0

I have a setup in which I use additional BibTeX fields for author/editor names to be used in the index (authauthor, autheditor). See Getting the name from another field indexed in biblatex. For reasons I do not understand this works with normal \cite commands but fails when I use \citeauthor. I redefined citeindex maybe this is not called for \citeauthor.

% call with
% xelatex debug-biber-authorindex.tex
% biber debug-biber-authorindex
% xelatex debug-biber-authorindex.tex
% makeindex -o debug-biber-authorindex.ind debug-biber-authorindex.idx
% xelatex debug-biber-authorindex.tex

\documentclass{article}

\begin{filecontents}{\jobname.bib}

@phdthesis{Fokkens2014a, authauthor = {Fokkens, Antske}, author = {Fokkens, Antske Sibelle}, school = {Department of Computational Linguistics, Universität des Saarlandes}, sortname = {Fokkens, Antske}, title = {Enhancing Empirical Research for Linguistically Motivated Precision Grammars}, year = {2014}}

\end{filecontents}

\begin{filecontents}{langsci.dbx} \DeclareDatamodelFields[type=list, datatype=name]{ authauthor,autheditor,sortname} \DeclareDatamodelEntryfields{authauthor,autheditor,sortname}

% for URLs like jstor URLs and MIT handle URLs, ACL antology

\DeclareDatamodelFields[type=field,datatype=literal]{ stableurl} \DeclareDatamodelEntryfields{stableurl}

% We also want to have this for books. Otherwise % % biber --validate-datamodel main % % complains.

\DeclareDatamodelEntryfields[book,proceedings]{ booktitle}

% just to get rid of warnings, authors keep supplying publishers with article entries % St. Mü, 2021-02-11 \DeclareDatamodelEntryfields[article]{ publisher}

% St. Mü. 2021-02-11 % our maintainance field. It records whether an item was reviewed or not. % \DeclareDatamodelFields[type=field,datatype=literal]{checked} \DeclareDatamodelEntryfields{checked}

% \DeclareDatamodelFields[type=field,datatype=literal]{checkedseries} % \DeclareDatamodelEntryfields{checkedseries}

% \DeclareDatamodelFields[type=field,datatype=literal]{checkednumber} % \DeclareDatamodelEntryfields{checkednumber}

% bibdesk stuff

\DeclareDatamodelFields[type=field,datatype=literal]{ bdsk-url-1, bdsk-url-2, bdsk-file-3, date-added, date-modified, read} \DeclareDatamodelEntryfields{ bdsk-url-1, bdsk-url-2, bdsk-file-3, date-added, date-modified, read}

% opt fields

\DeclareDatamodelFields[type=field,datatype=literal]{ %optdate, opteditor, optchapter, optisbn, optissn, optmonth, optpublisher, optschool, opturl, optyear}

\DeclareDatamodelEntryfields{ %optdate, opteditor, optchapter, optisbn, optissn, optmonth, optpublisher, optschool, opturl}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\ResetDatamodelConstraints

% St. Mü. 2021-02-10 \DeclareDatamodelConstraints[ article, book, inbook, bookinbook, suppbook, booklet, collection, incollection, suppcollection, manual, misc, mvbook, mvcollection, online, patent, periodical, suppperiodical, proceedings, inproceedings, reference, inreference, report, set, thesis, unpublished]{ \constraint[type=mandatory]{ \constraintfieldsxor{ \constraintfield{date} \constraintfield{year} } \constraintfield{checked} % uncomment for checking } % if there is an URL then there should be a urldate field. \constraint[type=conditional]{ \antecedent[quantifier=one]{ \constraintfield{url} } % biber/biblatex splits urldate into urlyear,urlmoth,ulrday \consequent[quantifier=all]{ \constraintfield{urlyear} \constraintfield{urlmonth} \constraintfield{urlday} } } }

\DeclareDatamodelConstraints[ article, % book, inbook, % bookinbook, % suppbook, % booklet, % collection, incollection, suppcollection, % manual, % misc, % mvbook, % mvcollection, % online, % patent, % periodical, % suppperiodical, % proceedings, inproceedings%, % reference, % inreference, % report, % set, % thesis, % unpublished ]{ \constraint[type=mandatory]{ \constraintfield{pages} % uncomment for checking } }

\DeclareDatamodelConstraints[set]{ \constraint[type=mandatory]{ \constraintfield{entryset} } }

\DeclareDatamodelConstraints[article]{ \constraint[type=mandatory]{ \constraintfield{author} \constraintfield{journaltitle} \constraintfield{title} % st. mü. 2021-02-13 yes, we want volume and number % if there is no number, the number field should be filled with "none". This will be surpressed by % an output filter. \constraintfield{volume} \constraintfield{number} \constraintfield{pages} } }

\DeclareDatamodelConstraints[book,mvbook,mvcollection,mvreference,incollection]{ \constraint[type=mandatory]{ \constraintfield{title} % Those books that are not in a series have the value none. St. Mü. 2021.02.11 % The value is suppressed by an outputfilter declaration for biblatex \constraintfield{series} } % if there is a series, there has to be a number. books without a number get the value none. % The value none is suppressed by an output filter declaration for biblatex \constraint[type=conditional]{ \antecedent[quantifier=one]{ \constraintfield{series} } \consequent[quantifier=all]{ \constraintfield{number} } } }

\DeclareDatamodelConstraints[inbook,bookinbook,suppbook]{ \constraint[type=mandatory]{ \constraintfield{author} \constraintfield{title} \constraintfield{booktitle} \constraintfield{publisher} \constraintfieldsxor{ \constraintfield{address} \constraintfield{location} } } }

\DeclareDatamodelConstraints[booklet]{ \constraint[type=mandatory]{ \constraintfieldsor{ \constraintfield{author} \constraintfield{editor} } \constraintfield{title} } }

\DeclareDatamodelConstraints[collection,reference]{ \constraint[type=mandatory]{ \constraintfield{editor} \constraintfield{title} \constraintfield{publisher} \constraintfieldsxor{ \constraintfield{address} \constraintfield{location} } } }

\DeclareDatamodelConstraints[incollection,suppcollection,inreference]{ \constraint[type=mandatory]{ \constraintfield{author} \constraintfield{editor} \constraintfield{title} \constraintfield{booktitle} %\constraintfield{series} %\constraintfield{number} \constraintfield{publisher} \constraintfieldsxor{ \constraintfield{address} \constraintfield{location} } } }

\DeclareDatamodelConstraints[dataset]{ \constraint[type=mandatory]{ \constraintfield{title} } }

\DeclareDatamodelConstraints[manual]{ \constraint[type=mandatory]{ \constraintfield{title} } }

\DeclareDatamodelConstraints[misc,software]{ \constraint[type=mandatory]{ \constraintfield{title} } }

\DeclareDatamodelConstraints[online]{ \constraint[type=mandatory]{ \constraintfield{title} \constraintfieldsor{ \constraintfield{url} \constraintfield{doi} \constraintfield{eprint} } } }

\DeclareDatamodelConstraints[patent]{ \constraint[type=mandatory]{ \constraintfield{author} \constraintfield{title} \constraintfield{number} } }

\DeclareDatamodelConstraints[periodical]{ \constraint[type=mandatory]{ \constraintfield{editor} \constraintfield{title} } }

\DeclareDatamodelConstraints[proceedings,mvproceedings]{ \constraint[type=mandatory]{ \constraintfield{title} \constraintfield{editor} \constraintfield{publisher} \constraintfieldsxor{ \constraintfield{address} \constraintfield{location} } } }

\DeclareDatamodelConstraints[inproceedings]{ \constraint[type=mandatory]{ \constraintfield{author} \constraintfield{editor} \constraintfield{title} \constraintfield{booktitle} \constraintfield{publisher} \constraintfieldsxor{ \constraintfield{address} \constraintfield{location} } } }

\DeclareDatamodelConstraints[report]{ \constraint[type=mandatory]{ \constraintfield{author} \constraintfield{title} \constraintfield{type} \constraintfield{institution} } }

\DeclareDatamodelConstraints[thesis]{ \constraint[type=mandatory]{ \constraintfield{author} \constraintfield{title} \constraintfield{type} \constraintfield{institution} } }

\DeclareDatamodelConstraints[unpublished]{ \constraint[type=mandatory]{ \constraintfield{author} \constraintfield{title} } }

\DeclareDatamodelConstraints{ \constraint[type=data, datatype=isbn]{ \constraintfield{isbn} } \constraint[type=data, datatype=issn]{ \constraintfield{issn} } \constraint[type=data, datatype=ismn]{ \constraintfield{ismn} } \constraint[type=data, datatype=pattern, pattern=\regexp{(?:sf|sm|sn|pf|pm|pn|pp)}]{ \constraintfield{gender} } } \end{filecontents}

\usepackage[ natbib=true, style=langsci-unified, citestyle=langsci-unified, datamodel=langsci, % add authauthor and autheditor as possible fields to bibtex entries backend=biber, indexing=cite, ]{biblatex}

\addbibresource{\jobname.bib}

\usepackage{index} \makeindex

\renewbibmacro*{citeindex}{% \ifciteindex {\iffieldequalstr{labelnamesource}{shortauthor} % If biblatex uses shortauthor as the label of a bibitem {\ifnameundef{authauthor} % we check whether there is something in authauthor {\indexnames{author}} % if not, we use author {\indexnames{authauthor}}} % if yes, we use authauthor {\iffieldequalstr{labelnamesource}{author} % if biblatex uses author we similarly test for % authauthor and use this field {\ifnameundef{authauthor}% if defined use authauthor {\indexnames{author}} {\indexnames{authauthor}}} % if defined use this field {\iffieldequalstr{labelnamesource}{shorteditor} % same for editor {\ifnameundef{autheditor} {\indexnames{editor}} {\indexnames{autheditor}}} {\indexnames{labelname}}}}} % as a fallback we index on whatever biblatex used. {}}

\begin{document}

Page 1.

\cite{Fokkens2014a}

\newpage

Page 2.

\cite{Fokkens2014a}

\newpage

Page 3.

\citeauthor{Fokkens2014a}

\newpage

Page 4.

\cite{Fokkens2014a}

\printbibliography

\printindex

\end{document}

Stefan Müller
  • 6,901
  • 3
  • 29
  • 61

1 Answers1

1

langsci-unified.cbx defines \citeauthor as follows

\DeclareCiteCommand{\citeauthor}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{prenote}}
  {\ifciteindex
     {\indexnames{labelname}}
     {}%
   \printtext[bibhyperref]{\printnames{labelname}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

this definition is based on the standard definition from biblatex.def

\DeclareCiteCommand{\citeauthor}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{prenote}}
  {\ifciteindex
     {\indexnames{labelname}}
     {}%
   \printnames{labelname}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

Hence, those \citeauthors have an explicit

\ifciteindex
  {\indexnames{labelname}}
  {}%

and don't use \usebibmacro{citeindex}. (I guess the idea is that citeindex would usually send both the name and the title off to the index, but for \citeauthor it is only appropriate to index the name.)

You can change that definition to use citeindex instead.

\DeclareCiteCommand{\citeauthor}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \printtext[bibhyperref]{\printnames{labelname}}}
  {\multicitedelim}
  {\usebibmacro{postnote}}
moewe
  • 175,683