Take the 2-minute tour ×
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.

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:

\newglossaryentry{BLAS}{%
  type=\acronymtype, 
  name={BLAS}, 
  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

2 Answers 2

up vote 5 down vote accepted

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

\documentclass{article}

\usepackage{glossaries}[2011/04/12]

\AtBeginDocument{%
  \defglsdisplayfirst[\acronymtype]{%
    \glsentryshort{\glslabel} (\glsentrylong{\glslabel})#4%
  }%
}

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

\makeglossaries

\begin{document}

\printglossary

\noindent
The \gls{BLAS} are \ldots

\end{document}

The resulting output is:

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

 
discard

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.