1

I am writing my dissertation in yathesis class and want to produce multiple indexes with imakeindex package. I have been able to produce two indexes: an index of names with title subentries, and an index of titles organized by year. From there, I cannot produce is an index of author's names (removing titles).

Would someone know how I can get an index of names only?

If possible, with the surname of the author followed by the first letter of his first name in parenthesis. Like that: Skocpol (T.),

Many thanks !

Here is the MWE:

\documentclass[12pt]{yathesis}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{hyperref}
\usepackage{lipsum}

\usepackage{imakeidx}
\usepackage[main=french]{babel}
\usepackage{csquotes}

\usepackage[indexing=cite,style=authortitle,autolang=hyphen,backend=biber]{biblatex}
\addbibresource{biblatex-examples.bib}


\makeindex
\makeindex[name=name-title,title={Name and Title Index}]
\makeindex[name=year-title,title={Year and Title Index}]

\makeatletter
\@ifpackageloaded{biblatex_legacy}
{\DeclareIndexNameFormat{name:title}{%
    \iffieldundef{title}
    {\usebibmacro{index:name}{\index[name-title]}{#1}{#3}{#5}{#7}}
    {\usebibmacro{index:name:title}{\index[name-title]}{#1}{#3}{#5}{#7}}}}
{\DeclareIndexNameFormat{name:title}{%
        \iffieldundef{title}
        {\usebibmacro{index:name}{\index[name-title]}
            {\namepartfamily}
        {\namepartgiven}
        {\namepartprefix}
        {\namepartsuffix}}
    {\usebibmacro{index:name:title}{\index[name-title]}
        {\namepartfamily}
        {\namepartgiven}
        {\namepartprefix}
        {\namepartsuffix}}}}
\makeatother

\DeclareIndexFieldFormat{with:year}{%
\iffieldundef{year}
{\usebibmacro{index:entry}{\index[year-title]}{%
        \mkbibindexentry{0}{Not dated}%
        \subentryoperator%
        \mkbibindexfield{\thefield{indexsorttitle}}{\emph{#1}}}}
{\usebibmacro{index:entry}{\index[year-title]}{%
        \thefield{year}\subentryoperator%
        \mkbibindexfield{\thefield{indexsorttitle}}{\emph{#1}}}}}

\renewbibmacro*{citeindex}{%
\ifciteindex
{\indexnames[name:title]{labelname}%
    \indexfield[with:year]{indextitle}}
{}}

\begin{document}

\mainmatter

Here is some text avec un ballon\index{ballon}
\autocite{knuth:ct,knuth:ct:a,knuth:ct:c,knuth:ct:d}
\autocite{aristotle:anima,aristotle:poetics,aristotle:physics}

 \backmatter 

 \clearpage

 \printbibliography

 \raggedright
 \printindex
 \printindex[name-title] % the name-title index
 \printindex[year-title] % the year-title index

 \end{document}
1

The following creates an extra index with names only and formats all names produced by biblatex in the index in the "Family (G.)" format.

To change the name format we redefine \mkbibindexname. For the name-only index we can mainly copy things from the other indices, but use name:index instead of index:name instead of index:name:title.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[main=french]{babel}
\usepackage{imakeidx}
\usepackage{csquotes}
\usepackage[indexing=cite,style=authortitle,autolang=hyphen,backend=biber]{biblatex}
\usepackage{hyperref}

\addbibresource{biblatex-examples.bib}

\makeindex
\makeindex[name=name-only,title={Name Index}]
\makeindex[name=name-title,title={Name and Title Index}]
\makeindex[name=year-title,title={Year and Title Index}]


\DeclareIndexNameFormat{name:title}{%
  \iffieldundef{title}
    {\usebibmacro{index:name}{\index[name-title]}
       {\namepartfamily}
       {\namepartgiveni}
       {\namepartprefix}
       {\namepartsuffix}}
    {\usebibmacro{index:name:title}{\index[name-title]}
       {\namepartfamily}
       {\namepartgiveni}
       {\namepartprefix}
       {\namepartsuffix}}}

\DeclareIndexNameFormat{name:only}{%
  \usebibmacro{index:name}{\index[name-only]}
    {\namepartfamily}
    {\namepartgiveni}
    {\namepartprefix}
    {\namepartsuffix}}

\makeatletter
\renewcommand*{\mkbibindexname}[4]{%
  \ifuseprefix
    {\ifdefvoid{#3}{}{#3 }%
     \@firstofone #1% remove spurious braces
     \ifdefvoid{#4}{}{ #4}%
     \ifdefvoid{#2}{}{ (#2)}%
     \actualoperator
     \ifdefvoid{#3}{}{\MakeCapital{#3} }%
     #1%
     \ifdefvoid{#4}{}{ #4}%
     \ifdefvoid{#2}{}{  (#2)}}
    {\@firstofone #1% remove spurious braces
     \ifdefvoid{#4}{}{ #4}%
     \ifdefvoid{#2}{}{ (#2)}%
     \ifdefvoid{#3}{}{ #3}}}
\makeatother

\DeclareIndexFieldFormat{with:year}{%
  \iffieldundef{year}
    {\usebibmacro{index:entry}{\index[year-title]}{%
       \mkbibindexentry{0}{Not dated}%
       \subentryoperator%
       \mkbibindexfield{\thefield{indexsorttitle}}{\emph{#1}}}}
    {\usebibmacro{index:entry}{\index[year-title]}{%
       \thefield{year}\subentryoperator%
       \mkbibindexfield{\thefield{indexsorttitle}}{\emph{#1}}}}}

\renewbibmacro*{citeindex}{%
  \ifciteindex
    {\indexnames[name:only]{labelname}%
     \indexnames[name:title]{labelname}%
     \indexfield[with:year]{indextitle}}
    {}}

\begin{document}
  Here is some text avec un ballon\index{ballon}
  \autocite{knuth:ct,knuth:ct:a,knuth:ct:c,knuth:ct:d}
  \autocite{aristotle:anima,aristotle:poetics,aristotle:physics}

 \printindex
 \printindex[name-title] % the name-title index
 \printindex[year-title] % the year-title index
 \printindex[name-only] % the name index
 \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.