Debian Codegraph @

texmf-dist/tex/psizzl/base/index.Psizzl

raw
1 % INDEX PSIZZL - indexing macros for TeX version 1.0
2 % index entries come in two visibilities - non-silent and silent
3 % non-silent entries are preceeded by a ^
4 % while silent entries are preceeded by ^^
5 % the four types of non-silent entries are as follows
6 % ^{text} - type 0, normal
7 % ^|text| - type 1, TeX input, but not a control sequence
8 % ^|\text| - type 2, TeX control sequence
9 % ^\<text> - type 3, TeX concept, a mnemonic name
10 %
11 % the format of the entry in the index file is:
12 % text_!n_pp. where _ is a space, n is the index type,
13 % pp is the page number
14 %
15 \newif\ifproofindex
16 \let\numbercount=\relax
17 \def\\{%
18 {\tt\char'134}%
19 }%
20 \def\<{%
21 \relax\ifmmode\mskip\medmuskip\else\char'74\fi
22 }%
23 \newwrite\@ndexwrite\def\@ndexfile{index.psiztemp }%
24 \adddef\fmtreset{%
25 \immediate\openout\@ndexwrite=\@ndexfile % file for index reminders
26 }%
27 \newif\ifsilent
28 \def\specialhat{%
29 \relax\ifmmode\def\next{^}\else\let\next=\beginxref\fi\next
30 }%
31 \def\beginxref{%
32 \futurelet\next\beginxrefswitch
33 }%
34 \def\beginxrefswitch{%
35 \ifx\next\specialhat\let\next\silentxref
36 \else\silentfalse\let\next\xref
37 \fi
38 \next
39 }%
40 {\c@tCactive\global\let^\specialhat\gdef\silentxref^{\silenttrue\xref}}%
41 \c@tCactive\adddef\l@twrite\l@tCzero %this turns on indexing capability
42 {\c@tVcontrol\c@tBactive|gdef\{}}% \ as an active character -> nothing
43 \def\marginstyle{\vrule height6pt depth2pt width0pt \sevenrm}%
44 \chardef\bslash=`\\
45 \def\xref{%
46 \futurelet\next\xrefswitch
47 }%
48 \def\xrefswitch{%
49 \begingroup
50 \ifx\next|%
51 \aftergroup\vxref % case 1 or 2, |arg| or |\arg|
52 \else
53 \ifx\next\<%
54 \aftergroup\anglexref % case 3, "\<arg>" means angle bracke
55 \else
56 \aftergroup\normalxref% case 0, "{arg}"
57 \fi
58 \fi
59 \endgroup
60 }%
61 \def\vxref|{\c@tBactive\futurelet\next\vxrefswitch}%
62 \def\vxrefswitch#1|{\c@tBcontrol
63 \ifx\next\empty
64 \def\xreftype{2}\def\next{{\tt\bslash\text}}% type 2, |\arg|
65 \else
66 \def\xreftype{1}\def\next{{\tt\text}}% type 1, |arg|
67 \fi
68 \edef\text{#1}\makexref
69 }%
70 \def\anglexref\<#1>{%
71 \def\xreftype{3}\def\text{#1}\def\next{$\langle$\text$\rangle$}%
72 \makexref
73 }%
74 \def\normalxref#1{%
75 \def\xreftype{0}\def\text{#1}\let\next=\text\makexref
76 }%
77 \def\makexref{%
78 \ifproofindex
79 \insert\margin{\hbox{\marginstyle\text}}%
80 \xdef\writeit{%
81 \write\@ndexwrite{%
82 \text\space!\xreftype\space\noexpand\number\p@gecount.%
83 }%
84 }%
85 \writeit
86 \else\ifhmode\kern\z@\fi
87 \fi
88 \ifsilent\ignorespaces\else\next\fi
89 }%
90 % the \insert (which is done in proofmode only) suppresses hyphenation,
91 % so the \kern\z@ is put in to give the same effect in non-proofmode.