3

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

2 Answers 2

5

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}
4

You can do that nesting gathered in aflalign(*) environment:

\documentclass{article}

\usepackage{mathtools}
\usepackage[showframe]{geometry}

\begin{document}

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

\begin{equation}
\begin{gathered}
    x^2 + 3 \\
    2x - 5 = z
    \end{gathered}
\end{equation}

Multiline math which must be left-aligned
\begin{flalign}
\hskip\parindent & \begin{gathered}
    x^2 + 3 \\
    2x - 5 = z
    \end{gathered} &
\end{flalign}

\end{document} 

enter image description here

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.