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.

5
  • Why do you the T2A encoding if you only use english?
    – Bernard
    Aug 14, 2018 at 11:28
  • 1
    Why use enumerate if the equations are numbered?
    – Skillmon
    Aug 14, 2018 at 11:42
  • @Skillmon: There might be text in addition to an equation in each item, and the list numbering might be independent of the equation numbering.
    – Bernard
    Aug 14, 2018 at 12:00
  • @Bernard, I use other languages apart from English as well. This is just a MWE. Aug 14, 2018 at 12:39
  • this question might be helpful: Equations inside enumerate aligned on item's number (possible duplicate) Oct 1, 2018 at 13:12

1 Answer 1

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

7
  • Brillant but coding is not understandable by plain Latex users.
    – pzorba75
    Aug 14, 2018 at 14:36
  • 1
    @pzorba75: I've added an explanation for \useshortskip. Is it clearer?
    – Bernard
    Aug 14, 2018 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, 2018 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, 2018 at 17:25
  • @pzorba75 does that help?
    – Skillmon
    Aug 14, 2018 at 17:25

You must log in to answer this question.

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