I'm setting up my list of acronyms using the glossaries package and ran into a challenge with a specific unit - FLOPS., i.e. floating point operations per second. In my document, I use FLOPS, GFLOPS and TFLOPS, where the G and T indicate 10^9 and 10^{12} respectively.

At present, I have three separate entries in my list of acronyms, but I'd prefer to have one entry for FLOPS, with a description that explains GFLOPS and TFLOPS. That way, the first time FLOPS, GFLOPS or TFLOPS appears it gets expanded, but the one that appears get printed as its acronym only. To give an example sentence, instead of this:

A trillion (10^{12}) floating point operations per second (TFLOPS) is 1000 times larger than a billion (10^9) floating point operations per second (GFLOPS).

I would like to have:

A trillion (10^{12}) floating point operations per second (TFLOPS) is 1000 times larger than a 1 GFLOPS.

I imaging this might be done with some sort of special formatting for the FLOPS glossary entry, e.g. an optional parameter to \gls that passes the exponent, but I have no idea how to achieve this.


I think I've found a solution to my problem. I was inspired by this tex.stackexchange post. Here's an MWE demonstrating the solution:



  {billion ($10^{9}$) \glsentrylong{\glslabel}}
  {trillion ($10^{12}$) \glsentrytext{\glslabel}}

    \glsentryitem{##1}\glstarget{##1}{\glossentryname{##1}} &
    \Glsentrylong{##1}\space\ifglshasfield{useri}{##1}{--- \space\Glsentryuseri{##1}\space}{}##2\tabularnewline

% This is my test case - FLOPS.
\newacronym[user1={The prefixes T and G are used to indicate $10^{12}$ and $10^9$ FLOPS}]{FLOPS}{FLOPS}{floating point operations per second}

  \ifglsused{#2}{\csname glsshort#1\endcsname{#2}}{\csname glslong#1\endcsname{#2} (\csname glsshort#1\endcsname{#2})\glsunset{#2}}%
  \ifglsused{#2}{\csname Glsshort#1\endcsname{#2}}{\csname Glslong#1\endcsname{#2} (\csname glsshort#1\endcsname{#2})\glsunset{#2}}%
  \ifglsused{#2}{\csname GLSshort#1\endcsname{#2}}{\csname GLSlong#1\endcsname{#2} (\csname GLSshort#1\endcsname{#2})\glsunset{#2}}%



$200$ \glsSI{giga}{FLOPS}. $1000$ \gls{FLOPS}. \glsSI{giga}{FLOPS} and \glsSI{tera}{FLOPS}



I went to extra effort with the \glsSI function because otherwise a new function is needed for giga, tera, mega, kilo and any others. The only thing still needed is a way to wrap the two \glsaddkey statements into a command, e.g. \SIPrefixForGlossary{giga}{G}. Any answer that adds that earns being marked as the answer.

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.