3

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

1

I never had any luck making xindy do what I wanted. In the end I have used the bibleref-parse and a custom index style.

Perhaps you could modify this example to produce something that matches the style you want (this is to match SBL referencing style):

\usepackage{bibleref-parse}
\usepackage{imakeidx}

\usepackage{filecontents}

\begin{filecontents}{\jobname.ist}
preamble
"\\begin{theindex}
\\renewcommand\\item{\\bigskip\\par\\normalfont\\bfseries}
\\renewcommand\\subitem{\\medskip\\par\\normalfont\\itshape}
\\newcommand\\firstsubitem{\\medskip\\par\\nobreak\\hangindent 1in\\normalfont\\itshape}
\\renewcommand\\subsubitem{\\par\\hangindent 1in\\normalfont\\hspace*{0.25in}}
\\newcommand\\firstsubsubitem{\\par\\nobreak\\hangindent 1in\\normalfont\\hspace*{0.25in}}\n"

item_01
"\n    \\firstsubitem"

item_x1
"\n    \\firstsubitem"

item_2
"\n      \\subsubitem\\raggedright\\strut\\rlap{"

item_12
"\n      \\firstsubsubitem\\raggedright\\strut\\rlap{"

item_x2
"\n      \\firstsubsubitem\\raggedright\\strut\\rlap{"

delim_0 "\\normalfont , "
delim_1 "\\normalfont , "
delim_2 "}\\normalfont\\hspace*{0.75in}%"
\end{filecontents}

\makeatletter
\braltabbrvname
\renewcommand*{\BRperiod}{}
\renewcommand*{\BRchsep}{;\space}
\renewcommand*{\BRvsep}{,\space}

\def\br@Ecclesiastes{Eccl\BRperiod}
\def\br@SongofSongs{Song\BRperiod}

\def\br@Titus{Titus}
\def\br@Philemon{Phlm\BRperiod}

\csdef{bri@Gen}{\BRbookof Genesis}
\csdef{bri@Exod}{\BRbookof Exodus}
\csdef{bri@Lev}{\BRbookof Levitcus}
\csdef{bri@Num}{\BRbookof Numbers}
\csdef{bri@Deut}{\BRbookof Deuteronomy}
\csdef{bri@Josh}{\BRbookof Joshua}
\csdef{bri@Judg}{\BRbookof Judges}
\csdef{bri@Ruth}{\BRbookof Ruth}
\csdef{bri@1Sam}{\BRbooknumberstyle{1}\BRbookof Samuel}
\csdef{bri@2Sam}{\BRbooknumberstyle{2}\BRbookof Samuel}
\csdef{bri@1Kgs}{\BRbooknumberstyle{1}\BRbookof Kings}
\csdef{bri@2Kgs}{\BRbooknumberstyle{2}\BRbookof Kings}
\csdef{bri@1Chr}{\BRbooknumberstyle{1}\BRbookof Chronicles}
\csdef{bri@2Chr}{\BRbooknumberstyle{2}\BRbookof Chronicles}
\csdef{bri@Ezra}{\BRbookof Ezra}
\csdef{bri@Neh}{\BRbookof Nehemiah}
\csdef{bri@Esth}{\BRbookof Esther}
\csdef{bri@Job}{\BRbookof Job}
\csdef{bri@Ps}{\BRbookof Psalms}
\csdef{bri@Prov}{\BRbookof Proverbs}
\csdef{bri@Eccl}{\BRbookof Ecclesiastes}
\csdef{bri@Song}{\BRbookof Song of Songs}
\csdef{bri@Isa}{\BRbookof Isaiah}
\csdef{bri@Jer}{\BRbookof Jeremiah}
\csdef{bri@Lam}{\BRbookof Lamentations}
\csdef{bri@Ezek}{\BRbookof Ezekiel}
\csdef{bri@Dan}{\BRbookof Daniel}
\csdef{bri@Hos}{\BRbookof Hosea}
\csdef{bri@Joel}{\BRbookof Joel}
\csdef{bri@Amos}{\BRbookof Amos}
\csdef{bri@Obad}{\BRbookof Obadiah}
\csdef{bri@Jonah}{\BRbookof Jonah}
\csdef{bri@Mic}{\BRbookof Micah}
\csdef{bri@Nah}{\BRbookof Nahum}
\csdef{bri@Hab}{\BRbookof Habakkuk}
\csdef{bri@Zeph}{\BRbookof Zephaniah}
\csdef{bri@Hag}{\BRbookof Haggai}
\csdef{bri@Zech}{\BRbookof Zechariah}
\csdef{bri@Mal}{\BRbookof Malachi}

\csdef{bri@Matt}{\BRbookof Matthew}
\csdef{bri@Mark}{\BRbookof Mark}
\csdef{bri@Luke}{\BRbookof Luke}
\csdef{bri@John}{\BRbookof John}
\csdef{bri@Acts}{\BRbookof Acts}
\csdef{bri@Rom}{\BRbookof Romans}
\csdef{bri@1Cor}{\BRbooknumberstyle{1}\BRbookof Corinthians}
\csdef{bri@2Cor}{\BRbooknumberstyle{2}\BRbookof Corinthians}
\csdef{bri@Gal}{\BRbookof Galatians}
\csdef{bri@Eph}{\BRbookof Ephesians}
\csdef{bri@Phil}{\BRbookof Philippians}
\csdef{bri@Col}{\BRbookof Colossians}
\csdef{bri@1Thess}{\BRbooknumberstyle{1}\BRbookof Thessalonians}
\csdef{bri@2Thess}{\BRbooknumberstyle{2}\BRbookof Thessalonians}
\csdef{bri@1Tim}{\BRbooknumberstyle{1}\BRbookof Timothy}
\csdef{bri@2Tim}{\BRbooknumberstyle{2}\BRbookof Timothy}
\csdef{bri@Titus}{\BRbookof Titus}
\csdef{bri@Phlm}{\BRbookof Philemon}
\csdef{bri@Heb}{\BRbookof Hebrews}
\csdef{bri@Jas}{\BRbookof James}
\csdef{bri@1Pet}{\BRbooknumberstyle{1}\BRbookof Peter}
\csdef{bri@2Pet}{\BRbooknumberstyle{2}\BRbookof Peter}
\csdef{bri@1John}{\BRbooknumberstyle{1}\BRbookof John}
\csdef{bri@2John}{\BRbooknumberstyle{2}\BRbookof John}
\csdef{bri@3John}{\BRbooknumberstyle{3}\BRbookof John}
\csdef{bri@Jude}{\BRbookof Jude}
\csdef{bri@Rev}{\BRbookof Revelation}

\csdef{br@oldtestament}{Old Testament}
\csdef{br@newtestament}{New Testament}

\biblerefmap{Gen}{01@\br@oldtestament !01}
\biblerefmap{Exod}{01@\br@oldtestament !02}
\biblerefmap{Lev}{01@\br@oldtestament !03}
\biblerefmap{Num}{01@\br@oldtestament !04}
\biblerefmap{Deut}{01@\br@oldtestament !05}
\biblerefmap{Josh}{01@\br@oldtestament !06}
\biblerefmap{Judg}{01@\br@oldtestament !07}
\biblerefmap{Ruth}{01@\br@oldtestament !08}
\biblerefmap{Sam1}{01@\br@oldtestament !09}
\biblerefmap{Sam2}{01@\br@oldtestament !10}
\biblerefmap{Kgs1}{01@\br@oldtestament !11}
\biblerefmap{Kgs2}{01@\br@oldtestament !12}
\biblerefmap{Chr1}{01@\br@oldtestament !13}
\biblerefmap{Chr2}{01@\br@oldtestament !14}
\biblerefmap{Ezra}{01@\br@oldtestament !15}
\biblerefmap{Neh}{01@\br@oldtestament !16}
\biblerefmap{Esth}{01@\br@oldtestament !17}
\biblerefmap{Job}{01@\br@oldtestament !18}
\biblerefmap{Ps}{01@\br@oldtestament !19}
\biblerefmap{Prov}{01@\br@oldtestament !20}
\biblerefmap{Eccl}{01@\br@oldtestament !21}
\biblerefmap{Song}{01@\br@oldtestament !22}
\biblerefmap{Isa}{01@\br@oldtestament !23}
\biblerefmap{Jer}{01@\br@oldtestament !24}
\biblerefmap{Lam}{01@\br@oldtestament !25}
\biblerefmap{Ezek}{01@\br@oldtestament !26}
\biblerefmap{Dan}{01@\br@oldtestament !27}
\biblerefmap{Hos}{01@\br@oldtestament !28}
\biblerefmap{Joel}{01@\br@oldtestament !29}
\biblerefmap{Amos}{01@\br@oldtestament !30}
\biblerefmap{Obad}{01@\br@oldtestament !31}
\biblerefmap{Jonah}{01@\br@oldtestament !32}
\biblerefmap{Mic}{01@\br@oldtestament !33}
\biblerefmap{Nah}{01@\br@oldtestament !34}
\biblerefmap{Hab}{01@\br@oldtestament !35}
\biblerefmap{Zeph}{01@\br@oldtestament !36}
\biblerefmap{Hag}{01@\br@oldtestament !37}
\biblerefmap{Zech}{01@\br@oldtestament !38}
\biblerefmap{Mal}{01@\br@oldtestament !39}

\biblerefmap{Matt}{02@\br@newtestament !01}
\biblerefmap{Mark}{02@\br@newtestament !02}
\biblerefmap{Luke}{02@\br@newtestament !03}
\biblerefmap{John}{02@\br@newtestament !04}
\biblerefmap{Acts}{02@\br@newtestament !05}
\biblerefmap{Rom}{02@\br@newtestament !06}
\biblerefmap{Cor1}{02@\br@newtestament !07}
\biblerefmap{Cor2}{02@\br@newtestament !08}
\biblerefmap{Gal}{02@\br@newtestament !09}
\biblerefmap{Eph}{02@\br@newtestament !10}
\biblerefmap{Phil}{02@\br@newtestament !11}
\biblerefmap{Col}{02@\br@newtestament !12}
\biblerefmap{Thess1}{02@\br@newtestament !13}
\biblerefmap{Thess2}{02@\br@newtestament !14}
\biblerefmap{Tim1}{02@\br@newtestament !15}
\biblerefmap{Tim2}{02@\br@newtestament !16}
\biblerefmap{Titus}{02@\br@newtestament !17}
\biblerefmap{Phlm}{02@\br@newtestament !18}
\biblerefmap{Heb}{02@\br@newtestament !19}
\biblerefmap{Jas}{02@\br@newtestament !20}
\biblerefmap{Pet1}{02@\br@newtestament !21}
\biblerefmap{Pet2}{02@\br@newtestament !22}
\biblerefmap{John1}{02@\br@newtestament !23}
\biblerefmap{John2}{02@\br@newtestament !24}
\biblerefmap{John3}{02@\br@newtestament !25}
\biblerefmap{Jude}{02@\br@newtestament !26}
\biblerefmap{Rev}{02@\br@newtestament !27}
\makeatother

\makeindex[name=\jobname-scr,title=Scripture Reference Index,options=-s \jobname.ist]
\renewcommand{\biblerefindex}{\index[\jobname-scr]}

\begin{document}

\pibibleverse{Gen 1:15}

\pibibleverse{Gen 2:5}

\pibibleverse{Gen 10:4}

\pibibleverse{Deut 1:11}

\pibibleverse{Eph 1:4}

\pibibleverse{Gal 2:5}

\printindex[\jobname-scr]

\end{document}

enter image description here

0

I have decided to quickly create my own .idx parser (in PHP) for this purpose.

Until now, it is knit to fit my needs only but if anybody else wants to use it, feel free to drop a comment.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.