I am typesetting a document in french, hence using xindy to create an index.

I have three levels of references : major, which is typesetted in bold; default which is typesetted in roman and minor, which displays in italics.

For a better readability of the index, I want the following order of the location-references to be respected: major, default, minor; like this:

enter image description here

Then, I edited the xindy style file to create groups:

enter image description here

but I also want the minor page number to disappear in favor of the default one:

enter image description here

Almost done, but the minor reference still displays before the default one because of its value. When I introduce more nesting in the groups definition, xindy returns an error:

(define-attributes (("major") (("default") ("minor"))) )

ERROR: nesting level too deep !

Is the style I want, implying group ordering and substituing, possible with xindy?

Below is an example.

% pdflatex -draftmode test.tex; texindy -M style.xdy -C utf8 test.idx; pdflatex test.tex

\documentclass[a4paper, 12pt]{article}


(define-attributes (("major") ("default" "minor")) )
(markup-attribute-group-list :sep "; ")

(merge-to "minor" "default" :drop)

(markup-locref :attr "major" :open "\textbf{" :close "}")
(markup-locref  :attr "minor" :open "\textit{" :close "}")

(markup-locclass-list :open "\dotfill")



\verb+\index{Index entry|minor}+\index{Index entry|minor}

\verb+\index{Index entry|major}+\index{Index entry|major}

\verb+\index{Index entry}+\index{Index entry}

\verb+\index{Index entry|minor}+\index{Index entry|minor}

\verb+(define-attributes (("major") ("default" "minor")) )+



After the Sergei Golovan’s answer, I tried some tests.

The method seems to work well with alone index references, although when using intervals with |( and |), warnings can appear:

Processing index... [10%]
WARNING: Found a :close-range in the index that wasn't opened before!

The warning seems to me very similar to this bug: https://sourceforge.net/p/xindy/bugs/54/ , as it appears when interval indexes are used. Sadly, it erases location references.

It also seems that sometimes, the process of substituing which occurs because of the defined groups, can lead to a warning.

This would need more tests to find a pattern and avoid errors in the final documents. I think this question should stay open to other solutions.

2 Answers 2


I'm not sure I fully understand what happens, but using

(define-attributes (("major") ("default" "minor") ("minor")) )

seems to do the trick. Minor entries are still grouped with default ones if they are both present on one page, but if there's only a minor entry on a page, it falls into a separate "minor" group and goes after the default group.

the result

  • 1
    This “hack” seems to work nicely with alone index references and when there is only one group of attributes. Thank you for this.
    – gwenj
    Aug 7, 2017 at 18:28

As I wanted to create index ranges within an environment I came up with a different solution. Instead of setting something like \index{foo|(} at the beginning and \index{foo|)} at the end, which could lead to the described problem, I just created those entries without specifying the start and the end of a range and set up texindy to do the job of building ranges. This needs some mechanism to create a duplicated entry on every page in between, wherefore I used the hook mechanism for shipout. So a working example looks like this:








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.