Adding letters to equation numbers

The amsmath package provides \tag{<whatever>} that allows you to tag (or number) an equation with <whatever> you want. Here's a minimal working example:

enter image description here

\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\begin{document}
\[
  f(x)=ax \qquad \text{and} \qquad g(x)=bx \tag{3.1.1a,b}\label{myeq}
\]
For example, see \eqref{myeq}.
\end{document}

If you don't want the parentheses around the \tag, use \tag* instead. With this, however, you can only reference the entire equation, not the separate components.


For the ability to reference either the main equation or the sub-equations as a whole, you could use the following setup:

enter image description here

\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\renewcommand{\theequation}{\thesubsection.\arabic{equation}}
\begin{document}
\setcounter{section}{2}% Just for illustrative purposes
\section{A section} \subsection{A subsection}
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis.%
\refstepcounter{equation}\label{myeqn1}% Correctly mark and label equation
\[
  f(x)=ax \qquad \text{and} \qquad g(x)=bx \tag{\theequation a,b}\label{myeqn2}
\]
For example, see~\eqref{myeqn1} and~\eqref{myeqn2}.
\end{document}​

The idea is to correctly step and reference (using \refstepcounter) the equation before it is typeset, and use the equation number in \tag (via \theequation) for appropriate labelling and referencing.


There is an easy way to do this automatically if you put the equations on seperate lines. The amsmath package provides an environment subequations which can easily be used in conjunction with the align environment for equations. For example:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{subequations}
\label{equations}
\begin{align}
  \label{eq:f}
  f(x)&=ax + b \\
  \label{eq:g}
  g(x)&=cx^2 + dx + e
\end{align}
\end{subequations}
For example, see \eqref{equations}.
Or see equations \eqref{eq:f} and \eqref{eq:g}.
\end{document}

\documentclass{article}
\usepackage{amsmath}

\makeatletter
\newcommand{\specialnumber}[1]{%
  \def\tagform@##1{\maketag@@@{(\ignorespaces##1\unskip\@@italiccorr#1)}}%
}
\newcommand{\specialeqref}[2]{\begingroup
  \def\tagform@##1{\maketag@@@{(\ignorespaces##1\unskip\@@italiccorr#2)}}%
  \eqref{#1}\endgroup}
\makeatother

\begin{document}
\begin{equation}
\specialnumber{a,b}\label{myeq}
a=b\qquad c=d
\end{equation}

\specialeqref{myeq}{a}

\end{document}

This doesn't work for alignment environments such as align and gather, though.

The argument to \specialnumber is added after the normal equation number. For references, you have to add it manually, so the \specialeqref command comes handy.