1

This question already has an answer here:

I have a long equation that must fit in a two-column journal. I know how to break up the right-hand terms nicely, but even so it won't fit and I need the equal signs to start on a new line, but I can't figure out how to do it nicely.

Here is what I've tried:

\begin{align*}
p(\{K_{\text{pre}},\theta_{\text{b,pre}},\sigma_{\text{pre}},K_{\text{post}},\theta_{\text{b,post}},\sigma_{\text{post}}\}\mid D)\\
\begin{split}=\phantom{} & p(\{K_{\text{pre}},\theta_{\text{b,pre}},\sigma_{\text{pre}}\}\mid D)\\
 & \times p(\{K_{\text{post}},\theta_{\text{b,post}},\sigma_{\text{post}}\}\mid D)
\end{split}
\\
\begin{split}=\phantom{} & p(\{K_{\text{pre}},\theta_{\text{b,pre}},\sigma_{\text{pre}}\}\mid D_{\text{pre}})\\
 & \times p(\{K_{\text{post}},\theta_{\text{b,post}},\sigma_{\text{post}}\}\mid D_{\text{post}})
\end{split}
\end{align*}

and the result:

enter image description here

Ideally I guess the right-hand lines should be "moved" to the left, but I'm not sure how to do that. I've seen the answers to How can I split an equation over two lines but here the first equal sign must come on a new line.

marked as duplicate by Mico, Maarten Dhondt, Troy, TeXnician, CarLaTeX Jun 15 '17 at 8:57

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1

Simply add another alignment character:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
p(\{K_{\text{pre}},&\theta_{\text{b,pre}},\sigma_{\text{pre}},K_{\text{post}},\theta_{\text{b,post}},\sigma_{\text{post}}\}\mid D)\\
=& p(\{K_{\text{pre}},\theta_{\text{b,pre}},\sigma_{\text{pre}}\}\mid D)\\
 & \times p(\{K_{\text{post}},\theta_{\text{b,post}},\sigma_{\text{post}}\}\mid D)\\
= & p(\{K_{\text{pre}},\theta_{\text{b,pre}},\sigma_{\text{pre}}\}\mid D_{\text{pre}})\\
 & \times p(\{K_{\text{post}},\theta_{\text{b,post}},\sigma_{\text{post}}\}\mid D_{\text{post}})
\end{align*}
\end{document}

enter image description here

Apparently the alignment is valid in both {align} and {split}, so you can add a single one in the left-hand side of your equation.


EDIT: As Mico noted, you can remove the {split} environment. The output is the same.

  • Since the OP's code is using an align* environment, you may want to show how the code might be simplified by doing away with both split environments. – Mico Jun 15 '17 at 7:53
1

I guess you're using a two column format, or you wouldn't need such splitting.

You can use aligned for the bottom part:

\documentclass[twocolumn]{article}
\usepackage{amsmath}

\usepackage{lipsum} % just for the example

\newcommand{\ts}[1]{\mathrm{#1}} % better than \ts

\begin{document}

\lipsum*[2]
\begin{align*}
& p(\{
      K_{\ts{pre}},\theta_{\ts{b},\ts{pre}},\sigma_{\ts{pre}},
      K_{\ts{post}},\theta_{\ts{b},\ts{post}},\sigma_{\ts{post}}
    \}\mid D
   )
\\
&\qquad\begin{aligned}
&= p(\{K_{\ts{pre}},\theta_{\ts{b,pre}},\sigma_{\ts{pre}}\}\mid D)\\
&\qquad \times p(\{K_{\ts{post}},\theta_{\ts{b},\ts{post}},\sigma_{\ts{post}}\}\mid D)
\\
&= p(\{K_{\ts{pre}},\theta_{\ts{b},\ts{pre}},\sigma_{\ts{pre}}\}\mid D_{\ts{pre}})\\
&\qquad \times p(\{K_{\ts{post}},\theta_{\ts{b},\ts{post}},\sigma_{\ts{post}}\}\mid D_{\ts{post}})
\end{aligned}
\end{align*}
\lipsum

\end{document}

enter image description here

I did some changes to your input. The first is using \mathrm instead of \text: with the latter, if your formula happens to be in a theorem statement, the subscripts would be set in italics.

The second is to split \ts{b,post} and similar into two, for consistency.

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