0

This is less a question and more of a tip/trick and an appeal for a more robust solution.

In my business we use lots, I mean lots, of acronyms. Eventually we came to our senses and started using the acronym tools of the glossaries package. Well, as great as this is, it needed one final addition to be really sanity-saving. Turn all glossary calls from \gls(someitem) into a compact command e.g. \someitem. Now we've done this through a hack of sorts:

\newcommand{\myacro}[3]{\newacronym{#1}{#2}{#3}\expandafter\newcommand\csname #1\endcsname{\gls{#1}\xspace}} 

We then have a separate 'Acronym.tex' file filled with calls like:

\myacro{lidar}{LIDAR}{Light Detection and Ranging}

In the body of the document we would use it like \gls(): "A common sensor used in driverless cars is \lidar."

This works well enough within its limits (we have another command for plurals and we have to tiptoe around other commands to prevent clashes, of course), but seems to work transparently within the general glossaries package. So much for the tip.

The appeal is for a way to get this kind of functionality (a command for an acronym) but using an acronym database managed by bib2gls. Does anyone have a slick way of making this possible?

  • 1
    Defining macros like this for acronyms is not a good idea. As you wrote if you have lots of such acronyms you will soon get in conflict with other packages; after all the number of short, good macro names is finite. And it makes the source less readable: it is then not so clear which command is an acronym. Also you have to use xspace to get the spacing more or less right and this has drawbacks https://tex.stackexchange.com/a/86620/2388. It is much better to get used to type \gls, you can then even setup your editor so that it pops up lists of keys, like you get if you use \cite. – Ulrike Fischer Nov 28 '20 at 09:40
  • I agree, and we certainly worried about this initially, but, after two or so years of use, clashes seem to be pretty rare and are easily resolved (e.g., \emag for Electro-magnetic rather than \em). In fact this is one reason I'm interested in something along the lines of bib2gls and a central acronym db -- only the acronyms you need would be pulled into the final document and maybe lowering the risk of command clash. As precarious as this approach may seem, it has increased adoption of the glossaries package here. – LaTeXFan Nov 28 '20 at 20:30

0 Answers0