2

When typing reactions starting with coordinating compounds, I noticed that when the first reactant starts with "[" in both reaction and reactions environments the part enclosed in square brackets isn't rendered correctly:

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

\begin{document}

\begin{reaction}
    [ML6]A <=> [ML6]+ + A-
\end{reaction}

\end{document}

enter image description here

Neither pdflatex, nor xelatex show any error messages. Empirically I discovered that adding a pair of square brackets to the reaction(s) environment solves the problem:

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

\begin{document}

\begin{reaction}[]
    [ML6]A <=> [ML6]+ + A-
\end{reaction}

\end{document} 

enter image description here

I'm also curious why \begin{reaction}[] actually works – maybe there are some arguments that reaction(s) environment expects?

  • not specific to the reaction environment. it's just how latex works. see e.g. Error with square bracket in table or just try \documentclass{article}\begin{document}\begin{figure}[Test]\end{figure}\end{document} and you will get an error about unknown positional arguments. – Troy Dec 4 '18 at 17:07
  • @Troy I see. So, what do you think would be the best course of action here: leave a couple of empty [] brackets every time, use {[} for the first complex, or something else? Also I find it weird that compilers don't complain at all as if ML6 were a valid argument. – andselisk Dec 4 '18 at 17:53
  • 1
    in this case, I would do [] since it seems to be the quickest way to do it. I don't think one has any advantage (apart from flow of typing) over the other. maybe Clemens would have something to say regarding your second statement. – Troy Dec 4 '18 at 18:26
  • 1
    chemmacros doesn't do this anymore with the newest release (should be available in the main distributions in a few days) – clemens Sep 27 at 11:16
2

This is not a problem with an up to date chemmacros (v5.8f):

\documentclass{article}
\usepackage{chemmacros}[2019/09/30]% v5.8f or newer
\chemsetup{modules = reactions}

\begin{document}

\begin{reaction}
  [ML6]A <=> [ML6]+ + A-
\end{reaction}

\begin{reaction}[]
  [ML6]A <=> [ML6]+ + A-
\end{reaction}

\end{document}

enter image description here

  • I really appreciate your competence. – Sebastiano Oct 14 at 21:16

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.