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.
- 3,826
- 11
2 Answers
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:
- 358
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}
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}
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}
If you set \mathindent to zero you get suboptimal output.
- 1,121,712





fleqnandflalign: https://tex.stackexchange.com/questions/145657/align-equation-left/145660#145660 – Steven B. Segletes Nov 28 '23 at 15:53fl eqn= flush left equations butfl alignis full length align, so only accidentally leftish aligned. – David Carlisle Nov 28 '23 at 17:32&&trick. – Steven B. Segletes Nov 28 '23 at 17:35