jupyter / jupyter-sphinx

Sphinx extension for rendering of Jupyter interactive widgets.
https://jupyter-sphinx.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
188 stars 65 forks source link

Is there a way to have the input and output cells in the LaTeX version differentiable? #208

Open moorepants opened 2 years ago

moorepants commented 2 years ago

Here is an example input and output cells in HTML and a LaTeX pdf: image

Notice how the HTML has the grey background to distinguish input from the output, but in the PDF there is no background color differentiation. Is there a (simple) way to get some input/output differentiation in the PDF? Or, if not, maybe there is an appropriate location in the stack (jupyter, sphinx, nbconvert, etc.) where I should do some hacking to implement this? Even adding the Python >>> input prompt on the input cells could help.

akhmerov commented 2 years ago

It's definitely possible, but it requires figuring out the latex markup generated by sphinx and modifying it. I don't think my latex-fu is strong enough.

moorepants commented 2 years ago

I can probably figure out the latex, but I'm not quite sure where to start. Can you give a pointer of where I should be looking to modify things? Would I be subclassing some kind of writer in Sphinx or something?