Hacker News
Show HN: TikZ Editor – WYSIWYG editor for figures in LaTeX
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.
otto-riz
|next
[-]
I'm not an AI evangelist, but this kind of thing is such a welcome boon. More itches can be scratched!
lopsotronic
|next
|previous
[-]
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)
j2kun
|next
|previous
[-]
DominikPeters
|root
|parent
|next
[-]
mcswell
|next
|previous
[-]
DominikPeters
|root
|parent
[-]
master-lincoln
|next
|previous
[-]
sorenjan
|next
|previous
[-]
__mharrison__
|next
|previous
[-]
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.
meghanto
|next
|previous
[-]
DominikPeters
|root
|parent
[-]
srean
|next
|previous
[-]
I was quite proud of the hours of work I had put in to configure it just so, with the 3d look and all.
delta_p_delta_x
|next
|previous
[-]
DominikPeters
|root
|parent
[-]
whatever1
|next
|previous
[-]
The world thanks you.
adityamwagh
|next
|previous
[-]
djmips
|next
|previous
[-]
DominikPeters
|root
|parent
[-]
> 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)..
Littice
|next
|previous
[-]
emil-lp
|next
|previous
[-]
DominikPeters
|root
|parent
[-]
\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?)
dima-quant
|next
|previous
[-]
hosteur
|next
|previous
[-]
quantummagic
|next
|previous
[-]
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.
cubefox
|next
|previous
[-]
DominikPeters
|root
|parent
[-]
\begin{tikzpicture}
\node[draw] (A) at (0,0) {A};
\node[draw, right of=A] (B) {B};
\end{tikzpicture}
delta_p_delta_x
|root
|parent
[-]
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.