下面的代码
\documentclass[twocolumn]{autart}
\begin{document}
\begin{frontmatter}
\author[MyCity]{Mar\'{c}us}\ead{[email protected]},
\address[MyCity]{My University, My address, My City}
\begin{abstract}
Hello, abstract!
\end{abstract}
\end{frontmatter}
Hello, world!
\end{document}
产生几个与缺失/多余的花括号相关的错误
Latexmk: applying rule 'pdflatex'...
This is pdfTeX, Version 3.141592653-2.6-1.40.23 (MiKTeX 21.10)
entering extended mode
(d:/minimal_working_example/main.tex
LaTeX2e <2021-06-01> patch level 1
L3 programming layer <2021-10-18> (autart.cls
Document Class: autart 2001/03/28, 2.18pl1: Automatica
(C:\Users\Moon Raven\AppData\Local\Programs\MiKTeX\tex/latex/base\latexsym.sty) (C:\Users\Moon Raven\AppData\Local\Programs\MiKTeX\tex/latex/base\ulasy.fd)) (C:\Users\Moon Raven\AppData\Local\Programs\MiKTeX\tex/latex/l3backend\l3backend-pdftex.def) (main.aux)
LaTeX Warning: Reference `MyCity' on page 1 undefined on input line 4.
\protect
d:/minimal_working_example/main.tex:10: Missing } inserted.
<inserted text>
}
l.10 \end{frontmatter}
d:/minimal_working_example/main.tex:10: Missing } inserted.
<inserted text>
}
l.10 \end{frontmatter}
d:/minimal_working_example/main.tex:10: Missing } inserted.
<inserted text>
}
l.10 \end{frontmatter}
d:/minimal_working_example/main.tex:10: Missing } inserted.
<inserted text>
}
l.10 \end{frontmatter}
d:/minimal_working_example/main.tex:10: Too many }'s.
\@ead@au ...norespaces \relax \accent 19 c\egroup
\spacefactor \accent@space...
l.10 \end{frontmatter}
d:/minimal_working_example/main.tex:10: Extra \endgroup.
\color@endgroup ->\endgraf \endgroup
l.10 \end{frontmatter}
d:/minimal_working_example/main.tex:10: Too many }'s.
\@footnotetext ...strutbox }\par \color@endgroup }
l.10 \end{frontmatter}
d:/minimal_working_example/main.tex:10: Too many }'s.
\output@ead@text ... \csname #1@text\endcsname .}}
\fi
l.10 \end{frontmatter}
d:/minimal_working_example/main.tex:10: Too many }'s.
\output@glob@notes ... \the \t@glob@notes \egroup
l.10 \end{frontmatter}
d:/minimal_working_example/main.tex:10: LaTeX Error: \begin{document} ended by \end{frontmatter}.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.10 \end{frontmatter}
d:/minimal_working_example/main.tex:10: Extra \endgroup.
<recently read> \endgroup
l.10 \end{frontmatter}
[1{C:/Users/Moon Raven/AppData/Local/MiKTeX/pdftex/config/pdftex.map}] (main.aux)
LaTeX Warning: There were undefined references.
LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.
)
(see the transcript file for additional information)<C:/Users/Moon Raven/AppData/Local/Programs/MiKTeX/fonts/type1/public/amsfonts/cm/cmbx12.pfb><C:/Users/Moon Raven/AppData/Local/Programs/MiKTeX/fonts/type1/public/amsfonts/cm/cmbx9.pfb><C:/Users/Moon Raven/AppData/Local/Programs/MiKTeX/fonts/type1/public/amsfonts/cm/cmr10.pfb><C:/Users/Moon Raven/AppData/Local/Programs/MiKTeX/fonts/type1/public/amsfonts/cm/cmr12.pfb><C:/Users/Moon Raven/AppData/Local/Programs/MiKTeX/fonts/type1/public/amsfonts/cm/cmr6.pfb><C:/Users/Moon Raven/AppData/Local/Programs/MiKTeX/fonts/type1/public/amsfonts/cm/cmr9.pfb><C:/Users/Moon Raven/AppData/Local/Programs/MiKTeX/fonts/type1/public/amsfonts/cm/cmsl9.pfb><C:/Users/Moon Raven/AppData/Local/Programs/MiKTeX/fonts/type1/public/amsfonts/cm/cmti9.pfb><C:/Users/Moon Raven/AppData/Local/Programs/MiKTeX/fonts/type1/public/amsfonts/cm/cmtt9.pfb>
Output written on main.pdf (1 page, 99906 bytes).
SyncTeX written on main.synctex.gz.
Transcript written on main.log.
Latexmk: References changed.
Latexmk: Log file says output to 'main.pdf'
Latexmk: List of undefined refs and citations:
Reference `MyCity' on page 1 undefined on input line 4
Latexmk: Summary of warnings from last run of *latex:
Latex failed to resolve 1 reference(s)
Collected error summary (may duplicate other messages):
pdflatex: Command for 'pdflatex' gave return code 1
Refer to 'main.log' for details
Latexmk: Use the -f option to force complete processing,
unless error was exceeding maximum runs, or warnings treated as errors.
Latexmk: Examining 'main.log'
=== TeX engine is 'pdfTeX'
Latexmk: Errors, so I did not complete making targets
这似乎是由作者字段中的重音字母引起的。重音字母似乎不会在文档的任何其他部分造成问题。发生了什么?
答案1
该类的作者使用了非常危险的\xdef
命令\edef
。他们试图使用宏来添加自制的保护措施\no@harm
,但不幸的是,它无法涵盖最常见的情况。
使用标准保护机制进行修复可以解决问题。
\documentclass[twocolumn]{autart}
\usepackage{etoolbox}
\makeatletter
\def\@xnamedef#1{\expandafter\protected@xdef\csname #1\endcsname}
\def\no@harm{} % now useless
\def\ead@au#1{\protected@edef\@ead@au{#1}}
\patchcmd\runningauthor@fmt{\global\edef}{\protected@xdef}{}{}
\patchcmd\runningauthor@fmt{\global\edef}{\protected@xdef}{}{}
\patchcmd\author@fmt{\edef}{\protected@edef}{}{}
\patchcmd\add@xtok{\xdef}{\protected@xdef}{}{}
\makeatother
\begin{document}
\begin{frontmatter}
\author[MyCity]{Mar\'{c}us}\ead{[email protected]},
\address[MyCity]{My University, My address, My City}
\begin{abstract}
Hello, abstract!
\end{abstract}
\end{frontmatter}
Hello, world!
\end{document}