Debian Codegraph @

texmf-dist/tex/generic/tex4ht/biblatex.4ht

raw
1 % biblatex.4ht (2023-12-11-13:31), generated from tex4ht-4ht.tex
2 % Copyright 2007-2009 Eitan M. Gurari
3 % Copyright 2009-2023 TeX Users Group
4 %
5 % This work may be distributed and/or modified under the
6 % conditions of the LaTeX Project Public License, either
7 % version 1.3c of this license or (at your option) any
8 % later version. The latest version of this license is in
9 % http://www.latex-project.org/lppl.txt
10 % and version 1.3c or later is part of all distributions
11 % of LaTeX version 2005/12/01 or later.
12 %
13 % This work has the LPPL maintenance status "maintained".
14 %
15 % The Current Maintainer of this work
16 % is the TeX4ht Project <http://tug.org/tex4ht>.
17 %
18 % If you modify this program, changing the
19 % version identification would be appreciated.
20 \immediate\write-1{version 2023-12-11-13:31}
21
22 \def\make:blx:ver#1.#2#3\relax{%
23 %\ifdim#1pt< 3pt \xdef\blx:ver:no{2}\else\xdef\blx:ver:no{3}\fi%
24 \gdef\blx:ver:no{#1}
25 \gdef\blx:subver:no{#2}
26 }
27 \expandafter\make:blx:ver\[email protected]\relax
28 \ifx\a:printshorthands\Undef\let\blx@shorthands\@empty\fi
29 \ifx\blx@startbib\:UnDef
30 \pend:def\blx@shorthands{%
31 \pend:def\blx@bibinit{%
32 \HAssign\shorthands:cnt=0
33 \NewConfigure{printfield-shorthand}{2}%
34 \Configure{printfield-shorthand}%
35 {\gHAdvance\shorthands:cnt by 1\relax
36 \ifnum \shorthands:cnt=1 \a:printshorthands
37 \else \c:printshorthands \fi
38 }
39 {\d:printshorthands}%
40 \append:def\endtheshorthands{\b:printshorthands}%
41 \csname a:@shorthands\endcsname}
42 }
43 \ifx\b:printshorthands\Undef\let\endtheshorthands\@empty\fi
44 \def\a:entryhead{CVR}
45 \def\a:entryhead:full{CV Radhakrishnan}
46 \ifx\bib@macro@entryhead:name\UnDef
47 \let\bib@macro@entryhead:name\@empty\fi
48 \ifx\bib@macro@entryhead:full\UnDef
49 \let\bib@macro@entryhead:full\@empty\fi
50 \gdef\BibFileName[#1]#2{\expandafter\xdef\csname
51 BibFileName#1\endcsname{#2}}
52 \newcount\sv:sec:cnt
53 \def\bibSecConfigure{%
54 \let\save:section\section
55 \global\sv:sec:cnt=\c@secnumdepth
56 \def\section{\@ifstar
57 {\c@secnumdepth=0\relax\save:section}%
58 {\c@secnumdepth=\sv:sec:cnt\save:section}}%
59 }
60 \gHAssign\bibN=0
61 \ifdefined\TE@hook\else%
62 \def\TE@hook{}%
63 \fi%
64
65 \AtBeginDocument{%
66 \Configure{ifthenelse}{\TE@hook}
67 }
68 \:CheckOption{ooffice}\if:Option
69 \def\bibConfigure{\ConfigureList{thebibliography}%
70 {\IgnorePar\EndP \gHAdvance\bib:N by 1
71 \HCode{<text:bibliography text:name="bib-\bib:N" >
72 <text:bibliography-source>\Hnewline
73 <text:index-title-template>}
74 \NoFonts\ref:name\EndNoFonts
75 \HCode{</text:index-title-template>\Hnewline
76 %
77 <text:bibliography-entry-template\Hnewline
78 text:bibliography-type="custom1"
79 text:style-name="Bibliography11">\Hnewline
80 %
81 <text:index-entry-bibliography
82 text:bibliography-data-field="identifier"/>\Hnewline
83 %
84 <text:index-entry-span>: </text:index-entry-span>\Hnewline
85 <text:index-entry-bibliography
86 text:bibliography-data-field="author" />\Hnewline
87 <text:index-entry-span>, </text:index-entry-span>\Hnewline
88 %
89 <text:index-entry-bibliography
90 text:bibliography-data-field="title" />\Hnewline
91 <text:index-entry-span>, </text:index-entry-span>\Hnewline
92 %
93 <text:index-entry-bibliography
94 text:bibliography-data-field="year" />\Hnewline
95 </text:bibliography-entry-template>\Hnewline\Hnewline
96 </text:bibliography-source>\Hnewline
97 <text:index-body>\Hnewline}%
98 \let\en:bib=\empty
99 }%
100 {\en:bib\HCode{</text:index-body></text:bibliography>}}
101 {\en:bib\gdef\en:bib{\HCode{</text:p>\Hnewline}}%
102 \HCode{<text:p text:style-name="p-bibitem">}%
103 \gHAdvance\bibN by 1
104 \HCode{<text:reference-mark
105 text:name="X0-\csname BIB-\bibN\endcsname">%
106 </text:reference-mark>}%
107 }%
108 {}{}
109 }
110
111 \else
112 \def\bibConfigure{%
113 \ConfigureList{thebibliography}
114 {\ifvmode \IgnorePar \fi \EndP \EndP
115 \HCode {<dl class="thebibliography">}%
116 %
117 % This is for linking citations with biblist items which
118 % are in a different file when output is split into different
119 % chunks. [CVR 2012-09-27]
120 %
121 %
122 % <biblatex-2.2>
123 %
124 \immediate\write\@auxout{%
125 \string\providecommand\string\BibFileName[2][]{}
126 }%
127 \immediate\write\@auxout{%
128 \string\BibFileName[\therefsection]{\FileName}}%
129 %
130 % </biblatex-2.2>
131 %
132 \PushMacro \end:itm \global \let \end:itm =\empty}%
133 {\ifvmode \IgnorePar \fi \EndP
134 \PopMacro \end:itm \global \let \end:itm \end:itm \EndP
135 \HCode {</dd></dl>}\ShowPar}%
136 {\ifvmode \IgnorePar \fi \EndP \gHAdvance \bibN by 1
137 \end:itm \global \def \end:itm {\EndP \Tg </dd>}%
138 \HCode {<dt id="X\therefsection-\abx@field@entrykey"
139 class="thebibliography">}\bgroup \bf}%
140 {\ifvmode \IgnorePar \fi \EndP
141 \egroup
142 \HCode {</dt><dd\Hnewline id="bib-\bibN"
143 class="thebibliography">}%
144 \par \ShowPar}%
145 }
146
147 \fi
148 \NewConfigure{printshorthands}{4}
149 \NewConfigure{@shorthands}[1]{\concat:config\a:@shorthands{#1}}
150 \let\a:@shorthands\empty
151 \def\nolinkurl#1{#1}
152 % \def\blx@checksum{\ifx \blx@checksum@old \blx@checksum@new \else
153 % \blx@warning@noline {Page references have changed.\MessageBreak
154 % Rerun to get references right}\@tempswatrue \blx@reruntrue \fi
155 % \@nameuse {blx@rerun}}
156 \def\blx@checksum#1#2#3{%
157 \begingroup
158 \blx@tempcnta\the\numexpr0#2*0#3\relax
159 \blx@tempcntb\blx@tempcnta
160 \divide\blx@tempcntb10
161 \multiply\blx@tempcntb10
162 \advance\blx@tempcnta-\blx@tempcntb
163 \xdef#1{#1\the\blx@tempcnta}%
164 \endgroup}
165
166 \@ifpackagelater{biblatex}{2018/03/01}{\let\blx:pend:def\pend:defI}{\let\blx:pend:def\pend:def}
167 \blx:pend:def\blx@bibliography{\bibSecConfigure%
168 \pend:def\blx@bibinit{%
169 \bibConfigure
170 \csname onthebibliography:list\endcsname
171 }%
172 }
173 \let\en:bib\@empty
174 \newcounter{bib}
175 \ifnum\blx:ver:no < 3
176 \protected\def\blx@bbl@entry#1#2#3{%
177 \begingroup
178 \def\texht@bibkey{#1}
179 \edef\abx@field@entrykey{\detokenize{#1}}%
180 \global\advance\c@bib 1
181 \immediate\write\@auxout{\string\expandafter\string\gdef
182 \string\csname\space BIB-\thebib\string\endcsname
183 {\expandafter\strip@prefix\meaning\texht@bibkey}}%
184 \Tag{)QX\therefsection-#1}{\thebib}%
185 \blx@setoptions@type{#2}%
186 \blx@bbl@options{#3}%
187 \blx@setoptions@entry
188 \edef\blx@bbl@data{blx@data@\the\c@refsection @\abx@field@entrykey}%
189 \csuse\blx@bbl@data
190 \cslet\blx@bbl@data\@empty
191 \blx@bbl@addfield{entrykey}{\abx@field@entrykey}%
192 \blx@bbl@addfield{entrytype}{#2}%
193 \blx@imc@iffieldundef{options}
194 {}
195 {\blx@bbl@fieldedef{options}{\expandonce\abx@field@options}}}
196 %
197 \protected\def\blx@finentry{%
198 \unspace
199 \a:finentry
200 \finentrypunct
201 \blx@postpunct
202 \b:finentry
203 \blx@initunit
204 }
205 %
206 \else
207 % Biblatex 3.0
208 %
209 % Hacks for biblatex
210
211 % I don't really understand this, but language processing is broken by default
212 % with biblatex. It loads language file, but it executes code which should be
213 % executed only in the case if the language file fails, it displays an error message
214 % and language handling doesn't work. When we execute following code, the language
215 % files are loaded before checking of the success and it seems to work.
216
217 \AtBeginDocument{%
218 \@ifpackageloaded{babel}
219 {% This is required for languages which are never explicitly selected
220 % It seems this code was executed also with Polyglossia, where it caused compilation error
221 \@ifpackageloaded{polyglossia}{}{%
222 \def\do#1{\blx@lbxinput{#1}{}{}}%
223 \ifx\@empty\bbl@loaded\else%
224 \expandafter\docsvlist\expandafter{\bbl@loaded}%
225 \fi}}{}%
226 }
227 \fi % end of version boolean
228 \NewConfigure{finentry}{2}
229 \def\:tempc[#1]#2{%
230 \expandafter\ifx \csname a:printfield-#2\endcsname\relax
231 \NewConfigure{printfield-#2}{2}%
232 \a:printfield{printfield-#2}%
233 \fi
234 \Configure{blx@unit}%
235 {\csname a:printfield-#2\endcsname}%
236 {\csname b:printfield-#2\endcsname}%
237 \csname o:\string\blx@printfield:\endcsname[#1]{#2}%
238 }
239 \expandafter\HLet\csname\string\blx@printfield\endcsname\:tempc
240 \NewConfigure{printfield}[1]{\def\a:printfield##1{#1}}
241 \Configure{printfield}{%
242 \Configure{#1}%
243 {\HCode{<!--#1-->}}%
244 {\HCode{<!--/#1-->}}%
245 }
246 \def\:tempc[#1]#2{%
247 \expandafter\ifx \csname a:bibstring-#2\endcsname\relax
248 \NewConfigure{bibstring-#2}{2}%
249 \a:printfield{bibstring-#2}%
250 \fi
251 \Configure{blx@unit}%
252 {\csname a:bibstring-#2\endcsname}%
253 {\csname b:bibstring-#2\endcsname}%
254 \csname o:\string\blx@bibstring:\endcsname[#1]{#2}%
255 }
256 \expandafter\HLet\csname\string\blx@bibstring\endcsname\:tempc
257 \def\:tempc[#1]#2{%
258 \expandafter\ifx \csname a:bibcpstring-#2\endcsname\relax
259 \NewConfigure{bibcpstring-#2}{2}%
260 \a:printfield{bibcpstring-#2}%
261 \fi
262 \Configure{blx@unit}%
263 {\csname a:bibcpstring-#2\endcsname}%
264 {\csname b:bibcpstring-#2\endcsname}%
265 \csname o:\string\blx@bibcpstring:\endcsname[#1]{#2}%
266 }
267 \expandafter\HLet\csname\string\blx@bibcpstring\endcsname\:tempc
268 \def\:tempc[#1]#2{%
269 \expandafter\ifx \csname a:biblcstring-#2\endcsname\relax
270 \NewConfigure{biblcstring-#2}{2}%
271 \a:printfield{biblcstring-#2}%
272 \fi
273 \Configure{blx@unit}%
274 {\csname a:biblcstring-#2\endcsname}%
275 {\csname b:biblcstring-#2\endcsname}%
276 \csname o:\string\blx@biblcstring:\endcsname[#1]{#2}%
277 }
278 \expandafter\HLet\csname\string\blx@biblcstring\endcsname\:tempc
279 \def\:tempc[#1]#2{%
280 \expandafter\ifx \csname a:bibucstring-#2\endcsname\relax
281 \NewConfigure{bibucstring-#2}{2}%
282 \a:printfield{bibucstring-#2}%
283 \fi
284 \Configure{blx@unit}%
285 {\csname a:bibucstring-#2\endcsname}%
286 {\csname b:bibucstring-#2\endcsname}%
287 \csname o:\string\blx@bibucstring:\endcsname[#1]{#2}%
288 }
289 \expandafter\HLet\csname\string\blx@bibucstring\endcsname\:tempc
290 \NewConfigure{biblatex-style}[2]{%
291 \def\:temp{#1}%
292 \ifx \:temp\blx@cbxfile
293 #2%
294 \global\let\biblatex:style\def
295 \fi
296 }
297
298 \def\biblatex:style{}
299 \Configure{biblatex-style}{}{}
300
301 \pend:def\at:docend{%
302 \ifx \UnDef\biblatex:style
303 \:warning{\string\Configure{biblatex-style}{\blx@cbxfile}{...}
304 not available}%
305 \fi
306 }
307 \let\blx:item\@item
308 \def\@item[#1]{%
309 \blx:item[#1]%
310 \ifhmode \spacefactor\blx@sf@par\fi
311 }
312 \let\blx@resetpuncthook\@empty
313 \let\blx@csq@ifkernmark\@empty
314 \newskip\blx@unitmark
315 \blx@unitmark=10pt plus 1pt minus 1pt
316 \let\abx@aux@page\@gobbletwo
317 \let\abx@aux@fnpage\@gobbletwo
318 \let\abx@aux@refsection\@gobbletwo
319 %
320 % <[email protected]> reported that After updating
321 % biblatex and biblatex.ht to versions 2.2 respectively
322 % 2012-09-28-17:49 (using MiKTeX 2.9 64 bit), tex4ht seemed no longer
323 % respected the defernumbers option in biblatex.sty: When applied to
324 % the attached file tex4hterror.tex.
325 %
326 % The problem was due to nullifying \abx@aux@number which in fact
327 % should have been redefined to \blx@aux@number when defernumbers
328 % option is true.
329 %
330 % This is done now and as per Kristian, the fix works fine now.
331 %
332 \ifnum\blx:ver:no < 3
333 %
334 \protected\def\blx@aux@number#1#2#3#4{%
335 \blx@bbl@addentryfield{\detokenize{#2}}{#3}{localnumber}{#4}%
336 \ifblank{#4}%
337 {}%
338 {\csgdef{blx@labelnumber@#3}{#4}%
339 %\blx@addchecksum{#1}{#4} % this can cause a nodocument error!
340 }}
341 %
342 \iftoggle{blx@defernumbers}%
343 {\setkeys{blx@opt@pre}{labelnumber}%
344 \let\blx@thelabelnumber\blx@addlabelnumber
345 \let\abx@aux@number\blx@aux@number}%
346 {\let\blx@thelabelnumber\relax
347 \let\abx@aux@number\@gobblefour}
348 %
349 \else
350 \def\@gobblefive#1#2#3#4#5{}%
351 \protected\def\blx@aux@number#1#2#3#4#5{%
352 \blx@bbl@addentryfield{\detokenize{#2}}{#3}{localnumber}{#4}{#5}%
353 \blx@bbl@addentryfield{\detokenize{#2}}{#3}{labelnumber}{#4}{#5}%
354 \global\toggletrue{blx@localnumber}%
355 \ifblank{#5}
356 {}
357 {\csgdef{blx@labelnumber@#3@#4}{#5}}}
358
359 \iftoggle{blx@defernumbers}%
360 {\setkeys{blx@opt@pre}{labelnumber}%
361 \let\blx@thelabelnumber\blx@addlabelnumber
362 \let\abx@aux@number\blx@aux@number}%
363 {\let\blx@thelabelnumber\relax
364 \let\abx@aux@number\@gobblefive}
365 \fi % end of version boolean
366 %
367 \AtEndDocument{%
368 \def\abx@aux@page#1#2{\blx@addpagesum{#1}{#2}}%
369 \def\abx@aux@fnpage#1#2{\blx@addpagesum{#1}{#2}}%
370 }
371 %
372 \def\blx@begunit{%
373 \toggletrue{blx@tempa}%
374 \iftoggle{blx@insert}%
375 {\iftoggle{blx@unit}%
376 {\begingroup
377 \let\blx@begunit\@empty
378 \let\blx@endunit\@empty
379 \let\blx@endnounit\@empty
380 \blx@unitpunct\blx@postpunct
381 \endgroup
382 \global\togglefalse{blx@unit}%
383 \togglefalse{blx@tempa}}
384 {\blx@postpunct}%
385 \iftoggle{blx@block}%
386 {\begingroup
387 \let\blx@begunit\@empty
388 \let\blx@endunit\@empty
389 \let\blx@endnounit\@empty
390 \newblockpunct
391 \endgroup
392 \global\togglefalse{blx@block}%
393 \togglefalse{blx@tempa}}%
394 {}}%
395 {}%
396 \blx@postpunct
397 \blx@imc@resetpunctfont
398 \iftoggle{blx@tempa}%
399 {}%
400 {\global\togglefalse{blx@insert}}%
401 \csname a:blx@unit\endcsname
402 \blx@leavevmode
403 \begingroup
404 \Configure{blx@unit}{}{}%
405 }
406 \def\blx@endunit{%
407 \endgroup
408 \csname b:blx@unit\endcsname%
409 \Configure{blx@unit}{}{}%
410 \global\toggletrue{blx@insert}%
411 \global\toggletrue{blx@lastins}%
412 }
413 \NewConfigure{blx@unit}{2}
414
415 %
416 \else
417 \fi
418
419 \ifdefined\XeTeXversion
420 \def\abx@aux@defaultrefcontext#1#2#3{%
421 \csxdef{blx@assignedrefcontextbib@#1@\detokenize{#2}}{\detokenize{#3}}}
422 \fi
423 \renewrobustcmd*{\addnbspace}{%
424 \unspace\blx@postpunct%
425 % insert real non-breaking space character
426 \nobreakspace\blx@imc@resetpunctfont}
427
428 \NewConfigure{thebibliography}{4}
429 \append:def\blx@bibinit{\a:bibinit}%
430 \NewConfigure{bibinit}{1}%
431
432 \let\blx@anchors\@empty
433 \let\bib@field@entrykey\@empty
434
435 \protected\def\blx@anchor{%
436 \xifinlist{X\the\c@refsection -%@
437 \bib@field@entrykey}{\blx@anchors}%
438 {}%
439 {\listxadd\blx@anchors{X\the\c@refsection -%@
440 \bib@field@entrykey}%
441 \hyper:natanchorstart{X\the\c@refsection -%@
442 \bib@field@entrykey}%
443 \hyper:natanchorend}}
444
445 \protected\def\blx@bibhyperref{%
446 \@ifnextchar[%]
447 {\blx@bibhyperref@i}%
448 {\blx@bibhyperref@i[\bib@field@entrykey]}}%
449
450 \long\def\blx@bibhyperref@i[#1]#2{%
451 \hyper:natlinkstart{X\the\c@refsection -%@
452 #1}%
453 #2\hyper:natlinkend}%
454
455 \protected\long\def\blx@bibhyperlink#1#2{%
456 \hyper:natlinkstart{X\the\c@refsection -%:
457 #1}%
458 #2\hyper:natlinkend}%
459
460 \protected\long\def\blx@bibhypertarget#1#2{%
461 \@bsphack
462 \hyper:natanchorstart{X\the\c@refsection -%:
463 #1}%
464 \@esphack
465 #2\hyper:natanchorend}%
466
467 \let\blx@ifhyperref\@firstoftwo
468
469 % Oleg Domanov [email protected] reports:
470 % tex4ht ends with an error when compiles biblatex files. I'm on
471 % Windows, texlive 2012. I put here a minimal example and files
472 % generated with the command latexmk test && mk4ht oolatex test
473 %
474 % https://www.dropbox.com/s/hn1zm40htqs13mf/t4htlink.zip
475 %
476 % There is a superfluous \relax in the file test.tmp, line 65 which
477 % seems to cause the error.
478 %
479 % Changes to cope with biblatex upgrade caused this problem. It is now
480 % fixed. --CVR 2012/10/26
481 %
482 \:CheckOption{ooffice}\if:Option
483 \def\hyper:natanchorstart#1{\Link{}{#1}\EndLink}%
484 \def\hyper:natlinkstart#1{\Link{#1}{}}%
485 \else
486 \def\hyper:natanchorstart#1{%
487 \expandafter\ifx\csname QXpage.\thepage\endcsname\relax%
488 \Tag{)Qpage.\thepage}{\file:id}%
489 \HCode{<a id="page.\thepage"></a>}%
490 \expandafter\xdef\csname QXpage.\thepage\endcsname{0}%
491 \fi
492 \Link[\csname BibFileName\therefsection\endcsname]{}{#1}\EndLink}
493 \def\hyper:natlinkstart#1{%
494 \expandafter\ifx\csname QXpage.\thepage\endcsname\relax%
495 \Tag{)Qpage.\thepage}{\file:id}%
496 \HCode{<a id="page.\thepage"></a>}%
497 \expandafter\xdef\csname QXpage.\thepage\endcsname{0}%
498 \fi
499 \Link[\csname BibFileName\therefsection\endcsname]{#1}{}}
500 \fi
501 \def\hyper:natanchorend{}
502 \def\hyper:natlinkend{\EndLink}
503 \def\writeCiteLink#1{\immediate\write\@mainaux{%
504 \string\@namedef{#1.\thepage}{\FileName}}}
505 \let\blx@addpagesum\@gobbletwo
506 % \let\nolinkurl\relax
507
508 \ifx\blx:ver:no < 3
509 %
510 % biblatex 2.9a
511 %
512 % Newly added to process {keylist} environment (CVR)
513 %
514 \let\keylist\description
515 \let\endkeylist\enddescription
516 \def\keyitem#1{\item[#1]}%
517 %
518 %
519 \else
520 %
521 % biblatex 3.0
522 %
523 \let\keylist\Un:def
524 \let\endkeylist\Un:def
525 \newenvironment*{keylist}
526 {\list{}{%
527 \setlength{\labelwidth}{1.25in}%
528 \setlength{\labelsep}{10pt}%
529 \setlength{\leftmargin}{0pt}%
530 \setlength{\itemsep}{0pt}%
531 \raggedright%
532 \renewcommand*{\makelabel}[1]{\hss\bfseries##1}}}
533 {\endlist}
534 %
535 \def\keyitem#1{%
536 \item[#1]
537 \begingroup
538 \keyitemhook%
539 \blx@bibinit%
540 \midsentence\ifbibstring{#1}{}{\latintext}\biblstring{#1}%
541 \expandafter\lbx@initnamehook\lsmartoftext%
542 \par\nobreak
543 \midsentence\ifbibstring{#1}{}{\latintext}\bibsstring{#1}%
544 \expandafter\lbx@initnamehook\ssmartoftext%
545 \endgroup
546 \par\nobreak}
547 \fi % End of version boolean
548
549 \ConfigureList{keylist}%
550 {\EndP\HCode{<dl \a:LRdir class="description">}%
551 \PushMacro\end:itm
552 \global\let\end:itm=\empty}%
553 {\PopMacro\end:itm \global\let\end:itm \end:itm
554 \EndP\HCode{</dd></dl>}\ShowPar}%
555 {\end:itm \global\def\end:itm{\EndP\Tg</dd>}\HCode{<dt
556 class="description">}\bgroup \bf}%
557 {\egroup\EndP\HCode{</dt><dd\Hnewline class="description">}}
558
559 \let\:temp\do
560 \def\do#1{%
561 \patchcmd#1%
562 {\color@begingroup}%
563 {\color@begingroup\toggletrue{blx@footnote}}%
564 {\togglefalse{blx@tempa}\listbreak}%
565 {}}%
566 \docsvlist{%
567 \@footnotetext,% latex
568 \H@@footnotetext,% hyperref
569 \scr@saved@footnotetext,% koma-script 3.x
570 \l@dold@footnotetext,% ledmac
571 \l@doldold@footnotetext,% ledmac
572 \@fntORI}% frenchle
573 \let\do\:temp
574
575 \pend:defI\blx@backref{%
576 % prevent duplicate backlink on the same page
577 \ifcsdef{bk##1\thepage}{}{%
578 % insert link to the page
579 \html:addr\Link-{}{x\last:haddr}\EndLink%
580 % save link to the .xref file
581 % we need to use \protected@write to get correct page numbers in backrefs
582 \protected@write\:refout{}{\string\:CrossWord{)Q##1\thepage}{x\last:haddr}{\folio}}%
583 % we need to save the link destination in .xref file
584 % too, otherwise \Link command would issue warning
585 \Tag{)Qx\last:haddr}{\FileNumber}%
586 }%
587 % declare this backlink destination as used, so we don't
588 % declare another one with the same name
589 \expandafter\gdef\csname bk##1\thepage\endcsname{}%
590 }
591
592 % version of \hyperlink that links back to saved link in citation
593 % on the given DVI page
594 \def\bbx:hyperlink#1#2{
595 % first argument is destination used by Hyperref, second is page number
596 % test if we saved link to the current bibitem and page
597 \ifTag{)Q\abx@field@entrykey#2}{%
598 \Link{\LikeRef{)Q\abx@field@entrykey#2}}{}#2\EndLink%
599 }%
600 {#2}% print just page number if there is no saved link
601 }
602
603 % we need to redefine pageref format, which is used for printing of
604 % back link page numbers. custom \hyperlink command is used
605 \DeclareListFormat{pageref}{%
606 % we redefine \hyperlink command to link page numbers in backreferences
607 % back to the citations on the given pages
608 \let\orig:hyperlink\hyperlink%
609 \let\hyperlink\bbx:hyperlink%
610 \ifnumless{\abx@pagerefstyle}{0}%
611 {\usebibmacro{list:plain}%
612 \ifhyperref%
613 {\hyperlink{page.#1}{#1}}%
614 {#1}}%
615 {\ifnumequal{\value{listcount}}{1}%
616 {\usebibmacro{pageref:init}}%
617 {}%
618 \usebibmacro{pageref:comp}{#1}%
619 \ifnumequal{\value{listcount}}{\value{liststop}}%
620 {\usebibmacro{pageref:dump}}%
621 {}}%
622 \let\hyperlink\orig:hyperlink%
623 }
624
625
626 \Hinput{biblatex}
627 \endinput
628