0

so yeah, I'm trying to stop using $$ for equations, but the fact that \[ automatically places equations in the center is a bit annoying, is there a command to disable that.

4

2 Answers 2

2

You can use the fleqn option to amsmath.

\documentclass{article}
\usepackage[fleqn]{amsmath}
\setlength{\mathindent}{0cm} % This controls the indent

\begin{document}
    \noindent
    Some text before the equation.
    \[
    x = y + z
    \]
    Some text after the equation.
\end{document}

Output:

enter image description here

1

You seem to be using input such as

This is some text before an equation\\
$x+y=y+x$\\
and this text follows

because using $$...$$ would center the equation anyway.

Such way of coding your typescript is wrong under many respects, even if you use something like

This is some text before an equation\\[1ex]
$x+y=y+x$\\[1ex]
and this text follows

to get vertical space around the math display.

Never use \\ to end lines in normal paragraphs. TeX ain't a word processor!

If you want equations to the left, it's possible using \[...\] or other amsmath display environments, but avoid printing display math flush with the left margin.

\documentclass[fleqn]{article}
\usepackage{amsmath}

\begin{document}

\section{Bad display}

The following fact should be known to every mathematician \\[1ex]
$\int_{-\infty}^{\infty} e^{-x^{2}}\,dx=\sqrt{\pi}$\\[1ex]
and was definitely a surprise when it was discovered.

\section{Good display}

The following fact should be known to every mathematician
\[
\int_{-\infty}^{\infty} e^{-x^{2}}\,dx=\sqrt{\pi}
\]
and was definitely a surprise when it was discovered.

\end{document}

enter image description here

If you really want the display to be flush left,

\documentclass[fleqn]{article}
\usepackage{amsmath}

\setlength{\mathindent}{0pt}

\begin{document}

\section{Not so good display}

The following fact should be known to every mathematician
\[
\int_{-\infty}^{\infty} e^{-x^{2}}\,dx=\sqrt{\pi}
\]
and was definitely a surprise when it was discovered.

\end{document}

enter image description here

Why isn't it really good? Because left aligned displays are usually employed along with equation numbers on the left. Look at the following.

\documentclass[fleqn,leqno]{article}
\usepackage{amsmath}

\begin{document}

\section{Unnumbered}

The following fact should be known to every mathematician
\[
\int_{-\infty}^{\infty} e^{-x^2}\,dx=\sqrt{\pi}
\]
and was definitely a surprise when it was discovered.

\section{Numbered}

The following fact should be known to every mathematician
\begin{equation}
\int_{-\infty}^{\infty} e^{-x^2}\,dx=\sqrt{\pi}
\end{equation}
and was definitely a surprise when it was discovered.

\end{document}

enter image description here

If you set \mathindent to zero you get suboptimal output.

enter image description here

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