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?

richtera
  • 1,521

2 Answers2

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

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