<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Pandoc | Thought splinters</title>
    <link>https://notes.peter-baumgartner.net/tag/pandoc/</link>
      <atom:link href="https://notes.peter-baumgartner.net/tag/pandoc/index.xml" rel="self" type="application/rss+xml" />
    <description>Pandoc</description>
    <generator>Wowchemy (https://wowchemy.com)</generator><language>en-us</language><copyright>CC BY-SA 4.0</copyright><lastBuildDate>Fri, 07 May 2021 00:00:00 +0000</lastBuildDate>
    <image>
      <url>https://notes.peter-baumgartner.net/media/icon_huab1e86cf5cbc1139acf672dc60b9d7d0_5213_512x512_fill_lanczos_center_2.png</url>
      <title>Pandoc</title>
      <link>https://notes.peter-baumgartner.net/tag/pandoc/</link>
    </image>
    
    <item>
      <title>Images in Rmarkdown Files</title>
      <link>https://notes.peter-baumgartner.net/2021/05/07/images-in-rmarkdown-files/</link>
      <pubDate>Fri, 07 May 2021 00:00:00 +0000</pubDate>
      <guid>https://notes.peter-baumgartner.net/2021/05/07/images-in-rmarkdown-files/</guid>
      <description>


&lt;h2 id=&#34;using-r-chunk-with-knitr&#34;&gt;Using R chunk with &lt;code&gt;knitr&lt;/code&gt;&lt;a href=&#34;#using-r-chunk-with-knitr&#34;&gt;&lt;svg class=&#34;anchor-symbol&#34; height=&#34;26&#34; width=&#34;26&#34; viewBox=&#34;0 0 22 22&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
&lt;path d=&#34;M0 0h24v24H0z&#34; fill=&#34;currentColor&#34;&gt;&lt;/path&gt;
&lt;path d=&#34;M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76.0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71.0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71.0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76.0 5-2.24 5-5s-2.24-5-5-5z&#34;&gt;&lt;/path&gt;
&lt;/svg&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Using R chunks with &lt;code&gt;knitr&lt;/code&gt; has the full features as outlined in the post &lt;a href=&#34;../images-from-rmd-to-html-format/#example&#34;&gt;Images: From R Markdown to HTML format&lt;/a&gt;.&lt;/p&gt;



&lt;h3 id=&#34;example&#34;&gt;Example&lt;a href=&#34;#example&#34;&gt;&lt;svg class=&#34;anchor-symbol&#34; height=&#34;26&#34; width=&#34;26&#34; viewBox=&#34;0 0 22 22&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
&lt;path d=&#34;M0 0h24v24H0z&#34; fill=&#34;currentColor&#34;&gt;&lt;/path&gt;
&lt;path d=&#34;M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76.0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71.0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71.0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76.0 5-2.24 5-5s-2.24-5-5-5z&#34;&gt;&lt;/path&gt;
&lt;/svg&gt;&lt;/a&gt;
&lt;/h3&gt;
&lt;div class=&#34;figure&#34; style=&#34;text-align: center&#34;&gt;
&lt;img src=&#34;images/my-image.png&#34; alt=&#34;Caption for this figure 1&#34; width=&#34;100%&#34; /&gt;
&lt;p class=&#34;caption&#34;&gt;Figure 1: Caption for this figure 1&lt;/p&gt;
&lt;/div&gt;



&lt;h3 id=&#34;code-in-r-chunk&#34;&gt;Code in R Chunk&lt;a href=&#34;#code-in-r-chunk&#34;&gt;&lt;svg class=&#34;anchor-symbol&#34; height=&#34;26&#34; width=&#34;26&#34; viewBox=&#34;0 0 22 22&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
&lt;path d=&#34;M0 0h24v24H0z&#34; fill=&#34;currentColor&#34;&gt;&lt;/path&gt;
&lt;path d=&#34;M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76.0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71.0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71.0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76.0 5-2.24 5-5s-2.24-5-5-5z&#34;&gt;&lt;/path&gt;
&lt;/svg&gt;&lt;/a&gt;
&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;```
{r img-with-knitr, echo=FALSE, fig.align=&#39;center&#39;, out.width=&#39;100%&#39;, fig.cap=&#39;Caption for this figure 1&#39;}
knitr::include_graphics(&amp;quot;images/my-image.png&amp;quot;)
```
&lt;/code&gt;&lt;/pre&gt;



&lt;h3 id=&#34;code-in-html&#34;&gt;Code in HTML&lt;a href=&#34;#code-in-html&#34;&gt;&lt;svg class=&#34;anchor-symbol&#34; height=&#34;26&#34; width=&#34;26&#34; viewBox=&#34;0 0 22 22&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
&lt;path d=&#34;M0 0h24v24H0z&#34; fill=&#34;currentColor&#34;&gt;&lt;/path&gt;
&lt;path d=&#34;M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76.0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71.0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71.0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76.0 5-2.24 5-5s-2.24-5-5-5z&#34;&gt;&lt;/path&gt;
&lt;/svg&gt;&lt;/a&gt;
&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;```
&amp;lt;div class=&amp;quot;figure&amp;quot; style=&amp;quot;text-align: center&amp;quot;&amp;gt;
    &amp;lt;span id=&amp;quot;fig:img-with-knitr&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;
    &amp;lt;img src=&amp;quot;images/my-image.png&amp;quot; alt=&amp;quot;Caption for this figure 1&amp;quot; width=&amp;quot;100%&amp;quot;/&amp;gt;
    &amp;lt;p class=&amp;quot;caption&amp;quot;&amp;gt;Figure 1: Caption for this figure 1&amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;

```
&lt;/code&gt;&lt;/pre&gt;



&lt;h3 id=&#34;css&#34;&gt;CSS&lt;a href=&#34;#css&#34;&gt;&lt;svg class=&#34;anchor-symbol&#34; height=&#34;26&#34; width=&#34;26&#34; viewBox=&#34;0 0 22 22&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
&lt;path d=&#34;M0 0h24v24H0z&#34; fill=&#34;currentColor&#34;&gt;&lt;/path&gt;
&lt;path d=&#34;M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76.0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71.0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71.0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76.0 5-2.24 5-5s-2.24-5-5-5z&#34;&gt;&lt;/path&gt;
&lt;/svg&gt;&lt;/a&gt;
&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;div.figure {
        border: 1px;
        border-style: groove;
        box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px  rgba(0, 0, 0, 0.19);
}

p.caption {
    text-align: center;
    margin-top: -0.5rem;
    margin-bottom: 0.5rem;
    font-size: smaller;
}
&lt;/code&gt;&lt;/pre&gt;



&lt;h3 id=&#34;summary&#34;&gt;Summary&lt;a href=&#34;#summary&#34;&gt;&lt;svg class=&#34;anchor-symbol&#34; height=&#34;26&#34; width=&#34;26&#34; viewBox=&#34;0 0 22 22&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
&lt;path d=&#34;M0 0h24v24H0z&#34; fill=&#34;currentColor&#34;&gt;&lt;/path&gt;
&lt;path d=&#34;M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76.0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71.0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71.0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76.0 5-2.24 5-5s-2.24-5-5-5z&#34;&gt;&lt;/path&gt;
&lt;/svg&gt;&lt;/a&gt;
&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Caption&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Format of caption&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Caption automatically numbered&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Alt&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Title&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tooltip&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Width/Height&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Link to&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ID&lt;/strong&gt;: yes (format: &amp;ldquo;fig:&amp;lt;chunk name&amp;gt;)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Classes&lt;/strong&gt;: yes (with &lt;code&gt;out.extra&lt;/code&gt;, example: &lt;code&gt;out.extra=&#39;class=&amp;quot;border shadowed&amp;quot;&#39;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CSS style&lt;/strong&gt;: yes (with out.extra, example: &lt;code&gt;out.extra=&#39;style=&amp;quot;background-color: #9ecff7; padding:10px; display: inline-block;&amp;quot;&#39;&lt;/code&gt; See blog post &lt;a href=&#34;http://zevross.com/blog/2017/06/19/tips-and-tricks-for-working-with-images-and-figures-in-r-markdown-documents/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Tips and tricks for working with images and figures in R Markdown documents&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Other&lt;/strong&gt; (key=value): no&lt;/li&gt;
&lt;/ul&gt;



&lt;h2 id=&#34;markdown-via-addins-insert-image&#34;&gt;Markdown via Addins &amp;lsquo;Insert Image&amp;rsquo;&lt;a href=&#34;#markdown-via-addins-insert-image&#34;&gt;&lt;svg class=&#34;anchor-symbol&#34; height=&#34;26&#34; width=&#34;26&#34; viewBox=&#34;0 0 22 22&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
&lt;path d=&#34;M0 0h24v24H0z&#34; fill=&#34;currentColor&#34;&gt;&lt;/path&gt;
&lt;path d=&#34;M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76.0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71.0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71.0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76.0 5-2.24 5-5s-2.24-5-5-5z&#34;&gt;&lt;/path&gt;
&lt;/svg&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;The behavior is the same as in &lt;a href=&#34;../images-in-md-files&#34;&gt;Images in .md files&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Using the RStudio Addin window without the width or height parameter it just generate markdown code. Is the width or height parameter included then HTML is generated but without &lt;code&gt;div.figure&lt;/code&gt; and &lt;code&gt;p.caption&lt;/code&gt; class. There is no caption visible and the CSS styling has to be done with &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; tag.&lt;/p&gt;



&lt;h3 id=&#34;example-1&#34;&gt;Example&lt;a href=&#34;#example-1&#34;&gt;&lt;svg class=&#34;anchor-symbol&#34; height=&#34;26&#34; width=&#34;26&#34; viewBox=&#34;0 0 22 22&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
&lt;path d=&#34;M0 0h24v24H0z&#34; fill=&#34;currentColor&#34;&gt;&lt;/path&gt;
&lt;path d=&#34;M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76.0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71.0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71.0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76.0 5-2.24 5-5s-2.24-5-5-5z&#34;&gt;&lt;/path&gt;
&lt;/svg&gt;&lt;/a&gt;
&lt;/h3&gt;
&lt;img src=&#34;images/my-image.png&#34; alt=&#34;Alt text&#34; width=&#34;100%&#34;/&gt;
&lt;div class=&#34;alert alert-warning&#34;&gt;
  &lt;div&gt;
    You can&amp;rsquo;t use the Addins &amp;lsquo;Insert Image&amp;rsquo; in Visual R Markdown mode because it protects the conversion by adding a backslash in front of the squared brackets: &lt;code&gt;!\[Alt text\](images/my-image.png)&lt;/code&gt;.
  &lt;/div&gt;
&lt;/div&gt;



&lt;h3 id=&#34;code-in-markdown&#34;&gt;Code in markdown&lt;a href=&#34;#code-in-markdown&#34;&gt;&lt;svg class=&#34;anchor-symbol&#34; height=&#34;26&#34; width=&#34;26&#34; viewBox=&#34;0 0 22 22&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
&lt;path d=&#34;M0 0h24v24H0z&#34; fill=&#34;currentColor&#34;&gt;&lt;/path&gt;
&lt;path d=&#34;M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76.0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71.0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71.0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76.0 5-2.24 5-5s-2.24-5-5-5z&#34;&gt;&lt;/path&gt;
&lt;/svg&gt;&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;The first line is the markdown code for images without width/height parameters. The second line has a width parameter.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;![Alt text](images/my-image.png)
&amp;lt;img src=&amp;quot;images/my-image.png&amp;quot; alt=&amp;quot;Alt text&amp;quot; width=&amp;quot;100%&amp;quot;/&amp;gt; 
&lt;/code&gt;&lt;/pre&gt;



&lt;h3 id=&#34;code-in-html-1&#34;&gt;Code in HTML&lt;a href=&#34;#code-in-html-1&#34;&gt;&lt;svg class=&#34;anchor-symbol&#34; height=&#34;26&#34; width=&#34;26&#34; viewBox=&#34;0 0 22 22&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
&lt;path d=&#34;M0 0h24v24H0z&#34; fill=&#34;currentColor&#34;&gt;&lt;/path&gt;
&lt;path d=&#34;M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76.0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71.0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71.0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76.0 5-2.24 5-5s-2.24-5-5-5z&#34;&gt;&lt;/path&gt;
&lt;/svg&gt;&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;The first line is the HTML code for images without width/height parameters. The second line has a width parameter.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;p&amp;gt;&amp;lt;img src=&amp;quot;images/my-image.png&amp;quot; alt=&amp;quot;Alt text&amp;quot;&amp;gt;&amp;lt;/p&amp;gt; 
&amp;lt;img src=&amp;quot;images/my-image.png&amp;quot; alt=&amp;quot;Alt text&amp;quot; width=&amp;quot;100%&amp;quot;&amp;gt;
&lt;/code&gt;&lt;/pre&gt;



&lt;h3 id=&#34;css-1&#34;&gt;CSS&lt;a href=&#34;#css-1&#34;&gt;&lt;svg class=&#34;anchor-symbol&#34; height=&#34;26&#34; width=&#34;26&#34; viewBox=&#34;0 0 22 22&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
&lt;path d=&#34;M0 0h24v24H0z&#34; fill=&#34;currentColor&#34;&gt;&lt;/path&gt;
&lt;path d=&#34;M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76.0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71.0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71.0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76.0 5-2.24 5-5s-2.24-5-5-5z&#34;&gt;&lt;/path&gt;
&lt;/svg&gt;&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;If the RStudio Addin window is used, then the &lt;code&gt;img&lt;/code&gt; tag should be wrapped into a paragraph. Otherwise it would be generate a conflict with other tags related with images.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&#34;language-css&#34;&gt;p img {
    border: 1px;
    border-style: groove;
    box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px  rgba(0, 0, 0, 0.19);
}

&lt;/code&gt;&lt;/pre&gt;
&lt;style type=&#34;text/css&#34;&gt;
p img {
    border: 1px;
    border-style: groove;
    box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px  rgba(0, 0, 0, 0.19);
}

&lt;/style&gt;



&lt;h3 id=&#34;summary-1&#34;&gt;Summary&lt;a href=&#34;#summary-1&#34;&gt;&lt;svg class=&#34;anchor-symbol&#34; height=&#34;26&#34; width=&#34;26&#34; viewBox=&#34;0 0 22 22&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
&lt;path d=&#34;M0 0h24v24H0z&#34; fill=&#34;currentColor&#34;&gt;&lt;/path&gt;
&lt;path d=&#34;M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76.0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71.0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71.0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76.0 5-2.24 5-5s-2.24-5-5-5z&#34;&gt;&lt;/path&gt;
&lt;/svg&gt;&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;So &amp;ndash; all in all &amp;ndash; the Addins window is not very useful. The only advantage is the generation of the filepath and the copy of the image in the correct folder.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Caption&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Format of caption&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Caption automatically numbered&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Alt&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Title&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tooltip&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Width/Height&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Link to&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ID&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Classes&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CSS style&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Other&lt;/strong&gt; (key=value): no&lt;/li&gt;
&lt;/ul&gt;



&lt;h2 id=&#34;visual-r-markdown-via-menu-insert-&#34;&gt;Visual R Markdown via Menu &amp;lsquo;Insert &amp;hellip;&amp;rsquo;&lt;a href=&#34;#visual-r-markdown-via-menu-insert-&#34;&gt;&lt;svg class=&#34;anchor-symbol&#34; height=&#34;26&#34; width=&#34;26&#34; viewBox=&#34;0 0 22 22&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
&lt;path d=&#34;M0 0h24v24H0z&#34; fill=&#34;currentColor&#34;&gt;&lt;/path&gt;
&lt;path d=&#34;M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76.0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71.0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71.0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76.0 5-2.24 5-5s-2.24-5-5-5z&#34;&gt;&lt;/path&gt;
&lt;/svg&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Again the same behavior as in &lt;a href=&#34;../images-in-md-files&#34;&gt;Images in .md files&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;With a &lt;code&gt;.Rmarkdown&lt;/code&gt; file Visual R Markdown offers only a reduced first part of the window as it is presented in an &lt;code&gt;.Rmd&lt;/code&gt; file. In contrast to the .Rmd version it lacks the fields to add width and height parameter.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;images/reduced-window-version-for-md-files-min.png&#34; alt=&#34;Window for inserting images in .md files with Visual R Markdown window with reduced number of input fields.&#34; title=&#34;text for title and tooltip&#34;&gt;&lt;/p&gt;
&lt;p&gt;But more important: There is no &lt;code&gt;caption&lt;/code&gt;! The text for the field &amp;lsquo;Caption/Alt&amp;rsquo; includes the text only for the &lt;code&gt;alt&lt;/code&gt;-attribute!&lt;/p&gt;



&lt;h3 id=&#34;example-2&#34;&gt;Example&lt;a href=&#34;#example-2&#34;&gt;&lt;svg class=&#34;anchor-symbol&#34; height=&#34;26&#34; width=&#34;26&#34; viewBox=&#34;0 0 22 22&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
&lt;path d=&#34;M0 0h24v24H0z&#34; fill=&#34;currentColor&#34;&gt;&lt;/path&gt;
&lt;path d=&#34;M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76.0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71.0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71.0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76.0 5-2.24 5-5s-2.24-5-5-5z&#34;&gt;&lt;/path&gt;
&lt;/svg&gt;&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;&lt;img src=&#34;images/my-image.png&#34; alt=&#34;Alt text (no caption!)&#34; title=&#34;Text for title and tooltip&#34;&gt;&lt;/p&gt;



&lt;h3 id=&#34;code-in-markdown-1&#34;&gt;Code in markdown&lt;a href=&#34;#code-in-markdown-1&#34;&gt;&lt;svg class=&#34;anchor-symbol&#34; height=&#34;26&#34; width=&#34;26&#34; viewBox=&#34;0 0 22 22&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
&lt;path d=&#34;M0 0h24v24H0z&#34; fill=&#34;currentColor&#34;&gt;&lt;/path&gt;
&lt;path d=&#34;M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76.0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71.0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71.0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76.0 5-2.24 5-5s-2.24-5-5-5z&#34;&gt;&lt;/path&gt;
&lt;/svg&gt;&lt;/a&gt;
&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;![Alt text (no caption!)](images/my-image.png &amp;quot;Text for title and tooltip&amp;quot;)
&lt;/code&gt;&lt;/pre&gt;



&lt;h3 id=&#34;code-in-html-2&#34;&gt;Code in HTML&lt;a href=&#34;#code-in-html-2&#34;&gt;&lt;svg class=&#34;anchor-symbol&#34; height=&#34;26&#34; width=&#34;26&#34; viewBox=&#34;0 0 22 22&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
&lt;path d=&#34;M0 0h24v24H0z&#34; fill=&#34;currentColor&#34;&gt;&lt;/path&gt;
&lt;path d=&#34;M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76.0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71.0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71.0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76.0 5-2.24 5-5s-2.24-5-5-5z&#34;&gt;&lt;/path&gt;
&lt;/svg&gt;&lt;/a&gt;
&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;p&amp;gt;&amp;lt;img src=&amp;quot;images/my-image.png&amp;quot; alt=&amp;quot;Alt text (no caption!)&amp;quot; title=&amp;quot;Text for title and tooltip&amp;quot;&amp;gt;&amp;lt;/p&amp;gt;
&lt;/code&gt;&lt;/pre&gt;



&lt;h3 id=&#34;css-2&#34;&gt;CSS&lt;a href=&#34;#css-2&#34;&gt;&lt;svg class=&#34;anchor-symbol&#34; height=&#34;26&#34; width=&#34;26&#34; viewBox=&#34;0 0 22 22&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
&lt;path d=&#34;M0 0h24v24H0z&#34; fill=&#34;currentColor&#34;&gt;&lt;/path&gt;
&lt;path d=&#34;M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76.0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71.0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71.0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76.0 5-2.24 5-5s-2.24-5-5-5z&#34;&gt;&lt;/path&gt;
&lt;/svg&gt;&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;The same as with the RStudio Addin window.&lt;/p&gt;



&lt;h3 id=&#34;summary-2&#34;&gt;Summary&lt;a href=&#34;#summary-2&#34;&gt;&lt;svg class=&#34;anchor-symbol&#34; height=&#34;26&#34; width=&#34;26&#34; viewBox=&#34;0 0 22 22&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
&lt;path d=&#34;M0 0h24v24H0z&#34; fill=&#34;currentColor&#34;&gt;&lt;/path&gt;
&lt;path d=&#34;M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76.0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71.0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71.0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76.0 5-2.24 5-5s-2.24-5-5-5z&#34;&gt;&lt;/path&gt;
&lt;/svg&gt;&lt;/a&gt;
&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Caption&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Format of caption&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Caption automatically numbered&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Alt&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Title&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tooltip&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Width/Height&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Link to&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ID&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Classes&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CSS style&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Other&lt;/strong&gt; (key=value): no&lt;/li&gt;
&lt;/ul&gt;



&lt;h2 id=&#34;hugo-figure-shortcut&#34;&gt;Hugo figure shortcut&lt;a href=&#34;#hugo-figure-shortcut&#34;&gt;&lt;svg class=&#34;anchor-symbol&#34; height=&#34;26&#34; width=&#34;26&#34; viewBox=&#34;0 0 22 22&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
&lt;path d=&#34;M0 0h24v24H0z&#34; fill=&#34;currentColor&#34;&gt;&lt;/path&gt;
&lt;path d=&#34;M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76.0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71.0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71.0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76.0 5-2.24 5-5s-2.24-5-5-5z&#34;&gt;&lt;/path&gt;
&lt;/svg&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Here again &amp;ndash; as in the .md file &amp;ndash; we do not need to protect the shortcode. We can insert it either via the Visual R Markdown menu &lt;code&gt;Insert -&amp;gt; Shortcode&lt;/code&gt; or write the code directly into markdown.&lt;/p&gt;



&lt;h3 id=&#34;example-3&#34;&gt;Example&lt;a href=&#34;#example-3&#34;&gt;&lt;svg class=&#34;anchor-symbol&#34; height=&#34;26&#34; width=&#34;26&#34; viewBox=&#34;0 0 22 22&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
&lt;path d=&#34;M0 0h24v24H0z&#34; fill=&#34;currentColor&#34;&gt;&lt;/path&gt;
&lt;path d=&#34;M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76.0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71.0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71.0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76.0 5-2.24 5-5s-2.24-5-5-5z&#34;&gt;&lt;/path&gt;
&lt;/svg&gt;&lt;/a&gt;
&lt;/h3&gt;














&lt;figure class=&#34;center&#34; id=&#34;figure-figure-4-my-title-text&#34;&gt;
  &lt;div class=&#34;d-flex justify-content-center&#34;&gt;
    &lt;div class=&#34;w-100&#34; &gt;
        &lt;img alt=&#34;my-alt text&#34; srcset=&#34;
               /2021/05/07/images-in-rmarkdown-files/images/my-image_huf81a7faf920bb11d47d82b059b9dc0cf_20503_1061e20606536f4413fb34665581822b.png 400w,
               /2021/05/07/images-in-rmarkdown-files/images/my-image_huf81a7faf920bb11d47d82b059b9dc0cf_20503_c4c18b47561549b1147ccf6dd152b5f0.png 760w,
               /2021/05/07/images-in-rmarkdown-files/images/my-image_huf81a7faf920bb11d47d82b059b9dc0cf_20503_1200x1200_fit_lanczos_2.png 1200w&#34;
               src=&#34;https://notes.peter-baumgartner.net/2021/05/07/images-in-rmarkdown-files/images/my-image_huf81a7faf920bb11d47d82b059b9dc0cf_20503_1061e20606536f4413fb34665581822b.png&#34;
               width=&#34;754&#34;
               height=&#34;226&#34;
               loading=&#34;lazy&#34; data-zoomable /&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;figcaption&gt;
      Figure 4: my title-text
    &lt;/figcaption&gt;&lt;/figure&gt;
&lt;p&gt;Everything I said about the features of the figure shortcode in the post &lt;a href=&#34;https://notes.peter-baumgartner.net/2021/05/05/images-from-rmd-to-html-format/#example-3&#34;&gt;Images: From R Markdown to HTML format&lt;/a&gt; applies for &lt;code&gt;.md&lt;/code&gt; and for .Rmarkdown files as well.&lt;/p&gt;



&lt;h3 id=&#34;summary-3&#34;&gt;Summary&lt;a href=&#34;#summary-3&#34;&gt;&lt;svg class=&#34;anchor-symbol&#34; height=&#34;26&#34; width=&#34;26&#34; viewBox=&#34;0 0 22 22&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
&lt;path d=&#34;M0 0h24v24H0z&#34; fill=&#34;currentColor&#34;&gt;&lt;/path&gt;
&lt;path d=&#34;M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76.0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71.0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71.0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76.0 5-2.24 5-5s-2.24-5-5-5z&#34;&gt;&lt;/path&gt;
&lt;/svg&gt;&lt;/a&gt;
&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Caption&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Format of caption&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Caption automatically numbered&lt;/strong&gt;: yes (Academic theme)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Alt&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Title&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tooltip&lt;/strong&gt;: no (zoomable)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Width/Height&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Link to&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ID&lt;/strong&gt;: yes (Academic theme)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Classes&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CSS style&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Other&lt;/strong&gt; (key=value): no&lt;/li&gt;
&lt;/ul&gt;



&lt;h2 id=&#34;results-and-conclusion&#34;&gt;Results and Conclusion&lt;a href=&#34;#results-and-conclusion&#34;&gt;&lt;svg class=&#34;anchor-symbol&#34; height=&#34;26&#34; width=&#34;26&#34; viewBox=&#34;0 0 22 22&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
&lt;path d=&#34;M0 0h24v24H0z&#34; fill=&#34;currentColor&#34;&gt;&lt;/path&gt;
&lt;path d=&#34;M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76.0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71.0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71.0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76.0 5-2.24 5-5s-2.24-5-5-5z&#34;&gt;&lt;/path&gt;
&lt;/svg&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Attribute&lt;/th&gt;
&lt;th style=&#34;text-align:center&#34;&gt;knitr&lt;/th&gt;
&lt;th style=&#34;text-align:center&#34;&gt;Addin&lt;/th&gt;
&lt;th style=&#34;text-align:center&#34;&gt;Visual&lt;/th&gt;
&lt;th style=&#34;text-align:center&#34;&gt;Hugo&lt;/th&gt;
&lt;th&gt;Remark&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Caption&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;✅&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;❌&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;❌&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;✅&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;C. format&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;❌ 1&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;❌&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;❌&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;❌ 1&lt;/td&gt;
&lt;td&gt;1) standard = bold&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;C.numbered&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;✅&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;❌&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;❌&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;✅ 2&lt;/td&gt;
&lt;td&gt;2) via &amp;lsquo;Academic&amp;rsquo; theme&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Alt&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;✅&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;❌&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;❌&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;✅&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Title&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;❌&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;❌&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;✅&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;❌&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Tooltip&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;❌&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;❌&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;✅&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;❌&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Width/Height&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;✅&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;✅&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;❌&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;✅&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Link to&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;❌&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;❌&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;✅&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;✅&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ID&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;✅ 3&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;❌&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;❌&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;✅ 4&lt;/td&gt;
&lt;td&gt;3) &lt;code&gt;fig:&amp;lt;chunk name&amp;gt;&lt;/code&gt; 4) &lt;code&gt;figure-&amp;lt;caption text&amp;gt;&lt;/code&gt; or &amp;lsquo;Academic&amp;rsquo; theme&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CSS&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;✅&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;❌&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;❌&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;✅&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Other&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;❌5&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;❌&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;❌&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;✅ 6&lt;/td&gt;
&lt;td&gt;1) via output chunk arbitrary HTML code! 4) &lt;code&gt;target&lt;/code&gt;, &lt;code&gt;rel&lt;/code&gt;, &lt;code&gt;attr&lt;/code&gt;, &lt;code&gt;attrlink&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;strong&gt;Table&lt;/strong&gt;: Features of different method of inserting images in &lt;code&gt;.Rmarkdown&lt;/code&gt; files converting to &lt;code&gt;.markdown&lt;/code&gt; using Pandoc and Hugo/Goldmark.&lt;/p&gt;
&lt;p&gt;Although both windows (Addins and Visual R Markdown windows) are not equipped with all the necessary attributes, here we have in contrast to &lt;code&gt;.md&lt;/code&gt; files also the alternative with &lt;code&gt;knitr&lt;/code&gt; chunks. So in way: &lt;code&gt;.Rmarkdown&lt;/code&gt; files are the best of both worlds! (This is also true with the Table of Contents, which works here as well.)&lt;/p&gt;
&lt;p&gt;&lt;span class=&#39;Z3988&#39; title=&#39;url_ver=Z39.88-2004&amp;amp;ctx_ver=Z39.88-2004&amp;amp;rfr_id=info%3Asid%2Fzotero.org%3A2&amp;amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Adc&amp;amp;rft.type=blogPost&amp;amp;rft.title=Images%20in%20Rmarkdown%20Files&amp;amp;rft.source=Thought%20splinters&amp;amp;rft.rights=CC%20BY-SA%204.0&amp;amp;rft.description=The%20post%20investigates%20different%20methods%20to%20include%20images%20in%20%60.Rmd%60%20files%20and%20how%20they%20are%20treated%20in%20the%20%60blogdown%60%20conversion%20process%20to%20.markdown%20files.&amp;amp;rft.identifier=https%3A%2F%2Fnotes.peter-baumgartner.net%2F2021%2F05%2F07%2Fimages-in-rmarkdown-files&amp;amp;rft.aufirst=Peter&amp;amp;rft.aulast=Baumgartner&amp;amp;rft.au=Peter%20Baumgartner&amp;amp;rft.date=2021-05-07&amp;amp;rft.language=en&#39;&gt;&lt;/span&gt;&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Images in .md Files</title>
      <link>https://notes.peter-baumgartner.net/2021/05/06/images-in-md-files/</link>
      <pubDate>Thu, 06 May 2021 00:00:00 +0000</pubDate>
      <guid>https://notes.peter-baumgartner.net/2021/05/06/images-in-md-files/</guid>
      <description>


&lt;h2 id=&#34;markdown-via-addins-insert-image&#34;&gt;Markdown via Addins &amp;lsquo;Insert Image&amp;rsquo;&lt;a href=&#34;#markdown-via-addins-insert-image&#34;&gt;&lt;svg class=&#34;anchor-symbol&#34; height=&#34;26&#34; width=&#34;26&#34; viewBox=&#34;0 0 22 22&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
&lt;path d=&#34;M0 0h24v24H0z&#34; fill=&#34;currentColor&#34;&gt;&lt;/path&gt;
&lt;path d=&#34;M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76.0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71.0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71.0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76.0 5-2.24 5-5s-2.24-5-5-5z&#34;&gt;&lt;/path&gt;
&lt;/svg&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;Using the RStudio Addin window without the width or height parameter it just generate markdown code. Is the width or height parameter included then HTML is generated but without &lt;code&gt;div.figure&lt;/code&gt; and &lt;code&gt;p.caption&lt;/code&gt; class. There is no caption visible and the CSS styling has to be done with &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; tag.&lt;/p&gt;



&lt;h3 id=&#34;example&#34;&gt;Example&lt;a href=&#34;#example&#34;&gt;&lt;svg class=&#34;anchor-symbol&#34; height=&#34;26&#34; width=&#34;26&#34; viewBox=&#34;0 0 22 22&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
&lt;path d=&#34;M0 0h24v24H0z&#34; fill=&#34;currentColor&#34;&gt;&lt;/path&gt;
&lt;path d=&#34;M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76.0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71.0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71.0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76.0 5-2.24 5-5s-2.24-5-5-5z&#34;&gt;&lt;/path&gt;
&lt;/svg&gt;&lt;/a&gt;
&lt;/h3&gt;
&lt;img src=&#34;images/my-image.png&#34; alt=&#34;Alt text&#34; width=&#34;100%&#34;/&gt;
&lt;div class=&#34;alert alert-warning&#34;&gt;
  &lt;div&gt;
    You can&amp;rsquo;t use the Addins &amp;lsquo;Insert Image&amp;rsquo; in Visual R Markdown mode because it protects the conversion by adding a backslash in front of the squared brackets: &lt;code&gt;!\[Alt text\](images/my-image.png)&lt;/code&gt;.
  &lt;/div&gt;
&lt;/div&gt;



&lt;h3 id=&#34;code-in-markdown&#34;&gt;Code in markdown&lt;a href=&#34;#code-in-markdown&#34;&gt;&lt;svg class=&#34;anchor-symbol&#34; height=&#34;26&#34; width=&#34;26&#34; viewBox=&#34;0 0 22 22&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
&lt;path d=&#34;M0 0h24v24H0z&#34; fill=&#34;currentColor&#34;&gt;&lt;/path&gt;
&lt;path d=&#34;M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76.0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71.0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71.0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76.0 5-2.24 5-5s-2.24-5-5-5z&#34;&gt;&lt;/path&gt;
&lt;/svg&gt;&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;The first line is the markdown code for images without width/height parameters. The second line has a width parameter.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;![Alt text](images/my-image.png)
&amp;lt;img src=&amp;quot;images/my-image.png&amp;quot; alt=&amp;quot;Alt text&amp;quot; width=&amp;quot;100%&amp;quot;/&amp;gt; 
&lt;/code&gt;&lt;/pre&gt;



&lt;h3 id=&#34;code-in-html&#34;&gt;Code in HTML&lt;a href=&#34;#code-in-html&#34;&gt;&lt;svg class=&#34;anchor-symbol&#34; height=&#34;26&#34; width=&#34;26&#34; viewBox=&#34;0 0 22 22&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
&lt;path d=&#34;M0 0h24v24H0z&#34; fill=&#34;currentColor&#34;&gt;&lt;/path&gt;
&lt;path d=&#34;M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76.0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71.0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71.0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76.0 5-2.24 5-5s-2.24-5-5-5z&#34;&gt;&lt;/path&gt;
&lt;/svg&gt;&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;The first line is the HTML code for images without width/height parameters. The second line has a width parameter.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;p&amp;gt;&amp;lt;img src=&amp;quot;images/my-image.png&amp;quot; alt=&amp;quot;Alt text&amp;quot;&amp;gt;&amp;lt;/p&amp;gt; 
&amp;lt;img src=&amp;quot;images/my-image.png&amp;quot; alt=&amp;quot;Alt text&amp;quot; width=&amp;quot;100%&amp;quot;&amp;gt;
&lt;/code&gt;&lt;/pre&gt;



&lt;h3 id=&#34;css&#34;&gt;CSS&lt;a href=&#34;#css&#34;&gt;&lt;svg class=&#34;anchor-symbol&#34; height=&#34;26&#34; width=&#34;26&#34; viewBox=&#34;0 0 22 22&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
&lt;path d=&#34;M0 0h24v24H0z&#34; fill=&#34;currentColor&#34;&gt;&lt;/path&gt;
&lt;path d=&#34;M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76.0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71.0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71.0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76.0 5-2.24 5-5s-2.24-5-5-5z&#34;&gt;&lt;/path&gt;
&lt;/svg&gt;&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;If the RStudio Addin window is used, then the &lt;code&gt;img&lt;/code&gt; tag should be wrapped into a paragraph. Otherwise it would be generate a conflict with other tags related with images.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&#34;language-{css}&#34;&gt;p img {
    border: 1px;
    border-style: groove;
    box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px  rgba(0, 0, 0, 0.19);
}

&lt;/code&gt;&lt;/pre&gt;



&lt;h3 id=&#34;summary&#34;&gt;Summary&lt;a href=&#34;#summary&#34;&gt;&lt;svg class=&#34;anchor-symbol&#34; height=&#34;26&#34; width=&#34;26&#34; viewBox=&#34;0 0 22 22&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
&lt;path d=&#34;M0 0h24v24H0z&#34; fill=&#34;currentColor&#34;&gt;&lt;/path&gt;
&lt;path d=&#34;M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76.0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71.0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71.0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76.0 5-2.24 5-5s-2.24-5-5-5z&#34;&gt;&lt;/path&gt;
&lt;/svg&gt;&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;So &amp;ndash; all in all &amp;ndash; the Addins window is not very useful. The only advantage is the generation of the filepath and the copy of the image in the correct folder.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Caption&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Format of caption&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Caption automatically numbered&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Alt&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Title&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tooltip&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Width/Height&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Link to&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ID&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Classes&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CSS style&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Other&lt;/strong&gt; (key=value): no&lt;/li&gt;
&lt;/ul&gt;



&lt;h2 id=&#34;visual-r-markdown-via-menu-insert-&#34;&gt;Visual R Markdown via Menu &amp;lsquo;Insert &amp;hellip;&amp;rsquo;&lt;a href=&#34;#visual-r-markdown-via-menu-insert-&#34;&gt;&lt;svg class=&#34;anchor-symbol&#34; height=&#34;26&#34; width=&#34;26&#34; viewBox=&#34;0 0 22 22&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
&lt;path d=&#34;M0 0h24v24H0z&#34; fill=&#34;currentColor&#34;&gt;&lt;/path&gt;
&lt;path d=&#34;M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76.0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71.0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71.0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76.0 5-2.24 5-5s-2.24-5-5-5z&#34;&gt;&lt;/path&gt;
&lt;/svg&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;With a &lt;code&gt;.md&lt;/code&gt; file Visual R Markdown offers only a reduced first part of the window as it is presented in an &lt;code&gt;.Rmd&lt;/code&gt; file. In contrast to the .Rmd version it lacks the fields to add width and height parameter.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;images/reduced-window-version-for-md-files-min.png&#34; alt=&#34;Window for inserting images in .md files with Visual R Markdown window with reduced number of input fields.&#34; title=&#34;text for title and tooltip&#34;&gt;&lt;/p&gt;
&lt;p&gt;But more important: There is no &lt;code&gt;caption&lt;/code&gt;! The text for the field &amp;lsquo;Caption/Alt&amp;rsquo; includes the text only for the &lt;code&gt;alt&lt;/code&gt;-attribute!&lt;/p&gt;



&lt;h3 id=&#34;example-1&#34;&gt;Example&lt;a href=&#34;#example-1&#34;&gt;&lt;svg class=&#34;anchor-symbol&#34; height=&#34;26&#34; width=&#34;26&#34; viewBox=&#34;0 0 22 22&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
&lt;path d=&#34;M0 0h24v24H0z&#34; fill=&#34;currentColor&#34;&gt;&lt;/path&gt;
&lt;path d=&#34;M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76.0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71.0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71.0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76.0 5-2.24 5-5s-2.24-5-5-5z&#34;&gt;&lt;/path&gt;
&lt;/svg&gt;&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;&lt;img src=&#34;images/my-image.png&#34; alt=&#34;Alt text (no caption!)&#34; title=&#34;Text for title and tooltip&#34;&gt;&lt;/p&gt;



&lt;h3 id=&#34;code-in-markdown-1&#34;&gt;Code in markdown&lt;a href=&#34;#code-in-markdown-1&#34;&gt;&lt;svg class=&#34;anchor-symbol&#34; height=&#34;26&#34; width=&#34;26&#34; viewBox=&#34;0 0 22 22&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
&lt;path d=&#34;M0 0h24v24H0z&#34; fill=&#34;currentColor&#34;&gt;&lt;/path&gt;
&lt;path d=&#34;M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76.0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71.0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71.0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76.0 5-2.24 5-5s-2.24-5-5-5z&#34;&gt;&lt;/path&gt;
&lt;/svg&gt;&lt;/a&gt;
&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;![Alt text (no caption!)](images/my-image.png &amp;quot;Text for title and tooltip&amp;quot;)
&lt;/code&gt;&lt;/pre&gt;



&lt;h3 id=&#34;code-in-html-1&#34;&gt;Code in HTML&lt;a href=&#34;#code-in-html-1&#34;&gt;&lt;svg class=&#34;anchor-symbol&#34; height=&#34;26&#34; width=&#34;26&#34; viewBox=&#34;0 0 22 22&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
&lt;path d=&#34;M0 0h24v24H0z&#34; fill=&#34;currentColor&#34;&gt;&lt;/path&gt;
&lt;path d=&#34;M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76.0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71.0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71.0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76.0 5-2.24 5-5s-2.24-5-5-5z&#34;&gt;&lt;/path&gt;
&lt;/svg&gt;&lt;/a&gt;
&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;p&amp;gt;&amp;lt;img src=&amp;quot;images/my-image.png&amp;quot; alt=&amp;quot;Alt text (no caption!)&amp;quot; title=&amp;quot;Text for title and tooltip&amp;quot;&amp;gt;&amp;lt;/p&amp;gt;
&lt;/code&gt;&lt;/pre&gt;



&lt;h3 id=&#34;css-1&#34;&gt;CSS&lt;a href=&#34;#css-1&#34;&gt;&lt;svg class=&#34;anchor-symbol&#34; height=&#34;26&#34; width=&#34;26&#34; viewBox=&#34;0 0 22 22&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
&lt;path d=&#34;M0 0h24v24H0z&#34; fill=&#34;currentColor&#34;&gt;&lt;/path&gt;
&lt;path d=&#34;M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76.0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71.0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71.0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76.0 5-2.24 5-5s-2.24-5-5-5z&#34;&gt;&lt;/path&gt;
&lt;/svg&gt;&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;The same as with the RStudio Addin window.&lt;/p&gt;



&lt;h3 id=&#34;summary-1&#34;&gt;Summary&lt;a href=&#34;#summary-1&#34;&gt;&lt;svg class=&#34;anchor-symbol&#34; height=&#34;26&#34; width=&#34;26&#34; viewBox=&#34;0 0 22 22&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
&lt;path d=&#34;M0 0h24v24H0z&#34; fill=&#34;currentColor&#34;&gt;&lt;/path&gt;
&lt;path d=&#34;M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76.0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71.0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71.0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76.0 5-2.24 5-5s-2.24-5-5-5z&#34;&gt;&lt;/path&gt;
&lt;/svg&gt;&lt;/a&gt;
&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Caption&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Format of caption&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Caption automatically numbered&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Alt&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Title&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tooltip&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Width/Height&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Link to&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ID&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Classes&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CSS style&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Other&lt;/strong&gt; (key=value): no&lt;/li&gt;
&lt;/ul&gt;



&lt;h2 id=&#34;hugo-figure-shortcut&#34;&gt;Hugo figure shortcut&lt;a href=&#34;#hugo-figure-shortcut&#34;&gt;&lt;svg class=&#34;anchor-symbol&#34; height=&#34;26&#34; width=&#34;26&#34; viewBox=&#34;0 0 22 22&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
&lt;path d=&#34;M0 0h24v24H0z&#34; fill=&#34;currentColor&#34;&gt;&lt;/path&gt;
&lt;path d=&#34;M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76.0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71.0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71.0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76.0 5-2.24 5-5s-2.24-5-5-5z&#34;&gt;&lt;/path&gt;
&lt;/svg&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;p&gt;In contrast to the .Rmd file we do not need to protect the shortcode. We can insert it either via the Visual R Markdown menu &lt;code&gt;Insert -&amp;gt; Shortcode&lt;/code&gt; or write the code directly into markdown.&lt;/p&gt;



&lt;h3 id=&#34;example-2&#34;&gt;Example&lt;a href=&#34;#example-2&#34;&gt;&lt;svg class=&#34;anchor-symbol&#34; height=&#34;26&#34; width=&#34;26&#34; viewBox=&#34;0 0 22 22&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
&lt;path d=&#34;M0 0h24v24H0z&#34; fill=&#34;currentColor&#34;&gt;&lt;/path&gt;
&lt;path d=&#34;M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76.0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71.0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71.0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76.0 5-2.24 5-5s-2.24-5-5-5z&#34;&gt;&lt;/path&gt;
&lt;/svg&gt;&lt;/a&gt;
&lt;/h3&gt;














&lt;figure class=&#34;center&#34; id=&#34;figure-figure-4-my-title-text&#34;&gt;
  &lt;div class=&#34;d-flex justify-content-center&#34;&gt;
    &lt;div class=&#34;w-100&#34; &gt;
        &lt;img alt=&#34;my-alt text&#34; srcset=&#34;
               /2021/05/06/images-in-md-files/images/my-image_huf81a7faf920bb11d47d82b059b9dc0cf_20503_1061e20606536f4413fb34665581822b.png 400w,
               /2021/05/06/images-in-md-files/images/my-image_huf81a7faf920bb11d47d82b059b9dc0cf_20503_c4c18b47561549b1147ccf6dd152b5f0.png 760w,
               /2021/05/06/images-in-md-files/images/my-image_huf81a7faf920bb11d47d82b059b9dc0cf_20503_1200x1200_fit_lanczos_2.png 1200w&#34;
               src=&#34;https://notes.peter-baumgartner.net/2021/05/06/images-in-md-files/images/my-image_huf81a7faf920bb11d47d82b059b9dc0cf_20503_1061e20606536f4413fb34665581822b.png&#34;
               width=&#34;754&#34;
               height=&#34;226&#34;
               loading=&#34;lazy&#34; data-zoomable /&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;figcaption&gt;
      Figure 4: my title-text
    &lt;/figcaption&gt;&lt;/figure&gt;
&lt;p&gt;Everything I said about the features of the figure shortcode in the post &lt;a href=&#34;../images-from-rmd-to-html-format/#example-3&#34;&gt;Images: From R Markdown to HTML format&lt;/a&gt; applies for &lt;code&gt;.md&lt;/code&gt; files as well.&lt;/p&gt;



&lt;h3 id=&#34;summary-2&#34;&gt;Summary&lt;a href=&#34;#summary-2&#34;&gt;&lt;svg class=&#34;anchor-symbol&#34; height=&#34;26&#34; width=&#34;26&#34; viewBox=&#34;0 0 22 22&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
&lt;path d=&#34;M0 0h24v24H0z&#34; fill=&#34;currentColor&#34;&gt;&lt;/path&gt;
&lt;path d=&#34;M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76.0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71.0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71.0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76.0 5-2.24 5-5s-2.24-5-5-5z&#34;&gt;&lt;/path&gt;
&lt;/svg&gt;&lt;/a&gt;
&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Caption&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Format of caption&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Caption automatically numbered&lt;/strong&gt;: yes (Academic theme)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Alt&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Title&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tooltip&lt;/strong&gt;: no (zoomable)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Width/Height&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Link to&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ID&lt;/strong&gt;: yes (Academic theme)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Classes&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CSS style&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Other&lt;/strong&gt; (key=value): no&lt;/li&gt;
&lt;/ul&gt;



&lt;h2 id=&#34;results-and-conclusion&#34;&gt;Results and Conclusion&lt;a href=&#34;#results-and-conclusion&#34;&gt;&lt;svg class=&#34;anchor-symbol&#34; height=&#34;26&#34; width=&#34;26&#34; viewBox=&#34;0 0 22 22&#34; xmlns=&#34;http://www.w3.org/2000/svg&#34;&gt;
&lt;path d=&#34;M0 0h24v24H0z&#34; fill=&#34;currentColor&#34;&gt;&lt;/path&gt;
&lt;path d=&#34;M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76.0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71.0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71.0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76.0 5-2.24 5-5s-2.24-5-5-5z&#34;&gt;&lt;/path&gt;
&lt;/svg&gt;&lt;/a&gt;
&lt;/h2&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Attribute&lt;/th&gt;
&lt;th style=&#34;text-align:center&#34;&gt;Addin&lt;/th&gt;
&lt;th style=&#34;text-align:center&#34;&gt;Visual&lt;/th&gt;
&lt;th style=&#34;text-align:center&#34;&gt;Hugo&lt;/th&gt;
&lt;th&gt;Remark&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Caption&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;❌&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;❌&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;✅&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;C. format&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;❌&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;❌&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;❌ 1&lt;/td&gt;
&lt;td&gt;1) standard = bold&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;C.numbered&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;❌&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;❌&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;✅ 2&lt;/td&gt;
&lt;td&gt;2) via &amp;lsquo;Academic&amp;rsquo; theme&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Alt&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;❌&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;❌&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;✅&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Title&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;❌&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;✅&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;❌&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Tooltip&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;❌&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;✅&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;❌&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Width/Height&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;✅&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;❌&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;✅&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Link to&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;❌&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;✅&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;✅&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ID&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;❌&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;❌&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;✅ 3&lt;/td&gt;
&lt;td&gt;3) &lt;code&gt;figure-&amp;lt;caption text&amp;gt;&lt;/code&gt; or &amp;lsquo;Academic&amp;rsquo; theme&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;CSS&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;❌&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;❌&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;✅&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Other&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;❌&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;❌&lt;/td&gt;
&lt;td style=&#34;text-align:center&#34;&gt;✅ 4&lt;/td&gt;
&lt;td&gt;4) &lt;code&gt;target&lt;/code&gt;, &lt;code&gt;rel&lt;/code&gt;, &lt;code&gt;attr&lt;/code&gt;, &lt;code&gt;attrlink&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;strong&gt;Table&lt;/strong&gt;: Features of different method of inserting images in &lt;code&gt;.md&lt;/code&gt; files converting with Hugo/Goldmark to HTML&lt;/p&gt;
&lt;p&gt;Only Hugo shortcode (with ID and numbered extension by the Academic theme) is the only real choice for figures equipped with all necessary attributes and nice styled.&lt;/p&gt;
&lt;p&gt;&lt;span class=&#39;Z3988&#39; title=&#39;url_ver=Z39.88-2004&amp;amp;ctx_ver=Z39.88-2004&amp;amp;rfr_id=info%3Asid%2Fzotero.org%3A2&amp;amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Adc&amp;amp;rft.type=blogPost&amp;amp;rft.title=Images%20in%20.md%20Files&amp;amp;rft.source=Thought%20splinters&amp;amp;rft.rights=CC%20BY-SA%204.0&amp;amp;rft.description=The%20post%20investigates%20different%20methods%20to%20include%20images%20in%20%60.md%60%20files%20and%20how%20they%20are%20treated%20in%20the%20Hugo/Goldmark%20conversion%20process%20to%20HTML.&amp;amp;rft.identifier=post%2F2021%2F2021-05-06-images-in-md-files%2Fimages-in-md-files&amp;amp;rft.aufirst=Peter&amp;amp;rft.aulast=Baumgartner&amp;amp;rft.au=Peter%20Baumgartner&amp;amp;rft.date=2021-05-06&amp;amp;rft.language=en&#39;&gt;&lt;/span&gt;&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Images: From R Markdown to HTML format</title>
      <link>https://notes.peter-baumgartner.net/2021/05/05/images-from-rmd-to-html-format/</link>
      <pubDate>Wed, 05 May 2021 00:00:00 +0000</pubDate>
      <guid>https://notes.peter-baumgartner.net/2021/05/05/images-from-rmd-to-html-format/</guid>
      <description>
&lt;script src=&#34;https://notes.peter-baumgartner.net/2021/05/05/images-from-rmd-to-html-format/index.en_files/header-attrs/header-attrs.js&#34;&gt;&lt;/script&gt;

&lt;div id=&#34;TOC&#34;&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#introduction&#34;&gt;Introduction&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#using-r-chunk-with-knitr&#34;&gt;Using r chunk with &lt;code&gt;knitr&lt;/code&gt;&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#example&#34;&gt;Example&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#code-in-r-chunk&#34;&gt;Code in R Chunk&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#code-in-html&#34;&gt;Code in HTML&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#css&#34;&gt;CSS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#summary&#34;&gt;Summary&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#markdown-via-addins-insert-image&#34;&gt;Markdown via Addins ‘Insert Image’&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#example-1&#34;&gt;Example&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#code-in-markdown&#34;&gt;Code in markdown&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#code-in-html-1&#34;&gt;Code in HTML&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#css-1&#34;&gt;CSS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#summary-1&#34;&gt;Summary&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#visual-r-markdown-via-menu-insert&#34;&gt;Visual R Markdown via Menu ‘Insert …’&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#example-2&#34;&gt;Example&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#code-in-markdown-1&#34;&gt;Code in markdown&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#code-in-html-2&#34;&gt;Code in HTML&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#css-2&#34;&gt;CSS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#summary-2&#34;&gt;Summary&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#hugo-figure-shortcut&#34;&gt;Hugo figure shortcut&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#example-3&#34;&gt;Example&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#code-in-html-chunk&#34;&gt;Code in HTML chunk&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#css-3&#34;&gt;CSS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#summary-3&#34;&gt;Summary&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#results-and-conclusion&#34;&gt;Results and Conclusion&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;

&lt;div id=&#34;introduction&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Introduction&lt;/h2&gt;
&lt;p&gt;This article is the first of a series of posts to investigate methods of inserting figures into different markdown formats. The resulting code depends on how images are included and the conversion tool they have to undergo. And — at least I think — also somewhat on the theme in use. In my case it is the blog widget of the &lt;code&gt;starter-academic&lt;/code&gt; theme.&lt;/p&gt;
&lt;p&gt;Here I look at the process chain from Rmd via &lt;a href=&#34;https://pandoc.org/&#34;&gt;Pandoc&lt;/a&gt; to HTML. I will inspect inserting images with the following methods:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;R chunk code via &lt;code&gt;knitr::include_graphics()&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;‘Insert Image’ window via blogdown Addins&lt;/li&gt;
&lt;li&gt;‘Image …’ window vial Visual R Markdown&lt;/li&gt;
&lt;li&gt;Hugo shortcode&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Of course, you can always include HTML instead of markdown code, but this case is not of interest here as there are no changes during the conversion process.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;using-r-chunk-with-knitr&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Using r chunk with &lt;code&gt;knitr&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;You can include external images with the &lt;a href=&#34;https://www.rdocumentation.org/packages/knitr/versions/1.33/topics/include_graphics&#34;&gt;knitr function &lt;code&gt;include_graphics()&lt;/code&gt;&lt;/a&gt;. There are &lt;a href=&#34;https://yihui.org/knitr/options/#plots&#34;&gt;many chunk options&lt;/a&gt; to specify the resulting figure, but not all are useful for external images.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use &lt;code&gt;out.width&lt;/code&gt; and &lt;code&gt;out.height&lt;/code&gt; (not &lt;code&gt;fig.width&lt;/code&gt; or &lt;code&gt;fig.height&lt;/code&gt;, they are for R-generated plots)&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;out.extra&lt;/code&gt; to add CSS styles (see for details &lt;a href=&#34;http://zevross.com/blog/2017/06/19/tips-and-tricks-for-working-with-images-and-figures-in-r-markdown-documents/#style-your-image-environment-with-css&#34;&gt;Style your image environment with CSS&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;If &lt;code&gt;fig.cap&lt;/code&gt; is provided without &lt;code&gt;fig.alt&lt;/code&gt;, it will also function as alternative text, which is usually not desired.&lt;/li&gt;
&lt;li&gt;Use &lt;a href=&#34;https://bookdown.org/yihui/rmarkdown-cookbook/output-hooks.html&#34;&gt;output hooks&lt;/a&gt; if you want even more control.&lt;/li&gt;
&lt;/ul&gt;
&lt;div id=&#34;example&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Example&lt;/h3&gt;
&lt;div class=&#34;figure&#34; style=&#34;text-align: center&#34;&gt;&lt;span id=&#34;fig:img-with-knitr&#34;&gt;&lt;/span&gt;
&lt;img src=&#34;images/my-image.png&#34; alt=&#34;Alternative text for figure 1&#34; width=&#34;50%&#34; /&gt;
&lt;p class=&#34;caption&#34;&gt;
Figure 1: Caption for figure 1
&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;&lt;div class=&#34;alert alert-warning&#34;&gt;
  &lt;div&gt;
    The &lt;code&gt;fig.align&lt;/code&gt; parameter generally works correctly, but not in this theme. It always centers to a 10 (instead 0f 12) column width. Left and right alignments do not work at all. I could not find and solve the problem.
  &lt;/div&gt;
&lt;/div&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;code-in-r-chunk&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Code in R Chunk&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;```
{r img-with-knitr, echo=FALSE, fig.align=&amp;#39;center&amp;#39;, out.width=&amp;#39;50%&amp;#39;, fig.cap=&amp;#39;Caption for figure 1&amp;#39;, fig.alt=&amp;#39;Alternative text for figure 1&amp;#39;}
knitr::include_graphics(&amp;quot;images/my-image.png&amp;quot;)
```&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;code-in-html&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Code in HTML&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;```
&amp;lt;div class=&amp;quot;figure&amp;quot; style=&amp;quot;text-align: center&amp;quot;&amp;gt;&amp;lt;span id=&amp;quot;fig:img-with-knitr&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;
    &amp;lt;img src=&amp;quot;images/my-image.png&amp;quot; alt=&amp;quot;Alternative text for figure 1&amp;quot; width=&amp;quot;50%&amp;quot;&amp;gt;
    &amp;lt;p class=&amp;quot;caption&amp;quot;&amp;gt;
        Figure 1: Caption for figure 1
    &amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;
```&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It is a stand-alone feature of &lt;code&gt;knitr&lt;/code&gt; to provide automatically generated figure numbers that you can reference via their id. The id is generated from the chunk name with the pattern &lt;code&gt;fig:&amp;lt;chunk name&amp;gt;&lt;/code&gt;. The figure 1 above can be referenced with &lt;code&gt;\@ref(fig:img-with-knitr)&lt;/code&gt;. Like this:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;For more details see Figure &lt;a href=&#34;#fig:img-with-knitr&#34;&gt;1&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;div class=&#34;alert alert-note&#34;&gt;
  &lt;div&gt;
    But in that case, you cannot use other methods to insert figures with numbers as &lt;code&gt;knitr&lt;/code&gt; will not be aware of them.
  &lt;/div&gt;
&lt;/div&gt;
&lt;/p&gt;
&lt;p&gt;The relevant selectors for CSS styles are &lt;code&gt;div.figure&lt;/code&gt; and &lt;code&gt;p.caption&lt;/code&gt;. We will see that these styles are consistent with all the other methods provided by RStudio windows. But Hugo’s figure shortcode uses the HTML tags &lt;code&gt;figure&lt;/code&gt; and &lt;code&gt;figcaption&lt;/code&gt;. In the &lt;a href=&#34;https://bookdown.org/yihui/rmarkdown-cookbook/hook-html5.html&#34;&gt;R Markdown Coobook&lt;/a&gt; is a work around expained how you can produce these Hugo HTML tags with &lt;code&gt;knitr&lt;/code&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;css&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;CSS&lt;/h3&gt;
&lt;p&gt;The CSS style I have used to display the image:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;img {
        border: 1px;
        border-style: groove;
        box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px  rgba(0, 0, 0, 0.19);
}

p.caption {
    text-align: center;
    margin-top: -0.5rem;
    margin-bottom: 0.5rem;
    font-size: smaller;
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;summary&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Summary&lt;/h3&gt;
&lt;p&gt;Using the &lt;code&gt;knitr&lt;/code&gt; function &lt;code&gt;include_graphics()&lt;/code&gt; for external images provides a rich set of image attributes (tags). It is also very flexible, especially if you are using the more complex possibilities like programming the output chunk hook.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Caption&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Format of caption&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Caption automatically numbered&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Alt&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Title&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tooltip&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Width/Height&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Link to&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ID&lt;/strong&gt;: yes (format: &#34;fig:&amp;lt;chunk name&amp;gt;)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Classes&lt;/strong&gt;: yes (with &lt;code&gt;out.extra&lt;/code&gt;, example: &lt;code&gt;out.extra=&#39;class=&#34;border shadowed&#34;&#39;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CSS style&lt;/strong&gt;: yes (with out.extra, example: &lt;code&gt;out.extra=&#39;style=&#34;background-color: #9ecff7; padding:10px; display: inline-block;&#34;&#39;&lt;/code&gt; See blog post &lt;a href=&#34;http://zevross.com/blog/2017/06/19/tips-and-tricks-for-working-with-images-and-figures-in-r-markdown-documents/&#34;&gt;Tips and tricks for working with images and figures in R Markdown documents&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Other&lt;/strong&gt; (key=value): no&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;markdown-via-addins-insert-image&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Markdown via Addins ‘Insert Image’&lt;/h2&gt;
&lt;p&gt;&lt;img src=&#34;images/adding-external-window-with-rstudio-addin-min.png&#34; /&gt;&lt;/p&gt;
&lt;p&gt;The possibilities of RStudio Addins window for &lt;code&gt;blogdown&lt;/code&gt; are sparse. But it has one big advantage: The addin helps user to provide the correct file path and copies the image to the right place.&lt;/p&gt;
&lt;p&gt;The RStudio Addins window for &lt;code&gt;blogdown&lt;/code&gt; package allows only width / height arguments and alternative text. The content of the ‘alt’-attribute is in the final HTML code converted to the caption, &lt;a href=&#34;https://blog.spotibo.com/difference-between-alt-text-and-title-text/&#34;&gt;which is not correct&lt;/a&gt;:&lt;/p&gt;
&lt;p&gt;The alternate text should describe what you can see on the image in case the image does not appear (e.g., is blocked) or the user applies a screen reader. ‘Alt’ text is also rendered by search engines. Every picture should have a corresponding ‘alt’ attribute The caption by contrast is not so important. It provides additional information and appears under the image explaining the content to reader who are able to see the picture.&lt;/p&gt;
&lt;div id=&#34;example-1&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Example&lt;/h3&gt;
&lt;div class=&#34;figure&#34;&gt;
&lt;img src=&#34;images/my-image.png&#34; style=&#34;width:100.0%&#34; alt=&#34;&#34; /&gt;
&lt;p class=&#34;caption&#34;&gt;&lt;strong&gt;Figure 2:&lt;/strong&gt; Caption for this figure 2&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;&lt;div class=&#34;alert alert-warning&#34;&gt;
  &lt;div&gt;
    You can’t use the Addins ‘Insert Image’ in Visual R Markdown mode because it protects the conversion by adding a backslash in front of the squared brackets: &lt;code&gt;![Alt text](images/my-image.png)&lt;/code&gt;.
  &lt;/div&gt;
&lt;/div&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;code-in-markdown&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Code in markdown&lt;/h3&gt;
&lt;p&gt;RStudio Addins window produces the following markdown code:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;![**Figure 2:** Caption for this figure 2](images/my-image.png){width=100%}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I think starting with the RStudio version 1.4 (January 2021) the RStudio Addin window is superseded by the the &lt;a href=&#34;https://rstudio.github.io/visual-markdown-editing/#/&#34;&gt;Visual R Markdown&lt;/a&gt; window (see &lt;a href=&#34;#visual-r-markdown-via-menu-insert&#34;&gt;next section&lt;/a&gt;). If you are turning on the visual editor you can always enhance the rudimentary markdown of the addin window with all the features of Visual R Markdown.&lt;/p&gt;
&lt;p&gt;For this improvement you need to&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;turn on Visual RStudio Markdown;&lt;/li&gt;
&lt;li&gt;select the image which markdown you want to enhance;&lt;/li&gt;
&lt;li&gt;click into the small round button with the three points to open up the dialog window;&lt;/li&gt;
&lt;li&gt;correct or add the desired content for the attributes (there is more under the “Attributes” tab);&lt;/li&gt;
&lt;li&gt;close the window;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you want to work with markdown directly you may turn off Visual RStudio Markdown.&lt;/p&gt;
&lt;div class=&#34;figure&#34;&gt;
&lt;img src=&#34;images/enhancing-markdown-with-visual-r-markdown-commented-min.png&#34; alt=&#34;&#34; /&gt;
&lt;p class=&#34;caption&#34;&gt;Screenshot of the Visual RStudio Markdown window&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;code-in-html-1&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Code in HTML&lt;/h3&gt;
&lt;p&gt;Here I am referring to the RStudio Addin without enhancement from the Visual R Markdown window.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&amp;quot;figure&amp;quot;&amp;gt;
    &amp;lt;img src=&amp;quot;images/my-image.png&amp;quot; alt=&amp;quot;&amp;quot;&amp;gt;
    &amp;lt;p class=&amp;quot;caption&amp;quot;&amp;gt;&amp;lt;strong&amp;gt;Figure 2:&amp;lt;/strong&amp;gt; Caption for this figure 1           
    &amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;As you can see: The &lt;code&gt;alt&lt;/code&gt; attribute is empty, although I have filled it out!&lt;/p&gt;
&lt;p&gt;&lt;div class=&#34;alert alert-note&#34;&gt;
  &lt;div&gt;
    If you do not provide text for the &lt;code&gt;alt&lt;/code&gt; (= capture) attributes then there is no &lt;code&gt;div.figure&lt;/code&gt; and &lt;code&gt;p.caption&lt;/code&gt; class. In this case there is only the &lt;code&gt;img&lt;/code&gt; tag as you can see with the image under the header &lt;a href=&#34;#markdown-via-addins-insert-image&#34;&gt;Markdown via Addins ‘Insert Image’&lt;/a&gt;.
  &lt;/div&gt;
&lt;/div&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;css-1&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;CSS&lt;/h3&gt;
&lt;p&gt;The conversion to HTML produced exactly the same classes as in the result with the &lt;code&gt;knitr&lt;/code&gt; image inclusion (see the &lt;a href=&#34;#css&#34;&gt;CSS code under the knitr section&lt;/a&gt;).&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;summary-1&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Summary&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Caption&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Format of caption&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Caption automatically numbered&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Alt&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Title&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tooltip&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Width/Height&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Link to&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ID&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Classes&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CSS style&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Other&lt;/strong&gt; (key=value): no&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;visual-r-markdown-via-menu-insert&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Visual R Markdown via Menu ‘Insert …’&lt;/h2&gt;
&lt;p&gt;&lt;img src=&#34;images/image-dialog-window-side-by-side-min.png&#34; /&gt;&lt;/p&gt;
&lt;p&gt;After you have turned on Visual R Markdown you can load the image window via the Menu &lt;code&gt;&#39;Insert &#39; -&amp;gt; &#39;Image…&#39;&lt;/code&gt; or shortcut ⇧⌘I. For an overview I put in the picture above both parts of the window side by side. You can see that it offers a very complete list of image attributes.&lt;/p&gt;
&lt;p&gt;&lt;div class=&#34;alert alert-warning&#34;&gt;
  &lt;div&gt;
    If you do not include text in the “Caption/Alt” field then no HTML code for the &lt;code&gt;div.figure&lt;/code&gt; and &lt;code&gt;p.caption&lt;/code&gt; classes will be produced and the appropriate CSS styles cannot be applied.
  &lt;/div&gt;
&lt;/div&gt;
&lt;/p&gt;
&lt;div id=&#34;example-2&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Example&lt;/h3&gt;
&lt;div class=&#34;figure&#34;&gt;
&lt;img src=&#34;images/my-image.png&#34; title=&#34;title text and tooltip&#34; id=&#34;figure3&#34; alt=&#34;here comes a description for blind people, screen readers and search engines&#34; alt=&#34;&#34; /&gt;
&lt;p class=&#34;caption&#34;&gt;Figure 3: Caption for this figure&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Even in this enhanced window is the wrong mixture of ‘Caption’ and ‘Alt’ attributes offered. But there is a work around with the ‘Other’-field as I have shown in the screenshot.&lt;/p&gt;
&lt;p&gt;&lt;div class=&#34;alert alert-note&#34;&gt;
  &lt;div&gt;
    Fill in the field “Caption/Alt” &lt;strong&gt;and&lt;/strong&gt; add the &lt;code&gt;alt&lt;/code&gt; attribute in the field “Others”. After the conversion to HTML the former constitutes the caption and the later the alternative text.
  &lt;/div&gt;
&lt;/div&gt;
&lt;/p&gt;
&lt;p&gt;If you click on the inserted image and call the window again, then a slightly different window appears where fields for width and height are added and can be changed. This addition appears under the image as well by just clicking on the image.&lt;/p&gt;
&lt;div class=&#34;figure&#34;&gt;
&lt;img src=&#34;images/width-height-fields-after-image-inclusion-min.png&#34; id=&#34;width-height-added&#34; alt=&#34;Width and height field added after the image was included into the .Rmd page. Left: changed window, right: after click into the inserted window.&#34; alt=&#34;&#34; /&gt;
&lt;p class=&#34;caption&#34;&gt;Width and height field added after the image was included into the .Rmd page&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;code-in-markdown-1&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Code in markdown&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;![Figure 3: Caption for this figure](images/my-image.png &amp;quot;title text and tooltip&amp;quot;){#figure3 alt=&amp;quot;here comes a description for blind people, screen readers and search engines}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In addition to the standard markdown code all the other attributes are added inside curly brackets.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;code-in-html-2&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Code in HTML&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&amp;quot;figure&amp;quot;&amp;gt;
    &amp;lt;img src=&amp;quot;images/my-image.png&amp;quot; title=&amp;quot;title text and tooltip&amp;quot; id=&amp;quot;figure3&amp;quot;
    alt=&amp;quot;here comes a description for blind people, screen readers and search engines&amp;quot;&amp;gt;
    &amp;lt;p class=&amp;quot;caption&amp;quot;&amp;gt;
        Figure 3: Caption for this figure
    &amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;css-2&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;CSS&lt;/h3&gt;
&lt;p&gt;The conversion to HTML produced exactly the same classes as in the result with the other two methods &lt;a href=&#34;#css&#34;&gt;&lt;code&gt;knitr&lt;/code&gt; image inclusion&lt;/a&gt; and &lt;a href=&#34;#css-1&#34;&gt;Addins ‘Insert Image’&lt;/a&gt;).&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;summary-2&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Summary&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Caption&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Format of caption&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Caption automatically numbered&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Alt&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Title&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tooltip&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Width/Height&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Link to&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ID&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Classes&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CSS style&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Other&lt;/strong&gt; (key=value): yes&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;hugo-figure-shortcut&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Hugo figure shortcut&lt;/h2&gt;
&lt;blockquote&gt;
&lt;p&gt;You cannot simply write {{&amp;lt; shortcode &amp;gt;}} in R Markdown, because Pandoc is not aware of Hugo shortcodes, and may convert special characters so that Hugo can no longer recognize the shortcodes (e.g. &amp;lt; will be converted to &amp;lt;).&lt;a href=&#34;#fn1&#34; class=&#34;footnote-ref&#34; id=&#34;fnref1&#34;&gt;&lt;sup&gt;1&lt;/sup&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;With &lt;a href=&#34;https://gohugo.io/getting-started/configuration-markup/#blackfriday&#34;&gt;Blackfriday&lt;/a&gt; as default Markdown rendering engine I used to use for shortcodes the &lt;code&gt;blogdown::shortcode()&lt;/code&gt; function. But after Hugo v0.60 the default Markdown rendering engine changed to &lt;a href=&#34;https://gohugo.io/getting-started/configuration-markup/#goldmark&#34;&gt;Goldmark&lt;/a&gt;. In the above quoted man page for the shortcode() function there is a also special note on this issue:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Since Hugo v0.60, Hugo has switched its default Markdown rendering engine to Goldmark. One consequence is that shortcodes may fail to render. You may enable the unsafe option in the configuration file: &lt;a href=&#34;https://gohugo.io/getting-started/configuration-markup/#goldmark&#34; class=&#34;uri&#34;&gt;https://gohugo.io/getting-started/configuration-markup/#goldmark&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I couldn’t understand this remark as for me all the Hugo shortcodes works well. But to apply it more easily I use pure HTML code chunks to prevent a conversion by Pandoc. This has the advantage that I can include Hugo’s shortcode syntax without any changes.&lt;/p&gt;
&lt;div id=&#34;example-3&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Example&lt;/h3&gt;














&lt;figure  id=&#34;figure-shortcut-figure&#34;&gt;
  &lt;div class=&#34;d-flex justify-content-center&#34;&gt;
    &lt;div class=&#34;w-100&#34; &gt;
        &lt;img alt=&#34;My alt text&#34; srcset=&#34;
               /2021/05/05/images-from-rmd-to-html-format/images/my-image_huf81a7faf920bb11d47d82b059b9dc0cf_20503_1061e20606536f4413fb34665581822b.png 400w,
               /2021/05/05/images-from-rmd-to-html-format/images/my-image_huf81a7faf920bb11d47d82b059b9dc0cf_20503_c4c18b47561549b1147ccf6dd152b5f0.png 760w,
               /2021/05/05/images-from-rmd-to-html-format/images/my-image_huf81a7faf920bb11d47d82b059b9dc0cf_20503_1200x1200_fit_lanczos_2.png 1200w&#34;
               src=&#34;https://notes.peter-baumgartner.net/2021/05/05/images-from-rmd-to-html-format/images/my-image_huf81a7faf920bb11d47d82b059b9dc0cf_20503_1061e20606536f4413fb34665581822b.png&#34;
               width=&#34;754&#34;
               height=&#34;226&#34;
               loading=&#34;lazy&#34; data-zoomable /&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;figcaption data-pre=&#34;Figure&amp;nbsp;&#34; data-post=&#34;:&amp;nbsp;&#34; class=&#34;numbered&#34;&gt;
      My caption text
    &lt;/figcaption&gt;&lt;/figure&gt;
&lt;/div&gt;
&lt;div id=&#34;code-in-html-chunk&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Code in HTML chunk&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;```{=html}
{{&amp;lt; figure src=&amp;quot;images/my-image.png&amp;quot; class=&amp;quot;center&amp;quot; alt=&amp;quot;My alt text&amp;quot; caption=&amp;quot;My title text&amp;quot; id=&amp;quot;shortcut-figure&amp;quot; numbered=&amp;quot;true&amp;quot; &amp;gt;}}
```&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;id&lt;/code&gt; and &lt;code&gt;numbered&lt;/code&gt; attributes are not provided by but they are a &lt;a href=&#34;https://wowchemy.com/docs/content/writing-markdown-latex/#single-image&#34;&gt;feature from the academic theme&lt;/a&gt;.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;If you do not use &lt;code&gt;id&lt;/code&gt; explicitly then Hugo generates an ID with the “figure-” followed by the caption text (e.g., &lt;code&gt;id=&#34;figure-my-caption-text&#34;&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;You can see that the numbering systems starts from scratch, e.g., it does not account for the &lt;code&gt;knitr&lt;/code&gt; chunks. The same is true vice versa.&lt;/li&gt;
&lt;li&gt;Besides the already mentioned attributes Hugo also features &lt;code&gt;target&lt;/code&gt;, &lt;code&gt;rel&lt;/code&gt; and attribution (&lt;code&gt;attr&lt;/code&gt; = text; &lt;code&gt;attrlink&lt;/code&gt; = link).&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div id=&#34;css-3&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;CSS&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;```{=html}
&amp;lt;figure id=&amp;quot;figure-shortcut-figure&amp;quot;&amp;gt;
  &amp;lt;div class=&amp;quot;d-flex justify-content-center&amp;quot;&amp;gt;
    &amp;lt;div class=&amp;quot;w-100&amp;quot;&amp;gt;
        &amp;lt;img alt=&amp;quot;My alt text&amp;quot; srcset=&amp;quot;
               /post/images-from-rmd-to-html-format/images/my-image_huf81a7faf920bb11d47d82b059b9dc0cf_20503_1061e20606536f4413fb34665581822b.png 400w,
               /post/images-from-rmd-to-html-format/images/my-image_huf81a7faf920bb11d47d82b059b9dc0cf_20503_c4c18b47561549b1147ccf6dd152b5f0.png 760w,
               /post/images-from-rmd-to-html-format/images/my-image_huf81a7faf920bb11d47d82b059b9dc0cf_20503_1200x1200_fit_lanczos_2.png 1200w&amp;quot; src=&amp;quot;/post/images-from-rmd-to-html-format/images/my-image_huf81a7faf920bb11d47d82b059b9dc0cf_20503_1061e20606536f4413fb34665581822b.png&amp;quot; width=&amp;quot;754&amp;quot; height=&amp;quot;226&amp;quot; loading=&amp;quot;lazy&amp;quot; data-zoomable=&amp;quot;&amp;quot; class=&amp;quot;medium-zoom-image&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;
  &amp;lt;figcaption data-pre=&amp;quot;Figure&amp;amp;nbsp;&amp;quot; data-post=&amp;quot;:&amp;amp;nbsp;&amp;quot; class=&amp;quot;numbered&amp;quot;&amp;gt;
      My caption text
  &amp;lt;/figcaption&amp;gt;
&amp;lt;/figure&amp;gt;

```&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The produced HTML is pretty complex, but here we are just interested in the two relevant tags for CSS styling: &lt;code&gt;&amp;lt;figure&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;figcaption&amp;gt;&lt;/code&gt;. These two HTML tag are different to the code produced by other methods of inserting images. So maybe it would be a good idea to style both variants the same way.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;summary-3&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Summary&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Caption&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Format of caption&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Caption automatically numbered&lt;/strong&gt;: yes (Academic theme)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Alt&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Title&lt;/strong&gt;: no&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tooltip&lt;/strong&gt;: no (zoomable)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Width/Height&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Link to&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ID&lt;/strong&gt;: yes (Academic theme)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Classes&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CSS style&lt;/strong&gt;: yes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Other&lt;/strong&gt; (key=value): no&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;results-and-conclusion&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Results and Conclusion&lt;/h2&gt;
&lt;table&gt;
&lt;caption&gt;Table: Features of different method of inserting images in Rmd files converting to HTML&lt;/caption&gt;
&lt;colgroup&gt;
&lt;col width=&#34;15%&#34; /&gt;
&lt;col width=&#34;8%&#34; /&gt;
&lt;col width=&#34;8%&#34; /&gt;
&lt;col width=&#34;9%&#34; /&gt;
&lt;col width=&#34;8%&#34; /&gt;
&lt;col width=&#34;51%&#34; /&gt;
&lt;/colgroup&gt;
&lt;thead&gt;
&lt;tr class=&#34;header&#34;&gt;
&lt;th&gt;Attribute&lt;/th&gt;
&lt;th align=&#34;center&#34;&gt;knitr&lt;/th&gt;
&lt;th align=&#34;center&#34;&gt;Addin&lt;/th&gt;
&lt;th align=&#34;center&#34;&gt;Visual&lt;/th&gt;
&lt;th align=&#34;center&#34;&gt;Hugo&lt;/th&gt;
&lt;th&gt;Remark&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td&gt;Caption&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;✅&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;✅&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;✅&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;✅&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td&gt;C. format&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;❌ &lt;sup&gt;2&lt;/sup&gt;&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;✅&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;❌&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;❌ &lt;sup&gt;2&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;&lt;sup&gt;2&lt;/sup&gt; standard = bold&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td&gt;C.numbered&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;✅&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;❌&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;❌&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;✅ &lt;sup&gt;3&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;&lt;sup&gt;3&lt;/sup&gt; via ‘Academic’ theme&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td&gt;Alt&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;✅&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;❌&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;✅ &lt;sup&gt;4&lt;/sup&gt;&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;✅&lt;/td&gt;
&lt;td&gt;&lt;sup&gt;4&lt;/sup&gt; via ‘Other’-field&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td&gt;Title&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;❌&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;❌&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;✅&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;❌&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td&gt;Tooltip&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;❌&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;❌&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;✅&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;❌&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td&gt;Width/Height&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;✅&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;✅&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;✅&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;✅&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td&gt;Link to&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;❌&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;❌&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;✅&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;✅&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td&gt;ID&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;✅ &lt;sup&gt;5&lt;/sup&gt;&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;❌&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;✅&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;✅ &lt;sup&gt;6&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;&lt;sup&gt;5&lt;/sup&gt; &lt;code&gt;fig:&amp;lt;chunk name&amp;gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;sup&gt;6&lt;/sup&gt; &lt;code&gt;figure-&amp;lt;caption text&amp;gt;&lt;/code&gt; or ‘Academic’ theme&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td&gt;CSS&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;✅&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;❌&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;✅&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;✅&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td&gt;Other&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;❌&lt;sup&gt;1&lt;/sup&gt;&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;❌&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;✅ &lt;sup&gt;7&lt;/sup&gt;&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;✅ &lt;sup&gt;8&lt;/sup&gt;&lt;/td&gt;
&lt;td&gt;&lt;p&gt;&lt;sup&gt;1&lt;/sup&gt;via output chunk arbitrary HTML code!&lt;/p&gt;
&lt;p&gt;&lt;sup&gt;7&lt;/sup&gt; free choice!&lt;/p&gt;
&lt;p&gt;&lt;sup&gt;8&lt;/sup&gt; &lt;code&gt;target&lt;/code&gt;, &lt;code&gt;rel&lt;/code&gt;, &lt;code&gt;attr&lt;/code&gt;, &lt;code&gt;attrlink&lt;/code&gt;&lt;/p&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;If we take into account that code produced by the RStudio Addin window can be improved at any time with the Visual R Markdown window then all the four offered methods are pretty similar. But keep in mind that advantages on the one hand are often counter acted by disadvantages on other areas. So — for instance — provides the conversion via Pandoc many advantages but looses also some features of Hugo or the applied theme.&lt;/p&gt;
&lt;p&gt;To sum up this this little investigation I see three patterns of decisions criteria:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;One big difference is the possibility to number the figures automatically. The Addin and Visual R Markdown windows do not provide this feature.&lt;/li&gt;
&lt;li&gt;On the other hand filling in the window fields is — especially for people who are not so comfortable with HTML or Markdown code — easier.&lt;/li&gt;
&lt;li&gt;Another decision criteria could be consistency: If you are using R chunks (which is the major reason to use the .Rmd format!) and want to be consistent throughout the file, then the decision for the &lt;code&gt;knitr&lt;/code&gt; method is obvious.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;But let’s see what the other file format are producing. For people using different methods&lt;a href=&#34;#fn2&#34; class=&#34;footnote-ref&#34; id=&#34;fnref2&#34;&gt;&lt;sup&gt;2&lt;/sup&gt;&lt;/a&gt; for their posts perhaps the comparison inside one file format is not sufficient. Perhaps there is a method not ideal when considered only one file format but has a higher consistency when looked all file format together.&lt;/p&gt;
&lt;span class=&#39;Z3988&#39; title=&#39;url_ver=Z39.88-2004&amp;amp;ctx_ver=Z39.88-2004&amp;amp;rfr_id=info%3Asid%2Fzotero.org%3A2&amp;amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Adc&amp;amp;rft.type=blogPost&amp;amp;rft.title=Images:%20From%20R%20Markdown%20to%20HTML%20format&amp;amp;rft.source=Thought%20splinters&amp;amp;rft.rights=CC%20BY-SA%204.0&amp;amp;rft.description=The%20post%20investigates%20different%20methods%20to%20include%20images%20in%20%60.Rmd%60%20files%20and%20how%20they%20are%20treated%20in%20the%20%60blogdown%60%20conversion%20process%20to%20HTML.&amp;amp;rft.identifier=https%3A%2F%2Fnotes.peter-baumgartner.net%2F2021%2F05%2F05%2Fimages-from-rmd-to-html-format&amp;amp;rft.aufirst=Peter&amp;amp;rft.aulast=Baumgartner&amp;amp;rft.au=Peter%20Baumgartner&amp;amp;rft.date=2021-05-05&amp;amp;rft.language=en&#39;&gt;&lt;/span&gt; 
&lt;/div&gt;
&lt;div class=&#34;footnotes&#34;&gt;
&lt;hr /&gt;
&lt;ol&gt;
&lt;li id=&#34;fn1&#34;&gt;&lt;p&gt;Helper functions to write Hugo shortcodes using the R syntax&lt;a href=&#34;#fnref1&#34; class=&#34;footnote-back&#34;&gt;↩︎&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li id=&#34;fn2&#34;&gt;&lt;p&gt;As with blogdown version 1.3 not all files are automatically rendered, one could choose a different file and conversion format for every post separately. This requires (1) deleting those files produced by the conversion process in the folder of the post under consideration (2) renaming the file ending of the main file and kniting/rendering the new file format again.&lt;a href=&#34;#fnref2&#34; class=&#34;footnote-back&#34;&gt;↩︎&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
</description>
    </item>
    
  </channel>
</rss>
