Markdown images not exporting via PDF download

4,435 views
Skip to first unread message

Carlos Guzman

unread,
Feb 3, 2016, 3:39:29 PM2/3/16
to Project Jupyter
I have recently started using ipython notebook (R kernel) to document my analysis, and after a bit of fiddling I was able to incorporate my results of my images using <img src='image.png'>.

I wanted to download a pdf copy of my documentation to share with a co-worker but after downloading pandoc and managing to convert to a PDF everything renders perfectly except the images. They don't seem to be exporting.

Does anyone know why this might be? And how could I go about fixing it? Or is this simply not possible?

I am using fedora 22.

Pandoc version 1.13.2

jupyter nbconvert version 4.1.0

Latest 3.2.3 R version.

Thomas Kluyver

unread,
Feb 3, 2016, 3:45:30 PM2/3/16
to Project Jupyter
I don't think pandoc converts HTML <img> tags embedded in Markdown to Latex. Try using the Markdown image syntax:

![alt text](image.png)

--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+u...@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/dd9722b3-f14d-4629-b03b-e48442f241ae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Carlos Guzman

unread,
Feb 3, 2016, 4:22:40 PM2/3/16
to Project Jupyter
While this kept my images in my ipython notebook file, when I tried converting to pdf I got an error:

LaTeX Warning: File `heatmap_BOTH_intragenic_allhistone.png' not found on input
     line 350.

Any idea what might be causing this?

Thomas Kluyver

unread,
Feb 3, 2016, 4:40:05 PM2/3/16
to Project Jupyter
On 3 February 2016 at 16:22, Carlos Guzman <cguzma...@gmail.com> wrote:
While this kept my images in my ipython notebook file, when I tried converting to pdf I got an error:

LaTeX Warning: File `heatmap_BOTH_intragenic_allhistone.png' not found on input
     line 350.

Any idea what might be causing this?

Oh, I remember now. We run latex in a temporary directory because of the mess it makes in the directory where it's run. But that breaks any references to external files it needs to pull in:
https://github.com/jupyter/nbconvert/issues/223

You can work around this by running nbconvert --to latex, and then running latex manually to generate the PDF.

Carlos Guzman

unread,
Feb 3, 2016, 7:17:14 PM2/3/16
to Project Jupyter
Sorry for the simple questions. But I can run nbconvert --to latex, but how do I run latex manually?

Matthias Geier

unread,
Feb 3, 2016, 7:31:32 PM2/3/16
to jup...@googlegroups.com
On Wed, Feb 3, 2016 at 8:17 PM, Carlos Guzman wrote:
> Sorry for the simple questions. But I can run nbconvert --to latex, but how
> do I run latex manually?

You can simply run

pdflatex myfile.tex

But sometimes (e.g. if you have references) you have to run this several times.

I highly recommend "latexmk", which will run pdflatex the right number
of times and also other commands if necessary and it can also display
the result, even continuously.

See this page for more details: http://mg.readthedocs.org/latexmk.html

cheers,
Matthias

>
> On Wednesday, February 3, 2016 at 10:40:05 AM UTC-6, takowl wrote:
>>
>> On 3 February 2016 at 16:22, Carlos Guzman <cguzma...@gmail.com> wrote:
>>>
>>> While this kept my images in my ipython notebook file, when I tried
>>> converting to pdf I got an error:
>>>>
>>>>
>>>> LaTeX Warning: File `heatmap_BOTH_intragenic_allhistone.png' not found
>>>> on input
>>>> line 350.
>>>
>>>
>>> Any idea what might be causing this?
>>
>>
>> Oh, I remember now. We run latex in a temporary directory because of the
>> mess it makes in the directory where it's run. But that breaks any
>> references to external files it needs to pull in:
>> https://github.com/jupyter/nbconvert/issues/223
>>
>> You can work around this by running nbconvert --to latex, and then running
>> latex manually to generate the PDF.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Project Jupyter" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jupyter+u...@googlegroups.com.
> To post to this group, send email to jup...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jupyter/c0238550-174b-4a37-b248-3585ef82b89c%40googlegroups.com.

Carlos Guzman

unread,
Feb 3, 2016, 8:41:36 PM2/3/16
to Project Jupyter
This worked perfectly, thanks very much to both of you!

Blue Tyson

unread,
Jul 11, 2017, 3:05:17 AM7/11/17
to Project Jupyter
Thanks for that.  Also I had a file with spaces in it like sample_image_name more name.jpg and it didn't work...either way, but taking out the spaces did.

M Pacer

unread,
Jul 11, 2017, 3:52:09 AM7/11/17
to Project Jupyter
That has to do with how you need to escape spaces in a \usegraphics() call in LaTeX. We could add something to check for that and modify the path, but that can actually introduce other problems. The real solution (as you've noted) is to just not have spaces in your file names, as it can introduce problems in a lot of contexts.
Reply all
Reply to author
Forward
0 new messages