1

When using more than 1 references that have the same author and created in the same year, usually the references are sorted by title and a letter is added after the year to differentiate them in citations.

For example, here's a MWE:

\documentclass{article}
\usepackage[backend=bibtex,
            bibstyle=authoryear,
            citestyle=authoryear,
            sorting=nyt,
            dashed=false]{biblatex}
\bibliography{myref}
\usepackage{filecontents}

\begin{filecontents}{myref.bib}
@inproceedings{someone:2000:xx,
    author = {Some Researcher},
    title = {Some Important Paper},
    year = {2000},
    booktitle = {Proc. of Some Cool Conference},
    pages = {123--126}
}

@inproceedings{someone:2000:yy,
    author = {Some Researcher},
    title = {Some Other Important Paper},
    year = {2000},
    booktitle = {Proc. of Some Other Cool Conference},
    pages = {123--126}
}
\end{filecontents}

\begin{document}

\cite{someone:2000:xx}
\cite{someone:2000:yy}

\printbibliography

\end{document}

it appears in my bibliography like this:

my bibliography

I would like the letters after years to be capitalized so it will be (2000A) and (2000B) instead of (2000a) and (2000b) because that's my thesis format as written in the guidelines. Any help is appreciated, thanks in advance!

3
  • 1
    Welcome to TeX.SX! Please post a minimal working example (MWE) instead of just code snippets. The example should be complete (i.e. compilable as is; it should start with \documentclass and end with \end{document}) and only contain what's necessary to reproduce your problem. (Here's an example of how to do that with a bibliography.) This makes it easier for us to reproduce your problem and test our solutions.
    – schtandard
    May 25 '20 at 10:30
  • 1
    As a side note: any reason why you are using bibtex instead of the preferred biber?
    – schtandard
    May 25 '20 at 10:31
  • Hi! Thanks for the comment. I've replaced the code snippets with an MWE. As for why I'm using bibtex and not biber, well, to be honest I'm currently using a template which was used by my seniors in previous years, so I just kinda stick with it. But the rules/writing format has changed since then and I had to do minor revisions myself hence this question.
    – didi1311
    May 25 '20 at 15:12
1

The format of the extra letter is controlled by the extradate field format. By default it uses \mknumalph, which produces a small Latin letter from a given number. We can copy the definition of \mknumalph to get a \mknumAlph which produces capital Latin letters and use that in the format.

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[style=authoryear, backend=biber]{biblatex}

\DeclareFieldFormat{extradate}{%
  \iffieldnums{labelyear}
    {\mknumAlph{#1}}
    {\mkbibparens{\mknumAlph{#1}}}}

\makeatletter
\newrobustcmd*{\mknumAlph}[1]{%
  \begingroup
  \blx@tempcnta=#1\relax
  \ifnum\blx@tempcnta>702 %
  \else
    \ifnum\blx@tempcnta>26 %
      \advance\blx@tempcnta\m@ne
      \divide\blx@tempcnta26\relax
      \blx@numalph\blx@tempcnta
      \multiply\blx@tempcnta26\relax
      \blx@tempcnta=\numexpr#1-\blx@tempcnta\relax
    \fi
  \fi
  \blx@numAlph\blx@tempcnta
  \endgroup}
\def\blx@numAlph#1{%
  \ifcase#1\relax\blx@warning@entry{Value out of range}\number#1\or
  A\or B\or C\or D\or E\or F\or G\or H\or I\or J\or K\or L\or M\or
  N\or O\or P\or Q\or R\or S\or T\or U\or V\or W\or X\or Y\or Z\else
  \blx@warning@entry{Value out of range}\number#1\fi}
\makeatother


\addbibresource{biblatex-examples.bib}


\begin{document}
\autocite{knuth:ct:b,knuth:ct:c}
\printbibliography
\end{document}

(Knuth 1986A; Knuth 1986B)


For a shorter implementation of \mknumAlph you can use expl3

\usepackage{expl3}
\usepackage{xparse}
\ExplSyntaxOn
\NewExpandableDocumentCommand{\mknumAlph}{m}{\int_to_Alph:n{#1}}
\ExplSyntaxOff
1
  • Or also \makeatletter\newcommand[\mknumAlph}[1]{\@Alph{#1}}\makeatother, assuming that there are no more than 26 entries with the same year. However this could conflict with some babel modules that do devious things to \@Alph.
    – egreg
    May 25 '20 at 16:16

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.