修复单行参考书目中的链接

修复单行参考书目中的链接

我正在创建一个用项目符号分隔的单行参考书目,方式如下:

\documentclass{scrreprt}
\usepackage{xcolor}
\usepackage[colorlinks=true,citecolor=blue,]{hyperref}
\usepackage{natbib}
\usepackage{lipsum}
\usepackage{paralist}
\usepackage{filecontents}

\begin{filecontents}{bibliography.bib}

    @ARTICLE{einstein1,
    author = {{Einstein}, A. and {Podolsky}, B. and {Rosen}, N.},
     title = "{Can Quantum-Mechanical Description of Physical Reality Be Considered Complete?}",
   journal = {Physical Review},
      year = 1935,
     month = may,
    volume = {47},
    number = {10},
     pages = {777-780},
    }

    @ARTICLE{einstein2,
    author = {{Einstein}, A.},
     title = "{{\"U}ber die von der molekularkinetischen Theorie der W{\"a}rme geforderte Bewegung von in ruhenden Fl{\"u}ssigkeiten suspendierten Teilchen}",
   journal = {Annalen der Physik},
      year = 1905,
     month = jan,
    volume = {322},
    number = {8},
     pages = {549-560},
}

\end{filecontents}

% define a bullet that doesn't work the first time around

\makeatletter
\newcommand{\mybullet}{%
    \ifnum\value{enumi}=1
    \else
        $\bullet$
    \fi
}
\makeatother

% make a single line bibliography

\renewenvironment{thebibliography}[1]{\let\par\relax%
  \section*{\refname}\inparaenum[\mybullet]}{\endinparaenum}
\let\oldbibitem\bibitem
\renewcommand{\bibitem}{\item \oldbibitem}

% DOCUMENT

\begin{document}

\lipsum

Let us cite \citet{einstein1} \citep[but also][]{einstein2}

\lipsum

\bibliography{bibliography}
\bibliographystyle{apalike}

\end{document}

这是按预期工作的,主要来自这里。但正如该答案所述,超链接已损坏。有没有简单的方法可以修复它?显然,这是因为我们必须使用编号列表,但只能使用项目符号。修复方法是将参考文献超链接到参考书目的最后一页或开头,这样就足够了。

相关内容