summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/acro/examples/acro.example.issue-119.tex
blob: d1b5cadc6505412a609dc80efb6858b1034738d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
\documentclass{article}
\usepackage[enable-debug]{expl3}

\usepackage[version=3]{acro}

\makeatletter
\NewAcroTemplate[list]{external}{%
  \if@filesw
    \newwrite\acro@list
    \immediate\openout\acro@list\jobname.ac\relax
    \immediate\write\acro@list{\string\begin{description}}
    \let\item\relax
    \acronymsmapF{%
      \immediate\write\acro@list{%
        \space\space
        \item[\acrofield{##1}{short}]
        \acrofield{##1}{long}%
        \acrofieldifTF{##1}{extra}{ (\acrofield{##1}{extra})}{}%
      }%
    }{\immediate\write\acro@list{\item}\AcroRerun}%
    \immediate\write\acro@list{\string\end{description}}
    \immediate\closeout\acro@list
  \fi
}
\makeatother

\DeclareAcronym{ny}{
  short = NY ,
  long = New York ,
}

\DeclareAcronym{la}{
  short = LA ,
  long = Los Angeles ,
  extra = City of Angels
}

\DeclareAcronym{dc}{
  short = D.C. ,
  long = Washington D.C.
}

\begin{document}

\acuseall
\printacronyms[template=external]
\null

\end{document}