# Multiple bibliographies with local links, global labels. Also global bibliography

How can I have a bibliography per section which shows only the references cited within the section? At the end, I also want a global bibliography which includes all cited references in any section.

As far as labels go, I want them global. So if labels are numeric, then [1] can appear in multiple sections but it always corresponds to the [1] that is in the global bibliography. If the labels are [Author00] then that same label would appear in multiple locations, consistently referring to the same bibitem.

Finally, there is the question of the hyperlink attached to the label. Should it go to the local bibliography or to the global bibliography? For now, I prefer local, but it would be nice to have this configurable.

If it matters, I want to do this with a single bibtex file. I've seen piecemeal answers here and there, but not much on what happens when you click the hyperlink.

With each section corresponding to a new reference section, you get "local" labels pointing to the local bibliographies.

With each section corresponding to a new reference segment, you get "global" labels pointing to the first instance the corresponding bibliography entry is printed.

Neither case gives you the desired result. The document below demonstrates how you can modify some internals to obtain the desired links with reference segments. The new boolean flag anchorsegments targets the local bibliographies when true and the global bibliography otherwise.

\documentclass{article}
\usepackage[refsegment=section]{biblatex}
\usepackage{hyperref}

\newbool{anchorsegments}
\booltrue{anchorsegments}

\makeatletter

\AtBeginDocument{%
\ifbool{anchorsegments}
{\long\def\blx@bibhyperref[#1]#2{%
\blx@sfrest
#2%
\blx@sfrest
#2%
\protected\long\def\blx@imc@bibhypertarget#1#2{%
\blx@sfsave\hyper@natanchorstart{\the\c@refsection:\the\c@refsegment:#1}%
\blx@sfrest
#2%
\blx@sfsave\hyper@natanchorend\blx@sfrest}%
\protected\def\blx@anchor{%
\xifinlist
{\the\c@refsection @\the\c@refsegment @\abx@field@entrykey}
{\blx@anchors}
{}
{\blx@anchors}
{\the\c@refsection @\the\c@refsegment @\abx@field@entrykey}%
\hyper@natanchorstart{%
\the\c@refsection @\the\c@refsegment @\abx@field@entrykey}%
\hyper@natanchorend}}%
\AtNextBibliography{\let\blx@anchor\relax}%
\subsection*{Local references}}}}

\makeatother

\begin{document}

\section{Title}
Filler \parencite{companion,markey,knuth:ct}.

\newpage
\section{Title}
Filler \parencite{markey,bertram,companion}.

Here local anchors are obtained by inserting \the\c@refsegment into link identifiers so that they are specific to both the reference section and segment. Global anchors are achieved by avoiding anchor definitions in each of the local bibliographies via \AtNextBibliography{\let\blx@anchor\relax}.