# Aligning Equations & Removing Equation Label

I have the code:

\begin{flalign}
&f_1(y_i; \boldsymbol{\theta}_1) = \lambda e^{-\lambda y_i} \\
&l_1(\boldsymbol{\theta}_1; \textbf{y}, \textbf{x}) = r num.not.censored
\log{(\lambda)} - \lambda \sum_{i=1}^{r num.data} y_i \\
&f_2(y_i; x_i, \boldsymbol{\theta}_2) = e^{\beta_1 + \beta_2 x_i}
\exp{(-e^{\beta_1 + \beta_2 x_i}y_i)} \\
&l_2(\boldsymbol{\theta}_2; \textbf{y}, \textbf{x}) =
\sum_{i=1}^{r num.not.censored} (\beta_1 + \beta_2 x_i)
-\sum_{i=1}^{r num.data} (e^{\beta_1 + \beta_2 x_i}y_i) \\
&f_3(y_i; x_i, \boldsymbol{\theta}_3) = \frac{1}{\sqrt{2\pi\sigma^2}}
\exp{\bigg(\frac{-(y_i - (\gamma_1 + \gamma_2 x_i))^2}{2\sigma^2}\bigg)} \\
&l_3(\boldsymbol{\theta}_3; \textbf{y}, \textbf{x}) = - 28
\log(2 \pi \sigma^2) - \sum_{i=1}^{r num.not.censored}
\bigg(\frac{(y_i - (\gamma_1 + \gamma_2 x_i))^2}{2 \sigma^2}\bigg)
\space + \\
&\sum_{i=r num.not.censored + 1}^{r num.data} \log
\bigg(\frac{1}{2} - \frac{1}{2}\text{erf}\Big(\frac{y_i -
(\gamma_1 + \gamma_2 x_i)}{\sigma \sqrt{2}}\Big)\bigg)
\end{flalign}


It renders as:

How can I shift line 7 to the right, so that it starts at equals sign of line 6?

I also want to remove the equation (7) label, since it is still part of equation (6).

Thanks,

Jack

You seem to want the fleqn option rather than flalign:

\documentclass{article}
\usepackage[fleqn]{amsmath}
\usepackage{bm}

\DeclareMathOperator{\erf}{erf}

\begin{document}

\begin{gather}
f_1(y_i; \bm{\theta}_1) = \lambda e^{-\lambda y_i} \\
l_1(\bm{\theta}_1; \mathbf{y}, \mathbf{x}) = 56
\log{(\lambda)} - \lambda \sum_{i=1}^{75} y_i \\
f_2(y_i; x_i, \bm{\theta}_2) = e^{\beta_1 + \beta_2 x_i}
\exp{(-e^{\beta_1 + \beta_2 x_i}y_i)} \\
l_2(\bm{\theta}_2; \mathbf{y}, \mathbf{x}) =
\sum_{i=1}^{56} (\beta_1 + \beta_2 x_i)
-\sum_{i=1}^{75} (e^{\beta_1 + \beta_2 x_i}y_i) \\
f_3(y_i; x_i, \bm{\theta}_3) = \frac{1}{\sqrt{2\pi\sigma^2}}
\exp{\biggl(\frac{-(y_i - (\gamma_1 + \gamma_2 x_i))^2}{2\sigma^2}\biggr)} \\
\begin{split}
l_3(\bm{\theta}_3; \mathbf{y}, \mathbf{x})
={}&{-}28\log(2 \pi \sigma^2) - \sum_{i=1}^{56}
\biggl(\frac{(y_i - (\gamma_1 + \gamma_2 x_i))^2}{2 \sigma^2}\biggr)
\\
&+\sum_{i=57}^{75} \log
\biggl(\frac{1}{2} - \frac{1}{2}\erf\Bigl(\frac{y_i -
(\gamma_1 + \gamma_2 x_i)}{\sigma \sqrt{2}}\Bigr)\biggr)
\end{split}
\end{gather}

\end{document}


You can easily change to alignment to the equals signs:

\documentclass{article}
\usepackage[fleqn]{amsmath}
\usepackage{bm}

\DeclareMathOperator{\erf}{erf}

\begin{document}

\begin{align}
f_1(y_i; \bm{\theta}_1) &= \lambda e^{-\lambda y_i} \\
l_1(\bm{\theta}_1; \mathbf{y}, \mathbf{x}) &= 56
\log{(\lambda)} - \lambda \sum_{i=1}^{75} y_i \\
f_2(y_i; x_i, \bm{\theta}_2) &= e^{\beta_1 + \beta_2 x_i}
\exp{(-e^{\beta_1 + \beta_2 x_i}y_i)} \\
l_2(\bm{\theta}_2; \mathbf{y}, \mathbf{x}) &=
\sum_{i=1}^{56} (\beta_1 + \beta_2 x_i)
-\sum_{i=1}^{75} (e^{\beta_1 + \beta_2 x_i}y_i) \\
f_3(y_i; x_i, \bm{\theta}_3) &= \frac{1}{\sqrt{2\pi\sigma^2}}
\exp{\biggl(\frac{-(y_i - (\gamma_1 + \gamma_2 x_i))^2}{2\sigma^2}\biggr)} \\
\begin{split}
l_3(\bm{\theta}_3; \mathbf{y}, \mathbf{x})
&=-28\log(2 \pi \sigma^2) - \sum_{i=1}^{56}
\biggl(\frac{(y_i - (\gamma_1 + \gamma_2 x_i))^2}{2 \sigma^2}\biggr)
\\
&\mathrel{\hphantom{=}}+\sum_{i=57}^{75} \log
\biggl(\frac{1}{2} - \frac{1}{2}\erf\Bigl(\frac{y_i -
(\gamma_1 + \gamma_2 x_i)}{\sigma \sqrt{2}}\Bigr)\biggr)
\end{split}
\end{align}

\end{document}


A few points to note.

1. \boldsymbol is deprecated and \bm (with the bm package) is to be preferred.

2. All \textbf commands should be \mathbf (in an italic context, such as a theorem statement, the letters would be typeset in italic).

3. Instead of \text{erf} one should define a suitable operator with \DeclareMathOperator (same reason as before).

You put the alignment symbols & not where they are supposed to be and you can use \notag to suppress a number.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{flalign}
f_1(y_i; \boldsymbol{\theta}_1) & = \lambda e^{-\lambda y_i} \\
l_1(\boldsymbol{\theta}_1; \textbf{y}, \textbf{x}) & = r num.not.censored
\log{(\lambda)} - \lambda \sum_{i=1}^{r num.data} y_i \\
f_2(y_i; x_i, \boldsymbol{\theta}_2) & = e^{\beta_1 + \beta_2 x_i} \exp{(-
e^{\beta_1 + \beta_2 x_i}y_i)} \\
l_2(\boldsymbol{\theta}_2; \textbf{y}, \textbf{x}) & = \sum_{i=1}^{r
num.not.censored} (\beta_1 + \beta_2 x_i) - \sum_{i=1}^{r num.data}
(e^{\beta_1 + \beta_2 x_i}y_i) \\
f_3(y_i; x_i, \boldsymbol{\theta}_3) & = \frac{1}{\sqrt{2\pi\sigma^2}}
\exp{\bigg(\frac{-(y_i - (\gamma_1 + \gamma_2 x_i))^2}{2\sigma^2}\bigg)} \\
l_3(\boldsymbol{\theta}_3; \textbf{y}, \textbf{x}) & = - 28 \log(2 \pi
\sigma^2) - \sum_{i=1}^{r num.not.censored} \bigg(\frac{(y_i - (\gamma_1 +
\gamma_2 x_i))^2}{2 \sigma^2}\bigg)\space + \notag\\
&\sum_{i=r num.not.censored
+ 1}^{r num.data} \log \bigg(\frac{1}{2} - \frac{1}
{2}\text{erf}\Big(\frac{y_i - (\gamma_1 + \gamma_2 x_i)}{\sigma
\sqrt{2}}\Big)\bigg)
\end{flalign}
\end{document}

• It might help if you replaced all instances of r num.not.censored with "56" and all instances of r num.data with "75". :-) [Admittedly, these mysterious strings are present in the OP's code -- but not in the associated screenshot.]
– Mico
Mar 25, 2018 at 14:38
• @Mico I was aware of this, but given that the OP does not provide an MWE I am under the impression that his document (or some interface to R) takes care of this.
– user121799
Mar 25, 2018 at 14:40

A standard align environment, with all equations aligned on the = symbols, may work at least as well as an flalign environment does.

Note that I replaced all instances of r num.not.censored with 56 and all instances of r num.data with 75. This seems to be justified by cross-checking with the screenshot you posted.

\documentclass{article}
\usepackage{amsmath}
\DeclareMathOperator{\erf}{erf}

\begin{document}
\begin{align}
f_1(y_i; \boldsymbol{\theta}_1)
&= \lambda e^{-\lambda y_i} \\
l_1(\boldsymbol{\theta}_1; \mathbf{y}, \mathbf{x})
&= 56\log{(\lambda)} - \lambda \sum_{i=1}^{75} y_i \\
f_2(y_i; x_i, \boldsymbol{\theta}_2)
&= e^{\beta_1 + \beta_2 x_i} \exp{(-e^{\beta_1 + \beta_2 x_i}y_i)} \\
l_2(\boldsymbol{\theta}_2; \mathbf{y}, mathbf{x})
&= \sum_{i=1}^{56} (\beta_1 + \beta_2 x_i)
-\sum_{i=1}^{75} (e^{\beta_1 + \beta_2 x_i}y_i) \\
f_3(y_i; x_i, \boldsymbol{\theta}_3)
&= \frac{1}{\sqrt{2\pi\sigma^2}}
\exp{\biggl(\frac{-(y_i - (\gamma_1 +
\gamma_2 x_i))^2}{2\sigma^2}\biggr)} \\
l_3(\boldsymbol{\theta}_3; \mathbf{y}, \mathbf{x})
&= - 28 \log(2 \pi \sigma^2)
- \sum_{i=1}^{56} \biggl(\frac{(y_i -
(\gamma_1 + \gamma_2 x_i))^2}{2 \sigma^2}\biggr) \\