![使超連結自動在標點符號處斷開](https://rvso.com/image/328826/%E4%BD%BF%E8%B6%85%E9%80%A3%E7%B5%90%E8%87%AA%E5%8B%95%E5%9C%A8%E6%A8%99%E9%BB%9E%E7%AC%A6%E8%99%9F%E8%99%95%E6%96%B7%E9%96%8B.png)
在下面的範例中,如何使列印為「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}
這適用於latex
thendvipdf
命令。
編輯:
奇怪的是,使用pdflatex
相同的檔案進行編譯不會產生相同的輸出。你必須把這條線
\burlalt{doi:10.2307/1968102}{http://dx.doi.org/10.2307/1968102}
使其發揮作用。