5

I need redefinition of gather (cannot be equation because of some other problem I asked about earlier on this forum) so it would have justification to the left, has no empty line after enumerate number. It may sound strange but I really need to have both labels tag and enumerating. Document has to be written in one style and I have to have enumerate in some sections where I don't have to have labels.

So, I want something like this:

\documentclass[11pt]{article}
\usepackage{amsmath}
\setlength{\jot}{0pt}
\begin{document}
  \begin{enumerate}
       \item \begin{gather} a=b \tag{12}\label{one}\end{gather}
       \item \begin{gather}c=d \tag{lee}\label{two}\end{gather}
       \item \begin{gather}e=f \tag{bom}\label{three}\end{gather}
    \end{enumerate}
     \eqref{one} \eqref{two} \eqref{three}      
\end{document}

to look like this

Thanks in advance!

1 Answer 1

5

Something like this?

enter image description here

Code:

\documentclass[11pt]{article}
\usepackage{amsmath}
\setlength{\jot}{0pt}

\makeatletter
\newcommand{\mathleft}{\@fleqntrue\@mathmargin5pt}
\newcommand{\mathcenter}{\@fleqnfalse}
\newcommand{\gatheritem}{%
    \item%
    \abovedisplayskip=0pt\abovedisplayshortskip=0pt%
    \belowdisplayskip=0pt\belowdisplayshortskip=0pt%
    ~\vspace*{-\baselineskip}%
  }
\newenvironment{gatherenum}{%
    \enumerate\mathleft%
  }{%
    \mathcenter\endenumerate%
  }
\makeatother

\begin{document}
  \begin{gatherenum}
       \gatheritem \begin{gather} a=b \tag{12}\label{one}\end{gather}
       \gatheritem \begin{gather}c=d \tag{lee}\label{two}\end{gather}
       \gatheritem \begin{gather}e=f \tag{bom}\label{three}\end{gather}
  \end{gatherenum}
     \eqref{one} \eqref{two} \eqref{three}
\end{document} 

You have to use the newly defined environment gatherenum instead of enumerate, and \gatheritem instead of \item.

How it works

We simulate the option fleqn for amsmath with the command \mathleft

\newcommand{\mathleft}{\@fleqntrue\@mathmargin5pt}

and restore the centering behavior with the command \mathcenter

\newcommand{\mathcenter}{\@fleqnfalse}

Then we define a new \item-like command (\gatheritem) which removes the unwanted spacing between the item number and the equation

\newcommand{\gatheritem}{%
    \item%
    \abovedisplayskip=0pt\abovedisplayshortskip=0pt%
    \belowdisplayskip=0pt\belowdisplayshortskip=0pt%
    ~\vspace*{-\baselineskip}%
  }

Finally, we create a new environment gatherenum which makes use of \mathleft and restores \mathcenter at the end.

2
  • Yes, it works great. Though spacing between {\gatheritem} items could be one third shorter.
    – user41766
    Jan 28, 2014 at 18:08
  • 1
    @user41766 I've modified the code. Now it should be how you want it. Jan 28, 2014 at 18:32

You must log in to answer this question.

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