使用 DVIPS 的 BreakURL 包仅适用于 URL,不适用于 DOI

使用 DVIPS 的 BreakURL 包仅适用于 URL,不适用于 DOI

我已经使用 准备了参考书目biblatex,但我的 DOI 地址换行不正确。我知道使用可以解决这个问题,但由于使用 ,pdflatex我必须使用latex-> dvips->来编译我的文档。ps2pdfpstricks

使用来自 Biblatex:DVI 模式下 URL 破解不起作用,我尝试使用该breakurl包,发现 URL 可以正确换行,但 DOI 仍然不能。

任何帮助,将不胜感激。在此处输入图片描述

这是 MWE

\documentclass{article}
\PassOptionsToPackage{hyphens}{url}\usepackage{hyperref}
\hypersetup{colorlinks,linkcolor=[RGB]{0,0,150}, citecolor=[RGB]{0,123,0},urlcolor=[RGB]{80,0,100}}
\usepackage[anythingbreaks]{breakurl}
\usepackage[citestyle=authoryear-comp,]{biblatex}
\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@article{liu2013condition,
title={Condition-based maintenance for continuously monitored degrading blah blah blah longer title},
author={Liu, Xiao and Li, Jingrui and Al-Khalifa, Khalifa N},
journal={IIE Transactions},
volume={45},
number={4},
pages={422--435},
year={2013},
publisher={Taylor and Francis},
doi = {10.1080/0740817X.2012.690930},
url={https://tex.stackexchange.com/questions/20768/how-to-allow-line-break-in-a-long-hyperlink-in-a-pdf-compiled-by-latex-dvips-ps2}
}
\end{filecontents}
\addbibresource{\jobname.bib} %Loads bibliography file
\usepackage[utf8]{inputenc}
\nocite{*}

\begin{document}

\printbibliography
\end{document}

答案1

DOI 是使用 和 内部设置的\href,而\nolinkurl这不适用于 breakurl。据我所知, breakurl 没有与 相对应\nolinkurl,但这似乎有效(并给出了正确的链接):

\documentclass{article}
\PassOptionsToPackage{hyphens}{url}\usepackage{hyperref}
\hypersetup{colorlinks,linkcolor=[RGB]{0,0,150}, citecolor=[RGB]{0,123,0},urlcolor=[RGB]{80,0,100}}
\usepackage[anythingbreaks]{breakurl}
\usepackage[citestyle=authoryear-comp,]{biblatex}
\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@article{liu2013condition,
title={Condition-based maintenance for continuously monitored degrading blah blah blah longer title},
author={Liu, Xiao and Li, Jingrui and Al-Khalifa, Khalifa N},
journal={IIE Transactions},
volume={45},
number={4},
pages={422--435},
year={2013},
publisher={Taylor and Francis},
doi = {10.1080/0740817X.2012.690930},
url={http://tex.stackexchange.com/questions/20768/how-to-allow-line-break-in-a-long-hyperlink-in-a-pdf-compiled-by-latex-dvips-ps2}
}
\end{filecontents}
\addbibresource{\jobname.bib} %Loads bibliography file
\usepackage[utf8]{inputenc}
\nocite{*}

\usepackage{expl3}
\ExplSyntaxOn
\newcommand \breakDOI[1]
 {
  \tl_map_inline:nn { #1 } { \href{http://dx.doi.org/#1}{##1} \penalty0 \scan_stop: }
 }
\ExplSyntaxOff

\DeclareFieldFormat{doi}{%
  \mkbibacro{DOI}\addcolon\space
  {\breakDOI{#1}}}


\begin{document}

\printbibliography
\end{document}

在此处输入图片描述

相关内容