3

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):

see picture below =]

3
  • 1
    Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}.
    – user31729
    Jan 14, 2015 at 13:38
  • 2
    amsmath provides intertext for stuff like that. If the line is part of an itemize environment it gets more complicated.
    – Johannes_B
    Jan 14, 2015 at 13:48
  • @ChristianHupfer Im so sorry! Will do that if I post another question! Never used this site before. It was part of the itemize environment, so it seems the second solution below is applicable. Jan 15, 2015 at 18:56

1 Answer 1

4

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}

enter image description here


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}

enter image description here

7
  • 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.
    – LaRiFaRi
    Jan 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
    – daleif
    Jan 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.
    – LaRiFaRi
    Jan 14, 2015 at 14:30

You must log in to answer this question.

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