texlive[42648] Master/texmf-dist: prooftrees (6dec16)

commits+karl at tug.org commits+karl at tug.org
Tue Dec 6 23:58:45 CET 2016


Revision: 42648
          http://tug.org/svn/texlive?view=revision&revision=42648
Author:   karl
Date:     2016-12-06 23:58:45 +0100 (Tue, 06 Dec 2016)
Log Message:
-----------
prooftrees (6dec16)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/prooftrees/README
    trunk/Master/texmf-dist/doc/latex/prooftrees/prooftrees.pdf
    trunk/Master/texmf-dist/doc/latex/prooftrees/prooftrees.tex
    trunk/Master/texmf-dist/doc/latex/prooftrees/prooftrees_biber.bib
    trunk/Master/texmf-dist/tex/latex/prooftrees/prooftrees.sty

Modified: trunk/Master/texmf-dist/doc/latex/prooftrees/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/prooftrees/README	2016-12-06 22:29:46 UTC (rev 42647)
+++ trunk/Master/texmf-dist/doc/latex/prooftrees/README	2016-12-06 22:58:45 UTC (rev 42648)
@@ -34,6 +34,6 @@
 
 Clea F. Rees
 ReesC21 <at> cardiff <dot> ac <dot> uk
-2016/12/05
+2016/12/06
 
 vim: set nospell: 

Modified: trunk/Master/texmf-dist/doc/latex/prooftrees/prooftrees.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/prooftrees/prooftrees.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/prooftrees/prooftrees.tex	2016-12-06 22:29:46 UTC (rev 42647)
+++ trunk/Master/texmf-dist/doc/latex/prooftrees/prooftrees.tex	2016-12-06 22:58:45 UTC (rev 42648)
@@ -20,7 +20,7 @@
 %%
 \pdfminorversion=7
 \RequirePackage{svn-prov}
-\ProvidesFileSVN{$Id: prooftrees.tex 5567 2016-12-05 03:44:11Z cfrees $}[v0.41 pgfmath branch \revinfo]
+\ProvidesFileSVN{$Id: prooftrees.tex 5576 2016-12-06 03:28:22Z cfrees $}[v0.5 \revinfo]
 \GetFileInfoSVN*
 \let\prooftreesdocversion\fileversion
 \let\prooftreesdocbase\filebase
@@ -434,7 +434,7 @@
 \end{figure}
 
 \emph{\bfseries Note that this package requires version 2.1 (2016/12/04) of \pkg{forest} \autocite{saso-forest-manual}.
-  It will not work with versions prior to 2 and some features will not work correctly with versions prior to 2.1.}
+  It will not work with versions prior to 2.1.}
 \bigskip
 
 \emph{I would like to thank \citeauthor{saso-forest-manual} both for developing \pkg{forest} and for considerable patience in answering my questions, addressing my confusions and correcting my mistakes.
@@ -455,7 +455,7 @@
 \]
 
 We start by typesetting the tree using \pkg{forest}'s default settings (\cref{fordefaults}) and find our solution has several advantages: the proof is specified concisely and the code reflects the structure of the tree.
-\begin{codcoeden}[label=fordefaults,floatplacement=tbp]{\pkg{forest}: default settings}
+\begin{codcoeden}[label=fordefaults,floatplacement=bp!]{\pkg{forest}: default settings}
 \begin{forest}
   [$P \vee (Q \vee \lnot R)$
     [$P \lif \lnot R$
@@ -522,7 +522,7 @@
 The package is \emph{\bfseries not} intended for the typesetting of proof trees which differ significantly in structure.
 \clearpage
 \thispagestyle{plain}%
-\begin{coeden}[label=sample, grow to left by=3em, grow to right by=3em]{\pkg{prooftrees}: sample output}
+\begin{coeden}[label=sample, floatplacement={!bp}, grow to left by=3em, grow to right by=3em]{\pkg{prooftrees}: sample output}
   \centering
   \begin{prooftree}
     {
@@ -1862,6 +1862,14 @@
 \section{Version History}\label{sec:hanes}
 % BEGIN sec:hanes
 
+\subsection*{0.5}\label{subsec:v0.5}
+% BEGIN subsec:v0.5
+
+Significant re-implementation leveraging the new argument processing facilities in \pkg{forest} 2.1.
+This significantly improves performance as the code is executed much faster than the previous \pkg{pgfmath} implementation.
+
+% END subsec:v0.5
+
 \subsection*{0.41}\label{subsec:v0.41}
 % BEGIN subsec:v0.41
 

Modified: trunk/Master/texmf-dist/doc/latex/prooftrees/prooftrees_biber.bib
===================================================================
--- trunk/Master/texmf-dist/doc/latex/prooftrees/prooftrees_biber.bib	2016-12-06 22:29:46 UTC (rev 42647)
+++ trunk/Master/texmf-dist/doc/latex/prooftrees/prooftrees_biber.bib	2016-12-06 22:58:45 UTC (rev 42648)
@@ -1,27 +1,27 @@
 @BOOK{hodges-logic,
   AUTHOR = {Hodges, Wilfred},
+  ISBN = {0140136363},
   PUBLISHER = {Penguin},
+  TITLE = {Logic: An Introduction to Elementary Logic},
   YEAR = {1977, 1991},
-  ISBN = {0140136363},
-  TITLE = {Logic: An Introduction to Elementary Logic},
 }
 
 @MANUAL{saso-forest-manual,
   AUTHOR = {Živanović, Sašo},
-  URL = {http://spj.ff.uni-lj.si/zivanovic/},
   DATE = {2016-03-04},
   EDITION = {2.0.2},
-  KEYWORDS = {TeX,LaTeX,PGF,TikZ,Forest},
+  KEYWORDS = {TeX, LaTeX, PGF, TikZ, Forest},
   TITLE = {Forest: A {PGF}/Ti\mkbibemph{k}{Z}-Based Package for Drawing Linguistic Trees},
+  URL = {http://spj.ff.uni-lj.si/zivanovic/},
 }
 
 @MANUAL{tantau-tikz-pgf-manual,
   AUTHOR = {Tantau, Till},
-  URL = {http://sourceforge.net/projects/pgf},
   DATE = {2015-08-29},
   EDITION = {3.0.1a},
-  KEYWORDS = {TeX,LaTeX,PGF,TikZ},
+  KEYWORDS = {TeX, LaTeX, PGF, TikZ},
   SUBTITLE = {Manual for Version 3.0.1a},
   TITLE = {The {T}i\mkbibemph{k}{Z} and {PGF} Packages},
+  URL = {http://sourceforge.net/projects/pgf},
 }
 

Modified: trunk/Master/texmf-dist/tex/latex/prooftrees/prooftrees.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/prooftrees/prooftrees.sty	2016-12-06 22:29:46 UTC (rev 42647)
+++ trunk/Master/texmf-dist/tex/latex/prooftrees/prooftrees.sty	2016-12-06 22:58:45 UTC (rev 42648)
@@ -16,7 +16,7 @@
 %%
 \NeedsTeXFormat{LaTeX2e}
 \RequirePackage{svn-prov}
-\ProvidesPackageSVN{$Id: prooftrees.sty 5566 2016-12-05 03:40:05Z cfrees $}[v0.41 pgfmath branch \revinfo]
+\ProvidesPackageSVN{$Id: prooftrees.sty 5575 2016-12-06 01:30:03Z cfrees $}[v0.5 \revinfo]
 \DeclareOption*{\PassOptionsToPackage{\CurrentOption}{forest}}
 \ProcessOptions
 \RequirePackage{forest}[2016/12/04]
@@ -101,9 +101,7 @@
   declare boolean={proof tree rhifo}{1},
   declare boolean={proof tree arweinydd}{0},
   declare autowrapped toks={just}{},
-  declare toks={proof tree jrefs}{},
   declare toks={proof tree rhestr rhifau llinellau}{},
-  declare toks={proof tree crefs}{},
   declare toks={proof tree close}{},
   declare toks={proof tree rhestr rhifau llinellau cau}{},
   declare autowrapped toks={just options}{},
@@ -115,28 +113,34 @@
   declare count={proof tree cadw toing by}{0},
   declare count={proof tree toooing}{0},
   declare count={proof tree proof line no}{0},
+  % keylists for internal storage
+  declare keylist={proof tree jrefs}{},
+  declare keylist={proof tree crefs}{},
+  % keylists for use in stages
   declare keylist={proof tree ffurf}{},
   declare keylist={proof tree symud awto}{},
   declare keylist={proof tree creu nodiadau}{},
   declare keylist={proof tree nodiadau}{},
+  % > not documented yet, I think
+  % > now indicates use of process when it is the first token, preceding a list of instructions as opposed to pgfmath stuff
   define long step={proof tree symud}{}{%
-    r,sort by={level,(n_children()>1)},sort'=descendants
+    root,sort by={>{O}{level},>{_O<}{1}{n children}},sort'=descendants
   },
   define long step={proof tree cywiro symud}{}{%
-    r,if line numbering={2}{1},sort by={level,(n_children()>1)},sort'=descendants
+    root,if line numbering={n=2}{n=1},sort by={>{O}{level},>{_O<}{1}{n children}},sort'=descendants
   },
-  define long step={proof tree camau}{}{% from saso's code (forest2-saso-ptsz.tex)
-    r, sort by={y,(proof_tree_phantom()==0),-x()}, sort'=descendants
+  define long step={proof tree camau}{}{% updated version of defn. from saso's code (forest2-saso-ptsz.tex) & http://chat.stackexchange.com/transcript/message/28321501#28321501
+    root,sort by={>{O}{y},>{Ow1+d}{x}{-##1}},sort'={filter={descendants}{>{OO!&}{proof tree rhifo}{proof tree phantom}}}% angen +d - gweler http://chat.stackexchange.com/transcript/message/28607212#28607212
   },
   define long step={proof tree wffs}{}{% coeden brif yn unig ar ôl i greu nodiadau
-    fake=r,if line numbering={2}{1},tree
+    fake=root,if line numbering={n=2}{n=1},tree
   },
   checked/.style={% mark discharge with optional name substituted into existential
     delay={%
       if check right={%
-        content/.wrap value={##1\ \forestregister{check with}#1},
+        content+'={\ \forestregister{check with}#1},
       }{%
-        content/.wrap value={\forestregister{check with}#1\ ##1},
+        +content'={\forestregister{check with}#1\ },
       },
     },
   },
@@ -143,14 +147,16 @@
   subs/.style={% mark substitution of name into universal
     delay={%
       if subs right={%
-        content/.wrap value={##1\ \forestregister{subs with}#1},
+        content+'={\ \forestregister{subs with}#1},
       }{%
-        content/.wrap value={\forestregister{subs with}#1\ ##1},
+        +content'={\forestregister{subs with}#1\ },
       },
     },
   },
   close/.style={% this now uses nodes rather than a label to accommodate annotations; closing must be done before packing the tree to ensure that sufficient space is allowed for the symbol and any following annotation; the annotations must be processed before anything is moved to ensure that the correct line numbers are used later, even if the references are given as relative node names
-    if={strequal("#1","")}{}{%
+    if={%
+      >{__=}{#1}{}%
+    }{}{%
       temptoksb={},
       temptoksa={#1},
       split register={temptoksa}{:}{proof tree close,temptoksb},
@@ -173,7 +179,14 @@
               },
             },
           },
-          if={strequal("#1","")}{}{% don't create a second node if there's no annotation
+          before drawing tree={%
+            if={>{RR|}{line numbering}{justifications}}{%
+              proof tree proof line no/.option=!parent.proof tree proof line no,
+            }{},
+          },
+          if={%
+            >{__=}{#1}{}%
+          }{}{% don't create a second node if there's no annotation
             delay={%
               append={% this node holds the annotation, possibly including cross-references which will be relative to the node's grandparent
                 [,
@@ -182,16 +195,23 @@
                   grouped,
                   no edge,
                   process keylist register=close format,
-                  if={strequal(proof_tree_close("!uu"),"")}{}{content/.wrap pgfmath arg={##1}{proof_tree_close("!uu")}},
-                  proof tree crefs/.wrap pgfmath arg={##1}{proof_tree_crefs("!uu")},
+                  if={%
+                    >{O_=}{!parent,parent.proof tree close}{}%
+                  }{}{content/.option=!{parent,parent}.proof tree close},
+                  proof tree crefs/.option=!{parent,parent}.proof tree crefs,
                   delay={%
-                    !uu.proof tree crefs={},
+                    !{parent,parent}.proof tree crefs'={},
                   },
-                ]
+                  before drawing tree={%
+                    if={>{RR|}{line numbering}{justifications}}{%
+                      proof tree proof line no/.option=!{parent,parent}.proof tree proof line no,
+                    }{},
+                  },
+                ]%
               },
             },
           },
-        ]
+        ]%
       },
     },
   },
@@ -204,13 +224,11 @@
     process keylist register=line no format,
     delay={%
       proof tree lcount'+=1,
-      tempcounta=int((proof_tree_lcount)+(line_no_shift)),
-      content/.wrap pgfmath arg={\linenumberstyle{##1}}{tempcounta},% content i.e. the line number
+      tempcounta/.process={RRw2+n}{proof tree lcount}{line no shift}{##1+##2},
+      content/.process={Rw1}{tempcounta}{\linenumberstyle{##1}},% content i.e. the line number
       name/.expanded={line no \foresteregister{tempcounta}},% name them so they can be moved later
-%       content/.expanded/.wrap pgfmath arg={\linenumberstyle{##1}}{int(proof_tree_lcount+line_no_shift)},% content i.e. the line number
-%       name/.expanded={line no \foresteregister{proof tree lcount}},% name them so they can be moved later
       typeset node,
-      if={proof_tree_lcount>2}{% the initial location of most line numbers is incorrect and they must be moved
+      if proof tree lcount>=3{% the initial location of most line numbers is incorrect and they must be moved
         for previous={% move the line number below the previous line number
           append/.expanded={line no \foresteregister{tempcounta}}
         },
@@ -225,12 +243,12 @@
     process keylist register=just format,
     delay={%
       proof tree jcount'+=1,
-      tempcounta=int((proof_tree_jcount)+(line_no_shift)),
+      tempcounta/.process={RRw2+n}{proof tree jcount}{line no shift}{##1+##2},
       name/.expanded={just \foresteregister{tempcounta}},% name them so they can be moved
       typeset node,% angen i osgoi broblemau 'da highlight just/line etc.
-      if={proof_tree_jcount>2}{% correct the location as for the line numbers (cf. line no style)
+      if proof tree jcount>=3{% correct the location as for the line numbers (cf. line no style)
         for previous={%
-          append/.expanded={just \foresteregister{tempcounta}}
+          append/.expanded={just \foresteregister{tempcounta}},
         },
       }{},
     },
@@ -244,7 +262,7 @@
         content={#1},
         phantom=false,
         baseline,
-        anchor=base west,
+        if line numbering={anchor=base west}{anchor=base},
         process keylist register=proof statement format
       },
       before computing xy={%
@@ -293,11 +311,13 @@
         }{},
       },
       proof tree creu nodiadau={% this is processed after computing xy
-        if={((line_numbering)==1) || ((justifications)==1)}{% count proof lines if necessary
+        if={>{RR|}{line numbering}{justifications}}{% count proof lines if necessary
           proof tree rhif lefelau'/.register=line no shift,
           for proof tree camau={%
-            if={((proof_tree_rhifo()==1)&&(proof_tree_phantom()==0))&&(level()>0)}{%
-              if={y()<y("!back")}{%
+            if level>=1{%
+              if={%
+                >{OO<}{y}{!back.y}%
+              }{%
                 proof tree rhif lefelau'+=1,
                 proof tree proof line no'/.register=proof tree rhif lefelau,
               }{%
@@ -307,7 +327,7 @@
           },
         }{},
         if line numbering={% get the x position of line numbers and adjust the location and alignment of the proof statement
-          proof tree line no x/.min={x()+min_x()}{fake=r,descendants},
+          proof tree line no x/.min={>{OOw2+d}{x}{min x}{##1+##2}}{fake=root,descendants},
           proof tree line no x-/.register=line no width,
           proof tree line no x-/.register=line no sep,
           for root={%
@@ -321,25 +341,25 @@
               % () to group are required here - otherwise, the -1 (or -2 or whatever) is silently ignored
               repeat={((proof_tree_rhif_lefelau)-1)-(line_no_shift)}{% most are created in the wrong place but proof tree line no moves them later
                 delay n={proof_tree_lcount}{
-                  append={[, proof tree line no]}
+                  append={[, proof tree line no]},
                 },
               },
-            ]
+            ]%
           },
         }{},
         if justifications={% get the x position of justifications and create the nodes which will hold the justification content, if required
-          proof tree justification x/.max={x()+max_x()}{fake=r,descendants},
+          proof tree justification x/.max={>{OOw2+d}{x}{max x}{##1+##2}}{fake=root,descendants},
           proof tree justification x+/.register=just sep,
           append={%
             [,
               proof tree line justification,
               repeat={((proof_tree_rhif_lefelau)-1)-(line_no_shift)}{% most are created in the wrong place but proof tree line justification moves them later
-                delay n={proof_tree_jcount}{
-                  append={[, proof tree line justification]}
+                delay n={proof_tree_jcount}{%
+                  append={[, proof tree line justification]},
                 },
-              }
-            ]
-          }
+              }%
+            ]%
+          },
         }{},
       },
     }{%
@@ -347,7 +367,7 @@
         if single branches={}{% automatically group lines if not using single branches
           if n children=1{%
             for children={%
-              grouped
+              grouped,
             },
           }{},
         },
@@ -360,16 +380,22 @@
     },
     proof tree ffurf={% processed before proof tree symud auto: adjusts the alignment of lines when some levels of the tree are grouped together either whenever the number of children is only 1 or by applying the grouped style to particular nodes when specifying the tree
       if single branches={%
-        where={((grouped()==0)&&(level()>2))&&(proof_tree_rhifo==1)}{%
-          if={(n_children("!u")==1)&&(n_children("!uu")>1)}{%
+        where={%
+          >{O! _O< O &&}{grouped}{2}{level}{proof tree rhifo}%
+        }{%
+          if={%
+           >{_O= _O< &}{1}{!parent.n children}{1}{!parent,parent.n children}%
+          }{%
             not tempboola,
-            for root/.wrap pgfmath arg={%
+            for root/.process={Ow1}{level}{%
               for level={##1}{%
-                if={(n_children("!u")>1)&&(n==1)}{%
+                if={%
+                 >{_O< _O= &}{1}{!parent.n children}{1}{n}%
+                }{%
                   tempboola,
                 }{},
               },
-            }{level()},
+            },
             if tempboola={%
               proof tree toing,
             }{},
@@ -376,39 +402,47 @@
           }{},
         }{},
       }{},
-      where={(grouped()&&(level()>1))&&(proof_tree_rhifo==1)}{% this searches for certain kinds of structural asymmetry in the tree and attempts to move lines appropriately in such cases - the algorithm is intended to be relatively conservative (not in the sense of 'cautious' or 'safe' but in the sense of 'reflection of the overlapping consensus of reasonable users' / 'what would be rationally agreed behind the prooftrees veil of ignorance'; apologies for the inconvenience if you are an unreasonable user)
+      where={%
+       >{O _O< O &&}{grouped}{1}{level}{proof tree rhifo}%
+      }{% this searches for certain kinds of structural asymmetry in the tree and attempts to move lines appropriately in such cases - the algorithm is intended to be relatively conservative (not in the sense of 'cautious' or 'safe' but in the sense of 'reflection of the overlapping consensus of reasonable users' / 'what would be rationally agreed behind the prooftrees veil of ignorance'; apologies for the inconvenience if you are an unreasonable user)
         not tempboola,
-        for root/.wrap pgfmath arg={%
+        for root/.process={Ow1}{level}{%
           for level={##1}{%
-            if={(n_children("!u")>1)&&(n==1)}{%
+            if={%
+             >{_O< _O= &}{1}{!parent.n children}{1}{n}%
+            }{%
               tempboola,
             }{},
           },
-        }{level()},% Sašo:  http://chat.stackexchange.com/transcript/message/27874731#27874731, see also http://chat.stackexchange.com/transcript/message/27874722#27874722
+        },% Sašo:  http://chat.stackexchange.com/transcript/message/27874731#27874731, see also http://chat.stackexchange.com/transcript/message/27874722#27874722
         if tempboola={%
           if n children=0{%
-            if={(proof_tree_toing("!u")==1)||(proof_tree_toing_with("!u")==1)}{% we're already moving the parent and the child will move with the parent, so we can just mark this and do nothing else
-              proof tree toing with
+            if={>{OO|}{!parent.proof tree toing}{!parent.proof tree toing with}}{% we're already moving the parent and the child will move with the parent, so we can just mark this and do nothing else
+              proof tree toing with,
             }{%
-              for root/.wrap pgfmath arg={% don't move a terminal node even in case of asymmetry: instead, create a separate proof line for terminal nodes on this level which are only children, by moving children with siblings on this level down a proof line, without altering their physical location
+              for root/.process={Ow1}{level}{% don't move a terminal node even in case of asymmetry: instead, create a separate proof line for terminal nodes on this level which are only children, by moving children with siblings on this level down a proof line, without altering their physical location
                 % this makes the tree more compact and stops it looking silly
                 for level={##1}{%
-                  if={(n_children("!u")>1)&&(n==1)}{% this just serves to keep the levels nice for the sub-tree and ensure things align. We need this because we want to skip a level here to allow room for the terminal node in the other branch
+                  if={%
+                   >{_O< _O= &}{1}{!parent.n children}{1}{n}%
+                  }{% this just serves to keep the levels nice for the sub-tree and ensure things align. We need this because we want to skip a level here to allow room for the terminal node in the other branch
                     for parent={%
                       if proof tree rhiant cymysg={}{% we mark the parent to avoid increasing the line number of its descendants more than once
                         proof tree rhiant cymysg,
                         for descendants={%
                           proof tree toing by'+=1,
-                        }
+                        },
                       },
                     },
                   }{},
                 },
-              }{level()},% Sašo:  http://chat.stackexchange.com/transcript/message/27874731#27874731, see also http://chat.stackexchange.com/transcript/message/27874722#27874722
+              },% Sašo:  http://chat.stackexchange.com/transcript/message/27874731#27874731, see also http://chat.stackexchange.com/transcript/message/27874722#27874722
             },
             no edge,
           }{%
-            if={(n_children("!u")==1)&&(n_children("!uu")>1)}{% don't try to move if the node has more than 1 child or the grandparent has no more than that; otherwise, mark the node as one to move - we figure out where to move it later
+            if={%
+             >{_O= _O< &}{1}{!parent.n children}{1}{!parent,parent.n children}%
+            }{% don't try to move if the node has more than 1 child or the grandparent has no more than that; otherwise, mark the node as one to move - we figure out where to move it later
               proof tree toing,
             }{no edge},
           },
@@ -419,11 +453,13 @@
       proof tree aros'=0,
       for proof tree symud={%
         if proof tree toing={% this relies on an experimental feature of forest, which is anffodus
-          for nodewalk={fake=u,fake=s,descendants}{do dynamics},
+          for nodewalk={fake=parent,fake=sibling,descendants}{do dynamics},
           delay n={\foresteregister{proof tree aros}}{%
-            tempcounta/.max={((level()+proof_tree_toing_by())+proof_tree_toooing())*(proof_tree_rhifo())}{us,descendants},
-            if={tempcounta>0}{%
-              if={((tempcounta)+1)>(level()+proof_tree_toing_by())}{%
+            tempcounta/.max={>{OOOOw4+n}{level}{proof tree toing by}{proof tree toooing}{proof tree rhifo}{(##1+##2+##3)*##4}}{parent,sibling,descendants},
+            if tempcounta>=1{%
+              if={%
+               >{Rw1+n OOw2+n >}{tempcounta}{##1+1}{level}{proof tree toing by}{##1+##2}%
+              }{%
                 tempcounta-/.option=level,
                 tempcounta'+=1,
                 move by/.register=tempcounta,
@@ -438,9 +474,9 @@
       where proof tree crefs={}{}{% resolve cross-refs in closures
         split option={proof tree crefs}{,}{proof tree rhif llinell cau},
         if content={}{%
-          content/.wrap pgfmath arg={##1}{proof_tree_rhestr_rhifau_llinellau_cau()},
+          content/.option=proof tree rhestr rhifau llinellau cau,
         }{%
-          content+/.wrap pgfmath arg={\ ##1}{proof_tree_rhestr_rhifau_llinellau_cau()},
+          content+/.process={_O}{\ }{proof tree rhestr rhifau llinellau cau},
         },
         typeset node,
       },
@@ -447,29 +483,28 @@
       if line numbering={% apply highlighting and additional TikZ keys to line numbers; initial alignment of numbers with proof lines
         for proof tree wffs={%
           if highlight line no={%
-            for name/.wrap 3 pgfmath args={{line no ##1}{%
-                node options/.register=highlight format,
-                ##2,
-                y=##3,
-                typeset node,
-              }%
-            }{proof_tree_proof_line_no()}{line_no_options()}{y()},
+            for name/.process={Ow1OOOw3}{proof tree proof line no}{line no ##1}{proof tree proof line no}{line no options}{y}{% from Sašo's anti-pgfmath version - rhaid ddweud proof tree proof line no yn ddwywaith ?! dim yn bosibl i ailddefnyddio'r gyntaf ?!
+              node options/.register=highlight format,
+              ##2,
+              y'=##3,
+              proof tree proof line no'=##1,
+              typeset node,
+            }%
           }{%
             if line no options={}{%
               if proof tree phantom={}{%
-                for name/.wrap 2 pgfmath args={%
-                  {line no ##1}{%
-                    y=##2,
-                  }%
-                }{proof_tree_proof_line_no()}{y()}
+                for name/.process={Ow1OOw2}{proof tree proof line no}{line no ##1}{proof tree proof line no}{y}{%
+                  y'=##2,
+                  proof tree proof line no'=##1,
+                }%
               },
             }{%
-              for name/.wrap 3 pgfmath args={{line no ##1}{%
-                  ##2,
-                  y=##3,
-                  typeset node,
-                }%
-              }{proof_tree_proof_line_no()}{line_no_options()}{y()},
+              for name/.process={Ow1OOOw3}{proof tree proof line no}{line no ##1}{proof tree proof line no}{line no options}{y}{%
+                ##2,
+                y'=##3,
+                proof tree proof line no'=##1,
+                typeset node,
+              }%
             },
           },
         },
@@ -478,51 +513,52 @@
         for proof tree wffs={%
           if just={}{%
             if proof tree phantom={}{%
-              for name/.wrap 2 pgfmath args={%
-                {just ##1}{%
-                  y=##2,
-                }%
-              }{proof_tree_proof_line_no()}{y()}
+              for name/.process={Ow1OOw2}{proof tree proof line no}{just ##1}{proof tree proof line no}{y}{% from Sašo's anti-pgfmath version - rhaid ddweud proof tree proof line no yn ddwywaith ?! dim yn bosibl i ailddefnyddio'r gyntaf ?!
+                y'=##2,
+                proof tree proof line no'=##1,
+              }%
             },
           }{% puts the content of the justifications into the empty justification nodes on the right; because this is done late, the nodes need to be typeset again
             if proof tree jrefs={}{}{% resolve cross-refs in justifications
               split option={proof tree jrefs}{,}{proof tree rhif llinell},
               if just refs left={%
-                +just/.wrap pgfmath arg={##1\ }{proof_tree_rhestr_rhifau_llinellau()},
+                +just/.process={O_}{proof tree rhestr rhifau llinellau}{\ },
               }{%
-                just+/.wrap pgfmath arg={\ ##1}{proof_tree_rhestr_rhifau_llinellau()},
+                just+/.process={_O}{\ }{proof tree rhestr rhifau llinellau},
               },
             },
             if highlight just={% apply highlighting and additional TikZ keys to justifications, set content and merge any conflicting specifications, warning user if appropriate
-              for name/.wrap 4 pgfmath args={%
-                {just ##1}{%
-                  if={(strequal(content(),""))||(strequal(content(),"##2"))}{%
-                    content={##2},
-                  }{%
-                    content/.wrap value={########1\foresteregister{merge delimiter}##2},
-                    TeX={\PackageWarning{prooftrees}{Merging conflicting justifications for line ##1! Please examine the output carefully and use "move by" to move lines later in the proof if required. Details of how to do this are included in the documentation.}},
-                  },
-                  node options/.register=highlight format,
-                  ##3,
-                  y=##4,
-                  typeset node,
-                }% do NOT put a comma here!
-              }{proof_tree_proof_line_no()}{just()}{just_options()}{y()},
+              for name/.process={Ow1OOOOw4}{proof tree proof line no}{just ##1}{proof tree proof line no}{just}{just options}{y}{% from Sašo's anti-pgfmath version - rhaid ddweud proof tree proof line no yn ddwywaith ?! dim yn bosibl i ailddefnyddio'r gyntaf ?!
+                if={%
+                 >{O_= O_= |}{content}{}{content}{##2}%
+                }{% gweler isod - o gôd Sašo
+                  content={##2},
+                }{%
+                  content+'={\foresteregister{merge delimiter}##2},
+                  TeX={\PackageWarning{prooftrees}{Merging conflicting justifications for line ##1! Please examine the output carefully and use "move by" to move lines later in the proof if required. Details of how to do this are included in the documentation.}},
+                },
+                node options/.register=highlight format,
+                ##3,
+                y'=##4,
+                proof tree proof line no'=##1,
+                typeset node,
+              }% do NOT put a comma here!
             }{%
-              for name/.wrap 4 pgfmath args={%
-                {just ##1}{%
-                  if={(strequal(content(),""))||(strequal(content(),"##2"))}{%
-                    content={##2},
-                  }{%
-                    content/.wrap value={########1\foresteregister{merge delimiter}##2},
-                    TeX={\PackageWarning{prooftrees}{Merging conflicting justifications for line ##1! Please examine the output carefully and use "move by" to move lines later in the proof if required. Details of how to do this are included in the documentation.}},
-                  },
-                  ##3,
-                  y=##4,
-                  typeset node,
-                }% do NOT put a comma here!
-              }{proof_tree_proof_line_no()}{just()}{just_options()}{y()},
-            },
+              for name/.process={Ow1OOOOw4}{proof tree proof line no}{just ##1}{proof tree proof line no}{just}{just options}{y}{% from Sašo's anti-pgfmath version - rhaid ddweud proof tree proof line no yn ddwywaith ?! dim yn bosibl i ailddefnyddio'r gyntaf ?!
+                if={% from Sašo's anti-pgfmath version - I appreciate this is faster, but why is it *required*?!
+                 >{O_= O_= |}{content}{}{content}{##2}%
+                }{%
+                  content={##2},
+                }{%
+                  content+'={\foresteregister{merge delimiter}##2},
+                  TeX={\PackageWarning{prooftrees}{Merging conflicting justifications for line ##1! Please examine the output carefully and use "move by" to move lines later in the proof if required. Details of how to do this are included in the documentation.}},
+                },
+                ##3,
+                y'=##4,
+                proof tree proof line no'=##1,
+                typeset node,
+              }% do NOT put a comma here!
+            }
           },
         },
       }{},
@@ -529,22 +565,16 @@
       for proof tree wffs={% apply highlighting and TikZ keys which are specified for whole proof lines to all applicable wffs
         if proof tree phantom={}{%
           if highlight line={%
-            for proof tree wffs/.wrap 2 pgfmath args={%
-              if proof tree proof line no={%
-                {##1}{%
-                  node options/.register=highlight format,
-                  ##2,
-                }{}%
-              },
-            }{proof_tree_proof_line_no()}{line_options()},
+            for proof tree wffs/.process={OOw2}{proof tree proof line no}{line options}{%
+              if proof tree proof line no={##1}{%
+                node options/.register=highlight format,
+                ##2,
+              }{}%
+            },
           }{%
-            for proof tree wffs/.wrap 2 pgfmath args={%
-              if proof tree proof line no={%
-                {##1}{%
-                  ##2,
-                }{}%
-              },
-            }{proof_tree_proof_line_no()}{line_options()}
+            for proof tree wffs/.process={OOw2}{proof tree proof line no}{line options}{%
+              if proof tree proof line no={##1}{##2}{},
+            },
           },
           delay={typeset node},
         },
@@ -552,42 +582,40 @@
     },
     before packing={% initial alignment so we don't get proof line numbers incrementing due to varying height/depth of nodes, for example - when single branches is true and few nodes are grouped, this is also a reasonable first approximation
       for tree={%
-        tier/.wrap pgfmath arg={tier ##1}{level()+proof_tree_toing_by()},
+        tier/.process={OOw2+nw1}{level}{proof tree toing by}{##1+##2}{tier ##1},
       },
       for root={% if there's no proof statement, adjust the alignment of the proof relative to the surrounding text
         if content={}{%
-          !1.baseline
-        }{}
-      }
+          !{n=1}.baseline,
+        }{},
+      },
     },
     before computing xy={% adjust distance between levels for grouped nodes after tree is packed
       for tree={%
-        if={(grouped==1)&&(level>1)}{l=\baselineskip}{}
+        if={%
+         >{O _O< &}{grouped}{1}{level}%
+        }{l'=\baselineskip}{},
       },
     },
     before drawing tree={% set final alignment for proof lines which have been moved by effectively grouping lead nodes and moving their subtrees accordingly - this requires that each line number and justification be the child of the previous one and that if justifications are used at all, then justifications exist for all proof lines, even if empty
-      if={((line_numbering==1)||(justifications==1))&&(single_branches==0)}{% correct the alignment of move by lines when single branches is false
+      if={>{RR|R!&}{line numbering}{justifications}{single branches}}{% correct the alignment of move by lines when single branches is false - o fersiwn anti-pgfmath Sašo
         tempdimc'=0pt,% track cumulative adjustments to line numbers and justifications
         for proof tree cywiro symud={%
           if proof tree arweinydd={% only examine the lead nodes - their descendants need the same (cumulative) adjustments
             tempdima'/.option=y,
             if line numbering={% if there are line numbers, we use the previous line number's vertical position
-              for name/.wrap pgfmath arg={%
-                {line no ##1}{%
-                  tempdimb'/.option=y,
-                }%
-              }{int(proof_tree_proof_line_no()-1)},
+              for name/.process={Ow1+nw1}{proof tree proof line no}{##1-1}{line no ##1}{% arafach ?
+                tempdimb'/.option=y,
+              }%
             }{% if not, we use the previous justification's vertical position
-              for name/.wrap pgfmath arg={%
-                {just ##1}{%
-                  tempdimb'/.option=y,
-                }%
-              }{int(proof_tree_proof_line_no()-1)},
+              for name/.process={Ow1+nw1}{proof tree proof line no}{##1-1}{just ##1}{% arafach ?
+                tempdimb'/.option=y,
+              }%
             },
             for parent={% the parent (which will be a phantom) gets aligned with the previous line
               y'/.register=tempdimb,
             },
-            if={(tempdimb)<=0}{% adjust so we align this line below the previous one (assuming we're going down)
+            if tempdimb<={0pt}{% adjust so we align this line below the previous one (assuming we're going down)
               tempdimb'-=\baselineskip,
             }{%
               tempdimb'+=\baselineskip,
@@ -598,22 +626,18 @@
             },
             tempdimb'-/.register=tempdimc,% deduct any tracked cumulative adjustments to line numbers and justifications
             if line numbering={% adjust the line numbers, if any
-              for name/.wrap pgfmath arg={%
-                {line no ##1}{%
-                  for tree={%
-                    y'+/.register=tempdimb,
-                  },
-                }%
-              }{proof_tree_proof_line_no()}
+              for name/.process={Ow1}{proof tree proof line no}{line no ##1}{%
+                for tree={%
+                  y'+/.register=tempdimb,
+                },
+              }%
             }{},
             if justifications={% adjust the justifications, if any
-              for name/.wrap pgfmath arg={%
-                {just ##1}{%
-                  for tree={%
-                    y'+/.register=tempdimb,
-                  },
-                }%
-              }{proof_tree_proof_line_no()}
+              for name/.process={Ow1}{proof tree proof line no}{just ##1}{% t. 60 manual 2.1 rc1
+                for tree={%
+                  y'+/.register=tempdimb,
+                },
+              }%
             }{},
             tempdimc'/.register=tempdimb,% add the adjustment just implemented to the tracked cumulative adjustments for line numbers and/or justifications
           }{},
@@ -622,11 +646,15 @@
     },
   },
   move by/.style={% this implements both the automated moves prooftrees finds necessary and any additional moves requested by the user - more accurately, it implements initial moves, which may get corrected later (e.g. to avoid skipping numbers or creating empty proof lines, which we assume aren't wanted)
-    if={#1>0}{% only try to move the node if the target line number exceeds the one i.e. the line number is to be positively incremented
+    if={
+     >{_n<}{0}{#1}%
+    }{% only try to move the node if the target line number exceeds the one i.e. the line number is to be positively incremented
       proof tree cadw toing by/.option=proof tree toing by,
       proof tree arweinydd,
       for tree={%
-        if={#1>1}{% track skipped lines for which we won't be creating phantom nodes
+        if={%
+         >{_n<}{1}{#1}%
+        }{% track skipped lines for which we won't be creating phantom nodes
           proof tree toing by+=#1-2,
           proof tree toooing'+=1,
         }{},
@@ -634,7 +662,9 @@
       delay={%
         replace by={% insert our first phantom
           [,
-            if={#1>1}{%
+            if={%
+             >{_n<}{1}{#1}%
+            }{%
               child anchor=parent,
               parent anchor=parent,
             }{%
@@ -642,10 +672,17 @@
               parent anchor=children,
             },
             proof tree phantom,
-            edge path/.pgfmath={edge_path("!last dynamic node")},% Sašo Živanović: http://chat.stackexchange.com/transcript/message/27990955#27990955
-            edge/.pgfmath={edge("!last dynamic node")},
+            edge path/.option=!last dynamic node.edge path,% Sašo Živanović: http://chat.stackexchange.com/transcript/message/27990955#27990955
+            edge/.option=!last dynamic node.edge,
             append,
-            if={#1>1}{% if we are moving by more than 1, we insert a second phantom so that a node with siblings which is moved a long way will not get a unidirectional edge but an edge which looks similar to others in the tree (by default, sloping down a line or so and then plummeting straight down rather than a sharply-angled steep descent)
+            before drawing tree={%
+              if={>{RR|}{line numbering}{justifications}}{%
+                proof tree proof line no/.process={Ow1+n}{!parent.proof tree proof line no}{##1+1},
+              }{},
+            },
+            if={%
+             >{_n<}{1}{#1}%
+            }{% if we are moving by more than 1, we insert a second phantom so that a node with siblings which is moved a long way will not get a unidirectional edge but an edge which looks similar to others in the tree (by default, sloping down a line or so and then plummeting straight down rather than a sharply-angled steep descent)
               delay={%
                 append={%
                   [,
@@ -653,11 +690,16 @@
                     parent anchor=parent,
                     proof tree toing by=#1-2+proof_tree_cadw_toing_by,
                     proof tree phantom,
-                    edge path/.pgfmath={edge_path("!last dynamic node")},
-                    edge/.pgfmath={edge("!last dynamic node")},
-                    append=!s
-                  ]
-                }
+                    edge path/.option=!last dynamic node.edge path,
+                    edge/.option=!last dynamic node.edge,
+                    before drawing tree={%
+                      if={>{RR|}{line numbering}{justifications}}{%
+                        proof tree proof line no/.process={Ow1+n}{!n=1.proof tree proof line no}{##1-1},
+                      }{},
+                    },
+                    append=!sibling,
+                  ]%
+                },
               },
             }{%
               if single branches={}{%
@@ -668,46 +710,42 @@
                 },
               },
             },
-           ]
+           ]%
         },
       },
     }{%
-      TeX/.wrap pgfmath arg={\PackageWarning{prooftrees}{Line not moved! I can only move things later in the proof. Please see the documentation for details. ##1}}{name()},
+      TeX/.process={Ow1}{name}{\PackageWarning{prooftrees}{Line not moved! I can only move things later in the proof. Please see the documentation for details. ##1}},
     },
   },
   proof tree cref/.style={% get the names of nodes cross-referenced in closure annotations for use later
-    if proof tree crefs={}{}{%
-      proof tree crefs+={,},
-    },
-    proof tree crefs+/.wrap pgfmath arg={##1}{name("#1")},
+    proof tree crefs+/.option=#1.name,
   },
   proof tree rhif llinell cau/.style={% get the proof line numbers of the cross-referenced nodes in closure annotations, using the list of names created earlier
     if proof tree rhestr rhifau llinellau cau={}{}{%
       proof tree rhestr rhifau llinellau cau+={,\,},
     },
-    proof tree rhestr rhifau llinellau cau+/.wrap pgfmath arg={##1}{proof_tree_proof_line_no("#1")},
+    proof tree rhestr rhifau llinellau cau+/.option=#1.proof tree proof line no,
   },
   proof tree jref/.style={% get the names of nodes cross-referenced in justifications for use later
-    if proof tree jrefs={}{}{%
-      proof tree jrefs+={,},
-    },
-    proof tree jrefs+/.wrap pgfmath arg={##1}{name("#1")},
+    proof tree jrefs+/.option=#1.name,
   },
   proof tree rhif llinell/.style={% get the proof line numbers of the cross-referenced nodes in justifications, using the list of names created earlier
     if proof tree rhestr rhifau llinellau={}{}{%
       proof tree rhestr rhifau llinellau+={,\,},
     },
-    proof tree rhestr rhifau llinellau+/.wrap pgfmath arg={##1}{proof_tree_proof_line_no("#1")},
+    proof tree rhestr rhifau llinellau+/.option=#1.proof tree proof line no,% works according to Sašo's anti-pgfmath version
   },
   proof tree dadfygio/.style={% style for use in debugging moves which displays information about nodes in the tree
     before packing={%
       for tree={%
-        label/.wrap 3 pgfmath args={[red,font=\tiny,inner sep=0pt,outer sep=0pt, anchor=south]below:##1/##2/##3}{level()}{proof_tree_toing_by()}{id()},
+        label/.process={OOOw3}{level}{proof tree toing by}{id}{[red,font=\tiny,inner sep=0pt,outer sep=0pt, anchor=south]below:##1/##2/##3},
       },
     },
     before drawing tree={%
       for tree={%
-        tikz+/.wrap pgfmath arg={\node [anchor=west, font=\tiny, text=blue, inner sep=0pt] at (.east) {##1}; }{proof_tree_proof_line_no()},
+        delay={%
+          tikz+/.process={Ow1}{proof tree proof line no}{\node [anchor=west, font=\tiny, text=blue, inner sep=0pt] at (.east) {##1}; },
+        },
       },
     },
   },
@@ -720,7 +758,7 @@
       stages={% customised definition of stages - we don't use any custom stages, but we do use several custom keylists, where the processing order of these is critical
         for root'={% nothing is removed from the standard forest definition - we only change it by adding to it
           process keylist register=default preamble,
-          process keylist register=preamble
+          process keylist register=preamble,
         },
         process keylist=given options,
         process keylist=before typesetting nodes,
@@ -736,12 +774,12 @@
         process keylist=proof tree creu nodiadau,
         process keylist=proof tree nodiadau,
         process keylist=before drawing tree,
-        draw tree stage
+        draw tree stage,
       },
-    )
+    )%
     proof tree,% apply the proof tree style, which sets keylists from both forest's defaults and our custom additions
     #1,% insert user's preamble, empty or otherwise - this allows the user both to override our defaults (e.g. by setting a non-empty proof statement or a custom format for line numbers) and to customise the tree using forest's facilities in the usual way - BUT customisations of the latter kind may or may not be effective, may or may not have undesirable - not to say chaotic - consequences, and may or may not cause compilation failures (structural changes, in particular, should be avoided completely)
-    [, name=proof statement @\prooftreebody]
+    [, name=proof statement @\prooftreebody]%
   \endforest}
 \endinput
 %% end prooftrees.sty



More information about the tex-live-commits mailing list