我偶然发现我的文本(UTF-8 编码,包含德语特殊字符 ä、ö、ü、ß)编译时没有错误,尽管我忘记了 inputenc(\usepackage[utf8]{inputenc})。
这是一个最小的例子,其中特殊字符“ö”正确地放置在 PDF 文档中。
\documentclass{scrartcl}
\begin{document}
Heute ist ein schöner Tag.
\end{document}
怎么会这样?这是我的日志文件
>pdflatex text.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (MiKTeX 21.1)
entering extended mode
(text.tex
LaTeX2e <2020-10-01> patch level 4
L3 programming layer <2021-01-09> xparse <2020-03-03>
("C:\Program Files\MiKTeX\tex/latex/koma-script\scrartcl.cls"
Document Class: scrartcl 2020/09/21 v3.32 KOMA-Script document class (article)
("C:\Program Files\MiKTeX\tex/latex/koma-script\scrkbase.sty"
("C:\Program Files\MiKTeX\tex/latex/koma-script\scrbase.sty"
("C:\Program Files\MiKTeX\tex/latex/koma-script\scrlfile.sty"
("C:\Program Files\MiKTeX\tex/latex/koma-script\scrlfile-hook.sty"
("C:\Program Files\MiKTeX\tex/latex/koma-script\scrlogo.sty")))
("C:\Program Files\MiKTeX\tex/latex/graphics\keyval.sty")))
("C:\Program Files\MiKTeX\tex/latex/koma-script\tocbasic.sty")
("C:\Program Files\MiKTeX\tex/latex/koma-script\scrsize11pt.clo")
("C:\Program Files\MiKTeX\tex/latex/koma-script\typearea.sty"))
("C:\Program Files\MiKTeX\tex/latex/l3backend\l3backend-pdftex.def") (text.aux)
[1{C:/Users/USERNAME/AppData/Local/MiKTeX/pdftex/config/pdftex.map}] (text.aux) )<C
:/Program Files/MiKTeX/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on text.pdf (1 page, 14015 bytes).
Transcript written on text.log.
答案1
[utf8]{inputenc}
几年来,UTF-8 一直是默认设置(基本上是通过内置的)。自 2018 年初 LaTeX 发布以来,请参阅ltnews 第 28 期