
我正在使用glossaries
並希望將首字母縮略詞描述的外觀更改為字體沒有襯線。
我設法更改了縮寫名稱,但似乎也找不到更改描述的開關。
有沒有簡單的方法而無需引入自訂術語表格式?
微量元素:
\documentclass[]{report}
\usepackage[
%nomain,
nonumberlist,
acronym,
section
]
{glossaries}
\renewcommand{\glsnamefont}[1]{\textsf{#1}} %Change acronym name font
\makeglossaries
\newacronym{NVP}{NVP} {Natural Ventilation Potential}
\begin{document}
\glsaddall
\printglossaries
\sffamily for comparison, this should be without serifs.
\end{document}
答案1
\glsnamefont
僅影響條目名稱在詞彙表中的顯示方式。對於預設的首long-short
字母縮寫樣式,欄位中僅顯示縮寫形式name
。長表格放在description
欄位中。
有沒有一種簡單的方法而不必引入自訂術語表格式?
不適用於基礎glossaries
包,除非您只是將整個術語表放入無襯線字體中:
\documentclass[]{report}
\usepackage[
%nomain,
nonumberlist,
acronym,
section
]
{glossaries}
\renewcommand{\glsnamefont}[1]{\textsf{#1}} %Change acronym name font
\renewcommand{\glossarypreamble}{\begin{sffamily}}
\renewcommand{\glossarypostamble}{\end{sffamily}}
\makeglossaries
\newacronym{NVP}{NVP} {Natural Ventilation Potential}
\begin{document}
\glsaddall
\printglossaries
\sffamily for comparison, this should be without serifs.
\end{document}
由於您已經隱藏了數字列表,因此這與在無襯線字體中設定name
和沒有什麼不同。description
另一種方法(如果您不想定義新的術語表樣式)是使用glossaries-extra
擴充包。有兩種可能的選擇:
使用long-em-short-em
樣式並將字體命令從 更改\emph
為\textsf
。這會修改文件文字(如果使用\gls
)和術語表中的樣式:
\documentclass[]{report}
\usepackage[
%nomain,
nonumberlist,
acronym,
section
]
{glossaries-extra}
\makeglossaries
\setabbreviationstyle[acronym]{long-em-short-em}
\renewcommand*{\glslongemfont}[1]{\textsf{#1}}%
\renewcommand*{\glsabbrvemfont}[1]{\textsf{#1}}%
\newacronym{NVP}{NVP} {Natural Ventilation Potential}
\begin{document}
\glsaddall
\printglossaries
\sffamily for comparison, this should be without serifs.
\end{document}
或者,如果您只想修改description
術語表中的欄位(而不改變長格式在文件中的顯示方式),您可以glossdescfont
像這樣設定屬性:
\documentclass[]{report}
\usepackage[
%nomain,
nonumberlist,
acronym,
section
]
{glossaries-extra}
\makeglossaries
\glssetcategoryattribute{acronym}{glossdescfont}{textsf}
\glssetcategoryattribute{acronym}{glossnamefont}{textsf}
\setabbreviationstyle[acronym]{long-short}
\newacronym{NVP}{NVP} {Natural Ventilation Potential}
\begin{document}
\glsaddall
\printglossaries
\sffamily for comparison, this should be without serifs.
\end{document}
這裡我用過
\glssetcategoryattribute{acronym}{glossnamefont}{textsf}
代替
\renewcommand{\glsnamefont}[1]{\textsf{#1}}
這樣字體變更只會影響首字母縮寫(如果您混合使用常規術語和首字母縮寫)。