0

I am using fleqn and align to have the equations in my thesis centered but I noticed that I can't get the correct numbering.

    \documentclass[twoside]{article}

\usepackage{hyperref}
\usepackage{mathtools, nccmath}
\usepackage{geometry}
\geometry{
  inner=37.125mm,
  outer=33.4125mm,
  top=1.5cm,
  bottom=1.5cm,
  heightrounded,
 % bindingoffset=0.5cm,
 % marginparwidth=51pt,
 % marginparsep=17pt,
 % headsep=24pt,
}

\begin{document}

\section{One}

Something something something

\subsection{SubSection}

as shown in eq. \eqref{eq:cost_dlp}: 

\begin{fleqn}[\parindent] \label{eq:cost_dlp}
\begin{align}
 & C_{}=C_\mathrm{}+C_\mathrm{}+C_\mathrm{}+C_\mathrm{}+C_\mathrm{}    
\end{align}
 \end{fleqn}




\end{document}
  • If you use fleqn you don't have your equations centered. – egreg Dec 17 '16 at 16:44
  • also why this fleqn environment rather than the standard fleqn documentclass option? – David Carlisle Dec 17 '16 at 16:50
  • Maybe he wants only some equations to be near the left margin? – Bernard Dec 17 '16 at 16:56
0

The explanation is fairly simple: you didn't put the equation label inside the equation environment, so it refers to the current section. Not related, but if you use \cref from cleveref, you don't even have to type equation. Also, hyperref should be loaded as the last package, with very few exceptions (`cleverref is one of these):

\documentclass[twoside]{article}

\usepackage{mathtools, nccmath}
\usepackage{geometry}
\geometry{
  inner=37.125mm,
  outer=33.4125mm,
  top=1.5cm,
  bottom=1.5cm,
  heightrounded,
 % bindingoffset=0.5cm,
 % marginparwidth=51pt,
 % marginparsep=17pt,
 % headsep=24pt,
}

\usepackage{hyperref}
\usepackage{cleveref}
 \begin{document}

\section{One}

Something something something

\subsection{SubSection}

as shown in \cref{eq:cost_dlp}:

\begin{fleqn}[\parindent]
\begin{align}\label{eq:cost_dlp}
 & C_{}=C_\mathrm{}+C_\mathrm{}+C_\mathrm{}+C_\mathrm{}+C_\mathrm{}
\end{align}
 \end{fleqn}

\end{document} 

enter image description here

2

\label{…}always references the last counter being set using \refstepcounter{…}. Display formula counters are stepped at the start of the display, so just put the \label{…} inside the formula environment:

\documentclass{article}
\usepackage{mathtools, nccmath}
\begin{document}
\section{One}
Something something something
\subsection{SubSection}
as shown in eq. \eqref{eq:cost_dlp}: 

\begin{fleqn}[\parindent] 
    \begin{align}             
        \label{eq:cost_dlp}
        & C_{}=C_\mathrm{}+C_\mathrm{}+C_\mathrm{}+C_\mathrm{}+C_\mathrm{}    
    \end{align}
\end{fleqn}
\end{document}
2

Put the \label at the end of the equation:

 & C_{}=C_\mathrm{}+C_\mathrm{}+C_\mathrm{}+C_\mathrm{}+C_\mathrm{}    \label{eq:cost_dlp}

If you have more than one equation in the align, put the label for each equation just before the \\ or the end.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.