Hacker News

DominikPeters
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.


gignico21 hours ago

I've tried it now a little. The UI looks very cool, and generally the project is cool so congrats!

However, the generated TikZ code is not good in my opinion. Everything uses absolute coordinates, which in TikZ is seldom needed.

Just to start, if I place a single node I get absolute coordinates for it. Why? If you just write `\node {Hello};`, TikZ will put that at the center of the bounding box. No need to tell it's at `(0.5,2.91)` like it's happening in my test. Then features such as "align bottom" for a selection of multiple nodes should are manipulating the absolute coordinates instead of using TikZ's alignment features (anchors etc.).

I understand generating such code is more difficult. Maybe it can be something to point at for the next version, who knows...

DominikPetersop21 hours ago

Thanks, this is good feedback. I think the difficulty lies not so much in code generation, but determining what a user would expect. If I click the "align bottom" button, I would be surprised if

  \begin{tikzpicture}
    \draw (0,2) rectangle (1,1);
    \draw (1.5,2) rectangle (2.5,1);
  \end{tikzpicture}
suddenly were to get a new randomly named \coordinate and relative coordinate notation. On the other hand, if you start out with "nice" code, the app will in many cases refuse to let you drag things since it doesn't know (and in many cases can't know) what the drag should mean (do you change the named coordinate or change the offset to the coordinate etc).

Elsewhere in this discussion, we talked about positioning like "right of", and some good suggestions were made (https://news.ycombinator.com/item?id=48647683).

delta_p_delta_x5 hours ago

A follow-up comment: when dragging, you could perhaps offer a 'sticky' mode (toggle/enable with Shift/Alt/Ctrl key?) that locks nodes to TikZ's default alignment features, and display a tooltip with the anchor position in question. Contrary to most drawing apps, this could be the default mode, and the toggle key could switch to absolute, freeform positioning.

gignico21 hours ago

That's true for two `rectangle` paths, but for two nodes that's what I would expect as a user. Anyway, not an easy problem for sure.

asdewqqwer20 hours ago

Feel like could reference how those CAD script languages do it.

DominikPetersop16 hours ago

If people are curious, I've worked on this project since February 2026, relatively consistently. In that time, through Codex, I've used around 700M tokens for this project (not counting cache reads), which at API rates would have cost $15k (but I actually paid only around $500 in ChatGPT subscription fees).

correctbrain12 hours ago

[dead]

lopsotronic21 hours ago

Ah, I love CircuitiTikZ. Only way to do simple text-based circuit diagrams.

https://ctan.org/pkg/circuitikz?lang=en

https://github.com/circuitikz/circuitikz

Some years ago I wired it up with `asciidoctor-diagram` so we could have simple circuits in our Asciidoc maintenance manuals. The techs loved the hell out of it, and we could collaborate on the things in a git versioned ecosystem vs whatever fresh hell the PDM/ERP had for us.

A very nice complement to the already awesome WireViz (https://github.com/wireviz/WireViz)

j2kuna day ago

Neat! I also enjoyed https://q.uiver.app/ by https://github.com/varkor which is a bit more specialized.

DominikPetersopa day ago

Yes, there are several editors for more specialized things. Other nice examples: https://tikzit.github.io/ and https://www.circuit2tikz.tf.fau.de/designer/ and https://tikzcd.yichuanshen.de/

correctbrain12 hours ago

[dead]

ixsploita day ago

I used lyx during university. Was super happy. Still have all my homework and lecuture notes.

https://www.lyx.org/

__mharrison__a day ago

This is very cool, but I'm going to say the inevitable...

How hard would it be to support cetz? I'm not touching LaTeX if I can avoid it, but I'm using Typst all the time.

hw__21 hours ago

Probably quite doable with a coding agent.

There is a full wysiwyg (vibe-coded) presentation software based on typst available which partially implements exactly that:

https://codeberg.org/presenst/presenst

master-lincolna day ago

As a student I really wanted something like this. Thanks for making it open source. My theoretical computer science prof happened to be Till Tantau the inventor of TikZ. An awesome communicator too.

DominikPetersopa day ago

Schleswig-Holsteiners are everywhere :) Till Tantau also started the beamer package for making LaTeX presentations. Both beamer and tikz are very important contributions to science communication.

tombert20 hours ago

This is cool!

I know people like it, but I hate writing TikZ manually, to the point that I've mostly moved most of my technical-ish drawings to draw.io/diagrams.net, and then just export to a PNG. I feel like it's inelegant, but it works well enough and it's easy to make something that looks ok. Generally I'm all for text-defined stuff.

I have moved some of my stuff to Mermaid when I know my stuff is going to live in Markdown but I've not tried to get that working in TeX.

That said, I would like to use TikZ just because it's kind of the idiomatic way of doing diagrams in LaTeX, so a WYSIWYG might be useful.

One suggestion, I would like the arrows to be able to "attach" to the boxes, as in the arrow endpoints can move when you move the boxes. That's how draw.io does it.

DominikPetersop20 hours ago

Attachment works for (text) nodes because they have anchors - you should see green attachment dots when drawing new lines or moving existing lines.

When using draw.io I’d suggest exporting to PDF instead of PNG so you keep it as vector graphics.

tombert20 hours ago

> When using draw.io I’d suggest exporting to PDF instead of PNG so you keep it as vector graphics.

I had trouble getting that working (admittedly years ago) and as long as you have a high enough resolution people can't really tell a difference between it and SVG, though obviously it will make the filesize bigger.

Just tried the text nodes and indeed the arrows work. I guess I would also suggest doing the same for regular shapes.

sureglymop20 hours ago

Can't you save a drawio file as .drawio.svg?

I've done diagrams with it a few times and just used Computer Modern to make the diagrams look the same as the text. Good enough.

sorenjana day ago

Looks really nice. You might consider adding some presets to make it easier to get started, like some common neural net architectures and other use cases for TikZ.

DominikPetersopa day ago

Good idea. There is File > Open Example, but it could be extended for sure. On desktop you can even directly open an arXiv paper!

mmmBacon12 hours ago

Wow this is awesome! I’ve been using ChatGPT to create TikZ diagrams because honestly it’s not trivial to create TikZ diagrams and they look really good when done well. However it can be challenging to get ChatGPT to tweak the diagrams. My knowledge of TikZ syntax and behavior isn’t always sophisticated enough to get the outcome I want. So this thing looks like an answer for that. Looking forward to trying this.

Incidentally I am using ChatGPT to create Latex documents for my blog and then they get rendered server side. The workflow works really well.

GL26a day ago

All STEM students and researches from the world thank you

anotherpaulg13 hours ago

FWIW, I have had great success asking AI coding tools to generate/edit tikz code. As with all AI coding, it helps to steer the agent to structure the code sensibly, etc. But frontier models seem to know how to write tikz.

mcswella day ago

I'm running Linux Mint (xfce version), and I installed the .deb version (TikZ.Editor_0.4.0_amd64.deb). It's very odd...for example, when I open it or do File/New, many (but not all) of the grid cells are rectangles, not squares. Am I doing something wrong, like installing the wrong version? Or maybe misinterpreting what the faint grey lines are?

DominikPetersopa day ago

Yeah that's odd, the grid should be square. Is the web version looking correct in the browser? Feel free to paste some screenshots into https://github.com/DominikPeters/tikz-editor/issues and I can look into it.

mcswell18 hours ago

I think the web version looks correct, although the grid lines are so faint there that it's hard to tell. I'll paste some screenshots to that link--thanks for the work!

nsagent12 hours ago

Having made graphics using TikZ, it was tedious and time consuming, but the results look great! Would have loved an easier way to make them.

Litticea day 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.

DominikPetersopa day 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.

aziis9818 hours ago

Wow, awesome project! I gave a look a bit at the code (before realizing this was made with coding agents as said below on the website) and this seems really well made.

Still, I would really like to know how you approached this from an architecture perspective. I'm also curious to how much coding agents structured the code like so by themselves or if you had to steer them heavily (I've just tried a bit gemini flash from antigravity cli so I'm a bit behind on this).

Also how did you approach the rendering correspondence with actual tikz code? Do you have some tests that like render the tikz using latex and your js pipeline and compare the result for differences?

DominikPetersop16 hours ago

The first part I implemented was the basic parser -> SVG renderer (restricted to the simplest TikZ constructs) and then put in a basic drag-and-drop interface to validate whether the architecture was promising. Code structure was decided pretty much entirely by Codex -- it asks my opinion with multiple choice questions during plan mode, which I like. I tend to alternate between feature expansion and code quality passes (e.g. making sure no files are too big, folder structure makes sense, test coverage is good, etc).

Indeed I have scripts for compiling a given tikz figure using latex (in particular dvisvgm so I get an SVG instead of a PDF) as well as my js-based renderer. I apply that script to various corpuses, mostly particular pages from the tikz manual (see https://tikz.dev), but there are also a few books about TikZ that have downloadable zips of all the examples they use. I then inspect the correspondence between the two renderers by eye and give Codex a list of which figures are wrong and why, and it then goes and fixes the underlying issues.

You'd think that finding discrepancies between the renderers could be done automatically, but it hasn't worked well in my experience. The models are multimodal but still kinda blind; they think two pictures are the same even if they are very much not the same. But once you tell them whats wrong, they're then pretty good at iterating until it is fixed. (One could also try to do a pixel diff of rasterized images, but that's super noisy, and text rendering isn't going to be pixel perfect anyway.)

wjholden21 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?

DominikPetersop21 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.

wjholden9 hours ago

A converter would be fantastic, too. I experimented with having a few LLMs try to translate TikZ to Cetz and none of them were great.

The best thing I have found so far is tylax (https://github.com/scipenai/tylax), which I think is a parser with rules, not a statistical model.

tombert20 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.

hulitu10 hours ago

> Oh man, good on you identifying a product that needs to exist

xfig ?

delta_p_delta_xa day 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

DominikPetersopa day 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!).

hmenke8 hours ago

I don't think generating pgfplots graphics counts as a derived work, as long as you are not distributing parts of the pgfplots source code. Otherwise every document that uses pgfplots would automatically be GPL-3.0-or-later, which is probably not what the author intended.

Source: I have a tiny bit of copyright on pgfplots, https://github.com/pgf-tikz/pgfplots/commits?author=hmenke

whatever1a day ago

OMG! Psychiatrists are going to lose all of their graduate customers!

The world thanks you.

[deleted]a day agocollapsed

adityamwagha day ago

Hey! I've always wanted something like this! Thanks for building this!

otto-riz21 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!

pixlmint20 hours ago

This is cool, I vibecoded something similar for a school project, but this looks much more mature, thanks for sharing!

sreana day 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.

golem1414 hours ago

My thought exactly when I saw the post.

xfig should still work, right? I remember that it could only export to .fig and .eps files, not latex or any other plot format.

srean6 hours ago

When linked with transfig their is a whole lot of file format it supports. Most distributions will package them together.

https://linux.die.net/man/1/transfig

bedstefara day ago

I do. I used it in the late noughts for my cryptology BSc because I was too lazy/busy to learn TikZ proper

sreana day 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.

lorenzohess12 hours ago

I still find Inkscape and svg + pdf_tex to be the easiest pattern.

Looks great for Tikz native though.

nynrathod9 hours ago

Great product visualization with code

dvorkaa day ago

I needed exactly this for years excellent work!

[deleted]a day agocollapsed

Affric15 hours ago

Would be cool if Apple incorporated something like this into pages

emil-lpa day ago

Here's what I would need: the ability to position five nodes in a circular fashion, so that they are evenly spaced.

DominikPetersopa day 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?)

abdullahkhalids20 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.

e2e8a day ago

That sounds like the array modifier in Blender

meghantoa day ago

Are you open to people repurposing this app as a plugin to larger apps like obsidian?

DominikPetersop21 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.

meghanto21 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!

djmipsa day ago

"TikZ ist kein Zeichenprogramm" (German for "TikZ is not a drawing program"). :-)

DominikPetersopa day 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)..

dima-quanta day ago

This is great, nice concept! Good use of coding agents. Now I can make diagrams much faster.

p0w3n3d10 hours ago

Wow. That's a thing!

hosteura day ago

Wow. I would have loved something like this when I was studying in University.

haritha131319 hours ago

Ah this is so cool! Wish I had it in my research days.

quantummagica day 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.

Barbinga day 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.)

cckolona day ago

This is so cool. I would have loved this in college.

david_2107a day ago

That's awesome! Long overdue.

cubefoxa day ago

That's cool. I guess it doesn't support TikZ' relative positioning (left of etc) because WYSIWYG features like drag-and-drop require absolute positioning?

DominikPetersopa day ago

It does support editing it if relative positioning is used in the code, i.e. if you drag the object it will continue being relatively positioned. But if you add new elements with the various tools, they will be absolutely positioned (not sure what would be a good UI for switching an element to relative positioning) unless you edit the source. You can try with

  \begin{tikzpicture}
    \node[draw] (A) at (0,0) {A};
    \node[draw, right of=A] (B) {B};
  \end{tikzpicture}

delta_p_delta_xa day ago

> not sure what would be a good UI for switching an element to relative positioning

  1. Right-click on an existing object, offer drop-down context menu.
  2. Menu item `Position relative to...`.
  3. The cursor now selects _other_ objects in the field. 
     a. If there is no other object, then offer to create a new label-less node with (x,y); default to the origin.
     b. Once an object is selected, then offer `right of`, `left of`, `north of`, `south of`, `southeast of`, etc as a drop-down menu, and a field for radial displacement.
        i. As a stretch goal, offer a `Custom position...` button to specify an (x, y) displacement, or a polar angle and radial displacement. These three options (fixed offsets, Cartesian, polar) could also be tabs in the resultant menu from (b) above. 
You could use this same UI/UX for `anchor`, too.

k33na day ago

Wow, this is really, really great. Congratulations on an excellent offering and piece of tech!

Yamaguchi_M4 hours ago

[flagged]

impartshadow16 hours ago

[flagged]

impartshadow20 hours ago

[flagged]

gunaclksy4 hours ago

[dead]

zayd7861a day ago

[flagged]

frankzeroa day ago

[dead]

jimmypka day ago

[flagged]

correctbrain12 hours ago

[dead]

martin_mate21 hours ago

[dead]

hn-front (c) 2024 voximity
source