# Changing order of long and short term in only some acronyms using glossaries?

In my glossary list, I have some terms that I want to be printed "long (short)" on first use, and others that I want to be printed "short (long)" on first use.

First I tried to customize the first key of the latter entries, but I can't get it to work as intended and it quickly goes out of hand as the number of entries increases. Then I thought about defining a new glossary, with its own style, but I don't understand how to do that from the manual as I still want those terms to appear in the index as all other terms.

I've provided a MWE below:

\documentclass{article}

\usepackage{glossaries}
\usepackage{glossaries-extra}
\makeglossaries

\setabbreviationstyle[acronym]{short-long}

\newacronym{abc}{ABC}{long term}
\newacronym{def}{DEF}{another long term}

\begin{document}
\gls{abc}'' should appear as short (long)'', whereas \gls{def}'' should
appear as long (short)''.

\printglossary{}

\end{document}

• Editors will hate what you are trying to accomplish. Consistency!!! Sep 22, 2017 at 14:07
• @StevenB.Segletes: I simplified the problem and from the way my question was formulated, this would indeed appear to be a terrible idea. In reality, I have two sets of terms: one contains acronyms of standard terms which are expected to be known by the reader; and the other are abbreviations of terms introduced in the text, where the long term is a new definition and the short term is an abbreviation of that definition. When recognizing this, I ended up doing pretty much what Nicola Talbot wrote in her answer. Sep 22, 2017 at 15:14

The simplest method is to use \newacronym for the short (long) forms and \newabbreviation for long (short) forms:

\documentclass{article}

\usepackage{glossaries-extra}

\makeglossaries

\setabbreviationstyle[acronym]{short-long}
\setabbreviationstyle{long-short}

\newacronym{abc}{ABC}{long term}
\newabbreviation{def}{DEF}{another long term}

\begin{document}
\gls{abc}'' should appear as short (long)'', whereas
\gls{def}'' should
appear as long (short)''.

\printglossary

\end{document}


This essentially comes down to \newabbreviation setting category=abbreviation and \newacronym setting category=acronym. You can choose other category labels if you prefer. For example:

\setabbreviationstyle[foo]{short-long}
\setabbreviationstyle[bar]{long-short}

\newabbreviation[category=foo]{abc}{ABC}{long term}
\newabbreviation[category=bar]{def}{DEF}{another long term}


Tip 1: if you're using glossaries-extra avoid explicitly loading glossaries first if possible (otherwise you'll need to split up the glossaries.sty and glossaries-extra.sty package options).

Tip 2: consider @Steven's comment.

• This is pretty much what I ended up doing (using acronyms and abbreviations). Sep 22, 2017 at 15:09