I just published probability-tree, a small Typst package for drawing n×p probability trees (the classic French-style trees, growing left-to-right), built on top of CeTZ.
It supports:
probability labels above, below or on the edge (above/below/on/hybrid), optionally sloped
per-node and per-probability overrides (sn / sp)
text styles: bold, italic, small caps, highlighting, custom functions
in on mode, the edge is cut under the label while keeping transparency
MIT licensed — feedback welcome!
Note:
the package is not yet on @preview — I’m waiting for feedback before publishing to the Typst Universe. For now, install it locally (@local) or grab the files from GitHub.
I have been waiting for this package. That’s a nice looking screenshot !
When you say that the labels keep the transparency, does it mean that if I use a gray background the labels won’t sit on a white box?
Thanks for your work
Edit: after testing it, it does work. The labels sit nicely on a painted background without ugly white boxes. I do think that the default height of the above setting for the labels is a bit too high though.
Hello,
Yes, exactly.
I really wanted the text (actually the whole tree) to be able to be placed inside a coloured box.
Please feel free to give it a go; I put the module together very quickly, so there may be some bugs.
I’ll have a look at the “above” setting for proba’s distance.
Thank you for your feedback, and sorry for my english.
Kind regards,
Mikaël