9

I have some trouble with the bibliography alignment. It's similar to References to align with the rest of the text, but that solution doesn't work for me.

Here is 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}

So I need the reference labels to be aligned with the parindent, and the rest part of the each bibliography entry should have general text width. I thought it's enough to set \leftmargin=0pt, but it didn't work. I have the following result: simple document

And what is actually more weird - it seems any value of \leftmargin doesn't have any effect to the bibliography display. The solution from the link above works fine if we don't have biblabel, but it's not my case.

Could you help me to move lines with the red marks to the green one?

2 Answers 2

7

To the extent that you're updating thebibliography, you might just as well renew the entire environment:

enter image description here

\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}

Since the bibliography is set as a list, you need to change the left margin to 0pt and the \itemindent to \labelwidth+\labelsep+<X> where <X> is the desired indent of the first line.

Your way of setting the lengths didn't work since it came too late in the process of setting the list. As you can see in the definition of thebibliography (taken from article.cls), the list is created within \thebibliography (or \begin{thebibliography}).

0
3

Set \leftmargin to be \labelsep and \itemindent to the desired length (3em in my example):

\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}

enter image description here

1
  • Yes, I set \leftmargin to be 0pt and got what I need. Thanks a lot!
    – Andrew
    Sep 14, 2013 at 0:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .