I am typesetting a book that will have 4 (or possibly more) indices (for which I am using splitindex
), one of which will be an index of bible verses.
This index is to be ordered by the order of the biblical books and the entries are to be grouped under these books. So it should be sth like
Genesis
1,15 123, 234-255
2,5 456
10,4 654
Deuteronomium
1,11 987
The index entries are in a shorthand like Dt_8,17-18
, so the .idx
looks like this (snippet to match remainder of example):
\indexentry{Ier_17,5}{884}
\indexentry{Dt_8,17-18}{884}
\indexentry{Dt 8,17}{884}
\indexentry{Gal_6,3}{884}
\indexentry{Dn_9,18}{880}
From http://www.xindy.org/doc/tutorial-3.html, I took the general hint to define a new alphabet which, when defined, includes a sort order (http://www.xindy.org/doc/manual-3.html). If I then add merge-rules (to make Dt
sorted with Deuteronomy
), I should come quite close to what I want.
My initial attempts of writing a xindy style file were along these lines:
;; basic definitions and markup commands
(define-location-class "page-numbers" ("arabic-numbers"))
(define-attributes ("default"))
(markup-index :open "~n\begin{theindex}~n"
:close "~n\end{theindex}~n"
:tree)
(markup-locclass-list :open "\quad{}")
(markup-locref-list :sep ", ")
(markup-indexentry :open "~n \item " :depth 0)
(markup-indexentry :open "~n \subitem " :depth 1)
(markup-indexentry :open "~n \subsubitem " :depth 2)
(markup-letter-group :open-head "~n\indexspace~n \textbf{" :close-head "}")
;; define alphabet (includes sort order)
(define-alphabet "bible-chapters"
("Genesis" "Exodus" "Leviticus" "Numeri" "Deuteronomium"))
;; define merge rules for shorthands
(merge-rule "Gn" "Genesis")
(merge-rule "Ex" "Exodus")
(merge-rule "Lv" "Leviticus")
(merge-rule "Nm" "Numeri")
(merge-rule "Dt" "Deuteronomium")
;; letter groups are supposed to give groups with headings
(define-letter-groups
("Genesis" "Exodus" "Leviticus" "Numeri" "Deuteronomium"))
;; ( "Gn" "Ex" "Lv" "Nm" "Dt" ))
;; Entry layout is book_chapter_verse(s)
(define-location-class "bible-verses"
("bible-chapters" :sep "_" "arabic-numbers" :sep "," "arabic-numbers"))
I ran xindy using xindy -M bible -t ex1.xlg auxiliaries\karlstadt-bib.idx
and the resulting .ind
(again, just a snippet) is
\indexspace
\textbf{C}
\item Ct_5,3\quad{}874
\indexspace
\textbf{D}
\item Dt 8,17\quad{}884
\item Dt_8,17-18\quad{}884
\item Dn_9,18\quad{}880
\indexspace
\textbf{E}
So, my merge rules worked as I expected as Dt
is sorted as if it were Deuteronomium
.
All the rest, though, did not work. The alphabet I defined is ignored but a standard alphabetical sort order is applied. Furthermore, the letter groups I define (tried both shorthands and long names) do not result in any grouping or generate any heading which is what I expected from the tutorial.
Is there any way of getting to where I need to go just using the commands available in the xindy style files?
The LaTeX files are generated from an XML source so I have some control over how the \sindex
commands look like but I'd like to avoid having to include a lengthy list of translations (Gn → Genesis
and so on) in my XSLT.
If it is not easily done with xindy or involves some extensive rewriting somewhere, I might be faster writing my own parser for this purpose, so please do not hesitate to tell me so.
Thanks in advance for your input, Dario