blob: 393049d234e910c7093359d7e55c6443584a1e3c (
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
%{{{ %M% 1.%I% pdc %E% -- indexing macros
%%Requires: utils.tex
% This is the interface to the makeindex program
\message{starting index file}
\newwrite\idxfile
\openout\idxfile=\jobname.idx
% Use Knuth's ^ and ^^ notations.
\newif\ifsilentidx
\def\idxcirk{\ifmmode\def\next{^}\else\let\next=\idxbegin\fi\next}
\def\idxbegin{\futurelet\next\idxbeginswitch}
\def\idxbeginswitch
{%
\ifx\next\idxcirk
\let\next=\idxsilent
\else
\silentidxfalse
\let\next=\idx
\fi
\next
}
\catcode`\^=13 \let^=\idxcirk
\macappend\verbatimplains{\\\^}
\def\idxsilent^{\silentidxtrue\idx}
% ^{foo} ^|foo| ^|\foo| ^<foo> ^$foo$
\def\idx{\futurelet\next\idxswitch}
\def\idxswitch
{%
\begingroup
\ifx\next|%
\aftergroup\vidx
\else\ifx\next\<%
\aftergroup\angleidx
\else\ifx\next$% $ for bracket matching
\aftergroup\mathsidx
\else\ifx\next"% $ for bracket matching
\aftergroup\quotedidx
\else
\aftergroup\normalidx
\fi\fi\fi\fi
\endgroup
}
\def\vidx|%
{%
\catcode`\\=13 % prevent "\" from forming control sequences
\futurelet\next\vidxswitch
}
\def\vidxswitch%
{%
\catcode`\\=0
\ifx\next\empty % ^|\foo|
\let\next\csidx
\else % ^|foo|
\let\next\noncsidx
\fi
\next
}
{\catcode`\@=0 \catcode`\\=13
@gdef@csidx\#1|%
{%
@def@next{{@tt@char`@\#1}}%
@edef@text{#1}%
@emitidx
}}
\def\noncsidx#1|%
{%
\def\next{{\tt#1}}%
\edef\text{#1}%
\emitidx
}
{\catcode`\@=0 \catcode`\\=13 @gdef\{}} % make "\" ifx-equivalent to \empty
\def\angleidx\<#1>%
{%
\def\next{\<#1>}%
\def\text{#1}%
\emitidx
}
\def\mathsidx$#1$%
{%
\def\next{$#1$}%
\def\text{#1}%
\emitidx
}
\def\quotedidx"#1"%
{%
\def\next{""#1""}%
\def\text{#1}%
\emitidx
}
\def\normalidx#1%
{%
\def\text{#1}%
\let\next=\text
\emitidx
}
\def\emitidx
{%
\edef\writeit
{%
\write\idxfile{\string\idx{\expandafter\gobbleARROW\meaning\text
\ifx\text\next\else
@\expandafter\gobbleARROW\meaning\next
\fi}{\noexpand\folio}}%
}%
\writeit
\ifsilentidx \ignorespaces \else \next \fi
}
\def\gobbleARROW#1:->{}
% The simple case -- write the parameter to the file
\def\index#1{\def\next{#1}\let\text=\next \silentidxtrue\emitidx}
{\plain|
\gdef\dfnidx#1{\index{#1|idxunderline}}
\gdef\qdfnidx#1{\index{#1@""#1""|idxunderline}}
}
\def\ttidx#1{^|#1|}
% Things that go after `|':
\def\idxunderline#1{$\underline{\hbox{#1}}$}
\def\see#1#2{{\it see}\space #1}
%}}} %M%
% Local variables:
% fold-folded-p: t
% tex-macros-p: t
% End:
|