2

I would like to use a reference style that I've seen in some older papers where the author will have several equations in the same line, but only one reference number for all of them. Then if the author wants to reference just one of the equations in that line, they will use a subscript or superscript to do so. Example:

a+b=c ; a*b=d  .................. (1)

Therefore, the equation with a sum a+b=c is given by equation (1)a.

Here is a MWE:

\documentclass[12pt]{article}
\usepackage{amsmath} % Extra Math Stuff
\begin{document}

I would like to have 3 equations together like this
\begin{equation}
A+B=C %\label{eq:sum}
\quad\textrm{,}\quad
A\times B=D %\label{eq:mul}
\qquad\textrm{,}\quad
A/B=D %\label{eq:div}
\label{eq:tog}
\end{equation}

And now I would like to either reference all equations in \eqref{eq:tog} or each of them individually, which should look like \eqref{eq:tog}$_a$, \eqref{eq:tog}$_b$ and \eqref{eq:tog}$_c$.

\end{document}
  • You mean that you would like a different way of doing this than is shown in your MWE? The solution you already have is by far the most natural and easiest way to do this. If you don't like this way of doing it then can you add some more detail saying what sort of solution you would like? – Andrew Nov 9 '16 at 1:27
1

\eqref sets the reference in \upshape using double nesting (from amsmath.dtx):

\newcommand{\eqref}[1]{\textup{\tagform@{\ref{#1}}}}

What I've done below is to create a manual reference that assumes you'll use \eqref{<subref>}, and therefore delays the printing of the sub-equation number by two groups (using a nested \AfterGroup from etextools):

enter image description here

\documentclass{article}

\usepackage{amsmath,etextools}

\newcounter{subeqn}[equation]
\renewcommand{\thesubeqn}{\alph{subeqn}}
\makeatletter
\newcommand{\sublabel}[1]{{%
  \stepcounter{subeqn}
  \def\@currentlabel{\theequation\protect\AfterGroup{\protect\AfterGroup{\protect\textsubscript{\thesubeqn}}}}%
  \ltx@label{#1}%
}}
\makeatother

\begin{document}

I would like to have 3 equations together like this:
\begin{equation}
  A + B = C \sublabel{eq:sum}
  \textrm{,}\qquad
  A \times B = D \sublabel{eq:mul}
  \textrm{,}\qquad
  A \div B = D \sublabel{eq:div}
  \label{eq:tog}
\end{equation}

And now I would like to either reference all equations in \eqref{eq:tog} 
or each of them individually, which should look like \eqref{eq:tog}$_a$, 
\eqref{eq:tog}$_b$ and \eqref{eq:tog}$_c$.

And now I would like to either reference all equations in \eqref{eq:tog} 
or each of them individually, which should look like \eqref{eq:sum}, 
\eqref{eq:mul} and \eqref{eq:div}.

\end{document}
  • Note: You must use \eqref to reference the sub-equations. – Werner Nov 9 '16 at 17:45

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.