summaryrefslogtreecommitdiff
path: root/Build/source/utils/xindy/xindy-src/modules/base/tex.xdy
blob: 197dba1b455cc6761535b32fd8f7ee358d3bd57e (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
;; $Id: tex.xdy,v 1.3 2010/06/11 11:01:46 jschrod Exp $
;;------------------------------------------------------------

;;;
;;; TeX conventions
;;;

;; Discard leading and trailing white space. Collapse multiple white
;; space characters to blank.
;;
;; FIXME: How do I specify tabs in that regexp? [ \t] does *not* work,
;; it is taken as blank and t.
;;
;; FIXME: Definition of these rules should be postponed until we start
;; with the actual work. Then they should be only issued if module
;; keep-blanks is not loaded. Module keep-blanks would set a flag, and
;; this code would check for it. We will need a hook in the kernel, to
;; achieve that goal.

(merge-rule "^ +" "" :eregexp)
(merge-rule " +$" "" :eregexp)
(merge-rule "  +" " " :eregexp)


;;
;; Handle TeX markup
;;


;; First, some markup that produces output and that we want to keep.
;; If this module is required, similar merge-rules for other markup
;; that shall be kept must be defined first. Otherwise it will be
;; discarded, by the default rule below.

(merge-rule "\\([{}$%&#])" "\1" :eregexp)
(merge-rule "~~" " ")
(merge-rule "---?" "-")
(merge-rule "\\TeX *" "TeX" :eregexp :again)
(merge-rule "\\LaTeX *" "LaTeX" :eregexp :again)
(merge-rule "\\MF *" "METAFONT" :eregexp :again)
(merge-rule "\\MP *" "METAPOST" :eregexp :again)

;; Ignore TeX commands by default. Some macros are known to be written
;; to index files where the arguments must be ignored as well. Our
;; argument parsing code is optimistic -- it will be possible to break
;; it. Let's wait for an error report and repair it then... ;-)

(merge-rule "\\discretionary *\{[^}]*\}\{[^}]*\}" "" :eregexp)
(merge-rule "\\kern *[-\.0-9a-z]* ?" "" :eregexp)

(merge-rule "\\[a-zA-Z@]+ *" "" :eregexp)
(merge-rule "\\[^a-zA-Z@]" "" :eregexp)
(merge-rule "[{}$]" "" :eregexp)



;;======================================================================
;;
;; $Log: tex.xdy,v $
;; Revision 1.3  2010/06/11 11:01:46  jschrod
;;     New 2.4 ordrules supports regexps with start-anchored matches.
;; Thus we can activate the leading blank processing rule. The
;; parenthesis-discard rule must trigger everywhere, not just at the
;; start of the index key.
;;     The blank suppression clause got optimized, it now triggers only
;; if there are multiple blanks and not for each appearing blank.
;;
;; Revision 1.2  2005/05/09 20:21:11  jschrod
;;     Support handling of some common macros for logos; ignore all other
;; TeX commands.
;;
;; Revision 1.1  2004/05/24 21:53:27  jschrod
;;     Standard modules, introduced in "LaTeX Companion Release".
;;