7

I want to use the description environment with the actual description starting on a new line. As https://tex.stackexchange.com/a/69525/293290 suggests, I am using the enumitem package and I have set style=nextline. But it doesn't work when the description is another environment, in my case enumerate.

\documentclass{article}
\usepackage{enumitem}

\begin{document}
\begin{description}[style=nextline]
    \item[Offset]
        \begin{enumerate}
            \item First line.
            \item Second line.
            \item Third line.
        \end{enumerate}
\end{description}
\end{document}

The rendered code snipped showing bad offset.

I've tried to insert a space in between, but it made a giant space.

\documentclass{article}
\usepackage{enumitem}

\begin{document}
\begin{description}[style=nextline]
    \item[Offset]~
        \begin{enumerate}
            \item First line.
            \item Second line.
            \item Third line.
        \end{enumerate}
\end{description}
\end{document}

Example of big space.

I have searched for other solutions and I came across How can I force all text to continue to the next line when using style=nextline in description lists with enumitem?, but this also doesn't solve my problem. How can I fix this?

0

1 Answer 1

6

One way to get what you want is to simply add a small negative vertical space at the beginning of the embedded enumerate list. We can do this using the before key which can inject code before the list starts. I've also added leftmargin=* to the list parameters so that the numbering lines up with the unnumbered description items.

\documentclass{article}
\usepackage{enumitem}

\begin{document}
\begin{description}[style=nextline]
    \item[First line] This is the first line.
    \item[Second line]
        \begin{enumerate}[leftmargin=*,before*=\leavevmode\vspace{-1.5\baselineskip}]
            \item First line.
            \item Second line.
            \item Third line.
        \end{enumerate}
\end{description}
\end{document}

output of code

2
  • 1
    I believe this is the best solution. Description items which don't start with enumerate or itemize won't be affected at all which is an improvement over the other solution posted here (but both solutions work). Thanks! Commented Mar 19, 2023 at 21:28
  • @user13840624 As far as I can tell the other solution doesn't actually work.
    – Alan Munn
    Commented Mar 19, 2023 at 21:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .