29

If I type

\begin{enumerate}    
    \item   
    \begin{align*}  
      eqn 1  
      eqn 2  
    \end{align*}  
\end{enumerate}

the label will appear on the first lines and the equations will appear on subsequent lines. How do I make it so that the equations begin on the same line as the enumerate label? Obviosly, I could manually adjust the location using \vspace and \rule, but is there a better way?

3
  • Are you sure you want to center the equations?
    – egreg
    Commented Jun 1, 2012 at 19:36
  • Yes, to do the same task without centering, I use \item $\begin{aligned}[t] equations \end{aligned}$
    – richtera
    Commented Jun 1, 2012 at 22:17
  • OK, but I'm still dubious about the result.
    – egreg
    Commented Jun 1, 2012 at 22:19

2 Answers 2

35
\listfiles
\documentclass{article}
\usepackage{amsmath}
\newcommand\Item[1][]{%
  \ifx\relax#1\relax  \item \else \item[#1] \fi
  \abovedisplayskip=0pt\abovedisplayshortskip=0pt~\vspace*{-\baselineskip}}
\begin{document}

\begin{enumerate}    
\item foo
\Item  
    \begin{align*}  
      eqn 1  \\
      eqn 2  
    \end{align*}  
\Item[a)]  
    \begin{align*}  
      eqn 1  \\
      eqn 2  
    \end{align*}  
\item bar
\end{enumerate}

\end{document}

enter image description here

6
  • This doesn't work for customized item like \Item[<mylabel>]. is it possible fix it?
    – skpblack
    Commented Jul 29, 2014 at 5:18
  • 1
    see myedited answer
    – user2478
    Commented Jul 29, 2014 at 6:14
  • @Herbert great job .....
    – juanuni
    Commented May 24, 2015 at 6:08
  • See also tex.stackexchange.com/questions/287081/… Commented Jan 15, 2016 at 16:55
  • 1
    This affects all equation environments in the Item, not just the first. Is there any way to only remove the top margin on the first equation? Commented Apr 5, 2021 at 16:50
18

It is my personal taste, you might not agree with me. Here is my rule of thumb.

  1. We know that the first line of all items of "list" (enumerate, itemize, etc) are left aligned.
  2. So if the item starts with a multi-line aligned equation, use aligned environment (plus t passed to its optional argument) rather than align*. See my the second item in my example below. Using align* makes the equations centered so it breaks the nature of "list".
  3. But if the item starts with a sentence, use align* environment. See my third item in the given example below. Using align* does not break the nature of "list".

Does it make sense?

\documentclass[preview,border=12pt,12pt]{standalone}% change it back to your own document class
\usepackage{amsmath}

\begin{document}
\begin{enumerate}
% number 1
\item $E\neq mc^2$ is the correct formula.
% number 2
\item
$
\!
\begin{aligned}[t]
 (a+b)^2 
    &= (a+b)(a+b) && \text{by definition} \\
    &= a^2 +ab +ab +b^2 && \text{using FOIL steps}\\
    &= a^2 +2ab +b^2 && \text{simplified}
\end{aligned}
$ 
% number 3
\item Consider the following equations,
\begin{align*}
    \vec \nabla \cdot \vec{B} &= 0\\
    \vec \nabla \times \vec{E} &= -\frac{\partial \vec{B}}{\partial t}
\end{align*}
% number
\item $y=mx+c$ is a street line.
\end{enumerate}
\end{document}

enter image description here

2
  • 1
    I use align* because it is possible break the alignment across the pages (with \allowdisplaybreaks) unlike aligned that produces unbreakable boxes.
    – skpblack
    Commented Jul 29, 2014 at 11:15
  • 4
    Why do you put the \! ?
    – Mathy
    Commented Mar 3, 2021 at 19:26

You must log in to answer this question.

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