4

I have a list with several items consisting solely of an align environment:

\begin{enumerate}
\item
\begin{align}
e^{\pi i} + 1 &= 0\\
1 + 1 &= 2
\end{align}
\end{enumerate}

enter image description here

By default, the environment begins on the line after the numbering. Other list environments with nested environments also prepend a line break automatically:

\begin{itemize}
\item
\[e^{\pi i} + 1 = 0\]
\end{itemize}

What is the best method to start the environment on the same line as the numbering?

David Carlisle
  • 757,742
Allen Z.
  • 143
  • 3
    Take a look at http://tex.stackexchange.com/q/9394 and the linked questions there. – Philippe Goutet Feb 04 '12 at 21:35
  • Can you explain why you need the enumerate list without text but with aligned equations in each om them? I have a feeling you're looking for the wrong hammer to nail your problem. If the previous sentence doesn't make sense, can you give a real example of what the first two items in your output would look like. –  Feb 05 '12 at 01:41
  • @MarcvanDongen I purposefully kept the question general in case others have the same problem, but here: http://imgur.com/gwVj0. In this case, I'm writing "one-line" solutions to a math test, where each step is self-explanatory. It seems from Philippe's comment that I'm not the only one with this need. – Allen Z. Feb 05 '12 at 02:13

3 Answers3

3

If you don't need to number the equations (and this wouldn't make much sense anyway), then aligned is what you're looking for:

\begin{enumerate}
\item
$\begin{aligned}[t]
e^{\pi i} + 1 &= 0\\
1 + 1 &= 2
\end{aligned}$
\end{enumerate}

The environments aligned, alignedat and gathered can take an optional argument telling LaTeX what vertical alignment we want with respect to the context; it can be [t] or [b] (default is center alignment), similarly to tabular, array and minipage.

David Carlisle
  • 757,742
egreg
  • 1,121,712
  • Neat. I didn't know about the [t] option for aligned. – Ian Thompson Feb 04 '12 at 23:09
  • This is what I wanted, thanks. (http://tex.stackexchange.com/a/9640/11452 lists solutions that work with align and so allow numbering and \displaybreak, but it was too much effort in this case.) – Allen Z. Feb 05 '12 at 01:53
1

I think you do not want really to put an equation into enumerate. What you want is to put equation number on left. Here is how:

\documentclass[leqno]{article}
\begin{document}
\begin{equation}
  e^{\pi i} + 1 = 0
\end{equation}
\end{document}

enter image description here

However, if you really, really want to use enumerate, try this:

\begin{enumerate}
\item\leavevmode\par\vspace*{-25pt}%
  \[e^{\pi i} + 1 = 0\]
\end{enumerate}

enter image description here

Boris
  • 38,129
  • I think the OP wants to be able to use an align to align multiple equations, so each group would be numbered. – Peter Grill Feb 04 '12 at 20:32
  • Then he needs amsmath with leqno option. Anyway, using enumerate for numbering formulas is a bad idea: the spacing will be completely wrong. – Boris Feb 04 '12 at 20:39
  • Sorry, that is not what I want; I oversimplified my question. I have multiple groups of equations, in this case solutions to numbered math problems. I actually don't care about numbering formulas, since I rarely reference previous ones. – Allen Z. Feb 04 '12 at 21:41
  • ok, see the update – Boris Feb 04 '12 at 22:59
  • Upvoted for the nice use of \leavevmode to keep it single-line. However, this technique was simply too fragile - I had to make adjustments since it was thrown off by adjusting the font size and even by merely loading the amsmath package (?!). It can be made slightly more robust by using em instead pt. – Allen Z. Feb 05 '12 at 02:02
0

A simple method is to use an in-text equation, with \displaystyle if necessary.

\documentclass{article}
\begin{document}
\begin{itemize}
\item This item contains text.
\item \( \displaystyle \sum_{j=0}^\infty \frac{1}{j^2} = \frac{\pi^2}{6}. \)
\end{itemize}
\end{document}
Ian Thompson
  • 43,767
  • I think the OP wants to be able to use an align to align multiple equations, not just one. – Peter Grill Feb 04 '12 at 20:31
  • I took "One item in the enumerate environment consists solely of an equation environment" to imply that the other items contain text. – Ian Thompson Feb 04 '12 at 20:35
  • Sorry for being unclear - I am typing a list of solutions to a math test. Several items are multi-line and use align. There are also several one-line items, but I still prefer [...] since \displaystyle clogs up the source. – Allen Z. Feb 04 '12 at 21:18
  • *That should be \[...\]. – Allen Z. Feb 04 '12 at 21:42