How to use multiple URLs for one bibtex reference?
Most bibliography styles format the field url
direct with the command \url
.
You can use the field note
to add unformatted text:
NOTE = "\url{http://citeseer.ist.psu.edu/562256.html} and
\url{http://gfs.sf.net/gerris.pdf}",
you can modify the \url
command with a redefinition to take two urls into account:
\RequirePackage{filecontents}
\begin{filecontents}{test3.bib}
@Misc{oai:CiteSeerPSU:562256,
title = "Gerris: {A} Tree-Based Adaptive Solver For The
Incompressible Euler Equations In Complex Geometries",
author = "St Ephane Popinet",
year = "2002",
month = sep # "~08",
abstract = "An adaptive mesh projection method for the
time-dependent incompressible Euler equations is
presented. The domain is spatially discretised using
quad/octrees and a multilevel Poisson solver is used to
obtain the pressure. Complex solid boundaries are
represented using a volume-of-fluid approach.
Second-order convergence in space and time is
demonstrated on regular, statically and dynamically
refined grids. The quad/octree discretisation proves to
be very flexible and allows accurate and efficient
tracking of flow features. The source code of the
method implementation is freely available.",
citeseer-references = "oai:CiteSeerPSU:500259; oai:CiteSeerPSU:27423;
oai:CiteSeerPSU:16254; oai:CiteSeerPSU:395363;
oai:CiteSeerPSU:436925; oai:CiteSeerPSU:90307;
oai:CiteSeerPSU:391348; oai:CiteSeerPSU:137987;
oai:CiteSeerPSU:442611; oai:CiteSeerPSU:44620;
oai:CiteSeerPSU:150038; oai:CiteSeerPSU:433875;
oai:CiteSeerPSU:441861; oai:CiteSeerPSU:526586",
bibsource = "OAI-PMH server at cs1.ist.psu.edu",
language = "en",
oai = "oai:CiteSeerPSU:562256",
rights = "unrestricted",
URL = "http://citeseer.ist.psu.edu/562256.html;
http://gfs.sf.net/gerris.pdf",
}
\end{filecontents}
\documentclass{article}
\usepackage[english]{babel}
\usepackage{url}
\usepackage[backend=biber]{biblatex}
\usepackage{hyperref}
\addbibresource{test3.bib}
\let\URL\url
\makeatletter
\def\url#1{\@URL#1;;\@nil}
\def\@URL#1;#2;#3\@nil{%
\URL{#1}\ifx\relax#2\relax\else; \URL{#2}\fi}
\makeatother
%url = {http://citeseer.ist.psu.edu/562256.html; http://gfs.sf.net/gerris.pdf}
\begin{document}
foo\cite{oai:CiteSeerPSU:562256}
\printbibliography
\end{document}
Won't let me comment on Herbert's answer. So based on his answer:
- When you copy this into your own code, make sure you place it after you include packages like
url
orhyperref
. To use spaces instead of semicolons, just replace the semicolons with spaces. This is useful for Mendeley-generated BibTeX files. When two spaces are immediately next to each other, you have to escape one so they don't disappear, i.e.
;;
becomes\
(a backslash with two spaces around it). Here's a version where I additionally removed the third argument (second space) because it apparently wasn't necessary (?), and so there's no backslash anymore, either.\let\URL\url \makeatletter \def\url#1{\@URL#1 \@nil} \def\@URL#1 #2\@nil{\URL{#1}\ifx\relax#2\relax \else; \URL{#2}\fi} \makeatother
Note that I left the "output semicolon" in there because I think it looks nice. Technically, you can write whatever you like there, including any arbitrary commands.
To extend it to
N
URLs, you have to call the macro recursively with the second argument (which will contain the remainingN-1
space-separated URLs). For some reason, an additional\relax
is necessary to make it work, found this out by accident:\let\URL\url \makeatletter \def\url#1{\@URL#1 \@nil} \def\@URL#1 #2\@nil{\URL{#1}\ifx\relax#2\relax \else; \url{#2\relax}\fi} \makeatother
To handle urls with the percent sign
%
and with the hash sign#
correctly, glean some inspiration from Changing the catcode of _ in one command? and further adjust the definitions as follows:\let\URL\url \makeatletter \def\url{\begingroup \catcode`\%=12\catcode`\#=12\relax\printurl} \def\printurl#1{\@URL#1 \@nil\endgroup} \def\@URL#1 #2\@nil{\URL{#1}\ifx\relax#2\relax \else; \url{#2\relax}\fi} \makeatother