My question is, how can I get the two different align*
environments to agree on the equal signs being centred for all six equations on the page (even though there is a line of text breaking them into groups of three and three):
1 Answer
Do you mean like this?
% arara: pdflatex
\documentclass{article}
\usepackage{mathtools}
\DeclareMathOperator{\var}{Var}
\begin{document}
\begin{align*}
E(M) &= A\\
E(A) &= 180-B-C\\
E(N) &= A/2 - B/2 - C/2 + 90
\intertext{(b) The variances are given by:}
\var(M) &= 1\\
\var(A) &= 1/2\\
\var(N) &= 3/4
\end{align*}
\end{document}
Update:
If the other commentators are right and you are inside an itemize
environment, a very easy solution would be to define your own indent. Not super fancy, but clear and easy.
% arara: pdflatex
\documentclass{article}
\usepackage{mathtools}
\DeclareMathOperator{\var}{Var}
\newcommand*{\myIndent}{\hspace{4cm}} % or whatever space you may find on http://tex.stackexchange.com/a/74354
\begin{document}
\begin{itemize}
\item[(a)] Whatever you have written in item (a):
\begin{flalign*}
\myIndent\mathllap{E(M)} &= A&\\
E(A) &= 180-B-C\\
E(N) &= A/2 - B/2 - C/2 + 90
\end{flalign*}
\item[(b)] The variances are given by:
\begin{flalign*}
\myIndent\mathllap{\var(M)} &= 1&\\
\var(A) &= 1/2\\
\var(N) &= 3/4
\end{flalign*}
\end{itemize}
\end{document}
Update 2:
daleif brought me to the idea to use \item
directly in \intertext
(or \shortintertext
, if you prefer the vertical spacing). You will need at least one \item
outside the align
in order to get that working.
% arara: pdflatex
\documentclass{article}
\usepackage{mathtools}
\DeclareMathOperator{\var}{Var}
\usepackage{enumitem}
\usepackage{blindtext}
\begin{document}
\begin{enumerate}[label=(\alph*)]
\item \blindtext
\begin{align*}
E(M) &= A\\
E(A) &= 180-B-C\\
E(N) &= A/2 - B/2 - C/2 + 90
\intertext{\item The variances are given by:}
\var(M) &= 1\\
\var(A) &= 1/2\\
\var(N) &= 3/4
\end{align*}
\end{enumerate}
\end{document}
-
I suspect that the
(b)
is part of some enumerated environment, which makes things a bit more tricky than this.;-)
Jan 14, 2015 at 13:54 -
@PaulGessler I fear the same... Well, We'll have to wait for the MWE.– LaRiFaRiJan 14, 2015 at 13:55
-
Just as a test I tried
\intertext{\item ...}
, that actually seems to be working!!! Though with a bit excessive text– daleifJan 14, 2015 at 14:12 -
@daleif cool, that is surprising! I will stand corrected if it does indeed work like that. Jan 14, 2015 at 14:18
-
@daleif Thanks. I put that to my answer. If you want to write an answer by yourself, I will delete that afterwards.– LaRiFaRiJan 14, 2015 at 14:30
\documentclass{...}
and ending with\end{document}
.amsmath
providesintertext
for stuff like that. If the line is part of an itemize environment it gets more complicated.