7

I'm writing a thesis in which I have both equations and chemical reactions.

I was wondering if it can be changed something in equations referencing, so that when you refer to one of them that is a reaction there is written Reaction 1.1 instead of Equation 1.1.

Is that possible, or do I have to use a different package for it?

I have seen that on some guides they suggest chemfig but none show how to enumerate it.

2
  • 3
    You might want to post some code. What exactly is used to have it print Equation 1.1
    – daleif
    Apr 6, 2016 at 17:42
  • 7
    by default \ref{..} just makes 1.1 so you would write Reaction \ref{myref} instead of Equation \ref{myref} If you are using a package provided command that produces other text you should say what code you are using. Apr 6, 2016 at 17:43

2 Answers 2

5

Your objective may be achieved by loading and using the cleveref package.

enter image description here

\documentclass{article}
\usepackage[colorlinks]{hyperref} % just for this example
\usepackage[nameinlink,noabbrev]{cleveref}
\crefname{reaction}{reaction}{reactions}

\begin{document}

\begin{equation} \label[reaction]{eq:triv} % note the optional argument
1+1=2
\end{equation}

\begin{equation} \label{eq:pyth}
a^2+b^2=c^2
\end{equation}

A cross-reference to \cref{eq:triv}, and another one to \cref{eq:pyth}.

\end{document}
5
  • I don't knwo why but it print both Reaction Equation 1.4... these are the packages i'm using \documentclass{uicthesi} \usepackage{siunitx} \usepackage{xfrac} \usepackage{graphicx} \usepackage{amsmath} \usepackage{algorithm2e} \usepackage{enumerate} \usepackage{amsfonts} \usepackage{enumitem} \usepackage{graphicx} \usepackage[nameinlink,noabbrev]{cleveref} \crefname{Reaction}{Reaction}{Reactions} \begin{equation} O_2 + 4e^- + 4H^+ \rightarrow 2H_2O \label[Reaction]{Cathode1} \end{equation} Apr 9, 2016 at 20:57
  • 1
    Some comments: (i) Don't load graphicx twice. (ii) Don't load both enumerate and enumitem; choose one or the other, but not both. (iii) Most importantly: where might one obtain the uicthesi document class from?
    – Mico
    Apr 9, 2016 at 21:10
  • 1
    @lorenzoD'angelo - I found a copy of uicthesi.cls on web. Please add the following instructions to your preamble to make the unwanted string Equation go away: \makeatletter \renewcommand\p@equation{} \makeatother.
    – Mico
    Apr 9, 2016 at 21:24
  • Done! It works perfectly!! Thank you very much for your help Apr 9, 2016 at 22:27
  • @lorenzoD'angelo - Glad it worked. Feel free to upvote and/or accept the answer. ;-)
    – Mico
    Apr 10, 2016 at 6:37
1

With an bleeding edge chemmacros the following is possible:

\documentclass{article}

\usepackage{chemmacros}[2016/05/04]
\chemsetup{ modules = {reactions} }

\usepackage[colorlinks]{hyperref} % just for this example
\usepackage[nameinlink,noabbrev]{cleveref}

\begin{document}

\begin{reaction} 
  2 H2 + O2 <=>> 2 H2O "\label{rct:water}"
\end{reaction}

\begin{equation}
  a^2 + b^2 = c^2  \label{eq:pyth}
\end{equation}

A cross-reference to \cref{rct:water}, and another one to \cref{eq:pyth}.

\end{document}

enter image description here


Of course this is different from Mico's answer since reactions and equations are numbered independently here.

2
  • That looks great for chemistry. Just curious: why are labels double-quoted label? May 8, 2016 at 12:08
  • @ChrisChudzicki per default chemmacros' reactions are parsed by the chemformula package. In order to prevent the parsing of the label as chemical formula I escaped the input with "…".
    – cgnieder
    May 8, 2016 at 12:10

You must log in to answer this question.

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