summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/acroterm/acroterm.sty
blob: b0f258a2e89a834784573d93e06b84477f9f55f6 (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
%%
%% This is file `acroterm.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% acroterm.dtx  (with options: `package')
%% 
%% The Acroterm package
%% 
%% Copyright (C) 2010 by Jakob Voss
%% 
%% Distributable under the LaTeX Project Public License,
%% version 1.3c or higher (your choice). The latest version of
%% this license is at: http://www.latex-project.org/lppl.txt
%% 
%% This work is "maintained" (as per LPPL maintenance status)
%% by Jakob Voss.
%% 
%% This work consists of the file  acroterm.dtx
%%           and the derived files acroterm.sty,
%%                                 acroterm.ins, and
%%                                 acroterm.pdf.
%% 
\ProvidesPackage{acroterm}
  [2010/11/19 v0.1 Manage and index acronyms and terms]
\RequirePackage{splitidx}[2009/02/18 v1.1a]
\RequirePackage{xifthen}
\newcommand{\Acrostyle}[1]{#1}
\newcommand{\acrostyle}[1]{\textsc{\lowercase{#1}}}
\newcommand{\termstyle}[1]{#1}
\newcommand{\Termstyle}[1]{\textit{#1}}
\newcommand{\tacrostyle}[2]{\termstyle{#1} (\acrostyle{#2})}
\newcommand{\Tacrostyle}[2]{\Termstyle{#1} (\acrostyle{#2})}
\newcommand{\atermstyle}[2]{\acrostyle{#1} (\termstyle{#2})}
\newcommand{\Atermstyle}[2]{\acrostyle{#1} (\termstyle{#2})}
\newcommand{\acroindexstyle}[1]{#1\acroexpand[ --- ]{#1}}
\newcommand{\provideacronym}[2]{% TODO: detect redefinitions
  \expandafter\providecommand\expandafter{%
  \csname acronymlong#1\endcsname}{#2}%
}
\newcommand{\bfhref}[1]{\textbf{\hyperpage{#1}}}
\newcommand{\acro@define}[2]{% #1: long term, #2: acronym
  \sindex[idx]{#1|see{\acrostyle{#2}}}% TODO: acronyms in general index?
  \@ifundefined{acronymlong#2}{%
    \provideacronym{#2}{#1}}{}%
  \sindex[acronym]{#2@\acroindexstyle{#2}|bfhref}%
}

\newcommand{\acroexpand}[2][]{%
  \@ifundefined{acronymlong#2}{}{%
  #1\csname acronymlong#2\endcsname}%
}
\newcommand{\term}[2][]{%
  \ifthenelse{\isempty{#1}}%
  {\sindex[idx]{#2}}{\sindex[idx]{#1}}%
  \termstyle{#2}}
\newcommand\Term[2][]{%
  \ifthenelse{\isempty{#1}}%
  {\sindex[idx]{#2|bfhref}}%
  {\sindex[idx]{#1|bfhref}}%
  \Termstyle{#2}%
}
\newcommand{\acro}[1]{%
  \acrostyle{#1}%
  {\sindex[acronym]{#1@\acroindexstyle{#1}}}%
}
\newcommand{\Acro}[1]{%
  \Acrostyle{#1}%
  {\sindex[acronym]{#1@\acroindexstyle{#1}}}%
}
\newcommand{\tacro}[3][]{%
  \ifthenelse{\isempty{#1}}%
  {\acro@define{#2}{#3}}{\acro@define{#1}{#3}}% TODO: not define?
  \tacrostyle{#2}{#3}}
\newcommand{\Tacro}[3][]{%
  \ifthenelse{\isempty{#1}}%
  {\acro@define{#2}{#3}}{\acro@define{#1}{#3}}%
  \Tacrostyle{#2}{#3}}
\newcommand{\aterm}[2]{%
  \acro@define{#2}{#1}% TODO: not define but only use?
  \atermstyle{#1}{#2}}
\newcommand{\Aterm}[2]{%
  \acro@define{#2}{#1}%
  \Atermstyle{#1}{#2}}
\endinput
%%
%% End of file `acroterm.sty'.