1

How do I align (by arrow) chemical reactions in different environments (between text)?

Example: Two arrays.

\begin{eqnarray}
    A & \longrightarrow & A' \\
    B & \longrightarrow & B'
\end{eqnarray}

some text

\begin{eqnarray}
    C & \longrightarrow & C' \\
    D & \longrightarrow & D'
\end{eqnarray}

For A/B and C/D the centering works. But they are not all (A,B,C,D) centered.

How do I manage this problem?

Thank you in advance!

cgnieder
  • 66,645
matt
  • 23
  • Welcome to TeX.SE! It's great to include your code, but please include it as part of a minimal working example, which will make it much easier to help you. – dgoodmaniii Feb 15 '20 at 13:27

1 Answers1

3

I would avoid eqnarray and use amsmath's align instead, see the reasons here.

Then I'd use amsmath's \intertext if the text between the reaction is short and the reactions form some sort of set. If they don't or if the text is too long then alignment might not be so important after all or even look strange.

And last but not least I'd use chemformula for the chemistry:

\documentclass{article}

\usepackage{amsmath}
\usepackage{chemformula}

\begin{document}

\begin{align}
  \ch{A & -> NO_{$x$}} \\
  \ch{B & -> H2O} \\
  \intertext{some text}
  \ch{C & -> SO4^{2-}} \\
  \ch{D & -> NH4+}
\end{align}

\end{document}

enter image description here

Should you want your reactions numbered independently from equations then you can do the same thing with chemmacros' reactions environment – this also uses chemformula for the chemicals:

\documentclass{article}

\usepackage{chemmacros}
\chemsetup{modules=reactions}

\begin{document}

\begin{reactions}
  A & -> NO_{$x$} \\
  B & -> H2O
  \intertext{some text}
  C & -> SO4^{2-} \\
  D & -> NH4+
\end{reactions}

\end{document}

enter image description here

cgnieder
  • 66,645