@Nicola-Talbot managed to solve my last question: Makeindex, different kinds of references and collation in the index
Unfortunately I don't succeed to carry this solution beyond splitindex.
This was the premise: Consider an index with three different attributes, default, ii (implicit) and nn:
Shakespeare\index{Shakespeare}
famous playwright from Stratford\index{Shakespeare|ii}
note: William Shakespeare (/ˈʃeɪkspɪər/;[1] 26 April 1564 (baptised) – 23 April 1616)[nb 1] was an English poet, playwright, and actor, widely regarded as the greatest writer in the English language and the world's pre-eminent dramatist.\index{Shakespeare|nn}
If there are entries of the default type on a page the ones with attributes should be omitted from the output.
This MWE works:
\documentclass{scrartcl}
\usepackage{filecontents}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{makeidx}
\begin{filecontents*}{\jobname.xdy}
; list of allowed attributes
(define-attributes (( "default" "ii" "nn" )))
; define format to use for locations
(markup-locref :open "\emph{" :close "}" :attr "ii")
(markup-locref :open "\nn{" :close "}" :attr "nn")
; location list separators
(markup-locref-list :sep ", ")
(markup-range :open "\range{" :sep "}{" :close "}")
(merge-to "nn" "ii" :drop)
\end{filecontents*}
\makeindex
\newcommand{\nn}[1]{#1n}
\newcommand{\range}[2]{{\def\nn##1{##1}#1}--#2}
\begin{document}
bla\index{Lahm} blablab\index{Lahm|nn}
bla\index{A} bla\index{A|nn}
bla\index{B} bla\index{B|nn}
\newpage
bla\index{Lahm|nn} blablab
bla\index{B|nn}
\newpage
bla\index{B|nn}
\printindex
\end{document}
Unfortunately when I introduce splitindex (I have two indices), the MWE doesn't properly omit the attributes anymore:
\documentclass{scrartcl}
\usepackage{filecontents}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage[makeindex, protected]{splitidx}
\newindex[persons]{pw}
\begin{filecontents*}{\jobname.xdy}
; list of allowed attributes
(define-attributes (( "default" "ii" "nn" )))
; define format to use for locations
(markup-locref :open "\ii{" :close "}" :attr "ii")
(markup-locref :open "\nn{" :close "}" :attr "nn")
; location list separators
(markup-locref-list :sep ", ")
(markup-range :open "\range{" :sep "}{" :close "}")
(merge-to "nn" "ii" :drop)
\end{filecontents*}
\makeindex
\newcommand{\nn}[1]{#1n}
\newcommand{\ii}[1]{\emph{#1}}
\newcommand{\range}[2]{{\def\nn##1{##1}#1}--#2}
\begin{document}
bla\sindex[pw]{Lahm} blablab\sindex[pw]{Lahm|nn}
bla\sindex[pw]{A} bla\sindex[pw]{A|nn}
bla\sindex[pw]{B} bla\sindex[pw]{B|nn}
bla\sindex[pw]{B} bla\sindex[pw]{B|ii}
\newpage
bla\sindex[pw]{Lahm|nn} blablab
bla\sindex[pw]{B|nn}
\newpage
bla\sindex[pw]{B|nn}
\printindex[pw]
\end{document}
I believe it has something to do with splitindex as the .ilg brings up the same warnings as makeindex:
Generating output file ./indextest-pw.ind....
## Warning (input = ./indextest-pw.idx, line = 4; output = ./indextest-pw.ind, line = 3):
-- Conflicting entries: multiple encaps for the same page under same key.
## Warning (input = ./indextest-pw.idx, line = 8; output = ./indextest-pw.ind, line = 7):
-- Conflicting entries: multiple encaps for the same page under same key.
## Warning (input = ./indextest-pw.idx, line = 6; output = ./indextest-pw.ind, line = 7):
-- Conflicting entries: multiple encaps for the same page under same key.
## Warning (input = ./indextest-pw.idx, line = 2; output = ./indextest-pw.ind, line = 11):
-- Conflicting entries: multiple encaps for the same page under same key.
Any idea how to solve this? Or should is there another way to have two indices with xindy?
Lahm, 1, 2n
so it has omitted1n
because there's a1
already, but included a2n
because there's no2
otherwise. Isn't that what you'd expect?