2

This question is a follow-on from Placement of `\Acrobatmenu{GoBack}{}` in `\hyperref`.

I am writing a document with many hyperlinks between the text and Figures, Tables and References, courtesy of \hyperref. When the reader clicks a hyperlink in the text to one of these document itmes, I would like to provide a return button on each of the items so that the busy reader can easily click and go back to the previous document area. I prefer to use an Adobe Acrobat "go back" button rather than using command-up arrow because this is simpler for the reader, I believe. I also prefer my "button" approach to the implementation in the \backref package which is used for citations and references.

In my previous question, @JasperHabicht provided an excellent solution for the Figures and Tables. I would love a similar solution for each reference. Ideally I would like the button (a red triangle) placed at the beginning of each reference or at the end, as desired. There are biblatex solutions (eg Add Text/Comment into bibliography), but a bibtex solution is necessary, as journals seem to not use biblatex.

MWE, with solution for Figures and Tables, but not references:

\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}

Output:

Fuzzy.jpg

Bob
  • 263
  • 1
    Well, the problem I see here is that you use hard-coded bibitems. You could just place your code after each of them, but I currently have no idea how to do this automatically. – Jasper Habicht Oct 20 '19 at 06:42
  • Sorry @JasperHabicht, I did not mean to imply use of hard-coded bibitems. I use a .bib file and formatting using bibtex in the usual fashion. I have revised my MWE to reflect these observations. Many thanks! – Bob Oct 20 '19 at 19:34

1 Answers1

3

I worked my way through the code of natbib.sty and probably found a solution where the go-back button is placed before each bibliography entry. As this is kind of a hack that inserts some code into other code, it may break if you use another bibliography style. Maybe someone else comes up with a better solution …

\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}

enter image description here

  • Wow, @JasperHabicht, major LaTeX-fu. Kudos to you! I'll wait a day or two and accept your answer. Thanks so very much! – Bob Oct 20 '19 at 22:17