# Create a register of persons with references

To Create a register of persons with biblatex seems to be much more complicate then i expected.

How can i create nice a register of persons semiautomatic with \ref?

Lets assume i have 20 persons that should be mentioned in a document. The grouping and sorting is complicate to implement in LaTeX, but i could do that very easy by hand and LaTeX could manage links and backlinks for me.

At the moment i use a solution like How do I include all authors of cited works in an index of persons?. It works but it can not handle the manual grouping and sorting.

The final document with hyperlinks and backlinks should look like

The screwdriver was turned by \person[Mr.]{Miller}.

Register of Persons
===================
Prof. Dr. M. Miller, University of M (p. 4, 12)
Dr. A. Foobar, University of M (p. 5)

B. Foo, University of Z (p. 1)

-
Have a look at the nameauth package. –  Marc van Dongen Nov 14 '12 at 7:26
nameauth is a good way to go (though I've only looked at the package, never used it). Another way to do it is with an index: as long as you put all your frequently names in macros and provide a 'general' name macro for one-off uses, it would not be hard to 'group' (i.e., sort) as you please. In the index approach, the xparse package will allow you to create pretty clever name+(conditional-)index macros pretty easily. See here for a related question. –  jon Nov 14 '12 at 10:40
I could not find anything about hyperlinks nor an register in the manual of nameauth. –  Jonas Stein Nov 14 '12 at 12:50

You can achieve this using the glossaries package:

\documentclass{report}

\usepackage{datatool-base}% provides \DTLinitials
\usepackage{glossaries}

% Syntax: \newperson{label}{title}{forenames}{surname}{affiliation}
\newcommand*{\newperson}[5]{%
\newglossaryentry{#1}%
{%
name={#2\space\DTLinitials{#3}\space#4},
sort={#5},% sort on affiliation
description={#5},% affiliation
text={#2\ #4},% title \space surname
user1={#2},% title
user2={#3},% forenames
user3={#4}% surname
}%
}

\let\Ptitle\glsuseri
\let\Pforenames\glsuserii
\let\Psurname\glsuseriii

\newglossarystyle{person}%
{%
\glossarystyle{list}%
\glsnogroupskiptrue
\renewcommand*{\glossaryentryfield}[5]{%
\item[]\glsentryitem{##1}\glstarget{##1}{##2},
##3 (p.~##5)}%
}%

\makeglossaries

\newperson{miller}{Prof.\ Dr.}{Marmaduke}{Miller}{University of M}
\newperson{foobar}{Dr.}{Aardvark}{Foobar}{University of M}
\newperson{foo}{Mr}{Bar}{Foo}{University of Z}

\begin{document}

The screwdriver was turned by \gls{miller}.
The hammer was whacked by \gls{foobar}.
\Gls{foo}['s] thumb throbbed.

\printglossary[title={Register of Persons},style=person]

\end{document}

-
I can not see a glossary. TeXLive2012 generated 1 page with: The screwdriver was turned by Prof. Dr. Miller. The hammer was whacked by Dr. Foobar. Mr Foo's thumb throbbed. Thats all. –  Jonas Stein Nov 15 '12 at 16:54
@JonasStein you need to run makeglossaries or makeindex. This is described in the glossaries manual and also in an article on LaTeX Community –  Nicola Talbot Nov 15 '12 at 17:25
I had to edit .latexmkrc now it works tex.stackexchange.com/questions/1226/… –  Jonas Stein Nov 19 '12 at 2:39
is it possible to print the section title instead of the pagenumer? see here –  Megachip Mar 15 '13 at 20:17

Alas, nameauth will not do the forward referencing. It will respect the index entry links back to the pages in question.

Here is a MWE of what nameauth does generally accomplish. What you get is a focus on auto-formatting of names. The package is meant (mostly) for printed matter. Thanks, however, for this post. It gives me an idea for expansion of features at some point.

\documentclass[11pt]{article}
\usepackage{nameauth}
\usepackage{makeidx}

\title{nameauth test}
\author{}
\date{}
\frenchspacing

\begin{nameauth}
\<Miller & Prof. Dr. M. & Miller & >
\<Foobar & Dr. A. & Foobar & >
\<Foo & B. & Foo & >
\end{nameauth}

\TagName[Prof. Dr. M.]{Miller}{, University of M}
\TagName[Dr. A.]{Foobar}{, University of M}
\TagName[B.]{Foo}{, University of Z}

\makeindex

\begin{document}

\maketitle

\section{Section 1}

The screwdriver was turned by \LMiller.
Do you call him \SMiller[Martin] or just \Miller?
I liked \LMiller[Mr.]'s lectures.
Not so much those of \LFoobar.
I thought \LFoobar[Mr.] was a little disjointed in his presentation.
I hear the new up-and-comer is \LFoo.
Do you know \Foo{} like I know \Foo?

\clearpage

\section{Section 2}

The screwdriver was turned by \LMiller.
Do you call him \SMiller[Martin] or just \Miller?
I liked \LMiller[Mr.]'s lectures.
Not so much those of \LFoobar.
I thought \LFoobar[Mr.] was a little disjointed in his presentation.
I hear the new up-and-comer is \LFoo.
Do you know \Foo{} like I know \Foo?

\clearpage

\printindex

\end{document}

-