9

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

  • It seems to work with the command \backrefalt redefinition in 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 7 '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). – Ioannis Filippidis Dec 14 '17 at 21:14
9

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:)

  • Tiny [ and ] or no one, I suposse. ;) And, why the \relax? – Andrestand Jun 8 '14 at 18:57
  • @Andrestand Yeah, I like the normal size brackets and tiny backrefs...no idea why I put the \relax in :) – Andrew Jun 8 '14 at 22:29
  • ;) 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 8 '14 at 22:54
  • 1
    @Andrestand Sorry, you're right. I've corrected this. – Andrew Jun 8 '14 at 23:24
2

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.