Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

share|improve this question

1 Answer 1

up vote 8 down vote accepted

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}
share|improve this answer
1  
+1. Yes, this is the way to go. This should be part of the package. –  Gonzalo Medina Mar 20 at 13:06
1  
@GonzaloMedina thanks, I sent a message to the package author, linking to this answer. –  David Carlisle Mar 20 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 at 22:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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