2

Consider the following example:

\documentclass{article}

\usepackage{amsmath, amsthm, amssymb, mathtools, thmtools, unicode-math}

\begin{document}

\begin{align*}
    \hphantom{\Leftrightarrow}Lf&=0\\
    \Leftrightarrow f''&=-\frac{2b}af'\\
    \Leftrightarrow f'&=c_1\exp\left(-2\int_0^{\;\cdot}\frac ba(x)\:{\rm d}x\right)\\
    \Leftrightarrow f&=c_1\int_0^{\;\cdot}\exp\left(-2\int_0^y\frac ba(x)\:{\rm d}x\right)\:{\rm d}y+c_2
\end{align*}

\end{document}

The desired output is as follows:

desired output

How can I achieve the correct alignment? Basically, it is a matrix with four columns. The content of the first, second and fourth column should be left, right and left aligned, respectively. How can we do this?

3

Use alignat:

\documentclass{article}

\usepackage{amsmath}

\newcommand{\diff}{\mathop{}\!\mathrm{d}}

\begin{document}

\begin{alignat*}{2}
&\quad& Lf&=0\\
\Leftrightarrow && f''&=-\frac{2b}af'\\
\Leftrightarrow && f'&=c_1\exp\biggl(-2\int_0^{\;\cdot}\frac ba(x)\diff x\biggr)\\
\Leftrightarrow && f&=c_1\int_0^{\;\cdot}\exp\biggl(-2\int_0^y\frac ba(x)\diff x\biggr)\diff y+c_2
\end{alignat*}

\end{document}

I changed how the differential d is typeset, the spacing with \: is wrong and \rm has been deprecated for more than 20 years.

enter image description here

1

There's also this possibility, with the \ArrowBetweenLines command, from mathtools.

Unrelated: needless to load amsmath since mathtools already does it for you.

\documentclass{article}

\usepackage{ amssymb, mathtools, amsthm, thmtools, unicode-math}

\begin{document}

\begin{alignat*}{2}
  & & Lf&=0\\
    \ArrowBetweenLines & & f''&=-\frac{2b}af'\\
    \ArrowBetweenLines & &f'&=c_1\exp\left(-2\int_0^{\;\cdot}\frac ba(x)\:{\rm d}x\right)\\
    \ArrowBetweenLines & &f&=c_1\int_0^{\;\cdot}\exp\left(-2\int_0^y\frac ba(x)\:{\rm d}x\right)\:{\rm d}y+c_2
\end{alignat*}

\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.