3

I want to use the abbreviation F/T for a pair of authors but want to see the real names in the index. The package authorindex can do this with a special field authauthors, but we are using biblatex. Is there a way to reach the same effect with biblatex?

\documentclass[english]{scrartcl}
\listfiles
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}

@misc{FreyTappe1991,
        Author = {Frey, Werner and Tappe, Hans Thilo},
        Howpublished = {Manuskript 30. Januar 1991},
        Shortauthor = {F/T},
        authautor = {Frey, Werner and Tappe, Hans Thilo},
        Title = {{Zur Interpretation der X-bar-Theorie und zur Syntax des Mittelfeldes}},
        Year = {1991}}


\end{filecontents}

\usepackage[
  style=authoryear,
    indexing=true
]{biblatex}
\bibliography{\jobname}

\makeindex

\begin{document}
Some text \cite{FreyTappe1991}
\clearpage
Some text \cite{FreyTappe1991}

\clearpage
Some text \cite{FreyTappe1991}

\clearpage
Some text \cite{FreyTappe1991}

\clearpage
\printbibliography
%\printindex
\end{document}
Stefan Müller
  • 6,901
  • 3
  • 29
  • 61

2 Answers2

4

We can check if labelname is one of the short... names and index the full version instead. No need for an additional authautor field.

\renewbibmacro*{citeindex}{%
  \ifciteindex
    {\iffieldequalstr{labelnamesource}{shortauthor}
       {\indexnames{author}}
       {\iffieldequalstr{labelnamesource}{shorteditor}
          {\indexnames{editor}}
          {\indexnames{labelname}}}%
     \indexfield{indextitle}}
    {}}

If you have enabled indexing of the bibliography as well (you do in your example), you will need the same for bibindex:

\renewbibmacro*{bibindex}{%
  \ifbibindex
    {\iffieldequalstr{labelnamesource}{shortauthor}
       {\indexnames{author}}
       {\iffieldequalstr{labelnamesource}{shorteditor}
          {\indexnames{editor}}
          {\indexnames{labelname}}}%
     \indexfield{indextitle}}
    {}}

If you insist on a new field, you will need to define a new data model. In the MWE this is created via filecontents, but if you intend to use it productively, simply save the file indexname.dbx to a location TeX can find it. You can then explicitly give the indexed names in indexname.

\documentclass[english]{scrartcl}
\listfiles
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@misc{FreyTappe1991,
        Author = {Frey, Werner and Tappe, Hans Thilo},
        Howpublished = {Manuskript 30. Januar 1991},
        Shortauthor = {F/T},
        indexname = {Frey, Werner and Tappe, Hans Thilo},
        Title = {{Zur Interpretation der X-bar-Theorie und zur Syntax des Mittelfeldes}},
        Year = {1991}}
\end{filecontents}

\begin{filecontents}{indexname.dbx}
\DeclareDatamodelFields[type=list, datatype=name]{
  indexname}
\DeclareDatamodelEntryfields{indexname}
\end{filecontents}


\usepackage[
  style=authoryear,
  indexing=true,
  datamodel=indexname,
]{biblatex}
\bibliography{\jobname}

\usepackage{makeidx}
\makeindex

\renewbibmacro*{citeindex}{%
  \ifciteindex
    {\ifnameundef{indexname}
       {\indexnames{labelname}}
       {\indexnames{indexname}}%
     \indexfield{indextitle}}
    {}}

\renewbibmacro*{bibindex}{%
  \ifbibindex
    {\ifnameundef{indexname}
       {\indexnames{labelname}}
       {\indexnames{indexname}}%
     \indexfield{indextitle}}
    {}}

\begin{document}
Some text \cite{FreyTappe1991}
\clearpage
Some text \cite{FreyTappe1991}

\clearpage
Some text \cite{FreyTappe1991}

\clearpage
Some text \cite{FreyTappe1991}

\clearpage
\printbibliography
\printindex
\end{document}
moewe
  • 175,683
  • Thanks a lot. There is a further twist. There are people like "Carl J. Pollard", who should be indexed as "Carl Pollard". For this the authauthor field would be cool. Is there a way to test for its presence and use it if present? – Stefan Müller Nov 19 '17 at 14:25
  • Or is this a new question? – Stefan Müller Nov 19 '17 at 14:25
  • If another entry has a proper corporate author or editor, that would change their indexing too, wouldn't it? – gusbrs Nov 19 '17 at 14:26
  • 1
    @gusbrs Yes, but you could argue that that would be a good thing. (I.e. index 'National Aeronautics and Space Administration' instead of 'NASA'.) – moewe Nov 19 '17 at 14:33
  • @gusbrs Of course my comment is only valid if the corporate author uses author for the long form and shortauthor for the short form. – moewe Nov 19 '17 at 14:39
  • @StefanMüller If you want a separate field, you will need to order one, see the second part of my edited answer. – moewe Nov 19 '17 at 14:40
0

One option would be to use the shorthand field instead of shortauthor. That means the cite commands will use only the shorthand (and not the year), but it seems to be more inline with what you are intending in the case, actually. Anyway, the year can also be obtained by \citeyear (or by adding it manually to the shorthand, as suggested by moewe in the comments).

\documentclass[english]{scrartcl}
\listfiles
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}

@misc{FreyTappe1991,
        Author = {Frey, Werner and Tappe, Hans Thilo},
        Howpublished = {Manuskript 30. Januar 1991},
        shorthand = {F/T},
        authautor = {Frey, Werner and Tappe, Hans Thilo},
        Title = {{Zur Interpretation der X-bar-Theorie und zur Syntax des Mittelfeldes}},
        Year = {1991}}

\end{filecontents}

\usepackage{makeidx}

\usepackage[
  style=authoryear,
    indexing=true
]{biblatex}
\addbibresource{\jobname.bib}

\makeindex

\begin{document}
Some text \cite{FreyTappe1991}

Some text \cite{FreyTappe1991}

Some text \cite{FreyTappe1991}

Some text \cite{FreyTappe1991} \citeyear{FreyTappe1991}

\printbibliography
\printindex
\end{document}

Resulting in:

enter image description here enter image description here

gusbrs
  • 13,740
  • 1
    If there are several works by "F/T" of course one needs to add the year to the shorthand manually. – moewe Nov 19 '17 at 14:07
  • @moewe, true, of course. And your comment adds to the suggestion of using citeyear. But you got me thinking, would there be a way do add labelyear + extradate to the shorthand field directly? If so, would it be a good idea? – gusbrs Nov 19 '17 at 14:14
  • 1
    Well, you could use a sourcemap to add the labelyear to the shorthand automatically. You could also change the macros to still print the labeldate even if a shorthand is used, but then the extradate/shorthand extra info are both not the correct fields to disambiguate. – moewe Nov 19 '17 at 14:18