34

I have used this BibTeX reference in my work

@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",
}

, but in the bibliography, instead of getting two separate links two the two urls, I get both urls merged into one link like this: http://citeseer.ist.psu.edu/562256.html;http://gfs.sf.net/gerris.pdf. Is there any way in which I can get the two urls separated and to get one link to each ulr? Frankly, I don't know what the best practice is for url linking in the bibliography, but what I have now is quite useless.

Edit: I'm using JabRef, and it modifies the bibtex code on the web page I linked to from

url = "http://citeseer.ist.psu.edu/562256.html; http://gfs.sf.net/gerris.pdf"

to

url = {http://citeseer.ist.psu.edu/562256.html; http://gfs.sf.net/gerris.pdf}.

In other words, it removes the quotation signs and inserts curly brackets instead. I don't know, maybe this can cause some problem?

7
  • 4
    Without a MWE it's hard to say but I suspect that since hyperref turns the url field into a link automatically, there might be no way to do what you want without major modifications to the bibliography style. Would using something like note="PDF: \url{http://gfs.sf.net/gerris.pdf}" be an option?
    – Christian
    May 30, 2012 at 14:41
  • You linked pdf can't be open. However it's the best to provide a small picture instead of linking May 31, 2012 at 10:21
  • @Marco Daniel: I you look at the url you see what I mean; this is how LaTeX formats it. Maybe I shouldn't have converted the text into a link, but this is what LaTeX does so I wanted to do the same thing here. Jun 1, 2012 at 8:16
  • @Christian: I solved it by simply remove one of the urls. I figured it doesn't really make sense to have more than one link to the same document, especially if one of them require a login that you maybe don't have. Jun 1, 2012 at 8:19
  • 3
    @StrawberryFieldsForever I wouldn't call that "solved" but yeah, that way the problem's gone ;)
    – Christian
    Jun 1, 2012 at 13:28

5 Answers 5

22

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}",
3
  • 1
    Most style use a prefix like URL: to format the url field. Simply add it to the note for full camouflage in the output.
    – ojdo
    Feb 27, 2015 at 16:12
  • 2
    For some documents, the tip by @ojdo is still visually distinguishable from "real" URL entries. At least in my case, I was able to make the camouflage even more perfect with \textsc{url:}.
    – ctitze
    Aug 23, 2018 at 9:17
  • For reference managers like Mendeley, this is a lot of manual work to change url to note.
    – Curious
    Nov 25, 2020 at 15:41
12

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}

enter image description here

5
  • Please explain what you did here! What does url contain after the line \addbibresource{test3.bib}? What does it contain if there are more than one reference? And what do the two macros do? Jun 1, 2012 at 8:33
  • I saved the old definition of \url as \URL and then redefined \url to be able to read two urls devided by a ;
    – user2478
    Jun 1, 2012 at 11:38
  • Will this method be the same even if you use the hyperref package and not the url package? Jun 12, 2012 at 12:31
  • 1
    @StrawberryFieldsForever: Yes, but the urls must be in one line
    – user2478
    Jan 26, 2013 at 15:43
  • 1
    How can I do this if my urls were separated by a space, as in url = {http://citeseer.ist.psu.edu/562256.html http://gfs.sf.net/gerris.pdf}? Is there a way to do this for 4 URLs, or even N URLs?
    – jvriesem
    May 2, 2015 at 0:43
5

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 or hyperref.
  • 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 remaining N-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
    
1
  • 3
    Doesn't work with Mendeley, unfortunately, as biblatex converts the space to "%20" before it reaches the code.
    – Philipp
    Mar 23, 2017 at 22:57
1

To make this work with Mendeley and avoid the issue that biblatex converts the space separator between urls to "%20" before it reaches the code, use the following command to redefine the url bibmacro to use urlraw instead of url.

\renewbibmacro*{url}{\printfield[url]{urlraw}}

\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

0

About @Marco Daniel's note answer, I'd advice using addendum rather than note to ensure URL are placed at the end of the entry, as are URL fields. Indeed, note is printed in the middle of the entry in some styles.

Using note: bib entry print using note field: URLs are not at the end of the entry in some style

Using addendum:

bib entry print using addendum field: URLs are always at the end of the entry

Entry code:

@book{Roland_Gautier,
    address = {Tours},
    author = {Gautier, Léon},
    keywords = {ling},
    publisher = {Alfred Mame et Fils},
    title = {La Chanson de Roland},
    year = {1872},
    Addendum = {\textsc{url} : \url{https://gallica.bnf.fr/ark:/12148/bpt6k102947j} (t. \textsc{i}), \url{https://gallica.bnf.fr/ark:/12148/bpt6k102948x} (t. \textsc{ii})},
    volumes = {2}
    }

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .