0

I'm trying to add colors to a recursive macro that I don't understand at all how it works(well, I see the basics but I'm lost to all the tex macro weirdness

\g@addto@macro\htree@start{child[color=\colors{\x}] foreach \noexpand\x in {1,2} {\iffalse}\fi}

the code comes from

http://www.texample.net/tikz/examples/h-tree/

I'd like to do various things like color child, add nodes, based on or child angle/index/etc, position, etc...

I'd like to try to add more than 2 children too.

I really don't get what {\iffalse}\fi} is doing...

3
  • 3
    A definition must have balanced braces same number left and right. The expression {\iffalse}\fi is called a brace hack, and provides a way, upon expansion to get a single brace into a definition. See tex.stackexchange.com/questions/418621/… Sep 21, 2019 at 0:55
  • Maybe section 57 Lindenmayer System Drawing Library of the pgfmanual v3.1.4 helps you to achieve what you want without learning all these (very cool) TeX hacks.
    – user194703
    Sep 21, 2019 at 2:37
  • @Schrödinger'scat Can it let me essentially do arbitrary effects? Suppose I want to create a fern but modify a few branches or set specific colors on branches? In a sane programming language it would be very simple but with tex I'm clueless. I thought about using lua but I then might as well just go to outside tex and generate an image which is probably what I'll have to do.
    – user184375
    Sep 21, 2019 at 9:37

0

You must log in to answer this question.