diff --git a/notebooks/References Notebook 2020.ipynb b/notebooks/References Notebook 2020.ipynb index f0fd7cd..676ebd2 100644 --- a/notebooks/References Notebook 2020.ipynb +++ b/notebooks/References Notebook 2020.ipynb @@ -299,6 +299,7 @@ "outputs": [], "source": [ "# BibTeX Reference\n", + "# authors used to be %I\n", "payload = {\"bibcode\": [\"{}\".format(Bibcode)],\n", " \"sort\": \"first_author asc\",\n", " \"format\": \n", @@ -308,9 +309,11 @@ " \"volume\": \"%V\",\n", " \"start-page\": \"%p\",\n", " \"end-page\": \"%P\",\n", + " \"pages\":\"%pp\",\n", " \"year\": %Y,\n", - " \"authors\": \"%I\",\n", + " \"author\": \"%A\",\n", " \"doi\": \"%d\",\n", + " \"key_format\":\"%ZAuthorSep:\" and \"\",\n", " \"bibcode\": \"%u\"}}'''\n", " }\n", "r = requests.post(\"https://api.adsabs.harvard.edu/v1/export/custom\", \\\n", @@ -318,15 +321,18 @@ " data=json.dumps(payload))\n", "response_json = r.json() \n", "ref_json = json.loads(response_json['export'])['ref_json']\n", - "print('authors:', ref_json['authors'])\n", - "print('title:', ref_json['title'])\n", - "print('journal:', ref_json['journal'])\n", - "print('volume:', ref_json['volume'])\n", - "print('start-page:', ref_json['start-page'])\n", - "print('end-page:', ref_json['end-page'])\n", - "print('year:', ref_json['year'])\n", - "print('doi:', ref_json['doi'])\n", - "print('bibcode:', ref_json['bibcode'])\n", + "print(f'@ARTICLE{{{doi},')\n", + "print('\\tauthor=', \"{{{0}}},\".format(ref_json['author']))\n", + "print('\\ttitle=', '\"{{{0}}}\",'.format(ref_json['title']))\n", + "print('\\tjournal=', \"{{{0}}},\".format(ref_json['journal']))\n", + "print('\\tvolume=', \"{{{0}}},\".format(ref_json['volume']))\n", + "print('\\tpages=', \"{{{0}}},\".format(ref_json['pages']))\n", + "#print('\\tstart-page=', '({}),'.format(ref_json['start-page']))\n", + "#print('\\tend-page=', '({}),'.format(ref_json['end-page']))\n", + "print('\\tyear=', \"{{{0}}},\".format(ref_json['year']))\n", + "print('\\tdoi=', \"{{{0}}},\".format(ref_json['doi']))\n", + "print('\\tbibcode=', \"{{{0}}}\".format(ref_json['bibcode']))\n", + "print(\"}\")\n", "# Note if this gives you an error then please remove \"encoder\": \"%ZEncoding:latex\\\\bibitem\", and enter a \\ before each J, T, V,\n", "# etc. therefore \"journal\": \"%J\", would be changed to \"journal\": \"%\\J\", thereby encoding the journal name into BibTeX format\n", "# this error occurs when the bibtex encoder cannot encode a section of the citation."