3

I am working on beamer presentations for my students to discuss chemical reactions in my classes. I am using the following syntax for

\documentclass[10pt]{beamer}
\usepackage{tikz}           % Package for drawing
\usepackage{chemfig}        % Chemical Diagrams
\usepackage{chemmacros}     % For chemical reactions and symbols
\setbeamertemplate{navigation symbols}{}

\usetheme{Warsaw}
\usetikzlibrary{matrix}

\setbeamercovered{invisible}

\begin{document}
\begin{frame}{}
    \begin{block}{Effect on equilibrium of \ch{NO}}
        \begin{reaction*}
            N2 \gas{} + O2 \gas{} <=>  2 NO \gas{} \qquad{} $\Delta H>0$
        \end{reaction*}
\end{frame}
\end{document}

The problem is that 0 is being shown in subscript while the intended output is regular-sized font. How to fix this?

Thanks

  • 1
    Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – Guido Oct 23 '14 at 9:55
  • related: tex.stackexchange.com/questions/163497/… – clemens Oct 23 '14 at 10:40
  • @Guido, thanks for pointing out. I will edit my post and follow the guidelines you have suggested. – Harpreet Oct 23 '14 at 11:24
  • @cgnieder, the method you suggested worked. Thanks. – Harpreet Oct 23 '14 at 11:26
2

The reaction environment uses the \ch command from the chemformula package internally. In the manual of the latter one can read

chemformula distinguishes between different types of input. These different parts have to be separated with blanks [...] A blank in the input never is a blank in the output. This role of the blank strictly holds and disregarding it can have unexpected results and even lead to errors.

Every blank in the input splits the input into different parts. In

\begin{reaction*}
N2 \gas{} + O2 \gas{} <=>  2 NO \gas{} \qquad $\Delta H > 0$
\end{reaction*}

we have the parts (remember that blanks after control sequences are ignored):

  • N2 (chemical formula)
  • \gas{} (chemical formula)
  • + (plus sign)
  • O2 (chemical formula)
  • \gas{} (chemical formula)
  • <=> (arrow)
  • 2 (stoichiometric factor)
  • NO (chemical formula)
  • \gas{} (chemical formula)
  • \qquad $\Delta H (chemical formula)
  • > (chemical formula)
  • 0$ (chemical formula)

Everything that cannot be interpreted as a certain input type (like arrow, ...) is treated as a chemical formula which means that digits are written as supscripts then...

In order to avoid this one can use chemformula's math input type which must start and end with $. It also must be preceded with a blank and must not contain any blanks:

\documentclass{article}
\usepackage{chemmacros}

\providecommand\IfChemCompatibilityTF[4]{#4}
\IfChemCompatibilityTF{>=}{5.0}{
  \usechemmodule{reactions,thermodynamics}
}{}

\begin{document}

\begin{reaction*}
  N2 \gas{} + O2 \gas{} <=>  2 NO \gas{} \qquad{} $\Delta H>0$
\end{reaction*}

\end{document}

enter image description here

The second example has the input parts

  • N2 (chemical formula)
  • \gas{} (chemical formula)
  • + (plus sign)
  • O2 (chemical formula)
  • \gas{} (chemical formula)
  • <=> (arrow)
  • 2 (stoichiometric factor)
  • NO (chemical formula)
  • \gas{} (chemical formula)
  • \qquad{} (chemical formula)
  • $\Delta H>0$ (escaped math)
  • Interesting. What is the difference between \qquad and \qquad{}? – Pouya Oct 23 '14 at 11:19
  • spaces after control sequences like \qquad are ignored, spaces after } are not. So \qquad{} ensures that the space token after it is recognized – clemens Oct 23 '14 at 11:22
  • Thank you. +1 since your answer is better than mine. Cheers :) – Pouya Oct 23 '14 at 11:34

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.