| 1 |
% \CheckSum{236} |
| 2 |
% \iffalse meta-comment |
| 3 |
% forest-libs.dtx |
| 4 |
%% `forest-libs' is a collection of libraries for package `forest'. |
| 5 |
%% |
| 6 |
%% Copyright (c) 2012-2017 Saso Zivanovic |
| 7 |
%% (Sa\v{s}o \v{Z}ivanovi\'{c}) |
| 8 |
%% [email protected] |
| 9 |
%% |
| 10 |
%% This work may be distributed and/or modified under the |
| 11 |
%% conditions of the LaTeX Project Public License, either version 1.3 |
| 12 |
%% of this license or (at your option) any later version. |
| 13 |
%% The latest version of this license is in |
| 14 |
%% |
| 15 |
%% http://www.latex-project.org/lppl.txt |
| 16 |
%% |
| 17 |
%% and version 1.3 or later is part of all distributions of LaTeX |
| 18 |
%% version 2005/12/01 or later. |
| 19 |
%% |
| 20 |
%% This work has the LPPL maintenance status `author-maintained'. |
| 21 |
%% |
| 22 |
%% This file is a part of package `forest'. For the list of files |
| 23 |
%% constituting the package see main source file of the package, |
| 24 |
%% `forest.dtx', or the derived `forest.sty'. |
| 25 |
%% |
| 26 |
% \fi |
| 27 |
% |
| 28 |
% \section{Libraries} |
| 29 |
% |
| 30 |
% This chapter contains not only the reference of commands found in libraries and some examples of |
| 31 |
% their usage, but also their definitions. This is done in the hope that these definitions, being |
| 32 |
% mostly styles, will be useful as examples of the core features of the package. I even managed to |
| 33 |
% comment them a bit \dots |
| 34 |
% |
| 35 |
% \paragraph{Disclaimer.} At least in the initial stages of a library's development, the function |
| 36 |
% and interface of macros and keys defined in a library might change without backwards compatibility |
| 37 |
% support! Though I'll try to keep this from happening \dots |
| 38 |
% |
| 39 |
% \begin{macrocode} |
| 40 |
\RequirePackage{forest} |
| 41 |
% \end{macrocode} |
| 42 |
% |
| 43 |
%\iffalse |
| 44 |
%<*linguistics> |
| 45 |
%\fi |
| 46 |
% \librarysection{linguistics} |
| 47 |
% \begin{macrocode} |
| 48 |
\ProvidesForestLibrary{linguistics}[2017/07/14 v0.1.2] |
| 49 |
% \end{macrocode} |
| 50 |
% |
| 51 |
% Defaults: |
| 52 |
% \begin{macrocode} |
| 53 |
\forestset{ |
| 54 |
linguistics@set@baseline/.style={ |
| 55 |
if phantom={for next node=linguistics@set@baseline}{baseline} |
| 56 |
}, |
| 57 |
libraries/linguistics/defaults/.style={ |
| 58 |
default preamble={ |
| 59 |
% \end{macrocode} |
| 60 |
% Edges of the children will ``meet'' under the node: |
| 61 |
% \begin{macrocode} |
| 62 |
sn edges, |
| 63 |
% \end{macrocode} |
| 64 |
% The root of the tree will be aligned with the text \dots\ or, more commonly, the example number. |
| 65 |
% More precisely, we actually align the first (in linear order) non-phantom node. This covers the |
| 66 |
% common case of side-by-side trees joined with a phantom root. |
| 67 |
% \begin{macrocode} |
| 68 |
before drawing tree={ |
| 69 |
if nodewalk valid={name=forest@baseline@node}{}{linguistics@set@baseline}, |
| 70 |
}, |
| 71 |
% \end{macrocode} |
| 72 |
% Enable (centered) multi-line nodes. |
| 73 |
% \begin{macrocode} |
| 74 |
for tree={align=center}, |
| 75 |
}, |
| 76 |
}, |
| 77 |
} |
| 78 |
% \end{macrocode} |
| 79 |
% |
| 80 |
% There's no linguistics without c-command\footnote{The definition of c-command is as follows: a node c-commands its siblings and their descendants.} \dots |
| 81 |
% \begin{syntax} |
| 82 |
% \indexitem{step>c-commanded} Visit all the nodes c-commanded by the current node. |
| 83 |
% \indexitem{step>c-commanders} Visit all the c-commanders of the current node, starting from the closest. |
| 84 |
% |
| 85 |
% \begin{forestexample}[tree bin=minipage,index={branch',c-commanded}] |
| 86 |
% \begin{forest} |
| 87 |
% [VP |
| 88 |
% [DP[John]] |
| 89 |
% [V' |
| 90 |
% [V, draw, for c-commanded={draw,circle} |
| 91 |
% [sent] |
| 92 |
% ] |
| 93 |
% [DP[Mary]] |
| 94 |
% [DP[D[a]][NP[letter]]] |
| 95 |
% ] |
| 96 |
% ] |
| 97 |
% \end{forest} |
| 98 |
% \end{forestexample} |
| 99 |
% |
| 100 |
% See how \indexex{branch'} is used to define |c-commanded|, and how \indexex{while nodewalk valid} and \indexex{nodewalk key>fake} are combined in the definition of |c-commanders|. |
| 101 |
% \begin{macrocode} |
| 102 |
\forestset{ |
| 103 |
define long step={c-commanded}{style}{branch'={siblings,descendants}}, |
| 104 |
define long step={c-commanders}{style}{while nodewalk valid={parent}{siblings,fake=parent}}, |
| 105 |
} |
| 106 |
% \end{macrocode} |
| 107 |
% |
| 108 |
% |c-commanders| could also be defined using \indexex{branch}: |
| 109 |
% \begin{lstlisting} |
| 110 |
% branch={current and ancestors, siblings} |
| 111 |
% \end{lstlisting} |
| 112 |
% |
| 113 |
% \indexitem{node key>sn edges} |
| 114 |
% |
| 115 |
% In linguistics, most people want the parent-child edge to go from the \emph{s}outh of the parent |
| 116 |
% to the \emph{n}orth of the child. This is achieved by this (badly named) style, which makes the |
| 117 |
% entire (sub)tree have such edges. |
| 118 |
% |
| 119 |
% \begin{forestexample} |
| 120 |
% \begin{forest} |
| 121 |
% sn edges |
| 122 |
% [VP |
| 123 |
% [DP] |
| 124 |
% [V' |
| 125 |
% [V] |
| 126 |
% [DP] |
| 127 |
% ] |
| 128 |
% ] |
| 129 |
% \end{forest} |
| 130 |
% \end{forestexample} |
| 131 |
% |
| 132 |
% \begin{macrocode} |
| 133 |
\forestset{ |
| 134 |
sn edges/.style={ |
| 135 |
for tree={ |
| 136 |
parent anchor=children, child anchor=parent |
| 137 |
} |
| 138 |
}, |
| 139 |
} |
| 140 |
% \end{macrocode} |
| 141 |
% |
| 142 |
% A note on implementation. Despite its name, this style does not refer to the |south| and |north| |
| 143 |
% anchor of the parent and the child node directly. If it did so, it would only work for trees with |
| 144 |
% standard linguistic \index{grow}|=-90|. So we rather use \FoRest;'s growth direction based |
| 145 |
% anchors: \index{anchor>children} always faces the children and \index{anchor>parent} always faces |
| 146 |
% the parent, so the edge will always be between them, and the normal, upward growing trees will |
| 147 |
% look good as well. |
| 148 |
% |
| 149 |
% \begin{forestexample}[index={anchor>south,anchor>north,option>parent anchor,option>child anchor}] |
| 150 |
% \begin{forest} |
| 151 |
% [bad![VP,no edge, for tree={grow=90, edge=red}, |
| 152 |
% for tree={parent anchor=south, child anchor=north} % bad |
| 153 |
% [DP][V'[V][DP]]]] |
| 154 |
% \end{forest} |
| 155 |
% \begin{forest} |
| 156 |
% [good![VP, no edge, for tree={grow=90, edge=green}, |
| 157 |
% ~sn edges~ % good! |
| 158 |
% [DP][V'[V][DP]]]] |
| 159 |
% \end{forest} |
| 160 |
% \end{forestexample} |
| 161 |
% |
| 162 |
% \indexitem{node key>roof} Makes the edge to parent a triangular roof. |
| 163 |
% \begin{macrocode} |
| 164 |
\forestset{ |
| 165 |
roof/.style={edge path'={% |
| 166 |
(.parent first)--(!u.children)--(.parent last)--cycle |
| 167 |
} |
| 168 |
}, |
| 169 |
} |
| 170 |
% \end{macrocode} |
| 171 |
% |
| 172 |
% \indexitem{node key>nice empty nodes} |
| 173 |
% |
| 174 |
% We often need empty nodes: tree (\ref{ex:niceemptynodes}a) shows how they look like by default: |
| 175 |
% ugly. |
| 176 |
% |
| 177 |
% First, we don't want the gaps: we change the shape of empty nodes to coordinate. We get tree |
| 178 |
% (\ref{ex:niceemptynodes}b). |
| 179 |
% |
| 180 |
% Second, the empty nodes seem too close |
| 181 |
% to the other (especially empty) nodes (this is a result of a small |
| 182 |
% default |s_sep|). We could use a greater \index{s sep}, but a better solution seems |
| 183 |
% to be to use |calign=fixed_angles|. The result is shown in (\ref{ex:niceemptynodes}c). |
| 184 |
% |
| 185 |
% However, at the transitions from empty to non-empty nodes, tree (\ref{ex:niceemptynodes}c) |
| 186 |
% seems to zigzag (although the base points of the spine nodes |
| 187 |
% are perfectly in line), and the edge to the empty node left to VP |
| 188 |
% seems too long (it reaches to the level of VP's base, while we'd |
| 189 |
% prefer it to stop at the same level as the edge to VP itself). The |
| 190 |
% first problem is solved by substituting |fixed_angles| for |
| 191 |
% |fixed_edge_angles|; the second one, by anchoring siblings of |
| 192 |
% empty nodes at north. VoilĂ , (\ref{ex:niceemptynodes}d)! |
| 193 |
% |
| 194 |
% \begin{forestexample}[label=ex:niceemptynodes,layout=tree on bottom,index={fixed angles,fixed edge angles,calign,tree,delay,where option,content,for step,step>parent,step>children,option>anchor}] |
| 195 |
% \forestset{ |
| 196 |
% xlist/.style={ |
| 197 |
% phantom, |
| 198 |
% for children={no edge,replace by={[,append, |
| 199 |
% delay={content/.wrap pgfmath arg={\csname @alph\endcsname{##1}.}{n()+#1}} |
| 200 |
% ]}} |
| 201 |
% }, |
| 202 |
% xlist/.default=0 |
| 203 |
% } |
| 204 |
% \begin{forest} |
| 205 |
% [,~xlist~, |
| 206 |
% for tree={after packing node={s+=0.1pt}}, % hack!!! |
| 207 |
% [CP, %(a) |
| 208 |
% [][[][[][VP[DP[John]][V'[V[loves]][DP[Mary]]]]]]] |
| 209 |
% [CP, delay={where content={}{shape=coordinate}{}} %(b) |
| 210 |
% [][[][[][VP[DP[John]][V'[V[loves]][DP[Mary]]]]]]] |
| 211 |
% [CP, for tree={calign=fixed angles}, %(c) |
| 212 |
% delay={where content={}{shape=coordinate}{}} |
| 213 |
% [][[][[][VP[DP[John]][V'[V[loves]][DP[Mary]]]]]]] |
| 214 |
% [CP, ~nice empty nodes~ %(d) |
| 215 |
% [][[][[][VP[DP[John]][V'[V[loves]][DP[Mary]]]]]]] |
| 216 |
% ] |
| 217 |
% \end{forest} |
| 218 |
% \end{forestexample} |
| 219 |
% |
| 220 |
% \begin{macrocode} |
| 221 |
\forestset{ |
| 222 |
nice empty nodes/.style={ |
| 223 |
for tree={calign=fixed edge angles}, |
| 224 |
delay={where content={}{shape=coordinate, |
| 225 |
for current and siblings={anchor=north}}{}} |
| 226 |
}, |
| 227 |
} |
| 228 |
% \end{macrocode} |
| 229 |
% |
| 230 |
% \indexitem{node key>draw brackets} Outputs the bracket representation of the tree. |
| 231 |
% \indexitem{node key>draw brackets compact} |
| 232 |
% \itemnosep |
| 233 |
% \indexitem{node key>draw brackets wide} These keys control whether the brackets have extra |
| 234 |
% spaces around them (|wide|) or not (|compact|). |
| 235 |
% \begin{macrocode} |
| 236 |
\providecommand\text[1]{\mbox{\scriptsize#1}} |
| 237 |
\forestset{ |
| 238 |
draw brackets compact/.code={\let\drawbracketsspace\relax}, |
| 239 |
draw brackets wide/.code={\let\drawbracketsspace\space}, |
| 240 |
draw brackets/.style={ |
| 241 |
% \end{macrocode} |
| 242 |
% There's stuff to do both before (output the opening bracket and the content) and after (output the |
| 243 |
% closing bracket) processing the children, so we use \indexex{for tree'}. |
| 244 |
% \begin{macrocode} |
| 245 |
for tree'={ |
| 246 |
TeX={[% |
| 247 |
% \end{macrocode} |
| 248 |
% Complication: \index{content format} must be expanded in advance, to correctly process tabular environments implicitely loaded by \index{align}|=|\index{value of=align>center}, which is the default in this library. (Not that one would want a multiline output in the bracket representation, but it's better than crashing.) |
| 249 |
% \begin{macrocode} |
| 250 |
\edef\forestdrawbracketscontentformat{\foresteoption{content format}}% |
| 251 |
}, |
| 252 |
if n children=0{ |
| 253 |
TeX={\drawbracketsspace\forestdrawbracketscontentformat\drawbracketsspace} |
| 254 |
}{ |
| 255 |
TeX={\textsubscript{\text{\forestdrawbracketscontentformat}}\drawbracketsspace} |
| 256 |
}, |
| 257 |
}{ |
| 258 |
TeX={]\drawbracketsspace}, |
| 259 |
} |
| 260 |
}, |
| 261 |
draw brackets wide |
| 262 |
} |
| 263 |
% \end{macrocode} |
| 264 |
% \end{syntax} |
| 265 |
% |
| 266 |
% \subsubsection{GP1} |
| 267 |
% |
| 268 |
% \begin{syntax} |
| 269 |
% \indexitem{node key>GP1} |
| 270 |
% |
| 271 |
% For Government Phonology (v1) representations. Here, the big trick |
| 272 |
% is to evenly space $\times$s by having a large enough |outer_xsep| |
| 273 |
% (adjustable), and then, before drawing (timing control option |
| 274 |
% |before_drawing_tree|), setting |outer_xsep| back to 0pt. The last step |
| 275 |
% is important, otherwise the arrows between $\times$s won't draw! |
| 276 |
% |
| 277 |
% An example of an ``embedded'' |GP1| style: |
| 278 |
% \begin{forestexample}[layout=tree on bottom,index={where option,tier,for step,step>children,content,tikz,option>l,dimen+,no edge},index>={!}] |
| 279 |
% \begin{forest} |
| 280 |
% myGP1/.style={ |
| 281 |
% ~GP1~, |
| 282 |
% delay={where tier={x}{ |
| 283 |
% for children={content=\textipa{##1}}}{}}, |
| 284 |
% tikz={\draw[dotted](.south)-- |
| 285 |
% (!1.north west)--(!l.north east)--cycle;}, |
| 286 |
% for children={l+=5mm,no edge} |
| 287 |
% } |
| 288 |
% [VP[DP[John,tier=word,myGP1 |
| 289 |
% [O[x[dZ]]] |
| 290 |
% [R[N[x[6]]]] |
| 291 |
% [O[x[n]]] |
| 292 |
% [R[N[x]]] |
| 293 |
% ]][V'[V[loves,tier=word,myGP1 |
| 294 |
% [O[x[l]]] |
| 295 |
% [R[N[x[a]]]] |
| 296 |
% [O[x[v]]] |
| 297 |
% [R[N[x]]] |
| 298 |
% [O[x[z]]] |
| 299 |
% [R[N[x]]] |
| 300 |
% ]][DP[Mary,tier=word,myGP1 |
| 301 |
% [O[x[m]]] |
| 302 |
% [R[N[x[e]]]] |
| 303 |
% [O[x[r]]] |
| 304 |
% [R[N[x[i]]]] |
| 305 |
% ]]]] |
| 306 |
% \end{forest}% |
| 307 |
% \end{forestexample} |
| 308 |
% |
| 309 |
% And an example of annotations. |
| 310 |
% \begin{forestexample} |
| 311 |
% \begin{forest}[,phantom,s sep=1cm |
| 312 |
% [{[ei]}, GP1 |
| 313 |
% [R[N[x[A,~el~[I,~head~,~associate=N~]]][x]]] |
| 314 |
% ] |
| 315 |
% [{[mars]}, GP1 |
| 316 |
% [O[x[m]]] |
| 317 |
% [R[N[x[a]]][x,~encircle~,densely dotted[r]]] |
| 318 |
% [O[x,~encircle~,~govern=<~[s]]] |
| 319 |
% [R,~fen~[N[x]]] |
| 320 |
% ] |
| 321 |
% ]\end{forest} |
| 322 |
% \end{forestexample} |
| 323 |
% |
| 324 |
% \begin{macrocode} |
| 325 |
\newbox\standardnodestrutbox |
| 326 |
\setbox\standardnodestrutbox=\hbox to 0pt{\phantom{\forestOve{standard node}{content}}} |
| 327 |
\def\standardnodestrut{\copy\standardnodestrutbox} |
| 328 |
\forestset{ |
| 329 |
GP1/.style 2 args={ |
| 330 |
for n={1}{baseline}, |
| 331 |
s sep=0pt, l sep=0pt, |
| 332 |
for descendants={ |
| 333 |
l sep=0pt, l={#1}, |
| 334 |
anchor=base,calign=first,child anchor=north, |
| 335 |
inner xsep=1pt,inner ysep=2pt,outer sep=0pt,s sep=0pt, |
| 336 |
}, |
| 337 |
delay={ |
| 338 |
if content={}{phantom}{for children={no edge}}, |
| 339 |
for tree={ |
| 340 |
if content={O}{tier=OR}{}, |
| 341 |
if content={R}{tier=OR}{}, |
| 342 |
if content={N}{tier=N}{}, |
| 343 |
if content={x}{ |
| 344 |
tier=x,content={$\times$},outer xsep={#2}, |
| 345 |
for tree={calign=center}, |
| 346 |
for descendants={content format={\noexpand\standardnodestrut\forestoption{content}}}, |
| 347 |
before drawing tree={outer xsep=0pt,delay={typeset node}}, |
| 348 |
s sep=4pt |
| 349 |
}{}, |
| 350 |
}, |
| 351 |
}, |
| 352 |
before drawing tree={where content={}{parent anchor=center,child anchor=center}{}}, |
| 353 |
}, |
| 354 |
GP1/.default={5ex}{8.0pt}, |
| 355 |
associate/.style={% |
| 356 |
tikz+={\draw[densely dotted](!)--(!#1);}}, |
| 357 |
spread/.style={ |
| 358 |
before drawing tree={tikz+={\draw[dotted](!)--(!#1);}}}, |
| 359 |
govern/.style={ |
| 360 |
before drawing tree={tikz+={\draw[->](!)--(!#1);}}}, |
| 361 |
p-govern/.style={ |
| 362 |
before drawing tree={tikz+={\draw[->](.north) to[out=150,in=30] (!#1.north);}}}, |
| 363 |
no p-govern/.style={ |
| 364 |
before drawing tree={tikz+={\draw[->,loosely dashed](.north) to[out=150,in=30] (!#1.north);}}}, |
| 365 |
encircle/.style={before drawing tree={circle,draw,inner sep=0pt}}, |
| 366 |
fen/.style={pin={[font=\footnotesize,inner sep=1pt,pin edge=<-]10:\textsc{Fen}}}, |
| 367 |
el/.style={content=\textsc{\textbf{##1}}}, |
| 368 |
head/.style={content=\textsc{\textbf{\underline{##1}}}} |
| 369 |
} |
| 370 |
% \end{macrocode} |
| 371 |
% \end{syntax} |
| 372 |
%\iffalse |
| 373 |
%</linguistics> |
| 374 |
%\fi |
| 375 |
% |
| 376 |
% |
| 377 |
% |
| 378 |
%\iffalse |
| 379 |
%<*edges> |
| 380 |
%\fi |
| 381 |
% \librarysection{edges} |
| 382 |
% \begin{macrocode} |
| 383 |
\ProvidesForestLibrary{edges}[2016/12/05 v0.1.1] |
| 384 |
% \end{macrocode} |
| 385 |
% |
| 386 |
% \begin{syntax} |
| 387 |
% |
| 388 |
% \indexitem{node key>forked edge'} |
| 389 |
% |
| 390 |
% Sets a forked edge to the current node. Arbitrary growth direction and node rotation are |
| 391 |
% supported. |
| 392 |
% |
| 393 |
% \indexitem{node key>forked edge} |
| 394 |
% |
| 395 |
% Like \index{forked edge'}, but it also sets \index{option>parent anchor} and \index{option>child |
| 396 |
% anchor} to the likely values of \index{anchor>children} and \index{anchor>parent}, respectively. |
| 397 |
% |
| 398 |
% \indexitem(tree){node key>forked edges}|=|\meta{nodewalk} |
| 399 |
% |
| 400 |
% Invokes \index{forked edge} for all nodes in the \meta{nodewalk}, by default the entire (sub)tree |
| 401 |
% rooted in the current node. |
| 402 |
% |
| 403 |
% \indexitem{option>fork sep} The \index{forest cs>l}-distance between the parent anchor and the |
| 404 |
% fork. |
| 405 |
% |
| 406 |
% \end{syntax} |
| 407 |
% |
| 408 |
% \begin{forestexample}[index={for step,tree,grow',forked edges}] |
| 409 |
% \begin{forest} |
| 410 |
% for tree={grow'=0,draw}, |
| 411 |
% forked edges, |
| 412 |
% [/ |
| 413 |
% [home |
| 414 |
% [saso |
| 415 |
% [Download] |
| 416 |
% [TeX] |
| 417 |
% ] |
| 418 |
% [alja] |
| 419 |
% [joe] |
| 420 |
% ] |
| 421 |
% [usr |
| 422 |
% [bin] |
| 423 |
% [share] |
| 424 |
% ] |
| 425 |
% ] |
| 426 |
% \end{forest} |
| 427 |
% \end{forestexample} |
| 428 |
% |
| 429 |
% See how growth direction based anchors \indexex{anchor>children} and \indexex{anchor>parent} are |
| 430 |
% used in the definition below to easily take care of arbitrary \index{grow} and |
| 431 |
% \index{rotate}. |
| 432 |
% \begin{macrocode} |
| 433 |
\forestset{ |
| 434 |
declare dimen={fork sep}{0.5em}, |
| 435 |
forked edge'/.style={ |
| 436 |
edge={rotate/.option=!parent.grow}, |
| 437 |
edge path'={(!u.parent anchor) -- ++(\forestoption{fork sep},0) |- (.child anchor)}, |
| 438 |
}, |
| 439 |
forked edge/.style={ |
| 440 |
on invalid={fake}{!parent.parent anchor=children}, |
| 441 |
child anchor=parent, |
| 442 |
forked edge', |
| 443 |
}, |
| 444 |
forked edges/.style={for nodewalk={#1}{forked edge}}, |
| 445 |
forked edges/.default=tree, |
| 446 |
} |
| 447 |
% \end{macrocode} |
| 448 |
% |
| 449 |
% \begin{syntax} |
| 450 |
% \indexitem{node key>folder} The children of the node are drawn like folders. |
| 451 |
% |
| 452 |
% All growth directions are supported (well, cardinal directions work perfectly; the others await |
| 453 |
% the sensitivity of packing to \index{edge path}), as well as node rotation and \index{reversed} |
| 454 |
% order of children. |
| 455 |
% |
| 456 |
% The outlook of the folder can be influenced by setting standard \foRest;'s options \index{l sep} |
| 457 |
% and \index{s sep} any time before packing, or \index{option>l} and \index{option>s} after |
| 458 |
% packing. Setting \index{option>l} and \index{option>s} before packing will have no influence on |
| 459 |
% the layout of the tree. |
| 460 |
% |
| 461 |
% \begin{syntax} |
| 462 |
% \indexitem(.45em){register>folder indent}|=|\meta{dimen} |
| 463 |
% |
| 464 |
% Specifies the shift of the parent's side of the edge in the \index{forest cs>l}-direction. |
| 465 |
% \end{syntax} |
| 466 |
% |
| 467 |
% \end{syntax} |
| 468 |
% |
| 469 |
% \begin{forestexample}[index={for step,tree,grow',folder}] |
| 470 |
% \begin{forest} |
| 471 |
% for tree={grow'=0,~folder~,draw} |
| 472 |
% [/ |
| 473 |
% [home |
| 474 |
% [saso |
| 475 |
% [Download] |
| 476 |
% [TeX] |
| 477 |
% ] |
| 478 |
% [alja] |
| 479 |
% [joe] |
| 480 |
% ] |
| 481 |
% [usr |
| 482 |
% [bin] |
| 483 |
% [share] |
| 484 |
% ] |
| 485 |
% ] |
| 486 |
% \end{forest} |
| 487 |
% \end{forestexample} |
| 488 |
% \begin{macrocode} |
| 489 |
\forestset{ |
| 490 |
declare dimen register=folder indent, |
| 491 |
folder indent=.45em, |
| 492 |
folder/.style={ |
| 493 |
parent anchor=-children last, |
| 494 |
anchor=parent first, |
| 495 |
calign=child, |
| 496 |
calign primary child=1, |
| 497 |
for children={ |
| 498 |
child anchor=parent, |
| 499 |
anchor=parent first, |
| 500 |
edge={rotate/.option=!parent.grow}, |
| 501 |
edge path'/.expanded={ |
| 502 |
([xshift=\forestregister{folder indent}]!u.parent anchor) |- (.child anchor) |
| 503 |
}, |
| 504 |
}, |
| 505 |
after packing node={ |
| 506 |
if n children=0{}{ |
| 507 |
tempdiml=l_sep()-l("!1"), |
| 508 |
tempdims={-abs(max_s("","")-min_s("",""))-s_sep()}, |
| 509 |
for children={ |
| 510 |
l+=tempdiml, |
| 511 |
s+=tempdims()*(reversed()-0.5)*2, |
| 512 |
}, |
| 513 |
}, |
| 514 |
}, |
| 515 |
} |
| 516 |
} |
| 517 |
% \end{macrocode} |
| 518 |
%\iffalse |
| 519 |
%</edges> |
| 520 |
%\fi |
| 521 |
% \forestset{every index end/.style={}} |
| 522 |
% \endinput |
| 523 |
% Local Variables: |
| 524 |
% mode: doctex |
| 525 |
% TeX-command-default: "sty" |
| 526 |
% fill-column: 100 |
| 527 |
% TeX-master: "forest" |
| 528 |
% End: |