4

I have defined a new counter to track chemical reactions listed in a Table

\begin{table}
\begin{tabular}{clccr} \hline
\#   & Reaction                           &  $\log_{10}A$ &  $n$  & $E_A$ \\ \hline
\rxn & 2(3H)-furanone $\to$~2-propenal + CO               &  23   & 1.234 & 202.3 \\
\rxn & 2(3H)-furanone $\to$~4-oxo-3-butenal               &  23   & 1.234 & 202.3 \\ 
\rxn & 2(3H)-furanone $\to$~2-butenedial                  &  23   & 1.234 & 202.3 \\
\rxn & 2(3H)-furanone $\to$~2-furanol                     &  23   & 1.234 & 202.3 \\ \hline
\end{tabular}
\caption{High-pressure limit rate constant parameters; units: s$^{-1}$, kJ mol$^{-1}$}
\label{kinetics}
\end{table} 

But how can I cross-reference? For example, in the main text reaction~\ref{a} has a much higher barrier than reaction~\ref{d} ...

LaTeX and plain old article class; the counter is set in the preamble as:

\newcounter{iso} % A new counter to track chemical reactions aka "equations"
\setcounter{iso}{1} %
\newcommand{\rxn}{(\oldstylenums{\theiso})\stepcounter{iso}}% Tabular numbering

John

0

2 Answers 2

4

You need \refstepcounter not \stepcounter and to use that before printing the number with \theiso, so also delete the line

\setcounter{iso}{1} %

you can then go \rxn\label{foo} for any row that you need to reference and \ref{foo} will reference it.

3

You need to use \refstepcounter instead of \stepcounter to increment the counter variable iso, and you need to provide a \label instruction after the "iso" counter is incremented (and displayed).

You can get automatically generated labels if you provide following instructions in the preamble:

\newcounter{iso}
\newcommand{\rxn}{\refstepcounter{iso}%
                  \label{iso:\theiso}%
                  (\oldstylenums{\theiso})}

You can then cross-reference the third "equation" by typing

\ref{iso:3}

Addendum: If you want symbolic-name rather than automatic-name \labels associated with some or all of the "equations", you can get them the old-fashioned way, i.e., by typing \label{rxn:whatever} in the cell after \rxn.

I assume you'll want to have the cross-referenced numbers typeset in "oldstyle" and surrounded by parentheses. If you have more than just a couple of such cross-references, it pays to set up a dedicated macro called, say, \osref (short for "oldstyle \ref") to simplify creating these cross-references:

\newcommand\osref[1]{(\oldstylenums{\ref{#1}})}

With this macro set up, you can type something like

As shown by reaction~\osref{rxn:whatever}, \ldots

to generate the properly formatted cross-references.

4
  • automatic labelling is evil: if you know the number is 3 you can just use 3 no need for ref{iso:3} labels should be symbolic names disconnected from the numbering Oct 6, 2014 at 8:55
  • Okay I would prefer symbolic labels but how does one achieve this? Displayed math mode is not possible within tabular (?) and text math does not allow labelling. The reaction counter is still required because we are not sure how many items will appear in the final Table. Oct 6, 2014 at 9:19
  • @JohnSimmie - Please see the addendum to my answer.
    – Mico
    Oct 6, 2014 at 9:23
  • @JohnSimmie Just use \label and \ref (although \label has to be in the first column as Mico has added, I noted that in my answer as well:-) Oct 6, 2014 at 10:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.