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 problem with the line break of an URL. The URL can´t break correct and extends into the border. I´ve tried some things. Amongst others I loaded the package breakurl, but without any success. When I set the bibliography left-aligned there isn´t a problem. But I need it justified. Here is an example:

\documentclass[
a4paper,                         
fontsize=11,                    
BCOR=10mm,
DIV=11
]{scrreprt}

\usepackage[ngerman]{babel}                    
\usepackage[latin1]{inputenc}                
\usepackage[T1]{fontenc}
\usepackage{lmodern}                        
\usepackage{microtype}    
\usepackage[
    style=numeric, 
    maxnames=1,
    bibencoding=latin1,
    backend=bibtex8,
    defernumbers=true,
    hyperref=true,
    alldates=long
]{biblatex}
\usepackage{hyperref}
\usepackage[hyphenbreaks]{breakurl}

\begin{filecontents}{bachelorarbeit_lit.bib}
@ONLINE{java96,
    author = {{Sun Microsystems}},
    title = {JavaSoft ships Java 1.0},
    year = {1996},
    month = {1},
    url = {http://findarticles.com/p/articles/mi_m0EIN/is_1996_Jan_23/ai_17853565/?tag=content;col1},
    urldate = {2011-03-02},
    sortname = {Sun},
    keywords = {www}
}

@ONLINE{java02,
    author = {{Computer Weekly}},
    title = {Write once, run anywhere?},
    year = {2002},
    month = {5},
    url = {http://www.computerweekly.com/Articles/2002/05/02/186793/Write-once-runanywhere1.htm},
    urldate = {2011-03-02},
    sortname = {Computer},
    keywords = {www}
}
\end{filecontents}

\bibliography{bachelorarbeit_lit}

\begin{document}
\chapter{Test}
Test \cite{java02}
Test \cite{java96}

%\raggedright
\printbibliography
\end{document}

Does anyone have an idea?

share|improve this question
1  
do not use package breakurl, when running pdflatex. hyperref does it anyway ... –  Herbert Apr 12 '11 at 18:51
    
But without breakurl the problem is the same. Hyperref has an option breaklinks. But as far as i know this option doesn´t works. It will be set internally by the drivers. –  MRae Apr 12 '11 at 19:01
    
I removed the {biblatex} tag because the problem at hand may also arise with other bibliography packages. –  lockstep Apr 12 '11 at 19:43
1  
A general hint that might be helpful whenever you're writing anything in English: For typing an apostrophe (as in can't), don't use the acute accent ´ (which is right of the sharp s ß, assuming you have a German keyboard), but instead the actual apostrophe ' by pressing shift + #. That'll give your LaTeX documents a way more professional look ;) –  doncherry Apr 29 '11 at 9:00
    
There will be a new solution for this problem in the near future (already tested and it will be uploaded to CTAN soon). Look at my question here: tex.stackexchange.com/a/108001/28200 –  DL6ER Apr 10 '13 at 20:18

2 Answers 2

up vote 13 down vote accepted

The first URL has a large unbreakable section (runanywhere1) which must either form the end of the second or the beginning of the third line (given the specific font size, margin etc. of the example) if one insists on justified text. An acceptable (?) solution may be obtained by adding e.g. \sloppy or \emergencystretch 1.5em before \printbibliography. enter image description here

share|improve this answer
    
Thanks for this answer. It is almost the same like the answer of Herbert and works too. –  MRae Apr 12 '11 at 19:24

try it this way (without breakurl

\begingroup
\raggedright
\sloppy
\printbibliography
\endgroup

enter image description here

or without \raggedright:

enter image description here

share|improve this answer
    
Okay, thanks for this answer. It works fine. –  MRae Apr 12 '11 at 19:23
    
This is a good solution :) Thanks Herbert! –  dingo_d Feb 7 at 9:07

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.