[Tex/LaTex] enumitem nextline style: nested item shouldn’t start on description label’s line

descriptionenumitemline-breakinglistsnesting

I use enumitem description style nextline to emulate a sort of TOC entry with the following code:

\documentclass{article}
\usepackage{enumitem}

\newenvironment{DLdescription}[1][*]{%
  \newcommand{\DLitem}[2][]{%
    \item[##1\hfill\emph{##2}]
  }
  \begin{description}[style=nextline,leftmargin=#1]%
}{\end{description}}

\begin{document}

  \begin{DLdescription}
  \DLitem[dleft1]{dright1}
    blah blah
    \begin{itemize}
    \item nested item correctly starts on its own line
    \end{itemize}
      \DLitem[dleft2]{dright2}
    % nothing before itemize
    \begin{itemize}
    \item nested item shouldn't start on description label's line!
    \end{itemize}
  \end{DLdescription}

\end{document}

The trouble comes on the second description item which starts straight away with an itemize: the nested item appears on the same line 🙁

output of code sample

A workaround found elsewhere suggests to append a \hfill to the relevant label, in my case that would patch command DLitem with

\item[##1\hfill\emph{##2}]\hfill

which, gives a non satisfactory results, as too much vertical space is added between the description label's line and the first nested item:

output of patched code

How to obtain the result in the second image without any extra vertical space?

Best Answer

I think you are misusing the nextline style. I would suggest that you do it like this:

\documentclass{article}
\usepackage{enumitem}

\newcommand{\DLitem}[2][]{%
 \item[#1]\hfill \emph{#2}\par}

\newenvironment{DLdescription}[1][*]
 {\begin{description}[leftmargin=#1]}
 {\end{description}}

\begin{document}

  \begin{DLdescription}
  \DLitem[dleft1]{dright1}
    blah blah
    \begin{itemize}
    \item nested item correctly starts on its own line
    \end{itemize}
      \DLitem[dleft2]{dright2}
    % nothing before itemize
    \begin{itemize}
    \item nested item shouldn't start on description label's line!
    \end{itemize}
  \end{DLdescription}

\end{document}

You can adjust locally \parskip is you want less space after the first line.