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 have a reference entry in the bibliography that appears as follows:

[50] AB MySQL.    MySQL:  The  world's  most  popular  open  source  database,
     http://www.mysql.com/, 2005.

How to prevent auto-justification for specific references?

share|improve this question
6  
You could specify your URLs using the url package. It does a very good job in breaking URLs at the text block edge. I'm not sure whether this what you're after. Or are you looking for a "ragged right" alignment? –  Werner Jan 15 '12 at 4:29
    
Thanks for the url package info, however, as you guessed, I am looking for left-aligning the text in this case. –  Bilal Sheikh Jan 15 '12 at 5:14
3  
You could just add \raggedright (left-aligned with no hyphenation on the right) before \bibliography{...} (or \printbibliography if you're using biblatex). –  Werner Jan 15 '12 at 5:53
2  
With biblatex, you could use \renewcommand*{\bibfont}{\raggedright}. –  lockstep Jan 15 '12 at 8:44
1  
Please provide a minimal example. Nobody knows what you're doing, let alone answer your question. –  Marc van Dongen Jan 15 '12 at 9:34
add comment

1 Answer

up vote 18 down vote accepted

To typeset the whole bibliography \raggedright, do one of the following:

1) If you're using a manually created thebibliography environment, add \raggedright at the beginning of the environment:

\begin{thebibliography}{9}
\raggedright

\bibitem{test} A bibitem.
\end{thebibliography}

2) If you create your bibliography with BibTeX, but without the help of the natbib or the biblatex package, enclose \bibliography{<mybib>} within a group and add \raggedright inside the group:

\begingroup
\raggedright

\bibliography{<mybib>}
\endgroup

3) If you're using either natbib or biblatex, simply redefine \bibfont:

\renewcommand*{\bibfont}{\raggedright}

If you really, really want to typeset only specific references \raggedright (which is rather inconsistent), you could trick biblatex into doing so by (ab)using the execute and addendum fields of the respective entries:

\documentclass{article}

\usepackage{biblatex}

\usepackage{lipsum}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@misc{A01,
  author = {Author, A.},
  year = {2001},
  title = {Alpha -- \lipsum*[1]},
}
@misc{B02,
  execute ={\raggedright},
  addendum = {\par\vspace{-\baselineskip}\nopunct},
  author = {Buthor, B.},
  year = {2002},
  title = {Bravo -- \lipsum*[1]},
}
@misc{C03,
  author = {Cuthor, C.},
  year = {2003},
  title = {Charlie -- \lipsum*[1]},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\nocite{*}

\begin{document}

\printbibliography

\end{document}

enter image description here

share|improve this answer
add comment

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.