Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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 :

enter image description here

And what I would like to obtain :

enter image description here

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

Thank you for your help.

EDIT:

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

enter image description here

share|improve this question
1  
Please add a minimal working example (MWE) that illustrates your problem. –  Marco Daniel Apr 9 '12 at 16:10
1  
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

2 Answers 2

up vote 8 down vote accepted

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}
share|improve this answer
    
Finally I used this solution, it works well. Tanks. –  Michaël Apr 9 '12 at 18:40

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.

enter image description here

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.

share|improve this answer
    
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
    
Thanks for this follow-up explanation. –  Mico Apr 9 '12 at 16:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.