我想知道如何让词汇表包首字母缩略词列表中的特定条目以小写字母显示。我发现其他帖子中有人问过如何让所有条目都变成小写字母,但没有问过如何让某个特定条目变成小写字母。我尝试了以下操作:
\documentclass[12pt,a4paper]{report}
\usepackage[T1]{fontenc}
\usepackage[acronym,sort=use,toc,nopostdot]{glossaries}
\newacronym{ac}{ac}{Alternating Current}
\newacronym{mosfet}{{\sc mosfet}}{Metal Oxide Semiconductor Field Effect Transistor}
\makeglossaries
\begin{document}
\printglossary[type=\acronymtype,title=Abbreviations]
\gls{mosfet} is supposed to be written in small caps but \gls{ac} is not.
\end{document}
我遇到的问题是,所有其他条目都是粗体,而那个小写字母的条目不是粗体。所以缩写列表看起来相当丑陋。这里有人知道解决这个问题的简单方法吗?
答案1
该命令\sc
已过时;它不仅会切换到小写字母,还会关闭其他字体功能(如粗体)。请使用\scshape
。(或者,您可以使用\textsc{<text in small caps>}
并取消附加组。)
答案2
您至少需要 4.02 版本才能执行以下操作:
\documentclass[12pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[acronym,sort=use,toc,nopostdot]{glossaries}
\glssetnoexpandfield{useri}
\newacronymstyle{long-alt-short}
{%
\ifdefempty\glscustomtext
{%
\ifglsused\glslabel
{%
\glsifplural
{%
\glscapscase
{%
{\glsentryuseri{\glslabel}\glsentryshortpl{\glslabel}}\glsinsert
}%
{%
{\glsentryuseri{\glslabel}\Glsentryshortpl{\glslabel}}\glsinsert
}%
{%
\mfirstucMakeUppercase
{{\glsentryuseri{\glslabel}\glsentryshortpl{\glslabel}}\glsinsert}%
}%
}%
{%
\glscapscase
{%
{\glsentryuseri{\glslabel}\glsentryshort{\glslabel}}\glsinsert
}%
{%
{\glsentryuseri{\glslabel}\Glsentryshort{\glslabel}}\glsinsert
}%
{%
\mfirstucMakeUppercase
{{\glsentryuseri{\glslabel}\glsentryshort{\glslabel}}\glsinsert}%
}%
}%
}%
{%
\glsifplural
{%
\glscapscase
{%
\genplacrfullformat{\glslabel}{\glsinsert}%
}%
{%
\Genplacrfullformat{\glslabel}{\glsinsert}%
}%
{%
\mfirstucMakeUppercase
{\genplacrfullformat{\glslabel}{\glsinsert}}%
}%
}%
{%
\glscapscase
{%
\genacrfullformat{\glslabel}{\glsinsert}%
}%
{%
\Genacrfullformat{\glslabel}{\glsinsert}%
}%
{%
\mfirstucMakeUppercase
{\genacrfullformat{\glslabel}{\glsinsert}}%
}%
}%
}%
}%
{%
\glscustomtext
}%
}%
{%
\GlsUseAcrStyleDefs{long-short}%
\renewcommand*{\acrpluralsuffix}{\glstextup{\glspluralsuffix}}%
\renewcommand*{\genacrfullformat}[2]{%
\glsentrylong{##1}##2\space
({\glsentryuseri{##1}\glsentryshort{##1}})%
}%
\renewcommand*{\Genacrfullformat}[2]{%
\Glsentrylong{##1}##2\space
({\glsentryuseri{##1}\glsentryshort{##1}})%
}%
\renewcommand*{\genplacrfullformat}[2]{%
\glsentrylongpl{##1}##2\space
({\glsentryuseri{##1}\glsentryshortpl{##1}})%
}%
\renewcommand*{\Genplacrfullformat}[2]{%
\Glsentrylongpl{##1}##2\space
({\glsentryuseri{##1}\glsentryshortpl{##1}})%
}%
\renewcommand*{\acronymentry}[1]{%
{\glsentryuseri{##1}\glsentryshort{##1}}}%
}
\setacronymstyle{long-alt-short}
\newacronym{ac}{ac}{Alternating Current}
\newacronym[user1=\scshape]{mosfet}{mosfet}{Metal Oxide Semiconductor Field Effect Transistor}
\makeglossaries
\begin{document}
\printglossary[type=\acronymtype,title=Abbreviations]
\gls{mosfet} is supposed to be written in small caps but \gls{ac} is not.
Next use:
\gls{mosfet} is supposed to be written in small caps but \gls{ac} is not.
\end{document}
这会将字体声明存储在user1
键中。如果尚未设置此键(与条目一样ac
),则不会执行任何字体更改。正如@lockstep 指出的\sc
那样,它已过时,因此我已将其替换为\scshape
。生成的文档如下所示: