# forest with more than one main file

I am using the following code to draw a folder tree:

%credit:https://tex.stackexchange.com/questions/5073/making-a-simple-directory-tree
\documentclass[border=5pt]{standalone}
\usepackage{forest}

\begin{document}

\begin{forest}
for tree={
font=\ttfamily,
grow'=0,
child anchor=west,
parent anchor=south,
anchor=west,
calign=first,
edge path={
\noexpand\path [draw, \forestoption{edge}]
(!u.south west) +(7.5pt,0) |- node[fill,inner sep=1.25pt] {} (.child anchor)\forestoption{edge label};
},
before typesetting nodes={
if n=1
{insert before={[,phantom]}}
{}
},
fit=band,
before computing xy={l=15pt},
}
%[
[text1    %this should be on the same level of...
[text1.1
[text1.1.1]
]
[text1.2
[text1.2.1]
]
]
[text2]   %...this
%]
\end{forest}

\end{document}


The output is the following:

I do not understand why text2 does not appear.

My aim is to have text1 and text2 on the same level as two main files. The only solution I found is to uncomment the square brackets in the code above and obtain

But I would like to not have the vertical line on the left. How could I achieve that?

• Have you considered using edges? – cfr Jan 17 '17 at 1:29

Salim Bou's answer is perfectly correct. However, it is now much easier to draw trees of this kind using Forest and it seems a shame not to make the most of the new facilities.

Current Forest (version 2 and later) supports libraries to extend its functionality, much as TikZ does. One of the bundled libraries is edges which, among other things, provides an out-of-the-box style for drawing trees of this kind. For some reason, it is called folder, but don't let that put you off. It even works OK on GNU/Linux and other Unix-ish systems!

\documentclass[border=10pt,multi,tikz]{standalone}
\usepackage[edges]{forest}
\begin{document}
\begin{forest}
for tree={
font=\ttfamily,
grow'=0,
folder,
edge label={node [midway, inner sep=1.25pt, fill] {}},
}
[, phantom
[text1
[text1.1
[text1.1.1]
]
[text1.2
[text1.2.1]
]
]
[text2]
]
\end{forest}
\end{document}


What you need is to hide first level with their edges by adding phantom key

%credit:https://tex.stackexchange.com/questions/5073/making-a-simple-directory-tree
\documentclass[border=5pt]{standalone}
\usepackage{forest}

\begin{document}

\begin{forest}
for tree={
font=\ttfamily,
grow'=0,
child anchor=west,
parent anchor=south,
anchor=west,
calign=first,
edge path={
\noexpand\path [draw, \forestoption{edge}]
(!u.south west) +(7.5pt,0) |- node[fill,inner sep=1.25pt] {} (.child anchor)\forestoption{edge label};
},
before typesetting nodes={
if n=1
{insert before={[,phantom]}}
{}
},
fit=band,
before computing xy={l=15pt},
}
[,phantom  % add this to hide first level
[text1
[text1.1
[text1.1.1]
]
[text1.2
[text1.2.1]
]
]
[text2]
]
\end{forest}

\end{document}


• Have you considered using edges? – cfr Jan 17 '17 at 1:28