![在 thebibliography 中使用 enumitem](https://linux22.com/image/409491/%E5%9C%A8%20thebibliography%20%E4%B8%AD%E4%BD%BF%E7%94%A8%20enumitem.png)
我正在尝试在“thebibliography”环境中设置 \labelindent 长度:
\documentclass[a4paper,12pt]{book}
\usepackage{enumitem}
\begin{document}
blblabla...
\begin{thebibliography}{300}
\addtolength{\labelwidth}{0.2in}
\addtolength{\labelindent}{0.2in}
\bibitem[PP53]{PP59} Peter Pan, 1953.
\bibitem[SB59]{SB59} Sleeping Beauty, 1959.
\end{thebibliography}
\end{document}
“thebibliography” 环境是一个列表,带有 \labelwidth 的选项可以正常工作,但 \labelindent 的顺序被忽略了。有什么想法吗?
答案1
请使用正确的选项值
\documentclass[a4paper,12pt]{book}
\usepackage{enumitem}
\usepackage{etoolbox}
\usepackage[pass, showframe]{geometry} % to show frames
\usepackage{lipsum} % for dummy text
\begin{document}
blblabla...
\begin{thebibliography}{[SB59]}
\bibitem[PP53]{PP59} Peter Pan, 1953. \lipsum[2]
\bibitem[SB59]{SB59} Sleeping Beauty, 1959.
\end{thebibliography}
\end{document}
答案2
thebibliography
标准类定义的环境包含,\@openbib@code
可以作为钩子使用。
\documentclass[a4paper,12pt]{book}
\usepackage{enumitem}
\usepackage{etoolbox}
\usepackage[pass, showframe]{geometry} % to show frames
\usepackage{lipsum} % for dummy text
\makeatletter
\apptocmd{\@openbib@code}
{\addtolength{\leftmargin}{2em}}
{}{\fail}
\makeatother
\begin{document}
blblabla...
\begin{thebibliography}{300}
\bibitem[PP53]{PP59} Peter Pan, 1953. \lipsum[2]
\bibitem[SB59]{SB59} Sleeping Beauty, 1959.
\end{thebibliography}
\end{document}