19

I'm using the option pagebackref in hyperref package and I get just the links list at the end of each reference name. It should print something like "Cited on page/s ", but I don't manage it even to do that.

My aim is to change some command to make it say that in Spanish, and I found it already considers Spanish in backref.sty, which is called by hyperref, I think... Reading hyperref, backref, backrefx's documentation didn't help.

Any guess?

Related: Formatting back references in bibliography

Andrestand
  • 1,085
  • 1
    It seems to work with the command \backrefalt redefinition in http://tug.org/pipermail/texhax/2009-November/013746.html , which is also mentioned in the backrefx documentation, although after some other code I didn't even try as I don't know very well how it works. Mine is a trial and error approach. – Andrestand Jun 07 '14 at 16:46
  • 1
    For those looking for how to create back-references without hyperref, consider using the package citeref (listed among the suggestions here, see also this discussion, in particular the comments about licensing). – 0 _ Dec 14 '17 at 21:14

2 Answers2

22

Use:

\usepackage[pagebackref=true]{hyperref}
\renewcommand*{\backref}[1]{}
\renewcommand*{\backrefalt}[4]{[{\tiny%
    \ifcase #1 Not cited.%
          \or Cited on page~#2.%
          \else Cited on pages #2.%
    \fi%
    }]}

I put this is in a \tiny font in between square brackets []. Change to your own tastes:)

  • 1
    Tiny [ and ] or no one, I suposse. ;) And, why the \relax? – Andrestand Jun 08 '14 at 18:57
  • 1
    @Andrestand Yeah, I like the normal size brackets and tiny backrefs...no idea why I put the \relax in :) –  Jun 08 '14 at 22:29
  • 1
    ;) What I meant is that with that code my PDFLaTeX is printing a normalsize [ but a tiny ], as the second one is before the first }. – Andrestand Jun 08 '14 at 22:54
  • 2
    @Andrestand Sorry, you're right. I've corrected this. –  Jun 08 '14 at 23:24
  • 1
    If there are m,ore pages, this returns, for instance, Cited on pages 2, 3 and 4. I am writing in another language (portuguese), so I would like to change the word and to the portuguese word e. How can I do it? – Pedro G. Mattos Apr 06 '20 at 05:10
  • @PedroG.Mattos The and comes from hyperref. Try using babel or asking a new question/. –  Apr 06 '20 at 11:30
  • I can't get this solution to work with the Tufte-Book class. Any help is much appreciated! I should mention that since the Tufte-Book class automatically loads hyperref, I had to include this as well: \usepackage[hyperpageref]{backref} – Steven Sep 06 '22 at 06:09
  • How to adapt it for \usepackage[backref=section]{hyperref}? I receave (document), instead of "section name", for example, as backref to \cite{} by using [backref=section]... – Riccardo Volpe Feb 20 '23 at 02:44
7

For a similar scenario, I preferred using a more concise text and explain it at the beginning of the bibliography, rather than using \tiny (which looks bad here, especially inside normal-sized brackets). Combining Andrew's answer with natbib's \bibpreamble and some space before the actual reference list with \bigskip, I ended up with the following setup, to customize as needed:

% Add any needed options:
\usepackage{natbib}
\usepackage[backref=page]{hyperref}

% Customize list of backreferences.
% From https://tex.stackexchange.com/a/183735/1340
\renewcommand*{\backref}[1]{}
\renewcommand*{\backrefalt}[4]{%
    \ifcase #1%
          \or [Page~#2.]%
          \else [Pages~#2.]%
    \fi%
    }
% Explain list of backreferences.
% https://tex.stackexchange.com/a/70953/1340
\renewcommand{\bibpreamble}{%
  [Citing pages are listed after each reference.]%
  \par\bigskip}

Of course, one can customize that preamble text (and formatting) further. To move the prelude closer to the title, for now I've settled on the following—but I'm not sure such low-level tuning is good typography (the above looks safer), so YMMV:

\newcommand{\myBibPreambleText}{[Citing pages are listed after each reference.]}

\renewcommand{\bibpreamble}{%
  \vspace{-2 \bigskipamount}%
  \myBibPreambleText%
  \par \vspace{2 \bigskipamount}}

EDIT: instead of hacking vertical spacing like that, it's probably more robust (typographically) to modify \bibsection to add a "subtitle", so that TeX computes the appropriate position. I can do this with the following code, where I've added \\ {\normalsize\mdseries \myBibPreambleText} to the definition of \bibsection which was in use for me, unless I load the tocbibind package, which rewrites the relevant code.

\newcommand{\myBibPreambleText}{[Citing pages are listed after each reference.]}

\makeatletter
\renewcommand{\bibsection}{
  \chapter*{\bibname \\ {\normalsize\mdseries \myBibPreambleText}}
  \@mkboth {\MakeUppercase {\bibname }}{\MakeUppercase {\bibname }}
}
\makeatother
  • 1
    I have tried to make the above solutions work with the Tufte-Book class using bibtex but to no avail. Any direction would be appreciated. – Steven Sep 06 '22 at 05:21
  • 1
    @Steven I forget the details of this answer, but \renewcommand tells me this solution was patching the internals of the involved packages. To adapt the answer, somebody probably needs to look at how the Tufte-Book class changes the bibliography code. If you need help with that, I recommend a new question with a MWE :-) – Blaisorblade Sep 06 '22 at 12:37
  • 1
    I have done what you suggested. See: https://tex.stackexchange.com/questions/656431/back-referencing-from-bibliography-using-tufte-book-class-bibtex Thank you! – Steven Sep 07 '22 at 02:15