January 17, 2013

Equation numbering in LaTeX: several versions of the same formula

When deducing a result one might need to write a formula several times, in slightly different form, as the proof proceeds. Using different equation numbers (default LaTeX behaviour) fails to show the unity between the various expressions. On the other hand, using only the \tag{} keyword (defined in the amsmath package) sets them completely apart from the other equations in the sequence.

It took me some time to realize that these two approaches can be combined very easily, as shown below:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation}
E=ma^2
\label{energy}
\end{equation}
\begin{equation}
a = b
\end{equation}
\begin{equation}
E=mb^2
\tag{\ref{energy}bis}
\end{equation}
\begin{equation}
b = c
\end{equation}
\begin{equation}
E=mc^2
\tag{\ref{energy}ter}
\end{equation}
\end{document}

yielding the desired result:
\begin{equation}
E=ma^2
\label{energy}
\end{equation}
\begin{equation}
a = b
\end{equation}
\begin{equation}
E=mb^2
\tag{\ref{energy}bis}
\end{equation}
\begin{equation}
b = c
\end{equation}
\begin{equation}
E=mc^2
\tag{\ref{energy}ter}
\end{equation}

No comments:

Post a Comment