Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make public the glossary template? #238

Open
dbitouze opened this issue Mar 14, 2022 · 7 comments
Open

Make public the glossary template? #238

dbitouze opened this issue Mar 14, 2022 · 7 comments
Labels
enhancement New feature or request

Comments

@dbitouze
Copy link
Contributor

The (abstract of the) documentation claims that acro can also be used for glossaries or nomenclatures. And indeed, a glossary can be found in it, which it is typeset thanks to the glossary template

\printacronyms[include=glossary,template=glossary]

But this template is private:

\NewAcroTemplate[list]{glossary}{%
...

(defined in acro-manual.cls only). Is there any reason for no making it public?

@cgnieder
Copy link
Owner

cgnieder commented Mar 14, 2022

Well, it's neither really private as the code of the manual class is public nor is it very complex:

\NewAcroTemplate[list]{glossary}{%
  \begin{description}
    \acronymsmapF{%
      \item[\sffamily\acrowrite{short}] \acrowrite{long}%
    }%
    { \item \AcroRerun }%
  \end {description}
}

To be honest it is just a very simple version of the default template:

\NewAcroTemplate[list]{description}{%
  \acroheading
  \acropreamble
  \begin{description}
    \acronymsmapF{%
      \item[\acrowrite{short}\acroifT{alt}{/}\acrowrite{alt}]
        \acrowrite{list}%
        \acroifanyT{foreign,extra}{ (}%
        \acrowrite{foreign}%
        \acroifallT{foreign,extra}{, }%
        \acrowrite{extra}%
        \acroifanyT{foreign,extra}{)}%
        \acropagefill
        \acropages{\acrotranslate{page}~}{\acrotranslate{pages}~}%
    }
    { \item \AcroRerun }%
  \end{description}
}

The only reason for the template definition in the manual is the \sffamily in the items…

(Which reminds that there should maybe be a possibility to set the format of the short forms in the list…?)

@dbitouze
Copy link
Contributor Author

Sorry, I wrote "private" whereas I meant "available and documented". In fact, examples of a glossary and of a nomenclature would be welcome 😄

@cgnieder
Copy link
Owner

As an example for a simple glossary the acro manual does

\NewAcroTemplate[list]{glossary}{%
  \begin{description}
    \acronymsmapF{%
      \item[\sffamily\acrowrite{short}] \acrowrite{long}%
    }%
    { \item \AcroRerun }%
  \end {description}
}

and defines the terms using the tag property:

\DeclareAcronym{property}{
  long = A \property*{property} is an option to the second argument of the
    \cs*{DeclareAcroym} command.  They are options of an individual acronym if
    you will. ,
  tag = glossary , no-index
}

The glossary then is printed like this:

\section{Glossary}
\printacronyms[include=glossary,template=glossary]

@cgnieder
Copy link
Owner

A more “nomenclature” like example is the following

\documentclass{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{acro}
\acsetup{
  list/display = all ,
  pages/display = first ,
  pages/name = true
}

\usepackage{longtable,siunitx}
\DeclareAcroProperty{unit}
\NewAcroTemplate[list]{physics}{
  \setlength\LTleft{0pt}%
  \setlength\LTright{0pt}%
  \acsetup{ pages/display = all }%
  \acroheading
  \acropreamble
  \acronymsmapF{%
    \AcroAddRow{
      \acrowrite{short} &
      \acrowrite{unit} &
      \acrowrite{list}  &
      \acroifpagesT{(S.~\acropages{}{})} \\
    }%
  }{\AcroRerun}
  \begin{longtable}{@{}lll@{\extracolsep{\fill}}l@{}}
    \bfseries\sffamily Symbol & \bfseries\sffamily Einheit &
    \bfseries\sffamily Name & \\ \endhead
    \AcronymTable
  \end{longtable}
}

\DeclareAcronym{ecm}{
  short = ECM ,
  long  = Electro Chemical Machining ,
  extra = Elektrochemisches Abtragen
}
\DeclareAcronym{adc}{
  short = ADC ,
  long  = Analog-to-Digital-Converter
}
\DeclareAcronym{edm}{
  short = EDM ,
  long  = Electro Discharge Machining
}
\DeclareAcronym{ecdm}{
  short = ECDM ,
  long  = Electro Chemical Discharge Machining ,
  extra = Kombination aus \acs{ecm} und \acs{edm}
}

% "Acronyme" (tatsächlich physikalische Größen) einer speziellen Klasse:
\DeclareAcronym{f}{
  short = \ensuremath{f} ,
  long  = Frequenz ,
  unit  = \unit{\hertz} ,
  tag = physics
}
\DeclareAcronym{A}{
  short = \ensuremath{A} ,
  long  = Fläche ,
  unit  = \unit{\metre^2} ,
  tag = physics
}
\DeclareAcronym{C}{
  short = \ensuremath{C} ,
  long  = Kapazität ,
  unit  = \unit{\farad} ,
  tag = physics
}
\DeclareAcronym{F}{
  short = \ensuremath{F} ,
  long  = Kraft ,
  unit  = \unit{\newton} ,
  tag = physics
}

\begin{document}

erstes Mal: \ac{ecm}

zweites Mal: \ac{ecm}

\ac{F}

% alle außer der Klasse 'physics' auflisten:
\printacronyms[exclude=physics, name=Abkürzungsverzeichnis]

% nur die Klasse 'physics' auflisten:
\printacronyms[include=physics, name=Formelverzeichnis,template=physics]

\end{document}

@cgnieder
Copy link
Owner

What both examples are missing are divisions are divisions into groups (let's say alphabetical or as in the nomencl manual Latin and Greek letters…). Such divisions can only be done manually by using tags in the definitions of the “acronyms” and by using several instances of \printacronyms.

@dbitouze
Copy link
Contributor Author

What both examples are missing are divisions are divisions into groups (let's say alphabetical or as in the nomencl manual Latin and Greek letters…). Such divisions can only be done manually by using tags in the definitions of the “acronyms” and by using several instances of \printacronyms.

OK so, for this purpose, the packages glossaries and glossaries-extra (maybe among others) are more convenient: too bad for those who would like to stick with acro! 😄

@cgnieder
Copy link
Owner

I take this as a feature request ;)

@cgnieder cgnieder added the enhancement New feature or request label Mar 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants