# Disabling URLs in bibliography

I use Mendeley for article management and export the related items to a bib file for referencing in LaTeX documents. I use IEEEtran style and see that the bibliography items include URLs which I don't want to include. The URLs may have URLs like this:

Available: http://www.mendeley.com/research/improved-adaptive-background-mixture-model-realtime-tracking-shadow-detection-6/


As a solution, I can delete the URL in Mendeley and export it again but I want the URLs remain. I only want them to be hidden in the references. Is there a command to disable URLs in bibliography?

P.S.: I'm not interested in typesetting the URLS as given in this question.

Additional information: I've used the following code for the bibliography:

\bibliographystyle{IEEEtran}
\bibliography{IEEEabrv,references}


There's a file named references.bib in the working folder.

• Very useful topic. Could you also think of a solution, which allows to have the url in bibliography entry or not depending on the entry type. I. e. remove the url from the bibliography for article-type entries, but keep it for manual- or techreport-type entries? Thanks a lot in advance! – Neb Feb 15 '12 at 18:29
• @Neb Welcome to TeX.sx! Your question won't be seen by many people here, so it would be best to repost it as a fresh question. Follow-up questions like this are more than welcome! Please use the "Ask Question" link for your new question; there you can link to this question to provide the background. – Werner Feb 15 '12 at 18:46

I guess you use the IEEEtran bibliography style coming along with the IEEEtran document class. You can easily adapt this style to ignore any url fields in your bibliographic database. To this end, copy the file IEEEtran.bst to your working directory (if it isn't already there) and apply the following patch:

--- IEEEtran.bst.orig
+++ IEEEtran.bst
@@ -403,7 +403,6 @@
default.ALTinterwordstretchfactor 'ALTinterwordstretchfactor :=
default.name.format.string 'name.format.string :=
default.name.latex.cmd 'name.latex.cmd :=
-  default.name.url.prefix 'name.url.prefix :=
}

@@ -1080,7 +1079,7 @@
if$"\begin{thebibliography}{" longest.label * "}" * write$ newline$- "\providecommand{\url}[1]{#1}" + "\def\url#1{}" write$ newline$"\csname url@samestyle\endcsname" write$ newline$ • @daleif: Yes, but you will probably also want to get rid of the Available:  field which precedes every url in the bibliography. This is achieved by the first part of the patch. – mhp Aug 23 '11 at 14:53 • @mhp what I mean is, why don't they add it with a macro instead and add say \providecommand\mymacro{...} in the bibliography preamble. Then users can define that macro them self to do nothing or to translate it into a different language. Thesee hardwired names often end up giving loads of problems when users use them for documents that style is not suppose to be used for. – daleif Aug 24 '11 at 8:52 • I am newbie. What does it mean "apply the patch"? How can I do that? – freude Jun 16 '13 at 12:25 • @freude In the Linux world, you would normally use the patch utility for that purpose. Save the patch in the current working directory as IEEEtran.bst.patch, then enter the command patch -i IEEEtran.bst.patch. – mhp Jun 16 '13 at 15:31 • @LWZ Unfortunately (or fortunately ;-)), I don’t know anything about Windows. – mhp Aug 8 '13 at 18:46 If you use biblatex, there's an option called url which can be set to url = false. There are also isbn, doi etc., similar options. If you are not using biblatex. I don't think there's an easy way get what you want. The traditional bibtex uses a very different language to define the bib style. • I'll second the biblatex + biber recommendation. I'm using it for my thesis and don't want ugly URLs in my reference section. The DOI option is much better looking and provides the same funtionality. – Darling Aug 23 '11 at 10:28 I have a cheeky solution to this. I grep "url" in my bibtex file with the invert switch -v -- in effect, it gives me a new bibtex file without any url data. In other words, grep -v "url =" file.bib > newfile.bib  • Your regular expression may need a little more attention. Depending on the bibliography contents, you don't want to remove any other fields containing the string url (perhaps a last name of an author). – Werner Feb 8 '12 at 0:45 • Also, if the URL is the last item in a bibtex entry, you'll have a comma problem, and maybe a closing brace problem. BibTool would be a good way to accomplish your idea. – Nathan Grigg Feb 8 '12 at 5:18 • Thanks, Werner, I've made the regular expression more accurate. Nathan, while your comment is true in general, it is found that the bib file generated by Mendeley puts each field on a new line, and the url field is always before the "year" field, hence one would never face the problem of a comma or closing brace. – U K Feb 8 '12 at 17:52 • @UK Actually, the grep thing didn't work for me (maybe because I didn't apply it quite right). But this did: cat mybibfile.ib | sed -e '/url /d' > mybibfile2.bib. I provided one solution here – dearN Apr 6 '12 at 22:07 • Might be better to use a regex like "^\s*url\s*=", which will ensure the url is at the start, and allow flexible whitespace. – naught101 Sep 17 '13 at 3:59 The IEEEtran.bst v1.14 introduces a new option to disable URLs. Now you can create a bib file containing the following: @IEEEtranBSTCTL{MyBSTcontrol, CTLuse_url = "no", }  Include this bib file along with other bib files, and invoke it via bstctlcite \begin{document} \bstctlcite{MyBSTcontrol} . .  All URLs in the references will be gone. I happen to have the IEEEtran.bst version 1.11 which is quite old actually. %% BibTeX Bibliography Style file for IEEE Journals and Conferences (unsorted) %% Version 1.11 (2003/04/02)  What worked for me really is following 1) Edit the "IEEEtran.bst" file to remove the url prefix by changing FUNCTION {bbl.urlprefix}{ "[Online]. Available:" }  to FUNCTION {bbl.urlprefix}{ "" }  2) Add this line \def\url#1{}  before the bibliography \bibliographystyle{IEEEtran} \bibliography{IEEEabrv,library}  • Welcome to TeX.SE! You may want to elaborate a bit on how your answer differs in substance from the earlier one given by @mhp. E.g., you could explain that by providing the instruction \def\url#1{} in your .tex file immediately before loading the .bst file, it's not necessary anymore to delete the line "\providecommand{\url}[1]{#1}" from the .bst file. – Mico Mar 2 '14 at 10:56 • This works well. Most IEEE conferences on control systems keep using this old version, as downloaded from css.paperplaza.net/conferences/support/tex.php. – oracleyue Mar 16 '18 at 14:52 In IEEEtran.bst Version 1.14 (2015/08/26), there is defaults variables for controling the BST style. At line 87, you find : % #0 turns off the display of urls % #1 enables FUNCTION {default.is.use.url} { #1 }  Just replace the #1 with #0. You can remove URLs from a bibliography by opening Mendeley Desktop and clicking View >Citation Style >More Styles, and set Include URLs and Date Accessed in Bibliographies to Only for Webpages. (This removes URLs from bibliographies created using the plugins and not from the .bib files!) • This was what I was looking for! However, my Mendelay desktop seems to ignore this setting when I export the .bib... and still adds the url's for journal articles... – JHBonarius Feb 27 '18 at 12:36 • @JHBonarius Any solution to the first comment? I am finding that Mendeley desktop annoyingly ignore this setting as the bibtex file has URLs in it. – rnoodle Jun 20 '18 at 15:54 • @rnoodle I spend a lot of time in contact with Mendelay first-line support. After endless "have you tried restarting your computer?" and "have you tried reinstalling mendeley desktop?" they finally figured our there is a serious problem, and they forwarded it to second line support. They never got back to me... – JHBonarius Jun 20 '18 at 19:37 • @JHBonarius My solution was to just use \bibliographystyle{apalike} – rnoodle Jun 21 '18 at 11:14 Another easy way to remove the URLs without modifying the .bst files is to open your bibliography (.bib) file and do a find/replace all on instances of "url". Replace them with "%url". When you build your document, the bibliography interprets all the url's as comments and leaves them out. It's not exactly a permanent fix, but it's an easy one to repeat any time you update your references. • The syntax for comments in a .bib file is a bit different, I suspect that bibtex instead interprets the url's as part of a different field, named %url. The end result is probably the same though. – T. Verron Sep 24 '14 at 12:52 How is the url typeset in the bbl file? If it is using \url then you could locally redefine \url inside the bibliography to do nothing, or perhaps redefine it to take two args and do nothing, then it will eat the url and a following period. you can add a @preamble string to add the redefinition into the bibfile, and from there into the bbl file via bibtex. That may be helpful. Consider the following entry in IEEEtran.bst file. Delete the line format.url output. FUNCTION {article} { std.status.using.comma start.entry if.url.alt.interword.spacing format.authors "author" output.warn name.or.dash format.article.title "title" output.warn format.journal "journal" bibinfo.check "journal" output.warn format.volume output format.number.if.use.for.article output format.pages output format.date "year" output.warn format.note output %format.url output fin.entry if.url.std.interword.spacing }  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – Paul Gessler May 13 '14 at 11:48 • This method also works for the Springer LNCS format. – metakermit Jun 26 '14 at 14:46 You can remove fields if you use biblatex, use this in your preamble (remove \bibliographystyle{IEEEtran}) \usepackage[style=ieee]{biblatex} \AtEveryBibitem{% \clearfield{issn} % Remove issn \clearfield{doi} % Remove doi \ifentrytype{online}{}{% Remove url except for @online \clearfield{url} } }  Editors like TexWorks allow the replacement of regular expressions. You can open the .bib file and search and replace the following expression with nothing. (url|doi) = \{[^\{]+\},\n*  Works fine for me. I had the same problem, and I solve it with the following R code using the "bibtex" package. library(bibtex) bib.list <- read.bib("./data/sample.bib") bib.list[1:length(bib.list)]$url <- NULL
write.bib(bib.list, "./data/sample_no_url.bib", append = FALSE, verbose = TRUE)