QuantEcon / sphinxcontrib-jupyter

A Sphinx Extension for Generating Jupyter Notebooks
BSD 3-Clause "New" or "Revised" License
76 stars 23 forks source link

ENH: Add jupyter_target_pdf option for new pdf compilation pipeline #210

Closed mmcky closed 5 years ago

mmcky commented 5 years ago

This PR adds a jupyter_target_pdf option to translator for optimising the generated ipynb to target conversion to PDF. This needs will assist with the make jupyterpdf builder being prepared by @AakashGfude (@AakashGfude please link PR once you have set one up)

  1. Removes the forced replacement of ( and ) with %28 and %29 that causes an issue with pandoc conversion.
  2. adjusts labelling of math equations to add \label{} to follow any \tag{} and remove the html id tags inserted above the equation
  3. update section reference targets to use \hypertarget

This PR adjusts the test structure to allow for different configurations. The base folder now contains the primary conversion tests for rst to ipynb. pdf contains test cases related to building pdf files (via ipynb).

mmcky commented 5 years ago
mmcky commented 5 years ago

The solution for :cite: is pretty fragile in that it relies on the bibliography to be specified in a file called references.rst. It appears that sphinxcontrib-bibtex doesn't seem to provide any indication of class in_citation_reference so it needs to be inferred from a general refuri.

mmcky commented 5 years ago

Note:

The solution notebooks for pdf/index and pdf/references are only placeholders. PDF compilation currently won't require these elements to compile so have not been fully implemented.

mmcky commented 5 years ago

@AakashGfude once this passes travis I think I can hand it over to you to integrate into your new pipeline for pdf production in PR #210. Before you migrate across would you mind:

  1. checkout this branch of sphinxcontrib-jupyter and generating a set of ipynb lectures for lectures-source-py (for jupyter and website, and coverage)
  2. checkout the master branch and generate a comparison set of notebooks
  3. use nbdime to make sure the notebooks match.

I think these should all pass -- as the base test cases haven't changed, but I would like to confirm before we merge in the master branch.

mmcky commented 5 years ago

@AakashGfude testing master and add-pdf-target-option on lecture-source-py and this branch doesn't interfere with jupyter, website or coverage generated ipynb files.

@AakashGfude let's merge this into master to update the translator and then you can update your builder with the new writer once we fix the conflicts with the master branch.