summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/testidx/samples/sample-idx-lua.tex
blob: 31b7ad03399079da82dd994153fb1dc603c5ea35 (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 file is public domain.
%
% This example document demonstrates the testidx package
% with LuaLaTeX and xindy. You can build this document using:
%
% lualatex sample-idx-lua
% xindy -M sample-idx-lua -M texindy -C utf8 -L english -t sample-idx-lua.ilg sample-idx-lua.idx
% lualatex sample-idx-lua
%
% If you are using arara, the directives are:
%
% arara: lualatex
% arara: xindy: {language: english, codepage: utf8,
% arara: --> log: sample-idx-lua.ilg,
% arara: --> modules: [sample-idx-lua, texindy]}
% arara: lualatex
\documentclass{article}

\usepackage{filecontents}
\usepackage{fontspec}
\usepackage{makeidx}
\usepackage{testidx}

% Create the .xdy file for this example:
\begin{filecontents*}{\jobname.xdy}
; list of allowed attributes

(define-attributes ((
  "tstidxencapi"
  "tstidxencapii"
  "tstidxencapiii"
)))

; define format to use for locations

(markup-locref :open "\tstidxencapi{"
 :close "}"
 :attr "tstidxencapi")

(markup-locref :open "\tstidxencapii{"
 :close "}"
 :attr "tstidxencapii")

(markup-locref :open "\tstidxencapiii{"
 :close "}"
 :attr "tstidxencapiii")

(markup-locref-list :sep ",")
(markup-range :sep "--")

; define a numbers group

(define-letter-group "Numbers"
   :prefixes ("0" "1" "2" "3" "4" "5" "6" "7" "8" "9")
   :before "A")

; define a "Maths" group for keys starting with ">"

(define-letter-group "Maths"
   :prefixes (">" )
   :before "Numbers")

; define a "Markers" group for keys starting with "<"

(define-letter-group "Markers"
   :prefixes ("<" )
   :before "Maths")

\end{filecontents*}

\makeindex

\begin{document}
\testidx

\printindex
\end{document}