Math & ScienceMultiple-lined Equations each with (a,b) Tag

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
Santeri
Posts: 3
Joined: Wed Sep 28, 2011 5:40 am

Multiple-lined Equations each with (a,b) Tag

Post by Santeri »

I would very much appreciate any help towards solving the following problem. I am trying display multiline equations, each of which is split into two separate equations on the same line, each with an (a,b) appear in front of the equation number in the equation tag, but which can be cross-refenced to give the equation number only (using, for instance, (\ref{eq}$a$)).

For single split equations I would normally achieve this with the equation environment and the \eqno command using the following code

Code: Select all

\begin{equation*}
\label{eq:abcd}
\refstepcounter{equation}
a = b \qquad c = d
\eqno{(\theequation \textit{a,b})}
\end{equation*}
Unfortunately however, \eqno does not work in the \align environment so, for instance,

Code: Select all

\begin{align*}
\label{eq:abcd}
\refstepcounter{equation}
a = b \qquad c = d
\eqno{(\theequation \textit{a,b})} \\
\label{eq:abcd2}
\refstepcounter{equation}
a = b \qquad c = d
\eqno{(\theequation \textit{a,b})}
\end{align*}
yeilds a "you can't use \eqno in math mode" error.

Note that including a \tag command according to

Code: Select all

\tag{(\theequation \textit{a,b})}
does give the desired result because then cross-referencing always includes the a,b part in full, e.g. (1a,b), whereas I would like to reference the two parts individually, e.g. (1a) and (1b).

Does anybody know of any way of achieving the desired (a,b) tag for equations on multiple lines?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

torbjorn t.
Posts: 162
Joined: Wed Jun 17, 2009 10:18 pm

Multiple-lined Equations each with (a,b) Tag

Post by torbjorn t. »

Amsmath provides a subequations environment that does this.

Code: Select all

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{subequations}
  \begin{align}
    a &= b \\
    c &= d
  \end{align}
\end{subequations}
\end{document}
Santeri
Posts: 3
Joined: Wed Sep 28, 2011 5:40 am

Re: multiple line equations each with (a, b) tag

Post by Santeri »

Thank you very much for the suggestion.

I had tried using the \subequation environment - However, this environment seems to tag each equation with ascending letters (1a), (1b), etc. but does not provide a tag, such as (1a,b), appropriate for two equations on one line.

To clarify my original post, is there a way to tag the equation as (1a,b) in, for example, in the \align environment, but cross reference it in the form (1a) or (1b) using, for instance, (\ref{eq}$a$) ?

Thanks again.
Santeri
Posts: 3
Joined: Wed Sep 28, 2011 5:40 am

Multiple-lined Equations each with (a,b) Tag

Post by Santeri »

Aha - I sound a solution to my question.

The style file subeqnarray.sty

(Copyright (C) 1988 by Johannes Braams, Dr Neher Laboratories)

has the \subeqnarray environment, which provides the required result according to

Code: Select all

\gdef\thesubequation{\theequation \textit{a,b}}
\begin{subeqnarray}
\label{eq:1}
A &=& B \qquad C = D, \\
\label{eq:2}
\refstepcounter{equation}
a &=& b \qquad c = d.
\end{subeqnarray}
Post Reply