Index Markup » Historie » Version 11
Martin Kraetke, 23.12.2021 14:26
1 | 1 | Martin Kraetke | h1. Index Markup |
---|---|---|---|
2 | |||
3 | 10 | Martin Kraetke | {{toc}} |
4 | |||
5 | 1 | Martin Kraetke | h2. Word |
6 | |||
7 | 6 | Martin Kraetke | Transpect-tex provides four methods to encode an index. They can be combined with each other. |
8 | 1 | Martin Kraetke | |
9 | 4 | Martin Kraetke | h3. (1) Word-Index |
10 | 1 | Martin Kraetke | |
11 | 4 | Martin Kraetke | Obviously, the native Word Index feature is supported. With the @\f@ switch, you can specify the index type. |
12 | 2 | Martin Kraetke | |
13 | 1 | Martin Kraetke | !index.png! |
14 | |||
15 | 4 | Martin Kraetke | The index listing is generated based upon the marked index entries in the main text. The Word feature _Insert index_ in the ribbon entitled _References_ shall be used only for your own control. It is removed during the process. |
16 | 1 | Martin Kraetke | |
17 | 4 | Martin Kraetke | If you create an index listing with Word, it does not initially contain index entries that have a certain index type with "\ f". |
18 | 5 | Martin Kraetke | But here are instructions on how to create an index listing for [[Indexverzeichnis-Typ| index entries with type]]. |
19 | 1 | Martin Kraetke | |
20 | 6 | Martin Kraetke | h3. (2) Encode index entries via character style |
21 | 1 | Martin Kraetke | |
22 | 6 | Martin Kraetke | You can markup phrases with a specific character style to encode them as index entry. During the conversion, an index entry is created from a phrase which has the character style (@[a-z]{1,3}_index_mark@). Index entries that are already encoded with the Word index feature are ignored and not encoded twice. |
23 | 1 | Martin Kraetke | |
24 | 6 | Martin Kraetke | h3. (3) List of index search terms |
25 | 1 | Martin Kraetke | |
26 | 6 | Martin Kraetke | You can create a list of index search terms at the end of the document. During the conversion the converter searches for matches in the content and creates an index entry for each match. There are specific requirements on the list of index search terms. Each entry must have the paragraph style @[a-z]{1,3}_index_list@ and needs to be placed in a separate paragraph. Index entries that are already encoded via Word index feature (1) or character style (2) are ignored and not encoded twice. You can also use the character style @[a-z]{1,3}_index_name@ to mark only a part of the index search term, e.g. for John Doe, _Doe_ can be marked so that an index entry is also created for the phrase _Mr Doe_. |
27 | 1 | Martin Kraetke | |
28 | 6 | Martin Kraetke | h3. (4) Static index |
29 | 1 | Martin Kraetke | |
30 | 6 | Martin Kraetke | If you do not want to automatically search for entries in the text in the index, you can also insert a static index. You need to insert a list of index entries that yield the @index_static@ style. Page numbers in the form of @entry 144, 156, 192@ are linked to the page, i.e. you have to make sure that the page reference is correct! |
31 | 1 | Martin Kraetke | |
32 | 7 | Martin Kraetke | h3. Index-Headings and Placement of Indices |
33 | 1 | Martin Kraetke | |
34 | 7 | Martin Kraetke | You can mark individual index headings with a paragraph format (Regex: @[a-z]{1,3}_index_heading@). The index is rendered where the heading is in the document. Do not forget to add the index type suffix to the style name if you have multiple indices in your document. |
35 | 1 | Martin Kraetke | |
36 | 8 | Martin Kraetke | With concordance lists and static registers, the heading must placed above the index and have the paragraph style @[a-z]{1,3}_index_heading@. Otherwise it won't be possible to assign the index heading to the list of index entries. For indexes with a specific type (e.g. person, location, subject etc), the type must be added to the paragraph style, e.g. @ [a-z] {1,3} _index_heading_person@. If there is no index heading, a standard text is inserted (e.g. _Index_) and the index is inserted at the end of the document. |
37 | 1 | Martin Kraetke | |
38 | 8 | Martin Kraetke | h2. Hub XML |
39 | 1 | Martin Kraetke | |
40 | 8 | Martin Kraetke | All four variants can be combined to create an index. In the hub format, index entries are given a @remap@ attribute in the text, which they assign to a specific index: |
41 | 1 | Martin Kraetke | |
42 | <pre><code class="xml"> |
||
43 | 9 | Martin Kraetke | <indexterm remap="e" type="person"> |
44 | <primary>John Doe</primary> |
||
45 | <secondary>Great writers of Anytown</secondary> |
||
46 | 1 | Martin Kraetke | </indexterm></code></pre> |
47 | |||
48 | 8 | Martin Kraetke | For each index, an @<index>@ element is generated. The @<index>@ is either placed at the position of the index heading or – if not present – at the end of the document. |
49 | 1 | Martin Kraetke | |
50 | <pre><code class="xml"> |
||
51 | 8 | Martin Kraetke | <index type="person" remap="e"> |
52 | <title role="tsindexheadingperson">John Doe</title> |
||
53 | 1 | Martin Kraetke | </index> |
54 | </code></pre> |
||
55 | |||
56 | 8 | Martin Kraetke | In the case of static indexes, it is assumed that the heading is always above the list of index entries. The type of index can also be specified here via an index type suffix in the paragraph style. Page numbers will be linked to the page later. |
57 | 1 | Martin Kraetke | |
58 | 8 | Martin Kraetke | A @.x_ind@ file is generated for static indexes during the XML conversion. In the case of dynamic indexes in the text, this must first be generated via @index.sh@. See below [[Index # call-up-the-index-script]]. |
59 | 1 | Martin Kraetke | |
60 | <pre><code class="xml"> |
||
61 | 9 | Martin Kraetke | <index remap="c" type="location"> |
62 | <title role="tsindexheadinglocation">Ortsregister</title> |
||
63 | 1 | Martin Kraetke | <indexdiv> |
64 | <title>B</title> |
||
65 | <indexentry> |
||
66 | <primaryie>Bertelé, <xref xlink:href="page-93"/>, <xref xlink:href="page-94"/></primaryie> |
||
67 | </indexentry> |
||
68 | <!-- (…) --> |
||
69 | </indexdiv> |
||
70 | </index> |
||
71 | </code></pre> |
||
72 | |||
73 | h2. TeX |
||
74 | |||
75 | 11 | Martin Kraetke | h3. Markup of multiple Indices |
76 | 1 | Martin Kraetke | |
77 | 11 | Martin Kraetke | We use the LaTeX package "index":https://mirror.dogado.de/tex-archive/macros/latex/contrib/index/index.pdf for the creation of indices and Xindy to render the index. |
78 | 1 | Martin Kraetke | |
79 | 11 | Martin Kraetke | h4. Declaration of indices of different types |
80 | 1 | Martin Kraetke | |
81 | 11 | Martin Kraetke | The index package allows to declare multiple indices. They are declared with @\(re)newindex@ commands: |
82 | |||
83 | 1 | Martin Kraetke | <pre><code class="text"> |
84 | \newindex{<typ>}{<endung rohindex>}{<endung fertiger index>}{<Überschrift>} |
||
85 | </code></pre> |
||
86 | |||
87 | 11 | Martin Kraetke | To ensure the invocation of the @index.sh@ script is working properly, the file extension of the non-default index types must be entitled @<typ>_idx@ (raw index) and @<typ>_ind@ (finished index). |
88 | |||
89 | The default index has the label @default@ assigned. Its heading can be overwritten: |
||
90 | |||
91 | 1 | Martin Kraetke | <pre><code class="text"> |
92 | \renewindex{default}{idx}{ind}{Personenregister} |
||
93 | </code></pre> |
||
94 | 11 | Martin Kraetke | |
95 | Index entries were marked in this way: |
||
96 | |||
97 | 1 | Martin Kraetke | <pre><code class="text"> |
98 | \index{<Lemma>} |
||
99 | </code></pre> |
||
100 | 11 | Martin Kraetke | |
101 | The index listing will be rendered in place of the @\printindex@ instruction. |
||
102 | |||
103 | 1 | Martin Kraetke | <pre><code class="text"> |
104 | \printindex |
||
105 | </code></pre> |
||
106 | |||
107 | 11 | Martin Kraetke | Concerning multiple indices, each index has an individual letter as identifier. |
108 | |||
109 | 1 | Martin Kraetke | <pre><code class="text"> |
110 | 11 | Martin Kraetke | \newindex{l}{l_idx}{l_ind}{Locations} |
111 | 1 | Martin Kraetke | </code></pre> |
112 | 11 | Martin Kraetke | |
113 | In these sample we define a location index that is identified by the letter "@l@". |
||
114 | |||
115 | 1 | Martin Kraetke | <pre><code class="text"> |
116 | 11 | Martin Kraetke | \index[l]{<Term>} |
117 | 1 | Martin Kraetke | </code></pre> |
118 | 11 | Martin Kraetke | |
119 | With @\printindex[l]@, the location index is rendered. |
||
120 | |||
121 | 1 | Martin Kraetke | <pre><code class="text"> |
122 | 11 | Martin Kraetke | \printindex[l] |
123 | 1 | Martin Kraetke | </code></pre> |
124 | |||
125 | |||
126 | 11 | Martin Kraetke | h4. Invocation of the index script |
127 | |||
128 | You can pass the index identifier (e.g. letter) to specify which index should be generated. If you omit the optional argument, the main index will be generated. |
||
129 | |||
130 | |||
131 | 1 | Martin Kraetke | <pre><code class="text"> |
132 | ./index.sh <tex-Dateiname ohne Endung> |
||
133 | </code></pre> |
||
134 | 11 | Martin Kraetke | |
135 | Passing the letter @l@ to the index script collects all index terms of this type and creates the location index. |
||
136 | |||
137 | 1 | Martin Kraetke | <pre><code class="text"> |
138 | 11 | Martin Kraetke | ./index.sh <tex-filename without extension (basename)> l |
139 | 1 | Martin Kraetke | </code></pre> |
140 | 11 | Martin Kraetke | |
141 | The script needs to run for each index to be created. |
||
142 | 1 | Martin Kraetke | |
143 | h3. Generierung des Index |
||
144 | |||
145 | h4. Generieung der Indexe durch TeX |
||
146 | |||
147 | Heißt: Indexeinträge sind mittels \index[<typ>]{<Lemma>} in TeX kodiert. |
||
148 | |||
149 | <pre><code class="xml"> |
||
150 | lualatex <tex-Dateiname>.tex %% Initialer TeX-Lauf; einsammeln der ÜSen |
||
151 | lualatex <tex-Dateiname>.tex %% Erzeugen des IHV; seitenzahlen verschieben sich ggf. |
||
152 | lualatex <tex-Dateiname>.tex %% Zur Sicherheit... |
||
153 | ./index.sh <tex-Dateiname> %% OHNE Endung! |
||
154 | ./index.sh <tex-Dateiname> <typ> %% Zweites, optionales Argument für Index-Typ anders als default, s.u. |
||
155 | lualatex <tex-Dateiname>.tex %% Index wird erstmalig ausgegeben, ÜS wird geschrieben |
||
156 | lualatex <tex-Dateiname>.tex %% ÜS(en) für Index(e) in IHV gerendert |
||
157 | lualatex <tex-Dateiname>.tex %% Zur Sicherheit... |
||
158 | </code></pre> |
||
159 | |||
160 | h4. Statische Index-Dateien |
||
161 | |||
162 | Heißt: @<basename>.<typ>_ind@ kommt vom Konverter |
||
163 | |||
164 | Bei statischen Indexes darf die @index.sh@ *nicht aufgerufen* werden, da sonst die *ind-Dateien überschrieben würden! Alle anderen Schritte sind dieselben; @\(re)newindex{}{}{}{}@ muss auch hier verwendet werden. Zum einen für die ÜSen, und zum anderen damit @\printindex[<typ>]@ keine "unknown index type"-Fehler auswirft. |