0

I know, there are several instructions and answers how to get a left alignment of equations in LaTeX. I tried a lot of methods, but it seems that there is no method, that solved my problem.

I don't want to use the \usepackage[fleqn]{amsmath} method, because I want to align some equations in the center. At the moment, the best solution that fits to my problem was

\begin{align*}
        f(k) &=\int^{\infty }_{-\infty } f(t) \cdot e^{-ikt} \cdot \D t \\
    &=\int^{\infty }_{-\infty}\frac{1}{2}\left(e^{i\omega_{0}  t}+e^{-i\omega_{0} t}\right) \cdot e^{-a|t|} \cdot e^{-ikt} \cdot \D t \\
    &=\int^{\infty}_{-\infty }\frac{1}{2}\left(e^{i\omega_{0} t} \cdot e^{-ikt} +e^{-i\omega_{0} t} \cdot e^{-ikt}\right) \cdot e^{-a|t|} \cdot \D t \\
    &=\int^{\infty}_{-\infty }\frac{1}{2}\left( e^{i\omega_{0} t - ikt} +e^{-i\omega_{0} t-ikt}\right) \cdot e^{-a|t|} \cdot \D t \\
    &=\int^{\infty}_{-\infty }\frac{1}{2}\left( e^{i(\omega_{0} -k) t} +e^{-i(\omega_{0} +k) t}\right) \cdot e^{-a|t|} \cdot \D t \\ 
    &=\int^{\infty}_{-\infty }\frac{1}{2}\left( e^{i(\omega_{0} -k) t} \cdot e^{-a|t|} +e^{-i( \omega_{0} +k) t} \cdot e^{-a|t|}\right) \cdot \D t \\
    &=\frac{1}{2}\int^{\infty}_{-\infty } e^{i(\omega_{0} -k) t-a|t|} \cdot \D t + \frac{1}{2}\int^{\infty }_{-\infty} e^{-i(\omega_{0} +k) t-a|t|} \cdot \D t \\
    \Rightarrow f(k) =\frac{1}{2}\int^{\infty }_{-\infty } e^{i(\omega_{0} -k) t-a|t|} \cdot \D t + \frac{1}{2}\int^{\infty }_{-\infty } e^{i( -( \omega_{0} +k)) t-a|t|} \cdotp \D t
\end{align*}

The result I get is this:

1]

What I want is to remove the empty area (which I marked as a red square in this picture)

enter image description here

so that the equation starts really at the left.

When I write \begin{align*} \item f(k) etc. I get my left alignment, but the equations look very squashed and ugly.

enter image description here

You can find my full LaTeX code here: https://www.overleaf.com/read/nkhmhfrhcwzy

I'm very grateful for your answers!

  • Welcome to TeX.SE!! – manooooh Oct 31 '18 at 0:15
  • 4
    You are missing an alignment point in the last line, so LaTeX thinks that the whole equation is in the first column. That's why it's so big. Use \Rightarrow f(k) &=\frac{1}{2}... in the last line. – Phelype Oleinik Oct 31 '18 at 0:16
1

The fleqn environment from nccmath is here for that. Note that if most of your equations are left aligned, you might as well use the fleqn option for the document class and use the ceqn environment for centred equations.

\documentclass[11pt]{article}
\usepackage{amsmath, nccmath}
\usepackage[showframe]{geometry} 
\newcommand*{\D}{\mathop{}\!\mathrm{d}}

\begin{document}

\begin{fleqn}
\begin{align*}
    f(k) &=\int^{\infty }_{-\infty } f(t) \cdot e^{-ikt} \cdot \D t \\
&=\int^{\infty }_{-\infty}\mfrac{1}{2}\left(e^{i\omega_{0} t}+e^{-i\omega_{0} t}\right) \cdot e^{-a|t|} \cdot e^{-ikt} \cdot \D t \\
&=\int^{\infty}_{-\infty }\mfrac{1}{2}\left(e^{i\omega_{0} t} \cdot e^{-ikt} +e^{-i\omega_{0} t} \cdot e^{-ikt}\right) \cdot e^{-a|t|} \cdot \D t \\
&=\int^{\infty}_{-\infty }\mfrac{1}{2}\left( e^{i\omega_{0} t - ikt} +e^{-i\omega_{0} t-ikt}\right) \cdot e^{-a|t|} \cdot \D t \\
&=\int^{\infty}_{-\infty }\mfrac{1}{2}\left( e^{i(\omega_{0} -k) t} +e^{-i(\omega_{0} +k) t}\right) \cdot e^{-a|t|} \cdot \D t \\
&=\int^{\infty}_{-\infty }\mfrac{1}{2}\left( e^{i(\omega_{0} -k) t} \cdot e^{-a|t|} +e^{-i( \omega_{0} +k) t} \cdot e^{-a|t|}\right) \cdot \D t \\
&=\mfrac{1}{2}\int^{\infty}_{-\infty } e^{i(\omega_{0} -k) t-a|t|} \cdot \D t + \mfrac{1}{2}\int^{\infty }_{-\infty} e^{-i(\omega_{0} +k) t-a|t|} \cdot \D t \\
\Rightarrow f(k) & =\mfrac{1}{2}\int^{\infty }_{-\infty } e^{i(\omega_{0} -k) t-a|t|} \cdot \D t + \mfrac{1}{2}\int^{\infty }_{-\infty } e^{i( -( \omega_{0} +k)) t-a|t|} \cdotp \D t
\end{align*}
\end{fleqn}

\end{document} 

enter image description here

  • 1
    No, I just forgot to include the result on the following line. 'Tis fixed. – Bernard Oct 31 '18 at 0:43
  • Thank you very much! <3 You saved my homework! – astronerd Oct 31 '18 at 6:51

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.