我对参考书目对齐有些困惑。它类似于与正文其他部分保持一致的引用,但该解决方案对我来说不起作用。
以下是 MWE:
\documentclass{article}
\let\oldthebibliography=\thebibliography
\let\endoldthebibliography=\endthebibliography
\renewenvironment{thebibliography}[1]{%
\begin{oldthebibliography}{#1}%
\setlength{\parskip}{0ex}%
\setlength{\itemsep}{0ex}%
\setlength{\itemindent}{3ex}
\setlength{\leftmargin}{0pt}%
}%
{
\end{oldthebibliography}%
}
\begin{document}
Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text.
\begin{thebibliography}{0}
\bibitem{1} Baider A. Noncompact Riemannian manifolds with discrete spectra //
J.Diff.Geom. -- 1979 -- V. 14 -- p. 41--57.
\bibitem{2} Berger M., Gauduchon P., Mazet E. Le spectre d'une
vari\'et\'e Rieman\-nienne -- Berlin-New York: Springer-Verlag, 1971. -- 251p.
-- (Lecture Notes in Math.; V.~194)
\end{thebibliography}
\end{document}
因此我需要将参考标签与对齐parindent
,并且每个参考书目条目的其余部分应具有一般文本宽度。我认为设置就足够了\leftmargin=0pt
,但它不起作用。我得到以下结果:
实际上更奇怪的是 - 似乎 的任何值\leftmargin
都不会对参考书目显示产生任何影响。如果我们没有 ,上面链接中的解决方案可以正常工作biblabel
,但这不是我的情况。
你能帮我把红色标记的线移到绿色标记的线吗?
答案1
就您更新的程度而言thebibliography
,您可能也会更新整个环境:
\documentclass{article}
\makeatletter
\renewenvironment{thebibliography}[1]
{\section*{\refname}%
\@mkboth{\MakeUppercase\refname}{\MakeUppercase\refname}%
\list{\@biblabel{\@arabic\c@enumiv}}%
{\settowidth\labelwidth{\@biblabel{#1}}%
\setlength{\itemindent}{\dimexpr\labelwidth+\labelsep+1em}
\leftmargin\z@
\@openbib@code
\usecounter{enumiv}%
\let\p@enumiv\@empty
\renewcommand\theenumiv{\@arabic\c@enumiv}}%
\sloppy
\clubpenalty4000
\@clubpenalty \clubpenalty
\widowpenalty4000%
\sfcode`\.\@m}
{\def\@noitemerr
{\@latex@warning{Empty `thebibliography' environment}}%
\endlist}
\makeatother
\begin{document}
Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text.
Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text.
\begin{thebibliography}{0}
\bibitem{1} Baider A. Noncompact Riemannian manifolds with discrete spectra //
J.Diff.Geom. -- 1979 -- V. 14 -- p. 41--57.
\bibitem{2} Berger M., Gauduchon P., Mazet E. Le spectre d'une
vari\'et\'e Rieman\-nienne -- Berlin-New York: Springer-Verlag, 1971. -- 251p.
-- (Lecture Notes in Math.; V.~194)
\end{thebibliography}
\end{document}
由于参考书目被设置为列表,因此您需要将左边距更改为 ,0pt
并将第一行所需的缩进量更改\itemindent
为。\labelwidth+\labelsep+<X>
<X>
你设置长度的方式不起作用,因为它在设置列表的过程中来得太晚了。正如你在定义中看到的那样thebibliography
(取自article.cls
\thebibliography
),则列表在(或)内创建\begin{thebibliography}
。
答案2
设置\leftmargin
为所需长度(\labelsep
在我的示例中):\itemindent
3em
\documentclass{article}
\makeatletter
\renewenvironment{thebibliography}[1]
{\section*{\refname}%
\@mkboth{\MakeUppercase\refname}{\MakeUppercase\refname}%
\list{\@biblabel{\@arabic\c@enumiv}}%
{\settowidth\labelwidth{\@biblabel{#1}}%
\leftmargin\labelsep
\itemindent3em
\@openbib@code
\usecounter{enumiv}%
\let\p@enumiv\@empty
\renewcommand\theenumiv{\@arabic\c@enumiv}}%
\sloppy
\clubpenalty4000
\@clubpenalty \clubpenalty
\widowpenalty4000%
\sfcode`\.\@m}
{\def\@noitemerr
{\@latex@warning{Empty `thebibliography' environment}}%
\endlist}
\makeatother
\begin{document}
Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text. Some text.
\begin{thebibliography}{9}
\bibitem{1} Baider A. Noncompact Riemannian manifolds with discrete spectra //
J.Diff.Geom. -- 1979 -- V. 14 -- p. 41--57.
\bibitem{2} Berger M., Gauduchon P., Mazet E. Le spectre d'une
vari\'et\'e Rieman\-nienne -- Berlin-New York: Springer-Verlag, 1971. -- 251p.
-- (Lecture Notes in Math.; V.~194)
\end{thebibliography}
\end{document}