diff options
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/forest/forest.sty | 269 |
1 files changed, 139 insertions, 130 deletions
diff --git a/Master/texmf-dist/tex/latex/forest/forest.sty b/Master/texmf-dist/tex/latex/forest/forest.sty index be4e5c06686..f93ca21cf4a 100644 --- a/Master/texmf-dist/tex/latex/forest/forest.sty +++ b/Master/texmf-dist/tex/latex/forest/forest.sty @@ -29,7 +29,7 @@ %% This work consists of the files forest.dtx and forest.ins %% and the derived file forest.sty. %% -\ProvidesPackage{forest}[2015/07/10 v1.08 Drawing (linguistic) trees] +\ProvidesPackage{forest}[2015/07/15 v1.09 Drawing (linguistic) trees] \RequirePackage{tikz}[2010/10/13] \usetikzlibrary{shapes} @@ -2575,6 +2575,11 @@ \else \pack@sibling@uniform@main{last}{first}{previous}{next}% \fi + \else + \ifnum\forestove{n children}=1 +\typeout{DEBUG calign: \forestove{content} --- \forestove{calign}}% + \csname forest@calign@\forestove{calign}\endcsname + \fi \fi } \def\pack@sibling@uniform@main#1#2#3#4{% @@ -2711,143 +2716,147 @@ \forest@calign@s@shift{\the\dimexpr-\the\pgf@y}% } \csdef{forest@calign@fixed angles}{% - \edef\forest@ca@first@child{\forest@node@nornbarthchildid{\forestove{calign primary child}}}% - \edef\forest@ca@second@child{\forest@node@nornbarthchildid{\forestove{calign secondary child}}}% - \ifnum\forestove{reversed}=1 - \let\forest@temp\forest@ca@first@child - \let\forest@ca@first@child\forest@ca@second@child - \let\forest@ca@second@child\forest@temp - \fi - \forestOget{\forest@ca@first@child}{l}\forest@ca@first@l - \forestOget{\forest@ca@second@child}{l}\forest@ca@second@l - \pgfmathsetlengthmacro\forest@ca@desired@s@distance{% - tan(\forestove{calign secondary angle})*\forest@ca@second@l - -tan(\forestove{calign primary angle})*\forest@ca@first@l - }% - \forestOget{\forest@ca@first@child}{s}\forest@ca@first@s - \forestOget{\forest@ca@second@child}{s}\forest@ca@second@s - \pgfmathsetlengthmacro\forest@ca@actual@s@distance{% - \forest@ca@second@s-\forest@ca@first@s}% - \ifdim\forest@ca@desired@s@distance>\forest@ca@actual@s@distance\relax - \ifdim\forest@ca@actual@s@distance=0pt - \pgfmathsetlength\pgfutil@tempdima{tan(\forestove{calign primary angle})*\forest@ca@second@l}% - \pgfmathsetlength\pgfutil@tempdimb{\forest@ca@desired@s@distance/(\forestove{n children}-1)}% - \forest@node@foreachchild{% - \forestoeset{s}{\the\pgfutil@tempdima}% - \advance\pgfutil@tempdima\pgfutil@tempdimb - }% - \def\forest@calign@anchor{0pt}% - \else - \pgfmathsetmacro\forest@ca@ratio{% - \forest@ca@desired@s@distance/\forest@ca@actual@s@distance}% - \forest@node@foreachchild{% - \pgfmathsetlengthmacro\forest@temp{\forest@ca@ratio*\forestove{s}}% - \forestolet{s}\forest@temp - }% - \pgfmathsetlengthmacro\forest@calign@anchor{% - -tan(\forestove{calign primary angle})*\forest@ca@first@l}% + \ifnum\forestove{n children}>1 + \edef\forest@ca@first@child{\forest@node@nornbarthchildid{\forestove{calign primary child}}}% + \edef\forest@ca@second@child{\forest@node@nornbarthchildid{\forestove{calign secondary child}}}% + \ifnum\forestove{reversed}=1 + \let\forest@temp\forest@ca@first@child + \let\forest@ca@first@child\forest@ca@second@child + \let\forest@ca@second@child\forest@temp \fi - \else - \ifdim\forest@ca@desired@s@distance<\forest@ca@actual@s@distance\relax - \pgfmathsetlengthmacro\forest@ca@ratio{% - \forest@ca@actual@s@distance/\forest@ca@desired@s@distance}% - \forest@node@foreachchild{% - \pgfmathsetlengthmacro\forest@temp{\forest@ca@ratio*\forestove{l}}% - \forestolet{l}\forest@temp - }% - \forestOget{\forest@ca@first@child}{l}\forest@ca@first@l - \pgfmathsetlengthmacro\forest@calign@anchor{% - -tan(\forestove{calign primary angle})*\forest@ca@first@l}% + \forestOget{\forest@ca@first@child}{l}\forest@ca@first@l + \forestOget{\forest@ca@second@child}{l}\forest@ca@second@l + \pgfmathsetlengthmacro\forest@ca@desired@s@distance{% + tan(\forestove{calign secondary angle})*\forest@ca@second@l + -tan(\forestove{calign primary angle})*\forest@ca@first@l + }% + \forestOget{\forest@ca@first@child}{s}\forest@ca@first@s + \forestOget{\forest@ca@second@child}{s}\forest@ca@second@s + \pgfmathsetlengthmacro\forest@ca@actual@s@distance{% + \forest@ca@second@s-\forest@ca@first@s}% + \ifdim\forest@ca@desired@s@distance>\forest@ca@actual@s@distance\relax + \ifdim\forest@ca@actual@s@distance=0pt + \pgfmathsetlength\pgfutil@tempdima{tan(\forestove{calign primary angle})*\forest@ca@second@l}% + \pgfmathsetlength\pgfutil@tempdimb{\forest@ca@desired@s@distance/(\forestove{n children}-1)}% + \forest@node@foreachchild{% + \forestoeset{s}{\the\pgfutil@tempdima}% + \advance\pgfutil@tempdima\pgfutil@tempdimb + }% + \def\forest@calign@anchor{0pt}% + \else + \pgfmathsetmacro\forest@ca@ratio{% + \forest@ca@desired@s@distance/\forest@ca@actual@s@distance}% + \forest@node@foreachchild{% + \pgfmathsetlengthmacro\forest@temp{\forest@ca@ratio*\forestove{s}}% + \forestolet{s}\forest@temp + }% + \pgfmathsetlengthmacro\forest@calign@anchor{% + -tan(\forestove{calign primary angle})*\forest@ca@first@l}% + \fi + \else + \ifdim\forest@ca@desired@s@distance<\forest@ca@actual@s@distance\relax + \pgfmathsetlengthmacro\forest@ca@ratio{% + \forest@ca@actual@s@distance/\forest@ca@desired@s@distance}% + \forest@node@foreachchild{% + \pgfmathsetlengthmacro\forest@temp{\forest@ca@ratio*\forestove{l}}% + \forestolet{l}\forest@temp + }% + \forestOget{\forest@ca@first@child}{l}\forest@ca@first@l + \pgfmathsetlengthmacro\forest@calign@anchor{% + -tan(\forestove{calign primary angle})*\forest@ca@first@l}% + \fi \fi + \forest@calign@s@shift{-\forest@calign@anchor}% \fi - \forest@calign@s@shift{-\forest@calign@anchor}% } \csdef{forest@calign@fixed edge angles}{% - \edef\forest@ca@first@child{\forest@node@nornbarthchildid{\forestove{calign primary child}}}% - \edef\forest@ca@second@child{\forest@node@nornbarthchildid{\forestove{calign secondary child}}}% - \ifnum\forestove{reversed}=1 - \let\forest@temp\forest@ca@first@child - \let\forest@ca@first@child\forest@ca@second@child - \let\forest@ca@second@child\forest@temp - \fi - \forestOget{\forest@ca@first@child}{l}\forest@ca@first@l - \forestOget{\forest@ca@second@child}{l}\forest@ca@second@l - \forestoget{parent@anchor}\forest@ca@parent@anchor - \forest@ca@parent@anchor - \edef\forest@ca@parent@anchor@s{\the\pgf@x}% - \edef\forest@ca@parent@anchor@l{\the\pgf@y}% - \forestOget{\forest@ca@first@child}{child@anchor}\forest@ca@first@child@anchor - \forest@ca@first@child@anchor - \edef\forest@ca@first@child@anchor@s{\the\pgf@x}% - \edef\forest@ca@first@child@anchor@l{\the\pgf@y}% - \forestOget{\forest@ca@second@child}{child@anchor}\forest@ca@second@child@anchor - \forest@ca@second@child@anchor - \edef\forest@ca@second@child@anchor@s{\the\pgf@x}% - \edef\forest@ca@second@child@anchor@l{\the\pgf@y}% - \pgfmathsetlengthmacro\forest@ca@desired@second@edge@s{tan(\forestove{calign secondary angle})*% - (\forest@ca@second@l-\forest@ca@second@child@anchor@l+\forest@ca@parent@anchor@l)}% - \pgfmathsetlengthmacro\forest@ca@desired@first@edge@s{tan(\forestove{calign primary angle})*% - (\forest@ca@first@l-\forest@ca@first@child@anchor@l+\forest@ca@parent@anchor@l)} - \pgfmathsetlengthmacro\forest@ca@desired@s@distance{\forest@ca@desired@second@edge@s-\forest@ca@desired@first@edge@s}% - \forestOget{\forest@ca@first@child}{s}\forest@ca@first@s - \forestOget{\forest@ca@second@child}{s}\forest@ca@second@s - \pgfmathsetlengthmacro\forest@ca@actual@s@distance{% - \forest@ca@second@s+\forest@ca@second@child@anchor@s - -\forest@ca@first@s-\forest@ca@first@child@anchor@s}% - \ifdim\forest@ca@desired@s@distance>\forest@ca@actual@s@distance\relax - \ifdim\forest@ca@actual@s@distance=0pt - \forestoget{n children}\forest@temp@n@children - \forest@node@foreachchild{% - \forestoget{child@anchor}\forest@temp@child@anchor - \forest@temp@child@anchor - \edef\forest@temp@child@anchor@s{\the\pgf@x}% - \pgfmathsetlengthmacro\forest@temp{% - \forest@ca@desired@first@edge@s+(\forestove{n}-1)*\forest@ca@desired@s@distance/(\forest@temp@n@children-1)+\forest@ca@first@child@anchor@s-\forest@temp@child@anchor@s}% - \forestolet{s}\forest@temp - }% - \def\forest@calign@anchor{0pt}% - \else - \pgfmathsetmacro\forest@ca@ratio{% - \forest@ca@desired@s@distance/\forest@ca@actual@s@distance}% - \forest@node@foreachchild{% - \forestoget{child@anchor}\forest@temp@child@anchor - \forest@temp@child@anchor - \edef\forest@temp@child@anchor@s{\the\pgf@x}% - \pgfmathsetlengthmacro\forest@temp{% - \forest@ca@ratio*(% - \forestove{s}-\forest@ca@first@s - +\forest@temp@child@anchor@s-\forest@ca@first@child@anchor@s)% - +\forest@ca@first@s - +\forest@ca@first@child@anchor@s-\forest@temp@child@anchor@s}% - \forestolet{s}\forest@temp - }% - \pgfmathsetlengthmacro\forest@calign@anchor{% - -tan(\forestove{calign primary angle})*(\forest@ca@first@l-\forest@ca@first@child@anchor@l+\forest@ca@parent@anchor@l)% - +\forest@ca@first@child@anchor@s-\forest@ca@parent@anchor@s - }% + \ifnum\forestove{n children}>1 + \edef\forest@ca@first@child{\forest@node@nornbarthchildid{\forestove{calign primary child}}}% + \edef\forest@ca@second@child{\forest@node@nornbarthchildid{\forestove{calign secondary child}}}% + \ifnum\forestove{reversed}=1 + \let\forest@temp\forest@ca@first@child + \let\forest@ca@first@child\forest@ca@second@child + \let\forest@ca@second@child\forest@temp \fi - \else - \ifdim\forest@ca@desired@s@distance<\forest@ca@actual@s@distance\relax - \pgfmathsetlengthmacro\forest@ca@ratio{% - \forest@ca@actual@s@distance/\forest@ca@desired@s@distance}% - \forest@node@foreachchild{% - \forestoget{child@anchor}\forest@temp@child@anchor - \forest@temp@child@anchor - \edef\forest@temp@child@anchor@l{\the\pgf@y}% - \pgfmathsetlengthmacro\forest@temp{% - \forest@ca@ratio*(% - \forestove{l}+\forest@ca@parent@anchor@l-\forest@temp@child@anchor@l) - -\forest@ca@parent@anchor@l+\forest@temp@child@anchor@l}% - \forestolet{l}\forest@temp - }% - \forestOget{\forest@ca@first@child}{l}\forest@ca@first@l - \pgfmathsetlengthmacro\forest@calign@anchor{% - -tan(\forestove{calign primary angle})*(\forest@ca@first@l+\forest@ca@parent@anchor@l-\forest@temp@child@anchor@l)% - +\forest@ca@first@child@anchor@s-\forest@ca@parent@anchor@s - }% + \forestOget{\forest@ca@first@child}{l}\forest@ca@first@l + \forestOget{\forest@ca@second@child}{l}\forest@ca@second@l + \forestoget{parent@anchor}\forest@ca@parent@anchor + \forest@ca@parent@anchor + \edef\forest@ca@parent@anchor@s{\the\pgf@x}% + \edef\forest@ca@parent@anchor@l{\the\pgf@y}% + \forestOget{\forest@ca@first@child}{child@anchor}\forest@ca@first@child@anchor + \forest@ca@first@child@anchor + \edef\forest@ca@first@child@anchor@s{\the\pgf@x}% + \edef\forest@ca@first@child@anchor@l{\the\pgf@y}% + \forestOget{\forest@ca@second@child}{child@anchor}\forest@ca@second@child@anchor + \forest@ca@second@child@anchor + \edef\forest@ca@second@child@anchor@s{\the\pgf@x}% + \edef\forest@ca@second@child@anchor@l{\the\pgf@y}% + \pgfmathsetlengthmacro\forest@ca@desired@second@edge@s{tan(\forestove{calign secondary angle})*% + (\forest@ca@second@l-\forest@ca@second@child@anchor@l+\forest@ca@parent@anchor@l)}% + \pgfmathsetlengthmacro\forest@ca@desired@first@edge@s{tan(\forestove{calign primary angle})*% + (\forest@ca@first@l-\forest@ca@first@child@anchor@l+\forest@ca@parent@anchor@l)} + \pgfmathsetlengthmacro\forest@ca@desired@s@distance{\forest@ca@desired@second@edge@s-\forest@ca@desired@first@edge@s}% + \forestOget{\forest@ca@first@child}{s}\forest@ca@first@s + \forestOget{\forest@ca@second@child}{s}\forest@ca@second@s + \pgfmathsetlengthmacro\forest@ca@actual@s@distance{% + \forest@ca@second@s+\forest@ca@second@child@anchor@s + -\forest@ca@first@s-\forest@ca@first@child@anchor@s}% + \ifdim\forest@ca@desired@s@distance>\forest@ca@actual@s@distance\relax + \ifdim\forest@ca@actual@s@distance=0pt + \forestoget{n children}\forest@temp@n@children + \forest@node@foreachchild{% + \forestoget{child@anchor}\forest@temp@child@anchor + \forest@temp@child@anchor + \edef\forest@temp@child@anchor@s{\the\pgf@x}% + \pgfmathsetlengthmacro\forest@temp{% + \forest@ca@desired@first@edge@s+(\forestove{n}-1)*\forest@ca@desired@s@distance/(\forest@temp@n@children-1)+\forest@ca@first@child@anchor@s-\forest@temp@child@anchor@s}% + \forestolet{s}\forest@temp + }% + \def\forest@calign@anchor{0pt}% + \else + \pgfmathsetmacro\forest@ca@ratio{% + \forest@ca@desired@s@distance/\forest@ca@actual@s@distance}% + \forest@node@foreachchild{% + \forestoget{child@anchor}\forest@temp@child@anchor + \forest@temp@child@anchor + \edef\forest@temp@child@anchor@s{\the\pgf@x}% + \pgfmathsetlengthmacro\forest@temp{% + \forest@ca@ratio*(% + \forestove{s}-\forest@ca@first@s + +\forest@temp@child@anchor@s-\forest@ca@first@child@anchor@s)% + +\forest@ca@first@s + +\forest@ca@first@child@anchor@s-\forest@temp@child@anchor@s}% + \forestolet{s}\forest@temp + }% + \pgfmathsetlengthmacro\forest@calign@anchor{% + -tan(\forestove{calign primary angle})*(\forest@ca@first@l-\forest@ca@first@child@anchor@l+\forest@ca@parent@anchor@l)% + +\forest@ca@first@child@anchor@s-\forest@ca@parent@anchor@s + }% + \fi + \else + \ifdim\forest@ca@desired@s@distance<\forest@ca@actual@s@distance\relax + \pgfmathsetlengthmacro\forest@ca@ratio{% + \forest@ca@actual@s@distance/\forest@ca@desired@s@distance}% + \forest@node@foreachchild{% + \forestoget{child@anchor}\forest@temp@child@anchor + \forest@temp@child@anchor + \edef\forest@temp@child@anchor@l{\the\pgf@y}% + \pgfmathsetlengthmacro\forest@temp{% + \forest@ca@ratio*(% + \forestove{l}+\forest@ca@parent@anchor@l-\forest@temp@child@anchor@l) + -\forest@ca@parent@anchor@l+\forest@temp@child@anchor@l}% + \forestolet{l}\forest@temp + }% + \forestOget{\forest@ca@first@child}{l}\forest@ca@first@l + \pgfmathsetlengthmacro\forest@calign@anchor{% + -tan(\forestove{calign primary angle})*(\forest@ca@first@l+\forest@ca@parent@anchor@l-\forest@temp@child@anchor@l)% + +\forest@ca@first@child@anchor@s-\forest@ca@parent@anchor@s + }% + \fi \fi + \forest@calign@s@shift{-\forest@calign@anchor}% \fi - \forest@calign@s@shift{-\forest@calign@anchor}% } \def\forest@node@getedge#1#2#3{% \forestoget{#1@edge@#2}#3% |