我试图在论文中混合使用小写字母和小写斜体缩写/首字母缩略词。我正在使用 glossaries-extra 并尝试创建一个新的缩写类别“acronymLC”,但是当我更改一个类别的样式时,它似乎会覆盖文本中的样式。我提供了 MWE:
\documentclass{article}
\usepackage[automake,acronym,nomain,shortcuts=other]{glossaries-extra}
\makeglossaries
\setabbreviationstyle[acronym]{short-sc-desc}
\setabbreviationstyle[acronymLC]{short-em-desc}
\renewcommand*{\glsxtrscfont}[1]{\normalfont\textsc{\MakeLowercase{#1}}}
\newcommand*{\glsxtremfont}[1]{\normalfont\textit{\normalfont #1}}
\newacronym[description={I want this to be small caps but \gls{def} should be lower case italics}]{abc}{abc}{Alpha Bravo Charlie}
\newabbreviation[category=acronymLC,description={I want this to be lower case italics but \gls{abc} should be small caps.}]{def}{def}{delta echo foxtrot}
\begin{document}
I have two acronyms \gls{abc} and \gls{def}. I would like the first to be small caps and the second to be lower case italics.
\printglossaries
\end{document}
另外,我想去掉词汇表中的粗体字体,这个问题之前已经回答过了,但我认为我在实施时犯了一个错误。
答案1
我认为这里存在一些问题。第一个可能是样式中的错误short-sc-desc
,可以通过以下方法修复:
\renewabbreviationstyle{short-sc-desc}
{%
\renewcommand*{\CustomAbbreviationFields}{%
name={\protect\glsxtrinlinefullformat{\the\glslabeltok}{}},
sort={\the\glsshorttok},
first={\protect\glsxtrfirstscfont{\the\glsshorttok}},
firstplural={\protect\glsxtrfirstscfont{\the\glsshortpltok}},
text={\protect\glsxtrscfont{\the\glsshorttok}},
plural={\protect\glsxtrscfont{\the\glsshortpltok}},
description={\the\glslongtok}}%
\renewcommand*{\GlsXtrPostNewAbbreviation}{%
\glssetattribute{\the\glslabeltok}{regular}{true}}%
}
{%
\GlsXtrUseAbbrStyleFmts{short-desc}%
\renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrscsuffix}%
\renewcommand*\glsabbrvfont[1]{\glsxtrscfont{##1}}%
\renewcommand*\glsfirstabbrvfont[1]{\glsxtrfirstscfont{##1}}%
}
没有\glsxtremfont
提供命令,glossaries-extra
所以你的定义
\newcommand*{\glsxtremfont}[1]{\normalfont\textit{\normalfont #1}}
未使用。(我的错在于没有使用更一致的命名方案。我认为这是因为em
后来添加了样式,而没有将其与sc
和样式进行比较。)它还抵消了withsm
的效果。我想你可能打算:\textit
\normalfont
\renewcommand*{\glsabbrvemfont}[1]{\normalfont\textit{#1}}
另一个问题与描述中的有关\gls
。我不确定为什么会出现在这里。这不完全是嵌套链接但似乎表现出了相同的行为。可以通过更改\gls
为\glsps
(短格式)或(文本格式)来修复此问题。对于这种特定样式,和\glspt
之间没有真正的区别。\glsps
\glspt
以下是完整的示例:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[automake,acronym,nomain,shortcuts=other]{glossaries-extra}
\makeglossaries
\renewabbreviationstyle{short-sc-desc}
{%
\renewcommand*{\CustomAbbreviationFields}{%
name={\protect\glsxtrinlinefullformat{\the\glslabeltok}{}},
sort={\the\glsshorttok},
first={\protect\glsxtrfirstscfont{\the\glsshorttok}},
firstplural={\protect\glsxtrfirstscfont{\the\glsshortpltok}},
text={\protect\glsxtrscfont{\the\glsshorttok}},
plural={\protect\glsxtrscfont{\the\glsshortpltok}},
description={\the\glslongtok}}%
\renewcommand*{\GlsXtrPostNewAbbreviation}{%
\glssetattribute{\the\glslabeltok}{regular}{true}}%
}
{%
\GlsXtrUseAbbrStyleFmts{short-desc}%
\renewcommand*{\abbrvpluralsuffix}{\protect\glsxtrscsuffix}%
\renewcommand*\glsabbrvfont[1]{\glsxtrscfont{##1}}%
\renewcommand*\glsfirstabbrvfont[1]{\glsxtrfirstscfont{##1}}%
}
\renewcommand*{\glsxtrscfont}[1]{\normalfont\textsc{\MakeLowercase{#1}}}
\renewcommand*{\glsabbrvemfont}[1]{\normalfont\textit{#1}}
\setabbreviationstyle[acronym]{short-sc-desc}
\setabbreviationstyle[acronymLC]{short-em-desc}
\newacronym[description={I want this to be small caps but \glsps{def}
should be lower case italics}]{abc}{abc}{Alpha Bravo Charlie}
\newabbreviation[category=acronymLC,description={I want this to be
lower case italics but \glsps{abc} should be small
caps.}]{def}{def}{delta echo foxtrot}
\begin{document}
I have two acronyms \gls{abc} and \gls{def}. I would like the first
to be small caps and the second to be lower case italics.
\printglossaries
\end{document}
得出的结果为: