I know how to use the ampersand in align
and aligned
environments to write multi-line equations. In this case I need to use \left[
and \right]
to contain an expression on the first line, and I want the beginning of the second line to be aligned with a specific point inside the square brackets of the first line.
I know from https://www.overleaf.com/learn/latex/Brackets_and_Parentheses that when one wants to use the \left
and \right
commands on multi-line equations, these commands must be balanced on each line and on the same side of &
, and in order to do so one must use "invisible" brackets to balance things out, i.e. adding \right.
and/or \left.
.
So I wrote
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation*}
\begin{aligned}
\ddot{Q}_s + 3H\dot{Q}_s + \left[ \frac{k^2}{a^2} \right. & \left. + \mathcal{M}_{SS} + 3\omega^2 - \Pi^2 \right] Q_s \\
&= 4M_P^2\frac{\omega}{\dot{\sigma}}\frac{k^2}{a^2}\Psi - \frac{D}{dt}\left(\Pi_jB^j\right) - \Pi_j\frac{D}{dt}B^j - \mathcal{M}_{Sj}B^j - 3H\left(\Pi_jB^j\right)
\end{aligned}
\end{equation*}
\end{document}
However, as you can see in the figure below, even if the use of \right.
and \left.
is correct (and in fact this code does not produce errors), the result is disappointing because the right square bracket on the first line have the wrong size. It seems that \left.
made the compiler forget the correct size of the left bracket, so that only the text between \left.
and \right]
is taken into account to evaluate the dimension of the right square bracket. Similarly, it seems that only the text between \left[
and \right.
is taken into account to evaluate the dimension of the left square bracket. In other words, it seems that the two square brackets on the first line do not communicate with each other.
How can i fix this? Thank you