我最近在我的 MacBook(运行 MacOS X 10.6.8)上安装了 TeXLive 2011,出现了以下问题:
例子:
\documentclass[11pt, a4paper]{scrbook}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage[TS1, T1]{fontenc}
\usepackage{aecompl}
\usepackage{textcomp}
\usepackage[ngerman]{babel}
\usepackage{xspace}
\usepackage[tight]{units}
\usepackage{varwidth}
\usepackage{xcolor}
\usepackage{amsmath}
\usepackage{siunitx}
%\usepackage[round-mode=places, round-integer-to-decimal, round-precision=2,
% table-format = 1.2,
% table-number-alignment=center,
% output-decimal-marker={,},
% group-digits=false
% ]{siunitx}
\newcommand{\FZ}[1]{\ensuremath{\textcolor{blue}{#1}}\xspace}
\newcommand{\ps}{\FZ{p_{\mathrm{s}}}}
\begin{document}
\listoffigures
\begin{figure}
\rule{5cm}{5cm}
\caption{effect of \ps on $p_{\mathrm{s}}$}
\end{figure}
\rule{1pt}{5cm}
effect of \ps on $p_{\mathrm{s}}$ -- here it works
\end{document}
使用 TeXLive 2010 编译没有问题。
使用 TeXLive 2011 后,第二次运行 pdflatex 后出现以下错误消息:
(./FehlerTeX2011.lof ./FehlerTeX2011.lof:2: Undefined control
sequence. <argument> ... 0.1}{\ignorespaces effect of \pson
$p_{\mathrm {s}}$} l.2 ...aces effect of \pson $p_{\mathrm {s}}$}}{1}
\ps
自定义命令、siunitx
包和图表列表似乎存在问题,因为错误可能是避免
- 通过停用
siunitx
- 或通过
\ps*{}*
在标题中用括号排版 - 或删除图片列表
- 或者使用 TeXLive 2010
(幸运的是,在 OS X 中有一种方法可以轻松地在不同的 TeX 安装之间切换)
有人能帮忙告诉我出了什么问题吗?
这是使用的软件包版本的完整日志文件:
This is pdfTeX, Version 3.1415926-2.3-1.40.12 (TeX Live 2011)
\write18 enabled.
entering extended mode
(./FehlerTeX2011.tex
LaTeX2e <2011/06/27>
Babel <v3.8m> and hyphenation patterns for english, dumylang, nohyphenation, ge
rman-x-2011-07-01, ngerman-x-2011-07-01, 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, galician, german, ngerman, swissgerman, monogreek, greek, hungarian,
icelandic, assamese, bengali, gujarati, hindi, kannada, malayalam, marathi, or
iya, panjabi, tamil, telugu, indonesian, interlingua, irish, italian, kurmanji,
lao, latin, latvian, lithuanian, mongolian, mongolianlmc, bokmal, nynorsk, pol
ish, portuguese, romanian, russian, sanskrit, serbian, serbianc, slovak, sloven
ian, spanish, swedish, turkish, turkmen, ukrainian, uppersorbian, welsh, loaded
.
(/usr/local/texlive/2011/texmf-dist/tex/latex/koma-script/scrbook.cls
Document Class: scrbook 2011/06/16 v3.09a KOMA-Script document class (book)
(/usr/local/texlive/2011/texmf-dist/tex/latex/koma-script/scrkbase.sty
(/usr/local/texlive/2011/texmf-dist/tex/latex/koma-script/scrbase.sty
(/usr/local/texlive/2011/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/koma-script/scrlfile.sty
Package scrlfile, 2011/03/09 v3.09 KOMA-Script package (loading files)
Copyright (C) Markus Kohm
))) (/usr/local/texlive/2011/texmf-dist/tex/latex/koma-script/tocbasic.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/koma-script/scrsize11pt.clo)
(/usr/local/texlive/2011/texmf-dist/tex/latex/koma-script/typearea.sty
Package typearea, 2011/06/16 v3.09a KOMA-Script package (type area)
Copyright (C) Frank Neukam, 1992-1994
Copyright (C) Markus Kohm, 1994-
)) (/usr/local/texlive/2011/texmf-dist/tex/generic/babel/babel.sty
(/usr/local/texlive/2011/texmf-dist/tex/generic/babel/ngermanb.ldf
(/usr/local/texlive/2011/texmf-dist/tex/generic/babel/babel.def)))
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/inputenc.sty
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/utf8.def
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/t1enc.dfu)
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/ot1enc.dfu)
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/omsenc.dfu)))
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/fontenc.sty
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/ts1enc.def
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/ts1enc.dfu))
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/t1enc.def))
(/usr/local/texlive/2011/texmf-dist/tex/latex/ae/aecompl.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/textcomp.sty
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/ts1enc.def))
(/usr/local/texlive/2011/texmf-dist/tex/latex/tools/xspace.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/units/units.sty
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/ifthen.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/units/nicefrac.sty))
(/usr/local/texlive/2011/texmf-dist/tex/latex/varwidth/varwidth.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/xcolor/xcolor.sty
(/usr/local/texlive/2011/texmf-dist/tex/latex/latexconfig/color.cfg)
(/usr/local/texlive/2011/texmf-dist/tex/latex/pdftex-def/pdftex.def
(/usr/local/texlive/2011/texmf-dist/tex/generic/oberdiek/infwarerr.sty)
(/usr/local/texlive/2011/texmf-dist/tex/generic/oberdiek/ltxcmds.sty)))
(/usr/local/texlive/2011/texmf-dist/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/local/texlive/2011/texmf-dist/tex/latex/amsmath/amstext.sty
(/usr/local/texlive/2011/texmf-dist/tex/latex/amsmath/amsgen.sty))
(/usr/local/texlive/2011/texmf-dist/tex/latex/amsmath/amsbsy.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/amsmath/amsopn.sty))
(/usr/local/texlive/2011/texmf-dist/tex/latex/siunitx/siunitx.sty
(/usr/local/texlive/2011/texmf-dist/tex/latex/l3kernel/expl3.sty
(/usr/local/texlive/2011/texmf-dist/tex/latex/l3kernel/l3names.sty
(/usr/local/texlive/2011/texmf-dist/tex/latex/l3kernel/l3bootstrap.sty))
(/usr/local/texlive/2011/texmf-dist/tex/latex/etex-pkg/etex.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/tools/calc.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/local/texlive/2011/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/latexconfig/graphics.cfg))
(/usr/local/texlive/2011/texmf-dist/tex/latex/l3kernel/l3basics.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/l3kernel/l3expan.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/l3kernel/l3tl.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/l3kernel/l3seq.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/l3kernel/l3int.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/l3kernel/l3quark.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/l3kernel/l3prg.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/l3kernel/l3clist.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/l3kernel/l3token.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/l3kernel/l3prop.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/l3kernel/l3msg.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/l3kernel/l3io.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/l3kernel/l3file.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/l3kernel/l3skip.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/l3kernel/l3keys.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/l3kernel/l3fp.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/l3kernel/l3box.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/l3kernel/l3coffins.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/l3kernel/l3color.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/l3kernel/l3luatex.sty))
(/usr/local/texlive/2011/texmf-dist/tex/latex/tools/array.sty)
(/usr/local/texlive/2011/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty
(/usr/local/texlive/2011/texmf-dist/tex/latex/l3packages/xparse/xparse.sty))
(/usr/local/texlive/2011/texmf-dist/tex/latex/beamer/translator/translator.sty
(/usr/local/texlive/2011/texmf-dist/tex/latex/beamer/translator/translator-lang
uage-mappings.tex))) (./FehlerTeX2011.aux)
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/ts1cmr.fd)
(/usr/local/texlive/2011/texmf-dist/tex/context/base/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
) (/usr/local/texlive/2011/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty
(/usr/local/texlive/2011/texmf-dist/tex/generic/oberdiek/ifluatex.sty)
(/usr/local/texlive/2011/texmf-dist/tex/generic/oberdiek/ifpdf.sty))
(/usr/local/texlive/2011/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty
(/usr/local/texlive/2011/texmf-dist/tex/latex/oberdiek/grfext.sty
(/usr/local/texlive/2011/texmf-dist/tex/generic/oberdiek/kvdefinekeys.sty))
(/usr/local/texlive/2011/texmf-dist/tex/latex/oberdiek/kvoptions.sty
(/usr/local/texlive/2011/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty
(/usr/local/texlive/2011/texmf-dist/tex/generic/oberdiek/etexcmds.sty)))
(/usr/local/texlive/2011/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg))
(/usr/local/texlive/2011/texmf-dist/tex/latex/beamer/translator/dicts/translato
r-basic-dictionary/translator-basic-dictionary-English.dict)
(/usr/local/texlive/2011/texmf-dist/tex/latex/siunitx/config/siunitx-abbreviati
ons.cfg)
(/usr/local/texlive/2011/texmf-dist/tex/latex/siunitx/config/siunitx-binary.cfg
) (/usr/local/texlive/2011/texmf-dist/tex/latex/base/t1cmss.fd)
(./FehlerTeX2011.lof
答案1
发生这种情况是因为在标准设置中将siunitx
定义\ps
为缩写。现在,大多数情况下您不会看到任何效果,但这里发生的是,LaTeX 用于将信息写入\caption
文件的过程需要进行一些修改.lof
。在此过程中,siunitx
会创建\ps
一个受保护的命令,这几乎总是透明的。问题之所以出现,是因为您决定以基于 - 的方式使用它,xspace
并且没有后续参数。
第一个解决方案是在后面包含一个参数\ps
:
\documentclass{article}
\usepackage{siunitx,xspace}
\newcommand{\ps}{\ensuremath{p_{\mathrm{s}}}\xspace}
\begin{document}
\listoffigures
\begin{figure}
\caption{effect of \ps{} on $p_{\mathrm{s}}$}
\end{figure}
\end{document}
第二个是告诉siunitx
不要定义任何缩写单位:
\documentclass{article}
\usepackage{siunitx,xspace}
\sisetup{abbreviations = false}
\newcommand{\ps}{\ensuremath{p_{\mathrm{s}}}\xspace}
\begin{document}
\listoffigures
\begin{figure}
\caption{effect of \ps on $p_{\mathrm{s}}$}
\end{figure}
\end{document}
(在两种情况下我都已将您的示例缩减到最少。)
自 TeX Live 2010 版本以来,您已经看到了变化,因为siunitx
现在默认定义缩写:旧设置是仅在请求时才执行此操作,但总的来说,对于大多数人来说,从一开始就将此设置“开启”更有意义。
答案2
我可以在 TeX Live 2011 上进行编译,没有任何问题。
.lof 文件中似乎丢失了一个空格,因为编译器抱怨 是\pson
未知的,而您写的\ps on
。因此,您可以在 之后使用{}
或,甚至可以在命令的定义中直接使用,或者尝试不使用因为不能保证在所有情况下都能正常工作。\space
\ps
\xspace
\xspace
\xspace
此外,由于问题似乎出现在您的系统中,与图片列表有关,因此您可以
保护
\ps
宏:\caption{effect of \protect\ps on $p_{\mathrm{s}}$}
或者将其声明为强命令:
\DeclareRobustCommand{\ps}{\FZ{p_{\mathrm{s}}}}