Using Tikz with Pandoc

Author

Dheepak Krishnamurthy

Published

February 19, 2022

Keywords

tikz, latex, pandoc, lua, filter

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

Reuse

Citation

BibTeX citation:
@online{krishnamurthy2022,
  author = {Krishnamurthy, Dheepak},
  title = {Using {Tikz} with {Pandoc}},
  date = {2022-02-19},
  url = {https://kdheepak.com/blog/using-tikz-with-pandoc/},
  langid = {en}
}
For attribution, please cite this work as:
D. Krishnamurthy, “Using Tikz with Pandoc,” Feb. 19, 2022. https://kdheepak.com/blog/using-tikz-with-pandoc/.