-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
nbconvert: Latex template refactor #4112
Conversation
Did some in person review:
|
Cell styles that we want to support:
|
Updated description, rebased, and ready to test/review. |
The preview images look awesome! I hope to find some time in the near future to test this! |
Thanks @jakobgager 😄 |
From in person review with @ellisonbg :
|
Also post review, added a bibliography block. |
I updated the screenshots in the description to match the altered output for the ipython & bw ipython styles |
from
I get
|
""" | ||
# Generate Pygments definitions for Latex | ||
resources["latex"] = {} | ||
resources["latex"]["pygment_definitions"] = LatexFormatter().get_style_defs() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pygments
in general, when creating a bunch of files of a given class, prefix seems better than suffix (style_ipython rather than ipython_style) |
Good tip, I've uploaded the changes |
Sounds like the funky logic I wrote to fix the $$ tag spacing on math (https://github.com/ipython/ipython/blob/master/IPython/nbconvert/filters/latex.py#L66) is failing, could you paste a small portion of the tex around that line (632) please? |
Funny issue. The first time I run pdflatex, latex complains about a missing language definition, and missing tikz. |
Really? That is very very strange, haven't heard of anything like that so far. The new pdf post processor logic (that @ellisonbg wrote, which was just merged into master a couple days ago and has been rebased into this PR) should clean ALL of the temporary files between runs for you. |
It should also automatically run pdflatex 3 times... I think it may abort if it encounters a critical failure, which may be a problem.. Maybe it should only abort on pdflatex failures after the final execution of pdflatex? |
The following notebook converted fine with ipython 1.0.0 but results in an latex error using your branch: |
Thanks @jakobgager I'll take a look right now |
Regarding the funny issue, it is quite tricky to reproduce the error. However I managed again (rename + switching from-and-to virtualenv) the error was
IIRC there was something similar with older versions, so it might not related to this at all. |
Btw. the I used the default calls for both issues |
I used to get this error when I used the old simple cell style, left some of the temp files in the directory, and then tried to use the notebook cell style. The problem was that the temporary files didn't have the dependencies necessary to run the more complex tex. Still all the temporary files should be removed with the changes to the pdf post processor.... Not sure why you are seeing this |
@jakobgager there was a missing escape_latex in the base, I just added it, please give a second whirl when you get a chance |
It fixes the problem with your notebook on my machine. |
Works also on my machine. I just wonder if the Output of In4 should get some linebreaks? |
It probably should, if it's not too complicated, #3959 |
((* elif cell.level == 6 -*)) | ||
((* block h6 -*))\\*\textit((* endblock h6 -*)) | ||
((*- endif -*)) | ||
{((( cell.source | citation2latex | escape_latex )))} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: Remove line breaks
deleted: latex/abstract.tplx deleted: latex/latex_sphinx_article.tplx deleted: latex/latex_sphinx_report.tplx deleted: latex/style_notebook.tplx deleted: latex/style_simple.tplx
Shouldn't have been checked in.
@ellisonbg and @minrk , changes made after our video conversation on Friday and rebased against master. |
@@ -15,26 +15,9 @@ | |||
#----------------------------------------------------------------------------- | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should move this file to nbconvert-examples
with the rest of the sphinx template stuff.
Overall this looks good, I had a few small comments inline. Lets make sure that the removed cell styles and sphinx stuff gets move over to nbconvert-examples. |
OK Travis is passing and everything looks good, merging. |
nbconvert: Latex template refactor
nbconvert: Latex template refactor
I'd like as much input from everyone as possible. It's a good time to make sure feature X won't be too hard to implement in the future.
Goals
Motivation
Design
Conditional inheritance is used select an output style. This may seem strange, but it is required to allow inheriting output templates to override media blocks and those blocks to be used by the output style. It also is a nice way of circumventing the need to require a cell style template per output template.
Features
python cell style
ipython cell style
black & white python cell style
black & white ipython cell style