4

I am using the package breakurl to avoid the urls to be out of the document. I am using TexMaker under GNU/Linux (concretely Debian wheezy), and generating a PDF file. The package works quite well except in two cases:

enter image description here

enter image description here

In the first case, the call to the \burl command is in a \footnote, in the second one, in a list in an appendix. The problem seems to be with the issue of hyphens not being interpreted as break points. I followed the instructions at http://texdoc.net/texmf-dist/doc/latex/breakurl/breakurl.pdf and try with the option \usepackage[hyphenbreaks]{breakurl}, but it does not work. I also tried the option hyphenbreaks, but it doesn't work neither (and it breaks the format in other places). Do you have any idea why this could be happening?

Thank you very much,

David

P.S: Here is a Minimum Working Example, as suggested by @Mico:

\documentclass[a4paper,12pt]{report}
\usepackage[margin=2.5cm]{geometry}
\usepackage[british]{babel}
\usepackage[utf8]{inputenc}


\usepackage[usenames,dvipsnames]{color}
\usepackage{setspace}
\usepackage{titlepic}
\usepackage{graphicx}
\usepackage[nodayofweek]{datetime}
\usepackage{float}
\usepackage{booktabs}
\usepackage{tablefootnote}
\usepackage{multirow}

\usepackage{titlesec}
\setcounter{secnumdepth}{4}
\titleformat{\paragraph}
{\normalfont\normalsize\bfseries}{\theparagraph}{1em}{}
\titlespacing*{\paragraph}
{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}



\usepackage{csquotes}

\usepackage[style=apa, backend=biber]{biblatex}
\DeclareLanguageMapping{british}{british-apa}
\addbibresource{bibliography.bib}


% Added for long urls
\usepackage{hyperref}
%\usepackage[hyphens]{url}
\usepackage[hyphenbreaks]{breakurl}

\usepackage[super]{nth}
\usepackage[gen]{eurosym}


\begin{document}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis commodo leo quis gravida tempor. Suspendisse convallis nibh in nisl ultrices porttitor. Etiam mattis mauris eget lectus ultricies, ut laoreet leo aliquet. Sed justo quam, ornare nec ex eget, consequat feugiat purus. Donec ultricies metus quis fermentum feugiat. Proin vehicula eu ex vel laoreet. Nullam nec dictum ante\footnote{\label{footnote-dcne2014} \url{http://camp.drupalne.org/session/drupal-case-commons-based-peer-production}} \footnote{\url{https://amsterdam2014.drupal.org/bof/study-drupal-community-academia-what-has-been-said-and-what-can-we-learn}}.

\newpage
%% Appendixes
\appendix

\chapter{List of modules, published materials and presentations}

\begin{itemize}
    \item Presentations: 
    \begin{itemize}
        \item ``Drupal as a case of Commons-based Peer Production", DrupalCamp North East (Sunderland, 25/07/2014 - \url{http://camp.drupalne.org/session/drupal-case-commons-based-peer-production}). Slides available at \url{http://www.slideshare.net/drozas/drupal-cbpp-dcne14}
    \end{itemize}
\end{itemize}




\end{document}

P.S.2: Here is the MWE with the changes suggested by @egreg. In this case, there seems to be a clash with the packages: ! LaTeX Error: Option clash for package url.

\documentclass[a4paper,12pt]{report}
\usepackage[margin=2.5cm]{geometry}
\usepackage[british]{babel}
\usepackage[utf8]{inputenc}


\usepackage[usenames,dvipsnames]{color}
\usepackage{setspace}
\usepackage{titlepic}
\usepackage{graphicx}
\usepackage[nodayofweek]{datetime}
\usepackage{float}
\usepackage{booktabs}
\usepackage{tablefootnote}
\usepackage{multirow}

\usepackage{titlesec}
\setcounter{secnumdepth}{4}
\titleformat{\paragraph}
{\normalfont\normalsize\bfseries}{\theparagraph}{1em}{}
\titlespacing*{\paragraph}
{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}



\usepackage{csquotes}

\usepackage[style=apa, backend=biber]{biblatex}
\DeclareLanguageMapping{british}{british-apa}
\addbibresource{bibliography.bib}


% Added for long urls
\usepackage[hyphens]{url}
\usepackage{hyperref}

%\usepackage[hyphenbreaks]{breakurl}

\usepackage[super]{nth}
\usepackage[gen]{eurosym}


\begin{document}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis commodo leo quis gravida tempor. Suspendisse convallis nibh in nisl ultrices porttitor. Etiam mattis mauris eget lectus ultricies, ut laoreet leo aliquet. Sed justo quam, ornare nec ex eget, consequat feugiat purus. Donec ultricies metus quis fermentum feugiat. Proin vehicula eu ex vel laoreet. Nullam nec dictum ante\footnote{\label{footnote-dcne2014} \url{http://camp.drupalne.org/session/drupal-case-commons-based-peer-production}} \footnote{\url{https://amsterdam2014.drupal.org/bof/study-drupal-community-academia-what-has-been-said-and-what-can-we-learn}}.

\newpage
%% Appendixes
\appendix

\chapter{List of modules, published materials and presentations}

\begin{itemize}
    \item Presentations: 
    \begin{itemize}
        \item ``Drupal as a case of Commons-based Peer Production", DrupalCamp North East (Sunderland, 25/07/2014 - \url{http://camp.drupalne.org/session/drupal-case-commons-based-peer-production}). Slides available at \url{http://www.slideshare.net/drozas/drupal-cbpp-dcne14}
    \end{itemize}
\end{itemize}




\end{document}
7
  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format.
    – Pier Paolo
    Nov 17, 2014 at 11:59
  • Insteading of using the breakurl package, you might try loading the url package with the option hyphens: \usepackage[hyphens]{url}. This is a failsafe method of typesetting long URL strings that may contain hyphens.
    – Mico
    Nov 17, 2014 at 13:15
  • Thanks for your reply, @Mico! I have tried with the url package instead. However, there seems to be a clash. I have commented the loading of the hyperref and breakurl packages, but still it does not compile. Concretely, the error is: The package url has already been loaded with options: [] There has now been an attempt to load it with options [hyphens] Adding the global options: ,hyphens to your \documentclass declaration may fix this. I have added the option ,hyphens to the documentclass, but I still get the same error while compiling. Any idea of why this could be happening? Thanks a lot
    – drozas
    Nov 17, 2014 at 18:03
  • You really need to post a Minimum Working Example, i.e., a document that starts with \documentclass and ends with \end{document} that replicates the problem behavior you're looking to fix. One or two footnotes with long URLs and one or two \items with long URLs should do it for the body of the document. It's crucial that you further indicate which TeX distribution you employ, which document class you use, as well as information about special fonts (if any), special formatting requirements (if any), and so on.
    – Mico
    Nov 17, 2014 at 20:48
  • Thanks for your suggestion @Mico! I have added a MWE in the main messsage.
    – drozas
    Nov 19, 2014 at 9:45

2 Answers 2

10

The first thing to note is that breakurl is useful only if the document is processed with latex+dvips+ps2pdf in order to produce a PDF file. If pdflatex is used, there's no point in loading breakurl instead of url.

Second: the package hyperref requires url, so this package should be loaded before hyperref if we want to add options to it.

Third: also biblatex requires url; so, again, url must be called before biblatex if options are to be passed to it.

Fourth: biblatex, for unknown reasons, changes the default URL style.

Here's the minimal example which you can base your document on:

\documentclass[a4paper,12pt]{report}

\usepackage[hyphens]{url}
\usepackage[style=apa, backend=biber]{biblatex}
\usepackage{hyperref}

\urlstyle{tt}

\begin{document}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis commodo leo quis gravida 
tempor. Suspendisse convallis nibh in nisl ultrices porttitor. Etiam mattis mauris eget 
lectus ultricies, ut laoreet leo aliquet. Sed justo quam, ornare nec ex eget, consequat 
feugiat purus. Donec ultricies metus quis fermentum feugiat. Proin vehicula eu ex vel 
laoreet. Nullam nec dictum ante\footnote{\label{footnote-dcne2014} 
\url{http://camp.drupalne.org/session/drupal-case-commons-based-peer-production}} 
\footnote{\url{https://amsterdam2014.drupal.org/bof/study-drupal-community-academia-what-has-been-said-and-what-can-we-learn}}.

\end{document}

enter image description here

I'm not really sure whether long URLs in footnotes are really useful for the reader. A list of URLs at the end of the document might be better, leaving in the footnote just a pointer (that can still become a hyperlink).

1
  • Thanks a lot @egreg! That worked perfectly, you made my day :-) I will attach another MWE with the whole set of options related to language which was clashing, in case it can be useful for someone else.
    – drozas
    Nov 19, 2014 at 10:45
1

This is a MWE with the solution provided by @egreg, and including the language options which were clashing, in case it can be useful for someone else

\documentclass[a4paper,12pt]{report}

\usepackage[hyphens]{url}
\usepackage[style=apa, backend=biber]{biblatex}
\DeclareLanguageMapping{british}{british-apa}
\addbibresource{bibliography.bib}
\usepackage[british]{babel}
\usepackage{hyperref}

\usepackage[margin=2.5cm]{geometry}
\usepackage[utf8]{inputenc}


\usepackage[usenames,dvipsnames]{color}
\usepackage{setspace}
\usepackage{titlepic}
\usepackage{graphicx}
\usepackage[nodayofweek]{datetime}
\usepackage{float}
\usepackage{booktabs}
\usepackage{tablefootnote}
\usepackage{multirow}

\usepackage{titlesec}
\setcounter{secnumdepth}{4}
\titleformat{\paragraph}
{\normalfont\normalsize\bfseries}{\theparagraph}{1em}{}
\titlespacing*{\paragraph}
{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}



\usepackage{csquotes}

\usepackage[super]{nth}
\usepackage[gen]{eurosym}


\begin{document}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis commodo leo quis gravida 
tempor. Suspendisse convallis nibh in nisl ultrices porttitor. Etiam mattis mauris eget 
lectus ultricies, ut laoreet leo aliquet. Sed justo quam, ornare nec ex eget, consequat 
feugiat purus. Donec ultricies metus quis fermentum feugiat. Proin vehicula eu ex vel 
laoreet. Nullam nec dictum ante\footnote{\label{footnote-dcne2014}\url{http://camp.drupalne.org/session/drupal-case-commons-based-peer-production}} 
\footnote{\url{https://amsterdam2014.drupal.org/bof/study-drupal-community-academia-what-has-been-said-and-what-can-we-learn}}.

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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