I am using the style ext-authoryear-ibid. I am trying to achieve an output like this (shorthand in "[]" if exists):
- First cite: (National Aeronautics and Space Administration [NASA], 2022, p. 12)
- Second cite: (ibid., p. 14)
- Another source: (Doe, John, 2019, p. 550)
- n-th cite: (NASA, 2022, p. 102)
Meaning, that only for the first cite, if a shorthand exists, use (1). For all subsequent cites use the shorthand only, but only if there was something cited in between. Otherwise use ibid.
I am currently some code which almost does what I want. The problem is, that it disables the ibid function. MWE:
\documentclass[
paper=A4,
fontsize=12pt,
]{article}
\usepackage[
backend=biber,
sorting=nyt,
style=ext-authoryear-ibid,
citecounter,
citetracker=true,
]{biblatex}
% Comma between title and year
\renewcommand*{\labelnamepunct}{\adddot\space}
\DeclareDelimFormat{nameyeardelim}{\addcomma\space}
% Hack for shortauthor, disables ibidem
\renewbibmacro*{cite}{%
\iffieldundef{shorthand}
{\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}
{\usebibmacro{cite:label}%
\setunit{\printdelim{nonameyeardelim}}}
{\ifboolexpr{
test{\ifnameundef{shortauthor}}
or
test{\ifciteseen}
}
{\printnames{labelname}%
\setunit{\printdelim{nameyeardelim}}}
{\printnames[labelname]{author}%
\ifnumgreater{\value{citecounter}}{1}
{\setunit{\addspace}%
\printtext[parens]{\printnames{labelname}}}%
{}%
\setunit{\printdelim{nameyeardelim}}}}%
\usebibmacro{cite:labeldate+extradate}}
{\usebibmacro{cite:shorthand}}}
\begin{filecontents*}{testbib.bib}
@online{test1,
author = {{National Aeronautics and Space Administration}},
shortauthor = {NASA},
title = {Aliens},
year = {2022}
}
@online{test2,
author = {John Doe},
title = {Generic Names},
year = {2019}
}
\end{filecontents*}
\addbibresource{testbib.bib}
\begin{document}
\parencite[][12]{test1}\par \parencite[][14]{test1} $\rightarrow$ needs to be: (ibid., 2022, p. 14)\par \parencite[][550]{test2}\par \parencite[][102]{test1}
\printbibliography
\end{document}
Thank you for your support.
![(National Aeronautics and Space Administration [NASA], 2022, p. 12)
(ibid., p. 14)
(Doe, 2019, p. 550)
(NASA, 2022, p. 102)](../../images/5bf14867eb8d9cb4eecc68698a8b1e0c.webp)
\caption{\parencite{}}(inside a figure) will introduce the first long name includingshorthandin brackets each time. I am afraid, that this can not be easily tackled by biblatex macros. But I would be happy to be proven wrong. – Peter Byron Jun 09 '22 at 13:14