Index Markup » Historie » Version 10
Martin Kraetke, 23.12.2021 14:00
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 | h3. Auszeichnung multipler Indexes und deren Überschriften |
||
76 | |||
77 | 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. |
||
78 | |||
79 | h4. Deklaration der Index-Typen |
||
80 | |||
81 | Das Paket erlaubt mehrere Indexe. Diese werden mit dem \(re)newindex-Befehlen deklariert: |
||
82 | <pre><code class="text"> |
||
83 | \newindex{<typ>}{<endung rohindex>}{<endung fertiger index>}{<Überschrift>} |
||
84 | </code></pre> |
||
85 | 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. |
||
86 | |||
87 | Der Default- oder Hauptindex kriegt das Label @default@, dessen ÜS lässt sich wie folgt überdefinieren: |
||
88 | <pre><code class="text"> |
||
89 | \renewindex{default}{idx}{ind}{Personenregister} |
||
90 | </code></pre> |
||
91 | Die Index-Einträge für diesen Index werden mit |
||
92 | <pre><code class="text"> |
||
93 | \index{<Lemma>} |
||
94 | </code></pre> |
||
95 | deklariert. Ausgegeben wird der Hauptindex wird mit |
||
96 | <pre><code class="text"> |
||
97 | \printindex |
||
98 | </code></pre> |
||
99 | |||
100 | 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: |
||
101 | <pre><code class="text"> |
||
102 | \newindex{o}{o_idx}{o_ind}{Ortsverzeichnis} |
||
103 | </code></pre> |
||
104 | Die Index-Einträge würden dann mit |
||
105 | <pre><code class="text"> |
||
106 | \index[o]{<Term>} |
||
107 | </code></pre> |
||
108 | deklariert, der Index mit |
||
109 | <pre><code class="text"> |
||
110 | \printindex[o] |
||
111 | </code></pre> |
||
112 | ausgegeben. |
||
113 | |||
114 | h4. Aufruf des Index-Skripts |
||
115 | |||
116 | Mit dem optionalen Argument kann angegeben werden, welcher Index generiert werden soll. Wird das optionale Argument weggelassen, wird der Hauptindex erzeugt: |
||
117 | <pre><code class="text"> |
||
118 | ./index.sh <tex-Dateiname ohne Endung> |
||
119 | </code></pre> |
||
120 | Der Aufruf mit optionalen Argument erzeugt den Neben-Index, z.B. |
||
121 | <pre><code class="text"> |
||
122 | ./index.sh <tex-Dateiname ohne Endung> o |
||
123 | </code></pre> |
||
124 | würde das Ortsverzeichnis aus o.g. Beispiel erzeugen. Das Skript muss also für jeden Index einzeln aufgerufen werden. |
||
125 | |||
126 | h3. Generierung des Index |
||
127 | |||
128 | h4. Generieung der Indexe durch TeX |
||
129 | |||
130 | Heißt: Indexeinträge sind mittels \index[<typ>]{<Lemma>} in TeX kodiert. |
||
131 | |||
132 | <pre><code class="xml"> |
||
133 | lualatex <tex-Dateiname>.tex %% Initialer TeX-Lauf; einsammeln der ÜSen |
||
134 | lualatex <tex-Dateiname>.tex %% Erzeugen des IHV; seitenzahlen verschieben sich ggf. |
||
135 | lualatex <tex-Dateiname>.tex %% Zur Sicherheit... |
||
136 | ./index.sh <tex-Dateiname> %% OHNE Endung! |
||
137 | ./index.sh <tex-Dateiname> <typ> %% Zweites, optionales Argument für Index-Typ anders als default, s.u. |
||
138 | lualatex <tex-Dateiname>.tex %% Index wird erstmalig ausgegeben, ÜS wird geschrieben |
||
139 | lualatex <tex-Dateiname>.tex %% ÜS(en) für Index(e) in IHV gerendert |
||
140 | lualatex <tex-Dateiname>.tex %% Zur Sicherheit... |
||
141 | </code></pre> |
||
142 | |||
143 | h4. Statische Index-Dateien |
||
144 | |||
145 | Heißt: @<basename>.<typ>_ind@ kommt vom Konverter |
||
146 | |||
147 | 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. |