I am trying to use mhchem inside the short caption for a number of figures and tables, and it is interfering with the thesis class I'm required to use (pittetd). It only happens when forming the list of tables or figures; if this doesn't need to be generated, there is no problem. More specifically, it only occurs when \bond{....} is present; \ce{} is not the issue.

Here is a MWE:



\newcommand{\arlidimert}{argon\textemdash{}lithium cation dimer}


  \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}
                    & \multicolumn{2}{c}{basis set} \\
    BSSE corrected? & def2-SVP    & def2-SVPD   \\
    no              & 24.2        & 17.1        \\
    yes             & 25.0        & 19.4        \\


If article is used instead, there's no issue.

The error output from latexmk -pdf mwe.tex:

(./mwe_mhchem_in_short_captions.out (./mwe_mhchem_in_short_captions.lot
! Undefined control sequence.
<argument> Ar\bond 
l.1 ...ue to higher-order effects}}{ii}{table.0.1}

When inspecting the *.lot files, the difference is clear. For the article (working) example:

\contentsline {table}{\numberline {1}{\ignorespaces Percentage of ALMO-EDA charge transfer in \ce {Ar\bond {....}Li+}{} due to higher-order effects}}{1}

but for pittetd (not working):

\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}

Since it seems to be triggered by \bond, I can't tell what the red herring is, or if something else is going on. Assume I don't understand how the class file works. What is the appropriate fix?

  • 1
    Try \usepackage{etoolbox}\robustify\arlidimer. – Ulrike Fischer Jan 30 '18 at 22:42
  • It works. I see that it preserves the command as it passes through the *.lot. Is it just changing when the macro expansion occurs? Why would the environment be different between the two classes? – pentavalentcarbon Jan 30 '18 at 23:14
  • Nevermind, I found tex.stackexchange.com/questions/4736/… and expect it'll probably answer those questions for me. – pentavalentcarbon Jan 30 '18 at 23:16
  • pittetd.cls heavily redefines \contentsline to work with hyperref which likely accounts for the problem. – Alan Munn Jan 31 '18 at 0:29
  • Ok, I'm having trouble getting this working in my non-MWE with a similar error. I'll probably read that question first. – pentavalentcarbon Jan 31 '18 at 1:48

Converting the comment into an answer to get it from the unanswered list:

Make the command robust with


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.