TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to change the way how the acronyms in glossaries package are printed on the first occurence when defining them via \newacronym{cd}{CD}{compact disk}. Currently I'm using the following to achieve it:

  description={Basic Linear Algebra Subprograms}, 
  first={\glstext*{BLAS} (\glsdesc*{BLAS})}%

which works, but is somehow to quite optimal yet since I need to particularly set the first-item. Any other ideas?

share|improve this question
up vote 6 down vote accepted

You can use \defglsdisplayfirst to change the format applied to an acronym when it is referenced the first time:



    \glsentryshort{\glslabel} (\glsentrylong{\glslabel})#4%

\newacronym{BLAS}{BLAS}{Basic Linear Algebra Subprograms}




The \gls{BLAS} are \ldots


The resulting output is:

share|improve this answer
Please note that glsdisplayfirst has been deprecated. See page 105 in the documentation for reference. – Frederik Aalund Jan 3 '15 at 21:16

I encountered some problems with glsdisplayfirst (extra spaces after acronyms). Here is my solution using newacronymstyle (based on glossaries official sample code sam­ple-cus­tom-acronym.tex):

Latex output


%define new style:
\newacronymstyle{custom-fn}% new style name
{% Check for long form in case of a mixed glossary
{% Style definitions:
 % Redefine the commands used by \glsgenacfmt on first use:
   \glsentryshort{##1} (\glsentrylong{##1})##2%
   \Glsentryshort{##1} (\Glsentrylong{##1})##2%
   \glsentryshortpl{##1} (\glsentrylongpl{##1})##2%
   \Glsentryshortpl{##1} (\Glsentrylongpl{##1})##2%

% Now set the new acronym style (to override the default style)

% Set an appropriate glossary style:

% Now define the acronyms (must be done after setting the custom
% style)
\newacronym{blas}{BLAS}{Basic Linear Algebra Subprograms}


First occurence of \gls{blas}.

And second occurence of \gls{blas}.

share|improve this answer

If you look into section 13.3 Defining A Custom Acronym Style of the glossaries documentation, you will find what you need.

An example of this code can be found in: http://archive.cs.uu.nl/mirror/CTAN/macros/latex/contrib/glossaries/samples/sample-custom-acronym.tex.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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