I have looked at Tikz, but I do not see how that scales.

For example I would like to present this [tensor calculus proof](http://mathematica.stackexchange.com/a/71613/12306) of the Hairy Ball theorem using Penrose Graphical notation.

AFAICT the Tikz source for that would look something assembler code for a small(?) operating system :).

How do you guys keep it manageable?

I was hoping there is some kind of code generator that produces something like Tikz or GraphVis from high level descriptions.

In the mean time I have come across HaTeX which could be used to provide something like that.

Also some newer TeX distribution seem to include an embedded Lua interpreter,

so that may also be a way to add a layer of abstraction.

For example I would like to present this [tensor calculus proof](http://mathematica.stackexchange.com/a/71613/12306) of the Hairy Ball theorem using Penrose Graphical notation.

AFAICT the Tikz source for that would look something assembler code for a small(?) operating system :).

How do you guys keep it manageable?

I was hoping there is some kind of code generator that produces something like Tikz or GraphVis from high level descriptions.

In the mean time I have come across HaTeX which could be used to provide something like that.

Also some newer TeX distribution seem to include an embedded Lua interpreter,

so that may also be a way to add a layer of abstraction.