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)"""

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.