2

I am trying to use a big equation inside flalign. The biggest chunk is the third line and I couldn't figure out how to something akin to \shoveright in this third equation, as I want is ending on the right margin. Does anyone know how I can do that in this code?

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage[letterpaper]{geometry}
\begin{document}

\def\del{\, \mathrm{d}}
\def\inv{^{-1}}

\begin{flalign*}
&\del L_j= \beta_j^{-2}\left (\tilde{\Sigma}_j\inv+\tilde{\Sigma}_{wj}\inv+\Psi_j\inv  +\rho^{-2}\sigma_x^2\Psi_j^{-2}\right )\inv\left\{\tilde{\Sigma}_j^{-3}\left (\Sigma_{\epsilon j}-\Sigma_j\right )\del \Sigma_j\right. & \\
&\phantom{\del L_j=} +\left[1+2\left (\tilde{\Sigma}_{wj}\inv+\Psi_j\inv +\rho^{-2}\sigma_x^2\Psi_j^{-2}\right )\Sigma_{\epsilon j}\right ]\del \tilde{\Sigma}_{wj}\inv &\\
&  \left. +2\left[\left (\tilde{\Sigma}_{wj}\inv+\Psi_j\inv +\rho^{-2}\sigma_x^2\Psi_j^{-2}\right )\Sigma_{\epsilon j}\left (1+2\rho^{-2}\sigma_x^{-2}\Psi_j\inv\right )+\left (1+\rho^{-2}\sigma_x^{-2}\Psi_j\inv\right )\right ]\del \Psi_{j}\inv\right\}&\\
&\phantom{\del L_j}= \text{right-hand-side number 1}&\\
&\phantom{\del L_j}= \text{right-hand-side number 2}&\\
&\phantom{\del L_j}= \text{etc.} &
\end{flalign*}

\noindent
This text is just to show the left and right margins. This text is just to show the left and right margins.

\multlinegap=0pt
\begin{multline*}
\del L_j= \beta_j^{-2}\left (\tilde{\Sigma}_j\inv+\tilde{\Sigma}_{wj}\inv+\Psi_j\inv +\rho^{-2}\sigma_x^2\Psi_j^{-2}\right )\inv\left\{\tilde{\Sigma}_j^{-3}\left (\Sigma_{\epsilon j}-\Sigma_j\right )\del \Sigma_j\right. \\
+\left[1+2\left (\tilde{\Sigma}_{wj}\inv+\Psi_j\inv +\rho^{-2}\sigma_x^2\Psi_j^{-2}\right )\Sigma_{\epsilon j}\right ]\del \tilde{\Sigma}_{wj}\inv\\
\shoveright{\left. +2\left[\left (\tilde{\Sigma}_{wj}\inv+\Psi_j\inv +\rho^{-2}\sigma_x^2\Psi_j^{-2}\right )\Sigma_{\epsilon j}\left (1+2\rho^{-2}\sigma_x^{-2}\Psi_j\inv\right )+\left (1+\rho^{-2}\sigma_x^{-2}\Psi_j\inv\right )\right ]\del \Psi_{j}\inv\right\}}\\
\shoveleft{\begin{aligned}
\phantom{\del L_j} &= \text{right-hand-side number 1}\\
\phantom{\del L_j} &= \text{right-hand-side number 2}\\
\phantom{\del L_j}  &= \text{etc.}
\end{aligned}}
\end{multline*}

\noindent
This text is just to show the left and right margins. This text is just to show the left and right margins.


\end{document}

In the second attempt, the third equation ends at the right margin. The caveat is that the spacing between on equation and the next in the aligned is not as large as the one in the previous code using align, so I don't regard it as satisfactory.

Also, for some reason my compiler reports over and underfull boxes, even though I cannot see why.

2
2

Given the structure of the formula and the width of the text block, I don't think you can display the equation in fewer than four lines. This necessitates breaking some of the longer parenthetical terms across two or more lines.

By the way, not only do \left and \right not work across broken lines, they arguably also choose math fences that are inappropriately large for the formula at hand. I suggest using \bigl and \bigr for the round parentheses and \Bigl and \Bigr for the square brackets and curly braces.

Finally, I wouldn't use an flalign environment, as align seems to be perfectly up to the task.

enter image description here

\documentclass[12pt]{article}
\usepackage{amsmath}
% remove 'showframe' option from real document
\usepackage[letterpaper,showframe]{geometry} 
\def\del{\, \mathrm{d}}
\def\inv{^{-1}}

\begin{document}
\begin{align*}
\del L_j
&= \beta_j^{-2}
\bigl ( \tilde{\Sigma}_j\inv+\tilde{\Sigma}_{wj}\inv+\Psi_j\inv  
    +\rho^{-2}\sigma_x^2\Psi_j^{-2}\bigr ) \inv \Bigl\{ \tilde{\Sigma}_j^{-3}
\bigl (\Sigma_{\epsilon j}-\Sigma_j\bigr )\del \Sigma_j\\
&\quad +\Bigl[1+2\bigl (\tilde{\Sigma}_{wj}\inv+\Psi_j\inv +\rho^{-2}\sigma_x^2\Psi_j^{-2}\bigr )
   \Sigma_{\epsilon j} \Bigr]\del \tilde{\Sigma}_{wj}\inv \\
&\quad+2\Bigl[\bigl (\tilde{\Sigma}_{wj}\inv+\Psi_j\inv +\rho^{-2}\sigma_x^2\Psi_j^{-2}\bigr )
   \Sigma_{\epsilon j}\bigl (1+2\rho^{-2}\sigma_x^{-2}\Psi_j\inv\bigr )\\
&\qquad+\bigl (1+\rho^{-2}\sigma_x^{-2}\Psi_j\inv\bigr )\Bigr] \del \Psi_{j}\inv \Bigr\}\\
&= \dots\\
&= \dots\\
&= \dots
\end{align*}
\end{document}

The thin lines in the screenshot are generated by the showframe option of the geometry package; drop this option in the production version of your paper.

1

Here a two ways of solving the problem: one with \flalign*, mathrlap and mathllap, the second with align*and a sort of MoveEqRight — which is only MoveEqLeft from mathtools with a negative argument. As I didn't know what \inv and \del were supposed to do, I decided the former was ^{-1} and the latter \relax:

\documentclass{article}
\usepackage{mathtools}
\usepackage[showframe, nomarginpar]{geometry} %
\def\del{\relax}
\def\inv{^{-1} }

\begin{document}

\begin{flalign*}%
\del L_j & = \beta_j^{-2}
  \mathrlap{\left (\tilde{\Sigma}_j\inv+\tilde{\Sigma}_{wj}\inv+\Psi_j\inv +\rho^{-2}\sigma_x^2\Psi_j^{-2}\right )\inv\left\{\tilde{\Sigma}_j^{-3}\left (\Sigma_{\epsilon j}-\Sigma_j\right )\del \Sigma_j\right.} \\[-4pt]
 & & & & \cdot \left[1+2\left (\tilde{\Sigma}_{wj}\inv+\Psi_j\inv +\rho^{-2}\sigma_x^2\Psi_j^{-2}\right )\Sigma_{\epsilon j}\right ]\del \tilde{\Sigma}_{wj}\inv& \\[-4pt]
 & & & & & \mathllap{ \left. {}+ 2\left[\left (\tilde{\Sigma}_{wj}\inv+\Psi_j\inv +\rho^{-2}\sigma_x^2\Psi_j^{-2}\right )\Sigma_{\epsilon j}\left (1+2\rho^{-2}\sigma_x^{-2}\Psi_j\inv\right )+\left (1+\rho^{-2}\sigma_x^{-2}\Psi_j\inv\right )\right ]\del \Psi_{j}\inv\right\}}
 \\
& = \text{right-hand-side number 1}&\\
& = \text{right-hand-side number 2}&\\
& = \text{etc.} &
\end{flalign*}

\begin{align*}%
\del L_j & = \beta_j^{-2}
 \left (\tilde{\Sigma}_j\inv+\tilde{\Sigma}_{wj}\inv+\Psi_j\inv +\rho^{-2}\sigma_x^2\Psi_j^{-2}\right )\inv\\[-3pt]
 \MoveEqLeft[-2.5] \cdot \left\{\tilde{\Sigma}_j^{-3}\left (\Sigma_{\epsilon j}-\Sigma_j\right )\del \Sigma_j\right.
 \cdot \left[1+2\left (\tilde{\Sigma}_{wj}\inv+\Psi_j\inv +\rho^{-2}\sigma_x^2\Psi_j^{-2}\right )\Sigma_{\epsilon j}\right ]\del \tilde{\Sigma}_{wj}\inv \\[-3pt]
 \MoveEqLeft[-3.5] \left. {}+ 2\left[\left (\tilde{\Sigma}_{wj}\inv+\Psi_j\inv +\rho^{-2}\sigma_x^2\Psi_j^{-2}\right )\Sigma_{\epsilon j}\left (1+2\rho^{-2}\sigma_x^{-2}\Psi_j\inv\right )+\left (1+\rho^{-2}\sigma_x^{-2}\Psi_j\inv\right )\right ]\del \Psi_{j}\inv\right\}
 \\
& = \text{right-hand-side number 1}\\
& = \text{right-hand-side number 2}\\
& = \text{etc.}
\end{align*}

\end{document} 

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.