5

In light of this and this AND if I'd want to use pdflatex instead of biblatex, how do I get rid of doi, ISSN links from my bibliography?

I can write a script such as here but that leaves a , hanging in each of the entries?

Any comments?

Edit:

I received very nice input from Mico but I was not able to apply his recommendations (I will do it and post the result here).

Meawhile, here is one not very elegant solution I devised:

I rid my .bib file off all url, doi, issn text like this:

cat mybibfile.ib | sed -e '/url /d' > mybibfile2.bib

Then I opened my new .bib file viz, mybibfile2.bib in gedit and replaced all ,\n} with } which ensured that I didn't have a hanging comma(,) in my file.

4
  • 3
    Welcome to TeX.SE! Your question is a bit confusing -- pdflatex and biblatex are in no way substitutes or otherwise in conflict with each other. Are you maybe looking to use bibtex instead of biblatex? If so, you should tell us which bibliography style file you intend to use.
    – Mico
    Apr 6, 2012 at 1:09
  • @Mico Oh! I thought biblatex was a substitute for pdflatex. But I was wondering if there was a way of omitting doi links etc either through pdflatex or bibtex or the Jabref preamble... with the natbib bibliography style...
    – dearN
    Apr 6, 2012 at 1:22
  • Natbib is a citation management package, not a bibliography style. The package does come with three style files: plainnat.bst, abbrevnat.bst, and unsrtnat.bst. However, one isn't forced to use natbib to use one of these style files, and one can use natbib with other style files. Thus the question: Which style file do you use? It's the style file that contains all formatting instructions that BibTeX executes.
    – Mico
    Apr 6, 2012 at 2:11
  • Oh sorry... unsrtnat, it is!
    – dearN
    Apr 6, 2012 at 2:16

2 Answers 2

6

One way to make BibTeX ignore fields such as doi and issn is to set the BibTeX functions that format these fields to a "dummy" instruction that does nothing at all. These functions (and all other BibTeX functions) are contained in the bibliography style file that's in use. Since you indicate that you use the unsrtnat bibliography style, you could proceed as follows:

  • Find the file unsrtnat.bst on your TeX system and copy it to, say, unsrtnatDNA.bst. (Never edit the original style files.)

  • Open the file unsrtnatDNA.bst in your favorite text editor. Search for the functions {format.issn} and {format.doi}. (The headers of these functions are on lines 278 and 292 in my version of the file unsrtnat.bst.) Replace their definitions -- the stuff below the respective header lines that's enclosed by a pair of curly braces -- with a "dummy" definition, viz., { }. For instance, you should change the definition of format.issn from

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

    to

    FUNCTION {format.issn}
    { }
    
  • Save and close the file.

  • Depending on your TeX distribution, you may have to update the filename database that TeX uses to find all relevant files. For instance, if you use TeXLive, the command that updates the filename database is called texhash.

  • From now one, use the command \bibliographystyle{unsrtnatDNA} in your tex files to instruct BibTeX to use your modified bibliography style file.

13
  • I did what you suggested. But bibtex exits with an exit code 2. What gives? :(
    – dearN
    Apr 6, 2012 at 3:44
  • Heres what I did: Cleared the .aux file. Ran pdflatex - no error. Ran bibtex - Error code 2.
    – dearN
    Apr 6, 2012 at 3:48
  • Hmmm. Can you figure out at which entry BibTeX hangs? If so, please post that entry in its entirety in an addendum to your question. (You did remember to run texhash or its equivalent, right?)
    – Mico
    Apr 6, 2012 at 6:08
  • @DNA: I've discovered a different solution. Please try it out.
    – Mico
    Apr 6, 2012 at 13:00
  • Thanks! I'll try this out shortly and post the outcome here.
    – dearN
    Apr 6, 2012 at 15:03
1

Not necessarily a elegant solution - but I wrote a quick python script a while back to solve similar problems - in principle can be used to get rid of any fields - and extended easily.

I posted it here.

http://quickscriptfixes.blogspot.com/2013/01/mendeley-bibtex-stripper-in-python.html

2
  • 1
    Looks fragile. What happens, e.g., when there is a = in some field?
    – mafp
    Mar 14, 2013 at 22:56
  • @mafp - you're of course entirely correct. I guess i gave a health warning with the code on the blog. However I'm pleased to say it works all the same(unintentionally - or at least untested) - the python statement looks for the 1st = on the line, and treats the rest as raw text. That said - there may any number of other ways of tripping it up. Afraid i didn't do any reading about the .bib standard(?) - just went with what mendeley spat out, and tried to make sense of it.
    – JPH
    Mar 14, 2013 at 23:36

You must log in to answer this question.

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