1

I have a quite a big amount of descriptions in my document. At the moment all of them look in the default manner. I use it to define terms with texts or with a list of keywords. Therefore, I often use something like this:

\begin{description}
    \item[Term One] Definition for term one.
    \item[Term Two] \hfill \begin{itemize}
        \item First keyword
        \item Second keyword
    \end{itemize}
\end{description}

Now the definition of Term One stands on the same line like Term One and the First keyword starts on a new line.

My desired output would be that the definition for Term One begins on a new line and that the First keyword describing Term Two is displayed on a new line. All in all, it should look like:

Minimal example

My problem is that if I use

\usepackage{enumitem}
\setlist[description]{style=nextline}

I get a newline before the first keyword. It would be great if anybody can point out a solution where I do not have to change the code above (deleting the \hfill is ok).

2

I hope I understood your question correctly, if so, the following gives you an environment initemize which simply negates the additional one-line space given when using style=nextline:

\documentclass{article}
\usepackage{enumitem}
\setlist[description]{style=nextline}

\newenvironment{initemize}{%
  \vspace{-\baselineskip}
  \begin{itemize}%
}{%
  \end{itemize}%
}

\begin{document}
\begin{description}
  \item[Term1] Definition for term one.
  \item[Term2] \hfill
    \begin{initemize}
      \item First keyword
      \item Second keyword
    \end{initemize}
  \item[Term3] With some text and then a normal itemize.
    \begin{itemize}
      \item key1
      \item key2
    \end{itemize}
\end{description}
\end{document}

output

  • Thank you, this worked. Would it be possible to rewrite the itemize environment inside the description environment instead of creating a new one? – Nick Lehmann Aug 27 '14 at 12:50
  • if you want to avoid the new definition, you may simply replace the \hfill in your example with \hfill\vspace{-\baselineskip}. – greyshade Aug 27 '14 at 13:02
2

to start a new list within a description (or other list) environment, all that's required is to put something invisible on the description line before the subsidiary itemize. \leavevmode is used for this purpose in quite a few list environments.

to start the text of a description on a new line, something invisible must be placed on the first line. then the line can be broken after the label by either a paragraph break or a double backslash; the vertical spacing will be different in the two cases, so such list entries should be input uniformly.

\documentclass{article}

\begin{document}

Some introductory text.\\
Force it to be more than one line long.
\begin{description}
    \item[Term1]~

     Definition for term one.
    \item[Term2] \leavevmode
      \begin{itemize}
        \item First keyword
        \item Second keyword
      \end{itemize}
      Some text at the end of the definition.
    \item[Term3]~\\ Definition for term three.
\end{description}
Some text following the list of terms.

Another paragraph.

\end{document}

output of example code

  • The solution works great for placing new itemize environment under a keyword. But now the normal keywords are not placed under the terms the should explain. – Nick Lehmann Aug 30 '14 at 9:32
  • @NickLehmann - i'm not sure what you mean. your question doesn't show an example of that. i'll extend this example to show some text after the itemized list for term 2, then another term with definition. if that doesn't cover the situation you refer to, then a more detailed explanation is needed. – barbara beeton Aug 30 '14 at 12:34
  • Sorry for being so unprecise. I updated the question and included a minimal example showing the desired output. – Nick Lehmann Aug 30 '14 at 12:44
  • Tilde! A great solution (for my similar but less involved need). So simple and unobtrusive. – Mars Nov 8 '17 at 19:55

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.