Tell me more ×
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 have the following LaTeX document:

\documentclass{article}
\usepackage[utf8]{inputenc}
\begin{document}
φΔδ汉
\end{document}

But I get the following error:

$ latex foo
This is pdfTeX, Version 3.1415926-1.40.11 (TeX Live 2010)
restricted \write18 enabled.
[...]
! Package inputenc Error: Unicode char \u8:φ not set up for use with LaTeX.

How can I use these and other UTF-8 characters?

Note: This and this look like duplicates but they are slightly different and don't answer my question.

share|improve this question

3 Answers

up vote 11 down vote accepted

The inputenc package, even with the utf8 option doesn't load all the Unicode tables. It loads only those for which it knows it will have to typeset some glyphs.

You have then to teach the proper environment, because each Unicode block requires a different TeX fonts (they have only 256 characters).

So your example works with pdflatex, but modified into the following code.

\documentclass{article}
\usepackage[LGRx,T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[greek,english]{babel}
\usepackage{CJKutf8}
\begin{document}

\foreignlanguage{greek}{φΔδ}\begin{CJK}{UTF8}{gbsn}汉\end{CJK}

\end{document}

This is admittedly largely impractical for extensive usage of characters belonging to different blocks, so it may be advisable to switch to XeLaTeX or LuaLaTeX that can use OpenType fonts.

enter image description here

share|improve this answer

utf8 for pdflatex has only a limited subset of Unicode. Use xelatex with

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Code2000}
\begin{document}
φΔδ汉
\end{document}

Code2000 can be replaced by another OpenType or TrueType font which has all that characters.

enter image description here

share|improve this answer

This error occurs when the tex editor file encoding and the document file encoding are not the same.

E.g. editor file encoding is ISO-8859-1, and the document has \usepackage[utf8]{inputenc} command. Change the editor file encoding to UTF-8, and restart the editor.

(It is possible that your editor refers to file encoding as font encoding. For details, see the comments.)

share|improve this answer
3  
Welcome to tex.sx! These aren't font encodings, but file encodings you're thinking of. – doncherry Nov 22 '12 at 18:28
Hello! Thank you, precisely so. (My editor refers to it as font encoding.) – NaMarPi Nov 22 '12 at 19:49
Then I would not trust that editor anymore ;). (Which one is it?) The thing is, there is a concept called font encodings in LaTeX, it's what you're dealing with when saying e.g. \usepackage[T1]{fontenc}. – doncherry Nov 22 '12 at 19:53
Texmaker. I am new here, and it is important to me to add correct answers. What is the etiquette here? Can I improve my answers after comments, or leave it as it is? – NaMarPi Nov 22 '12 at 20:07
It's definitely a good idea to edit your answer, possibly with a little note that the edit resulted from comments, but often that's not even necessary. Thanks for caring! (As for Texmaker: That's the editor I use as well. I'll file a bug report later.) – doncherry Nov 22 '12 at 20:23
show 1 more comment

Your Answer

 
discard

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.