Fix citation keys

This commit is contained in:
2024-09-30 14:09:51 +02:00
parent 4c7eca5804
commit eb5514622b

View File

@@ -1,48 +1,35 @@
\usepackage[ \usepackage[
backend=biber, backend=biber,
style=alphabetic, style=ext-authoryear-comp,
backref=true,% Show page numbers where citations appear backref=true,% Show page numbers where citations appear
maxbibnames=99,% Show all authors in bibliography maxbibnames=99,% Show all authors in bibliography
maxalphanames=1,% Show only one author in citations keys maxalphanames=1,% Show only one author in citations keys
maxcitenames=1,% Show only one authors in citations in text maxcitenames=1,% Show only one authors in citations in text
uniquelist=false, % Force to show only one author in citations
]{biblatex} ]{biblatex}
% Define citation style to be [Author, Year] % Use square brackets instead of parentheses for citations (https://tex.stackexchange.com/a/499667)
% From https://tex.stackexchange.com/a/176119 \DeclareOuterCiteDelims{cite}{\bibopenbracket}{\bibclosebracket}
\DeclareLabelalphaTemplate{ \DeclareInnerCiteDelims{textcite}{\bibopenbracket}{\bibclosebracket}
\labelelement{% Author \DeclareOuterCiteDelims{parencite}{\bibopenbracket}{\bibclosebracket}
\field[final]{shorthand}
\field{labelname}
\field{label}
}
\labelelement{% Comma
\literal{,\addhighpenspace}
}
\labelelement{% Year
\field{year}
}
}
\DeclareLabelalphaNameTemplate{% Use prefix + family name for 'Author' in citation keys
\namepart[use]{prefix}
\namepart{family}
}
\renewcommand*{\labelalphaothers}{} % Remove "et al." in citation keys
% Define \textcite to be Author [Yeara] (magically defined by Copilot) \DeclareDelimFormat{nameyeardelim}{\addcomma\space} % Add comma between author and year in citations
\DeclareCiteCommand{\textcite}
{\usebibmacro{prenote}} % Include the author's name in the hyperlink to the reference (https://tex.stackexchange.com/a/499667)
{% \DeclareFieldFormat{linkallcite}{%
\ifciteindex{\indexnames{labelname}}{}% \DeclareFieldFormat{bibhyperref}{##1}%
\bibhyperref{\printnames{labelname}}% Author \bibhyperref{#1}%
\setunit{\addspace}% Space }
\printtext[brackets]{\bibhyperref{\printdateextra}}% Year \AtIntrocite{\DeclareFieldFormat{linkallcite}{#1}}
\letbibmacro{oldcite}{cite}
\renewbibmacro{cite}{%
\printtext[linkallcite]{\usebibmacro{oldcite}}%
} }
{\multicitedelim}
{\usebibmacro{postnote}}
% Remove some fields from bibliography % Remove some fields from bibliography
\AtEveryBibitem{ \AtEveryBibitem{
\ifentrytype{book}{}{ \ifentrytype{book}{}{ % Keep ISBN only for books
\clearfield{isbn}% \clearfield{isbn}%
} }
\clearfield{day}% \clearfield{day}%