4

I'm trying to include a molecular structure drawn with chemfig inside chemformula's reaction environment by escaping it with "…". It all worked fine until I stumbled upon a structure with a triple bond. According to chemfig's manual, ~ is used exclusively for drawing a triple bond, however, when placed inside reaction, ~ character is ignored or incorrectly interpreted (single and double bonds are displayed fine):

enter image description here

\documentclass{article}
\usepackage{chemmacros}
    \chemsetup{modules={all}}
\usepackage{chemfig}

\begin{document}

\begin{reaction}
    A + B + C + D -> "\chemfig{A-[::30]B=[::30]C~[:30]D}"
\end{reaction}

\end{document}

I'm using chemformula v4.15g, chemmacros v5.8f and chemfig v1.41 from the fully up-to-date (as of 2019-10-08) TeX Live 2019.

  • 1
    From the chemformula manual (see section 8.1, page 21): "If you put something between " " or ' ' then the input will be treated as normal text, except that spaces are not allowed and have to be input with ~." This might be the reason for the output you get. – leandriis Oct 9 at 17:01
  • 1
    This will work in version 4.15h (2019/10/13) of chemformula which I've just uploaded to CTAN – clemens Oct 13 at 17:13
  • @clemens Thank you very much! – andselisk Oct 13 at 22:47
3

With chemformula v4.15h (2019/10/13) the MWE works:

\documentclass{article}

\usepackage{chemformula}[2019/10/13] % v4.15h or newer
\usepackage{chemmacros}
\chemsetup{modules={reactions}}

\usepackage{chemfig}

\begin{document}

\begin{reaction}
  A + B + C + D -> "\chemfig{A-[::30]B=[::30]C~[:30]D}"
\end{reaction}

\end{document}

enter image description here

3
\documentclass{article}
\usepackage{chemmacros}
    \chemsetup{modules={all}}
\usepackage{chemfig}

\newcommand{\abcd}{\chemfig{A-[::30]B=[::30]C~[:30]D}}

\begin{document}

\begin{reaction}
    A + B + C + D -> "\abcd"
\end{reaction}

\end{document}

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.