summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/forest/forest-compat.sty
blob: 4245f10304496c8e16451dfae942a2b0f96b24a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
% \CheckSum{12884}
% \iffalse meta-comment
% forest-index.dtx
%% `forest-compat' defines a compatibility layer of package `forest'.
%%
%% Copyright (c) 2015 Saso Zivanovic
%%                    (Sa\v{s}o \v{Z}ivanovi\'{c})
%% saso.zivanovic@guest.arnes.si
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%% 
%%   http://www.latex-project.org/lppl.txt
%%   
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%% This work has the LPPL maintenance status `author-maintained'.
%% 
%% This file is a part of package `forest'. For the list of files
%% constituting the package see main source file of the package,
%% `forest.dtx', or the derived `forest.sty'.

\ProvidesPackage{forest-compat}

\def\forest@deprecated#1{%
  \PackageWarning{forest}{Compatibility mode for #1}%
}
\forestset{@@deprecated/.code={\forest@deprecated{#1}}}
\def\forestcompat#1{\pgfqkeys{/forest/@compat}{#1}}
\forestcompat{
  silent/.style={\def\forest@deprecated##1{}},
  %%% begin listing region: compat_keys
  most/.style={1.0-most},
  all/.style={1.0-all},
  none/.style={},
  1.0-most/.style={
    1.0-triangle,1.0-linear,1.0-nodewalk,1.0-ancestors,
    1.0-fittotree,1.0-for,1.0-forall
  },
  1.0-all/.style={
    1.0-most,
    1.0-forstep,1.0-rotate,1.0-stages,1.0-name,
    2.0.2-all,
  },
  2.0.2-all/.style={
    2.0.2-delayn,2.0.2-wrapnpgfmathargs,
  },
  %%% end listing region: compat_keys
  1.0-triangle/.style={
    /forest/triangle/.style={
      @@deprecated={key "triangle" from v1.0.x. Use key "roof" from library "linguistics" instead},
      edge path'={%
        (.north west)--(!u.south)--(.north east)--cycle
      }
    }
  },
  1.0-linear/.style={
    /forest/define long step={linear next}{autostep}{%
      \forest@deprecated{nodewalk step "linear next" from v1.0. Use key "next node" instead.}%
      \edef\forest@cn{\forest@node@linearnextid}},
    /forest/define long step={linear previous}{autostep}{%
      \forest@deprecated{nodewalk step "linear previous" from v1.0. Use key "previous node" instead.}%
      \edef\forest@cn{\forest@node@linearpreviousid}},
  },
  1.0-nodewalk/.style={
    /forest/node walk/before walk/.style={},
    /forest/node walk/every step/.style={},
    /forest/node walk/after walk/.style={},
    /forest/node walk/.style={
      @@deprecated={key "node walk" from v1.0. Use key "nodewalk" instead.},
      /forest/node walk/before walk,
      /forest/nodewalk/before walk/.style={/forest/node walk/before walk},
      /forest/nodewalk/every step/.style={/forest/node walk/every step},
      /forest/nodewalk/after walk/.style={/forest/node walk/after walk},
      /forest/nodewalk/node walk/.style={before walk,for nodewalk={####1,options={/forest/nodewalk/after walk}}{/forest/nodewalk/every step}},
      for nodewalk={##1,options={/forest/nodewalk/after walk}}{/forest/nodewalk/every step},
    },
  },
  1.0-ancestors/.style={
    /forest/for ancestors'/.style={
      @@deprecated={key "for ancestors'" from v1.0.x.  Use key "for current and ancestors" instead.},
      for current and ancestors={##1}},
  },
  1.0-fittotree/.style={%
    /tikz/fit to tree/.style={
      /forest/@@deprecated={key "/tikz/fit to tree" from v1.0.x.  Use "/tikz/fit to=tree" instead.},
      inner sep=0pt,fit to=tree
    }
  },
  1.0-for/.style={
    /forest/for/.code 2 args={%  #1 = nodewalk, #2 = after walk keylist
      \forest@deprecated{Key "for" from v1.0.x.  Use key "for group" instead.}%
      \forest@forthis{\forest@nodewalk{##1,options={##2}}{}}%
    }
  },
  1.0-forall/.style={
    /forest/for all next/.style={
      @@deprecated={Key "for all next" from v1.0.x.  Use key "for following siblings" instead.},
      for following siblings={##1}},
    /forest/for all previous/.style={
      @@deprecated={Key "for all previous" from v1.0.x.  Use key "for preceding siblings" instead.},
      for preceding siblings={##1}},
  },
  1.0-forstep/.code={%
    \def\forest@forstepwrapper##1##2{%
      \def\forest@nodewalk@config@everystep@method{independent}%
      \def\forest@nodewalk@config@history@method{independent}%
      \edef\forest@marshal{%
        \def\noexpand\forest@nodewalk@config@oninvalid{compatfake}%
        \unexpanded{\forest@Nodewalk{##1}{##2}}%
        \def\noexpand\forest@cn{\forest@cn}%
        \def\noexpand\forest@nodewalk@config@oninvalid{\forest@nodewalk@config@oninvalid}%
      }\forest@marshal
    }%
    \def\forest@relatednode@option@compat@ignoreinvalidsteps##1{%
      \forest@saveandrestoremacro\forest@nodewalk@oninvalid{%
        \def\forest@nodewalk@oninvalid{compatfake}%
        ##1%
      }%
    }%
  },
  1.0-rotate/.style={
    /forest/undef option=rotate,
    rotate/.style={
      @@deprecate={Using non-autoforwarded key "rotate". Some keys, like "forked edges" and "folder", might produce a wrong result.},
      node options={rotate={##1}},
    },
  },
  1.0-stages/.style={
    /forest/@@deprecated={Using v1.0.x "stages" style},
    /forest/stages/.style={
      process keylist=before typesetting nodes,
      typeset nodes stage,
      process keylist=before packing,
      pack stage,
      process keylist=before computing xy,
      compute xy stage,
      process keylist=before drawing tree,
      draw tree stage,
    },
    /forest/TeX={%
      \def\forest@defstages##1{%
        \def\forest@stages{%
          begin forest,
          for root'={
            process keylist register=default preamble,
            process keylist register=preamble
          },
          process keylist=given options,
          ##1,
          end forest
        }%
      }%
    },
  },
  1.0-name/.code={%
    \forest@deprecated{key "name": using key "name" from v1.0.x, which does not enforce uniqueness. If you really need this, you're doing something wrong.}%
    \def\forest@node@setname##1{%
      \ifstrempty{##1}{}{%
        \forestoeset{name}{##1}%
        \csedef{forest@id@of@##1}{\forest@cn}%
      }%
    }%
    \def\forest@node@setalias##1{%
      \ifstrempty{##1}{}{%
        \csedef{forest@id@of@##1}{\forest@cn}%
      }%
    }%
  },
  2.0.2-delayn/.style={
    /forest/delay@n/.style 2 args={
      @@deprecated={propagator "delay n" (it introduces two levels of hash doubling)},
      if={##1==1}{delay={##2}}{delay={delay@n/.wrap pgfmath arg={{####1}{##2}}{##1-1}}}
    },
  },
  2.0.2-wrapnpgfmathargs/.code={
    \def\forest@wrap@pgfmath@args@@@wrapandpasson{%
      \forest@deprecated{handler "wrap n pgfmath args" (it introduces two levels of hash doubling)}%
      \expandafter\expandafter\expandafter\def
          \expandafter\expandafter\expandafter\forest@wrapped
          \expandafter\expandafter\expandafter{%
            \expandafter\forest@wrap@code\forest@wrap@args}%
      \expandafter\pgfkeysalso\expandafter{\expandafter\pgfkeyscurrentpath\expandafter=\expandafter{\forest@wrapped}}%
    }%
  },
}
\expandafter\forestcompat\expandafter{\forest@compat}