Top
Best
New

Posted by DominikPeters 11 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.

315 points | 61 commentspage 3
haritha1313 5 hours ago|
Ah this is so cool! Wish I had it in my research days.
dvorka 10 hours ago||
I needed exactly this for years excellent work!
meghanto 8 hours ago||
Are you open to people repurposing this app as a plugin to larger apps like obsidian?
DominikPeters 8 hours ago|
Generally yes! It is permissively licensed. I originally considered writing this app as a VS Code extension (because most app ideas that include a source editor are more simply done as an extension) but then decided that I wanted to have more control over the source view.
meghanto 7 hours ago||
Perfect! I've been working on a general purpose Swiss army knife for technical note taking/ knowledge management/ sharing. This could very well be an add-on missing piece for heavier latex rendering and editing. Thank you!
emil-lp 10 hours ago||
Here's what I would need: the ability to position five nodes in a circular fashion, so that they are evenly spaced.
DominikPeters 10 hours ago|
Intriguing thought. Of course by writing code it can be done

  \foreach \i in {1,...,5} {
    \node[circle, draw] (n\i) at ({90 - 72*(\i-1)}:1cm) {$\i$};
  }
but I'm not sure how to expose that as a UI in a nice way (maybe: if something uses polar coordinates and the user holds shift, then during drag the radius stays fixed, and I nudge towards even angular spacing + multiples of 15 degrees?)
abdullahkhalids 6 hours ago|||
A simpler way to do this would be for the user to create and place some temporary virtual "grids". For example, the user might create a virtual triangle of a certain size. Or in the case of this request, a circle with n points. Note that these are virtual and temporary items never created in the underlying tikz code (though you may implement them with hidden tikz code).

Then the user can do one of two things. (1) Select an item and place it on the grid, and the item gets replicated on all the grid points. (2) Pick and place different items on each of the grid points.

e2e8 10 hours ago|||
That sounds like the array modifier in Blender
dima-quant 10 hours ago||
This is great, nice concept! Good use of coding agents. Now I can make diagrams much faster.
hosteur 10 hours ago||
Wow. I would have loved something like this when I was studying in University.
cckolon 8 hours ago||
This is so cool. I would have loved this in college.
quantummagic 10 hours ago||
Great job! Thank you for making it open source.

At some point the people who seethe with hate for AI, and claim it's all hallucinations and illegitimate hype, are going to have to admit they were wrong. Projects like this are the proof staring them right in the face, if they care to look.

Barbing 10 hours ago|
They’ve updated their criticisms since - bottom of career ladder disruption, skill atrophy.

(Not on HN but I do still see some folks who last tested LLMs before Nov ‘25, those folks might still be mostly out of touch.)

djmips 8 hours ago|
"TikZ ist kein Zeichenprogramm" (German for "TikZ is not a drawing program"). :-)
DominikPeters 8 hours ago|
An explanation for the name from the TikZ docs:

> TikZ’s name is intended to warn people that TikZ is not a program that you can use to draw graphics with your mouse or tablet. Rather, it is more like a “graphics language”.

While making the app I was worried that I was going against the TikZ philosophy. Maybe I should have named it "TikZ ist doch ein Zeichenprogramm" (TideZ)..

More comments...