Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
    
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
1  
@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

8 Answers 8

up vote 8 down vote accepted

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$
share|improve this answer
1  
@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
1  
@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
1  
I am newbie. What does it mean "apply the patch"? How can I do that? –  freude Jun 16 '13 at 12:25
1  
@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
1  
@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 use biblatex. I don't think there's an easy way get what you want. The traditional bibtexuse a very different language to define the bib style.

share|improve this answer
    
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
share|improve this answer
3  
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 –  drN Apr 6 '12 at 22:07
2  
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

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}
share|improve this answer
    
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 at 10:56

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
}
share|improve this answer
    
Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. –  Paul Gessler May 13 at 11:48
    
This method also works for the Springer LNCS format. –  kermit666 Jun 26 at 14:46

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.

share|improve this answer

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.

Reference: http://support.mendeley.com/customer/portal/articles/170063-removing-urls-from-bibliographies-using-the-word-plugin

(This removes URLs from bibliographies created using the plugins and not from the .bib files!)

share|improve this answer

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.

share|improve this answer
    
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 at 12:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.