83 lines
2.1 KiB
TeX
83 lines
2.1 KiB
TeX
\usepackage[
|
|
backend=biber,
|
|
style=ext-alphabetic,
|
|
backref=true,% Show page numbers where citations appear
|
|
maxbibnames=99,% Show all authors in bibliography
|
|
maxalphanames=1,% Show only one author in citations keys
|
|
maxcitenames=1,% Show only one authors in citations in text
|
|
uniquelist=false% Force to show only one author in citations
|
|
]{biblatex}
|
|
|
|
% Define citation style to be [Author Year]
|
|
% From https://tex.stackexchange.com/a/176119
|
|
\DeclareLabelalphaTemplate{%
|
|
\labelelement{% Author
|
|
\field[final]{shorthand}%
|
|
\field{labelname}%
|
|
\field{label}%
|
|
}%
|
|
\labelelement{% Space
|
|
\literal{\addhighpenspace}%
|
|
}%
|
|
\labelelement{% Year
|
|
\field{year}%
|
|
}%
|
|
}
|
|
|
|
% Use prefix + family name for 'Author' in citation keys
|
|
\DeclareLabelalphaNameTemplate{%
|
|
\namepart[use]{prefix}%
|
|
\namepart{family}%
|
|
}
|
|
|
|
\renewcommand*{\labelalphaothers}{\ et~al.}% Use "et al." in citation keys
|
|
|
|
% Define \textcite to be Author [Yeara] (magically defined by Copilot)
|
|
\DeclareCiteCommand{\textcite}
|
|
{\usebibmacro{prenote}}
|
|
{%
|
|
\ifciteindex{\indexnames{labelname}}{}%
|
|
\bibhyperref{\printnames{labelname}}% Author
|
|
\setunit{\addspace}% Space
|
|
\printtext[brackets]{\bibhyperref{\printdateextra}}% Year
|
|
}
|
|
{\multicitedelim}
|
|
{\usebibmacro{postnote}}
|
|
|
|
% Remove some fields from bibliography
|
|
\AtEveryBibitem{
|
|
\ifentrytype{book}{}{% Keep ISBN only for books
|
|
\clearfield{isbn}%
|
|
}%
|
|
\clearfield{day}%
|
|
\clearfield{doi}%
|
|
\clearlist{editor}%
|
|
\clearfield{extra}%
|
|
\clearfield{location}%
|
|
\clearfield{month}%
|
|
\clearfield{series}%
|
|
\clearlist{publisher}%
|
|
\clearfield{url}%
|
|
}
|
|
|
|
% References section (https://tex.stackexchange.com/a/298992)
|
|
% tex-fmt: off
|
|
\setlength{\biblabelsep}{2\labelsep}%
|
|
\defbibenvironment{bibliography}{%
|
|
\list{%
|
|
\printtext[labelalphawidth]{%
|
|
\printfield{prefixnumber}%
|
|
\printfield{labelalpha}%
|
|
\printfield{extraalpha}%
|
|
}%
|
|
}{%
|
|
\setlength{\labelsep}{\biblabelsep}%
|
|
\setlength{\leftmargin}{\labelsep}%
|
|
\setlength{\itemsep}{\bibitemsep}%
|
|
\setlength{\parsep}{\bibparsep}%
|
|
}%
|
|
\renewcommand*{\makelabel}[1]{##1\hss}%
|
|
}{\endlist}%
|
|
{\item}%
|
|
% tex-fmt: on
|