Math & Sciencemhchem | White Space with multi-line Brace in Equations

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
hugovdberg
Posts: 133
Joined: Sat Feb 25, 2012 6:12 pm

mhchem | White Space with multi-line Brace in Equations

Post by hugovdberg »

It's been a while since I have been here, but now I have another question and maybe I'm just too picky but I don't like the spacing (both horizontally and vertically) in the following example (which is based on a stackoverflow answer on this page):

Code: Select all

\documentclass{scrartcl}
\usepackage{amsmath}
\usepackage[version=3]{mhchem}

\begin{document}
\begin{align*}
\cee{N2 + O2   &->[\text{high temperature}] 2NO}\\
\begin{array}{r}\cee{
   NO + O3\\
   NO + HO2
   }\end{array}
   &
\left.\begin{array}{l}\cee{
   -> NO2 + O2\\ 
   -> NO2 + OH
   }\end{array}\right\} \text{or} \\
\cee{NO2 + OH &-> HNO3\\
HNO3  &-> H+ + NO3-}
\end{align*}
\end{document}
I have tried combining the two {array} environments, but then the reactions don't align with the surrounding reactions at all (left aligned on the page). I have also tried to surround the lines without a brace with {array} environments, which lines them up more nicely, but I do not like the large white space to the left of the reaction arrow. And does anyone know how to make the reaction arrows all the same length?

Also there is a little more vertical white space above and below the braced lines then between the bottom two lines, but that's just a minor thing, maybe that's fine because of the brace which extends a little above and below the lines.

The PDF output of the MWE is attached.
Attachments
mwe.pdf
(41.74 KiB) Downloaded 385 times
Last edited by localghost on Wed Nov 07, 2012 11:07 am, edited 1 time in total.
Ubuntu 13.10 + Tex Live 2013 + Texmaker / Windows 7 Pro + MikTex 2.9 + TexnicCenter / Android 4.3 + TexPortal + DroidEdit

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX books
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

mhchem | White Space with multi-line Brace in Equations

Post by cgnieder »

This is probably the space around the array columns. Try setting \arraycolsep=0pt or remove the space manually be specifying the columns like @{}r@{} and @{}l@{}.

Regards
site moderator & package author
hugovdberg
Posts: 133
Joined: Sat Feb 25, 2012 6:12 pm

mhchem | White Space with multi-line Brace in Equations

Post by hugovdberg »

@localghost Sorry, I overlooked the attachment option, thanks for fixing that!
However, I'm not sure if this really is a mhchem specific problem, since the original solution also has the extraneous whitespace.

@cgnieder Thanks for that solution, I ended up adding {array} environments around the right-hand part of each equation and specifying the columns like you said. It looks way nicer now, and I'll go with the little extra vertical space.

I fixed the wider arrows myself with \hphantom, now the arrows are all the same length.
Ubuntu 13.10 + Tex Live 2013 + Texmaker / Windows 7 Pro + MikTex 2.9 + TexnicCenter / Android 4.3 + TexPortal + DroidEdit
Post Reply