如何在宏中包装描述术语?

如何在宏中包装描述术语?

这种语法显然不起作用,但这是我想要做的要点:

\documentclass{article}
\usepackage{enumitem}

\newcommand\DoSomething[1]{Hello, #1}

\begin{document}
\begin{description}[label=\DoSomething{*}]
  \item[Duck] ([Hello, Duck] is the label.)
  \item[Duck] ([Hello, Duck] is the label.)
  \item[Goose] ([Hello, Duck] is the label.)
\end{description}
\end{document}

为了澄清起见,我想要的效果和说

\documentclass{article}
\usepackage{enumitem}

\newcommand\DoSomething[1]{Hello, #1}

\begin{document}
\begin{description}
  \item[\DoSomething{Duck}] ([Hello, Duck] is the label.)
  \item[\DoSomething{Duck}] ([Hello, Duck] is the label.)
  \item[\DoSomething{Goose}] ([Hello, Goose] is the label.)
\end{description}
\end{document}

答案1

为什么不

\documentclass{article}
\usepackage[T1]{fontenc}

\newcommand\DoSomething[1]{Hello, #1}

\begin{document}
\begin{description}
    \renewcommand*{\makelabel}[1]{\textbf{\DoSomething{#1}}}
    \item[Duck] ([Hello, Duck] is the label.)
\end{description}
\end{document}

满足您的需求?

相关内容