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!

  • Can't you just use style=authoryear, instead of bibstyle=alphabetic, citestyle=alphabetic,? – moewe Mar 7 '16 at 17:52
  • Wish that I could, but I need the labels and bracketed inline citations (see edit). – jamieil Mar 7 '16 at 17:59
  • You can get bracketed citations if you define a command analogous to \parencite, see \renewcommand \cite[99]{Turing} vs. \cite{Turing}. You can even the block in the bibliography: Adding an AuthorYear block at the beginning of bibliography entries. – moewe Mar 7 '16 at 18:04
  • 1
    This isn't possible with label templates - you can't insert a character between names in a name list. I will probably add this as an option in the next dev release shortly. – PLK Mar 8 '16 at 0:06
  • That would come in really handy! Any chance that this will have happened by the end of march? Otherwise, I would try moewe's approach and see where I can get. – jamieil Mar 8 '16 at 6:40
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}}
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.