Keshav Rajasekaran
Keshav Rajasekaran

Reputation: 33

ipython notebook images not seen in pdf conversion

When I try to convert the ipynb file to pdf my pictures in the ipynb don't make it to the pdf at all. There is no sign of them and the markdown table doesn't get rendered properly. Is there a reason why this is happening?

Upvotes: 2

Views: 2419

Answers (3)

pds
pds

Reputation: 2582

This is known bug with nbconvert see issue #552. It seems to be a problem with how nbconvert converts the ipynb to a tex-compatible file structure before a tex compiler compiles to PDF.

The simple workaround by tashrifbillah on issue #1079 is using a code cell to present the image, as I duplicate below:

from IPython.display import display, Image
display(Image(filename="image_directory/my_image.png"))

This cell is processed differently than the markdown cells, and is presented correctly to the tex compiler for PDF production.

Upvotes: 1

Mahesh Mavuri
Mahesh Mavuri

Reputation: 1

just try the below code in markdown

![title](imagename.png)

Make sure that the image you are trying to save in ipython notebook is in the same location as of the notebook

Upvotes: -2

hagger98
hagger98

Reputation: 1

Please see the following code of auto generated Latex file created by Jupyter Notebook (ipynb) file. You can open the .tex extension file in the editor and go to the line 32 or 33 where you will find the bold line and comment it out. Your problem will be partially solved. Code: \makeatletter \def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth \else\Gin@nat@width\fi} \makeatother \let\Oldincludegraphics\includegraphics % Set max figure width to be 80% of text width, for now hardcoded. (%)\renewcommand{\includegraphics}[1]{\Oldincludegraphics[width=.8\maxwidth]{#1}} After commenting it out, find the image attachment command in .tex file. When you find that lines where compiler stops usually. replace the line of: \adjustmentbox with: \includegraphics[scale=0.5 or whatever you desire]{yourimage.png}

Hope it solves your problem, mine is solved and i generated pdf from latex including graphics.

Upvotes: -1

Related Questions