biblatex 参考书目列表的左边距对齐

biblatex 参考书目列表的左边距对齐

可能重复:
将 biblatex 标签移至边缘

biblatex是否有一个简单的解决方案,可以强制将参考书目列表(通过)的数字\printbibliography放入左列,以便条目的文本与文档中其余文本对齐?

我想制作

   References
1. Last, F. M.; Last, F. M., Title; Publisher: City, Year, pages.
2. Last, F. M.; Last, F. M., Title; Publisher: City, Year, pages.

而不是通常的

References
1. Last, F. M.; Last, F. M., Title; Publisher: City, Year, pages.
1. Last, F. M.; Last, F. M., Title; Publisher: City, Year, pages.

似乎使用我之前的问题中的解决方案“如何在左边距对齐章节标题和列表环境?“不起作用,所以我假设生成参考书目列表不仅仅是声明一个简单的枚举列表。

答案1

答案取决于您使用哪种参考书目样式biblatex;在这种情况下,您似乎正在考虑numeric,因此:

\documentclass[12pt]{article}

\usepackage[showframe]{geometry}
\usepackage[backend=biber, style=numeric]{biblatex}
\addbibresource{biblatex-examples.bib}% from biblatex

\DeclareFieldFormat{labelnumberwidth}{#1\adddot}% forgot this; from Audrey's comment 

% default bibliography environment (from biblatex.sty)
\defbibenvironment{bibliography} 
  {\list{}{%
     \leftmargin\bibhang 
     \itemindent-\leftmargin 
     \itemsep\bibitemsep
      \parsep\bibparsep}}
  {\endlist}
  {\item}

% 'numeric' bibliography environment (from numeric.bbx)
\defbibenvironment{bibliography}
  {\list
     {\printtext[labelnumberwidth]{%
        \printfield{prefixnumber}%
        \printfield{labelnumber}}}
     {\setlength{\labelwidth}{\labelnumberwidth}%
      \setlength{\leftmargin}{\labelwidth}%
      \setlength{\labelsep}{\biblabelsep}%
%      \addtolength{\leftmargin}{\labelsep}%
      \addtolength{\leftmargin}{-\labelsep}% <-- changed
      \setlength{\itemsep}{\bibitemsep}%
      \setlength{\parsep}{\bibparsep}}%
      \renewcommand*{\makelabel}[1]{\hss##1}}
  {\endlist}
  {\item}

\begin{document}

\nocite{companion,cotton,gonzalez,hammond,iliad,knuth:ct,knuth:ct:a,
  knuth:ct:b, knuth:ct:c, knuth:ct:d, knuth:ct:e}%
\printbibliography

\end{document}

相关内容