2

I'm having troubles (again!) with some equations alignments. See the following MWE:

    \documentclass[11pt,letterpaper,twoside]{book}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[total={6in,10in},left=1.5in,top=0.5in,includehead,includefoot]{geometry}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{mathtools}

\begin{document}

\noindent
Blablabla bla bla blabla bla blabla bla bla blablabla blabla bla blabla bla bla bla bla blabla:
\begin{align*}
    A &= BBB \\
    = CCCC \text{to be centered on the whole line} CCCC & \\
    &= DDD.
\end{align*}
Blablabla bla bla blabla bla blabla bla bla blablabla blabla bla blabla bla bla bla bla blabla:

\end{document}

Preview:

enter image description here

As shown in red on the picture, I need the first and third lines to be aligned with their equal sign, approximately at the center of the page (as it is usually done within the align environment), while the second line should be centered (not aligned with the first and third lines).

The second line is what gives me the trouble.

How can I do that without cheating and hacking a lot with many \phantom or \mathclap commands?

3
  • 1
    you could use \intertext{\centering $CC=....$}` but it will be confusing to read. Commented Mar 6, 2020 at 21:13
  • @DavidCarlisle, I was thinking about using the \intertext command, but it would be inapropriate. The second line is actually a big matrix! And I need it to be centered on the page.
    – Cham
    Commented Mar 6, 2020 at 21:14
  • 1
    It is only inappropriate because its inappropriate to align two out of three related = which is what you are asking for. I I was going to post exactly the same answer as AboAmar with shortintertext but he/she beat me to it. Commented Mar 6, 2020 at 21:19

2 Answers 2

2
\documentclass[11pt,letterpaper,twoside]{book}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[total={6in,10in},left=1.5in,top=0.5in,includehead,includefoot]{geometry}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{mathtools}

\begin{document}

\noindent
Blablabla bla bla blabla bla blabla bla bla blablabla blabla bla blabla bla bla bla bla blabla:
\begin{align*}
    A &= BBB
    \shortintertext{\centering${} = CCCC$ to be centered on the whole line $CCCC$}
    &= DDD.
\end{align*}
Blablabla bla bla blabla bla blabla bla bla blablabla blabla bla blabla bla bla bla bla blabla:

\end{document}
0

You could use and equation environment inside an \intertext command.

\documentclass[11pt,letterpaper,twoside]{book}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[total={6in,10in},left=1.5in,top=0.5in,includehead,includefoot]{geometry}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{mathtools}

\begin{document}

\noindent
Blablabla bla bla blabla bla blabla bla bla blablabla blabla bla blabla bla bla bla bla blabla:
\begin{align*}
    A &= BBB 
    \intertext{\[ = CCCC \text{to be centered on the whole line} CCCC \]}
    &= DDD.
\end{align*}
Blablabla bla bla blabla bla blabla bla bla blablabla blabla bla blabla bla bla bla bla blabla:

\end{document}

However the vertical spacing looks a little weird and should be adjusted.

7
  • I don't think that \intertext is appropriate in my case. My second line is actually a big matrix, and I need it to be horizontally centered on the page. Maybe some trick with \mathclap would do, but I'm yet unable to get it right.
    – Cham
    Commented Mar 6, 2020 at 21:18
  • @Cham what objection do you have to intertext (given that for some unexplained reason you want to break the alignment)? Commented Mar 6, 2020 at 21:19
  • I need to break the alignment because the second line is too large (a big matrix). And I need the last line to be aligned with the first one, especially since there are more lines under the last one (the code above is just a MWE).
    – Cham
    Commented Mar 6, 2020 at 21:20
  • But if \intertext is not appropriate, what kind of layout are you trying to achieve?
    – Vincent
    Commented Mar 6, 2020 at 21:23
  • @Vincent, I need all lines to be aligned with their equal sign, except for the second line which needs to be centered.
    – Cham
    Commented Mar 6, 2020 at 21:27

You must log in to answer this question.

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