[Tex/LaTex] Nested lists without hyphenation using sloppypar

hyphenationlists

I use XeTeX, Version 3.1415926-2.4-0.9998 (TeX Live 2012/W32TeX).

I want to create a nested list without hyphenation. I am using the sloppypar environment with hyphenation command to turn off hyphenation. This creates issues when used with a nested numbered list created using enumerate. In the MWE below, the second item in the outer list is not numbered, while the first item in the second inner list has the combined number 2(a). The nested list works fine without sloppypar as the second section below shows.

\documentclass{article}
\usepackage{ragged2e}
\usepackage{polyglossia}
\begin{document}
\section{Nested list with sloppypar}
\begin{enumerate}
\item \begin{sloppypar}\justifying\hyphenrules{nohyphenation}Blah blah blah.\end{sloppypar}
\begin{enumerate}
    \item \begin{sloppypar}\justifying\hyphenrules{nohyphenation}Blah blah blah.\end{sloppypar}
    \item \begin{sloppypar}\justifying\hyphenrules{nohyphenation}Blah blah blah.\end{sloppypar}
\end{enumerate}
\item \begin{sloppypar}\justifying\hyphenrules{nohyphenation}Blah blah blah.\end{sloppypar}
\begin{enumerate}
    \item \begin{sloppypar}\justifying\hyphenrules{nohyphenation}Blah blah blah.\end{sloppypar}
    \item \begin{sloppypar}\justifying\hyphenrules{nohyphenation}Blah blah blah.\end{sloppypar}
\end{enumerate}
\end{enumerate}

\section{Nested list without sloppypar}
\begin{enumerate}
\item Blah blah blah.
\begin{enumerate}
    \item Blah blah blah.
    \item Blah blah blah.
\end{enumerate}
\item Blah blah blah.
\begin{enumerate}
    \item Blah blah blah.
    \item Blah blah blah.
\end{enumerate}
\end{enumerate}
\end{document}

Best Answer

Just add a \par or blank line leaving the nested enumerate environment.

\documentclass{article}
\usepackage{ragged2e}
\usepackage{polyglossia}
\begin{document}
\section{Nested list with sloppypar}
\begin{enumerate}
\item \begin{sloppypar}\justifying\hyphenrules{nohyphenation}Blah blah blah.\end{sloppypar}
\begin{enumerate}
    \item \begin{sloppypar}\justifying\hyphenrules{nohyphenation}Blah blah blah.\end{sloppypar}
    \item \begin{sloppypar}\justifying\hyphenrules{nohyphenation}Blah blah blah.\end{sloppypar}
\end{enumerate}\par % <----- ADDED PAR IS HERE
\item \begin{sloppypar}\justifying\hyphenrules{nohyphenation}Blah blah blah.\end{sloppypar}
\begin{enumerate}
    \item \begin{sloppypar}\justifying\hyphenrules{nohyphenation}Blah blah blah.\end{sloppypar}
    \item \begin{sloppypar}\justifying\hyphenrules{nohyphenation}Blah blah blah.\end{sloppypar}
\end{enumerate}
\end{enumerate}

\section{Nested list without sloppypar}
\begin{enumerate}
\item Blah blah blah.
\begin{enumerate}
    \item Blah blah blah.
    \item Blah blah blah.
\end{enumerate}
\item Blah blah blah.
\begin{enumerate}
    \item Blah blah blah.
    \item Blah blah blah.
\end{enumerate}
\end{enumerate}
\end{document}

enter image description here

As I tell the OP in the comments below, I cannot give a definitive answer as to why the \par is needed. But the symptom of the original MWE gave the appearance of a misinterpreted paragraph/group issue. So it was a natural first guess, and in this case, it proved sufficient.

Alternately, the nested enumerate could be enclosed in its own group, as follows:

\documentclass{article}
\usepackage{ragged2e}
\usepackage{polyglossia}
\begin{document}
\section{Nested list with sloppypar}
\begin{enumerate}
\item \begin{sloppypar}\justifying\hyphenrules{nohyphenation}Blah blah blah.\end{sloppypar}
{\begin{enumerate}
    \item \begin{sloppypar}\justifying\hyphenrules{nohyphenation}Blah blah blah.\end{sloppypar}
    \item \begin{sloppypar}\justifying\hyphenrules{nohyphenation}Blah blah blah.\end{sloppypar}
\end{enumerate}}
\item \begin{sloppypar}\justifying\hyphenrules{nohyphenation}Blah blah blah.\end{sloppypar}
\begin{enumerate}
    \item \begin{sloppypar}\justifying\hyphenrules{nohyphenation}Blah blah blah.\end{sloppypar}
    \item \begin{sloppypar}\justifying\hyphenrules{nohyphenation}Blah blah blah.\end{sloppypar}
\end{enumerate}
\end{enumerate}
\end{document}
Related Question