3

When I compile my code, I get an error "Package amsmath Error: Multiple \label's: label 'eq:melangeAFAf_avtVefaible' will be lost I don't understand it because I only have this label once in my code. Where could the error come from?

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage{inputenc} 
\usepackage[french]{babel}
\usepackage{amsmath}
\usepackage{chemgreek}
\usepackage[modules={all}]{chemmacros}%le module orbital a été commenté (lignes 3816 à 3824
%+\chemsetup{modules=all}
\usepackage{textgreek}
\chemsetup{greek=textgreek}


\begin{document}
        \begin{equation}
\sigma =\frac{C_b}{V_{a1} + V_{a2} + V_0 } \left(V \bigl(\lambda^0_{\ch{Na\pch{}}}- \lambda^0_{\ch{H3O\pch{}}}  \bigr) + V_{eq1} \bigl(\lambda^0_{\ch{H3O\pch{}}}  + \lambda^0_{\ch{Cl\mch{}}} \bigr)  \right)
            \label{eq:melangeAFAf_avtVefort}
            \end{equation}
\medskip
        \begin{align*}
            \sigma &=\lambda^0_{\ch{A\mch{}}} \ch{[A\mch{}]} + \lambda^0_{\ch{Cl\mch{}}} \ch{[Cl\mch{}]} + \lambda^0_{\ch{Na\pch{}}} \ch{[Na\pch{}]}\\
            \label{eq:melangeAFAf_avtVefaible}
            \end{align*}
\medskip
        \begin{align*}
            \sigma &=\lambda^0_{\ch{HO\mch{}}} \ch{[HO\mch{}]} + \lambda^0_{\ch{A\mch{}}} \ch{[A\mch{}]} + \lambda^0_{\ch{Cl\mch{}}} \ch{[Cl\mch{}]} + \lambda^0_{\ch{Na\pch{}}} \ch{[Na\pch{}]}\\
            \label{eq:melangeAfAF_apVefor}
            \end{align*}
\end{document}

THANKS

2
  • 8
    You are labelling an unnumbered equation (declared using align*). If you actually want to cross reference that equation, use align and not align*. Better yet, since you are equation appears to fit on one line with the second line being otherwise empty except for the label, you should rewrite those to use equation. Commented May 27 at 5:17
  • You could use \tag{...} so theat \ref has something to print. Commented May 27 at 21:20

1 Answer 1

3

I suspect that there's some interaction between amsmath and chemmacros. The solution is to comment out the faulty \label.

Anyway

  1. it doesn't make sense to \label a line in align*

  2. if you \label in align, the label should not go behind \\

  3. there should never be a trailing \\ in align or similar amsmath environments

  4. a single “equation” should not be set in align or other amsmath environment: use equation or equation*.

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\usepackage{amsmath}
\usepackage{chemgreek}
\usepackage[modules={all}]{chemmacros}%le module orbital a été commenté (lignes 3816 à 3824
%+\chemsetup{modules=all}
\usepackage{textgreek}
\chemsetup{greek=textgreek}


\begin{document}

\section{With \texttt{align}}

\noindent
Some really nonsense text equation long enough so it wraps to the next line and stops
\begin{equation}
  \sigma =\frac{C_b}{V_{a1} + V_{a2} + V_0 } \bigl(
    V \bigl(\lambda^0_{\ch{Na\pch}}- \lambda^0_{\ch{H3O\pch}}  \bigr) +
    V_{eq1} \bigl(\lambda^0_{\ch{H3O\pch}}  + \lambda^0_{\ch{Cl\mch}} \bigr)
  \bigr)
  \label{eq:melangeAFAf_avtVefort}
\end{equation}
Some really nonsense text equation long enough so it wraps to the next line and stops
\begin{align}
  \sigma &=
  \lambda^0_{\ch{A\mch}} \ch{[A\mch]} +
  \lambda^0_{\ch{Cl\mch}} \ch{[Cl\mch]} +
  \lambda^0_{\ch{Na\pch}} \ch{[Na\pch]}
  \label{eq:melangeAFAf_avtVefaible}
\end{align}
Some really nonsense text equation long enough so it wraps to the next line and stops
\begin{align}
  \sigma &=
  \lambda^0_{\ch{HO\mch}} \ch{[HO\mch]} +
  \lambda^0_{\ch{A\mch}} \ch{[A\mch]} +
  \lambda^0_{\ch{Cl\mch}} \ch{[Cl\mch]} +
  \lambda^0_{\ch{Na\pch}} \ch{[Na\pch]}
  \label{eq:melangeAfAF_apVefor}
\end{align}
Some really nonsense text equation long enough so it wraps to the next line and stops

\section{With \texttt{align}}

\noindent
Some really nonsense text equation long enough so it wraps to the next line and stops
\begin{equation}
  \sigma =\frac{C_b}{V_{a1} + V_{a2} + V_0 } \bigl(
    V \bigl(\lambda^0_{\ch{Na\pch}}- \lambda^0_{\ch{H3O\pch}}  \bigr) +
    V_{eq1} \bigl(\lambda^0_{\ch{H3O\pch}}  + \lambda^0_{\ch{Cl\mch}} \bigr)
  \bigr)
  \label{eq:melangeAFAf_avtVefort}
\end{equation}
Some really nonsense text equation long enough so it wraps to the next line and stops
\begin{equation}
  \sigma =
  \lambda^0_{\ch{A\mch}} \ch{[A\mch]} +
  \lambda^0_{\ch{Cl\mch}} \ch{[Cl\mch]} +
  \lambda^0_{\ch{Na\pch}} \ch{[Na\pch]}
  \label{eq:melangeAFAf_avtVefaible}
\end{equation}
Some really nonsense text equation long enough so it wraps to the next line and stops
\begin{equation}
  \sigma =
  \lambda^0_{\ch{HO\mch}} \ch{[HO\mch]} +
  \lambda^0_{\ch{A\mch}} \ch{[A\mch]} +
  \lambda^0_{\ch{Cl\mch}} \ch{[Cl\mch]} +
  \lambda^0_{\ch{Na\pch}} \ch{[Na\pch]}
  \label{eq:melangeAfAF_apVefor}
\end{equation}
Some really nonsense text equation long enough so it wraps to the next line and stops

\end{document}

enter image description here

You should be able to notice the too large vertical space in the first section.

3
  • I believe the second section should be titled "With equation" :-)
    – campa
    Commented May 27 at 8:46
  • @campa D'oh! as somebody would say.
    – egreg
    Commented May 27 at 8:47
  • thanks @egreg. For the "single" equation, it's just that I simplified the equation to a single line so as not to overload the code (but in reality I have several lines hence the align environment and not equation)
    – Nicolas
    Commented May 27 at 9:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .