3

The obvious alignment would be the = and the + signs, however, I do wish to align the es). alignat* allows me to alternate between right and left alignment, so I can have right alignment before the es and left alignment after the es.

However, the es are enclosed by big ∫ brackets, and the alignment prohibits the compiler to realise that the closing brackets is associated with the opening brackets.

MWE

\documentclass{article}
\usepackage{mathtools}
\begin{document}

\[ F(s) = \mathcal{L}\{f(t)\} = \int_{0}^{\infty} f(t)e^{-st} dt \]

\begin{alignat*}{8}
             F(s)
 &&=        \int_{0}^{1}      1\cdot &e^{-st} dt  
  &+        \int_{1}^{2}     -1\cdot &e^{-st} dt  
  &+        \int_{2}^{\infty} 0\cdot &e^{-st} dt\\
 &&= \left[-\tfrac{1}{s}\cdot &e^{-st}\right]_{0}^{1}
  &+ \left[ \tfrac{1}{s}\cdot &e^{-st}\right]_{1}^{2}
  &+ \left[                 0 &       \right]_{2}^{\infty}
\end{alignat*}

\end{document}
4
  • 1
    From where you got tfrac?
    – Sigur
    Feb 5, 2020 at 11:03
  • 1
    What about replacing \left \right by \Bigl \Bigr? No errors with that. Also, move the ` =` before the && to have a better spacing around it.
    – Sigur
    Feb 5, 2020 at 11:04
  • Yeah, I forgot to add that package to the MWE. Thanks for pointing that out. Replacing \left \right with \Bigl \Bigr works excellent. Cheers, @Sigur
    – Matt
    Feb 5, 2020 at 11:20
  • Good. Observe the space around the equal signs. I think it is not the same as a simple one like in \[ a = b \].
    – Sigur
    Feb 5, 2020 at 11:22

1 Answer 1

3

I'm not sure this is a good idea, anyway here's how you can do it.

The trick is remembering that alignat (here in the internal version alignedat) makes pairs of right- and left-aligned columns.

A few {} are needed to ensure correct spacing around binary operation symbols.

\documentclass{article}
\usepackage{mathtools}
\begin{document}

\begin{gather*}
F(s) = \mathcal{L}\{f(t)\} = \int_{0}^{\infty} f(t)e^{-st}\,dt
\\
\begin{alignedat}{8}
F(s)
&=  & \int_{0}^{1}      1 &\cdot{}&& e^{-st}\,dt &
&+{}& \int_{1}^{2}     -1 &\cdot{}&& e^{-st}\,dt &
&+{}& \int_{2}^{\infty}{} & 0 \cdot e^{-st}\,dt
\\
&=  & \Bigl[-\frac{1}{s} &\cdot{}&& e^{-st}\Bigr]_{0}^{1} &
&+{}& \Bigl[ \frac{1}{s} &\cdot{}&& e^{-st}\Bigr]_{1}^{2} &
&+{}& \Bigl[&0\Bigr]_{2}^{\infty}
\end{alignedat}
\end{gather*}

\end{document}

enter image description here

Avoiding the repetition:

\documentclass{article}
\usepackage{mathtools}
\begin{document}

\begin{align*}
F(s) &= \mathcal{L}\{f(t)\} = \int_{0}^{\infty} f(t)e^{-st}\,dt
\\
&\begin{alignedat}{8}
&=  & \int_{0}^{1}      1 &\cdot{}&& e^{-st}\,dt &
&+{}& \int_{1}^{2}     -1 &\cdot{}&& e^{-st}\,dt &
&+{}& \int_{2}^{\infty}{} & 0 \cdot e^{-st}\,dt
\\
&=  & \Bigl[-\frac{1}{s} &\cdot{}&& e^{-st}\Bigr]_{0}^{1} &
&+{}& \Bigl[ \frac{1}{s} &\cdot{}&& e^{-st}\Bigr]_{1}^{2} &
&+{}& \Bigl[&0\Bigr]_{2}^{\infty}
\end{alignedat}
\end{align*}

\end{document}

enter image description here

My preference would go to the following setting, because I start from the idea that readers can read.

\documentclass{article}
\usepackage{mathtools}
\begin{document}

\begin{align*}
F(s) &= \mathcal{L}\{f(t)\} = \int_{0}^{\infty} f(t)e^{-st}\,dt
\\
     &= \int_{0}^{1}  1\cdot e^{-st}\,dt
      + \int_{1}^{2} -1\cdot e^{-st}\,dt
      + \int_{2}^{\infty} 0\cdot e^{-st}\,dt
\\
&= \Bigl[-\frac{1}{s} e^{-st}\Bigr]_{0}^{1}
 + \Bigl[ \frac{1}{s} e^{-st}\Bigr]_{1}^{2}
 + \Bigl[0\Bigr]_{2}^{\infty}
\end{align*}

\end{document}

enter image description here

3
  • Very good points. Personally, I like to align each term in the middle and bottom rows, as it's clearer for the reader to see that each term on the bottom row is what each term on the middle row turns into. However, I agree with the fact that writing F(s) twice is perhaps too much. Do you know a way to align only the first equal sign from the first row with the rest of the equal signs, but keeping the alignment between rows two and three?
    – Matt
    Feb 9, 2020 at 17:18
  • @Matt Added and fixed a slight misalignment
    – egreg
    Feb 9, 2020 at 17:42
  • Perfect, thanks! :)
    – Matt
    Feb 10, 2020 at 11:35

You must log in to answer this question.

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