1

I want to make numbered chemical equation with the potential of that equation on the right. This is what I have:

\begin{align}
\label{eq:NiOOH}
    \ce{NiOOH + H2O + e- &<=>[discharge][charge] Ni(OH)2 + OH-}
    \tagaddtext{[$E_0,red=0,52$ \si{\volt}]}
\end{align}

For most of the equations this work, however if equation is too long it overlapse with potential: enter image description here

I tried to align equation to the left with FLALIGN, but there was no change.

All other complex equations looks the same: enter image description here

1
  • Can you share an image of the faulty output, including your attempts to fix the problem? It would be helpful to have a sense of where the overlap happens and why your previous attempt hasn't been successful
    – jackson
    Apr 5, 2021 at 18:10

2 Answers 2

2

enter image description here

\documentclass{article}
\usepackage{chemmacros}
\usechemmodule{reactions}
\usepackage{siunitx}

\begin{document}

\begin{reaction}
    NiOOH + H2O + e- <=>[discharge][charge] Ni(OH)2 + OH-
     $\qquad[E_0,red=\SI{0,52}{\volt}]$ \label{rct:NiOOH}
\end{reaction}

\end{document}
3
  • Is it standard to have the space between the equation and the potential be a fixed \qquad-width, rather floating the partial right against the equation number, as in the original question? I would have thought floating would be preferable (but I am not a chemist)
    – jackson
    Apr 5, 2021 at 18:19
  • Somehow, mine LaTeX template is not recognizing chemmacros package despite its declared in main tex file. It doesnt do that with other packages. Also I probably can't use this kind of numbering in my thesis.
    – Kamil
    Apr 6, 2021 at 15:34
  • @Kamil: There was a small error in the previous version of the code. You might want to try again with the updated version. Regarding: "Also I probably can't use this kind of numbering" If you refer to the number being enclosed in a set of curly brackets, please keep in mind that you can change tat. \chemsetup[reactions]{tag-open = [ ,tag-close = ]} for example results in square brackets instead.
    – leandriis
    Apr 6, 2021 at 17:37
1

I propose this MWE and I have get this using for the double arrow chemarrow package. Of course you can always use the specific chemmacros package. For the use of \tagaddtext from this site, you must add the code:

\makeatletter
\providecommand\add@text{}
\newcommand\tagaddtext[1]{%
  \gdef\add@text{#1\gdef\add@text{}}}% 
\renewcommand\tagform@[1]{%
  \maketag@@@{\llap{\add@text\quad}(\ignorespaces#1\unskip\@@italiccorr)}%
}
\makeatother

It is very important that you add a minimal complete compilable code.

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath}
\usepackage[margin=2cm]{geometry}
\usepackage{chemarrow}
\usepackage{siunitx}
\sisetup{detect-all}

\makeatletter
\providecommand\add@text{}
\newcommand\tagaddtext[1]{%
  \gdef\add@text{#1\gdef\add@text{}}}% 
\renewcommand\tagform@[1]{%
  \maketag@@@{\llap{\add@text\quad}(\ignorespaces#1\unskip\@@italiccorr)}%
}
\makeatother

\begin{document}
\begin{align}
\mathrm{NiOOH + H_2O + e^-} \autorightleftharpoons{discharge}{charge} \mathrm{Ni(OH)_2 + OH^-}& &\tagaddtext{$[E_0, \text{red}=0.52 \si{\volt}]$}
\label{eq:NiOOH}
\end{align}
\end{document}

enter image description here

5
  • This does work for this particular equation, however I do have more complex ones and it doesnt work for those. Is there a way how to make text in equations smaller? \small or \tiny does not work as it do for tables.
    – Kamil
    Apr 6, 2021 at 15:37
  • @Kamil If you prefer I delete my answer. You can use in math mode or \scriptstyle or \scriptscriptstyle. \small or \tiny are specific only for the text.
    – Sebastiano
    Apr 6, 2021 at 15:40
  • 1
    No, let it here. It is a pretty good answer. You helped me at least with arrows, this way it looks better.
    – Kamil
    Apr 6, 2021 at 15:59
  • 1
    i will only replace \text{red}=0.52 \si{\volt} with \text{red}=\SI{0.52}{\volt}. (+1)
    – Zarko
    Apr 6, 2021 at 18:00
  • @Zarko Kindest Zarko you know you are authorized to do whatever you want in my answers...:-) You can improved my answer. :-)
    – Sebastiano
    Apr 6, 2021 at 19:38

You must log in to answer this question.

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