# itemize in hbox – Perhaps a missing \item

When compiling the following code with pdflatex

\documentclass{scrartcl}

\begin{document}
\hbox{\begin{itemize}
\item Lorem Ipsum
\end{itemize}}
\end{document}


I get the error

! LaTeX Error: Something's wrong--perhaps a missing \item.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
...

l.5 \item L
orem Ipsum


What is the reason for this? Can this be solved such that it sets in the expected manner? I already figured out that wrapping a minipage around the itemize inside the hbox works but it depends on being able to determine the correct width of the minipage – which would be \textwidth in the MWE but not in my actual usecase.

• You can't use itemize in a \hbox, itemize needs to be able to enter vertical mode, which it can't in a horizontal box, you have to use it in a minipage or \parbox. But you could fake an itemize like appearance with a tabular rather easily. – Skillmon Jul 1 '20 at 19:25

## 1 Answer

I'm not sure what your aim is, but you can perhaps use varwidth.

\documentclass{scrartcl}
\usepackage{varwidth}

\begin{document}

\fbox{% just to show that this grows up to what's needed
\begin{varwidth}{\textwidth}
Some text
\begin{itemize}
\item Lorem Ipsum
\item Some longer lorem
\end{itemize}
\end{varwidth}%<--- just because we're in an \fbox
}

\end{document}


The \fbox around the varwidth is just to show the boundaries of the built box; varwidth builds a minipage.