user3834981
user3834981

Reputation: 11

Numbering each line of equation in Latex

Is there a way to label every line of multiline equation with a separate subindex?

For example, I would like to obtain sth like (in the output)

a = b (1.23.1)

c = d (1.23.2)

= f (1.23.3)

and then be able to refer to either whole multiline equation ("As seen in 1.23 bla bla bla...") or to a specific line ("In 1.23.3 we have redefined d...").

Upvotes: 1

Views: 26158

Answers (1)

Harley Day
Harley Day

Reputation: 101

For anyone wanting the answer to this query, here's a useful tex.stackexchange answer: https://tex.stackexchange.com/questions/118086/numbering-all-lines-of-an-array

The essentials are as follows:

%% in your preable
\usepackage{amsmath}

%% in your document
\begin{subequations}
\begin{align}
% YOUR MULTILINE MATHEMATICS WITH & ALIGNMENT CHARACTERS AND \\ NEWLINE MARKERS
% place \label{THIS-LINE} on each line, and you can cross-reference the line using \ref{THIS-LINE}
\end{align}
% place a \label{WHOLE-THING} here, and you can cross-reference the whole thing using \ref{WHOLE-THING}
\end{subequations}

Here's an example:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}

\begin{document}

\begin{subequations}
\begin{align}
\frac{\mathrm{d} x}{\mathrm{d} t} &=\sigma(y-x)\label{eqn:line-1} \\
\frac{\mathrm{d} y}{\mathrm{d} t} &=x(\rho-z)-y\label{eqn:line-2} \\
\frac{\mathrm{d} z}{\mathrm{d} t} &=x y-\beta z
\end{align}
\label{eqn:all-lines}
\end{subequations}

Look at the first line \ref{eqn:line-1}, and now look at the second line \ref{eqn:line-2}. They are both part of the whole system \ref{eqn:all-lines}.

\end{document}

Multiline mathematics with each line labelled as number+letter and cross-referencing for each line and the whole system

Upvotes: 7

Related Questions