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

lockstep
  • 250,273
Urko
  • 969
  • Look for FUNCTION {format.url} in .bst file, then remove all text between the curly braces, e.g. FUNCTION {format.url} { url empty$ { "" } { "" } if$ } – Babak Akbarzade Feb 06 '22 at 17:55

12 Answers12

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.

varepsilon
  • 531
  • 4
  • 4
  • 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 ". –  Aug 16 '22 at 00:12
  • Since both branches of the if$ now do the same, we can shorten things a bit to FUNCTION {format.url} { "" } – moewe Mar 02 '23 at 07: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

daleif
  • 54,450
  • 1
    And how can I rename the key? – Urko Jul 23 '13 at 12:07
  • 1
    How do you normally edit your .bib file? – daleif Jul 23 '13 at 12:41
  • I use the JabRef program. – Urko Jul 23 '13 at 12:50
  • Hmm, no idea. I usually edit using a normal text editor. I just installed JabRef, it does not seem to be able to rename a key. You should be able to make a copy of your .bib file, open the copy in your normal LaTeX editor (perhaps unless it is LyX) and then do a search'n'replace using the LaTeX editor. A .bib file is just text. JabRef just diesplays it in a convenient manner. – daleif Jul 23 '13 at 13:03
  • 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 Jul 23 '13 at 14:01
  • Most bibtex style files are not configurable, so alas. – daleif Jul 23 '13 at 15:40
  • 1
    Brilliantly simple solution! – CMichael Sep 07 '14 at 09:57
  • 10
    It's a useless hack and barley generalizable. Nowadays most .bib files in use are generated automatically (JabRef, Mendeley, etc.) – MERose Jun 30 '16 at 08:49
  • @MERose no, it is a useless feature in those programmes that one cannot rename a key – daleif Jun 30 '16 at 09:44
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}
  }
}
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.

Dagfinn Rime
  • 163
  • 1
  • 6
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...

JHBonarius
  • 357
  • 3
  • 10
4

You can directly add the options to the usepackage directive:

\usepackage[backend=biber, style=numeric-comp, isbn=false, issn=false, doi=false]{biblatex}
nyameko
  • 165
  • 5
    The options you mention are for the biblatex package but the question was about natbib package – Manza Jul 23 '20 at 09:51
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

Diaa
  • 9,599
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!

  • I think this has already been mentioned in the top answer by varepsilon. – Roland Mar 02 '23 at 06: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 Mar 02 '23 at 07: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.

Pierz
  • 479