# Indent second line of a bibliography

I am writing a bibliography :

\begin{thebibliography}{9}
\bibitem{Lorem}\textsc{Lorem ipsum dolor sit}
\texttt{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras vitae purus mi. Fusce quam urna, elementum at ullamcorper in, tempus sed quam.}
\end{thebibliography}


The result :

And what I would like to obtain :

I want to indent the second and the third line of \texttt. Do I have to redefine \texttt or is there an other solution?

EDIT:

By using the solution of egreg I obtain a strange result :

• Please add a minimal working example (MWE) that illustrates your problem. – Marco Daniel Apr 9 '12 at 16:10
• Remember that if you have more than 10 bib entries, you have to pu {99} in the beginning, instead of {9}. The number of 9's ought to correspond to the number of digits of the largest bib label. – yo' Apr 9 '12 at 17:06
• You probably have an outdated version of enumitem. What operating system and TeX distribution are you using? – egreg Apr 9 '12 at 17:42
• Windows 7 and MiKTeX 2.9 – Michaël Apr 9 '12 at 17:54
• If I use enumitem I have problems with the package enumerate. – Michaël Apr 9 '12 at 18:01

The LaTeX internals can be modified to allow this. We modify:

• \@biblabel that prints the label, the new one includes a space of the length \bibindent

• \bibitem that prints the whole title, to remove the extra space for the first line

• You should add \kern\bibindent into the parameter of \begin{thebibliography} so that the indentation is ensured

• The line \def\bibindent defines the amount of indentation, I set it to 1em.

The code:

\documentclass{article}
\begin{document}

\def\bibindent{1em}
\begin{thebibliography}{99\kern\bibindent}
\makeatletter
\let\old@biblabel\@biblabel
\def\@biblabel#1{\old@biblabel{#1}\kern\bibindent}
\let\old@bibitem\bibitem
\def\bibitem#1{\old@bibitem{#1}\leavevmode\kern-\bibindent}
\makeatother

\bibitem{Lorem}\textsc{Lorem ipsum dolor sit}
\texttt{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras vitae purus mi. Fusce quam urna, elementum at ullamcorper in, tempus sed quam.}
\end{thebibliography}

\end{document}

• I used this to do the opposite - remove indent, thanks. Using \documentclass[openbib]{memoir} results in bibliography indents that I didn't want. Adding \def\bibindent{0em} before \begin{document} fixed it. – Cog77 Aug 19 '15 at 11:13

You can use the enumitem package to redefine the environment:

\documentclass[a4paper]{article}
\usepackage{enumitem}
\makeatletter
\renewenvironment{thebibliography}[1]
{\section*{\refname}%
\@mkboth{\MakeUppercase\refname}{\MakeUppercase\refname}%
\begin{enumerate}[label={[\arabic{enumi}]},itemindent=*,leftmargin=4em]
\@openbib@code
\sloppy
\clubpenalty4000
\@clubpenalty \clubpenalty
\widowpenalty4000
\sfcode\.\@m}
{\def\@noitemerr
{\@latex@warning{Empty thebibliography' environment}}%
\end{enumerate}}
\makeatother

\begin{document}

\begin{thebibliography}{99}

\bibitem{Lorem}\textsc{Lorem ipsum dolor sit} \texttt{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras
vitae purus mi. Fusce quam urna, elementum at ullamcorper in, tempus sed quam.}

\bibitem{Lorem2}\textsc{Lorem ipsum dolor sit} \texttt{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras
vitae purus mi. Fusce quam urna, elementum at ullamcorper in, tempus sed quam.}

\end{thebibliography}

\end{document}


Adjust the value for leftmargin to suit you. Notice that the argument to thebibliography is still necessary, even if it does nothing. This way you won't need to modify the input if you change your mind.

## Caveat

This code is meant for the standard class article. For report or book change \section into \chapter, while for KoMa-script classes or memoir some different hack might be necessary.

• Does it matter if one uses counter enumi (1) or counter enumiv (4)? The latter counter is employed by LaTeX's main document classes in the construction of the bibliography list. Just curious. – Mico Apr 9 '12 at 16:49
• @Mico I guess one can even use label={[\arabic*]}, in this case. I didn't want to go too far away from the usual setting. Probably the standard classes choose enumiv because it's rarely used in the document. – egreg Apr 9 '12 at 16:53