5

While illustrating atomic orbitals for 1,3-butadiene guided by examples in chemmacros' manual, I receive the following error:

Argument of \orbital has an extra }. }

MWE:

\documentclass{article}
\usepackage{chemmacros}
    \chemsetup{modules = all}
    \chemsetup[orbital]{overlay}
\usepackage{chemfig}
    \setchemfig{
        atom sep = 2.5em
    }

\begin{document}

\chemfig{
    \orbital{p}
    -[:30]\orbital{p}
    -[:-30]{\orbital[phase=-]{p}}
    -[:30]{\orbital[phase=-]{p}}
}

\end{document}

pdflatex produces the following [incorrect] structure:

Defected structure of 1,3-butadiene

The same error occurs for the examples from the manual where optional arguments are passed to \orbital[...]{...} inside \chemfig{...}. I'm using fully updated TeXLive 2018.

6

Empirically I found out that putting arguments inside {...} (and not entire \orbital[...]{...} command) solves the problem:

\documentclass{article}
\usepackage{chemmacros}
    \chemsetup{modules = all}
    \chemsetup[orbital]{overlay}
\usepackage{chemfig}
    \setchemfig{
        atom sep = 2.5em
    }

\begin{document}

\chemfig{
    \orbital{p}
    -[:30]\orbital{p}
    -[:-30]\orbital[{phase=-}]{p}
    -[:30]\orbital[{phase=-}]{p}
}

\end{document}

1,3-butadiene

I'm still not sure what caused the former solution to stop working; maybe it has something to do with the recent chemfig update.

  • Are you saying that in some older version of chemfig the MWE in your question worked, but now you had to switch the order of {}? Btw. it somehow reminds me this bug tex.stackexchange.com/questions/156547/bug-in-arrow-label – pisoir Jan 4 at 16:53
  • @pisoir About an year ago I remember using the examples for orbitals from chemmacros's manual and I didn't encounter any issues. – andselisk Jan 5 at 2:01

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.