I am trying to reproduce my university bibliography style in biblatex.
In the bibliography, every entry is prefixed with label in parentheses which consists of institution or authors, year and cited page (optional). When there are two entries with the same institution or authors and the same year, the year should be suffixed with consecutive letters as pictured below:
At this point, the code generating bibliography looks as follows:
\defbibenvironment{bibliography}{%
\list{%
\printtext[parens]{%
\printlist{institution}%
\setunit*{\addcomma\addspace}%
\printnames[author-label][-2]{author}%
\setunit*{,\addspace}%
\printfield{year}%
\iffieldundef{thiscite}{}
{\addcomma\space\printfield{thiscite}}%
}%
\enspace---\enspace%
}{%
\setlength{\labelwidth}{\labelnumberwidth}%
\setlength{\leftmargin}{\labelwidth}%
\setlength{\labelsep}{0pt}%
\addtolength{\leftmargin}{\labelsep}%
\setlength{\itemsep}{\bibitemsep}%
\setlength{\parsep}{\bibparsep}}%
\renewcommand*{\makelabel}[1]{\hss##1}
}{\endlist}{\item}
…which produces the following:
I was only able to find partial snippets in the biblatex documentation, but there was no concrete example, so I was not able to make anything out of it.
How can I check if there are two labels with the same institution/authors and year and insert suffix after the year?
MWE
wsb.bbx:
\ProvidesFile{wsb.bbx}[2020/01/11 WSB bibliography style]
\RequireBibliographyStyle{standard}
\DeclareDatamodelFields[type=field, datatype=range, skipout=false]{thiscite}
\DeclareFieldFormat{thiscite}{\mkpageprefix{#1}}
\def\printname{\usebibmacro{name:family}{\namepartfamily}{\namepartgiven}{\namepartprefix}{\namepartsuffix}}
\DeclareNameFormat{author-label}{%
% If there are more than three names, print only the first one
\ifmorenames%
{\ifthenelse{\value{listcount}=1}
{\printname{} \bibstring{andothers}}
{}}
{\printname{}}%
}
\DeclareNameFormat{author}{%
\namepartfamily%
\ifdefvoid{\namepartgiven}
{}{\addcomma\space\namepartgiveni}%
\ifthenelse{\value{listcount}=\value{liststop}}
{}{\addcomma\space}%
\usebibmacro{name:andothers}%
}
\defbibenvironment{bibliography}{%
\list{%
\printtext[parens]{%
\printlist{institution}%
\setunit*{\addcomma\addspace}%
\printnames[author-label][-2]{author}%
\setunit*{,\addspace}%
\printfield{year}%
\iffieldundef{thiscite}{}
{\addcomma\space\printfield{thiscite}}%
}%
\enspace---\enspace%
}{%
\setlength{\labelwidth}{\labelnumberwidth}%
\setlength{\leftmargin}{\labelwidth}%
\setlength{\labelsep}{0pt}%
\addtolength{\leftmargin}{\labelsep}%
\setlength{\itemsep}{\bibitemsep}%
\setlength{\parsep}{\bibparsep}}%
\renewcommand*{\makelabel}[1]{\hss##1}
}{\endlist}{\item}
\newbibmacro*{institution+author+year}{%
\printlist{institution}%
\setunit*{\addcomma\addspace}%
\printnames{author}%
\setunit{,\addspace}%
\printfield{year}%
}
\DeclareBibliographyDriver{report}{%
\usebibmacro{institution+author+year}%
\newunit\newblock%
\printfield{title}%
\setunit{\addcomma\addspace}%
\iffieldundef{journaltitle}{}
{\usebibmacro{in:}%
\printfield{journaltitle}}%
\setunit{\addcomma\addspace}%
\printfield{number}%
\setunit{\addcomma\addspace}%
\usebibmacro{url+urldate}%
\setunit{\addcomma\addspace}%
\printfield{pages}%
\newunit\newblock%
\finentry}
mve.tex:
\documentclass[]{article}
\usepackage[
bibstyle=wsb,
sortcites=true,
sorting=nty,
]{biblatex}
\usepackage{filecontents}
\begin{filecontents*}{sample.bib}
@report{gus_2016,
title = "Działalność innowacyjna przedsiębiorstw w~latach 2013-2016",
institution = "GUS",
url = "http://stat.gov.pl/obszary-tematyczne/nauka-i-technikaspoleczenstwo-informacyjne/nauka-i-technika/dzialanosc-innowacyjnaprzedsiebiorstw-w-latach-2013-2015,2,14.html",
urldate = "2017-07-18",
thiscite = "3",
year = 2016,
}
@report{gus_2016a,
title = "Badanie organizacji i~rozkładu czasu pracy w~Polsce w~2015 roku",
institution = "GUS",
url = "http://stat.gov.pl/obszary-tematyczne/rynekpracy/opracowania/badanie-organizacji-i-rozkladu-czasu-pracy-wpolsce-w-2015-r-,12,1.html",
urldate = "2017-07-18",
thiscite = "38",
year = 2016,
}
\end{filecontents*}
\addbibresource{sample.bib}
\begin{document}
Citation number one \cite{gus_2016}.
Citation number two \cite{gus_2016a}.
\printbibliography{}
\end{document}



authoryear(check outauthoryear.bbxandauthoryear.cbx). Biber can calculate uniqueness information and add disambiguation letters where required (extradateinfo). – moewe Jan 23 '20 at 21:15