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

2
  • 1
    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
    Commented Jun 7, 2014 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 _
    Commented Dec 14, 2017 at 21:14

2 Answers 2

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

8
  • 1
    Tiny [ and ] or no one, I suposse. ;) And, why the \relax?
    – Andrestand
    Commented Jun 8, 2014 at 18:57
  • 1
    @Andrestand Yeah, I like the normal size brackets and tiny backrefs...no idea why I put the \relax in :)
    – user30471
    Commented Jun 8, 2014 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
    Commented Jun 8, 2014 at 22:54
  • 2
    @Andrestand Sorry, you're right. I've corrected this.
    – user30471
    Commented Jun 8, 2014 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? Commented Apr 6, 2020 at 5:10
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
3
  • 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
    Commented Sep 6, 2022 at 5: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 :-) Commented Sep 6, 2022 at 12:37
  • 1
    I have done what you suggested. See: tex.stackexchange.com/questions/656431/… Thank you!
    – Steven
    Commented Sep 7, 2022 at 2:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .