pandoc-ext / diagram

Generate diagrams from embedded code; supports Mermaid, Dot/GraphViz, PlantUML, Asymptote, and TikZ.
MIT License
53 stars 9 forks source link

tikz latex template should use standalone option [tikz] for marginless tikz diagrams #15

Closed PeterSommerlad closed 2 months ago

PeterSommerlad commented 4 months ago

As of today the standalone document template for tikz diagrams looks like:

local tikz_template = pandoc.template.compile [[
\documentclass{standalone}
\usepackage{tikz}
$for(header-includes)$
$it$
$endfor$
$additional-packages$
\begin{document}
$body$
\end{document}
]]

this way all images get a left-hand border, even when cropped.

However, the latex package standalone has a dedicated [tikz] option that gives much cleaner results and renders images without a left-hand border. So the above template should be replaced with

--- LaTeX template used to compile TikZ images. Takes additional
--- packages as the first, and the actual TikZ code as the second
--- argument.
local tikz_template = pandoc.template.compile [[
\documentclass[tikz]{standalone}
$for(header-includes)$
$it$
$endfor$
$additional-packages$
\begin{document}
$body$
\end{document}
]]
PeterSommerlad commented 4 months ago

see pull request #16

tarleb commented 2 months ago

Fixed via PR #16.