Skip to content
kd
18 Feb 2022
Back to blog

Using Tikz with Pandoc

1 min read (43 words)

This is a demo of integrating Tikz as part of the blog.

\begin{tikzpicture}
\def \n {5}
\def \radius {3cm}
\def \margin {8} % margin in angles, depends on the radius
\foreach \s in {1,...,\n}
{
\node[draw, circle] at ({360/\n * (\s - 1)}:\radius) {$\s$};
\draw[->, >=latex] ({360/\n * (\s - 1)+\margin}:\radius)
arc ({360/\n * (\s - 1)+\margin}:{360/\n * (\s)-\margin}:\radius);
}
\end{tikzpicture}
Code
using Markdown
using TikzPictures
tp = TikzPicture(L"""
\def \n {5}
\def \radius {3cm}
\def \margin {8} % margin in angles, depends on the radius
\foreach \s in {1,...,\n}
{
\node[draw, circle] at ({360/\n * (\s - 1)}:\radius) {$\s$};
\draw[->, >=latex] ({360/\n * (\s - 1)+\margin}:\radius)
arc ({360/\n * (\s - 1)+\margin}:{360/\n * (\s)-\margin}:\radius);
}
""")
save(SVG("test"), tp)
md"""![](./test.svg)"""
[ Info: Precompiling TikzPictures [37f6aa50-8035-52d0-81c2-5a1d08754b2d]
[ Info: Precompiling Poppler_jll [9c32591e-4766-534b-9725-b71a8799265b]
┌ Warning: test.svg already exists, overwriting!
└ @ TikzPictures ~/.julia/packages/TikzPictures/9WzZq/src/TikzPictures.jl:432


Citation

@online{krishnamurthy2022usingtikzwithpandoc,
  author = {Dheepak Krishnamurthy},
  title = {Using Tikz with Pandoc},
  year = {2022},
  date = {2022-02-18},
  url = {https://kdheepak.com/blog/using-tikz-with-pandoc/},
  langid = {en},
}

For attribution, please cite this work as:

Dheepak Krishnamurthy, "Using Tikz with Pandoc", February 18, 2022 https://kdheepak.com/blog/using-tikz-with-pandoc/


Sveltekit tailwind starter
Using MermaidJS with Pandoc