如何在 xindy 中使用多个位置类别?

如何在 xindy 中使用多个位置类别?

我正在使用xindy已经手动创建的索引进行排版。该idx文件如下所示:

\indexentry{Aboriginal!Advising the Accused}{Ch. 46, S. 3.7.8, P. 208A}
\indexentry{Aboriginal!Definition Of}{Ch. 46, S. 2.1, P. 452B}
\indexentry{Aboriginal Rights!Defence}{Ch. 46, S. 3.1.4(a), P. 109AB}

如您所见,页面引用遵循以下模式:章节-部分-页面-列;例如第 46 章,第 3.7.7(a) 节,第 208A 页

我的xdy文件如下所示:

(define-alphabet "chapter" ("Ch."))
(define-alphabet "section" ("S."))
(define-alphabet "page" ("P."))
(define-alphabet "column" ("A" "B" "AB" "ABA"))
(define-location-class "combination-locator" :var
  ("chapter" :sep " " "arabic-numbers" 
    :sep ", "
    "section" :sep " "
        "arabic-numbers" :sep "."
        "arabic-numbers" :sep "."
        "arabic-numbers" :sep "("
        "alpha" :sep ")" :sep ", " 
    "page" :sep " " "arabic-numbers" "column"
    ))

我遇到的问题是格式略有变化 - 部分最多有 4 个层次结构级别,包括一个按字母顺序排列的级别,并且xindy很难识别一个部分在哪里结束,另一个部分在哪里开始:

WARNING: location-reference "Ch. 46, S. 2.1, P. 208A" did not match any location-class! (ignored)

我的感觉是,问题的一部分在于使用这种复杂的location-class。似乎创建一系列位置类,然后在元位置类中将它们链接在一起会更容易。但是,文档没有解释如何创建递归位置类。

答案1

我在 xindy 文档中找不到任何表明您可以指定可选元素的内容,因此最简单的方法似乎就是将这些位置类添加到xdy您上面给出的末尾:

(define-location-class "combination-locator-a" :var
  ("chapter" :sep " " "arabic-numbers" 
    :sep ", "
    "section" :sep " "
        "arabic-numbers" :sep "."
        "arabic-numbers" :sep "."
        "arabic-numbers" :sep ", " 
    "page" :sep " " "arabic-numbers" "column"
    ))
(define-location-class "combination-locator-b" :var
  ("chapter" :sep " " "arabic-numbers" 
    :sep ", "
    "section" :sep " "
        "arabic-numbers" :sep "."
        "arabic-numbers" :sep ", " 
    "page" :sep " " "arabic-numbers" "column"
    ))
(define-location-class "combination-locator-c" :var
  ("chapter" :sep " " "arabic-numbers" 
    :sep ", "
    "section" :sep " "
        "arabic-numbers" :sep ", " 
    "page" :sep " " "arabic-numbers" "column"
    ))

当我通过该命令运行示例idx文件时,它产生了看似适当的输出:

  \lettergroup{A}
  \item Aboriginal
    \subitem Advising the Accused, Ch. 46, S. 3.7.8, P. 208A
    \subitem Definition Of, Ch. 46, S. 2.1, P. 452B
  \item Aboriginal Rights
    \subitem Defence, Ch. 46, S. 3.1.4(a), P. 109AB

相关内容