Tell me more ×
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

4 Answers

up vote 6 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
Isn't just easier to add @preamble{"\def\url#1{}"} to the bib file? – daleif Aug 23 '11 at 11:20
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
This solves my problem, thanks! @daleif: I externally update the bib file frequently using Mendeley. Adding the preamble doesn't seem to be practical. – petrichor Aug 23 '11 at 16:03
Is mendeley a bibtex data handling program? if so @pramble is just another type of bibtex input added to the .bib file. @mhp I didn't know IEEE was that anoing, why are they hardcoded? – daleif Aug 23 '11 at 16:32
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
show 4 more comments

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
1  
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

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

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.