2

I have an ordered list (enumerate) each item of which is a numbered formula. I am using a gather environment.

\documentclass[12pt,a4paper]{article}
\usepackage[T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath}
\begin{document}
The following conditions are true:
\begin{enumerate}
\item \begin{gather}
    x^2 \ge 0,
\end{gather}
\item \begin{gather}
    x^2 \ge 0,
\end{gather}
\end{enumerate}
\end{document}

But the formulas appear in the center of the next line producing one empty line.

enter image description here How can I get rid of the empty lines and align the formulas to the left? Formula numbers must stay on the right. I would like to stick to the gather environment if possible, because I find it very convenient for my purposes.

1 Answers1

5

Here is a solution: I define a new environment, Lgather (L is for both list and left), with the help of package nccmath, which defines a fleqn environment (inside this environment, equations are left-aligned) and a \useshortskip command, which in practice makes the spacing between text and displayed equation equal to \baselineskip, so I only had to neutralise it with a \vspace*{-\baselineskip}.

\documentclass[12pt, a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath, nccmath}
\newenvironment{Lgather}{\useshortskip\leavevmode\vspace*{-\baselineskip}\fleqn\gather}{\endgather\endfleqn}

\begin{document}

The following conditions are true:
\begin{enumerate}
    \item 
    \begin{Lgather}
    x^2 \ge 0,
 \end{Lgather}
\item 
    \begin{Lgather}
    x^2 \ge 0,
    \end{Lgather}
\end{enumerate}

\end{document}

enter image description here

Bernard
  • 271,350
  • Brillant but coding is not understandable by plain Latex users. – pzorba75 Aug 14 '18 at 14:36
  • 1
    @pzorba75: I've added an explanation for \useshortskip. Is it clearer? – Bernard Aug 14 '18 at 14:51
  • @Bernard : For sure, this explanation is useful. But I still remain unable to write such expressions from my own. – pzorba75 Aug 14 '18 at 17:10
  • 2
    @pzorba75 \newenvironment lets you define a new environment it takes 3 mandatory arguments being the environment's name, the code to be executed at \begin and the code to be executed at \end. The \begin part issues \useshortskip and a negative vertical skip of one \baselineskip. After that it starts two environments without using \begin namely fleqn and gather, both are ended in the end branch with \endfleqn and \endgather (the code to be used at \begin is stored in a macro with the environment's name as its name, the \end in \end<name>). – Skillmon Aug 14 '18 at 17:25
  • @pzorba75 does that help? – Skillmon Aug 14 '18 at 17:25
  • @Skillmon : Sure it helps; Why gather following fleqn is needed as there is only a one line expression in fleqn? – pzorba75 Aug 15 '18 at 03:41
  • @pzorba75 because fleqn is not a math environment but an environment in which every display math environment should be left aligned. You could use equation instead of gather for example, but you need to use a math environment. – Skillmon Aug 15 '18 at 06:33