<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Latex on Janik von Rotz</title>
    <link>https://janikvonrotz.ch/tags/latex/</link>
    <description>Recent content in Latex on Janik von Rotz</description>
    <generator>Hugo</generator>
    <language>en</language>
    <lastBuildDate>Thu, 12 Nov 2020 18:38:44 +0100</lastBuildDate>
    <atom:link href="https://janikvonrotz.ch/tags/latex/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Render PDF from Markdown that is using mermaid</title>
      <link>https://janikvonrotz.ch/2020/11/12/render-pdf-from-markdown-that-is-using-mermaid/</link>
      <pubDate>Thu, 12 Nov 2020 18:38:44 +0100</pubDate>
      <guid>https://janikvonrotz.ch/2020/11/12/render-pdf-from-markdown-that-is-using-mermaid/</guid>
      <description>&lt;p&gt;Mermaid and Markdown is widely supported match. With mermaid you can describe diagrams and get them rendered next to your Markdown text. It is kind of a markdown flavor, but not supported by all Markdown processors. Use this guide to get result as described in the title.&lt;/p&gt;&#xA;&lt;p&gt;You will need:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://pandoc.org/installing.html&#34;&gt;Pandoc&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;brew install pandoc&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://linux.die.net/man/1/pdflatex&#34;&gt;pdflatex&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;brew cask install basictex&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://github.com/raghur/mermaid-filter&#34;&gt;pandoc mermaid-filter&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;npm i -g mermaid-filter&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;After everything installed (assume that &lt;code&gt;pandoc&lt;/code&gt; and &lt;code&gt;mermaid-filter&lt;/code&gt; are&#xA;available in your &lt;code&gt;echo $PATH&lt;/code&gt;)&lt;/p&gt;&#xA;&lt;h2 id=&#34;example&#34;&gt;Example&lt;/h2&gt;&#xA;&lt;p&gt;This document itself is written in markdown. Access the source and save it as &lt;code&gt;mermaid-pandoc-guide.md&lt;/code&gt; then use pandoc and the filter to create a PDF.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-zsh&#34; data-lang=&#34;zsh&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;pandoc mermaid-pandoc-guide.md -o mermaid-pandoc-guide.pdf --toc -V papersize:a4 --highlight-style pygments -N -V geometry:&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;top=2cm, bottom=1.5cm, left=2cm, right=2cm&amp;#34;&lt;/span&gt; -V toc-title:&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;Inhaltsverzeichnis&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This mermaid graph must be rendered properly:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-mermaid&#34; data-lang=&#34;mermaid&#34;&gt;graph TD;&#xA;    A--&amp;gt;B;&#xA;    A--&amp;gt;C;&#xA;    B--&amp;gt;D;&#xA;    C&#xA;&lt;/code&gt;&lt;/pre&gt;</description>
    </item>
  </channel>
</rss>
