nbconvert-examples icon indicating copy to clipboard operation
nbconvert-examples copied to clipboard

citations example does not work in nbconvert 4.0

Open btel opened this issue 9 years ago • 3 comments

The citations are not generated in the output pdf.

btel avatar Sep 11 '15 00:09 btel

This does not work for the example (seems there is an issue with the .bib file), but work elsewhere for me:

make sure you have installed:

texlive-latex-extra texlive-bibtex-extra

Open jupyter notebook:

%%bash

jupyter nbconvert LifecycleTools.ipynb --to latex --template citations
latex LifecycleTools.tex
bibtex LifecycleTools.aux
pdflatex LifecycleTools.tex
pdflatex LifecycleTools.tex
pdflatex LifecycleTools.tex

The example should definetly be updated since it is also referenced in the documentation of nbconvert: http://nbconvert.readthedocs.org/en/latest/latex_citations.html

Siggenx avatar Sep 21 '15 07:09 Siggenx

I did a little digging and it looks like the working directory that bibtex is executed in is a temp folder that does not contain ipython.bib (this file is in /nbconvert-examples/citations, but doesn't make it to the temp folder).

Sorry, but I am nowhere near expert enough to try and code up a solution, but it should be in the form of either:

  • make sure the XXX.bib file is copied over to the temp folder (probably the better way, but how easy is it to find the right .bib file to copy?), or
  • leave XXX.bib wherever it is and point bibtex to it (strikes me as a cludge).

Here is my log (I added the cwd line to the debugger). Note that bibtex fails because it can't see ipython.bib, and the cwd is /tmp/tmp8vqimrmo.

...
[NbConvertApp] WARNING | bibtex had problems, most likely because there were no citations
[NbConvertApp] bibtex output: ['bibtex', 'notebook']
This is BibTeX, Version 0.99d (TeX Live 2016)
The top-level auxiliary file: notebook.aux
The style file: unsrt.bst
I couldn't open database file ipython.bib
---line 32 of file notebook.aux
 : \bibdata{ipython
 :                 }
I'm skipping whatever remains of this command
I found no database files---while reading file notebook.aux
Warning--I didn't find a database entry for "4th-paradigm"
Warning--I didn't find a database entry for "Hef10"
Warning--I didn't find a database entry for "Cou10"
Warning--I didn't find a database entry for "PER-GRA:2007"
Warning--I didn't find a database entry for "Perez2011"
Warning--I didn't find a database entry for "ganga09"
Warning--I didn't find a database entry for "SST"
(There were 2 error messages)

cwd: /tmp/tmp8vqimrmo
[NbConvertApp] PDF successfully created
[NbConvertApp] Writing 197458 bytes to LifecycleTools.pdf

smcateer avatar Dec 30 '16 03:12 smcateer

@Siggenx Great! It works though I don't understand why.

DeathPoem avatar May 08 '17 12:05 DeathPoem