Top
Best
New

Posted by DominikPeters 10 hours ago

Show HN: TikZ Editor – WYSIWYG editor for figures in LaTeX(tikz.dev)
Hi all! TikZ is a widely-used LaTeX package for drawing figures in papers. It uses commands like \draw[->] (0,0) -- (1,2); to draw lines, shapes, text, etc. Academics usually code up their figures by hand, so there is lots of twiddling around with the coordinates and recompiling until things look nice. I guess it’s a bit like SVG, but it’s more code than markup, for example it has loops with \foreach.

I built an open-source WYSIWYG TikZ editor (available for web and desktop) that allows you to edit your TikZ source code visually by dragging and resizing elements. It simultaneously shows the source code and the rendered figure, and lets you edit either one while the two views stay in sync. I’m not aware of any other editors that are simultaneously source editors and WYSIWYG (even for editing SVG or HTML), and I’m quite pleased with how well the combination works.

The way the app is implemented is by parsing the TikZ code, and at all times keeping track of the exact source location of each object. Thereby, when a user drags an element to a new position, the app can override just the numbers in the coordinate without changing anything else in the code (such as line breaks or indentation).

This approach essentially required reimplementing a large fraction of TikZ, which is the kind of task that no human would ever want to do. I think building software that doesn’t exist yet because it would be impossibly tedious to code up is one of the great new possibilities thanks to coding agents, and it’s worth brainstorming for other examples. (This app was built almost entirely by Codex.)

Implementing the app came with lots of fun side quests, including building converters from SVG / pptx / ipe to TikZ, re-implementing the LaTeX hyphenation and line-breaking algorithm to support multi-line nodes, and making a color picker that uses the red!20!black color mixing notation used in LaTeX papers.

292 points | 58 commentspage 2
pixlmint 4 hours ago|
This is cool, I vibecoded something similar for a school project, but this looks much more mature, thanks for sharing!
Littice 9 hours ago||
The killer feature for me is not drawing TikZ visually, but being able to touch old TikZ without turning the source into generated-looking soup.
DominikPeters 9 hours ago|
Exactly, I wanted to avoid that. In contrast, if you open an SVG in (for example) Inkscape and make a minimal change and save, the resulting file has little to do with the original.
delta_p_delta_x 9 hours ago||
This is superb. Will you consider adding support for pgfplots[1]? When I was a student I was long considering writing a native application for real-time TikZing.

[1]: https://ctan.org/pkg/pgfplots?lang=en

DominikPeters 8 hours ago|
I think pgfplots should in principle be possible. I've postponed it thus far because pgfplots is GPL licensed, while the editor is MIT licensed, so I would need to distribute pgfplots support as a separate add-on. But in due course, putting in add-on infrastructure could make sense, because it would also allow adding support for stuff like tikzcd and CircuiTikZ (or tikzpingus!).
whatever1 9 hours ago||
OMG! Psychiatrists are going to lose all of their graduate customers!

The world thanks you.

wjholden 6 hours ago||
Oh man, good on you identifying a product that needs to exist. I've used a few TikZ editors (both online and desktop) and none of them are just amazing.

But, I've taken my papers to Typst. Could you have the agent do the same thing for Cetz, the TikZ equivalent for Typst?

tombert 5 hours ago||
Tangential, but how has the publishing process been for Typst?

I'm looking to write a paper on a recent project, but most of the places I've seen to submit has asked for TeX. I greatly prefer Typst because of the ridiculously fast compilation times but I haven't used it for anything outside of school assignments do to that restriction.

DominikPeters 6 hours ago||
I don't use Typst myself and am not familiar with Cetz. From the docs it looks like it's in early stages of development, so it doesn't feel like the right time to do this to me (or at least should be a separate, perhaps forked, app). But certainly it would make sense to develop bidirectional converters that could in particular be used at file open and file save in this app.
adityamwagh 9 hours ago||
Hey! I've always wanted something like this! Thanks for building this!
srean 7 hours ago||
Is their anyone here old enough to remember Xfig ?

I was quite proud of the hours of work I had put in to configure it just so, with the 3d look and all.

bedstefar 7 hours ago|
I do. I used it in the late noughts for my cryptology BSc because I was too lazy/busy to learn TikZ proper
srean 7 hours ago||
Tikz by hand for busy diagrams can be a whole lot of work.

What I loved about Xfig was that one could use latex and latex fonts in the diagrams.

otto-riz 6 hours ago||
> the kind of task that no human would ever want to do

I'm not an AI evangelist, but this kind of thing is such a welcome boon. More itches can be scratched!

haritha1313 4 hours ago||
Ah this is so cool! Wish I had it in my research days.
More comments...