1

I would like to create an index of persons. I have used the nameauth package and I am working in a memoir class. I did not manage to completely obtain the results I want. I have also tried to fiddle around with glossaries and imakeidx, but to be honest I am not so good at customization.

What I am trying to do:

  • Forward referencing to the names in the index, preferably with a simple command as in my MWE. The nameauth package is missing forward references, although it does do correct backwards references.
  • A description field for the index only. Preferably life dates included in the first occurrence of the name, but not the rest of the description. In my MWE I have tried to circumvent the problem by putting it in the "affix" part, but this is of course not satisfactory.
  • In my MWE there is a small problem of spacing after the command of a name is being used. How do I solve this?
  • Lastly, I want to have hyperrefs in the descriptions in the index, i.e.

MWE of what I have now:

    \documentclass[a4paper,oneside]{memoir}
    \usepackage{geometry}

    \usepackage{nameauth}
    \usepackage[hidelinks]{hyperref} % For hyperlinks in the PDF

    \makeindex
    \begin{document}
    \pagestyle{plain}

    \begin{nameauth}
    \< Bosscha     & Johannes  & Bosscha, Jr. (1831-1911)  & >
    \< BosschaSr   & Johannes  & Bosscha, Sr. (1784-1874)  & >
    \< Someone     & Mister    & Someone, (1812-1911) & >
    \end{nameauth}

    \chapter{test}
    And I want to test \Bosscha, or either is it \BosschaSr. So the second 
    time it is called we get: \Bosscha and \BosschaSr. Another test is
    \Someone and \Name[Mister]{Someone2}{ (1812-1911), and some text}.
    Lastly, I could try a manual \href{www.google.nl}{\Bosscha (1831-1911)},
    although I'm not sure this is a solution to my problem.

    \printindex
    \end{document}

What I want to achieve:

In text first occurrence [in smallcaps]:

Johannes van Bosscha Jr. (1831-1911) was born in etc.

This is going correct. I would like to change the later occurrences to smallcaps:

In his later life, Van Bosscha Jr. did such and such.

In the index:

Bosscha, Johannes van, Jr. (1831-1911), description of person, p. 1, 3, 5.

Where somewhere I have a hyperlink inside.

The nameauth partly already has what I need concerning ordering and backreferences, but I lack the freedom to edit the part inside the index for the description and hyperreferences and there is no forward referencing. How can I solve this?

4
  • I've done something similar some while ago, with glossaries. I'll check
    – user31729
    Feb 15, 2017 at 17:22
  • I also have a MWE (see: txt.do/d1zhu) with glossaries inspired by another question asked on this site. The problems there is that I don't know how to: - Create a difference between first and later occurences, and while we're at it make them in smallcaps. - Get the sorting right with names like "van Bosscha" sorted at the B, similar problems with affixes such as Jr. to display them correctly in the index. - Add a hyperlink in the index entry (I know, this request is a bit over the top).
    – Thagusta
    Feb 16, 2017 at 11:54
  • You could use Biblatex/Biber, if it isn't overkill.
    – cfr
    Apr 4, 2017 at 1:18
  • see also tex.stackexchange.com/questions/82659/… Mar 24, 2019 at 14:23

2 Answers 2

3

Here's an example using the acro and (for convenience) the imakeidx package. acro requires a pretty verbose acronym setup for each one because of all the bells and whistles you want, but the package offers many customizable features.

\documentclass{memoir}
\usepackage[T1]{fontenc}
\usepackage{imakeidx}
\makeindex
\usepackage{acro}
\acsetup{
  first-style=long, page-style=plain, index,
  activate-trailing-tokens = {dot}
}
\usepackage{hyperref}

\DeclareAcronym{bosscha}{
  % Appearance in text
  short =     {Van Bosscha Jr\acdot},
  long =      {Johannes van Bosscha Jr\acdot},
  long-post = {\space (1831--1911)},
  first-long-format = {\scshape},
  short-plural = , long-plural = ,
  % Appearance in \printacronyms
  extra =     {(1831--1911)},
  sort =      {Van Bosscha, Johannes, Jr.},
  list =      {\href{www.google.com}{Van Bosscha, Johannes, Jr}},
  % Appearance in index
  index =     {\href{www.google.com}{Van Bosscha, Johannes, Jr.} (1831--1911)},
}

\DeclareAcronym{bosschasr}{
  short =     {Van Bosscha Sr\acdot},
  long =      {Maior van Bosscha Sr\acdot},
  long-post = {\space (1700--1831)},
  first-long-format = {\scshape},
  extra =     {(1700--1831)},
  sort =      {Van Bosscha, Maior, Sr},
  list =      {\href{www.yahoo.com}{Van Bosscha, Johannes, Sr}},
  index =     {\href{www.yahoo.com}{Van Bosscha, Johannes, Sr.} (1700--1831)},
}

\begin{document}

\chapter{Test}
And I want to test \ac{bosscha}, or either is it \ac{bosschasr}. So
the second time it is called we get: \ac{bosscha} and \ac{bosschasr}.
% Another test is \Someone and \Name[Mister]{Someone2}{ (1812-1911),
% and some text}.  Lastly, I could try a manual
% \href{www.google.nl}{\Bosscha (1831-1911)}, although I'm not sure
% this is a solution to my problem.

\clearpage

And I want to test \ac{bosscha}, or either is it \ac{bosschasr}. So
the second time it is called we get: \ac{bosscha} and \ac{bosschasr}.

\printacronyms[name=Persons of Interest]

\printindex

\end{document}

Here I've included the \printacronyms command just so you can compare it to the indexed output. (Note that the author of acro is not convinced that indexing is a useful feature, and asks for an email if you do like this option and notice any issues.)

3
  • Dear Jon, I do like this feature and it works perfectly. I' ve ran into a small problem with the hyperlinks to the pages. If names are mentioned on 3 subsequent pages then the link becomes p 1-3 for instance, where both numbers 1 and 3 are hyperlinked, but it ofcourse does not link to page 2. This is of course ugly behavior, but for all practical purposes it works awesome! Thanks!
    – Thagusta
    Jun 23, 2017 at 8:54
  • Note that after some customization I like the index style better than the printacronym style.
    – Thagusta
    Jun 23, 2017 at 9:19
  • 1
    Dear Jon, I have ran into a problem with the \printindex command. The problem is, that the index entry overwrites the sort entry. This combined with not working together well with hyperref leads to strange sorting behaviour of the index. Therefore, the index entry should be expanded like this: index = {Bemmelen@\href{dwc.knaw.nl/DL/levensberichten/PE00001577.pdf}{van Bemmelen, Jacob Maarten} (1830--1911)}. In this way, the entry gets sorted in the index at Bemmelen, which is the required behaviour.
    – Thagusta
    Jun 25, 2017 at 10:45
1

As of April 2017 the nameauth package will do most of what you asked for, except for the hyperlinks. I'm afraid that this functionality would have to wait for a future horizon.

For simplicity I did not set up the name as "Van Bosscha," as the subsequent material would suggest. There are a few different ways to do that, depending on language needs as the package docs also suggest. US English puts the particle in the surname, e.g., \noexpand\textSC{\noexpand\AltCaps{v}an Bosscha}. Other contexts leave the particle separate, either in the FNN field or alternate names field, depending on what one wants in the index. I stuck with a modified version of your MWE below, which shows roughly what one can expect currently from nameauth 3.2:

\documentclass[a4paper,oneside]{memoir}
\usepackage{geometry}

\usepackage[altformat]{nameauth}

\PretagName[Johannes]{\noexpand\textSC{Bosscha},\noexpand\textSC{Jr.}}
  {Bosscha, Johannes, Jr.}
\PretagName[Johannes]{\noexpand\textSC{Bosscha},\noexpand\textSC{Sr.}}
  {Bosscha, Johannes, Sr.}

\NameAddInfo[Johannes]{\noexpand\textSC{Bosscha},\noexpand\textSC{Jr.}}
  {(1831--1911)}
\NameAddInfo[Johannes]{\noexpand\textSC{Bosscha},\noexpand\textSC{Sr.}}
  {(1784--1874)}

\TagName[Johannes]{\noexpand\textSC{Bosscha},\noexpand\textSC{Jr.}}
  { (1831--1911)}
\TagName[Johannes]{\noexpand\textSC{Bosscha},\noexpand\textSC{Sr.}}
  { (1784--1874)}

\makeatletter % I should put the nonbreaking space below in the pkg docs
\renewcommand*\NamesFormat[1]{\begingroup%
\protected@edef\temp{\endgroup{#1~%
\noexpand\NameQueryInfo[\unexpanded\expandafter{\the\@nameauth@toksa}]
{\unexpanded\expandafter{\the\@nameauth@toksb}}
[\unexpanded\expandafter{\the\@nameauth@toksc}]}}\temp}
\makeatother

\renewcommand*\MainNameHook{\AltOn}

\begin{nameauth}
\< Bosscha   & Johannes & \noexpand\textSC{Bosscha},\noexpand\textSC{Jr.} & >
\< BosschaSr & Johannes & \noexpand\textSC{Bosscha},\noexpand\textSC{Sr.} & >
\end{nameauth}

\makeindex
\begin{document}
\AltFormatActive*
\pagestyle{plain}

\chapter{test}

I want to test \Bosscha, or either is it \BosschaSr{}.

We actually have to frustrate the punctuation detection
when adding a text tag here. I will explain this in the
docs for the next version.

The second time it is called we get: \Bosscha\ and \BosschaSr.
Again \KeepAffix\LBosscha\ and \LBosschaSr.
We can force the formatting via \ForceName\Bosscha\ and
\ForceName\BosschaSr, which is not the same as
\ForgetThis\Bosscha\ and \ForgetThis\BosschaSr{}.

\printindex
\end{document}
1
  • This solution also works perfectly, except for the hyperlink structure that I require.
    – Thagusta
    Jun 23, 2017 at 8:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .