我想打印不缩进的参考文献部分。我找到了有关如何缩进 bib 项目的信息,但没有找到有关我的问题的信息。我试图让第二行参考文献不缩进,以遵守命令提供的文档其余部分的边距限制\geometry{verbose,tmargin=1.25in,bmargin=1.25in,lmargin=1.4in,rmargin=1.15in}
。'bibliography' 文件包含我的参考文献。非常感谢!这是我的 MWE:
\documentclass[12pt]{report}
\usepackage[letterpaper]{geometry}
\geometry{verbose,tmargin=1.25in,bmargin=1.25in,
lmargin=1.4in,rmargin=1.15in}
\usepackage[doublespacing]{setspace}
\usepackage{indentfirst}
\begin{document}
Text goes here. ..\cite{ito92, joannopoulos95}
Here, n describes the increase in P1 by nucleation. The gain
($gP_{L-1}$) and loss ($-P_{L}$) terms are due to subunit addition.
\bibliographystyle{unsrt}
\bibliography{references}
\end{document}
答案1
注意:这是非常 hack 的。也许有更聪明的方法来做到这一点。无论如何:
\documentclass[12pt]{report}
\usepackage[letterpaper]{geometry}
\geometry{verbose,tmargin=1.25in,bmargin=1.25in,
lmargin=1.4in,rmargin=1.15in}
\usepackage[doublespacing]{setspace}
\usepackage{indentfirst}
\usepackage{enumitem}
\makeatletter
\renewenvironment{thebibliography}[1]
{\chapter*{\bibname}%
\setbox2\hbox{\@biblabel{#1}}
\@mkboth{\MakeUppercase\bibname}{\MakeUppercase\bibname}%
\begin{enumerate}[itemindent=!,leftmargin=0pt,label={\@biblabel{\@arabic\c@enumiv}\setbox2\hbox{\@biblabel{\@arabic\c@enumiv}}\hspace{\labelwidth}\hspace{-\wd2}},labelwidth=\wd2]
\usecounter{enumiv}%
\sloppy
\clubpenalty4000
\@clubpenalty \clubpenalty
\widowpenalty4000%
\sfcode`\.\@m}
{\def\@noitemerr
{\@latex@warning{Empty `thebibliography' environment}}%
\end{enumerate}}
\makeatother
\begin{document}
Text goes here. ..\cite{ito92, joannopoulos95}
Here, n describes the increase in P1 by nucleation. The gain ($gP_{L-1}$) and loss ($-P_{L}$) terms are due to subunit addition.
\bibliographystyle{unsrt} \bibliography{references}
\begin{thebibliography}{11}
\bibitem{ito92}
Foo Bar Baz,
\emph{Lorem Ipsum dolor sit amet},
Consectetuer editions,
March 24th, 1993,
Rivendell.
\bibitem{mu}
qef
\bibitem{2424}
oihoiwrgh
\bibitem{qeqefqe}
3t31tsef
\bibitem{214}
qeeqfr
\bibitem{1235689}
12345678900987654321
\bibitem{3215}
asdsad
\bibitem{124124}
14124124
\bibitem{134134}
adgvadagd
\bibitem{foobarbazbellheisenbug}
Schrodinbug Heisenbug Schrodinbug Lorem ipsum dolor sit amet consectetuer adipiscing elit foobar
\end{thebibliography}
\end{document}
我重新定义了书目环境以使用enumerate
来自的环境enumitem
,并摆弄参数,设法获得所需的结果。许多代码片段都是从来自的书目环境的定义中复制而来的report
。我的编辑是在从\setbox1
到的部分\usecounter
。在那里,我将框 1 设置为,\@biblabel{#1}
这是类先前设置的正确标签宽度。\@mkboth
不在类中。然后我们有了列表。选项itemindent
和leftmargin
按照“原始答案”的建议进行设置这里,所以感谢 karlkoeller。label=
是从课堂上抄袭过来的,虽然这\hspace
是解决评论截图中问题的方法,或者更确切地说是变体1稍微偏向左边距的右侧:基本上它放置了足够的空间来对齐1第二行。labelwidth=
将列表开始时框 1 的宽度(因此框 1 是由 设置的\setbox1
)作为其值。因此,在本例中,标签宽度是 [10] 的宽度,但是当标签更紧时,它不会向右刷新,而是\hspace
插入一个使其在左侧完全对齐的 。输出如下:
是吗?
简化版本仍然使用enumitem
\makeatletter
将和之间的代码更改\makeatother
为
\makeatletter
\newlength\biblabelwd
\renewenvironment{thebibliography}[1]
{\chapter*{\bibname}%
\@mkboth{\MakeUppercase\bibname}{\MakeUppercase\bibname}%
\settowidth\biblabelwd{\@biblabel{#1} }%
\begin{enumerate}[
itemindent=\biblabelwd,
leftmargin=0pt,
label={\makebox[\biblabelwd][l]{\@biblabel{\arabic{enumiv}}}},
labelwidth=0pt,
labelsep=0pt
]
\usecounter{enumiv}%
\sloppy
\clubpenalty4000
\@clubpenalty \clubpenalty
\widowpenalty4000%
\sfcode`\.\@m}
{\def\@noitemerr
{\@latex@warning{Empty `thebibliography' environment}}%
\end{enumerate}}
\makeatother