summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/hvindex/hvindex.sty
blob: f6dba8e127a69cf134ca57bdddce35d32bca9acd (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
% $Id: deIndex.sty 737 2009-10-12 08:59:10Z herbert $
%%
%% IMPORTANT NOTICE:
%%
%% This is file `hvindex.sty',
%%
%% Herbert Voss <herbert@dante.de>
%% October 01, 2009-
%%
%% 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.
%%
%% DESCRIPTION:
%%   `hvindex' offers macros for simplifing indexing of words
%%
\NeedsTeXFormat{LaTeX2e}
\def\fileversion{0.04}
\def\filedate{2017/12/12}
\message{`hvindex' v\fileversion, \filedate\space (hv)}
%
\ProvidesPackage{hvindex}[\filedate~Index macros (hv)]
%
\RequirePackage{xkeyval}
\newif\ifhv@makeidx\hv@makeidxfalse
\DeclareOptionX{makeidx}{\hv@makeidxtrue}
\newcommand*\hv@index@quote{>}
\DeclareOptionX{quote}{\renewcommand*\hv@index@quote{#1}}


\ProcessOptionsX\relax

\ifhv@makeidx
  \RequirePackage{makeidx}
  \makeindex
\fi
%
\let\IndexNIL\@nil
\def\hvIDXfontDefault#1{#1}
\let\hvIDXfont\hvIDXfontDefault
%
\makeatother
\def\Index#1{\expandafter\IndexXi#1!!!\IndexNIL}
\def\IndexXi#1!#2!#3!#4\IndexNIL{%
  \ifx\relax#3\relax% 			% 	no 3rd argument
    \ifx\relax#2\relax%			% 	no 2nd argument
      \IndexXXi#1@@==%\IndexNIL%		% 	scan #1 for @
    \else\IndexXXii#1!#2@@\IndexNIL\fi%	% 	scan #2 for @
  \else\IndexXXiii#1!\noexpand#2!#3@@\IndexNIL% scan #3 for @
  \fi}
\def\IndexXXi#1@#2@#3\IndexNIL{%
  \ifx\relax#2\relax% 				no @ in last arg
    \ifx\hvIDXfont\hvIDXfontDefault
    \index{#1}#1%
    \else\index{#1@\hvIDXfont{#1}}\hvIDXfont{#1}\fi%#1
  \else\index{#1@#2}#2\fi}%		% #1@#2
%
\def\IndexXXii#1!#2@#3@#4\IndexNIL{%
  \ifx\relax#3\relax 		% 		no @ in last arg
    \ifx\hvIDXfont\hvIDXfontDefault\index{#2}#2%
    \else\index{#1!#2@\hvIDXfont{#2}}\hvIDXfont{#2}\fi%
  \else\index{#1!\protect#2@#3}#3\fi}
%
\def\IndexXXiii#1!#2!#3@#4@#5\IndexNIL{%
  \ifx\relax#4\relax 		% 		no @ in last arg
    \ifx\hvIDXfont\hvIDXfontDefault\index{#3}#3%
    \else\index{#1!#2!#3@\hvIDXfont{#3}}\hvIDXfont{#3}\fi%
  \else\index{#1!#2!\protect#3@#4}#4\fi}
%
\def\sfIndex#1{\let\hvIDXfont\textsf\Index{#1}\let\hvIDXfont\hvIDXfontDefault}
\def\ttIndex#1{\let\hvIDXfont\texttt\Index{#1}\let\hvIDXfont\hvIDXfontDefault}
\def\scIndex#1{\let\hvIDXfont\textsc\Index{#1}\let\hvIDXfont\hvIDXfontDefault}
\def\itIndex#1{\let\hvIDXfont\textit\Index{#1}\let\hvIDXfont\hvIDXfontDefault}
\def\bfIndex#1{\let\hvIDXfont\textbf\Index{#1}\let\hvIDXfont\hvIDXfontDefault}
%
\makeatletter
\def\sIndex#1{\expandafter\sIndex@i#1\@nil}
\def\sIndex@i#1|#2\@nil{\index{#1|see{#2}}#1}
\def\saIndex#1{\expandafter\saIndex@i#1\@nil}
\def\saIndex@i#1|#2\@nil{\index{#1|seealso{#2}}#1}
%
\iffalse
\begingroup
  \lccode`0=`\{
  \lccode`1=`\}
\lowercase{%
  \endgroup
  \newcommand\hvBraceLeft{0}%
  \newcommand\hvBraceRight{1}%
}
\def\iBraceL{%
  \begingroup
    \edef\x{\endgroup
      \noexpand\index{\string"\string{@\string\textbraceleft}%
    }\x}
\def\iBraceR{%
  \begingroup
    \edef\x{\endgroup
      \noexpand\index{\string"\string{@\string\textbraceleft}%
    }\x}
%\begingroup
%  \edef\x{\endgroup
%    \noexpand\index{\string"\string{@\string\textbraceleft}%
%  }%
%\x
\else
%\newcommand*{\hv@braceIndex}[1]{\index{#1}}
%\newcommand*\iBraceL{\hv@braceIndex{"\hvBraceLeft @\string\textbraceleft}}
%\newcommand*\iBraceR{\hv@braceIndex{"\hvBraceRight @\string\textbraceright}}
%\newcommand*\IBraceL{\hv@braceIndex{"\hvBraceLeft @\textbraceleft}\{}
%\newcommand*\IBraceR{\hv@braceIndex{"\hvBraceRight @\textbraceright}\}}
\def\iBraceL{\index{\char123}}
\def\iBraceR{\index{\char125}}
\def\iVert{\index{\char124}}

\fi
\newcommand*\IBraceL{\iBraceL\textbraceleft}
\newcommand*\IBraceR{\iBraceR\textbraceright}
\newcommand*\IVert{\iVert|}



\endinput