## LaTeX forum ⇒ Math & Science ⇒ How to properly label two aligned equations on the same line? Topic is solved

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Cham
Posts: 898
Joined: Sat Apr 02, 2011 4:06 pm

### How to properly label two aligned equations on the same line?  Topic is solved

I rarely do the following (it's the first time, actually!). To save space on a page, I have to align two labeled equations on the same line. Then I need to make a reference to these equations in the text. The MWE below reproduce the issue :

\documentclass[]{article}\usepackage{amsmath}\begin{document} Here are two funny equations :	\begin{align}	\label{a label}		a &= b,		& c &= d.	\end{align}Equation \eqref{a label}a is not the same as equation \eqref{a label}b. \end{document}

I need the equation numbers to be properly shown as (1a) and (1b), not as (1)a and (2)b like what is done by hand in this code. What should be the proper way of doing this?

Cham
Posts: 898
Joined: Sat Apr 02, 2011 4:06 pm
Ok, forget it! I solved my problem simply by reformulating the text itself.

Stefan Kottwitz
Posts: 9323
Joined: Mon Mar 10, 2008 9:44 pm
Hi Cham,

a proper way could be using the subequations environment:

\documentclass{article}\usepackage{amsmath}\begin{document}\noindentHere are two funny equations :\begin{subequations}  \begin{equation}    \label{eq-a}      a = b  \end{equation}  \begin{equation}    \label{eq-b}    c = d  \end{equation}\end{subequations}Equation \eqref{eq-a} is not the same as equation \eqref{eq-b}. \end{document}

subequation.png (11.68 KiB) Viewed 3812 times

Stefan

Cham
Posts: 898
Joined: Sat Apr 02, 2011 4:06 pm
Can you place the two equations side by side, on the same line ?

Stefan Kottwitz
Posts: 9323
Joined: Mon Mar 10, 2008 9:44 pm
There's support for side by side and alignment in general, just mixing in sub-numbering in aligned environments is not so common and less supported by default. For example, there cannot be several labels for references in the same align environment line.

But it's easy doing it with \parbox or \minipage and in the same way above. Or here, I simply use tabularx, the X columns share the available space symmetrically, in the middle I just have a column for separation space. It's not so unusual: for arranging stuff in columns, a table is a natural choice.

\documentclass{article}\usepackage{amsmath}\usepackage{tabularx}\begin{document}\noindentHere are two funny equations : \begin{subequations}  \begin{tabularx}{\textwidth}{Xp{2cm}X}  \begin{equation}    \label{eq-a}      a = b  \end{equation}  & &  \begin{equation}    \label{eq-b}    c = d  \end{equation}  \end{tabularx}\end{subequations}Equation \eqref{eq-a} is not the same as equation \eqref{eq-b}. \end{document}

subequation-table.png (12.03 KiB) Viewed 3806 times

Stefan

Cham
Posts: 898
Joined: Sat Apr 02, 2011 4:06 pm
Thanks a lot for the explanations and examples. May be usefull in the future.

JoshuaHampton
Posts: 1
Joined: Thu Dec 28, 2017 10:35 am
The amsmath package provides a handful of options for displaying equations. You can choose the layout that better suits your document, even if the equations are really long, or if you have to include several equations in the same line.

Contents
1 Introduction
2 Including the amsmath package
3 Writing a single equation
4 Displaying long equations
5 Splitting and aligning an equation
6 Aligning several equations
7 Grouping and centering equations