对于我目前的论文,我想重用我以前写过的另一篇文章的代码。代码如下:
% glossareintraege fett schreiben
\renewcommand*{\glstextformat}[1]{\textbf{#1}}
% abkuerzungen normal schreiben
\renewcommand*{\acronymfont}[1]{\mdseries #1}
\renewcommand*{\CustomAcronymFields}{%
name={\noexpand\acronymfont{\the\glsshorttok}},%
sort={\the\glsshorttok},%
symbol={\the\glsshorttok},%
text={\noexpand\acronymfont{\the\glsshorttok}},%
first={\textmd{\the\glslongtok}},%
firstplural={\textmd{\the\glslongtok\noexpand\acrpluralsuffix}},%
plural={\noexpand\acronymfont{\the\glsshorttok}\noexpand\acrpluralsuffix},%
description={\the\glslongtok}
}
\renewcommand*{\SetCustomDisplayStyle}[1]{%
\defglsdisplayfirst[#1]{##1##4\space (\acronymfont{\glsentryshort{\glslabel}})}
\defglsdisplay[#1]{##1##4}%
}
%
\SetCustomStyle
%
\makeglossaries
关于此的问题是,我收到两个警告,因为 defglsentryfmt 和 defglsdisplay 已被弃用。
我该如何解决这个问题?谢谢!
答案1
据我所知,我认为这可以满足您的要求:
\documentclass{report}
\usepackage[colorlinks]{hyperref}
\usepackage[acronym]{glossaries}
\makeglossaries
\renewcommand*{\glstextformat}[1]{\textbf{#1}}
\makeglossaries
\newacronymstyle{md-long-short}%
{%
\ifglshaslong{\glslabel}{\textmd{\glsgenacfmt}}{\glsgenentryfmt}%
}%
{%
\GlsUseAcrStyleDefs{long-short}%
\renewcommand{\acronymfont}[1]{\textmd{##1}}%
}
\setacronymstyle{md-long-short}
\newacronym{abc}{ABC}{Long Form}
\newglossaryentry{sample}{name=sample,description={an example}}
\begin{document}
\gls{sample}.
First: \gls{abc}. Next: \gls{abc}.
\printglossaries
\end{document}