[Tex/LaTex] Proper chemical notation in chemmacros with names

chemistrychemmacros

I am using chemmacros for the reaction environment and chemformula to write the reaction equation below:

 \documentclass{article}
 \usepackage{chemmacros}
\begin{document}
\begin{reaction}%improper chemical subscripts
 {!(crystalline\ copper\ sulphate)( CuSO4. 5 H2O (s))} ->[heat] {!(anhydrous\ copper\ sulphate)( CuSO4(s))} + {!(water)(5 H2O(g)) }     
\end{reaction}
\begin{reaction}%improper chemical subscripts
 {!(crystalline\ copper\ sulphate)( CuSO$_4$. 5 H$_2$O (s))} ->[heat] {!(anhydrous\ copper\ sulphate)( CuSO$_4$(s))} + {!(water)(5 H$_2$O(g)) }     
\end{reaction}
\[%proper notation
\ch{!(crystalline\ copper\ sulphate)( CuSO4. 5 H2O (s))} \ch{->[heat]} \ch{!(anhydrous\ copper\ sulphate)( CuSO4(s))} + \ch{!(water)(5 H2O(g)) } 
\]
\end{document}

enter image description here

How do I get the proper chemical notation (last reaction in image) in a reaction environment with the names underneath the substances?

Best Answer

This is a question of leaving enough blanks between the different input types: there should be blanks around formulae and stoichiometric factors as well as around the dot for crystalline water. Here is how I would write it:

\documentclass{article}
\usepackage{chemmacros}
\begin{document}

\begin{reaction}
 !(crystalline\ copper\ sulphate)( CuSO4 . 5 H2O \sld )
 ->[heat]
 !(anhydrous\ copper\ sulphate)( CuSO4 \sld ) + !(water)( 5 H2O \gas ) 
\end{reaction}

\end{document}

enter image description here

Related Question