![natbib 不会自动缩进,并且 \bibhang 无法识别](https://linux22.com/image/282622/natbib%20%E4%B8%8D%E4%BC%9A%E8%87%AA%E5%8A%A8%E7%BC%A9%E8%BF%9B%EF%BC%8C%E5%B9%B6%E4%B8%94%20%5Cbibhang%20%E6%97%A0%E6%B3%95%E8%AF%86%E5%88%AB.png)
这是我的 MWE:
\documentclass[oneside,11pt]{book}
\usepackage[sort&compress]{natbib} % for bibliography
\begin{document}
\chapter{one}
here is some stuff and I'm going to reference \cite{Aliyu1985}.
\bibliographystyle{plain}
\bibliography{references}
\end{document}
references.bib 文件仅包含一个参考:
@inproceedings{Aliyu1985,
title="{{``Effects of Strain Rate on Delamination Fracture Toughness of Graphite/Epoxy"}}",
author="Aliyu, A.A. and Daniel, I.M.",
booktitle="Delamination and Debonding of Materials",
year="1985",
pages="336-348",
organization="American Society for Testing and Materials",
address="Philadelphia",
publisher="ASTM STP 876",
editor="W.S. Johnson, Ed.",
}
我的问题是,我试图格式化的文档是我的论文,必须符合我所在大学的格式指南。参考书目中应该出现的悬挂缩进(由 \bibhang 设置)不存在。我尝试设置长度,即
\setlength{\bibhang}{2em}
或者
\setlength{\bibhang}{0.5in}
毫无效果。我的文档超过 200 页,所以我真的不想更改文档类别或切换到 biblatex(甚至不确定这是否可行)。
有人对如何实现悬挂缩进有什么建议吗?
答案1
\bibhang
仅适用于作者年份样式,并且您使用的是plain
使用不同参数集的数字样式 ( )。您可以重新定义\NAT@bibsetnum
(给出数字样式中使用的值),以使用由 控制的所需悬挂缩进\bibindent
:
\documentclass[oneside,11pt]{book}
\usepackage[sort&compress]{natbib} % for bibliography
\setlength\bibindent{2em}
\makeatletter
\renewcommand\NAT@bibsetnum[1]{\settowidth\labelwidth{\@biblabel{#1}}%
\setlength{\leftmargin}{\bibindent}\addtolength{\leftmargin}{\dimexpr\labelwidth+\labelsep\relax}%
\setlength{\itemindent}{-\bibindent}%
\setlength{\listparindent}{\itemindent}
\setlength{\itemsep}{\bibsep}\setlength{\parsep}{\z@}%
\ifNAT@openbib
\addtolength{\leftmargin}{\bibindent}%
\setlength{\itemindent}{-\bibindent}%
\setlength{\listparindent}{\itemindent}%
\setlength{\parsep}{0pt}%
\fi
}
\makeatother
\begin{document}
\chapter{Test Chapter}
here is some stuff and I'm going to reference \cite{Aliyu1985}.
\bibliographystyle{plain}
\bibliography{references}
\end{document}
这与您的示例.bib
文件一起产生: