标签归档:Chemical equation

How to Display Decimal Numbers in Chemical Equations with LaTeX mhchem Package?

Like many people who use LaTeX, I like using the mhchem package to type chemical equations, but there was a problem I met when I was typing numbers with decimal in mhchem package, e.g. if an equation is written as follows,

\ce{3.043 Fe2O3}

decimal numbers in chemical equations

mhchem would gives the result 3·043 Fe2O3 instead of the expected 3.043 Fe2O3. The dot here is actually for the center dot in chemistry equations. But we need the mathematical decimal dot (period).

because mhchem normally does not render the dot as decimal. I tried several methods to make the decimal dot does not display at the middle, e.g. a possible method can be

\ce{\text{3.043} Fe2O3}

though it is not so handy and looks a bit weird (numbers display as plain texts). Finally, I found the following trick works:

\ce{$3.043$ Fe2O3}

decimal numbers in chemical equations

just use maths-escape mode, using $$ to embrace the number. There should not be any white spaces between $ and the number otherwise the compiling would go wrongly, though this is not the case in normal equations.

中文:在LaTeX mhchem包中输入带小数点数字的化学公式时,用美元符号$$将小数点数字包括起来,就可以正常显示小数点而不是在中间位置的点,$与数字之间不得有空格。