参考书目中没有使用 biblatex 的悬挂缩进

参考书目中没有使用 biblatex 的悬挂缩进

我尝试去掉参考书目中的悬挂缩进。biblatex手册建议这样\setlength{\bibhang}{0pt}做,但在这种情况下不起作用。

梅威瑟:

\documentclass{article}

% arara: pdflatex
% arara: biber
% arara: pdflatex

\usepackage[
    backend=biber,
    style=chem-angew,
    articletitle=true,
    defernumbers=true
]{biblatex}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@article{D04,
  author = {Duthor, D.},
  year = {2004},
  volume = {1},
  pages = {2},
  title = {Nanoscale magnetic skyrmions in metallic films and multilayers: a new twist for spintronics Nanoscale magnetic skyrmions in metallic films and multilayers: a new twist for spintronics},
}

\end{filecontents}

\addbibresource{\jobname.bib}

\setlength{\bibhang}{0pt}

\begin{document}

Some text \cite{D04}.

\printbibliography

\end{document}

如何避免参考文献的第二行(和第三行)缩进?

在此处输入图片描述

答案1

和样式bibliography的环境不使用,因为它们的工作方式更像。在这些列表中,所有行都具有相同的缩进,但第一行还有一个标签。numericalphabetic\bibhangenumerate

所以如果你想使用\bibhang你需要这样的东西

\documentclass{article}
\usepackage[
    backend=biber,
    style=chem-angew,
    articletitle=true,
    defernumbers=true
]{biblatex}

\addbibresource{biblatex-examples.bib}

\setlength{\bibhang}{0pt}
\defbibenvironment{bibliography}
  {\list
     {}
     {\setlength{\leftmargin}{\bibhang}%
      \setlength{\itemindent}{-\leftmargin}%
      \setlength{\itemsep}{\bibitemsep}%
      \setlength{\parsep}{\bibparsep}}}
  {\endlist}
  {\item
   \printtext[labelnumberwidth]{%
     \printfield{labelprefix}%
      \printfield{labelnumber}}%
   \addspace}

\begin{document}
Some text \cite{sigfridsson,cicero,worman}.

\printbibliography
\end{document}

一个更简单的解决方案是

\defbibenvironment{bibliography}
  {\trivlist}
  {\endtrivlist}
  {\item
   \printtext[labelnumberwidth]{%
     \printfield{labelprefix}%
      \printfield{labelnumber}}%
   \addspace}

答案2

解决方案在于重新定义bibenvironment

\documentclass{article}
\usepackage[showframe]{geometry}
% arara: pdflatex
% arara: biber
% arara: pdflatex

\usepackage[
    backend=biber,
    style=chem-angew,
    articletitle=true,
    defernumbers=true
]{biblatex}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@article{D04,
  author = {Duthor, D.},
  year = {2004},
  volume = {1},
  pages = {2},
  title = {Nanoscale magnetic skyrmions in metallic films and multilayers: a new twist for spintronics Nanoscale magnetic skyrmions in metallic films and multilayers: a new twist for spintronics},
}

\end{filecontents}

\addbibresource{\jobname.bib}

\defbibenvironment{bibliography}
 {\list
 {\printtext[labelnumberwidth]{%
    \printfield{labelprefix}%
    \printfield{labelnumber}}}
 {\setlength{\labelwidth}{\labelnumberwidth}%
 \setlength{\leftmargin}{0pt}%{\labelwidth}%
 \setlength{\labelsep}{\biblabelsep}%
 %\addtolength{\leftmargin}{\labelsep}%
 \setlength{\itemsep}{\bibitemsep}%
 \setlength{\parsep}{\bibparsep}}%
 \renewcommand*{\makelabel}[1]{\hss\hspace{\dimexpr\labelnumberwidth+\labelsep}##1}}
 {\endlist}
 {\item}

\begin{document}

Some text \cite{D04}.

\printbibliography

\end{document} 

在此处输入图片描述

相关内容