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

Code, edit and compile here:
\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}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
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

Code, edit and compile here:
\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}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
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

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Bartman
Posts: 369
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)
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Code: Select all

(\#eq:relative-humidity)
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
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