I have written the following piece of latex (ignore the formulas, don't make sense) \begin{gather}     \min \quad \sum_{i=1}^{n} a_i b_i, \nonumber \\     \begin{align}         \sum_{i=1}^{n} a_{i} \geq i&amp;,   &amp; \forall i &amp;= 1, \ldots, m, \label{eqn1} \\          \sum_{i=1}^{n} b_{i} \geq i&amp;,   &amp; \forall i &amp;= 1, \ldots, m, \label{eqn2} \\          a_{ij}          \in \{0,1\}&amp;,   &amp; \forall i &amp;= 1, \ldots, n, \; \forall j = 1, \ldots, n \nonumber     \end{align} \end{gather}  and I get the error: ! Package amsmath Error: Multiple \label's: label 'eqn1' will be lost. From what I have found online this happens when more than one labels refers to the same equation, but I don't know how to solve it. P.S., side questions: what's the best way to align the stuff inside the align block?  does not work in my case: I need to \label two lines/equations inside the inner align environment, whereas the linked answer works only if you have one label inside the align environment and the other one outside.
122336
I have nested gather and align according to  \begin{gather}        \sum\limits_{i=1}^n i + \text{expression} = \dfrac{n(n-1)}{2} \label{l1}\\        \begin{align}             a+\text{expression}&amp;=b \\ %\label{l2} doesnt work             c&amp;=d+\text{expression} \\             e+\text{long expression}&amp;=f-\text{expression}        \end{align}  \end{gather}   to get an output looking like this:   The problem is that it is not possible to label all equations separately. The problem is identical to that discussed in , except  that in my problem the first line needs to be centered.  Thanks for any help.
93051
I have a long equation in LaTeX, which I need to break up into more lines. I've done this, although its not quite what I was looking for. Here is a MWE showing my problem:  \documentclass[10pt]{article}  \usepackage[T1]{fontenc} \usepackage{amsmath, amsthm, amssymb} \usepackage[ansinew]{inputenc}  \begin{document} \begin{equation}   \begin{aligned}         \alpha &amp;= 1 &amp;&amp;+ 2     \\                &amp;    &amp;&amp;- 3 + 4 \\                &amp;= 4 \\                &amp;=5-1,   \end{aligned} \end{equation} \end{document}   So there is a long equation broken into 2 lines, followed by 2 short lines. Here is what I desire:   There should be an equation label for each equality sign, so 3 in total. At the moment there is only one The "+2" and "-3+4"-parts are aligned right, which distorts the whole equation. I'm not quite sure why it is doing that, I haven't told it explicitly to do so.   Is there a way to correct these errors?    EDIT: Original output looks like
49264
There are many discussions over how to align multiple align environments with interspersed texts. However, I want to label multiple aligned blocks such that each number will center vertically for each aligned blocks and at the same time align across blocks.  Here is a MWE that achieves either at one time. The first part simply uses one giant align environment with some \nonumber directive. The second one use equation to wrap aligned but lose alignment info. How should I achieve the best of both worlds?  \documentclass{article} \usepackage{amsmath} \begin{document}   % Part I   \begin{align}           x^2 + y^2 &amp;= 1 \\                 z^2 &amp;= 0 \nonumber \\     x^2 + y^2 + z^2 &amp;= 1   \end{align}    % Part II   \begin{equation}     \begin{aligned}       x^2 + y^2 &amp;= 1 \\             z^2 &amp;= 0 \\     \end{aligned}   \end{equation}   \begin{equation}     \begin{aligned}       x^2 + y^2 + z^2 &amp;= 1     \end{aligned}   \end{equation} \end{document}
53280
I want to show the derivation of a formula where I encounter long formulae. Unfortunately the derivation is very complex, so I have to show some intermediate steps.  My problem is, that I want to mix the behaviour of multline with align. The first line should be aligned left and the whole rest should be aligned right with respect to the longest line. This block should be aligned at the =.  At the moment, I use the align environment. But in this case, the first line is still aligned left to the $ of the other lines.  Important note: I don't like magic numbers. So I prefer solutions which are completely automatic.    My approach so far:  \documentclass{scrartcl} % Kodierung \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{lmodern} % Sprache (neue deutsche Rechtschreibung) \usepackage[ngerman]{babel} % Mathematik \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb}  \begin{document}     \begin{align}         (a+b+c+d+e+f) \\ % aligned left         % the following block should be aligned right         &amp;= a+b+c+d+e+f+g+h+i+j+k+l+m+n\\     \begin{split}         &amp;= a+b+c+d+e+f+g+h+i+j+k+l+m+n \\         &amp; \quad +o+p+q+r+s+t+u+v+w+x+y+z+1+2+3+4     \end{split}\\         &amp;= a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p     \end{align} \end{document}
25494
I always use align in my documents, and avoid equation. Is there anything wrong with that? My reasoning behind this: align > equation, so why not use it?
100578
I have a problem writing an equation in eqnarray environment, where I split a single line into two lines. The first line starting with \left[ and the second line ending with \right], but I could not compile it using latex.
75798
I write homework assignments in LaTex and the assignments are always divided into subparts (i.e. Problem 1 is divided into 1.1, 1.2, 1.3, ...). Currently what I do is I have nested enumerations, but the numbering isn't exactly what I'd like. To number the subparts, I am currently using:  \renewcommand{\labelenumii}{\arabic{enumii}.}   However, this produces  1. 2. ...    and what I'd like it to be is   1.1 1.2 ...    Is there anyway to do this?
48035
I am trying to add equation names besides the equation numbers but, in addition, in such a way that \eqref inserts just the number.  Inspired by the top answer in , I tried the following solution:   \documentclass{article} \usepackage{amsmath} \newcommand\mylabel[2]{\label{#1} \\[-\baselineskip] \tag*{#2\ \hphantom{(\ref{#1})}}}  \begin{document}  \begin{align} f(x) = a \mylabel{eq:a}{Constant} \\ h(x) = ax^2+bx+c \mylabel{eq:b}{Quadratic} \end{align}  Equations \eqref{eq:a} and \eqref{eq:b} look OK\dots   \begin{align} j(x) = \varinjlim_{C_j} \mylabel{eq:c}{Way too low!} \end{align}  \dots but the method fails in style for Equation \eqref{eq:c}.  \end{document}      As you can see, the trick I used is to write the equation name in a new line and then lift it by -\baselineskip. For simple equations as (1) or (2) I get exactly what I want. But indeed, this is shoddy work and it fails as soon as the equation gets a little more complicated, e.g. for (3).   I don't know whether I could use another length instead of -\baselineskip so that I always get the correct lift, or whether there is a more elegant (and not too complicated) way to achieve what I want.
109820
Can anyone help please? I need to know how to make the sum of value S(n) = 0+1+2+3+4...+(n-1)+n (example: 0+1+2+3 = 6 , 0+1+2+3+4+5+6+7 = 28 and so on) on Latex
52917
What I have are two equations with align and I want one single equation number to refer to this system of equations. To illustrate, I have  \begin{align}   dr_t &amp;= \kappa ( \theta - r_t ) dt + \sigma_r r^{\xi} dW_t \\   dA_t &amp;= \mu A_t dt + \sigma_A^{\alpha} dZ_t, \end{align}    and I want neither  \begin{align}   dr_t &amp;= \kappa ( \theta - r_t ) dt + \sigma_r r^{\xi} dW_t \nonumber \\   dA_t &amp;= \mu A_t dt + \sigma_A^{\alpha} dZ_t, \end{align}    nor   \begin{align}   dr_t &amp;= \kappa ( \theta - r_t ) dt + \sigma_r r^{\xi} dW_t \\   dA_t &amp;= \mu A_t dt + \sigma_A^{\alpha} dZ_t, \nonumber \end{align}     but having a single number in the middle. I know this can be achieved by nesting an array inside of an equation but then some symbols (sums, etc.) look differently and I thought there had to be a better way of doing this.
115624
Using the amsmath environment, I'd like to create a short-cut for  \begin{equation*}   \begin{split}     ...   \end{split} \end{equation*}   But saying  \newenvironment{eqs}   {\begin{equation*}\begin{split}}   {\end{split}\end{equation*}}   and using it with  \begin{eqs}   ... \end{eqs}   produces the error  ! LaTeX Error: \begin{split} on input line 67 ended by \end{eqs}.   However, using \newcommand works — but \eqs{...} over several lines looks a bit weird:  \newcommand{\eqs}[1]{   {\begin{equation*}\begin{split}{#1}\end{split}\end{equation*}}}  % ...  \eqs{   ...   ...}   Is it possible to get this to work with a new environment, or are there better ways to achieve something equivalent?
27962
In the example below, an error is caused by \begin{align} and \end{align} but I do not see why:  \documentclass{book} \usepackage{amsmath} \newenvironment{subalign}{\begin{subequations}\begin{align}}{\end{align}\end{subequations}} \begin{document} \begin{subalign}      a&amp;=b\\     &amp;=b \end{subalign} \end{document}
41225
Some people have asked about how to add multiple paragraphs (when \intertext and \shortintertext no longer work), a fix was proposed by Peter Grill :  He wrote:     My first thought was to hack apart the result of an align and dole   out the lines one-by-one wherever you want them. Alas, align   produces a list of considerable complexity and it is not worth the   effort to unravel it (if that's even possible).      So I made my own alignment environment that, as far as I can tell,   does what you'd want align* to do but produces a very simple list.   My macro \ALineAgain then picks that list apart and drops the lines   one at a time wherever you ask.      Because the lines are not printed where the alignment is actually   given, it makes no sense to have an AlignAgain*; it never prints   equation numbers. Instead, the \ALineAgain macro takes a star that   suppresses the addition of an equation number.   The problem with this code is that the equation numbers seem to be messed up once you try referencing them. Below, I've added only a few lines to Peter's code (notably: \numberwithin{equation}{section}, two section commands, and then a single line at the very end that attempts to reference the two equations).   Rather than printing (1.1) and (1.2), it prints (1.1) and (1.1). There seems to be something wrong with the equations portion of the code. Can anybody spot the problem?   \documentclass{article} % \usepackage{showframe} \usepackage{amsmath}  \numberwithin{equation}{section}  % It's like {align}, but simple! \newenvironment{SimpleAlign} {%  \let\\=\cr  \tabskip 0pt plus 1fil\relax  \halign\bgroup   &amp;\hfil$\displaystyle ##$\tabskip 0pt\relax   &amp;$\displaystyle {}##$\hfil\tabskip 0pt plus 1fil\relax\cr } {%  \crcr\egroup }  % Saves its contents typeset like SimpleAlign.  You can give it a name. \newenvironment{AlignAgain}[1][AlignBox] {%  \expandafter\let\expandafter\AlignAgainBox\csname #1\endcsname  \setbox\AlignAgainBox=\vbox\bgroup\SimpleAlign } {%  \endSimpleAlign\egroup  \ReBox\AlignAgainBox } \newbox\AlignBox  % Prints the lines from {AlignAgain} one-by-one, with or without equation numbers as starred.  If you named the {AlignAgain}, use it here. \makeatletter \newcommand\ALineAgain{%  \@ifstar   {\AlignAgainStartrue\@ALineAgain}   {\AlignAgainStarfalse\@ALineAgain}% } \newcommand\@ALineAgain[1][AlignBox]{%  \expandafter\let\expandafter\AlignAgainBox\csname #1\endcsname  \begin{equation*}   \PutFirstBox\ifAlignAgainStar\AlignAgainBox  \end{equation*} } \makeatother \newif\ifAlignAgainStar  % Reboxes a box in the format: {[1][2]...[n]} -&gt; {[1]{[2]{...}[n]}} % {...} = \hbox \newcommand{\ReBox}[1] {%  % To enter internal vertical mode, where \lastbox is valid  \setbox0=\vbox{%   \unvbox#1\relax   \global\setbox#1=\hbox{\hbox{}}   \loop    \unskip    %\box0 is the box currently at the end of #1    \setbox0=\lastbox   \ifvoid0\relax   \else    \global\setbox#1=\hbox{\box0\box#1}%   \repeat  }% }  % Puts the first box in a nested-box list into the display, saving the rest back in #1 % Optionally places an equation number \newcommand{\PutFirstBox}[2]{%  \hbox to \displaywidth{%   \unhbox#2\relax   \global\setbox#2=\lastbox   \setbox0=\lastbox   \unhbox0%   #1\else\refstepcounter{equation}\llap{(\theequation)}\fi  }% }  \begin{document}  \section{First section} \subsection{A subsection} Hello \begin{AlignAgain}  a &amp;= b &amp; c &amp;= d \label{firsteqn} \\  f(x) &amp;= g(x) &amp; h(x) &amp;= e^{-1/x^2} \label{myeqn} \\ \end{AlignAgain}  This is a paragraph with a lot of redundant words whose only purpose is to extend it onto a new line or two so it's dramatic when I display this equation: \ALineAgain and then follow it with a bunch more text.  And also a new paragraph, just for good measure.  I wonder if the two equations will line up?  I sure hope so! \ALineAgain This is sort of fun.   Can we reference equations by section? Try (\ref{firsteqn}) and (\ref{myeqn}).  \end{document}
32875
I'm facing a problem with my document that has many equations. The problem with the labelling issue if I decide to modify or add new equations. Basically so far, I'm using \label{eq4.1} where 4 for the chapter four and 1 for the first equation. With this approach, if I decide later to add new equations before eq4.1, then I have to change all subsequent equations to reflect this change. I'm looking for a better and flexible approach to cope with this problem.   \documentclass{article} \usepackage{amsmath}  \begin{document}  \begin{align} x &amp;= 2^{100}, \label{eq4.1} \\ y &amp;= 2^{100}, \label{eq4.2} \\ z &amp;= 2^{100}. \label{eq4.3} \end{align}  These are \eqref{eq4.1} and \eqref{eq4.2} and \eqref{eq4.3}.   \end{document}
70382
I have the following Latexcode:  \begin{equation} \mathscr{G} = A_{polygon} - \sum \limits_{C \in \Xi} A(C) \end{equation}   However, the sum index looks bad in my eyes, as the "is element of" sign is a little lower than the other two letters. It looks badly aligned.  Is there a way to fix this? I don't want to change to to smaller case letters as I have a convention for letter cases in my document.  edit: I've added a picture    I'd like the element sign to be above the red line i.e. vertically centered with C and Ξ.
95936
I'm using the multlined environment inside an align environment and want have the = aligned at the top and the equation numbering at the bottom. Is this possible?  Here my MWE:  \documentclass{article} \usepackage{mathtools,amsmath} \begin{document} \begin{align} y &amp;= a+b+c \\ &amp;= \begin{multlined}[t] a+b+ \\ c \end{multlined} \end{align} \begin{align} y &amp;= a+b+c \\ &amp;= \begin{multlined}[b] a+b+ \\ c \end{multlined} \end{align} \end{document}
59750
I want some advice about how to format it better if I have to write a long text below a $\sum$ or a $\prod$ sign. Basically I want to explain the restriction over which the sum or the product is being taken.   For example how can I improve the looks of these equations,  $N_i (\rho) = \sum _ {B \in \rho s.t n_{\delta_j}(B) = 0    \forall j \neq i} n_{\delta_i} (B)$  $\sum _{ \rho s.t N_i(\rho) = a_i and M_i(\rho) = b_i}    \prod _{B \in \rho} \langle \prod_{i=1}^{n} \delta_i ^{n_{\delta_i}(B)}    y_i ^{n_{y_i}(B)} \rangle_c$