8

when using \cee command (from mhchem package) within align environment, \\[10pt] doesn't work. It works in align environment without \cee. Is there a workaround?

here is a MWE:

\documentclass{article} 
\usepackage{amsmath}
\usepackage{mhchem}

%with \cee command
\begin{document}
\begin{align}
\cee{
A &-> B \\[10pt] %"[10pt]" is printed, no vertical adjustment
A &-> B 
}
\end{align}

%without \cee command
\begin{align}
A &\rightarrow B \\[10pt] %vertical adjustment works
A &\rightarrow B 
\end{align}

\end{document}

prints:

enter image description here

8

Edit: mhchem version 3.16 includes the fix shown below. Update will be available in a few days.

enter image description here

(This redefinition requires the current version of mhchem, not the one in texlive 2012)

\documentclass{article} 
\usepackage{amsmath}
\usepackage{mhchem}

\makeatletter
\def\mhchem@cee@i#1\\#2#3\mhchem@ENDEND{%
  \ifx\mhchem@END#2%
    \mhchem@cee@ii#1&\mhchem@END\mhchem@ENDEND%
  \else%
    \mhchem@cee@ii#1&\mhchem@END\mhchem@ENDEND%
    \g@addto@macro\mhchem@ce@out{\\}%
   \@ifnextchar[\mhchem@cee@ibrk
\mhchem@cee@i#2#3\mhchem@ENDEND%
  \fi%
}

\def\mhchem@cee@ibrk[#1]{%
 \g@addto@macro\mhchem@ce@out{[#1]}\mhchem@cee@i}
\makeatother

%with \cee command
\begin{document}

\begin{align}
\cee{
A &-> B \\[10pt] %"[10pt]" is printed, no vertical adjustment
A &-> B 
}
\end{align}

%without \cee command
\begin{align}
A &\rightarrow B \\[10pt] %vertical adjustment works
A &\rightarrow B 
\end{align}

\end{document}
  • 1
    +1. Yes, this is the way to go. This should be part of the package. – Gonzalo Medina Mar 20 '14 at 13:06
  • 1
    @GonzaloMedina thanks, I sent a message to the package author, linking to this answer. – David Carlisle Mar 20 '14 at 13:14
  • Thanks David! A new version of mhchem was submitted, with your solution included. So, in a few days' time, the correct answer will be: Simply use mhchem version 3.16 or higher. – mh543 Mar 20 '14 at 22:07

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.