3

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.

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

2 Answers 2

7

\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}

enter image description here

1

\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}

enter image description here

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

You must log in to answer this question.

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