将“caption”包与“thesis”类一起使用-未定义的控制序列

将“caption”包与“thesis”类一起使用-未定义的控制序列

我正在尝试编写我的博士论文。它以前(几个月左右)有用,但从那时起,事情发生了变化,因为我得到了一个

undefined control sequence

与以下相关的错误caption包裹。

我已将其全部精简为一个最小示例。不过,我保留了序言中的所有包声明。

\documentclass[a4paper,oneside]{thesis}
\usepackage[left=35mm,right=17mm,top=17mm,bottom=25mm,includehead,includefoot]{geometry}

\usepackage[pdftex]{graphicx}
\usepackage{epstopdf}
\newcommand{\ANGLE}{180}
\usepackage[usenames,dvipsnames]{color}

\usepackage[normal]{subfigure}
\setlength{\abovecaptionskip}{15pt} 
\usepackage{flafter}
\usepackage[section]{placeins} 
\usepackage[hang,small]{caption}
\usepackage{rotating}
\usepackage{enumerate}
\usepackage{array}
\usepackage{times}
\usepackage{amsmath,amsfonts,mathrsfs}
\usepackage{textcomp}
\usepackage{multirow}
\usepackage[round]{natbib}
\usepackage{hyperref}
\usepackage[version=3]{/home/qq002439/.tex/mhchem}


\begin{document}

\begin{figure}
\caption{figure}
\end{figure}

\end{document}

这就是我尝试使用 pdfLaTeX 编译的代码。以下是输出日志:

This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/openSUSE) 
entering extended mode

(./test.tex
LaTeX2e <2009/09/24>
Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, german-x-2009-06-19, ngerman-x-2009-06-19, ancientgreek, ibycus, ar
abic, basque, bulgarian, catalan, pinyin, coptic, croatian, czech, danish, dutc
h, esperanto, estonian, farsi, finnish, french, galician, german, ngerman, mono
greek, greek, hungarian, icelandic, indonesian, interlingua, irish, italian, ku
rmanji, latin, latvian, lithuanian, mongolian, mongolian2a, bokmal, nynorsk, po
lish, portuguese, romanian, russian, sanskrit, serbian, slovak, slovenian, span
ish, swedish, turkish, ukenglish, ukrainian, uppersorbian, welsh, loaded.
(/home/qq002439/.tex/thesis.cls
Document Class: thesis 2006/06/02 v0.1 User-refined LaTeX document class
(/usr/share/texmf/tex/latex/base/bk11.clo))
(/usr/share/texmf/tex/latex/geometry/geometry.sty
(/usr/share/texmf/tex/latex/graphics/keyval.sty)
(/usr/share/texmf/tex/generic/oberdiek/ifpdf.sty)
(/usr/share/texmf/tex/generic/oberdiek/ifvtex.sty))
(/usr/share/texmf/tex/latex/graphics/graphicx.sty
(/usr/share/texmf/tex/latex/graphics/graphics.sty
(/usr/share/texmf/tex/latex/graphics/trig.sty)
(/usr/share/texmf/tex/latex/latexconfig/graphics.cfg)
(/usr/share/texmf/tex/latex/pdftex-def/pdftex.def)))
(/usr/share/texmf/tex/latex/oberdiek/epstopdf.sty
(/usr/share/texmf/tex/latex/oberdiek/epstopdf-base.sty
(/usr/share/texmf/tex/generic/oberdiek/infwarerr.sty)
(/usr/share/texmf/tex/latex/oberdiek/grfext.sty)
(/usr/share/texmf/tex/latex/oberdiek/kvoptions.sty
(/usr/share/texmf/tex/generic/oberdiek/kvsetkeys.sty
(/usr/share/texmf/tex/generic/oberdiek/etexcmds.sty)))
(/usr/share/texmf/tex/generic/oberdiek/pdftexcmds.sty
(/usr/share/texmf/tex/generic/oberdiek/ifluatex.sty)
(/usr/share/texmf/tex/generic/oberdiek/ltxcmds.sty))

Package epstopdf Warning: Shell escape feature is not enabled.

(/usr/share/texmf/tex/latex/latexconfig/epstopdf-sys.cfg)))
(/usr/share/texmf/tex/latex/graphics/color.sty
(/usr/share/texmf/tex/latex/latexconfig/color.cfg)
(/usr/share/texmf/tex/latex/graphics/dvipsnam.def))
(/usr/share/texmf/tex/latex/subfigure/subfigure.sty
****************************************
* Local config file subfigure.cfg used *
****************************************
(/usr/share/texmf/tex/latex/subfigure/subfigure.cfg))
(/usr/share/texmf/tex/latex/base/flafter.sty)
(/usr/share/texmf/tex/latex/placeins/placeins.sty)
(/usr/share/texmf/tex/latex/caption/caption.sty
(/usr/share/texmf/tex/latex/caption/caption3.sty))
(/usr/share/texmf/tex/latex/rotating/rotating.sty
(/usr/share/texmf/tex/latex/base/ifthen.sty))
(/usr/share/texmf/tex/latex/tools/enumerate.sty)
(/usr/share/texmf/tex/latex/tools/array.sty)
(/usr/share/texmf/tex/latex/psnfss/times.sty)
(/usr/share/texmf/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/share/texmf/tex/latex/amsmath/amstext.sty
(/usr/share/texmf/tex/latex/amsmath/amsgen.sty))
(/usr/share/texmf/tex/latex/amsmath/amsbsy.sty)
(/usr/share/texmf/tex/latex/amsmath/amsopn.sty))
(/usr/share/texmf/tex/latex/amsfonts/amsfonts.sty)
(/usr/share/texmf/tex/latex/jknapltx/mathrsfs.sty)
(/usr/share/texmf/tex/latex/base/textcomp.sty
(/usr/share/texmf/tex/latex/base/ts1enc.def))
(/usr/share/texmf/tex/latex/multirow/multirow.sty)
(/usr/share/texmf/tex/latex/natbib/natbib.sty)
(/usr/share/texmf/tex/latex/hyperref/hyperref.sty
(/usr/share/texmf/tex/generic/ifxetex/ifxetex.sty)
(/usr/share/texmf/tex/latex/oberdiek/hycolor.sty
(/usr/share/texmf/tex/latex/oberdiek/xcolor-patch.sty))
(/usr/share/texmf/tex/latex/hyperref/pd1enc.def)
(/usr/share/texmf/tex/latex/latexconfig/hyperref.cfg)
Implicit mode ON; LaTeX internals redefined
(/usr/share/texmf/tex/latex/ltxmisc/url.sty)
(/usr/share/texmf/tex/generic/oberdiek/bitset.sty
(/usr/share/texmf/tex/generic/oberdiek/intcalc.sty)
(/usr/share/texmf/tex/generic/oberdiek/bigintcalc.sty))
(/usr/share/texmf/tex/generic/oberdiek/atbegshi.sty))
*hyperref using default driver hpdftex*
(/usr/share/texmf/tex/latex/hyperref/hpdftex.def)
(/home/qq002439/.tex/mhchem.sty

LaTeX Warning: You have requested package `/home/qq002439/.tex/mhchem',
               but the package provides `mhchem'.

(/usr/share/texmf/tex/latex/tools/calc.sty)
(/usr/share/texmf/tex/latex/oberdiek/twoopt.sty)) (./test.aux)
(/usr/share/texmf/tex/latex/base/ts1cmr.fd)
(/usr/share/texmf/tex/latex/psnfss/ot1ptm.fd)
*geometry* driver: auto-detecting
*geometry* detected driver: pdftex
(/usr/share/texmf/tex/latex/hyperref/nameref.sty
(/usr/share/texmf/tex/latex/oberdiek/refcount.sty)) (./test.out) (./test.out)
! Undefined control sequence.
\captionlabelfont@default ->\cph@font 

l.30 \caption{figure}

? ! Undefined control sequence.
\captionlabelfont@default ->\cph@font 

l.30 \caption{figure}

? ! Undefined control sequence.
\captiontextfont@default ->\cpb@font 

l.30 \caption{figure}

? ! Undefined control sequence.
\captionlabelfont@default ->\cph@font 

l.30 \caption{figure}

? ! Undefined control sequence.
\captionlabelfont@default ->\cph@font 

l.30 \caption{figure}

? ! Undefined control sequence.
\captiontextfont@default ->\cpb@font 

l.30 \caption{figure}

? ! Undefined control sequence.
<argument> ...ngth {\baselineskip }{0pt}\@chapapp 
                                                  \ \thechapter \hspace {\st...
l.33 \end{document}

? [1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] (./test.aux) ){/usr/shar
e/texmf/fonts/enc/dvips/base/8r.enc}</usr/share/texmf/fonts/type1/urw/times/utm
r8a.pfb></usr/share/texmf/fonts/type1/urw/times/utmr8a.pfb>
Output written on test.pdf (1 page, 19428 bytes).
Transcript written on test.log.

正如您所看到的,它实际上写出了一个.pdf看起来不错的文件,但它完全搞乱了我的论文编写。有人对 LaTeX 新手如何解决这个问题有什么建议吗?

答案1

文档类别的检测thesishttp://www.ctan.org/pkg/thesis) 在软件包的早期非常幼稚,caption因为我不知道还会调用其他文档类thesis。这个问题已于 2009/11/15 修复,因此您的caption软件包似乎比这更老,而且您偶然发现了一个 3 年前就已解决的问题。

如果无法更新 TeX 发行版,您可以尝试重命名文档类(例如,重命名为mythesis或其他名称thesis),或者尝试caption使用自己的labelfont=textfont=设置加载包,例如

\usepackage[hang,small,labelfont=,textfont=]{caption}

这将覆盖对 CTAN文档类的labelfont和支持,从而删除对和(CTAN-文档类的内部命令)的支持。textfontthesis\cph@font\cpb@fontthesis

顺便说一句:该subfigure包不应用于新文档,它仅可用于使旧文档仍可编译。

相关内容