0

I'd like to have a diagram like in this answer:

What I have

The difference is, that the box shouldn't conatin all of the text, but parts of it. The text afterwards has to go undecorated.

I tried making the whole diagram plain and adding decoration manually, but it didn't compile.

I don't care about wich library is used to generate the tree.

2
  • Welcome to TeX.SX! Could you give also a rough representation of what you need? – egreg Nov 21 '16 at 16:03
  • Just imagine the coloured box of each node in the picture only contain the word "tex" and the "t1.1" being classic black on white. – piegames Nov 21 '16 at 16:38
3

It is virtually impossible to tell what you really want: you give no code and a description which doesn't make much sense. Apparently, you want to split words into a bit in a coloured box and a bit not in a coloured box, where the word being split is inexplicably always text. Oh, well.

bizarre tree

Looks bizarre to me, but I suppose it takes all sorts, if not necessarily the liquorice kind.

\documentclass[tikz,border=10pt,multi,dvipsnames,svgnames,x11names]{standalone}
\usepackage[edges]{forest}

\begin{document}
\begin{forest}
  my label/.style={
    label={[font=\sffamily]right:{#1}},
  },
  for tree={% addaswyd o gôd Gonzalo Medina: http://tex.stackexchange.com/a/270761/
    folder,
    font=\sffamily,
    text=white,
    minimum height=0.75cm,
    if level=0{fill=ForestGreen}{fill/.wrap pgfmath arg={SlateBlue#1}{int(4-(mod((level()-1),4)))}},
    rounded corners=4pt,
    grow'=0,
    edge={ForestGreen,rounded corners,line width=1pt},
    fit=band,
  },
  before typesetting nodes={
    for tree={
      split option={content}{:}{content,my label},
    }
  }
  [tex:t1
    [tex:t1.1
      [tex:t1.1.1
        [tex:t1.1.1.1
          [tex:t1.1.1.1.1]
          [tex:t1.1.1.1.2]
          [tex:t1.1.1.1.3]
        ]
      ]
      [tex:t1.1.2
        [tex:t1.1.2.1]
      ]
      [tex:t1.1.3
        [tex:t1.1.3.1]
      ]
    ]
    [tex:t1.2
      [tex:t1.2.1]
      [tex:t1.2.2]
    ]
  ]
\end{forest}
\end{document}
3
  • Thank you, that's exactly what I needed. I got the following errors while compiling: "Package pgfkeys Error: I do not know the key '/forest/package@options/edges' and I am going to ignore it. Perhaps you misspelled it. ...fPackageOptions{/forest/package@options}" "Package pgfkeys Error: I do not know the key '/tikz/split option', to which ys you misspelled it. \end{forest}" – piegames Nov 22 '16 at 8:24
  • 1
    @piegames Your TeX installation is out of date and you have an old version of Forest. You need to update. – cfr Nov 22 '16 at 15:53
  • Adapted from tex.stackexchange.com/a/340354. – cfr Jan 5 '17 at 22:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.