8

I have an itemize inside a description, like this:

\documentclass[]{article}
\usepackage[vmargin=1in,hmargin=1in]{geometry}
\usepackage{enumitem}
\setlist[description]{style=nextline}

\begin{document}

\begin{description}
  \item[Definition 1]
  \begin{itemize}
    \item One
    \item Two
    \item Three
  \end{itemize}
  \item[Definition 2]
  \begin{itemize}
    \item Four
    \item Five
  \end{itemize}
\end{description}

\end{document}

However, despite the style=newline (which works for normal text in a description item), the first item of the itemize is on the same line as the definition:

Example rendering

How can I force the itemize to begin on a new line?

Ideally, I am looking for a solution I can put in an options.sty rather than an in-line solution involving mboxes etc. (the actual latex causing me a problem is being generated from reStructuredText via pandoc, however the snippet above reproduces the problem).

  • Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – yo' Jul 21 '14 at 10:32
  • 1
    Apologies - first post! I have updated my snippet to include everything that I have in my test document - I hope it is sufficient. – mkjpryor Jul 21 '14 at 10:38
6

You could try some variation on the following:

\documentclass[]{article}
\usepackage[vmargin=1in,hmargin=1in]{geometry}
\usepackage{enumitem}
\setlist[itemize]{topsep=0pt,before=\leavevmode\vspace{-1.5em}}
\setlist[description]{style=nextline}
\begin{document}

\begin{description}
  \item[Definition 1]
  \begin{itemize}
    \item One
    \item Two
    \item Three
  \end{itemize}
  \item[Definition 2]
  \begin{itemize}
    \item Four
    \item Five
  \end{itemize}
  \item[Definition 3]
  This is a normal description.
\end{description}
\end{document}

This important bit is the \setlist[itemize]{...}. This gives:

enter image description here

  • This works really well for the nested lists. However, it doesn't play nice with \setlist[description]{style=nextline} which I am using for definition lists with 'normal' text - it results in large gaps between the definition and the first list item. – mkjpryor Jul 21 '14 at 15:10
  • @mkjpryor This was why I removed the \setlist[description]{style=nextline}:) I've modified the example above so that it now uses the vspace as suggested by Harish Kumar in the comments. – Andrew Jul 21 '14 at 21:40
5

Very easy. Start itemize with a empty item. Like this \item[]. This works well with \setlist[description]{style=nextline} (and enumerate) and if you want to align with description you can add \setlist[itemize,enumerate]{leftmargin=*}.

Further, if you want lists with the normal separation of the text should use the settings \setlist[itemize,enumerate]{itemsep=0pt,parsep=0pt} Here the complete code:

\documentclass[]{article}
\usepackage[vmargin=1in,hmargin=1in]{geometry}
\usepackage{enumitem}
\setlist[description]{style=nextline}
\setlist[itemize,enumerate]{leftmargin=*,itemsep=0pt,parsep=0pt}

\begin{document}

\begin{description}
  \item[Definition 1]
  \begin{itemize}
    \item[]
    \item One
    \item Two
    \item Three
  \end{itemize}
  \item[Definition 2]
  \begin{itemize}
    \item[] 
    \item Four
    \item Five
  \end{itemize}
  \item[Definition 3] This is a specification for \ldots
  \item[Definition 4]
    \begin{enumerate}
      \item[] 
      \item Six
      \item Seven
    \end{enumerate}
\end{description}

\end{document}

And the result

enter image description here

  • In my document, this still puts a dot on the same line as the definition where it thinks the first (empty) list item is. Am I missing something? – mkjpryor Jul 21 '14 at 12:26
  • 1
    Check to see if you forgot the square brackets [] after of \item. Put \item[] is very important. This also works for enumerate. – skpblack Jul 21 '14 at 16:03
  • And you don't need modify your specifications with \setlist[...]{...}. – skpblack Jul 21 '14 at 16:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.