# Maths mode with chemmacros

I am a beginner with chemmacros and I have a problem during the compilation when I want to use greek letters inside the \ch{} command. Here is an example:

\ch{\Delta E=h.\nu}


A solution is to write this :

\ch{$\Delta E=h.\nu$}


However, I know that there is another solution as the initial command was already compiled on another computer. And as I have a 10,000 lines file, I cannot fix everything by hand...

Here is the package I loaded :

 \usepackage{upgreek}
\usepackage{chemmacros}
\usepackage{textgreek}
\chemsetup{greek=textgreek}
\usepackage{amsmath}


I am using MacTeX2016 with LaTeX v3.62 and the lastest chemmacros version.
Any idea? Thanks a lot for your help.

• That looks more like physics, not chemistry. Are you sure, the commands of chemformula are fitting your needs? – Johannes_B Jul 18 '16 at 8:43
• Reason i am asking: There is a difference between a variable (typeset italic) and a chemical element (typeset upright). – Johannes_B Jul 18 '16 at 8:46

\ch{\Delta E=h.\nu} should never have worked (I surely never intended it to). Also it doesn't make sense: $\Delta E=h\nu$ is a mathematical formula and not a chemical one. If you need math in a chemical formula chemformula offers to surround the entry with $…$ as you've already discovered.

Using \ch{$\Delta E=h.\nu$} is still wrong – not only semantically: the spacing is also wrong. Use \ch for chemical formulae and equations and math mode for math expressions and equations.

\documentclass{article}
\usepackage{chemformula}

\begin{document}

wrong: \ch{$\Delta E=h.\nu$} \par
correct: $\Delta E=h\cdot\nu$\par
correct: $\Delta E=h\nu$

\bigskip

correct: \ch{H2SO4} \par
wrong: $H_2SO_4$

\end{document}


\Delta E=h.\nu is invalid syntax for the chemmacros \ch environment, but will compile in the \ce environment from mhchem.

Inclusion of upgreek will clear italicization from nu.

\documentclass{article}
\usepackage{mhchem}
\usepackage{upgreek}
\begin{document}

{a.} \ce{\Delta E=h.\nu}\\

{b.} $\Delta E=h.\nu$

\end{document}


• It will compile but I wouldn't call it valid syntax for mhchem, either! Also the spacing is wrong – cgnieder Aug 20 '16 at 23:54