2

LaTeX's acronym packages are very, very handy. However, there is a writing requirement that it doesn't seem to get around.

First, I'd like to establish what I find useful about acronym packages, then describe how its utility may be compromised by a common use case. I use the acro package, and would like to stick with that if possible, but I suspect that most acronym packages will run into the problem.

Acronym packages allow me to use acronyms without keeping track of their first occurrences in a document, or significant section therein. The package will find the first occurrence and provide the short and long form, then use the short form thereafter.

The problem is that the long form often needs to be preceded by a definite article "the" whereas the short form does not. For example:

Bob hails from *the* Centre for Spaghetti Studies (CSS).
Bob hails from CSS.

*The* Centre for Spaghetti Studies's (CSS's) mandate is broad.
CSS's mandate is broad.

Because of this, I do have to keep track of the first occurrence, which pretty well negates the major reason for me to use any acronym package.

Is there any practice in composing LaTeX documents that can salvage the benefit of acronym packages?

Defining the long form to include "the" is not ideal. Let's say that I meant:

CSS scientists eat well.

On the first occurrence I would get:

*The* Centre for Spaghetti Studies scientists eat well.

What I really would have wanted is:

Centre for Spaghetti Studies scientists eat well.

Thanks.

  • Has anyone yet founded the “Centre for Spaghetti Studies”? 🤔 – rugk Jun 19 at 19:26
  • 1
    The organization is so secret that evidence of its existence does not exist online. It is only the subject of whispered speculation. But trust me, those who work for them are very satisfied. And a bit substantial. – user2153235 Jun 21 at 18:25
3

Provided you have an up to date acro you can define a definite article and commands that make use of it. All you then have to do is define the acronym accordingly:

\documentclass{article}
\usepackage{acro}

\DeclareAcroArticle{definite}{the}
\DeclareAcroEnding{possessive}{'s}{'s}

\NewAcroCommand\dac{m}{\acrodefinite\UseAcroTemplate{first}{#1}}
\NewAcroCommand\Dac{m}{\acroupper\acrodefinite\UseAcroTemplate{first}{#1}}

\NewAcroCommand\Dacg{m}{%
  \acroupper
  \acrodefinite
  \acropossessive
  \UseAcroTemplate{first}{#1}%
}

\DeclareAcronym{css}{
  short = CSS ,
  long = Centre for Spaghetti Studies ,
  short-definite = \nospace ,
  long-possessive = '
}

\begin{document}

Bob hails from \dac{css}. \par
Bob hails from \dac{css}.

\acreset{css}

\Dacg{css} mandate is broad. \par
\Dacg{css} mandate is broad.

\acreset{css}

\Dac{css} scientists eat well. \par
\Dac{css} scientists eat well. \par

\end{document}

enter image description here

| improve this answer | |
  • Thanks, cgnieder. I've installed LaTeX from Cygwin, and the *.log file says that I have acro version 2.11d. The above code breaks on the \DeclareAcroArticle command. I'm having trouble finding out where the package documentation resides on this installation. I realize that I can manually install packages, but I think I'm just going to leave this solution to those who already have a more recent acro package. My past experience is that I can spend days figuring the files needed for manual package installs, and the dependencies bring on another layer of complexity. I appreciate it. – user2153235 May 5 at 21:24
  • @user2153235 Both mine and Ulrike's answer use version 3 of acro which has been published at the end of April 2020 and is only available in texlive 2020 or an up to date MiKTeX – cgnieder May 5 at 21:30
  • Thanks for clarifying. I just tested Ulrike's MWE, and it fails for me as well. I will have to mull over the challenges of manual package installation. It's complicated by the fact that I have limited permissions on the machine, so it's hard to update things even if I move to MiKTeK. – user2153235 May 5 at 22:36
  • Ulrike's instructions for installing the acro package cut away all the preconceptions I had about the difficulty of manually managing packages. Both your answer and Ulrike's answer work. Thank you! – user2153235 May 5 at 23:51
4

You can define a new template:

\documentclass[a4paper,12pt]{book}
\usepackage{acro}
\DeclareAcronym{cd}{
 short = CD ,
 long = compact disc
 }

\DeclareAcronym{css}{
 short = CSS ,
 long = Centre for Spaghetti Studies
 } 
\NewAcroTemplate{long-short-the}{%
 \acroiffirstTF{%
 The
 \acrowrite{long}%
 \acspace(%
 \acroifT{foreign}{\acrowrite{foreign}, }%
 \acrowrite{short}%
 \acroifT{alt}{ \acrotranslate{or} \acrowrite{alt}}%
 \acrogroupcite
 )%
 }%
 {\acrowrite{short}}%
 } 
\begin{document}

\ac[first-style=long-short-the]{cd}, \ac{css}

\ac[first-style=long-short-the]{cd}
\end{document}

enter image description here

| improve this answer | |
  • 1
    Interesting. Lots to digest and look up there regarding the inner workings of acro. Does that mean I have to use the optional argument [first-style=long-short-the] everywhere that CD is used? – user2153235 May 5 at 21:05
  • @user2153235 Everytime you might want want the definite article, yes. I believe my suggestion in my answer is easier in the long run – cgnieder May 5 at 21:27
  • well you will have to differentiate somehow the cases where you want a "the" and where not. LaTeX can not guess that. But you don't have to type the option all the time, you could define a shorter command e.g. \newcommand\dac{\ac[first-style=long-short-the]} – Ulrike Fischer May 5 at 21:34
  • Thanks, Ulrike. I responded under cgnieder's answer about the severe limitations in my laptop. I think that my work-around is not to rely on specific package features, but to use the non-ideal inclusion of "the" in the long form of an acronym. – user2153235 May 5 at 22:38
  • I don't see much of a problem to install the new version for a test manually. It consists only of two sty: ctan.org/tex-archive/macros/latex/contrib/acro, copy them in your document folder. (it is naturally possible that it depends on other stuff, eg from expl3, but you will see ...) – Ulrike Fischer May 5 at 22:47

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.