2

I am currently using biblatex to produce an index of ancient authors, like so:-

Author,
  On Conundrums,
    II, 77.3--5, 1
    II, 77.10--12, 2
    II, 100, 5--6, 3

Where II is the volume number of the book On Conundrums, 77 or 100 are page numbers, and 3--5, 10--12, 5--6 are line numbers of the quoted passages, and finally 1, 2, 3 are the pages where each of the quotations occurs.

In my document source, references such as II, 77.3--5 go into the <prenote> optional argument, like so: \autocite[II, 77.3--5]{Author}.

To produce the actual index, I use the solution provided by @PaulStanley there, which I adapted to make it comply with biblatex 3.3 new formatting rules for names (see "biblatexengine.tex" at the end of this post).

The problem is that references such as II, 77.3--5 are not sorted correctly in the index. To take two examples, II, 55.1 goes after II, 211.25--28 just because 5 > 2, and II, 77.3--5 goes after II, 77.10--12 just because 3 > 1, and so forth.

In other words, page/line numbers are not treated as numbers here, while they are always in "simple" postnote contents such as \autocite[123]{Author}.

Is there a way to get this work? At present, my solution consists in prefixing all numbers with zeros, like so: II, 077.01--13, then passing the formatted index on to a Lua script to take out the leading zeros. This works, but isn't there a better way to proceed?

Any help would be much appreciated.

MWE:

\documentclass{article}

\usepackage{fontspec}
\usepackage{libertine}

\usepackage{filecontents}

\begin{filecontents}{mwe.bib}
@Book{IAUMuller,
  year =     1995,
  author =   {{Ibn Abī Uṣaybiʿa}},
  title =    {ʿUyūn al-anbāʾ fī ṭabaqāt al-atibbāʾ},
  shorttitle =   {ʿUyūn al-anbāʾ},
  editor =   {Müller, August},
  shorteditor =  {Müller},
  pagination =   {none},
  entrysubtype = {classical},
  publisher =    {Institute for the history of Arabic-Islamic Science},
  location =     {Frankfurt am Main},
  volumes =  2
}
\end{filecontents}

\usepackage{indextools}

\usepackage[citestyle=verbose-trad3, citepages=omit,
backend=biber, indexing]{biblatex}

\addbibresource{mwe.bib}

\makeindex[name=authortitle, title={Ancient Authors}]
\makeindex[name=ancauthortitle, title={Modern Authors}]

\input{biblatexengine.tex}

\begin{document}
First reference\autocite[II, 77.3--5]{IAUMuller}; second
reference\autocite[II, 100.5--6]{IAUMuller}. And finally\autocite[II,
77.10--12]{IAUMuller}.

\printbibliography
\printindex[ancauthortitle]
\end{document}

Content of biblatexengine.tex. The relevant part of this file begins at %RELEVANT and ends at %NOT RELEVANT:

%RELEVANT:
\makeatletter
\def\thefirstpage#1{%
  \expandafter\expandafter\expandafter\firstpage@i
  \expandafter\expandafter\expandafter{\csname abx@field@#1\endcsname}}
\def\firstpage@i#1{\firstpage@ii#1-\@nil}
\def\firstpage@ii#1-#2\@nil{#1}
 \newbibmacro*{index:name:title:pages}[5]{%
  \begingroup
  \ifuseprefix
    {\def\abx@tempa{%
       \ifblank{#4}{}{#4 }%
       \@firstofone #2% remove spurious braces
       \ifblank{#5}{}{ #5}%
       \ifblank{#3}{}{, #3}%
       \actualoperator
       \ifblank{#4}{}{\MakeCapital{#4} }%
       #2%
       \ifblank{#5}{}{ #5}%
       \ifblank{#3}{}{, #3}}}
    {\def\abx@tempa{%
       \@firstofone #2% remove spurious braces
       \ifblank{#5}{}{#5}%
       \ifblank{#3#4}{}{,}%
       \ifblank{#3}{}{ #3}%
       \ifblank{#4}{}{ #4}}}%
  \savefield{indextitle}{\abx@tempb}%
  \iffieldpages{postnote}
    {\protected@edef\theindexentry{\unexpanded{#1}{%
       \abx@tempa!\thefield{indexsorttitle}%
       \actualoperator\emph{\expandonce\abx@tempb}%
       !\thefirstpage{postnote}\actualoperator\thefield{postnote}|emph}}}
    {\protected@edef\theindexentry{\unexpanded{#1}{%
       \abx@tempa!\thefield{indexsorttitle}%
       \actualoperator\emph{\expandonce\abx@tempb}}}}%
  \theindexentry
  \endgroup}
\makeatother

\DeclareIndexNameFormat{title:pages}{%
\nameparts{#1}%
\iffieldequalstr{entrysubtype}{classical}{%
   \usebibmacro{index:name:title:pages}{\index[ancauthortitle]}%
     {\iffieldundef{usera}{}{\thefield{usera}\actualoperator}\namepartfamily}%
        {\namepartgiven%
        \iffieldundef{nameaddon}{}{\addspace\parentext{\thefield{nameaddon}}}}%
        {\namepartprefix}{\namepartsuffix}}%
   {\usebibmacro{index:name:title:pages}{\index[authortitle]}%
     {\iffieldundef{usera}{}{\thefield{usera}\actualoperator}\namepartfamily}%
        {\namepartgiven}{\namepartprefix}{\namepartsuffix}}}

\renewbibmacro*{citeindex}{%
  \ifciteindex{\indexnames[title:pages]{labelname}}{}}

%NOT RELEVANT (serves other purposes):

\DeclareCiteCommand{\notecite} % adapt \notecite
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{prenote}}
  {\ifciteindex
     {\indexnames[title:pages]{labelname}}
     {}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\makeatletter           % include \ifciteindex in lowlevel \citename
\long\csdef{blx@cite@citename}#1#2#3#4#5#6{%
  \begingroup
  \blx@citecmdinit
  \blx@citeinit
  \ifblank{#1}
    {}
    {\def\abx@field@prenote{#1}}%
  \ifblank{#2}
    {\let\blx@thenotecheck\relax}
    {\def\abx@field@postnote{#2}}%
  \def\blx@precode{\usebibmacro{prenote}}%
  \def\blx@loopcode{%
     \ifciteindex
     {\indexnames[title:pages]{labelname}}
     {}%
    \ifnameundef{#5}
      {\blx@warning@entry{'#5' undefined or not a name list}%
       \abx@missing{#5}}
      {\printnames[#4]{#5}}}%
  \def\blx@dlimcode{\multicitedelim}%
  \ifblank{#2}
    {\def\blx@postcode{#6}}
    {\def\blx@postcode{\usebibmacro{postnote}#6}}%
  \boolfalse{citetracker}%
  \boolfalse{pagetracker}%
  \blx@citeloop{#3}%
  \endgroup}
                      % include \ifciteindex in low-level \citefield
\long\csdef{blx@cite@citefield}#1#2#3#4#5#6{%
  \begingroup
  \blx@citecmdinit
  \blx@citeinit
  \ifblank{#1}
    {}
    {\def\abx@field@prenote{#1}}%
  \ifblank{#2}
    {\let\blx@thenotecheck\relax}
    {\def\abx@field@postnote{#2}}%
  \def\blx@precode{\usebibmacro{prenote}}%
  \def\blx@loopcode{%
     \ifciteindex
     {\indexnames[title:pages]{labelname}}
     {}%
    \iffieldundef{#5}
      {\blx@warning@entry{'#5' undefined or not a field}%
       \abx@missing{#5}}
      {\printfield[#4]{#5}}}%
  \def\blx@dlimcode{\multicitedelim}%
  \ifblank{#2}
    {\def\blx@postcode{#6}}
    {\def\blx@postcode{\usebibmacro{postnote}#6}}%
  \boolfalse{citetracker}%
  \boolfalse{pagetracker}%
  \blx@citeloop{#3}%
  \endgroup}
\makeatother

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.