\usepackage[hyphenbreaks]{breakurl} 在 \footnote 或 appendix 中不起作用

\usepackage[hyphenbreaks]{breakurl} 在 \footnote 或 appendix 中不起作用

我正在使用 breakurl 包来避免 URL 超出文档范围。我在 GNU/Linux(具体是 Debian wheezy)下使用 TexMaker,并生成 PDF 文件。除了两种情况外,该包运行良好:

在此处输入图片描述

在此处输入图片描述

在第一种情况下,对 \burl 命令的调用位于 \footnote 中,在第二种情况下,调用位于附录中的列表中。问题似乎在于连字符未被解释为断点的问题。我按照以下说明进行操作http://texdoc.net/texmf-dist/doc/latex/breakurl/breakurl.pdf并尝试使用选项 \usepackage[hyphenbreaks]{breakurl},但它不起作用。我还尝试了选项 hyphenbreaks,但它也不起作用(并且它在其他地方破坏了格式)。你知道为什么会发生这种情况吗?

非常感谢,

大卫

PS:这是@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}

PS2:以下是 @egreg 建议的更改后的 MWE。在这种情况下,似乎存在与软件包的冲突:!LaTeX 错误:软件包 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}

答案1

首先要注意的是,breakurl只有使用 处理文档latex+dvips+ps2pdf以生成 PDF 文件时, 才有用。如果pdflatex使用 ,则加载breakurl而不是是没有意义的url

第二:该包hyperref需要,因此如果我们想向其添加选项,url则应先加载此包。hyperref

第三:也biblatex需要url;所以,再说一次,url biblatex是否要将选项传递给它。

第四:biblatex,由于未知的原因,改变了默认的URL样式。

以下是您可以作为文档基础的最小示例:

\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}

在此处输入图片描述

我不确定脚注中的长URL是否对读者有用。

答案2

这是由 @egreg 提供的解决方案的 MWE,其中包括发生冲突的语言选项,以防对其他人有用

\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}

相关内容