# Change automatically derived citekey in biblatex with alphabetic style

I would like to change the automatically generated citation key of biblatex when using the style alphabetic. So far I only know the possibility via the field shorthand. But I would like to have the citekey automatically derived from the last name of the author and the year. If there are two authors it should be Last Name 1 and Last Name 2 and the year. If there are more than two authors it should be Last Name 1 et al. and the year. Is there e.g. the possibility to address the year and last name within a bibitem (e.g. bibauthorlastname) and do something like

@article{articleA,
title={This is a long title of article A},
author={Albert Einstein},
journal={Some scienece journal},
volume={1},
number={4},
pages={42--125},
year=1950,
publisher={Hellsevier},
shorthand = {\bibauthorlastname \bibyear}
}


Or do I have to approach the matter in a completely different way?

Here is a MWE, where the citekey entry is formatted as it should be (but not automatically).

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{lmodern}
\usepackage{filecontents}
\usepackage[
backend=biber,
bibencoding=utf8,
style=alphabetic
]{biblatex}

\begin{filecontents*}{\jobname.bib}
@article{articleA,
title={This is a long title of article A},
author={Albert Einstein},
journal={Some scienece journal},
volume={1},
number={4},
pages={42--125},
year=1950,
publisher={Hellsevier},
shorthand = {Einstein 1950}
}

@article{articleB,
title={This is a long title of article B},
author={Ludwig Boltzmann and Erwin Schrödinger},
journal={Another science journal},
volume={42},
number={1},
pages={43--49},
year=1970,
publisher={Hellsevier},
shorthand = {Boltzmann and Schrödinger 1970}
}

@article{articleC,
title={This is a long title of article C},
author={Ludwig Boltzmann and Erwin Schrödinger and Werner Heisenberg},
journal={Another science journal},
volume={4},
number={1},
pages={10--50},
year=1980,
publisher={Hellsevier},
shorthand = {Boltzmann et al. 1980}
}
\end{filecontents*}

\begin{document}
This is a test for citation \cite{articleA}. And here is another test \cite{articleB} and also \cite{articleC}.
\printbibliography
\end{document}


• Does this answer your question? maxnames in biber – Marijn Jan 17 '20 at 15:23
• From there: in biblatex the maxnames option controls when the names will be shown in full and when et al is used in the citations. – Marijn Jan 17 '20 at 15:24
• @Marijn On the other hand the OP uses style=alphabetic, which is not affected by maxnames. – moewe Jan 17 '20 at 15:31
• @moewe I see, I overlooked that. However, he could use authoryear instead, as you show in your answer. – Marijn Jan 17 '20 at 15:34
• @Marijn Quite, but then some additional work is needed to get the desired output, so I would be reluctant to close this question as a duplicate of tex.stackexchange.com/q/103933/35864 – moewe Jan 17 '20 at 15:35

The style you describe is an author-year style, so it seems more straigtforward to base it on style=authoryear rather than style=alphabetic.

If you want to retain the square brackets around citations and the repetition of the citation label in the bibliography, I suggest you have a look at biblatex-ext's ext-authoryear style. Its citation delimiter feature makes it easy to obtain square brackets instead of the usual round brackets (with \DeclareOuterCiteDelims), its introcite option makes it easy to repeat the citation label in the bibliography.

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

\usepackage[
backend=biber,
style=ext-authoryear,
maxcitenames=2, mincitenames=1,
uniquelist=false,
maxbibnames=999,
introcite=label,
]{biblatex}

\DefineBibliographyStrings{german}{
}

\DeclareOuterCiteDelims{parencite}{\bibopenbracket}{\bibclosebracket}
\DeclareFieldFormat{bbx@introcite}{\mkbibbrackets{#1}}

\begin{filecontents*}{\jobname.bib}
@article{articleA,
title     = {This is a long title of article A},
author    = {Albert Einstein},
journal   = {Some Science Journal},
volume    = {1},
number    = {4},
pages     = {42--125},
year      = 1950,
}
@article{articleB,
title   = {This is a long title of article B},
author  = {Ludwig Boltzmann and Erwin Schrödinger},
journal = {Another Science Journal},
volume  = {42},
number  = {1},
pages   = {43--49},
year    = 1970,
}
@article{articleC,
title   = {This is a long title of article C},
author  = {Ludwig Boltzmann and Erwin Schrödinger and Werner Heisenberg},
journal = {Another Science Journal},
volume  = {4},
number  = {1},
pages   = {10--50},
year    = 1980,
}
\end{filecontents*}

\begin{document}
This is a test for citation \autocite{articleA}.
And here is another test \autocite{articleB}
and also \autocite{articleC}.

\printbibliography
\end{document}


• Is there a way to implement the whole thing without using biblatex-ext? The problem is that the ShareLaTeX instance I am working on probably uses an older Tex distribution that does not include the package. I tried to copy the relevant content from the package into the code above to make it available, but I didn't get anywhere. – Nico Jan 24 '20 at 14:17
• @Nico Are you using ShareLaTeX on a server of your university/institution? The online version of ShareLaTeX merged with Overleaf a while ago and Overleaf just got TeX live 2019 (overleaf.com/blog/tex-live-2019-upgrade-january-2020) (biblatex-ext is included in TeX live 2019 and in updated versions of TeX live 2018), so if you start a new project there, you should be able to use biblatex-ext. Unfortunately, the code for the two main features used here is quite elaborate and porting it to an (to me unknown and untestable) version of LaTeX is a pain. – moewe Jan 24 '20 at 14:47
• Yes, we operate our own ShareLaTeX server at our institute. Unfortunately, I have no access rights to the administration of the server, so I can't make updates or install packages manually. My own packages are simply uploaded as .sty files to my projects, so I thought that this might be possible with biblatex-ext as well. – Nico Jan 24 '20 at 15:08
• Just adding \usepackage{hyperref} to your MWE links only the "date-part" of the shorthand. Is it possible to have the whole shorthand linked? – Nico Mar 9 '20 at 15:27
• @Nico Theoretically yes, but it can be tricky, so my advice is to accept the status quo. If you absolutely want to have links that extend to the author name, my go-to link is tex.stackexchange.com/q/15951/35864. If that does not work I suggest you open a new question. – moewe Mar 9 '20 at 16:28