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?

Hood Chatham
  • 5,467
Milo Li
  • 347

1 Answers1

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} 
Hood Chatham
  • 5,467
  • 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 01 '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 01 '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. – Hood Chatham Dec 01 '16 at 23:18
  • my code is too long for hat comment window here... idk where to post it – Milo Li Dec 01 '16 at 23:40
  • thanks for editing! you are really nice ;) but minimiere and the first equation are still centerd and not on the left... – Milo Li Dec 01 '16 at 23:48
  • Edited again... – Hood Chatham Dec 02 '16 at 00:49
  • 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). – Torbjørn T. Dec 02 '16 at 05:24
  • thanks both of you ! how can i change the vertical space between the equations? and why is parskip better than parindent? – Milo Li Dec 02 '16 at 21:50
  • @MiloLi With just \setlength\parindent{0pt} there will be no good way to tell where one paragraph ends and the next one begins. The parskip package also sets zero parindent, but in addition increases the vertical space between paragraphs (\parskip) and, I think, does some other small adjustments. See http://tex.stackexchange.com/q/2929/586 for some methods to increase line spacing in multi-line equations, if that was what you meant. The question is about gather, but the same applies for flalign I believe. – Torbjørn T. Dec 03 '16 at 18:44