# Chemmacros errors

So I can get this to work;

\documentclass{minimal}
\usepackage{isotope}

\begin{document}
\isotope{Po} --- \isotope[56]{Fe} --- \isotope[13][6]{C}\\

$\isotope{n} + \isotope{H} \to \isotope{D} + \gamma(2.2\,\mathrm{MeV})$ \\

$\isotope[13]{C} + \alpha(5.314\,\mathrm{MeV}) \to \isotope[16]{O}^{**} + n$
\end{document}


and display and output something like this;

But when I do this...

\documentclass{minimal}
\usepackage[compatibility=5.8]{chemmacros}
\chemsetup{modules=all}

\begin{document}
\isotope{Po} --- \isotope[56]{Fe} --- \isotope[13][6]{C}\\

$\isotope{n} + \isotope{H} \to \isotope{D} + \gamma(2.2\,\mathrm{MeV})$ \\

$\isotope[13]{C} + \alpha(5.314\,\mathrm{MeV}) \to \isotope[16]{O}^{**} + n$
\end{document}


It all goes to pot. Errors about control sequences etc. I've read through the documentation a couple of times and pretty sure I'm doing it right.

! Missing number, treated as zero.
\@elements@atom@name@num@[
l.6 \isotope{Po} --- \isotope[
56]{Fe} --- \isotope[13][6]{C}\\
A number should have been here; I inserted 0'.
(If you can't figure out why I needed to see a number,
look up weird error' in the index to The TeXbook.)

! Missing \endcsname inserted.
\__int_eval_end:
l.6 \isotope{Po} --- \isotope[
56]{Fe} --- \isotope[13][6]{C}\\
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.

! Missing \endcsname inserted.
\__int_to_roman_
l.6 \isotope{Po} --- \isotope[
56]{Fe} --- \isotope[13][6]{C}\\
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.

! Missing number, treated as zero.
\@elements@atom@name@num@[
l.6 \isotope{Po} --- \isotope[
56]{Fe} --- \isotope[13][6]{C}\\
A number should have been here; I inserted 0'.
(If you can't figure out why I needed to see a number,
look up weird error' in the index to The TeXbook.)


1. Replaced the minimal document class with article
2. Used chemmacros syntax consistently through out the code, avoiding the need to revert to math mode. Use of \isotope from chemmacros retrieves the necessary isotope information from the elements package.
3. Since n and D are not setup in elements, it is necessary to revert to using chemformula syntax.
4. The particles (alpha and gamma) are set using the chemgreek macros. This avoids reverting to math mode. Standard usage is for the greek letters to be upright necessitating loading a font that has upright Greek glyphs. To do this, I loaded Linux Libertine.
5. I changed the \isotope syntax. It should be \isotope{nuc,symbol}, where nuc is the number of neutrons (the number in the upper left) and symbol is the symbol for the element in the periodic table.
6. The energy values of the particles is formatted using siunitx syntax.

This is the MWE:

\documentclass[a4paper,12pt]{article}
\usepackage{chemmacros}
\chemsetup{modules=all}
\usepackage{chemgreek}
\usepackage{fontspec}
\selectchemgreekmapping{fontspec}
\setmainfont{LinLibertine_R.otf} % for upright greek glyphs
\usepackage{siunitx}

\begin{document}
\isotope{Po} --- \isotope{56,Fe} --- \isotope{13,C}

\bigskip

\ch{^{1}n + \isotope{H} -> ^{2}_{1}D + \chemgamma}(\SI{2.2}{\meV})

\bigskip

\ch{\isotope{13,C} + \chemalpha}(\SI{5.314}{\meV}) \ch{-> \isotope{16,O}$^{**}$ + n}

\end{document}


This is the result:

• I would recommend also using siunitx to typeset the units instead of mathrm. Btw, D is deuterium, an isotope of H. – Troy Aug 17 '17 at 0:08
• @Troy. Thanks. \isotope loads the elements package to get the periodic table number and the isotope. I should have written D is not in the elements package. I think it has to be setup. I'll edit this later. – Ross Aug 17 '17 at 0:27
• Hey Troy, thanks for taking time out to reply. I was trying out this piece of code tex.stackexchange.com/questions/322132/… as I was having issues with the isotope module. Understand now where I went wrong. Thanks for your tips. I think yesterday was one of those days where I got abit OCD and tried to superscript something in a super-clever way for 2 (maybe 3?) hours. – Hamish Robertson Aug 17 '17 at 7:20