# formatting names in an index so that they appear in small caps

here is my question :

Can I modify the presentation of people's names in my index ?

Informations about my document

I am using the package imakeidx with xindy. I have two indexes, people's names in the principal one, and others in a second index called NC.

Peoples names get indexed in three ways :

• by the option indexing=cite of biblatex
• by the classical \index{Doe, John} command
• by some personal commands

The commands look this way :

\newcommand{\n}[2]{#1~\textsc{#2}\index{#2, #1}}
\newcommand{\nx}[1]{\textsc{#1}\index{#1}}


Everything is working fine in my index, except that the names appear in the index in this way : "Doe, John". I would like them to appear in this way : "DOE John" (DOE being in smallcaps like "\textsc{Doe} John" does)

If there is no first name (the reason why I have a \nx command), for example "Aristotle", I would like it to appear in small caps too.

Any idea how I could do that ?

Thanks

• Check in the biblatex document \DeclareIndexNameFormat and friends. – Ulrike Fischer Mar 26 '15 at 16:07
• Thank you @UlrikeFischer, here's what I did : I was already having this command : \renewbibmacro*{citeindex}{{\indexnames{author}}{}}. As I see it, it was for the author's names only to appear in the index, not the book titles. So I added this one : \DeclareIndexNameFormat{default}{\usebibmacro{index:name}{\index}{#1}{#3@\textsc{#1}, #3}{#5}{#7}} It works fine, except that : 1. single names (like "Plato") appear this way "PLATO, , 56" from Biblatex, and "PLATO, 56" from my indexing commands. 2. corporations names are still here. I don't konw hove to solve those two problems. – Malo Mar 27 '15 at 14:10
• As you didn't provide sensible code for testing I can't help you. – Ulrike Fischer Mar 27 '15 at 14:15
• Compilable MWE with all index types included would be a great start for us, it's difficult to test ideas without the code. I could try to prepare a patch in Lua if there wouldn't be any other option. – Malipivo Mar 27 '15 at 15:33

This MWE works on my computer running under Ubuntu (it doesn't on the other one with Windows, but I guess that the problem comes from the installation and not the MWE) :

\documentclass[12pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}

\usepackage[backend=biber, style=authoryear, ibidtracker=true, indexing=cite, citestyle=authoryear-ibid]{biblatex}

\usepackage{imakeidx}
\makeindex
\makeindex[name=nc]

\renewbibmacro*{citeindex}{{\indexnames{author}}{}}
\DeclareIndexNameFormat{default}{\usebibmacro{index:name}{\index}{\textsc{#1}}{#3}{#5}{#7}}

\usepackage{filecontents}
\begin{filecontents}{jobname.bib}
@book{BOOK,
author = {Doe, John},
title = {great book},
date = {2015-04-01},
}
@article{ARTICLE,
author = {{Group of Smart People}},
title = {great article},
journaltitle = {journal},
date = {2015-04-01},
}
@book{BOOK2,
author = {Plato},
title = {Gorgias},
date = {2015-04-01},
}
\end{filecontents}

\newcommand{\n}[2]{#1~\textsc{#2}\index{\textsc{#2}, #1}}
\newcommand{\nx}[1]{\textsc{#1}\index{\textsc{#1}}}
\newcommand{\x}[1]{#1\index[nc]{#1}}
\newcommand{\y}[1]{\emph{#1}\index[nc]{#1@\emph{#1}}}

\begin{document}

\chapter{one}

\nx{Plato} enjoyed \x{philosophy}

\y{logos}

\chapter{two}

\cite[35]{BOOK}

\chapter{three}

\n{John}{Doe}

\cite[33]{BOOK2}

\chapter{four}

\nx{Cicero}

\chapter{five}

\cite[35]{ARTICLE}

\printbibliography
\printindex
\printindex[nc]

\end{document}


Notes :

• I have edited my initial question because different questions were mixed in it, and I will ask them on separate questions.

• This works as well as there is a separate index for people's names. If they are mixed with common names, then they won't be sorted well, because of the command \textsc at the beginning. Then it would be necessary to add the @ in the index commands, but it becomes difficult for the DelcareIndexNameFormat command.