# Large formula in align

I have a large formula in align:

\begin{align*}
log \mathcal{L}(\alpha,\beta,\mu,\delta|  l_1,...,l_n)&=\\\sum_{i=1}^n  \left( log \left(\frac{\sqrt{\alpha^2-\beta^2}}{2\alpha \delta K_1 (\delta\sqrt{\alpha^2-\beta^2})} exp\left(-\alpha\sqrt{\delta^2+(l-\mu)^2}+\beta(l-\mu)\right)\right) \right)
\end{align*}


Currently, this looks like But I want to have the first equation, the logL a bit pushed to the left. Now it is on the right side, what I don't like. I tried to insert a & before the exp to align it on that point, but this does not work.

 \begin{align*}
log \mathcal{L}(\alpha,\beta,\mu,\delta|  l_1,...,l_n)&=\\\sum_{i=1}^n  \left( log \left(\frac{\sqrt{\alpha^2-\beta^2}}{2\alpha \delta K_1 (\delta\sqrt{\alpha^2-\beta^2})} &exp\left(-\alpha\sqrt{\delta^2+(l-\mu)^2}+\beta(l-\mu)\right)\right) \right)
\end{align*}


How can I get the first part of the equation aligned in the center?

• You don't need align for a single equation... maybe the {multline} environment is better here, see mathmode for reference. – cgnieder Aug 8 '13 at 17:18
• And how can I solve my problem? What code should I use instead? – Jen Bohold Aug 8 '13 at 17:22

To obtain a centred "first part" and only have two parts, I assume you just want the whole things centred. For this you just have to gather* the contents: \documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\begin{document}
\begin{gather*}
\log \mathcal{L}(\alpha,\beta,\mu,\delta|  l_1,...,l_n) = \\
\sum_{i=1}^n  \left( \log \left(\frac{\sqrt{\alpha^2-\beta^2}}{2\alpha \delta K_1 (\delta\sqrt{\alpha^2-\beta^2})} \exp\left(-\alpha\sqrt{\delta^2+(l-\mu)^2}+\beta(l-\mu)\right)\right) \right)
\end{gather*}
\end{document}


Note the use of \log as an operator for logarithm.

• thanks, but what is the difference between \log and log? I like the cursive log? – Jen Bohold Aug 8 '13 at 17:27
• @JenBohold: \log prints log as an operator in upright font. log in math mode is similar to the multiplication of three variables l, o and g. The same goes for \exp (multiplication of e, x and p). – Werner Aug 8 '13 at 17:30

This is how it looks with multline* (just to let you know):

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{multline*}
\log\mathcal{L}(\alpha,\beta,\mu,\delta|  l_1,...,l_n)=\\
\sum_{i=1}^n  \left(\log\left(\frac{\sqrt{\alpha^2-\beta^2}}{2\alpha\delta K_1 (\delta\sqrt{\alpha^2-\beta^2})} \exp\left(-\alpha\sqrt{\delta^2+(l-\mu)^2}+\beta(l-\mu)\right)\right)\right)
\end{multline*}
\end{document} • I'd use this way rather than centering. – egreg Aug 8 '13 at 18:03
• +1 Other tweaks: spacing around |, size of brackets (particularly the one after \exp) and their spacing. – Andrew Swann May 27 '17 at 8:50
• @AndrewSwann thanks, but adding \mid and substituting \left and \right with correct sizes was not the aim of the last edit. – karlkoeller May 27 '17 at 8:57

Just to comment on Karls suggestion, this is how I normally do this in order to get a more consistent look and feel. Note that the = is moved to the next line (this is generally a good idea it it may be overlooked overwise)

\documentclass{article}
\begin{document}
\begin{align*}
\MoveEqLeft\log\mathcal{L}(\alpha,\beta,\mu,\delta|  l_1,\dots,l_n)
\\
&=\sum_{i=1}^n  \left(\log\left(\frac{\sqrt{\alpha^2-\beta^2}}{2\alpha
\delta K_1 (\delta\sqrt{\alpha^2-\beta^2})} \exp\left(-\alpha
\sqrt{\delta^2+(l-\mu)^2}+\beta(l-\mu)\right)\right)\right)
\end{align*}
\end{document}


\MoveEqLeft has a hidden & inside it, and will pull the line 2em backwards from the alignment point. This stackengine solution has two features to note: 1) you can customize the gap between the lines (currently set to 10pt); and 2) you can choose the alignment of the equations, relative to each other (currently set centered "l", but can be set to "c" or "r").

\documentclass{article}
\usepackage{amsmath}
\usepackage{stackengine}
\begin{document}
\stackMath
\def\stackalignment{l}
\stackanchor[10pt]{\displaystyle%
\log\mathcal{L}(\alpha,\beta,\mu,\delta|  l_1,...,l_n)=
}{\displaystyle
\sum_{i=1}^n  \left(\log\left(\frac{\sqrt{\alpha^2-\beta^2}}{2\alpha\delta K_1 (\delta\sqrt{\alpha^2-\beta^2})} \exp\left(-\alpha\sqrt{\delta^2+(l-\mu)^2}+\beta(l-\mu)\right)\right)\right)
}
\end{document} The \stackMath macro is recently introduced to the stackengine package, and causes the stacking arguments to be processed in \textstyle math by default.

Check with the below tag:

\begin{gather}
log \mathcal{L}(\alpha,\beta,\mu,\delta|  l_1,...,l_n)=\\
\sum_{i=1}^n  \left( log \left(\frac{\sqrt{\alpha^2-\beta^2}}{2\alpha \delta K_1 (\delta\sqrt{\alpha^2-\beta^2})} exp\left(-\alpha\sqrt{\delta^2+(l-\mu)^2}+\beta(l-\mu)\right)\right) \right)
\end{gather}