1

I am trying to achieve essentially the same effect as asked for in this question, except that I want to redefine \item to achieve the result automatically. Specifically, I am trying to use an inline list with the enumitem package in which the items which would otherwise contain a line break are instead simply displayed on the next line. Below is a MWE.

\documentclass{article}

\usepackage[inline]{enumitem}

\begin{document}

\begin{minipage}{.3\textwidth}
\begin{enumerate*}
\item Hello world!
\item Hello again!
\end{enumerate*}
\end{minipage}

\vspace{\baselineskip}

\begin{minipage}{.3\textwidth}
\begin{enumerate*}
\item Hello world!
\item \mbox{Hello again!}
\end{enumerate*}
\end{minipage}

\vspace{\baselineskip}

\let\olditem\item
\renewcommand{\item}[1]{\olditem \mbox{#1}}
\begin{minipage}{.3\textwidth}
\begin{enumerate*}
\item Hello world!
\item Hello again!
\end{enumerate*}
\end{minipage}

\end{document}

MWE

The first result is what happens by default, the second result is a correct fix with the \mbox placed directly after \item, and the third result is my failed attempt to automate the \mbox by redefining \item.

How do I correctly automate the placement of the \mbox around every element in the list, or otherwise, how do I prevent this mid-item line breaking.

0 Answers0