1

How to generate the following sentences with the glossaries functionality:

In operational phase 1 (OP1) we did such. In the following OP2 and OP3 we changed the settings.

The tex code would look something like:

In \gls{OP1} we did such. In the following \gls{OP2} and \gls{OP3} we changed the settings.

Of course the acronym definitions

\newacronym{OP1}{OP1}{operation phase~1}
\newacronym{OP2}{OP2}{operation phase~2}
\newacronym{OP2}{OP2}{operation phase~2}

would result in the expansion of all acronyms, whereas I need only the first phrase to expand. Is this functionality included or problematic?

Compilable example document:

\documentclass{article}
\usepackage{lmodern}
\usepackage[utf8]{inputenc}         

\usepackage[acronym, nomain, nonumberlist, toc, automake=immediate]{glossaries-extra}
\setabbreviationstyle[acronym]{long-short-user}

\makeglossaries


\newacronym{OP1}{OP1}{operation phase~1}
\newacronym{OP2}{OP2}{operation phase~2}
\newacronym{OP3}{OP3}{operation phase~3}

\begin{document}
In \gls{OP1} we did such. In the following \gls{OP2} and \gls{OP3} we changed the settings.

\printglossaries

\end{document}

1 Answers1

1

You can achieve the desired output using a combination of \glsentryshort and \glsadd as shown in the following example:

\documentclass{article}
\usepackage{lmodern}
\usepackage[utf8]{inputenc}         

\usepackage[acronym, nomain, nonumberlist, toc, automake]{glossaries-extra}
\setabbreviationstyle[acronym]{long-short-user}

\makeglossaries


\newacronym{OP1}{OP1}{operation phase~1}
\newacronym{OP2}{OP2}{operation phase~2}
\newacronym{OP3}{OP3}{operation phase~3}

\begin{document}
In \gls{OP1} we did such. In the following \glsentryshort{OP2} and \glsentryshort{OP3} we changed the settings.


\printglossaries
\glsadd{OP2}\glsadd{OP3}
\end{document}

enter image description here

leandriis
  • 62,593
  • Thank you for your answer. However, is there no better way? The way i see it, this solution defies the whole point of glossaries since you need to rearrange everything if you change the order. – Daniel Böckenhoff Jun 04 '19 at 07:07