## LaTeX forum ⇒ Math & Science ⇒ Cross-referencing with mhchem package

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Sonntag
Posts: 13
Joined: Sun May 24, 2015 3:37 pm

### Cross-referencing with mhchem package

Hi!
\reaction{H2 + OH* <=> H2O + H*}

I want to cross-reference an equation that I've introduced with the reaction-environment from the mhchem package. How can I do it? Hope for your answers.

Sonntag

Tags:

Johannes_B
Site Moderator
Posts: 4186
Joined: Thu Nov 01, 2012 4:08 pm
Hi and welcome,

\documentclass{article}\usepackage[version=3]{mhchem}\begin{document}\reaction{H2 + OH* <=> H2O + H*} \label{Water} See reaction~\ref{Water}\end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

Sonntag
Posts: 13
Joined: Sun May 24, 2015 3:37 pm
Here is a short mini-example:

\documentclass{article} \usepackage { chemexec }\usepackage[version=4,arrows=pgf-filled]{mhchem}	 \begin{document}\reaction{O2 + H* <=> OH* + O*} \end{document}

Johannes_B
Site Moderator
Posts: 4186
Joined: Thu Nov 01, 2012 4:08 pm
Hm, interesting. I just poked the author to have a look at this. Clemens is a very active developer, maintining multiple packages like exsheets for exam sheets and chemmacros for a whole bundle of chemistry stuff, more customizable than mhchem.

As it stands now, the package is from 2011, but not declared obsolete. Currently, your code is giving an option clash, that should be fixed within chemexec. I recommend to use the above mentioned and more up-to-date packages.

\documentclass{article}\usepackage { chemexec }\usepackage[version=4,arrows=pgf-filled]{mhchem}\begin{document}\reaction{H2 + OH* <=> H2O + H* \label{Water}}See reaction~\ref{Water}\end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

Sonntag
Posts: 13
Joined: Sun May 24, 2015 3:37 pm

Johannes_B
Site Moderator
Posts: 4186
Joined: Thu Nov 01, 2012 4:08 pm
This might be an interesting read, thanks Clemens for sending me that link.
myChemistry
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

cgnieder
Site Moderator
Posts: 1993
Joined: Sat Apr 16, 2011 7:27 pm
chemexec has been my first attempt of writing a package ever. I knew little to nothing about writing a package and it is an obsolete package. Don't use it but use mhchem or chemmacros or chemformula instead. Using chemexec is at your own risk and I won't provide any support to any conflicts due to its usage.

Best regards
site moderator & package author

Sonntag
Posts: 13
Joined: Sun May 24, 2015 3:37 pm

In the other packages I couldn't find a command that numbers my reaction equations independantly from the math mode like chemexec does with the \reaction command. (It numbers reaction equations with "R1", "R2" etc.) There's a possibility to do this with the other packages that I haven't seen yet?

Sonntag

Johannes_B
Site Moderator
Posts: 4186
Joined: Thu Nov 01, 2012 4:08 pm
Sure, an up to date version needed.
\documentclass{article}\usepackage{chemmacros}\usepackage{showframe}\begin{document}\listofreactions\begin{reaction}	H2 + O* <=> OH* + H*\end{reaction}\renewtagform{reaction}[R ]{\{}{\}}\begin{reactions}	Ca + O &-> CaO \\	H2 + O* &<=> OH* + H*\end{reactions}\end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.