我试图mhchem
在短标题内使用一些图表和表格,但它干扰了我需要使用的论文类别(pittetd
)。它只在形成表格或图表列表时发生;如果不需要生成,则没有问题。更具体地说,它只在\bond{....}
存在时发生;\ce{}
不是问题。
以下是 MWE:
\let\oldyear\year
\documentclass{pittetd}
\let\setyear\year
\let\year\oldyear
\usepackage{booktabs}
\usepackage[version=4]{mhchem}
\newcommand{\arlidimert}{argon\textemdash{}lithium cation dimer}
\newcommand{\arlidimer}{\ce{Ar\bond{....}Li+}}
\begin{document}
\listoftables
\begin{table}
\caption[Percentage of ALMO-EDA charge transfer in \arlidimer{} due to higher-order effects]{Percentage of ALMO-EDA charge transfer in \arlidimer{} due to higher-order effects}
\label{tab:almo-eda-higher-order-pct-of-ct}
\begin{tabular}{ccc}
\toprule
& \multicolumn{2}{c}{basis set} \\
BSSE corrected? & def2-SVP & def2-SVPD \\
\midrule
no & 24.2 & 17.1 \\
yes & 25.0 & 19.4 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
如果article
改用,则没有问题。
错误输出来自latexmk -pdf mwe.tex
:
(/usr/local/texlive/2017/texmf-dist/tex/latex/graphics/color.sty
(/usr/local/texlive/2017/texmf-dist/tex/latex/graphics-cfg/color.cfg))
(/usr/local/texlive/2017/texmf-dist/tex/latex/hyperref/nameref.sty
(/usr/local/texlive/2017/texmf-dist/tex/generic/oberdiek/gettitlestring.sty))
(./mwe_mhchem_in_short_captions.out (./mwe_mhchem_in_short_captions.lot
! Undefined control sequence.
<argument> Ar\bond
{....}Li+
l.1 ...ue to higher-order effects}}{ii}{table.0.1}
检查*.lot
文件时,差异很明显。对于article
(工作)示例:
\contentsline {table}{\numberline {1}{\ignorespaces Percentage of ALMO-EDA charge transfer in \ce {Ar\bond {....}Li+}{} due to higher-order effects}}{1}
但对于pittetd
(不起作用):
\contentsline {table}{\numberline {1}{\ignorespaces Percentage of ALMO-EDA charge transfer in \ce {Ar\bond {....}Li+}{} due to higher-order effects}}{ii}{table.0.1}
由于它似乎是由 触发的\bond
,我无法判断什么是干扰,或者是否发生了其他事情。假设我不了解类文件的工作原理。适当的修复是什么?
答案1
将评论转换为答案以从未答案列表中获取它:
使用以下方法增强命令的鲁棒性
\usepackage{etoolbox}
\robustify\arlidimer