Math & Sciencereferencing a non-existing label in equation

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
kalmer
Posts: 3
Joined: Sat Apr 02, 2022 9:58 pm

referencing a non-existing label in equation

Post by kalmer »

i use align as in the following example:

Code: Select all

\begin{align}
RH :&= \cfrac{m_w}{m_\text{sat}(w)} = \cfrac{M_w \cdot n_w}{M_\text{sat}(w) \cdot n_\text{sat}(w)} = \cfrac{M_w \cdot \frac{p_w \cdot \cancel{V}}{\cancel{R \cdot T}}}{M_\text{sat}(w) \cdot \cfrac{p_\text{sat}(w) \cdot \cancel{V}}{\cancel{R \cdot T}}} = \frac{p_w}{p_\text{sat}(w)}\\
&= \frac{\frac{W \times p}{W + `r M_w_TO_M_d`}}{p_\text{sat}(w)} = \frac{W \times p}{(W + `r M_w_TO_M_d`) \cdot p_\text{sat}(w)} = \frac{x_w}{x_\text{sat}(w)}|_{T, P}
(\#eq:relative-humidity)
\end{align}
Based on this source code, a multi-line equation will be created having two numeric labels on the right-hand side, one for each line. If i want to reference the the equation, i use \@ref(eq:relative-humidity) and that works fine. However, i want to refer the first line, not the second line. How can i do that? i tried the following:

Code: Select all

\begin{align}
RH :&= \cfrac{m_w}{m_\text{sat}(w)} = \cfrac{M_w \cdot n_w}{M_\text{sat}(w) \cdot n_\text{sat}(w)} = \cfrac{M_w \cdot \frac{p_w \cdot \cancel{V}}{\cancel{R \cdot T}}}{M_\text{sat}(w) \cdot \cfrac{p_\text{sat}(w) \cdot \cancel{V}}{\cancel{R \cdot T}}} = \frac{p_w}{p_\text{sat}(w)}\\(\#eq:relative-humidity-ratio-of-pressures)
&= \frac{\frac{W \times p}{W + `r M_w_TO_M_d`}}{p_\text{sat}(w)} = \frac{W \times p}{(W + `r M_w_TO_M_d`) \cdot p_\text{sat}(w)} = \frac{x_w}{x_\text{sat}(w)}|_{T, P}
(\#eq:relative-humidity)
\end{align}
That resulted with:
! Package amsmath Error: Multiple \label's: label 'eq:relative-humidity-ratio-of-pressures' will be lost.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
Bartman
Posts: 366
Joined: Fri Jan 03, 2020 2:39 pm

referencing a non-existing label in equation

Post by Bartman »

Please expand your example to a complete Infominimal working example that produces your error message.

A line in the align environment can only be referenced if one \label command precedes the end of the line. In your case the first line would have no label and the second two or multiple, as the error message states.
Kreuz Elf
Posts: 22
Joined: Thu Mar 04, 2021 7:33 pm

referencing a non-existing label in equation

Post by Kreuz Elf »

Code: Select all

(\#eq:relative-humidity-ratio-of-pressures)

Code: Select all

(\#eq:relative-humidity)
I've not seen this syntax before. Maybe it is a legit variant, but consider using \lable{eq:relative-humidity-ratio-of-pressures}
Post Reply