5

Is there any way to remove the vertical spacing around a chemical equation placed in a multline environment in a table?

I tried setting the length of display skips as suggested in this question but it doesn't seem to work.

Just as information, the \ce command doesn't cause this behavior; it is seen with normal math equations as well.

MWE:

\documentclass[a4paper, 10pt, oneside]{memoir}
\usepackage{mhchem}
\usepackage{amsmath}

% This doesn't work.
\setlength{\abovedisplayskip}{0pt}
\setlength{\belowdisplayskip}{0pt}
\setlength{\abovedisplayshortskip}{0pt}
\setlength{\multlinegap}{0pt}

\begin{document}

\begin{table}
    \begin{tabular}{rp{27em}l}
        1  & \begin{multline*}\ce{This is a very long list of products ->\\[-0.5em] This is another very long list of reactants}\end{multline*} & Align top \\
        2  & \ce{Na+ + Cl- -> NaCl} & Example \\
        3 & \begin{multline}
            This is not a chemical equation environment \\
            But theres still vertical spacing.
        \end{multline} & Align top
    \end{tabular}
\end{table}

\end{document}

enter image description here

Thank you!

5
  • The last ‘equation’ has to be numbered? – Bernard Sep 22 '19 at 15:45
  • 1
    multline is intended to form a new standalone display. Instead, try multlined, which is a "subsidiary" structure. This requires the mathtools package. – barbara beeton Sep 22 '19 at 16:26
  • @Bernard No, it's just demonstrating that this occurs without the \ce command. However, I intend to use the \ce command in my actual text. – ruby Sep 22 '19 at 16:41
  • @barbarabeeton multlined removes the vertical spacing, but the second line doesn't seem to be aligned right, it merely seems to be indented from the left. Is there any way to make the second line align right? – ruby Sep 22 '19 at 16:41
  • 1
    @ruby -- All the "subsidiary" multi-line environments just take up the horizontal space needed for the input expression. If you want the last line of multlined to be farther to the right, you can/should add some additional \hspace at the beginning of that line. – barbara beeton Sep 22 '19 at 22:57
4

The multlined environments can take two optional arguments: its vertical position (t, c or b) and its width. I naturally chose the column width:

\documentclass[a4paper, 10pt, oneside]{memoir}
\usepackage{mhchem}
\usepackage{mathtools}
\makeatletter\newcommand*{\compress}{\@minipagetrue}

\setlength{\multlinegap}{20pt}

\begin{document}

\begin{table}
    \begin{tabular}{r|p{27em}|l}
        1 & $ \begin{multlined}[t][27em]\ce{This is a very long list of products ->\\This is another very long list of reactants}\end{multlined} $ & Align top \\
        2 & \ce{Na+ + Cl- -> NaCl} & Example \\
        3 &\leavevmode$ \begin{multlined}[t][27em]
            \text{This is not a chemical equation environment} \\
            \text{But theres still vertical spacing}.
        \end{multlined} $ & Align top
    \end{tabular}
\end{table}

\end{document} 

enter image description here

2
  • Not quite sure why (and can't test), but the two lines of item 1 are too close together. Perhaps it's the effect of \ce, because item 3, where both lines are defined with \text, has almost too much space. – barbara beeton Sep 23 '19 at 0:07
  • @barbarabeeton: You're right – thank you for warning me! Examining the code, I found out I hadn't noticed a useless \\[-0.5em] in the code posted with the question. So it has nothing to do with the \ce command and I removed it. Thanks again. – Bernard Sep 23 '19 at 0:22

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.