1

Imagine I have a 2-line formula where in the first line I have a probability that I explicitly calculate in the second row, so the second line is much longer, so something like this:

\begin{align*}
 & \mathbb P\Big(x\leq 10\Big) \\
        &= \mathbb P\Big(x\leq 1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1\Big)\\
\end{align*}

If I do that, the probability sign aligns with the = sign, which does not look too good; I would like the two probability signs to align; However, if I do this:

\begin{align*}
 & \mathbb P\Big(x\leq 10\Big) \\
        = &\mathbb P\Big(x\leq 1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1\Big)\\
\end{align*}

I end up with very little space in the second line between the '=' and the probability symbol P; Of course I could add a space, but this seems not no be a very elegant solution; So I thought I add a phantom sign like this

\begin{align*}
 &\phantom{=} \mathbb P\Big(x\leq 10\Big) \\
        &= \mathbb P\Big(x\leq 1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1\Big)\\
\end{align*}

However, this will also not work; So what is the right way to do it?

1
  • Welcome to TeX.SE.
    – Mico
    Jul 26, 2021 at 2:37

4 Answers 4

1

For the formula at hand, the multi-line equation typesetting apparatus of the amsmath package doesn't seem to be all that well suited. I'd therefore just pack most of the material in a \parbox of a suitably chosen width.

enter image description here

\documentclass{article} 
\usepackage{amssymb} % for \mathbb macro
\begin{document}
\[
\mathbb{P}(x\leq 10) 
\leq\mathbb{P}\bigl(x\leq \parbox[t]{0.7\textwidth}{\raggedright%
   $1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+
    1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1 \bigr)$}
\]
\end{document}
1

I'm dubious about the layout choice here, but the issue with the \phantom attempt was that \phantom{=} will be treated as an ordinary character rather than a relation. If you change it to be \mathrel{\phantom{=}} you will get the alignment you expected.

\begin{align*}
 &\mathrel{\phantom{=}} \mathbb P\Big(x\leq 10\Big) \\
        &= \mathbb P\Big(x\leq 1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1\Big)\\
\end{align*}
2
  • 1
    Wouldn't it be much easier to use ={}& in the second line?
    – campa
    Jul 26, 2021 at 7:00
  • 1
    I wrote my answer primarily for those who might come here through search. I'm inclined to think that the whole presentation should be rethought.
    – Don Hosek
    Jul 26, 2021 at 13:09
0

What I'd do is to write something like:

\begin{align}
   \mathbb P\Big(x\leq 10\Big) & \\
     &= \mathbb P
          \Big(
            x
              \le 1+1+1+1+1+1+1+1+1+1+1+1+1+1+1
                    +1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1
          \Big)
\end{align}

You want what is before the '=' to be more to the left.

Also consider the tools AMS offers to write split equations, this will end up numbering each line, and I doubt that is what you want.

Or just rewrite, define a variable/function to express your "1+1" ad nauseam as something more manageable (and understandable).

1
  • If you look at the original question a little more closely, you'll see that he used align* and not align.
    – Don Hosek
    Jul 26, 2021 at 3:31
0

Another possibilities could be using array adjusting column separation, or alignat in which horizontal space has to be explicitly specified:

\documentclass{article}
\usepackage{amsmath,amssymb}
\setlength{\arraycolsep}{2pt}
\begin{document}
\[
\begin{array}{rl}
  &\mathbb P\bigl(x\leq 10\bigr) \\
= & \mathbb P\bigl(x\leq 1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1\bigr)
\end{array}
\]

\begin{alignat*}{2}
& \; \mathbb P\bigl(x\leq 10\bigr) \\
= & \; \mathbb P\bigl(x\leq 1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1\bigr)
\end{alignat*}
\end{document}

enter image description here

2
  • How would you fix the overfull-line issue in the second row?
    – Mico
    Jul 26, 2021 at 13:37
  • 1
    I just didn’t. I was hoping that the equation was just an example of a short row and a long one. To solve it I will add more line breaks, if I want to stick with this methods, the parbox solution you provide it is actually very nice. But as you noted I didn’t take that into account Jul 26, 2021 at 15:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .