1

im working on my thesis and i have a major problem. I want to write down many equations with labels, bc i need the labels for references to explain those equations. Neither flalgin works with my texskill or gather. So now im writing you guys for help, im totall frustrated. This is my code

\documentclass{article} 
\usepackage{amsmath}

\begin{document}

\textbf{Minimiere:} 
\begin{flalign} 
Z=c_{max}  \\
\label{eins}
%\intertext{unter den Nebenbedingungen} \nonumber
\textbf{unter der Nebenbedingungen} \nonumber 
\hat{c}_{r,m,i}\leq c_{j,n,i} + \Omega\cdot\chi_{r,m,j,n}-\Omega ;\ \ \forall({r,m,i,j,n})\\\label{zwei}
\hat{c}_{r,m,i}\geq c_{j,n,i} - \Omega\cdot\chi_{r,m,j,n}-\Omega;\ \ \forall({r,m,i,j,n}) \\ 
\label{drei}
\end{flalign}


Die Zielfunktion in Gleichung \eqref{eq:eins} soll die Produktionsdauer des Programms(schedule) minimieren, welches der Fertigstellungszeit des letzten zu bearbeitenden Sublots im System entspricht.Die Bedingungen in Gleichung \eqref{eq:zwei} und \eqref{eq:drei} sagen beide aus

\end{document}

Why those the error occur that label eins will be lost ? My Plan is to build a gather or align equation environment like this:Equations

Can you help me guys?

2
  • 1
    Welcome to TeX.SX! The example code has several useless packages for the problem. Next time try and minimize it.
    – egreg
    Dec 1 '16 at 16:19
  • Crosspost
    – Johannes_B
    Dec 11 '16 at 7:11
2

There are a few problems with your code. One is that you need to use \label before \\. The second is that if you want to reference your equations by \ref{eq:equationname} then you have to label them using \label{eq:equationname}. The thing that goes inside the \label should be identical to the thing that goes in the \ref. Last, the commented out lines would cause a problem. The correct solution would be to say \intertext{blah blah blah} without using \nonumber. If you do want to use \nonumber, there should not be a label on the same line. Trying to use \nonumber and \label on the same line will cause Error: label "labelname" will be lost.

\documentclass[a4paper, 12pt]{article}
\usepackage[fleqn]{amsmath}
\setlength{\mathindent}{0pt}
\setlength{\parindent}{0pt}
\begin{document}

\textbf{Minimiere:}
\begin{flalign}
\label{eq:eins}Z&=c_{max}
\end{flalign}
\textbf{unter den Nebenbedingungen}
\begin{flalign}
\hat{c}_{r,m,i}\leq c_{j,n,i} + \Omega\cdot\chi_{r,m,j,n}-\Omega ;\ \ \forall({r,m,i,j,n})\label{eq:zwei}\\
\hat{c}_{r,m,i}\geq c_{j,n,i} - \Omega\cdot\chi_{r,m,j,n}-\Omega;\ \ \forall({r,m,i,j,n}) \label{eq:drei}
\end{flalign}


Die Zielfunktion in Gleichung \eqref{eq:eins} soll die Produktionsdauer des Programms(schedule) minimieren, welches der Fertigstellungszeit des letzten zu bearbeitenden Sublots im System entspricht.Die Bedingungen in Gleichung \eqref{eq:zwei} und \eqref{eq:drei} sagen beide aus

\end{document} 
9
  • hey thanks for helping me out. The Packages i got are from the institute where i am writing my thesis, they gave me those template. Can you tell me whats useless please?
    – Milo Li
    Dec 1 '16 at 23:08
  • thank you hood chatam! but now its not leftsided? and the intertext is not thick? how can i change that
    – Milo Li
    Dec 1 '16 at 23:10
  • Edited. It's not really possible for me to tell which of the packages you have loaded are useless from this little piece of your code. Dec 1 '16 at 23:18
  • my code is too long for hat comment window here... idk where to post it
    – Milo Li
    Dec 1 '16 at 23:40
  • 3
    For the first, single equation, I'd use equation instead of flalign. And \usepackage{parskip} might be a better idea than \setlength{\parindent}{0pt}. (+1 though). Dec 2 '16 at 5:24

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.