[Tex/LaTex] Align math to the left

horizontal alignmentmath-mode

I need to align math to the left. I tried to add [fleqn] option to the \documentclass command – it works but now all equations in the document are aligned to the left which isn't what I want.

My LaTeX code looks like this

\documentclass{article}

\usepackage{amsmath}

\begin{document}

Classic math which I don't want align to the left

\[
    2x + 5
\]

Multiline math which must be left-aligned   

\begin{gather*}
    x^2 + 3 \\
    2x - 5
\end{gather*}

\end{document}

gather* environment is used only for example. Is there any environment instead of gather* which is suitable for my needs? Thanks

Best Answer

That's a rather strange requirement, perhaps easiest is if you use $$ instead of \[. $$ is officially not supported syntax, the main problem being that it does not+ work with fleqn which seems to be exactly what you want here.

Note never leave a blank line above a display math, whether $$, \[ or \begin{align}

enter image description here

\documentclass[fleqn]{article}

\usepackage{amsmath}

\begin{document}

Classic math which I don't want align to the left
$$
    2x + 5
$$

Multiline math which must be left-aligned   
\begin{gather*}
    x^2 + 3 \\
    2x - 5 \\
\end{gather*}

\end{document}
Related Question