# How to place equation number below formula?

I have 3 matrices and I want them to be in one row, with a reference number below each matrix. How do I get the equation number below a formula? (similar to subfigure)

From the comments: - I want to reference the equations via \ref - The subequation tag was that because I have the impression that it could work like subfigure, but I could not see a way so far

• Do these equation numbers need to be accessible by way of the \ref macro? – Steven B. Segletes Oct 5 '16 at 11:07
• You've set the subequations tag. Does this mean that you're using a subequations environment for the three equations? Please advise. – Mico Oct 5 '16 at 11:07

You could put them in a tabular (or better tabularx) environment, or in minipages. And do the equation number handling yourself.

\documentclass{article}
\usepackage{amsmath}
\usepackage{tabularx}
\newcommand\makeeqno{\refstepcounter{equation}(\theequation)}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\begin{document}

\begin{tabularx}{0.7\textwidth}{CCC}
$\begin{pmatrix} a & b \\ c & d \end{pmatrix}$
&
$\begin{pmatrix} 11 & 12 \\ 21 & 22 \end{pmatrix}$
&
$\begin{pmatrix} A & B \\ C & D \end{pmatrix}$
\\
\makeeqno \label{first} & \makeeqno \label{second} &\makeeqno \label{third}\\
\end{tabularx}

Now refer to equation \ref{first} and equation \ref{third}.

Another equation:
$$\label{eq:4} E = m c^2$$
\end{document}


Or with minipages:

\documentclass{article}
\usepackage{amsmath}
\newcommand\makeeqno{\refstepcounter{equation}(\theequation)}
\newenvironment{mip}{
\begin{minipage}{3cm}\begin{center}}{\end{center}\end{minipage}}
\begin{document}
\begin{mip}
$\begin{pmatrix} a & b \\ c & d \end{pmatrix}$\\
\makeeqno \label{first}
\end{mip}
\begin{mip}
$\begin{pmatrix} 11 & 12 \\ 21 & 22 \end{pmatrix}$\\
\makeeqno \label{second}
\end{mip}
\begin{mip}
$\begin{pmatrix} A & B \\ C & D \end{pmatrix}$\\
\makeeqno \label{third}
\end{mip}

Now refer to equation \ref{first} and equation \ref{third}.

Another equation:
$$\label{eq:4} E = m c^2$$
\end{document}


Writing an environment to do this seems tricky as I can't think of a nice syntax that caters for both the "column" entries and the labels for the corresponding equation numbers (this is not to say that this is not possible only that I didn't think of a way:).

Here is a way to do want you want "by hand": the matrices are put into an array environment and then the equation numbers are added below them using a macro \addlabel. This macro takes one argument, the label name, and then increments and prints the equation number and adds the \label. Since you mention subeqations I assume that you are using the amsmath package.

Here is the output:

and here is the code:

\documentclass{article}
\usepackage{amsmath}
\makeatletter
\newcommand\addlabel[1]{% using \label causes spurious so use \ltx@label
\refstepcounter{equation}(\theequation)\ltx@label{#1}}
\makeatother

\begin{document}

$\begin{array}{ccc} \begin{pmatrix}1&0&0\\0&1&0\\0&0&1\end{pmatrix} & \begin{pmatrix}1&0&0\\0&1&0\\0&0&1\end{pmatrix} & \begin{pmatrix}1&0&0\\0&1&0\\0&0&1\end{pmatrix} \\[1mm]% add some extra space after the equation line % now add labels to matrices \addlabel{one} & & \addlabel{three} \end{array}$

See equations \ref{one} and \ref{three}.
\end{document}


I have left out an equation number for the second matrix only to show that this is possible.

The definition of \addlabel is more convoluted than you might expect because it calls \ltx@label. This is because amsmath redefines \label so that it can check for various errors, including having more than one label or the same equation, so we get warnings if we try to use \label. In fact, \ltx@label is the "real" latex \label command, so we can avoid the amsmath warnings by using it.