5

I have an issue when I try to align different "align" environments. This is my Latex code :

\documentclass[10pt, a4paper]{article}

\usepackage[english]{babel}
\usepackage[english]{isodate}
\usepackage[T1]{fontenc}
\usepackage[hidelinks]{hyperref}
\usepackage[utf8]{inputenc}

\usepackage{mathtools}
\usepackage{amsmath}
\usepackage{amssymb}

\begin{document}
    \section{Example}
    \subsection*{Degree 1}
    \begin{align*}
        C_1' & = C_1 \\
        C_0' & = a_k + C_0
    \end{align*}

    \subsection*{Degree 2}
    \begin{align*}
        C_2' & = C_2 \\
        C_1' & = 2 C_2 a_k + C_1 \\
        C_0' & = C_2   a_k^2 + C_1   a_k + C_0
    \end{align*}

    \subsection*{Degree 3}
    \begin{align*}
        C_3' & = C_3 \\
        C_2' & = 3 C_3 a_k + C_2 \\
        C_1' & = 3 C_3 a_k^2 + 2 C_2 a_k + C_1 \\
        C_0' & = C_3 a_k^3 + C_2   a_k^2 + C_1   a_k + C_0
    \end{align*}

    \subsection*{Degree 4}
    \begin{align*}
        C_4' & = C_4 \\
        C_3' & = 4 C_4 a_k + C_3 \\
        C_2' & = 6 C_4 a_k^2 + 3 C_3 a_k + C_2 \\
        C_1' & = 4 C_4 a_k^3 + 3 C_3 a_k^2 + 2 C_2 a_k + C_1 \\
        C_0' & = C_4 a_k^4 + C_3 a_k^3 + C_2 a_k^2 + C_1 a_k + C_0
    \end{align*}

    \subsection*{Degree 5}
    \begin{align*}
        C_5' & = C_5 \\
        C_4' & = 5 C_5 a_k + C_4 \\
        C_3' & = 10 C_5 a_k^2 + 4 C_4 a_k + C_3 \\
        C_2' & = 10 C_5 a_k^3 + 6 C_4 a_k^2 + 3 C_3 a_k + C_2 \\
        C_1' & = 5 C_5 a_k^4 + 4 C_4 a_k^3 + 3 C_3 a_k^2 + 2 C_2 a_k + C_1 \\
        C_0' & = C_5 a_k^5 + C_4 a_k^4 + C_3 a_k^3 + C_2 a_k^2 + C_1 a_k + C_0
    \end{align*}
\end{document}

And this is the output :

enter image description here

As you can see, equations are not well aligned. I want to align their left side on the same line but by keeping them in the middle of the page (is this clear ?)

1 Answer 1

8

With \intertext:

enter image description here

\documentclass[10pt, a4paper]{article}

\usepackage[english]{babel}
\usepackage[english]{isodate}
\usepackage[T1]{fontenc}
\usepackage[hidelinks]{hyperref}
\usepackage[utf8]{inputenc}

\usepackage{mathtools}
\usepackage{amsmath}
\usepackage{amssymb}

\begin{document}
    \section{Example}
    \subsection*{Degree 1}
    \begin{align*}
        C_1' & = C_1 \\
        C_0' & = a_k + C_0
%
    \intertext{\subsection*{Degree 2}}
        C_2' & = C_2 \\
        C_1' & = 2 C_2 a_k + C_1 \\
        C_0' & = C_2   a_k^2 + C_1   a_k + C_0
%
    \intertext{\subsection*{Degree 3}}
        C_3' & = C_3 \\
        C_2' & = 3 C_3 a_k + C_2 \\
        C_1' & = 3 C_3 a_k^2 + 2 C_2 a_k + C_1 \\
        C_0' & = C_3 a_k^3 + C_2   a_k^2 + C_1   a_k + C_0
%
    \intertext{\subsection*{Degree 4}}
        C_4' & = C_4 \\
        C_3' & = 4 C_4 a_k + C_3 \\
        C_2' & = 6 C_4 a_k^2 + 3 C_3 a_k + C_2 \\
        C_1' & = 4 C_4 a_k^3 + 3 C_3 a_k^2 + 2 C_2 a_k + C_1 \\
        C_0' & = C_4 a_k^4 + C_3 a_k^3 + C_2 a_k^2 + C_1 a_k + C_0
%
    \intertext{\subsection*{Degree 5}}
        C_5' & = C_5 \\
        C_4' & = 5 C_5 a_k + C_4 \\
        C_3' & = 10 C_5 a_k^2 + 4 C_4 a_k + C_3 \\
        C_2' & = 10 C_5 a_k^3 + 6 C_4 a_k^2 + 3 C_3 a_k + C_2 \\
        C_1' & = 5 C_5 a_k^4 + 4 C_4 a_k^3 + 3 C_3 a_k^2 + 2 C_2 a_k + C_1 \\
        C_0' & = C_5 a_k^5 + C_4 a_k^4 + C_3 a_k^3 + C_2 a_k^2 + C_1 a_k + C_0
    \end{align*}
\end{document}
2
  • 1
    Precisely what I was looking for, thanks
    – graille
    Commented Aug 17, 2019 at 13:00
  • 1
    @graille: You're welcome. If you want to, you could also define your own command ro avoid cepeatedly typing Degree and to avoid manual numbering.
    – leandriis
    Commented Aug 17, 2019 at 13:07

You must log in to answer this question.

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