Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I normally use \usepackage[utf8]{inputenc} for my latex document but on this site i saw a lot of code with \usepackage[utf8x]{inputenc}.

What are the differences between the 2 options ?

Is there one of the option obsolete and which one should I use ?

share|improve this question
add comment

4 Answers

up vote 57 down vote accepted

The simple answer is that utf8x is to be avoided if possible. It loads the ucs package, which for a long time was unmaintained (although there is now a new maintainer) and breaks various other things.

The best way to deal with unicode source (especially with non-latin scripts) is really XeLaTeX or LuaLaTeX.

There's an extended discussion of this here: Encoding remarks. See especially the comments by Philipp Lehman and Philipp Stephani.

share|improve this answer
In some case utf8 breaks some things too when utf8x is fine. I work only with utf8 and utf8x and I don't remember why but after working with utf8 and some problems, now I work with utf8x. I agree with you about XeLaTeX or LuaLaTeX but some users need to work again with pdflatex. –  Alain Matthes Mar 9 '11 at 18:39
usually I use LuaLaTeX, but for some stuff I don't have choice to use pdfLaTeX –  Matsaya Mar 9 '11 at 19:58
The link to "encoding remarks" above seems to be broken, and I can't seem to find the right object. Does anyone know how to relocate this (apparently important) discussion? –  acr Jan 18 '13 at 13:33
@acr I've fixed the broken link. Thanks for pointing it out. –  Alan Munn Jan 18 '13 at 17:18
add comment

In fact, utf8 may not be as restrictive as it seems: it only loads characters that can be displayed by the font encoding.

When typing


the font encoding is still OT1 when loading inputenc, which has very few characters. By using


you will allow all displayable utf8 characters to be available as input.

share|improve this answer
I think I am blind but I see no difference between those two lines... Except for what seems to be a typo in "userpackage" –  drozzy Mar 4 '12 at 22:01
@drozzy, the difference is the order of the commands. –  maxschlepzig Jun 24 '12 at 16:08
add comment

"The simple answer is that utf8x is to be avoided if possible." Yes and No. No it's not so simple utf8x is sometimes necessary when you need to write greek or some special symbols. Yes utf8x is for a long time was unmaintained but we can use it. Try to compile the next code with utf8





This is english
\textgreek{Τηις ις γρεεκ}
This is english again.


enter image description here

share|improve this answer
utfx is not necessary for greek. utf8 is extensible: You need a lgrenc.dfu to get the definition for greek then utf8 will work fine. lgrenc.dfu can be found on the net (e.g. in the latex bug database if I remember it correctly). –  Ulrike Fischer Mar 9 '11 at 18:50
@Ulrike: Thanks Ulrike, I don't know 'lgrenc.dfu' ! Is it recent ? Josselin Noirel writes something about "mem.sty" but I think this package disappears. \usepackage[charset=utf8,greek,english]{mem} –  Alain Matthes Mar 9 '11 at 19:06
@Ulrike: Why lgrenc.dfu is not in TeXLive ? and I read : Based on a babel patch by Werner Lemberg, with input from the ucs package (ucsencs.def) by Dominique Unruh and CB.enc by Apostolos Syropoulos. So there is a part from ucs ! –  Alain Matthes Mar 9 '11 at 19:56
I have no idea why it never found its way to CTAN. But it is not part of ucs, it only reused some (or a lot) definitions from it (writing all this long list which maps a input char to a command is a lot work). lgrenc.dfu is quite similar to standard lists like t1enc.dfu and utf8enc.def which are part of basic latex/inputenc+utf8. –  Ulrike Fischer Mar 9 '11 at 20:31
In TeX Live 2012 one can say \usepackage[LGRx,T1]{fontenc} and then \usepackage[utf8]{inputenc} will enable direct usage of Greek characters. –  egreg Jan 18 '13 at 17:30
show 1 more comment

I've had the experience of not being able to compile Hebrew with utf8, only with utf8x, using pdflatex in MikTeX (e.g. 2.9). Many guides on writing Hebrew LaTeX suggest using utf8x:

This is not to contradict what the learned sages say above, it's just an example of a case in which it seems to be impossible to avoid (unless someone suggests a way like Ulrike's suggesting regarding Greek).

Note: This answer is only relevant to pdfTeX+Babel, not XeTeX+Polyglossia.

share|improve this answer
Frankly, if you are working with Hebrew, you should really be using XeLaTeX and the bidi package. –  Alan Munn Sep 23 '11 at 13:25
Well, I was talking in the past tense... although, frankly, I haven't made the switch yet. Still find it important to mention it here, as people looking up the difference between the two options will probably hit this question. –  einpoklum Sep 29 '11 at 15:03
XeLaTeX must have been a great improvement for people writing in Hebrew. I don't think the incompatibility between babel with the hebrew option and amsthm was ever fixed (I don't write Hebrew myself, so I never bothered to check) –  kahen Nov 8 '11 at 1:29
@kahen: It's true fundamentally, but the package support is still lacking - even more with XeLaTeX+polyglossia than with pdfLaTeX+babel. –  einpoklum Dec 13 '13 at 11:03
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.