1

Does someone know how to turn this vertical directory structure into a horizontal one? I already tried different solutions, but none of them worked as expected.

\documentclass[12pt,a4paper,oneside, ngerman, tikz,multi,dvipsnames,svgnames,x11names]{scrreprt}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage[textwidth=18cm]{geometry}
\usepackage{import}
\usepackage[edges]{forest}   

\begin{document} 
    \begin{center}
      \begin{forest}
        my label/.style={
           label={[font=\sffamily]right:{#1}},
         },
        for tree={% addaswyd o gôd Gonzalo Medina: https://tex.stackexchange.com/a/270761/
          folder,
          font=\sffamily,
          text=white,
          minimum height=0.75cm,
          text width=20mm,
          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,
          },
          [app
            [api
              [v1]
              ]
            [core]
            [crud]
            [database]
            [models
                 [router
                    [$<$vendors$>$
                         [$<$models$>$]
                    ]
                ]
                [switch
                    [$<$vendors$>$
                        [$<$models$>$]
                    ]
                ]
            ]
            [schemas]
          ]
        \end{forest}
    \end{center}
\end{document}
2
  • Welcome to TeX.SX. When you post a question, please provide a "Minimal Working Example" (MWE) that starts with \documentclass, includes all relevant \usepackage commands, ends with \end{document} and compiles without errors, even if it does not produce your desired output.
    – Sandy G
    Commented May 9, 2022 at 20:12
  • Hello, i updated the post accordingly. It compiles without errors on my machine
    – Onur C.Y.
    Commented May 9, 2022 at 20:21

1 Answer 1

1

I'm not sure if this is what you want, but since the folder option has downward as its natural direction, you need to change grow'=0 to grow=270. Then to rotate the nodes, add rotate=-90 to your for tree.

enter image description here

    for tree={% addaswyd o gôd Gonzalo Medina: https://tex.stackexchange.com/a/270761/
      folder,
      font=\sffamily,
      text=white,
      minimum height=0.75cm,
      text width=20mm,
      if level=0{fill=ForestGreen}{fill/.wrap pgfmath 
      arg={SlateBlue#1}{int(4-(mod((level()-1),4)))}},
      rounded corners=4pt,
      grow=270,
      rotate=-90,
      edge={ForestGreen,rounded corners,line width=1pt},
      fit=band,
      }
1
  • Thank you very much! This will fit my needs.
    – Onur C.Y.
    Commented May 9, 2022 at 20:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .