# Problem with multiple alignment

I'd like to have two alignments.

\documentclass{article}
\usepackage{nicefrac,amsmath,amssymb}
\usepackage{relsize}

\begin{document}

\begin{aligned} &\int \limits_{0}^{2\pi} \hat{B}_{\delta r \mu} \cdot \cos \left( \mu p \alpha - \mu \omega_{el} t \right) \cdot \hat{A}_{\nu} \cdot \sin \left( \nu p \alpha - \omega_{el} t \right) d\alpha \\ &= \hat{B}_{\delta r \mu} \cdot \hat{A}_{\nu} \cdot \int \limits_{0}^{2\pi} \cos \left( \mu p \alpha - \mu \omega_{el} t \right) \cdot \sin \left( \nu p \alpha - \omega_{el} t \right) d\alpha \\ &= \frac{\hat{B}_{\delta r \mu} \cdot \hat{A}_{\nu}}{2} \cdot \Bigg( \overbrace{\int \limits_{0}^{2\pi} \sin \left( p \alpha \left( \nu - \mu \right) - \omega_{el} t \left(1 + \mu \right) \right) d\alpha}^{\larger\textcircled{\smaller[2]1}} + \overbrace{\int \limits_{0}^{2\pi} \sin \left( p \alpha \left( \nu + \mu \right) - \omega_{el} t \left(1 - \mu \right) \right) d\alpha}^{\larger\textcircled{\smaller[2]2}} \Bigg) \\ &{\larger\textcircled{\smaller[2]1}}: &&\int \limits_{0}^{2\pi} \sin \left( p \alpha \left( \nu - \mu \right) - \omega_{el} t \left(1 + \mu \right) \right) d\alpha \\ & &&= \frac{1}{p \cdot (\nu - \mu)} \cdot \Big[ -\cos \left( p \alpha (\nu - \mu) - \omega_{el} t (1 + \mu) \right) \Big]_{0}^{2\pi} \\ & &&= \frac{1}{p \cdot (\nu - \mu)} \cdot \Big( -\cos \big( 2\pi \overbrace{ p (\nu - \mu)}^{\in \, \mathbb{Z}} - \omega_{el} t (1 + \mu) \big) + \cos \big( - \omega_{el} t (1 + \mu) \big) \Big) \\ & &&= \frac{1}{p \cdot (\nu - \mu)} \cdot \Big( -\cos \big( - \omega_{el} t (1 + \mu) \big) + \cos \big( - \omega_{el} t (1 + \mu) \big) \Big) = 0 \end{aligned}

\end{document}


But the part belonging to the second alignment is nearly not visible (too far right). It should be directly below the integral in line 4.

• Your code does not compile. What are larger and smaller commands? Aug 29, 2022 at 18:29
• Sorry, i have edited it. Aug 29, 2022 at 18:45
• You're missing a third & in front of your equals signs (but your equation will still be too long for a single line). Aug 29, 2022 at 19:03

Is it something like this you want? I added some improvements such as an upright d for the differential symbol.

\documentclass{article}
\usepackage{nicefrac, mathtools,amssymb}
\usepackage{relsize}
\usepackage{showframe}
\renewcommand*\ShowFrameLinethickness{0.3pt}
\newcommand*{\dd}{\mathop{}\!\mathrm{d}}

\begin{document}

\begin{aligned} &\int \limits_{0}^{2\pi} \hat{B}_{\delta r \mu} \cdot \cos \left( \mu p \alpha - \mu \omega_{el} t \right) \cdot \hat{A}_{\nu} \cdot \sin \left( \nu p \alpha - \omega_{el} t \right) \dd\alpha \\ &= \hat{B}_{\delta r \mu} \cdot \hat{A}_{\nu} \cdot \int \limits_{0}^{2\pi} \cos \left( \mu p \alpha - \mu \omega_{el} t \right) \cdot \sin \left( \nu p \alpha - \omega_{el} t \right) \dd\alpha \\ &= \frac{\hat{B}_{\delta r \mu} \cdot \hat{A}_{\nu}}{2} \cdot \begin{multlined}[t]\Biggl( \overbrace{\int \limits_{0}^{2\pi} \sin \left( p \alpha \left( \nu - \mu \right) - \omega_{el} t \left(1 + \mu \right) \right) \dd\alpha}^{\larger\textcircled{\smaller[2]1}} \\[-2ex] + \overbrace{\int \limits_{0}^{2\pi} \sin \left( p \alpha \left( \nu + \mu \right) - \omega_{el} t \left(1 - \mu \right) \right) \dd\alpha}^{\larger\textcircled{\smaller[2]2}} \Biggr) \end{multlined}\\ &{\larger\textcircled{\smaller[2]1}}: \begin{aligned}[t] &\int \limits_{0}^{2\pi} \sin \left(p \alpha \left( \nu - \mu \right) - \omega_{el} t \left(1 + \mu \right) \right) d\alpha \\[-1ex] &= \frac{1}{p \cdot (\nu - \mu)} \cdot \Bigl[ -\cos \left( p \alpha (\nu - \mu) - \omega_{el} t (1 + \mu) \right) \Bigr]_{0}^{2\pi} \end{aligned}\\ &= \frac{1}{p \cdot (\nu - \mu)} \cdot \Bigl( -\cos \big( 2\pi \overbrace{ p (\nu - \mu)}^{\in \, \mathbb{Z}} - \omega_{el} t (1 + \mu) \big) + \cos \big( - \omega_{el} t (1 + \mu) \big) \Bigr) \\ &= \frac{1}{p \cdot (\nu - \mu)} \cdot \Bigl( -\cos \big( - \omega_{el} t (1 + \mu) \big) + \cos \bigl( - \omega_{el} t (1 + \mu) \bigr) \Bigr) = 0 \end{aligned}

\end{document}


• Why changing the “d” from italic to upright? You shouldn't impose your preference over the OP's. And no, there is no consensus on how to typeset the ”d” for the differential. Aug 29, 2022 at 21:40
• +1, especially for that upright differential operator.
– User
Aug 29, 2022 at 23:52
• Thank you very much, this is what i was looking for ! Aug 30, 2022 at 6:59

Have a look at the code below and let me know if you have any questions.

\documentclass{article}
\usepackage{nicefrac,amssymb}
\usepackage{relsize}

\newlength\matheqindent   \setlength\matheqindent{3em}   % Length name controlling the indentation

\begin{document}

\noindent%
\begin{align*}
\mathrlap{
\int \limits_{0}^{2\pi} \hat{B}_{\delta r \mu} \cdot \cos \left( \mu p \alpha - \mu \omega_{el} t \right) \cdot \hat{A}_{\nu} \cdot \sin \left( \nu p \alpha - \omega_{el} t \right) d\alpha
}\hspace{\matheqindent} \\
&= \hat{B}_{\delta r \mu} \cdot \hat{A}_{\nu} \cdot \int \limits_{0}^{2\pi} \cos \left( \mu p \alpha - \mu \omega_{el} t \right) \cdot \sin \left( \nu p \alpha - \omega_{el} t \right) d\alpha \\
&= \frac{\hat{B}_{\delta r \mu} \cdot \hat{A}_{\nu}}{2} \cdot \Bigg(
\begin{aligned}[t]
& \overbrace{\int \limits_{0}^{2\pi} \sin \left( p \alpha \left( \nu - \mu \right) - \omega_{el} t \left(1 + \mu \right) \right) d\alpha}^{\larger\textcircled{\smaller[2]1}} \\
& + \overbrace{\int \limits_{0}^{2\pi} \sin \left( p \alpha \left( \nu + \mu \right) - \omega_{el} t \left(1 - \mu \right) \right) d\alpha}^{\larger\textcircled{\smaller[2]2}} \Bigg) \\
\end{aligned} \\
\mathrlap{
\larger\textcircled{\smaller[2]1}:
}\hspace{\matheqindent} & \\
\mathrlap{
\int \limits_{0}^{2\pi} \sin \left( p \alpha \left( \nu - \mu \right) - \omega_{el} t \left(1 + \mu \right) \right) d\alpha
}\hspace{\matheqindent}\\
&= \frac{1}{p \cdot (\nu - \mu)} \cdot \Big[ -\cos \left( p \alpha (\nu - \mu) - \omega_{el} t (1 + \mu) \right) \Big]_{0}^{2\pi} \\
&= \frac{1}{p \cdot (\nu - \mu)} \cdot \Big(
\begin{aligned}[t]
& - \cos \big( 2\pi \overbrace{ p (\nu - \mu)}^{\in \, \mathbb{Z}} - \omega_{el} t (1 + \mu) \big) \\
& + \cos \big( - \omega_{el} t (1 + \mu) \big) \Big) \\
\end{aligned} \\
&= \frac{1}{p \cdot (\nu - \mu)} \cdot \Big(
\begin{aligned}[t]
& - \cos \big( - \omega_{el} t (1 + \mu) \big) \\
& + \cos \big( - \omega_{el} t (1 + \mu) \big) \Big)
\end{aligned} \\
&= 0.
\end{align*}

\end{document}


Update according to the comment. Equation without indentation and multi-lines (with one exception).

\documentclass{article}
\usepackage{nicefrac,amssymb}
\usepackage{relsize}

\begin{document}

\noindent%
\begin{align*}
&\int \limits_{0}^{2\pi} \hat{B}_{\delta r \mu} \cdot \cos \left( \mu p \alpha - \mu \omega_{el} t \right) \cdot \hat{A}_{\nu} \cdot \sin \left( \nu p \alpha - \omega_{el} t \right) d\alpha \\
&= \hat{B}_{\delta r \mu} \cdot \hat{A}_{\nu} \cdot \int \limits_{0}^{2\pi} \cos \left( \mu p \alpha - \mu \omega_{el} t \right) \cdot \sin \left( \nu p \alpha - \omega_{el} t \right) d\alpha \\
&= \frac{\hat{B}_{\delta r \mu} \cdot \hat{A}_{\nu}}{2} \cdot \Bigg(
\begin{aligned}[t]
& \overbrace{\int \limits_{0}^{2\pi} \sin \left( p \alpha \left( \nu - \mu \right) - \omega_{el} t \left(1 + \mu \right) \right) d\alpha}^{\larger\textcircled{\smaller[2]1}} \\
& + \overbrace{\int \limits_{0}^{2\pi} \sin \left( p \alpha \left( \nu + \mu \right) - \omega_{el} t \left(1 - \mu \right) \right) d\alpha}^{\larger\textcircled{\smaller[2]2}} \Bigg) \\
\end{aligned} \\
&{\larger\textcircled{\smaller[2]1}}:
\int \limits_{0}^{2\pi} \sin \left(p \alpha \left( \nu - \mu \right) - \omega_{el} t \left(1 + \mu \right) \right) d\alpha
\\
&= \frac{1}{p \cdot (\nu - \mu)} \cdot \Big[ -\cos \left( p \alpha (\nu - \mu) - \omega_{el} t (1 + \mu) \right) \Big]_{0}^{2\pi} \\
&= \frac{1}{p \cdot (\nu - \mu)} \cdot \Big(- \cos \big( 2\pi \overbrace{ p (\nu - \mu)}^{\in \, \mathbb{Z}} - \omega_{el} t (1 + \mu) \big) + \cos \big( - \omega_{el} t (1 + \mu) \big) \Big) \\
&= \frac{1}{p \cdot (\nu - \mu)} \cdot \Big(- \cos \big( - \omega_{el} t (1 + \mu) \big) + \cos \big( - \omega_{el} t (1 + \mu) \big) \Big) = 0.
\end{align*}

\end{document}

• Thank you so far. The whole equation should be aligned to the left. So line 3 and 4 in your result should fit in one single line. The integral in line 6 should be in the same line as the circled 1. And the rest of the lines should be aligned to the integral sign of line 6. Aug 30, 2022 at 6:46
• @Domi1908 I updated my answer and added another version of equations. It was a matter of removing \mathrcap{} that caused indentations and added ampersand & in front of each equation for left alignment. I also removed last two inner aligned environments. This became almost the same answer as @egreg's and @Bernard's however mine's without indentations after the circled number. Aug 30, 2022 at 8:55
• Looking at your code again, I think @egreg's answer is what you want to achieve because he managed to add indentation after the circled number. I'll leave my answer as is at this point. Aug 30, 2022 at 8:58