2

I wish to change a line from the Heiko Oberdiek's backref.sty in my document directly. The line reads:

\long\def\hyper@page@backref#1#2#3{\hyperlink{page.#1}{#1}}

I have something to add there:

\long\def\hyper@page@backref#1#2#3{(cited on page \hyperlink{page.#1}{#1}$\uparrow$)}

It works pretty well in backref.sty, but is ignored when put into my document. I do not want to export edited .sty files with such a small change to other local machines, where my document is supposed to be compiled.

egreg
  • 1,121,712
  • 2
    Welcome to TeX.SX! We prefer a full document where this feature occurs in order to provide help. A single line of code is not helpful in most cases. Please show what you have done so far. An 'ordinary' patch should work eventually. I can imagine also that this after to put into \AtBeginDocument{...} –  Nov 14 '15 at 23:03
  • 7
    if you put that line in the preamble you need to surround it with \makeatletter ... \makeatother – David Carlisle Nov 14 '15 at 23:04

1 Answers1

1

While your wish does not seem to make sense to me if I try to understand it literally, my guess is that the problem you are experiencing is the following:

From a quick glance at backref.sty, the macro \hyper@page@backref seems to be used only once: If the option hyperpageref is set, then \hyper@page@backref is copied to \backrefxxx using \let (see What is the difference between \let and \def?). Thus, the problem is the following: When you call \usepackage, then \hyper@page@backref is defined, and its value is copied to \backrefxxx immediately. When you change \hyper@page@backref later, this has no effect, since \hyper@page@backref is not used anymore.

You could try to redefine \backrefxxx directly (but I did not try that).

jarauh
  • 2,762
  • 15
  • 27