1

I use biblatex. I have problem with linebreak between bibliography items. I have for short url:

bad way

The space between the organization and url is not optimal. I want nolinebreak between organisation and url and hyphenation in url like for long url:

good way

I use

\documentclass{article} 
\usepackage[utf8]{inputenc} 
\usepackage[USenglish]{babel}

\usepackage[bibstyle=authortitle,
        citestyle=authoryear-ibid,
        natbib=true,
        urldate=long, 
        firstinits=true, 
        uniquename=false,
        backend=bibtex]{biblatex}

%==== online sources format =====
\DeclareFieldFormat{url}{\url{#1}}
\DeclareFieldFormat{urldate}{\printtext{Last accessed}\addcolon\space#1}
\urlstyle{rm}

\DeclareBibliographyDriver{online}{%
\printnames{author}%
\newunit\newblock
\printfield{note}%
\newunit\newblock
\printlist{organization}\addcolon%
\newunit\newblock
\printfield{url}%
\newunit
\printurldate%
\finentry}
%===================================

\addbibresource{my.bib}

\begin{document}

\citet[UDE][]{ARUS}
\citep{AESOPComplexity} 

\raggedright
\printbibliography

\end{document}

and my.bib

@ELECTRONIC{AESOPComplexity,
  author = {AESOP},
  note = {Association of European Schools of Planning},
  organization = {Thematic group Planning and Complexity},
  date={2015},
  urldate = {2015-01-22},
  url = {http://www.aesop-planning.eu/blogs/en_GB/planning-and-complexity}
}

@ELECTRONIC{ARUS,
  author = {ARUS},
  note = {Advanced Research in Urban Systems}, 
  organization = {Structured PhD program at the University of Duisburg Essen},
  institution = {UNIVERSIT\"AT DUISBURG­-ESSEN},
  address = {Germany},
  date={2015},
  urldate = {2015-01-22},
  url = {https://www.uni-due.de/urbane-systeme/advanced-research-in-urban-systems_en.shtml}
  }

Could I solve this problem without delete \raggedright?

Thank you!

lockstep
  • 250,273
Mikhail
  • 35

1 Answers1

2

This is rooted with how you output URLs in \DeclareFieldFormat{url} and \DeclareBibliographyDriver{online}. Effectively this means the last whitespace before a URL is a normal space and biblatex is much less reluctant to break at said space instead of breaking the URL.

We can make the last space before the URL non-breaking forcing biblatex to break the URL somewhere (URL breaking is a very delicate matter though, and in my view best avoided).

\DeclareBibliographyDriver{online}{%
\printnames{author}%
\newunit\newblock
\printfield{note}%
\newunit\newblock
\printlist{organization}%<--- no \addcolon anymore
\printunit{\addcolon\addnbspace}% <---- this is new
\printfield{url}%
\newunit
\printurldate%
\finentry}

MWE

\documentclass{article} 
\usepackage[utf8]{inputenc} 
\usepackage[USenglish]{babel}
\usepackage{filecontents} 
\usepackage[bibstyle=authortitle,
        citestyle=authoryear-ibid,
        natbib=true,
        urldate=long, 
        firstinits=true, 
        uniquename=false]{biblatex}

%==== online sources format =====
\DeclareFieldFormat{url}{\url{#1}}
\DeclareFieldFormat{urldate}{\printtext{Last accessed}\addcolon\space#1}
\urlstyle{rm}

\DeclareBibliographyDriver{online}{%
\printnames{author}%
\newunit\newblock
\printfield{note}%
\newunit\newblock
\printlist{organization}%
\printunit{\addcolon\addnbspace}%
\printfield{url}%
\newunit
\printurldate%
\finentry}
%===================================
%===================================
\begin{filecontents*}{\jobname.bib}
@ELECTRONIC{AESOPComplexity,
  author = {AESOP},
  note = {Association of European Schools of Planning},
  organization = {Thematic group Planning and Complexity},
  date={2015},
  urldate = {2015-01-22},
  url = {http://www.aesop-planning.eu/blogs/en_GB/planning-and-complexity}
}

@ELECTRONIC{ARUS,
  author = {ARUS},
  note = {Advanced Research in Urban Systems}, 
  organization = {Structured PhD program at the University of Duisburg Essen},
  institution = {UNIVERSIT\"AT DUISBURG­-ESSEN},
  address = {Germany},
  date={2015},
  urldate = {2015-01-22},
  url = {https://www.uni-due.de/urbane-systeme/advanced-research-in-urban-systems_en.shtml}
  }
\end{filecontents*}


\addbibresource{\jobname.bib}

\begin{document}

\citet[UDE][]{ARUS}
\citep{AESOPComplexity} 

\raggedright
\printbibliography

\end{document}

enter image description here

moewe
  • 175,683