\printbibliography 上的缩进

\printbibliography 上的缩进

我的 LaTeX 代码是:

\documentclass{article}
\usepackage[backend=bibtex]{biblatex}
\addbibresource{lib.bib}

\begin{document}
This is an introduction.

\setlength{\leftskip}{3cm}
This is a sub-chapter

\setlength{\leftskip}{0cm}

The bibliography is printed here:

\setlength{\leftskip}{3cm}
\nocite{*}
\printbibliography

\setlength{\leftskip}{0cm}

This is the conclusion

\end{document}

lib.bib的内容为:

    @article{article1,
    author =       "author1",
    title =        "title1",
    journal =       "journal1",
    year =          "2007",
    url =           "library.com/334"
}

@conference{conference2,
    author =       "W",
    journal =    "bookt",
    title =        "title2",
    year =          "2008"
}

输出为:

在此处输入图片描述

缩进仅对“参考”有效,其余参考书目的缩进与文档不一致。

如何使缩进起作用\printbibliography

答案1

只需在环境定义中添加\leftskip缩进即可。\leftmarginbibliography

\defbibenvironment{bibliography}
  {\list
     {\printtext[labelnumberwidth]{%
      \printfield{labelprefix}%
      \printfield{labelnumber}}}
     {\setlength{\labelwidth}{\labelnumberwidth}%
      \setlength{\leftmargin}{\labelwidth}%
      \setlength{\labelsep}{\biblabelsep}%
      \addtolength{\leftmargin}{\labelsep}%
      \addtolength{\leftmargin}{\leftskip}%<----- here
      \setlength{\itemsep}{\bibitemsep}%
      \setlength{\parsep}{\bibparsep}}%
      \renewcommand*{\makelabel}[1]{\hss##1}}
  {\endlist}
  {\item}

相关内容