0

How can I add an emdash (---) after every item label in every description environment in my document? Is there a global way to override the layout of each item?

This produces the desired effect, but I'm manually inserting the emdash after each item:

\documentclass{book}
\begin{document}
    \begin{description}
        \item[A] --- description        
        \item[B] --- description    
    \end{description}
\end{document}

Can it be done using just \item[label] description throughout my document, and only a quick override in my preamble? I found this code in book.cls:

\newenvironment{description}
               {\list{}{\labelwidth\z@ \itemindent-\leftmargin
                        \let\makelabel\descriptionlabel}}
               {\endlist}

So, I think I need to re-define \makelabel, but I'm not sure how to proceed from here. I only want to change the description environment, and not other lists.

0

You need to change the definition of \descriptionlabel.

% descriptionprob.tex  SE 572848
\documentclass{book}

\begin{document}
Regular descriptions:
\begin{description}
  \item[A] an item
  \item[B] another item
\end{description}

Revised description labels.
\renewcommand{\descriptionlabel}[1]{%
  \hspace\labelsep
  \normalfont{\bfseries #1} ---}

\begin{description}
  \item[A] an item
  \item[B] another item
\end{description}

\end{document}

enter image description here

0

you could use enumitem:

\documentclass{book}
\usepackage{enumitem}
\newcommand\mydesclabel[1]{#1\quad{\normalfont ---}}
\setlist[description,1]{format=\mydesclabel}
\begin{document}
    \begin{description}
        \item[A]  description
        \item[B]  description
    \end{description}
\end{document}

Your Answer

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