更改参考书目中“作者年份块”的字体大小

更改参考书目中“作者年份块”的字体大小

我想知道您是否可能对如何操作以下 MWE 有任何意见,以便将以下示例中参考书目条目左侧的作者年份标签缩小到脚注大小或脚本大小以防止换行。 (我正在使用biblatex/Biber 和 XeTeX)

作者年份 [空格] 姓氏,名字 (2017)。标题。地点:出版商。

有人在论坛上写了一个很棒的代码,我在这里应用了它,除了脚本大小之外,它具有所有其他功能。

梅威瑟:

\documentclass[12pt,a4paper]{report}

\AtBeginDocument{\addbibresource{C://thesisbibfile/thesis.bib}}

\usepackage[
backend=biber,
autolang=hyphen, %which parameters are important when changing languages according to entry language id in the database
citestyle=authoryear, %style when citing, 
bibstyle=authoryear-icomp, %style in the bibliography
language=auto,
%hyperref,
autocite=inline %plain %inline / footnote
url=true, 
dashed=false,
doi=true,
sortlocale=auto,
]{biblatex}%this style compresses the numbering 


\makeatletter
\setlength{\bibitemsep}{0.5\baselineskip plus 0.5\baselineskip}

\newsavebox\ay@labelbox
\newlength{\labwidthsameline}
\setlength{\labwidthsameline}{2em}   % the {xem} defines the length of the label: best is either 2 or 9 em

\newbibmacro{labelwidthbib}{%
    \begingroup
    \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{Robertson1989}

\printbibliography
\end{document}

答案1

只需将其放入宏\scriptsizelabelwidthbib即可

\newbibmacro{labelwidthbib}{%
  \begingroup
  \scriptsize
  \delimcontext{cite}%
  \DeclareFieldFormat{bibhyperref}{##1}%
  \csuse{blx@hook@cite}%
  \csuse{blx@hook@citekey}%
  \citetrackerfalse\pagetrackerfalse\backtrackerfalse
  \defcounter{maxnames}{\blx@maxcitenames}%
  \usebibmacro{cite}%
  \endgroup
} 

biblatex-ext已经内置了此功能(相关选项称为introcite),因此代码可以大大缩短为

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[
  backend=biber,
  style=ext-authoryear-icomp,
  autocite=inline,
  introcite=label,
]{biblatex}

\addbibresource{biblatex-examples.bib}

\setlength{\bibitemsep}{0.5\baselineskip plus 0.5\baselineskip}
\setlength{\introcitewidth}{0em}
\setlength{\introcitesep}{2\biblabelsep}

\DeclareFieldFormat{bbx@introcite}{{\scriptsize #1}}

\begin{document}
\cite{sigfridsson}

\printbibliography
\end{document}

Sigfridsson 和 Ryde 1998 在 <code>\scriptsize</code> 中,下一行是完整的 bib 条目(缩进)

相关内容