有超过一行的参考引用条目。由于我使用 LaTeX -> PS -> PDF 进行编译,因此 hyperref 创建的链接无法正确显示在输出文件 (pdf) 中。为了解决这个问题,我\usepackage{hypdvips}
在序言中添加了。但我没有得到链接(同时我得到了超过一行的 toc 链接)
这是我的最小工作示例:
\documentclass{book}
\usepackage{natbib}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage[draft=false,dvips,ps2pdf=true,colorlinks,pdfborderstyle={/S/U/W 0},bookmarksnumbered,bookmarksopen=false,unicode=true,pdfpagelabels=false]{hyperref}%
\usepackage[emptypagelabels=false]{hypdvips}
\makeatletter
\renewcommand*{\Hy@backout}[1]{}
\providecommand*{\backrefsetup}[1]{}
\makeatother
\begin{document}
The second breakthrough was the development of the semiconductor laser.
Demonstrations of laser action\enlargethispage{12pt}
in semiconductors were reported in \citet*{Hall1962}, in \citet*{Nathan1962}, in
\citet*{Holonyak1962}, and in \citet*{Quist1962}.
All of the papers were independently submitted within a span of less than three months in 1962. The practical breakthrough of the first
continuous-wave room-temperature semiconductor laser was reported by
\citet*{Alferov1970}.
\begin{thebibliography}{}
\bibitem[\protect\citeauthoryear{Hall, Fenner, Kingsley, Soltys, and Carlson}{Hall et~al.}{1962}]{Hall1962}
Hall, R.~N., G.~E. Fenner, J.~D. Kingsley, T.~J. Soltys, and R.~O. Carlson.
\newblock Coherent light emission from {Ga--As} junctions.
\newblock \textit{Physics Review Letters}, 9(9):366--8, 1962.
\bibitem[\protect\citeauthoryear{Nathan, Dumke, Burns, Dill, and Lasher}{Nathan et~al.}{1962}]{Nathan1962}
Nathan, M., W.~Dumke, G.~Burns, F.~Dill, and G.~Lasher.
\newblock Stimulated emission of radiation from {GaAs P--N} junctions.
\newblock \textit{Applied Physics Letters}, 1(3):62--4, 1962.
\bibitem[Holonyak and Bevacqua(1962)]{Holonyak1962}
Holonyak, N. and S.~F. Bevacqua.
\newblock Coherent (visible) light emission from {$\textrm{Ga}(\textrm{As}_{1 - x}\textrm{P}_x)$} junctions.
\newblock \textit{Applied Physics Letters}, 1(4):82--3, 1962.
\bibitem[\protect\citeauthoryear{Quist, Rediker, Keyes, Krag, Lax, and
Zeigler}{Quist et~al.}{1962}]{Quist1962}
Quist, T.~M., R.~H. Rediker, R.~J. Keyes, W.~E. Krag, B.~Lax, A.~L. McWhorter, and H.~J. Zeigler.
\newblock Semiconductor maser of {GaAs}.
\newblock \textit{Applied Physics Letters}, 1(4):91--2, 1962.
\bibitem[\protect\citeauthoryear{Alferov, Andreev, Portnoi, and Turkan}{Alferov et~al.}{1970}]{Alferov1970}
Alferov, Zh.~I., V.~M. Andreev, E.~L. Portnoi, and M.~K. Turkan.
\newblock {AlAs--GaAs} heterojunction injection lasers with a low room-temperature threshold.
\newblock \textit{Soviet Physics Semiconductors}, \hbox{3:460--3}, 1970.
\end{thebibliography}
\end{document}
我尝试修改以下内容,但无法修改
\def\hyper@natlinkstart#1{%
\Hy@backout{#1}%
\hyper@linkstart{cite}{cite.#1}%
\def\hyper@nat@current{#1}%
}
在下图中,我突出显示了损坏的链接
请检查并建议如何纠正断开的链接问题
答案1
我得到了解决方案,并在 natbib 包中进行了简单修改
我将 \NAT@hyper@ 改为 \hyper@@link{}{cite.@citeb@extra@b@citeb} 以获取中断链接
\def\NAT@citex%
[#1][#2]#3{%
\NAT@reset@parser
\NAT@sort@cites{#3}%
\NAT@reset@citea
\@cite{\let\NAT@nm\@empty\let\NAT@year\@empty
\@for\@citeb:=\NAT@cite@list\do
{\@safe@activestrue
\edef\@citeb{\expandafter\@firstofone\@citeb\@empty}%
\@safe@activesfalse
\@ifundefined{b@\@citeb\@extra@b@citeb}{\@citea%
{\reset@font\bfseries ?}\NAT@citeundefined
\PackageWarning{natbib}%
{Citation `\@citeb' on page \thepage \space undefined}\def\NAT@date{}}%
{\let\NAT@last@nm=\NAT@nm\let\NAT@last@yr=\NAT@year
\NAT@parse{\@citeb}%
\ifNAT@longnames\@ifundefined{bv@\@citeb\@extra@b@citeb}{%
\let\NAT@name=\NAT@all@names
\global\@namedef{bv@\@citeb\@extra@b@citeb}{}}{}%
\fi
\ifNAT@full\let\NAT@nm\NAT@all@names\else
\let\NAT@nm\NAT@name\fi
\ifNAT@swa\ifcase\NAT@ctype
\if\relax\NAT@date\relax
\@citea\NAT@hyper@{\NAT@nmfmt{\NAT@nm}\NAT@date}%
\else
\ifx\NAT@last@nm\NAT@nm\NAT@yrsep
\ifx\NAT@last@yr\NAT@year
\def\NAT@temp{{?}}%
\ifx\NAT@temp\NAT@exlab\PackageWarningNoLine{natbib}%
{Multiple citation on page \thepage: same authors and
year\MessageBreak without distinguishing extra
letter,\MessageBreak appears as question mark}\fi
\NAT@hyper@{\NAT@exlab}%
\else\unskip\NAT@spacechar
\NAT@hyper@{\NAT@date}%
\fi
\else
\@citea\hyper@@link{}{cite.\@citeb\@extra@b@citeb}{\NAT@nmfmt{\NAT@nm}}%%%%changed to \hyper@@link
\NAT@aysep\NAT@spacechar%
\NAT@hyper@{\NAT@date}%
\fi
\fi
\or\@citea\NAT@hyper@{\NAT@nmfmt{\NAT@nm}}%
\or\@citea\NAT@hyper@{\NAT@date}%
\or\@citea\NAT@hyper@{\NAT@alias}%
\fi \NAT@def@citea
\else
\ifcase\NAT@ctype
\if\relax\NAT@date\relax
\@citea\NAT@hyper@{\NAT@nmfmt{\NAT@nm}}%
\else
\ifx\NAT@last@nm\NAT@nm\NAT@yrsep
\ifx\NAT@last@yr\NAT@year
\def\NAT@temp{{?}}%
\ifx\NAT@temp\NAT@exlab\PackageWarningNoLine{natbib}%
{Multiple citation on page \thepage: same authors and
year\MessageBreak without distinguishing extra
letter,\MessageBreak appears as question mark}\fi
\NAT@hyper@{\NAT@exlab}%
\else
\unskip\NAT@spacechar
\NAT@hyper@{\NAT@date}%
\fi
\else
\@citea{%
\hyper@@link{}{cite.\@citeb\@extra@b@citeb}{\NAT@nmfmt{\NAT@nm}}%%%%%changed to \hyper@@link
{\NAT@spacechar\NAT@@open\if*#1*\else#1\NAT@spacechar\fi}%
% {\@citeb\@extra@b@citeb}%
\NAT@hyper@{\NAT@date}%
}%
\fi
\fi
\or\@citea\hyper@@link{}{cite.\@citeb\@extra@b@citeb}{\NAT@nmfmt{\NAT@nm}}%%%%%changed to \hyper@@link
\or\@citea\NAT@hyper@{\NAT@date}%
\or\@citea\NAT@hyper@{\NAT@alias}%
\fi
\if\relax\NAT@date\relax
\NAT@def@citea
\else
\NAT@def@citea@close
\fi
\fi
}}\ifNAT@swa\else\if*#2*\else\NAT@cmt#2\fi
\if\relax\NAT@date\relax\else\NAT@@close\fi\fi}{#1}{#2}}