9

I have configured my bibliography to show

  • all authors for up to 8 authors
  • 3 authors et al. if there are more authors

This works mostly well, however there are edge cases where my bib entries have less than 8 authors followed by and others. Currently these are treated as if they have less than 8 authors, however I'd like that they would also be shown as 3 authors et al. (One can assume that all entries ending with and others have significantly more authors than 8, so it will never occur that bib entries ending with and others would have less than 8 authors in total.)*

To avoid problems with how to sort the and others in relation to real author names, I'd like to sort only by visible author names, this means up to 8 authors for small other papers, up to 3 names for long author lists.

\documentclass{article}

\usepackage[T1]{fontenc}     
\usepackage[utf8]{inputenc}     
\usepackage[english]{babel}

\usepackage[
    style=authoryear,       
    maxbibnames=8,  
    minbibnames=3,  
    uniquelist=false,
]{biblatex}

\usepackage{filecontents}
\begin{filecontents*}{test.bib}
@ARTICLE{foo,
    author = {Ab, X. and Ah, X. and Ai, X. and An, X. and Ar, X. and Ar, X. and Ar, X. and Ar, X. and Ba, X. and others},
    year = 2018,
    title = {foo}
}

@ARTICLE{bar,
    author = {Ab, X. and Ah, X. and Ai, X. and An, X. and Ar, X. and Ar, X. and others},
    year = 2019,
    title = {bar}
}

@article{alice,
    author = {Ab, X. and Ah, X. and Ai, X. and An, X. and Ar, X. and Ar, X. and Ar, X. and Ar, X. and others},
    year = 2018,
    title = {alice} 
}
\end{filecontents*}

\addbibresource{test.bib}

\begin{document}

    \cite{alice} \cite{foo} \cite{bar}
    \printbibliography

\end{document}

enter image description here

(*) I know that I could go though my long bib file and add at least 8 authors to each entry, but would require a lot of time and it feels pointless if these names will never be displayed

EDIT

What I have tried so far is to replace and others with ...and Ar, X. and others and others and others and others and others and others and others and others to get more than 8 authors, but unfortunately additional others don't seem to count :(

Bernard
  • 271,350
  • Interesting question. For the biblatex side I could find an ugly hack by modifying the internal \blx@namesetup (there might be a more elegant way, though). But for the Biber side of things (sorting) things are more tricky. – moewe Apr 12 '19 at 11:21
  • @moewe If it would things easier, I'd also be fine with a solution that sorts all entries only by the first 3 or even first author only. –  Apr 12 '19 at 11:23
  • @moewe yes, in theory I know that they are bad, ADS unfortunately adds them and my regex foo is not strong enough to automatically get rid of them –  Apr 12 '19 at 11:24
  • @moewe I removed the {} from my MWE –  Apr 12 '19 at 11:27
  • Too bad. The ADS format is quite a headache (see also https://tex.stackexchange.com/q/386053/35864). Then my comment should only be a warning for others reading this question. – moewe Apr 12 '19 at 11:27
  • @moewe Interesting question, there seems to be many things to learn. I will read it carefully. –  Apr 12 '19 at 11:28
  • If you always give at least three real authors before you write and others you can use Biber's sourcemaps to replace and others with eight fake names. Then truncation in the bibliography and sorting will be as expected. Obviously this does not work if you only have one or two names before an and others because that would cause a few of the fake authors to sneak in, furthermore this would be problematic with other uniquelist settings, so it is not really portable. – moewe Apr 12 '19 at 11:30
  • @moewe I have at least 3 real authors before and others, so this might work. Would it be possible to see and example? I'm not really familiar with how sourcemaps etc work. –  Apr 12 '19 at 11:33

1 Answers1

4

I am not aware of a nice solution to your problem that solves all issues at once.

Under the following two assumptions I can offer an ugly, but simple work-around

  1. Whenever you use an explicit and others in a name field you must give at least three names (more specifically, you must give at least minbibnames names).
  2. The uniquelist feature is turned off completely with uniquelist=false (this is already the case in your MWE).

We can then simply replace and others in a name field with a list of eight fake names via a Biber sourcemap. The assumptions 1 and 2 together with the (min|max)names settings then guarantee that the fake names are never seen or used for sorting. They are just there to make biblatex and Biber see enough names for truncation.

The assumptions and general set-up of your question may not always be satisfied, so I can not wholeheartedly recommend this approach for general use.

The foreach=setnames/fieldsource=\regexp{$MAPLOOP} combination applies the map to each name field known to Biber (author, editor, translator, ...). match=\regexp{and\x{20}others\Z} (maybe use \s+ instead of \x{20}, or at least \x{20}+?) matches the string and others at the end of the field and replaces it with the eight fake names.

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}

\usepackage[%
  style=authoryear,
  maxbibnames=8,
  minbibnames=3,
  uniquelist=false,
]{biblatex}

\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map[foreach=setnames]{
      \step[fieldsource=\regexp{$MAPLOOP}, match=\regexp{and\x{20}others\Z},
            replace={Fake One and Fake Two and Fake Three and Fake Four
                     and Fake Five and Fake Six and Fake Seven and Fake Eight}]
    }
  }
}

\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@article{foo,
  author = {Ab, X. and Ah, X. and Ai, X. and An, X. and Ar, X.
            and Ar, X. and Ar, X. and Ar, X. and Ba, X. and others},
  year   = 2018,
  title  = {foo},
}
@article{bar,
  author = {Ab, X. and Ah, X. and Ai, X. and An, X. and Ar, X.
            and Ar, X. and others},
  year   = 2019,
  title  = {bar},
}
@article{alice,
  author = {Ab, X. and Ah, X. and Ai, X. and An, X. and Ar, X.
            and Ar, X. and Ar, X. and Ar, X. and others},
  year   = 2018,
  title  = {alice},
}
\end{filecontents*}

\addbibresource{\jobname.bib}

\begin{document}
  \cite{alice,foo,bar}
  \printbibliography
\end{document}

Ab et al. 2018a; Ab et al. 2018b; Ab et al. 2019//References//Ab, X., X. Ah, X. Ai, et al. (2018a). “alice”. In://Ab, X., X. Ah, X. Ai, et al. (2018b). “foo”. In://Ab, X., X. Ah, X. Ai, et al. (2019). “bar”. In:


Alternatively, the following hack

\makeatletter
\def\blx@namesetup#1#2#3{%
  \def\currentname{#3}%
  \c@listcount\@ne
  \c@listtotal\csname c@#3\endcsname
  \blx@namesetup@i{#3}%
  \iftoggle{abx@bool@more#3}% <- this test is new
    {\c@listtotal\@m}
    {}%
  \ifblank{#1}
    {\c@liststart\@ne}
    {\ifnum#1<\@ne
       \c@liststart\@ne
     \else
       \c@liststart#1\relax
     \fi}%
  \ifblank{#2}
    {\c@liststop\c@listtotal
     \ifnum\c@liststop>\c@maxnames
       \c@liststop\c@minnames
       \ifnum\c@uniquelist>\c@liststop
         \c@liststop\c@uniquelist
       \fi
     \fi}
    {\ifnum#2>\c@listtotal
       \c@liststop\c@listtotal
     \else
       \ifnum#2<\@ne
         \c@liststop\@ne
       \else
         \c@liststop#2\relax
       \fi
     \fi}%
  \blx@namecodes}
\makeatother

would cause biblatex to treat a name list with explicit and others as consisting of 1000 names (and hence truncating it as desired). But because this happens on the biblatex side only, it is too late for sorting (which is done by Biber). That means the order of the entries will be seemingly random, which is usually a bad idea. In the upcoming biblatex/Biber version that could be partly remedied by setting maxsortnames to a lower value (3 I guess), but that would sort lists with between three and eight authors only by the first three names even though all names are displayed. So I can't really recommend this approach, either.


If you think the desired behaviour is useful for other people as well (because it is common practice in your field, required by a certain journal, ...) is useful, I'd like to urge you to open a feature request at https://github.com/plk/biblatex/issues.

moewe
  • 175,683