Search code examples
layoutlatextikzdot2tex

tikz mindmap/tree or graph autolayout


tikz mindmaps are suitable for small layout, however I'm looking for an autolayout mechanism that allows arbitrary content to be layed out automatically.

Example of limitations of tikz mindmaps: If I add grow cyclic to the path, the size and distance of the nodes to each other is not optimal. I imagine a result similar to the output of the graphml editor yed which works pretty well, but there's no bindings to TeX afaik.


Solution

  • This can be achieved with the dot2tex package in LaTeX:

    \begin{dot2tex}[tikz,options=-tmath,autosize]
    digraph G {
        a [texlbl="\begin{minipage}{10cm} \end{minipage}" ] 
        b [texlbl="C"]
        a -> b -> a
    }
    \end{dot2tex}
    

    Arbitrary markup can be put into the texlbl parameter and will be layed out nicely.

    It's important to add the autosize option and to not include line breaks in the texlbl content (consider wrapping in standalone for very long content).