1

Is it possible the set up a xindy rule in a way that an entry does not show up in the index at all?

Here is a MWE

\documentclass{article}
\usepackage[xindy]{imakeidx}
\def\xindyopt{-M texindy -L german-din}
\makeindex[program=truexindy,options=\xindyopt]
\begin{document}
Lala \index{Test}
\printindex
\end{document}

What rule do I need to remove Test from the index?

5

Here it is. I sort "Test" into a separate letter group "DontIndex", and then surround that group with code that just eats it. You can add other keys to the same group, as shown in the code below, and they will be eaten together.

\RequirePackage{filecontents}
\begin{filecontents*}{DontIndex.xdy}
(require "texindy.xdy") 

(define-letter-group "DontIndex" :prefixes ("~b") :before "default")
(merge-rule "^Test$" "~b") ;$
(merge-rule "^XYZ$" "~b") ;$
 (markup-letter-group  :group "DontIndex" :open "\def\DontShowMe#1{}\DontShowMe{" :close "}")
\end{filecontents*}

\documentclass{article}
\usepackage[xindy]{imakeidx}
\def\xindyopt{-M DontIndex -L german-din}
\makeindex[program=truexindy,options=\xindyopt]
\begin{document}
Disappear \index{Test} \index{XYZ} 
More \index{abc}\\
Still more \index{xyz}
\index{=}
\\
And now testing \index{Testing}
\printindex
\end{document}

enter image description here

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.