Projekt

Allgemein

Profil

Index Markup » Historie » Version 7

Martin Kraetke, 23.12.2021 13:55

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 7 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
h2. Hub
37
38
Es können alle vier Varianten einen Index zu erstellen miteinander kombiniert werden. Im Hub-Format erhalten Indexeinträge im Text ein @remap@-Attribut, was sie einem bestimmten Index zuordnet:
39
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
Für jeden Index wird zudem ein @<index>@-Element erzeugt. Entweder steht das an der Stelle, wo die Indexüberschrift gesetzt wurde, oder am Ende. In dem Überschriftenformat kann man am Ende auch den Indextyp anhängen.
47
48
<pre><code class="xml">
49
<index type="Tiere" remap="e">
50
  <title role="tsindexheadingTiere">Tiere</title>
51
</index>
52
</code></pre>
53
54
Bei statischen Indexen wird davon ausgegangen, dass die Überschrift über den Indexeinträgen steht. Über den Formatzusatz kann hier aber auch der Typ des Indexes angegeben werden. Seitenzahlen werden später auf die Seite verlinkt.
55
56
Für statische Indexe wird schon bei der XML-Konvertierung eine passende @.x_ind@-Datei erzeugt. Bei dynamischen Indexen im Text muss diese erst noch über die @index.sh@ erzeugt werden. Siehe dazu weiter unten [[Index#Aufruf-des-Index-Skripts]].
57
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
72
h2. TeX
73
74
h3. Auszeichnung multipler Indexes und deren Überschriften
75
76
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.
77
78
h4. Deklaration der Index-Typen
79
80
Das Paket erlaubt mehrere Indexe. Diese werden mit dem \(re)newindex-Befehlen deklariert:
81
<pre><code class="text">
82
\newindex{<typ>}{<endung rohindex>}{<endung fertiger index>}{<Überschrift>}
83
</code></pre>
84
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.
85
86
Der Default- oder Hauptindex kriegt das Label @default@, dessen ÜS lässt sich wie folgt überdefinieren:
87
<pre><code class="text">
88
\renewindex{default}{idx}{ind}{Personenregister}
89
</code></pre>
90
Die Index-Einträge für diesen Index werden  mit 
91
<pre><code class="text">
92
\index{<Lemma>}
93
</code></pre>
94
deklariert. Ausgegeben wird der Hauptindex wird mit 
95
<pre><code class="text">
96
\printindex
97
</code></pre>
98
99
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:
100
<pre><code class="text">
101
\newindex{o}{o_idx}{o_ind}{Ortsverzeichnis}
102
</code></pre>
103
Die Index-Einträge würden dann mit 
104
<pre><code class="text">
105
\index[o]{<Term>}
106
</code></pre>
107
deklariert, der Index mit 
108
<pre><code class="text">
109
\printindex[o]
110
</code></pre>
111
ausgegeben.
112
113
h4. Aufruf des Index-Skripts
114
115
Mit dem optionalen Argument kann angegeben werden, welcher Index generiert werden soll. Wird das optionale Argument weggelassen, wird der Hauptindex erzeugt:
116
<pre><code class="text">
117
./index.sh <tex-Dateiname ohne Endung>
118
</code></pre>
119
Der Aufruf mit optionalen Argument erzeugt den Neben-Index, z.B.
120
<pre><code class="text">
121
./index.sh <tex-Dateiname ohne Endung> o
122
</code></pre>
123
würde das Ortsverzeichnis aus o.g. Beispiel erzeugen. Das Skript muss also für jeden Index einzeln aufgerufen werden.
124
125
h3. Generierung des Index
126
127
h4. Generieung der Indexe durch TeX
128
129
Heißt: Indexeinträge sind mittels \index[<typ>]{<Lemma>} in TeX kodiert.
130
131
<pre><code class="xml">
132
lualatex <tex-Dateiname>.tex     %% Initialer TeX-Lauf; einsammeln der ÜSen
133
lualatex <tex-Dateiname>.tex     %% Erzeugen des IHV; seitenzahlen verschieben sich ggf. 
134
lualatex <tex-Dateiname>.tex     %% Zur Sicherheit... 
135
./index.sh <tex-Dateiname>       %% OHNE Endung!
136
./index.sh <tex-Dateiname> <typ> %% Zweites, optionales Argument für Index-Typ anders als default, s.u.
137
lualatex  <tex-Dateiname>.tex    %% Index wird erstmalig ausgegeben, ÜS wird geschrieben
138
lualatex  <tex-Dateiname>.tex    %% ÜS(en) für Index(e) in IHV gerendert
139
lualatex  <tex-Dateiname>.tex    %% Zur Sicherheit...
140
</code></pre>
141
142
h4. Statische Index-Dateien
143
144
Heißt: @<basename>.<typ>_ind@ kommt vom Konverter
145
146
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.