-
Notifications
You must be signed in to change notification settings - Fork 572
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
Download as pdf via LaTex not working #27
Comments
Copying what I suspect is the relevant part of the Latex output:
|
Any idea about how I can fix it? The Download as pdf function works for Python 2 Kernel. |
Sorry, I don't really know about latex. Try to work out what bit of output it's choking on, that might help. |
I tried generating the pdf using nbconvert and it failed at the compilation step. When I do pdflatex on the generated .tex file it works. A workaround might be using nbconvert at the commandline and compiling using pdflatex. |
It would be really nice to get this fixed. Any estimate of when it might get fixed? |
I think it's waiting for someone who knows LaTeX to investigate what's going on. Volunteers welcome :-) |
Well, I know Latex well, but don't know anything about how all this Jupyter/IRKernel/nbconvert connects together. I'll see if I can poke around a bit. |
You can generate the LaTeX by doing nbconvert by nbconvert/nbconvert/exporters/pdf.py Line 127 in 0e6466d
|
The problem is that for some reason the export is using "description*" as the list environment. As far as I know there is no such environment. At least not one in any of the common libraries. It should really be changed to "description" instead, but I cannot find where that typo is in the code. Can anyone help find it or at least point me to where it might be? There is at least one other problem too. It's not escaping percent signs. It's using "%" when it should be using "%" |
Hi @dkincaid, I tried looking for the description* tag and it's not in the nbconvert templates as well. Interestingly, the description* block matches the output of the IRKernel.
json from notebook
Output from the notebook
Interestingly the description tag is in the .ipynb file and rendered in the "text/latex" section in the output. I'm not sure how the notebook handles this but I couldn't find the same section in my notebook with the python kernels. |
Aha! I hadn't thought of this coming from the kernel itself. It looks like the relevant code is here: And here's the commit that added it: IRkernel/repr@8f50f10 @flying-sheep, the |
add a way to register stuff to add to the LaTeX preample of the template. right now the default template has a rather random assortment of as documented in |
I can confirm that adding Adding Please don't forget about the issue with |
oh sorry, i meant
where does the % problem happen? |
This piece of code:
produces this output in Jupyter notebook:
and this output in latex after
in Latex the |
hmm, right. tracked as IRkernel/repr#10 |
I just got this problem trying to convert a R notebook, so it's still here, any news?
See the LaTeX manual or LaTeX Companion for explanation. |
as said above, that’s due to
you can put this in a file ((*- extends 'article.tplx' -*))
((* block packages *))
((( super() )))
\usepackage[inline]{enumitem}
\usepackage{minted}
((* endblock packages *)) and then call |
Thanks, but as it was mentioned earlier, that only works without package {minted}, once i erased that line it worked. Also, there are many rendering errors in the PDF, errors that when I create a python nb instead of a R one , and use %%R cell magic and convert the nb to pdf don't happen. For example
From a python nb with %%R the rendering is correct. |
not an error. that’s the vector indices 😄 if you want them to be displayed differently, read the enumitem docs and find out how to configure them to show no indices. i think you can use |
Of course are the indexes but in dont see them in R console, i dont see them in the the html from the R notebook, i dont see them in the pdf created by ipython using R magic so why i suppose to want them to be displayed in the pdf ? Not an error? displaying something that nobody sees is not an error?. It isnt a matter of preference, or if I want them to be displayed differently, no program is showing them except this nbconvert from R notebooks. And finally, if nbconvert from a ipython notebook using R magic produces a pdf displaying what it is expected, without dealing with any kind of tex configuration, why nbconvert from and R nb does not? |
haha no reason to get worked up either. it’s just the representation i chose, because there’s no easy way to get “display index of the index of the first item per line” in LaTeX. you can configure my representation by calling all this is a byproduct of using fancy displaying instead of ugly “render R’s output as monospaced text” (what R magic does). Try displaying a matrix or data.frame and you’ll see why this is better! please share the |
Hi all, any movement on this issue? I added the following
Then tried to convert my notebook
which resulted in the output here. The important part is below:
Any help is appreciated. Cheers! |
can you try with the newest IRkernel/repr from github? this is a latex escaping error which was hopefully addressed in a recent PR devtools::install_github('IRkernel/repr') |
Hi @flying-sheep, I did a |
Is it possible to confirm the R kernel version being used through a CLI or API in the notebook? |
|
well, it can’t be sthe same error still as. now repr outputs that should be fine. you’ll have to recreate the cell outputs though, maybe you forgot that. repr is only responsible to create the LaTeX code, but once (faulty) code is saved in the .ipynb file it can’t change it. |
Perhaps this is a separate issue, then? I fully upgraded jupyter (from pip) and have tried to use both the GUI and CLI to convert, but still get failures. I tried converting to just latex and the table output is not the same as what |
With the command you have above, nbconvert won't use IRkernel at all - it's working with the outputs saved in your notebook. You'll need to re-run the notebook after updating IRkernel to get the updated output. There is a |
Hi @takluyver, should have been more precise. I killed the notebook process after installing the updated kernel. Note that the |
Ok, finally figured it out. I had to
Thanks for the assist! |
sorry to be nitpicky, but i think what you really had to do is
dunno how updating jupyter or the kernel itself could help, but it never hurts 😄 |
Hi, any idea how to solve it? |
read my first comment in this thread |
Note, the current workaround is adding something like this in the first cell (or at least before any displayed functions or lists/vectors): library("IRdisplay")
display_latex("\\usepackage[inline]{enumitem}\n\\usepackage{minted}" There are now two alternative proposals to fix this without the need of a user workaround: IRkernel/repr#74 and #335 |
wait, you can do that inside of pretty cool, i didn’t know that! |
bump. I just converted to LaTeX and did a search-and-replace for |
I'm going to say #335 closes this but will reopen if there it pops up again. |
#143 at IRKernel
The text was updated successfully, but these errors were encountered: