![! 程序包 inputenc 错误:Unicode 字符 \u8:äöü 未设置为用于 Latex - 我的 latex 坏了吗](https://linux22.com/image/264385/!%20%E7%A8%8B%E5%BA%8F%E5%8C%85%20inputenc%20%E9%94%99%E8%AF%AF%EF%BC%9AUnicode%20%E5%AD%97%E7%AC%A6%20%5Cu8%3A%C3%A4%C3%B6%C3%BC%20%E6%9C%AA%E8%AE%BE%E7%BD%AE%E4%B8%BA%E7%94%A8%E4%BA%8E%20Latex%20-%20%E6%88%91%E7%9A%84%20latex%20%E5%9D%8F%E4%BA%86%E5%90%97%20.png)
当尝试使用 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
......)