pdf 上的引文链接正在作者列表和年份上创建

pdf 上的引文链接正在作者列表和年份上创建

以下是我现在正在做的事情。

\documentclass[11pt,english]{extarticle}
\usepackage{listings}
\lstset{language=Matlab}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{bm}
\usepackage{booktabs}
\usepackage{float}
\usepackage{color}
\usepackage[title,titletoc,toc]{appendix}
\usepackage[nohead]{geometry}
\usepackage[bottom]{footmisc}
\usepackage{endnotes}
\usepackage{graphicx}
\usepackage[center,bf]{caption}
\usepackage{morefloats}
\usepackage{epstopdf}
\usepackage{rotating}
\usepackage{enumerate}
\usepackage{bbm}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\numberwithin{equation}{section}
\usepackage{fancyhdr}
\setlength{\parindent}{24pt}
\setlength{\headheight}{0in}
\usepackage{longtable}
\usepackage{import}
\usepackage{natbib}
\setlength{\bibsep}{0pt plus 0.3ex}
\usepackage{microtype}

\usepackage{multirow}
\usepackage{adjustbox}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\usepackage{verbatim} 
\usepackage{setspace}
\linespread{1.3}
\usepackage{pdflscape}
\usepackage{subcaption}
\usetikzlibrary{arrows,calc}
\usepackage{setspace}
\usepackage{ragged2e}


%%%%%%%%%%% Suppress Warning
\usepackage{silence}
\WarningFilter{latex}{Text page}
\WarningFilter*{natbib}{Citation}
\WarningFilter*{natbib}{There}
 

\usepackage{changepage}
\newlength{\wideitemsep}
\setlength{\wideitemsep}{\itemsep}
\addtolength{\wideitemsep}{5pt}
\let\olditem\item
\renewcommand{\item}{\setlength{\itemsep}{7pt}\olditem}


\newcommand{\sym}[1]{{#1}}

\long\def\/*#1*/{}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Make Title appear in the top of the page
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{titling}
%\setlength{\droptitle}{-4em}
\setlength{\droptitle}{-2em}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% Directly brought from Lyx %%%%
\usepackage[T1]{fontenc}
\geometry{verbose,tmargin=2.7cm,bmargin=2.7cm,lmargin=2.5cm,rmargin=2.5cm}
\usepackage{amsthm}



\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
\theoremstyle{plain}
\newtheorem{thm}{\protect\theoremname}
\theoremstyle{plain}
\newtheorem{prop}[thm]{\protect\propositionname}
\ifx\proof\undefined
\newenvironment{proof}[1][\protect\proofname]{\par
    \normalfont\topsep6\p@\@plus6\p@\relax
    \trivlist
    \itemindent\parindent
    \item[\hskip\labelsep\scshape #1]\ignorespaces
}{%
    \endtrivlist\@endpefalse
}
\providecommand{\proofname}{Proof}
\fi
\theoremstyle{plain}
\newtheorem{cor}[thm]{\protect\corollaryname}

\makeatother

\usepackage{babel}
\providecommand{\corollaryname}{Corollary}
\providecommand{\propositionname}{Proposition}
\providecommand{\theoremname}{Theorem}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This package makes you cross-reference across different tex files.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{xr-hyper}
\usepackage[colorlinks=true,urlcolor=blue, linkcolor=blue, citecolor=blue]{hyperref}
\hypersetup{
filecolor=black
}

\makeatletter
\newcommand*{\addFileDependency}[1]{
  \typeout{(#1)}
  \@addtofilelist{#1}
  \IfFileExists{#1}{}{\typeout{No file #1.}}
}
\makeatother

\newcommand*{\myexternaldocument}[1]{
    \externaldocument{#1}
    \addFileDependency{#1.tex}
    \addFileDependency{#1.aux}
}
%%% END HELPER CODE

\myexternaldocument{online_appendix}



\begin{document}


\newpage{}
\setcounter{page}{1}


\section{Introduction}
\label{section:introduction} 

Words\footnote{hi}

Citation examples: 

\cite{Coase1992AER}




\newpage{}

\begin{singlespacing} %\nocite{*}
 \bibliographystyle{aer}
\bibliography{Reference}
 \end{singlespacing}


\end{document}

我使用的参考是

@article{Coase1992AER,
  title={The Institutional Structure of Production},
  author={Ronald H. Coase},
  journal={American Economic Review},
  volume={82},
  number={4},
  pages={713---719},
  year={1992}
}

然后,我得到了两个单独的链接。

我正确地得到了这个

在此处输入图片描述

但如果我将鼠标悬停在作者姓名上,此链接仅适用于作者姓名

在此处输入图片描述

如果我将鼠标悬停在年份上,此链接仅适用于年份部分。

在此处输入图片描述

但是创建超链接的标准方法是创建一个跨作者姓名和年份的统一链接,对吗?那么我想遵循标准做法。我该怎么做?


附录:与以前相同的材料,但现在以最小工作示例的形式或平均能量损失

\documentclass[11pt,english]{extarticle}
\begin{filecontents}[overwrite]{Reference.bib}
@article{Coase1992AER,
  title  ={The Institutional Structure of Production},
  author ={Ronald H. Coase},
  journal={American Economic Review},
  volume ={82},
  number ={4},
  pages  ={713-719},
  year   ={1992}
}
\end{filecontents}

\usepackage{natbib}
\bibliographystyle{aer}

\usepackage{babel}
\usepackage[T1]{fontenc}
\usepackage[colorlinks=true,urlcolor=blue, linkcolor=blue, 
            citecolor=blue, filecolor=black]{hyperref}

\begin{document}
\cite{Coase1992AER}
\bibliography{Reference}
\end{document}

答案1

你写了

但是创建超链接的标准方法是创建一个包含作者姓名和年份的统一链接,对吗?那么我想遵循标准做法。我该怎么做?

首先,我想重申 @moewe 在评论中表达的观点,即可能没有一种(更不用说“标准”)方法可以创建从作者年份样式的引文标注到相应格式的书目条目的超链接。据我所知,引文标注有两个单独的超链接或一个统一的超链接同样好。当然,我认为读者不会因为引文标注可能包含两个单独的超链接而感到困惑。

您的问题的解决方案实际上很容易找到Audrey B. 的回答,发布于 2011 年,针对查询natbib 和 hyperref 的(作者,年份)样式产生两个链接。令人高兴的是,尽管代码已经有 11 年的历史了,但它似乎仍然运行良好。这可能是因为这个natbib包在这段时间内也没有经历任何重大变化。

\citet{Coase1992AER}请考虑以下示例和相关屏幕截图。由和生成的引文标注\citep{Coase1992AER}现在是单个超链接。并且,在引文标注“(Coase, 1992a,b, 1993)”中,粒子Coase, 1992ab1993是 3 个单独的超链接,而不是 4 个。另外:请注意,围绕 输出的括号\citep不是超链接的一部分。此做法是natbib引文管理软件包的“标准”。

在此处输入图片描述

\documentclass[11pt,english]{extarticle}

%% Create a bib file on the fly:
\begin{filecontents}[overwrite]{Reference.bib}
@article{Coase1992AER,
  title  ={The Institutional Structure of Production},
  author ={Ronald H. Coase},
  journal={American Economic Review},
  volume ={82},
  number ={4},
  pages  ={713-719},
  year   ={1992},
}
@misc{Coase1992alt, title={Thoughts}, author={Ronald H. Coase}, year=1992}
@misc{Coase1993, title={Further Thoughts}, author={Ronald H. Coase}, year=1993}
\end{filecontents}

\usepackage[sort,round]{natbib}
\bibliographystyle{plainnat} % or some other suitable bibliography style

\usepackage{babel}
\usepackage[T1]{fontenc}
\usepackage[colorlinks=true,citecolor=blue]{hyperref}

%% The following code block is copied straight from Audrey B.'s answer
%% given at https://tex.stackexchange.com/a/27235/5001

\usepackage{etoolbox}

\makeatletter

\pretocmd{\NAT@citex}{%
  \let\NAT@hyper@\NAT@hyper@citex
  \def\NAT@postnote{#2}%
  \setcounter{NAT@total@cites}{0}%
  \setcounter{NAT@count@cites}{0}%
  \forcsvlist{\stepcounter{NAT@total@cites}\@gobble}{#3}}{}{}
\newcounter{NAT@total@cites}
\newcounter{NAT@count@cites}
\def\NAT@postnote{}

% include postnote and \citet closing bracket in hyperlink
\def\NAT@hyper@citex#1{%
  \stepcounter{NAT@count@cites}%
  \hyper@natlinkstart{\@citeb\@extra@b@citeb}#1%
  \ifnumequal{\value{NAT@count@cites}}{\value{NAT@total@cites}}
    {\ifNAT@swa\else\if*\NAT@postnote*\else%
     \NAT@cmt\NAT@postnote\global\def\NAT@postnote{}\fi\fi}{}%
  \ifNAT@swa\else\if\relax\NAT@date\relax
  \else\NAT@@close\global\let\NAT@nm\@empty\fi\fi% avoid compact citations
  \hyper@natlinkend}
\renewcommand\hyper@natlinkbreak[2]{#1}

% avoid extraneous postnotes, closing brackets
\patchcmd{\NAT@citex}
  {\ifNAT@swa\else\if*#2*\else\NAT@cmt#2\fi
   \if\relax\NAT@date\relax\else\NAT@@close\fi\fi}{}{}{}
\patchcmd{\NAT@citex}
  {\if\relax\NAT@date\relax\NAT@def@citea\else\NAT@def@citea@close\fi}
  {\if\relax\NAT@date\relax\NAT@def@citea\else\NAT@def@citea@space\fi}{}{}

\makeatother
%% end of copied code block


\begin{document}
\citet{Coase1992AER}, \citep{Coase1992AER}

\citep{Coase1992AER,Coase1993,Coase1992alt}

\bibliography{Reference}
\end{document}

相关内容