0

Depending on the number of authors of a publication, I would like to get labels used by the "bibstyle=alphabetic" option and inline-citations to look like this:

One author -> [Doe 2016]

Two authors -> [Doe1/Doe2 2016]

Three or more authors-> [Doe1 et al. 2016]

I tried to implement this using \DeclareLabelalphaTemplate, but since it does not seem to support conditional expressions, did not succed.

This is what I got so far:

\documentclass{article}
\usepackage{filecontents}

\begin{filecontents*}{\jobname.bib}
@document{one,
  author = {Firstname1 Lastname1},
  title = {One Author},
  year = {2001},
}
@document{two,
  author = {Firstname1 Lastname1 and Firstname2 Lastname2},
  title = {Two Authors},
  year = {2002},
}
@document{three,
  author = {Firstname1 Lastname1 and Firstname2 Lastname2 and Firstname3 Lastname3},
  title = {Three Authors},
  year = {2003},
}
}
\end{filecontents*}

\usepackage[
backend=biber,
    bibstyle=alphabetic,
    citestyle=alphabetic,
    maxcitenames=2,
    maxbibnames=6
    ]{biblatex}

\addbibresource{\jobname.bib}

\renewcommand{\labelalphaothers}{\addspace et al.} %use et al. for more than maxcitenames=2 authors

\DeclareLabelalphaTemplate{
  \labelelement{\field[ifnames=3,names=1]{labelname}}
  \labelelement{\field[ifnames=2,names=1]{labelname}}
  \labelelement{\field[ifnames=1]{labelname}
                \literal{/}}
  \labelelement{\field[ifnames=2,noalphaothers=true]{labelname}}
  \labelelement{\literal{\addspace}} 
  \labelelement{\field{year}}
  }


\begin{document}
\nocite{*}

\printbibliography
\end{document}

Using biblatex v3.3 and biber 2.4, this gives

enter image description here

which is clearly not as I have hoped for. Any advice would be really appreciated!

1 Answers1

1

With biblatex 3.4/biber 2.5 (now in developement folder on Sourceforge), simply do this:

\usepackage[style=alphabetic, maxalphanames=2, minalphanames=1]{biblatex}

\renewcommand{\labelalphaothers}{\addspace et al.}

\DeclareLabelalphaTemplate{
  \labelelement{\field[namessep=/]{labelname}}
  \labelelement{\literal{\addspace}} 
  \labelelement{\field{year}}
}
PLK
  • 22,776