用語集とフォントスペックを使用した偽の小文字大文字

用語集とフォントスペックを使用した偽の小文字大文字

パッケージを使用して略語のリストを作成するときに、偽の小文字大文字を使用したいと思います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}

最後に、本当に小型株を持っていない場合の最善の戦略は、小型株を完全に避けることです。

関連情報