Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have an align question. Essentially the following code:

\begin{align} 
    \nonumber & \exp\left(-\sum_{t=1}^T\lambda_t f_t(x_1)\right)\exp(-\mu-1) + \exp\left(-\sum_{t=1}^T\lambda_t f_t(x_2)\right)\exp(-\mu-1) \\ 
    \nonumber & \cdots + \exp\left(-\sum_{t=1}^T\lambda_t f_t(x_k)\right)\exp(-\mu-1)  = 1 \\ 
    \nonumber &  \sum_{i=1}^k \exp\left(-\sum_{t=1}^T \lambda_t f_t(x_i) \right)  = \exp(\mu+1) \\  
              &  \exp(-\mu-1)  = \frac{1}{\displaystyle{\sum_{i=1}^k} \exp\left(-\displaystyle{\sum_{t=1}^T} \lambda_t f_t(x_i) \right)}  
\end{align}

Produces the following:

align1

However I would like to have the equal signs in line 2, 3 and 4 all aligned, how can I do this? (Line 2 is a continuation of line 1).

share|improve this question
    
Use the & right before the = to get the = aligned. However, how do you want the first line to be aligned? –  Qrrbrbirlbel Apr 30 '13 at 17:47
    
I would like the first line and second line to stay as they are, then align the equal signs. –  TrueTears Apr 30 '13 at 17:50
add comment

3 Answers

up vote 4 down vote accepted

Some ideas:

Code

\documentclass{article}
\usepackage{mathtools}
\begin{document}
\begin{equation}
\begin{split}
\exp\left(-\sum_{t=1}^T\lambda_t f_t(x_1)\right)\exp(-\mu-1) & + \exp\left(-\sum_{t=1}^T\lambda_t f_t(x_2)\right)\exp(-\mu-1) \\
  \cdots + \exp\left(-\sum_{t=1}^T\lambda_t f_t(x_k)\right)\exp(-\mu-1)  & = 1 \\
   \sum_{i=1}^k \exp\left(-\sum_{t=1}^T \lambda_t f_t(x_i) \right) & = \exp(\mu+1) \\
            \exp(-\mu-1) & = \frac{1}{\displaystyle{\sum_{i=1}^k} \exp\left(-\displaystyle{\sum_{t=1}^T} \lambda_t f_t(x_i) \right)}
\end{split}
\end{equation}

\begin{alignat}{6}
\mathrlap{\exp\left(-\sum_{t=1}^T\lambda_t f_t(x_1)\right)\exp(-\mu-1)  + \exp\left(-\sum_{t=1}^T\lambda_t f_t(x_2)\right)\exp(-\mu-1)} \nonumber\\
&&\dots + \exp\left(-\sum_{t=1}^T\lambda_t f_t(x_k)\right)\exp(-\mu-1)  & = 1 \nonumber\\
&&\sum_{i=1}^k \exp\left(-\sum_{t=1}^T \lambda_t f_t(x_i) \right) & = \exp(\mu+1) \nonumber\\
&&\exp(-\mu-1) & = \frac{1}{\displaystyle{\sum_{i=1}^k} \exp\left(-\displaystyle{\sum_{t=1}^T} \lambda_t f_t(x_i) \right)}
\end{alignat}

\begin{multline}
\exp\left(-\sum_{t=1}^T\lambda_t f_t(x_1)\right)\exp(-\mu-1) + \exp\left(-\sum_{t=1}^T\lambda_t f_t(x_2)\right)\exp(-\mu-1) \\
\begin{aligned}
  \cdots + \exp\left(-\sum_{t=1}^T\lambda_t f_t(x_k)\right)\exp(-\mu-1)  & = 1 \\
   \sum_{i=1}^k \exp\left(-\sum_{t=1}^T \lambda_t f_t(x_i) \right) & = \exp(\mu+1) \\
            \exp(-\mu-1) & = \frac{1}{\displaystyle{\sum_{i=1}^k} \exp\left(-\displaystyle{\sum_{t=1}^T} \lambda_t f_t(x_i) \right)}
\end{aligned}
\end{multline}
\end{document}

Output

enter image description here

share|improve this answer
add comment

enter image description here

\documentclass[preview,border=12pt]{standalone}
\usepackage{amsmath}
\begin{document}
\begin{gather}
\exp\left(-\sum_{t=1}^T\lambda_t f_t(x_1)\right)\exp(-\mu-1) + \exp\left(-\sum_{t=1}^T\lambda_t f_t(x_2)\right)\exp(-\mu-1) \notag\\
\begin{aligned}
 \cdots + \exp\left(-\sum_{t=1}^T\lambda_t f_t(x_k)\right)\exp(-\mu-1)  &= 1 \\
 \sum_{i=1}^k \exp\left(-\sum_{t=1}^T \lambda_t f_t(x_i) \right)  &= \exp(\mu+1) \\
 \exp(-\mu-1)  &= \frac{1}{\displaystyle{\sum_{i=1}^k} \exp\left(-\displaystyle{\sum_{t=1}^T} \lambda_t f_t(x_i) \right)}
\end{aligned}
\end{gather}
\end{document}
share|improve this answer
add comment

this might satisfy your request:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{multline}
\exp\left(-\sum_{t=1}^T\lambda_t f_t(x_1)\right)\exp(-\mu-1) + \exp\left(-\sum_{t=1}^T\lambda_t f_t(x_2)\right)\exp(-\mu-1) \\
\begin{aligned}
 \cdots + \exp\left(-\sum_{t=1}^T\lambda_t f_t(x_k)\right)\exp(-\mu-1)  &= 1 \\
 \sum_{i=1}^k \exp\left(-\sum_{t=1}^T \lambda_t f_t(x_i) \right)  &= \exp(\mu+1) \\
 \exp(-\mu-1)  &= \frac{1}{\displaystyle{\sum_{i=1}^k} \exp\left(-\displaystyle{\sum_{t=1}^T} \lambda_t f_t(x_i) \right)}
\end{aligned}
\end{multline}
\end{document}

output of sample code

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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