Latest news 2019-11-04: The giveaway of two signed copies of “Quack, quack, quack. Give my hat back!” has closed and the winning entrants have been selected. Thank you to everyone who took part.

glossaries package FAQ

FAQ Search Tips

How do I set the font for just the long form when using \newacronym? 🔗

As from version 4.02 you can define your own custom acronym style (see How do I define my own custom acronym style?). For example, suppose you want the long form in italic followed by the short form in parentheses on first use, then you can define a new style called, say, em-long-short that's based on the long-short style:

\newacronymstyle{em-long-short}
{%
  \GlsUseAcrEntryDispStyle{long-short}%
}%
{%
  \GlsUseAcrStyleDefs{long-short}%  
  \renewcommand*{\genacrfullformat}[2]{%
   \emph{\glsentrylong{##1}}##2\space
   (\firstacronymfont{\glsentryshort{##1}})%
  }%
  \renewcommand*{\Genacrfullformat}[2]{%
   \emph{\Glsentrylong{##1}}##2\space
   (\firstacronymfont{\glsentryshort{##1}})%
  }%
  \renewcommand*{\genplacrfullformat}[2]{%
   \emph{\glsentrylongpl{##1}}##2\space
   (\firstacronymfont{\glsentryshortpl{##1}})%
  }%
  \renewcommand*{\Genplacrfullformat}[2]{%
   \emph{\Glsentrylongpl{##1}}##2\space
   (\firstacronymfont{\Glsentryshortpl{##1}})%
  }%
}
Now you can set the style:
\setacronymstyle{em-long-short}
You may prefer to move the insert part (##2) into the \emph argument:
\newacronymstyle{em-long-short}
{%
  \GlsUseAcrEntryDispStyle{long-short}%
}%
{%
  \GlsUseAcrStyleDefs{long-short}%  
  \renewcommand*{\genacrfullformat}[2]{%
   \emph{\glsentrylong{##1}##2}\space
   (\firstacronymfont{\glsentryshort{##1}})%
  }%
  \renewcommand*{\Genacrfullformat}[2]{%
   \emph{\Glsentrylong{##1}##2}\space
   (\firstacronymfont{\glsentryshort{##1}})%
  }%
  \renewcommand*{\genplacrfullformat}[2]{%
   \emph{\glsentrylongpl{##1}##2}\space
   (\firstacronymfont{\glsentryshortpl{##1}})%
  }%
  \renewcommand*{\Genplacrfullformat}[2]{%
   \emph{\Glsentrylongpl{##1}##2}\space
   (\firstacronymfont{\Glsentryshortpl{##1}})%
  }%
}

Pre version 4.02:

You can use the custom acronym format, as described in How do I define my own custom acronym style?. For example, suppose you want the long form to be emphasized using \emph, you can do the following:

\renewcommand*{\CustomAcronymFields}{%
  name={\the\glsshorttok},% name is abbreviated form
  description={\the\glslongtok},% description is long form
  first={\noexpand\emph{\the\glslongtok}\space(\the\glsshorttok)},%
  firstplural={\noexpand\emph{\the\glslongtok\noexpand\acrpluralsuffix}\space(\the\glsshorttok)},%
  text={\the\glsshorttok},%
  plural={\the\glsshorttok\noexpand\acrpluralsuffix}%
}

\SetCustomStyle
This displays long (short). You can swap, add or remove \glslongtok and \glsshorttok, as required. Remember to use \SetCustomStyle to switch to this acronym style. (If you get an error saying that \CustomAcronymFields can't be redefined as it doesn't exist or an "Undefined control sequence" error for \SetCustomStyle, then you need to update your version of glossaries.)

Note, however, that this solution doesn't work for plurals that aren't formed by simply prefixing the singular term with \acrpluralsuffix. If this causes a problem, upgrade to the latest version and use \newacronymstyle as described above.

Last modified: 2013-12-08 16:39:19.


Category: glossaries package
Topic: Referencing Terms

© 2019 Dickimaw Books. "Dickimaw", "Dickimaw Books" and the Dickimaw parrot logo are trademarks. The Dickimaw parrot was painted by Magdalene Pritchett.

Terms of Use Privacy Policy Cookies Site Map FAQs