3

I want to define a personalized description environment, which adds a boldface and brackets around the label name, so I'm using enumitem:

\newlist{named}{description}{1}
\setlist[named]{label=\textbf{(??)}}

What shall I put instead of ?? to access the optional argument passed to \item from the list?

To be as clear as possible, this is what I currently write:

\begin{description}
    \item[\textbf{(Hello)}] lorem ipsum...
\end{description}

and this is what I want to write (to accomplish the same result but to save some keystrokes):

\begin{named}
    \item[Hello] lorem ipsum...
\end{named}
4

You'll need a helper macro. The manual says that the commands in the font key can end with a macro taking one argument, which will be the item text.

\documentclass{memoir}
\usepackage{enumitem}
\newcommand\parens[1]{(#1)}
\setlist[description]{
  font=\bfseries\sffamily\parens,
}
\begin{document}

\begin{description}
\item[hello] 
\end{description}

\end{document}

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.