0

I would like to remove the unnecessary spacing between in the last two lines. The equal signs should be aligned but all a little bit more to the right. Thanks in advance.

My code:

\documentclass{article}

\usepackage{amsmath}

\begin{document}
\begin{flalign*}
&\quad\rightarrow u(x_1,x_2,T) 
&&= \left(\alpha_1 e^{\sigma_1 x_1} + \alpha_2 e^{\sigma_2 x_2} - 1\right)_+ &\\
%
&\quad\rightarrow \lim_{x_1 \rightarrow -\infty}  u(x_1,x_2,t) 
&&= \alpha_2 e^{\sigma_2 x_2} P(d_1) - e^{-r(T-t)} P(d_2) &\\
%
&\quad\rightarrow \lim_{x_2 \rightarrow -\infty}  u(x_1,x_2,t) 
&&= \alpha_1 e^{\sigma_1 x_1} P(\hat{d}_1) - e^{-r(T-t)} P(\hat{d}_2) &\\
%
&\quad\rightarrow \lim_{x_1 \rightarrow \infty}  \left(u(x_1,x_2,t) - \alpha_1 e^{\sigma_1 x_1}\right)
&&= e^{-r(T-t)} \left(\alpha_2 e^{\sigma_2 x_2} - 1\right) &\\
%
&\quad\rightarrow \lim_{x_2 \rightarrow \infty}  \left(u(x_1,x_2,t) - \alpha_2 e^{\sigma_2 x_2}\right)
&&= e^{-r(T-t)} \left(\alpha_1 e^{\sigma_1 x_1} - 1\right) &
\end{flalign*}
\end{document}

enter image description here

Why is there spacing in the first place?

Again thanks in advance!

1
  • flalign, like align is desiged for showing muliple equations on a line so a=b c=d so adds space between each "pair". use alignat Jul 11, 2022 at 16:04

2 Answers 2

2

flalign, like align is designed for showing muliple equations on a line so a=b c=d. So it adds space between each "pair". The space shows more with flalign as that is "Full Length align" so by design stretches the groups apart as far as possible, to cover the width of the page.

Use alignat

enter image description here

\documentclass{article}

\usepackage{amsmath}

\begin{document}
\begin{alignat*}{-1}
&\rightarrow u(x_1,x_2,T) 
&&= \left(\alpha_1 e^{\sigma_1 x_1} + \alpha_2 e^{\sigma_2 x_2} - 1\right)_+ \\
%
&\rightarrow \lim_{x_1 \rightarrow -\infty}  u(x_1,x_2,t) 
&&= \alpha_2 e^{\sigma_2 x_2} P(d_1) - e^{-r(T-t)} P(d_2)\\
%
&\rightarrow \lim_{x_2 \rightarrow -\infty}  u(x_1,x_2,t) 
&&= \alpha_1 e^{\sigma_1 x_1} P(\hat{d}_1) - e^{-r(T-t)} P(\hat{d}_2)\\
%
&\rightarrow \lim_{x_1 \rightarrow \infty}  \left(u(x_1,x_2,t) - \alpha_1 e^{\sigma_1 x_1}\right)
&&= e^{-r(T-t)} \left(\alpha_2 e^{\sigma_2 x_2} - 1\right)\\
%
&\rightarrow \lim_{x_2 \rightarrow \infty}  \left(u(x_1,x_2,t) - \alpha_2 e^{\sigma_2 x_2}\right)
&&= e^{-r(T-t)} \left(\alpha_1 e^{\sigma_1 x_1} - 1\right)
\end{alignat*}
\end{document}
5
  • Thank you so far! The reason I did not use alignat is because I want the whole thing to be aligned to the left side (the rightarrows) - preferably with some offset. How would I do that?
    – Alex_qp
    Jul 11, 2022 at 16:24
  • \usepackage[fleqn]{amsmath} and set \mathindent or for a one-off in an otherwise centred document use $\begin{aligndat}... @Alex_qp Jul 11, 2022 at 16:26
  • Thank you so much! It works with fleqn.
    – Alex_qp
    Jul 11, 2022 at 16:28
  • @Bernard that's true but did you mean to make that comment on your answer, as I haven't mentioned the nccmath fleqn environment here? Jul 11, 2022 at 16:37
  • @DavidCarlisle:You're right, but I only focused on the question author's comment, and didn't see it was a comment about your answer. I'll move it within seconds
    – Bernard
    Jul 11, 2022 at 16:40
0

A solution with the fleqn environment, from nccmath and alignat*:

    \documentclass{article}

    \usepackage{amsmath}
    \usepackage{nccmath}
    \usepackage{showframe}
    \renewcommand{\ShowFrameLinethickness}{0.3pt}

    \begin{document}

    \begin{fleqn}[1em]
    \begin{alignat*}{2}
    &\rightarrow u(x_1,x_2,T)
    &&= \left(\alpha_1 e^{\sigma_1 x_1} + \alpha_2 e^{\sigma_2 x_2} - 1\right)_+ \\
    %
    &\rightarrow \lim_{x_1 \rightarrow -\infty} u(x_1,x_2,t)
    &&= \alpha_2 e^{\sigma_2 x_2} P(d_1) - e^{-r(T-t)} P(d_2) \\
    %
    &\rightarrow \lim_{x_2 \rightarrow -\infty} u(x_1,x_2,t)
    &&= \alpha_1 e^{\sigma_1 x_1} P(\hat{d}_1) - e^{-r(T-t)} P(\hat{d}_2) b\\
    %
    &\rightarrow \lim_{x_1 \rightarrow \infty} \left(u(x_1,x_2,t) - \alpha_1 e^{\sigma_1 x_1}\right)
    &&= e^{-r(T-t)} \left(\alpha_2 e^{\sigma_2 x_2} - 1\right) \\
    %
    &\rightarrow \lim_{x_2 \rightarrow \infty} \left(u(x_1,x_2,t) - \alpha_2 e^{\sigma_2 x_2}\right)
    & &= e^{-r(T-t)} \left(\alpha_1 e^{\sigma_1 x_1} - 1\right)
    \end{alignat*}
    \end{fleqn}

    \end{document} 

enter image description here

3
  • Why are you using \begin{alignat}{2}.... instead of {-1}? What does this parameter do?
    – Alex_qp
    Jul 11, 2022 at 16:30
  • @Alex_qp: because there are two alignment points: the arrows and the = sign.
    – Bernard
    Jul 11, 2022 at 16:35
  • Note the optional argument of the fleqn environment is used to set the distance from the left margin at which the equations begin (the default is 0).
    – Bernard
    Jul 11, 2022 at 16:41

You must log in to answer this question.

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