HackerTrans
TopNewTrendsCommentsPastAskShowJobs

DominikPeters

no profile record

Submissions

Show HN: TikZ Editor – WYSIWYG editor for figures in LaTeX

tikz.dev
451 points·by DominikPeters·18 hari yang lalu·74 comments

comments

DominikPeters
·17 hari yang lalu·discuss
Hi Henri, thanks for all your work on pgf, and congrats on the recent push on CI etc. The reason I think that GPL-3 would bite is that adding support would require more or less translating the pgfplots source to javascript, so that the app can parse and then correctly render the code, and that would definitely be a derived work. But I think the add-on route should be okay.
DominikPeters
·18 hari yang lalu·discuss
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).
DominikPeters
·18 hari yang lalu·discuss
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.)
DominikPeters
·18 hari yang lalu·discuss
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.
DominikPeters
·18 hari yang lalu·discuss
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).
DominikPeters
·18 hari yang lalu·discuss
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.
DominikPeters
·18 hari yang lalu·discuss
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.
DominikPeters
·18 hari yang lalu·discuss
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.
DominikPeters
·18 hari yang lalu·discuss
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)..
DominikPeters
·18 hari yang lalu·discuss
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}
DominikPeters
·18 hari yang lalu·discuss
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/
DominikPeters
·18 hari yang lalu·discuss
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!).
DominikPeters
·18 hari yang lalu·discuss
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.
DominikPeters
·18 hari yang lalu·discuss
Good idea. There is File > Open Example, but it could be extended for sure. On desktop you can even directly open an arXiv paper!
DominikPeters
·18 hari yang lalu·discuss
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?)
DominikPeters
·18 hari yang lalu·discuss
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.
DominikPeters
·2 bulan yang lalu·discuss
The landing page (clearly to a large part written by LLM) does not mention that both KaTeX and mathjax can render to SVG in node. This wasm approach might still be lighter, but the advantage is not as clear as the page makes it seem. (It also contains LLM dishonesties like that the bundle size is 0 KB.)
DominikPeters
·3 bulan yang lalu·discuss
This approach started with the “Ask a question about your code” feature, which is more comparable to single chat message with relatively predictable token usage. Now it’s an agent who might work for 30 minutes, read the whole codebase, and write 1000 lines
DominikPeters
·3 bulan yang lalu·discuss
They mention in the announcement that it will be possible to pool usage across an organization.
DominikPeters
·3 bulan yang lalu·discuss
It's interesting that the API token cost of GPT-5.5 is double the cost of GPT-5.4, but Copilot charges a 7.5x multiplier and gates the model in premium plans. Clearly, they severely underpriced previous models like GPT-5.4 which they sell at $0.04 per request -- and these models can of course work for 30+ minutes in response to a single request and incur costs of several dollars.