我想在使用包製作縮寫列表時使用偽造的小型大寫字母glossaries
。我使用的是另一種字體,但出於可重複性的目的,在本示例中我使用了Linux Libertine O
.為了讓事情更清楚,我還在這個例子中誇大了比例因子。由於某種原因,有時我的\smallCaps
命令似乎工作正常,但在這種情況下它不會再返回。我究竟做錯了什麼?
\documentclass{memoir}
\usepackage{glossaries}
\usepackage{fontspec}
\newcommand{\smallCaps}[1]{%
{\fontspec[Scale=0.5]{Linux Libertine O} #1}%
}
\setacronymstyle{long-short}
\begin{document}
%ABBREVIATIONS
\newacronym{ADR}{\smallCaps{ADR}}{adverse drug reaction}
\setmainfont{Linux Libertine O}
Works \smallCaps{FOO} does not work: \gls{ADR}). A more specific definition
for the term \gls{ADR} is
\end{document}
答案1
你不應該\fontspec
在文件內部使用;它是用戶級別命令使用的通用命令\setmainfont
,\newfontfamily
等等。也\setmainfont
只能在序言中使用。
我刪除了\setmainfont
聲明只是為了展示如何獨立於主字體選擇字體。關鍵是要使用short
中的密鑰\newacronym
。
\documentclass{memoir}
\usepackage{glossaries}
\usepackage{fontspec}
\newcommand{\smallCaps}[1]{%
{\fontspec[Scale=0.5]{Linux Libertine O} #1}%
}
\setacronymstyle{long-short}
\begin{document}
%ABBREVIATIONS
\newacronym{ADR}{\smallCaps{ADR}}{adverse drug reaction}
\setmainfont{Linux Libertine O}
Works \smallCaps{FOO} does not work: \gls{ADR}). A more specific definition
for the term \gls{ADR} is
\end{document}
另一方面,更好的策略(假設您沒有其他方法來產生小型大寫字母)是將其添加到字體定義中:
\documentclass{memoir}
\usepackage{fontspec}
\usepackage{glossaries}
\makeglossaries
\setmainfont{Latin Modern Roman}[
SmallCapsFont={Linux Libertine O},
SmallCapsFeatures={Scale=0.5},
]
\setacronymstyle{long-short}
\begin{document}
%ABBREVIATIONS
\newacronym[
short=\textsc{ADR}
]{ADR}{ADR}{adverse drug reaction}
Works \textsc{FOO} does not work: \gls{ADR}). A more specific definition
for the term \gls{ADR} is
\printglossaries
\end{document}
最後,如果你沒有真正的小型股,最好的策略就是完全避免它們。