当尝试使用 xelatex 编译以下文档时:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[german]{babel}
\begin{document}
äöüÄÖÜ
\end{document}
我收到此错误(抱歉粘贴了这么长的内容):
This is XeTeX, Version 3.1415926-2.4-0.9998 (TeX Live 2012/Debian)
restricted \write18 enabled.
entering extended mode
(./umlauts.tex
LaTeX2e <2011/06/27>
Babel <v3.8m> and hyphenation patterns for english, dumylang, nohyphenation, et
hiopic, farsi, arabic, pinyin, croatian, bulgarian, ukrainian, russian, slovak,
czech, danish, dutch, usenglishmax, ukenglish, finnish, french, basque, ngerma
n, german, swissgerman, ngerman-x-2012-05-30, german-x-2012-05-30, monogreek, g
reek, ibycus, ancientgreek, hungarian, bengali, tamil, hindi, telugu, gujarati,
sanskrit, malayalam, kannada, assamese, marathi, oriya, panjabi, italian, lati
n, latvian, lithuanian, mongolian, mongolianlmc, nynorsk, bokmal, indonesian, e
speranto, coptic, welsh, irish, interlingua, serbian, serbianc, slovenian, friu
lan, romansh, estonian, romanian, armenian, uppersorbian, turkish, afrikaans, i
celandic, kurmanji, polish, portuguese, galician, catalan, spanish, swedish, th
ai, loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo))
(/usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty
(/usr/share/texlive/texmf-dist/tex/latex/base/utf8.def
(/usr/share/texlive/texmf-dist/tex/latex/base/t1enc.dfu)
(/usr/share/texlive/texmf-dist/tex/latex/base/ot1enc.dfu)
(/usr/share/texlive/texmf-dist/tex/latex/base/omsenc.dfu)))
(/usr/share/texlive/texmf-dist/tex/latex/base/fontenc.sty
(/usr/share/texlive/texmf-dist/tex/latex/base/t1enc.def))
(/var/lib/texmf/tex/generic/babel/babel.sty
(/usr/share/texlive/texmf-dist/tex/generic/babel/germanb.ldf
(/usr/share/texlive/texmf-dist/tex/generic/babel/babel.def))) (./umlauts.aux)
! Package inputenc Error: Unicode char \u8:äöü not set up for use with LaTeX
.
See the inputenc package documentation for explanation.
Type H <return> for immediate help.
...
l.9 äöü
ÄÖÜ
?
! Package inputenc Error: Unicode char \u8:ÄÖ not set up for use with LaTeX.
See the inputenc package documentation for explanation.
Type H <return> for immediate help.
...
l.9 äöüÄÖ
Ü
?
Runaway argument?
! Paragraph ended before \UTFviii@two@octets was complete.
<to be read again>
\par
l.10
?
(./umlauts.aux) )
No pages of output.
Transcript written on umlauts.log.
但该文件是utf-8编码的:
$ file -i umlauts.tex
umlauts.tex: text/x-tex; charset=utf-8
我不明白我做错了什么。我的 latex 坏了吗?我正在使用 Ubuntu 12.10 存储库中的 Texlive。
答案1
我自己使用
\usepackage[T1]{fontenc}
\usepackage[utf8x]{inputenc}
也许这对你也有用?(也就是说,我使用 pdflatex 而不是XeTeX
......)