In my bibliography style, I have added a trigger to change the biblatex
bibliography back reference mechanism to refer to the paragraph numbers in the margins ("runners") instead of pages.
\def\blx@addbackref@i#1{%
\ifbacktracker
\blx@leavevmode
\if@filesw
\protected@write\@mainaux{}{\string\abx@aux@backref
{\the\c@instcount}{#1}{\the\c@refsection}%
{\ifbool{bbx:runner}%
{\therunner}%
{\thepage}}%
{\noexpand\the\c@page}}%
\fi
\fi%
}
\therunner
is added to a paragraph by using the macro from the jurabook
class
\newcommand*{\rn}[2][]{%
\if@dorunners%
\stepcounter{runner}%
#2\marginpar%
[\hfill{\small\sffamily\therunner}\hspace*{\jb@runnersspace@length}]%
{\hspace*{\jb@runnersspace@length}{\small\sffamily\therunner}\hfill}%
\protected@edef\@currentlabel{\therunner}%
\else%
#2
\fi% do NOT delete the percentage sign
\ifthenelse{\equal{#1}{\@empty}}%
{}% nix
%else
{\label{#1}}%
}
Since the runner mechanism is the only feature from the jurabook class I needed, I have copied that macro into my preamble rather than using the entire class.
If I now set the biblatex
option runner to true, thus switching bbx:runner
to true, the back reference numbers shown in the bibliography show the paragraph numbers shown in the document margins rather than the page numbers for each cited entry.
However, if I click the number, the link takes me to the page corresponding to the number rather than the paragraph corresponding to the number. This means that I have an entry that is cited in paragraph number 10 on page 6, the number shown in the bibliography will be 10. Clicking that number, however, takes me to page number 10.
Does anyone know how I need to adjust the back referencing mechanism to make the paragraph the hyperref
target of the numbers shown in the biblatex
bibliography?
\hyperlink
and\hypertarget
directly? I have used this combo in a similar situation - questions in the running text, and answers at the chapter end pointing to each other.\hypertarget
each time\blx@addbackref@i
is called and then patch the back reference mechanism inbiblatex
to refer to this target? My problem basically is that I don't know howbiblatex
sets the link? Does it use\hyperlink
? How does it determine the argument for it? I understand the biblatex.sty code too little.\hyperlink
, and probably prefixes the argument withpage.
. The link is set by thepageref
bibmacro in standard styles. You can see this by taking a look atstandard.bbx
. Thepageref
bibmacro is defined inbiblatex.def
.pageref
macro prints the pageref link. The hyperlinking is done by the list formatting for this list. If the pageref list contains more than one item,\DeclareListFormat{pageref}
calls, amongst others, three macros:pageref:init
,pageref:comp
andpageref:dump
. If the pageref list contains exactly one item, it is printed by\hyperlink{page.#1}{#1}
(provided hyperrefs are used). So in the easiest example (only one back reference), I would need to modify\hyperlink{page.#1}{#1}
to refer to thetherunner
rather thanthepage
.