0

I have observed that a \begin{enumerate} before the first appearance of an e.g. \section{...} environment causes problems. Why do I need to move \begin{enumerate} right before the first \item?

Overall, there is some sort of conflict between the first appearance of \begin{enumerate} and the first appearance of \section{...}. Is there a rule of thumb I missed about Latex or Latex2e?

cgnieder
  • 66,645
  • 1
    related http://tex.stackexchange.com/questions/237551/indent-text-without-using-trivlist – touhami Sep 11 '15 at 15:51
  • 7
    Your question is not very clear. But \section should never be inside an enumerate environment, if that is what you mean? Since a list environment should only be a list of \item then naturally \begin{enumerate} has to be before the first \item – David Carlisle Sep 11 '15 at 16:08
  • \section is no environment –  Sep 11 '15 at 17:49

1 Answers1

2

Your question is very unclear but I suspect that you want an enumerated list in each section which starts from where the previous section's list left off, something like

enter image description here

\documentclass{article}

\usepackage{enumitem}

\begin{document}

\section{Zzzzz}
\begin{enumerate}
\item aaa
\item bbb
\end{enumerate}

\section{Zzzzzz}
\begin{enumerate}[resume]
\item aaaa
\item bbbb
\end{enumerate}

\section{Zzzzzzz}
\begin{enumerate}[resume]
\item aaaaa
\item bbbbb
\end{enumerate}

\end{document}

A list such as enumerate is a list of items, each prefixed by \item so you can't have a section heading in a list, and naturally the first command after \begin{enumerate} has to be \item.

I used the enumitem package here to simplify starting the lists at numbers other than 1, via its resume option.

David Carlisle
  • 757,742