cleveref、autonum 和标签仅引用方程式

cleveref、autonum 和标签仅引用方程式

用户 建议我使用新autonum包来回复我的询问。但是,我在让该包工作时遇到了一些困难。这是一个使用“未定义引用”进行编译的最小工作示例:

\documentclass{article}
\usepackage{amsmath, cleveref}
\usepackage{autonum}

\begin{document}
\begin{align}\label{eq:eq1}
a = b+c
\end{align}
Refer to equation \cref{eq:eq1}.
\end{document}

我认为我没有正确使用这个包,但我不确定我到底做错了什么。

另外,这里是 LaTeX=>PDF 编译的文件列表。

 *File List*
 article.cls    2007/10/19 v1.4h Standard LaTeX document class
  size10.clo    2007/10/19 v1.4h Standard LaTeX file (size option)
 amsmath.sty    2000/07/18 v2.13 AMS math features
 amstext.sty    2000/06/29 v2.01
  amsgen.sty    1999/11/30 v2.0
  amsbsy.sty    1999/11/29 v1.2d
  amsopn.sty    1999/12/14 v2.01 operator names
cleveref.sty    2011/01/19 v0.17.8 Intelligent cross-referencing
 autonum.sty    2012/06/21 v0.2 autonum LaTeX package
etoolbox.sty    2011/01/03 v2.1 e-TeX tools for LaTeX
    etex.sty    1998/03/26 v2.0 eTeX basic definition package (PEB)
 textpos.sty    2012/06/01 v1.7h
everyshi.sty    2001/05/15 v3.00 EveryShipout Package (MS)
 ***********

.log 文件如下:

This is pdfTeX, Version 3.1415926-1.40.10 (MiKTeX 2.8) (preloaded format=pdflatex 2012.7.8)  8 JUL 2012 05:05
entering extended mode
**E:/programming/latex/minimal-examples/autonum.tex
(E:/programming/latex/minimal-examples/autonum.tex
LaTeX2e <2009/09/24>
Babel <v3.8l> and hyphenation patterns for english, dumylang, nohyphenation, ge
rman, ngerman, german-x-2009-06-19, ngerman-x-2009-06-19, french, loaded.
(E:\programfiles\MiKTeX2.8\tex\latex\base\article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(E:\programfiles\MiKTeX2.8\tex\latex\base\size10.clo
File: size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
)
\c@part=\count79
\c@section=\count80
\c@subsection=\count81
\c@subsubsection=\count82
\c@paragraph=\count83
\c@subparagraph=\count84
\c@figure=\count85
\c@table=\count86
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
(E:\programfiles\MiKTeX2.8\tex\latex\ams\math\amsmath.sty
Package: amsmath 2000/07/18 v2.13 AMS math features
\@mathmargin=\skip43

For additional information on amsmath, use the `?' option.
(E:\programfiles\MiKTeX2.8\tex\latex\ams\math\amstext.sty
Package: amstext 2000/06/29 v2.01

(E:\programfiles\MiKTeX2.8\tex\latex\ams\math\amsgen.sty
File: amsgen.sty 1999/11/30 v2.0
\@emptytoks=\toks14
\ex@=\dimen103
))
(E:\programfiles\MiKTeX2.8\tex\latex\ams\math\amsbsy.sty
Package: amsbsy 1999/11/29 v1.2d
\pmbraise@=\dimen104
)
(E:\programfiles\MiKTeX2.8\tex\latex\ams\math\amsopn.sty
Package: amsopn 1999/12/14 v2.01 operator names
)
\inf@bad=\count87
LaTeX Info: Redefining \frac on input line 211.
\uproot@=\count88
\leftroot@=\count89
LaTeX Info: Redefining \overline on input line 307.
\classnum@=\count90
\DOTSCASE@=\count91
LaTeX Info: Redefining \ldots on input line 379.
LaTeX Info: Redefining \dots on input line 382.
LaTeX Info: Redefining \cdots on input line 467.
\Mathstrutbox@=\box26
\strutbox@=\box27
\big@size=\dimen105
LaTeX Font Info:    Redeclaring font encoding OML on input line 567.
LaTeX Font Info:    Redeclaring font encoding OMS on input line 568.
\macc@depth=\count92
\c@MaxMatrixCols=\count93
\dotsspace@=\muskip10
\c@parentequation=\count94
\dspbrk@lvl=\count95
\tag@help=\toks15
\row@=\count96
\column@=\count97
\maxfields@=\count98
\andhelp@=\toks16
\eqnshift@=\dimen106
\alignsep@=\dimen107
\tagshift@=\dimen108
\tagwidth@=\dimen109
\totwidth@=\dimen110
\lineht@=\dimen111
\@envbody=\toks17
\multlinegap=\skip44
\multlinetaggap=\skip45
\mathdisplay@stack=\toks18
LaTeX Info: Redefining \[ on input line 2666.
LaTeX Info: Redefining \] on input line 2667.
)
(C:\Users\<User>\AppData\Roaming\MiKTeX\2.8\tex\latex\cleveref\cleveref.sty
Package: cleveref 2011/01/19 v0.17.8 Intelligent cross-referencing
Package cleveref Info: loaded `english' language definitions on input line 5263
.
)
(C:\Users\<User>\AppData\Roaming\MiKTeX\2.8\tex\latex\autonum\autonum.sty
Package: autonum 2012/06/21 v0.2 autonum LaTeX package

(C:\Users\<User>\AppData\Roaming\MiKTeX\2.8\tex\latex\etoolbox\etoolbox.sty
Package: etoolbox 2011/01/03 v2.1 e-TeX tools for LaTeX

(E:\programfiles\MiKTeX2.8\tex\latex\misc\etex.sty
Package: etex 1998/03/26 v2.0 eTeX basic definition package (PEB)
\et@xins=\count99
)
\etb@tempcnta=\count100
)
(C:\Users\<User>\AppData\Roaming\MiKTeX\2.8\tex\latex\textpos\textpos.sty
Package: textpos 2012/06/01 v1.7h

Package: textpos 2012/06/01 1.7h, absolute positioning of text on the page
(C:\Users\<User>\AppData\Roaming\MiKTeX\2.8\tex\latex\ms\everyshi.sty
Package: everyshi 2001/05/15 v3.00 EveryShipout Package (MS)
)
\TP@textbox=\box28
\TP@holdbox=\box29
\TPHorizModule=\dimen112
\TPVertModule=\dimen113
\TP@margin=\dimen114
\TP@absmargin=\dimen115

Grid set 16 x 16 = 38.39343pt x 49.68562pt
\TPboxrulesize=\dimen116
\TP@ox=\dimen117
\TP@oy=\dimen118
\TP@tbargs=\toks19
\TP@prevdepth=\dimen119
TextBlockOrigin set to 0pt x 0pt
)
\c@autonum@counter=\count101
) (E:\programming\latex\minimal-examples\autonum.aux)
LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 5.
LaTeX Font Info:    ... okay on input line 5.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 5.
LaTeX Font Info:    ... okay on input line 5.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 5.
LaTeX Font Info:    ... okay on input line 5.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 5.
LaTeX Font Info:    ... okay on input line 5.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 5.
LaTeX Font Info:    ... okay on input line 5.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 5.
LaTeX Font Info:    ... okay on input line 5.

ABD: EveryShipout initializing macros
Underfull \hbox (badness 10000) detected at line 5
 []$[]    $ 
 []


LaTeX Warning: Reference `eq:eq1' on page 1 undefined on input line 10.

[1

{C:/Users/<User>/AppData/Local/MiKTeX/2.8/pdftex/config/pdftex.map}]
(E:\programming\latex\minimal-examples\autonum.aux)

 *File List*
 article.cls    2007/10/19 v1.4h Standard LaTeX document class
  size10.clo    2007/10/19 v1.4h Standard LaTeX file (size option)
 amsmath.sty    2000/07/18 v2.13 AMS math features
 amstext.sty    2000/06/29 v2.01
  amsgen.sty    1999/11/30 v2.0
  amsbsy.sty    1999/11/29 v1.2d
  amsopn.sty    1999/12/14 v2.01 operator names
cleveref.sty    2011/01/19 v0.17.8 Intelligent cross-referencing
 autonum.sty    2012/06/21 v0.2 autonum LaTeX package
etoolbox.sty    2011/01/03 v2.1 e-TeX tools for LaTeX
    etex.sty    1998/03/26 v2.0 eTeX basic definition package (PEB)
 textpos.sty    2012/06/01 v1.7h
everyshi.sty    2001/05/15 v3.00 EveryShipout Package (MS)
 ***********


LaTeX Warning: There were undefined references.

 ) 
Here is how much of TeX's memory you used:
 2606 strings out of 495285
 44952 string characters out of 3180519
 139985 words of memory out of 3000000
 5849 multiletter control sequences out of 15000+200000
 4402 words of font info for 17 fonts, out of 3000000 for 9000
 14 hyphenation exceptions out of 8191
 30i,9n,31p,841b,210s stack positions out of 5000i,500n,10000p,200000b,50000s
<E:/programfiles/MiKTeX2.8/fonts/type1/public/amsfonts/cm/cmbx10.pfb><E:/prog
ramfiles/MiKTeX2.8/fonts/type1/public/amsfonts/cm/cmmi10.pfb><E:/programfiles/M
iKTeX2.8/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on autonum.pdf (1 page, 30636 bytes).
PDF statistics:
 18 PDF objects out of 1000 (max. 8388607)
 0 named destinations out of 1000 (max. 500000)
 1 words of extra memory for PDF output out of 10000 (max. 10000000)

答案1

在当前版本中,autonum 包不再支持标签名称中的特殊字符。因此,冒号或数字等字符目前是不允许的,必须进行更改。

技术原因是,当引用方程式时,标签名称用作新创建的命令的一部分。此命令保存到辅助文件中,如果辅助文件中有此命令,则在下次运行期间标签会获得一个数字。由于命令名称不能包含特殊字符,因此会出现观察到的限制。

我想我必须提出一个单独的问题来更好地解决这个问题,因为它超出了我的 TeX 知识。

更新:如果命令名称包含特殊字符,则正确创建

更新 2:有一个新版本可用,修复错误。

更新 3:版本 0.3.6 应该可以一劳永逸地修复该错误。不幸的是,测试套件未涵盖回归问题。

答案2

cleveref除了之前的答案之外,在和之间仍然存在一个autonum涉及的错误\Cref

\documentclass{article}
\usepackage{amsmath, cleveref}
\usepackage{autonum}

\begin{document}
\begin{align}\label{eq:eq1}
a = b+c
\end{align}
Refer to equation \cref{eq:eq1}. % This works fine post bug-fix.
\Cref{eq:eq1} is a great equation. % This gives "reference undefined"

\结束{文档}

相关内容