# Indexing of single and multiple Psalms in bibleref / bibleref-german

In scholarship, a single reference to a Psalm is abbreviated with "Ps" (for "Psalm"), while references to several Psalms are abbreviated as "Pss" ("Psalms").

The bibleref-german package does accommodate for that by printing "Pss" when the abbreviation "Ps" is used, and by defining a new book "Psalm", for which the abbreviation "Ps" is printed.

This is how the book is defined in bibleref-german.sty:

\def\br@Psalm{Ps\BRperiod}%
\def\br@Psalms{Pss\BRperiod}%


My MWE looks like this:

\documentclass[a4paper,10pt]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage[RGG]{bibleref-german}
\usepackage{makeidx}
\makeindex

\begin{document}
Single psalm reference: \ibibleverse{Psalm}(23:1)

Multiple psalm references: \ibibleverse{Ps}(119:105); \ibiblechvs{Ps}(121:2)

\printindex
\end{document}


It looks like this in the rendered text:

Single psalm reference: Ps 23,1

Multiple psalm references: Pss 119,105; 121,2


The problem is that this differentiation is then also made in the index, i.e. there are two different entries for "Ps" and "Pss" in the index:

I want to differentiate in the text between "Ps" and "Pss", but have all references listed under "Pss" in the index (or "Ps", for that matter). How do I achieve that the references to Ps as well as the references to Psalm are both mapped to Pss in the index?

I wasn't sure how to fix bibref (or bibref-german), so what I did is replace the book name in the *.idx file before it is processed by makeindex.

First of all, I need to specify a mapping in which "Ps" and "Pss" have the same order:

[...]
\biblerefmap{Ps}{23}
\biblerefmap{Pss}{23}
[...]


Then, after compiling the tex file and before creating the index, I need to do a string replacement (for instance, by using sed, see alternatives here):

pdflatex file.tex
sed -i "s/BRbooktitlestyle {Pss}/BRbooktitlestyle {Ps}/g" file.idx
makeindex file.idx
pdflatex file.tex