4

I'm writing a document in French and I have to deal with gender forms of words with the acro package. I would like to produce something like

tridimensionnelles (3D) (a feminine form) or bidimensionnel (2D) (for a masculine form)

With the code:

\documentclass[12pt,twoside,openright]{book}
\usepackage[version=3]{acro} %list of abbreviations

\acsetup{ list/template = longtable, list/display = used, uppercase/list, format/alt } \DeclareAcronym{2d}{ short = 2D, long = bidimensionnel, alt-format = tridimensionnelles} \DeclareAcronym{3d}{ short = 3D, long = tridimensionnel, alt = tridimensionnelles}

\begin{document} \ac{2d} is masculine gender form. \newline \aca{3d} is the feminine gender form, but there is not the short form (3D). \end{document}

I can produce text like

enter image description here

But the 3D in parenthesis not appear.

Do you have any idea to deal with gender forms with the acro package?

  • Welcome to TeX.se. Instead of posting a code fragment, it's more helpful to put the fragment into a compilable document that people can play with. – Alan Munn Mar 07 '23 at 16:00
  • 1
    Hello @AlanMunn and thank you for your corrections. I've added a compilable document. – nicolas Emoptisie Mar 07 '23 at 16:12
  • \aca is just printing the alt form it's working as intended, alt is meant as an alternative short form, so \aca is more of a stand-in for \acs than \ac or \acf. You might be trying to set plural forms and so want to set long-plural-form=les when declaring, but I'm not quite clear, could you give a couple more usages of the acro commands and what you want them to expand to? – Dai Bowen Mar 07 '23 at 16:34
  • As an example with "2D", I would like to define the plural form "bidimensionnels" and the feminine form "bidimensionnelle" and to be able to use "bidimensionnelles" form, i.e feminine plural. I will check long-plural-form=les – nicolas Emoptisie Mar 07 '23 at 20:14
  • @nicolasEmoptisie I think I see, long-plural-form probably isn't enough. So essentially you want a masculine and feminine version of each acro command (e.g. \ac can be called with \acmasc or \acfem, \acs having \acsmasc and \acsfem) or does the gender only come up in specific cases/forms? – Dai Bowen Mar 07 '23 at 20:38
  • Yes, exactly @DaiBowen. – nicolas Emoptisie Mar 08 '23 at 09:34

2 Answers2

1

acro has interfaces for defining arbitrary new properties with \DeclareAcroProperty, and new commands with \NewAcroCommand detailed in the documentation in sections 29. Properties and 30. Own acronym commands.

However, for defining multiple properties and an internal interface, I think \DeclareAcroEnding can be slightly misused to good effect. \DeclareAcroEnding{feminine}{}{} defines *-feminine and *-feminine-form equivalents to the *-plural and *-plural-form that are all initially empty. Where the feminine form differs by letters appended to the masculine form long-feminine=les can be set, or where it differs more substantially long-feminine-form=tridimensionelles can be used to state it in its entirety.

Then we need to add new \ac-variants to apply these properties, e.g.

\NewAcroCommand \acF {m}
  { \acrofeminine \UseAcroTemplate {first} {#1} }
\NewAcroCommand \AcF {m}
  { \acrofeminine \acroupper \UseAcroTemplate {first} {#1} }

(note I'm using F to avoid clashing with the already existing \acf-type commands that force the full appearance). Other variants need to be explicitly defined individually but can be based on the definitions found in the source.

\documentclass[12pt,twoside,openright]{book}
\usepackage{acro}[=v3]

\DeclareAcroEnding{feminine}{}{}

\DeclareAcronym{2d}{ short = 2D, long = bidimensionnel, long-feminine=les, } \DeclareAcronym{3d}{ short = 3D, long = tridimensionnel, long-feminine-form=tridimensionnelles, }

\NewAcroCommand \acF {m} { \acrofeminine \UseAcroTemplate {first} {#1} } \NewAcroCommand \AcF {m} { \acrofeminine \acroupper \UseAcroTemplate {first} {#1} }

\begin{document} \ac{2d} \acreset{2d} \acF{2d}

\acF{3d} \acreset{3d} \ac{3d}

\printacronyms[heading=none] \end{document}

Code output

For the feminine plural, I think we have to declare a separate ending \DeclareAcroEnding{feminineplural}{s}{s} using the same default as for the plural ending. Unfortunately I don't see how we can inherit the feminine endings, so this will require some duplication, even if the plural just appends an s.

\documentclass[12pt,twoside,openright]{book}
\usepackage{acro}[=v3]

\DeclareAcroEnding{feminine}{}{} \DeclareAcroEnding{feminineplural}{s}{s}

\DeclareAcronym{2d}{ short = 2D, long = bidimensionnel, long-feminine=les, long-feminineplural=less }

\NewAcroCommand \acpF {m} { \acrofeminineplural \UseAcroTemplate {first} {#1} }

\begin{document} \acp{2d} \acreset{2d} \acpF{2d}

\printacronyms[heading=none] \end{document}

Code output


A slightly nicer interface than exploiting \DeclareAcroEnding probably could be built, but not without either a lot of boiler plate code or relying on the expl3 interface.

Dai Bowen
  • 6,117
0

The lazy solution, when you have one acronym that may take two forms which differ arbitrarily (whether in one or all of the short/long/first/plural/etc), is to define two tightly connected acronyms.

The uselist property of an acronym allows the acronyms 2d and 2dB allows 2d to consider itself used if 2dB has been used, even if it has not itself, and vice versa.

\DeclareAcronym{2d}{
    short   = 2D,
    long    = bidimensionnel,
    uselist = {2dB},
}
\DeclareAcronym{2dB}{
    short   = 2D,
    long    = bidimensionnelB,
    uselist = {2d},
}

The two acronyms can differ as much or as little (even not at all if necessary) and within the text will not share a common first usage. This can be extended to an arbitrary number of acronyms if necessary.

There are a few caveats coming from pairing up acronyms like this though:

  • Resetting usage remains local to the acronym, \acreset{2d} will only reset 2d while, if it has been used, 2dB will still remember it was used.

  • \acsetup{single=true} will give unexpected behaviour if both are used but one of them is only used once.

  • As we have two acronyms the \printacronyms will list both unless their list form is identical (e.g. if they share a short/long form but differ on plural properties). This can be resolved by tagging one of the acronyms and using exclude in \printacronyms

    \DeclareAcronym{2d}{
        short   = 2D,
        long    = bidimensionnel,
        uselist = {2dB},
    }
    \DeclareAcronym{2dB}{
        short   = 2D,
        long    = bidimensionnelB,
        uselist = {2d},
        tag = {B-form},
    }
    

    \begin{document} \ac{2d}
    \ac{2dB}

    \printacronyms[heading=none,exclude={B-form}] \end{document}

    however this too can have unexpected consequences if only 2dB ends up being used in the document and \acsetup{list/display=used} is set.

Dai Bowen
  • 6,117