summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/xindex/xindex.sty
blob: 43cd71a32479507e3e9436e5f3e0df27fae9cc0b (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
%% This is file `xindex.sty',
%%
%% Copyright (C) 2018-2024
%% Herbert Voss
%%
%% It may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%    http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%
%
% -------------------------------------
\ProvidesPackage{xindex}[2024/05/16 v. 0.60 write into an idx file (hv)]
%
\RequirePackage{xkeyval}

\newif\if@@imakeidx \@@imakeidxfalse

\DeclareOptionX{imakeidx}{\@@imakeidxtrue}
\DeclareOptionX*{\PassOptionsToPackage\CurrentOption{imakeidx}}
\ProcessOptionsX\relax

\@ifpackageloaded{imakeidx}{}{%   imakeidx already loaded?? if not then define ...
  \newif\ifimki@startedidx
  \newif\ifimki@splitindex
}

\if@@imakeidx
  \typeout{xindex: Using package imakeidx}%
  \RequirePackage{imakeidx}
  \def\imki@progdefault{xindex}
  \def\imki@program{xindex}
%
  \def\imki@@startidxsplit#1{%
    \if@filesw
      \def\index{\@bsphack
        \@ifnextchar [{\@index}{\@index[\imki@jobname]}}
      \expandafter\newwrite\csname #1@idxfile\endcsname
      \immediate\openout \csname #1@idxfile\endcsname #1.idx\relax
      \def\writeidx##1{\write\expandafter\csname #1@idxfile\endcsname{\noexpand##1}}%
      \typeout{Writing index file #1.idx}%
    \fi
  }
  \global\imki@startedidxfalse
  \def\imki@@startidxunique#1{%
    \if@filesw
      \ifimki@startedidx\else
        \newwrite\@indexfile
        \immediate\openout\@indexfile\imki@jobname.idx%
        \def\writeidx##1{\write\@indexfile{\noexpand##1}}%
        \global\imki@startedidxtrue
      \fi
      \def\index{\@bsphack
        \@ifnextchar [{\@index}{\@index[\imki@jobname]}}
      \expandafter\let\csname #1@idxfile\endcsname\@empty
      \typeout{Started index file #1}%
   \fi
  }
%
  \ifimki@splitindex
    \let\imki@startidx\imki@@startidxunique
  \else
    \let\imki@startidx\imki@@startidxsplit
  \fi
\else
  \typeout{xindex: Using package makeidx}%
  \RequirePackage{makeidx}
  \def\writeidx#1{\write\@indexfile{\noexpand#1}}
\fi

\providecommand\braceLeft{\{}
\providecommand\braceRight{\}}

\endinput