使超連結自動在標點符號處斷開

使超連結自動在標點符號處斷開

在下面的範例中,如何使列印為「doi:10.2307/1968102」的超連結自動在任何標點符號處換行,即:、.或/?

注意:我直接從 .tex 檔案編譯為 PDF,因此該breakurl套件將無法運作。

\documentclass{article}

\usepackage{hyperref}
\urlstyle{same}

\begin{document}

\begin{thebibliography}{9}

\bibitem{1}
N. Wiener, \emph{Tauberian theorems}, Ann. of Math. (2) \textbf{33} (1932),
\href{http://dx.doi.org/10.2307/1968102}{doi:10.2307/1968102}.

\end{thebibliography}

\end{document}

編輯:好的,看來如果我應用\nolinkurl到 的第二個參數\href,我會得到我想要的行為:

\documentclass{article}

\usepackage{hyperref}
\urlstyle{same}

\begin{document}

\begin{thebibliography}{9}

\bibitem{1}
N. Wiener, \emph{Tauberian theorems}, Ann. of Math. (2) \textbf{33} (1932),
\href{http://dx.doi.org/10.2307/1968102}{\nolinkurl{doi:10.2307/1968102}}.

\end{thebibliography}

\end{document}

答案1

breakurl包解決您的問題

\documentclass{article}

\usepackage{hyperref}
\usepackage{breakurl}
\begin{document}

\begin{thebibliography}{9}

\bibitem{1}
N. Wiener, \emph{Tauberian theorems}, Ann. of Math. (2) \textbf{33} (1932),
\renewcommand\UrlFont{\rmfamily}
\burlalt{http://dx.doi.org/10.2307/1968102}{doi:10.2307/1968102}.
\href{http://dx.doi.org/10.2307/1968102}{doi:10.2307/1968102}.

\end{thebibliography}

\end{document}

這適用於latexthendvipdf命令。

編輯: 奇怪的是,使用pdflatex相同的檔案進行編譯不會產生相同的輸出。你必須把這條線

\burlalt{doi:10.2307/1968102}{http://dx.doi.org/10.2307/1968102}

使其發揮作用。

相關內容