# Seperate URLs for each bibliographic entry which refers to the same source, but to different page(s); + 1 URL for the source in the \printbibliography

When one wishes to cite a reference (and more specifically: a certain page 123 of a source) in a footnote, one can e.g. use \footfullcite[p.~123]{Bestbook} , in case the reference would be labeled Bestbook.

If one wishes, later in the document, to cite another page (e.g. 456) of that same book, this can be easily done using \footfullcite[p.~456]{Bestbook} .

When one, later int he document, uses \printbibliography, only one source will be referenced, but there will be no specific mention of any of the referenced pages earlier on.

I am trying to add a specific (always differing) URL for the following instances:

• each time a different page is mentioned, in the footnfullcite (in the MWE, this amount up to 2 different URLs, but that's just an example).
• another one for the \printbibliography.

## MWE

\documentclass{report}

\begin{filecontents}{testbibliography.bib}
@book{Bestbook,
author =   {{The best author in the world}},
title =   {The best title in the world},
year =   {The best year in the world},
publisher =   {The best publisher in the world}}
\end{filecontents}

\usepackage[backend=bibtex]{biblatex}

\begin{document}

This is clearly a passage which refers to page 123, just look at the footnote to understand that.\footfullcite[p.~123]{Bestbook} How to add a url inside the cited reference's footnote, which specifically links to page 123?

This is clearly a passage which refers to page 456, just look at the footnote to understand that.\footfullcite[p.~456]{Bestbook} How to add a url inside the cited reference's footnote, which specifically links to page 456?

Now, how to add a separate URL for the complete book (as for the \textbf{Bibliograpy}, cf. next page)?
\printbibliography

\end{document}


P.S.: I am not looking for a way to automatically (as in: "auto-generated depending on the base-url") generate the URL for each random page-number; rather I would like the document-writer to manually copy-paste the URL for each specific page into the bibliographic information (inside @book{Bestbook,...). It would be nice if it were possible to incorporate as such: url=MAIN-BOOK-URL, url-p123=PAGE-URL-FOR-PAGE-123, et cetera?

Then, it would be nice if \footfullcite[p.~123]{Bestbook} could automatically recuperate the contents of url-p123 as its URL to display on output, et cetera.

• Please provide some guidance on how 123 or 456 or any arbitrary number correlates to a specific webpage. If they do not, you can simply write \footfullcite{Bestbook}, p.~\href{<URL string>}{123} (and you could put those into a single 3-argument command if you wanted), but it seems incredibly tedious to track down a URL for every single different page citation.... Note also that if different online book 'sites' have different means of reporting the pages, I don't think there can be a general answer to this question. – jon Apr 25 '16 at 4:04
• I'm afraid that is impossible with backend=bibtex: the fields are hardcoded and can't be modified on the fly (and the bibliography drivers would be impossibly difficult to maintain if you had to modify them each time a new page url were going to be added to the .bib file. With backend=biber, it seems almost possible, but so complicated and clunky compared to my first suggestion as to be not worth it. If you are going to need to add information every time you cite a different page number, why not just add it to the .tex file? (I'll watch with interest to see if anyone answers, however.) – jon Apr 25 '16 at 5:25
• The problem with BibTeX is that biblatex offers the interface for new data fields only for Biber and it is very likely you are going to need new fields (or any other Biber-only feature) here. Even with Biber I can't think of an elegant way to declare fields like url-p# where # is a dummy variable for all page numbers. Indeed, I think it would be easier here to write something up if there were a general rule to convert a page number to a URL. – moewe Apr 25 '16 at 6:37
• What you might want to keep in mind is that it is a bit weird to require the .bib file to contain all page-links for cited pages. The .bib file should be blissfully unaware of which pages are really cited in the end. (Just one more thing: with biblatex you can write \cite[123]{foo} instead of \cite[p.~123]{foo}, it can add the required "p." and "pp." automatically.) – moewe Apr 25 '16 at 6:38
• Before starting of the implementation you should check if you can actually provide the data you want biblatex to show. So find some real books long with the needed (page-)urls and show them. Check also the time you need to assemble this information and decide if a document writer will really want to do this for all the citations. – Ulrike Fischer Apr 25 '16 at 8:51

Rather than implementing this feature in biblatex, one could simply do the following:

\newcommand{\urlcite}[3]{\footfullcite{#1}, p.~\href{#2}{#3}}


This is a fairly 'dumb' command, of course, and you lose out a lot of the clever functionality of biblatex's citation commands. However, in this case, it is not a big loss because:

1. we know that the citation requires a page number since that is the whole point of the page-specific request; and
2. putting the page-specific URL in the actual citation is hardly more laborious than putting it in the .bib file (except where there are repeated citations to the same exact page).

The main advantage of this approach is that we don't need to build a massively complex system that can create and spit out new URI fields based on scanning the page(s) named in a \cite command.

Given that these URLs are probably programmatically generated, you might want to note in any such document that relies on them that there is no guarantee that the links valid beyond <some such date>....

So, as an MWE:

\documentclass{article}
\usepackage[backend=biber, style=authortitle]{biblatex}
\usepackage{hyperref}
\newcommand{\urlcite}[3]{\fullcite{#1}, p.~\href{#2}{#3}}
% Less flexible
\newcommand{\footurlcite}[3]{\footnote{\fullcite{#1}, p.~\href{#2}{#3}.}}%

\begin{document}

An example.%
\footnote{\urlcite{westfahl:space}{http://www.notrealurl.fake}{55}.} %
An example.%
\footurlcite{westfahl:space}{http://www.notrealurl.fake}{56} %

\printbibliography

\end{document}

• Could you maybe add a MWE, please; so that it is easier to understand how to implement this, for a broad audience? – O0123 May 8 '16 at 22:27
• @VincentVerheyen Good grief! You surely aren't thinking of making other people do this, too, are you? – cfr May 9 '16 at 2:04
• @jon ;) Thanks for the MWE. I just think it could be nicer to have the URL spanning the whole footnote, instead of only the page number. – O0123 May 9 '16 at 8:14
• @VincentVerheyen -- do you know how the command \href works? It goes \href{<URL>}{<text>}.... – jon May 11 '16 at 20:46
• @jon Thank you Jon, I will try to adapt your answer, based on that clarification. Could you please also advise me on how to compile your MWE? I currently experience some problems in making the footnotes appear not as "westfahl:space, p. 55" (I intend to make the "westfahl:space" compile into the intended reference of course). – O0123 May 12 '16 at 7:44