1

I would like to write two half-cell equations (reduction and oxidation) each on their own row, each with their own label of type reactions and entry with RxnDesc (reaction description) in the List of Reactions (provided by chemmacros reactions module, followed by a summation line (just a horizontal rule) and the sum reaction, which should also have its own label and entry in listofreactions.

I can achieve the desired "look" with aligned, but that does not give me any entries in the list of reactions nor labels of reaction type:

\documentclass{article}
\usepackage{amsmath}
\usepackage{chemformula}

\begin{equation}
\begin{aligned}
\ch{1/2 O2\aq{} + H2O + 2 e-          &<=> 2 OH-} \\
\ch{Zn^{2+}\aq{} + 2 OH-              &-> ZnO\sld{} + H2O}\\
\midrule
\ch{Zn^{2+}\aq{} + 1/2 O2\aq{} + 2 e- &-> ZnO\sld{}}
\end{aligned}
\end{equation}

\end{document}

half-cell and sum reaction with equation environment

I have been trying to achieve that look (except every reaction should have its own label) with the reactions environment, but consistently failed. The best I can achieve is a nicely aligned reaction block, with entries with descriptions in list of reactions and labels, but missing the horizontal rule:

\documentclass{article}
\usepackage{amsmath}
\usepackage[minimal=true, modules={reactions}]{chemmacros}
\usepackage{chemformula}
\usepackage{booktabs}
\usepackage{array}
\listofreactions

\begin{reactions}
1/2 O2\aq{} + H2O + 2 e- &<=> 2 OH- \AddRxnDesc{Oxygen~reduction~in~water} \\
Zn^{2+}\aq{} + 2 OH- &-> ZnO\sld{} + H2O \AddRxnDesc{Zinc~hydroxide~to~oxide} \\
Zn^{2+}\aq{} + 1/2 O2\aq{} + 2 e- &-> ZnO\sld{} \AddRxnDesc{Zinc~deposition}
\end{reactions}

half-cell and sum reaction with reactions environment

I have tried \NewChemReaction{rxntab}[1]{tabular} as suggested in a previous answer, but I could not get \hline or midrule to work, neither reaction labels or reaction descriptions, and in addition it doesn't look very nice, visually.

I also tried to use a regular align environment and reset the label numbering as suggested in a previous answer but that answer shows how to do it for a single equation and I guess my copy-paste skills were not enough to achieve the same for multiple numbered equations ;-)

Would love to learn how to do it, if there is a way.

TeXLive 2023, chemmacros v6.2a, chemformula v4.17 on Ubuntu 22.04.

Other related questios & answers:

1
  • I have done this halfreactions/total reaction scheme a while ago. Have to check whether my solution meets your requirements though before I post an answer.
    – alchemist
    Commented Apr 1, 2023 at 1:48

1 Answer 1

2

Well, it turned out to be a bit of playing with positioning, but this is the best result I obtained. So I will share it with you.

\documentclass{article}

\usepackage[minimal=true, modules={reactions}]{chemmacros}

\chemsetup{formula=chemformula}
\chemsetup[chemformula]{format={\sffamily}}
\chemsetup[reactions]{before-tag = \textbf, tag-open = \textbf{[} , tag-close = \textbf{]}}

%----- defining subreactions in reaction ----
\makeatletter
\newenvironment{subreactions}{%
    \refstepcounter{reaction}%
    \protected@edef\theparentequation{\thereaction}%
    \setcounter{parentequation}{\value{reaction}}%
    \setcounter{reaction}{0}%
    \def\thereaction{\theparentequation\alph{reaction}}%
    \ignorespaces
    }{%
    \setcounter{reaction}{\value{parentequation}}%
    \ignorespacesafterend
    }
\makeatother

\begin{document}
    
\listofreactions

    \raisebox{-39pt}{\hspace{20mm} \rule{70mm}{1pt}}
    \vspace{-51pt}
\begin{subreactions}
    \begin{reactions}
    1/2 O2 + H2O + 2 \el &<=> 2 OH\mch[] \AddRxnDesc{Oxygen~reduction~in~water} \\
    Zn\pch[2] + 2 OH\mch[] &-> ZnO + H2O \AddRxnDesc{Zinc~hydroxide~to~oxide}
\end{reactions}
\end{subreactions}
\vspace{-12pt}
    \addtocounter{reaction}{-1}
    \begin{reaction}
        Zn\pch[2]\aq{} + 1/2 O2\aq{} -> ZnO\sld{} \quad \quad \quad \AddRxnDesc{Zinc~deposition}
    \end{reaction}

\end{document}

Resulting in:

subreactions adjusted

Notes:

  1. As you can see, placing the total reaction outside the subreactions/reactions environment doesn't align the reaction arrow with the previous ones automatically. You can adjust the arrow position of the total reaction by adding \quad a few times before the \AddRxnDesc.
  2. I altered your reactions to the conventional presentation. Inside a half reaction phases aren't used as there are electrons involved. Those don't have a phase, only an origin. Conventionally, when using phases inside a reaction, all compounds should be assigned their phase. Phases can be added to the total reaction.
  3. I changed the way you added charges to ions using the chemmacros definitions.
  4. The array environment used by reactions prohibits the use of lines inside that environment. It looks like a table but it doesn't behave like one. So you need to place the rule before the subreactions start and play with the vertical and horizontal spacing of these two.
  5. To get the correct reaction number, you'll need to adjust the \thereaction counter before adding the total reaction.
  6. The subreactions macro isn't my idea. I copied it a few year back from an answer to a similar question give by Clemens Niederberger. I didn't find it for now.
2
  • Thanks for sharing! And thanks for the helpful notes :-) Here's hoping for a future half-cell/sum reaction environment (perhaps in chemmacros?) that handles the horizontal and vertical alignments automatically for the user. I do like that the half-cell reactions get labelled as "sub"-reactions, neat touch! Commented Apr 2, 2023 at 13:15
  • 1
    And you're right, this kind of code has been shared before on TeX.SE. I found this answer by leandriis (2021-07-04), who cites this answer by Craig (2017-03-01). Commented Apr 2, 2023 at 13:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .