8

I'm currently using Mendeley to gather my references and export them as a .bib file. I turned off the URL parameters on inclusion of Biblatex as I don't want URLs for published papers, books, etc:

\usepackage[backend=biber,
            style=numeric,
            sorting=none,
            url=false]{biblatex}

However, I want the URLs in my references for webpages. I realise that one solution is to just remove the URLs from Mendeley before exporting to .bib, but I also want to keep the URLs there for published works.

moewe
  • 175,683
  • 2
    For your webpages, you should use @online, for which the url is always printed, even with url=false. I'm not a Mendeley user though, so I'm not sure about how to tell it to do that. Anyway, that's what biblatex would expect. – gusbrs Apr 28 '18 at 00:59
  • 2
    Welcome! That will work, provided you are using appropriate entry types, as @gusbrs notes and provided, of course, that Mendeley includes the data in the exported .bib. If Mendeley is using the wrong entry type for web pages, that's where you need to intervene in your workflow. – cfr Apr 28 '18 at 01:35
  • Chances are that Mendeley exports webpages as @misc or as a weird entrytype that biblatex does not know and therefore maps to @misc. As gusbrs and cfr already pointed out, if you have an @online you should get to see the URL even with url=false. – moewe Apr 28 '18 at 06:10
  • Thanks for the replies! I didn't realise but Mendeley is exporting webpage references as @misc instead of @online. I can't seem to find a way of changing this. Mendeley's auto .bib syncing is very useful, but it looks like I'm just going to have to manually change the @misc to @online before submission. – Oliver Crow Apr 28 '18 at 09:34
  • 1
    Maybe you should consider complaining to the Mendeley people. They really should export @online if they want to support biblatex. https://tex.stackexchange.com/q/422563/35864 has a work-around to reclassify @miscs with URL as @online. – moewe Apr 28 '18 at 11:06

1 Answers1

12

The standard behaviour of biblatex is to always display URLs for @online regardless of the url option. So even with url=false you should see the URL of @online entries.

Mendeley exports websites as @misc entries. But @misc does not fall under the @online exception above and so the URLs of your sources are suppressed.

The solution is to tell the Mendeley people that they should export online sources to @online if they want to support biblatex properly. I have googled around a bit and it seems like people have been trying to get Mendeley to change their .bib export for quite a while, apparently with limited success.

You can use a method similar to Mendeley and Biblatex: how to interpret 'misc' as 'patent' or 'online' to try and salvage your .bib file. The map

\DeclareSourcemap{
  \maps[datatype=bibtex, overwrite=true]{
    \map{
      \step[fieldsource=url, final]
      \step[typesource=misc, typetarget=online]
    }
  }
}

converts all @miscs with a URL field to @online.

The map

\DeclareSourcemap{
  \maps[datatype=bibtex, overwrite=true]{
    \map{
      \step[typesource=misc, typetarget=online]
    }
  }
}

converts all @miscs to @online.

Both solutions assume that you have no legitimate @misc entries with a url field (which should not be converted to @online).

moewe
  • 175,683
  • Perfect, this is exactly what I was looking for. Thank you. – Oliver Crow Apr 29 '18 at 12:26
  • 1
    @OliverCrow But don't rely on this workaround. Pressure the Mendeley people into implementing a proper .bib export. – moewe Apr 29 '18 at 12:59
  • 2
    I have sent them a message about this (through their contact methods). Their Feature Requests page just returns a 404... – Oliver Crow Apr 29 '18 at 13:26
  • Great answer, second snippet worked for me perfectly – d-man May 10 '22 at 14:13
  • I have the attached @online bib item and use \bibliographystyle{plain} and it doesn't show the URL. Any ideas?

    @online{eip, title = {{The Electoral Integrity Project}}, url = {https://www.electoralintegrityproject.com} }

    – pms May 26 '23 at 14:15
  • 1
    @pms plain is a very old BibTeX style (not biblatex, as in this question). It was written before URLs were a big thing. That's why it doesn't support a url field. You need to choose a style that does. You could try plainurl instead of plain or one of the natbib styles. – moewe May 29 '23 at 05:24