Index Markup » Historie » Version 8
Martin Kraetke, 23.12.2021 13:59
1 | 1 | Martin Kraetke | h1. Index Markup |
---|---|---|---|
2 | |||
3 | h2. Word |
||
4 | |||
5 | 6 | Martin Kraetke | Transpect-tex provides four methods to encode an index. They can be combined with each other. |
6 | 1 | Martin Kraetke | |
7 | 4 | Martin Kraetke | h3. (1) Word-Index |
8 | 1 | Martin Kraetke | |
9 | 4 | Martin Kraetke | Obviously, the native Word Index feature is supported. With the @\f@ switch, you can specify the index type. |
10 | 2 | Martin Kraetke | |
11 | 1 | Martin Kraetke | !index.png! |
12 | |||
13 | 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. |
14 | 1 | Martin Kraetke | |
15 | 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". |
16 | 5 | Martin Kraetke | But here are instructions on how to create an index listing for [[Indexverzeichnis-Typ| index entries with type]]. |
17 | 1 | Martin Kraetke | |
18 | 6 | Martin Kraetke | h3. (2) Encode index entries via character style |
19 | 1 | Martin Kraetke | |
20 | 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. |
21 | 1 | Martin Kraetke | |
22 | 6 | Martin Kraetke | h3. (3) List of index search terms |
23 | 1 | Martin Kraetke | |
24 | 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_. |
25 | 1 | Martin Kraetke | |
26 | 6 | Martin Kraetke | h3. (4) Static index |
27 | 1 | Martin Kraetke | |
28 | 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! |
29 | 1 | Martin Kraetke | |
30 | 7 | Martin Kraetke | h3. Index-Headings and Placement of Indices |
31 | 1 | Martin Kraetke | |
32 | 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. |
33 | 1 | Martin Kraetke | |
34 | 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. |
35 | 1 | Martin Kraetke | |
36 | 8 | Martin Kraetke | h2. Hub XML |
37 | 1 | Martin Kraetke | |
38 | 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: |
39 | 1 | Martin Kraetke | |
40 | <pre><code class="xml"> |
||
41 | <indexterm remap="e" type="Tiere"> |
||
42 | <primary>Wolf</primary> |
||
43 | <secondary>Lamm</secondary> |
||
44 | </indexterm></code></pre> |
||
45 | |||
46 | 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. |
47 | 1 | Martin Kraetke | |
48 | <pre><code class="xml"> |
||
49 | 8 | Martin Kraetke | <index type="person" remap="e"> |
50 | <title role="tsindexheadingperson">John Doe</title> |
||
51 | 1 | Martin Kraetke | </index> |
52 | </code></pre> |
||
53 | |||
54 | 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. |
55 | 1 | Martin Kraetke | |
56 | 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]]. |
57 | 1 | Martin Kraetke | |
58 | <pre><code class="xml"> |
||
59 | <index remap="c" type="Orte"> |
||
60 | <title role="tsindexheadingOrte">Ortsregister</title> |
||
61 | <indexdiv> |
||
62 | <title>B</title> |
||
63 | <indexentry> |
||
64 | <primaryie>Bertelé, <xref xlink:href="page-93"/>, <xref xlink:href="page-94"/></primaryie> |
||
65 | </indexentry> |
||
66 | <!-- (…) --> |
||
67 | </indexdiv> |
||
68 | </index> |
||
69 | </code></pre> |
||
70 | |||
71 | h2. TeX |
||
72 | |||
73 | h3. Auszeichnung multipler Indexes und deren Überschriften |
||
74 | |||
75 | Wir verwenden das LaTeX-Paket "index":https://mirror.dogado.de/tex-archive/macros/latex/contrib/index/index.pdf für die Rohindexerzeugung, sowie Xindy zum Generieren des fertigen Registers. |
||
76 | |||
77 | h4. Deklaration der Index-Typen |
||
78 | |||
79 | Das Paket erlaubt mehrere Indexe. Diese werden mit dem \(re)newindex-Befehlen deklariert: |
||
80 | <pre><code class="text"> |
||
81 | \newindex{<typ>}{<endung rohindex>}{<endung fertiger index>}{<Überschrift>} |
||
82 | </code></pre> |
||
83 | Damit der Skriptaufruf später korrekt funktioniert, müssen die beiden Endungen bei *nicht-default-Typen* dem Schema @<typ>_idx@ (Rohindex) bzw. @<typ>_ind@ (fertiger Index) entsprechen. |
||
84 | |||
85 | Der Default- oder Hauptindex kriegt das Label @default@, dessen ÜS lässt sich wie folgt überdefinieren: |
||
86 | <pre><code class="text"> |
||
87 | \renewindex{default}{idx}{ind}{Personenregister} |
||
88 | </code></pre> |
||
89 | Die Index-Einträge für diesen Index werden mit |
||
90 | <pre><code class="text"> |
||
91 | \index{<Lemma>} |
||
92 | </code></pre> |
||
93 | deklariert. Ausgegeben wird der Hauptindex wird mit |
||
94 | <pre><code class="text"> |
||
95 | \printindex |
||
96 | </code></pre> |
||
97 | |||
98 | Angenommen, wir wollen zusätzlich zu diesem noch ein Ortsverzeichnis, dann müssen wir in der Präambel der tex-Datei einen neuen Index-Typ deklarieren: |
||
99 | <pre><code class="text"> |
||
100 | \newindex{o}{o_idx}{o_ind}{Ortsverzeichnis} |
||
101 | </code></pre> |
||
102 | Die Index-Einträge würden dann mit |
||
103 | <pre><code class="text"> |
||
104 | \index[o]{<Term>} |
||
105 | </code></pre> |
||
106 | deklariert, der Index mit |
||
107 | <pre><code class="text"> |
||
108 | \printindex[o] |
||
109 | </code></pre> |
||
110 | ausgegeben. |
||
111 | |||
112 | h4. Aufruf des Index-Skripts |
||
113 | |||
114 | Mit dem optionalen Argument kann angegeben werden, welcher Index generiert werden soll. Wird das optionale Argument weggelassen, wird der Hauptindex erzeugt: |
||
115 | <pre><code class="text"> |
||
116 | ./index.sh <tex-Dateiname ohne Endung> |
||
117 | </code></pre> |
||
118 | Der Aufruf mit optionalen Argument erzeugt den Neben-Index, z.B. |
||
119 | <pre><code class="text"> |
||
120 | ./index.sh <tex-Dateiname ohne Endung> o |
||
121 | </code></pre> |
||
122 | würde das Ortsverzeichnis aus o.g. Beispiel erzeugen. Das Skript muss also für jeden Index einzeln aufgerufen werden. |
||
123 | |||
124 | h3. Generierung des Index |
||
125 | |||
126 | h4. Generieung der Indexe durch TeX |
||
127 | |||
128 | Heißt: Indexeinträge sind mittels \index[<typ>]{<Lemma>} in TeX kodiert. |
||
129 | |||
130 | <pre><code class="xml"> |
||
131 | lualatex <tex-Dateiname>.tex %% Initialer TeX-Lauf; einsammeln der ÜSen |
||
132 | lualatex <tex-Dateiname>.tex %% Erzeugen des IHV; seitenzahlen verschieben sich ggf. |
||
133 | lualatex <tex-Dateiname>.tex %% Zur Sicherheit... |
||
134 | ./index.sh <tex-Dateiname> %% OHNE Endung! |
||
135 | ./index.sh <tex-Dateiname> <typ> %% Zweites, optionales Argument für Index-Typ anders als default, s.u. |
||
136 | lualatex <tex-Dateiname>.tex %% Index wird erstmalig ausgegeben, ÜS wird geschrieben |
||
137 | lualatex <tex-Dateiname>.tex %% ÜS(en) für Index(e) in IHV gerendert |
||
138 | lualatex <tex-Dateiname>.tex %% Zur Sicherheit... |
||
139 | </code></pre> |
||
140 | |||
141 | h4. Statische Index-Dateien |
||
142 | |||
143 | Heißt: @<basename>.<typ>_ind@ kommt vom Konverter |
||
144 | |||
145 | 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. |