executablebooks / sphinx-jupyterbook-latex

Supporting LaTeX infrastructure for Jupyter Book
https://sphinx-jupyterbook-latex.readthedocs.io
BSD 3-Clause "New" or "Revised" License
29 stars 13 forks source link

Local bibliographies do not appear in PDF output #94

Open raptistasos opened 2 years ago

raptistasos commented 2 years ago

Hi!

I introduced some local bibliographies in my Jupyter book by inserting at the end of each chapter,

## Bibliography
```{bibliography}
:filter: docname in docnames

The bibliography renders as expected in the HTML output but not in the PDF output, where the bibliography is still collected at the end of the document, while the headers (## Bibliography) keep appearing at the end of each chapter without any content inside.

Is this a known issue? Is there a workaround?

Thanks! 
mmcky commented 2 years ago

thanks for reporting this @raptistasos. I think the main issue here is that bibliography support in LaTeX relies on Tex (i.e. pdflatex or xelatex etc.) to build the bibliographies through the use of tags. The sphinx.writer is adding \bibliography at the end of the document to be populated by tex.

Do you know the tex you would use to actually implement this in a LaTeX document?

@AakashGfude this is something we may need to support in this extension (similar to the table of contents issue)

raptistasos commented 2 years ago

@mmcky @AakashGfude It's me that I must thank you for all the great work that you are doing! In tex, I would use the following template,

https://www.overleaf.com/latex/examples/per-chapter-bibliographies-with-chapterbib/pqzjpxwyyjyd

However, I am not sure if it is compatible with the way that sphinx.writer is adding the bibliography as it dismantles the .bib file and adds any references directly into the .tex file.