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?


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:


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.


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


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.