On 2019-05-06, at 20:17, Matt Price <mopto...@gmail.com> wrote:
> So, I'm finding more and more that I want to include simple diagrams in my > course materials. At present I am generating them as svg's using Inkscape, > but that feels really tiresome to me. I would much rather make them > programmatically, preferably including the source code as an org-mode block. > > I thought ditaa would be the tool for this, but I cannot figure out how to > do this work efficiently in ditaa. So for instance, I have this simple svg > file (attached). It consists of two text-containing symmetrical rectangles > separated by a bit of whitespace and connected by two curved arrows (one > pointing from each of the rectangles to the other). > > Trying to replicate this in ditaa did not prove easy. Editing feels > extremely labourious. Am I missing something? Is there a really good > tutorial somehwere that I'm just not finding? Or is there maybe another > tool I should be using instead? Eric beat me to mentioning TikZ, which I've been using to create all sorts of drawings for the past ten years or so. Another TeX-related tool is METAPOST. TikZ is apparently inspired by it a lot, and it has some very nice features (like solving systems of linear equations given in a declarative style to get intersection points of straight lines - very handy). There is another macro system built on top of it, called METAFUN (https://wiki.contextgarden.net/MetaFun). Since you mentioned exporting to HTML, d3.js came to my mind immediately. I don't have a lot of experience with it, and its main aim is something different, but it's definitely worth knowing about. Last but not least, I guess writing directly in SVG format might or might not be what you want. (I remember ye olden days when they said that XML was something to be written and read by humans... And in some cases this is in fact true!) Hth, -- Marcin Borkowski http://mbork.pl