我最近在将letter
文档类与包magyar
的语言选项组合时遇到了麻烦babel
。奇怪的是,上次我不得不使用这种组合时(大约半年前),它没有任何问题。举个例子,即使是以下代码目前也无法在我的计算机上编译:
\documentclass{letter}
\usepackage[magyar]{babel}
\begin{document}
\begin{letter}{}
Lorem ipsum.
\end{letter}
\end{document}
你们中有人遇到过这个问题吗?我在 Mac OS X 10.6 上使用 TeX Live 2012。我用 TeX Live Manager 更新了所有软件包,但这也没有解决问题。
有任何想法吗?
非常感谢你的帮助,
Ádám
编辑:这是我在上面的代码上运行 LaTeX 时得到的结果(再次编辑以获取文件列表):
This is pdfTeX, Version 3.1415926-2.4-1.40.13 (TeX Live 2012)
restricted \write18 enabled.
entering extended mode
(./Lorem Ipsum.tex
LaTeX2e <2011/06/27>
Babel <v3.8m> and hyphenation patterns for english, dumylang, nohyphenation, ge
rman-x-2012-05-30, ngerman-x-2012-05-30, afrikaans, ancientgreek, ibycus, arabi
c, armenian, basque, bulgarian, catalan, pinyin, coptic, croatian, czech, danis
h, dutch, ukenglish, usenglishmax, esperanto, estonian, ethiopic, farsi, finnis
h, french, friulan, galician, german, ngerman, swissgerman, monogreek, greek, h
ungarian, icelandic, assamese, bengali, gujarati, hindi, kannada, malayalam, ma
rathi, oriya, panjabi, tamil, telugu, indonesian, interlingua, irish, italian,
kurmanji, latin, latvian, lithuanian, mongolian, mongolianlmc, bokmal, nynorsk,
piedmontese, polish, portuguese, romanian, romansh, russian, sanskrit, serbian
, serbianc, slovak, slovenian, spanish, swedish, turkish, turkmen, ukrainian, u
ppersorbian, welsh, loaded.
(/usr/local/texlive/2012/texmf-dist/tex/latex/base/letter.cls
Document Class: letter 1999/04/29 v1.2z Standard LaTeX document class
(/usr/local/texlive/2012/texmf-dist/tex/latex/base/size10.clo))
(/usr/local/texlive/2012/texmf-dist/tex/generic/babel/babel.sty
(/usr/local/texlive/2012/texmf-dist/tex/generic/babel/magyar.ldf
(/usr/local/texlive/2012/texmf-dist/tex/generic/babel/babel.def)))
No file "Lorem Ipsum".aux.
LaTeX Warning: Please use \usepackage{t1enc} with
\usepackage[magyar]{babel}, to get accented chars hyphenated.
LaTeX Warning: Please use \usepackage[latin2]{inputenc} with
\usepackage[magyar]{babel}.
(/usr/local/texlive/2012/texmf-dist/tex/latex/base/letter.cls
! LaTeX Error: Can be used only in preamble.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.181 \@onlypreamble
\makelabels
?
! LaTeX Error: Can be used only in preamble.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.181 \@onlypreamble\makelabels
?
) [1{/usr/local/texlive/2012/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
(./Lorem Ipsum.aux)
*File List*
letter.cls 1999/04/29 v1.2z Standard LaTeX document class
size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
babel.sty 2008/07/08 v3.8m The Babel package
magyar.ldf 2007/10/19 v1.5 Magyar support from the babel v3.7 system
***********
)</usr/local/texlive/2012/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on "Lorem Ipsum.pdf" (1 page, 12274 bytes).
SyncTeX written on "Lorem Ipsum.synctex.gz"
Transcript written on "Lorem Ipsum.log".
答案1
因此,使用 1.5 版。此样式由 Péter Szabó 直接维护。尝试
\def\magyarOptions{defaults=safest}
在加载之前babel
,然后阅读http://www.math.bme.hu/latex/其中一人解释说:“如果某个文档无法编译,但可以使用 进行编译defaults=safest
,则可以逐一打开各个选项,以查看是哪一个选项导致了兼容性问题。”
答案2
使用最新的版本magyar.ldf
即可起作用!!!
\documentclass{letter}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\PassOptionsToPackage{defaults=hu-min}{magyar.ldf}
\usepackage[magyar]{babel}
\begin{document}
\begin{letter}{}
Lorem ipsum.
\end{letter}
\end{document}