43

I am using natbib and the plainnat style for the references. I would like to know how can I remove the ISSN, DOI and URL from the references without deleting them in the .bib file. I have seen some solutions in other posts but using biblatex; is there any solution for using natbib?

This is the code I am using:

\documentclass[12pt,a4paper]{article}
\usepackage[english]{babel}
\usepackage[square,sort&compress,comma,numbers]{natbib}
\author{Me}
\title{Article}
\begin{document}
\maketitle
\begin{abstract}
    This article...
\end{abstract}
\section{Intro}
    According to \citet{John2003} ...
\bibliographystyle{plainnat}
\bibliography{bibl}
\end{document}

bibl contains an entry with the keycode John2003

1
  • Look for FUNCTION {format.url} in .bst file, then remove all text between the curly braces, e.g. FUNCTION {format.url} { url empty$ { "" } { "" } if$ } Commented Feb 6, 2022 at 17:55

12 Answers 12

43

I would not recommend modifying the *.bib file. You may need these fields one day (some journals ask to put DOI/ISSN, and URLs can be useful for your own reference). Instead, you should change the style file that regulates how bibliography is displayed.

Locate plainnat.bst file on your computer. Copy it to the directory with your *.tex files, rename it to something like plainnatnourl.bst and modify it such that it does not print URLs. You can then use

\bibliographystyle{plainnatnourl}

Modification should be rather simple. In case of abbrvnat.bst the only thing I had to do was to change

FUNCTION {format.url}
{ url empty$
    { "" }
    { <SOME CODE THAT FORMATS URL> }
  if$
}

to

FUNCTION {format.url}
{ url empty$
    { "" }
    { "" }
  if$
}

plainnat.bst should be similar.

2
  • Worked like a charm: to get rid of the annoying "URL" label I just did a case-sensitive search for "URL" in the copied/renamed .bst file using my text editor then manually deleted "URL ".
    – user93292
    Commented Aug 16, 2022 at 0:12
  • Since both branches of the if$ now do the same, we can shorten things a bit to FUNCTION {format.url} { "" }
    – moewe
    Commented Mar 2, 2023 at 7:17
13

Don't delete, just rename the key, i.e. ISSN -> OPTISSN. Then the data is still there but is ignored by bibtex as it does not know OPTISSN

9
  • 1
    And how can I rename the key?
    – Urko
    Commented Jul 23, 2013 at 12:07
  • 1
    How do you normally edit your .bib file?
    – daleif
    Commented Jul 23, 2013 at 12:41
  • 1
    Thank you for your answer. It works, but it is quite a tedious work, at least in my case because I have several .bib files. I will use this solution in a precise moment, but I would like to know if there is any other solution to my problem.
    – Urko
    Commented Jul 23, 2013 at 14:01
  • 1
    Brilliantly simple solution!
    – CMichael
    Commented Sep 7, 2014 at 9:57
  • 10
    It's a useless hack and barley generalizable. Nowadays most .bib files in use are generated automatically (JabRef, Mendeley, etc.)
    – MERose
    Commented Jun 30, 2016 at 8:49
9

You can remove fields if you use biblatex, use this in your preamble (remove \usepackage[square,sort&compress,comma,numbers]{natbib})

\usepackage[style=numeric-comp,natbib=true]{biblatex}
\AtEveryBibitem{%
  \clearfield{issn} % Remove issn
  \clearfield{doi} % Remove doi

  \ifentrytype{online}{}{% Remove url except for @online
    \clearfield{url}
  }
}
3
  • 1
    maybe you should add that you need to use biber not bibtex for this to work...
    – JHBonarius
    Commented Mar 10, 2018 at 19:40
  • for me it works with biblatex Commented Feb 28, 2019 at 12:29
  • doesn't work in overleaf Commented Jan 18, 2023 at 14:09
8

It's easy to create your own bst-file using the custom-bib package. You run

latex makebst

This will start a series of question to which you respond y (yes) or n (no), and at the end it will create a bst-file for you. The questions include if DOI/URL fields should be included in bibliography.

4

You can directly add the options to the usepackage directive:

\usepackage[backend=biber, style=numeric-comp, isbn=false, issn=false, doi=false]{biblatex}
1
  • 5
    The options you mention are for the biblatex package but the question was about natbib package
    – Manza
    Commented Jul 23, 2020 at 9:51
4

I agree with varepsilon that you can edit the .bst file. However I would not edit the FUNCTION {format.url}... because this will mean that the URL will never be displayed...So also not for online resources, where you actually want it!

Instead, I would look for the source-specific style functions, e.g. FUNCTION {article}. There just remove the lines with format.isbn output, format.doi output, and format.url output. Do this for every style you don't want to see the ISBN/DOI/URL.

Of course don't do this for FUNCTION {misc}, which is used for online resources and such...

Also, remember that journals some times don't like you tinkering with their reference style (even if there are errors in it). You'll have to manage with the style they give you...

1

I'd liked to post this as a comment. To improve the makeshift of doing search and replace, you can use a tool, such as textcrawler, to rename entries in several files/directories. It's also possible to filter the files to be searched, e. g. by ending *.bib

1

According to this discussion, one can easily open the *.bib file using JabRef, then select Quality > Set/clear/append/rename fields.

Then, any field can be chosen for a specific entry or all entries to edit/rename/clear.

enter image description here

1

You can modify the Bibliography style file plainnat.bst. If you cannot find this style file in your tex directory, you can download it from this website.

Download and rename the style file as plainnat-modified.bst. Open the file using a text editor and modify the following lines:

FUNCTION {format.isbn}
{ isbn empty$
    { "" }
    { new.block "ISBN " isbn * }
  if$
}

FUNCTION {format.issn}
{ issn empty$
    { "" }
    { new.block "ISSN " issn * }
  if$
}

FUNCTION {format.url}
{ url empty$
    { "" }
    { new.block "URL \url{" url * "}" * }
  if$
}

to these

FUNCTION {format.isbn}
{ isbn empty$
    { "" }
    { "" }
  if$
}

FUNCTION {format.issn}
{ issn empty$
    { "" }
    { "" }
  if$
}

FUNCTION {format.url}
{ url empty$
    { "" }
    { "" }
  if$
}

Upload the modified style file to your tex folder and change your LaTeX code as

\usepackage{natbib}
\bibliographystyle{plainnat-modified}

Done!

2
  • I think this has already been mentioned in the top answer by varepsilon.
    – Roland
    Commented Mar 2, 2023 at 6:13
  • @Roland Yes, but it is more detailed, because it show also the changes for issn and isbn. So maybe it is a kind of improvement.
    – cabohah
    Commented Mar 2, 2023 at 7:49
0

If you are stuck with bibtex or natbib and creating an individual .bst-file or renaming fields in Jabref is not an option, you may want to edit the actual .bib-file. In Windows you can use a batch-script for this. Create a file, e.g. filterbib.bat with the following content

findstr /V "doi url issn" references.bib  > referencesfiltered.bib 

Call it and it will create a copy of your .bib-file without the unwanted entries, which you can then load in your document.

I wouldn't recommend to modify the original .bib-file as you will loose important information. That is why using biblatex or creating a custom style file is still the best option. Unfortunately, only a few journals permit that.

0

As far as the discussion goes the following procedure was pretty helpful.

Select the entries (or all entries using ctrl+A) then go to "Edit"> Manage field names & content. Select url from the drop down box of "Field names". Finally check on " Rename field to "Url_JabRef" and then click "OK".enter image description here

0

This not specific to natbib, but you can use Zotero with the Better Bibtex plugin to omit specified fields from its exported bibtex file which will then be used by natbib.

In Zotero (with the Better Bibtex plugin installed) this is configured by going to Preferences->Better Bibtex->Export->Fields->Fields to omit from export, and adding a comma separated list of fields to exclude.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .