pandoc-ext / diagram

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

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

Closed PeterSommerlad closed 6 months ago

PeterSommerlad commented 8 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 8 months ago

see pull request #16

tarleb commented 6 months ago

Fixed via PR #16.