Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exporting to LaTeX #18

Open
kirk86 opened this issue Aug 6, 2019 · 8 comments
Open

Exporting to LaTeX #18

kirk86 opened this issue Aug 6, 2019 · 8 comments
Labels

Comments

@kirk86
Copy link

kirk86 commented Aug 6, 2019

Hi and thanks for this package, I just had a couple of questions if you don't mind me asking since I couldn't find any answers in the readme.

  1. Is it possible to export the document into latex?
  2. Will you be releasing a conda package?

Thanks!

@epogrebnyak
Copy link
Contributor

To my understanding html is currently the only output, but other formats are discussed (eg pdf via Webkit).

Also once there is a html, one can try create a latex with pandoc. If you can point out a good rendering engine / library for latex, that would be very helpful.

@danijar
Copy link
Owner

danijar commented Aug 6, 2019

Exactly. If you give pandoc a try, please let us know how it goes. If HTML is well supported, we might be fine with having Handout always export HTML. In that case, we can provide a few examples on how to combine it with pandoc to export into various formats.

Please open a separate issue about conda :)

@danijar danijar changed the title [question] Possibility to export to latex and conda packgs Exporting to LaTeX Aug 6, 2019
@kirk86
Copy link
Author

kirk86 commented Aug 7, 2019

Thanks folks @danijar & @epogrebnyak for the responses, maybe if we exported directly to ipynb and then let the users convert that to other formats since ipynb allows for easy conversion to other formats such as html, pdf, latex, etc. (just an idea)

@epogrebnyak

If you can point out a good rendering engine / library for latex, that would be very helpful.

I usually use this to export an ipynb to latex, hope that helps.

Also another idea would be to combine forces with this in order to allow for easy export between .py and .ipynb.

@epogrebnyak
Copy link
Contributor

@kirk86 - thanks for giving the clues on the latex workflow. As I understand, the current stand for Handout is one-directional transformation of .py to html, followed by options to convert to other formats.

These options seems to be (for issue #9):

  • pdf (bypassing latex)
  • latex
  • ipynb
  • some flavour of markdown
  • other (?)

In the space of py2nb that you mentioned there is also jupytext, just to note.

ipynb allows for easy conversion to other formats such as html, pdf, latex, etc. (just an idea)

Any pointers on how people convert from .ipynb to pdf/latex? nbconvert?

@kirk86
Copy link
Author

kirk86 commented Aug 7, 2019

@epogrebnyak thanks for pointing to jupytext.

Any pointers on how people convert from .ipynb to pdf/latex? nbconvert?

jupyter nbconvert --to latex --template report <path/to/.ipynb>
jupyter nbconvert --to pdf <path/to/.ipynb>

Alternatively, from inside jupyter menu Download as, then you'll find all the available options.

But in my experience it dumps everything (i.e. images, .tex files, etc.) in the same folder that .ipynb is located, while the package I used it keeps things nice tightly in separate folders, for instance images go to their own folder imgs, .tex files to their own tex folder, etc.

@epogrebnyak
Copy link
Contributor

epogrebnyak commented Aug 7, 2019

@kirk86 - thanks for pointing out the nbconvert commands! I'm now looking at nbconvert machinery to produce latex/pdf, posting for future reference:

  • here is presumably the latex exporter class (template formatter? I have a hard time seeing the point of entry to it.)

  • and here is a pdf maker - it calls xelatex <filename> quite, more understabdable what is going on.

@kirk86
Copy link
Author

kirk86 commented Aug 8, 2019

@epogrebnyak

  • for latex it uses jinja2 to export in different formats look at TemplateExporter and Exporter. I think that's where the action is taking place.
  • First they read the notebook, and then they pass its content through a number of filters for preprocessing and cleaning, finally they convert it.

That's my understanding of it.

@danijar
Copy link
Owner

danijar commented Aug 9, 2019

I think it'd be easy to write a LaTeX exporter -- we don't even need a templating library to make a first attempt at this.

We should only output LaTeX source in this case. The user can either manually call their LaTeX compiler afterwards or call it from within their script after the doc.show() line. Of course, this would be good to point out in an example.

We just need to support multiple exporters which is tracked in #9.

@danijar danijar added feature and removed question labels Aug 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants