答案1
编辑:
biblatex-ext
已将此函数内置为introcite=label
。因此,下面的代码可以替换为\documentclass{article} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage[british]{babel} \usepackage{csquotes} \usepackage[style=ext-authoryear, backend=biber, introcite=label, dashed=false]{biblatex} \addbibresource{biblatex-examples.bib} \setlength{\bibitemsep}{0.5\baselineskip plus 0.5\baselineskip} \setlength{\introcitewidth}{6em} \begin{document} \cite{sigfridsson,worman,geer,knuth:ct:a} \printbibliography \end{document}
这些样式
biblatex-ext
可用作相应标准样式的直接替代品。
尝试这个
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[british]{babel}
\usepackage{csquotes}
\usepackage[style=authoryear,backend=biber,dashed=false]{biblatex}
\addbibresource{biblatex-examples.bib}
\makeatletter
\setlength{\bibitemsep}{0.5\baselineskip plus 0.5\baselineskip}
\newsavebox\ay@labelbox
\newlength{\labwidthsameline}
\setlength{\labwidthsameline}{6em}
\newbibmacro{labelwidthbib}{%
\begingroup
\delimcontext{cite}%
\DeclareFieldFormat{bibhyperref}{##1}%
\csuse{blx@hook@cite}%
\csuse{blx@hook@citekey}%
\citetrackerfalse\pagetrackerfalse\backtrackerfalse
\defcounter{maxnames}{\blx@maxcitenames}%
\usebibmacro{cite}%
\endgroup
}
%-----------------------
\newbibmacro{kicklabel}{%
\sbox\ay@labelbox{\usebibmacro{labelwidthbib}}%
\global\togglefalse{blx@insert}%
\ifdim\wd\ay@labelbox>\labwidthsameline
\leavevmode\newline
\fi
}
\defbibenvironment{bibliography}%
{\list
{\usebibmacro{labelwidthbib}}%
{\setlength{\labelwidth}{\labwidthsameline}%
\setlength{\leftmargin}{\labelwidth}%
\setlength{\labelsep}{\biblabelsep}%
\addtolength{\leftmargin}{\labelsep}%
\setlength{\itemsep}{\bibitemsep}%
\setlength{\parsep}{\bibparsep}%
\renewcommand*{\makelabel}[1]{##1\hss}}}%
{\endlist}%
{\item\usebibmacro{kicklabel}}
\makeatother
\begin{document}
\cite{sigfridsson,worman,geer,knuth:ct:a}
\printbibliography
\end{document}
这主要受到以下启发:https://github.com/LukasCBossert/biblatex-archaeologie/issues/79和https://github.com/LukasCBossert/biblatex-archaeologie/issues/58