Environment for chemical reaction with reference
You can define new Reaction
command; I also would suggest to use rxn
acronym instead of rea
for better code readability (rxn stands exclusively for "reaction", whereas "rea" has numerous meanings). Adapted from my answer:
\documentclass{article}
\usepackage{amsmath,}
\usepackage{chemmacros}
\chemsetup{
modules = {reactions},
formula = mhchem,
reactions/tag-open = {(},
reactions/tag-close = {)},
}
\usepackage{hyperref}
\newcommand{\rxnref}[1]{Reaction~\ref{#1}}
\begin{document}
You can see the chemical decomposition at \rxnref{rxn:bla} and its mathematical representation in \autoref{eq:foo}.
\begin{equation}\label{eq:foo}
t^2 + 27t
\end{equation}
\begin{reaction}\label{rxn:bla}
\ce{SiC + 2O2 -> CO2 + SiO2}
\end{reaction}
\end{document}
With the code of a previous answer of mine and some additions
\documentclass{article}
\usepackage{amsmath}
\usepackage{chemmacros}
\usepackage{hyperref}
\makeatletter % patchcmd from etoolbox, loaded by chemmacros
\patchcmd{\hyper@makecurrent}
{\edef\Hy@param{#1}}
{\xHy@param@def{#1}}
{}{}
\def\xHy@param@def#1{%
\edef\@tempa{\csname theH#1\endcsname}%
\edef\@tempa{\expandafter\@car\@tempa\@nil}%
\edef\Hy@param{\if R\@tempa reaction\else#1\fi}%
}
\makeatother
\newcommand\reactionautorefname{Reaction}
\chemsetup{
modules = {reactions},
formula = mhchem,
reactions/tag-open=(R,
reactions/tag-close=),
}
\begin{document}
You can see the chemical decomposition at \autoref{rea:bla} and its
mathematical representation in \autoref{eq:foo}.
\begin{equation}\label{eq:foo}
t^2 + 27t
\end{equation}
and there is a reaction
\begin{reaction}\label{rea:bla}
\ce{SiC + 2O2 -> CO2 + SiO2},
\end{reaction}
\end{document}