Perhaps a missing \item?

Sometimes, the error

Something's wrong--perhaps a missing \item

actually means what it says:

\begin{itemize}
  boo!
\end{itemize}

produces the error, and is plainly in need of an \item command.

However, the error regularly appears when you would never have thought that a \item command might be appropriate. For example, the seemingly innocent:

\fbox{%
  \begin{alltt}
    boo!
  \end{alltt}%
}

produces the error (the same happens with \mbox in place of \fbox, or with either of their “big brothers”, \framebox and \makebox). This is because the alltt environment uses a “trivial” list, hidden inside their definition. (The itemize environment also has this construct inside itself, in fact, so \begin{itemize} won’t work inside an \fbox, either.) The list construct wants to happen between paragraphs, so it makes a new paragraph of its own. Inside the \fbox command, that doesn’t work, and subsequent macros convince themselves that there’s a missing \item command.

To solve this rather cryptic error, one must put the alltt inside a paragraph-style box. The following modification of the above does work:

\fbox{%
  \begin{minipage}{0.75\textwidth}
    \begin{alltt}
      hi, there!
    \end{alltt}
  \end{minipage}
}

The code above produces a box that’s far too wide for the text. One may want to use something that allows variable size boxes in place of the minipage environment.

Oddly, although the verbatim environment wouldn’t work inside a \fbox command argument (see verbatim in command arguments), you get an error that complains about \item: the environment’s internal list bites you before verbatim has even had a chance to create its own sort of chaos.

Another (seemingly) obvious use of \fbox also falls foul of this error:

\fbox{\section{Boxy section}}

This is a case where you’ve simply got to be more subtle; you should either write your own macros to replace the insides of LaTeX’s sectioning macros, or look for some alternative in the packages discussed in “The style of section headings”.

This question on the Web: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=errmissitem