仅对 \gls 加粗,对 \glsdesc 不加粗

仅对 \gls 加粗,对 \glsdesc 不加粗

我怎样才能将\gls词汇表条目设置为粗体,但不将\glsdesc定义设置为粗体?

% arara: pdflatex
% arara: makeglossaries
% arara: pdflatex

\documentclass{article}

\usepackage[colorlinks=true]{hyperref}
\usepackage[acronym,toc,style=listgroup]{glossaries}
\makeglossaries

\newglossaryentry{apc} {
    name = {antigen presenting cell},
    description = {cells that present MHC proteins on their surface},
}

% glossary definitions as bold
\renewcommand*{\glstextformat}[1]{\textcolor{black}{\textbf{#1}}}


\begin{document}

\Glspl{apc} are \glsdesc*{apc}.

\printglossary

\end{document}

(请注意,这与以下问题相关,但并不完全相同:使用长样式时如何以粗体显示词汇表条目名称?

答案1

在你的序言中添加这一行:

\defglsentryfmt{\color{black}\bfseries\glsgenentryfmt}

并删除

\renewcommand*{\glstextformat}[1]{\textcolor{black}{\textbf{#1}}}

梅威瑟:

% arara: pdflatex
% arara: makeglossaries
% arara: pdflatex

\documentclass{article}

\usepackage[colorlinks=true]{hyperref}
\usepackage[acronym,toc,style=listgroup]{glossaries}
\makeglossaries

\newglossaryentry{apc} {
    name = {antigen presenting cell},
    description = {cells that present MHC proteins on their surface},
}

% glossary definitions as bold
\defglsentryfmt{\color{black}\bfseries\glsgenentryfmt}

\begin{document}

\Glspl{apc} are \glsdesc*{apc}.

\printglossary

\end{document} 

输出:

在此处输入图片描述

相关内容