11

I am using a Nature biblatex style with bibtex to typeset bibliography and would like to suppress URLs from appearing in the "paper" entry types (like books, journal articles and proceedings). If I use url=none, URLs are suppressed everywhere, including the online resources. I need to avoid it. Is there a way?

Update I use Mendeley to manage bibliography. These are two @book examples from the bib-file:

@book{SnyderLove1983,
  address = {London},
  author = {Snyder, Allan and Love, John},
  publisher = {Chapman \& Hall},
  title = {{Optical waveguide theory}},
  url = {http://books.google.com/books?id=gIQB\_hzB0SMC},
  year = {1983}
}

@book{Agrawal01,
  author = {Agrawal, Govind P.},
  edition = {3rd},
  pages = {467},
  publisher = {Academic Press},
  series = {Optics and Photonics},
  title = {{Nonlinear Fiber Optics}},
  url = {http://www.elsevierdirect.com/product.jsp?isbn=9780120451432},
  year = {2001}
}

This is @inproceedings:

@inproceedings{Liao2011,
  author = {Liao, Changrui and Wang, Dongming and He, Xiaoying and Yang, Minwei},
  booktitle = {Proceedings of SPIE},
  doi = {10.1117/12.885826},
  number = {13},
  pages = {77534I--77534I--4},
  title = {{Twisted optical microfiber for refractive index sensing}},
  url = {http://link.aip.org/link/?PSISDG/7753/77534I/1 http://link.aip.org/link/PSISDG/v7753/i1/p77534I/s1\&Agg=doi},
  volume = {23},
  year = {2011}
}

In the @inproceedings record, Mendeley has concatenated two URLs in the bib-file. A bug, clearly.

  • URLs should be automatically missed out if papers have pages: this is by far the most common place to see a URL stored but not needed when printed. Perhaps you could provide an example of your .bib file? – Joseph Wright Jun 12 '12 at 19:35
  • @JosephWright: I added a couple of book records to the original question. One with pages, another without. Both are typeset with URL. Same with inproceedings. – texnic Jun 13 '12 at 7:56
14

This is difficult to handle within a style as it depends on how people store data in their database. (Different users will have different ideas about which types should and should not include a URL.) However, within a document it should be easy enough to handle using biblatex's abilities to access the data model. For example, something like

\AtEveryBibitem{%
  \ifentrytype{book}
    {\clearfield{url}}
    {}%
}

will clear the URL field for all books. Using a boolean expression, this can then be extended for multiple entry types

\AtEveryBibitem{%
  \ifboolexpr
    {
      test { \ifentrytype{book} }
      or
      test { \ifentrytype{inbook} }
      or
      test { \ifentrytype{inproceedings} }
    }
    {\clearfield{url}}
    {}%
}
  • @texnic I've updated the bool expression: try the new one – Joseph Wright Jun 13 '12 at 18:27
  • That's exactly what I was hoping for. Both solutions work, thank you! – texnic Jun 14 '12 at 9:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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