2

I'm testing xindy with MikTeX on Windows 10. I have the following simple myfile.tex:

\documentclass{article}

\usepackage{imakeidx}
\makeindex

\begin{document}
Some text
\index{aa}
\index{ab}
\index{ac}
\printindex
\end{document}

... and mystyle.xdy containing one line: (define-letter-group "ab" :after "A" :before "B").

When I run either

xelatex myfile
texindy -C utf8 -L english -M mystyle -o myfile.ind myfile.idx
xelatex myfile

or

xelatex myfile
xindy -C utf8 -L english -M texindy -M mystyle -o myfile.ind myfile.idx
xelatex myfile

I can see that xindy runs and produces an .ind, and it reads my style file but it doesn't apply it. What is going on? How do I make xindy apply my style file?

1

1 Answer 1

3

I can't tell definitely about MikTeX, but on my TeXLive on a Debian GNU/Linux system xindy uses so called prefixes to put accented letters into lettergroups and to sort them. For example, the following is taken from /usr/share/xindy/lang/english/utf8.xdy:

;; Rules for xindy; generated by make-rules.pl
;; language: English

(define-letter-group "A" :prefixes ("�"))
(define-letter-group "B" :after "A" :prefixes ("�"))
(define-letter-group "C" :after "B" :prefixes ("�"))

(Here "�" replaces one-byte strings which are used then to sort index entries, they are different for all lettergroups, for "A" it's the 0x80 byte, for "B" it's 0x84, for "C" it's 0x86 etc.) After that the "en-alphabetize" rule replaces all letters by these prefixes and xindy does the sorting and putting words to letergroups based on them. Here is an excerpt from the rule:

(define-rule-set "en-alphabetize"

  :rules  (("À" "�" :string)
           ("à" "�" :string)
           ("Æ" "��" :string)
           ("æ" "��" :string)

Again, I can't reproduce the 8-bit strings, though the first "�" in all four rules is 0x80 which means that these letters will go to the "A" lettergroup.

So, If you want your "AB" lettergroup to blend in the existing groups, you'll have to assign suitable prefix for it. What works with my TeXLive is the following mystyle.xdy:

(define-letter-group "ab" :after "A" :prefixes ("��"))

where the first has the 0x80 hex code, and the second one has the 0x84 hex code. I don't know if the codes should be the same for MikTeX, as they are generated by a script. Here is the base64 encoded mystyle.xdy if it helps (as simple copying and pasting wouldn't work because of 8-bit strings):

KGRlZmluZS1sZXR0ZXItZ3JvdXAgImFiIiA6YWZ0ZXIgIkEiIDpwcmVmaXhlcyAoIoCEIikpDQoNCg==

When I run

xindy -C utf8 -L english -M texindy -M mystyle myfile.idx

I get the following myfile.ind:

\begin{theindex}
  \providecommand*\lettergroupDefault[1]{}
  \providecommand*\lettergroup[1]{%
      \par\textbf{#1}\par
      \nopagebreak
  }

  \lettergroup{A}
  \item aa, 1
  \item ac, 1

  \indexspace

  \lettergroup{ab}
  \item ab, 1

\end{theindex}
6
  • I found the following lines in lang/english/utf8.xdy: (define-letter-group "A" :prefixes ("\200")) (define-letter-group "B" :after "A" :prefixes ("\204")) (define-letter-group "C" :after "B" :prefixes ("\206")) so will try with those Commented Jun 16, 2018 at 8:08
  • In fact those spaces in :prefixes aren't spaces. They are some invisible characters, which you'll have to copy to your mystyle.xdy somehow. Commented Jun 16, 2018 at 8:10
  • Edited my comment. Actually they are not 4-character strings like "\200" etc but in my Emacs they appear as single characters Commented Jun 16, 2018 at 8:13
  • Yes, they aren't escape sequences. They are actual bytes. Commented Jun 16, 2018 at 8:13
  • And since they are the same as in my TeXLive distribution, you can unbase64 the style file from the answer. It should work for you as well. Commented Jun 16, 2018 at 8:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .