4

Just started in the writing of chemistry stuff using LaTeX.

Question

Is it possible to tag chemical equations with a letter and numbers as R1, R2 and so on?

Output and MWE

enter image description here

\documentclass[12pt,twoside]{report}

\usepackage[spanish,es-noquoting]{babel}
      \usepackage[utf8]{inputenc} 
        \usepackage[T1]{fontenc} 
        \usepackage{amssymb} 
        \usepackage{amsfonts}
        \usepackage{nccmath}
        \usepackage{chemformula}

 \begin{document}

    \begin{align}
    &\ch{B + H+ <=> BH+}\\
    &\ch{AH+ + B <=> A + BH^{+}} \label{reaccion_neta}
    \end{align}

    The sum \ref{reaccion_neta} is:

    \begin{align}
    \Delta G^0_{1} + \Delta G^0_{ref}&=-RT(ln(Ka_1)+ln(Ka^{-1}_{ref}) \\
    G^0_{BH^+} - G^0_{B} + G^0_{A}- G^0_{AH+} &=-RT(ln(Ka_1)+ln(Ka^{-1}_{ref})\\
    &= RT2.303pKa_{1}- RT2.303pKa_{ref}
    \end{align}

    \end{document}
  • We appreciate it if there is only one question per post. That allows us to keep focussed. – Masroor Aug 31 '17 at 17:17
  • There are various packages for typesetting chemistry related stuff. You could have a look at mhchem or chemmacros. Both offer the possibility to align and number reaction equations. This answer might be interesting as well. – leandriis Aug 31 '17 at 17:23
  • 1
    Unrelated: use \ln not ln for the natural logaritm, and you'd probably want _{\mathrm{ref}} instead of _{ref}. – Torbjørn T. Aug 31 '17 at 17:34
  • How would you like the "letter numbering" to be relative to the "equation numbering"? (A) (B) (1) (2) (3)...? – Werner Aug 31 '17 at 17:41
  • 2
    @Hernan Miraola As already commented before, there already is an answer to this part of your question here: tex.stackexchange.com/a/147854/134144 Ludovic C. defined a new environment for numbering reaction equations with R1... while keeping the counter of math equations untouched. – leandriis Aug 31 '17 at 19:05
4

Here you are. I define an environment, somewhat like subequations, which re-defines the equation counter as a new chemeqn counter. Also, I propose another alignment (second group) based on alignat, which I find nicer:

\documentclass[12pt,twoside]{report}

\usepackage[spanish,es-noquoting]{babel}
  \usepackage[utf8]{inputenc}
    \usepackage[T1]{fontenc}
    \usepackage{amssymb}
    \usepackage{amsfonts}
    \usepackage{mathtools, nccmath}
    \usepackage{chemformula}

\makeatletter
\newcounter{chemeqn}
\newenvironment{chemequations}{\let\c@equation\c@chemeqn\def\theequation{R\thechemeqn}}{}
\makeatother

\begin{document}

\begin{chemequations}
\begin{align}
     &\ch{B + H+<=> BH+}\\
     &\ch{AH+ + B<=> A + BH^{+}} \label{reaccion_neta}
\end{align}

\begin{alignat}{2}
    \ch{B &+ H+ & & <=> BH+}\\
    \ch{AH+ &+ B & & <=> A + BH^{+}} \label{reaccion_neta}
\end{alignat}
\end{chemequations}

The sum \eqref{reaccion_neta} is:
\begin{align}
\Delta G^0_{1} + \Delta G^0_\textrm{ref}&=-RT(\ln(Ka_1)+\ln(Ka^{-1}_\textrm{ref}) \\
G^0_{BH^+} - G^0_{B} + G^0_{A}- G^0_{AH+} &=-RT(\ln(Ka_1)+\ln(Ka^{-1}_\textrm{ref})\\
&= RT2.303pKa_{1}- RT2.303pKa_\textrm{ref}
\end{align}

\end{document}

enter image description here

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.