0

I have a published paper and I am going to use it in my dissertation. I normally use Mendeley to create .bib file. However, I am wondering is there a smart and easy way to create this .bib file by just providing the paper or doi of the paper and it gives me the .bib file of the references?

For example, I want a .bib file that contains the references of this article: https://www.cambridge.org/core/journals/microscopy-and-microanalysis/article/estimating-step-heights-from-topdown-sem-images/ECA77A258DAA20A73CA510AADFFD4F08

4
  • 3
    Note that .bib entries from the web are notoriously unreliable. But there are some reasonable ways to get .bib entries from DOIs. See How can I find a bibtex entry for an article? (duplicate?) – Alan Munn Dec 12 '19 at 16:10
  • To support Alan's point about the dubious quality of .bib entries from the web you may want to have a look at tex.stackexchange.com/q/386053/35864. You have tagged your question with biblatex. Is there anything specifically about biblatex (the citation/bibliography package: ctan.org/pkg/biblatex) you would like to see addressed, or are you only asking about generic .bib files? – moewe Dec 12 '19 at 16:46
  • But I want to get all .bib enteries in the references without going to each reference one by one. – Kutadgubilig Dec 12 '19 at 16:47
  • If you use R, then RefManageR. Otherwise, I suggest the Jabref GUI. But whatever the method, you must check and the entries one by one and fix things manually. Some sources of bibtex/biblatex references are better than others, but often the code supplied will need some fixes. – Fran Dec 14 '19 at 18:24
0

It's not TeX, but I use this python 3 code to do something like this:

from isbnlib import meta
from isbnlib.registry import bibformatters
import sys
import urllib.request
from urllib.error import HTTPError
import time

### PARA DOI
#BASE_URL = 'http://dx.doi.org/'
BASE_URL = 'https://www.doi.org/'

ListaDOI = ['10.1119/1.5124814',
            '10.1103/PhysRevB.100.245121',
            '10.1103/PhysRevB.100.224507',
            '10.1103/PhysRevE.100.052303',
            '10.1103/PhysRevFluids.4.124002',
            '10.1103/PhysRevD.100.126011',
            '10.1103/PhysRevA.100.052322']

### PARA ISBN
SERVICE = 'openl'
getInfoISBN = bibformatters['bibtex']

ListaISBN = []


#timestamp=time.strftime("%d-%m-%Y-%H%M%S")
timestamp=time.strftime("%d-%m-%Y-%H")
filename='bibliography-'+timestamp+'.txt'
g=open(filename,'a')

for doi in ListaDOI:
    url = BASE_URL + doi
    req = urllib.request.Request(url)
    req.add_header('Accept', 'application/x-bibtex')
    time.sleep(2)
    try:
        with urllib.request.urlopen(req) as f:
            bibtexDOI = f.read().decode()
        print(bibtexDOI)
        g.write('\n' + bibtexDOI + '\n\n')

    except HTTPError as e:
        if e.code == 404:
            print('\n DOI {} nao encontrado. DOI not found.\n'.format(doi))
            g.write('DOI: {}'.format(doi)+' não encontrado. Not found.\n\n')
        else:
            print('Serviço indisponível. Service unavailable.')
            sys.exit(1)

for isbn in ListaISBN:
    try:
        bibtexISBN = getInfoISBN(meta(isbn, SERVICE))
        print(bibtexISBN)
        g.write('\n' + bibtexISBN + '\n\n')

    except:
        print('\n ISBN {} nao encontrado. ISBN not found.\n'.format(isbn))
        g.write('ISBN: {}'.format(isbn)+' não encontrado. Not found.\n\n')
g.close()

It uses the site http://dx.doi.org/ to get the information. So, you list the doi number in 'ListaDOI' (how many you need) and just run with your python. It will show the bib entry and save it into a 'bibliography.txt'.

Edit: added isbn search. It uses a specific python lib, the isbnlib. The same way you put isbn into 'ListaISBN', like in 'ListaDOI'.

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.