17
votes

First of all, what's the difference between utf8 and utf8x in

\usepackage[utf8]{inputenc}
\usepackage[utf8x]{inputenc}

when used in LaTeX?

Secondly, what packages are required when writing an article in Icelandic using LaTeX? I found:

\usepackage[icelandic]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8x]{inputenc}

after experimenting a bit but I have a feeling some part of the code may be redundant. And even with them the aforementioned packages, the code inside

\begin{lstlisting}
...
\end{lstlisting}

isn't rendered with Icelandic characters when outputted through pdflatex in Ubuntu, although it works on my friend's computer (who's running Debian). What's missing?

1
Is the input document actually written in UTF-8?jalf
if your fonts aren't working properly, try xetex or xelatex.Mica
All of the fonts work using the packages I mentioned- except for the text in the <code>lstlisting</code>Iceland_jack
Regarding the suggestion to close this question and move it to superuser.com, there's a fairly established standard, now, of asking LaTeX questions here. Could split them into programming-related LaTeX questions here and user-level questions there, but not much point IMO.Will Robertson

1 Answers

18
votes

[UTF8] is "supported" by the LaTeX team and covers a fairly specific/limited range of unicode input characters. It only defines those symbols that are known to be available with the current font encoding.

[UTF8x], AFAIK, is no longer supported, but covers a much broader range of input symbols. I would recommend only trying it if [UTF8] doesn't do what you need.


Secondly, the listings package (and most other related packages that do character scanning) does not support UTF8 input. (If it's working on a friend's machine they must be using an 8-bit input encoding instead.) The listingsutf8 package provides a UTF8-compatible replacement for \lstinputlisting but not for the main lstlisting environment. Using XeLaTeX might help you here, however.