[NTG-context] externalizing TikZ graphics

Hans Hagen j.hagen at xs4all.nl
Mon Jan 25 17:31:17 CET 2021

On 1/25/2021 4:42 PM, Henning Hraban Ramm wrote:
> Hi,
> did anyone succeed in externalizing TikZ graphics with ConTeXt?
> It’s about a project with hundreds of diagrams that (in the current state) clutter the main directory with cryptically-named PDFs (at least sorted by component name) and that on each ConTeXt run take a lot of runtime (I guess also the many log lines slow the process).
> In 2013, Aditya said it wasn’t possible to externalize pgf/TikZ graphics as documented in the pgf manual, and "perhaps" it would make sense to use his filter module:
> https://mailman.ntg.nl/pipermail/ntg-context/2013/071162.html
> Did anyone try to do that? I didn’t find anything in this list’s archives.
> The original pgf way is two-pass, and you’d need to call LaTeX with the intended graphics name as --jobname; that’s far too much of a hassle for that many graphics.
> I generally like how the filter module works, as you can also define the name of every buffer, but my only experience with that is my LilyPond setup.
> If nobody has better advice, I’ll try to come up with a filter setup. That would mean we’d avoid the tikz module, every TikZ diagram will get written to a buffer of configurable name, and that (with preamble setup) will get run through LaTeX. I read pgf had some restrictions in plain TeX mode, but perhaps we can also use LuaTeX in plain mode to avoid the LaTeX dependency.
In the following case the buffer only gets typeset when it changes:


     % maybe include a style / enviroment
     \usemodule[tikz] \usetikzlibrary[patterns]
            \draw[pattern color=red,pattern=bricks] (0,0) circle (1cm);




                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl

More information about the ntg-context mailing list