Skip to content

Commit

Permalink
deploy: 3636e3a
Browse files Browse the repository at this point in the history
  • Loading branch information
balajialg committed Jul 31, 2024
1 parent e9c4c47 commit fe15226
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 51 deletions.
4 changes: 2 additions & 2 deletions _sources/workflow/download_notebook_as_pdf.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ File -> Save and Export Notebook As -> HTML
:name: Download Jupyter Notebook as HTML
```

```{note}
````{note}
When it comes to embedding images in Jupyter notebooks so that it is available as part of PDF, there are various methods to include images. Below are the five options to embed an image of an early Mathematica interface.
#### HTML Image Tag
Expand Down Expand Up @@ -66,4 +66,4 @@ The IPython.display module provides functions to display images directly in Jupy
This method is used to embed an image as an attachment within a Jupyter notebook. It references the image by its attachment identifier, which is useful for images embedded directly within the notebook file.
```
````
2 changes: 1 addition & 1 deletion notebook/images5ways.html
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ <h2> Contents </h2>
<div class="cell_output docutils container">
<div class="output traceback highlight-ipythontb notranslate"><div class="highlight"><pre><span></span><span class="gt">---------------------------------------------------------------------------</span>
<span class="ne">FileNotFoundError</span><span class="g g-Whitespace"> </span>Traceback (most recent call last)
<span class="o">/</span><span class="n">tmp</span><span class="o">/</span><span class="n">ipykernel_1851</span><span class="o">/</span><span class="mf">3066509368.</span><span class="n">py</span> <span class="ow">in</span> <span class="o">&lt;</span><span class="n">module</span><span class="o">&gt;</span>
<span class="o">/</span><span class="n">tmp</span><span class="o">/</span><span class="n">ipykernel_1850</span><span class="o">/</span><span class="mf">3066509368.</span><span class="n">py</span> <span class="ow">in</span> <span class="o">&lt;</span><span class="n">module</span><span class="o">&gt;</span>
<span class="g g-Whitespace"> </span><span class="mi">1</span> <span class="kn">from</span> <span class="nn">IPython.display</span> <span class="kn">import</span> <span class="n">display</span><span class="p">,</span> <span class="n">Image</span>
<span class="ne">----&gt; </span><span class="mi">2</span> <span class="n">display</span><span class="p">(</span><span class="n">Image</span><span class="p">(</span><span class="n">filename</span><span class="o">=</span><span class="s2">&quot;mathematica.png&quot;</span><span class="p">,</span> <span class="n">width</span><span class="o">=</span><span class="mi">250</span><span class="p">))</span>

Expand Down
2 changes: 1 addition & 1 deletion reports/notebook/images5ways.err.log
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ display(Image(filename="mathematica.png", width=250))

---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
/tmp/ipykernel_1851/3066509368.py in <module>
/tmp/ipykernel_1850/3066509368.py in <module>
 1 from IPython.display import display, Image
----> 2 display(Image(filename="mathematica.png", width=250))

Expand Down
2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

51 changes: 5 additions & 46 deletions workflow/download_notebook_as_pdf.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,7 @@
</button>
`);
</script>
<label class="sidebar-toggle secondary-toggle btn btn-sm" for="__secondary"title="Toggle secondary sidebar" data-bs-placement="bottom" data-bs-toggle="tooltip">
<span class="fa-solid fa-list"></span>
</label>

</div></div>

</div>
Expand All @@ -385,17 +383,6 @@ <h1>Download Jupyter Notebook as a PDF</h1>
<div id="print-main-content">
<div id="jb-print-toc">

<div>
<h2> Contents </h2>
</div>
<nav aria-label="Page">
<ul class="visible nav section-nav flex-column">
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#markdown-image-syntax">Markdown Image Syntax</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#html-in-markdown-cell">HTML in Markdown Cell</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#ipython-display-module">IPython Display Module</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#markdown-image-with-attachment">Markdown Image with Attachment</a></li>
</ul>
</nav>
</div>
</div>
</div>
Expand Down Expand Up @@ -425,40 +412,29 @@ <h1>Download Jupyter Notebook as a PDF<a class="headerlink" href="#download-jupy
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="o">&lt;</span><span class="n">img</span> <span class="n">src</span><span class="o">=</span><span class="s2">&quot;mathematica.png&quot;</span> <span class="n">alt</span><span class="o">=</span><span class="s2">&quot;Early Mathematica Interface&quot;</span> <span class="n">style</span><span class="o">=</span><span class="s2">&quot;width: 250px;&quot;</span> <span class="n">class</span><span class="o">=</span><span class="s2">&quot;center&quot;</span><span class="o">/&gt;</span>
</pre></div>
</div>
</div>
<p>This method uses standard HTML to embed an image. It is straightforward and allows for extensive customization through HTML attributes like style and class.</p>
<section id="markdown-image-syntax">
<h2>Markdown Image Syntax<a class="headerlink" href="#markdown-image-syntax" title="Permalink to this heading">#</a></h2>
<p class="rubric">Markdown Image Syntax</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>![mathematica](mathematica.png)
</pre></div>
</div>
<p>Markdown provides a simple syntax for embedding images. This method is concise and ideal for use in Markdown cells in Jupyter notebooks.</p>
</section>
<section id="html-in-markdown-cell">
<h2>HTML in Markdown Cell<a class="headerlink" href="#html-in-markdown-cell" title="Permalink to this heading">#</a></h2>
<p class="rubric">HTML in Markdown Cell</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="o">&lt;</span><span class="n">img</span> <span class="n">src</span><span class="o">=</span><span class="s2">&quot;https://rtl.berkeley.edu/profiles/openberkeley/themes/openberkeley_theme_brand/assets/images/berkeley_wordmark_blue_175x70.svg&quot;</span> <span class="n">alt</span><span class="o">=</span><span class="s2">&quot;Berkeley Logo&quot;</span> <span class="n">style</span><span class="o">=</span><span class="s2">&quot;width: 250px;&quot;</span> <span class="n">class</span><span class="o">=</span><span class="s2">&quot;center&quot;</span><span class="o">/&gt;</span>
</pre></div>
</div>
<p>Embedding an image using HTML within a Markdown cell offers the flexibility of HTML while allowing the cell to remain in Markdown mode. This is useful for more complex styling and alignment requirements.</p>
</section>
<section id="ipython-display-module">
<h2>IPython Display Module<a class="headerlink" href="#ipython-display-module" title="Permalink to this heading">#</a></h2>
<p class="rubric">IPython Display Module</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">IPython.display</span> <span class="kn">import</span> <span class="n">display</span><span class="p">,</span> <span class="n">Image</span>
<span class="n">display</span><span class="p">(</span><span class="n">Image</span><span class="p">(</span><span class="n">filename</span><span class="o">=</span><span class="s2">&quot;mathematica.png&quot;</span><span class="p">,</span> <span class="n">width</span><span class="o">=</span><span class="mi">250</span><span class="p">))</span>\
</pre></div>
</div>
<p>The IPython.display module provides functions to display images directly in Jupyter notebooks.</p>
</section>
<section id="markdown-image-with-attachment">
<h2>Markdown Image with Attachment<a class="headerlink" href="#markdown-image-with-attachment" title="Permalink to this heading">#</a></h2>
<p class="rubric">Markdown Image with Attachment</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>![mathematica.png](attachment:5265a161-c705-42fc-a3ed-ec1fde427030.png)
</pre></div>
</div>
<p>This method is used to embed an image as an attachment within a Jupyter notebook. It references the image by its attachment identifier, which is useful for images embedded directly within the notebook file.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>
</pre></div>
</div>
</section>
</section>

<script type="text/x-thebe-config">
Expand Down Expand Up @@ -520,23 +496,6 @@ <h2>Markdown Image with Attachment<a class="headerlink" href="#markdown-image-wi



<div class="bd-sidebar-secondary bd-toc"><div class="sidebar-secondary-items sidebar-secondary__inner">

<div class="sidebar-secondary-item">
<div class="page-toc tocsection onthispage">
<i class="fa-solid fa-list"></i> Contents
</div>
<nav class="bd-toc-nav page-toc">
<ul class="visible nav section-nav flex-column">
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#markdown-image-syntax">Markdown Image Syntax</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#html-in-markdown-cell">HTML in Markdown Cell</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#ipython-display-module">IPython Display Module</a></li>
<li class="toc-h2 nav-item toc-entry"><a class="reference internal nav-link" href="#markdown-image-with-attachment">Markdown Image with Attachment</a></li>
</ul>
</nav></div>

</div></div>


</div>
<footer class="bd-footer-content">
Expand Down

0 comments on commit fe15226

Please sign in to comment.