I'm writing a document where I have to use terms and abbreviations defined in a glossary a lot. I don't want to type \gls{HPC} each time I use the abbreviation HPC. It litters the code with more trash longer than the abbreviation I'm using and I might miss an occurrence of the abbreviation.

Is there a way to tell LaTeX to just always replace HPC with \gls{HPC} and HPCs with \glspl{HPC}? (To indicate the potential problematic that one term to be replaced can be a substring of a different one. It can be assumed, though, that no glossary element occurs as a substring of any term that is not a glossary element.)

I know that I can improve upon the situation by defining


but that still contains a backslash. Is this the best one can do without awfully much hacking?


I don't recommend it, but you can use \oldacronym instead of \newacronym. Instead of:

\newacronym{HPC}{HPC}{H-whatever P-whatever C-whatever}


\oldacronym{HPC}{H-whatever P-whatever C-whatever}{}

This creates the command \HPC. If the short form contains non-alphabetic content you need to use the optional argument:

\oldacronym[HiiPC]{H2PC}{H-whatever2 P-whatever C-whatever}{}

This creates the command \HiiPC.

The final argument is the key=value list that's supplied as the optional argument to \newacronym.

If you load the xspace package, \xspace is appended to the definition, but be careful of the various pitfalls. See Table 13.2 in the glossaries user manual.

The reason this command is called \oldacronym is because it's designed to emulate the style of the \newacronym command provided by the obsolete glossary package (which the glossaries package replaced). In the long run this design caused too many problems, which is why it wasn't adopted in the replacement package.

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.