2

I want to use faked small caps when doing a list of abbreviations using the glossaries package. I am using another font but for reproducibility purposes in this example I have used Linux Libertine O. To make things clearer I have also exaggerated the scaling factor in this example. For some reason it seems sometimes my \smallCaps command works fine but in this case it doesn't go back again. What am I doing wrong?

\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}

enter image description here

2

You should never use \fontspec inside the document; it's a generic command used by the user level commands \setmainfont, \newfontfamily and similar. Also \setmainfont should only be used in the preamble.

I removed the \setmainfont declaration just to show how the font is chosen independently of the main font. The key is to use the short key in \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}

enter image description here

On the other hand, a better strategy (assuming you have no other way to produce small caps) is to add it in the font definition:

\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}

Finally, the best strategy if you don't have real small caps is to avoid them altogether.

| improve this answer | |
  • Sadly it doesn't seem to play nice together with fakeslant though... :( – jonalv Feb 18 '15 at 15:59
  • @jonalv Don't fake. ;-) Above all, don't use slanted type. – egreg Feb 18 '15 at 15:59
  • I use them to mark strange commercial names on things which I want to mark somewhat in the text to make it clear that "Yes it's actually called that, don't blame me" :) – jonalv Feb 18 '15 at 16:02
  • @jonalv Please, open a new question with a detailed example. – egreg Feb 18 '15 at 16:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.