Ditching Compile-and-Pray: The Rise of Two-Way TikZ Editors
A new open-source editor brings true two-way visual editing to LaTeX's most powerful and frustrating diagramming tool.
If you have ever spent forty minutes trying to align a curved arrow with a node in a LaTeX document, you already know the unique frustration of TikZ. Writing TikZ is basically programming graphics in assembly. You write some coordinate math, hit compile, wait for the PDF engine to chug along, and discover your arrow is pointing directly into a node's label. So you nudge the x-coordinate by 0.15, compile again, and repeat the loop until you want to throw your laptop out the window.
While online LaTeX editors like Overleaf have made document collaboration simple, they have done nothing to solve the compile-and-pray feedback loop of figure creation. Developers and researchers are left choosing between writing raw coordinate code by hand or using external drawing tools that spit out unmaintainable, machine-generated TeX files.
The launch of Dominik Peters' open-source TikZ Editor, currently hosted on GitHub, represents a genuine shift in how we can author LaTeX figures. By implementing a parser that reads and writes clean TikZ code in real time, it bridges the gap between raw code control and visual intuition.
The Limits of One-Way Generators and Graph Editors
To understand why a two-way parser is such a big deal, we have to look at the existing state of TikZ tooling. Historically, developers have had three bad options for creating diagrams:
- One-Way Code Generators: Tools like TikzMaker allow you to draw diagrams or circuits visually and export the code. The problem is that the generated code is often a bloated mess of absolute coordinates. If you need to make a minor text change or adjust a layout later, you cannot easily do it in the code without breaking the visual structure. Importing that code back into the editor is usually impossible.
- Graph-Specific Editors: TikZiT is a great tool for drawing graphs and string diagrams, but it is highly specialized. It relies on its own
.tikzstylesfiles and a custom LaTeX style sheet (tikzit.sty). It does not work as a general-purpose editor for the arbitrary shapes, trees, and matrices that populate most technical papers. - Static Previewers: Lean web tools, such as the pickedshares online editor, use libraries like Tikzjax to render previews in the browser. While this speeds up the compilation loop, it is still a one-way street. You are still writing raw code and clicking a "Show" button to see the result. You do not get a visual canvas where you can drag elements around.
The new TikZ Editor takes a different approach. It does not just generate code; it parses your existing TikZ code, builds a visual representation, and updates the code dynamically as you drag elements on the canvas. If you make a change in the code editor, the visual canvas updates instantly. If you drag a node on the canvas, the code updates without destroying your hand-written formatting, line breaks, or spaces.
Under the Hood: The Two-Way Sync Breakthrough
Parsing TikZ is notoriously difficult because TikZ is not just a markup language; it is a programming language executed by TeX. It supports loops, math operations, and complex relative positioning. Building a parser that can read this code, map it to a visual canvas, and write it back without losing the user's original formatting is a massive engineering challenge.
The codebase of the new TikZ Editor, written primarily in TypeScript (91.2%) with a small Rust footprint (1.5%), manages this by supporting a wide array of native TikZ constructs. It handles more than 25 built-in shapes, Bézier curves with control points, matrices, and tree layouts.
Most impressively, it supports \foreach loops. If you have a loop generating a grid of nodes, the editor can parse and display them. You can also use number scrubbing in the live source editor to slide values up and down and watch the visual elements scale in real time.
Here is an example of the kind of clean, structured code the editor can parse and maintain:
\begin{tikzpicture}[node distance=1.5cm and 1cm]
\node (text1) [xshift=3cm] {How is it done?};
\node (pro1) [process, below of=text1, xshift=-1cm] {Output};
\node (pro2) [process, below of=text1, xshift=3cm] {Main function};
\draw [thick, ->] (pro1) -- (pro2);
\end{tikzpicture}
If you drag pro1 on the visual canvas, the editor updates the xshift or coordinate values in the code while preserving your indentation and style definitions. This means you can open an existing paper's .tex file, tweak a figure visually, and save it back to your git repository without creating a diff that looks like a bomb went off in your codebase.
Practical Adoption: Workflows and Trade-offs
For working developers, the TikZ Editor is available both as a web application and as a lightweight desktop app for macOS, Windows, and Linux. The desktop version includes native file dialogs, system clipboard integration, and an AI assistant to help write complex TikZ code.
If you want to adopt this in your workflow, the typical path looks like this:
- For New Diagrams: Start in the visual editor. Use the toolbar to drop shapes, draw paths, and set up your layout. The editor will generate clean, human-readable TikZ code that you can copy directly into your LaTeX document.
- For Existing Diagrams: Copy the
\begin{tikzpicture}block from your LaTeX source, paste it into the editor's code view, make your visual adjustments on the canvas, and paste the updated code back. - For External Assets: The editor supports importing SVG, IPE, and PPTX files, which makes it easier to migrate legacy assets into native LaTeX vectors.
However, there are some clear trade-offs to keep in mind. Because TikZ is so vast, the editor only has partial support for advanced features like decorations, graphs, and mathematical plots. Complex coordinate math using let operations is not yet supported. If your diagrams rely heavily on these advanced programmatic features, the parser may fail to render them correctly, or it may strip them out when saving.
The Verdict
Dominik Peters' TikZ Editor is not just another one-way drawing tool. By focusing on two-way parsing and code preservation, it solves the actual pain point of LaTeX figure authoring: the disconnect between code and visual feedback.
It is not a complete replacement for the raw power of the TeX engine, and power users writing highly programmatic, math-heavy TikZ will still hit the limits of the parser. But for the 90% of developers who just need to draw clear flowcharts, architecture diagrams, trees, and block diagrams without losing their minds in coordinate math, this tool is production-ready and highly recommended. It is a massive quality-of-life upgrade that respects your code while saving your sanity.
Sources & further reading
- Show HN: TikZ Editor – WYSIWYG editor for figures in LaTeX — tikz.dev
- Tikz online editor • pickedshares Engineering Tools — pickedshares.com
- GitHub - DominikPeters/tikz-editor: A WYSIWYG editor for TikZ that parses TikZ code · GitHub — github.com
- TikZiT — tikzit.github.io
Lenn writes about cloud platforms, Kubernetes internals, and the infrastructure decisions that quietly make or break engineering organizations. Based in Berlin's vibrant tech scene, they have a talent for turning dense platform-engineering topics into prose that people actually finish reading.
Discussion 2
where are the tests for this editor?
i feel you, tikz can be a real yaml-like pain - all that tweaking and recompiling, so a two-way editor sounds like a total game changer for latex diagrams