带有 xindy 的圣经经文索引

带有 xindy 的圣经经文索引

我正在排版一本书,其中有 4 个(或可能更多)索引(我正在使用splitindex),其中一个是圣经经文索引。

这个索引将按照圣经书卷的顺序排列,条目将按这些书卷分组。所以它应该是这样的

Genesis
    1,15 123, 234-255
    2,5 456
    10,4 654

Deuteronomium
    1,11 987

索引条目采用像 这样的简写形式Dt_8,17-18,因此.idx看起来像这样(与示例其余部分相匹配的代码片段):

\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}

http://www.xindy.org/doc/tutorial-3.html,我接受了这个一般性的暗示,定义了一个新的字母表,当定义时,包括一个排序顺序(http://www.xindy.org/doc/manual-3.html)。如果我随后添加合并规则(以便使用 进行Dt排序Deuteronomy),我应该会非常接近我想要的结果。

我最初尝试编写 xindy 样式文件是这样的:

;; 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"))

我使用 xindy 运行了它xindy -M bible -t ex1.xlg auxiliaries\karlstadt-bib.idx,结果.ind(再次说明,只是一段代码)是

\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}

因此,我的合并规则按我预期的方式工作,就像Dt排序一样Deuteronomium

但其余的都不起作用。我定义的字母表被忽略,但应用了标准字母排序顺序。此外,我定义的字母组(尝试了简写和长名称)不会导致任何分组或生成任何标题,这正是我从教程中期望的。

有没有办法只使用 xindy 样式文件中提供的命令就能到达我需要去的地方?LaTeX 文件是从 XML 源生成的,因此我可以控制命令的外观,\sindex但我想避免在我的 XSLT 中包含冗长的翻译列表(Gn → Genesis等等)。

如果使用 xindy 无法轻松完成或涉及某些地方的大量重写,我可能会更快地为此目的编写自己的解析器,所以请不要犹豫地告诉我。

提前感谢您的意见,Dario

答案1

我从来没有成功实现xindy我想要的效果。最后我使用了bibleref-parse自定义索引样式。

也许您可以修改这个例子来产生符合您想要的风格的东西(这是为了匹配 SBL 引用风格):

\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}

在此处输入图片描述

答案2

为此,我决定快速创建自己的 .idx 解析器(使用 PHP)。

到目前为止,它只是满足了我的需求,但如果其他人想使用它,请随时发表评论。

相关内容