summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/bezos/esindex.sty
blob: 5fefcf2c1845f2dc7b0f13f74f2f27e030fb362e (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
% This file is copyrighted (c) 1998-2004 by Javier Bezos.
% All Rights Reserved.
% 
% This program can be redistributed and/or modified under the terms
% of the LaTeX Project Public License Distributed from CTAN
% archives in directory macros/latex/base/lppl.txt; either
% version 1 of the License, or any later version.

\ProvidesPackage{esindex}[2004/07/19 v1.1 Spanish indexes]

\def\esx@level{`\!}
\def\esx@actual{`\@}
\def\esx@encap{`\|}
\def\esx@quote{`\"}

\def\esx@error{\PackageError{esindex}{Unknown index parameter}%
	   {Options in this package have the form^^J%
	    parameter=value, where parameter stands for^^J%
		one of the following MakeIndex ones:^^J%
		encap, level, actual, quote}}

\def\esx@process#1=#2\esx@process{%
  \@ifundefined{esx@#1}{\esx@error}{%
  \expandafter\edef\csname esx@#1\endcsname
   {\string`\expandafter\noexpand\csname\string#2\endcsname}}}

\DeclareOption*{%
  \@expandtwoargs\in@{=}{\CurrentOption}%
  \ifin@
    \expandafter\esx@process\CurrentOption\esx@process
  \else
    \esx@error
  \fi}

\ProcessOptions

\begingroup

\catcode`\|=\catcode\esx@encap   \lccode`\|=\esx@encap\relax
\catcode`\!=\catcode\esx@level   \lccode`\!=\esx@level\relax
\catcode`\&=\catcode\esx@actual  \lccode`\&=\esx@actual\relax
\catcode`\*=13                   \lccode`\*=\esx@quote\relax

\catcode`\'=13
\catcode`\"=13
\catcode`\~=13

\gdef\esindex#1#{\esx@index{#1}}

\lowercase{
\gdef\esx@index#1#2{%
  \let\esx@g\@empty
  \esx@bar@idx#2|\@@
  \expandafter\esx@@index\esx@b!\@@
  \protected@edef\esx@g{\noexpand\index#1{\esx@g\esx@a}}%
  \esx@g}
}

\lowercase{
\gdef\esx@bar@idx#1|#2\@@{%
  \def\esx@b{#1}\def\esx@a{#2}%
  \ifx\esx@a\@empty\else\esx@bar@eat#2\fi}
}

\lowercase{
\gdef\esx@bar@eat#1|{\def\esx@a{|#1}}
}

\lowercase{
\gdef\esx@@index#1!#2\@@{%
  \begingroup
  \def\@tabacckludge##1{\csname\string##1\endcsname}%
  \def\'##1{\@ifundefined{esx@index@q@\string##1}%
       {##1}%
       {\csname esx@index@q@\string##1\endcsname}}%
  \ifnum\catcode`\'=\active
    \let'\'%
  \fi
  \def\~##1{\string##1\string^^ff}%
  \ifnum\catcode`\~=\active
    \let~\~%
  \fi
  \def\"##1{\@ifundefined{esx@index@qq@\string##1}%
       {\string"##1}%
       {\csname esx@index@qq@\string##1\endcsname}}%
  \ifnum\catcode`\"=\active
    \let"\"%
  \fi
  \protected@xdef\esx@g{\esx@g#1\string &}%
  \endgroup
  \begingroup
  \def*##1{% <- its lower case is the quote char (")
    \ifcat##1a%
	  \@ifundefined{spanish@sh@\string*\string##1@}%
        {\string*##1}%
        {\string*\string*##1}%
	\else
	  \string*\string##1%
	\fi}%
  \def\esx@b{#2}%
  \ifx\esx@b\@empty
     \protected@xdef\esx@g{\esx@g#1}%
  \else
     \protected@xdef\esx@g{\esx@g#1!}%
     \esx@@index#2\@@
  \fi
  \endgroup}
}
\endgroup

\def\esx@index@q@n{n\string^^ff}
\def\esx@index@q@N{N\string^^ff}

\def\esx@index@qq@o{.o}
\def\esx@index@qq@O{.O}
\def\esx@index@qq@a{.a}
\def\esx@index@qq@A{.A}
\def\esx@index@qq@u{u}
\def\esx@index@qq@A{U}
\def\esx@index@qq@c{c}
\def\esx@index@qq@C{C}

\endinput