2

There is a library in TikZ for creating mind (or concept) maps (https://pgf-tikz.github.io/pgf/pgfmanual.pdf#section.60).

However, it doesn't seem that intuitive to use. I want nodes to automatically adjust to their content (which can partly be achieved with https://tex.stackexchange.com/a/285655/194783).

Additionally, I want the mind map to be arranged (at least semi-)automatically.

So that things like in this MWE don't happen:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{mindmap}

\begin{document} \pagestyle{empty} {\centering \makebox[0pt]{ \begin{tikzpicture} [mindmap, grow cyclic, every node/.style={concept, text width=}, concept color=teal!40, ] \node {node} child{ node {subnode} child { node {subnode} } child { node {subnode} } child { node {subnode} } child { node {subnode} } } child{ node {subnode} child { node {subnode} } child { node {subnode} } } child{ node {subnode} child { node {subnode} } child { node {subnode} } child { node {subnode} } child { node {subnode} } } child{ node {subnode} child { node {subnode} } child { node {subnode} } child { node {subnode} } child { node {subnode} } child { node {subnode} } } child{ node {subnode} child { node {subnode} } child { node {subnode} } child { node {subnode} } child { node {subnode} } child { node {subnode} } } child{ node {subnode} child { node {subnode} } child { node {subnode} } child { node {subnode} } child { node {subnode} } child { node {subnode} } } child{ node {subnode} child { node {subnode} } child { node {subnode} } child { node {subnode} } child { node {subnode} } child { node {subnode} } }; \end{tikzpicture} } \par } \end{document}

result

I assume, in CSS, one defines margins to have non-overlapping elements.

Part of the solution might include setting dynamic sibling angles (like in https://tex.stackexchange.com/a/118746/194783) and defining a custom growth function (as described in https://tex.stackexchange.com/a/232914/194783).

Edit: To mitigate the problem, I added some code to automatically set the sibling angle based on the number of children of a node. This still doesn't always avoid overlap, though.

I have seen several posts about writing custom growth functions to achieve a special shape. This also often solves overlaps, but I don't want the shapes that are used there.

For a related problem, there is the forest package suggested, which doesn't entirely help in my case: Overlapping nodes in a tree using TikZ

clel
  • 325
  • I'm interested in this too, shame there doesn't seem to be much of a solution to this as it would be handy!

    I'm guessing there is a solution that could be calculated using a kind of force of attraction and repulsion between nodes, but I'm nowhere near savvy enough to do this with LaTeX.

    – Ash Oldershaw Nov 04 '23 at 13:32

0 Answers0