# tips to make best estimate on aligning

Hey so I keep on using

\ \ {text}


to make sure all my equations are aligned. Is there any good ways to do this beside using the spacing systems? Like I had to print my project two times because the equations weren't perfectly aligned using the above idea. Anyway, here's my code and hopefully it can give you guy some insight for a tip:

\section*{Calculation}

Since the quantile plot does not show indications that the sample came from a normally distributed population, we can find the $95\%$ confidence interval for the population by using the following:

\begin{multialign}

P_{2.5} < \mu < P_{97.5}

\end{multialign}

This means that $\mu$ lies between the interval of the mean of the 12th and 13th scores and the mean of the 487th and 488th scores in the sorted list of means. Hence we get:

\begin{multialign}

\ \ P_{2.5} &< \mu < P_{97.5} \\

\ \ \frac{35.833+37.417}{2} &< \mu < \frac{198.917+200.583}{2} \\

\ \ \frac{73.250}{2} &< \mu <\frac{399.554}{2}\\

\ \ 36.625 &< \mu < 199.777 \\

\end{multialign}

Therefore the $95\%$ confidence interval of our sample data is:

\begin{multialign}

36.6 < \mu < 200.\ \text{or} \

\mu \in (36.6, 200.)

\end{multialign}


Here's the picture without using

\ \ {text}

Here's the picture guessing many times with

\ \ {text}

Like is there a way to eliminate this guess and check process?

-
Please always provide a complete example. Your snippet is not compilable and not minimal. You can mark your code as such by indenting it by 4 spaces. Or you mark you code and press the {}-button of the editor provides by this side here. – LaRiFaRi Jul 21 '14 at 9:03
Yeah I did spacing. But is there a way to eliminate this though? – Gamerdue Jul 21 '14 at 9:14
I was referring to the code mark up in your question. You have to mark you code as such in order to make it readable. Why do you want to align several equations on a page? That looks strange. The should be centred. If you want to use the secret multialign in your example, you will have to span it over the whole part. If you do not, the first equation has no knowledge about the position of the other equations. – LaRiFaRi Jul 21 '14 at 9:17
In my opinion you don't need the one liner sharing alignment with the four line display: they are separate by three lines of text and, moreover, the one liner is a general formula. – egreg Jul 21 '14 at 10:39

I don't know which package you need to use multialign, nor the purpose of that environment. I was able to reproduce the desired output with standard align environment, and without adding spaces with \. The macro \intertext (from amsmath) does the trick, but only for special cases such as the example you posted, in which the separate equations you want to align are close and with few text in between:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\section*{Calculation}

Since the quantile plot does not show indications that the sample came from a normally distributed population, we can find the $95\%$ confidence interval for the population by using the following:

\begin{align*}
P_{2.5} &< \mu < P_{97.5}
\intertext{%
This means that $\mu$ lies between the interval of the mean of the 12th and 13th scores and the mean of the 487th and 488th scores in the sorted list of means. Hence we get:
}
P_{2.5} &< \mu < P_{97.5} \\
\frac{35.833+37.417}{2} &< \mu < \frac{198.917+200.583}{2} \\
\frac{73.250}{2} &< \mu <\frac{399.554}{2}\\
36.625 &< \mu < 199.777 \\
\end{align*}

Therefore the $95\%$ confidence interval of our sample data is:

\begin{align*}
36.6 < \mu < 200.\ \text{or} \
\mu \in (36.6, 200.)
\end{align*}
\end{document}


-
In case it's even a shorter sentence than that, with package mathtools you have \shortintertext{…} which inserts less space. – Manuel Jul 21 '14 at 9:28
I'd add more space around the or at the end. I typically use \quad at either end such that readers do not overlook the or – daleif Jul 21 '14 at 10:58

In my opinion you don't need the one liner sharing alignment with the four line display: they are separate by three lines of text and, moreover, the one liner is a general formula.

However, there's no guesswork involved: just squash the material on the outside.

\documentclass{article}
\usepackage{mathtools}
\newcommand{\LHS}[1]{\mathllap{#1}}
\newcommand{\RHS}[1]{\mathrlap{#1}}
\begin{document}
\section*{Calculation}

Since the quantile plot does not show indications that the sample came from a normally
distributed population, we can find the $95\%$ confidence interval for the population by using
the following:
\begin{equation*}
\LHS{P_{2.5}} < \mu < \RHS{P_{97.5}}
\end{equation*}
This means that $\mu$ lies between the interval of the mean of the 12th and 13th scores and
the mean of the 487th and 488th scores in the sorted list of means. Hence we get:
\begin{align*}
\LHS{P_{2.5}} &< \mu < \RHS{P_{97.5}} \\
\LHS{\frac{35.833+37.417}{2}} &< \mu < \RHS{\frac{198.917+200.583}{2}} \\
\LHS{\frac{73.250}{2}} &< \mu < \RHS{\frac{399.554}{2}} \\
\LHS{36.625} &< \mu < \RHS{199.777} \\
\end{align*}
Therefore the $95\%$ confidence interval of our sample data is:
\begin{equation*}
36.6 < \mu < 200 \text{ or } \mu \in (36.6, 200)
\end{equation*}

\end{document}


Never leave blank lines before a math display and inside it; following a math display with a blank line means starting a new paragraph, which is almost surely what you don't want for this text snippet.

Here's the same without squashing; seeing the result I confirm my idea that one shouldn't bother trying aligning the “mu” symbols.

Note. If multialign is the environment I defined in one of my answers, don't use it in this case: it was defined for a very specific purpose, which has nothing to do with yours.

I'd write it in a different way: the display with repeated inequalities can be good for a high school textbook, not for a research paper.

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\section*{Calculation}

Since the quantile plot does not show indications that the sample came from a normally
distributed population, we can find the $95\%$ confidence interval for the population by using
the following inequalities
\begin{equation*}
P_{2.5} < \mu < P_{97.5}.
\end{equation*}
This means that $\mu$ lies between the interval of the mean of the 12th and 13th scores and
the mean of the 487th and 488th scores in the sorted list of means. With easy computations,
\begin{gather*}
P_{2.5}=\frac{35.833+37.417}{2}=\frac{73.250}{2}=36.625, \\[1ex]
P_{97.5}=\frac{198.917+200.583}{2}=\frac{399.554}{2}=199.777,
\end{gather*}
and therefore the $95\%$ confidence interval of our sample data is
\begin{equation*}
36.6 < \mu < 200
\end{equation*}
or $\mu \in (36.6, 200)$.
\end{document}


Note the omission of colons before the equations (they aren't necessary and, perhaps, even wrong); the last version of the inequality, with the denotation of an interval, is just an inessential rewriting of the main formula, so its place is in line.

-
Hi @egreg, would you recommend adding extra space around the or? I usually do for better readability. – daleif Jul 21 '14 at 10:59
@daleif That's a stylistic decision; uniformity is the key. However, I would place the final chunk in line after the display. – egreg Jul 21 '14 at 11:51
Thank You very much for the help guys – Gamerdue Aug 7 '14 at 21:54