将 \Acrobatmenu{GoBack} 与 bibtex 结合使用

将 \Acrobatmenu{GoBack} 与 bibtex 结合使用

这个问题是`\Acrobatmenu{GoBack}{}` 在 `\hyperref` 中的位置

我正在编写一份文档,其中文本和图表、表格和参考文献之间有许多超链接,这些链接均由 提供\hyperref。当读者单击文本中指向这些文档项目之一的超链接时,我希望在每个项目上提供一个返回按钮,以便忙碌的读者可以轻松单击并返回上一个文档区域。我更喜欢使用 Adob​​e Acrobat“返回”按钮,而不是使用,因为我认为这对读者来说更简单。我还更喜欢在用于引用和参考的包command-up arrow中使用“按钮”方法来实现。\backref

在我之前的问题中,@JasperHabicht 为图表提供了一个出色的解决方案。我希望每个参考文献都有类似的解决方案。理想情况下,我希望按钮(红色三角形)放置在每个参考文献的开头或结尾,根据需要。有 biblatex 解决方案(例如在参考书目中添加文本/评论),但 bibtex 解决方案是必要的,因为期刊似乎不使用 biblatex。

MWE,提供图表解决方案,但没有参考文献:

\documentclass[12pt]{amsart}

\usepackage{filecontents}

\begin{filecontents}{Fuzzyrefs.bib}

@article{Fuzzy:2019aa,
    Author = {Strong Fuzzy and Big Energy Wuzzy},
    Date-Added = {2019-10-13 10:35:56 -0700},
    Date-Modified = {2019-10-13 14:26:57 -0700},
    Doi = {},
    Journal = {{Fuzzy goes big}},
    Number = {5},
    Pages = {1--20},
    Title = {What a pretty red car you have!},
    Url = {},
    Volume = {5},
    Year = {2019},
    Bdsk-Url-1 = {}}

\end{filecontents}

\usepackage{geometry} % see geometry.pdf on how to lay out the page. There's lots.
\geometry{a4paper} % or letter or a5paper or ... etc

\usepackage{graphicx}
\usepackage{mathtools} 
\usepackage{amssymb} 

\usepackage[round]{natbib}

%% Remove square brackets from first author(s) in bibliography
%\makeatletter
%%\renewcommand{\@biblabel}[1]{\quad#1}%<--- \quad gives space of width letter "M" and indents bibliography by same
%\renewcommand{\@biblabel}[1]{#1}%left flush
%\makeatother

\renewcommand{\figurename}{\Acrobatmenu{GoBack}{$\blacktriangle$} Figure}
\renewcommand{\tablename}{\Acrobatmenu{GoBack}{$\blacktriangle$} Table}

\usepackage{hyperref} % use command left arrow to return to exact reference in Adobe Reader
\hypersetup{
     colorlinks=true,
    %hidelinks=true, 
    linkcolor=blue,
    citecolor=blue,
    filecolor=magenta,      
    urlcolor=blue,
}

\usepackage[all]{hypcap}

%%% BEGIN DOCUMENT
\begin{document}

\title{My Red Car}
\author{Fuzzy}
\maketitle

Fuzzy and Wuzzy drove the little red car all the way to toy town \citep{Fuzzy:2019aa}.

\begingroup
%\renewcommand{\section}[2]{}
\bibliographystyle{plainnat}
\bibliography{Fuzzyrefs.bib}
\endgroup

\section*{Figures}

\begin{figure}[htb!]
\includegraphics[width = 0.5\textwidth]{example-image-a}
\caption{
 \textbf{Fuzzy said yes.} What a wonderful affirmation.
}
\label{fig:Cat}
\end{figure}

\section*{Tables}
\begin{table}[htb!]
\begin{tabular}{ r r r }
\hline 
one & two & three \\
\hline
\end{tabular}
\caption{
 \textbf{Fuzzy said no.} She is strong and proud.
}
\label{tab:Cat}
\end{table}

\end{document}

输出:

模糊.jpg

答案1

我仔细研究了代码natbib.sty,大概找到了一个解决方案,将返回按钮放在每个参考书目条目之前。由于这是一种将一些代码插入其他代码的黑客行为,如果您使用其他参考书目样式,它可能会中断。也许其他人想出了更好的解决方案……

\documentclass[12pt]{amsart}

\usepackage{filecontents}
\begin{filecontents}{Fuzzyrefs.bib}
@article{Fuzzy:2019aa,
    Author = {Strong Fuzzy and Big Energy Wuzzy},
    Journal = {{Fuzzy goes big}},
    Number = {5},
    Pages = {1--20},
    Title = {What a pretty red car you have!},
    Volume = {5},
    Year = {2019}}

@article{Fuzzy:2019ab,
    Author = {Weak Fuzzy and Low Energy Wuzzy},
    Journal = {{Fuzzy goes big again}},
    Number = {6},
    Pages = {21--45},
    Title = {And a blue one as well!},
    Volume = {3},
    Year = {2020}}
\end{filecontents}

\usepackage{geometry} % see geometry.pdf on how to lay out the page. There's lots.
\geometry{a4paper} % or letter or a5paper or ... etc

\usepackage{graphicx}
\usepackage{mathtools} 
\usepackage{amssymb} 

\usepackage[round]{natbib}

\usepackage{etoolbox}
\makeatletter
\apptocmd{\NAT@bibitem@init}{\Acrobatmenu{GoBack}{$\blacktriangle$}~}{}{}
\makeatother

\usepackage{hyperref} % use command left arrow to return to exact reference in Adobe Reader
\hypersetup{
    colorlinks=true,
    %hidelinks=true, 
    linkcolor=blue,
    citecolor=blue,
    filecolor=magenta,      
    urlcolor=blue,
}

\usepackage[all]{hypcap}

%%% BEGIN DOCUMENT
\begin{document}

\title{My Red Car}
\author{Fuzzy}
\maketitle

Fuzzy and Wuzzy drove the little red car all the way to toy town \citep{Fuzzy:2019aa}, because the blue car had a flat tire \citep{Fuzzy:2019ab}.

\begingroup
%\renewcommand{\section}[2]{}
\bibliographystyle{plainnat}
\bibliography{Fuzzyrefs.bib}
\endgroup

\end{document}

在此处输入图片描述

相关内容