OthersAcro package: Handling possessive case (apostrophe s)

Information and discussion about other TeX distributions not listed above; installation, administration; field reports
Post Reply
JustA_LaTeXusr
Posts: 42
Joined: Tue Jul 23, 2013 6:48 pm

Acro package: Handling possessive case (apostrophe s)

Post by JustA_LaTeXusr »

The current v1.5 acro package (http://bitbucket.org/cgnieder/acro/wiki/Home, not the same as the also-popular acronym package) does not have an acronym invocation that automatically takes care of the possessive case, i.e., when the noun for which the acronym is followed immediately by an apostrophe "s". Some web search reveals some material that might be adaptable to handle the case, e.g., http://hstuart.dk/2007/08/03/programmin ... g-commands, but adapting it to the acro package will require much more knowledge of tex programming under-the-hood than I currently have. I realize that the knowledge can be acquired, but unfortunately, I have to make choices based on my timelines as well. This means rewording an otherwise efficiently constructed sentence to avoid apostrophe "s".

Would this be trivial for someone to adapt for the acro package?

This has been posted to:
http://latex-community.org/forum/viewto ... 15&t=24989
http://tex.stackexchange.com/questions/ ... ostrophe-s

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Acro package: Handling possessive case (apostrophe s)

Post by cgnieder »

Here's my answer on TeX.se:
Since v2.0 acro has a concept of endings. It handles the plural forms this way and allows the definition of additional endings:

Code: Select all

\ProvideAcroEnding{possessive}{'s}{'s}
This defines a lower level command \acro_possessive: which can be used to define new acro commands and defines a number of options to set the endings individually for certain acronyms.

Here is a complete example that also shows how to define suitable commands for acro.

Code: Select all

\documentclass{article}
\usepackage{acro}
    
\ProvideAcroEnding {possessive} {'s} {'s}
    
\ExplSyntaxOn
\NewAcroCommand \acg
  {
    \acro_possessive:
    \acro_use:n {#1}
  }
\NewAcroCommand \acsg
  {
    \acro_possessive:
    \acro_short:n {#1}
  }
\NewAcroCommand \aclg
  {
    \acro_possessive:
    \acro_long:n {#1}
  }
\ExplSyntaxOff
    
\DeclareAcronym{MP}{
  short            = MP ,
  long             = Member of Parliament ,
  long-plural-form = Members of Parliament ,
  long-possessive-form = Member's of Parliament
}
    
\DeclareAcronym{cd}{
  short = CD ,
  long  = compact disc
}
      
\begin{document}
    
first: \acg{cd}; \acg{MP}
    
short: \acsg{cd}; \acsg{MP}
    
long: \aclg{cd}; \aclg{MP}
    
\end{document}
Note that several endings can't really be applied to an acronym. If we were to define

Code: Select all

\NewAcroCommand \acpg
  {
    \acro_possessive:
    \acro_plural:
    \acro_use:n {#1}
  }
we'd get CDs's
site moderator & package author
Post Reply