diff options
Diffstat (limited to 'Master/texmf-dist')
294 files changed, 21360 insertions, 22406 deletions
diff --git a/Master/texmf-dist/doc/generic/pgf/ChangeLog b/Master/texmf-dist/doc/generic/pgf/ChangeLog index ee370607121..c304aad27ea 100644 --- a/Master/texmf-dist/doc/generic/pgf/ChangeLog +++ b/Master/texmf-dist/doc/generic/pgf/ChangeLog @@ -1,3449 +1,3321 @@ -2019-04-04 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - - Release 3.1.2! - -2019-04-04 Henri Menke - - - Update README - -2019-04-03 Henri Menke - - - Fix #523 (jkinable) - -2019-04-03 Henri Menke - - - Fix #522 (kpymtzanev) - -2019-04-02 Henri Menke - - - Welcome to GitHub :octocat: - -2019-03-13 Max Snippe - - - Renaming perspective library macros - -2019-03-13 Max Snippe - - - Fixed typo and missing backslash - -2019-03-11 Henri Menke - - - Correct copyright statement - -2019-03-08 Max Snippe - - - Added perspective library - -2019-03-06 Henri Menke - - - Fix TeX conditionals on \pgfmathdeclarefunction (Eric Domenjoud) Feature Request #121 - -2019-02-28 Henri Menke - - - More accurate \pgfpointnormalised #518 #519 Feature #96 - -2019-02-22 Henri Menke - - - tikzmath needs to know about fpu - -2019-02-20 Henri Menke - - - Fix shading angle #516 (Eric Domenjoud) - -2019-02-14 Henri Menke - - - Fix trivial typo #514 - -2019-02-08 Henri Menke - - - Missed ligature suppression for dvisvgm #473 - -2019-02-08 Henri Menke - - - Now I hopefully got all of the ligatures #473 - -2019-02-05 Henri Menke - - - Some fixes for the shading patch #511 (Eric Domenjoud) - -2019-02-05 Henri Menke - - - \long\def - -2019-02-05 Henri Menke - - - Fake \scantokens has to at least strip braces - -2019-02-05 Henri Menke - - - Only use \scantokens if available #508 - -2019-02-04 Henri Menke - - - Revert "Revert "Patch for shadings #511 (Eric Domenjoud)"" - -2019-02-04 Henri Menke - - - Revert "Patch for shadings #511 (Eric Domenjoud)" - -2019-02-04 Henri Menke - - - Making the declared coordinate accessible - -2019-02-04 Henri Menke - - - Globally remember declare coordinate of a node - -2019-02-04 Henri Menke - - - Check for \pgfpointxyz before \rawx, \rawy, \rawz - -2019-02-04 Henri Menke - - - Add \rawx, \rawy, \rawz to let operation - -2019-02-04 Henri Menke - - - Disable strict nesting for now - -2019-02-04 Henri Menke - - - Patch for shadings #511 (Eric Domenjoud) - -2019-02-03 Stefan Pinnow - - - - minor stuff - -2019-02-02 Christian Feuersaenger - - - Merge branch 'master' of ssh://git.code.sf.net/p/pgf/git - -2019-02-02 Christian Feuersaenger - - - Merge branch 'branch_3.1_hotfix' - -2019-02-02 Christian Feuersaenger - - - updated release file - 2019-02-02 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - - Release 3.1.1! + + - Release 3.1.1! 2019-02-01 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - - fixed bug #503: regression prevented the use of dvips. This reverts the - bugfix for bug #362 + + - fixed bug #503: regression prevented the use of dvips. This reverts the + bugfix for bug 362 2019-01-05 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - - Release 3.1! + + - Release 3.1! 2018-12-28 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - \pgfmathprintnumber: implemented 'retain unit mantissa=true|false' (feature #92) + - \pgfmathprintnumber: implemented 'retain unit mantissa=true|false' (feature #92) 2018-12-30 Henri Menke - - fixed wrong projection of `canvas is xy plane at z` in `3d` library (bug #410) - - added documentation of `3d` library to the manual (support request #11) - - defined CMYK colors for ConTeXt (feature request #33) - - `text along path` decoration repeated last char multiple times when - this was in math mode (bug #479) + - fixed wrong projection of `canvas is xy plane at z` in `3d` library (bug #410) + - added documentation of `3d` library to the manual (support request #11) + - defined CMYK colors for ConTeXt (feature request #33) + - `text along path` decoration repeated last char multiple times when + this was in math mode (bug #479) 2018-12-29 Henri Menke - - fixed accidental usage of `\rm` (bug #476) + - fixed accidental usage of `\rm` (bug #476) 2018-12-28 Henri Menke - - fixed newlines for tex4ht (bug #327) - - fixed bug that `fit` didn't work with `transform shape` (bug #330) - - fill color in nodes now respects colormodel (bug #349) - - fixed broken VTeX support (bug #350) - - `text=<color>` now works fine when in the nodes' text `\textcolor` is used (bug #362) + - fixed newlines for tex4ht (bug #327) + - fixed bug that `fit` didn't work with `transform shape` (bug #330) + - fill color in nodes now respects colormodel (bug #349) + - fixed broken VTeX support (bug #350) + - `text=<color>` now works fine when in the nodes' text `\textcolor` is used (bug #362) 2018-12-26 Henri Menke - - allowed whitespace between layers in `\pgfsetlayers` (bug #376) + - allowed whitespace between layers in `\pgfsetlayers` (bug #376) 2018-12-25 Henri Menke - - fixed `\method` which can now contain empty lines (bug #448) - - manual improvement regarding `pgfoothis` (bug #452) - - documented commands `\pgfooeset`, `\pgfooappend`, `\pgfooprefix` (bug #452) + - fixed `\method` which can now contain empty lines (bug #448) + - manual improvement regarding `pgfoothis` (bug #452) + - documented commands `\pgfooeset`, `\pgfooappend`, `\pgfooprefix` (bug #452) 2018-12-24 Henri Menke - - fixed bug in \pgfkeysedef (bug #306) - - `miter limit` now raises an error when a value < 1 is given (bug #347) - - fixed bug that `\pgfmathmax` and `pgfmathmin` were broken when - `fixedpointarithmetic` library was loaded (bug #360) - - added missing function `\pgfmathpneg` in `fixedpointarithmetic` library (bug #361) - - fixed bug that brace decorations were malformed for large amplitudes (bug #351) - - made node parser aware of prefix and suffix (bug #397) + - fixed bug in \pgfkeysedef (bug #306) + - `miter limit` now raises an error when a value < 1 is given (bug #347) + - fixed bug that `\pgfmathmax` and `pgfmathmin` were broken when + `fixedpointarithmetic` library was loaded (bug #360) + - added missing function `\pgfmathpneg` in `fixedpointarithmetic` library (bug #361) + - fixed bug that brace decorations were malformed for large amplitudes (bug #351) + - made node parser aware of prefix and suffix (bug #397) 2018-12-23 Henri Menke - - (almost) fixed guillemets for LuaTeX (bug #473) + - (almost) fixed guillemets for LuaTeX (bug #473) 2018-12-21 Henri Menke - - fixed incorrect spelling in pgflibrarydecorations.text (bug #479) - (but this doesn't solve the bug 100%) - - fixed 'bend left' bug if used with a formula (bug #423) - - use \typeout stream instead of \write16 (bug #488) - - fixed some bugs regarding graphdrawing electrical "springs" (bugs #380 and #381) + - fixed incorrect spelling in pgflibrarydecorations.text (bug #479) + (but this doesn't solve the bug 100%) + - fixed 'bend left' bug if used with a formula (bug #423) + - use \typeout stream instead of \write16 (bug #488) + - fixed some bugs regarding graphdrawing electrical "springs" (bugs #380 and #381) - 2018-12-20 Henri Menke + 2018-12-20 Henri Menke - - fixed pgf_lookup_and_require for new luaotfload (bug #493) - - fixed graphdrawing for ConTeXt (bug #477) + - fixed pgf_lookup_and_require for new luaotfload (bug #493) + - fixed graphdrawing for ConTeXt (bug #477) 2018-04-30 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - added utility \pgfmathifexpression (and special treatment in luamath - library and fpu library) + - added utility \pgfmathifexpression (and special treatment in luamath + library and fpu library) 2017-11-14 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - intersections lib: improved accuracy of intersections for linear paths + - intersections lib: improved accuracy of intersections for linear paths 2017-02-08 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - fixed incompatibility issue of tikzmath and fpu reported in - http://tex.stackexchange.com/questions/349766/pgfplots-on-tikzmath-function-with-conditionals-returns-an-error + - fixed incompatibility issue of tikzmath and fpu reported in + http://tex.stackexchange.com/questions/349766/pgfplots-on-tikzmath-function-with-conditionals-returns-an-error 2016-12-31 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - Improved driver detection (bug #395 TikZ does not create output with LuaTeX 0.95.0) - - New luatex driver now supports fallback to pdftex driver if - luatexversion is older than 95 (let's hope this works reliably - luatex - used to have version 240 some time ago!) + - Improved driver detection (bug #395 TikZ does not create output with LuaTeX 0.95.0) + - New luatex driver now supports fallback to pdftex driver if + luatexversion is older than 95 (let's hope this works reliably - luatex + used to have version 240 some time ago!) 2016-08-10 Till Tantau <tantau@users.sourceforge.net> - - Fixed bugs that caused pgfsys-dvips.def to generate corrupt - PostScript for all nodes. + - Fixed bugs that caused pgfsys-dvips.def to generate corrupt + PostScript for all nodes. 2016-07-16 Till Tantau <tantau@users.sourceforge.net> - - Bounding box computations for animations implemented. - - Animated arrow tips are now possible. + - Bounding box computations for animations implemented. + - Animated arrow tips are now possible. 2016-07-13 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - fixed incompatibility between textpos (absolute mode) and external + - fixed incompatibility between textpos (absolute mode) and external 2016-06-17 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - fixed \write18 issues in luatex 0.87 and later (by using os.execute()) - affects external lib and plot function. + - fixed \write18 issues in luatex 0.87 and later (by using os.execute()) + affects external lib and plot function. 2016-03-31 Till Tantau <tantau@users.sourceforge.net> - - Lots of bugfixes in animation and svg code. - - Added optimizations to reduce file size for svg code - (better support by dvisvgm will be needed however for more - compact text!). + - Lots of bugfixes in animation and svg code. + - Added optimizations to reduce file size for svg code + (better support by dvisvgm will be needed however for more + compact text!). 2016-03-18 Till Tantau <tantau@users.sourceforge.net> - - First working, fully documented version of TikZ animations! + - First working, fully documented version of TikZ animations! 2016-02-24 Till Tantau <tantau@users.sourceforge.net> - - Fixed manual stuff to compile it with dvisvgm. + - Fixed manual stuff to compile it with dvisvgm. 2016-02-02 Till Tantau <tantau@users.sourceforge.net> - - Rewrote tikz animation lib. + - Rewrote tikz animation lib. 2016-01-06 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - added context-related aux file fix of Hans Hagen + - added context-related aux file fix of Hans Hagen 2016-01-02 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - fixed save stack issues (eliminated 'retaining' issues) about pgf@x and pgf@y + - fixed save stack issues (eliminated 'retaining' issues) about pgf@x and pgf@y 2015-12-29 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - external lib: 'force remake' now also updates .md5 files + - external lib: 'force remake' now also updates .md5 files 2015-11-28 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - fpu: fixed floor and ceil - - fixed basic layer floor function - - lua library: improved interoperability of luamath and fpu - - unit test now compares luamath, fpu, and pgfbasic math + - fpu: fixed floor and ceil + - fixed basic layer floor function + - lua library: improved interoperability of luamath and fpu + - unit test now compares luamath, fpu, and pgfbasic math 2015-11-15 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - activated math parser in foreach's end notation to allow \foreach \i in {0,...,10-9} + - activated math parser in foreach's end notation to allow \foreach \i in {0,...,10-9} 2015-09-09 Till Tantau <tantau@users.sourceforge.net> - - Worked on pgfsys-dvisvgm.def a lot. Now requires - dvisvgm-1.5.3 because of switch from pt to bp there. Does - correct bounding box computations. + - Worked on pgfsys-dvisvgm.def a lot. Now requires + dvisvgm-1.5.3 because of switch from pt to bp there. Does + correct bounding box computations. 2015-09-06 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - fixed bug in luamath library + - fixed bug in luamath library 2015-08-29 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - external lib: added support to automatically externalize references and - labels with 'mode=convert with system call' + - external lib: added support to automatically externalize references and + labels with 'mode=convert with system call' 2015-08-24 Till Tantau <tantau@users.sourceforge.net> - - Reworked implementation of animations for tikz and started - on documentation of the backend. + - Reworked implementation of animations for tikz and started + on documentation of the backend. 2015-08-20 Till Tantau <tantau@users.sourceforge.net> - - First complete implementation of animations for tikz! (for - svg backend). Documentation still missing, but works nicely. + - First complete implementation of animations for tikz! (for + svg backend). Documentation still missing, but works nicely. 2015-08-13 Till Tantau <tantau@users.sourceforge.net> - - First work on animations for svg. Added commands in pgfsys - and added module pgfmoduleanimations. No documnetation yet. + - First work on animations for svg. Added commands in pgfsys + and added module pgfmoduleanimations. No documnetation yet. 2015-08-07 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - Release 3.0.1! + - Release 3.0.1! 2015-08-03 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - fixed regression introduced for pgf 3.0.0 (bug #149): leading empty - lines at the beginning of plot files disabled '-- plot' - - fixed bug #291 (missing white space trimming in node labels) - - fixed bug #313 (alias option did not respect name prefix/suffix) - - fixed bug #341 ("is in pic" was not reset) - - fixed bug #365 (caused by missing adoption after copy-paste in tikzlibraryfolding) - - fixed bug #315/316 by applying the suggested patch and verifying it + - fixed regression introduced for pgf 3.0.0 (bug #149): leading empty + lines at the beginning of plot files disabled '-- plot' + - fixed bug #291 (missing white space trimming in node labels) + - fixed bug #313 (alias option did not respect name prefix/suffix) + - fixed bug #341 ("is in pic" was not reset) + - fixed bug #365 (caused by missing adoption after copy-paste in tikzlibraryfolding) + - fixed bug #315/316 by applying the suggested patch and verifying it 2015-06-12 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - fixed fpu math functions for int, ceil, and floor - - added \pgfmathlogtwo and \pgfmathlogten as requested in bug #359 + - fixed fpu math functions for int, ceil, and floor + - added \pgfmathlogtwo and \pgfmathlogten as requested in bug #359 2015-06-06 Till Tantau <tantau@users.sourceforge.net> - - Fixed problem in gd: Creating more than about 15 vertices - inside a graph drawing algorithm was impossible since this - created too many text input levels. Reorganized the interplay - between tex and lua for the coroutine so that no input levels - are created. + - Fixed problem in gd: Creating more than about 15 vertices + inside a graph drawing algorithm was impossible since this + created too many text input levels. Reorganized the interplay + between tex and lua for the coroutine so that no input levels + are created. 2015-06-05 Till Tantau <tantau@users.sourceforge.net> - - Added number nodes option to graph lib. + - Added number nodes option to graph lib. 2015-05-18 Till Tantau <tantau@users.sourceforge.net> - - Fixed nullfont warnings in axes in datavisualization. - - Fixed wrong axes for school book plots. + - Fixed nullfont warnings in axes in datavisualization. + - Fixed wrong axes for school book plots. 2015-05-15 Mark Wibrow <vibrovski@users.sourceforge.net> - - Fixed nullfont warnings when parsing logic gate inputs. + - Fixed nullfont warnings when parsing logic gate inputs. 2015-05-08 Till Tantau <tantau@users.sourceforge.net> - - Fixed bug in tikz.code.tex concerning colors for arrow tips: - Setting and restoring the global color "trackers" - pgf@fillcolor@global over groups was done only in \pgfscope, - but not in the scopes opened and closed by tikz when drawing a - path (\pgfsys@beginscope is used there). This caused wrong - colors to be used. + - Fixed bug in tikz.code.tex concerning colors for arrow tips: + Setting and restoring the global color "trackers" + pgf@fillcolor@global over groups was done only in \pgfscope, + but not in the scopes opened and closed by tikz when drawing a + path (\pgfsys@beginscope is used there). This caused wrong + colors to be used. 2015-05-08 Mark Wibrow <vibrovski@users.sourceforge.net> - - Updated patterns.meta library. + - Updated patterns.meta library. 2015-05-02 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - context: committed patch to adopt pgfutil-context for new (incompatible) - context handling of colors -- contains some cleanup by Hans Hagen. + - context: committed patch to adopt pgfutil-context for new (incompatible) + context handling of colors -- contains some cleanup by Hans Hagen. 2015-03-28 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - fixed bug in external lib: braces in external filenames confused the generator + - fixed bug in external lib: braces in external filenames confused the generator 2015-01-02 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - fixed bug in fpu: equal(x, 0) failed for x<0 + - fixed bug in fpu: equal(x, 0) failed for x<0 2014-12-30 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - fixed bug in atan2 (returned wrong sign for atan2(4e-5,-5)) - - implemented atan2 in FPU + - fixed bug in atan2 (returned wrong sign for atan2(4e-5,-5)) + - implemented atan2 in FPU 2014-11-02 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - fixed save stack issue (TeX capacity exceeded, sorry [save size=250000]) - if the color changes a _huge_ number of times during a single path. + - fixed save stack issue (TeX capacity exceeded, sorry [save size=250000]) + if the color changes a _huge_ number of times during a single path. 2014-10-11 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - worked on LUA math parser: ensured that a suitable first scope of - functions works. I also added support for 'declare function' + - worked on LUA math parser: ensured that a suitable first scope of + functions works. I also added support for 'declare function' 2014-10-11 Mark Wibrow <vibrovski@users.sourceforge.net> - - Added provisional code for patterns.meta library. Patterns + - Added provisional code for patterns.meta library. Patterns can now be declared using TikZ code with additional support for tile transformations. Currently only PDF output supported - at back-end (uses \pgfsys@declarepattern@meta in pgfsys-pdftex.def). + at back-end (uses \pgfsys@declarepattern@meta in pgfsys-pdftex.def). 2014-08-04 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - finished first prototype of a LUA math parser. It is orders of magnitude - faster than its TeX pendant, features a pure LUA mode and also offers a - fallback to the TeX \pgfmathparse for unsupported operations/functions - only defined in TeX. + - finished first prototype of a LUA math parser. It is orders of magnitude + faster than its TeX pendant, features a pure LUA mode and also offers a + fallback to the TeX \pgfmathparse for unsupported operations/functions + only defined in TeX. 2014-07-09 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - fixed bug (regression of bug #229): external lib with dvips produced - wrong bounding box (was broken entirely) + - fixed bug (regression of bug #229): external lib with dvips produced + wrong bounding box (was broken entirely) 2014-07-08 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - fixed regression in external lib: 'mode=graphics if exists' broke any - undefined label warnigns - - added automatic "fast lane" to math parser: if the input is a number - without units, it will return that as-is. Reduces typesetting time down to - 66% for huge scatter plots and has just 1% overhead for math intensive - figures. + - fixed regression in external lib: 'mode=graphics if exists' broke any + undefined label warnigns + - added automatic "fast lane" to math parser: if the input is a number + without units, it will return that as-is. Reduces typesetting time down to + 66% for huge scatter plots and has just 1% overhead for math intensive + figures. 2014-06-22 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - added switch 'trig format=deg|rad' which allows to switch sin,cos,tan, - and their friends to radians. It works for all user input - arguments - I hope without unanticipated side-effects (marked as - experimental) + - added switch 'trig format=deg|rad' which allows to switch sin,cos,tan, + and their friends to radians. It works for all user input + arguments - I hope without unanticipated side-effects (marked as + experimental) 2014-05-17 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - external lib: defined suitable defaults for 'system call' depending on driver - - external lib: solved incompatibility with biblatex's \cite[][]{name} - command (http://tex.stackexchange.com/questions/173465/tikz-error-for-externalized-graphics-but-output-is-correct} - - number parser/printer: added switch 'read comma as period' to read - localized input numbers. Off by default but added useful hint to parser - message. + - external lib: defined suitable defaults for 'system call' depending on driver + - external lib: solved incompatibility with biblatex's \cite[][]{name} + command (http://tex.stackexchange.com/questions/173465/tikz-error-for-externalized-graphics-but-output-is-correct} + - number parser/printer: added switch 'read comma as period' to read + localized input numbers. Off by default but added useful hint to parser + message. 2014-05-06 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - Fixed bug #308 fixedpointarithmetic: unwanted spaces by line ends + - Fixed bug #308 fixedpointarithmetic: unwanted spaces by line ends 2014-03-30 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - Fixed feature #81: signum function (fpu + pgf basic layer) + - Fixed feature #81: signum function (fpu + pgf basic layer) 2014-03-24 Till Tantau <tantau@users.sourceforge.net> - - Fixed all \begin{scope} and \end{scope} in foldings lib, - changed them to \scope and \endscope. + - Fixed all \begin{scope} and \end{scope} in foldings lib, + changed them to \scope and \endscope. 2014-03-21 Till Tantau <tantau@users.sourceforge.net> - - Fixed #303 Type in pgfmanual (colormixin) - - Fixed #302 pgf-3.0: Cannot plot a constant function. Will - now center the constant line. - - Addressed #299 Precision problem with explicitily anchored - labels: While not a bug, I added a "centered" option for cases - similar to this one (although, in this particular case, the - new centered option is not what is needed)... - - Fixed #298 \pgfarrowsdeclare is still mentioned in pgfmanual - - Fixed #294 Nodes for arcs, which angles are calculated - simultaneously. - - Fixed #292 "node scale and outer sep" by introducing the new - option "outer sep=auto", which takes care of both this problem - (at least in all normal cases) and also of the draw versus - fill problem with outer seps. + - Fixed #303 Type in pgfmanual (colormixin) + - Fixed #302 pgf-3.0: Cannot plot a constant function. Will + now center the constant line. + - Addressed #299 Precision problem with explicitily anchored + labels: While not a bug, I added a "centered" option for cases + similar to this one (although, in this particular case, the + new centered option is not what is needed)... + - Fixed #298 \pgfarrowsdeclare is still mentioned in pgfmanual + - Fixed #294 Nodes for arcs, which angles are calculated + simultaneously. + - Fixed #292 "node scale and outer sep" by introducing the new + option "outer sep=auto", which takes care of both this problem + (at least in all normal cases) and also of the draw versus + fill problem with outer seps. 2014-03-20 Till Tantau <tantau@users.sourceforge.net> - - Fixed #285 \tikz@intersect@namedpaths persists outside - scopes as suggested. - - Fixed #284 Additional rerun statement for overlays (for LyX) - by adding the proposed solution (essentially). - - Added post-fix for #288 by undoing all -- ligatures in - verbatim code. + - Fixed #285 \tikz@intersect@namedpaths persists outside + scopes as suggested. + - Fixed #284 Additional rerun statement for overlays (for LyX) + by adding the proposed solution (essentially). + - Added post-fix for #288 by undoing all -- ligatures in + verbatim code. 2014-03-19 Till Tantau <tantau@users.sourceforge.net> - - Fxied #283 "Is there a smarter way to handle units in math - engine?" by adding the "scalar" function. - - Fixed #288 "All the '£' should be '$' in the examples of - pgfmanual..." by switching to T1 enconding. - - Fixed #282 "\pgfmathredeclarefunction does not work properly." + - Fxied #283 "Is there a smarter way to handle units in math + engine?" by adding the "scalar" function. + - Fixed #288 "All the '£' should be '$' in the examples of + pgfmanual..." by switching to T1 enconding. + - Fixed #282 "\pgfmathredeclarefunction does not work properly." 2014-02-24 Till Tantau <tantau@users.sourceforge.net> - - Added first edge routing algorithm to gd. - + - Added first edge routing algorithm to gd. + 2014-02-02 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - - intersections libs: improved robustness and accuracy for curveto paths - by using the floating point library together with Mark Wibrow. + + - intersections libs: improved robustness and accuracy for curveto paths + by using the floating point library together with Mark Wibrow. 2014-01-08 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - fixed bug in latex/plain tex shipout routines for xdvipdfmx and xelatex: - combination of shadings and standalone package failed to work. + - fixed bug in latex/plain tex shipout routines for xdvipdfmx and xelatex: + combination of shadings and standalone package failed to work. 2013-12-31 Mark Wibrow <vibrovski@users.sourceforge.net> - - Fix for 'rotate around x/y/z' keys which now evaluate - the argument provided. - + - Fix for 'rotate around x/y/z' keys which now evaluate + the argument provided. + 2013-12-25 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - intersections lib: detected duplicates in line-to intersections - in endpoints and suppressed them. - - intersections lib: stored time offset for each intersections as optional - property (i.e. if it comes for free). This is required to compute fill - paths + - intersections lib: detected duplicates in line-to intersections + in endpoints and suppressed them. + - intersections lib: stored time offset for each intersections as optional + property (i.e. if it comes for free). This is required to compute fill + paths 2013-12-20 Till Tantau <tantau@users.sourceforge.net> - - Release 3.0.0! + - Release 3.0.0! 2013-12-20 Till Tantau <tantau@users.sourceforge.net> - - In preparation for the release 3.0.0, I pimped the manual a - bit. It will now automatically detect whether graph drawing - C libs are available or not. Also, syntax hilighting is now - always switched on. I also some subtle optical hints to - crossreferenced words in the code examples; this is pretty - useful, I think. - - Did a lot of cleaning up for the release. - + - In preparation for the release 3.0.0, I pimped the manual a + bit. It will now automatically detect whether graph drawing + C libs are available or not. Also, syntax hilighting is now + always switched on. I also some subtle optical hints to + crossreferenced words in the code examples; this is pretty + useful, I think. + - Did a lot of cleaning up for the release. + 2013-12-18 Till Tantau <tantau@users.sourceforge.net> - - Fixed a bug in Vertex.lua that returned wrong anchor - positions for non-centered vertices. - + - Fixed a bug in Vertex.lua that returned wrong anchor + positions for non-centered vertices. + 2013-12-13 Till Tantau <tantau@users.sourceforge.net> - - Fixed bug #280 "Layered layout" produces unknown key with graphs library. - - Fixed bug #279 "Some parts of arguments in foreach macro are lost". - - Fixed bug #258 "Default arrow edge style puts circumflex in - drawn end node" by now allowing people to say tip=on proper draw. - + - Fixed bug #280 "Layered layout" produces unknown key with graphs library. + - Fixed bug #279 "Some parts of arguments in foreach macro are lost". + - Fixed bug #258 "Default arrow edge style puts circumflex in + drawn end node" by now allowing people to say tip=on proper draw. + 2013-12-08 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - intersections lib: ensured that 'name path global' is reset between main paths. + - intersections lib: ensured that 'name path global' is reset between main paths. 2013-11-30 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - worked on intersections lib (internals only); added O(N) list - append/prepend utilities + - worked on intersections lib (internals only); added O(N) list + append/prepend utilities 2013-11-18 Mark Wibrow <vibrovski@users.sourceforge.net> - - Added keys 'rotate around x', 'rotate around y' and - 'rotate around z' to rotate the xyz coordinate system - around the x, y, or z axis. - + - Added keys 'rotate around x', 'rotate around y' and + 'rotate around z' to rotate the xyz coordinate system + around the x, y, or z axis. + 2013-11-17 Mark Wibrow <vibrovski@users.sourceforge.net> - - Fixes for 'text effects along path' decoration and docs. + - Fixes for 'text effects along path' decoration and docs. 2013-11-16 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - external lib: added support for 'up to date check=md5' for lualatex. - Now, lualatex and pdftex both result in the same checksums (by means of - \usepackage{pdftexcmds}) + - external lib: added support for 'up to date check=md5' for lualatex. + Now, lualatex and pdftex both result in the same checksums (by means of + \usepackage{pdftexcmds}) 2013-11-16 Mark Wibrow <vibrovski@users.sourceforge.net> - - Finalised 'text effects along path' decoration and docs. - + - Finalised 'text effects along path' decoration and docs. + 2013-11-11 Mark Wibrow <vibrovski@users.sourceforge.net> - - Changed keyval example (and references to define@key) - in pgfcalendar documentation to pgfkeys stuff. + - Changed keyval example (and references to define@key) + in pgfcalendar documentation to pgfkeys stuff. 2013-11-08 Mark Wibrow <vibrovski@users.sourceforge.net> - - Minor fixes to decorations.text and math libraries documentation - + - Minor fixes to decorations.text and math libraries documentation + 2013-11-07 Mark Wibrow <vibrovski@users.sourceforge.net> - - Added 'text effects along path' decoration. + - Added 'text effects along path' decoration. 2013-11-01 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - Fixed regression/bug in 'name path global'. + - Fixed regression/bug in 'name path global'. 2013-10-31 Till Tantau <tantau@users.sourceforge.net> - - - Applied path for bug #277 "\beforeforegroundpath not working". - + + - Applied path for bug #277 "\beforeforegroundpath not working". + 2013-10-09 Till Tantau <tantau@users.sourceforge.net> - - Prepared manual for new release (fixed overful boxes and - index problems). - + - Prepared manual for new release (fixed overful boxes and + index problems). + 2013-10-08 Mark Wibrow <vibrovski@users.sourceforge.net> - - Updated math library (minor fixes). + - Updated math library (minor fixes). 2013-10-07 Till Tantau <tantau@users.sourceforge.net> - - - Applied some fixes so that C code for graph drawing works - once more. - - Arrow tips and their doc are now officially finished! - - Added documentation of nonlinear transformations. - + + - Applied some fixes so that C code for graph drawing works + once more. + - Arrow tips and their doc are now officially finished! + - Added documentation of nonlinear transformations. + 2013-10-06 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - modified release script to allow uploads of unstable TDS - zips to http://pgf.sourceforge.net using - make -f pgf/scripts/pgf/Makefile.pgf_release upload USER=cfeuersaenger + - modified release script to allow uploads of unstable TDS + zips to http://pgf.sourceforge.net using + make -f pgf/scripts/pgf/Makefile.pgf_release upload USER=cfeuersaenger 2013-10-02 Mark Wibrow <vibrovski@users.sourceforge.net> - - Fixed problem with math parser inserting extraneous - spaces when parsing \dimenexpr - + - Fixed problem with math parser inserting extraneous + spaces when parsing \dimenexpr + 2013-09-30 Till Tantau <tantau@users.sourceforge.net> - - Changed blend mode syntax to standard pgf syntax (since PDF - and SVG do not agree on names...). - - Added scale and slant options for arrow tips. - - Added more generic arrow tips. - + - Changed blend mode syntax to standard pgf syntax (since PDF + and SVG do not agree on names...). + - Added scale and slant options for arrow tips. + - Added more generic arrow tips. + 2013-09-24 Till Tantau <tantau@users.sourceforge.net> - - - First version of comlete arrow documentation finished. Still - need to document the arrows.meta library, though. - - Added "tips" option for drawing arrow tips without drawing - paths. - + + - First version of comlete arrow documentation finished. Still + need to document the arrows.meta library, though. + - Added "tips" option for drawing arrow tips without drawing + paths. + 2013-09-23 Till Tantau <tantau@users.sourceforge.net> - - - Fixed bug #273 "Graph drawing sublayouts fails". - - Incorporated first partial documentation of the arrow tips - into the main documentation. - - Fixed bug bugs:#272 "SVG parser error after close path" as - suggested by Mark Wibrow. - - Also changed the default syntax for svg path command so that - it uses braces instead of quotation marks. (Quotation marks - still work, of course.) + + - Fixed bug #273 "Graph drawing sublayouts fails". + - Incorporated first partial documentation of the arrow tips + into the main documentation. + - Fixed bug bugs:#272 "SVG parser error after close path" as + suggested by Mark Wibrow. + - Also changed the default syntax for svg path command so that + it uses braces instead of quotation marks. (Quotation marks + still work, of course.) 2013-09-22 Till Tantau <tantau@users.sourceforge.net> - - Started working on arrow doc. - + - Started working on arrow doc. + 2013-09-20 Mark Wibrow <vibrovski@users.sourceforge.net> - - Added macro to convert string of digits to comma separated list. - + - Added macro to convert string of digits to comma separated list. + 2013-09-18 Till Tantau <tantau@users.sourceforge.net> - - First version of new arrow tip management done. Up and - running! Still needs documentation and the old arrow tip - codes should (but need not) be ported. - - Did some porting of old code, added fixes. Doc still missing. - + - First version of new arrow tip management done. Up and + running! Still needs documentation and the old arrow tip + codes should (but need not) be ported. + - Did some porting of old code, added fixes. Doc still missing. + 2013-09-17 Till Tantau <tantau@users.sourceforge.net> - - Fixed bug #264: "\pgfkeys /errors/unknown key should (?) expand first argument" - - Fixed bug #268: "`matrix of nodes' isn't working properly any more" - + - Fixed bug #264: "\pgfkeys /errors/unknown key should (?) expand first argument" + - Fixed bug #268: "`matrix of nodes' isn't working properly any more" + 2013-09-11 Mark Wibrow <vibrovski@users.sourceforge.net> - - Corrected typos (bug #266 and bug #265) + - Corrected typos (bug #266 and bug #265) 2013-09-11 Mark Wibrow <vibrovski@users.sourceforge.net> - - added magnetic tape shape. + - added magnetic tape shape. 2013-09-09 Till Tantau <tantau@users.sourceforge.net> - - Fixed bug #262/267: "Line breaks are not working in labels anyy more." - - Fixed bug #260: "TikZ node on background in pgfextra" - - Started work on bending arrows. - + - Fixed bug #262/267: "Line breaks are not working in labels anyy more." + - Fixed bug #260: "TikZ node on background in pgfextra" + - Started work on bending arrows. + 2013-09-05 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - external lib: fixed bug: file dependency handling was incorrect and - suffered from regression caused by MD5 checks + - external lib: fixed bug: file dependency handling was incorrect and + suffered from regression caused by MD5 checks 2013-08-31 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - repaired incompatibility with pgfplots <= 1.8: samples key was - evaluated in context of floating point unit and new pgf code relied on dimension - registers. + - repaired incompatibility with pgfplots <= 1.8: samples key was + evaluated in context of floating point unit and new pgf code relied on dimension + registers. 2013-08-29 Till Tantau <tantau@users.sourceforge.net> - - Added "turn" key. - + - Added "turn" key. + 2013-08-28 Till Tantau <tantau@users.sourceforge.net> - - Added "angle" pic type and "angles" library. - - Patched gd loader code so that it works with context mark IV. - + - Added "angle" pic type and "angles" library. + - Patched gd loader code so that it works with context mark IV. + 2013-08-27 Till Tantau <tantau@users.sourceforge.net> - - Added new pic path command. - - Patched pgfsys-dvipdfmx.def to step around the bug in - (x)dvipdfmx that caused scaled boxes (including scaled - graphics) inside nodes to be displayed incorrectly. - + - Added new pic path command. + - Patched pgfsys-dvipdfmx.def to step around the bug in + (x)dvipdfmx that caused scaled boxes (including scaled + graphics) inside nodes to be displayed incorrectly. + 2013-08-24 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - - fixed bug in fpu: 0^0 and 0^x both produced nan. Now we get - 0^0=1 and 0^x = 0. + + - fixed bug in fpu: 0^0 and 0^x both produced nan. Now we get + 0^0=1 and 0^x = 0. 2013-08-22 Till Tantau <tantua@users.sourceforge.net> - - Removed claims from manual (not by me...) that TikZ does not - work with Mark IV of context. I just tried it and everything - I tried (including advanced stuff like shadings) worked fine. - + - Removed claims from manual (not by me...) that TikZ does not + work with Mark IV of context. I just tried it and everything + I tried (including advanced stuff like shadings) worked fine. + 2013-08-18 Mark Wibrow <vibrovski@users.sourceforge.net> - - Fixed pgf intersection library to ensure that - specialround tokens are processed. + - Fixed pgf intersection library to ensure that + specialround tokens are processed. 2013-08-06 Till Tantau <tantua@users.sourceforge.net> - - Added support for dvisvgm. Quite nice... - + - Added support for dvisvgm. Quite nice... + 2013-08-05 Till Tantau <tantua@users.sourceforge.net> - - Worked on tex4ht code. Works reasonably well know and even - graph drawing is possible (when luatex is used for - typesetting; for this I needed to fix some latin1 characters in - html4.4ht). Also, I renamed /tikz/tex4ht... to /pgf/tex4ht - (someone else added that) since tikz has nothing to do with - that stuff. - Typesetting the manual in tex4ht no longer works, but that seems - like too much bother for my taste. + - Worked on tex4ht code. Works reasonably well know and even + graph drawing is possible (when luatex is used for + typesetting; for this I needed to fix some latin1 characters in + html4.4ht). Also, I renamed /tikz/tex4ht... to /pgf/tex4ht + (someone else added that) since tikz has nothing to do with + that stuff. + Typesetting the manual in tex4ht no longer works, but that seems + like too much bother for my taste. 2013-08-02 Till Tantau <tantua@users.sourceforge.net> - - Fixed bug #256 "The special \pgfcoordinate macro doesn't - expand \pgfpictureid." + - Fixed bug #256 "The special \pgfcoordinate macro doesn't + expand \pgfpictureid." 2013-08-04 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - - external lib: fixed incompatibility of pdflscape with - external lib + + - external lib: fixed incompatibility of pdflscape with + external lib 2013-08-01 Till Tantau <tantua@users.sourceforge.net> - - Fixed a problem with pdf resources of transparency groups in - dvipdfmx. - + - Fixed a problem with pdf resources of transparency groups in + dvipdfmx. + 2013-07-31 Till Tantau <tantua@users.sourceforge.net> - - Fixed bug #149 "/tikz/raw gnuplot ignoring segmented plot" - by introducing a new way of handling plot streams. There are - now new kinds of points (outliers and undefined points) and - "new data sets" commands inside streams. Handlers (like the - lineto and curve handlers) can be configured to interpret - these as jumps (this is the default). - - Fixed bug #255 "Trig computations offend fp via fixedpointarithmetic lib" - + - Fixed bug #149 "/tikz/raw gnuplot ignoring segmented plot" + by introducing a new way of handling plot streams. There are + now new kinds of points (outliers and undefined points) and + "new data sets" commands inside streams. Handlers (like the + lineto and curve handlers) can be configured to interpret + these as jumps (this is the default). + - Fixed bug #255 "Trig computations offend fp via fixedpointarithmetic lib" + 2013-07-31 Mark Wibrow <vibrovski@users.sourceforge.net> - - Added "math" library. Could be integrated with calc library. - + - Added "math" library. Could be integrated with calc library. + 2013-07-26 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - Fixed bug in external lib: mode=list and make did not cope well with - \ref in externalized images. These will be remade now. + - Fixed bug in external lib: mode=list and make did not cope well with + \ref in externalized images. These will be remade now. 2013-07-24 Till Tantau <tantua@users.sourceforge.net> - - Fixed bug #162 "PGF manual examples use undefined "shape example" style" - - Fixed bug #169 "ghostscript error: /undefined in pgfo" - - Concerning bug #167 "node pin option sets - inconsistent/incorrect angle" I added some clarification in - the manual that explains the observed behaviour. - - Fixed bug #158 "\pgfmathparse does not support e-TeXs - \numexpr and \dimexpr". You can now also use - \pgfmathsetlength to assign a muskip a value. Internally, - "mu" is treated like "pt", but if an expression contains - "mu", \pgfmathsetlength and \pgfmathaddtolength will convert - the number to "mu" before the assignment. - + - Fixed bug #162 "PGF manual examples use undefined "shape example" style" + - Fixed bug #169 "ghostscript error: /undefined in pgfo" + - Concerning bug #167 "node pin option sets + inconsistent/incorrect angle" I added some clarification in + the manual that explains the observed behaviour. + - Fixed bug #158 "\pgfmathparse does not support e-TeXs + \numexpr and \dimexpr". You can now also use + \pgfmathsetlength to assign a muskip a value. Internally, + "mu" is treated like "pt", but if an expression contains + "mu", \pgfmathsetlength and \pgfmathaddtolength will convert + the number to "mu" before the assignment. + 2013-07-22 Till Tantau <tantua@users.sourceforge.net> - - Fixed bug #173 "Tikz's transparency, xelatex and preview - package" by adding a specific fix for the interaction - between preview.sty and everyshi.sty in pgfutil-latex.def. + - Fixed bug #173 "Tikz's transparency, xelatex and preview + package" by adding a specific fix for the interaction + between preview.sty and everyshi.sty in pgfutil-latex.def. 2013-07-19 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - - optimized mark=* and mark=o (q path versions lead to 10% time reduction) - - adopted new pgfkeys feature to /handler config/full or existing ( - required when /.search also is used to find the correct key path) + + - optimized mark=* and mark=o (q path versions lead to 10% time reduction) + - adopted new pgfkeys feature to /handler config/full or existing ( + required when /.search also is used to find the correct key path) 2013-07-19 Till Tantau <tantua@users.sourceforge.net> - - Fixed bug #175 "In PGF oo module, calling a method strips grouping" - - Fixed bug #181 "Need to document |- coordinates using calc notation" - - Fixed bug #187 "\pgfmathanglebetweenpoints is not documented" - - Increased accuracy of atan, atan2 and - \pgfmathanglebetweenpoints. + - Fixed bug #175 "In PGF oo module, calling a method strips grouping" + - Fixed bug #181 "Need to document |- coordinates using calc notation" + - Fixed bug #187 "\pgfmathanglebetweenpoints is not documented" + - Increased accuracy of atan, atan2 and + \pgfmathanglebetweenpoints. 2013-07-18 Till Tantau <tantua@users.sourceforge.net> - - Fixed bug "#168 PGF is sensitive to dollar catcode" - - Fixed bug "#186 pgfonlayer makes pgf forget options" and - added "every on background layer" option. - - Fixed bug "#192 pgffor scope iteration is buggy" - - Fixed bug "#196 Incoherent syntax for Bézier curves" - - Fixed bug "#199 Drawing error for chamfered rectangle" - - Fixed bug "#201 Markings fail with "Dimension too Large" on - certain paths" by fixing a mistake and the decoration core - and, additionally, in pgfmathanglebetweenpoints. - - Fixed bug "#254 building currenct CVS version fails on - graphdrawing with current luatex": Will now work nicely with - TeXLive 2013 and Lua 5.2. - - Added feature request "bug #203 Blending modes and better transparency" - + - Fixed bug "#168 PGF is sensitive to dollar catcode" + - Fixed bug "#186 pgfonlayer makes pgf forget options" and + added "every on background layer" option. + - Fixed bug "#192 pgffor scope iteration is buggy" + - Fixed bug "#196 Incoherent syntax for Bézier curves" + - Fixed bug "#199 Drawing error for chamfered rectangle" + - Fixed bug "#201 Markings fail with "Dimension too Large" on + certain paths" by fixing a mistake and the decoration core + and, additionally, in pgfmathanglebetweenpoints. + - Fixed bug "#254 building currenct CVS version fails on + graphdrawing with current luatex": Will now work nicely with + TeXLive 2013 and Lua 5.2. + - Added feature request "bug #203 Blending modes and better transparency" + 2013-07-17 Till Tantau <tantua@users.sourceforge.net> - - - Fixed bug #204 "strange influence of \baselinestretch on - tikz figure" by no longer sharing \pgfutil@tempa with latex: - This register gets changed by LaTeX in a fontchange, which, in - turn can happen at the beginning of every - \pgfmathsetlength. - - Fixed bug #207 "Decoration markings not on path on large - lines" by using a more precise computation of positions on - straight lines in decorations. Also, the angle computation - is now much more precise by fixedin bug #201. - - Fixed bug #212 "Error if using plot into a \foreach loop in - a single path" by making \pgffor@beginhook and friends local - to the current \foreach. A nice side-effect is that one can - now nest \foreach statements on a path and also mix in the - plots. Hopefully, no one relied on the (undocumented, - unsupported) old bevahiour of the hooks. - - Fixed bug #213 "pgfmathsetcounter only works in local scope" - by adding a note in the documentation. - - Fixed bug #211 "\nodepart ignores text transparency" - - Fixed bug #220 "Transformations ignored in edge decoration." - - Fixed bug #221 "xyz spherical and cylindrical coordinate, radius not defined" - - Fixed bug #225 "pgfkeys "/errors/unknown choice value" ignores parameters" - - Fixed bug #253 "\pgfkeysfiltered cannot accept long arguments" - - Fixed bug #252 "I'm not able to build the current CVS - version". This included a number of patches to fix problems - introduced with the bugfixes introduced recently - + + - Fixed bug #204 "strange influence of \baselinestretch on + tikz figure" by no longer sharing \pgfutil@tempa with latex: + This register gets changed by LaTeX in a fontchange, which, in + turn can happen at the beginning of every + \pgfmathsetlength. + - Fixed bug #207 "Decoration markings not on path on large + lines" by using a more precise computation of positions on + straight lines in decorations. Also, the angle computation + is now much more precise by fixedin bug #201. + - Fixed bug #212 "Error if using plot into a \foreach loop in + a single path" by making \pgffor@beginhook and friends local + to the current \foreach. A nice side-effect is that one can + now nest \foreach statements on a path and also mix in the + plots. Hopefully, no one relied on the (undocumented, + unsupported) old bevahiour of the hooks. + - Fixed bug #213 "pgfmathsetcounter only works in local scope" + by adding a note in the documentation. + - Fixed bug #211 "\nodepart ignores text transparency" + - Fixed bug #220 "Transformations ignored in edge decoration." + - Fixed bug #221 "xyz spherical and cylindrical coordinate, radius not defined" + - Fixed bug #225 "pgfkeys "/errors/unknown choice value" ignores parameters" + - Fixed bug #253 "\pgfkeysfiltered cannot accept long arguments" + - Fixed bug #252 "I'm not able to build the current CVS + version". This included a number of patches to fix problems + introduced with the bugfixes introduced recently + 2013-07-16 Till Tantau <tantua@users.sourceforge.net> - - - Fixed bug #226 "matrix column sep=-\pgflinewidth changes after empty cell" - - Fixed bug #229 "pgfpagesuselayout breaks beamer class" - (hopefully, setting page sizes is really messy in TeX!). - - Fixed bug #232 "pow function broken for 0^x for non-integer values of x" - - Fixed bug #165 "\draw with empty domain results in infinite calculation" - - Added better error message to adress bug #244 "mindmap-style - "invalidates" coordinate shape." - - Fixed bug #235 "\def\costhirty{0.8660256} not really used" - + + - Fixed bug #226 "matrix column sep=-\pgflinewidth changes after empty cell" + - Fixed bug #229 "pgfpagesuselayout breaks beamer class" + (hopefully, setting page sizes is really messy in TeX!). + - Fixed bug #232 "pow function broken for 0^x for non-integer values of x" + - Fixed bug #165 "\draw with empty domain results in infinite calculation" + - Added better error message to adress bug #244 "mindmap-style + "invalidates" coordinate shape." + - Fixed bug #235 "\def\costhirty{0.8660256} not really used" + 2013-07-15 Till Tantau <tantua@users.sourceforge.net> - - - Fixed bug "#237 CVS-version: pdfimage error: key interpolate undefined" - - Fixed bug "#245 broken key /pgf/decoration/reset marks" - - Fixed bug "#239 picture disappear after a zero-width rectangle width shading" - - Fixed bug "#247 Error messages hard to catch in plain TeX/ConTeXt" - - Fixed bug "#166 Possibly typos in circuits.logic.IEC" - - Fixed bug "#249 pgfkeys: /handlers/first char syntax is not - 'self-contained' (CVS version)" - - Fixed bug "#248 circuits adjustable annotation improperly placed" - + + - Fixed bug "#237 CVS-version: pdfimage error: key interpolate undefined" + - Fixed bug "#245 broken key /pgf/decoration/reset marks" + - Fixed bug "#239 picture disappear after a zero-width rectangle width shading" + - Fixed bug "#247 Error messages hard to catch in plain TeX/ConTeXt" + - Fixed bug "#166 Possibly typos in circuits.logic.IEC" + - Fixed bug "#249 pgfkeys: /handlers/first char syntax is not + 'self-contained' (CVS version)" + - Fixed bug "#248 circuits adjustable annotation improperly placed" + 2013-07-13 Till Tantau <tantua@users.sourceforge.net> - - - Fixed bug "#250 pgfkyes: .append style and similar undouble # tokens" - - Fixed bug "#143 label changes center of a matrix node" + + - Fixed bug "#250 pgfkyes: .append style and similar undouble # tokens" + - Fixed bug "#143 label changes center of a matrix node" 2013-07-12 Till Tantau <tantau@users.sourceforge.net> - - - Fixed bug #128 "fit does not scale if used in scaled scope" - - Fixed bug #136 "\hrulefill inherits or not pgf line styles" - - Fixed bug #224 "Including Tikzpicture in third part of - multipart node" + + - Fixed bug #128 "fit does not scale if used in scaled scope" + - Fixed bug #136 "\hrulefill inherits or not pgf line styles" + - Fixed bug #224 "Including Tikzpicture in third part of + multipart node" 2013-07-11 Till Tantau <tantau@users.sourceforge.net> - - - Fixed bug #251 "cross out shape interacts with path options of path it is drawn on" - - Fixed bug #139 "Placement of node inside matix environment" - - Fixed bug #131 "text centering calculates wrong" and added - new "node font" option. - - Fixed bug #121 "Annoying "Underfull \hbox (badness 10000)" message" - - Fixed bug #134 "Edge node style affecting arrowhead". - + + - Fixed bug #251 "cross out shape interacts with path options of path it is drawn on" + - Fixed bug #139 "Placement of node inside matix environment" + - Fixed bug #131 "text centering calculates wrong" and added + new "node font" option. + - Fixed bug #121 "Annoying "Underfull \hbox (badness 10000)" message" + - Fixed bug #134 "Edge node style affecting arrowhead". + 2013-07-08 Till Tantau <tantau@users.sourceforge.net> - - - Fixed bug #132 "Error in matrix with column sep "between" - origins" - - Fixed bug #133 "\draw[-<<,>=stealth] (10,45) -- (40,45); does - not work." However, this introduces a (small, only visual) - incompatibility with previous versions. If you need the visual - effect "-<<" used to have (which, in a sense, was wrong), use - "-< <" instead. The new "-> >" is also quite handy. - + + - Fixed bug #132 "Error in matrix with column sep "between" + origins" + - Fixed bug #133 "\draw[-<<,>=stealth] (10,45) -- (40,45); does + not work." However, this introduces a (small, only visual) + incompatibility with previous versions. If you need the visual + effect "-<<" used to have (which, in a sense, was wrong), use + "-< <" instead. The new "-> >" is also quite handy. + 2013-06-28 Till Tantau <tantau@users.sourceforge.net> - - Fixed bug #116 "Decorations can't be repositioned when - pre/post used." - + - Fixed bug #116 "Decorations can't be repositioned when + pre/post used." + 2013-06-25 Till Tantau <tantau@users.sourceforge.net> - - - Fixed bug #241 "div/null error by (270:length) and a fading line." - - Fixed bug #126 "Incorrect placed labels for inplicite positioned nodes." - - Added foreach syntax to nodes. This is useful and also - needed to fix the problem that the foreach statement cannot - be used after a to path. - + + - Fixed bug #241 "div/null error by (270:length) and a fading line." + - Fixed bug #126 "Incorrect placed labels for inplicite positioned nodes." + - Added foreach syntax to nodes. This is useful and also + needed to fix the problem that the foreach statement cannot + be used after a to path. + 2013-06-24 Till Tantau <tantau@users.sourceforge.net> - - - Fixed bug #18 and #74 (active characters and tikz) by virtue - of the new "babel" library, which deactivates catcodes at the - beginning of tikz pictures and reactivates them in nodes. - + + - Fixed bug #18 and #74 (active characters and tikz) by virtue + of the new "babel" library, which deactivates catcodes at the + beginning of tikz pictures and reactivates them in nodes. + 2013-06-21 Till Tantau <tantau@users.sourceforge.net> - - Fixed bug #110 "cannot add node after cycle operation" - - Fixed bug #88 "\pgftransformarrow does not rotate with \pgfpointanchor" - - Fixed bug #86 "macro-expanded tree node has bad edge anchor" - - Fixed bug #85 "PGF + Crop package, at least for pdftex." - + - Fixed bug #110 "cannot add node after cycle operation" + - Fixed bug #88 "\pgftransformarrow does not rotate with \pgfpointanchor" + - Fixed bug #86 "macro-expanded tree node has bad edge anchor" + - Fixed bug #85 "PGF + Crop package, at least for pdftex." + 2013-06-20 Till Tantau <tantau@users.sourceforge.net> - - - Fixed bug #83 "Transparency Problem with \usepackage{endfloat}." - - Applied patch #19 pgfkeys: ".search also" fails at unbalanced "\if" values - - Applied patch #18 Missing grid lines with - negative increment - - Applied patch #17 TikZ folding library - - Applied patch #14 inheritance in the oo module - - Applied patch #13 leaking space in \pgfpointintersectionoflines - - Applied patch #11 Patch for Bug #3165961 (\pgfmathmax and \pgfmathmin) - - Fixed problem of patch #9 Add papersize to XeTeX driver - - Applied patch #8 Support for changing physical page size with XeTeX - (also added position saving support, while I was at it...) - - Applied patches #3, #4, #5, #6 (typos in manual) as far as possible - + + - Fixed bug #83 "Transparency Problem with \usepackage{endfloat}." + - Applied patch #19 pgfkeys: ".search also" fails at unbalanced "\if" values + - Applied patch #18 Missing grid lines with + negative increment + - Applied patch #17 TikZ folding library + - Applied patch #14 inheritance in the oo module + - Applied patch #13 leaking space in \pgfpointintersectionoflines + - Applied patch #11 Patch for Bug #3165961 (\pgfmathmax and \pgfmathmin) + - Fixed problem of patch #9 Add papersize to XeTeX driver + - Applied patch #8 Support for changing physical page size with XeTeX + (also added position saving support, while I was at it...) + - Applied patches #3, #4, #5, #6 (typos in manual) as far as possible + 2013-06-18 Till Tantau <tantau@users.sourceforge.net> - - - Fixed bug #236 "Scaled closed paths, start/end points dont exactly match": - "cycle" can now be used with all path operations where it - makes sense, not only with --. In particular, things like - ".. cycle" or "to [bend right] cycle" are now allowed. + + - Fixed bug #236 "Scaled closed paths, start/end points dont exactly match": + "cycle" can now be used with all path operations where it + makes sense, not only with --. In particular, things like + ".. cycle" or "to [bend right] cycle" are now allowed. 2013-05-23 Till Tantau <tantau@users.sourceforge.net> - - Reworked handling of edge and vertex paths in gd. In - particular, edge--vertex intersections are now computed in - Lua, rather than in TikZ. This is much more powerful and - allows beautiful arcs between vertices. It is also very - useful for planar graph drawings when several edges leave a - vertex in the same direction. - + - Reworked handling of edge and vertex paths in gd. In + particular, edge--vertex intersections are now computed in + Lua, rather than in TikZ. This is much more powerful and + allows beautiful arcs between vertices. It is also very + useful for planar graph drawings when several edges leave a + vertex in the same direction. + 2013-04-08 Till Tantau <tantau@users.sourceforge.net> - - - Did away with luadoc, now using simple handcoded documentor - that will also work with Lua 5.2 - - Redid OGDF support. Resonably stable base now. - - Added better C support. - - Should now work with both Lua 5.1 and 5.2 - + + - Did away with luadoc, now using simple handcoded documentor + that will also work with Lua 5.2 + - Redid OGDF support. Resonably stable base now. + - Added better C support. + - Should now work with both Lua 5.1 and 5.2 + 2013-03-15 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - fixed incompatibility of fixltx2e and external lib + - fixed incompatibility of fixltx2e and external lib 2013-02-08 Till Tantau <tantau@users.sourceforge.net> - - - Reworked Storage mechanism of graph drawing system. - - Added phylogenetics library for graph drawing; documentation - still only rudimentary. - + + - Reworked Storage mechanism of graph drawing system. + - Added phylogenetics library for graph drawing; documentation + still only rudimentary. + 2012-12-30 Till Tantau <tantau@users.sourceforge.net> - - - Started adding support for calling C graph drawing functions - from Lua. - - First proof of concept for OGDF finished. - - Must still address luatex shared library link problems. + + - Started adding support for calling C graph drawing functions + from Lua. + - First proof of concept for OGDF finished. + - Must still address luatex shared library link problems. 2012-12-25 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - - fixed bug in external lib: \tikzexternalgetnextfilename did reset the - value of \tikzsetnextfilename and 'export next' + + - fixed bug in external lib: \tikzexternalgetnextfilename did reset the + value of \tikzsetnextfilename and 'export next' 2012-11-30 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - updated driver pgfsys-xetex: now, it supports all that the new driver - for dvipdfmx does which includes fadings, functional shadings, and - patterns. + - updated driver pgfsys-xetex: now, it supports all that the new driver + for dvipdfmx does which includes fadings, functional shadings, and + patterns. 2012-11-30 Till Tantau <tantau@users.sourceforge.net> - - - First complete documentation of the graph drawing - system. (Finally!) - + + - First complete documentation of the graph drawing + system. (Finally!) + 2012-11-27 Till Tantau <tantau@users.sourceforge.net> - - Renamed gd files to shorter versions: instead of - pgf/gd/model/pgf.gd.model.Edges.lua we now have - pgf/gd/model/Edge.lua and so on. - - Worked on gd documentation. Only binding doc is still a - mess. - + - Renamed gd files to shorter versions: instead of + pgf/gd/model/pgf.gd.model.Edges.lua we now have + pgf/gd/model/Edge.lua and so on. + - Worked on gd documentation. Only binding doc is still a + mess. + 2012-11-26 Till Tantau <tantau@users.sourceforge.net> - - Worked on gd documentation. - + - Worked on gd documentation. + 2012-11-21 Till Tantau <tantau@users.sourceforge.net> - - - New version of gd lib. The internals have been completely - redone. In particular, no tikz libraries are needed for the - individual algorithms any longer, all declarations are now - done completely inside Lua. This makes gd usable (in - principle) independently of tikz and pgf. - - Because of this, all declarations of algorithms need to be - redone. + + - New version of gd lib. The internals have been completely + redone. In particular, no tikz libraries are needed for the + individual algorithms any longer, all declarations are now + done completely inside Lua. This makes gd usable (in + principle) independently of tikz and pgf. + - Because of this, all declarations of algorithms need to be + redone. 2012-11-10 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - - external lib: fixed spurious white space (caused by 'up to date check') + + - external lib: fixed spurious white space (caused by 'up to date check') 2012-11-01 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - manual styles: improved robustness of auto cross references & active spaces + - manual styles: improved robustness of auto cross references & active spaces 2012-10-18 Christophe Jorssen <cjorssen@users.sourceforge.net> - - Fixed a bug with active colon in circuits lib. Probably more to - fix in other libraries. - + - Fixed a bug with active colon in circuits lib. Probably more to + fix in other libraries. + 2012-10-11 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - Improved precision of math functions asin and acos (using linear - interpolation instead of constant interpolation) + - Improved precision of math functions asin and acos (using linear + interpolation instead of constant interpolation) 2012-09-27 Till Tantau <tantau@users.sourceforge.net> - - Worked on gd. - + - Worked on gd. + 2012-09-26 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - fixed pgfsys-pdftex.def : very old regression with \setbeamercovered{transparent} and \pause - Patch by Hendrik Vogt + - fixed pgfsys-pdftex.def : very old regression with \setbeamercovered{transparent} and \pause + Patch by Hendrik Vogt 2012-08-29 Till Tantau <tantau@users.sourceforge.net> - - Added support for sublayouts in gd (not yet fully - documented). This allows one to use several algorithms inside - a single graph. - + - Added support for sublayouts in gd (not yet fully + documented). This allows one to use several algorithms inside + a single graph. + 2012-06-28 Till Tantau <tantau@users.sourceforge.net> - - - Redone handling of clusters in gd yet again. Renamed them to - "collections". Much better system now, can handle hyperedges, - subgraphs and other stuff (in principle). - - Nodes generated by a gd algorithm now have correct size - information (this one was tricky!). - + + - Redone handling of clusters in gd yet again. Renamed them to + "collections". Much better system now, can handle hyperedges, + subgraphs and other stuff (in principle). + - Nodes generated by a gd algorithm now have correct size + information (this one was tricky!). + 2012-06-22 Till Tantau <tantau@users.sourceforge.net> - - - Redone handling of clusters in gd. - - Worked on gd documentation. + + - Redone handling of clusters in gd. + - Worked on gd documentation. 2012-06-18 Christian Feuersaenger <cfeuersaenger@users.sourceforge.net> - - fixed minor expansion issue \foreach \x in {a,...,d} lead to unexpanded value \x - + - fixed minor expansion issue \foreach \x in {a,...,d} lead to unexpanded value \x + 2012-06-18 Christian Feuersaenger <ludewich@users.sourceforge.net> - - externalization: added special switch to deactivate incompatible - geometry drivers during externalization + - externalization: added special switch to deactivate incompatible + geometry drivers during externalization 2012-05-31 Till Tantau <tantau@users.sourceforge.net> - - - Redone pgf.gd.model.Arc - - Added documentation for said class. - + + - Redone pgf.gd.model.Arc + - Added documentation for said class. + 2012-05-23 Till Tantau <tantau@users.sourceforge.net> - - Worked on gd documentation. - - Replaced old luadoc by customized version. Gets called - directly from tex. - + - Worked on gd documentation. + - Replaced old luadoc by customized version. Gets called + directly from tex. + 2012-05-17 Christian Feuersaenger <ludewich@users.sourceforge.net> - - - external lib: added support for MD5/diff based up-to-date checks. - Changes to a picture will automatically result in a remake of the - respective external graphics. + + - external lib: added support for MD5/diff based up-to-date checks. + Changes to a picture will automatically result in a remake of the + respective external graphics. 2012-05-03 Christophe Jorssen <cjorssen@users.sourceforge.net> - - Fix bug #3527068 (\pgfmathatantwo did not exist) + - Fix bug #3527068 (\pgfmathatantwo did not exist) 2012-05-14 Till Tantau <tantau@users.sourceforge.net> - - Changed pgf.gd.new_graph_drawing_algorithm syntax. Not - likely to change again... - - Added support for algorithms to create nodes and edge in the - syntactic digraph. - - Introduced library graphdrawing.examples that includes some - code demonstrating how "things are done". + - Changed pgf.gd.new_graph_drawing_algorithm syntax. Not + likely to change again... + - Added support for algorithms to create nodes and edge in the + syntactic digraph. + - Introduced library graphdrawing.examples that includes some + code demonstrating how "things are done". 2012-05-13 Christian Feuersaenger <ludewich@users.sourceforge.net> - - context: fixed catcode issues by means of suitable module - \protect/\unprotect statements. + - context: fixed catcode issues by means of suitable module + \protect/\unprotect statements. 2012-05-06 Till Tantau <tantau@users.sourceforge.net> - - Introduced a new class model for graph drawing (Digraph, - Arc, and Vertex instead of Graph, Edge, Node). I'm currently - porting all the old code, but it takes a while and it's a - bit messy right now. Some easy algorithms are already based - on the new system, old ones not. In the end, things should - be significantly faster and also easier to program. + - Introduced a new class model for graph drawing (Digraph, + Arc, and Vertex instead of Graph, Edge, Node). I'm currently + porting all the old code, but it takes a while and it's a + bit messy right now. Some easy algorithms are already based + on the new system, old ones not. In the end, things should + be significantly faster and also easier to program. 2012-05-03 Christophe Jorssen <cjorssen@users.sourceforge.net> - - Attempt to fix bug in calc lib when '!' or ':' are active (not - fully tested but should work). + - Attempt to fix bug in calc lib when '!' or ':' are active (not + fully tested but should work). 2012-05-02 Christophe Jorssen <cjorssen@users.sourceforge.net> - - Attempt to fix bug with label and pin when ':' is active (not - fully tested but should work). + - Attempt to fix bug with label and pin when ':' is active (not + fully tested but should work). 2012-04-19 Till Tantau <tantau@users.sourceforge.net> - - Finished the first two chapters of the documentation of gd - (overview and tikz usage). - - Module system is now redone and the directory structure - has been reorganized. No more messing around with lua - modules, everything is perfectly portable now. - + - Finished the first two chapters of the documentation of gd + (overview and tikz usage). + - Module system is now redone and the directory structure + has been reorganized. No more messing around with lua + modules, everything is perfectly portable now. + 2012-04-17 Till Tantau <tantau@users.sourceforge.net> - - Started to completely redo the module system of graph - drawing in lua. I'm in the middle of it, so its currently - messy, but it works. - + - Started to completely redo the module system of graph + drawing in lua. I'm in the middle of it, so its currently + messy, but it works. + 2012-04-12 Till Tantau <tantau@users.sourceforge.net> - - Implemented packing procedure for graph drawing. - - Cleaned up graph drawing source some more. - - Renamed lots of files (still not happy with it, though). + - Implemented packing procedure for graph drawing. + - Cleaned up graph drawing source some more. + - Renamed lots of files (still not happy with it, though). 2012-04-11 Till Tantau <tantau@users.sourceforge.net> - - Implemented Reingold-Tilford tree layout. + - Implemented Reingold-Tilford tree layout. 2012-04-05 Till Tantau <tantau@users.sourceforge.net> - - Implemented my first graph drawing algorithm: circular layout. + - Implemented my first graph drawing algorithm: circular layout. 2012-04-03 Till Tantau <tantau@users.sourceforge.net> - - Introduced new declaration mechanism for graph drawing - algorithm classes - - Implemented preprocessing step of decomposing a graph into - connected components. - + - Introduced new declaration mechanism for graph drawing + algorithm classes + - Implemented preprocessing step of decomposing a graph into + connected components. + 2012-04-02 Till Tantau <tantau@users.sourceforge.net> - - Cleaned up graph drawing algorithm directories: Moved - obsolete algorithms to special directory. - - Switched graph drawing calling interface from function-base - to object-based: All graph drawing algorithms must now be - implemented in a class - - Cleaned up file and class names of graph drawing engine. + - Cleaned up graph drawing algorithm directories: Moved + obsolete algorithms to special directory. + - Switched graph drawing calling interface from function-base + to object-based: All graph drawing algorithms must now be + implemented in a class + - Cleaned up file and class names of graph drawing engine. 2012-03-30 Till Tantau <tantau@users.sourceforge.net> - - Fixed problem that in case math library is loaded before pgf - some math functions were broken (because \pgfmath@xa and - \pgf@xa were different registers, which they should not be). - + - Fixed problem that in case math library is loaded before pgf + some math functions were broken (because \pgfmath@xa and + \pgf@xa were different registers, which they should not be). + 2012-03-29 Till Tantau <tantau@users.sourceforge.net> - - Added anchoring and orientation to graph drawing library. - + - Added anchoring and orientation to graph drawing library. + 2012-03-21 Till Tantau <tantau@users.sourceforge.net> - - Added arrows.spaced library. - - Added quotation syntax to graph lib. - - Renamed some graph drawing layouts. - - Worked on documentation of graph drawing lib. + - Added arrows.spaced library. + - Added quotation syntax to graph lib. + - Renamed some graph drawing layouts. + - Worked on documentation of graph drawing lib. 2012-03-07 Christophe Jorssen <cjorssen@users.sourceforge.net> - - Moved wrappers for luatex primitives (\pgfutil@directlua, - \pgfutil@ifluatex, \pgfutil@luaescapestring) to pgfutil-common.tex - - Added support for luatex to the profiler library by emulating - \pdfelapsedtime. + - Moved wrappers for luatex primitives (\pgfutil@directlua, + \pgfutil@ifluatex, \pgfutil@luaescapestring) to pgfutil-common.tex + - Added support for luatex to the profiler library by emulating + \pdfelapsedtime. 2012-02-27 Till Tantau <tantau@users.sourceforge.net> - - Fixed wrong edef in graph lib that broke the /-syntax when - text contained expandable stuff. - + - Fixed wrong edef in graph lib that broke the /-syntax when + text contained expandable stuff. + 2012-02-21 Christophe Jorssen <cjorssen@users.sourceforge.net> - - More work on the luamath parser and evaluator. + - More work on the luamath parser and evaluator. 2012-01-24 Christophe Jorssen <cjorssen@users.sourceforge.net> - - Fix a bug in tikz polar coordinates (reported on tex.se - http://tex.stackexchange.com/questions/41828/using-math-in-tikz): - braces around a delimited argument are removed. + - Fix a bug in tikz polar coordinates (reported on tex.se + http://tex.stackexchange.com/questions/41828/using-math-in-tikz): + braces around a delimited argument are removed. 2012-01-10 Christophe Jorssen <cjorssen@users.sourceforge.net> - - Fix a bug in pgfmath != operator (reported and fixed on tex.se - http://tex.stackexchange.com/questions/40605/using-in-pgfmathparse) + - Fix a bug in pgfmath != operator (reported and fixed on tex.se + http://tex.stackexchange.com/questions/40605/using-in-pgfmathparse) 2012-01-09 Christophe Jorssen <cjorssen@users.sourceforge.net> - - Fix a pgfmath dependency for pgffor. + - Fix a pgfmath dependency for pgffor. 2012-01-03 Till Tantau <tantau@users.sourceforge.net> - - Added pos support to the arc command (finally...). - - Added support to the graph library for drawing tries. - - Added support to the graph library for adding edge labels in - an easier way. + - Added pos support to the arc command (finally...). + - Added support to the graph library for drawing tries. + - Added support to the graph library for adding edge labels in + an easier way. 2011-12-29 Christian Feuersaenger <ludewich@users.sourceforge.net> - - Added the 'fixed relative' number formatting style. + - Added the 'fixed relative' number formatting style. 2011-12-28 Christian Feuersaenger <ludewich@users.sourceforge.net> - - - Added 'const plot mark mid' and 'jump mark mid' plot handlers. + + - Added 'const plot mark mid' and 'jump mark mid' plot handlers. 2011-12-02 Till Tantau <tantau@users.sourceforge.net> - - Renamed "layered drawing" to "layered layout" for - consistency. + - Renamed "layered drawing" to "layered layout" for + consistency. 2011-11-12 Christophe Jorssen <cjorssen@users.sourceforge.net> - - More work on the lua math parser and evaluator. - - Added wrappers for luatex primitives: \pgfutil@directlua, - \pgfutil@ifluatex, \pgfutil@luaescapestring - - Make lua code more lua 5.2 compatible + - More work on the lua math parser and evaluator. + - Added wrappers for luatex primitives: \pgfutil@directlua, + \pgfutil@ifluatex, \pgfutil@luaescapestring + - Make lua code more lua 5.2 compatible 2011-11-11 Christophe Jorssen <cjorssen@users.sourceforge.net> - - Work on the lua math parser and evaluator. Begin to merge Mark's - code with mine. + - Work on the lua math parser and evaluator. Begin to merge Mark's + code with mine. 2011-11-03 Christian Feuersaenger <ludewich@users.sourceforge.net> - - - added FPU support for ==, !=, <=, >=, ? + + - added FPU support for ==, !=, <=, >=, ? 2011-10-29 Christian Feuersaenger <ludewich@users.sourceforge.net> - - fixed problem with pgf number printer: it introduced spurious spaces - tracker id 3430171. Thanks to Clemens Koppensteiner for the bugfix. + - fixed problem with pgf number printer: it introduced spurious spaces + tracker id 3430171. Thanks to Clemens Koppensteiner for the bugfix. 2011-09-25 Christian Feuersaenger <ludewich@users.sourceforge.net> - - \pgfsetlayers can now be given inside of a pgfpicture (or tikzpicture) + - \pgfsetlayers can now be given inside of a pgfpicture (or tikzpicture) 2011-06-22 Christophe Jorssen <cjorssen@users.sourceforge.net> - - The lua math parser now works on basic expressions (no units, no - arrays, no strings, no functions, ...?). + - The lua math parser now works on basic expressions (no units, no + arrays, no strings, no functions, ...?). 2011-06-02 Christophe Jorssen <cjorssen@users.sourceforge.net> - - Some work on a lua (lpeg based) math parser. + - Some work on a lua (lpeg based) math parser. 2011-05-31 Christophe Jorssen <cjorssen@users.sourceforge.net> - - Added a gnuplot call key to pgfmoduleplot.code.tex (feature - request #3308340). + - Added a gnuplot call key to pgfmoduleplot.code.tex (feature + request #3308340). 2011-05-30 Jannis Pohlmann <jannis@xfce.org> - - graph drawing: - - Initial work on layered drawing algorithms. + - graph drawing: + - Initial work on layered drawing algorithms. 2011-05-25 Christophe Jorssen <cjorssen@users.sourceforge.net> - - Added dim function for array to pgfmath (to be documented) - - Some work on a ODE solver - + - Added dim function for array to pgfmath (to be documented) + - Some work on a ODE solver + 2011-05-20 Christian Feuersaenger <ludewich@users.sourceforge.net> - - removed spurious white spaces in my bugfix for pgfmathdivide + - removed spurious white spaces in my bugfix for pgfmathdivide 2011-05-19 Till Tantau <tantau@users.sourceforge.net> - - Second attempt at fixing spy lib... + - Second attempt at fixing spy lib... 2011-05-18 Matthias Schulz <ma.schulz@email.de> - - graph drawing: - - added short overview for nodes and edges (lua class documentation) + - graph drawing: + - added short overview for nodes and edges (lua class documentation) 2011-05-17 Jannis Pohlmann <jannis@xfce.org> - - graph drawing: - - Separate 'spring layout' and 'spring electrical layout' families. - Rename existing algorithms accordingly. - - Add an implementation of the Floyd-Warshall algorithm. - - Add a new 'Hu2006 spring' algorithm based solely on springs. - - Improve the initial layout of 'Hu2006 spring electrical' by - taking the graph size and diameter into account. - - Rework existing spring electrical algorithms and improve - documentation. - - Catch -!- edges and remove them from the Lua graph when detected. + - graph drawing: + - Separate 'spring layout' and 'spring electrical layout' families. + Rename existing algorithms accordingly. + - Add an implementation of the Floyd-Warshall algorithm. + - Add a new 'Hu2006 spring' algorithm based solely on springs. + - Improve the initial layout of 'Hu2006 spring electrical' by + taking the graph size and diameter into account. + - Rework existing spring electrical algorithms and improve + documentation. + - Catch -!- edges and remove them from the Lua graph when detected. 2011-05-14 Jannis Pohlmann <jannis@xfce.org> - - graph drawing: - - Update documentation of spring and spring-electrical parameters. - Add TODO items where things are missing, unclear or need to be - worked on. - - Make initial step dimension and the electric charge of nodes - configurable. Both, Walshaw2000 and Hu2006 support this. - - Improve the approximation of the repulsive force. + - graph drawing: + - Update documentation of spring and spring-electrical parameters. + Add TODO items where things are missing, unclear or need to be + worked on. + - Make initial step dimension and the electric charge of nodes + configurable. Both, Walshaw2000 and Hu2006 support this. + - Improve the approximation of the repulsive force. 2011-05-13 Till Tantau <tantau@users.sourceforge.net> - - Fixed bug 3297817 (spy postscript problem). - - Fixed bug of missing newpath in postscript and opacity - settings. - + - Fixed bug 3297817 (spy postscript problem). + - Fixed bug of missing newpath in postscript and opacity + settings. + 2011-05-13 Jannis Pohlmann <jannis@xfce.org> - - graph drawing: - - Rename graphdrawing.spring to graphdrawing.force. - - Fix NaN bug in the orientation helper. - - Initial work on improving and documenting the parameters for - spring and spring-electrical algorithms. - - Properly forward default node and edge parameters to Lua. + - graph drawing: + - Rename graphdrawing.spring to graphdrawing.force. + - Fix NaN bug in the orientation helper. + - Initial work on improving and documenting the parameters for + spring and spring-electrical algorithms. + - Properly forward default node and edge parameters to Lua. 2011-05-12 Jannis Pohlmann <jannis@xfce.org> - - graph drawing: - - Add Fibonacci heap and priority queue classes. - - Add Lua file for common graph algorithms. Implement Dijkstra. - - Add method Graph:getPseudoDiameter(). - - Hu2006: Scale coordinations of nodes in a coarse graph based on - the quotient of its pseudo diameters and that of the parent coarse - graph, as described in the paper. + - graph drawing: + - Add Fibonacci heap and priority queue classes. + - Add Lua file for common graph algorithms. Implement Dijkstra. + - Add method Graph:getPseudoDiameter(). + - Hu2006: Scale coordinations of nodes in a coarse graph based on + the quotient of its pseudo diameters and that of the parent coarse + graph, as described in the paper. 2011-05-11 Jannis Pohlmann <jannis@xfce.org> - - graph drawing: - - Fix several interpolation bugs in the coarse graph class. - - Use the coarse graph class in the Walshaw2000 algorithm. + - graph drawing: + - Fix several interpolation bugs in the coarse graph class. + - Use the coarse graph class in the Walshaw2000 algorithm. 2011-05-11 Till Tantau <tantau@users.sourceforge.net> - - Worked on documentation of gd backend. Still need to - document graph parameters. - + - Worked on documentation of gd backend. Still need to + document graph parameters. + 2011-05-10 Jannis Pohlmann <jannis@xfce.org> - - graph drawing: - - Remove files from the old graph drawing library tree. - - Disable verbose logging by default. - - Specify sane initial values for spring algorithm parameters. + - graph drawing: + - Remove files from the old graph drawing library tree. + - Disable verbose logging by default. + - Specify sane initial values for spring algorithm parameters. 2011-05-10 Till Tantau <tantau@users.sourceforge.net> - - Added .graph drawing parameter initial key. + - Added .graph drawing parameter initial key. 2011-05-09 Jannis Pohlmann <jannis@xfce.org> - - graph drawing: - - Implement graph coarsening in the Hu2006 algorithm. - - Name force-based algorithms after the paper author and year. + - graph drawing: + - Implement graph coarsening in the Hu2006 algorithm. + - Name force-based algorithms after the paper author and year. 2011-05-09 Till Tantau <tantau@users.sourceforge.net> - - Reorganized graph drawing documentation. + - Reorganized graph drawing documentation. 2011-05-06 Jannis Pohlmann <jannis@xfce.org> - - Finished the graph drawing library reorganization started by Till. + - Finished the graph drawing library reorganization started by Till. 2011-05-06 Till Tantau <tantau@users.sourceforge.net> - - Reorganized the graph drawing key and directory - structure. The documentation is still missing. Also, lots of - files still need to be moved, but I'll leave that to Jannis. - + - Reorganized the graph drawing key and directory + structure. The documentation is still missing. Also, lots of + files still need to be moved, but I'll leave that to Jannis. + 2011-05-06 Jannis Pohlmann <jannis@xfce.org> - - graph drawing: - - implement a quadtree optimization in the Walshaw algorithm. - - add a simple version of the Hu spring-electrical algorithm that - seems to work almost as good as the Walshaw even without - the multilevel approach implemented (which is the only thing - that really makes the Walshaw algorithm useful). + - graph drawing: + - implement a quadtree optimization in the Walshaw algorithm. + - add a simple version of the Hu spring-electrical algorithm that + seems to work almost as good as the Walshaw even without + the multilevel approach implemented (which is the only thing + that really makes the Walshaw algorithm useful). 2011-05-04 Jannis Pohlmann <jannis@xfce.org> - - graph drawing: - - Initial work on a quad tree implementation for spring and spring - electrical algorithms, with unit test. - - Improve the internals of the Vector class. + - graph drawing: + - Initial work on a quad tree implementation for spring and spring + electrical algorithms, with unit test. + - Improve the internals of the Vector class. 2011-05-03 Till Tantau <tantau@users.sourceforge.net> - - graph drawing: Started to cleanup pgf and tikz layers. Ongoing... + - graph drawing: Started to cleanup pgf and tikz layers. Ongoing... 2011-05-03 Jannis Pohlmann <jannis@xfce.org> - - graph drawing: - - Fix Walshaw algorithm to properly set the subnodes when copying - the coarse graphs. Simplify the code that updates the node - coordinates. + - graph drawing: + - Fix Walshaw algorithm to properly set the subnodes when copying + the coarse graphs. Simplify the code that updates the node + coordinates. 2011-05-02 Jannis Pohlmann <jannis@xfce.org> - - graph drawing: - - Modify the doclet to allow underscores in parameter names. - - Document the Vector class as well as the table, iter and traversal - helpers. - - Remove old table and iterator helpers. Rename helper files. Rename - table.merge() and table.copy() to table.custom_merge() and - table.custom_copy() to avoid name clashes with luatools. Add - string helpers, including string.parse_braces(). Update algorithms - to work with these changes. - - Allow vectors to have an origin vector, similar to the Position - class. Introduce new alternative table-based syntax for - Vector:set() that is much easier to read. Update unit tests - and algorithms. + - graph drawing: + - Modify the doclet to allow underscores in parameter names. + - Document the Vector class as well as the table, iter and traversal + helpers. + - Remove old table and iterator helpers. Rename helper files. Rename + table.merge() and table.copy() to table.custom_merge() and + table.custom_copy() to avoid name clashes with luatools. Add + string helpers, including string.parse_braces(). Update algorithms + to work with these changes. + - Allow vectors to have an origin vector, similar to the Position + class. Introduce new alternative table-based syntax for + Vector:set() that is much easier to read. Update unit tests + and algorithms. 2011-05-02 Christian Feuersaenger <ludewich@users.sourceforge.net> - - fpu: added support for log10 and log2 + - fpu: added support for log10 and log2 2011-05-02 Jannis Pohlmann <jannis@xfce.org> - - graph drawing: - - Drop the 'not yet positionedPGFGDINTERNAL' node name prefix - internally. It's stripped off now when nodes are passed over to - Lua and its added back again when shipping the node out to TeX. - - Drop the Node:shortname() method which is no longer needed. - - Improve coding style and documentation of the Interface, Sys, - Node, Edge and Graph classes. - - Rename Sys:logMessage() to Sys:log(). - - Make parameter labels in the API docs not appear in bold. - - Disable verbose logging by default. - - Add methods Edge:getNodes() and Node:getEdges(). + - graph drawing: + - Drop the 'not yet positionedPGFGDINTERNAL' node name prefix + internally. It's stripped off now when nodes are passed over to + Lua and its added back again when shipping the node out to TeX. + - Drop the Node:shortname() method which is no longer needed. + - Improve coding style and documentation of the Interface, Sys, + Node, Edge and Graph classes. + - Rename Sys:logMessage() to Sys:log(). + - Make parameter labels in the API docs not appear in bold. + - Disable verbose logging by default. + - Add methods Edge:getNodes() and Node:getEdges(). 2011-05-02 Jannis Pohlmann <jannis@xfce.org> - - graph drawing: - - Initial work on spring-electrical and layered drawing algorithms. - - Major rework of the Lua code of the graphdrawing library: added - a Vector class for improved math operations and node positioning, - added quite a number of table and iterator helpers, added - post-processing code for fixing the orientation of graph drawings, - updated the graph/node/edge data structures to store nodes in the order - they appear instead of storing them in a random order, implement - coordinate keys for nodes, and much more. + - graph drawing: + - Initial work on spring-electrical and layered drawing algorithms. + - Major rework of the Lua code of the graphdrawing library: added + a Vector class for improved math operations and node positioning, + added quite a number of table and iterator helpers, added + post-processing code for fixing the orientation of graph drawings, + updated the graph/node/edge data structures to store nodes in the order + they appear instead of storing them in a random order, implement + coordinate keys for nodes, and much more. 2011-04-30 Christian Feuersaenger <ludewich@users.sourceforge.net> - - number printing: added '1000 sep in fractionals' switch + - number printing: added '1000 sep in fractionals' switch 2011-04-29 Christophe Jorssen <cjorssen@users.sourceforge.net> - - Work on pgflibraryluamath (added pgfpointnormalised) + - Work on pgflibraryluamath (added pgfpointnormalised) 2011-04-27 Matthias Schulz <ma.schulz@email.de> - - Graphdrawing library documentation, split into two files, removed - noluatex file, reworked the text (added information). + - Graphdrawing library documentation, split into two files, removed + noluatex file, reworked the text (added information). 2011-04-25 Christophe Jorssen <cjorssen@users.sourceforge.net> - - First attempt to do math with lua (very basical): pgflibraryluamath + - First attempt to do math with lua (very basical): pgflibraryluamath 2011-04-18 Christian Feuersaenger <ludewich@users.sourceforge.net> - - bugfix for rounding error in \pgfmathdivide{83.407811000}{16.68156400} - was 4.10, is now 5.0: it could happen in rare cases that digits where - appended where they shouldhave been than added (4 + .10 instead of 4 + 1.0) + - bugfix for rounding error in \pgfmathdivide{83.407811000}{16.68156400} + was 4.10, is now 5.0: it could happen in rare cases that digits where + appended where they shouldhave been than added (4 + .10 instead of 4 + 1.0) 2011-04-22 Jannis Pohlmann <jannis@xfce.org> - - Implemented a G_n subgraph for creating grid (or: mesh) graphs. - This also introduces a new key /tikz/graphs/wrap after=<number> that - configures how the nodes in such a grid graph are connected. Some of - the common subgraph keys such as /tikz/graphs/V and /tikz/graphs/n - can be used with G_n subgraphs as well. - - Added a simple grid placement strategy. It currently does not - support the chain shift and group shift keys properly and does not - implement any placement order other than left-to-right, so there is - room for improvement. + - Implemented a G_n subgraph for creating grid (or: mesh) graphs. + This also introduces a new key /tikz/graphs/wrap after=<number> that + configures how the nodes in such a grid graph are connected. Some of + the common subgraph keys such as /tikz/graphs/V and /tikz/graphs/n + can be used with G_n subgraphs as well. + - Added a simple grid placement strategy. It currently does not + support the chain shift and group shift keys properly and does not + implement any placement order other than left-to-right, so there is + room for improvement. 2011-04-18 Christian Feuersaenger <ludewich@users.sourceforge.net> - - - external lib: reduced number of \newwrite allocations and allowed to disable features - to safe more of them (aux in dpth=false,disable dependency files) + + - external lib: reduced number of \newwrite allocations and allowed to disable features + to safe more of them (aux in dpth=false,disable dependency files) 2011-04-17 Christian Feuersaenger <ludewich@users.sourceforge.net> - - - added '/pgf/number format/relative' formatting style. + + - added '/pgf/number format/relative' formatting style. 2011-03-22 Till Tantau <tantau@users.sourceforge.net> - - Finished documentation of data visualization (sort of)! - - First usable version of data visualization! + - Finished documentation of data visualization (sort of)! + - First usable version of data visualization! 2011-03-15 Till Tantau <tantau@users.sourceforge.net> - - Worked on dv documentation. Finished chapter on visualizers, - style sheets. Legends still missing + - Worked on dv documentation. Finished chapter on visualizers, + style sheets. Legends still missing 2011-03-07 Till Tantau <tantau@users.sourceforge.net> - - Worked on dv documentation. Finished chapter on axes. + - Worked on dv documentation. Finished chapter on axes. 2011-03-07 Christian Feuersaenger <ludewich@users.sourceforge.net> - - - Incorporated a bugfix of Hans Hagen which makes pgf compatible with - Context Mk IV. - Verified: the patch is backwards compatible with TL 2009 and TL 2010 - i.e. Context MkII and it works with Context Mk IV. + + - Incorporated a bugfix of Hans Hagen which makes pgf compatible with + Context Mk IV. + Verified: the patch is backwards compatible with TL 2009 and TL 2010 + i.e. Context MkII and it works with Context Mk IV. 2011-01-22 Till Tantau <tantau@users.sourceforge.net> - - Worked on dv documentation. - + - Worked on dv documentation. + 2011-01-05 Christophe Jorssen <cjorssen@users.sourceforge.net> - - Attempt to fix a bug #1911195 with pgfpages and rotation (fix - contributed by Mark Wibrow). Note: Mark was not sure it has side - effects. + - Attempt to fix a bug #1911195 with pgfpages and rotation (fix + contributed by Mark Wibrow). Note: Mark was not sure it has side + effects. 2010-12-17 Christophe Jorssen <cjorssen@users.sourceforge.net> - - Documentation will now compile with auto-xref enabled (a problem - with \_ in the graph lib not handled correctly by - pgfmanual.pdflinks.code.tex). - - Fix bug #3104978 thanks to Heiko Oberdiek patch on ctt. + - Documentation will now compile with auto-xref enabled (a problem + with \_ in the graph lib not handled correctly by + pgfmanual.pdflinks.code.tex). + - Fix bug #3104978 thanks to Heiko Oberdiek patch on ctt. 2010-12-17 Till Tantau <tantau@users.sourceforge.net> - - Changed the graph syntax for anonymous nodes in the graph - library and simplified the as= syntax. - - Added fresh nodes options to graph library. + - Changed the graph syntax for anonymous nodes in the graph + library and simplified the as= syntax. + - Added fresh nodes options to graph library. 2010-12-14 Till Tantau <tantau@users.sourceforge.net> - - Fixed graph lib so that it compiles with plain TeX. + - Fixed graph lib so that it compiles with plain TeX. 2010-12-10 Till Tantau <tantau@users.sourceforge.net> - - Small fixed in the graph library. + - Small fixed in the graph library. 2010-12-07 Till Tantau <tantau@users.sourceforge.net> - - Finished graph library! + - Finished graph library! 2010-12-06 Till Tantau <tantau@users.sourceforge.net> - - Nearly finished graph lib and its documentation. + - Nearly finished graph lib and its documentation. 2010-11-30 Till Tantau <tantau@users.sourceforge.net> - - Fixed bug #3123605 (hopefully...). - - Worked on graph lib. + - Fixed bug #3123605 (hopefully...). + - Worked on graph lib. 2010-11-19 Christophe Jorssen <cjorssen@users.sourceforge.net> - - Some integer arithmetics functions for the math parser - (contributed by Alain Matthes): gcd, isprime, isodd, iseven + - Some integer arithmetics functions for the math parser + (contributed by Alain Matthes): gcd, isprime, isodd, iseven 2010-11-19 Till Tantau <tantau@users.sourceforge.net> - - Second attempt at making \tikz work also with fragile stuff - following. The new code will no longer fail in a situation - like \tikz \foreach ... - - Worked on graph lib stuff. + - Second attempt at making \tikz work also with fragile stuff + following. The new code will no longer fail in a situation + like \tikz \foreach ... + - Worked on graph lib stuff. 2010-11-06 Christophe Jorssen <cjorssen@users.sourceforge.net> - - A luatex version of the doc is available (fixed inputenc issues - since luatex works with utf8 by default). + - A luatex version of the doc is available (fixed inputenc issues + since luatex works with utf8 by default). 2010-11-04 Christophe Jorssen <cjorssen@users.sourceforge.net> - - Fix bug in pgfmathfunctions.basic.code.tex (bug reported by - Alain Matthes and fixed by Paul Gaborit on fctt): wrong - interaction between pow and exp (linked to \pgfmath@x modified - outside macro call). + - Fix bug in pgfmathfunctions.basic.code.tex (bug reported by + Alain Matthes and fixed by Paul Gaborit on fctt): wrong + interaction between pow and exp (linked to \pgfmath@x modified + outside macro call). 2010-11-01 Christophe Jorssen <cjorssen@users.sourceforge.net> - - Make \pgfkeys@exp@call long (bug reported by Florent Chervet on - fctt) - - Fix bug in pgflibraryshapes.callouts.code.tex: \pgf@test changed - to \pgf@node@name (bug reported by Zarko F. Cucej on ctt and fix - contributed by Mark Wibrow) - + - Make \pgfkeys@exp@call long (bug reported by Florent Chervet on + fctt) + - Fix bug in pgflibraryshapes.callouts.code.tex: \pgf@test changed + to \pgf@node@name (bug reported by Zarko F. Cucej on ctt and fix + contributed by Mark Wibrow) + 2010-10-27 Christophe Jorssen <cjorssen@users.sourceforge.net> - - fixed bug 3096333 (Fix contributed by Mark Wibrow): pgffor - failed to update \lastx in some cases - + - fixed bug 3096333 (Fix contributed by Mark Wibrow): pgffor + failed to update \lastx in some cases + 2010-10-25 Christian Feuersaenger <ludewich@users.sourceforge.net> - Released version 2.10 + Released version 2.10 2010-10-22 Christian Feuersaenger <ludewich@users.sourceforge.net> - - closed a lot of bugs on sourceforge, especially documentation bugs - - fixed bug 2429749: gnuplot invocation in tabularx did not work. + - closed a lot of bugs on sourceforge, especially documentation bugs + - fixed bug 2429749: gnuplot invocation in tabularx did not work. 2010-10-21 Christian Feuersaenger <ludewich@users.sourceforge.net> - - fixed bug: there was an incompatibility between pgf and beamer due to a - missing \interlineskip in the shipout handling for latex. + - fixed bug: there was an incompatibility between pgf and beamer due to a + missing \interlineskip in the shipout handling for latex. 2010-10-15 Christian Feuersaenger <ludewich@users.sourceforge.net> - - renamed 'halfcircle' marker to 'halfcircle*' and added 'halfcircle'. - - provided special case 'mark color=none' for the half-filled markers. + - renamed 'halfcircle' marker to 'halfcircle*' and added 'halfcircle'. + - provided special case 'mark color=none' for the half-filled markers. 2010-10-13 Christian Feuersaenger <ludewich@users.sourceforge.net> - - fixed incorrect fill/stroke coloring of new marker contributions (see - ChangeLog 2010-09-27) - - added more predefined dashed and dotted line patterns for black/white plots - to fulfill a related feature request of Tomek - - fixed bug: the 'name path global' feature did not work in every case... - the actual implementation might need to be revised eventually. + - fixed incorrect fill/stroke coloring of new marker contributions (see + ChangeLog 2010-09-27) + - added more predefined dashed and dotted line patterns for black/white plots + to fulfill a related feature request of Tomek + - fixed bug: the 'name path global' feature did not work in every case... + the actual implementation might need to be revised eventually. 2010-10-12 Christian Feuersaenger <ludewich@users.sourceforge.net> - - Imported spell checking results of Stefan Pinnow (thanks!) - - Dealed with typo in 'sci generic' number formatting style: it now - accepts 'mantissa' *and* 'mantisse' + - Imported spell checking results of Stefan Pinnow (thanks!) + - Dealed with typo in 'sci generic' number formatting style: it now + accepts 'mantissa' *and* 'mantisse' 2010-10-11 Christian Feuersaenger <ludewich@users.sourceforge.net> - - - External lib: Fixed bug. The 'failed ref warnings for' was not properly \protect'ed. + + - External lib: Fixed bug. The 'failed ref warnings for' was not properly \protect'ed. 2010-09-27 Till Tantau <tantua@users.sourceforge.net> - - Started on graph lib. Not yet finished and not documented. - + - Started on graph lib. Not yet finished and not documented. + 2010-09-21 Christian Feuersaenger <ludewich@users.sourceforge.net> - - Added plot markers of Magnus Tewes and Tomek: halfcircle, halfsquare*, - halfsquare left*, halfsquare right*, heart + - Added plot markers of Magnus Tewes and Tomek: halfcircle, halfsquare*, + halfsquare left*, halfsquare right*, heart 2010-09-08 Till Tantau <tantua@users.sourceforge.net> - - Added \pgfpositionnodelater and \pgfpositionnodenow - commands. - + - Added \pgfpositionnodelater and \pgfpositionnodenow + commands. + 2010-08-31 Christian Feuersaenger <ludewich@users.sourceforge.net> - - externalization+\ref: fixed a bug + - externalization+\ref: fixed a bug 2010-08-30 Christian Feuersaenger <ludewich@users.sourceforge.net> - - external lib: documented how to generate .png graphics and added support - switches. + - external lib: documented how to generate .png graphics and added support + switches. 2010-08-26 Christian Feuersaenger <ludewich@users.sourceforge.net> - - added 'baseline=default', 'trim left=default' and 'trim right=default' choices to reset these keys. + - added 'baseline=default', 'trim left=default' and 'trim right=default' choices to reset these keys. 2010-08-25 Christian Feuersaenger <ludewich@users.sourceforge.net> - - added support to provide paragraphs in "pin" arguments + - added support to provide paragraphs in "pin" arguments 2010-08-24 Till Tantau <tantau@users.sourceforge.net> - - Worked on data visualization and its documentation. + - Worked on data visualization and its documentation. 2010-08-23 Christian Feuersaenger <ludewich@users.sourceforge.net> - - - basic level externalization: added \hoffset=0pt and \voffset=0pt to improve - compatibility with special document classes - - added docs for \deferredanchor feature contributed by Christophe Jorssen <cjorssen@users.sourceforge.net> - - ConTeXt support: fixed loading problem of calendar lib + + - basic level externalization: added \hoffset=0pt and \voffset=0pt to improve + compatibility with special document classes + - added docs for \deferredanchor feature contributed by Christophe Jorssen <cjorssen@users.sourceforge.net> + - ConTeXt support: fixed loading problem of calendar lib 2010-08-18 Christian Feuersaenger <ludewich@users.sourceforge.net> - - pgfsys-tex4ht.def: fixed problem with \par in a non-long macro argument, - thereby eliminating a compilation problem - - pgfsys-tex4ht.def: renamed offending macro invocation \Par to \par + - pgfsys-tex4ht.def: fixed problem with \par in a non-long macro argument, + thereby eliminating a compilation problem + - pgfsys-tex4ht.def: renamed offending macro invocation \Par to \par 2010-08-16 Christian Feuersaenger <ludewich@users.sourceforge.net> - - - basic level image externalization: added '/pgf/images/trim external={<left>}{<bottom>}{<right>}{<top>}' - to allow modifications to the hardcoded '1truein' shifts. - - added '/.style n args' key. - - \usetikzlibrary / \usepgflibrary: added support for white-space trimming - and empty arguments in the lists. Now, lines do not need to be terminated - by '%' and ',,' is valid. + + - basic level image externalization: added '/pgf/images/trim external={<left>}{<bottom>}{<right>}{<top>}' + to allow modifications to the hardcoded '1truein' shifts. + - added '/.style n args' key. + - \usetikzlibrary / \usepgflibrary: added support for white-space trimming + and empty arguments in the lists. Now, lines do not need to be terminated + by '%' and ',,' is valid. 2010-08-13 Christian Feuersaenger <ludewich@users.sourceforge.net> - - external lib: documented how to solve compatibility problems with - \tikzifexternalizing + - external lib: documented how to solve compatibility problems with + \tikzifexternalizing 2010-08-11 Christian Feuersaenger <ludewich@users.sourceforge.net> - - - added \deferredanchor feature contributed by Christophe Jorssen <cjorssen@users.sourceforge.net> + + - added \deferredanchor feature contributed by Christophe Jorssen <cjorssen@users.sourceforge.net> 2010-08-03 Christian Feuersaenger <ludewich@users.sourceforge.net> - - added optimized and numerically stable arc path command - \pgfpatharctoprecomputed which interpolates start- and end points - + - added optimized and numerically stable arc path command + \pgfpatharctoprecomputed which interpolates start- and end points + 2010-07-10 Christian Feuersaenger <ludewich@users.sourceforge.net> - - - external lib: fixed incompatibility with 2010/06/08 v2.0b eso-pic package + + - external lib: fixed incompatibility with 2010/06/08 v2.0b eso-pic package 2010-07-06 Christian Feuersaenger <ludewich@users.sourceforge.net> - - external lib: added sanity checking for failed \ref,\pageref,\cite commands in external images. + - external lib: added sanity checking for failed \ref,\pageref,\cite commands in external images. 2010-07-01 Christian Feuersaenger <ludewich@users.sourceforge.net> - - - math parser: improved error messages by providing the complete math expression. + + - math parser: improved error messages by providing the complete math expression. 2010-06-30 Christian Feuersaenger <ludewich@users.sourceforge.net> - - - added 'trim left' and 'trim right' features to simplify bounding box - modifications and allow support for restricted bounding boxes and image - externalization. + + - added 'trim left' and 'trim right' features to simplify bounding box + modifications and allow support for restricted bounding boxes and image + externalization. 2010-06-16 Christian Feuersaenger <ludewich@users.sourceforge.net> - - - pgfutil-latex.def: changed \usepackage to \RequirePackage (thanks to Christophe Jorssen) - - external lib: added \tikzappendtofigurename{} shortcut for '\tikzset{external/figure name/.add={}{suffix}}' + + - pgfutil-latex.def: changed \usepackage to \RequirePackage (thanks to Christophe Jorssen) + - external lib: added \tikzappendtofigurename{} shortcut for '\tikzset{external/figure name/.add={}{suffix}}' 2010-06-14 Christian Feuersaenger <ludewich@users.sourceforge.net> - - - external lib: added warning at end of document if not all graphics have - been found. + + - external lib: added warning at end of document if not all graphics have + been found. 2010-06-10 Christian Feuersaenger <ludewich@users.sourceforge.net> - - - updated file 'tikzexternal.sty' for \label and \ref support inside of - externalized graphics - - documented how \label and \ref support in external graphics works. - - activated \label support for mode=convert with system call and - documented limitations. + + - updated file 'tikzexternal.sty' for \label and \ref support inside of + externalized graphics + - documented how \label and \ref support in external graphics works. + - activated \label support for mode=convert with system call and + documented limitations. 2010-06-09 Christian Feuersaenger <ludewich@users.sourceforge.net> - - added \tikzifinpicture{<true code>}{<false code>} macro + - added \tikzifinpicture{<true code>}{<false code>} macro 2010-05-31 Till Tantau <tantau@users.sourceforge.net> - - Worked on data visualization. + - Worked on data visualization. 2010-05-30 Till Tantau <tantau@users.sourceforge.net> - - Added .list key handler. + - Added .list key handler. 2010-05-26 Till Tantau <tantau@users.sourceforge.net> - - Worked on data visualization. - + - Worked on data visualization. + 2010-05-06 Christian Feuersaenger <ludewich@users.sourceforge.net> - - improved sanity checking in number printer: now, the zero flag is - checked even if its exponent > 0 + - improved sanity checking in number printer: now, the zero flag is + checked even if its exponent > 0 2010-04-22 Christian Feuersaenger <ludewich@users.sourceforge.net> - - floatparsenumber: number format errors after exponents now contain the offending - character instead of '\relax' + - floatparsenumber: number format errors after exponents now contain the offending + character instead of '\relax' 2010-04-12 Christian Feuersaenger <ludewich@users.sourceforge.net> - - number printer: added 'frac denom' and 'frac whole' for fine tuning of - fractional number printing. + - number printer: added 'frac denom' and 'frac whole' for fine tuning of + fractional number printing. 2010-04-10 Christian Feuersaenger <ludewich@users.sourceforge.net> - - number printer: made \protect portable across TeX variants (doesn't - produce bugs with context anymore) - - fpu: optimized \pgfmathfloatgetflagstomacro + - number printer: made \protect portable across TeX variants (doesn't + produce bugs with context anymore) + - fpu: optimized \pgfmathfloatgetflagstomacro 2010-04-09 Christian Feuersaenger <ludewich@users.sourceforge.net> - - added \pgfresetboundingbox - - added \pgfgetlastxy coordinate macro - - added '/pgf/images/include external/<image name>' code key. + - added \pgfresetboundingbox + - added \pgfgetlastxy coordinate macro + - added '/pgf/images/include external/<image name>' code key. 2010-04-08 Christian Feuersaenger <ludewich@users.sourceforge.net> - - fpu: added convenience method \pgfmathfloattoint + - fpu: added convenience method \pgfmathfloattoint 2010-03-31 Christian Feuersaenger <ludewich@users.sourceforge.net> - - number printer: added 'frac' style to automatically create fractionals. + - number printer: added 'frac' style to automatically create fractionals. 2010-03-25 Christian Feuersaenger <ludewich@users.sourceforge.net> - - splitted basic level file pgfcoreimage.code.tex: there is now a - pgfcoreexternal.code.tex file. + - splitted basic level file pgfcoreimage.code.tex: there is now a + pgfcoreexternal.code.tex file. 2010-03-24 Christian Feuersaenger <ludewich@users.sourceforge.net> - - \pgfmathprintnumber is no longer a "fragile" command (it is \protect'ed - automatically in LaTeX). + - \pgfmathprintnumber is no longer a "fragile" command (it is \protect'ed + automatically in LaTeX). 2010-03-23 Till Tantau <tantau@users.sourceforge.net> - - Fixed baseline alignment with "text width" option in LaTeX. + - Fixed baseline alignment with "text width" option in LaTeX. 2010-03-23 Mark Wibrow <vibrovski@users.sourceforge.net> - - New divide function - - Rewrote code foreach extensions. Now no longer an impenetrable mess. - pgffor.code.tex is much larger, but contains some (as yet) undocumented - features which may get optimised out. - + - New divide function + - Rewrote code foreach extensions. Now no longer an impenetrable mess. + pgffor.code.tex is much larger, but contains some (as yet) undocumented + features which may get optimised out. + 2010-03-19 Christian Feuersaenger <ludewich@users.sourceforge.net> - - Image externalization: added '/pgf/images/aux in dpth' feature. - It allows to store \label and other .aux file related stuff in the image's - .dpth file which is processed when when the main document includes the - image. - The new switch is on for the semi-automatic modes of the external lib, otherwise it is - off. + - Image externalization: added '/pgf/images/aux in dpth' feature. + It allows to store \label and other .aux file related stuff in the image's + .dpth file which is processed when when the main document includes the + image. + The new switch is on for the semi-automatic modes of the external lib, otherwise it is + off. 2010-03-17 Christian Feuersaenger <ludewich@users.sourceforge.net> - - pgfkeys: added '.code n args' handler. The difference to '.code - args={#1#2#3}' is that keys defined with 'code n args' gobble spaces - between the arguments. - Note: 'code 2 args' remains as-is (it has the special feature that the - second argument is optional). - - fixed bug in '/.add code' key handler: it didn't work properly for - complicated keys - - pgfkeys manual section: updated xrefs and docs + - pgfkeys: added '.code n args' handler. The difference to '.code + args={#1#2#3}' is that keys defined with 'code n args' gobble spaces + between the arguments. + Note: 'code 2 args' remains as-is (it has the special feature that the + second argument is optional). + - fixed bug in '/.add code' key handler: it didn't work properly for + complicated keys + - pgfkeys manual section: updated xrefs and docs 2010-03-15 Christian Feuersaenger <ludewich@users.sourceforge.net> - - external lib: \tikzexternalize no longer needs (but still accepts) the - main job's name. Changes are now documented and the replacement |.sty| - file has been updated. - - intersection lib: added 'name path global' feature. + - external lib: \tikzexternalize no longer needs (but still accepts) the + main job's name. Changes are now documented and the replacement |.sty| + file has been updated. + - intersection lib: added 'name path global' feature. 2010-03-11 Christian Feuersaenger <ludewich@users.sourceforge.net> - - external lib: partially fixed incompatibility with glossary package and - documented work-around + - external lib: partially fixed incompatibility with glossary package and + documented work-around 2010-03-05 Christian Feuersaenger <ludewich@users.sourceforge.net> - - FPU: added \pgfmathfloatifapproxequalrel - - number printing: added style to configure |sci precision| - - number printing: added style to configure |std=<lower e>:<upper e>| + - FPU: added \pgfmathfloatifapproxequalrel + - number printing: added style to configure |sci precision| + - number printing: added style to configure |std=<lower e>:<upper e>| 2010-03-03 Christian Feuersaenger <ludewich@users.sourceforge.net> - - - external lib: the <real job's name> argument from \tikzexternalize is - now optional. It can be deduced automatically if it is missing. + + - external lib: the <real job's name> argument from \tikzexternalize is + now optional. It can be deduced automatically if it is missing. 2010-02-18 Christian Feuersaenger <ludewich@users.sourceforge.net> - - number printing: added 'sci generic' style to customize the appearance - of scientific format and a 'verbatim' style which doesn't use TeX macros - for the formatted numbers. + - number printing: added 'sci generic' style to customize the appearance + of scientific format and a 'verbatim' style which doesn't use TeX macros + for the formatted numbers. 2010-02-17 Christian Feuersaenger <ludewich@users.sourceforge.net> - - external lib: now, a |\jobname.auxlock| file will be generated in order - to detect whether the \jobname.aux file is in its final state. This allows - to export any images containing |\ref{}| manually; the automatic procedure - will not use the .aux file. + - external lib: now, a |\jobname.auxlock| file will be generated in order + to detect whether the \jobname.aux file is in its final state. This allows + to export any images containing |\ref{}| manually; the automatic procedure + will not use the .aux file. 2010-02-16 Christian Feuersaenger <ludewich@users.sourceforge.net> - - Added \ifpgfexternalreadmainaux switch. Will be used to avoid buffering - problems during externalization mode 'convert with system call'. + - Added \ifpgfexternalreadmainaux switch. Will be used to avoid buffering + problems during externalization mode 'convert with system call'. 2010-02-16 Till Tantau <tantau@users.sourceforge.net> - - Fixed bug "papersize not supported by pgfsys-xetex.def - ID: 2934982" + - Fixed bug "papersize not supported by pgfsys-xetex.def - ID: 2934982" 2010-02-09 Christian Feuersaenger <ludewich@users.sourceforge.net> - - Improved automatic cross referencing: auto key path prefixing failed for - spaces in key paths. + - Improved automatic cross referencing: auto key path prefixing failed for + spaces in key paths. 2010-02-08 Till Tantau <tantau@users.sourceforge.net> - - Added "on background layer" key to backgrounds lib. + - Added "on background layer" key to backgrounds lib. 2010-02-02 Christian Feuersaenger <ludewich@users.sourceforge.net> - - added \pgfmathifisint - - supported \nofiles in auto xref generation + - added \pgfmathifisint + - supported \nofiles in auto xref generation 2010-02-01 Christian Feuersaenger <ludewich@users.sourceforge.net> - - - externalization: both, basic layer and external lib now support \ref{}s - inside of externalized pictures. Furthermore, they won't generate any aux - files on their own (which wouldn't be thread safe and is not useful - anyway) + + - externalization: both, basic layer and external lib now support \ref{}s + inside of externalized pictures. Furthermore, they won't generate any aux + files on their own (which wouldn't be thread safe and is not useful + anyway) 2010-01-29 Christian Feuersaenger <ludewich@users.sourceforge.net> - - external lib: fixed bug with figure list/makefile handling and file - deps: calling file dependency handlings outside of a picture could result - in compilation failures + - external lib: fixed bug with figure list/makefile handling and file + deps: calling file dependency handlings outside of a picture could result + in compilation failures 2010-01-27 Christian Feuersaenger <ludewich@users.sourceforge.net> - - external lib: mode=list and make now supports the force remake keys. - - external lib: the -shell-escape switch for nested system calls is - activated only if it was active for the main document. This should allow a - reasonable security measure for mode=list and make (which will also work - without system calls from within TeX). + - external lib: mode=list and make now supports the force remake keys. + - external lib: the -shell-escape switch for nested system calls is + activated only if it was active for the main document. This should allow a + reasonable security measure for mode=list and make (which will also work + without system calls from within TeX). 2010-01-18 Christian Feuersaenger <ludewich@users.sourceforge.net> - - external lib: added support for file dependencies. - For mode=list and make, any file dependencies configured with - \tikzpicturedependsonfile{<name>} will be checked by the generated - makefile. + - external lib: added support for file dependencies. + For mode=list and make, any file dependencies configured with + \tikzpicturedependsonfile{<name>} will be checked by the generated + makefile. 2010-01-16 Christian Feuersaenger <ludewich@users.sourceforge.net> - - profiler library now uses an output file which contains the current date - and time. Furthermore, it counts every invocation and allows to show every - command invocation (optionally with arguments expanded). + - profiler library now uses an output file which contains the current date + and time. Furthermore, it counts every invocation and allows to show every + command invocation (optionally with arguments expanded). 2010-01-14 Christian Feuersaenger <ludewich@users.sourceforge.net> - - profiler library can now profile macros with arbitrary argument pattern - and is more rebust with respect to save stack usage + - profiler library can now profile macros with arbitrary argument pattern + and is more rebust with respect to save stack usage 2010-01-11 Christian Feuersaenger <ludewich@users.sourceforge.net> - - worked on profiler library and added docs for it. + - worked on profiler library and added docs for it. 2010-01-10 Christian Feuersaenger <ludewich@users.sourceforge.net> - - added first draft of the pgf 'profiler' library + - added first draft of the pgf 'profiler' library 2010-01-07 Mark Wibrow <vibrovski@users.sourceforge.net> - - Fix for rounded corners affecting custom fills in rectangle - split shape. + - Fix for rounded corners affecting custom fills in rectangle + split shape. 2009-12-29 Christian Feuersaenger <ludewich@users.sourceforge.net> - - updated the 'make dist' documentation target such that it compresses - every pdf object. The resulting manual is half as large than without - compression, but it requires pdf 1.5 (at least acrobat 6.0). + - updated the 'make dist' documentation target such that it compresses + every pdf object. The resulting manual is half as large than without + compression, but it requires pdf 1.5 (at least acrobat 6.0). 2009-12-22 Christian Feuersaenger <ludewich@users.sourceforge.net> - - external lib: some output messages did not respect the 'verbose - IO=false' flag; fixed that - - fixed buggy treatment of some automatic cross references in manual + - external lib: some output messages did not respect the 'verbose + IO=false' flag; fixed that + - fixed buggy treatment of some automatic cross references in manual 2009-12-15 Christian Feuersaenger <ludewich@users.sourceforge.net> - - external lib: improved the tikzexternal.sty package which can be used - without pgf installed. + - external lib: improved the tikzexternal.sty package which can be used + without pgf installed. 2009-12-04 Till Tantau <tantau@users.sourceforge.net> - - added spy library. - + - added spy library. + 2009-12-02 Christian Feuersaenger <ludewich@users.sourceforge.net> - - - imported a patch of Andy Schlaikjer which extends the 'plot gnuplot' - feature to read the ``unbounded point'' information provided by gnuplot. + + - imported a patch of Andy Schlaikjer which extends the 'plot gnuplot' + feature to read the ``unbounded point'' information provided by gnuplot. 2009-11-29 Christian Feuersaenger <ludewich@users.sourceforge.net> - - added \r@pgf@reada temporary \openin register for compatibility with - other packages + - added \r@pgf@reada temporary \openin register for compatibility with + other packages 2009-11-19 Christian Feuersaenger <ludewich@users.sourceforge.net> - - fixed an auto xref bug which wrote '\pgfkeys{}' although the manual - contained |\pgfkeys|. + - fixed an auto xref bug which wrote '\pgfkeys{}' although the manual + contained |\pgfkeys|. 2009-11-18 Christian Feuersaenger <ludewich@users.sourceforge.net> - - external lib: the 'optimize command away' things where not activated - accidentally. I fixed it. - - added support for new paragraphs in pgfkeys values - - fixed bug in |const plot| handler (and all its variants): the first - coordinate was transformed twice + - external lib: the 'optimize command away' things where not activated + accidentally. I fixed it. + - added support for new paragraphs in pgfkeys values + - fixed bug in |const plot| handler (and all its variants): the first + coordinate was transformed twice 2009-11-15 Christian Feuersaenger <ludewich@users.sourceforge.net> - - auto xrefs now support point coordinate systems. - - auto xrefs now provide an interface to deal with tricky active - characters (for |-) - - external lib: improved compatibility with |fadings| libary. - - replaced 'set terminal table; set output "<file>"' by 'set table "<file>"' - to maintain compatibility with the new gnuplot version. + - auto xrefs now support point coordinate systems. + - auto xrefs now provide an interface to deal with tricky active + characters (for |-) + - external lib: improved compatibility with |fadings| libary. + - replaced 'set terminal table; set output "<file>"' by 'set table "<file>"' + to maintain compatibility with the new gnuplot version. 2009-11-14 Christian Feuersaenger <ludewich@users.sourceforge.net> - - pgfmanual.pdf: provided a 'make dist' target in version_for_pdftex/en - which activates automatic hyper references from codeexamples to key - declarations. - This utilizes larger memory limits, configured in - doc/generic/pgf/text-en/texmf.cnf + - pgfmanual.pdf: provided a 'make dist' target in version_for_pdftex/en + which activates automatic hyper references from codeexamples to key + declarations. + This utilizes larger memory limits, configured in + doc/generic/pgf/text-en/texmf.cnf 2009-11-12 Christian Feuersaenger <ludewich@users.sourceforge.net> - - Added the 'small mindmap' style. + - Added the 'small mindmap' style. 2009-11-06 Christian Feuersaenger <ludewich@users.sourceforge.net> - - FPU: improved sanity checks and exception handling for the decompose - routines (pgfmathfloatgetexponent etc) and the number parser. - Added exception 'wrong lowlevel format'. + - FPU: improved sanity checks and exception handling for the decompose + routines (pgfmathfloatgetexponent etc) and the number parser. + Added exception 'wrong lowlevel format'. 2009-10-20 Christian Feuersaenger <ludewich@users.sourceforge.net> - - renamed 'text mark/style' to 'text mark style' and 'text mark/as node' - to 'text mark as node' (there are backw. compatibility hooks). - This should avoid confusion with '.unknown' handlers. + - renamed 'text mark/style' to 'text mark style' and 'text mark/as node' + to 'text mark as node' (there are backw. compatibility hooks). + This should avoid confusion with '.unknown' handlers. 2009-10-19 Christian Feuersaenger <ludewich@users.sourceforge.net> - - - improved error recovery of external lib. + + - improved error recovery of external lib. 2009-10-16 Christian Feuersaenger <ludewich@users.sourceforge.net> - - temporarily disabled the auto cross references -- it seems they compile - only with increased memory. + - temporarily disabled the auto cross references -- it seems they compile + only with increased memory. 2009-10-15 Christian Feuersaenger <ludewich@users.sourceforge.net> - - Installed preliminary version of automatic cross referencing tool. - Now, every codeexample is parsed for options and control sequences which - have been defined somewhere else in the document; pdf cross references are - built automatically as well. - - configured links to be blue throughout the document. - - external lib: added \tikzexternaldisable such that partial externalization is possible - although the document contains unsupported constructs (where environments - can't be identified without macro expansion). - The pgfmanual compiles with image externalization now. + - Installed preliminary version of automatic cross referencing tool. + Now, every codeexample is parsed for options and control sequences which + have been defined somewhere else in the document; pdf cross references are + built automatically as well. + - configured links to be blue throughout the document. + - external lib: added \tikzexternaldisable such that partial externalization is possible + although the document contains unsupported constructs (where environments + can't be identified without macro expansion). + The pgfmanual compiles with image externalization now. 2009-10-13 Christian Feuersaenger <ludewich@users.sourceforge.net> - - added \pgfutilsolvetwotwoleq to solve 2x2 linear equation systems using - column pivotisation and gauss elim. Should result in improved quality - compared with \pgftransforminvert as internal equation solver + - added \pgfutilsolvetwotwoleq to solve 2x2 linear equation systems using + column pivotisation and gauss elim. Should result in improved quality + compared with \pgftransforminvert as internal equation solver 2009-10-09 Christian Feuersaenger <ludewich@users.sourceforge.net> - - Defined \pgfdeclaregenericanchor to allow anchors which get the shape - name as argument. Only useful internally. + - Defined \pgfdeclaregenericanchor to allow anchors which get the shape + name as argument. Only useful internally. 2009-09-15 Christian Feuersaenger <ludewich@users.sourceforge.net> - - Fixed buggy treatment of white spaces in \jobname and 'plot function' - using \pgfutilpreparefilename. + - Fixed buggy treatment of white spaces in \jobname and 'plot function' + using \pgfutilpreparefilename. 2009-09-04 Till Tantau <tantau@users.sourceforge.net> - - Fixed bug item #2834141 [wrong reversed double arrows] - - Fixed bug item #2834233 [shapes libraries] - - Fixed bug item #2822265 [tangent coordinates not working in CVS] - - Changed \rm to \tf in Context. + - Fixed bug item #2834141 [wrong reversed double arrows] + - Fixed bug item #2834233 [shapes libraries] + - Fixed bug item #2822265 [tangent coordinates not working in CVS] + - Changed \rm to \tf in Context. 2009-07-31 Christian Feuersaenger <ludewich@users.sourceforge.net> - - external lib: added 'mode=list and make'. Now, image externalisation - time can be reduced with 'make -j 2 -f mainfile.makefile'. + - external lib: added 'mode=list and make'. Now, image externalisation + time can be reduced with 'make -j 2 -f mainfile.makefile'. 2009-07-08 Christian Feuersaenger <ludewich@users.sourceforge.net> - - external lib: fixed treatment of long arguments in \tikz ... ; shortcut - command. + - external lib: fixed treatment of long arguments in \tikz ... ; shortcut + command. 2009-06-30 Christian Feuersaenger <ludewich@users.sourceforge.net> - - fixed white space bug in \pgfkeysdeactivatefamily - - added \pgfmathfloatvalueof + - fixed white space bug in \pgfkeysdeactivatefamily + - added \pgfmathfloatvalueof 2009-06-22 Christian Feuersaenger <ludewich@users.sourceforge.net> - - added a '*' feature to '\pgfmathdeclarefunction' which overwrites - existing functions. + - added a '*' feature to '\pgfmathdeclarefunction' which overwrites + existing functions. 2009-06-11 Christian Feuersaenger <ludewich@users.sourceforge.net> - - added '/tikz/no marks' key. - - fixed typo in external lib documentation: the key is called 'figure name', - not 'file name' + - added '/tikz/no marks' key. + - fixed typo in external lib documentation: the key is called 'figure name', + not 'file name' 2009-06-10 Christian Feuersaenger <ludewich@users.sourceforge.net> - - - added \pgfgettransformentries and \pgfsettransformentries. - - updated the external library such that it deals with active characters - in the same way as without external library. - - fixed bug in fpu cosh, sinh and tanh + + - added \pgfgettransformentries and \pgfsettransformentries. + - updated the external library such that it deals with active characters + in the same way as without external library. + - fixed bug in fpu cosh, sinh and tanh 2009-06-09 Christian Feuersaenger <ludewich@users.sourceforge.net> - - provided two new aliases for key filters, added \pgfkeyssetfamily. + - provided two new aliases for key filters, added \pgfkeyssetfamily. 2009-05-29 Christian Feuersaenger <ludewich@users.sourceforge.net> - - allowed numbers like '.9' in fpu. + - allowed numbers like '.9' in fpu. 2009-02-29 Mark Wibrow <vibrovski@users.sourceforge.net> - - Fix for signal shape. + - Fix for signal shape. 2009-05-22 Jin-Hwan Cho <jinhwancho@users.sourceforge.net> - - Applied the patches for dvipdfmx driver, - pgf-doc-diff.version2cvs (2009-04-18) and - pgf-generic-diff.version2cvs (2009-04-19). + - Applied the patches for dvipdfmx driver, + pgf-doc-diff.version2cvs (2009-04-18) and + pgf-generic-diff.version2cvs (2009-04-19). 2009-05-18 Christian Feuersaenger <ludewich@users.sourceforge.net> - - Restored processing of unknown keys in the predefined key filters 'and', - 'not', 'or' and 'false': it was not improvement... + - Restored processing of unknown keys in the predefined key filters 'and', + 'not', 'or' and 'false': it was not improvement... 2009-05-17 Christian Feuersaenger <ludewich@users.sourceforge.net> - - fixed the sequence of arguments of - \pgfqkeysactivatefamiliesandfilteroptions and - \pgfqkeysactivatesinglefamilyandfilteroptions - in the reference manual. + - fixed the sequence of arguments of + \pgfqkeysactivatefamiliesandfilteroptions and + \pgfqkeysactivatesinglefamilyandfilteroptions + in the reference manual. 2009-05-16 Christian Feuersaenger <ludewich@users.sourceforge.net> - - key filtering: the composed key filter handlers 'not', 'and', 'false' and 'or' now - ignore unknown options and call the .unknown handlers. - - pgfkeys: removed the experimental \pgfkeyssetdefaultpathforhandled method. - It doesn't fit into the clean interface for pgfkeys - and the problem of - default paths for handled keys can be solved better with the '/handler - config' method. + - key filtering: the composed key filter handlers 'not', 'and', 'false' and 'or' now + ignore unknown options and call the .unknown handlers. + - pgfkeys: removed the experimental \pgfkeyssetdefaultpathforhandled method. + It doesn't fit into the clean interface for pgfkeys - and the problem of + default paths for handled keys can be solved better with the '/handler + config' method. 2009-04-24 Christian Feuersaenger <ludewich@users.sourceforge.net> - - provided API function \pgfmathfloatifflags to simplify special cases in - FPU. + - provided API function \pgfmathfloatifflags to simplify special cases in + FPU. 2009-04-23 Christian Feuersaenger <ludewich@users.sourceforge.net> - - added (primitive) veclen implementation for FPU. - - added cosh, sinh, tanh to FPU + - added (primitive) veclen implementation for FPU. + - added cosh, sinh, tanh to FPU 2009-04-21 Christian Feuersaenger <ludewich@users.sourceforge.net> - - fixed bug in external lib: empty lines in tikzpicture environments were not accepted - for some operating modes. + - fixed bug in external lib: empty lines in tikzpicture environments were not accepted + for some operating modes. 2009-04-18 Christian Feuersaenger <ludewich@users.sourceforge.net> - - added \pgfqpointscale + - added \pgfqpointscale 2009-04-08 Christian Feuersaenger <ludewich@users.sourceforge.net> - - added an optional argument count to 'optimize command away' in external - library. + - added an optional argument count to 'optimize command away' in external + library. 2009-04-03 Christian Feuersaenger <ludewich@users.sourceforge.net> - - added the |figure name| key to the externalization library - - improved docs for externalization library + - added the |figure name| key to the externalization library + - improved docs for externalization library 2009-03-30 Christian Feuersaenger <ludewich@users.sourceforge.net> - - improved sanity checking of floating point comparison: does now also - yield results for infty/nan - - added fix for precedence bug for unary minus (fix has been suggested by - Mark Wibrow, by mail conversation) + - improved sanity checking of floating point comparison: does now also + yield results for infty/nan + - added fix for precedence bug for unary minus (fix has been suggested by + Mark Wibrow, by mail conversation) 2009-03-22 Till Tantau <tantau@users.sourceforge.net> - - Replaced \z@ by 0pt for context. + - Replaced \z@ by 0pt for context. 2009-03-21 Christian Feuersaenger <ludewich@users.sourceforge.net> - - external library: fixed the 'optimize' feature: pictures which won't be - exported could not be optimized away (although they should) + - external library: fixed the 'optimize' feature: pictures which won't be + exported could not be optimized away (although they should) 2009-03-20 Till Tantau <tantau@users.sourceforge.net> - - Replaced \toks@ and \voidb@x by \pgfutil@toks@ and - \pgfutil@voidb@x. + - Replaced \toks@ and \voidb@x by \pgfutil@toks@ and + \pgfutil@voidb@x. 2009-03-14 Christian Feuersaenger <ludewich@users.sourceforge.net> - - improved docs for .search also. - - fixed initial value for 'domain' such that it really uses the default - samples=25. - + - improved docs for .search also. + - fixed initial value for 'domain' such that it really uses the default + samples=25. + 2009-03-09 Till Tantau <tantau@users.sourceforge.net> - - Added patch for context color support in luatex. + - Added patch for context color support in luatex. 2009-02-26 Christian Feuersaenger <ludewich@users.sourceforge.net> - - improved the optimization facilities of the external library: - |optimize=false| will now properly restore any optimized material - when used in \tikzset - + - improved the optimization facilities of the external library: + |optimize=false| will now properly restore any optimized material + when used in \tikzset + 2009-02-23 Christian Feuersaenger <ludewich@users.sourceforge.net> - - added |/handler config=all,only existing,full or existing| - configuration. - - added |.search also| key handler as a simple implementation of key - search paths. - - fixed default value for /tikz/samples at- there are no really 25 - samples, not 26. I forgot to fix this last time when I fixed 'samples' + - added |/handler config=all,only existing,full or existing| + configuration. + - added |.search also| key handler as a simple implementation of key + search paths. + - fixed default value for /tikz/samples at- there are no really 25 + samples, not 26. I forgot to fix this last time when I fixed 'samples' 2009-02-20 Christian Feuersaenger <ludewich@users.sourceforge.net> - - added |\pgfkeyssetdefaultpathforhandled| feature as improvement for - multiple key paths to pgfkeys. Reference documentation and an - application example is in the manual. + - added |\pgfkeyssetdefaultpathforhandled| feature as improvement for + multiple key paths to pgfkeys. Reference documentation and an + application example is in the manual. 2009-02-13 Christian Feuersaenger <ludewich@users.sourceforge.net> - - added 'mark=text' which draws arbitrary TeX content as plot marks to - plot mark library. + - added 'mark=text' which draws arbitrary TeX content as plot marks to + plot mark library. 2009-02-06 Mark Wibrow <vibrovski@users.sourceforge.net> - - Added key 'define function' to define simple local functions. + - Added key 'define function' to define simple local functions. 2009-02-04 Till Tantau <tantau@users.sourceforge.net> - - Worked on dv stuff. - + - Worked on dv stuff. + 2009-02-01 Mark Wibrow <vibrovski@users.sourceforge.net> - - Index argument to array is automatically truncated to an - integer. - - Text decoration can now be aligned along or fitted to a path. - - Added key '/pgf/decoration/reverse path' to decorate a path - backwards. + - Index argument to array is automatically truncated to an + integer. + - Text decoration can now be aligned along or fitted to a path. + - Added key '/pgf/decoration/reverse path' to decorate a path + backwards. 2009-01-24 Christian Feuersaenger <ludewich@users.sourceforge.net> - - the FPU deactivation command is now assembled once and for all during - its first usage. + - the FPU deactivation command is now assembled once and for all during + its first usage. 2009-01-23 Till Tantau <tantau@users.sourceforge.net> - - Changed the "ellipse", "circle" and "arc" commands, so that - they take options. This gives a much clearer and more - flexible syntax. Naturally, the old syntax continues to work - as expected. - - Documented svg stuff and added tikz interface. Most useful - for quickly converting svg pictures to tikz pictures... + - Changed the "ellipse", "circle" and "arc" commands, so that + they take options. This gives a much clearer and more + flexible syntax. Naturally, the old syntax continues to work + as expected. + - Documented svg stuff and added tikz interface. Most useful + for quickly converting svg pictures to tikz pictures... 2009-01-23 Christian Feuersaenger <ludewich@users.sourceforge.net> - - fixed fpu 'round' method - it rounded mantissas instead of the complete - number before. + - fixed fpu 'round' method - it rounded mantissas instead of the complete + number before. 2009-01-22 Till Tantau <tantau@users.sourceforge.net> - - Fixed some math stuff - - Renamed \pgfpathcurvebetweentime* to - \pgfpathcurvebetweentimecontinue. - - Added svg.path lib. It allows one to directly use - the svg syntax for paths (like "M10 10 L 20 20"). Not yet - documented. + - Fixed some math stuff + - Renamed \pgfpathcurvebetweentime* to + \pgfpathcurvebetweentimecontinue. + - Added svg.path lib. It allows one to directly use + the svg syntax for paths (like "M10 10 L 20 20"). Not yet + documented. 2009-01-06 Till Tantau <tantau@users.sourceforge.net> - - Added tutorial for mind/lecture maps. + - Added tutorial for mind/lecture maps. 2009-01-06 Christian Feuersaenger <ludewich@users.sourceforge.net> - - implemented fpu factorial - - if the fixed point library is activated, the fpu will be deactivated - automatically. - - added draft for FPU documentation + - implemented fpu factorial + - if the fixed point library is activated, the fpu will be deactivated + automatically. + - added draft for FPU documentation 2009-01-03 Christian Feuersaenger <ludewich@users.sourceforge.net> - - - fixed bug in fpu sqrt. - - added logical commands to fpu. - - fixed bug in fpu related to multi-argument-commands - - provided feature to disable fpu manually. + + - fixed bug in fpu sqrt. + - added logical commands to fpu. + - fixed bug in fpu related to multi-argument-commands + - provided feature to disable fpu manually. 2008-12-31 Christian Feuersaenger <ludewich@users.sourceforge.net> - - added support for pgf 2.00 and the fpu (works only with additional - and technical work - the fpu file is not all which is needed) - - added pow and greaterthan to FPU - - fixed some FPU issues - - fixed processing of '/tikz/domain' key - it produced N+1 samples instead - of N. + - added support for pgf 2.00 and the fpu (works only with additional + and technical work - the fpu file is not all which is needed) + - added pow and greaterthan to FPU + - fixed some FPU issues + - fixed processing of '/tikz/domain' key - it produced N+1 samples instead + of N. 2008-12-30 Christian Feuersaenger <ludewich@users.sourceforge.net> - - added further functions to fpu; improved sanity checking; fixed smaller - bugs related to fpu + - added further functions to fpu; improved sanity checking; fixed smaller + bugs related to fpu 2008-12-29 Christian Feuersaenger <ludewich@users.sourceforge.net> - - improved internal floating point code: it is possible to change the - low-level representation with minimal number of code lines. - - modified low-level floating point representation. All high level code - should be completely unaffected; the changes are backwards compatible. - - Wrote first draft of a floating point unit library (fpu) similar in - spirit to the fixed point library of Mark Wibrow. - - Moved all floating point math operations (functions) into the fpu - library. It is now necessary to include the library in order to use - floating point math operations. The number formatting methods are still - available as before. + - improved internal floating point code: it is possible to change the + low-level representation with minimal number of code lines. + - modified low-level floating point representation. All high level code + should be completely unaffected; the changes are backwards compatible. + - Wrote first draft of a floating point unit library (fpu) similar in + spirit to the fixed point library of Mark Wibrow. + - Moved all floating point math operations (functions) into the fpu + library. It is now necessary to include the library in order to use + floating point math operations. The number formatting methods are still + available as before. 2008-12-28 Christian Feuersaenger <ludewich@users.sourceforge.net> - - added trigonometric functions to floating point unit. + - added trigonometric functions to floating point unit. 2008-12-17 Till Tantau <tantau@users.sourceforge.net> - - Added \colorlet to ConTeXt stuff. + - Added \colorlet to ConTeXt stuff. 2008-12-14 Till Tantau <tantau@users.sourceforge.net> - - Worked some more on data visualization stuff. Still in - pre-alpha. + - Worked some more on data visualization stuff. Still in + pre-alpha. 2008-12-11 Christian Feuersaenger <ludewich@users.sourceforge.net> - - added \pgfmathfloatexp. + - added \pgfmathfloatexp. 2008-12-07 Christian Feuersaenger <ludewich@users.sourceforge.net> - - floating point macros now always use the basic pgf math methods for - mantisse computations, even if the fixed point library is active. + - floating point macros now always use the basic pgf math methods for + mantisse computations, even if the fixed point library is active. 2008-12-06 Christian Feuersaenger <ludewich@users.sourceforge.net> - - 'mark=none' is now equivalent with 'mark=' (disables plot marks). - The previous behavior was to issue \pgfuseplotmark{none} which is - equivalent to \relax (and wastes time). + - 'mark=none' is now equivalent with 'mark=' (disables plot marks). + The previous behavior was to issue \pgfuseplotmark{none} which is + equivalent to \relax (and wastes time). 2008-12-03 Till Tantau <tantau@users.sourceforge.net> - - Changed exp function code in - pgfmathfunctions.basic.code.tex. It is now *much* more - precise for negative values and also more precise for - positive values. + - Changed exp function code in + pgfmathfunctions.basic.code.tex. It is now *much* more + precise for negative values and also more precise for + positive values. 2008-11-28 Christian Feuersaenger <ludewich@users.sourceforge.net> - - optimized \pgfmathfloattofixed for speed (although it introduces - redundand zeros) - - Added '/pgf/image/include external' command key as public interface - to modify the '\includegraphics' command in image externalization routines. + - optimized \pgfmathfloattofixed for speed (although it introduces + redundand zeros) + - Added '/pgf/image/include external' command key as public interface + to modify the '\includegraphics' command in image externalization routines. 2008-11-24 Christian Feuersaenger <ludewich@users.sourceforge.net> - - fixed bug with |overlay| option and matrizes: now, cell pictures won't - collapse any more if the matrix has |overlay| enabled. However, the - matrix' bounding box won't contribute to the image as desired. + - fixed bug with |overlay| option and matrizes: now, cell pictures won't + collapse any more if the matrix has |overlay| enabled. However, the + matrix' bounding box won't contribute to the image as desired. 2008-11-23 Christian Feuersaenger <ludewich@users.sourceforge.net> - - - added support for active '!' characters (for example in blue!30!black - and french babel setting) - - modified processing of 'domain' option: the argument is '\edef'ed such - that any potentially active ':' characters will be expanded to non-active - ones (avoiding errors in the following processing). + + - added support for active '!' characters (for example in blue!30!black + and french babel setting) + - modified processing of 'domain' option: the argument is '\edef'ed such + that any potentially active ':' characters will be expanded to non-active + ones (avoiding errors in the following processing). 2008-11-13 Till Tantau <tantau@users.sourceforge.net> - - Fixed \pgfnodealias bug that caused chains to fail in matrices. + - Fixed \pgfnodealias bug that caused chains to fail in matrices. 2008-10-30 Till Tantau <tantau@users.sourceforge.net> - - Added shading library, mainly containing the new color wheel - shading donated by Ken Starks. + - Added shading library, mainly containing the new color wheel + shading donated by Ken Starks. 2008-10-27 Mark Wibrow <vibrovski@users.sourceforge.net> - - More fixes for insertion of spaces. + - More fixes for insertion of spaces. 2008-10-27 Till Tantau <tantau@users.sourceforge.net> - - Added square arrow send by - gvtjongahung@users.sourceforge.net. - - Changed pgfutil-context.def so that driver detection should - work once more. + - Added square arrow send by + gvtjongahung@users.sourceforge.net. + - Changed pgfutil-context.def so that driver detection should + work once more. 2008-10-27 Mark Wibrow <vibrovski@users.sourceforge.net> - - Fixed insertion of space when parsing exponents. + - Fixed insertion of space when parsing exponents. 2008-10-23 Christian Feuersaenger <ludewich@users.sourceforge.net> - - added int truncation to floating point unit. + - added int truncation to floating point unit. 2008-10-22 Christian Feuersaenger <ludewich@users.sourceforge.net> - - added abs, abserror and relerror to floating point unit. + - added abs, abserror and relerror to floating point unit. 2008-10-21 Christian Feuersaenger <ludewich@users.sourceforge.net> - - added sqrt for floating point unit, built on top of pgfmathsqrt. + - added sqrt for floating point unit, built on top of pgfmathsqrt. 2008-10-09 Till Tantau <tantau@users.sourceforge.net> - - Fixed the wrong lengths of support vectors for circles. Used to - be 0.555 (found by trial and error), while the correct value - is 4/3*(sqrt(2)-1) = 0.5522847, which gives much better - circles. - Thanks to Ken Starks for point this out. + - Fixed the wrong lengths of support vectors for circles. Used to + be 0.555 (found by trial and error), while the correct value + is 4/3*(sqrt(2)-1) = 0.5522847, which gives much better + circles. + Thanks to Ken Starks for point this out. 2008-10-07 Mark Wibrow <vibrovski@users.sourceforge.net> - - Fixed rounded rectangle right arc bug. + - Fixed rounded rectangle right arc bug. 2008-10-06 Christian Feuersaenger <ludewich@users.sourceforge.net> - - Fixed missing treatment of 'assume math mode' in \pgfmathprintnumber' + - Fixed missing treatment of 'assume math mode' in \pgfmathprintnumber' 2008-10-05 Till Tantau <tantau@users.sourceforge.net> - - Fixed missing switching off of auto anchors in positioning - library. + - Fixed missing switching off of auto anchors in positioning + library. 2008-10-01 Till Tantau <tantau@tcs.uni-luebeck.de> - - Fixed matrix/pdfsync incompatibility. + - Fixed matrix/pdfsync incompatibility. 2008-09-30 Mark Wibrow <vibrovski@users.sourceforge.net> - - Fixed some parsing bugs with arrays. - - Fix for parsing of arrays in TikZ coordinates. + - Fixed some parsing bugs with arrays. + - Fix for parsing of arrays in TikZ coordinates. 2008-09-25 Christian Feuersaenger <ludewich@users.sourceforge.net> - - Added number formatting option 'min exponent for 1000 sep'. + - Added number formatting option 'min exponent for 1000 sep'. 2008-09-21 Mark Wibrow <vibrovski@users.sourceforge.net> - - Fixed bug in math parser which inserted spaces into text - or picture. + - Fixed bug in math parser which inserted spaces into text + or picture. 2008-09-17 Christian Feuersaenger <ludewich@users.sourceforge.net> - - added number formatting style 'sci superscript' - Example: formats the number 42 as 4.2^1 instead of 4.2 \cdot 10^1 + - added number formatting style 'sci superscript' + Example: formats the number 42 as 4.2^1 instead of 4.2 \cdot 10^1 2008-09-15 Till Tantau <tantau@users.sourceforge.net> - - Fixed bug "TikZ, the shadow library and ConTeXt MKIV - (LuaTeX)". - + - Fixed bug "TikZ, the shadow library and ConTeXt MKIV + (LuaTeX)". + 2008-09-14 Mark Wibrow <vibrovski@users.sourceforge.net> - - Fixed bug #2105132 for rounded rectangle. - - Fixed bug #2044129 for chamfered rectangle. - + - Fixed bug #2105132 for rounded rectangle. + - Fixed bug #2044129 for chamfered rectangle. + 2008-09-12 Mark Wibrow <vibrovski@users.sourceforge.net> - - Added \pgfpathcurvebetweentime. + - Added \pgfpathcurvebetweentime. 2008-09-10 Till Tantau <tantau@users.sourceforge.net> - - Fixed problem with nodes on a line inside a picture that is - inside a node of another picture. Pictures will now always - start with "pos=.5" set. + - Fixed problem with nodes on a line inside a picture that is + inside a node of another picture. Pictures will now always + start with "pos=.5" set. 2008-09-07 Mark Wibrow <vibrovski@users.sourceforge.net> - - Slight hack of decorations so that the input path can consist of a - single move to. This enables stuff like - \path [decoration={some decoration}, decorate] (4,5); + - Slight hack of decorations so that the input path can consist of a + single move to. This enables stuff like + \path [decoration={some decoration}, decorate] (4,5); 2008-09-03 Christian Feuersaenger <ludewich@users.sourceforge.net> - - fixed small bug related to '@dec sep mark' and not-a-number in number - formatting routines. + - fixed small bug related to '@dec sep mark' and not-a-number in number + formatting routines. 2008-09-03 Mark Wibrow <vibrovski@users.sourceforge.net> - - Solutions for path intersections can now be sorted along either path. - - \pgfintersectionsolutions is now a macro, not a count register. + - Solutions for path intersections can now be sorted along either path. + - \pgfintersectionsolutions is now a macro, not a count register. 2008-08-31 Mark Wibrow <vibrovski@users.sourceforge.net> - - - fix for ``Missing character...' warnings in logfile when using - foreach. - - removed `trim integers' option from foreach as int function - can now be used. + + - fix for ``Missing character...' warnings in logfile when using + foreach. + - removed `trim integers' option from foreach as int function + can now be used. 2008-08-31 Mark Wibrow <vibrovski@users.sourceforge.net> - - Rewrote math parser. Anyone who relies on, or has hacked internal - parser or function macros, or has defined their own functions for - the parser will need to reconsult the code and/or documentation. - - Files for functions definitions split (possibly permanantly) into - different files. - - Scaling of results at the end of the parse is no longer the default - action. This doesn't break PGF or TikZ, but it may break user code - that depended on this scaling. To turn it back on use - \let\pgfmathpostparse=\pgfmathscaleresult. - - Modifying existing functions or creating new functions must now be - done using \pgfmathdeclarefunction and \pgfmathredeclarefunction. - - Single argument functions do not need parentheses, provided the - funtion is followed by a space, so sin 60 is the same as sin(60). - But! Functions have the highest precedence, so sin 60*\x is the - same as sin(60)*\x. - - Added {} operators for array specification and [] operators for - array access - see docs for details. - - added postfix ! factorial operator. - - added c++/java style conditional e.g., \x > 10 ? 13 : 20. - - added >=, <=, !=, prefix !, &&, || operators. - - added atan2, log10, log2, e, int and frac functions. - - adapted cosh, sinh and tanh from Martin Heller. - - added lua-style random function for generating random integers. - - added Mod function (note capital letter). Uses floored division - and is never negative. - - min, max, veclen and pow can now be nested in any argument - position. - - min and max can now take a variable number of arguments. - - For compatability \pgfmathmax and \pgfmathmin still take two - arguments (although these can contain comma separated expressions). - However \pgfmathmin@ and \pgfmathmax@ now only take - one argument in the form \pgfmathmin@{{1}{2}{3}{4}{5}} (for 5 - arguments). - - added hex, Hex, bin, and oct functions. These functions will not - work properly if the post-parse scaling is turned back on. - - 0 prefix for integers now specifies an octal number which is - automatically converted to base 10. - - 0x or 0X prefix for integers now specifies a hexadecimal number, - which is automatically converted to base 10. - - 0b or 0B prefix for integers now specifies a binary number, - which is automatically converted to base 10. - - "" characters turn off parsing (!) for part of an expression. - - added width, height, and depth functions for text e.g., - width("Some text"), but as an expression is \edef'ed before - parsing other commands will have to be `protected' e.g., - width("\noexpand\Huge Some text"). - - bugfix for tan and cot. + - Rewrote math parser. Anyone who relies on, or has hacked internal + parser or function macros, or has defined their own functions for + the parser will need to reconsult the code and/or documentation. + - Files for functions definitions split (possibly permanantly) into + different files. + - Scaling of results at the end of the parse is no longer the default + action. This doesn't break PGF or TikZ, but it may break user code + that depended on this scaling. To turn it back on use + \let\pgfmathpostparse=\pgfmathscaleresult. + - Modifying existing functions or creating new functions must now be + done using \pgfmathdeclarefunction and \pgfmathredeclarefunction. + - Single argument functions do not need parentheses, provided the + funtion is followed by a space, so sin 60 is the same as sin(60). + But! Functions have the highest precedence, so sin 60*\x is the + same as sin(60)*\x. + - Added {} operators for array specification and [] operators for + array access - see docs for details. + - added postfix ! factorial operator. + - added c++/java style conditional e.g., \x > 10 ? 13 : 20. + - added >=, <=, !=, prefix !, &&, || operators. + - added atan2, log10, log2, e, int and frac functions. + - adapted cosh, sinh and tanh from Martin Heller. + - added lua-style random function for generating random integers. + - added Mod function (note capital letter). Uses floored division + and is never negative. + - min, max, veclen and pow can now be nested in any argument + position. + - min and max can now take a variable number of arguments. + - For compatability \pgfmathmax and \pgfmathmin still take two + arguments (although these can contain comma separated expressions). + However \pgfmathmin@ and \pgfmathmax@ now only take + one argument in the form \pgfmathmin@{{1}{2}{3}{4}{5}} (for 5 + arguments). + - added hex, Hex, bin, and oct functions. These functions will not + work properly if the post-parse scaling is turned back on. + - 0 prefix for integers now specifies an octal number which is + automatically converted to base 10. + - 0x or 0X prefix for integers now specifies a hexadecimal number, + which is automatically converted to base 10. + - 0b or 0B prefix for integers now specifies a binary number, + which is automatically converted to base 10. + - "" characters turn off parsing (!) for part of an expression. + - added width, height, and depth functions for text e.g., + width("Some text"), but as an expression is \edef'ed before + parsing other commands will have to be `protected' e.g., + width("\noexpand\Huge Some text"). + - bugfix for tan and cot. 2008-08-27 Christian Feuersaenger <ludewich@users.sourceforge.net> - - added '/tikz/external/export={true,false}' key for externalization - library. + - added '/tikz/external/export={true,false}' key for externalization + library. 2008-08-05 Christian Feuersaenger <ludewich@users.sourceforge.net> - - added documentation for basic layer externalization and baseline option. + - added documentation for basic layer externalization and baseline option. 2008-07-28 Christian Feuersaenger <ludewich@users.sourceforge.net> - - added 'showpos' key to number printing (and alias 'print sign'). + - added 'showpos' key to number printing (and alias 'print sign'). 2008-07-22 Christian Feuersaenger <ludewich@users.sourceforge.net> - - fixed typo in pgfmathfloat.code.tex - - added 'optimize command away=\macro' key to externalization library. It - allows to discard unnecessary and possibly expensive user macros during - export (unnecessary = not in selected picture). + - fixed typo in pgfmathfloat.code.tex + - added 'optimize command away=\macro' key to externalization library. It + allows to discard unnecessary and possibly expensive user macros during + export (unnecessary = not in selected picture). 2008-07-18 Christian Feuersaenger <ludewich@users.sourceforge.net> - - Fixed bug in system layer path collecting. Very long paths - are now processed more efficiently (the bug disabled an optimization). + - Fixed bug in system layer path collecting. Very long paths + are now processed more efficiently (the bug disabled an optimization). 2008-07-14 Christian Feuersaenger <ludewich@users.sourceforge.net> - - added "marker" positions into the output of number formatting routines - to find period positions (even if no period is typeset) and exponent - positions. Allows alignment within auxiliary routines. + - added "marker" positions into the output of number formatting routines + to find period positions (even if no period is typeset) and exponent + positions. Allows alignment within auxiliary routines. 2008-07-14 Till Tantau <tantau@users.sourceforge.net> - - Fixed dash phase bug. - - Fixed missing library include in automata lib. - - Added "align" option. "text ragged" and friends are now - deprecated. Text width need no longer not, but can, be - specified. The following now has the expected effect: \node - [draw,align=center] {Hello\\world.}; + - Fixed dash phase bug. + - Fixed missing library include in automata lib. + - Added "align" option. "text ragged" and friends are now + deprecated. Text width need no longer not, but can, be + specified. The following now has the expected effect: \node + [draw,align=center] {Hello\\world.}; 2008-07-10 Christian Feuersaenger <ludewich@users.sourceforge.net> - - added \pgfqpointxy and \pgfqpointxyz to complement the "quick" point - commands in basic layer. + - added \pgfqpointxy and \pgfqpointxyz to complement the "quick" point + commands in basic layer. 2008-07-09 Christian Feuersaenger <ludewich@users.sourceforge.net> - - added 'every mark' style. - - 'mark options' simply overwrites 'every mark' (consistent with its old - definition) + - added 'every mark' style. + - 'mark options' simply overwrites 'every mark' (consistent with its old + definition) 2008-07-07 Till Tantau <tantau@users.sourceforge.net> - - Finished circuit library and documentation (well, some - shapes still missing, but that's something users should - contribute). + - Finished circuit library and documentation (well, some + shapes still missing, but that's something users should + contribute). 2008-07-01 Christian Feuersaenger <ludewich@users.sourceforge.net> - - the external library now handles active double quotes ", - single quotes ', and active semicolons ';' in its system call - correctly. Furthermore, \\ will expand to a normal - backslash. The initial system call now uses double quotes - for indows compatibility, it also contains the shell-escape - feature for gnuplot invocations. + - the external library now handles active double quotes ", + single quotes ', and active semicolons ';' in its system call + correctly. Furthermore, \\ will expand to a normal + backslash. The initial system call now uses double quotes + for indows compatibility, it also contains the shell-escape + feature for gnuplot invocations. 2008-06-30 Till Tantau <tantau@users.sourceforge.net> - - Did some documentation of circuit lib. - - Removed the separated documentation of the intersection - library and made this documentation part of the main - documentation. - - The intersection cs is now deprecated, the documentation - is now only based on the intersection lib. - - Added a "by" option so that "name intersections={of=A and - B,by={c,d,e}}" will create an alias c for intersection-1, d - for intersection-2 and e for intersection-3. - - Renamed "path name" to "name path" in the intersection - lib. This is more consistent with "name intersections". + - Did some documentation of circuit lib. + - Removed the separated documentation of the intersection + library and made this documentation part of the main + documentation. + - The intersection cs is now deprecated, the documentation + is now only based on the intersection lib. + - Added a "by" option so that "name intersections={of=A and + B,by={c,d,e}}" will create an alias c for intersection-1, d + for intersection-2 and e for intersection-3. + - Renamed "path name" to "name path" in the intersection + lib. This is more consistent with "name intersections". 2008-06-29 Christian Feuersaenger <ludewich@users.sourceforge.net> - - Minor changes on float stuff, wrote pgfmathfloatmultiply and - pgfmathfloatdivide on top of pgfmathmultiply and pgfmathdivide + - Minor changes on float stuff, wrote pgfmathfloatmultiply and + pgfmathfloatdivide on top of pgfmathmultiply and pgfmathdivide 2008-06-29 Mark Wibrow <vibrovski@users.sourceforge.net> - - Added `Fixed Point Arithmetic' library, which provides - a parsing interface to the fp package. Dealing with plotting - files still a bit crude. - - This library means the manual now requires the fp pacakge - to compile. - - Fixed floor function for negative numbers. - - Fixed \pgfmathsetseed. - - Font and group fix for external documentation. + - Added `Fixed Point Arithmetic' library, which provides + a parsing interface to the fp package. Dealing with plotting + files still a bit crude. + - This library means the manual now requires the fp pacakge + to compile. + - Fixed floor function for negative numbers. + - Fixed \pgfmathsetseed. + - Font and group fix for external documentation. 2008-06-27 Mark Wibrow <vibrovski@users.sourceforge.net> - - Complete change of TikZ intersections (PGF unchanged). - - Slight hack of the TikZ scopes library to permit local - path naming. Should work... + - Complete change of TikZ intersections (PGF unchanged). + - Slight hack of the TikZ scopes library to permit local + path naming. Should work... 2008-06-26 Till Tantau <tantau@users.sourceforge.net> - - Continued with circuit library. - - Introduced subdirectories inside the pgf library - directory and moved libs into them. - You may need to update your checkout. + - Continued with circuit library. + - Introduced subdirectories inside the pgf library + directory and moved libs into them. + You may need to update your checkout. 2008-06-26 Christian Feuersaenger <ludewich@users.sourceforge.net> - - The external library now typesets as horizontal material by issueing - \leavevmode. This fixes an inconsistency with the normal tikzpictures. + - The external library now typesets as horizontal material by issueing + \leavevmode. This fixes an inconsistency with the normal tikzpictures. 2008-06-25 Mark Wibrow <vibrovski@users.sourceforge.net> - - Added intersection library + documentation for - intersecting ``named'' paths. + - Added intersection library + documentation for + intersecting ``named'' paths. 2008-06-25 Christian Feuersaenger <ludewich@users.sourceforge.net> - - Fixed bug in external library. Now, strings like '#1' occuring - somewhere in an image is collected correctly. + - Fixed bug in external library. Now, strings like '#1' occuring + somewhere in an image is collected correctly. 2008-06-24 Mark Wibrow <vibrovski@users.sourceforge.net> - - Removed new intersection stuff. Need to restart from scratch... + - Removed new intersection stuff. Need to restart from scratch... 2008-06-23 Till Tantau <tantau@users.sourceforge.net> - - Started working on circuit library documentation. + - Started working on circuit library documentation. 2008-06-23 Mark Wibrow <vibrovski@users.sourceforge.net> - - Added PGF code and docs for intersections of two curves and - intersections of a line and a curve. - - Fixed bug in foreach code when registers are used with dots - statement. - + - Added PGF code and docs for intersections of two curves and + intersections of a line and a curve. + - Fixed bug in foreach code when registers are used with dots + statement. + 2008-06-22 Till Tantau <tantau@users.sourceforge.net> - - Created first version of circuit libraries for electrical - engineering (circuits.ee.*). - - Added libraries so that ee circuits and logical circuits can - be accessed using the same interface. (circuits.logic.*) - - The tikz lib shapes.gates.logic.* will no - longer be needed, the circuits.logic.* will replace them. (The - pgf libs shapes.gates.* are still used as before, however.) - - Minor patch in shapes.gates.logic.US so that the .0 and .180 - anchors of a not gate or a buffer gate are the same as the - input or output anchors. - - All this is not documented, yet. - - Worked some more on dv stuff, but nothing to "show", yet. + - Created first version of circuit libraries for electrical + engineering (circuits.ee.*). + - Added libraries so that ee circuits and logical circuits can + be accessed using the same interface. (circuits.logic.*) + - The tikz lib shapes.gates.logic.* will no + longer be needed, the circuits.logic.* will replace them. (The + pgf libs shapes.gates.* are still used as before, however.) + - Minor patch in shapes.gates.logic.US so that the .0 and .180 + anchors of a not gate or a buffer gate are the same as the + input or output anchors. + - All this is not documented, yet. + - Worked some more on dv stuff, but nothing to "show", yet. 2008-06-21 Mark Wibrow <vibrovski@users.sourceforge.net> - - Fixed parsing bug in foreach code. - - Added "rotate fit" key to fit library, so (e.g.) a rotated - rectangle can be fitted around nodes/coordinates. + - Fixed parsing bug in foreach code. + - Added "rotate fit" key to fit library, so (e.g.) a rotated + rectangle can be fitted around nodes/coordinates. 2008-06-21 Christian Feuersaenger <ludewich@users.sourceforge.net> - - Added documentation for tikz 'external' library. - - created pgfexternalwithdepth.tex file to use the 'baseline' information. - - improved some issues of the external library. - - Added '/pgf/images/draft' option - - Modified implementation of draft images to show the image file name - instead of the internal image name + - Added documentation for tikz 'external' library. + - created pgfexternalwithdepth.tex file to use the 'baseline' information. + - improved some issues of the external library. + - Added '/pgf/images/draft' option + - Modified implementation of draft images to show the image file name + instead of the internal image name 2008-06-19 Christian Feuersaenger <ludewich@users.sourceforge.net> - - Added tikz library 'external' which allows automatic or semiautomatic - export of each tikzpicture to pdf. Documentation is not yet ready. - - Added self-contained latex package tikzexternal.sty to read those images - without tikz/pgf installed. - - Added support for the 'baseline' option in \beginpgfgraphicnamed ... \endpgfgraphicnamed - by storing the box depth into a separate file. + - Added tikz library 'external' which allows automatic or semiautomatic + export of each tikzpicture to pdf. Documentation is not yet ready. + - Added self-contained latex package tikzexternal.sty to read those images + without tikz/pgf installed. + - Added support for the 'baseline' option in \beginpgfgraphicnamed ... \endpgfgraphicnamed + by storing the box depth into a separate file. 2008-06-19 Till Tantau <tantau@users.sourceforge.net> - - Added first ideas for a circuit library. - - Bugfixes in scoping behaviour. - - Changed scoping rules for to path operation: Options are now - local. This may break existing code, but is much more - consistent with everything else and removes other problems. - - Patched mindmap lib to account for these changed rules. - - Added insert path option. - - Deprecated "after node path". Use "append after command" and - "prefix after command" instead. - - Moved datavisualization libraries to separate subdirectory. + - Added first ideas for a circuit library. + - Bugfixes in scoping behaviour. + - Changed scoping rules for to path operation: Options are now + local. This may break existing code, but is much more + consistent with everything else and removes other problems. + - Patched mindmap lib to account for these changed rules. + - Added insert path option. + - Deprecated "after node path". Use "append after command" and + "prefix after command" instead. + - Moved datavisualization libraries to separate subdirectory. 2008-06-18 Till Tantau <tantau@users.sourceforge.net> - - Changed label and pin options once again, to allow more - flexibility. In particular, the angle can now be - omitted. Also, for rotated main nodes the anchors are now - chosen in more sensible ways. + - Changed label and pin options once again, to allow more + flexibility. In particular, the angle can now be + omitted. Also, for rotated main nodes the anchors are now + chosen in more sensible ways. 2008-06-16 Till Tantau <tantau@users.sourceforge.net> - - Added tiny little turtle graphics library for fun. - - Changed scoping rules for \foreach statement on a path: the - last coordinate is now persistent not only after the foreach - statement, but also between different iterations. - - Changed positioning of "label" when you attach a label to a - transformed shape. The position is now absolute with respect - to the page, unless the "transform shape" option is used. - + - Added tiny little turtle graphics library for fun. + - Changed scoping rules for \foreach statement on a path: the + last coordinate is now persistent not only after the foreach + statement, but also between different iterations. + - Changed positioning of "label" when you attach a label to a + transformed shape. The position is now absolute with respect + to the page, unless the "transform shape" option is used. + 2008-06-11 Mark Wibrow <vibrovski@users.sourceforge.net> - - Fixed the bug fix for character checking in foreach. - - Updates and fixes for new foreach code. + - Fixed the bug fix for character checking in foreach. + - Updates and fixes for new foreach code. 2008-06-13 Till Tantau <tantau@users.sourceforge.net> - - Fixed bug in new \foreach stuff that causes an error on - things like \foreach \i in {1,...,\foo}. If a list element - is a macro, no is-it-a-character check is done. + - Fixed bug in new \foreach stuff that causes an error on + things like \foreach \i in {1,...,\foo}. If a list element + is a macro, no is-it-a-character check is done. 2008-06-11 Mark Wibrow <vibrovski@users.sourceforge.net> - - Checked in proposed \foreach extensions. Possibly the - extensions would be better contained in a pgflibrary... - - list items can now be evaluated. - - dots replacement is context sensitive. - - sequences indicated by dots can be character sequences. - - a list item can be ``remembered'' in the next iteration. - - access to the number of the current item in the list is - provided. + - Checked in proposed \foreach extensions. Possibly the + extensions would be better contained in a pgflibrary... + - list items can now be evaluated. + - dots replacement is context sensitive. + - sequences indicated by dots can be character sequences. + - a list item can be ``remembered'' in the next iteration. + - access to the number of the current item in the list is + provided. 2008-06-09 Till Tantau <tantau@users.sourceforge.net> - - Worked a bit on data visualization stuff. - + - Worked a bit on data visualization stuff. + 2008-06-07 Christian Feuersaenger <ludewich@users.sourceforge.net> - - Added '/pgf/number format/1000 sep' and 'dec sep' shortcut - styles which simply call 'set thousands separator' and 'set - decimal separator'. Those option are somewhat long... + - Added '/pgf/number format/1000 sep' and 'dec sep' shortcut + styles which simply call 'set thousands separator' and 'set + decimal separator'. Those option are somewhat long... 2008-06-06 Till Tantau <tantau@users.sourceforge.net> - - Fixed the "local bounding box" option so that it honors the - "relevant for picture size"-if. - + - Fixed the "local bounding box" option so that it honors the + "relevant for picture size"-if. + 2008-06-04 Till Tantau <tantau@users.sourceforge.net> - - Fixed buggy "mid left" and "mid right" options. - - Added "between positions" option to the "mark" option. This - makes it possible to create paths with "repeated arrows along - the path". This did not work before. + - Fixed buggy "mid left" and "mid right" options. + - Added "between positions" option to the "mark" option. This + makes it possible to create paths with "repeated arrows along + the path". This did not work before. 2008-06-03 Christian Feuersaenger <ludewich@users.sourceforge.net> - - Added '/pgf/number format/assume math mode' to disable math checks. - This allows to assemble tabulars, apply \pgfmathprintnumber to each cell - and use the dcolumn package to align at decimal separators (no - documentation for that feature yet) + - Added '/pgf/number format/assume math mode' to disable math checks. + This allows to assemble tabulars, apply \pgfmathprintnumber to each cell + and use the dcolumn package to align at decimal separators (no + documentation for that feature yet) 2008-06-02 Till Tantau <tantau@users.sourceforge.net> - - Fixed pgfpages in conjunction with everyshi. + - Fixed pgfpages in conjunction with everyshi. 2008-05-31 Christian Feuersaenger <ludewich@users.sourceforge.net> - - - Semantics of |/pgf/number format/fixed zerofill| changed: it now simply - sets a boolean which affects all numbers in fixed format; it does not - SET fixed format. The same holds for sci zerofill. + + - Semantics of |/pgf/number format/fixed zerofill| changed: it now simply + sets a boolean which affects all numbers in fixed format; it does not + SET fixed format. The same holds for sci zerofill. 2008-05-30 Christian Feuersaenger <ludewich@users.sourceforge.net> - - Provided \pgfmathprintnumberto macro in addition to - \pgfmathprintnumber. + - Provided \pgfmathprintnumberto macro in addition to + \pgfmathprintnumber. 2008-05-22 Mark Wibrow <vibrovski@users.sourceforge.net> - - Revised Lindenmayer system stuff. Documentation should - now be up to date. + - Revised Lindenmayer system stuff. Documentation should + now be up to date. 2008-05-22 Christian Feuersaenger <ludewich@users.sourceforge.net> - - Added 'xbar interval' and 'ybar interval' plot handlers. - - Moved plot handler options to /pgf key tree. - - added 'bar shift' option. - - bar width option is now evaluated when needed. - - Added documentation for plot handler library changes and for tikz-plot - interfaces. - - Modified pgf manual macros: codeexamples section now employs pgfkeys, - xkeyval no longer required. Introduced style 'every codeexample' to - maintain compatibility and allow customization for users. + - Added 'xbar interval' and 'ybar interval' plot handlers. + - Moved plot handler options to /pgf key tree. + - added 'bar shift' option. + - bar width option is now evaluated when needed. + - Added documentation for plot handler library changes and for tikz-plot + interfaces. + - Modified pgf manual macros: codeexamples section now employs pgfkeys, + xkeyval no longer required. Introduced style 'every codeexample' to + maintain compatibility and allow customization for users. 2008-05-21 Till Tantau <tantau@users.sourceforge.net> - - Added missing documentation of moveto-decoration. + - Added missing documentation of moveto-decoration. 2008-05-20 Mark Wibrow <vibrovski@users.sourceforge.net> - - Changed the processing of \pgflsystemstep. Now a TeX - dimension, it permits a symbol to shorten the step. + - Changed the processing of \pgflsystemstep. Now a TeX + dimension, it permits a symbol to shorten the step. 2008-05-19 Mark Wibrow <vibrovski@users.sourceforge.net> - - Added Lindemayer system drawing library. - - Renamed the ranomization keys for the step and angle. - - Updated the L-system docs. + - Added Lindemayer system drawing library. + - Renamed the ranomization keys for the step and angle. + - Updated the L-system docs. 2008-05-19 Till Tantau <tantau@users.sourceforge.net> - - Added documentation of oo-subsystem. - - Started documentation of data visualization-subsystem. - - Fixed hyperlink problem in dvipdfm(x)/xetex. - - Fixed typos in Lindemayer system doc. + - Added documentation of oo-subsystem. + - Started documentation of data visualization-subsystem. + - Fixed hyperlink problem in dvipdfm(x)/xetex. + - Fixed typos in Lindemayer system doc. 2008-05-17 Christian Feuersaenger <ludewich@users.sourceforge.net> - - Added \pgfmathfloatadd, \pgfmathfloatsubtract and - \pgfmathfloatmultiplyfixed based on pgf's normal math parser - - Added tests for float arithmetics - - Added \pgfmathfloattoextentedprecision for 8-digit mantisse precision - - Added documentation for these methods - - Added basic layer input stream methods to set zero levels for [xy]comb/[xy]bar; - allows to start bars at different offsets than x=0 / y=0. - - Added documentation for zero level streams. + - Added \pgfmathfloatadd, \pgfmathfloatsubtract and + \pgfmathfloatmultiplyfixed based on pgf's normal math parser + - Added tests for float arithmetics + - Added \pgfmathfloattoextentedprecision for 8-digit mantisse precision + - Added documentation for these methods + - Added basic layer input stream methods to set zero levels for [xy]comb/[xy]bar; + allows to start bars at different offsets than x=0 / y=0. + - Added documentation for zero level streams. 2008-05-15 Till Tantau <tantau@users.sourceforge.net> - - Added "path picture" option, mostly for the implementation - of the corrected mindmap connecting bars. - - Fixed buggy code of mindmap connect bars: Shading angles - where sometimes wrong and shading was sometimes at the wrong - position. + - Added "path picture" option, mostly for the implementation + of the corrected mindmap connecting bars. + - Fixed buggy code of mindmap connect bars: Shading angles + where sometimes wrong and shading was sometimes at the wrong + position. 2008-05-14 Till Tantau <tantau@users.sourceforge.net> - - Completely rewrote management of pdf resources. This affects - pdftex, dvipdfm, dvipdfmx and xetex backends and all front - ends. They should now all work together in harmony, as far - as this is supported by them. - - Completely rewrote driver detection in plain and context - mode. - - dvipdfmx and xetex now use \special{pdf:literal direct}, - which can *considerably* reduce file sizes (up to a factor - of 2). + - Completely rewrote management of pdf resources. This affects + pdftex, dvipdfm, dvipdfmx and xetex backends and all front + ends. They should now all work together in harmony, as far + as this is supported by them. + - Completely rewrote driver detection in plain and context + mode. + - dvipdfmx and xetex now use \special{pdf:literal direct}, + which can *considerably* reduce file sizes (up to a factor + of 2). 2008-05-14 Mark Wibrow <vibrovski@users.sourceforge.net> - - Fixed compatability issue with old calc code. - + - Fixed compatability issue with old calc code. + 2008-05-13 Christian Feuersaenger <ludewich@users.sourceforge.net> - - documented '.lasttry' key handler - - introduced documentation for key filtering routines (as \input section - in pgfmanual-en-pgfkeys.tex). Main section of pgfkeys not really updated - yet; I only removed the 'family limitation' item in the introduction. + - documented '.lasttry' key handler + - introduced documentation for key filtering routines (as \input section + in pgfmanual-en-pgfkeys.tex). Main section of pgfkeys not really updated + yet; I only removed the 'family limitation' item in the introduction. 2008-05-11 Mark Wibrow <vibrovski@users.sourceforge.net> - - Multiple fixes for signal shape. + - Multiple fixes for signal shape. 2008-05-03 Christian Feuersaenger <ludewich@users.sourceforge.net> - - added \pgfplotbarwidth and docs - - used \pgfmathparse to assign \pgfsetplotbarwidth - - added 'const plot mark right' to plot handler library to complete the - different variants of left/right connected/jump handlers. + - added \pgfplotbarwidth and docs + - used \pgfmathparse to assign \pgfsetplotbarwidth + - added 'const plot mark right' to plot handler library to complete the + different variants of left/right connected/jump handlers. 2008-05-01 Mark Wibrow <vibrovski@users.sourceforge.net> - - Fixed parser for expressions that begin and end with braces. + - Fixed parser for expressions that begin and end with braces. 2008-04-27 Christian Feuersaenger <ludewich@users.sourceforge.net> - - - Added \pgfmathapproxequalto operation and documentation below - \pgfmathequalto - - Added some user-interface methods to floating point arithmetics - - Added options - /pgf/number format/set decimal separator - /pgf/number format/set thousands separator - /pgf/number format/skip 0. - - Added documentation for floating point arithmetics - - Added documentation for number printing + + - Added \pgfmathapproxequalto operation and documentation below + \pgfmathequalto + - Added some user-interface methods to floating point arithmetics + - Added options + /pgf/number format/set decimal separator + /pgf/number format/set thousands separator + /pgf/number format/skip 0. + - Added documentation for floating point arithmetics + - Added documentation for number printing 2008-04-26 Christian Feuersaenger <ludewich@users.sourceforge.net> - - Added PGF plot handlers to plot handler library: - - \pgfplothandlerxbar - - \pgfplothandlerybar - with parameter \pgfsetplotbarwidth{} and - - \pgfplothandlerconstantlineto - - \pgfplothandlerjumpmarkleft - - \pgfplothandlerjumpmarkright - - Added Tikz-Plot handlers - - /tikz/xbar - - /tikz/ybar - with option '/tikz/bar width' and - - /tikz/const plot - - /tikz/jump mark left - - /tikz/jump mark right - - Added documentation for new plot handlers to Tikz- and plot handler - section in manual + - Added PGF plot handlers to plot handler library: + - \pgfplothandlerxbar + - \pgfplothandlerybar + with parameter \pgfsetplotbarwidth{} and + - \pgfplothandlerconstantlineto + - \pgfplothandlerjumpmarkleft + - \pgfplothandlerjumpmarkright + - Added Tikz-Plot handlers + - /tikz/xbar + - /tikz/ybar + with option '/tikz/bar width' and + - /tikz/const plot + - /tikz/jump mark left + - /tikz/jump mark right + - Added documentation for new plot handlers to Tikz- and plot handler + section in manual 2008-04-23 Till Tantau <tantau@users.sourceforge.net> - - Documented changed double line handling. - - Made some arrow tips work with double lines. + - Documented changed double line handling. + - Made some arrow tips work with double lines. 2008-04-22 Till Tantau <tantau@users.sourceforge.net> - - Added (not yet documented) "inner lines", which move the - double line mechanism from tikz to the basic layer. This - allows the definition of special arrow tips for double lines. - - Added (not yet documented) new arrow tip "implies" using - this mechanism. + - Added (not yet documented) "inner lines", which move the + double line mechanism from tikz to the basic layer. This + allows the definition of special arrow tips for double lines. + - Added (not yet documented) new arrow tip "implies" using + this mechanism. 2008-04-21 Mark Wibrow <vibrovski@users.sourceforge.net> - - - New version of rectangle split shape. Now supports horizontal - as well as vertical spliting. Also supports up to 20 parts. + + - New version of rectangle split shape. Now supports horizontal + as well as vertical spliting. Also supports up to 20 parts. 2008-04-17 Christian Feuersaenger <ludewich@users.sourceforge.net> - - Added pgfkeysfiltered.code.tex which provides key filtering - and provides key-selection utilities like xkeyvals families - - changed pgfkeys.code.tex to '\input' pgfkeysfiltered.code.tex + - Added pgfkeysfiltered.code.tex which provides key filtering + and provides key-selection utilities like xkeyvals families + - changed pgfkeys.code.tex to '\input' pgfkeysfiltered.code.tex 2008-04-14 Christian Feuersaenger <ludewich@users.sourceforge.net> - - Added \tikzaddtikzonlycommandshortcutlet and - \tikzaddtikzonlycommandshortcutdef to install shortcut commands at the - beginning of tikzpicture. - - pgfkeys.code.tex: fixed incompatibility .try with .is choice + - Added \tikzaddtikzonlycommandshortcutlet and + \tikzaddtikzonlycommandshortcutdef to install shortcut commands at the + beginning of tikzpicture. + - pgfkeys.code.tex: fixed incompatibility .try with .is choice 2008-04-10 Till Tantau <tantau@users.sourceforge.net> - - Fixed patterns in dvips mode (were broken). - + - Fixed patterns in dvips mode (were broken). + 2008-04-03 Till Tantau <tantau@users.sourceforge.net> - - - Switched to everyshi in latex mode to hack into - \shipout. Wrote direct code to hack into \shipout in plain - mode. Hacking into \shipout in Context is still unclear. - - Added space arrow. - + + - Switched to everyshi in latex mode to hack into + \shipout. Wrote direct code to hack into \shipout in plain + mode. Hacking into \shipout in Context is still unclear. + - Added space arrow. + 2008-4-02 Mark Wibrow <vibrovski@users.sourceforge.net> - - - Reimplemented parsing of operands. + + - Reimplemented parsing of operands. 2008-04-01 Till Tantau <tantau@users.sourceforge.net> - - Added cirlce solidus shape by Manuel Lacruz. + - Added cirlce solidus shape by Manuel Lacruz. 2008-03-19 Mark Wibrow <vibrovski@users.sourceforge.net> - - - `curve control points' decoration no longer exists. It is - replaced by the `show path construction' decoration. - - added code + docs for defining changable patterns. - - Parser altered to access \pgfmathfloatparsenumber when - \ifpgfmathfloat is true (old interface to \pgfmathfloat deleted). + + - `curve control points' decoration no longer exists. It is + replaced by the `show path construction' decoration. + - added code + docs for defining changable patterns. + - Parser altered to access \pgfmathfloatparsenumber when + \ifpgfmathfloat is true (old interface to \pgfmathfloat deleted). 2008-03-18 Christian Feuersaenger <ludewich@users.sourceforge.net> - - Added generic/pgf/math/pgfmathfloat.code.tex - - Modified pgfmath.code.tex to include pgfmathfloat.code.tex - - Added generic/pgf/testsuite/mathtest/pgfmathtestsuite.tex [dvipdfm/pdflatex] - which provides testing for pgfmathfloat.code.tex + - Added generic/pgf/math/pgfmathfloat.code.tex + - Modified pgfmath.code.tex to include pgfmathfloat.code.tex + - Added generic/pgf/testsuite/mathtest/pgfmathtestsuite.tex [dvipdfm/pdflatex] + which provides testing for pgfmathfloat.code.tex 2008-03-17 Till Tantau <tantau@users.sourceforge.net> - - Fixed minimum width handling in rounded rectangle shape. + - Fixed minimum width handling in rounded rectangle shape. 2008-03-12 Mark Wibrow <vibrovski@users.sourceforge.net> - - Added key for rectangle split to ignore empty parts. - - Extended \pgfshadecolortorgb to define macros for the - individual color components. + - Added key for rectangle split to ignore empty parts. + - Extended \pgfshadecolortorgb to define macros for the + individual color components. 2008-03-08 Mark Wibrow <vibrovski@users.sourceforge.net> - - Added `curve control points' decoration for drawing - curve controls. NB: names/keys may change. + - Added `curve control points' decoration for drawing + curve controls. NB: names/keys may change. 2008-03-07 Mark Wibrow <vibrovski@users.sourceforge.net> - - Fix for (some) `hidden' bugs: ``Missing character: - There is no <char> in font nullfont!''. This is usually - only seen in log file. Fixed for star, circular sector - and math macros. + - Fix for (some) `hidden' bugs: ``Missing character: + There is no <char> in font nullfont!''. This is usually + only seen in log file. Fixed for star, circular sector + and math macros. 2008-03-03 Till Tantau <tantau@users.sourceforge.net> - - Fixed documentation "placment" replaced by "positioning" - - Fixed ConTeXt page resource problem. (ConTeXt support is - still not as smooth as support of other formats) - - Checked in some data visualization stuff, without any - documentation. Everything still likely to change - completely. - - Moved module management to pgfutil. - - Added support for simple oo-programming, not documented. + - Fixed documentation "placment" replaced by "positioning" + - Fixed ConTeXt page resource problem. (ConTeXt support is + still not as smooth as support of other formats) + - Checked in some data visualization stuff, without any + documentation. Everything still likely to change + completely. + - Moved module management to pgfutil. + - Added support for simple oo-programming, not documented. 2008-02-26 Till Tantau <tantau@users.sourceforge.net> - - Fixed bug in pgfkeysaddvalue. - - Fixed bug of stack leak in function shadings in postscript. - - Fixed missing image inclusion documentation. - - Fixed atan bug in documentation example. - - Fixed missing dependency of chains--positioning library - - Fixed missing dependency of mindmap--decorations library + - Fixed bug in pgfkeysaddvalue. + - Fixed bug of stack leak in function shadings in postscript. + - Fixed missing image inclusion documentation. + - Fixed atan bug in documentation example. + - Fixed missing dependency of chains--positioning library + - Fixed missing dependency of mindmap--decorations library 2008-02-20 Till Tantau <tantau@users.sourceforge.net> - Released version 2.00 + Released version 2.00 2008-02-14 Till Tantau <tantau@users.sourceforge.net> - - Fixed "initial"/"accepting" distance bug. - - Fixed wrong intersection computation bug. - + - Fixed "initial"/"accepting" distance bug. + - Fixed wrong intersection computation bug. + 2008-02-13 Till Tantau <tantau@users.sourceforge.net> - - Added "local bounding box" option for Fabien... + - Added "local bounding box" option for Fabien... 2008-02-12 Till Tantau <tantau@users.sourceforge.net> - - Finished chains and chain tutorial. - - Fixed height of rounded rectangle shape. - + - Finished chains and chain tutorial. + - Fixed height of rounded rectangle shape. + 2008-02-11 Till Tantau <tantau@users.sourceforge.net> - - Added "auto end on length" and "auto corner on length" - options to decorations. - - Added "if input segment is closepath" option to - decorations. - - Renamed "subpath" in decoration code to "inputsegment". In - the pdf-specification (and in the rest of the pgf manual) a - path is made up of subpath, which are started by movetos, - and these in turn are made up of segments. In decorations, - segments used to be called subpaths, which was too - confusing... - - More renaming in chains, but its stabilizing now. - - Started a tutorial on chains. - + - Added "auto end on length" and "auto corner on length" + options to decorations. + - Added "if input segment is closepath" option to + decorations. + - Renamed "subpath" in decoration code to "inputsegment". In + the pdf-specification (and in the rest of the pgf manual) a + path is made up of subpath, which are started by movetos, + and these in turn are made up of segments. In decorations, + segments used to be called subpaths, which was too + confusing... + - More renaming in chains, but its stabilizing now. + - Started a tutorial on chains. + 2008-02-10 Till Tantau <tantau@users.sourceforge.net> - - Moved chain part inside "positioning" into "chains" - library. - - Renamed things in the chains library, yet again and added - branches. - - Fixed bug with "xyz of" placements. + - Moved chain part inside "positioning" into "chains" + library. + - Renamed things in the chains library, yet again and added + branches. + - Fixed bug with "xyz of" placements. 2008-02-08 Till Tantau <tantau@users.sourceforge.net> - - Renamed "placements" library to "positioning". - - Renamed and changed all chain commands. - - Added scopes library. - - Renamed cap and join to line cap and line join (but old ones - are still available). + - Renamed "placements" library to "positioning". + - Renamed and changed all chain commands. + - Added scopes library. + - Renamed cap and join to line cap and line join (but old ones + are still available). 2008-02-07 Till Tantau <tantau@users.sourceforge.net> - - Patched Makefiles according to suggestion by Hans Meine. - - Fixed bug: duplicate fading name in pgflibraryfadings. - - Fixed bug: wrong size of functional shading in dvips. - - Fixed bud: documentation a4paper setting. - - Fixed bug: Manual now compiles with tex4ht once more. - - Fixed bug: Manual now is hyperlinked also for dvipdfm. - - Fixed bug: wrong size of all shadings in svg code. - - Slight change in placement lib, default chain now has a - name. + - Patched Makefiles according to suggestion by Hans Meine. + - Fixed bug: duplicate fading name in pgflibraryfadings. + - Fixed bug: wrong size of functional shading in dvips. + - Fixed bud: documentation a4paper setting. + - Fixed bug: Manual now compiles with tex4ht once more. + - Fixed bug: Manual now is hyperlinked also for dvipdfm. + - Fixed bug: wrong size of all shadings in svg code. + - Slight change in placement lib, default chain now has a + name. 2008-02-07 Mark Wibrow <vibrovski@users.sourceforge.net> - - Removed internal asin tables as asin is now calculated from - acos tables. - - Misc. updates for shapes docs. + - Removed internal asin tables as asin is now calculated from + acos tables. + - Misc. updates for shapes docs. 2008-02-06 Till Tantau <tantau@users.sourceforge.net> - - Changed fit library, so that nodes are now "completely" - fitted. - - Changed tutorial so that fit library is now used. - - Added placement library and documentation. + - Changed fit library, so that nodes are now "completely" + fitted. + - Changed tutorial so that fit library is now used. + - Added placement library and documentation. 2008-02-05 Till Tantau <tantau@users.sourceforge.net> - - Fixes in snake compatibility code. - - Added dvipdfmx support (identical to dvipdfm). - - Fixed missing braces and color stack problem in - shapes.logic.IEC. + - Fixes in snake compatibility code. + - Added dvipdfmx support (identical to dvipdfm). + - Fixed missing braces and color stack problem in + shapes.logic.IEC. 2008-02-04 Till Tantau <tantau@users.sourceforge.net> - - Patched (and hopefully fixed) hyperref support. - - Made matrix inversion more precise. - - Added tutorial for geometric constructions. - - Fixed partway and intersection computations. - - Added line to circle intersection. + - Patched (and hopefully fixed) hyperref support. + - Made matrix inversion more precise. + - Added tutorial for geometric constructions. + - Fixed partway and intersection computations. + - Added line to circle intersection. 2008-02-03 Till Tantau <tantau@users.sourceforge.net> - - - Added through library (still very simple...). - - Added computation of intersection of circles and tangent to - a circle. + + - Added through library (still very simple...). + - Added computation of intersection of circles and tangent to + a circle. 2008-01-31 Mark Wibrow <vibrovski@users.sourceforge.net> - - Updated isosceles triangle shape. Positioning of node - contents improved. Added key so minimum width and height - can be applied independently - - Fix for trapezium shape for minimum height. This fix may - ``break'' exisiting code by making any trapezium enlarged using - minimum height to appear slightly wider than before. But... - - Added keys for trapezium so that minimum width and height - can be applied independently, or to just the `body' of the - trapezium. + - Updated isosceles triangle shape. Positioning of node + contents improved. Added key so minimum width and height + can be applied independently + - Fix for trapezium shape for minimum height. This fix may + ``break'' exisiting code by making any trapezium enlarged using + minimum height to appear slightly wider than before. But... + - Added keys for trapezium so that minimum width and height + can be applied independently, or to just the `body' of the + trapezium. 2008-01-30 Mark Wibrow <vibrovski@users.sourceforge.net> - - Reimplemented shape `tape'. Anchors should behave a bit - better now. + - Reimplemented shape `tape'. Anchors should behave a bit + better now. 2008-01-29 Till Tantau <tantau@users.sourceforge.net> - - Fixed problem with pin a relative coordinates. + - Fixed problem with pin a relative coordinates. 2008-01-27 Mark Wibrow <vibrovski@users.sourceforge.net> - - Added `logic gate IEC symbol color` key to change color - for all symbols simultaneously. - - Fix for loading US and IEC shape library separately. - - Misc. updates for decoration docs. + - Added `logic gate IEC symbol color` key to change color + for all symbols simultaneously. + - Fix for loading US and IEC shape library separately. + - Misc. updates for decoration docs. 2008-01-26 Till Tantau <tantau@users.sourceforge.net> - - Modified calc library. Working on documentation. - - Added calc library and ($...$) notation for coordinates. + - Modified calc library. Working on documentation. + - Added calc library and ($...$) notation for coordinates. 2008-01-25 Mark Wibrow <vibrovski@users.sourceforge.net> - - - Reorganised logic shapes. Now two libraries: - shapes.gates.logic.US (for `American' gates) and - shapes.gates.logic.IEC (for rectangular gates). - Gates are now named `and gate US' or `and gate IEC' etc. - TikZ key `use US style logic gates' and `use IEC style - logic gates' set up styles so that (e.g.) `and gate' - becomes a synonym for `shape=and gate US'. See docs for - details. + + - Reorganised logic shapes. Now two libraries: + shapes.gates.logic.US (for `American' gates) and + shapes.gates.logic.IEC (for rectangular gates). + Gates are now named `and gate US' or `and gate IEC' etc. + TikZ key `use US style logic gates' and `use IEC style + logic gates' set up styles so that (e.g.) `and gate' + becomes a synonym for `shape=and gate US'. See docs for + details. 2008-01-23 Till Tantau <tantau@users.sourceforge.net> - - Added decorations.markings. + - Added decorations.markings. 2008-01-22 Till Tantau <tantau@users.sourceforge.net> - - Fixed pgfpatharc: Fractional angles are now handled - correctly. - - Fixed incompatability with bm package: Changed hack to - \@@end to \AtEndDocument. - - Changed things in the math engine to speed up things: First, - \pgfmath@returnone now uses simpler and faster code. Second, - some marshals in the internal math commands like - \pgfmathadd@ have been removed. This makes it necessary that - the second operand in a call to an internal math macro no - longer uses \pgf@x or \pgf@xa and I fixed the 3 places where - this was the case. - - Added footprint decoration and merged Marks footprints. - - Added buffering to the subpath mechanism. This speeds up - constructions of very long paths by a factor of 10 or more. - - Fixed missing declaration of \iftikz@decoratepath in - tikz.code.tex. + - Fixed pgfpatharc: Fractional angles are now handled + correctly. + - Fixed incompatability with bm package: Changed hack to + \@@end to \AtEndDocument. + - Changed things in the math engine to speed up things: First, + \pgfmath@returnone now uses simpler and faster code. Second, + some marshals in the internal math commands like + \pgfmathadd@ have been removed. This makes it necessary that + the second operand in a call to an internal math macro no + longer uses \pgf@x or \pgf@xa and I fixed the 3 places where + this was the case. + - Added footprint decoration and merged Marks footprints. + - Added buffering to the subpath mechanism. This speeds up + constructions of very long paths by a factor of 10 or more. + - Fixed missing declaration of \iftikz@decoratepath in + tikz.code.tex. 2008-01-22 Mark Wibrow <vibrovski@users.sourceforge.net> - - - Added logic shapes library. Includes AND gate, NAND gate, - OR gate, NOR gate, XOR gate, XNOR gate and NOT gate. + + - Added logic shapes library. Includes AND gate, NAND gate, + OR gate, NOR gate, XOR gate, XNOR gate and NOT gate. 2008-01-22 Till Tantau <tantau@users.sourceforge.net> - - Fooled around with title page. - - Changed TikZ path scoping rules: Scopes no longer affect the - last point on a path. This was a nuiseance before and became - a real problem with decorations. - - Finished my move from snakes to decorations. Also finished - documentation. - We are now ready for a new release! - + - Fooled around with title page. + - Changed TikZ path scoping rules: Scopes no longer affect the + last point on a path. This was a nuiseance before and became + a real problem with decorations. + - Finished my move from snakes to decorations. Also finished + documentation. + We are now ready for a new release! + 2008-01-19 Mark Wibrow <vibrovski@users.sourceforge.net> - - - Removed \externalcode command for decoration states as - persistent pre/postcomputation stuff does a similar job. + + - Removed \externalcode command for decoration states as + persistent pre/postcomputation stuff does a similar job. 2008-01-18 Mark Wibrow <vibrovski@users.sourceforge.net> - - - Added \externalcode command for decoration states. Allows - code to be executed outside the TeX-group the state code - is executed in. + + - Added \externalcode command for decoration states. Allows + code to be executed outside the TeX-group the state code + is executed in. 2008-01-17 Till Tantau <tantau@users.sourceforge.net> - - Split decoration lib into several libs. - - Renamed lineto decoration to curveto decoration. - - Renamed many keys of decorations and snakes to shorter - names. - - Changed the tikz setting of decoration options. - - No documentation yet. + - Split decoration lib into several libs. + - Renamed lineto decoration to curveto decoration. + - Renamed many keys of decorations and snakes to shorter + names. + - Changed the tikz setting of decoration options. + - No documentation yet. 2008-01-17 Till Tantau <tantau@users.sourceforge.net> - - Started merging snakes and decorations. Not yet finished. + - Started merging snakes and decorations. Not yet finished. 2008-01-16 Till Tantau <tantau@users.sourceforge.net> - - (Partly) rewrote the tikz support for decorations. There is - now a "decorate" path command: - \draw ... decorate [decoration=zigzag] { (0,0) -- (1,2) }; + - (Partly) rewrote the tikz support for decorations. There is + now a "decorate" path command: + \draw ... decorate [decoration=zigzag] { (0,0) -- (1,2) }; This yields a much cleaner interface. - - There is also a decorate=true/false option that causes the - whole path to be decorated. - - Decorated path can now contain nodes. - - Node paths can also be decorated now. - - Fixed missing \pgftransformreset inside decoration - environment. - + - There is also a decorate=true/false option that causes the + whole path to be decorated. + - Decorated path can now contain nodes. + - Node paths can also be decorated now. + - Fixed missing \pgftransformreset inside decoration + environment. + 2008-01-15 Till Tantau <tantau@users.sourceforge.net> - - Changed the decoration documentation a bit. Still not quite - perfect... - - Restructured the basic layer. There is a central core (which - got slightly larger) and "modules", which can be included - using \usepgfmodule. All the pgfbaseXXX files are now - obsolete and only included for the old ones for - compatibility. - The {pgf} package no longer includes the modules "pattern", - "snakes" and "decorations" by default. However, these - modules are loaded by their respective libraries, so, - normally, no one will notice. - + - Changed the decoration documentation a bit. Still not quite + perfect... + - Restructured the basic layer. There is a central core (which + got slightly larger) and "modules", which can be included + using \usepgfmodule. All the pgfbaseXXX files are now + obsolete and only included for the old ones for + compatibility. + The {pgf} package no longer includes the modules "pattern", + "snakes" and "decorations" by default. However, these + modules are loaded by their respective libraries, so, + normally, no one will notice. + 2008-01-15 Mark Wibrow <vibrovski@users.sourceforge.net> - - - Fix for minimum size in ellipse split shape. - - Added decorations documentation. + + - Fix for minimum size in ellipse split shape. + - Added decorations documentation. 2008-01-14 Till Tantau <tantau@users.sourceforge.net> - - Coordinates like (2,3cm) are now allowed. Has the same - effect as ([shift={(2,0)}]0pt,3cm), which is what everybody - would expect. - - Moved tikz hacks inside tikzlibrarydecorations into - tikz.code.tex itself. + - Coordinates like (2,3cm) are now allowed. Has the same + effect as ([shift={(2,0)}]0pt,3cm), which is what everybody + would expect. + - Moved tikz hacks inside tikzlibrarydecorations into + tikz.code.tex itself. 2008-01-14 Mark Wibrow <vibrovski@users.sourceforge.net> - - - Fix for save stack overflow in decorations. - - Renamed \pgfdecorate \endpgfdecorate, now \pgfdecoration - \endpgfdecoration. Makes it more consistent with... - - Meta decorations! Automata that decorate the path with - decoration automata! Increased fancyness! Docs soon. - - Removed a bunch of keys from \tikzlibrarydecorations as - not really necessary. + + - Fix for save stack overflow in decorations. + - Renamed \pgfdecorate \endpgfdecorate, now \pgfdecoration + \endpgfdecoration. Makes it more consistent with... + - Meta decorations! Automata that decorate the path with + decoration automata! Increased fancyness! Docs soon. + - Removed a bunch of keys from \tikzlibrarydecorations as + not really necessary. 2008-01-13 Till tantau <tantau@users.sourceforge.net> - - Changed shadow lib once more and added it to CVS. + - Changed shadow lib once more and added it to CVS. 2008-01-13 Mark Wibrow <vibrovski@users.sourceforge.net> - - Added decorations files. Docs to follow soon(ish). - - Fix for `star point ratio' and `star point height' - keys in star shape. + - Added decorations files. Docs to follow soon(ish). + - Fix for `star point ratio' and `star point height' + keys in star shape. 2008-01-11 Till Tantau <tantau@users.sourceforge.net> - - - Added copy shadow. + + - Added copy shadow. 2008-01-10 Till Tantau <tantau@users.sourceforge.net> - - Added random steps snake. - + - Added random steps snake. + 2008-01-09 Till Tantau <tantau@users.sourceforge.net> - - Added shadow library, removed shadow shapes (no longer - needed). - - Added preaction and postaction options (very useful). - - Added transform canvas option. - - Added scale around option. - - Moved tikz.code.tex to tikz/tikz.code.tex - - Moved .../libraries/pgflibrarytikzXXXX.code.tex to - .../frontendlayer/tikz/libraries/tikzlibraryXXXX.code.tex. + - Added shadow library, removed shadow shapes (no longer + needed). + - Added preaction and postaction options (very useful). + - Added transform canvas option. + - Added scale around option. + - Moved tikz.code.tex to tikz/tikz.code.tex + - Moved .../libraries/pgflibrarytikzXXXX.code.tex to + .../frontendlayer/tikz/libraries/tikzlibraryXXXX.code.tex. 2007-12-20 Till Tantau <tantau@users.sourceforge.net> - - Fixed missing example bbs for dvipdfm. - - Fixed buggy swirl shading. - - Finished documentation switch from \itemoption to {key}. - - Changed TikZ fading options. More consistent and easier to use, - now. + - Fixed missing example bbs for dvipdfm. + - Fixed buggy swirl shading. + - Finished documentation switch from \itemoption to {key}. + - Changed TikZ fading options. More consistent and easier to use, + now. 2007-12-20 Mark Wibrow <vibrovski@users.sourceforge.net> - - Added `ellipse split' shape. + - Added `ellipse split' shape. 2007-12-17 Till Tantau <tantau@users.sourceforge.net> - - Fixed spaces problem with external graphics. - - Added [missing] option to supress children. - - Reduced number of libs includes by {shapes} to geometric, - misc and symbol. Shapes is now more or less deprecated. - - Added shadowed shapes. - - Added pgfsys-xetex for native xetex support. - - Added documentation hint on scoping inside \foreach. - - Fixed bug [1620194] "tikz library mindmap requires trees" - - Fixed bug [1787504] "Usage of \@namelet in xxcolor.sty clases with memoir." - - Fixed bug [1809693] "background rectangle is scaled". - + - Fixed spaces problem with external graphics. + - Added [missing] option to supress children. + - Reduced number of libs includes by {shapes} to geometric, + misc and symbol. Shapes is now more or less deprecated. + - Added shadowed shapes. + - Added pgfsys-xetex for native xetex support. + - Added documentation hint on scoping inside \foreach. + - Fixed bug [1620194] "tikz library mindmap requires trees" + - Fixed bug [1787504] "Usage of \@namelet in xxcolor.sty clases with memoir." + - Fixed bug [1809693] "background rectangle is scaled". + 2007-12-13 Till Tantau <tantau@users.sourceforge.net> - - Added fadings. - - Added functional shadings. - - Fixed bug in double drawing with arrows. + - Added fadings. + - Added functional shadings. + - Fixed bug in double drawing with arrows. 2007-11-24 Mark Wibrow <vibrovski@users.sourceforge.net> - - Fix for all math functions with two arguments. - - Fix for tikz when y-coordinate is a function within braces. - - Fix for distance calculation in shape snake. - - Added `cloud callout' shape. - - cloud shape can now use (or ignore) `aspect' key. - - More key updates/fixes for shapes. - + - Fix for all math functions with two arguments. + - Fix for tikz when y-coordinate is a function within braces. + - Fix for distance calculation in shape snake. + - Added `cloud callout' shape. + - cloud shape can now use (or ignore) `aspect' key. + - More key updates/fixes for shapes. + 2007-11-23 Till Tantau <tantau@users.sourceforge.net> - - - Corrected minimum size of a diamond shape (was twice the - correct size -- this may break existing code, but that cannot - be avoided!). - - Changed some more documentation from \itemoption to {key}s. Not - yet finished. - + + - Corrected minimum size of a diamond shape (was twice the + correct size -- this may break existing code, but that cannot + be avoided!). + - Changed some more documentation from \itemoption to {key}s. Not + yet finished. + 2007-11-19 Mark Wibrow <vibrovski@users.sourceforge.net> - - Updated math documentation. Code examples now consistent with - the rest of the manual. + - Updated math documentation. Code examples now consistent with + the rest of the manual. 2007-11-12 Till Tantau <tantau@users.sourceforge.net> - - - Fixed hyperref-dvipdfm-problem. - + + - Fixed hyperref-dvipdfm-problem. + 2007-11-10 Mark Wibrow <vibrovski@users.sourceforge.net> - - Updated cloud shape for minimum size calculations. - - Reimplemented rounded rectangle. Now supports concave arcs. - - Removed all stuff for Fancy hyperlinked picture of shapes. + - Updated cloud shape for minimum size calculations. + - Reimplemented rounded rectangle. Now supports concave arcs. + - Removed all stuff for Fancy hyperlinked picture of shapes. 2007-11-07 Till Tantau <tantau@users.sourceforge.net> - - - \foreach will now allow a macro name to be given as list - argument (as in \foreach \x in \mylist {...}) - + + - \foreach will now allow a macro name to be given as list + argument (as in \foreach \x in \mylist {...}) + 2007-10-29 Till Tantau <tantau@users.sourceforge.net> - - Fixed keys problem when .try is used with a comma. - + - Fixed keys problem when .try is used with a comma. + 2007-10-28 Mark Wibrow <vibrovski@users.sourceforge.net> - - Fixed shape snake for drawing to other pictures. - - Added shapes `arrow box' shape, `rectangle callout` and - `ellipse callout'. + - Fixed shape snake for drawing to other pictures. + - Added shapes `arrow box' shape, `rectangle callout` and + `ellipse callout'. 2007-10-26 Till Tantau <tantau@users.sourceforge.net> - - Fixed dvipdfm problem with hyperref. + - Fixed dvipdfm problem with hyperref. 2007-10-13 Mark Wibrow <vibrovski@users.sourceforge.net> - - pgfbasesnakes: changed length calculation and added angle calculation. - - added `shape snake' to snake library. - - added cylinder shape to geometric shapes. - - renamed `bevelled rectangle'. Now called `chamfered rectangle'. - - renamed pgfsavepgf@process. Now called pgfextract@process. + - pgfbasesnakes: changed length calculation and added angle calculation. + - added `shape snake' to snake library. + - added cylinder shape to geometric shapes. + - renamed `bevelled rectangle'. Now called `chamfered rectangle'. + - renamed pgfsavepgf@process. Now called pgfextract@process. 2007-10-12 Mark Wibrow <vibrovski@users.sourceforge.net> - - Fixed bug #1803811 gobbling of tokens after \pgfmathaddtocounter. - - Fixed insertion of spaces after \pgfmath stuff. - - Fixed bug #1811862. + - Fixed bug #1803811 gobbling of tokens after \pgfmathaddtocounter. + - Fixed insertion of spaces after \pgfmath stuff. + - Fixed bug #1811862. 2007-09-19 Mark Wibrow <vibrovski@users.sourceforge.net> @@ -3471,21 +3343,21 @@ 2007-08-20 Mark Wibrow <vibrovski@users.sourceforge.net> - - Added cloud shape. - - Updated all shapes (and doc.) for pgfkeys. - - Changed Kite key: Now use (e.g.) '/pgf/kite vertex angles=60 and 70' (see doc.) - - Added keys /pgf/shape aspect and /pgf/shape aspect inverse, (but \pgfsetshapeaspect - and, TikZ option `apsect' are still there for compatability). - - Updated diamond shape (and doc.) to use keys. - -`Housekeeping' stuff (moved some macros around). + - Added cloud shape. + - Updated all shapes (and doc.) for pgfkeys. + - Changed Kite key: Now use (e.g.) '/pgf/kite vertex angles=60 and 70' (see doc.) + - Added keys /pgf/shape aspect and /pgf/shape aspect inverse, (but \pgfsetshapeaspect + and, TikZ option `apsect' are still there for compatability). + - Updated diamond shape (and doc.) to use keys. + -`Housekeeping' stuff (moved some macros around). 2007-08-10 Mark Wibrow <vibrovski@users.sourceforge.net> - - Trapezium shape updated. No longer uses left and right - extensions. Uses internal angles instead. + - Trapezium shape updated. No longer uses left and right + extensions. Uses internal angles instead. - Updated pgfkeys for shapes (not done \pgfsetshapeaspect for - diamond shape) + diamond shape) 2007-08-09 Mark Wibrow <vibrovski@users.sourceforge.net> @@ -3494,7 +3366,7 @@ 2007-08-08 Till Tantau <tantau@users.sourceforge.net> - - Added fitting library. + - Added fitting library. 2007-07-28 Mark Wibrow <vibrovski@users.sourceforge.net> @@ -3506,373 +3378,373 @@ 2007-07-23 Till Tantau <tantau@users.sourceforge.net> - - Started to use new pgfkeys also in pgf. In particular, - commands like \pgfsetshape... are now replaced by keys. - (Not yet finished.) - + - Started to use new pgfkeys also in pgf. In particular, + commands like \pgfsetshape... are now replaced by keys. + (Not yet finished.) + 2007-07-21 Mark Wibrow <vibrovski@users.sourceforge.net> - - Added new geometric shape: `circular sector'. - - Updated pgfbaseshapes.code.tex for saved macro support. + - Added new geometric shape: `circular sector'. + - Updated pgfbaseshapes.code.tex for saved macro support. 2007-07-12 Till Tantau <tantau@users.sourceforge.net> - - Added overlay functionality to \node. - - Added pgfkeys and its documentation. + - Added overlay functionality to \node. + - Added pgfkeys and its documentation. 2007-07-10 Mark Wibrow <vibrovski@users.sourceforge.net> - - Updated all `new' geometric shapes: polygon, star, trapezium, - semicircle, isosceles triangle, kite, dart. - - `isosceles triangle' and `simple isosceles triangle' combined - into one shape. - - more accurate anchor positioning in polygon and star shapes. - - Added `shape border uses incircle' option for supporting shapes. - - Added `shape border rotate' option for supporting shapes. + - Updated all `new' geometric shapes: polygon, star, trapezium, + semicircle, isosceles triangle, kite, dart. + - `isosceles triangle' and `simple isosceles triangle' combined + into one shape. + - more accurate anchor positioning in polygon and star shapes. + - Added `shape border uses incircle' option for supporting shapes. + - Added `shape border rotate' option for supporting shapes. 2007-07-04 Mark Wibrow <vibrovski@users.sourceforge.net> - - Added support for sec, cosec and cot. + - Added support for sec, cosec and cot. 2007-07-03 Till Tantau <tantau@users.sourceforge.net> - - Fixed missing compatibility \pgfsincos - - Fixed wrong \pgfmathsincos + - Fixed missing compatibility \pgfsincos + - Fixed wrong \pgfmathsincos 2007-06-23 Mark Wibrow <vibrovski@users.sourceforge.net> - - Added semicircle shape. - - Updated documentation for all new shapes. + - Added semicircle shape. + - Updated documentation for all new shapes. 2007-06-22 Mark Wibrow <vibrovski@users.sourceforge.net> - - Added support for savedmacros in \pgfdeclareshape. - - Added trapezium shape. - - Added support for `legacy' calc code (\real, \minof, \maxof, \ratio). - - Fixed 'public' sqrt macro in \pgfmathoperations.code.tex - - Added isosceles triangle shape: uses incircle, but supports arbitrary - rotation of border. - - Added simple isosceles triangle shape: much tighter fit of node - contents, but restricted rotation of border. + - Added support for savedmacros in \pgfdeclareshape. + - Added trapezium shape. + - Added support for `legacy' calc code (\real, \minof, \maxof, \ratio). + - Fixed 'public' sqrt macro in \pgfmathoperations.code.tex + - Added isosceles triangle shape: uses incircle, but supports arbitrary + rotation of border. + - Added simple isosceles triangle shape: much tighter fit of node + contents, but restricted rotation of border. 2007-06-21 Till Tantau <tantau@users.sourceforge.net> - - Fixed text width problem in matrix of nodes. + - Fixed text width problem in matrix of nodes. 2007-01-18 Till Tantau <tantau@users.sourceforge.net> - Version 1.18: - - - Added regular polygon and star shapes (by Mark Wibrow). - - Added graphic externalization commands. - - Added barycentric coordinate system. - - Added direct TikZ plotting of function based on math engine. - - Added math documentation into main documentation. - - Added Mark Wibrow's math library. - - Added calendar support. - - Added matrix stuff. - - Added automatic driver selection for xetex. - - Added "growth parent anchor" option. - - Fixed superfluous spaces in quick math parse code - - Fixed superfluous \newboxes in math and image code - - Fixed mth parser to recognize \wd\mybox. - - Fixed wrong \pgfmathsetrandomseed - - Fixed wrong \pgfmathradians@ - - Fixed problems with long mantissa and plain tex math code. - - Fixed things so that \setlength works in pictures, once - more. - - Fixed selectfont problem in pdfsys-dvipdfm.def - - Fixed problem with lost lastx/lasty in foreach in TikZ. - - Fixed snake+rectangle+transform problem. - - Fixed rectangle+rounded corner problem. - - Fixed postscrip eofill1 problem. - - Fixed amsmath/pgf clash because of wrong definition of \: - - Fixed size of hyperlinks inside nodes. - - Fixed ConTeXt problem in pgfbaseplot. - - Fixed .aux problems in plain and ConTeXt mode. Using .pgf as - extension now. + Version 1.18: + + - Added regular polygon and star shapes (by Mark Wibrow). + - Added graphic externalization commands. + - Added barycentric coordinate system. + - Added direct TikZ plotting of function based on math engine. + - Added math documentation into main documentation. + - Added Mark Wibrow's math library. + - Added calendar support. + - Added matrix stuff. + - Added automatic driver selection for xetex. + - Added "growth parent anchor" option. + - Fixed superfluous spaces in quick math parse code + - Fixed superfluous \newboxes in math and image code + - Fixed mth parser to recognize \wd\mybox. + - Fixed wrong \pgfmathsetrandomseed + - Fixed wrong \pgfmathradians@ + - Fixed problems with long mantissa and plain tex math code. + - Fixed things so that \setlength works in pictures, once + more. + - Fixed selectfont problem in pdfsys-dvipdfm.def + - Fixed problem with lost lastx/lasty in foreach in TikZ. + - Fixed snake+rectangle+transform problem. + - Fixed rectangle+rounded corner problem. + - Fixed postscrip eofill1 problem. + - Fixed amsmath/pgf clash because of wrong definition of \: + - Fixed size of hyperlinks inside nodes. + - Fixed ConTeXt problem in pgfbaseplot. + - Fixed .aux problems in plain and ConTeXt mode. Using .pgf as + extension now. 2006-10-26 Till Tantau <tantau@users.sourceforge.net> - Version 1.10: + Version 1.10: - - Renamed \pgf@sys@pdf@mark to \pgfsyspdfmark. - - Fixed the ConTeXt support so that it is usable (which is wasn't). - + - Renamed \pgf@sys@pdf@mark to \pgfsyspdfmark. + - Fixed the ConTeXt support so that it is usable (which is wasn't). + 2006-10-11 Till Tantau <tantau@users.sourceforge.net> - Version 1.09: - - - Added \usepgflibrary and \usetikzlibrary to simplify adding - new libraries. - - Added native ConTeXt support in the form of module - wrappers. - - Added patterns. - - Added crosses snake. - - Added to and edge path operations. - - Added to path library. In particular, this gives decent - curved paths. - - Added tikz automata library. - - Added tikz er diagram library. - - Added tikz Petri net library. - - Added tikz mindmap library. - - Added access to nodes in other pictures (!). - - Added extended baseline setting. - - Added functionality to add new coordinate systems. - - Added polar xy coordinate system. - - Added diamond shape (!). - - Added plot mark phase, repeat and indices. - - Added text height and text depth options. - - Added label and pin options. - - Added automatic node placement (!). - - Added pgfsys-dvi.def for pure dvi mode. Supports only - black and white drawing (not documented and not really usable). - - Added 3d library (not documented and not really usable). - - Cleared up license chaos. - - Reorganized library documentation. - - Removed pgflibraryautomata, use pgflibrarytikzautomata instead. - - Fixed tree level option bug. - - Fixed missing options for coordinates. - - Fixed bug in TikZ parabola code. - - Fixed bug in TikZ snake cycle code. - - Fixed bug with empty list in pgffor - - Fixed bug in code for insertion of dvips header specials. - - Fixed bug in shading code (wrong bigpoint correction). - - Fixed bug #1472666. - - Fixed bug #1473255. - - Fixed bug #1526175. - - Fixed bug #1542512. - - Fixed bug in TikZ transformation code for nested pictures. - - Fixed patch #1443606. - - Fixed path #1526178. - + Version 1.09: + + - Added \usepgflibrary and \usetikzlibrary to simplify adding + new libraries. + - Added native ConTeXt support in the form of module + wrappers. + - Added patterns. + - Added crosses snake. + - Added to and edge path operations. + - Added to path library. In particular, this gives decent + curved paths. + - Added tikz automata library. + - Added tikz er diagram library. + - Added tikz Petri net library. + - Added tikz mindmap library. + - Added access to nodes in other pictures (!). + - Added extended baseline setting. + - Added functionality to add new coordinate systems. + - Added polar xy coordinate system. + - Added diamond shape (!). + - Added plot mark phase, repeat and indices. + - Added text height and text depth options. + - Added label and pin options. + - Added automatic node placement (!). + - Added pgfsys-dvi.def for pure dvi mode. Supports only + black and white drawing (not documented and not really usable). + - Added 3d library (not documented and not really usable). + - Cleared up license chaos. + - Reorganized library documentation. + - Removed pgflibraryautomata, use pgflibrarytikzautomata instead. + - Fixed tree level option bug. + - Fixed missing options for coordinates. + - Fixed bug in TikZ parabola code. + - Fixed bug in TikZ snake cycle code. + - Fixed bug with empty list in pgffor + - Fixed bug in code for insertion of dvips header specials. + - Fixed bug in shading code (wrong bigpoint correction). + - Fixed bug #1472666. + - Fixed bug #1473255. + - Fixed bug #1526175. + - Fixed bug #1542512. + - Fixed bug in TikZ transformation code for nested pictures. + - Fixed patch #1443606. + - Fixed path #1526178. + 2005-11-16 Till Tantau <tantau@users.sourceforge.net> - Version 1.01: + Version 1.01: - - Added textures support. - - Added text opacity option. - - Fixed bug in pgfbasesnakes.code.tex causing lot's of - 'missing = in nullfont' message in log file. - - Fixed bug that made plain tex mode unusable. - - Fixed missing pgfsys-vtex.def in FILES. - - Fixed wrong box placements in compatibility mode. - - Fixed SVG support to create legal xml. - - Moved documentation to doc/generic/pgf. + - Added textures support. + - Added text opacity option. + - Fixed bug in pgfbasesnakes.code.tex causing lot's of + 'missing = in nullfont' message in log file. + - Fixed bug that made plain tex mode unusable. + - Fixed missing pgfsys-vtex.def in FILES. + - Fixed wrong box placements in compatibility mode. + - Fixed SVG support to create legal xml. + - Moved documentation to doc/generic/pgf. 2005-10-23 Till Tantau <tantau@users.sourceforge.net> - Version 1.00: + Version 1.00: - - There have not been any real changes since 0.99. - - + - There have not been any real changes since 0.99. + + 2005-10-11 Till Tantau <tantau@users.sourceforge.net> - Version 0.99: + Version 0.99: - - Added vtex support (finally!). - - Added multi part mechanism to nodes. - - Added very simple pgflibraryautomata. - - Changed coordinate shape such that it now never produces a - text label. - - Renamed \pgfshapebox to \pgfnodeparttextbox (made necessary - by the node part mechanism). + - Added vtex support (finally!). + - Added multi part mechanism to nodes. + - Added very simple pgflibraryautomata. + - Changed coordinate shape such that it now never produces a + text label. + - Renamed \pgfshapebox to \pgfnodeparttextbox (made necessary + by the node part mechanism). 2005-09-20 Till Tantau <tantau@users.sourceforge.net> - Version 0.98: + Version 0.98: - - Added transparency to PGF (quite nice...). - - Added foreach option to child path operation (also nice...). - - Fixed problem with \\ in centered text. - - Fixed problem with hyperlinks in nodes. - - Fixed wrong arrows in trees. + - Added transparency to PGF (quite nice...). + - Added foreach option to child path operation (also nice...). + - Fixed problem with \\ in centered text. + - Fixed problem with hyperlinks in nodes. + - Fixed wrong arrows in trees. 2005-09-08 Till Tantau <tantua@users.sourceforge.net> - Version 0.97: - - - Reorganised directory structure of documentation. - - Added tree mechanism. - - Added snake mechanism. - - Added layer mechanism. - - Added new shapes: cross out, strike out, forbidden sign. - - Added some more documentation. - - Added "none" drawing and filling colors. - - Added pgflibrarytikzbackgrounds. - - Changed syntax of \pgfqbox. - - Changed syntax of several \pgfsys@xxxx commands. - - Added SVG support / a tex4ht backend. (Complicated text - inside svg graphics is not supported well, but that's mainly - a shortcoming of the svg specification.) + Version 0.97: + + - Reorganised directory structure of documentation. + - Added tree mechanism. + - Added snake mechanism. + - Added layer mechanism. + - Added new shapes: cross out, strike out, forbidden sign. + - Added some more documentation. + - Added "none" drawing and filling colors. + - Added pgflibrarytikzbackgrounds. + - Changed syntax of \pgfqbox. + - Changed syntax of several \pgfsys@xxxx commands. + - Added SVG support / a tex4ht backend. (Complicated text + inside svg graphics is not supported well, but that's mainly + a shortcoming of the svg specification.) 2005-07-06 Till Tantau <tantau@users.sourceforge.net> - Version 0.96: - - This is a beta version. Version 1.00 will be the first stable - version of TikZ/pgf. - - - Fixed spacing problem in dvips. - - Changed syntax of plot and plot marks. - - Changed syntax of ellipse and elliptical arc options. - - Fixed baseline bug in tikz. - - Fixed bug in pgfpages. - - Introduced "every xxxx" styles, got rid of shape actions option. - - Added "intersection of" syntax for coordinates. - - Started revising the documentation. - - Changed names of some pgfpages commands. - - Changed syntax of parabola command. - - Proof read documentation. + Version 0.96: + + This is a beta version. Version 1.00 will be the first stable + version of TikZ/pgf. + + - Fixed spacing problem in dvips. + - Changed syntax of plot and plot marks. + - Changed syntax of ellipse and elliptical arc options. + - Fixed baseline bug in tikz. + - Fixed bug in pgfpages. + - Introduced "every xxxx" styles, got rid of shape actions option. + - Added "intersection of" syntax for coordinates. + - Started revising the documentation. + - Changed names of some pgfpages commands. + - Changed syntax of parabola command. + - Proof read documentation. 2005-06-12 Till Tantau <tantau@users.sourceforge.net> - Version 0.95: - - This is an *alpha* prerelease version. Syntax changes - are still possible before the beta version. Version 1.00 - will be the stable version. - - Changes (this is almost a new program): - - Introduced three layers: system, basic, frontends. - - Wrote two frontends: TikZ (*most* useful!) and pgfpict2e (a - demonstration). - - Largely rewrote the basic layer. - - Largely rewrote the system layer. - - Completely rewrote the documentation. - - Added two utilities: pgfpages and pgffor. - - Made macro naming more consistent. - - Added plain tex support. - - Added dvipdfm support. - - Restructured directory structure. - - Zillions of small bugfixes. - + Version 0.95: + + This is an *alpha* prerelease version. Syntax changes + are still possible before the beta version. Version 1.00 + will be the stable version. + + Changes (this is almost a new program): + - Introduced three layers: system, basic, frontends. + - Wrote two frontends: TikZ (*most* useful!) and pgfpict2e (a + demonstration). + - Largely rewrote the basic layer. + - Largely rewrote the system layer. + - Completely rewrote the documentation. + - Added two utilities: pgfpages and pgffor. + - Made macro naming more consistent. + - Added plain tex support. + - Added dvipdfm support. + - Restructured directory structure. + - Zillions of small bugfixes. + 2004-10-20 Till Tantau <tantau@users.sourceforge.net> - Version 0.65: - - Fixed bug in pgfshade.sty that arises in conjunction with - calc.sty and latex+dvips. + Version 0.65: + - Fixed bug in pgfshade.sty that arises in conjunction with + calc.sty and latex+dvips. 2004-10-08 Till Tantau <tantau@users.sourceforge.net> - Version 0.64: - - Fixed missing depth of \pgfnodebox. - - Fixed bug that caused infinite stack loop with pictures inside - nodes. + Version 0.64: + - Fixed missing depth of \pgfnodebox. + - Fixed bug that caused infinite stack loop with pictures inside + nodes. 2004-07-08 Till Tantau <tantau@users.sourceforge.net> - Version 0.63: - - Added \pgfextractx, \pgfextracty, \pgfcorner. - - Added some documentation on masks and images. - - Fixed a somewhat obscure bug having to do with the modification - of \spaceskip. - - \pgfex and \pgfem no loner needed. Use 1ex etc. once more. - - calc.sty is now supported. + Version 0.63: + - Added \pgfextractx, \pgfextracty, \pgfcorner. + - Added some documentation on masks and images. + - Fixed a somewhat obscure bug having to do with the modification + of \spaceskip. + - \pgfex and \pgfem no loner needed. Use 1ex etc. once more. + - calc.sty is now supported. 2004-07-06 Till Tantau <tantau@users.sourceforge.net> - Version 0.62: - - Fixed problem in xxcolor with option "gray" and xcolor. - - Switched to xcolor version 2.00. - - Added eofill and eofillstroke commands. - - Added option to shadings, so that they are automatically - recalculated upon color changes. - - Changed names of example images to start with pgf. + Version 0.62: + - Fixed problem in xxcolor with option "gray" and xcolor. + - Switched to xcolor version 2.00. + - Added eofill and eofillstroke commands. + - Added option to shadings, so that they are automatically + recalculated upon color changes. + - Changed names of example images to start with pgf. 2004-04-07 Till Tantau <tantau@cs.tu-berlin.de> - Version 0.61: - - Added \pgfex and \pgfem dimensions. - - Fixed bug that causes pgfshade to fail to work if xcolor - is called with option "gray". - - Fixed PostScript code for radial shadings. - - xxcolor now works with xcolor 1.10 (and only 1.10). + Version 0.61: + - Added \pgfex and \pgfem dimensions. + - Fixed bug that causes pgfshade to fail to work if xcolor + is called with option "gray". + - Fixed PostScript code for radial shadings. + - xxcolor now works with xcolor 1.10 (and only 1.10). 2004-02-18 Till Tantau <tantau@cs.tu-berlin.de> - Version 0.60: - - Replaced some commands for the postscript code by shorter - versions for smaller file size. - - Fixed bug in pgfbox command that caused incorrect kerning in - postscript output. - - Fixed bug in pgfsys@defineimage that made page inclusion - impossible. - - Fixed bug in pgfshading that did not reset dash patterns in - shadings in the PostScript version. - - Spaces are now allowed inside the pgfpicture environment. - - Added \pgfgrid command. - + Version 0.60: + - Replaced some commands for the postscript code by shorter + versions for smaller file size. + - Fixed bug in pgfbox command that caused incorrect kerning in + postscript output. + - Fixed bug in pgfsys@defineimage that made page inclusion + impossible. + - Fixed bug in pgfshading that did not reset dash patterns in + shadings in the PostScript version. + - Spaces are now allowed inside the pgfpicture environment. + - Added \pgfgrid command. + 2004-01-13 Till Tantau <tantau@cs.tu-berlin.de> - Version 0.50: - - Switched to version 1.06 of xcolor. - - Core pgf no longer relies on xxcolor. - - The syntax of the mechanism for choosing alternate images and - shadings is more flexible now. The syntax has been changed - (mainly, you now have to have a dot between the original name and - the alternate extension). - - Some xxcolor commands have been removed. - + Version 0.50: + - Switched to version 1.06 of xcolor. + - Core pgf no longer relies on xxcolor. + - The syntax of the mechanism for choosing alternate images and + shadings is more flexible now. The syntax has been changed + (mainly, you now have to have a dot between the original name and + the alternate extension). + - Some xxcolor commands have been removed. + 2003-12-02 Till Tantau <tantau@cs.tu-berlin.de> - Version 0.43: - - Fixed \normalcolor, so that it works also in preamble. + Version 0.43: + - Fixed \normalcolor, so that it works also in preamble. 2003-11-20 Till Tantau <tantau@cs.tu-berlin.de> - Version 0.42: - - Documented masks. - - Fixed bug in pgf.sty for nested pictures. + Version 0.42: + - Documented masks. + - Fixed bug in pgf.sty for nested pictures. 2003-11-18 Till Tantau <tantau@cs.tu-berlin.de> - Version 0.41: - - Added masks (not yet documented). + Version 0.41: + - Added masks (not yet documented). 2003-11-12 Till Tantau <tantau@cs.tu-berlin.de> - Version 0.40: - - Changed syntax of \pgfdeclareimage. Uses key=value scheme - now. All parameters may now be omitted. - - Added \pgfimage command. - - Option for selecting a specific page from an image file. - - Fixed bug in xxcolor.sty having to do with \@ifempty command. - - Reworked the formatting of the user's guide. + Version 0.40: + - Changed syntax of \pgfdeclareimage. Uses key=value scheme + now. All parameters may now be omitted. + - Added \pgfimage command. + - Option for selecting a specific page from an image file. + - Fixed bug in xxcolor.sty having to do with \@ifempty command. + - Reworked the formatting of the user's guide. 2003-10-29 Till Tantau <tantau@cs.tu-berlin.de> - Version 0.34: - - Shadings now work together with color mix-ins. - - Shadings can now take color names as parameters. - + Version 0.34: + - Shadings now work together with color mix-ins. + - Shadings can now take color names as parameters. + 2003-10-24 Till Tantau <tantau@cs.tu-berlin.de> - Version 0.33: - - Fixed problem with missing \leavevmode in \pgfuseimage. - - Reworked code for image inclusion. - - "Draft" option is now supported. Supresses reading of images. - - Added xxcolor package. - - pgfpictures will now inherit the color from their surroundings. + Version 0.33: + - Fixed problem with missing \leavevmode in \pgfuseimage. + - Reworked code for image inclusion. + - "Draft" option is now supported. Supresses reading of images. + - Added xxcolor package. + - pgfpictures will now inherit the color from their surroundings. 2003-10-20 Till Tantau <tantau@cs.tu-berlin.de> - Version 0.32: - - Updated installation procedure information. + Version 0.32: + - Updated installation procedure information. 2003-09-18 Till Tantau <tantau@cs.tu-berlin.de> - Version 0.31: - - One parameter for \pgfdeclareimage may now be omitted. It will - be computed automatically. - + Version 0.31: + - One parameter for \pgfdeclareimage may now be omitted. It will + be computed automatically. + 2003-08-21 Till Tantau <tantau@cs.tu-berlin.de> - Version 0.30: - - Created ChangeLog - - Added pgfshade.sty - + Version 0.30: + - Created ChangeLog + - Added pgfshade.sty + ;;; Local Variables: diff --git a/Master/texmf-dist/doc/generic/pgf/FILES b/Master/texmf-dist/doc/generic/pgf/FILES index d49e5add7e3..7dc4c280031 100644 --- a/Master/texmf-dist/doc/generic/pgf/FILES +++ b/Master/texmf-dist/doc/generic/pgf/FILES @@ -83,7 +83,6 @@ pgf/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryfit.code.tex pgf/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryspy.code.tex pgf/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarythrough.code.tex pgf/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryshadings.code.tex -pgf/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryperspective.code.tex pgf/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarylindenmayersystems.code.tex pgf/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarypositioning.code.tex pgf/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryautomata.code.tex @@ -593,7 +592,6 @@ pgf/doc/generic/pgf/text-en/pgfmanual-en-library-folding.tex pgf/doc/generic/pgf/text-en/pgfmanual-en-library-profiler.tex pgf/doc/generic/pgf/text-en/pgfmanual-en-tutorial-Euclid.tex pgf/doc/generic/pgf/text-en/pgfmanual-en-gd-usage-tikz.tex -pgf/doc/generic/pgf/text-en/pgfmanual-en-library-perspective.tex pgf/doc/generic/pgf/text-en/pgfmanual-en-library-circuits.tex pgf/doc/generic/pgf/text-en/pgfmanual-en-library-babel.tex pgf/doc/generic/pgf/text-en/pgfmanual-en-library-trees.tex diff --git a/Master/texmf-dist/doc/generic/pgf/README b/Master/texmf-dist/doc/generic/pgf/README index d0af9b9adc5..de59b6dede9 100644 --- a/Master/texmf-dist/doc/generic/pgf/README +++ b/Master/texmf-dist/doc/generic/pgf/README @@ -5,7 +5,7 @@ doc/generic/pgf/pgfmanual.pdf for a manual. This documentation also explains the installation. See the file doc/generic/pgf/license/LICENSE for license details. -Please go to https://github.com/pgf-tikz/pgf +Please go to http://sourceforge.net/projects/pgf/ to submit bug reports, request new features, etc. diff --git a/Master/texmf-dist/doc/generic/pgf/licenses/gnu-free-documentation-license-1.2.txt b/Master/texmf-dist/doc/generic/pgf/licenses/gnu-free-documentation-license-1.2.txt index 26cf032dcdf..4a0fe1c8dee 100644 --- a/Master/texmf-dist/doc/generic/pgf/licenses/gnu-free-documentation-license-1.2.txt +++ b/Master/texmf-dist/doc/generic/pgf/licenses/gnu-free-documentation-license-1.2.txt @@ -1,5 +1,5 @@ - GNU Free Documentation License - Version 1.2, November 2002 + GNU Free Documentation License + Version 1.2, November 2002 Copyright (C) 2000,2001,2002 Free Software Foundation, Inc. diff --git a/Master/texmf-dist/doc/generic/pgf/licenses/gnu-public-license-2.txt b/Master/texmf-dist/doc/generic/pgf/licenses/gnu-public-license-2.txt index fd94e166f55..d511905c164 100644 --- a/Master/texmf-dist/doc/generic/pgf/licenses/gnu-public-license-2.txt +++ b/Master/texmf-dist/doc/generic/pgf/licenses/gnu-public-license-2.txt @@ -1,12 +1,12 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. - Preamble + Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public @@ -56,7 +56,7 @@ patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. - GNU GENERAL PUBLIC LICENSE + GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains @@ -255,7 +255,7 @@ make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. - NO WARRANTY + NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN @@ -277,9 +277,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - END OF TERMS AND CONDITIONS + END OF TERMS AND CONDITIONS - How to Apply These Terms to Your New Programs + How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it diff --git a/Master/texmf-dist/doc/generic/pgf/macros/pgfmanual-en-macros.tex b/Master/texmf-dist/doc/generic/pgf/macros/pgfmanual-en-macros.tex index c326d973e32..37591af1529 100644 --- a/Master/texmf-dist/doc/generic/pgf/macros/pgfmanual-en-macros.tex +++ b/Master/texmf-dist/doc/generic/pgf/macros/pgfmanual-en-macros.tex @@ -309,7 +309,7 @@ \def\extractmathfunctionname@#1(#2)#3\tmpb{\def\mathname{#1}} \makeatother - + \newenvironment{math-function}[1]{ \def\mathdefaultname{#1} \extractmathfunctionname{#1} @@ -339,7 +339,7 @@ \pgfmanualentryheadline{\mathexample\hfill\mathtype}% \def\mathtest{#1}% \ifx\mathtest\pgfmanualemptytext% - \index{#2@\protect\texttt{#2} #3 math operator}% + \index{#2@\protect\texttt{#2} #3 math operator}% \index{Math operators!#2@\protect\texttt{#2}}% \fi% \pgfmanualbody @@ -358,7 +358,7 @@ \pgfmanualentryheadline{\mathexample\hfill\mathtype}% \def\mathtest{#1}% \ifx\mathtest\pgfmanualemptytext% - \index{#2#3@\protect\texttt{#2\protect\ #3} #4 math operators}% + \index{#2#3@\protect\texttt{#2\protect\ #3} #4 math operators}% \index{Math operators!#2#3@\protect\texttt{#2\protect\ #3}}% \fi% \pgfmanualbody @@ -819,7 +819,7 @@ \decomposetoodeep#1/#2\nil% \else% \iffirsttime% - \begingroup% + \begingroup% % also make a pdf link anchor with full key path. \def\hyperlabelwithoutslash##1/\nil{% \pgfmanualpdflabel{##1}{}% @@ -1185,7 +1185,7 @@ \edef\strippedtext{\stripcommand#1}% \expandafter\getridofats\strippedtext @\relax% } - + \gdef\stripcommand#1{\expandafter\mygobble\string#1} } @@ -1326,14 +1326,14 @@ \newenvironment{arrowexamples} {\begin{tabbing} - \hbox to \dimexpr\linewidth-5.5cm\relax{\emph{Appearance of the below at line width} \hfil} \= + \hbox to \dimexpr\linewidth-5.5cm\relax{\emph{Appearance of the below at line width} \hfil} \= \hbox to 1.9cm{\emph{0.4pt}\hfil} \= \hbox to 2cm{\emph{0.8pt}\hfil} \= \emph{1.6pt} \\ } {\end{tabbing}\vskip-1em} \newenvironment{arrowcapexamples} {\begin{tabbing} - \hbox to \dimexpr\linewidth-5.5cm\relax{\emph{Appearance of the below at line width} \hfil} \= + \hbox to \dimexpr\linewidth-5.5cm\relax{\emph{Appearance of the below at line width} \hfil} \= \hbox to 1.9cm{\emph{1ex}\hfil} \= \hbox to 2cm{\emph{1em}\hfil} \\ } {\end{tabbing}\vskip-1em} @@ -1376,7 +1376,7 @@ \newcommand\symarrow[1]{% \index{#1@\protect\texttt{#1} arrow tip}% \index{Arrow tips!#1@\protect\texttt{#1}}% - \texttt{#1}& yields thick + \texttt{#1}& yields thick \begin{tikzpicture}[arrows={#1-#1},thick,baseline] \useasboundingbox (-1mm,-0.5ex) rectangle (1.1cm,2ex); \fill [black!15] (1cm,-.5ex) rectangle (1.1cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ; @@ -1391,7 +1391,7 @@ \newcommand\symarrowdouble[1]{% \index{#1@\protect\texttt{#1} arrow tip}% \index{Arrow tips!#1@\protect\texttt{#1}}% - \texttt{#1}& yields thick + \texttt{#1}& yields thick \begin{tikzpicture}[arrows={#1-#1},thick,baseline] \useasboundingbox (-1mm,-0.5ex) rectangle (1.1cm,2ex); \fill [black!15] (1cm,-.5ex) rectangle (1.1cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ; @@ -1402,12 +1402,12 @@ \useasboundingbox (-1mm,-0.5ex) rectangle (1.1cm,2ex); \fill [black!15] (1cm,-.5ex) rectangle (1.1cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ; \draw (0pt,.5ex) -- (1cm,.5ex); - \end{tikzpicture}, double + \end{tikzpicture}, double \begin{tikzpicture}[arrows={#1-#1},thick,baseline] \useasboundingbox (-1mm,-0.5ex) rectangle (1.1cm,2ex); \fill [black!15] (1cm,-.5ex) rectangle (1.1cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ; \draw[double,double equal sign distance] (0pt,.5ex) -- (1cm,.5ex); - \end{tikzpicture} and + \end{tikzpicture} and \begin{tikzpicture}[arrows={#1-#1},thin,baseline] \useasboundingbox (-1mm,-0.5ex) rectangle (1.1cm,2ex); \fill [black!15] (1cm,-.5ex) rectangle (1.1cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ; @@ -1420,7 +1420,7 @@ \index{Arrow tips!#1@\protect\texttt{#1}}% \index{#2@\protect\texttt{#2} arrow tip}% \index{Arrow tips!#2@\protect\texttt{#2}}% - \texttt{#1-#2}& yields thick + \texttt{#1-#2}& yields thick \begin{tikzpicture}[arrows={#1-#2},thick,baseline] \useasboundingbox (-1mm,-0.5ex) rectangle (1.1cm,2ex); \fill [black!15] (1cm,-.5ex) rectangle (1.1cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ; @@ -1438,7 +1438,7 @@ \index{Arrow tips!#1@\protect\texttt{#1}}% \index{#2@\protect\texttt{#2} arrow tip}% \index{Arrow tips!#2@\protect\texttt{#2}}% - \texttt{#1-#2}& yields thick + \texttt{#1-#2}& yields thick \begin{tikzpicture}[arrows={#1-#2},thick,baseline] \useasboundingbox (-1mm,-0.5ex) rectangle (1.1cm,2ex); \fill [black!15] (1cm,-.5ex) rectangle (1.1cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ; @@ -1448,12 +1448,12 @@ \useasboundingbox (-1mm,-0.5ex) rectangle (1.1cm,2ex); \fill [black!15] (1cm,-.5ex) rectangle (1.1cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ; \draw (0pt,.5ex) -- (1cm,.5ex); - \end{tikzpicture}, double + \end{tikzpicture}, double \begin{tikzpicture}[arrows={#1-#2},thick,baseline] \useasboundingbox (-1mm,-0.5ex) rectangle (1.1cm,2ex); \fill [black!15] (1cm,-.5ex) rectangle (1.1cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ; \draw[double,double equal sign distance] (0pt,.5ex) -- (1cm,.5ex); - \end{tikzpicture} and + \end{tikzpicture} and \begin{tikzpicture}[arrows={#1-#2},thin,baseline] \useasboundingbox (-1mm,-0.5ex) rectangle (1.1cm,2ex); \fill [black!15] (1cm,-.5ex) rectangle (1.1cm,1.5ex) (-1mm,-.5ex) rectangle (0mm,1.5ex) ; @@ -1482,7 +1482,7 @@ \index{#1@\protect\texttt{#1} plot mark}% \index{Plot marks!#1@\protect\texttt{#1}} \texttt{mark=\declare{\noligs{#1}}} & \tikz\draw[color=black!25] - plot[mark=#1,mark options={fill=examplefill,draw=black}] + plot[mark=#1,mark options={fill=examplefill,draw=black}] coordinates {(0,0) (.5,0.2) (1,0) (1.5,0.2)};\\ } @@ -1561,7 +1561,7 @@ % \codeexample@tabinit@catcode % and % \codeexample@tabinit@replacementchars -% which are used inside of +% which are used inside of %\begin{codeexample} % ... %\end{codeexample} @@ -1900,7 +1900,7 @@ \makeatother -%%% Local Variables: +%%% Local Variables: %%% mode: latex %%% TeX-master: "beameruserguide" -%%% End: +%%% End: diff --git a/Master/texmf-dist/doc/generic/pgf/pgfmanual.pdf b/Master/texmf-dist/doc/generic/pgf/pgfmanual.pdf Binary files differindex c521d86650b..69eac37dc41 100644 --- a/Master/texmf-dist/doc/generic/pgf/pgfmanual.pdf +++ b/Master/texmf-dist/doc/generic/pgf/pgfmanual.pdf diff --git a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-base-decorations.tex b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-base-decorations.tex index a4067c9861a..b51d5373162 100644 --- a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-base-decorations.tex +++ b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-base-decorations.tex @@ -968,7 +968,7 @@ only use one meta-decoration per path. \begin{environment}{{pgfmetadecoration}\marg{name}} This environment decorates the input path described in \meta{environment - contents}, with the meta-decoration \meta{name}. + contents}, with the meta-decoration \meta{name}. \end{environment} \begin{plainenvironment}{{pgfmetadecoration}\marg{name}} diff --git a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-base-points.tex b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-base-points.tex index 56f49d7e5dc..eace57ffde3 100644 --- a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-base-points.tex +++ b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-base-points.tex @@ -66,7 +66,7 @@ The following commands are the most basic for specifying a coordinate. \draw[help lines] (0,0) grid (3,2); \foreach \angle in {0,10,...,90} - {\pgfpathcircle{\pgfpointpolar{\angle}{1cm and 2cm}}{2pt}} + {\pgfpathcircle{\pgfpointpolar{\angle}{1cm/2cm}}{2pt}} \pgfusepath{fill} \end{tikzpicture} \end{codeexample} @@ -662,8 +662,8 @@ be used to perform the above code: Note that this macro is used often internally. For this reason, it is not a good idea to keep anything important in the variables |\pgf@x| and |\pgf@y| since they will be overwritten and changed frequently. Instead, intermediate -values can be stored in the \TeX-dimensions |\pgf@xa|, |\pgf@xb|, |\pgf@xc| and -their |y|-counterparts |\pgf@ya|, |\pgf@yb|, |\pgf@yc|. For example, here is the +values can ge stored in the \TeX-dimensions |\pgf@xa|, |\pgf@xb|, |\pgf@xc| and +their |y|-counterparts |\pgf@ya|, |\pgf@yb|, |pgf@yc|. For example, here is the code of the command |\pgfpointadd|: % \begin{codeexample}[code only] diff --git a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-base-transparency.tex b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-base-transparency.tex index 22156f98d3e..fda8f6a8872 100644 --- a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-base-transparency.tex +++ b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-base-transparency.tex @@ -349,7 +349,6 @@ Transparency groups are declared using the following commands. is ``large enough'' and then insert this picture into the main picture while ignoring the size. The following example shows how this is done: -% TODO: Nesting tikzpictures is NOT supported {\tikzexternaldisable \begin{codeexample}[] \begin{tikzpicture} diff --git a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-library-circuits.tex b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-library-circuits.tex index 31d4345cb69..66bbd1e3233 100644 --- a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-library-circuits.tex +++ b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-library-circuits.tex @@ -1241,7 +1241,7 @@ Let us begin with the base library that defines the handling of inputs. \foreach \x/\y/\z in {false/blue/1pt, true/red/2pt} \foreach \a in {north, south, east, west, north east, south east, north west, south west} - \draw[logic gate anchors use bounding box=\x, color=\y] + \draw[logic gate anchors use bounding box=\x, color=\y] (A.\a) circle(\z); \end{tikzpicture} \end{codeexample} diff --git a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-library-decorations.tex b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-library-decorations.tex index 718d8b7870c..58d2b6f3af8 100644 --- a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-library-decorations.tex +++ b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-library-decorations.tex @@ -1819,7 +1819,7 @@ shapes. This library is included mostly for historical reasons, using the \end{key} \begin{key}{/pgf/decoration/text effects/word count=\meta{macro}} - Store the number of words in the decoration text in \meta{macro}. + Store the number of words in the decoration text in \meta{macro}. Numbering starts at |1|. When the character is the word separator, \meta{macro} takes the number of the previous word. If the decoration text starts with a word separator \meta{macro} will be |0|. diff --git a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-library-perspective.tex b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-library-perspective.tex deleted file mode 100644 index 61ed10179ec..00000000000 --- a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-library-perspective.tex +++ /dev/null @@ -1,418 +0,0 @@ -\section{Three Point Perspective Drawing Library} - -\noindent\emph{by Max Snippe} - -\begin{tikzlibrary}{perspective} - This library provides tools for perspective drawing with one, two, or three - vanishing points. -\end{tikzlibrary} - -\subsection{Coordinate Systems} - -\begin{coordinatesystem}{three point perspective} - The |three point perspective| coordinate system is very similar to the |xyz| - coordinate system, save that it will display the provided coordinates with a - perspective projection. - % - \begin{key}{/tikz/cs/x=\meta{number} (initially 0)} - The $x$ component of the coordinate. Should be given \emph{without} unit. - \end{key} - % - \begin{key}{/tikz/cs/y=\meta{number} (initially 0)} - Same as |x|. - \end{key} - % - \begin{key}{/tikz/cs/z=\meta{number} (initially 0)} - Same as |x|. - \end{key} -\end{coordinatesystem} - -\begin{coordinatesystem}{tpp} - The |tpp| coordinate system is an alias for the |three point perspective| - coordinate system. -\end{coordinatesystem} - -\subsection{Setting the view} - -\begin{key}{/tikz/3d view=\marg{azimuth}\marg{elevation} - (default \{-30\}\{15\})} - With the |3d view| option, the projection of the 3D coordinates on the 2D page - is defined. It is determined by rotating the coordinate system by - $-\meta{azimuth}$ around the $z$-axis, and by \meta{elevation} around the - (new) $x$-axis, as shown below. - - \begin{tikzpicture}[ - viewpoint/.pic={ - \draw (22.5:0.45) -- (0,0) -- (-22.5:0.45); - \draw (0,0) ++ (22.5:0.35) arc (22.5:-22.5:0.35); - \draw (0.225,0) circle (0.02 and 0.09); - }] - \begin{scope}[3d view={-20}{20}] - \draw[->] (-3,0,0) -- (3,0,0) node[pos=1.05]{x}; - \draw[->] (0,-3,0) -- (0,3,0) node[pos=1.05]{y}; - \draw[->] (0,0,-1) -- (0,0,3) node[pos=1.05]{z}; - - \pgfmathsetmacro\az{50} - \begin{scope}[canvas is xy plane at z=0] - \draw[->] (0,0) ++(0,-2) arc (-90:-90+\az:2) coordinate[pos=0.5](az); - \draw (az) -- ++(-90+\az/2:1) node[below]{\meta{azimuth}}; - \draw[dashed] (0,0) -- ++(-90+\az:3); - \end{scope} - \begin{scope}[rotate around z=\az] - \pgfmathsetmacro\el{50} - \begin{scope}[canvas is yz plane at x=0] - \draw[->] (0,0) ++(-2.5,0) arc (180:180-\el:2.5) - coordinate[pos=0.5](el); - \draw (el) -- ++(180-\el/2:1) node[above]{\meta{elevation}}; - \draw[dashed] (0,0) -- - pic[solid,sloped,transform shape,pos=1.2]{viewpoint} ++(180-\el:3); - \end{scope} - \end{scope} - \end{scope} - \end{tikzpicture} - - For example, when both \meta{azimuth} and \meta{elevation} are 0$^\circ$, - $+z$ will be pointing upward, and $+x$ will be pointing right. The default is - as shown below. -\begin{codeexample}[] -\begin{tikzpicture}[3d view] - \draw[->] (-1,0,0) -- (1,0,0) node[pos=1.1]{x}; - \draw[->] (0,-1,0) -- (0,1,0) node[pos=1.1]{y}; - \draw[->] (0,0,-1) -- (0,0,1) node[pos=1.1]{z}; -\end{tikzpicture} -\end{codeexample} -\end{key} - -\begin{stylekey}{/tikz/isometric view} - A special kind of |3d view| is isometric, which can be set with the - |isometric view| style. It simply sets |3d view={-45}{35.26}|. The value for - \meta{elevation} is determined with $\arctan(1/\sqrt{2})$. In isometric - projection the angle between any pair of axes is 120$^\circ$, as shown below. -\begin{codeexample}[] -\begin{tikzpicture}[isometric view] - \draw[->] (-1,0,0) -- (1,0,0) node[pos=1.1]{x}; - \draw[->] (0,-1,0) -- (0,1,0) node[pos=1.1]{y}; - \draw[->] (0,0,-1) -- (0,0,1) node[pos=1.1]{z}; -\end{tikzpicture} -\end{codeexample} -\end{stylekey} - -\subsection{Defining the perspective} - -\newcommand\simplecuboid[3]{% - \fill[gray!80!white] (tpp cs:x=0,y=0,z=#3) - -- (tpp cs:x=0,y=#2,z=#3) - -- (tpp cs:x=#1,y=#2,z=#3) - -- (tpp cs:x=#1,y=0,z=#3) -- cycle; - \fill[gray] (tpp cs:x=0,y=0,z=0) - -- (tpp cs:x=0,y=0,z=#3) - -- (tpp cs:x=0,y=#2,z=#3) - -- (tpp cs:x=0,y=#2,z=0) -- cycle; - \fill[gray!50!white] (tpp cs:x=0,y=0,z=0) - -- (tpp cs:x=0,y=0,z=#3) - -- (tpp cs:x=#1,y=0,z=#3) - -- (tpp cs:x=#1,y=0,z=0) -- cycle;} - -\newcommand{\simpleaxes}[3]{% - \draw[->] (-0.5,0,0) -- (#1,0,0) node[pos=1.1]{x}; - \draw[->] (0,-0.5,0) -- (0,#2,0) node[pos=1.1]{y}; - \draw[->] (0,0,-0.5) -- (0,0,#3) node[pos=1.1]{z};} - -In this section, the following example cuboid will be used with various scaling. -As a reference, the axes will be shown too, without perspective projection. -\begingroup -\let\simplecuboid\relax -\let\simpleaxes\relax -\begin{codeexample}[] -\newcommand\simplecuboid[3]{% - \fill[gray!80!white] (tpp cs:x=0,y=0,z=#3) - -- (tpp cs:x=0,y=#2,z=#3) - -- (tpp cs:x=#1,y=#2,z=#3) - -- (tpp cs:x=#1,y=0,z=#3) -- cycle; - \fill[gray] (tpp cs:x=0,y=0,z=0) - -- (tpp cs:x=0,y=0,z=#3) - -- (tpp cs:x=0,y=#2,z=#3) - -- (tpp cs:x=0,y=#2,z=0) -- cycle; - \fill[gray!50!white] (tpp cs:x=0,y=0,z=0) - -- (tpp cs:x=0,y=0,z=#3) - -- (tpp cs:x=#1,y=0,z=#3) - -- (tpp cs:x=#1,y=0,z=0) -- cycle;} -\newcommand{\simpleaxes}[3]{% - \draw[->] (-0.5,0,0) -- (#1,0,0) node[pos=1.1]{x}; - \draw[->] (0,-0.5,0) -- (0,#2,0) node[pos=1.1]{y}; - \draw[->] (0,0,-0.5) -- (0,0,#3) node[pos=1.1]{z};} - -\begin{tikzpicture}[3d view] - \simplecuboid{2}{2}{2} - \simpleaxes{2}{2}{2} -\end{tikzpicture} -\end{codeexample} -\endgroup - -\begin{key}{/tikz/perspective=\meta{vanishing points} - (default p=\{(10,0,0)\},q=\{(0,10,0)\},r=\{(0,0,20)\})} - The `strength' of the perspective can be determined by setting the location of - the vanishing points. The default values have a stronger perspective towards - $x$ and $y$ than towards $z$, as shown below. -\begin{codeexample}[] -\begin{tikzpicture}[3d view,perspective] - \simplecuboid{2}{2}{2} - \simpleaxes{2}{2}{2} -\end{tikzpicture} -\end{codeexample} - From this example it also shows that the maximum dimensions of the cuboid are - no longer 2 by 2 by 2. This is inherent to the perspective projection. - % - \begin{key}{/tikz/perspective/p=\marg{x,y,z} (initially (0,0,0))} - The location of the vanishing point that determines the `strength' of the - perspective in $x$-direction can be set with the |p| key. -\begin{codeexample}[] -\begin{tikzpicture}[ - 3d view, - perspective={ - p = {(5,0,0)}}] - \simplecuboid{2}{2}{2} - \simpleaxes{2}{2}{2} -\end{tikzpicture} -\end{codeexample} - Note also that when only |p| is provided, the perspective in $y$ and $z$ - direction is turned off. - - To turn of the perspective in $x$-direction, one must set the $x$ component - of |p| to \texttt{0} (e.g. |p={(0,a,b)}|, where \texttt{a} and \texttt{b} - can be any number and will be ignored). Or one can provide |q| and |r| and - omit |p|. - - By changing the $y$ and $z$ components of |p|, one can achieve various - effects. -\begin{codeexample}[] -\begin{tikzpicture}[ - 3d view, - perspective={ - p = {(5,0,1)}}] - \simplecuboid{2}{2}{2} - \simpleaxes{2}{2}{2} -\end{tikzpicture} -\end{codeexample} -\begin{codeexample}[] -\begin{tikzpicture}[ - 3d view, - perspective={ - p = {(5,1,0)}}] - \simplecuboid{2}{2}{2} - \simpleaxes{2}{2}{2} -\end{tikzpicture} -\end{codeexample} -\begin{codeexample}[] -\begin{tikzpicture}[ - 3d view, - perspective={ - p = {(5,1,1)}}] - \simplecuboid{2}{2}{2} - \simpleaxes{2}{2}{2} -\end{tikzpicture} -\end{codeexample} - \end{key} - % - \begin{key}{/tikz/perspective/q=\marg{x,y,z} (initially (0,0,0))} - Similar to |p|, but can be turned off by setting its $y$ component to - \texttt{0}. -\begin{codeexample}[] -\begin{tikzpicture}[ - 3d view, - perspective={ - q = {(0,5,0)}}] - \simplecuboid{2}{2}{2} - \simpleaxes{2}{2}{2} -\end{tikzpicture} -\end{codeexample} - \end{key} - % - \begin{key}{/tikz/perspective/r=\marg{x,y,z} (initially (0,0,0))} - Similar to |p|, but can be turned off by setting its $z$ component to - \texttt{0}. -\begin{codeexample}[] -\begin{tikzpicture}[ - 3d view, - perspective={ - r = {(0,0,5)}}] - \simplecuboid{2}{2}{2} - \simpleaxes{2}{2}{2} -\end{tikzpicture} -\end{codeexample} - \end{key} -\end{key} - -\subsection{Shortcomings} - Currently a number of things are not working, mostly due to the fact that PGF - uses a 2D coordinate system underwater, and perspective projection is a - non-linear affine transformation which needs to be aware of all three - coordinates. These three coordinates are currently lost when processing a 3D - coordinate. - The issues include, but possibly are not limited to: - \begin{itemize} - \item Keys like |shift|, |xshift|, |yshift| are not working - \item Keys like |rotate around x|, |rotate around y|, and |rotate around z| - are not working - \item Units are not working - \item Most keys from the |3d| library are unsupported, e.g. all the - |canvas is .. plane| keys. - \end{itemize} - -\subsection{Examples} -An |r| that lies `below' your drawing can mimic a macro effect. -\nopagebreak -\begin{codeexample}[] -\begin{tikzpicture}[ - isometric view, - perspective={ - p = {(8,0,0)}, - q = {(0,8,0)}, - r = {(0,0,-8)}}] - - \simplecuboid{2}{2}{2}] - -\end{tikzpicture} -\end{codeexample} - -A peculiar phenomenon inherent to perspective drawing, is that however great -your coordinate will become in the direction of the vanishing point, it will -never reach it. -\nopagebreak -\begin{codeexample}[] -\begin{tikzpicture}[ - isometric view, - perspective={ - p = {(4,0,0)}, - q = {(0,4,0)}}] - - \node[fill=red,circle,inner sep=1.5pt,label=above:p] at (4,0,0){}; - - \foreach \i in {0,...,100}{ - \filldraw[fill = gray] (tpp cs:x=\i,y=0,z=0) - -- (tpp cs:x=\i+0.5,y=0,z=0) - -- (tpp cs:x=\i+0.5,y=2,z=0) - -- (tpp cs:x=\i,y=2,z=0) - -- cycle;} -\end{tikzpicture} -\end{codeexample} - -Even for simple examples, the added perspective might add another `dimension' to -your drawing. In this case, two vanishing points give a more intuitive result -then three would. -\nopagebreak -\begin{codeexample}[] -\begin{tikzpicture}[ - scale=0.7, - 3d view, - perspective={ - p = {(20,0,0)}, - q = {(0,20,0)}}] - - \filldraw[fill=brown] (tpp cs:x=0,y=0,z=0) - -- (tpp cs:x=0,y=4,z=0) - -- (tpp cs:x=0,y=4,z=2) - -- (tpp cs:x=0,y=2,z=4) - -- (tpp cs:x=0,y=0,z=2) -- cycle; - \filldraw[fill=red!70!black] (tpp cs:x=0,y=0,z=2) - -- (tpp cs:x=5,y=0,z=2) - -- (tpp cs:x=5,y=2,z=4) - -- (tpp cs:x=0,y=2,z=4) -- cycle; - \filldraw[fill=brown!80!white] (tpp cs:x=0,y=0,z=0) - -- (tpp cs:x=0,y=0,z=2) - -- (tpp cs:x=5,y=0,z=2) - -- (tpp cs:x=5,y=0,z=0) -- cycle; -\end{tikzpicture} -\end{codeexample} - -With the vanishing points nearby, the distortion of parallel lines becomes very -strong. This might lead to \texttt{Dimension too large} errors. -\nopagebreak -\begin{codeexample}[] -\begin{tikzpicture}[ - 3d view, - perspective={ - p = {(2,0,0)}, - q = {(0,2,0)}, - r = {(0,0,2)}}, - scale=4, - vanishing point/.style={fill,circle,inner sep=2pt}] - - \simplecuboid{3}{1}{2} - - \node[vanishing point,label = right:p] (p) at (2,0,0){}; - \node[vanishing point,label = left:q] (q) at (0,2,0){}; - \node[vanishing point,label = above:r] (r) at (0,0,2){}; - - \begin{scope}[dotted] - \foreach \y in {0,1}{ - \foreach \z in {0,2}{ - \draw (tpp cs:x=0,y=\y,z=\z) -- (p.center);}} - \foreach \x in {0,3}{ - \foreach \z in {0,2}{ - \draw (tpp cs:x=\x,y=0,z=\z) -- (q.center);}} - \foreach \x in {0,3}{ - \foreach \y in {0,1}{ - \draw (tpp cs:x=\x,y=\y,z=0) -- (r.center);}} - \end{scope} -\end{tikzpicture} -\end{codeexample} - -% A more complex example. -\iffalse -Of course these examples can become as complex as desired, but as with any 3D -drawing using \tikzname, the order of drawing commands is important and can -become increasingly more complex. -\nopagebreak -\begin{codeexample}[] -\begin{tikzpicture}[ - cycle of vertices/.style 2 args={ - insert path={ - foreach \i [count=\j,evaluate=\j as \k using - {ifthenelse(\j==1,"","-- "}] in {#2}{\k (vert-#1-\i)} -- cycle}}, - scale=0.7, - line join=round, - bottom/.style={draw=white!50!black,fill=white!40!black}, - front/.style={draw=white!50!black,fill=black}, - side/.style={draw=white!50!black,fill=white!80!black}, -] - \begin{scope}[ - 3d view={-20}{0}, - perspective={ - p = {(20,0,0)}, - q = {(0,20,0)}, - r = {(5,1,50)}, - }] - \path foreach \x/\y/\z [count=\i] in { - 3.5/2.0/0.0,3.5/2.0/4.0,6.0/2.0/4.0,6.5/2.0/3.5,6.5/2.0/0.5,6.0/2.0/0.0, - 4.5/2.0/1.0,4.5/2.0/3.0,5.5/2.0/3.0,5.5/2.0/1.0,3.5/0.0/0.0,3.5/0.0/4.0, - 6.0/0.0/4.0,6.5/0.0/3.5,6.5/0.0/0.5,6.0/0.0/0.0,4.5/0.0/1.0,4.5/0.0/3.0, - 5.5/0.0/3.0,5.5/0.0/1.0% - }{(tpp cs:x=\x,y=\y,z=\z) coordinate[name=vert-D-\i]}; - \filldraw[front,cycle of vertices={D}{1,...,6}, - cycle of vertices={D}{7,10,9,8}]; - \filldraw[side,cycle of vertices={D}{10,9,19,20}]; - \filldraw[bottom,cycle of vertices={D}{8,9,19,18}]; - \filldraw[front,cycle of vertices={D}{11,...,16}, - cycle of vertices={D}{17,20,19,18}]; - \filldraw[side,cycle of vertices={D}{1,2,12,11}]; - % '3' - \path foreach \x/\y/\z [count=\i] in { - 0.0/2.0/0.0,0.0/2.0/1.0,2.0/2.0/1.0,2.0/2.0/1.5,0.0/2.0/1.5,0.0/2.0/2.5, - 2.0/2.0/2.5,2.0/2.0/3.0,0.0/2.0/3.0,0.0/2.0/4.0,3.0/2.0/4.0,3.0/2.0/0.0, - 0.0/0.0/0.0,0.0/0.0/1.0,2.0/0.0/1.0,2.0/0.0/1.5,0.0/0.0/1.5,0.0/0.0/2.5, - 2.0/0.0/2.5,2.0/0.0/3.0,0.0/0.0/3.0,0.0/0.0/4.0,3.0/0.0/4.0,3.0/0.0/0.0% - }{(tpp cs:x=\x,y=\y,z=\z) coordinate[name=vert-3-\i]}; - \filldraw[front,cycle of vertices={3}{1,...,12}]; - \filldraw[side,cycle of vertices={3}{3,4,16,15}]; - \filldraw[side,cycle of vertices={3}{7,8,20,19}]; - \filldraw[side,cycle of vertices={3}{1,2,14,13}]; - \filldraw[side,cycle of vertices={3}{5,6,18,17}]; - \filldraw[side,cycle of vertices={3}{9,10,22,21}]; - \filldraw[bottom,cycle of vertices={3}{4,5,17,16}]; - \filldraw[bottom,cycle of vertices={3}{8,9,21,20}]; - \filldraw[front,cycle of vertices={3}{13,...,24}]; - \end{scope} -\end{tikzpicture} -\end{codeexample} -\fi
\ No newline at end of file diff --git a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-main-body.tex b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-main-body.tex index 15a678e7270..78b72d5ab8c 100644 --- a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-main-body.tex +++ b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-main-body.tex @@ -50,7 +50,6 @@ \foreach \where in {-9cm,9cm} {\nodeshadowed [at={(\where,5cm)}] { - % TODO: Nesting tikzpictures is NOT supported \tikz \draw [green!20!black, rotate=90] [l-system={rule set={F -> FF-[-F+F]+[+F-F]}, axiom=F, order=4, step=2pt, randomize step percent=50, angle=30, randomize angle percent=5}] @@ -221,7 +220,7 @@ \title{\bfseries The \tikzname\ and {\Large PGF} Packages\\ \large Manual for version \pgfversion\\[1mm] -\large\href{https://github.com/pgf-tikz/pgf}{\texttt{https://github.com/pgf-tikz/pgf}}} +\large\href{https://sourceforge.net/projects/pgf}{\texttt{https://sourceforge.net/projects/pgf}}} \author{Till Tantau\footnote{Editor of this documentation. Parts of this documentation have been written by other authors as indicated in these parts or chapters and in Section~\ref{section-authors}.}\\ @@ -537,7 +536,6 @@ libraries are not loaded by default since many users will not need them. \include{pgfmanual-en-library-mindmaps} \include{pgfmanual-en-library-folding} \include{pgfmanual-en-library-patterns} -\include{pgfmanual-en-library-perspective} \include{pgfmanual-en-library-petri} \include{pgfmanual-en-library-plot-handlers} \include{pgfmanual-en-library-plot-marks} diff --git a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-main-preamble.tex b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-main-preamble.tex index d35c0e89abd..5515cc8b7ed 100644 --- a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-main-preamble.tex +++ b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-main-preamble.tex @@ -94,7 +94,6 @@ views, animations, rdf, - perspective, } \usepackage{ifluatex} diff --git a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-pgffor.tex b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-pgffor.tex index 8ae0628b367..a8ddbd9194a 100644 --- a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-pgffor.tex +++ b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-pgffor.tex @@ -359,19 +359,6 @@ This section describes the package |pgffor|, which is loaded automatically by \end{codeexample} % \end{key} - - \begin{key}{/pgf/foreach/parse=\marg{boolean} (default false)} - If this key is set to true the upper bound in the loop will be - fed into |\pgfmathparse|. This allows to use complex expressions as - the upper bound. However, the expression must be safe for evaluation - in |\pgfmathparse|. It is known that internal \TeX\ registers can - cause trouble. - % -\begin{codeexample}[] -\foreach \x [parse=true] in {1,...,1.0e+1 - 1}{ \x } -\end{codeexample} - % - \end{key} \end{command} \begin{command}{\breakforeach} diff --git a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tikz-coordinates.tex b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tikz-coordinates.tex index c3921486e6d..8ffafad7f54 100644 --- a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tikz-coordinates.tex +++ b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tikz-coordinates.tex @@ -1046,7 +1046,7 @@ which you need. whatever value it had at the beginning of the scope. More precisely, when \tikzname\ encounters |}| on a path, it checks whether at this particular moment the key is set to |true|. If so, the current position reverts to the - value it had when the matching |{| was read. + value is had when the matching |{| was read. % \begin{codeexample}[] \begin{tikzpicture} diff --git a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tikz-decorations.tex b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tikz-decorations.tex index 009660a911d..1600e6f5378 100644 --- a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tikz-decorations.tex +++ b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tikz-decorations.tex @@ -474,20 +474,25 @@ decorations, not with meta-decorations. which |0pt| by default. Thus, for the |pre| option to have any effect, you also need to set the |pre length| option. % - % TODO: Nesting tikzpictures is NOT supported \begin{codeexample}[] +\begin{tikzpicture} \tikz [decoration={zigzag,pre=lineto,pre length=1cm}] \draw [decorate] (0,0) -- (2,1) arc (90:0:1); +\end{tikzpicture} \end{codeexample} % \begin{codeexample}[] +\begin{tikzpicture} \tikz [decoration={zigzag,pre=moveto,pre length=1cm}] \draw [decorate] (0,0) -- (2,1) arc (90:0:1); +\end{tikzpicture} \end{codeexample} % \begin{codeexample}[] +\begin{tikzpicture} \tikz [decoration={zigzag,pre=crosses,pre length=1cm}] \draw [decorate] (0,0) -- (2,1) arc (90:0:1); +\end{tikzpicture} \end{codeexample} Note that the default |pre| option is |lineto|, not |curveto|. This means @@ -495,13 +500,17 @@ decorations, not with meta-decorations. reasons). Change the |pre| key to |curveto| if you have a curved path. % \begin{codeexample}[] +\begin{tikzpicture} \tikz [decoration={zigzag,pre length=3cm}] \draw [decorate] (0,0) -- (2,1) arc (90:0:1); +\end{tikzpicture} \end{codeexample} % \begin{codeexample}[] +\begin{tikzpicture} \tikz [decoration={zigzag,pre=curveto,pre length=3cm}] \draw [decorate] (0,0) -- (2,1) arc (90:0:1); +\end{tikzpicture} \end{codeexample} % \end{key} diff --git a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tutorial-Euclid.tex b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tutorial-Euclid.tex index ace6c5d8827..c35deca1f82 100644 --- a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tutorial-Euclid.tex +++ b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tutorial-Euclid.tex @@ -488,7 +488,7 @@ The second proposition in the Elements is the following: Produce the straight lines \A\E\ and \B\F\ in a straight line with \D\A\ and \D\B. Describe the circle \C\G\H\ with center \B\ and radius \B\C, and again, describe the circle \G\K\L\ with center - \D\ and radius \D\G. + \D\ and radius \D\G. Since the point \B\ is the center of the circle \C\G\H, therefore \B\C\ equals \B\G. Again, since the point \D\ is the center of the diff --git a/Master/texmf-dist/doc/generic/pgf/version-for-dvisvgm/en/Makefile b/Master/texmf-dist/doc/generic/pgf/version-for-dvisvgm/en/Makefile index 57bf75e8b38..d598bdc8348 100644 --- a/Master/texmf-dist/doc/generic/pgf/version-for-dvisvgm/en/Makefile +++ b/Master/texmf-dist/doc/generic/pgf/version-for-dvisvgm/en/Makefile @@ -17,7 +17,7 @@ pgfmanual.ind: pgfmanual.idx pgfmanual.svg: $(doc).tex $(doc).ind revisionfile TEXINPUTS="$(TEXINPUTS)" $(latex) $(doc).tex - dvisvgm --font-format=woff --no-merge --output=%f-%4p.svg --page=1- --bbox=a4 --linkmark=none $(doc) + dvisvgm --no-merge --output=%f-%4p.svg --page=1- --bbox=a4 --linkmark=none $(doc) pgfmanual-no-font.svg: $(doc).tex $(doc).ind revisionfile TEXINPUTS="$(TEXINPUTS)" $(latex) $(doc).tex diff --git a/Master/texmf-dist/doc/generic/pgf/version-for-dvisvgm/pgfmanual-dvisvgm.cfg b/Master/texmf-dist/doc/generic/pgf/version-for-dvisvgm/pgfmanual-dvisvgm.cfg index e07ee9cdd19..e6e29e1fda5 100644 --- a/Master/texmf-dist/doc/generic/pgf/version-for-dvisvgm/pgfmanual-dvisvgm.cfg +++ b/Master/texmf-dist/doc/generic/pgf/version-for-dvisvgm/pgfmanual-dvisvgm.cfg @@ -11,12 +11,7 @@ \usepackage[hypertex]{hyperref} \makeatletter -\g@addto@macro\selectfont{% - \long\edef\longf@family{\f@family}% - \ifx\longf@family\ttdefault - \ignoreligaturesinfont\font\relax - \fi -} +\expandafter\g@addto@macro\csname ttfamily \endcsname{\ignoreligaturesinfont\font\relax} \makeatother \usepackage{graphicx,xcolor} diff --git a/Master/texmf-dist/doc/generic/pgf/version-for-luatex/pgfmanual-luatex.cfg b/Master/texmf-dist/doc/generic/pgf/version-for-luatex/pgfmanual-luatex.cfg index 1523589539d..7b57d3ed418 100644 --- a/Master/texmf-dist/doc/generic/pgf/version-for-luatex/pgfmanual-luatex.cfg +++ b/Master/texmf-dist/doc/generic/pgf/version-for-luatex/pgfmanual-luatex.cfg @@ -11,12 +11,7 @@ \usepackage[hyphens]{url} \usepackage[pdfborder={0 0 0}]{hyperref} \makeatletter -\g@addto@macro\selectfont{% - \long\edef\longf@family{\f@family}% - \ifx\longf@family\ttdefault - \ignoreligaturesinfont\font\relax - \fi -} +\expandafter\g@addto@macro\csname ttfamily \endcsname{\ignoreligaturesinfont\font\relax} \makeatother % Just make sure to compile this using lualatex. diff --git a/Master/texmf-dist/doc/generic/pgf/version-for-pdftex/pgfmanual-pdftex.cfg b/Master/texmf-dist/doc/generic/pgf/version-for-pdftex/pgfmanual-pdftex.cfg index 4aa0520888d..bea9f8d862f 100644 --- a/Master/texmf-dist/doc/generic/pgf/version-for-pdftex/pgfmanual-pdftex.cfg +++ b/Master/texmf-dist/doc/generic/pgf/version-for-pdftex/pgfmanual-pdftex.cfg @@ -11,12 +11,7 @@ \usepackage[hyphens]{url} \usepackage[pdfborder={0 0 0}]{hyperref} \makeatletter -\g@addto@macro\selectfont{% - \long\edef\longf@family{\f@family}% - \ifx\longf@family\ttdefault - \pdfnoligatures\font\relax - \fi -} +\expandafter\g@addto@macro\csname ttfamily \endcsname{\pdfnoligatures\font\relax} \makeatother % Just make sure to compile this using pdfelatex. diff --git a/Master/texmf-dist/source/generic/pgf/testsuite/external/tikzexternaltest.code.tex b/Master/texmf-dist/source/generic/pgf/testsuite/external/tikzexternaltest.code.tex index 153a074255a..8a200fcf991 100644 --- a/Master/texmf-dist/source/generic/pgf/testsuite/external/tikzexternaltest.code.tex +++ b/Master/texmf-dist/source/generic/pgf/testsuite/external/tikzexternaltest.code.tex @@ -4,23 +4,23 @@ A small image with a filled circle follows here (with baseline): \tikz[baseline] \fill[red] (0,1cm) circle(2pt); \tikzsetnextfilename{\tikzexternalrealjob-setnextfilename} -The next one uses +The next one uses \begin{tikzpicture}[baseline] - \draw (0,0) grid (4,4); + \draw (0,0) grid (4,4); \end{tikzpicture} an explizit file name. \begin{tikzpicture} - \node[draw,rounded corners] {A node with a ref (\ref{eq:1})}; + \node[draw,rounded corners] {A node with a ref (\ref{eq:1})}; \end{tikzpicture} \begin{equation} - 1+1=3 - \label{eq:1} + 1+1=3 + \label{eq:1} \end{equation} \begin{tikzpicture} - \node[draw,rounded corners] {A node which contains a label\label{a:label:in:a:picture}}; + \node[draw,rounded corners] {A node which contains a label\label{a:label:in:a:picture}}; \end{tikzpicture} The label inside of a node is on page~\pageref{a:label:in:a:picture}. @@ -29,12 +29,12 @@ The label inside of a node is on page~\pageref{a:label:in:a:picture}. \else The following picture exports a legend to the aux file (if possible). \begin{tikzpicture} - \begin{axis}[legend entries={1,2,3,4},legend to name=legend:name] - \addplot {x}; - \addplot {x+1}; - \addplot {x+2}; - \addplot {x+3}; - \end{axis} + \begin{axis}[legend entries={1,2,3,4},legend to name=legend:name] + \addplot {x}; + \addplot {x+1}; + \addplot {x+2}; + \addplot {x+3}; + \end{axis} \end{tikzpicture} Here is the legend: \pgfplotslegendfromname{legend:name}. diff --git a/Master/texmf-dist/source/generic/pgf/testsuite/external/tikzexternaltest.sharedpreamble.tex b/Master/texmf-dist/source/generic/pgf/testsuite/external/tikzexternaltest.sharedpreamble.tex index d2577b01b13..87e94f899eb 100644 --- a/Master/texmf-dist/source/generic/pgf/testsuite/external/tikzexternaltest.sharedpreamble.tex +++ b/Master/texmf-dist/source/generic/pgf/testsuite/external/tikzexternaltest.sharedpreamble.tex @@ -5,16 +5,16 @@ \usepackage{hyperref} \IfFileExists{pgfplots.sty}{% - \usepackage{pgfplots} + \usepackage{pgfplots} }{}% \IfFileExists{tikzlibraryexternal.code.tex}{% - \usetikzlibrary{external} + \usetikzlibrary{external} }{% - \message{TEST IS RUNNING IN COMPATIBILITY MODE}% - % a test to check for pgf 2.00 compatibility, to check whether the - % external library copy shipped with pgfplots works: - \usepgfplotslibrary{external} + \message{TEST IS RUNNING IN COMPATIBILITY MODE}% + % a test to check for pgf 2.00 compatibility, to check whether the + % external library copy shipped with pgfplots works: + \usepgfplotslibrary{external} }% \pgfkeys{/pgf/images/include external/.code={\href{file:#1}{\pgfimage{#1}}}} diff --git a/Master/texmf-dist/source/generic/pgf/testsuite/mathtest/pgfmathtestsuite.tex b/Master/texmf-dist/source/generic/pgf/testsuite/mathtest/pgfmathtestsuite.tex index 6baf5ddba49..ecae8941fe1 100644 --- a/Master/texmf-dist/source/generic/pgf/testsuite/mathtest/pgfmathtestsuite.tex +++ b/Master/texmf-dist/source/generic/pgf/testsuite/mathtest/pgfmathtestsuite.tex @@ -1,5 +1,5 @@ -% FIXME: this class is MESSY. -% +% FIXME: this class is MESSY. +% % rewrite with proper assertions ... it goes back to a time where I % merely wanted to inspect the results! % @@ -13,20 +13,20 @@ \usepackage{ifpdf} \ifpdf - \usepackage{hyperref} + \usepackage{hyperref} \else - \def\pgfsysdriver{pgfsys-dvipdfm.def} - \usepackage[dvipdfm]{hyperref} + \def\pgfsysdriver{pgfsys-dvipdfm.def} + \usepackage[dvipdfm]{hyperref} \fi \usepackage{tikz} \usepackage{fp} \makeatletter \pgfutil@ifundefined{pgfmathdeclarefunction}{ - % load pgfplots with its pgf 2.00 compatibility code: - \usepackage{pgfplots} + % load pgfplots with its pgf 2.00 compatibility code: + \usepackage{pgfplots} }{ - \usepgflibrary{fpu} + \usepgflibrary{fpu} } \makeatother @@ -46,93 +46,93 @@ \def\compare#1#2{% - \begingroup - \message{COMPUTING LOG(#1)}% - \pgfmathlog{#1}% - \let\actual=\pgfmathresult - \def\expected{#2}% - \pgfmathsubtract\actual\expected% - \let\abserr=\pgfmathresult - \pgfmathdivide\abserr\expected - \let\relerr=\pgfmathresult - \noindent - log(#1)\hfill= - \expected;\hfill% - actual=\actual;\hfill% - abserr=\abserr;\hfill% - relerr=\relerr;\hfill% - \endgroup - \par + \begingroup + \message{COMPUTING LOG(#1)}% + \pgfmathlog{#1}% + \let\actual=\pgfmathresult + \def\expected{#2}% + \pgfmathsubtract\actual\expected% + \let\abserr=\pgfmathresult + \pgfmathdivide\abserr\expected + \let\relerr=\pgfmathresult + \noindent + log(#1)\hfill= + \expected;\hfill% + actual=\actual;\hfill% + abserr=\abserr;\hfill% + relerr=\relerr;\hfill% + \endgroup + \par }% %-------------------------------------------------- % \def\showlowlevelfloat#1#2e#3\relax{% -% \ensuremath{[#1] \cdot #2 \cdot 10^{#3}}% +% \ensuremath{[#1] \cdot #2 \cdot 10^{#3}}% % }% -%-------------------------------------------------- +%-------------------------------------------------- \long\def\showlowlevelfloatmacro#1{#1} \long\def\showlowlevelfloatmacrolong#1{% - #1 is decomposed into - - {% - \gdef\testerror{}% - \pgfmathfloattoregisters{#1}{\count0 }{\dimen0 }{\count1 }% - pgfmathfloattoregisters: flags \the\count0; M=\the\dimen0; E=\the\count1 - \ifx\testerror\empty - \else - \par (caught \texttt{\testerror})% - \fi - }% - - {% - \gdef\testerror{}% - pgfmathfloattoregisterstok: \pgfmathfloattoregisterstok{#1}{\count0 }{\toks0 }{\count1 }% - flags \the\count0; M=\the\toks0; E=\the\count1 - \ifx\testerror\empty - \else - \par (caught \texttt{\testerror})% - \fi - }% - - {% - \gdef\testerror{}% - pgfmathfloatgetflags \pgfmathfloatgetflags{#1}{\count0 } - flags \the\count0; - \ifx\testerror\empty - \else - \par (caught \texttt{\testerror})% - \fi - }% - - \medskip - %\expandafter\showlowlevelfloat#1\relax + #1 is decomposed into + + {% + \gdef\testerror{}% + \pgfmathfloattoregisters{#1}{\count0 }{\dimen0 }{\count1 }% + pgfmathfloattoregisters: flags \the\count0; M=\the\dimen0; E=\the\count1 + \ifx\testerror\empty + \else + \par (caught \texttt{\testerror})% + \fi + }% + + {% + \gdef\testerror{}% + pgfmathfloattoregisterstok: \pgfmathfloattoregisterstok{#1}{\count0 }{\toks0 }{\count1 }% + flags \the\count0; M=\the\toks0; E=\the\count1 + \ifx\testerror\empty + \else + \par (caught \texttt{\testerror})% + \fi + }% + + {% + \gdef\testerror{}% + pgfmathfloatgetflags \pgfmathfloatgetflags{#1}{\count0 } + flags \the\count0; + \ifx\testerror\empty + \else + \par (caught \texttt{\testerror})% + \fi + }% + + \medskip + %\expandafter\showlowlevelfloat#1\relax }% \def\showsinglenumberparsing#1{% %\tracingmacros=2\tracingcommands=2 - \begingroup - \message{PARSING NUMBER #1...}% - \gdef\testerror{}% - \pgfmathfloatparsenumber{#1}% - \let\resultasfloat=\pgfmathresult - \pgfmathfloattofixed\resultasfloat - \let\resultasfixed=\pgfmathresult - \[ #1 \mapsto \resultasfloat = \showlowlevelfloatmacro\resultasfloat \mapsto \resultasfixed - \] - \ifx\testerror\empty - \else - \par (caught \texttt{\testerror})% - \fi - \endgroup + \begingroup + \message{PARSING NUMBER #1...}% + \gdef\testerror{}% + \pgfmathfloatparsenumber{#1}% + \let\resultasfloat=\pgfmathresult + \pgfmathfloattofixed\resultasfloat + \let\resultasfixed=\pgfmathresult + \[ #1 \mapsto \resultasfloat = \showlowlevelfloatmacro\resultasfloat \mapsto \resultasfixed + \] + \ifx\testerror\empty + \else + \par (caught \texttt{\testerror})% + \fi + \endgroup %\tracingmacros=0\tracingcommands=0 } \def\pretty#1{% - \message{Pretty-printing #1...}% - \pgfmathprintnumberto{#1}\result - {\pgfkeys{/pgf/number format/showpos}\pgfmathprintnumberto{#1}\resultpos\global\let\resultpos=\resultpos}% - \[ #1 \mapsto \pgfmathprintnumber{#1} [=\resultpos] \] - \message{#1 mapsto \meaning\result}% + \message{Pretty-printing #1...}% + \pgfmathprintnumberto{#1}\result + {\pgfkeys{/pgf/number format/showpos}\pgfmathprintnumberto{#1}\resultpos\global\let\resultpos=\resultpos}% + \[ #1 \mapsto \pgfmathprintnumber{#1} [=\resultpos] \] + \message{#1 mapsto \meaning\result}% } \begin{document} @@ -146,7 +146,7 @@ % \showit{4.0} % log(1200)=\pgfmathlog{1.2}\pgfmathadd{\pgfmathresult}{6.9077}\pgfmathresult\par % log(6.241e-7)=\pgfmathlog{6.241}\pgfmathadd{\pgfmathresult}{-16.11809}\pgfmathresult\par -%-------------------------------------------------- +%-------------------------------------------------- \testsection{Conversion to normalised floating point numbers basis 10} \showsinglenumberparsing{123.41251}% @@ -203,36 +203,36 @@ \testsubsection{Error handling} { - \pgfkeys{ - /pgf/fpu/handlers/empty number/.code 2 args={% - \gdef\testerror{handlers/empty number=\{#1\}\{#2\}}% - }, - /pgf/fpu/handlers/invalid number/.code 2 args={% - \gdef\testerror{handlers/invalid number=\{#1\}\{#2\}}% - }, - /pgf/fpu/handlers/wrong lowlevel format/.code 2 args={% - \gdef\testerror{handlers/wrong lowlevel format=\{#1\}\{#2\}}% - }, - } - \showsinglenumberparsing{-53e-5 not terminated} - %\showsinglenumberparsing{-53e-} - \showsinglenumberparsing{} - \showsinglenumberparsing{ ASDZ@414e12} - - This one has trailing spaces and should work: - \showsinglenumberparsing{10 } - - This one has leading spaces and should work: - \showsinglenumberparsing{ 10} - - \testsubsection{Error handling of decompose routines} - - \pgfmathfloatparsenumber{100} - \showlowlevelfloatmacrolong{\pgfmathresult} - - \showlowlevelfloatmacrolong{132} - - \showlowlevelfloatmacrolong{Z} + \pgfkeys{ + /pgf/fpu/handlers/empty number/.code 2 args={% + \gdef\testerror{handlers/empty number=\{#1\}\{#2\}}% + }, + /pgf/fpu/handlers/invalid number/.code 2 args={% + \gdef\testerror{handlers/invalid number=\{#1\}\{#2\}}% + }, + /pgf/fpu/handlers/wrong lowlevel format/.code 2 args={% + \gdef\testerror{handlers/wrong lowlevel format=\{#1\}\{#2\}}% + }, + } + \showsinglenumberparsing{-53e-5 not terminated} + %\showsinglenumberparsing{-53e-} + \showsinglenumberparsing{} + \showsinglenumberparsing{ ASDZ@414e12} + + This one has trailing spaces and should work: + \showsinglenumberparsing{10 } + + This one has leading spaces and should work: + \showsinglenumberparsing{ 10} + + \testsubsection{Error handling of decompose routines} + + \pgfmathfloatparsenumber{100} + \showlowlevelfloatmacrolong{\pgfmathresult} + + \showlowlevelfloatmacrolong{132} + + \showlowlevelfloatmacrolong{Z} } \testsection{logarithms, compared with PGF arithmetics} @@ -298,65 +298,65 @@ { \twocolumn \def\prettytest{% - \pretty{1} - \pretty{1.0} - \pretty{-1.02311} - \pretty{-11241.02311} - \pretty{-11241} - \pretty{8124.99999} - \pretty{8124.849999} - \pretty{8124.843333} - \pretty{8.82} - \pretty{8.5} - \pretty{9.} - \pretty{5.9} - \pretty{-0.00001} - \pretty{-1.00001} - \pretty{-0.559} - \pretty{-0.554} - \pretty{-0.00000141} - \pretty{1.234e10} - \pretty{123456781} - \pretty{1234} - \pretty{8} - \pretty{-9.995} - \pretty{-0.015} - \pretty{-0.1} - \pretty{-0.15} - \pretty{0.15} - \pretty{-0} - \pretty{0} - \pretty{9.00} - \pretty{200.01} - \pretty{200.0000} - \pretty{1.5e-7} - \pretty{0.00035} - \pretty{0.00005} - \pretty{nan} - \pretty{inf} - \pretty{-inf} - \pretty{10} - \pretty{100} - \pretty{200} - \pretty{500} - \pretty{1000} - \pretty{30000} - \pretty{600000} - \pretty{1000000} - \pretty{30000000} - \pretty{600000000} - \pretty{1000000000} - \pretty{-10} - \pretty{-100} - \pretty{-200} - \pretty{-500} - \pretty{-1000} - \pretty{-30000} - \pretty{-600000} - \pretty{-1000000} - \pretty{-30000000} - \pretty{-600000000} - \pretty{-1000000000} + \pretty{1} + \pretty{1.0} + \pretty{-1.02311} + \pretty{-11241.02311} + \pretty{-11241} + \pretty{8124.99999} + \pretty{8124.849999} + \pretty{8124.843333} + \pretty{8.82} + \pretty{8.5} + \pretty{9.} + \pretty{5.9} + \pretty{-0.00001} + \pretty{-1.00001} + \pretty{-0.559} + \pretty{-0.554} + \pretty{-0.00000141} + \pretty{1.234e10} + \pretty{123456781} + \pretty{1234} + \pretty{8} + \pretty{-9.995} + \pretty{-0.015} + \pretty{-0.1} + \pretty{-0.15} + \pretty{0.15} + \pretty{-0} + \pretty{0} + \pretty{9.00} + \pretty{200.01} + \pretty{200.0000} + \pretty{1.5e-7} + \pretty{0.00035} + \pretty{0.00005} + \pretty{nan} + \pretty{inf} + \pretty{-inf} + \pretty{10} + \pretty{100} + \pretty{200} + \pretty{500} + \pretty{1000} + \pretty{30000} + \pretty{600000} + \pretty{1000000} + \pretty{30000000} + \pretty{600000000} + \pretty{1000000000} + \pretty{-10} + \pretty{-100} + \pretty{-200} + \pretty{-500} + \pretty{-1000} + \pretty{-30000} + \pretty{-600000} + \pretty{-1000000} + \pretty{-30000000} + \pretty{-600000000} + \pretty{-1000000000} } \testsubsection{STD format} @@ -491,61 +491,61 @@ \testsection{Pretty printing using the relative style} { -\long\def\TESTIT#1#2{% - \gdef\temptable{\begin{tabular}}% - \gdef\header{l}% - \def\n{\noexpand\n}% - \foreach \number in {#2} {% - \xdef\header{\header c}% - }% - \toks0=\expandafter{\temptable}% - \xdef\temptable{\the\toks0 {\header}\n}% - % - \toks0=\expandafter{\temptable}% - \toks1={}% - \xdef\temptable{\the\toks0 \the\toks1}% - \foreach \number in {#2} {% - \toks0=\expandafter{\temptable}% - \toks1=\expandafter{\number}% - \xdef\temptable{\the\toks0 & \noexpand\texttt{\the\toks1}}% - }% - \toks0=\expandafter{\temptable}% - \xdef\temptable{\the\toks0 \noexpand\\\n}% - % - \toks0=\expandafter{\temptable}% - \toks1={With actual config:}% - \xdef\temptable{\the\toks0 \the\toks1}% - \foreach \number in {#2} {% - \toks0=\expandafter{\temptable}% - \toks1=\expandafter{\number}% - \xdef\temptable{\the\toks0 & \noexpand\pgfmathprintnumber{\the\toks1}}% - }% - \toks0=\expandafter{\temptable}% - \xdef\temptable{\the\toks0 \noexpand\\\n}% - % - \foreach \relativeto in {#1} {% - \toks0=\expandafter{\temptable}% - \xdef\temptable{\the\toks0 Relative to $10^{\relativeto}$:}% - \foreach \number in {#2} {% - \toks0=\expandafter{\temptable}% - \toks1=\expandafter{\number}% - \xdef\temptable{\the\toks0 & \noexpand\pgfmathprintnumber[relative={\relativeto}]{\the\toks1}}% - }% - \toks0=\expandafter{\temptable}% - \xdef\temptable{\the\toks0 \noexpand\\\n}% - }% - % - % - \toks0=\expandafter{\temptable}% - \toks1={\end{tabular}\n}% - \xdef\temptable{\the\toks0 \the\toks1}% - % - \def\n{^^J}% +\long\def\TESTIT#1#2{% + \gdef\temptable{\begin{tabular}}% + \gdef\header{l}% + \def\n{\noexpand\n}% + \foreach \number in {#2} {% + \xdef\header{\header c}% + }% + \toks0=\expandafter{\temptable}% + \xdef\temptable{\the\toks0 {\header}\n}% + % + \toks0=\expandafter{\temptable}% + \toks1={}% + \xdef\temptable{\the\toks0 \the\toks1}% + \foreach \number in {#2} {% + \toks0=\expandafter{\temptable}% + \toks1=\expandafter{\number}% + \xdef\temptable{\the\toks0 & \noexpand\texttt{\the\toks1}}% + }% + \toks0=\expandafter{\temptable}% + \xdef\temptable{\the\toks0 \noexpand\\\n}% + % + \toks0=\expandafter{\temptable}% + \toks1={With actual config:}% + \xdef\temptable{\the\toks0 \the\toks1}% + \foreach \number in {#2} {% + \toks0=\expandafter{\temptable}% + \toks1=\expandafter{\number}% + \xdef\temptable{\the\toks0 & \noexpand\pgfmathprintnumber{\the\toks1}}% + }% + \toks0=\expandafter{\temptable}% + \xdef\temptable{\the\toks0 \noexpand\\\n}% + % + \foreach \relativeto in {#1} {% + \toks0=\expandafter{\temptable}% + \xdef\temptable{\the\toks0 Relative to $10^{\relativeto}$:}% + \foreach \number in {#2} {% + \toks0=\expandafter{\temptable}% + \toks1=\expandafter{\number}% + \xdef\temptable{\the\toks0 & \noexpand\pgfmathprintnumber[relative={\relativeto}]{\the\toks1}}% + }% + \toks0=\expandafter{\temptable}% + \xdef\temptable{\the\toks0 \noexpand\\\n}% + }% + % + % + \toks0=\expandafter{\temptable}% + \toks1={\end{tabular}\n}% + \xdef\temptable{\the\toks0 \the\toks1}% + % + \def\n{^^J}% %\message{TEMP-TABLE: \n\meaning\temptable\n}% - % - \let\n=\relax - \noindent - \temptable + % + \let\n=\relax + \noindent + \temptable }% %\tracingmacros=2 \tracingcommands=2 @@ -574,20 +574,20 @@ \begingroup \testsection{testing pgfmathfloatadd} \def\testfloataddnonsymmetric#1#2{% - \pgfmathfloatparsenumber{#1}% - \let\first=\pgfmathresult - \pgfmathfloatparsenumber{#2}% - \let\second=\pgfmathresult - \message{computing #1 + #2; \first + \second}% - \pgfmathfloatadd\first\second - \let\result=\pgfmathresult - \pgfmathfloattofixed\result - \let\resultfixed=\pgfmathresult - \[ \text{pgfmathfloatadd: } \showlowlevelfloatmacro\first + \showlowlevelfloatmacro\second = \showlowlevelfloatmacro\result \; \bigl( #1 + #2 = \resultfixed \bigr). \] + \pgfmathfloatparsenumber{#1}% + \let\first=\pgfmathresult + \pgfmathfloatparsenumber{#2}% + \let\second=\pgfmathresult + \message{computing #1 + #2; \first + \second}% + \pgfmathfloatadd\first\second + \let\result=\pgfmathresult + \pgfmathfloattofixed\result + \let\resultfixed=\pgfmathresult + \[ \text{pgfmathfloatadd: } \showlowlevelfloatmacro\first + \showlowlevelfloatmacro\second = \showlowlevelfloatmacro\result \; \bigl( #1 + #2 = \resultfixed \bigr). \] }% \def\testfloatadd#1#2{% - \testfloataddnonsymmetric{#1}{#2}% - \testfloataddnonsymmetric{#2}{#1}% + \testfloataddnonsymmetric{#1}{#2}% + \testfloataddnonsymmetric{#2}{#1}% }% \testfloatadd{1}{100} @@ -623,17 +623,17 @@ \begingroup \testsection{testing pgfmathfloatmultiplyfixed} \def\testfloatmultiplyfixed#1#2{% - \pgfmathfloatparsenumber{#1}% - \let\first=\pgfmathresult - \pgfmathfloatparsenumber{#2}% - \pgfmathfloattofixed\pgfmathresult - \let\second=\pgfmathresult - \message{computing #1 * #2; \first * \second}% - \pgfmathfloatmultiplyfixed\first\second - \let\result=\pgfmathresult - \pgfmathfloattofixed\result - \let\resultfixed=\pgfmathresult - \[ \text{pgfmathfloatmultiplyfixed: } \showlowlevelfloatmacro\first \cdot \second = \showlowlevelfloatmacro\result \; \bigl( #1 \cdot #2 = \resultfixed \bigr). \] + \pgfmathfloatparsenumber{#1}% + \let\first=\pgfmathresult + \pgfmathfloatparsenumber{#2}% + \pgfmathfloattofixed\pgfmathresult + \let\second=\pgfmathresult + \message{computing #1 * #2; \first * \second}% + \pgfmathfloatmultiplyfixed\first\second + \let\result=\pgfmathresult + \pgfmathfloattofixed\result + \let\resultfixed=\pgfmathresult + \[ \text{pgfmathfloatmultiplyfixed: } \showlowlevelfloatmacro\first \cdot \second = \showlowlevelfloatmacro\result \; \bigl( #1 \cdot #2 = \resultfixed \bigr). \] }% \testfloatmultiplyfixed{1}{100} @@ -670,18 +670,18 @@ \testsection{testing pgfmathfloatlessthan} \def\testfloatlessthan#1#2{% - \pgfmathfloatparsenumber{#1}% - \let\first=\pgfmathresult - \pgfmathfloatparsenumber{#2}% - \let\second=\pgfmathresult - \message{checking #1 <= #2; \first <= \second}% - \pgfmathfloatlessthan\first\second - \ifpgfmathfloatcomparison - \def\result{<}% - \else - \def\result{\ge}% - \fi - \[ \text{pgfmathfloatlessthan: } \bigl( \showlowlevelfloatmacro\first \bigr)\; = #1 \result #2\; \bigl( = \showlowlevelfloatmacro\second \big). \] + \pgfmathfloatparsenumber{#1}% + \let\first=\pgfmathresult + \pgfmathfloatparsenumber{#2}% + \let\second=\pgfmathresult + \message{checking #1 <= #2; \first <= \second}% + \pgfmathfloatlessthan\first\second + \ifpgfmathfloatcomparison + \def\result{<}% + \else + \def\result{\ge}% + \fi + \[ \text{pgfmathfloatlessthan: } \bigl( \showlowlevelfloatmacro\first \bigr)\; = #1 \result #2\; \bigl( = \showlowlevelfloatmacro\second \big). \] }% \testfloatlessthan{4}{5} @@ -702,15 +702,15 @@ \testsection{float to fixed test} \def\testpgfmathfloattofixed#1{% - \pgfmathfloatparsenumber{#1}% + \pgfmathfloatparsenumber{#1}% %\tracingmacros=2\tracingcommands=2 - \let\argument=\pgfmathresult - \message{converting #1 = \argument\ to fixed point}% - \pgfmathfloattofixed\argument - \let\result=\pgfmathresult - \message{-> \result}% + \let\argument=\pgfmathresult + \message{converting #1 = \argument\ to fixed point}% + \pgfmathfloattofixed\argument + \let\result=\pgfmathresult + \message{-> \result}% %\tracingmacros=0\tracingcommands=0 - \[ \bigl( \showlowlevelfloatmacro\argument \bigr)\; = #1 \mapsto \result \] + \[ \bigl( \showlowlevelfloatmacro\argument \bigr)\; = #1 \mapsto \result \] }% \testpgfmathfloattofixed{0} \testpgfmathfloattofixed{5} @@ -733,21 +733,21 @@ \testsection{Testing pgfmathfloatmin and pgfmathfloatmax} \def\testfloatminmax#1#2{% - \pgfmathfloatparsenumber{#1}% - \let\first=\pgfmathresult - \pgfmathfloatparsenumber{#2}% - \let\second=\pgfmathresult + \pgfmathfloatparsenumber{#1}% + \let\first=\pgfmathresult + \pgfmathfloatparsenumber{#2}% + \let\second=\pgfmathresult %\tracingmacros=2\tracingcommands=2 - \message{computing min/max #1 and #2}% - \pgfmathfloatmin\first\second - \let\result=\pgfmathresult - \pgfmathfloattofixed\result - \[ \min\{#1,#2\} = \min\{ \showlowlevelfloatmacro\first, \showlowlevelfloatmacro\second \} \; = \showlowlevelfloatmacro\result = \pgfmathresult \] - % - \pgfmathfloatmax\first\second - \let\result=\pgfmathresult - \pgfmathfloattofixed\result - \[ \max\{#1,#2\} = \max\{ \showlowlevelfloatmacro\first, \showlowlevelfloatmacro\second \} \; = \showlowlevelfloatmacro\result = \pgfmathresult \] + \message{computing min/max #1 and #2}% + \pgfmathfloatmin\first\second + \let\result=\pgfmathresult + \pgfmathfloattofixed\result + \[ \min\{#1,#2\} = \min\{ \showlowlevelfloatmacro\first, \showlowlevelfloatmacro\second \} \; = \showlowlevelfloatmacro\result = \pgfmathresult \] + % + \pgfmathfloatmax\first\second + \let\result=\pgfmathresult + \pgfmathfloattofixed\result + \[ \max\{#1,#2\} = \max\{ \showlowlevelfloatmacro\first, \showlowlevelfloatmacro\second \} \; = \showlowlevelfloatmacro\result = \pgfmathresult \] }% \testfloatminmax{42}{56} \testfloatminmax{-4122}{1256} @@ -756,13 +756,13 @@ \testsection{Testing pgfmathfloatshift} \def\pgfmathfloatshifttest#1#2{% - \pgfmathfloatparsenumber{#1}% - \let\argument=\pgfmathresult - \message{computing mathshift #1 by #2}% - \pgfmathfloatshift\argument{#2}% - \let\result=\pgfmathresult - \pgfmathfloattofixed\result - \[ #1 \cdot 10^{#2} = \showlowlevelfloatmacro\argument \cdot 10^{#2} = \showlowlevelfloatmacro\result = \pgfmathresult \] + \pgfmathfloatparsenumber{#1}% + \let\argument=\pgfmathresult + \message{computing mathshift #1 by #2}% + \pgfmathfloatshift\argument{#2}% + \let\result=\pgfmathresult + \pgfmathfloattofixed\result + \[ #1 \cdot 10^{#2} = \showlowlevelfloatmacro\argument \cdot 10^{#2} = \showlowlevelfloatmacro\result = \pgfmathresult \] }% \pgfmathfloatshifttest{4}{1} \pgfmathfloatshifttest{4}{2} @@ -775,71 +775,71 @@ \testsection{Testing pgfmathfloatmultiply} \begingroup \def\pgfmathfloatmultiplytest#1#2{% - \pgfmathfloatparsenumber{#1}% - \let\argumenta=\pgfmathresult - \pgfmathfloatparsenumber{#2}% - \let\argumentb=\pgfmathresult - \message{computing mathmultiply #1 by #2}% - \pgfmathfloatmultiply\argumenta\argumentb% - \let\result=\pgfmathresult - \pgfmathfloattofixed\result - \[ #1 \cdot #2 = \showlowlevelfloatmacro\result = \pgfmathresult \] + \pgfmathfloatparsenumber{#1}% + \let\argumenta=\pgfmathresult + \pgfmathfloatparsenumber{#2}% + \let\argumentb=\pgfmathresult + \message{computing mathmultiply #1 by #2}% + \pgfmathfloatmultiply\argumenta\argumentb% + \let\result=\pgfmathresult + \pgfmathfloattofixed\result + \[ #1 \cdot #2 = \showlowlevelfloatmacro\result = \pgfmathresult \] }% \def\tests{% - \pgfmathfloatmultiplytest{4}{1} - \pgfmathfloatmultiplytest{4}{2} - \pgfmathfloatmultiplytest{4}{-1} - \pgfmathfloatmultiplytest{4}{-2} - \pgfmathfloatmultiplytest{0}{-2} - \pgfmathfloatmultiplytest{1.1415130}{-2} - \pgfmathfloatmultiplytest{1.1415130}{5} - \pgfmathfloatmultiplytest{10}{10} - \pgfmathfloatmultiplytest{100}{100} - \pgfmathfloatmultiplytest{9999999}{9999999} - gnuplot for $\cdot$: $99999980000001.0$ - \pgfmathfloatmultiplytest{-10}{10} - \pgfmathfloatmultiplytest{-90}{3} - \pgfmathfloatmultiplytest{-90}{-3} - \pgfmathfloatmultiplytest{-inf}{nan} - \pgfmathfloatmultiplytest{-inf}{+inf} - \pgfmathfloatmultiplytest{1}{0} - \pgfmathfloatmultiplytest{1}{0} - \pgfmathfloatmultiplytest{1}{-0} - \pgfmathfloatmultiplytest{3.14159265358979}{2} + \pgfmathfloatmultiplytest{4}{1} + \pgfmathfloatmultiplytest{4}{2} + \pgfmathfloatmultiplytest{4}{-1} + \pgfmathfloatmultiplytest{4}{-2} + \pgfmathfloatmultiplytest{0}{-2} + \pgfmathfloatmultiplytest{1.1415130}{-2} + \pgfmathfloatmultiplytest{1.1415130}{5} + \pgfmathfloatmultiplytest{10}{10} + \pgfmathfloatmultiplytest{100}{100} + \pgfmathfloatmultiplytest{9999999}{9999999} + gnuplot for $\cdot$: $99999980000001.0$ + \pgfmathfloatmultiplytest{-10}{10} + \pgfmathfloatmultiplytest{-90}{3} + \pgfmathfloatmultiplytest{-90}{-3} + \pgfmathfloatmultiplytest{-inf}{nan} + \pgfmathfloatmultiplytest{-inf}{+inf} + \pgfmathfloatmultiplytest{1}{0} + \pgfmathfloatmultiplytest{1}{0} + \pgfmathfloatmultiplytest{1}{-0} + \pgfmathfloatmultiplytest{3.14159265358979}{2} }% \tests \testsection{Testing pgfmathfloatdivide} \def\pgfmathfloatmultiplytest#1#2{% - \pgfmathfloatparsenumber{#1}% - \let\argumenta=\pgfmathresult - \pgfmathfloatparsenumber{#2}% - \let\argumentb=\pgfmathresult - \message{computing mathdivide #1 by #2}% - \pgfmathfloatdivide\argumenta\argumentb% - \let\result=\pgfmathresult - \pgfmathfloattofixed\result - \[ #1 / #2 = \showlowlevelfloatmacro\result = \pgfmathresult \] + \pgfmathfloatparsenumber{#1}% + \let\argumenta=\pgfmathresult + \pgfmathfloatparsenumber{#2}% + \let\argumentb=\pgfmathresult + \message{computing mathdivide #1 by #2}% + \pgfmathfloatdivide\argumenta\argumentb% + \let\result=\pgfmathresult + \pgfmathfloattofixed\result + \[ #1 / #2 = \showlowlevelfloatmacro\result = \pgfmathresult \] }% \tests % #1/#2 expected #3 \def\pgfmathfloattest#1#2#3{% - \pgfmathfloatparsenumber{#1}% - \let\argumenta=\pgfmathresult - \pgfmathfloatparsenumber{#2}% - \let\argumentb=\pgfmathresult - \pgfmathfloatparsenumber{#3}% - \let\reference=\pgfmathresult - \message{computing (#1/#2)}% - \pgfmathfloatdivide\argumenta\argumentb% - \let\resultfloat=\pgfmathresult - \pgfmathfloattosci\pgfmathresult - \let\result=\pgfmathresult - \pgfmathfloatrelerror\resultfloat\reference - \pgfmathfloattosci\pgfmathresult - \[ #1/#2 = \result\quad (\text{error/r to }#3 = \pgfmathprintnumber\pgfmathresult)\] + \pgfmathfloatparsenumber{#1}% + \let\argumenta=\pgfmathresult + \pgfmathfloatparsenumber{#2}% + \let\argumentb=\pgfmathresult + \pgfmathfloatparsenumber{#3}% + \let\reference=\pgfmathresult + \message{computing (#1/#2)}% + \pgfmathfloatdivide\argumenta\argumentb% + \let\resultfloat=\pgfmathresult + \pgfmathfloattosci\pgfmathresult + \let\result=\pgfmathresult + \pgfmathfloatrelerror\resultfloat\reference + \pgfmathfloattosci\pgfmathresult + \[ #1/#2 = \result\quad (\text{error/r to }#3 = \pgfmathprintnumber\pgfmathresult)\] }% \pgfmathfloattest{83407811.0}{166815640.0}{0.499999946048224} \endgroup @@ -850,28 +850,28 @@ % #1 : number % #2 : the reference, sqrt (#1) \def\pgfmathfloatsqrttest#1#2{% - \pgfmathfloatparsenumber{#1}% - \let\argumenta=\pgfmathresult - \pgfmathfloatparsenumber{#2}% - \let\reference=\pgfmathresult - \message{computing sqrt(#1)}% - \pgfmathfloatsqrt\argumenta% - \let\resultfloat=\pgfmathresult - \pgfmathfloattosci\pgfmathresult - \let\result=\pgfmathresult - \pgfmathfloatrelerror\resultfloat\reference - \pgfmathfloattosci\pgfmathresult - \[ \sqrt{#1} = \result\quad (\text{rel. error } \pgfmathresult)\] + \pgfmathfloatparsenumber{#1}% + \let\argumenta=\pgfmathresult + \pgfmathfloatparsenumber{#2}% + \let\reference=\pgfmathresult + \message{computing sqrt(#1)}% + \pgfmathfloatsqrt\argumenta% + \let\resultfloat=\pgfmathresult + \pgfmathfloattosci\pgfmathresult + \let\result=\pgfmathresult + \pgfmathfloatrelerror\resultfloat\reference + \pgfmathfloattosci\pgfmathresult + \[ \sqrt{#1} = \result\quad (\text{rel. error } \pgfmathresult)\] }% \def\tests{% - \pgfmathfloatsqrttest{0}{0} - \pgfmathfloatsqrttest{1}{1} - \pgfmathfloatsqrttest{2}{1.414213562373} - \pgfmathfloatsqrttest{4}{2} - \pgfmathfloatsqrttest{16}{4} - \pgfmathfloatsqrttest{10}{3.162277660168} - \pgfmathfloatsqrttest{1000000}{1000} - \pgfmathfloatsqrttest{123456789}{1.111111106055556e+04} + \pgfmathfloatsqrttest{0}{0} + \pgfmathfloatsqrttest{1}{1} + \pgfmathfloatsqrttest{2}{1.414213562373} + \pgfmathfloatsqrttest{4}{2} + \pgfmathfloatsqrttest{16}{4} + \pgfmathfloatsqrttest{10}{3.162277660168} + \pgfmathfloatsqrttest{1000000}{1000} + \pgfmathfloatsqrttest{123456789}{1.111111106055556e+04} }% \tests } @@ -880,32 +880,32 @@ \testsection{Testing pgfmathfloatint} % #1 : number \def\pgfmathfloatinttest#1{% - \pgfmathfloatparsenumber{#1}% - \let\argumenta=\pgfmathresult - \message{computing int(#1)}% - \pgfmathfloatint\argumenta% - \pgfmathfloattosci\pgfmathresult - \let\result=\pgfmathresult - \[ int(#1) = \result \] - % - \pgfmathfloatparsenumber{-#1}% - \let\argumenta=\pgfmathresult - \message{computing int(-#1)}% - \pgfmathfloatint\argumenta% - \pgfmathfloattosci\pgfmathresult - \let\result=\pgfmathresult - \[ int(-#1) = \result \] + \pgfmathfloatparsenumber{#1}% + \let\argumenta=\pgfmathresult + \message{computing int(#1)}% + \pgfmathfloatint\argumenta% + \pgfmathfloattosci\pgfmathresult + \let\result=\pgfmathresult + \[ int(#1) = \result \] + % + \pgfmathfloatparsenumber{-#1}% + \let\argumenta=\pgfmathresult + \message{computing int(-#1)}% + \pgfmathfloatint\argumenta% + \pgfmathfloattosci\pgfmathresult + \let\result=\pgfmathresult + \[ int(-#1) = \result \] }% \def\tests{% - \pgfmathfloatinttest{1.23} - \pgfmathfloatinttest{12.34} - \pgfmathfloatinttest{123.4} - \pgfmathfloatinttest{1234.} - \pgfmathfloatinttest{1234.1} - \pgfmathfloatinttest{1e-2} - \pgfmathfloatinttest{0} - \pgfmathfloatinttest{3.456789e4} - \pgfmathfloatinttest{3.456789e10} + \pgfmathfloatinttest{1.23} + \pgfmathfloatinttest{12.34} + \pgfmathfloatinttest{123.4} + \pgfmathfloatinttest{1234.} + \pgfmathfloatinttest{1234.1} + \pgfmathfloatinttest{1e-2} + \pgfmathfloatinttest{0} + \pgfmathfloatinttest{3.456789e4} + \pgfmathfloatinttest{3.456789e10} }% \tests } @@ -915,72 +915,72 @@ % #1 : number % #2 : the reference, sqrt (#1) \def\pgfmathfloattest#1#2{% - \pgfmathfloatparsenumber{#1}% - \let\argumenta=\pgfmathresult - \pgfmathfloatparsenumber{#2}% - \let\reference=\pgfmathresult - \message{computing (#1)}% - \pgfmathfloatexp\argumenta% - \let\resultfloat=\pgfmathresult - \pgfmathfloattosci\pgfmathresult - \let\result=\pgfmathresult - \pgfmathfloatrelerror\resultfloat\reference - \pgfmathfloattosci\pgfmathresult - \[ \exp(#1) = \result\quad (\text{error/r to }#2 = \pgfmathresult)\] + \pgfmathfloatparsenumber{#1}% + \let\argumenta=\pgfmathresult + \pgfmathfloatparsenumber{#2}% + \let\reference=\pgfmathresult + \message{computing (#1)}% + \pgfmathfloatexp\argumenta% + \let\resultfloat=\pgfmathresult + \pgfmathfloattosci\pgfmathresult + \let\result=\pgfmathresult + \pgfmathfloatrelerror\resultfloat\reference + \pgfmathfloattosci\pgfmathresult + \[ \exp(#1) = \result\quad (\text{error/r to }#2 = \pgfmathresult)\] }% %\tracingmacros=2\tracingcommands=2 - \pgfmathfloattest{-700}{9.85967654375977e-305} - \pgfmathfloattest{-1.0000000e+02}{3.7200760e-44} - \pgfmathfloattest{-9.5918367e+01}{2.2038516e-42} - \pgfmathfloattest{-9.1836735e+01}{1.3056083e-40} - \pgfmathfloattest{-8.7755102e+01}{7.7346991e-39} - \pgfmathfloattest{-8.3673469e+01}{4.5821992e-37} - \pgfmathfloattest{-7.9591837e+01}{2.7145916e-35} - \pgfmathfloattest{-7.5510204e+01}{1.6081814e-33} - \pgfmathfloattest{-7.1428571e+01}{9.5272065e-32} - \pgfmathfloattest{-6.7346939e+01}{5.6441184e-30} - \pgfmathfloattest{-6.3265306e+01}{3.3436950e-28} - \pgfmathfloattest{-5.9183673e+01}{1.9808756e-26} - \pgfmathfloattest{-5.5102041e+01}{1.1735125e-24} - \pgfmathfloattest{-5.1020408e+01}{6.9521362e-23} - \pgfmathfloattest{-4.6938776e+01}{4.1185924e-21} - \pgfmathfloattest{-4.2857143e+01}{2.4399411e-19} - \pgfmathfloattest{-3.8775510e+01}{1.4454727e-17} - \pgfmathfloattest{-3.4693878e+01}{8.5632855e-16} - \pgfmathfloattest{-3.0612245e+01}{5.0730713e-14} - \pgfmathfloattest{-2.6530612e+01}{3.0053946e-12} - \pgfmathfloattest{-2.2448980e+01}{1.7804593e-10} - \pgfmathfloattest{-1.8367347e+01}{1.0547817e-08} - \pgfmathfloattest{-1.4285714e+01}{6.2487495e-07} - \pgfmathfloattest{-1.0204082e+01}{3.7018912e-05} - \pgfmathfloattest{-6.1224490e+00}{2.1930786e-03} - \pgfmathfloattest{-2.0408163e+00}{1.2992261e-01} - \pgfmathfloattest{2.0408163e+00}{7.6968898e+00} - \pgfmathfloattest{6.1224490e+00}{4.5598001e+02} - \pgfmathfloattest{1.0204082e+01}{2.7013219e+04} - \pgfmathfloattest{1.4285714e+01}{1.6003202e+06} - \pgfmathfloattest{1.8367347e+01}{9.4806349e+07} - \pgfmathfloattest{2.2448980e+01}{5.6165284e+09} - \pgfmathfloattest{2.6530612e+01}{3.3273501e+11} - \pgfmathfloattest{3.0612245e+01}{1.9711925e+13} - \pgfmathfloattest{3.4693878e+01}{1.1677761e+15} - \pgfmathfloattest{3.8775510e+01}{6.9181522e+16} - \pgfmathfloattest{4.2857143e+01}{4.0984595e+18} - \pgfmathfloattest{4.6938776e+01}{2.4280140e+20} - \pgfmathfloattest{5.1020408e+01}{1.4384068e+22} - \pgfmathfloattest{5.5102041e+01}{8.5214258e+23} - \pgfmathfloattest{5.9183673e+01}{5.0482727e+25} - \pgfmathfloattest{6.3265306e+01}{2.9907034e+27} - \pgfmathfloattest{6.7346939e+01}{1.7717559e+29} - \pgfmathfloattest{7.1428571e+01}{1.0496256e+31} - \pgfmathfloattest{7.5510204e+01}{6.2182039e+32} - \pgfmathfloattest{7.9591837e+01}{3.6837954e+34} - \pgfmathfloattest{8.3673469e+01}{2.1823582e+36} - \pgfmathfloattest{8.7755102e+01}{1.2928751e+38} - \pgfmathfloattest{9.1836735e+01}{7.6592653e+39} - \pgfmathfloattest{9.5918367e+01}{4.5375106e+41} - \pgfmathfloattest{1.0000000e+02}{2.6881171e+43} - \pgfmathfloattest{700}{1.014232054735e+304} + \pgfmathfloattest{-700}{9.85967654375977e-305} + \pgfmathfloattest{-1.0000000e+02}{3.7200760e-44} + \pgfmathfloattest{-9.5918367e+01}{2.2038516e-42} + \pgfmathfloattest{-9.1836735e+01}{1.3056083e-40} + \pgfmathfloattest{-8.7755102e+01}{7.7346991e-39} + \pgfmathfloattest{-8.3673469e+01}{4.5821992e-37} + \pgfmathfloattest{-7.9591837e+01}{2.7145916e-35} + \pgfmathfloattest{-7.5510204e+01}{1.6081814e-33} + \pgfmathfloattest{-7.1428571e+01}{9.5272065e-32} + \pgfmathfloattest{-6.7346939e+01}{5.6441184e-30} + \pgfmathfloattest{-6.3265306e+01}{3.3436950e-28} + \pgfmathfloattest{-5.9183673e+01}{1.9808756e-26} + \pgfmathfloattest{-5.5102041e+01}{1.1735125e-24} + \pgfmathfloattest{-5.1020408e+01}{6.9521362e-23} + \pgfmathfloattest{-4.6938776e+01}{4.1185924e-21} + \pgfmathfloattest{-4.2857143e+01}{2.4399411e-19} + \pgfmathfloattest{-3.8775510e+01}{1.4454727e-17} + \pgfmathfloattest{-3.4693878e+01}{8.5632855e-16} + \pgfmathfloattest{-3.0612245e+01}{5.0730713e-14} + \pgfmathfloattest{-2.6530612e+01}{3.0053946e-12} + \pgfmathfloattest{-2.2448980e+01}{1.7804593e-10} + \pgfmathfloattest{-1.8367347e+01}{1.0547817e-08} + \pgfmathfloattest{-1.4285714e+01}{6.2487495e-07} + \pgfmathfloattest{-1.0204082e+01}{3.7018912e-05} + \pgfmathfloattest{-6.1224490e+00}{2.1930786e-03} + \pgfmathfloattest{-2.0408163e+00}{1.2992261e-01} + \pgfmathfloattest{2.0408163e+00}{7.6968898e+00} + \pgfmathfloattest{6.1224490e+00}{4.5598001e+02} + \pgfmathfloattest{1.0204082e+01}{2.7013219e+04} + \pgfmathfloattest{1.4285714e+01}{1.6003202e+06} + \pgfmathfloattest{1.8367347e+01}{9.4806349e+07} + \pgfmathfloattest{2.2448980e+01}{5.6165284e+09} + \pgfmathfloattest{2.6530612e+01}{3.3273501e+11} + \pgfmathfloattest{3.0612245e+01}{1.9711925e+13} + \pgfmathfloattest{3.4693878e+01}{1.1677761e+15} + \pgfmathfloattest{3.8775510e+01}{6.9181522e+16} + \pgfmathfloattest{4.2857143e+01}{4.0984595e+18} + \pgfmathfloattest{4.6938776e+01}{2.4280140e+20} + \pgfmathfloattest{5.1020408e+01}{1.4384068e+22} + \pgfmathfloattest{5.5102041e+01}{8.5214258e+23} + \pgfmathfloattest{5.9183673e+01}{5.0482727e+25} + \pgfmathfloattest{6.3265306e+01}{2.9907034e+27} + \pgfmathfloattest{6.7346939e+01}{1.7717559e+29} + \pgfmathfloattest{7.1428571e+01}{1.0496256e+31} + \pgfmathfloattest{7.5510204e+01}{6.2182039e+32} + \pgfmathfloattest{7.9591837e+01}{3.6837954e+34} + \pgfmathfloattest{8.3673469e+01}{2.1823582e+36} + \pgfmathfloattest{8.7755102e+01}{1.2928751e+38} + \pgfmathfloattest{9.1836735e+01}{7.6592653e+39} + \pgfmathfloattest{9.5918367e+01}{4.5375106e+41} + \pgfmathfloattest{1.0000000e+02}{2.6881171e+43} + \pgfmathfloattest{700}{1.014232054735e+304} } { @@ -989,29 +989,29 @@ % #2 : operand 2 % #3 : the reference, #1 mod #2 \def\pgfmathfloattest#1#2#3{% - \pgfmathfloatparsenumber{#1}% - \let\argumenta=\pgfmathresult - \pgfmathfloatparsenumber{#2}% - \let\argumentb=\pgfmathresult - \pgfmathfloatparsenumber{#3}% - \let\reference=\pgfmathresult - \message{computing #1 mod #2}% - \pgfmathfloatmod\argumenta\argumentb% - \let\resultfloat=\pgfmathresult - \pgfmathfloattosci\pgfmathresult - \let\result=\pgfmathresult - \pgfmathfloatrelerror\resultfloat\reference - \pgfmathfloattosci\pgfmathresult - \[ #1\text{ mod }#2 = \result\quad (\text{error/r to }#3 = \pgfmathresult)\] + \pgfmathfloatparsenumber{#1}% + \let\argumenta=\pgfmathresult + \pgfmathfloatparsenumber{#2}% + \let\argumentb=\pgfmathresult + \pgfmathfloatparsenumber{#3}% + \let\reference=\pgfmathresult + \message{computing #1 mod #2}% + \pgfmathfloatmod\argumenta\argumentb% + \let\resultfloat=\pgfmathresult + \pgfmathfloattosci\pgfmathresult + \let\result=\pgfmathresult + \pgfmathfloatrelerror\resultfloat\reference + \pgfmathfloattosci\pgfmathresult + \[ #1\text{ mod }#2 = \result\quad (\text{error/r to }#3 = \pgfmathresult)\] }% %\tracingmacros=2\tracingcommands=2 - \pgfmathfloattest{4}{3}{1} - \pgfmathfloattest{10}{10}{0} - \pgfmathfloattest{20}{6}{2} - \pgfmathfloattest{-100}{30}{-10} - \pgfmathfloattest{10.5}{5}{0.5} - \pgfmathfloattest{300.63}{360}{300.63} - \pgfmathfloattest{-20}{30}{-20} + \pgfmathfloattest{4}{3}{1} + \pgfmathfloattest{10}{10}{0} + \pgfmathfloattest{20}{6}{2} + \pgfmathfloattest{-100}{30}{-10} + \pgfmathfloattest{10.5}{5}{0.5} + \pgfmathfloattest{300.63}{360}{300.63} + \pgfmathfloattest{-20}{30}{-20} } { @@ -1020,245 +1020,245 @@ % #2 : operand % #3 : the reference, #2(#1) \def\pgfmathfloattest#1#2#3{% - \pgfmathfloatparsenumber{#2}% - \let\argumenta=\pgfmathresult - \pgfmathfloatparsenumber{#3}% - \let\reference=\pgfmathresult - \message{computing \string#1(#2)}% - #1\argumenta% - \let\resultfloat=\pgfmathresult - \pgfmathfloattosci\pgfmathresult - \let\result=\pgfmathresult - \pgfmathfloatrelerror\resultfloat\reference - \pgfmathfloattosci\pgfmathresult - \[ \string#1(#2) = \result\quad (\text{error/r to }#3 = \pgfmathresult)\] + \pgfmathfloatparsenumber{#2}% + \let\argumenta=\pgfmathresult + \pgfmathfloatparsenumber{#3}% + \let\reference=\pgfmathresult + \message{computing \string#1(#2)}% + #1\argumenta% + \let\resultfloat=\pgfmathresult + \pgfmathfloattosci\pgfmathresult + \let\result=\pgfmathresult + \pgfmathfloatrelerror\resultfloat\reference + \pgfmathfloattosci\pgfmathresult + \[ \string#1(#2) = \result\quad (\text{error/r to }#3 = \pgfmathresult)\] }% %\tracingmacros=2\tracingcommands=2 \testsubsection{SIN} - \pgfmathfloattest\pgfmathfloatsin{-7.2000000e+02}{4.8985872e-16} - \pgfmathfloattest\pgfmathfloatsin{-6.5454545e+02}{9.0963200e-01} - \pgfmathfloattest\pgfmathfloatsin{-5.8909091e+02}{7.5574957e-01} - \pgfmathfloattest\pgfmathfloatsin{-5.2363636e+02}{-2.8173256e-01} - \pgfmathfloattest\pgfmathfloatsin{-4.5818182e+02}{-9.8982144e-01} - \pgfmathfloattest\pgfmathfloatsin{-3.9272727e+02}{-5.4064082e-01} - \pgfmathfloattest\pgfmathfloatsin{-3.2727273e+02}{5.4064082e-01} - \pgfmathfloattest\pgfmathfloatsin{-2.6181818e+02}{9.8982144e-01} - \pgfmathfloattest\pgfmathfloatsin{-1.9636364e+02}{2.8173256e-01} - \pgfmathfloattest\pgfmathfloatsin{-1.3090909e+02}{-7.5574957e-01} - \pgfmathfloattest\pgfmathfloatsin{-6.5454545e+01}{-9.0963200e-01} - \pgfmathfloattest\pgfmathfloatsin{0.0000000e+00}{0.0000000e+00} - \pgfmathfloattest\pgfmathfloatsin{6.5454545e+01}{9.0963200e-01} - \pgfmathfloattest\pgfmathfloatsin{1.3090909e+02}{7.5574957e-01} - \pgfmathfloattest\pgfmathfloatsin{1.9636364e+02}{-2.8173256e-01} - \pgfmathfloattest\pgfmathfloatsin{2.6181818e+02}{-9.8982144e-01} - \pgfmathfloattest\pgfmathfloatsin{3.2727273e+02}{-5.4064082e-01} - \pgfmathfloattest\pgfmathfloatsin{3.9272727e+02}{5.4064082e-01} - \pgfmathfloattest\pgfmathfloatsin{4.5818182e+02}{9.8982144e-01} - \pgfmathfloattest\pgfmathfloatsin{5.2363636e+02}{2.8173256e-01} - \pgfmathfloattest\pgfmathfloatsin{5.8909091e+02}{-7.5574957e-01} - \pgfmathfloattest\pgfmathfloatsin{6.5454545e+02}{-9.0963200e-01} - \pgfmathfloattest\pgfmathfloatsin{7.2000000e+02}{-4.8985872e-16} + \pgfmathfloattest\pgfmathfloatsin{-7.2000000e+02}{4.8985872e-16} + \pgfmathfloattest\pgfmathfloatsin{-6.5454545e+02}{9.0963200e-01} + \pgfmathfloattest\pgfmathfloatsin{-5.8909091e+02}{7.5574957e-01} + \pgfmathfloattest\pgfmathfloatsin{-5.2363636e+02}{-2.8173256e-01} + \pgfmathfloattest\pgfmathfloatsin{-4.5818182e+02}{-9.8982144e-01} + \pgfmathfloattest\pgfmathfloatsin{-3.9272727e+02}{-5.4064082e-01} + \pgfmathfloattest\pgfmathfloatsin{-3.2727273e+02}{5.4064082e-01} + \pgfmathfloattest\pgfmathfloatsin{-2.6181818e+02}{9.8982144e-01} + \pgfmathfloattest\pgfmathfloatsin{-1.9636364e+02}{2.8173256e-01} + \pgfmathfloattest\pgfmathfloatsin{-1.3090909e+02}{-7.5574957e-01} + \pgfmathfloattest\pgfmathfloatsin{-6.5454545e+01}{-9.0963200e-01} + \pgfmathfloattest\pgfmathfloatsin{0.0000000e+00}{0.0000000e+00} + \pgfmathfloattest\pgfmathfloatsin{6.5454545e+01}{9.0963200e-01} + \pgfmathfloattest\pgfmathfloatsin{1.3090909e+02}{7.5574957e-01} + \pgfmathfloattest\pgfmathfloatsin{1.9636364e+02}{-2.8173256e-01} + \pgfmathfloattest\pgfmathfloatsin{2.6181818e+02}{-9.8982144e-01} + \pgfmathfloattest\pgfmathfloatsin{3.2727273e+02}{-5.4064082e-01} + \pgfmathfloattest\pgfmathfloatsin{3.9272727e+02}{5.4064082e-01} + \pgfmathfloattest\pgfmathfloatsin{4.5818182e+02}{9.8982144e-01} + \pgfmathfloattest\pgfmathfloatsin{5.2363636e+02}{2.8173256e-01} + \pgfmathfloattest\pgfmathfloatsin{5.8909091e+02}{-7.5574957e-01} + \pgfmathfloattest\pgfmathfloatsin{6.5454545e+02}{-9.0963200e-01} + \pgfmathfloattest\pgfmathfloatsin{7.2000000e+02}{-4.8985872e-16} \testsubsection{COS} - \pgfmathfloattest\pgfmathfloatcos{-7.2000000e+02}{1.0000000e+00} - \pgfmathfloattest\pgfmathfloatcos{-6.5454545e+02}{4.1541501e-01} - \pgfmathfloattest\pgfmathfloatcos{-5.8909091e+02}{-6.5486073e-01} - \pgfmathfloattest\pgfmathfloatcos{-5.2363636e+02}{-9.5949297e-01} - \pgfmathfloattest\pgfmathfloatcos{-4.5818182e+02}{-1.4231484e-01} - \pgfmathfloattest\pgfmathfloatcos{-3.9272727e+02}{8.4125353e-01} - \pgfmathfloattest\pgfmathfloatcos{-3.2727273e+02}{8.4125353e-01} - \pgfmathfloattest\pgfmathfloatcos{-2.6181818e+02}{-1.4231484e-01} - \pgfmathfloattest\pgfmathfloatcos{-1.9636364e+02}{-9.5949297e-01} - \pgfmathfloattest\pgfmathfloatcos{-1.3090909e+02}{-6.5486073e-01} - \pgfmathfloattest\pgfmathfloatcos{-6.5454545e+01}{4.1541501e-01} - \pgfmathfloattest\pgfmathfloatcos{0.0000000e+00}{1.0000000e+00} - \pgfmathfloattest\pgfmathfloatcos{6.5454545e+01}{4.1541501e-01} - \pgfmathfloattest\pgfmathfloatcos{1.3090909e+02}{-6.5486073e-01} - \pgfmathfloattest\pgfmathfloatcos{1.9636364e+02}{-9.5949297e-01} - \pgfmathfloattest\pgfmathfloatcos{2.6181818e+02}{-1.4231484e-01} - \pgfmathfloattest\pgfmathfloatcos{3.2727273e+02}{8.4125353e-01} - \pgfmathfloattest\pgfmathfloatcos{3.9272727e+02}{8.4125353e-01} - \pgfmathfloattest\pgfmathfloatcos{4.5818182e+02}{-1.4231484e-01} - \pgfmathfloattest\pgfmathfloatcos{5.2363636e+02}{-9.5949297e-01} - \pgfmathfloattest\pgfmathfloatcos{5.8909091e+02}{-6.5486073e-01} - \pgfmathfloattest\pgfmathfloatcos{6.5454545e+02}{4.1541501e-01} - \pgfmathfloattest\pgfmathfloatcos{7.2000000e+02}{1.0000000e+00} + \pgfmathfloattest\pgfmathfloatcos{-7.2000000e+02}{1.0000000e+00} + \pgfmathfloattest\pgfmathfloatcos{-6.5454545e+02}{4.1541501e-01} + \pgfmathfloattest\pgfmathfloatcos{-5.8909091e+02}{-6.5486073e-01} + \pgfmathfloattest\pgfmathfloatcos{-5.2363636e+02}{-9.5949297e-01} + \pgfmathfloattest\pgfmathfloatcos{-4.5818182e+02}{-1.4231484e-01} + \pgfmathfloattest\pgfmathfloatcos{-3.9272727e+02}{8.4125353e-01} + \pgfmathfloattest\pgfmathfloatcos{-3.2727273e+02}{8.4125353e-01} + \pgfmathfloattest\pgfmathfloatcos{-2.6181818e+02}{-1.4231484e-01} + \pgfmathfloattest\pgfmathfloatcos{-1.9636364e+02}{-9.5949297e-01} + \pgfmathfloattest\pgfmathfloatcos{-1.3090909e+02}{-6.5486073e-01} + \pgfmathfloattest\pgfmathfloatcos{-6.5454545e+01}{4.1541501e-01} + \pgfmathfloattest\pgfmathfloatcos{0.0000000e+00}{1.0000000e+00} + \pgfmathfloattest\pgfmathfloatcos{6.5454545e+01}{4.1541501e-01} + \pgfmathfloattest\pgfmathfloatcos{1.3090909e+02}{-6.5486073e-01} + \pgfmathfloattest\pgfmathfloatcos{1.9636364e+02}{-9.5949297e-01} + \pgfmathfloattest\pgfmathfloatcos{2.6181818e+02}{-1.4231484e-01} + \pgfmathfloattest\pgfmathfloatcos{3.2727273e+02}{8.4125353e-01} + \pgfmathfloattest\pgfmathfloatcos{3.9272727e+02}{8.4125353e-01} + \pgfmathfloattest\pgfmathfloatcos{4.5818182e+02}{-1.4231484e-01} + \pgfmathfloattest\pgfmathfloatcos{5.2363636e+02}{-9.5949297e-01} + \pgfmathfloattest\pgfmathfloatcos{5.8909091e+02}{-6.5486073e-01} + \pgfmathfloattest\pgfmathfloatcos{6.5454545e+02}{4.1541501e-01} + \pgfmathfloattest\pgfmathfloatcos{7.2000000e+02}{1.0000000e+00} \testsubsection{TAN} - \pgfmathfloattest\pgfmathfloattan{-7.2000000e+02}{4.8985872e-16} - \pgfmathfloattest\pgfmathfloattan{-6.5454545e+02}{2.1896946e+00} - \pgfmathfloattest\pgfmathfloattan{-5.8909091e+02}{-1.1540615e+00} - \pgfmathfloattest\pgfmathfloattan{-5.2363636e+02}{2.9362649e-01} - \pgfmathfloattest\pgfmathfloattan{-4.5818182e+02}{6.9551528e+00} - \pgfmathfloattest\pgfmathfloattan{-3.9272727e+02}{-6.4266098e-01} - \pgfmathfloattest\pgfmathfloattan{-3.2727273e+02}{6.4266098e-01} - \pgfmathfloattest\pgfmathfloattan{-2.6181818e+02}{-6.9551528e+00} - \pgfmathfloattest\pgfmathfloattan{-1.9636364e+02}{-2.9362649e-01} - \pgfmathfloattest\pgfmathfloattan{-1.3090909e+02}{1.1540615e+00} - \pgfmathfloattest\pgfmathfloattan{-6.5454545e+01}{-2.1896946e+00} - \pgfmathfloattest\pgfmathfloattan{0.0000000e+00}{0.0000000e+00} - \pgfmathfloattest\pgfmathfloattan{6.5454545e+01}{2.1896946e+00} - \pgfmathfloattest\pgfmathfloattan{1.3090909e+02}{-1.1540615e+00} - \pgfmathfloattest\pgfmathfloattan{1.9636364e+02}{2.9362649e-01} - \pgfmathfloattest\pgfmathfloattan{2.6181818e+02}{6.9551528e+00} - \pgfmathfloattest\pgfmathfloattan{3.2727273e+02}{-6.4266098e-01} - \pgfmathfloattest\pgfmathfloattan{3.9272727e+02}{6.4266098e-01} - \pgfmathfloattest\pgfmathfloattan{4.5818182e+02}{-6.9551528e+00} - \pgfmathfloattest\pgfmathfloattan{5.2363636e+02}{-2.9362649e-01} - \pgfmathfloattest\pgfmathfloattan{5.8909091e+02}{1.1540615e+00} - \pgfmathfloattest\pgfmathfloattan{6.5454545e+02}{-2.1896946e+00} - \pgfmathfloattest\pgfmathfloattan{7.2000000e+02}{-4.8985872e-16} + \pgfmathfloattest\pgfmathfloattan{-7.2000000e+02}{4.8985872e-16} + \pgfmathfloattest\pgfmathfloattan{-6.5454545e+02}{2.1896946e+00} + \pgfmathfloattest\pgfmathfloattan{-5.8909091e+02}{-1.1540615e+00} + \pgfmathfloattest\pgfmathfloattan{-5.2363636e+02}{2.9362649e-01} + \pgfmathfloattest\pgfmathfloattan{-4.5818182e+02}{6.9551528e+00} + \pgfmathfloattest\pgfmathfloattan{-3.9272727e+02}{-6.4266098e-01} + \pgfmathfloattest\pgfmathfloattan{-3.2727273e+02}{6.4266098e-01} + \pgfmathfloattest\pgfmathfloattan{-2.6181818e+02}{-6.9551528e+00} + \pgfmathfloattest\pgfmathfloattan{-1.9636364e+02}{-2.9362649e-01} + \pgfmathfloattest\pgfmathfloattan{-1.3090909e+02}{1.1540615e+00} + \pgfmathfloattest\pgfmathfloattan{-6.5454545e+01}{-2.1896946e+00} + \pgfmathfloattest\pgfmathfloattan{0.0000000e+00}{0.0000000e+00} + \pgfmathfloattest\pgfmathfloattan{6.5454545e+01}{2.1896946e+00} + \pgfmathfloattest\pgfmathfloattan{1.3090909e+02}{-1.1540615e+00} + \pgfmathfloattest\pgfmathfloattan{1.9636364e+02}{2.9362649e-01} + \pgfmathfloattest\pgfmathfloattan{2.6181818e+02}{6.9551528e+00} + \pgfmathfloattest\pgfmathfloattan{3.2727273e+02}{-6.4266098e-01} + \pgfmathfloattest\pgfmathfloattan{3.9272727e+02}{6.4266098e-01} + \pgfmathfloattest\pgfmathfloattan{4.5818182e+02}{-6.9551528e+00} + \pgfmathfloattest\pgfmathfloattan{5.2363636e+02}{-2.9362649e-01} + \pgfmathfloattest\pgfmathfloattan{5.8909091e+02}{1.1540615e+00} + \pgfmathfloattest\pgfmathfloattan{6.5454545e+02}{-2.1896946e+00} + \pgfmathfloattest\pgfmathfloattan{7.2000000e+02}{-4.8985872e-16} } { - % #1 : expression - % #2 : the reference - \def\assertEquals#1#2{% - \pgfmathfloatparsenumber{#2}% - \let\reference=\pgfmathresult - \message{parsing expression #1...}% - \pgfmathparse{#1}% - \pgfmathfloatparsenumber{\pgfmathresult}% - \let\argumenta=\pgfmathresult - \let\resultfloat=\pgfmathresult - \pgfmathfloattosci\pgfmathresult - \let\result=\pgfmathresult - \pgfmathfloatrelerror\resultfloat\reference - \let\actualerror=\pgfmathresult - \pgfmathfloatgreaterthan{\pgfmathresult}{\THRESH}% - \ifpgfmathfloatcomparison - \begingroup - \pgfkeys{/pgf/fpu=false}% - \pgfmathparse{#1}% - \global\let\actualBasic=\pgfmathresult - \endgroup - \PackageError{pgf-fpu}{Got error: expected #1=#2, but was \result\space (error \actualerror; basic level returns \actualBasic)}{}% - \fi - \pgfmathfloattosci\actualerror - \[ #1 = \result \quad[= \resultfloat] \quad (\text{error/r to }#2 = \pgfmathresult)\] - }% - \def\mathparserTestCases{% - \assertEquals{1+1}{2} - \assertEquals{1234567*4}{4938268} - \assertEquals{exp(200)}{7.22597376812575e+86} - \assertEquals{rad(360)}{6.28318530717959} - \assertEquals{rad(180)}{3.14159265358979} - \assertEquals{deg(2*pi)}{360} - \assertEquals{deg(pi)}{180} - \assertEquals{ln(1)}{0} - \assertEquals{round(1.5)}{2} - \assertEquals{round(-1.5)}{-2} - \assertEquals{- (1.5)}{-1.5} - \assertEquals{(1e4 - 1e3) * 1e5}{900000000.0} - \assertEquals{4^2}{16} - \assertEquals{4^3}{64} - \assertEquals{4^-3}{0.015625} - \assertEquals{4^-6}{0.000244140625} - \assertEquals{111^4}{151807041} - \assertEquals{8^10}{1073741824} - \assertEquals{3^1.5}{5.19615242270663} - \assertEquals{16^5.5}{4194304} - \assertEquals{15^-0.25}{0.508132748154615} - \assertEquals{sec(45)}{1.4142136e+00} - \assertEquals{cot(30)}{1.7320508e+00} - \assertEquals{asin(7.0710678e-01)}{45} - \assertEquals{acos(8.6602540e-01)}{30} - \assertEquals{atan(5.7735027e-01)}{30} - \assertEquals{atan(16000)}{89.9964} - \assertEquals{atan(1e6)}{8.9999943e+01} - \assertEquals{atan(-1e6)}{-8.9999943e+01} - \assertEquals{-12^2}{-144}% - \assertEquals{0-12^2}{-144}% - \assertEquals{-(12)^2}{-144}% - \assertEquals{exp(-12^2)}{2.8946e-63}% - \assertEquals{round(98.8)}{99}% - \assertEquals{-pi}{-3.14159265358979}% - \assertEquals{2*(-pi)}{-6.28318530717959}% - \assertEquals{2*(-3)}{-6}% - \assertEquals{veclen(1,1)}{1.414213562373095}% - \assertEquals{veclen(1e5,6e5)}{6.082762530298220e+05}% - \assertEquals{cosh(5)}{74.20994852478784}% - \assertEquals{sinh(0.6)}{0.636653582148241}% - \assertEquals{tanh(0.6)}{0.537049566998035}% - - {\pgfkeys{/pgf/trig format=rad} - \assertEquals{atan2(4,5)}{0.674740942223553}% - \assertEquals{atan2(-4,5)}{-0.674740942223553}% - \assertEquals{atan2(4,-5)}{2.46685171136624}% - \assertEquals{atan2(-4,-5)}{-2.46685171136624}% - % - \assertEquals{atan2(5,4)}{0.89605538457134}% - \assertEquals{atan2(-5,4)}{-0.89605538457134}% - \assertEquals{atan2(5,-4)}{2.24553726901845}% - \assertEquals{atan2(-5,-4)}{-2.24553726901845}% - % - \assertEquals{atan2(4e-5,5)}{0}% - \assertEquals{atan2(4e-5,-5)}{3.1415126535899}% - } - % \assertEquals{ceil(1.5)}{2} - } - - - { - \testsection{Testing the FPU library (and math parser)} - \pgfkeys{/pgf/fpu} - %\tracingmacros=2\tracingcommands=2 - \mathparserTestCases - } - - { - \def\mathparserTestCases{% - \assertEquals{sin(90)}{1.0}% - \assertEquals{cos(90)}{0.0}% - \assertEquals{tan(45)}{1.0}% - \assertEquals{sec(45)}{1.41429}% - \assertEquals{cosec(30)}{2.0}% - \assertEquals{cot(15)}{3.73215}% - \assertEquals{asin(0.7071)}{44.99945}% - \assertEquals{acos(0.5)}{60}% - \assertEquals{atan(1)}{45}% - \assertEquals{atan(16001)}{90}% - \assertEquals{atan(-16001)}{-90}% - %\assertEquals{atan2(-4,3)}{-53.13011}% - }% - \testsection{Testing trig format=deg, basic layer (selected examples)} - %\tracingmacros=2\tracingcommands=2 - \mathparserTestCases - - \testsection{Testing trig format=deg, FPU (selected examples)} - \pgfkeys{/pgf/fpu} - \mathparserTestCases - } - - { - \pgfkeys{/pgf/trig format=rad} - \def\mathparserTestCases{% - \assertEquals{sin(pi/2)}{1.0}% - \assertEquals{cos(pi/2)}{0.0}% - \assertEquals{tan(pi/4)}{1.0}% - \assertEquals{sec(pi/4)}{1.41429}% - \assertEquals{cosec(rad(30))}{2.0}% - \assertEquals{cot(rad(15))}{3.73215}% - \assertEquals{asin(0.7071)}{0.785388564086562}% 44.99945}% - \assertEquals{acos(0.5)}{1.0471975511966}% - \assertEquals{atan(1)}{0.785398163397448}%45}% - \assertEquals{atan(16001)}{1.570796326794}% - \assertEquals{atan(-16001)}{-1.570796326794}% - %\assertEquals{atan2(-4,3)}{-53.13011}% - }% - \testsection{Testing trig format=rad, basic layer (selected examples)} - %\tracingmacros=2\tracingcommands=2 - \mathparserTestCases - - \testsection{Testing trig format=rad, FPU (selected examples)} - \pgfkeys{/pgf/fpu} - \mathparserTestCases - } + % #1 : expression + % #2 : the reference + \def\assertEquals#1#2{% + \pgfmathfloatparsenumber{#2}% + \let\reference=\pgfmathresult + \message{parsing expression #1...}% + \pgfmathparse{#1}% + \pgfmathfloatparsenumber{\pgfmathresult}% + \let\argumenta=\pgfmathresult + \let\resultfloat=\pgfmathresult + \pgfmathfloattosci\pgfmathresult + \let\result=\pgfmathresult + \pgfmathfloatrelerror\resultfloat\reference + \let\actualerror=\pgfmathresult + \pgfmathfloatgreaterthan{\pgfmathresult}{\THRESH}% + \ifpgfmathfloatcomparison + \begingroup + \pgfkeys{/pgf/fpu=false}% + \pgfmathparse{#1}% + \global\let\actualBasic=\pgfmathresult + \endgroup + \PackageError{pgf-fpu}{Got error: expected #1=#2, but was \result\space (error \actualerror; basic level returns \actualBasic)}{}% + \fi + \pgfmathfloattosci\actualerror + \[ #1 = \result \quad[= \resultfloat] \quad (\text{error/r to }#2 = \pgfmathresult)\] + }% + \def\mathparserTestCases{% + \assertEquals{1+1}{2} + \assertEquals{1234567*4}{4938268} + \assertEquals{exp(200)}{7.22597376812575e+86} + \assertEquals{rad(360)}{6.28318530717959} + \assertEquals{rad(180)}{3.14159265358979} + \assertEquals{deg(2*pi)}{360} + \assertEquals{deg(pi)}{180} + \assertEquals{ln(1)}{0} + \assertEquals{round(1.5)}{2} + \assertEquals{round(-1.5)}{-2} + \assertEquals{- (1.5)}{-1.5} + \assertEquals{(1e4 - 1e3) * 1e5}{900000000.0} + \assertEquals{4^2}{16} + \assertEquals{4^3}{64} + \assertEquals{4^-3}{0.015625} + \assertEquals{4^-6}{0.000244140625} + \assertEquals{111^4}{151807041} + \assertEquals{8^10}{1073741824} + \assertEquals{3^1.5}{5.19615242270663} + \assertEquals{16^5.5}{4194304} + \assertEquals{15^-0.25}{0.508132748154615} + \assertEquals{sec(45)}{1.4142136e+00} + \assertEquals{cot(30)}{1.7320508e+00} + \assertEquals{asin(7.0710678e-01)}{45} + \assertEquals{acos(8.6602540e-01)}{30} + \assertEquals{atan(5.7735027e-01)}{30} + \assertEquals{atan(16000)}{89.9964} + \assertEquals{atan(1e6)}{8.9999943e+01} + \assertEquals{atan(-1e6)}{-8.9999943e+01} + \assertEquals{-12^2}{-144}% + \assertEquals{0-12^2}{-144}% + \assertEquals{-(12)^2}{-144}% + \assertEquals{exp(-12^2)}{2.8946e-63}% + \assertEquals{round(98.8)}{99}% + \assertEquals{-pi}{-3.14159265358979}% + \assertEquals{2*(-pi)}{-6.28318530717959}% + \assertEquals{2*(-3)}{-6}% + \assertEquals{veclen(1,1)}{1.414213562373095}% + \assertEquals{veclen(1e5,6e5)}{6.082762530298220e+05}% + \assertEquals{cosh(5)}{74.20994852478784}% + \assertEquals{sinh(0.6)}{0.636653582148241}% + \assertEquals{tanh(0.6)}{0.537049566998035}% + + {\pgfkeys{/pgf/trig format=rad} + \assertEquals{atan2(4,5)}{0.674740942223553}% + \assertEquals{atan2(-4,5)}{-0.674740942223553}% + \assertEquals{atan2(4,-5)}{2.46685171136624}% + \assertEquals{atan2(-4,-5)}{-2.46685171136624}% + % + \assertEquals{atan2(5,4)}{0.89605538457134}% + \assertEquals{atan2(-5,4)}{-0.89605538457134}% + \assertEquals{atan2(5,-4)}{2.24553726901845}% + \assertEquals{atan2(-5,-4)}{-2.24553726901845}% + % + \assertEquals{atan2(4e-5,5)}{0}% + \assertEquals{atan2(4e-5,-5)}{3.1415126535899}% + } + % \assertEquals{ceil(1.5)}{2} + } + + + { + \testsection{Testing the FPU library (and math parser)} + \pgfkeys{/pgf/fpu} + %\tracingmacros=2\tracingcommands=2 + \mathparserTestCases + } + + { + \def\mathparserTestCases{% + \assertEquals{sin(90)}{1.0}% + \assertEquals{cos(90)}{0.0}% + \assertEquals{tan(45)}{1.0}% + \assertEquals{sec(45)}{1.41429}% + \assertEquals{cosec(30)}{2.0}% + \assertEquals{cot(15)}{3.73215}% + \assertEquals{asin(0.7071)}{44.99945}% + \assertEquals{acos(0.5)}{60}% + \assertEquals{atan(1)}{45}% + \assertEquals{atan(16001)}{90}% + \assertEquals{atan(-16001)}{-90}% + %\assertEquals{atan2(-4,3)}{-53.13011}% + }% + \testsection{Testing trig format=deg, basic layer (selected examples)} + %\tracingmacros=2\tracingcommands=2 + \mathparserTestCases + + \testsection{Testing trig format=deg, FPU (selected examples)} + \pgfkeys{/pgf/fpu} + \mathparserTestCases + } + + { + \pgfkeys{/pgf/trig format=rad} + \def\mathparserTestCases{% + \assertEquals{sin(pi/2)}{1.0}% + \assertEquals{cos(pi/2)}{0.0}% + \assertEquals{tan(pi/4)}{1.0}% + \assertEquals{sec(pi/4)}{1.41429}% + \assertEquals{cosec(rad(30))}{2.0}% + \assertEquals{cot(rad(15))}{3.73215}% + \assertEquals{asin(0.7071)}{0.785388564086562}% 44.99945}% + \assertEquals{acos(0.5)}{1.0471975511966}% + \assertEquals{atan(1)}{0.785398163397448}%45}% + \assertEquals{atan(16001)}{1.570796326794}% + \assertEquals{atan(-16001)}{-1.570796326794}% + %\assertEquals{atan2(-4,3)}{-53.13011}% + }% + \testsection{Testing trig format=rad, basic layer (selected examples)} + %\tracingmacros=2\tracingcommands=2 + \mathparserTestCases + + \testsection{Testing trig format=rad, FPU (selected examples)} + \pgfkeys{/pgf/fpu} + \mathparserTestCases + } } \end{document} diff --git a/Master/texmf-dist/source/generic/pgf/testsuite/mathtest/unittest_luamathparser.tex b/Master/texmf-dist/source/generic/pgf/testsuite/mathtest/unittest_luamathparser.tex index 225927eb411..ee144598943 100644 --- a/Master/texmf-dist/source/generic/pgf/testsuite/mathtest/unittest_luamathparser.tex +++ b/Master/texmf-dist/source/generic/pgf/testsuite/mathtest/unittest_luamathparser.tex @@ -9,8 +9,8 @@ X \def\SHOW#1{% - \dimen0=#1 % - #1 = \the\dimen0 + \dimen0=#1 % + #1 = \the\dimen0 } \SHOW{1pt} @@ -40,13 +40,13 @@ X \newif\ifcomparewithtex \newif\ifcomparewithfpu \pgfkeys{ - /ut/compare with TeX/.is if=comparewithtex, - /ut/compare with TeX=true, - /ut/compare with fpu/.is if=comparewithfpu, - /ut/compare with fpu=true, - /ut/.search also={/pgf/luamath}, - /pgf/luamath/show error message=true, - /pgf/luamath/enable TeX fallback=false, + /ut/compare with TeX/.is if=comparewithtex, + /ut/compare with TeX=true, + /ut/compare with fpu/.is if=comparewithfpu, + /ut/compare with fpu=true, + /ut/.search also={/pgf/luamath}, + /pgf/luamath/show error message=true, + /pgf/luamath/enable TeX fallback=false, } \newcount\numErrors @@ -57,113 +57,113 @@ X % #4: expected 'units declared' (1 or 0) \def\parsertest{\pgfutil@ifnextchar[\parsertest@{\parsertest@[]}}% \def\parsertest@[#1]#2#3#4{% - \begingroup - \pgfqkeys{/ut}{#1}% - \pgfluamathparse{#2}% - \let\actual=\pgfmathresult - \ifpgfmathunitsdeclared - \def\actualunitsdeclared{1}% - \else - \def\actualunitsdeclared{0}% - \fi - % - \ifcomparewithtex - \ifpgfluamathusedTeXfallback - \let\expectedTeX=\actual - \else - \pgfmathparse{#2}% - \let\expectedTeX=\pgfmathresult - \fi - \else - \def\expectedTeX{--}% - \fi - % - \edef\expected{#3}% - \def\success{1}% - \ifx\expected\empty - \ifx\actual\empty - \else - \def\success{0}% - \fi - \else - \ifx\actual\expected - \else - \def\success{0}% - \fi - \fi - % - \if1\success - \else - \message{FAILURE for #2 expected \expected\space but was \actual^^J}% - \global\advance\numErrors by1 - \fi - % - \if1\success - \def\expectedunitsdeclared{#4}% - \ifx\actualunitsdeclared\expectedunitsdeclared - \else - \def\success{0}% - \message{FAILURE for #2 expected units declared #4 but was \actualunitsdeclared^^J}% - \global\advance\numErrors by1 - \fi - \fi - % - \if1\success - \ifcomparewithtex - % check against PGF's basic layer as reference: - \dimen0=\actual pt % - \dimen1=\expectedTeX pt % - \advance\dimen0 by-\dimen1 - \ifdim\dimen0<0sp - \dimen0=-\dimen0 - \fi - \ifdim\dimen0 > 0.004pt % - \def\success{0}% - \message{FAILURE for #2 : matches expectations, but does NOT match TeX output (error \the\dimen0). expected \expectedTeX\space but was \actual^^J}% - \global\advance\numErrors by1 - \fi - % - % - \ifpgfmathunitsdeclared - \def\actualTeXunitsdeclared{1}% - \else - \def\actualTeXunitsdeclared{0}% - \fi - \ifx\actualTeXunitsdeclared\actualunitsdeclared - \else - \message{WARNING for #2 : matches ALL expectations, but TeX's output does NOT match TeX expected units declared (TeX returns \actualTeXunitsdeclared, expectation = LUA is \actualunitsdeclared)^^J}% - \fi - \fi - % - \ifcomparewithfpu - % check that FPU works as well. This - % * tests the FPU - % * tests that FPU values can be injected into the LUA backend: - \begingroup - \pgfkeys{/pgf/fpu,/pgf/fpu/output format=float}% - \pgfmathparse{#2}% - \xdef\actualfpu{\pgfmathresult}% - \ifpgfmathunitsdeclared - \xdef\actualfpuunitsdeclared{1}% - \else - \xdef\actualfpuunitsdeclared{0}% - \fi - \endgroup - % - \pgfkeys{/pgf/luamath/output format=fixed}% - \pgfluamathparse{abs(\actual - \actualfpu) > 0.004}% - \ifdim\pgfmathresult pt=1pt - \def\success{0}% - \pgfluamathparse{abs(\actual - \actualfpu)}% - \message{FAILURE for #2 : matches expectations, but does NOT match output of FPU (error \pgfmathresult). fpu=\actualfpu\space lua=\actual^^J}% - \global\advance\numErrors by1 - \fi - \fi - % - \fi - % - \message{#2 = \actual\space (pgf=\expectedTeX) \if1\success OK\else FAILURE\fi^^J}% - \endgroup + \begingroup + \pgfqkeys{/ut}{#1}% + \pgfluamathparse{#2}% + \let\actual=\pgfmathresult + \ifpgfmathunitsdeclared + \def\actualunitsdeclared{1}% + \else + \def\actualunitsdeclared{0}% + \fi + % + \ifcomparewithtex + \ifpgfluamathusedTeXfallback + \let\expectedTeX=\actual + \else + \pgfmathparse{#2}% + \let\expectedTeX=\pgfmathresult + \fi + \else + \def\expectedTeX{--}% + \fi + % + \edef\expected{#3}% + \def\success{1}% + \ifx\expected\empty + \ifx\actual\empty + \else + \def\success{0}% + \fi + \else + \ifx\actual\expected + \else + \def\success{0}% + \fi + \fi + % + \if1\success + \else + \message{FAILURE for #2 expected \expected\space but was \actual^^J}% + \global\advance\numErrors by1 + \fi + % + \if1\success + \def\expectedunitsdeclared{#4}% + \ifx\actualunitsdeclared\expectedunitsdeclared + \else + \def\success{0}% + \message{FAILURE for #2 expected units declared #4 but was \actualunitsdeclared^^J}% + \global\advance\numErrors by1 + \fi + \fi + % + \if1\success + \ifcomparewithtex + % check against PGF's basic layer as reference: + \dimen0=\actual pt % + \dimen1=\expectedTeX pt % + \advance\dimen0 by-\dimen1 + \ifdim\dimen0<0sp + \dimen0=-\dimen0 + \fi + \ifdim\dimen0 > 0.004pt % + \def\success{0}% + \message{FAILURE for #2 : matches expectations, but does NOT match TeX output (error \the\dimen0). expected \expectedTeX\space but was \actual^^J}% + \global\advance\numErrors by1 + \fi + % + % + \ifpgfmathunitsdeclared + \def\actualTeXunitsdeclared{1}% + \else + \def\actualTeXunitsdeclared{0}% + \fi + \ifx\actualTeXunitsdeclared\actualunitsdeclared + \else + \message{WARNING for #2 : matches ALL expectations, but TeX's output does NOT match TeX expected units declared (TeX returns \actualTeXunitsdeclared, expectation = LUA is \actualunitsdeclared)^^J}% + \fi + \fi + % + \ifcomparewithfpu + % check that FPU works as well. This + % * tests the FPU + % * tests that FPU values can be injected into the LUA backend: + \begingroup + \pgfkeys{/pgf/fpu,/pgf/fpu/output format=float}% + \pgfmathparse{#2}% + \xdef\actualfpu{\pgfmathresult}% + \ifpgfmathunitsdeclared + \xdef\actualfpuunitsdeclared{1}% + \else + \xdef\actualfpuunitsdeclared{0}% + \fi + \endgroup + % + \pgfkeys{/pgf/luamath/output format=fixed}% + \pgfluamathparse{abs(\actual - \actualfpu) > 0.004}% + \ifdim\pgfmathresult pt=1pt + \def\success{0}% + \pgfluamathparse{abs(\actual - \actualfpu)}% + \message{FAILURE for #2 : matches expectations, but does NOT match output of FPU (error \pgfmathresult). fpu=\actualfpu\space lua=\actual^^J}% + \global\advance\numErrors by1 + \fi + \fi + % + \fi + % + \message{#2 = \actual\space (pgf=\expectedTeX) \if1\success OK\else FAILURE\fi^^J}% + \endgroup }% \parsertest{1}{1.0}{0} @@ -225,10 +225,10 @@ X \pgfmathdeclarefunction{N1}{3}{\pgfmathparse{#1+#2+#3}}% \directlua{ function pgfluamathfunctions.x() - return 4 + return 4 end function pgfluamathfunctions.N1(x,m,n) - return x+m+n + return x+m+n end } \parsertest{2^x}{16.0}{0} @@ -371,8 +371,8 @@ end \parsertest{0 <0.1 || 4 <0.1}{1.0}{0} { \pgfkeys{/pgf/declare function={ - xx=4; - yy=4; + xx=4; + yy=4; }} \parsertest{abs(xx-yy)<0.1 ? -42 : 42}{-42.0}{0} \parsertest{abs(xx-yy)<0.1 || abs(xx-0.5)<0.1}{1.0}{0} @@ -425,11 +425,11 @@ end % -- strings with "<str>" % -- 'scalar' function % -- hex/octal/binary input -% -- tex registers +% -- tex registers % -- What happens for undefined functions!? --> return nil and let TeX invoke its parser (no warning!?) % -- width/height/depth % end -%-------------------------------------------------- +%-------------------------------------------------- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -510,15 +510,15 @@ end % should have been clean up: \parsertest[show error message=false,compare with TeX=false,compare with fpu=false]{mu1(-5,2)}{}{0} - + \def\pgfmathifexpressionTest#1{% - \pgfmathifexpression{1000>999}{% - % ok - \message{PASSED for mathifexpression(1000>999) #1: = '\pgfmathresult'^^J}% - }{% - \message{FAILURE for mathifexpression(1000>999) #1: = '\pgfmathresult'^^J}% - \global\advance\numErrors by1 - }% + \pgfmathifexpression{1000>999}{% + % ok + \message{PASSED for mathifexpression(1000>999) #1: = '\pgfmathresult'^^J}% + }{% + \message{FAILURE for mathifexpression(1000>999) #1: = '\pgfmathresult'^^J}% + \global\advance\numErrors by1 + }% } \pgfmathifexpressionTest{basicmath} @@ -533,7 +533,7 @@ end \pgfkeys{/pgf/fpu,/pgf/fpu/output format=fixed}% \pgfmathifexpressionTest{fpu output fixed} \endgroup - + \begingroup \pgfkeys{/pgf/fpu,/pgf/fpu/output format=sci}% \pgfmathifexpressionTest{fpu output sci} @@ -553,9 +553,9 @@ end % NO MORE TEST CASES HERE! \ifnum\numErrors>0 - \PackageError{pgf}{Has \the\numErrors\space FAILURES}{} + \PackageError{pgf}{Has \the\numErrors\space FAILURES}{} \else - \message{All cases PASSED^^J}% + \message{All cases PASSED^^J}% \fi diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreexternal.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreexternal.code.tex index 9ec63ff7c66..8e150972a97 100644 --- a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreexternal.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreexternal.code.tex @@ -273,7 +273,7 @@ % \pgfexternalstorecommand will be restored. % - anything else will be appended to the main .aux file, assuming that % it contains \label or \ref information (only if the LaTeX switch -% \if@filesw is \iftrue). +% \if@filesw is \iftrue). % % % #1: the image file name (such that #1.dpth exists) diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepoints.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepoints.code.tex index 028546dde89..57db0d20ba2 100644 --- a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepoints.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorepoints.code.tex @@ -568,8 +568,8 @@ % % #1 = a time % #2 = center of a ellipse -% #3 = 0-degree axis of the ellipse -% #4 = 90-degree axis of the ellipse +% #3 = 0-degree exis of the ellipse +% #4 = 90-degree exis of the ellipse % #5 = start angle of an arc on the ellipse % #6 = end angle of an arc on the ellipse % @@ -851,11 +851,11 @@ \def\pgfpointxyz#1#2#3{% \pgfmathparse{#1}% - \global\let\pgftemp@x=\pgfmathresult% + \let\pgftemp@x=\pgfmathresult% \pgfmathparse{#2}% - \global\let\pgftemp@y=\pgfmathresult% + \let\pgftemp@y=\pgfmathresult% \pgfmathparse{#3}% - \global\let\pgftemp@z=\pgfmathresult% + \let\pgftemp@z=\pgfmathresult% \global\pgf@x=\pgftemp@x\pgf@xx% \global\advance\pgf@x by \pgftemp@y\pgf@yx% \global\advance\pgf@x by \pgftemp@z\pgf@zx% @@ -943,12 +943,77 @@ \def\pgfpointnormalised#1{% \pgf@process{#1}% - \pgfmathatantwo{\the\pgf@y}{\the\pgf@x}% - \let\pgf@tmp=\pgfmathresult% - \pgfmathcos@{\pgf@tmp}% - \pgf@x=\pgfmathresult pt\relax% - \pgfmathsin@{\pgf@tmp}% - \pgf@y=\pgfmathresult pt\relax% + \pgf@xa=\pgf@x% + \pgf@ya=\pgf@y% + \ifdim\pgf@x<0pt\relax% move into first quadrant + \global\pgf@x=-\pgf@x% + \fi% + \ifdim\pgf@y<0pt\relax% + \pgf@y=-\pgf@y% + \fi% + \ifdim\pgf@x>\pgf@y% x > y + % make point small + \c@pgf@counta=\pgf@x% + \divide\c@pgf@counta by 65536\relax% + \ifnum\c@pgf@counta=0\relax% + \c@pgf@counta=1\relax% + \fi% + \global\divide\pgf@x by\c@pgf@counta% + \global\divide\pgf@y by\c@pgf@counta% + \divide\pgf@xa by\c@pgf@counta% + \divide\pgf@ya by\c@pgf@counta% + % ok. + \global\pgf@x=.125\pgf@x% + \global\pgf@y=.125\pgf@y% + \c@pgf@counta=\pgf@x% + \c@pgf@countb=\pgf@y% + \multiply\c@pgf@countb by 100% + \ifnum\c@pgf@counta<64\relax% + \global\pgf@x=1pt\relax% + \global\pgf@y=0pt\relax% + \else% + \divide\c@pgf@countb by \c@pgf@counta% + \global\pgf@x=\csname pgf@cosfrac\the\c@pgf@countb\endcsname pt% + \pgf@xc=8192pt% + \divide\pgf@xc by\c@pgf@counta% + \global\pgf@y=\pgf@sys@tonumber{\pgf@xc}\pgf@ya% + \global\pgf@y=\pgf@sys@tonumber{\pgf@x}\pgf@y% + \fi% + \ifdim\pgf@xa<0pt% + \global\pgf@x=-\pgf@x% + \fi% + \else% x <= y + % make point small + \c@pgf@counta=\pgf@y% + \divide\c@pgf@counta by 65536\relax% + \ifnum\c@pgf@counta=0\relax% + \c@pgf@counta=1\relax% + \fi% + \global\divide\pgf@x by\c@pgf@counta% + \global\divide\pgf@y by\c@pgf@counta% + \divide\pgf@xa by\c@pgf@counta% + \divide\pgf@ya by\c@pgf@counta% + % ok. + \global\pgf@x=.125\pgf@x% + \global\pgf@y=.125\pgf@y% + \c@pgf@counta=\pgf@y% + \c@pgf@countb=\pgf@x% + \multiply\c@pgf@countb by 100% + \ifnum\c@pgf@counta<64\relax% + \global\pgf@y=1pt\relax% + \global\pgf@x=0pt\relax% + \else% + \divide\c@pgf@countb by \c@pgf@counta% + \global\pgf@y=\csname pgfmath@cosfrac@\the\c@pgf@countb\endcsname pt% + \pgf@xc=8192pt% + \divide\pgf@xc by\c@pgf@counta% + \global\pgf@x=\pgf@sys@tonumber{\pgf@xc}\pgf@xa% + \global\pgf@x=\pgf@sys@tonumber{\pgf@y}\pgf@x% + \fi% + \ifdim\pgf@ya<0pt% + \global\pgf@y=-\pgf@y% + \fi% + \fi\ignorespaces% } diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.code.tex index 3e292aa0383..50a820f6126 100644 --- a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcorescopes.code.tex @@ -742,7 +742,6 @@ \def\pgfinterruptpicture {% \begingroup% - \csname tikz@inside@picturefalse\endcsname% \pgfinterruptboundingbox% \pgftransformreset% \pgfinterruptpath% diff --git a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreshade.code.tex b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreshade.code.tex index 93079024f6e..971752304a7 100644 --- a/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreshade.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreshade.code.tex @@ -157,12 +157,6 @@ -\newcount\pgf@shadingcount -\pgf@shadingcount=0 -{ - \catcode`\%=12 - \gdef\pgf@shadingnum{%\the\pgf@shadingcount%} -} % Declares a horizontal shading for later use. The shading is a % horizontal bar that changes its color. @@ -202,11 +196,8 @@ \def\pgf@declarehorizontalshading[#1]#2#3#4{% \expandafter\def\csname pgf@deps@pgfshading#2!\endcsname{#1}% \expandafter\ifx\csname pgf@deps@pgfshading#2!\endcsname\pgfutil@empty% - \expandafter\let\csname pgf@num@pgfshading#2!\endcsname\pgfutil@empty \pgfsys@horishading{#2}{#3}{#4}% \else% - \global\advance\pgf@shadingcount 1\relax - \expandafter\edef\csname pgf@num@pgfshading#2!\endcsname{\pgf@shadingnum}% \expandafter\def\csname pgf@func@pgfshading#2!\endcsname{\pgfsys@horishading}% \expandafter\def\csname pgf@args@pgfshading#2!\endcsname{{#3}{#4}}% \expandafter\let\csname @pgfshading#2!\endcsname=\pgfutil@empty% @@ -235,11 +226,8 @@ \def\pgf@declareverticalshading[#1]#2#3#4{% \expandafter\def\csname pgf@deps@pgfshading#2!\endcsname{#1}% \expandafter\ifx\csname pgf@deps@pgfshading#2!\endcsname\pgfutil@empty% - \expandafter\let\csname pgf@num@pgfshading#2!\endcsname=\pgfutil@empty \pgfsys@vertshading{#2}{#3}{#4}% \else% - \global\advance\pgf@shadingcount 1\relax - \expandafter\edef\csname pgf@num@pgfshading#2!\endcsname{\pgf@shadingnum}% \expandafter\def\csname pgf@func@pgfshading#2!\endcsname{\pgfsys@vertshading}% \expandafter\def\csname pgf@args@pgfshading#2!\endcsname{{#3}{#4}}% \expandafter\let\csname @pgfshading#2!\endcsname=\pgfutil@empty% @@ -281,11 +269,8 @@ \def\pgf@declareradialshading[#1]#2#3#4{% \expandafter\def\csname pgf@deps@pgfshading#2!\endcsname{#1}% \expandafter\ifx\csname pgf@deps@pgfshading#2!\endcsname\pgfutil@empty% - \expandafter\let\csname pgf@num@pgfshading#2!\endcsname=\pgfutil@empty \pgfsys@radialshading{#2}{#3}{#4}% \else% - \global\advance\pgf@shadingcount 1\relax - \expandafter\edef\csname pgf@num@pgfshading#2!\endcsname{\pgf@shadingnum}% \expandafter\def\csname pgf@func@pgfshading#2!\endcsname{\pgfsys@radialshading}% \expandafter\def\csname pgf@args@pgfshading#2!\endcsname{{#3}{#4}}% \expandafter\let\csname @pgfshading#2!\endcsname=\pgfutil@empty% @@ -332,7 +317,7 @@ % evaluated for each pixel independently. % % Because of the rather difficult PostScript syntax, use this macro -% only *if you know what you are doing* (or if you are adventurous, of +% only *if you know what you are doing* (or if you are advanterous, of % course). % % As for other shadings, the optional dependencies argument is used to @@ -391,21 +376,17 @@ \def\pgf@declarefunctionalshading[#1]#2#3#4#5#6{% \expandafter\def\csname pgf@deps@pgfshading#2!\endcsname{#1}% \expandafter\ifx\csname pgf@deps@pgfshading#2!\endcsname\pgfutil@empty% - \expandafter\let\csname pgf@num@pgfshading#2!\endcsname=\pgfutil@empty \pgfshade@functionaldo{#2}{#3}{#4}{#5}{#6}% \else% - \global\advance\pgf@shadingcount 1\relax - \expandafter\edef\csname pgf@num@pgfshading#2!\endcsname{\pgf@shadingnum}% \expandafter\def\csname pgf@func@pgfshading#2!\endcsname{\pgfshade@functionaldo}% \expandafter\def\csname pgf@args@pgfshading#2!\endcsname{{#3}{#4}{#5}{#6}}% \expandafter\let\csname @pgfshading#2!\endcsname=\pgfutil@empty% \fi} \def\pgfshade@functionaldo#1#2#3#4#5{% - \begingroup + {% #4% \pgfsys@functionalshading{#1}{#2}{#3}{#5}% - \expandafter\pgfmath@smuggleone\csname @pgfshading#1!\endcsname - \endgroup + }% } \def\pgfshadecolortorgb#1#2{% @@ -445,38 +426,38 @@ \expandafter\pgfutil@ifundefined\expandafter{\pgf@shadingname}% {\pgferror{Undefined shading "#1"}}% {% - \edef\pgf@shade@adds{\csname pgf@num\pgf@shadingname\endcsname}% - \pgfutil@ifundefined{pgf@deps\pgf@shadingname}% - {}% {% - \begingroup - \pgfutil@globalcolorsfalse + \pgfutil@globalcolorsfalse% + \def\pgf@shade@adds{}% + \pgfutil@ifundefined{pgf@deps\pgf@shadingname}% + {}% + {% \edef\@list{\csname pgf@deps\pgf@shadingname\endcsname}% \pgfutil@for\@temp:=\@list\do{% - \pgfutil@ifundefined{applycolormixins}{}{\applycolormixins{\@temp}}% - \pgfutil@extractcolorspec{\@temp}{\pgf@tempcolor}% - \expandafter\pgfutil@convertcolorspec\pgf@tempcolor{rgb}{\pgf@rgbcolor}% - \edef\pgf@shade@adds{\pgf@shade@adds,\pgf@rgbcolor}% + {% + \pgfutil@ifundefined{applycolormixins}{}{\applycolormixins{\@temp}}% + \pgfutil@extractcolorspec{\@temp}{\pgf@tempcolor}% + \expandafter\pgfutil@convertcolorspec\pgf@tempcolor{rgb}{\pgf@rgbcolor}% + \xdef\pgf@shade@adds{\pgf@shade@adds,\pgf@rgbcolor}% + }% }% - \pgfmath@smuggleone\pgf@shade@adds - \endgroup - }% - \expandafter\pgf@strip@shadename\pgf@shadingname!!% - \edef\pgf@shadingxname{@pgfshading\pgf@basename\pgf@shade@adds!}% - \pgfutil@ifundefined{\pgf@shadingxname}% - {% - \begingroup - \edef\@temp{\expandafter\noexpand\csname pgf@func\pgf@shadingname\endcsname}% - \edef\@args{{\pgf@basename\pgf@shade@adds}}% - \expandafter\expandafter\expandafter\def - \expandafter\expandafter\expandafter\@@args - \expandafter\expandafter\expandafter{\csname pgf@args\pgf@shadingname\endcsname}% - \expandafter\expandafter\expandafter\@temp\expandafter\@args\@@args - \expandafter\pgfmath@smuggleone\csname\pgf@shadingxname\endcsname - \endgroup + }% + \expandafter\pgf@strip@shadename\pgf@shadingname!!% + \pgfutil@ifundefined{@pgfshading\pgf@basename\pgf@shade@adds!}% + {% + {% + \expandafter\def\expandafter\@temp\expandafter{\csname pgf@func\pgf@shadingname\endcsname}% + \edef\@args{{\pgf@basename\pgf@shade@adds}}% + \expandafter\expandafter\expandafter\def% + \expandafter\expandafter\expandafter\@@args% + \expandafter\expandafter\expandafter{\csname pgf@args\pgf@shadingname\endcsname}% + \expandafter\expandafter\expandafter\@temp\expandafter\@args\@@args% + % + }% + }% + {}% + \pgf@invokeshading{\csname @pgfshading\pgf@basename\pgf@shade@adds!\endcsname}% }% - {}% - \pgf@invokeshading{\csname\pgf@shadingxname\endcsname}% }% } @@ -503,8 +484,6 @@ \def\pgfaliasshading#1#2{% \expandafter\let\expandafter\pgf@temp\expandafter=\csname @pgfshading#2!\endcsname% \expandafter\let\csname @pgfshading#1!\endcsname=\pgf@temp% - \expandafter\let\expandafter\pgf@temp\expandafter=\csname pgf@num@pgfshading#2!\endcsname% - \expandafter\let\csname pgf@num@pgfshading#1!\endcsname=\pgf@temp% \expandafter\let\expandafter\pgf@temp\expandafter=\csname pgf@deps@pgfshading#2!\endcsname% \expandafter\let\csname pgf@deps@pgfshading#1!\endcsname=\pgf@temp% \expandafter\let\expandafter\pgf@temp\expandafter=\csname pgf@func@pgfshading#2!\endcsname% @@ -560,66 +539,40 @@ \advance\pgf@xb by.5\pgf@pathminx% \pgf@yb=.5\pgf@pathmaxy% \advance\pgf@yb by.5\pgf@pathminy% - % Calculate rotation: - \pgfmathparse{#2}% - \let\pgfshade@angle=\pgfmathresult - \pgfmathsin@\pgfshade@angle - \let\pgfshade@sin=\pgfmathresult - \pgfmathcos@\pgfshade@angle - \let\pgfshade@cos=\pgfmathresult - % width and height of the bounding box - \pgf@xa=\pgf@pathmaxx - \advance\pgf@xa by-\pgf@pathminx - \pgf@ya=\pgf@pathmaxy - \advance\pgf@ya by-\pgf@pathminy % Calculate scaling: - % xscale = 1pt/50bp * (w*|cos(a)|+h*|sin(a)|)/(|cos(a)|+|sin(a)|) - % yscale = 1pt/50bp * (w*|sin(a)|+h*|cos(a)|)/(|cos(a)|+|sin(a)|) - % 1pt/50bp = .01992528 - \pgfmathabs@\pgfshade@sin - \let\pgfshade@abssin=\pgfmathresult - \pgfmathabs@\pgfshade@cos - \let\pgfshade@abscos=\pgfmathresult - \pgf@xc=\pgfshade@abscos\pgf@xa - \advance\pgf@xc by\pgfshade@abssin\pgf@ya - \pgf@yc=\pgfshade@abssin\pgf@xa - \advance\pgf@yc by\pgfshade@abscos\pgf@ya - \pgfmathadd@\pgfshade@abscos\pgfshade@abssin - \pgfmathdivide@{.01992528}{\pgfmathresult}% - \pgf@xc=\pgfmathresult\pgf@xc - \pgf@yc=\pgfmathresult\pgf@yc - \ifdim\pgf@xc<0.0001pt - \ifdim\pgf@xc>-0.0001pt - \pgf@no@shadetrue - \fi - \fi - \ifdim\pgf@yc<0.0001pt - \ifdim\pgf@yc>-0.0001pt - \pgf@no@shadetrue - \fi - \fi - \ifpgf@no@shade\else - \pgfsys@beginscope - \pgfsyssoftpath@invokecurrentpath - \pgfsys@clipnext - \pgfsys@discardpath - % Compute new transformation matrix: - % shift - \pgfsys@transformcm{1}{0}{0}{1}{\the\pgf@xb}{\the\pgf@yb}% - % rotation - \pgf@x=\pgfshade@sin pt% - \pgf@xa=-\pgf@x% - \pgfsys@transformcm{\pgfshade@cos}{\pgfshade@sin}{\pgf@sys@tonumber{\pgf@xa}}{\pgfshade@cos}{0pt}{0pt}% - % scaling - \pgfsys@transformcm{\pgf@sys@tonumber{\pgf@xc}}{0}{0}{\pgf@sys@tonumber{\pgf@yc}}{0pt}{0pt}% - % This will actually be the first transformation of the shading. - % Should it be applied first so that it becomes the last one? - \ifx\pgf@shade@extra@transform\pgfutil@empty% - \else% - \pgflowlevel{\pgf@shade@extra@transform}% - \fi% - \pgfuseshading{#1}% - \pgfsys@endscope% + \pgf@xc=\pgf@pathmaxx% + \advance\pgf@xc by-\pgf@pathminx% + \pgf@yc=\pgf@pathmaxy% + \advance\pgf@yc by-\pgf@pathminy% + \pgf@xc=.01992528\pgf@xc% + \pgf@yc=.01992528\pgf@yc% + \ifdim\pgf@xc<0.0001pt\relax\ifdim\pgf@xc>-0.0001pt\relax\pgf@no@shadetrue\fi\fi% + \ifdim\pgf@yc<0.0001pt\relax\ifdim\pgf@yc>-0.0001pt\relax\pgf@no@shadetrue\fi\fi% + \ifpgf@no@shade\else% + \pgfsys@beginscope% + \pgfsyssoftpath@invokecurrentpath% + \pgfsys@clipnext% + \pgfsys@discardpath% + % Compute new transformation matrix: + \pgfsys@transformcm{1}{0}{0}{1}{\pgf@xb}{\pgf@yb}% + \pgfsys@transformcm% + {\pgf@sys@tonumber{\pgf@xc}}{0}% + {0}{\pgf@sys@tonumber{\pgf@yc}}{0pt}{0pt}% + \pgfmathparse{#2}% + \let\pgfshade@angle=\pgfmathresult% + \pgfmathsin@{\pgfshade@angle}% + \let\pgfshade@sin=\pgfmathresult% + \pgfmathcos@{\pgfshade@angle}% + \let\pgfshade@cos=\pgfmathresult% + \pgf@x=\pgfshade@sin pt% + \pgf@xa=-\pgf@x% + \pgfsys@transformcm{\pgfshade@cos}{\pgfshade@sin}{\pgf@sys@tonumber{\pgf@xa}}{\pgfshade@cos}{0pt}{0pt}% + \ifx\pgf@shade@extra@transform\pgfutil@empty% + \else% + \pgflowlevel{\pgf@shade@extra@transform}% + \fi% + \pgfuseshading{#1}% + \pgfsys@endscope% \fi% \endgroup% \fi% diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/graphs/tikzlibrarygraphs.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/graphs/tikzlibrarygraphs.code.tex index 15fcecb70df..27f0ed4aba5 100644 --- a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/graphs/tikzlibrarygraphs.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/graphs/tikzlibrarygraphs.code.tex @@ -542,10 +542,10 @@ }% \def\tikz@lib@graph@quote@parser@done{% - {\expandafter\pgfutil@scantokens\expandafter{% + {\expandafter\scantokens\expandafter{% \expandafter\expandafter\expandafter\tikzlibgraphactivations\expandafter\expandafter\expandafter\tikzlibgraphdoedef\expandafter{\the\pgfkeys@temptoks}% }}% - {\expandafter\pgfutil@scantokens\expandafter{\expandafter\tikzlibgraphactivationsbrace\expandafter\xdef\expandafter\tikzlibgraphreplaced\expandafter<\tikzlibgraphreplaced>\catcode`\}=2\relax}}% + {\expandafter\scantokens\expandafter{\expandafter\tikzlibgraphactivationsbrace\expandafter\xdef\expandafter\tikzlibgraphreplaced\expandafter<\tikzlibgraphreplaced>\catcode`\}=2\relax}}% \edef\tikzlibgraphreplaced{\expandafter\detokenize\expandafter{\tikzlibgraphreplaced}} \pgfutil@ifnextchar/\tikz@lib@graph@quotes@slash\tikz@lib@graph@quotes@no@slash% }% @@ -563,7 +563,7 @@ \def\tikz@lib@prepare@active#1#2#3{% {% \catcode`#1=13\relax% - \pgfutil@scantokens{\gdef\tikzlibgraphactivator{\def#2{@#3@}}}% + \scantokens{\gdef\tikzlibgraphactivator{\def#2{@#3@}}}% }% \pgfutil@g@addto@macro\tikzlibgraphactivations{\catcode`#1=13\relax}% \expandafter\pgfutil@g@addto@macro\expandafter\tikzlibgraphactivations\expandafter{\tikzlibgraphactivator}% @@ -646,16 +646,7 @@ \def\tikz@lib@graph@node{\tikz@lib@graph@check@quotes\tikz@lib@graph@node@normal}% -\def\tikz@lib@graph@node@normal{% - \pgfutil@ifnextchar({\tikz@lib@graph@node@dressed}{\tikz@lib@graph@node@naked}% -}% - -\def\tikz@lib@graph@node@dressed(#1){% - % Add extra braces around nodes to protect dashes - \tikz@lib@graph@node@naked{(#1)}% -}% - -\def\tikz@lib@graph@node@naked#1-{% +\def\tikz@lib@graph@node@normal#1-{% % Detect trailing < \tikz@lib@graph@@node#1<\pgf@stop% }% @@ -892,8 +883,7 @@ \ifpgfutil@in@% \tikz@lib@parse@node@with@doubleunder#1\pgf@stop% \else - \edef\pgf@marshal{\noexpand\pgfkeys@spdef\noexpand\tikz@lib@graph@name@only{#1}}% - \pgf@marshal% + \pgfkeys@spdef\tikz@lib@graph@name@only{#1}% \let\tikz@lib@graph@node@text\tikz@lib@graph@name@only% \edef\tikz@lib@graph@name{\tikz@lib@graph@path\tikz@lib@graph@name@only}% \fi% @@ -912,7 +902,7 @@ }% \def\tikz@lg@slash@quote"#1"#2\pgf@stop{% \iftikz@handle@active@nodes% - \def\tikz@lib@graph@node@text{\csname pgfutil@scantokens\endcsname{#1}}% + \def\tikz@lib@graph@node@text{\scantokens{#1}}% \else \def\tikz@lib@graph@node@text{#1}% \fi% @@ -920,7 +910,7 @@ {\catcode`\"=13\relax \gdef\tikz@lg@slash@quote@active"#1"#2\pgf@stop{% \iftikz@handle@active@nodes% - \def\tikz@lib@graph@node@text{\csname pgfutil@scantokens\endcsname{#1}}% + \def\tikz@lib@graph@node@text{\scantokens{#1}}% \else \def\tikz@lib@graph@node@text{#1}% \fi% @@ -928,7 +918,7 @@ }% \def\tikz@lg@slash@cont#1\pgf@stop{% \iftikz@handle@active@nodes% - \def\tikz@lib@graph@node@text{\csname pgfutil@scantokens\endcsname{#1}}% + \def\tikz@lib@graph@node@text{\scantokens{#1}}% \else \def\tikz@lib@graph@node@text{#1}% \fi% diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzexternalshared.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzexternalshared.code.tex index d35c7eee765..645191dbabf 100644 --- a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzexternalshared.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzexternalshared.code.tex @@ -12,7 +12,7 @@ % tikzlibraryexternal.code.tex % ****************************** % -% +% % This file provides a high-level automatic export feature for tikz pictures. % It allows to export EACH SINGLE FIGURE into a separate PDF. % @@ -61,17 +61,17 @@ % % This command must be called *after* \tikzexternalize. \def\tikzifexternalizing#1#2{% - \ifpgf@external@grabshipout #1\else #2\fi + \ifpgf@external@grabshipout #1\else #2\fi }% % Invokes '#1' if the external lib is currently externalizing the NEXT FOLLOWING % tikzpicture. It invokes '#2' if that is not the case. \def\tikzifexternalizingnext#1#2{% - \ifpgf@external@grabshipout - \tikzexternalgetnextfilename\tikzexternal@temp - \tikzifexternaljobnamematches\tikzexternal@temp{#1}{#2}% - \else - #2% - \fi + \ifpgf@external@grabshipout + \tikzexternalgetnextfilename\tikzexternal@temp + \tikzifexternaljobnamematches\tikzexternal@temp{#1}{#2}% + \else + #2% + \fi }% % Invokes '#1' if the external lib is currently externalizing the % current picture. It invokes '#2' if that is not the case. @@ -79,243 +79,243 @@ % If the command is invoked outside of a picture, '#2' will be % invoked. \def\tikzifexternalizingcurrent#1#2{% - \ifpgf@external@grabshipout - \tikzexternalgetcurrentfilename\tikzexternal@temp - \ifx\tikzexternal@temp\pgfutil@empty - #2% - \else - \tikzifexternaljobnamematches\tikzexternal@temp{#1}{#2}% - \fi - \else - #2% - \fi + \ifpgf@external@grabshipout + \tikzexternalgetcurrentfilename\tikzexternal@temp + \ifx\tikzexternal@temp\pgfutil@empty + #2% + \else + \tikzifexternaljobnamematches\tikzexternal@temp{#1}{#2}% + \fi + \else + #2% + \fi }% % Invokes '#2' if \jobname equals '#1' and '#3' if not. % I suppose that '#1' is a macro containing the file name. % \def\tikzifexternaljobnamematches#1#2#3{% - \edef\pgf@tempa{\expandafter\string\csname#1\endcsname}% - \edef\pgf@tempb{\expandafter\string\csname\pgfactualjobname\endcsname}% - \ifx\pgf@tempa\pgf@tempb #2\else#3 \fi% + \edef\pgf@tempa{\expandafter\string\csname#1\endcsname}% + \edef\pgf@tempb{\expandafter\string\csname\pgfactualjobname\endcsname}% + \ifx\pgf@tempa\pgf@tempb #2\else#3 \fi% }% \pgfutil@IfUndefined{pdfshellescape}{% - % let's hope that \usepackage{pdftexcmds} has been used... - \pgfutil@IfUndefined{pdf@shellescape}{% - \def\tikzexternalcheckshellescape{0}% - }{% - \let\tikzexternalcheckshellescape=\pdf@shellescape - }% + % let's hope that \usepackage{pdftexcmds} has been used... + \pgfutil@IfUndefined{pdf@shellescape}{% + \def\tikzexternalcheckshellescape{0}% + }{% + \let\tikzexternalcheckshellescape=\pdf@shellescape + }% }{% - \let\tikzexternalcheckshellescape=\pdfshellescape + \let\tikzexternalcheckshellescape=\pdfshellescape }% \ifnum\tikzexternalcheckshellescape=1 - \def\tikzexternalcheckshellescape{\pgfkeysvalueof{/tikz/external/shell escape}\space}% + \def\tikzexternalcheckshellescape{\pgfkeysvalueof{/tikz/external/shell escape}\space}% \else - \def\tikzexternalcheckshellescape{}% + \def\tikzexternalcheckshellescape{}% \fi \newif\iftikzexternal@auto@detect@jobname \pgfqkeys{/tikz/external}{ - figure list/.is if=tikzexternal@genfigurelist, - aux in dpth/.style={/pgf/images/aux in dpth=#1},% - disable dependency files/.code={% - \let\tikzexternalfiledependsonfile@ACTIVE=\tikzexternalfiledependsonfile - }, - % 'mode' applies only if \jobname==real job name. - mode/.is choice, - mode/only graphics/.code = {% - \def\tikzexternal@opmode{0}% - \pgfkeysalso{/pgf/images/aux in dpth=true}% - }, - mode/no graphics/.code = {\def\tikzexternal@opmode{1}}, - % an alias for 'no graphics:' - mode/only pictures/.code = {\def\tikzexternal@opmode{1}}, - mode/graphics if exists/.code= {% - \def\tikzexternal@opmode{2}% - \pgfkeysalso{/pgf/images/aux in dpth=true}% - }, - mode/list only/.code = {\def\tikzexternal@opmode{3}\tikzexternal@genfigurelisttrue}, - mode/convert with system call/.code={% - \def\tikzexternal@opmode{4}% - \pgfkeysalso{/tikz/external/figure list=false,/pgf/images/aux in dpth=true}% - }, - mode/list and make/.code = {% - \def\tikzexternal@opmode{5}% - \pgfkeysalso{/tikz/external/figure list=true,/pgf/images/aux in dpth=true}% - }, - mode=convert with system call, - force remake/.is if=tikzexternal@force@remake, - force remake/.default=true, - % - % DEPRECATED: this here will work out-of-the box (provided that - % 'aux in dpth' is active): - failed ref warnings for/.initial={\ref,\cite,\pageref}, - export next/.is if=tikzexternalexportnext, - export/.is if=tikzexternal@export@enabled, - remake next/.is if=tikzexternalremakenext, - remake next/.default=true, - verbose IO/.is if=tikzexternal@verboseio, - verbose IO/.default=true, - verbose IO=true, - verbose optimize/.is if=tikzexternal@verbose@optimize, - verbose up to date/.is if=tikzexternal@verboseuptodate, - verbose/.style={ - verbose IO=#1, - verbose optimize=#1, - verbose up to date=#1, - }, - shell escape/.initial=-shell-escape, - read main aux/.is if=pgfexternalreadmainaux, - image discarded text/.initial={% - [[ \textsc{Image Discarded Due To} \texttt{`/tikz/external/% - \ifcase\tikzexternal@opmode\relax - mode=only graphics% - \or - mode=no graphics% - \or - mode=graphics if exists% - \or - mode=list only% - \or - mode=convert with system call% - \or - mode=list and make% - \fi - '}~]]% - \pgfutil@ifundefined{tikzexternal@warning@at@end}{% - \pgfutil@ifundefined{AtEndDocument}{}{% - \AtEndDocument{% - \message{! Package tikz Warning: Some images are not up-to-date and need to be generated. }% - }% - }% - \gdef\tikzexternal@warning@at@end{1}% - }{}% - }, - optimize/.is choice, - optimize/true/.code={% - \tikzexternal@optimizetrue - \iftikzexternal@optimize - \ifpgf@external@grabshipout - % we have already started the externalization! Install - % optimization commands to activate the new one: - \tikzexternal@optimize@REPLACE - \fi - \fi - }, - optimize/false/.code={% - \tikzexternal@optimizefalse% - \tikzexternal@optimize@RESTORE - },% - optimize=true, - optimize away text/.code={[ \textsc{\string#1\ optimized away because it does not contribute to exported PDF}]}, - optimize/install/.code={},% - optimize/restore/.code={},% - % Expects two arguments, the command name and (optionally) a count - % of expected arguments. - % Example: - % 'optimize command away=\includegraphics' - % 'optimize command away={\mycommand}{3}' - % - % It accepts commands which have '[]' arguments and whose first - % argument always begins with '{'. - % - % #1: the command name - % #2: either empty or a number of EXPECTED arguments. It will be checked - % for one optional argument in square brackets as well. - optimize command away/.code 2 args={% - \expandafter\global\expandafter\let\csname\string#1@ORIG\endcsname=#1% - \pgfkeysalso{% - /tikz/external/optimize/install/.append code={% - \def#1{\tikzexternal@optimize@away@cmd{#1}{#2}}% - }, - /tikz/external/optimize/restore/.append code={% - \expandafter\let\expandafter#1\csname\string#1@ORIG\endcsname - } - }% - \iftikzexternal@optimize - \ifpgf@external@grabshipout - % we have already started the externalization! Install - % optimization commands to activate the new one: - \tikzexternal@optimize@REPLACE - \fi - \fi - }, - optimize command away=\includegraphics, - optimize command away=\pgfincludeexternalgraphics, - % EXPERIMENTAL (UNTESTED): - optimize latex env away/.code={% - \expandafter\let\expandafter\pgf@tempa\csname #1\endcsname - \expandafter\global\expandafter\let\csname #1@ORIG\endcsname=\pgf@tempa% - \pgfkeysalso{% - /tikz/external/optimize/install/.append code={% - \pgfutil@namedef{#1}{\tikzexternal@optimize@away@latex@env{#1}}% - }, - /tikz/external/optimize/restore/.append code={% - \pgfutil@namelet{#1}{#1@ORIG}% - }% - }% - }, - only named/.is if=tikzexternal@onlynamed, - only named/.default=true, - figure name/.initial=\tikzexternal@realjob-figure, - reset counter/.code={% - \expandafter\gdef\csname c@tikzext@no@#1\endcsname{0}% - },% - prefix/.code={\tikzsetexternalprefix{#1}}, - up to date check/.is choice, - up to date check/simple/.code={\def\tikzexternal@uptodate@mode{0}}, - % md5 relies on \pdfmdfivesum of pdftex. It uses 'diff' as fallback if we do not have that command. - up to date check/md5/.code={\def\tikzexternal@uptodate@mode{1}}, - up to date check/diff/.code={\def\tikzexternal@uptodate@mode{2}}, - up to date check=md5, + figure list/.is if=tikzexternal@genfigurelist, + aux in dpth/.style={/pgf/images/aux in dpth=#1},% + disable dependency files/.code={% + \let\tikzexternalfiledependsonfile@ACTIVE=\tikzexternalfiledependsonfile + }, + % 'mode' applies only if \jobname==real job name. + mode/.is choice, + mode/only graphics/.code = {% + \def\tikzexternal@opmode{0}% + \pgfkeysalso{/pgf/images/aux in dpth=true}% + }, + mode/no graphics/.code = {\def\tikzexternal@opmode{1}}, + % an alias for 'no graphics:' + mode/only pictures/.code = {\def\tikzexternal@opmode{1}}, + mode/graphics if exists/.code= {% + \def\tikzexternal@opmode{2}% + \pgfkeysalso{/pgf/images/aux in dpth=true}% + }, + mode/list only/.code = {\def\tikzexternal@opmode{3}\tikzexternal@genfigurelisttrue}, + mode/convert with system call/.code={% + \def\tikzexternal@opmode{4}% + \pgfkeysalso{/tikz/external/figure list=false,/pgf/images/aux in dpth=true}% + }, + mode/list and make/.code = {% + \def\tikzexternal@opmode{5}% + \pgfkeysalso{/tikz/external/figure list=true,/pgf/images/aux in dpth=true}% + }, + mode=convert with system call, + force remake/.is if=tikzexternal@force@remake, + force remake/.default=true, + % + % DEPRECATED: this here will work out-of-the box (provided that + % 'aux in dpth' is active): + failed ref warnings for/.initial={\ref,\cite,\pageref}, + export next/.is if=tikzexternalexportnext, + export/.is if=tikzexternal@export@enabled, + remake next/.is if=tikzexternalremakenext, + remake next/.default=true, + verbose IO/.is if=tikzexternal@verboseio, + verbose IO/.default=true, + verbose IO=true, + verbose optimize/.is if=tikzexternal@verbose@optimize, + verbose up to date/.is if=tikzexternal@verboseuptodate, + verbose/.style={ + verbose IO=#1, + verbose optimize=#1, + verbose up to date=#1, + }, + shell escape/.initial=-shell-escape, + read main aux/.is if=pgfexternalreadmainaux, + image discarded text/.initial={% + [[ \textsc{Image Discarded Due To} \texttt{`/tikz/external/% + \ifcase\tikzexternal@opmode\relax + mode=only graphics% + \or + mode=no graphics% + \or + mode=graphics if exists% + \or + mode=list only% + \or + mode=convert with system call% + \or + mode=list and make% + \fi + '}~]]% + \pgfutil@ifundefined{tikzexternal@warning@at@end}{% + \pgfutil@ifundefined{AtEndDocument}{}{% + \AtEndDocument{% + \message{! Package tikz Warning: Some images are not up-to-date and need to be generated. }% + }% + }% + \gdef\tikzexternal@warning@at@end{1}% + }{}% + }, + optimize/.is choice, + optimize/true/.code={% + \tikzexternal@optimizetrue + \iftikzexternal@optimize + \ifpgf@external@grabshipout + % we have already started the externalization! Install + % optimization commands to activate the new one: + \tikzexternal@optimize@REPLACE + \fi + \fi + }, + optimize/false/.code={% + \tikzexternal@optimizefalse% + \tikzexternal@optimize@RESTORE + },% + optimize=true, + optimize away text/.code={[ \textsc{\string#1\ optimized away because it does not contribute to exported PDF}]}, + optimize/install/.code={},% + optimize/restore/.code={},% + % Expects two arguments, the command name and (optionally) a count + % of expected arguments. + % Example: + % 'optimize command away=\includegraphics' + % 'optimize command away={\mycommand}{3}' + % + % It accepts commands which have '[]' arguments and whose first + % argument always begins with '{'. + % + % #1: the command name + % #2: either empty or a number of EXPECTED arguments. It will be checked + % for one optional argument in square brackets as well. + optimize command away/.code 2 args={% + \expandafter\global\expandafter\let\csname\string#1@ORIG\endcsname=#1% + \pgfkeysalso{% + /tikz/external/optimize/install/.append code={% + \def#1{\tikzexternal@optimize@away@cmd{#1}{#2}}% + }, + /tikz/external/optimize/restore/.append code={% + \expandafter\let\expandafter#1\csname\string#1@ORIG\endcsname + } + }% + \iftikzexternal@optimize + \ifpgf@external@grabshipout + % we have already started the externalization! Install + % optimization commands to activate the new one: + \tikzexternal@optimize@REPLACE + \fi + \fi + }, + optimize command away=\includegraphics, + optimize command away=\pgfincludeexternalgraphics, + % EXPERIMENTAL (UNTESTED): + optimize latex env away/.code={% + \expandafter\let\expandafter\pgf@tempa\csname #1\endcsname + \expandafter\global\expandafter\let\csname #1@ORIG\endcsname=\pgf@tempa% + \pgfkeysalso{% + /tikz/external/optimize/install/.append code={% + \pgfutil@namedef{#1}{\tikzexternal@optimize@away@latex@env{#1}}% + }, + /tikz/external/optimize/restore/.append code={% + \pgfutil@namelet{#1}{#1@ORIG}% + }% + }% + }, + only named/.is if=tikzexternal@onlynamed, + only named/.default=true, + figure name/.initial=\tikzexternal@realjob-figure, + reset counter/.code={% + \expandafter\gdef\csname c@tikzext@no@#1\endcsname{0}% + },% + prefix/.code={\tikzsetexternalprefix{#1}}, + up to date check/.is choice, + up to date check/simple/.code={\def\tikzexternal@uptodate@mode{0}}, + % md5 relies on \pdfmdfivesum of pdftex. It uses 'diff' as fallback if we do not have that command. + up to date check/md5/.code={\def\tikzexternal@uptodate@mode{1}}, + up to date check/diff/.code={\def\tikzexternal@uptodate@mode{2}}, + up to date check=md5, } \expandafter\def\csname tikzexternal@driver@pgfsys-luatex.def\endcsname{% - \pgfkeyssetvalue{/tikz/external/system call}{% - lualatex \tikzexternalcheckshellescape -halt-on-error -interaction=batchmode -jobname "\image" "\texsource"% - }% + \pgfkeyssetvalue{/tikz/external/system call}{% + lualatex \tikzexternalcheckshellescape -halt-on-error -interaction=batchmode -jobname "\image" "\texsource"% + }% }% \expandafter\def\csname tikzexternal@driver@pgfsys-pdftex.def\endcsname{% - \pgfutil@IfUndefined{directlua}{% - \pgfkeyssetvalue{/tikz/external/system call}{% - pdflatex \tikzexternalcheckshellescape -halt-on-error -interaction=batchmode -jobname "\image" "\texsource"% - }% - }{% - \pgfkeyssetvalue{/tikz/external/system call}{% - lualatex \tikzexternalcheckshellescape -halt-on-error -interaction=batchmode -jobname "\image" "\texsource"% - }% - }% + \pgfutil@IfUndefined{directlua}{% + \pgfkeyssetvalue{/tikz/external/system call}{% + pdflatex \tikzexternalcheckshellescape -halt-on-error -interaction=batchmode -jobname "\image" "\texsource"% + }% + }{% + \pgfkeyssetvalue{/tikz/external/system call}{% + lualatex \tikzexternalcheckshellescape -halt-on-error -interaction=batchmode -jobname "\image" "\texsource"% + }% + }% }% %-------------------------------------------------- % \expandafter\def\csname tikzexternal@driver@pgfsys-dvipdfm.def\endcsname{% -% \pgfkeyssetvalue{/tikz/external/system call}{% -% latex \tikzexternalcheckshellescape -halt-on-error -interaction=batchmode -jobname "\image" "\texsource"% -% && dvipdfm "\image".dvi % -% }% +% \pgfkeyssetvalue{/tikz/external/system call}{% +% latex \tikzexternalcheckshellescape -halt-on-error -interaction=batchmode -jobname "\image" "\texsource"% +% && dvipdfm "\image".dvi % +% }% % }% -%-------------------------------------------------- +%-------------------------------------------------- \expandafter\def\csname tikzexternal@driver@pgfsys-xetex.def\endcsname{% - \pgfkeyssetvalue{/tikz/external/system call}{% - xelatex \tikzexternalcheckshellescape -halt-on-error -interaction=batchmode -jobname "\image" "\texsource"% - }% + \pgfkeyssetvalue{/tikz/external/system call}{% + xelatex \tikzexternalcheckshellescape -halt-on-error -interaction=batchmode -jobname "\image" "\texsource"% + }% }% \expandafter\def\csname tikzexternal@driver@pgfsys-dvips.def\endcsname{% - \pgfkeyssetvalue{/tikz/external/system call}{% - latex \tikzexternalcheckshellescape -halt-on-error -interaction=batchmode -jobname "\image" "\texsource" % - && dvips -o "\image".ps "\image".dvi % - }% + \pgfkeyssetvalue{/tikz/external/system call}{% + latex \tikzexternalcheckshellescape -halt-on-error -interaction=batchmode -jobname "\image" "\texsource" % + && dvips -o "\image".ps "\image".dvi % + }% }% % Auto-select a suitable default value fo 'system call': \pgfutil@ifundefined{tikzexternal@driver@\pgfsysdriver}{% - % fallback. We do not know the driver here. - \csname tikzexternal@driver@pgfsys-pdftex.def\endcsname + % fallback. We do not know the driver here. + \csname tikzexternal@driver@pgfsys-pdftex.def\endcsname }{% - \csname tikzexternal@driver@\pgfsysdriver\endcsname + \csname tikzexternal@driver@\pgfsysdriver\endcsname }% @@ -329,7 +329,7 @@ \tikzsetexternalprefix{} % This method initialises automatic externalization. -% +% % The command does need any argument, but it has two optional ones: % % 1. \tikzexternalize[<options>] @@ -348,67 +348,67 @@ % 2. in case that the job's real name and the current \jobname differ, % it will process ONLY the matching tikzpicture. \def\tikzexternalize{% - \pgfutil@ifnextchar[{% - \tikzexternalize@opt - }{% - \tikzexternalize@opt[]% - }% + \pgfutil@ifnextchar[{% + \tikzexternalize@opt + }{% + \tikzexternalize@opt[]% + }% }% \def\tikzexternalize@opt[#1]{% - \pgfutil@ifnextchar\bgroup{% - \tikzexternal@auto@detect@jobnamefalse - \tikzexternalize@opt@withname[#1]% - }{% - \tikzexternal@auto@detect@jobnametrue - \pgfutil@ifundefined{tikzexternalrealjob}{% - % ok, \tikzexternalrealjob is not known. - % Assume we are currently *not* externalizing. - \let\tikzexternalrealjob=\jobname - }{}% - \def\pgf@tempa{\tikzexternalize@opt@withname[#1]}% - \expandafter\pgf@tempa\expandafter{\tikzexternalrealjob}% - }% + \pgfutil@ifnextchar\bgroup{% + \tikzexternal@auto@detect@jobnamefalse + \tikzexternalize@opt@withname[#1]% + }{% + \tikzexternal@auto@detect@jobnametrue + \pgfutil@ifundefined{tikzexternalrealjob}{% + % ok, \tikzexternalrealjob is not known. + % Assume we are currently *not* externalizing. + \let\tikzexternalrealjob=\jobname + }{}% + \def\pgf@tempa{\tikzexternalize@opt@withname[#1]}% + \expandafter\pgf@tempa\expandafter{\tikzexternalrealjob}% + }% }% \def\tikzexternalize@opt@withname[#1]#2{% - \gdef\tikzexternalrealjob{#2}% - \if1\tikzexternalize@hasbeencalled - \else - \pgfqkeys{/tikz/external}{#1}% - \def\tikzexternal@realjob{#2}% - \tikzexternalauxlock@init - \pgfrealjobname{#2}% - \def\tikzexternalize@hasbeencalled{1}% - \tikzexternalenable - \def\tikzexternal@determineimgextension##1:##2\relax{\gdef\tikzexternalimgextension{##1}}% - \xdef\pgf@tempa{\pgfsys@imagesuffixlist}% - \expandafter\tikzexternal@determineimgextension\pgf@tempa:\relax - \pgfutil@ifundefined{includegraphics}{% - \let\tikzexternal@orig@includegraphics=\relax - }{% - \let\tikzexternal@orig@includegraphics=\includegraphics - }% - \let\tikzexternalfiledependsonfile=\tikzexternalfiledependsonfile@ACTIVE - \let\tikzpicturedependsonfile=\tikzpicturedependsonfile@ACTIVE - \fi + \gdef\tikzexternalrealjob{#2}% + \if1\tikzexternalize@hasbeencalled + \else + \pgfqkeys{/tikz/external}{#1}% + \def\tikzexternal@realjob{#2}% + \tikzexternalauxlock@init + \pgfrealjobname{#2}% + \def\tikzexternalize@hasbeencalled{1}% + \tikzexternalenable + \def\tikzexternal@determineimgextension##1:##2\relax{\gdef\tikzexternalimgextension{##1}}% + \xdef\pgf@tempa{\pgfsys@imagesuffixlist}% + \expandafter\tikzexternal@determineimgextension\pgf@tempa:\relax + \pgfutil@ifundefined{includegraphics}{% + \let\tikzexternal@orig@includegraphics=\relax + }{% + \let\tikzexternal@orig@includegraphics=\includegraphics + }% + \let\tikzexternalfiledependsonfile=\tikzexternalfiledependsonfile@ACTIVE + \let\tikzpicturedependsonfile=\tikzpicturedependsonfile@ACTIVE + \fi } \def\tikzexternalize@hasbeencalled{0}% \def\tikzifexternalizehasbeencalled#1#2{% - \if1\tikzexternalize@hasbeencalled - #1% - \else - #2% - \fi + \if1\tikzexternalize@hasbeencalled + #1% + \else + #2% + \fi }% -% If mode=`convert with system call', the boolean \ifpgfexternalreadmainaux +% If mode=`convert with system call', the boolean \ifpgfexternalreadmainaux % will be set depending on the current lock file. % % The idea is as follows: Suppose -% pdflatex -shell-escape mainjob.tex +% pdflatex -shell-escape mainjob.tex % is running. -% -% While it runs, +% +% While it runs, % a) it modifies its mainjob.aux file, % b) it issues pdflatex -jobname mainjob-figure0 mainjob.tex . % @@ -418,7 +418,7 @@ % avoid such failure, a locking mechanism is established. % % The locking mechanisms causes (a) to write a lock command into -% mainjob.auxlock +% mainjob.auxlock % just before (b) is called. Then, (b) will check it. After (b) has % completed, the lock will be reset. % @@ -437,66 +437,66 @@ % anything. Otherwise, it will be changed depending for 'mode=convert % with system call' if necessary. \def\tikzexternalauxlock@init{% - \if4\tikzexternal@opmode - % mode=convert with system call - \ifpgfexternalreadmainaux - % ohoh. This case needs care because the main.aux might - % not be ready at this time! - % check. - % - \edef\pgf@tempa{\expandafter\string\csname\tikzexternal@realjob\endcsname}% - \edef\pgf@tempb{\expandafter\string\csname\jobname\endcsname}% - \ifx\pgf@tempa\pgf@tempb - % we are *not* externalizing. Set lock into its - % initial "unlocked" state. - \tikzexternalauxlock@setlock{0}% - \else - % we are externalizing. Query the lock's value: - \tikzexternalauxlock@getlockvalue - \if1\tikzexternallocked - \pgfexternalreadmainauxfalse - % the main .aux file won't be read right now. - \else - \pgfexternalreadmainauxtrue - \fi - \fi - \else - % NO-OP. We won't read the main aux file anyway. - \def\tikzexternalauxlock@setlock##1{}% - \fi - \fi + \if4\tikzexternal@opmode + % mode=convert with system call + \ifpgfexternalreadmainaux + % ohoh. This case needs care because the main.aux might + % not be ready at this time! + % check. + % + \edef\pgf@tempa{\expandafter\string\csname\tikzexternal@realjob\endcsname}% + \edef\pgf@tempb{\expandafter\string\csname\jobname\endcsname}% + \ifx\pgf@tempa\pgf@tempb + % we are *not* externalizing. Set lock into its + % initial "unlocked" state. + \tikzexternalauxlock@setlock{0}% + \else + % we are externalizing. Query the lock's value: + \tikzexternalauxlock@getlockvalue + \if1\tikzexternallocked + \pgfexternalreadmainauxfalse + % the main .aux file won't be read right now. + \else + \pgfexternalreadmainauxtrue + \fi + \fi + \else + % NO-OP. We won't read the main aux file anyway. + \def\tikzexternalauxlock@setlock##1{}% + \fi + \fi } % defines \tikzexternallocked to be either 0 or 1, depending on the % lock file. \def\tikzexternalauxlock@getlockvalue{% - \openin\r@pgf@reada=\tikzexternal@realjob.auxlock - \ifeof\r@pgf@reada - % no lock file. Unlock. - \def\tikzexternallocked{0}% - \else - % read first line... - \read\r@pgf@reada to\pgf@tempa - % ... and execute it. - \pgf@tempa - % it should contain a definition of \tikzexternallocked. If - % not, lock it anyway. - \pgfutil@ifundefined - {tikzexternallocked} - {\def\tikzexternallocked{1}}% - {}% - \fi - \closein\r@pgf@reada + \openin\r@pgf@reada=\tikzexternal@realjob.auxlock + \ifeof\r@pgf@reada + % no lock file. Unlock. + \def\tikzexternallocked{0}% + \else + % read first line... + \read\r@pgf@reada to\pgf@tempa + % ... and execute it. + \pgf@tempa + % it should contain a definition of \tikzexternallocked. If + % not, lock it anyway. + \pgfutil@ifundefined + {tikzexternallocked} + {\def\tikzexternallocked{1}}% + {}% + \fi + \closein\r@pgf@reada }% \def\tikzexternalauxlock@setlock#1{% - \immediate\openout\w@pgf@writea=\tikzexternal@realjob.auxlock - \immediate\write\w@pgf@writea{\noexpand\def\noexpand\tikzexternallocked{#1}}% - \immediate\closeout\w@pgf@writea + \immediate\openout\w@pgf@writea=\tikzexternal@realjob.auxlock + \immediate\write\w@pgf@writea{\noexpand\def\noexpand\tikzexternallocked{#1}}% + \immediate\closeout\w@pgf@writea } % this is a hook into pgfcoreexternal.code.tex: \def\pgf@external@grab@refundefinedtrue@code{% - \gdef\noexpand\tikzexternal@systemcall@reschedule@to@end@document{1}% + \gdef\noexpand\tikzexternal@systemcall@reschedule@to@end@document{1}% }% % Expands to the default image extension (it is set by @@ -510,54 +510,54 @@ % can be used to (temporarily) disable the externalization. \def\tikzexternaldisable{% - \let\tikz=\tikzexternal@origtikz - \tikzexternal@TEXDIALECT@restore@picture - \pgfutil@ifundefined{tikzexternal@orig@tikzfadingfrompicture} - {}% NOP - {% - \let\tikzfadingfrompicture=\tikzexternal@orig@tikzfadingfrompicture - \let\endtikzfadingfrompicture=\tikzexternal@orig@endtikzfadingfrompicture - \let\tikzfading=\tikzexternal@orig@tikzfading - }% - \iftikzexternal@optimize - \ifpgf@external@grabshipout - \tikzexternal@optimize@RESTORE - \fi - \fi + \let\tikz=\tikzexternal@origtikz + \tikzexternal@TEXDIALECT@restore@picture + \pgfutil@ifundefined{tikzexternal@orig@tikzfadingfrompicture} + {}% NOP + {% + \let\tikzfadingfrompicture=\tikzexternal@orig@tikzfadingfrompicture + \let\endtikzfadingfrompicture=\tikzexternal@orig@endtikzfadingfrompicture + \let\tikzfading=\tikzexternal@orig@tikzfading + }% + \iftikzexternal@optimize + \ifpgf@external@grabshipout + \tikzexternal@optimize@RESTORE + \fi + \fi }% % re-enables externalization after a \tikzexternalizedisable. \def\tikzexternalenable{% - \if\tikzexternalize@hasbeencalled1% - \let\tikz=\tikzexternal@tikz@replacement - \tikzexternal@TEXDIALECT@installreplacement@picture - \pgfutil@ifundefined{tikzfadingfrompicture}% - {}% no special handling for 'fading lib' - {% - % oh, ok -- patch fading lib! - \pgfutil@ifundefined{tikzexternal@orig@tikzfadingfrompicture}{% - \let\tikzexternal@orig@tikzfadingfrompicture=\tikzfadingfrompicture - \let\tikzexternal@orig@endtikzfadingfrompicture=\endtikzfadingfrompicture - \let\tikzexternal@orig@tikzfading=\tikzfading - }{}% - \def\tikzfadingfrompicture{% - \begingroup - \tikzexternaldisable - \tikzexternal@orig@tikzfadingfrompicture}% - \def\endtikzfadingfrompicture{% - \tikzexternal@orig@endtikzfadingfrompicture - \endgroup}% - \def\tikzfading[##1]{% - \begingroup - \tikzexternaldisable - \tikzexternal@orig@tikzfading[##1]% - \endgroup}% - }% - \iftikzexternal@optimize - \ifpgf@external@grabshipout - \tikzexternal@optimize@REPLACE - \fi - \fi - \fi + \if\tikzexternalize@hasbeencalled1% + \let\tikz=\tikzexternal@tikz@replacement + \tikzexternal@TEXDIALECT@installreplacement@picture + \pgfutil@ifundefined{tikzfadingfrompicture}% + {}% no special handling for 'fading lib' + {% + % oh, ok -- patch fading lib! + \pgfutil@ifundefined{tikzexternal@orig@tikzfadingfrompicture}{% + \let\tikzexternal@orig@tikzfadingfrompicture=\tikzfadingfrompicture + \let\tikzexternal@orig@endtikzfadingfrompicture=\endtikzfadingfrompicture + \let\tikzexternal@orig@tikzfading=\tikzfading + }{}% + \def\tikzfadingfrompicture{% + \begingroup + \tikzexternaldisable + \tikzexternal@orig@tikzfadingfrompicture}% + \def\endtikzfadingfrompicture{% + \tikzexternal@orig@endtikzfadingfrompicture + \endgroup}% + \def\tikzfading[##1]{% + \begingroup + \tikzexternaldisable + \tikzexternal@orig@tikzfading[##1]% + \endgroup}% + }% + \iftikzexternal@optimize + \ifpgf@external@grabshipout + \tikzexternal@optimize@REPLACE + \fi + \fi + \fi }% % Sets the filename for the next tikzpicture or \tikz shortcommand. @@ -572,34 +572,34 @@ \tikzsetnextfilename{} -% These are few TeX dialect-specific commands which need to be overridden when used with +% These are few TeX dialect-specific commands which need to be overriden when used with % something different than plain TeX: % % 1. this command collects a complete image into a macro, up to (but not including) the % final TeX-dialect specific end-image command. % This is really difficult for LaTeX because \end{tikzpicture} either involves dirty % catcode-hacks to parse the braces or an ugly loop which loops until it -% finds \end followed by {tikzpicture}. -% +% finds \end followed by {tikzpicture}. +% % #1: a macro which will be called with the collected environment contents. % all following tokens: the environment contents. \long\gdef\tikzexternal@TEXDIALECT@collectpicture#1#2\endtikzpicture{#1{#2}} % % 2. the following commands should expand to the TeX-dialect specific begin and end image command, i.e. -% \tikzpicture / \endtikzpicture -% or -% \begin{tikzpicture} / \end{tikzpicture} -% or -% \starttikzpicture / \stoptikzpicture +% \tikzpicture / \endtikzpicture +% or +% \begin{tikzpicture} / \end{tikzpicture} +% or +% \starttikzpicture / \stoptikzpicture \def\tikzexternal@TEXDIALECT@begpicture{\tikzpicture} \def\tikzexternal@TEXDIALECT@endpicture{\endtikzpicture}% % % 3. This installs the replacement macros: \def\tikzexternal@TEXDIALECT@installreplacement@picture{% - \let\tikzpicture=\tikzexternal@tikzpicture@replacement + \let\tikzpicture=\tikzexternal@tikzpicture@replacement }% \def\tikzexternal@TEXDIALECT@restore@picture{% - \let\tikzpicture=\tikzexternal@origpicture + \let\tikzpicture=\tikzexternal@origpicture }% @@ -617,77 +617,77 @@ % - externalize mode (i.e. jobname != real job name). Then, it will % externalize the picture selected by 'jobname' (and only this picture). \def\tikzexternal@tikzpicture@replacement{% - \leavevmode - \global\tikzexternal@file@isuptodatetrue% may be set to false during checks. - \tikzexternal@getnextfilename\tikzexternal@curfilename - \ifx\tikzexternal@curfilename\pgfutil@empty - \ifpgf@external@grabshipout - % This picture won't be externalized. - % But maybe we can optimize it away: - \iftikzexternal@optimize - % -> it won't be shipped out anyway, so save typesetting time! - \let\tikzexternal@next=\tikzexternal@skipfigure - \else - % include this graphics into the output (even if - % it will be discarded anyway). - \let\tikzexternal@next=\tikzexternal@normalpicture@nographics - \fi - \else - \let\tikzexternal@next=\tikzexternal@normalpicture@nographics - \fi - \else - \ifpgf@external@grabshipout - \tikzifexternaljobnamematches\tikzexternal@curfilename{% - % ok, this here IS the picture for which - % pdflatex --jobname <my name> - % has been invoked. - \let\tikzexternal@next=\tikzexternal@externalizefig - }{% - \iftikzexternal@optimize - % No, another picture should be exported. Simply skip this one - % -> it won't be shipped out anyway, so save typesetting time! - \let\tikzexternal@next=\tikzexternal@skipfigure - \else - % include this graphics into the output (even it - % it will be discarded anyway). - \let\tikzexternal@next=\tikzexternal@normalpicture@nographics - \fi - }% - \else - \ifcase\tikzexternal@opmode\relax - % 'mode=only graphics' - \let\tikzexternal@next=\tikzexternal@forcegraphics - \or - % 'mode=no graphics' - \let\tikzexternal@next=\tikzexternal@normalpicture@nographics - \or - % 'mode=graphics if exists' - \let\tikzexternal@next=\tikzexternal@externalizefig - \or - % 'mode=list only' - \let\tikzexternal@next=\tikzexternal@listmodepicture - \or - % 'mode=convert with system call' - \let\tikzexternal@next=\tikzexternal@externalizefig@systemcall - \or - % 'mode=list and make' - \let\tikzexternal@next=\tikzexternal@list@and@makefile@mode@picture - \fi - \fi - \fi - \tikzexternal@next + \leavevmode + \global\tikzexternal@file@isuptodatetrue% may be set to false during checks. + \tikzexternal@getnextfilename\tikzexternal@curfilename + \ifx\tikzexternal@curfilename\pgfutil@empty + \ifpgf@external@grabshipout + % This picture won't be externalized. + % But maybe we can optimize it away: + \iftikzexternal@optimize + % -> it won't be shipped out anyway, so save typesetting time! + \let\tikzexternal@next=\tikzexternal@skipfigure + \else + % include this graphics into the output (even if + % it will be discarded anyway). + \let\tikzexternal@next=\tikzexternal@normalpicture@nographics + \fi + \else + \let\tikzexternal@next=\tikzexternal@normalpicture@nographics + \fi + \else + \ifpgf@external@grabshipout + \tikzifexternaljobnamematches\tikzexternal@curfilename{% + % ok, this here IS the picture for which + % pdflatex --jobname <my name> + % has been invoked. + \let\tikzexternal@next=\tikzexternal@externalizefig + }{% + \iftikzexternal@optimize + % No, another picture should be exported. Simply skip this one + % -> it won't be shipped out anyway, so save typesetting time! + \let\tikzexternal@next=\tikzexternal@skipfigure + \else + % include this graphics into the output (even it + % it will be discarded anyway). + \let\tikzexternal@next=\tikzexternal@normalpicture@nographics + \fi + }% + \else + \ifcase\tikzexternal@opmode\relax + % 'mode=only graphics' + \let\tikzexternal@next=\tikzexternal@forcegraphics + \or + % 'mode=no graphics' + \let\tikzexternal@next=\tikzexternal@normalpicture@nographics + \or + % 'mode=graphics if exists' + \let\tikzexternal@next=\tikzexternal@externalizefig + \or + % 'mode=list only' + \let\tikzexternal@next=\tikzexternal@listmodepicture + \or + % 'mode=convert with system call' + \let\tikzexternal@next=\tikzexternal@externalizefig@systemcall + \or + % 'mode=list and make' + \let\tikzexternal@next=\tikzexternal@list@and@makefile@mode@picture + \fi + \fi + \fi + \tikzexternal@next }% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Replacement for \tikz short command: \def\tikzexternal@tikz@replacement{% - \pgfutil@ifnextchar[{\tikzexternal@tikz@replacement@opt}{\tikzexternal@tikz@replacement@opt[]}% + \pgfutil@ifnextchar[{\tikzexternal@tikz@replacement@opt}{\tikzexternal@tikz@replacement@opt[]}% }% \def\tikzexternal@tikz@replacement@opt[#1]{% - \pgfutil@ifnextchar\bgroup{\tikzexternal@tikz@replacement@opt@{#1}}{\tikzexternal@tikz@replacement@opt@@{#1}}% + \pgfutil@ifnextchar\bgroup{\tikzexternal@tikz@replacement@opt@{#1}}{\tikzexternal@tikz@replacement@opt@@{#1}}% } \long\def\tikzexternal@tikz@replacement@opt@#1#2{% - \tikzexternal@tikz@replacement@opt@process{#1}{#2}% + \tikzexternal@tikz@replacement@opt@process{#1}{#2}% }% \def\tikzexternal@tikz@replacement@opt@@#1{% \def\tikz@next{\tikzexternal@tikz@replacement@collectnormalsemicolon{#1}}% @@ -696,41 +696,41 @@ \fi% \tikz@next} \long\def\tikzexternal@tikz@replacement@collectnormalsemicolon#1#2;{% - \tikzexternal@tikz@replacement@opt@process{#1}{#2;}% + \tikzexternal@tikz@replacement@opt@process{#1}{#2;}% }% { \catcode`\;=\active \long\gdef\tikzexternal@tikz@replacement@collectactivesemicolon#1#2;{% - \tikzexternal@tikz@replacement@opt@process{#1}{#2;}% + \tikzexternal@tikz@replacement@opt@process{#1}{#2;}% } } \long\def\tikzexternal@tikz@replacement@opt@process#1#2{% - \begingroup - \t@tikzexternal@tmpa=\expandafter{\tikzexternal@TEXDIALECT@begpicture[#1]#2}% - \t@tikzexternal@tmpb=\expandafter{\tikzexternal@TEXDIALECT@endpicture}% - \xdef\pgf@tempa{\the\t@tikzexternal@tmpa\the\t@tikzexternal@tmpb}% - \endgroup - \pgf@tempa + \begingroup + \t@tikzexternal@tmpa=\expandafter{\tikzexternal@TEXDIALECT@begpicture[#1]#2}% + \t@tikzexternal@tmpb=\expandafter{\tikzexternal@TEXDIALECT@endpicture}% + \xdef\pgf@tempa{\the\t@tikzexternal@tmpa\the\t@tikzexternal@tmpb}% + \endgroup + \pgf@tempa } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \def\tikzexternal@getnextfilename@advancecount{% - \begingroup - \c@pgf@counta=\csname c@tikzext@no@\tikzexternal@figurename\endcsname\relax - \advance\c@pgf@counta by1 - \expandafter\xdef\csname c@tikzext@no@\tikzexternal@figurename\endcsname{\the\c@pgf@counta}% - \endgroup + \begingroup + \c@pgf@counta=\csname c@tikzext@no@\tikzexternal@figurename\endcsname\relax + \advance\c@pgf@counta by1 + \expandafter\xdef\csname c@tikzext@no@\tikzexternal@figurename\endcsname{\the\c@pgf@counta}% + \endgroup }% % Returns the file name which will be used for the next tikzpicture (based on the currently available information only, of course). \def\tikzexternalgetnextfilename#1{% - \begingroup - \let\tikzexternal@getnextfilename@advancecount\relax% NOP - \let\tikzexternal@getnextfilename@resetglobals=\relax% NOP - \def\tikzexternal@protocol@to@file##1{}% NOP - \tikzexternal@getnextfilename#1% - \pgfmath@smuggleone#1% - \endgroup + \begingroup + \let\tikzexternal@getnextfilename@advancecount\relax% NOP + \let\tikzexternal@getnextfilename@resetglobals=\relax% NOP + \def\tikzexternal@protocol@to@file##1{}% NOP + \tikzexternal@getnextfilename#1% + \pgfmath@smuggleone#1% + \endgroup }% % Returns the file name of the current picture. @@ -740,13 +740,13 @@ % #1 the macro which will contain the file name. % @see \tikzexternalgetnextfilename \def\tikzexternalgetcurrentfilename#1{% - \ifx\tikzexternal@curfilename\relax - % we are outside of a picture. - \let#1=\pgfutil@empty - \else - % we are inside of a picture. - \let#1=\tikzexternal@curfilename - \fi + \ifx\tikzexternal@curfilename\relax + % we are outside of a picture. + \let#1=\pgfutil@empty + \else + % we are inside of a picture. + \let#1=\tikzexternal@curfilename + \fi } % Fills #1 with a filename for the current picture. @@ -762,152 +762,152 @@ % Please note that both, \tikzsetnextfilename and \tikzexternalexportnextfalse % affect only ONE picture. They will be reset afterwards. \def\tikzexternal@getnextfilename#1{% - \let#1=\pgfutil@empty - % determine next file name: - \iftikzexternal@export@enabled - \iftikzexternalexportnext - \begingroup - \t@tikzexternal@tmpa=\expandafter{\tikzexternal@filenameprefix}% - \ifx\tikzexternal@nextfile\pgfutil@empty - \iftikzexternal@onlynamed - \xdef\pgf@tempa{}% - \else - \pgfkeysgetvalue{/tikz/external/figure name}\tikzexternal@figurename - \pgfutil@ifundefined{c@tikzext@no@\tikzexternal@figurename}{% - % initialise on first usage: - \expandafter\gdef\csname c@tikzext@no@\tikzexternal@figurename\endcsname{0}% - }{}% - \t@tikzexternal@tmpb=\expandafter{\tikzexternal@figurename}% - \xdef\pgf@tempa{\the\t@tikzexternal@tmpa\the\t@tikzexternal@tmpb\csname c@tikzext@no@\tikzexternal@figurename\endcsname}% - % advance the counter for 'figure name': - \tikzexternal@getnextfilename@advancecount - \fi - \else - \t@tikzexternal@tmpb=\expandafter{\tikzexternal@nextfile}% - \xdef\pgf@tempa{\the\t@tikzexternal@tmpa\the\t@tikzexternal@tmpb}% - \fi - \endgroup - \let#1=\pgf@tempa - \fi - \fi - % - \tikzexternal@getnextfilename@resetglobals% - % - \tikzexternal@protocol@to@file#1% + \let#1=\pgfutil@empty + % determine next file name: + \iftikzexternal@export@enabled + \iftikzexternalexportnext + \begingroup + \t@tikzexternal@tmpa=\expandafter{\tikzexternal@filenameprefix}% + \ifx\tikzexternal@nextfile\pgfutil@empty + \iftikzexternal@onlynamed + \xdef\pgf@tempa{}% + \else + \pgfkeysgetvalue{/tikz/external/figure name}\tikzexternal@figurename + \pgfutil@ifundefined{c@tikzext@no@\tikzexternal@figurename}{% + % initialise on first usage: + \expandafter\gdef\csname c@tikzext@no@\tikzexternal@figurename\endcsname{0}% + }{}% + \t@tikzexternal@tmpb=\expandafter{\tikzexternal@figurename}% + \xdef\pgf@tempa{\the\t@tikzexternal@tmpa\the\t@tikzexternal@tmpb\csname c@tikzext@no@\tikzexternal@figurename\endcsname}% + % advance the counter for 'figure name': + \tikzexternal@getnextfilename@advancecount + \fi + \else + \t@tikzexternal@tmpb=\expandafter{\tikzexternal@nextfile}% + \xdef\pgf@tempa{\the\t@tikzexternal@tmpa\the\t@tikzexternal@tmpb}% + \fi + \endgroup + \let#1=\pgf@tempa + \fi + \fi + % + \tikzexternal@getnextfilename@resetglobals% + % + \tikzexternal@protocol@to@file#1% }% \def\tikzexternal@getnextfilename@resetglobals{% - % Reset global flags: - \global\let\tikzexternal@nextfile=\pgfutil@empty - \global\tikzexternalexportnexttrue + % Reset global flags: + \global\let\tikzexternal@nextfile=\pgfutil@empty + \global\tikzexternalexportnexttrue }% % #1: the image file name which should be protocolled. (can be a % macro) \def\tikzexternal@protocol@to@file#1{% - \ifpgf@external@grabshipout% - \else - \iftikzexternal@genfigurelist - \edef\tikzexternal@temp{#1}% - \ifx\tikzexternal@temp\pgfutil@empty - \else - \pgfutil@ifundefined{tikzexternal@listmode@openedfile}{% - \message{Opening '\tikzexternal@realjob.figlist' for writing.}% - \begingroup - \globaldefs=1 - % this gets round '\outer\newwrite' in plain TeX: - \csname newwrite\endcsname\tikzexternal@outfile - \endgroup - \immediate\openout\tikzexternal@outfile=\tikzexternal@realjob.figlist\relax - \gdef\tikzexternal@listmode@openedfile{1}% - \if\tikzexternal@opmode5% mode='list and make' - \tikzexternal@list@and@make@prepare - \fi - }{}% - \iftikzexternal@verboseio - \pgf@typeout{Writing '#1' to '\tikzexternal@realjob.figlist'.}% - \fi - \immediate\write\tikzexternal@outfile{#1}% - \if\tikzexternal@opmode5% mode='list and make' - \tikzexternal@list@and@make@gentarget{#1}% - \fi - \fi - \fi - \fi + \ifpgf@external@grabshipout% + \else + \iftikzexternal@genfigurelist + \edef\tikzexternal@temp{#1}% + \ifx\tikzexternal@temp\pgfutil@empty + \else + \pgfutil@ifundefined{tikzexternal@listmode@openedfile}{% + \message{Opening '\tikzexternal@realjob.figlist' for writing.}% + \begingroup + \globaldefs=1 + % this gets round '\outer\newwrite' in plain TeX: + \csname newwrite\endcsname\tikzexternal@outfile + \endgroup + \immediate\openout\tikzexternal@outfile=\tikzexternal@realjob.figlist\relax + \gdef\tikzexternal@listmode@openedfile{1}% + \if\tikzexternal@opmode5% mode='list and make' + \tikzexternal@list@and@make@prepare + \fi + }{}% + \iftikzexternal@verboseio + \pgf@typeout{Writing '#1' to '\tikzexternal@realjob.figlist'.}% + \fi + \immediate\write\tikzexternal@outfile{#1}% + \if\tikzexternal@opmode5% mode='list and make' + \tikzexternal@list@and@make@gentarget{#1}% + \fi + \fi + \fi + \fi }% \def\tikzexternal@list@and@make@gentarget#1{% - \tikzexternal@assemble@systemcall{#1}{\pgf@tempa}% - \def\tikzexternal@tempb{\pgfutilstrreplace{^^J}{^^J\tikzexternal@TABchar}}% - \expandafter\tikzexternal@tempb\expandafter{\pgf@tempa}% - \let\pgf@tempa=\pgfretval - \iftikzexternal@verboseio - \pgf@typeout{Writing '#1' to '\tikzexternal@realjob.makefile'.}% - \fi - \global\tikzexternal@file@isuptodatetrue% only check for force remake: - \tikzexternal@checkforceremake% - \immediate\write\tikzexternal@outmakefile{#1\tikzexternalimgextension: \iftikzexternal@file@isuptodate\else FORCEREMAKE\fi}% - \immediate\write\tikzexternal@outmakefile{\tikzexternal@TABchar\pgf@tempa}% - \immediate\write\tikzexternal@outmakefile{}% + \tikzexternal@assemble@systemcall{#1}{\pgf@tempa}% + \def\tikzexternal@tempb{\pgfutilstrreplace{^^J}{^^J\tikzexternal@TABchar}}% + \expandafter\tikzexternal@tempb\expandafter{\pgf@tempa}% + \let\pgf@tempa=\pgfretval + \iftikzexternal@verboseio + \pgf@typeout{Writing '#1' to '\tikzexternal@realjob.makefile'.}% + \fi + \global\tikzexternal@file@isuptodatetrue% only check for force remake: + \tikzexternal@checkforceremake% + \immediate\write\tikzexternal@outmakefile{#1\tikzexternalimgextension: \iftikzexternal@file@isuptodate\else FORCEREMAKE\fi}% + \immediate\write\tikzexternal@outmakefile{\tikzexternal@TABchar\pgf@tempa}% + \immediate\write\tikzexternal@outmakefile{}% } \def\tikzexternal@list@and@make@prepare{% - \iftikzexternal@verboseio - \pgf@typeout{Opening '\tikzexternal@realjob.makefile' for writing.}% - \fi - \begingroup - % this makes \tikzexternal@outmakefile global: - \globaldefs=1 - % this gets round '\outer\newwrite' in plain TeX: - \csname newwrite\endcsname\tikzexternal@outmakefile - \endgroup - \immediate\openout\tikzexternal@outmakefile=\tikzexternal@realjob.makefile\relax - \immediate\write\tikzexternal@outmakefile{ALL_FIGURE_NAMES=\tikzexternal@DOLLARchar(shell cat \tikzexternal@realjob.figlist)}% - \immediate\write\tikzexternal@outmakefile{ALL_FIGURES=\tikzexternal@DOLLARchar(ALL_FIGURE_NAMES:\tikzexternal@PERCENTchar=\tikzexternal@PERCENTchar\tikzexternalimgextension)}% - \immediate\write\tikzexternal@outmakefile{}% - \immediate\write\tikzexternal@outmakefile{allimages: \tikzexternal@DOLLARchar(ALL_FIGURES)}% - \immediate\write\tikzexternal@outmakefile{\tikzexternal@TABchar @echo All images exist now. Use make -B to re-generate them.}% - \immediate\write\tikzexternal@outmakefile{}% - \immediate\write\tikzexternal@outmakefile{FORCEREMAKE:}% - \immediate\write\tikzexternal@outmakefile{}% - % - % support for .dep files and auto-dependencies: - \immediate\write\tikzexternal@outmakefile{include $(ALL_FIGURE_NAMES:\tikzexternal@PERCENTchar=\tikzexternal@PERCENTchar.\tikzexternaldepext)}% - \immediate\write\tikzexternal@outmakefile{}% - \tikzexternalmakefiledefaultdeprule - \immediate\write\tikzexternal@outmakefile{}% - \tikzexternal@outmakefile@pendingcommands - \pgfutil@ifundefined{AtEndDocument}{}{% - \AtEndDocument{\pgf@typeout{===== mode=`list and make': Use 'make -f \tikzexternal@realjob.makefile' to generate all images. Then, re-run (pdf)latex \tikzexternal@realjob. =====}}% - }% + \iftikzexternal@verboseio + \pgf@typeout{Opening '\tikzexternal@realjob.makefile' for writing.}% + \fi + \begingroup + % this makes \tikzexternal@outmakefile global: + \globaldefs=1 + % this gets round '\outer\newwrite' in plain TeX: + \csname newwrite\endcsname\tikzexternal@outmakefile + \endgroup + \immediate\openout\tikzexternal@outmakefile=\tikzexternal@realjob.makefile\relax + \immediate\write\tikzexternal@outmakefile{ALL_FIGURE_NAMES=\tikzexternal@DOLLARchar(shell cat \tikzexternal@realjob.figlist)}% + \immediate\write\tikzexternal@outmakefile{ALL_FIGURES=\tikzexternal@DOLLARchar(ALL_FIGURE_NAMES:\tikzexternal@PERCENTchar=\tikzexternal@PERCENTchar\tikzexternalimgextension)}% + \immediate\write\tikzexternal@outmakefile{}% + \immediate\write\tikzexternal@outmakefile{allimages: \tikzexternal@DOLLARchar(ALL_FIGURES)}% + \immediate\write\tikzexternal@outmakefile{\tikzexternal@TABchar @echo All images exist now. Use make -B to re-generate them.}% + \immediate\write\tikzexternal@outmakefile{}% + \immediate\write\tikzexternal@outmakefile{FORCEREMAKE:}% + \immediate\write\tikzexternal@outmakefile{}% + % + % support for .dep files and auto-dependencies: + \immediate\write\tikzexternal@outmakefile{include $(ALL_FIGURE_NAMES:\tikzexternal@PERCENTchar=\tikzexternal@PERCENTchar.\tikzexternaldepext)}% + \immediate\write\tikzexternal@outmakefile{}% + \tikzexternalmakefiledefaultdeprule + \immediate\write\tikzexternal@outmakefile{}% + \tikzexternal@outmakefile@pendingcommands + \pgfutil@ifundefined{AtEndDocument}{}{% + \AtEndDocument{\pgf@typeout{===== mode=`list and make': Use 'make -f \tikzexternal@realjob.makefile' to generate all images. Then, re-run (pdf)latex \tikzexternal@realjob. =====}}% + }% }% \def\tikzexternaldepext{dep} \def\tikzexternalmakefiledefaultdeprule{% - \immediate\write\tikzexternal@outmakefile{\tikzexternal@PERCENTchar.\tikzexternaldepext:}% - \immediate\write\tikzexternal@outmakefile{\tikzexternal@TABchar mkdir -p \tikzexternal@normal@dq $(dir $@)\tikzexternal@normal@dq}% - \immediate\write\tikzexternal@outmakefile{\tikzexternal@TABchar touch \tikzexternal@normal@dq $@\tikzexternal@normal@dq\space \tikzexternal@HASHchar\space will be filled later.}% + \immediate\write\tikzexternal@outmakefile{\tikzexternal@PERCENTchar.\tikzexternaldepext:}% + \immediate\write\tikzexternal@outmakefile{\tikzexternal@TABchar mkdir -p \tikzexternal@normal@dq $(dir $@)\tikzexternal@normal@dq}% + \immediate\write\tikzexternal@outmakefile{\tikzexternal@TABchar touch \tikzexternal@normal@dq $@\tikzexternal@normal@dq\space \tikzexternal@HASHchar\space will be filled later.}% }% % Invokes '#1' if a makefile is to be written and '#2' if not. \def\tikzexternalifwritesmakefile#1#2{% - \if5\tikzexternal@opmode #1\else #2\fi + \if5\tikzexternal@opmode #1\else #2\fi }% \def\tikzexternal@outmakefile@pendingcommands{}% % Will write something to the make file. If the makefile is not yet % opened, #1 will be written as soon as it *is* opened. \def\tikzexternalwritetomakefile#1{% - \if\tikzexternal@opmode5% mode='list and make' - \pgfutil@ifundefined{tikzexternal@outmakefile}{% - \expandafter\gdef\expandafter\tikzexternal@outmakefile@pendingcommands\expandafter{% - \tikzexternal@outmakefile@pendingcommands - \immediate\write\tikzexternal@outmakefile{#1}% - }% - }{% - \immediate\write\tikzexternal@outmakefile{#1}% - }% - \fi + \if\tikzexternal@opmode5% mode='list and make' + \pgfutil@ifundefined{tikzexternal@outmakefile}{% + \expandafter\gdef\expandafter\tikzexternal@outmakefile@pendingcommands\expandafter{% + \tikzexternal@outmakefile@pendingcommands + \immediate\write\tikzexternal@outmakefile{#1}% + }% + }{% + \immediate\write\tikzexternal@outmakefile{#1}% + }% + \fi }% \def\tikzexternal@dep@file@name{} @@ -919,23 +919,23 @@ % external graphics for which we are adding a dependency. % #2: a file name. If this file gets changed, #1 shall be remade. % -% This command will be activated as soon as \tikzexternalize has been +% This command will be actived as soons as \tikzexternalize has been % called. \def\tikzexternalfiledependsonfile@ACTIVE#1#2{% - \begingroup - \def\tikzpicturedependsonfile@name{#1}% - \ifx\tikzpicturedependsonfile@name\pgfutil@empty - % could be auto-generated: empty file name means "picture - % won't be externalized". Skip it. - \else - % if we encounter any dependencies while we externalize a - % picture, we have to write these things into the image's .dep - % file. - \tikzifexternalizingcurrent - {\tikzexternalfiledependsonfile@append@to@dep@file{#1}{#2}}% - {\tikzexternalfiledependsonfile@append@to@makefile{#1}{#2}}% - \fi - \endgroup + \begingroup + \def\tikzpicturedependsonfile@name{#1}% + \ifx\tikzpicturedependsonfile@name\pgfutil@empty + % could be auto-generated: empty file name means "picture + % won't be externalized". Skip it. + \else + % if we encounter any dependencies while we externalize a + % picture, we have to write these things into the image's .dep + % file. + \tikzifexternalizingcurrent + {\tikzexternalfiledependsonfile@append@to@dep@file{#1}{#2}}% + {\tikzexternalfiledependsonfile@append@to@makefile{#1}{#2}}% + \fi + \endgroup }% \def\tikzexternalfiledependsonfile#1#2{}% NO-OP until \tikzexternalize has been called. @@ -949,32 +949,32 @@ % Consequently, this here has to be called if and only if #1 is about % to be externalized. \def\tikzexternalfiledependsonfile@append@to@dep@file#1#2{% - % write every dependency which is defined *INSIDE* of the current - % picture into the .dep file of the current picture: - \tikzexternalgetcurrentfilename\tikzpicturedependsonfile@name - \edef\tikzpicturedependsonfile@name{\tikzpicturedependsonfile@name.\tikzexternaldepext}% - %\edef\tikzpicturedependsonfile@name{#1.\tikzexternaldepext}% - \ifx\tikzexternal@dep@file@name\tikzpicturedependsonfile@name - % file is open and ready. - \else - % create new output file. - \pgfutil@ifundefined{tikzexternal@dep@file}{% - \begingroup - % this makes \tikzexternal@dep@file global: - \globaldefs=1 - % this gets round '\outer\newwrite' in plain TeX: - \csname newwrite\endcsname\tikzexternal@dep@file - \endgroup - }{}% - \ifx\tikzexternal@dep@file@name\pgfutil@empty - \else - % it is already open. Close it. - \immediate\closeout\tikzexternal@dep@file - \fi - \global\let\tikzexternal@dep@file@name=\tikzpicturedependsonfile@name - \immediate\openout\tikzexternal@dep@file=\tikzexternal@dep@file@name\relax - \fi - \immediate\write\tikzexternal@dep@file{#1\tikzexternalimgextension: #2}% + % write every dependency which is defined *INSIDE* of the current + % picture into the .dep file of the current picture: + \tikzexternalgetcurrentfilename\tikzpicturedependsonfile@name + \edef\tikzpicturedependsonfile@name{\tikzpicturedependsonfile@name.\tikzexternaldepext}% + %\edef\tikzpicturedependsonfile@name{#1.\tikzexternaldepext}% + \ifx\tikzexternal@dep@file@name\tikzpicturedependsonfile@name + % file is open and ready. + \else + % create new output file. + \pgfutil@ifundefined{tikzexternal@dep@file}{% + \begingroup + % this makes \tikzexternal@dep@file global: + \globaldefs=1 + % this gets round '\outer\newwrite' in plain TeX: + \csname newwrite\endcsname\tikzexternal@dep@file + \endgroup + }{}% + \ifx\tikzexternal@dep@file@name\pgfutil@empty + \else + % it is already open. Close it. + \immediate\closeout\tikzexternal@dep@file + \fi + \global\let\tikzexternal@dep@file@name=\tikzpicturedependsonfile@name + \immediate\openout\tikzexternal@dep@file=\tikzexternal@dep@file@name\relax + \fi + \immediate\write\tikzexternal@dep@file{#1\tikzexternalimgextension: #2}% } % sub-routine of \tikzexternalfiledependsonfile which appends stuff to @@ -985,8 +985,8 @@ % the documentation of % \tikzexternalfiledependsonfile@append@to@dep@file) \def\tikzexternalfiledependsonfile@append@to@makefile#1#2{% - \edef\tikzexternal@temp{#1\tikzexternalimgextension: #2}% - \expandafter\tikzexternalwritetomakefile\expandafter{\tikzexternal@temp}% + \edef\tikzexternal@temp{#1\tikzexternalimgextension: #2}% + \expandafter\tikzexternalwritetomakefile\expandafter{\tikzexternal@temp}% } % Adds a dependency for the NEXT picture which is about to be @@ -996,46 +996,46 @@ % #1: a file name. If this file gets changed, the tikzpicture's % externalized graphics shall be remade. % -% This command will be activated as soon as \tikzexternalize has been +% This command will be actived as soons as \tikzexternalize has been % called. \def\tikzpicturedependsonfile@ACTIVE#1{% - \begingroup - \tikzexternalgetcurrentfilename\tikzpicturedependsonfile@name - \ifx\tikzpicturedependsonfile@name\pgfutil@empty - \tikzexternalgetnextfilename\tikzpicturedependsonfile@name - \fi - \expandafter\tikzexternalfiledependsonfile\expandafter{\tikzpicturedependsonfile@name}{#1}% - \endgroup + \begingroup + \tikzexternalgetcurrentfilename\tikzpicturedependsonfile@name + \ifx\tikzpicturedependsonfile@name\pgfutil@empty + \tikzexternalgetnextfilename\tikzpicturedependsonfile@name + \fi + \expandafter\tikzexternalfiledependsonfile\expandafter{\tikzpicturedependsonfile@name}{#1}% + \endgroup }% \def\tikzpicturedependsonfile#1{}% NO-OP until \tikzexternalize has been called. -% This command is invoked +% This command is invoked % if and only if ( (grab mode && --jobname matches) || 'mode=graphics if exists' ) % % It converts the current tikzpicture into an image in grab mode % or processes the 'graphics if exist' mode. \def\tikzexternal@externalizefig{% - \ifpgf@external@grabshipout% - % In this case, we already KNOW that the filename matches. - \expandafter\tikzexternal@externalizefig@GRAB% - \else - \expandafter\tikzexternal@externalizefig@mode@graphics@if@exists - \fi% + \ifpgf@external@grabshipout% + % In this case, we already KNOW that the filename matches. + \expandafter\tikzexternal@externalizefig@GRAB% + \else + \expandafter\tikzexternal@externalizefig@mode@graphics@if@exists + \fi% } \def\tikzexternal@externalizefig@mode@graphics@if@exists{% - % check if there is already a file. - % In that case, use it. If not, typeset the picture normally. - \gdef\pgf@filename{}% - \xdef\pgf@tempa{\noexpand\pgf@findfile\pgfsys@imagesuffixlist:+{\tikzexternal@curfilename}}% - \pgf@tempa - \ifx\pgf@filename\pgfutil@empty% - % Note: since we have no 'GRAB' mode, we do not have to deal with optimization. - % there is no graphics. - \expandafter\tikzexternal@normalpicture@nographics - \else - \expandafter\tikzexternal@forcegraphics - \fi + % check if there is already a file. + % In that case, use it. If not, typeset the picture normally. + \gdef\pgf@filename{}% + \xdef\pgf@tempa{\noexpand\pgf@findfile\pgfsys@imagesuffixlist:+{\tikzexternal@curfilename}}% + \pgf@tempa + \ifx\pgf@filename\pgfutil@empty% + % Note: since we have no 'GRAB' mode, we do not have to deal with optimization. + % there is no graphics. + \expandafter\tikzexternal@normalpicture@nographics + \else + \expandafter\tikzexternal@forcegraphics + \fi }% @@ -1043,118 +1043,118 @@ % It will be called if GRAB mode is on. % See the 'optimize command away' key. \def\tikzexternal@optimize@away@cmd#1#2{% - \pgfutil@ifnextchar[{% - \tikzexternal@optimize@away@cmd@{#1}{#2}% - }{% - \tikzexternal@optimize@away@cmd@{#1}{#2}[]% - }% + \pgfutil@ifnextchar[{% + \tikzexternal@optimize@away@cmd@{#1}{#2}% + }{% + \tikzexternal@optimize@away@cmd@{#1}{#2}[]% + }% }% \def\tikzexternal@optimize@away@cmd@#1#2[#3]{% - \def\tikz@temp{#2}% - \ifx\tikz@temp\pgfutil@empty - \def\tikz@temp{\tikzexternal@optimize@away@cmd@auto{#1}{#3}}% - \else - \ifcase#2\relax - \def\tikzexternal@optimize@away@cmd@manual{% - \tikzexternal@optimize@away@cmd@@@{#1}{#3}{}% - }% - \or - \def\tikzexternal@optimize@away@cmd@manual##1{% - \tikzexternal@optimize@away@cmd@@@{#1}{#3}{{##1}}% - }% - \or - \def\tikzexternal@optimize@away@cmd@manual##1##2{% - \tikzexternal@optimize@away@cmd@@@{#1}{#3}{{##1}{##2}}% - }% - \or - \def\tikzexternal@optimize@away@cmd@manual##1##2##3{% - \tikzexternal@optimize@away@cmd@@@{#1}{#3}{{##1}{##2}{##3}}% - }% - \or - \def\tikzexternal@optimize@away@cmd@manual##1##2##3##4{% - \tikzexternal@optimize@away@cmd@@@{#1}{#3}{{##1}{##2}{##3}{##4}}% - }% - \or - \def\tikzexternal@optimize@away@cmd@manual##1##2##3##4##5{% - \tikzexternal@optimize@away@cmd@@@{#1}{#3}{{##1}{##2}{##3}{##4}{##5}}% - }% - \or - \def\tikzexternal@optimize@away@cmd@manual##1##2##3##4##5##6{% - \tikzexternal@optimize@away@cmd@@@{#1}{#3}{{##1}{##2}{##3}{##4}{##5}{##6}}% - }% - \or - \def\tikzexternal@optimize@away@cmd@manual##1##2##3##4##5##6##7{% - \tikzexternal@optimize@away@cmd@@@{#1}{#3}{{##1}{##2}{##3}{##4}{##5}{##6}{##7}}% - }% - \or - \def\tikzexternal@optimize@away@cmd@manual##1##2##3##4##5##6##7##8{% - \tikzexternal@optimize@away@cmd@@@{#1}{#3}{{##1}{##2}{##3}{##4}{##5}{##6}{##7}{##8}}% - }% - \or - \def\tikzexternal@optimize@away@cmd@manual##1##2##3##4##5##6##7##8##9{% - \tikzexternal@optimize@away@cmd@@@{#1}{#3}{{##1}{##2}{##3}{##4}{##5}{##6}{##7}{##8}{##9}}% - }% - \fi - \def\tikz@temp{\tikzexternal@optimize@away@cmd@manual}% - \fi - \tikz@temp + \def\tikz@temp{#2}% + \ifx\tikz@temp\pgfutil@empty + \def\tikz@temp{\tikzexternal@optimize@away@cmd@auto{#1}{#3}}% + \else + \ifcase#2\relax + \def\tikzexternal@optimize@away@cmd@manual{% + \tikzexternal@optimize@away@cmd@@@{#1}{#3}{}% + }% + \or + \def\tikzexternal@optimize@away@cmd@manual##1{% + \tikzexternal@optimize@away@cmd@@@{#1}{#3}{{##1}}% + }% + \or + \def\tikzexternal@optimize@away@cmd@manual##1##2{% + \tikzexternal@optimize@away@cmd@@@{#1}{#3}{{##1}{##2}}% + }% + \or + \def\tikzexternal@optimize@away@cmd@manual##1##2##3{% + \tikzexternal@optimize@away@cmd@@@{#1}{#3}{{##1}{##2}{##3}}% + }% + \or + \def\tikzexternal@optimize@away@cmd@manual##1##2##3##4{% + \tikzexternal@optimize@away@cmd@@@{#1}{#3}{{##1}{##2}{##3}{##4}}% + }% + \or + \def\tikzexternal@optimize@away@cmd@manual##1##2##3##4##5{% + \tikzexternal@optimize@away@cmd@@@{#1}{#3}{{##1}{##2}{##3}{##4}{##5}}% + }% + \or + \def\tikzexternal@optimize@away@cmd@manual##1##2##3##4##5##6{% + \tikzexternal@optimize@away@cmd@@@{#1}{#3}{{##1}{##2}{##3}{##4}{##5}{##6}}% + }% + \or + \def\tikzexternal@optimize@away@cmd@manual##1##2##3##4##5##6##7{% + \tikzexternal@optimize@away@cmd@@@{#1}{#3}{{##1}{##2}{##3}{##4}{##5}{##6}{##7}}% + }% + \or + \def\tikzexternal@optimize@away@cmd@manual##1##2##3##4##5##6##7##8{% + \tikzexternal@optimize@away@cmd@@@{#1}{#3}{{##1}{##2}{##3}{##4}{##5}{##6}{##7}{##8}}% + }% + \or + \def\tikzexternal@optimize@away@cmd@manual##1##2##3##4##5##6##7##8##9{% + \tikzexternal@optimize@away@cmd@@@{#1}{#3}{{##1}{##2}{##3}{##4}{##5}{##6}{##7}{##8}{##9}}% + }% + \fi + \def\tikz@temp{\tikzexternal@optimize@away@cmd@manual}% + \fi + \tikz@temp }% \def\tikzexternal@optimize@away@cmd@auto#1#2{% - \pgfutil@ifnextchar\bgroup{% - \tikzexternal@optimize@away@cmd@auto@{#1}{#2}% - }{% - \tikzexternal@optimize@away@cmd@auto@{#1}{#2}{<no argument in curly braces>}% give empty argument. - } + \pgfutil@ifnextchar\bgroup{% + \tikzexternal@optimize@away@cmd@auto@{#1}{#2}% + }{% + \tikzexternal@optimize@away@cmd@auto@{#1}{#2}{<no argument in curly braces>}% give empty argument. + } }% \def\tikzexternal@optimize@away@cmd@auto@#1#2#3{% - \tikzexternal@optimize@away@cmd@@@{#1}{#2}{{#3}}% <-- provide braces + \tikzexternal@optimize@away@cmd@@@{#1}{#2}{{#3}}% <-- provide braces }% \def\tikzexternal@optimize@away@cmd@@@#1#2#3{% - \begingroup - \toks0={#1[#2]#3}% - \iftikzexternal@verbose@optimize - \pgf@typeout{The command '\the\toks0' has been optimized away. Use '/tikz/external/optimize=false' to disable this.}% - \fi - \endgroup - \begingroup - \pgfkeysvalueof{/tikz/external/optimize away text/.@cmd}#1\pgfeov% - \endgroup + \begingroup + \toks0={#1[#2]#3}% + \iftikzexternal@verbose@optimize + \pgf@typeout{The command '\the\toks0' has been optimized away. Use '/tikz/external/optimize=false' to disable this.}% + \fi + \endgroup + \begingroup + \pgfkeysvalueof{/tikz/external/optimize away text/.@cmd}#1\pgfeov% + \endgroup }% \def\tikzexternal@optimize@away@latex@env#1{% - \def\tikzexternal@optimize@away@latex@env@{#1}% - \begingroup - \def\tikzexternal@laTeX@collect@until@end@tikzpicturetikzpicturestring{#1}% - \tikzexternal@TEXDIALECT@collectpicture\tikzexternal@optimize@away@latex@env@close + \def\tikzexternal@optimize@away@latex@env@{#1}% + \begingroup + \def\tikzexternal@laTeX@collect@until@end@tikzpicturetikzpicturestring{#1}% + \tikzexternal@TEXDIALECT@collectpicture\tikzexternal@optimize@away@latex@env@close }% \long\def\tikzexternal@optimize@away@latex@env@close#1{% - \iftikzexternal@verbose@optimize - \pgf@typeout{The complete contents of \string\begin{tikzexternal@optimize@away@latex@env@} up to the next \end{tikzexternal@optimize@away@latex@env@} has been optimized away because it does not contribute to the exported PDF. Use '/tikz/external/optimize=false' to disable this.}% - \fi - \endgroup - % we still need to invoke \end{<name>} in latex because \begin{<name>} - % starts a local group - that must be closed properly. Make sure then \end<name> does nothing: - \expandafter\let\csname end\tikzexternal@optimize@away@latex@env@\endcsname=\relax - \expandafter\end\expandafter{\tikzexternal@optimize@away@latex@env@}% + \iftikzexternal@verbose@optimize + \pgf@typeout{The complete contents of \string\begin{tikzexternal@optimize@away@latex@env@} up to the next \end{tikzexternal@optimize@away@latex@env@} has been optimized away because it does not contribute to the exported PDF. Use '/tikz/external/optimize=false' to disable this.}% + \fi + \endgroup + % we still need to invoke \end{<name>} in latex because \begin{<name>} + % starts a local group - that must be closed properly. Make sure then \end<name> does nothing: + \expandafter\let\csname end\tikzexternal@optimize@away@latex@env@\endcsname=\relax + \expandafter\end\expandafter{\tikzexternal@optimize@away@latex@env@}% }% \def\tikzexternal@optimize@REPLACE{% - \pgfkeysvalueof{/tikz/external/optimize/install/.@cmd}\pgfeov + \pgfkeysvalueof{/tikz/external/optimize/install/.@cmd}\pgfeov }% \def\tikzexternal@optimize@RESTORE{% - \pgfkeysvalueof{/tikz/external/optimize/restore/.@cmd}\pgfeov + \pgfkeysvalueof{/tikz/external/optimize/restore/.@cmd}\pgfeov }% % Closes one 'tikzpicture' environment. This is only used for LaTeX, % because the '\end{tikzpicture}' command would raise an exception otherwise. % It does *not* call \endtikzpicture. \def\tikzexternal@closeenvironments{% - \let\endtikzpicture=\relax - \tikzexternal@TEXDIALECT@endpicture - \let\endtikzpicture=\tikzexternal@origendpicture - \let\tikzexternal@curfilename=\relax + \let\endtikzpicture=\relax + \tikzexternal@TEXDIALECT@endpicture + \let\endtikzpicture=\tikzexternal@origendpicture + \let\tikzexternal@curfilename=\relax } % Throws a tikzpicture away - without further notice. @@ -1163,19 +1163,19 @@ % % See the 'optimize' key to disable this. \def\tikzexternal@skipfigure{% - \tikzexternal@TEXDIALECT@collectpicture\tikzexternal@skipfigure@@ + \tikzexternal@TEXDIALECT@collectpicture\tikzexternal@skipfigure@@ } \long\def\tikzexternal@skipfigure@@#1{% - \iftikzexternal@verbose@optimize - \pgf@typeout{A tikzpicture has been optimized away. Use '/tikz/external/optimize=false' to disable this.}% - \fi - \tikzexternal@closeenvironments - \pgfkeysvalueof{/tikz/external/optimize away text/.@cmd}tikzpicture\pgfeov% + \iftikzexternal@verbose@optimize + \pgf@typeout{A tikzpicture has been optimized away. Use '/tikz/external/optimize=false' to disable this.}% + \fi + \tikzexternal@closeenvironments + \pgfkeysvalueof{/tikz/external/optimize away text/.@cmd}tikzpicture\pgfeov% } % Processes tikzpicture normally; without any externalization. % -% We need to do further work here to deal with NESTED tikzpicture environments +% We need to do further work here to deal with NESTED tikzpicture environments % because all of them shall also be typeset normally. % % Idea: @@ -1185,126 +1185,126 @@ % % FIXME: could it be possible that nested tikzpictures use other code anyway? \def\tikzexternal@normalpicture@nographics{% - \tikzexternal@nestedflagfalse - \let\tikzpicture=\tikzexternal@normalpicture@begreplace - \let\endtikzpicture=\tikzexternal@normalpicture@endreplace - \tikzpicture + \tikzexternal@nestedflagfalse + \let\tikzpicture=\tikzexternal@normalpicture@begreplace + \let\endtikzpicture=\tikzexternal@normalpicture@endreplace + \tikzpicture } \def\tikzexternal@normalpicture@begreplace{% - \begingroup - \tikzexternal@nestedflagtrue - \tikzexternal@origpicture + \begingroup + \tikzexternal@nestedflagtrue + \tikzexternal@origpicture } \def\tikzexternal@normalpicture@endreplace{% - \tikzexternal@origendpicture - \endgroup - \iftikzexternal@nestedflag - \else - \let\tikzpicture=\tikzexternal@tikzpicture@replacement - \let\endtikzpicture=\tikzexternal@origendpicture - \fi + \tikzexternal@origendpicture + \endgroup + \iftikzexternal@nestedflag + \else + \let\tikzpicture=\tikzexternal@tikzpicture@replacement + \let\endtikzpicture=\tikzexternal@origendpicture + \fi }% % Assumes there is an image on disk and reads it. The tikzpicture is thrown away. \def\tikzexternal@forcegraphics{% - \tikzexternal@TEXDIALECT@collectpicture\tikzexternal@forcegraphics@@ + \tikzexternal@TEXDIALECT@collectpicture\tikzexternal@forcegraphics@@ } \long\def\tikzexternal@forcegraphics@@#1{\tikzexternal@forcegraphics@@@}% \def\tikzexternal@forcegraphics@@@{% - \if5\tikzexternal@opmode - \let\tikz@refundefinedtrue@@=\G@refundefinedtrue - \gdef\G@refundefinedtrue{% - \tikz@refundefinedtrue@@ - \tikzexternal@forceremake@undefined@reference@handler - }% - \fi - \expandafter\pgfincludeexternalgraphics\expandafter{\tikzexternal@curfilename}% - \if5\tikzexternal@opmode - \global\let\G@refundefinedtrue=\tikz@refundefinedtrue@@ - \fi - \tikzexternal@closeenvironments + \if5\tikzexternal@opmode + \let\tikz@refundefinedtrue@@=\G@refundefinedtrue + \gdef\G@refundefinedtrue{% + \tikz@refundefinedtrue@@ + \tikzexternal@forceremake@undefined@reference@handler + }% + \fi + \expandafter\pgfincludeexternalgraphics\expandafter{\tikzexternal@curfilename}% + \if5\tikzexternal@opmode + \global\let\G@refundefinedtrue=\tikz@refundefinedtrue@@ + \fi + \tikzexternal@closeenvironments } \def\tikzexternal@forceremake@undefined@reference@handler{% - \pgf@typeout{===== 'mode=list and make': encountered undefined reference in current picture. Adding dependency to FORCEREMAKE. Rerun make to update the picture.' ========^^J}% - \tikzpicturedependsonfile{FORCEREMAKE}% + \pgf@typeout{===== 'mode=list and make': encountered undefined reference in current picture. Adding dependency to FORCEREMAKE. Rerun make to update the picture.' ========^^J}% + \tikzpicturedependsonfile{FORCEREMAKE}% }% % Simply replaces the complete picture by some placeholder text. % It is used by 'mode=list only' to reduce runtime. \def\tikzexternal@listmodepicture{% - \tikzexternal@TEXDIALECT@collectpicture\tikzexternal@listmodepicture@@ + \tikzexternal@TEXDIALECT@collectpicture\tikzexternal@listmodepicture@@ } \long\def\tikzexternal@listmodepicture@@#1{\tikzexternal@listmodepicture@@@} \def\tikzexternal@listmodepicture@@@{% - \pgfkeysvalueof{/tikz/external/image discarded text}% - \tikzexternal@closeenvironments + \pgfkeysvalueof{/tikz/external/image discarded text}% + \tikzexternal@closeenvironments } % check if there is already a file. % In that case, use it. If not, skip it. \def\tikzexternal@list@and@makefile@mode@picture{% - \tikzexternal@TEXDIALECT@collectpicture\tikzexternal@list@and@makefile@mode@picture@ + \tikzexternal@TEXDIALECT@collectpicture\tikzexternal@list@and@makefile@mode@picture@ }% \long\def\tikzexternal@list@and@makefile@mode@picture@#1{% - % - \tikzexternal@check@uptodate@mode{#1}% - % - \gdef\pgf@filename{}% - \xdef\pgf@tempa{\noexpand\pgf@findfile\pgfsys@imagesuffixlist:+{\tikzexternal@curfilename}}% - \pgf@tempa - \ifx\pgf@filename\pgfutil@empty% - % Note: since we have no 'GRAB' mode, we do not have to deal with optimization. - % there is no graphics. - \expandafter\tikzexternal@listmodepicture@@@ - \else - \expandafter\tikzexternal@forcegraphics@@@ - \fi + % + \tikzexternal@check@uptodate@mode{#1}% + % + \gdef\pgf@filename{}% + \xdef\pgf@tempa{\noexpand\pgf@findfile\pgfsys@imagesuffixlist:+{\tikzexternal@curfilename}}% + \pgf@tempa + \ifx\pgf@filename\pgfutil@empty% + % Note: since we have no 'GRAB' mode, we do not have to deal with optimization. + % there is no graphics. + \expandafter\tikzexternal@listmodepicture@@@ + \else + \expandafter\tikzexternal@forcegraphics@@@ + \fi }% \def\tikzexternal@externalizefig@before@grab{% - \pgfutil@IfUndefined{TP@holdbox}{% - }{% - % \usepackage[absolute]{textpos} - % populates this box -- and would inject unwanted material into our images. Reset it: - \global\setbox\TP@holdbox\vbox{}% - }% + \pgfutil@IfUndefined{TP@holdbox}{% + }{% + % \usepackage[absolute]{textpos} + % populates this box -- and would inject unwanted material into our images. Reset it: + \global\setbox\TP@holdbox\vbox{}% + }% }% \def\tikzexternal@externalizefig@GRAB{% - \ifpgf@external@grabshipout - \iftikzexternal@optimize - \tikzexternal@optimize@RESTORE - \fi - \tikzexternal@externalizefig@before@grab - \fi - \def\tikzpicture{% - \def\tikzpicture{% make sure that nested \tikzpicture are processed normally. - \begingroup - \def\endtikzpicture{% - \tikzexternal@origendpicture - \endgroup - }% - \tikzexternal@origpicture - }% - \pgf@external@grab{\tikzexternal@curfilename}% - \tikzexternal@origpicture - }% - \def\endtikzpicture{% - \tikzexternal@origendpicture - \pgf@externalend - % - \tikzexternal@ensure@nonempty@floats - % - \let\tikzpicture=\tikzexternal@tikzpicture@replacement - \let\endtikzpicture=\tikzexternal@origendpicture - \iftikzexternal@optimize - \ifpgf@external@grabshipout - \tikzexternal@optimize@REPLACE - \fi - \fi - }% - \tikzpicture + \ifpgf@external@grabshipout + \iftikzexternal@optimize + \tikzexternal@optimize@RESTORE + \fi + \tikzexternal@externalizefig@before@grab + \fi + \def\tikzpicture{% + \def\tikzpicture{% make sure that nested \tikzpicture are processed normally. + \begingroup + \def\endtikzpicture{% + \tikzexternal@origendpicture + \endgroup + }% + \tikzexternal@origpicture + }% + \pgf@external@grab{\tikzexternal@curfilename}% + \tikzexternal@origpicture + }% + \def\endtikzpicture{% + \tikzexternal@origendpicture + \pgf@externalend + % + \tikzexternal@ensure@nonempty@floats + % + \let\tikzpicture=\tikzexternal@tikzpicture@replacement + \let\endtikzpicture=\tikzexternal@origendpicture + \iftikzexternal@optimize + \ifpgf@external@grabshipout + \tikzexternal@optimize@REPLACE + \fi + \fi + }% + \tikzpicture }% % If a sequence of floats containing JUST tikzpictures is @@ -1320,7 +1320,7 @@ % see % http://tex.stackexchange.com/questions/54625/why-is-fixltx2e-incompatible-with-tikzexternalize \def\tikzexternal@ensure@nonempty@floats{% - tikzexternal: picture has been externalized. This text is required to avoid empty floats. + tikzexternal: picture has been externalized. This text is required to avoid empty floats. }% % 1. Discards the current picture in this document. @@ -1329,7 +1329,7 @@ % process \tikzexternal@externalizefig. % 4. Assert that finally an image exists and use it. \def\tikzexternal@externalizefig@systemcall{% - \tikzexternal@TEXDIALECT@collectpicture\tikzexternal@externalizefig@systemcall@@ + \tikzexternal@TEXDIALECT@collectpicture\tikzexternal@externalizefig@systemcall@@ } { @@ -1358,10 +1358,10 @@ |xdef|tikzexternal@normal@backslash{\}% } { -\catcode`\^^I=12 +\catcode`\^^I=12 \catcode`\$=12 \catcode`\%=12 -\catcode`\#=12 +\catcode`\#=12 \gdef\tikzexternal@HASHchar{#} \gdef\tikzexternal@TABchar{^^I}\gdef\tikzexternal@PERCENTchar{%}\xdef\tikzexternal@DOLLARchar{$}} @@ -1372,130 +1372,131 @@ % #2: the global return value macro % \def\tikzexternal@assemble@systemcall#1#2{% - \begingroup - \def\image{#1}% - \iftikzexternal@auto@detect@jobname - \edef\texsource{\string\def\string\tikzexternalrealjob{\tikzexternal@realjob}\string\input{\tikzexternal@realjob}}% - \else - \let\texsource=\tikzexternal@realjob - \fi - \ifnum\the\catcode`\"=13 \tikzexternal@activate@normal@dq\fi - \ifnum\the\catcode`\'=13 \tikzexternal@activate@normal@sq\fi - \ifnum\the\catcode`\;=13 \tikzexternal@activate@normal@semic\fi - \ifnum\the\catcode`\-=13 \tikzexternal@activate@normal@dash\fi - \let\\=\tikzexternal@normal@backslash - \xdef#2{\pgfkeysvalueof{/tikz/external/system call}}% - \endgroup + \begingroup + \def\image{#1}% + \iftikzexternal@auto@detect@jobname + \edef\texsource{\string\def\string\tikzexternalrealjob{\tikzexternal@realjob}\string\input{\tikzexternal@realjob}}% + \else + \let\texsource=\tikzexternal@realjob + \fi + \ifnum\the\catcode`\"=13 \tikzexternal@activate@normal@dq\fi + \ifnum\the\catcode`\'=13 \tikzexternal@activate@normal@sq\fi + \ifnum\the\catcode`\;=13 \tikzexternal@activate@normal@semic\fi + \ifnum\the\catcode`\-=13 \tikzexternal@activate@normal@dash\fi + \let\\=\tikzexternal@normal@backslash + \xdef#2{\pgfkeysvalueof{/tikz/external/system call}}% + \endgroup }% \long\def\tikzexternal@externalizefig@systemcall@@#1{% - \tikzexternal@externalizefig@systemcall@uptodatecheck{#1}% - \tikzexternal@assemble@systemcall{\tikzexternal@curfilename}{\pgf@tempa}% - \global\let\tikzexternal@cursyscall=\pgf@tempa - \gdef\tikzexternal@typeset@picture@on@failure{1}% - \iftikzexternal@file@isuptodate - \iftikzexternal@verboseio - \pgf@typeout{===== Image '\tikzexternal@curfilename' is up-to-date. ======}% - \fi - \let\pgf@filename=\tikzexternal@curfilename - \else - \begingroup - % no such image. Generate it! - % - \tikzexternalauxlock@setlock1% - \tikzexternal@externalizefig@systemcall@call{\tikzexternal@cursyscall}% - \tikzexternalauxlock@setlock0% - \expandafter\tikzexternal@externalizefig@systemcall@assertsuccess\expandafter{\tikzexternal@cursyscall}% - \pgfmath@smuggleone\pgf@filename - \endgroup - \fi - \ifx\pgf@filename\pgfutil@empty - \if1\tikzexternal@typeset@picture@on@failure - % error recovery: something did not work! Try to load it - % anyway. Perhaps it was just that shell-escape wasn't - % enabled. - \begingroup - \toks0={% - \tikzexternaldisable - }% - % FIXME : THIS WILL FAIL IF THERE IS '##' INSIDE OF '#1'! - % for example something like /.style={#1} in the picture environment *will* fail. - \toks1={% - \tikzpicture - #1% - }% - \toks2={% - \tikzexternal@TEXDIALECT@endpicture - \tikzexternalenable - }% - \xdef\tikzexternal@externalizefig@systemcall@next{% - \the\toks0 - % try reading them again as if they were in the input file. - \noexpand\pgfutil@scantokens{\the\toks1 }% - \the\toks2 - }% - \endgroup - \else - % Ah -- this picture failed, but the failure has already - % been handled somehow. Do not typeset it again! - % - % A use-case is that the picture has been rescheduled for - % \end{document}. - \gdef\tikzexternal@externalizefig@systemcall@next{\tikzexternal@closeenvironments}% - \fi - \else - % ok, take the image! - \gdef\tikzexternal@systemcall@reschedule@to@end@document{0}% - \expandafter\pgfincludeexternalgraphics\expandafter{\tikzexternal@curfilename}% - \if1\tikzexternal@systemcall@reschedule@to@end@document - \pgfutil@IfUndefined{AtVeryEndDocument}{% - }{% - \pgf@typeout{===== The previous system call resulted in undefined references inside of the output file. Rescheduling it for \string\end{document}. ========}% - \expandafter\tikzexternal@externalizefig@systemcall@reschedule\expandafter{\tikzexternal@cursyscall}% - }% - \fi - \gdef\tikzexternal@externalizefig@systemcall@next{\tikzexternal@closeenvironments}% - \fi - \tikzexternal@externalizefig@systemcall@next + \tikzexternal@externalizefig@systemcall@uptodatecheck{#1}% + \tikzexternal@assemble@systemcall{\tikzexternal@curfilename}{\pgf@tempa}% + \global\let\tikzexternal@cursyscall=\pgf@tempa + \gdef\tikzexternal@typeset@picture@on@failure{1}% + \iftikzexternal@file@isuptodate + \iftikzexternal@verboseio + \pgf@typeout{===== Image '\tikzexternal@curfilename' is up-to-date. ======}% + \fi + \let\pgf@filename=\tikzexternal@curfilename + \else + \begingroup + % no such image. Generate it! + % + \tikzexternalauxlock@setlock1% + \tikzexternal@externalizefig@systemcall@call{\tikzexternal@cursyscall}% + \tikzexternalauxlock@setlock0% + \expandafter\tikzexternal@externalizefig@systemcall@assertsuccess\expandafter{\tikzexternal@cursyscall}% + \pgfmath@smuggleone\pgf@filename + \endgroup + \fi + \ifx\pgf@filename\pgfutil@empty + \if1\tikzexternal@typeset@picture@on@failure + % error recovery: something did not work! Try to load it + % anyway. Perhaps it was just that shell-escape wasn't + % enabled. + \begingroup + \toks0={% + \tikzexternaldisable + \pgfutil@ifundefined{scantokens}{\long\def\scantokens##1{##1}}{}% + }% + % FIXME : THIS WILL FAIL IF THERE IS '##' INSIDE OF '#1'! + % for example something like /.style={#1} in the picture environment *will* fail. + \toks1={% + \tikzpicture + #1% + }% + \toks2={% + \tikzexternal@TEXDIALECT@endpicture + \tikzexternalenable + }% + \xdef\tikzexternal@externalizefig@systemcall@next{% + \the\toks0 + % try reading them again as if they were in the input file. + \noexpand\scantokens{\the\toks1 }% + \the\toks2 + }% + \endgroup + \else + % Ah -- this picture failed, but the failure has already + % been handled somehow. Do not typeset it again! + % + % A use-case is that the picture has been rescheduled for + % \end{document}. + \gdef\tikzexternal@externalizefig@systemcall@next{\tikzexternal@closeenvironments}% + \fi + \else + % ok, take the image! + \gdef\tikzexternal@systemcall@reschedule@to@end@document{0}% + \expandafter\pgfincludeexternalgraphics\expandafter{\tikzexternal@curfilename}% + \if1\tikzexternal@systemcall@reschedule@to@end@document + \pgfutil@IfUndefined{AtVeryEndDocument}{% + }{% + \pgf@typeout{===== The previous system call resulted in undefined references inside of the output file. Rescheduling it for \string\end{document}. ========}% + \expandafter\tikzexternal@externalizefig@systemcall@reschedule\expandafter{\tikzexternal@cursyscall}% + }% + \fi + \gdef\tikzexternal@externalizefig@systemcall@next{\tikzexternal@closeenvironments}% + \fi + \tikzexternal@externalizefig@systemcall@next }% \def\tikzexternal@externalizefig@systemcall@call#1{% - \iftikzexternal@verboseio - \pgf@typeout{===== 'mode=convert with system call': Invoking '#1' ========}% - \fi - \pgfutil@shellescape{#1}% + \iftikzexternal@verboseio + \pgf@typeout{===== 'mode=convert with system call': Invoking '#1' ========}% + \fi + \pgfutil@shellescape{#1}% }% % Sets \iftikzexternal@file@isuptodate to false if one of the "force % remake" things is active. \def\tikzexternal@checkforceremake{% - \iftikzexternal@force@remake - \global\tikzexternal@file@isuptodatefalse - \else - \iftikzexternalremakenext - \global\tikzexternal@file@isuptodatefalse - \global\tikzexternalremakenextfalse - \fi - \fi + \iftikzexternal@force@remake + \global\tikzexternal@file@isuptodatefalse + \else + \iftikzexternalremakenext + \global\tikzexternal@file@isuptodatefalse + \global\tikzexternalremakenextfalse + \fi + \fi } \pgfutil@IfUndefined{pdfmdfivesum}{% }{% - % predefine to this value. This does only make sense for pdftex. - % note that the latex library for 'external' loads \usepackage{pdftexcmds} which \let's this to \pdf@mdfivesum: - \let\tikzexternal@mdfivesum=\pdfmdfivesum + % predefine to this value. This does only make sense for pdftex. + % note that the latex library for 'external' loads \usepackage{pdftexcmds} which \let's this to \pdf@mdfivesum: + \let\tikzexternal@mdfivesum=\pdfmdfivesum }% \long\def\tikzexternal@computemdfivesum#1{% - \t@tikzexternal@tmpb={#1}% - \edef\tikzexternal@temp{\the\t@tikzexternal@tmpb}% - % \meaning results in a string of catcode 12 - which is expandable. - \edef\pgfretval{\tikzexternal@mdfivesum{\meaning\tikzexternal@temp}}% + \t@tikzexternal@tmpb={#1}% + \edef\tikzexternal@temp{\the\t@tikzexternal@tmpb}% + % \meaning results in a string of catcode 12 - which is expandable. + \edef\pgfretval{\tikzexternal@mdfivesum{\meaning\tikzexternal@temp}}% } \long\def\tikzexternal@computemdfivesum@diff@fallback#1{% - \t@tikzexternal@tmpb={#1}% - \edef\tikzexternal@temp{\the\t@tikzexternal@tmpb}% - % \meaning results in a string of catcode 12 - which is expandable. - \edef\pgfretval{\meaning\tikzexternal@temp}% + \t@tikzexternal@tmpb={#1}% + \edef\tikzexternal@temp{\the\t@tikzexternal@tmpb}% + % \meaning results in a string of catcode 12 - which is expandable. + \edef\pgfretval{\meaning\tikzexternal@temp}% } % Will be set dynamically, depending on 'up to date check'. @@ -1506,146 +1507,146 @@ % It is used as argument for \write{..} % % #1 the hash key to serialize. -% \def\tikzexternal@hashfct@serialize +% \def\tikzexternal@hashfct@serialize \long\def\tikzexternal@hashfct@serialize@std#1{% - \noexpand\def\noexpand\tikzexternallastkey{#1}% + \noexpand\def\noexpand\tikzexternallastkey{#1}% }% % serializes using temporary token registers. Necessary if #1 contains % executable code. \long\def\tikzexternal@hashfct@serialize@tok#1{% - \noexpand\begingroup - % in order to allow '#' inside of the body, we have to use token registers: - \noexpand\toks0={#1}% - \noexpand\xdef\noexpand\tikzexternallastkey{\noexpand\the\noexpand\toks0 }% - \noexpand\endgroup + \noexpand\begingroup + % in order to allow '#' inside of the body, we have to use token registers: + \noexpand\toks0={#1}% + \noexpand\xdef\noexpand\tikzexternallastkey{\noexpand\the\noexpand\toks0 }% + \noexpand\endgroup }% \def\tikzexternal@check@uptodate@ext{.md5} -\def\tikzexternal@check@uptodate@mode@warn@fallback{% - \message{Package tikz Warning: The key 'up to date check=md5' is impossible, there is no macro to compute MD5. Falling back to 'up to date check=diff'.}% - % - % warn only once: - \global\let\tikzexternal@check@uptodate@mode@warn@fallback=\relax +\def\tikzexternal@check@uptodate@mode@warn@fallback{% + \message{Package tikz Warning: The key 'up to date check=md5' is impossible, there is no macro to compute MD5. Falling back to 'up to date check=diff'.}% + % + % warn only once: + \global\let\tikzexternal@check@uptodate@mode@warn@fallback=\relax }% % assigns the boolean \iftikzexternal@file@isuptodate \long\def\tikzexternal@check@uptodate@mode#1{% - \if1\tikzexternal@uptodate@mode - % up to date check=md5: - % check if we CAN compute MD5 sums: - \pgfutil@IfUndefined{tikzexternal@mdfivesum}{% - % we cannot compute md5 sums - fallback to diff. - \tikzexternal@check@uptodate@mode@warn@fallback - \def\tikzexternal@uptodate@mode{2}% - }{}% - \fi - % - \ifcase\tikzexternal@uptodate@mode - % up to date check=simple - % nothing to do -- file existence is checked anyway. - \let\tikzexternal@hashfct=\pgfutil@empty - \let\tikzexternal@hashfct@serialize=\pgfutil@empty - \or - % up to date check=md5 - \let\tikzexternal@hashfct=\tikzexternal@computemdfivesum - \let\tikzexternal@hashfct@serialize=\tikzexternal@hashfct@serialize@std - \or - \let\tikzexternal@hashfct=\tikzexternal@computemdfivesum@diff@fallback - \let\tikzexternal@hashfct@serialize=\tikzexternal@hashfct@serialize@tok - \fi - \ifx\tikzexternal@hashfct\pgfutil@empty - \else - \tikzpicturedependsonfile{\tikzexternal@curfilename\tikzexternal@check@uptodate@ext}% - \tikzexternal@hashfct{#1}% - \let\tikzexternal@lastkey@new=\pgfretval - \begingroup - % no '@' token in this macro: avoid messing up the catcodes in input files: - \global\let\tikzexternallastkey=\pgfutil@empty - \openin\r@pgf@reada=\tikzexternal@curfilename\tikzexternal@check@uptodate@ext\relax % - \ifeof\r@pgf@reada - \else - % read first line... - \endlinechar=-1 % older versions did not have a '%' at the end-of-line. Avoid spurious spaces. - \read\r@pgf@reada to\pgf@tempa - % ... and execute it. - \pgf@tempa - % it should contain a definition of \tikzexternallastkey. - \fi - \closein\r@pgf@reada - % - \let\tikzexternal@lastkey=\tikzexternallastkey - \pgfmath@smuggleone\tikzexternal@lastkey - \endgroup - % normalize catcodes. Unfortunately, they cannot be expected to be the same. - % \meaning will use catcode 12 for each token: - \edef\tikzexternal@lastkey@normalized{\meaning\tikzexternal@lastkey}% - \edef\tikzexternal@lastkey@new@normalized{\meaning\tikzexternal@lastkey@new}% - \iftikzexternal@verboseuptodate - \pgf@typeout{Up-to-date check of \tikzexternal@curfilename: new \tikzexternal@lastkey@new@normalized; old \tikzexternal@lastkey@normalized.^^J}% - \fi - \ifx\tikzexternal@lastkey@normalized\tikzexternal@lastkey@new@normalized - \tikzexternal@file@isuptodatetrue - \else - \tikzexternal@file@isuptodatefalse - \immediate\openout\w@pgf@writea=\tikzexternal@curfilename\tikzexternal@check@uptodate@ext\relax% - \immediate\write\w@pgf@writea{\tikzexternal@hashfct@serialize{\tikzexternal@lastkey@new}\tikzexternal@PERCENTchar}% - \immediate\closeout\w@pgf@writea - \fi - \fi + \if1\tikzexternal@uptodate@mode + % up to date check=md5: + % check if we CAN compute MD5 sums: + \pgfutil@IfUndefined{tikzexternal@mdfivesum}{% + % we cannot compute md5 sums - fallback to diff. + \tikzexternal@check@uptodate@mode@warn@fallback + \def\tikzexternal@uptodate@mode{2}% + }{}% + \fi + % + \ifcase\tikzexternal@uptodate@mode + % up to date check=simple + % nothing to do -- file existance is checked anyway. + \let\tikzexternal@hashfct=\pgfutil@empty + \let\tikzexternal@hashfct@serialize=\pgfutil@empty + \or + % up to date check=md5 + \let\tikzexternal@hashfct=\tikzexternal@computemdfivesum + \let\tikzexternal@hashfct@serialize=\tikzexternal@hashfct@serialize@std + \or + \let\tikzexternal@hashfct=\tikzexternal@computemdfivesum@diff@fallback + \let\tikzexternal@hashfct@serialize=\tikzexternal@hashfct@serialize@tok + \fi + \ifx\tikzexternal@hashfct\pgfutil@empty + \else + \tikzpicturedependsonfile{\tikzexternal@curfilename\tikzexternal@check@uptodate@ext}% + \tikzexternal@hashfct{#1}% + \let\tikzexternal@lastkey@new=\pgfretval + \begingroup + % no '@' token in this macro: avoid messing up the catcodes in input files: + \global\let\tikzexternallastkey=\pgfutil@empty + \openin\r@pgf@reada=\tikzexternal@curfilename\tikzexternal@check@uptodate@ext\relax % + \ifeof\r@pgf@reada + \else + % read first line... + \endlinechar=-1 % older versions did not have a '%' at the end-of-line. Avoid spurious spaces. + \read\r@pgf@reada to\pgf@tempa + % ... and execute it. + \pgf@tempa + % it should contain a definition of \tikzexternallastkey. + \fi + \closein\r@pgf@reada + % + \let\tikzexternal@lastkey=\tikzexternallastkey + \pgfmath@smuggleone\tikzexternal@lastkey + \endgroup + % normalize catcodes. Unfortunately, they cannot be expected to be the same. + % \meaning will use catcode 12 for each token: + \edef\tikzexternal@lastkey@normalized{\meaning\tikzexternal@lastkey}% + \edef\tikzexternal@lastkey@new@normalized{\meaning\tikzexternal@lastkey@new}% + \iftikzexternal@verboseuptodate + \pgf@typeout{Up-to-date check of \tikzexternal@curfilename: new \tikzexternal@lastkey@new@normalized; old \tikzexternal@lastkey@normalized.^^J}% + \fi + \ifx\tikzexternal@lastkey@normalized\tikzexternal@lastkey@new@normalized + \tikzexternal@file@isuptodatetrue + \else + \tikzexternal@file@isuptodatefalse + \immediate\openout\w@pgf@writea=\tikzexternal@curfilename\tikzexternal@check@uptodate@ext\relax% + \immediate\write\w@pgf@writea{\tikzexternal@hashfct@serialize{\tikzexternal@lastkey@new}\tikzexternal@PERCENTchar}% + \immediate\closeout\w@pgf@writea + \fi + \fi } % Checks whether the current picture needs to be externalized. -% -% This is the case if +% +% This is the case if % a) there is no external image yet, % b) the picture has been invalidated manually. % % It returns \iftikzexternal@file@isuptodate accordingly. % #1: the picture-content \long\def\tikzexternal@externalizefig@systemcall@uptodatecheck#1{% - \tikzexternal@check@uptodate@mode{#1}% - \tikzexternal@checkforceremake - \iftikzexternal@file@isuptodate - % check if there is already a file. - % In that case, use it. If that is not the case, generate it and include it afterwards. - \gdef\pgf@filename{}% - \xdef\pgf@tempa{\noexpand\pgf@findfile\pgfsys@imagesuffixlist:+{\tikzexternal@curfilename}}% - \pgf@tempa - \ifx\pgf@filename\pgfutil@empty% - \global\tikzexternal@file@isuptodatefalse - \fi - \fi + \tikzexternal@check@uptodate@mode{#1}% + \tikzexternal@checkforceremake + \iftikzexternal@file@isuptodate + % check if there is already a file. + % In that case, use it. If that is not the case, generate it and include it afterwards. + \gdef\pgf@filename{}% + \xdef\pgf@tempa{\noexpand\pgf@findfile\pgfsys@imagesuffixlist:+{\tikzexternal@curfilename}}% + \pgf@tempa + \ifx\pgf@filename\pgfutil@empty% + \global\tikzexternal@file@isuptodatefalse + \fi + \fi }% % \pgf@filename will be empty if the assertion failed. \def\tikzexternal@externalizefig@systemcall@assertsuccess#1{% - % check if there is a file now and raise an error message if not. - \gdef\pgf@filename{}% - \xdef\pgf@tempa{\noexpand\pgf@findfile\pgfsys@imagesuffixlist:+{\tikzexternal@curfilename}}% - \pgf@tempa - \ifx\pgf@filename\pgfutil@empty% - \tikzexternal@externalizefig@systemcall@handleexception{#1}% - \fi + % check if there is a file now and raise an error message if not. + \gdef\pgf@filename{}% + \xdef\pgf@tempa{\noexpand\pgf@findfile\pgfsys@imagesuffixlist:+{\tikzexternal@curfilename}}% + \pgf@tempa + \ifx\pgf@filename\pgfutil@empty% + \tikzexternal@externalizefig@systemcall@handleexception{#1}% + \fi }% \def\tikzexternal@externalizefig@systemcall@handleexception@msg#1{% - \tikzerror{Sorry, the system call '#1' did NOT result in a usable output file '\tikzexternal@curfilename' (expected one of \pgfsys@imagesuffixlist). Please verify that you have enabled system calls. For pdflatex, this is 'pdflatex -shell-escape'. Sometimes it is also named 'write 18' or something like that. Or maybe the command simply failed? Error messages can be found in '\tikzexternal@curfilename.log'. If you continue now, I'll try to typeset the picture}{}% + \tikzerror{Sorry, the system call '#1' did NOT result in a usable output file '\tikzexternal@curfilename' (expected one of \pgfsys@imagesuffixlist). Please verify that you have enabled system calls. For pdflatex, this is 'pdflatex -shell-escape'. Sometimes it is also named 'write 18' or something like that. Or maybe the command simply failed? Error messages can be found in '\tikzexternal@curfilename.log'. If you continue now, I'll try to typeset the picture}{}% } \def\tikzexternal@externalizefig@systemcall@handleexception@retry@later#1{% - \gdef\tikzexternal@systemcall@reschedule@to@end@document{0}% - \expandafter\pgfexternalreaddpth\expandafter{\tikzexternal@curfilename}% - \if1\tikzexternal@systemcall@reschedule@to@end@document - \pgfutil@IfUndefined{AtVeryEndDocument}{% - \tikzexternal@externalizefig@systemcall@handleexception@msg{#1}% - }{% - \pgf@typeout{===== The last system call resulted in an EMPTY output file. Maybe it is part of \string\ref. Rescheduling it for \string\end{document}. ========}% - \gdef\tikzexternal@typeset@picture@on@failure{0}% - \tikzexternal@externalizefig@systemcall@reschedule{#1}% - }% - \else - \tikzexternal@externalizefig@systemcall@handleexception@msg{#1}% - \fi + \gdef\tikzexternal@systemcall@reschedule@to@end@document{0}% + \expandafter\pgfexternalreaddpth\expandafter{\tikzexternal@curfilename}% + \if1\tikzexternal@systemcall@reschedule@to@end@document + \pgfutil@IfUndefined{AtVeryEndDocument}{% + \tikzexternal@externalizefig@systemcall@handleexception@msg{#1}% + }{% + \pgf@typeout{===== The last system call resulted in an EMPTY output file. Maybe it is part of \string\ref. Rescheduling it for \string\end{document}. ========}% + \gdef\tikzexternal@typeset@picture@on@failure{0}% + \tikzexternal@externalizefig@systemcall@reschedule{#1}% + }% + \else + \tikzexternal@externalizefig@systemcall@handleexception@msg{#1}% + \fi } % reschedules the externalization of the current file to @@ -1654,58 +1655,58 @@ % This hook allows to execute code AFTER the main .aux file is % finished; it will even re-read the main aux file. \def\tikzexternal@externalizefig@systemcall@reschedule#1{% - \t@tikzexternal@tmpb={% - \global\let\tikzexternal@externalizefig@systemcall@handleexception=\tikzexternal@externalizefig@systemcall@handleexception@msg% - % ... no auxlocks! - \tikzexternal@externalizefig@systemcall@call{#1}% - \tikzexternal@externalizefig@systemcall@assertsuccess{#1}% - }% - \xdef\pgfutil@tempa{% - \noexpand\def\noexpand\tikzexternal@curfilename{\tikzexternal@curfilename}% - \the\t@tikzexternal@tmpb - }% - \expandafter\AtVeryEndDocument\expandafter{\pgfutil@tempa}% - \gdef\tikzexternal@has@rescheduled@something{1}% + \t@tikzexternal@tmpb={% + \global\let\tikzexternal@externalizefig@systemcall@handleexception=\tikzexternal@externalizefig@systemcall@handleexception@msg% + % ... no auxlocks! + \tikzexternal@externalizefig@systemcall@call{#1}% + \tikzexternal@externalizefig@systemcall@assertsuccess{#1}% + }% + \xdef\pgfutil@tempa{% + \noexpand\def\noexpand\tikzexternal@curfilename{\tikzexternal@curfilename}% + \the\t@tikzexternal@tmpb + }% + \expandafter\AtVeryEndDocument\expandafter{\pgfutil@tempa}% + \gdef\tikzexternal@has@rescheduled@something{1}% }% \let\tikzexternal@externalizefig@systemcall@handleexception=\tikzexternal@externalizefig@systemcall@handleexception@retry@later% \def\tikzexternal@has@rescheduled@something{0}% \pgfutil@IfUndefined{AtVeryEndDocument}{}{% - \AtVeryEndDocument{% - \if1\tikzexternal@has@rescheduled@something - \pgf@typeout{===== tikzexternal: \string\end{document} reached. Working on rescheduled images to resolve references... ========}% - \fi - }% + \AtVeryEndDocument{% + \if1\tikzexternal@has@rescheduled@something + \pgf@typeout{===== tikzexternal: \string\end{document} reached. Working on rescheduled images to resolve references... ========}% + \fi + }% } % Overwrite error message of pgf. % This happens if the generated image was empty, i.e. if there was no \shipout. \def\pgfexternal@error@no@shipout{% - \begingroup - \begingroup - % overwrite .dpth file in order to flag the file as "need to be scheduled - % for \AtVeryEndDocument" : - \immediate\openout\pgf@plotwrite=\pgfactualjobname.dpth - \let\w@pgfexternal@auxout=\pgf@plotwrite - \pgfexternalstorecommand@isexporting{\gdef\noexpand\tikzexternal@systemcall@reschedule@to@end@document{1}}% - \immediate\closeout\pgf@plotwrite - \endgroup - \tikzexternal@assemble@systemcall{\pgfactualjobname}{\pgf@tempa}% - \toks0=\expandafter{\pgf@tempa}% - \tikzerror{Sorry, image externalization failed: the resulting image was EMPTY. I tried to externalize '\pgfactualjobname', but it seems there is no such image in the document!? + \begingroup + \begingroup + % overwrite .dpth file in order to flag the file as "need to be scheduled + % for \AtVeryEndDocument" : + \immediate\openout\pgf@plotwrite=\pgfactualjobname.dpth + \let\w@pgfexternal@auxout=\pgf@plotwrite + \pgfexternalstorecommand@isexporting{\gdef\noexpand\tikzexternal@systemcall@reschedule@to@end@document{1}}% + \immediate\closeout\pgf@plotwrite + \endgroup + \tikzexternal@assemble@systemcall{\pgfactualjobname}{\pgf@tempa}% + \toks0=\expandafter{\pgf@tempa}% + \tikzerror{Sorry, image externalization failed: the resulting image was EMPTY. I tried to externalize '\pgfactualjobname', but it seems there is no such image in the document!? \if\tikzexternal@opmode4 ^^J -\space\space You are currently using 'mode=convert with system call'. This problem can happen if the image (or one of the images preceding it) was declared inside of a \string\label{} (i.e. in the .aux file): 'convert with system call' has no access to the main aux file.^^J +\space\space You are currently using 'mode=convert with system call'. This problem can happen if the image (or one of the images preceeding it) was declared inside of a \string\label{} (i.e. in the .aux file): 'convert with system call' has no access to the main aux file.^^J \space\space Possible solutions in this case:^^J \space\space (a) Try using 'mode=list and make',^^J -\space\space (b) Issue the externalization command '\the\toks0' *manually* (also check the preceding externalized images, perhaps the file name sequence is not correct).^^J +\space\space (b) Issue the externalization command '\the\toks0' *manually* (also check the preceeding externalized images, perhaps the file name sequence is not correct).^^J \space\space Repeat: the resulting image was EMPTY, your attention is required \else - \if\tikzexternal@opmode5 ^^J + \if\tikzexternal@opmode5 ^^J \space\space You are currently using 'mode=list and make'. Possible solutions:^^J \space\space (a) Try to delete `\tikzexternal@realjob.makefile'. Perhaps it is not up-to-date.^^J \space\space (b) Perhaps pictures are declared inside of \string\label{} and the .aux file is not up-to-date. Re-run latex, perhaps re-generate the graphics as well.^^J \space\space Repeat: the resulting image was EMPTY, your attention is required - \fi + \fi \fi}% - \endgroup + \endgroup }% diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryangles.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryangles.code.tex index 5a89e4defd1..364468a2eb4 100644 --- a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryangles.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryangles.code.tex @@ -63,7 +63,7 @@ \ifx\tikzpictext\relax\else% \def\pgf@temp{\node()[name prefix ..,at={([shift={({.5*\tikz@start@angle@temp+.5*\tikz@end@angle@temp}:\pgfkeysvalueof{/tikz/angle - eccentricity}*1.4142136*\tikz@lib@angle@rad pt)}]#2.center)}]} + eccentricity}*sqrt(1/2)*\tikz@lib@angle@rad pt)}]#2.center)}]} \expandafter\pgf@temp\expandafter[\tikzpictextoptions]{\tikzpictext};% \fi }% diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarycalc.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarycalc.code.tex index 8911b82144e..561a725307f 100644 --- a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarycalc.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarycalc.code.tex @@ -39,10 +39,6 @@ \let\x=\tikz@cc@dox% \let\y=\tikz@cc@doy% \let\n=\tikz@cc@don% - \let\rawx=\tikz@cc@dotempx% - \let\rawy=\tikz@cc@dotempy% - \let\rawz=\tikz@cc@dotempz% - \let\coord=\tikz@cc@docoord% \pgfutil@ifnextchar i{\tikz@cc@stop@let}{\tikz@cc@handle@line}% }% \def\tikz@cc@handle@line{% @@ -70,17 +66,6 @@ \expandafter\edef\csname tikz@cc@p@\tikz@cc@coord@name\endcsname{\the\pgf@x,\the\pgf@y}% \expandafter\edef\csname tikz@cc@x@\tikz@cc@coord@name\endcsname{\the\pgf@x}% \expandafter\edef\csname tikz@cc@y@\tikz@cc@coord@name\endcsname{\the\pgf@y}% - \pgfutil@letfirst\pgfutil@next{#1}% - \ifx\pgfutil@next\pgfpointxyz - \expandafter\edef\csname tikz@cc@tempx@\tikz@cc@coord@name\endcsname{\pgftemp@x}% - \expandafter\edef\csname tikz@cc@tempy@\tikz@cc@coord@name\endcsname{\pgftemp@y}% - \expandafter\edef\csname tikz@cc@tempz@\tikz@cc@coord@name\endcsname{\pgftemp@z}% - \else - \expandafter\edef\csname tikz@cc@tempx@\tikz@cc@coord@name\endcsname{}% - \expandafter\edef\csname tikz@cc@tempy@\tikz@cc@coord@name\endcsname{}% - \expandafter\edef\csname tikz@cc@tempz@\tikz@cc@coord@name\endcsname{}% - \fi - \expandafter\edef\csname tikz@cc@coord@\tikz@cc@coord@name\endcsname{\csname tikz@declared@coordinate\endcsname}% \pgfutil@ifnextchar,{\tikz@cc@handle@nextline}{\tikz@cc@stop@let}% }% \def\tikz@cc@handle@nextline,{% @@ -94,10 +79,6 @@ \def\tikz@cc@dox#1{\csname tikz@cc@x@#1\endcsname}% \def\tikz@cc@doy#1{\csname tikz@cc@y@#1\endcsname}% \def\tikz@cc@don#1{\csname tikz@cc@n@#1\endcsname}% -\def\tikz@cc@dotempx#1{\csname tikz@cc@tempx@#1\endcsname}% -\def\tikz@cc@dotempy#1{\csname tikz@cc@tempy@#1\endcsname}% -\def\tikz@cc@dotempz#1{\csname tikz@cc@tempz@#1\endcsname}% -\def\tikz@cc@docoord#1{\csname tikz@cc@coord@#1\endcsname}% diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryintersections.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryintersections.code.tex index 5b0e83d5ee1..f3e4f94144b 100644 --- a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryintersections.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryintersections.code.tex @@ -53,16 +53,23 @@ \expandafter\pgfutil@g@addto@macro\expandafter\tikz@intersect@namedpaths\expandafter{\tikz@marshal}% }% -% at the end of evey \path command ... + \let\tikz@finish@orig=\tikz@finish \def\tikz@finish{% \tikz@finish@orig% \tikz@intersect@finish% }% -% ... make the named path variables available \def\tikz@intersect@finish{% - \tikz@intersect@namedpaths% + \ifx\tikz@intersect@namedpaths\pgfutil@empty% + \else% + \tikz@intersect@namedpaths% + % FIXME : it is reasonable to reset this globally as it is global + % in its nature. But the reset instruction should be moved to + % \endscope or something related. Resetting it here breaks the + % manual + \let\tikz@intersect@namedpaths=\pgfutil@empty% + \fi% }% \let\tikz@intersect@namedpaths=\pgfutil@empty diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarymath.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarymath.code.tex index fd876f5d73c..bf95161576d 100644 --- a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarymath.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarymath.code.tex @@ -7,7 +7,7 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -\usetikzlibrary{fpu} + \edef\tikz@math@at@catcode{\the\catcode`\@}% \catcode`\@=11 diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryperspective.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryperspective.code.tex deleted file mode 100644 index 61a8016057c..00000000000 --- a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryperspective.code.tex +++ /dev/null @@ -1,111 +0,0 @@ -% Copyright 2019 by Max Snippe -% -% This file may be distributed and/or modified -% -% 1. under the LaTeX Project Public License and/or -% 2. under the GNU Public License. -% -% See the file doc/generic/pgf/licenses/LICENSE for more details. - -\ProvidesFileRCS{tikzlibraryperspective.code.tex} - -% Initialize affine transformation matrix for perspective view -% [aa ab ac 0] -% [ba bb bc 0] -% [ca cb cc 0] -% [da db dc 1] -\pgfmathsetmacro\pgf@H@tpp@aa{+1} - \pgfmathsetmacro\pgf@H@tpp@ab{+0} - \pgfmathsetmacro\pgf@H@tpp@ac{+0} -\pgfmathsetmacro\pgf@H@tpp@ba{+0} - \pgfmathsetmacro\pgf@H@tpp@bb{+1} - \pgfmathsetmacro\pgf@H@tpp@bc{+0} -\pgfmathsetmacro\pgf@H@tpp@ca{+0} - \pgfmathsetmacro\pgf@H@tpp@cb{+0} - \pgfmathsetmacro\pgf@H@tpp@cc{+1} -\pgfmathsetmacro\pgf@H@tpp@da{+0} - \pgfmathsetmacro\pgf@H@tpp@db{+0} - \pgfmathsetmacro\pgf@H@tpp@dc{+0} - -\def\pgfpointperspectivexyz#1#2#3{% - \pgfmathsetmacro\pgf@pp@w% - { \pgf@H@tpp@da*(#1) + \pgf@H@tpp@db*(#2) + \pgf@H@tpp@dc*(#3) + 1} - \pgfmathsetmacro\pgf@pp@x% - {(\pgf@H@tpp@aa*(#1) + \pgf@H@tpp@ab*(#2) + \pgf@H@tpp@ac*(#3))/\pgf@pp@w} - \pgfmathsetmacro\pgf@pp@y% - {(\pgf@H@tpp@ba*(#1) + \pgf@H@tpp@bb*(#2) + \pgf@H@tpp@bc*(#3))/\pgf@pp@w} - \pgfmathsetmacro\pgf@pp@z% - {(\pgf@H@tpp@ca*(#1) + \pgf@H@tpp@cb*(#2) + \pgf@H@tpp@cc*(#3))/\pgf@pp@w} -% - \pgf@x=\pgf@pp@x\pgf@xx% - \advance\pgf@x by \pgf@pp@y\pgf@yx% - \advance\pgf@x by \pgf@pp@z\pgf@zx% - \pgf@y=\pgf@pp@x\pgf@xy% - \advance\pgf@y by \pgf@pp@y\pgf@yy% - \advance\pgf@y by \pgf@pp@z\pgf@zy} - -\tikzdeclarecoordinatesystem{three point perspective} -{% - \tikzset{cs/.cd,x=0,y=0,z=0,#1}% - \pgfpointperspectivexyz{\tikz@cs@x}{\tikz@cs@y}{\tikz@cs@z} -} -\tikzaliascoordinatesystem{tpp}{three point perspective} - -\pgfkeys{ - /perspective/.cd, - p/.code args={(#1,#2,#3)}{ - \pgfmathparse{ifthenelse(#1,int(1),int(0))} - \ifnum\pgfmathresult=0\else - \pgfmathsetmacro\pgf@H@tpp@ba{#2/#1} - \pgfmathsetmacro\pgf@H@tpp@ca{#3/#1} - \pgfmathsetmacro\pgf@H@tpp@da{ 1/#1} - \fi - }, - q/.code args={(#1,#2,#3)}{ - \pgfmathparse{ifthenelse(#2,int(1),int(0))} - \ifnum\pgfmathresult=0\else - \pgfmathsetmacro\pgf@H@tpp@ab{#1/#2} - \pgfmathsetmacro\pgf@H@tpp@cb{#3/#2} - \pgfmathsetmacro\pgf@H@tpp@db{ 1/#2} - \fi - }, - r/.code args={(#1,#2,#3)}{ - \pgfmathparse{ifthenelse(#3,int(1),int(0))} - \ifnum\pgfmathresult=0\else - \pgfmathsetmacro\pgf@H@tpp@ac{#1/#3} - \pgfmathsetmacro\pgf@H@tpp@bc{#2/#3} - \pgfmathsetmacro\pgf@H@tpp@dc{ 1/#3} - \fi - }, -} - -\tikzset{ - perspective/.append code={\pgfkeys{/perspective/.cd,#1}}, - perspective/.default={ - p={(10,0,0)}, - q={(0,10,0)}, - r={(0,0,20)}}, -} - -\tikzset{ - 3d view/.code 2 args={ - % Set elevation and azimuth angles - \pgfmathsetmacro\pgf@view@az{#1} - \pgfmathsetmacro\pgf@view@el{#2} - % Calculate projections of rotation matrix - \pgfmathsetmacro\pgf@xvec@x{cos(\pgf@view@az)} - \pgfmathsetmacro\pgf@xvec@y{-sin(\pgf@view@az)*sin(\pgf@view@el)} - \pgfmathsetmacro\pgf@yvec@x{sin(\pgf@view@az)} - \pgfmathsetmacro\pgf@yvec@y{cos(\pgf@view@az)*sin(\pgf@view@el)} - \pgfmathsetmacro\pgf@zvec@x{+0} - \pgfmathsetmacro\pgf@zvec@y{cos(\pgf@view@el)} - % Set base vectors - \pgfsetxvec{\pgfpoint{\pgf@xvec@x cm}{\pgf@xvec@y cm}} - \pgfsetyvec{\pgfpoint{\pgf@yvec@x cm}{\pgf@yvec@y cm}} - \pgfsetzvec{\pgfpoint{\pgf@zvec@x cm}{\pgf@zvec@y cm}} - }, - 3d view/.default={-30}{15}, - isometric view/.style={3d view={-45}{atan(1/sqrt(2))}}, -} - -\endinput diff --git a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex index 1ce575aab62..2caf2c50695 100644 --- a/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex @@ -822,7 +822,7 @@ tikz@label@angle = #2, anchor=@auto, #1, - tikz@label@post = \tikz@label@distance] {\iftikz@handle@active@nodes\expandafter\pgfutil@scantokens\else\expandafter\pgfutil@firstofone\fi{#3\ignorespaces}} + tikz@label@post = \tikz@label@distance] {\iftikz@handle@active@nodes\expandafter\scantokens\else\expandafter\pgfutil@firstofone\fi{#3\ignorespaces}} \pgfextra{\global\let\tikz@last@fig@name=\tikz@save@last@fig@name} \egroup}}}% \endgroup @@ -852,7 +852,7 @@ tikz@label@angle = #2, anchor=@auto, #1, - tikz@label@post = \tikz@label@distance] {\iftikz@handle@active@nodes\expandafter\pgfutil@scantokens\else\expandafter\pgfutil@firstofone\fi{#3\ignorespaces}} + tikz@label@post = \tikz@label@distance] {\iftikz@handle@active@nodes\expandafter\scantokens\else\expandafter\pgfutil@firstofone\fi{#3\ignorespaces}} \pgfextra{\global\let\tikz@last@fig@name=\tikz@save@last@fig@name} \egroup}}}% @@ -1656,21 +1656,12 @@ % % Main TikZ Environment % -\newif\iftikz@inside@picture -\tikz@inside@picturefalse -\def\tikz@check@inside@picture{% - \iftikz@inside@picture% - \pgfwarning{Nesting tikzpictures is NOT supported}% - \fi% - \tikz@inside@picturetrue% -} \def\tikzpicture{% \begingroup% \tikz@startup@env% \tikz@collect@scope@anims\tikz@picture}% \def\tikz@picture[#1]{% - %\tikz@check@inside@picture% \pgfpicture% \let\tikz@atbegin@picture=\pgfutil@empty% \let\tikz@atend@picture=\pgfutil@empty% @@ -2018,7 +2009,6 @@ % settings. \def\tikz@command@path{% - \global\let\tikz@intersect@namedpaths=\pgfutil@empty% clear intersections \let\tikz@signal@path=\tikz@signal@path% for detection at begin of matrix cell \pgfutil@ifnextchar[{\tikz@check@earg}%] {\pgfutil@ifnextchar<{\tikz@doopt}{\tikz@@command@path}}}% @@ -2779,7 +2769,7 @@ \iftikz@collect@pic% \expandafter\def\expandafter\tikz@collected@onpath\expandafter{\tikz@collected@onpath{#1}}% \else% - \expandafter\def\expandafter\tikz@collected@onpath\expandafter{\tikz@collected@onpath{\pgfutil@scantokens{#1}}}% + \expandafter\def\expandafter\tikz@collected@onpath\expandafter{\tikz@collected@onpath{\scantokens{#1}}}% \fi% \else% \expandafter\def\expandafter\tikz@collected@onpath\expandafter{\tikz@collected@onpath{#1}}% @@ -3833,8 +3823,6 @@ {\tikzerror{Unknown shape ``\tikz@shape.'' Using ``rectangle'' instead}% \def\tikz@shape{rectangle}}% {}% - \expandafter\xdef\csname tikz@dcl@coord@\tikz@fig@name\endcsname{% - \csname tikz@scan@point@coordinate\endcsname}% \tikzset{every \tikz@shape\space node/.try}% \tikz@node@textfont% \tikz@node@begin@hook% @@ -3881,8 +3869,8 @@ \else% \pgfutil@colorlet{.}{\tikz@textcolor}% \fi% - % FIXME : this here is the proposed solution for <https://sourceforge.net/p/pgf/bugs/362/> - % but it caused <https://sourceforge.net/p/pgf/bugs/503/>. + % FIXME : this here is the proposed solution for https://sourceforge.net/p/pgf/bugs/362/ + % bit it caused https://sourceforge.net/p/pgf/bugs/503/ . % \pgfutil@color{.}% \setbox\tikz@figbox=\box\pgfutil@voidb@x% \setbox\tikz@figbox@bg=\box\pgfutil@voidb@x% @@ -4338,7 +4326,7 @@ \iftikz@node@is@pic% \expandafter\def\expandafter\tikz@nodes@collect\expandafter{\tikz@nodes@collect{#1}}% \else% - \expandafter\def\expandafter\tikz@nodes@collect\expandafter{\tikz@nodes@collect{\pgfutil@scantokens{#1}}}% + \expandafter\def\expandafter\tikz@nodes@collect\expandafter{\tikz@nodes@collect{\scantokens{#1}}}% \fi% \else% \expandafter\def\expandafter\tikz@nodes@collect\expandafter{\tikz@nodes@collect{#1}}% @@ -4677,7 +4665,7 @@ \tikz@p@c@s}% \def\tikz@p@c@s@group#1{% \iftikz@handle@active@nodes% - \expandafter\def\expandafter\tikz@child@node@text\expandafter{\tikz@child@node@text{\pgfutil@scantokens{#1}}}% + \expandafter\def\expandafter\tikz@child@node@text\expandafter{\tikz@child@node@text{\scantokens{#1}}}% \else% \expandafter\def\expandafter\tikz@child@node@text\expandafter{\tikz@child@node@text{#1}} \fi% @@ -5173,8 +5161,8 @@ {\tikz@scan@no@calculator#1(}% }% \def\tikz@scan@no@calculator#1(#2){% - \edef\tikz@scan@point@coordinate{(#2)}% - \expandafter\tikz@@scan@@no@calculator\expandafter#1\tikz@scan@point@coordinate% + \edef\tikz@temp{(#2)}% + \expandafter\tikz@@scan@@no@calculator\expandafter#1\tikz@temp% }% \def\tikz@@scan@@no@calculator#1(#2){% \pgfutil@in@{cs:}{#2}% @@ -5338,7 +5326,6 @@ \def\tikz@shapeborder@name{\tikz@pp@name{#2}}% \fi% \fi% - \expandafter\let\expandafter\tikz@declared@coordinate\csname tikz@dcl@coord@\tikz@pp@name{#2}\endcsname \edef\tikz@marshal{\noexpand#1{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}}% \tikz@marshal% }% diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf.lua index b0a32476167..da0aba39121 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf.lua @@ -19,7 +19,7 @@ pgf = {} --- Forward +-- Forward local tostring_table --- diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd.lua index 20d8acafa59..cf94454a494 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd.lua @@ -38,7 +38,7 @@ require("pgf").gd = gd -- this table is present, it will be used as the default table. Second, -- it can have a graph_parameters table. This table will be used in the -- constructor to preload graph parameters from the pgf layer. For --- this, each entry of the table should be of the form +-- this, each entry of the table should be of the form -- -- key = 'string' -- @@ -50,13 +50,13 @@ require("pgf").gd = gd function gd.new_algorithm_class (class) class.__index = class - class.new = - function (initial) + class.new = + function (initial) -- Create new object local obj = {} for k,v in pairs(initial) do - obj[k] = v + obj[k] = v end setmetatable(obj, class) @@ -69,4 +69,4 @@ function gd.new_algorithm_class (class) end -return gd +return gd
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/bindings/Binding.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/bindings/Binding.lua index 6ffb4168f52..5b60d90ccd6 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/bindings/Binding.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/bindings/Binding.lua @@ -38,7 +38,7 @@ local Storage = require "pgf.gd.lib.Storage" -- -- @field storage A |Storage| storing the information passed from the -- display layer. The interpretation of this left to the actual --- binding. +-- binding. local Binding = { storage = Storage.newTableStorage () @@ -71,7 +71,7 @@ end -- of the display layer to make the parameter |t.key| available to the -- parsing process. Furthermore, if |t.initial| is not |nil|, the -- display layer must convert it into a value that is stored as the --- initial value and call |InterfaceToDisplay.setOptionInitial|. +-- initial value and call |InterfaceToDisplay.setOptionInitial|. -- -- @param t See |InterfaceToAlgorithms.declare| for details. @@ -105,7 +105,7 @@ end --- --- This function and the corresponding |...Stop...| functions are +-- This function and the correspoding |...Stop...| functions are -- called whenever a collection kind should be rendered. See -- |InterfaceToDisplay.render_collections| for details. -- @@ -141,7 +141,7 @@ end --- --- This function and the corresponding |...Stop...| functions are +-- This function and the correspoding |...Stop...| functions are -- called whenever a vertex should be rendered. See -- |InterfaceToDisplay.render_vertices| for details. -- @@ -191,7 +191,7 @@ end --- --- This function and the corresponding |...Stop...| functions are +-- This function and the correspoding |...Stop...| functions are -- called whenever an edge should be rendered. See -- |InterfaceToDisplay.render_edges| for details. -- @@ -237,22 +237,21 @@ end -- vertex. This call will be made while an algorithm is running. It is -- now the job of the binding to cause the display layer to create the -- node. This is done by calling the |yield| method of the scope's --- coroutine. +-- coroutine. -- -- @param init A table of initial values for the node. The following -- fields will be used: --- % -- \begin{itemize} --- \item |name| If present, this name will be given to the --- node. If not present, an internal name is generated. Note that, --- unless the node is a subgraph node, this name may not be the name --- of an already present node of the graph; in this case an error --- results. --- \item |shape| If present, a shape of the node. --- \item |generated_options| A table that is passed back to the --- display layer as a list of key--value pairs. --- \item |text| The text of the node, to be passed back to the --- higher layer. This is what should be displayed as the node's text. +-- \item |name| If present, this name will be given to the +-- node. If not present, an iternal name is generated. Note that, +-- unless the node is a subgraph node, this name may not be the name +-- of an already present node of the graph; in this case an error +-- results. +-- \item |shape| If present, a shape of the node. +-- \item |generated_options| A table that is passed back to the +-- display layer as a list of key-value pairs. +-- \item |text| The text of the node, to be passed back to the +-- higher layer. This is what should be displayed as the node's text. -- \end{itemize} function Binding:createVertex(init) diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/bindings/BindingToPGF.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/bindings/BindingToPGF.lua index 5324a1652e6..90519e23d55 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/bindings/BindingToPGF.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/bindings/BindingToPGF.lua @@ -20,7 +20,7 @@ local Storage = require "pgf.gd.lib.Storage" -- drawing system to the \pgfname\ display system by overriding (that -- is, implementing) the methods of the |Binding| class. As a typical -- example, consider the implementation of the function |renderVertex|: --- % +-- --\begin{codeexample}[code only, tikz syntax=false] --function BindingToPGF:renderVertex(v) -- local info = assert(self.infos[v], "thou shalt not modify the syntactic digraph") @@ -44,7 +44,7 @@ local Storage = require "pgf.gd.lib.Storage" -- (new) position for the node. For almost all methods of the -- |Binding| class there is a corresponding ``callback'' macro on the -- \TeX\ layer, all of which are implemented in the \pgfname\ library --- |graphdrawing|. For details on these callbacks, +-- |graphdrawing|. For details on these callbacks, -- please consult the code of that file and of the class -- |BindingToPGF| (they are not documented here since they are local -- to the binding and should not be called by anyone other than the @@ -81,7 +81,7 @@ local coordinate_in_pgf_syntax function BindingToPGF:resumeGraphDrawingCoroutine(text) tex.print(text) - tex.print("\\pgfgdresumecoroutinetrue") + tex.print("\\pgfgdresumecoroutinetrue") end @@ -108,7 +108,7 @@ end function BindingToPGF:renderCollection(collection) tex.print("\\pgfgdcallbackrendercollection{".. collection.kind .. "}{" - .. table_in_pgf_syntax(collection.generated_options) .. "}") + .. table_in_pgf_syntax(collection.generated_options) .. "}") end function BindingToPGF:renderCollectionStartKind(kind, layer) @@ -133,11 +133,11 @@ local box_count = 0 function BindingToPGF:everyVertexCreation(v) local info = self.storage[v] - + -- Save the box! box_count = box_count + 1 boxes[box_count] = node.copy_list(tex.box[info.tex_box_number]) - + -- Special tex stuff, should not be considered by gd algorithm info.box_count = box_count end @@ -180,12 +180,12 @@ local function rigid(x) end end - + -- Managing edges function BindingToPGF:renderEdge(e) local info = assert(self.storage[e], "thou shalt not modify the syntactic digraph") - + local function get_anchor(e, anchor) local a = e.options[anchor] if a and a ~= "" then @@ -194,7 +194,7 @@ function BindingToPGF:renderEdge(e) return "" end end - + local callback = { '\\pgfgdcallbackedge', '{', e.tail.name .. get_anchor(e, "tail anchor"), '}', @@ -205,12 +205,12 @@ function BindingToPGF:renderEdge(e) '{', table_in_pgf_syntax(e.generated_options), '}', '{' } - + local i = 1 while i <= #e.path do local c = e.path[i] assert (type(c) == "string", "illegal path operand") - + if c == "lineto" then i = i + 1 local d = rigid(e.path[i]) @@ -231,19 +231,19 @@ function BindingToPGF:renderEdge(e) .. to_pt(d2.x) .. ',' .. to_pt(d2.y) .. ')..' callback [#callback + 1] = '(' .. to_pt(d3.x) .. ',' .. to_pt(d3.y) .. ')' i = i + 1 - else + else error("illegal operation in edge path") end end callback [#callback + 1] = '}' callback [#callback + 1] = '{' .. animations_in_pgf_syntax(e.animations) .. '}' - + -- hand TikZ code over to TeX tex.print(table.concat(callback)) end - - + + function BindingToPGF:renderEdgesStart() tex.print("\\pgfgdcallbackbeginedgeshipout") end @@ -275,12 +275,12 @@ function table_in_pgf_syntax (t) local prefix = "/graph drawing/" local suffix = "/.try" return table.concat( lib.imap( t, function(table) - if table.value then - return prefix .. table.key .. suffix .. "={" .. tostring(table.value) .. "}" - else - return prefix .. table.key .. suffix - end - end), ",") + if table.value then + return prefix .. table.key .. suffix .. "={" .. tostring(table.value) .. "}" + else + return prefix .. table.key .. suffix + end + end), ",") end @@ -288,29 +288,29 @@ function animations_in_pgf_syntax (a) return table.concat( lib.imap( - a, - function(animation) - return "\\pgfanimateattribute{" .. animation.attribute .. "}{whom=pgf@gd," .. - table.concat( - lib.imap ( - animation.entries, - function (entry) - return "entry={" .. entry.t .. "s}{" .. to_pgf(entry.value) .. "}" - end - ), ",") .. - "," .. - table.concat( - lib.imap( - animation.options or {}, - function(table) - if table.value then - return table.key .. "={" .. to_pgf(table.value) .. "}" - else - return table.key - end - end), ",") - .. "}" - end) + a, + function(animation) + return "\\pgfanimateattribute{" .. animation.attribute .. "}{whom=pgf@gd," .. + table.concat( + lib.imap ( + animation.entries, + function (entry) + return "entry={" .. entry.t .. "s}{" .. to_pgf(entry.value) .. "}" + end + ), ",") .. + "," .. + table.concat( + lib.imap( + animation.options or {}, + function(table) + if table.value then + return table.key .. "={" .. to_pgf(table.value) .. "}" + else + return table.key + end + end), ",") + .. "}" + end) ) end @@ -332,12 +332,12 @@ end function path_in_pgf_syntax (p) local s = {} - + local i = 1 while i <= #p do local c = p[i] assert (type(c) == "string", "illegal path operand") - + if c == "lineto" then i = i + 1 local d = rigid(p[i]) @@ -355,10 +355,10 @@ function path_in_pgf_syntax (p) local d1, d2, d3 = rigid(p[i+1]), rigid(p[i+2]), rigid(p[i+3]) i = i + 3 s [#s + 1] = '\\pgfpathcurveto{\\pgfqpoint{' .. to_pt(d1.x) .. '}{' .. to_pt(d1.y) .. '}}{\\pgfqpoint{' - .. to_pt(d2.x) .. '}{' .. to_pt(d2.y) .. '}}{\\pgfqpoint{' - .. to_pt(d3.x) .. '}{' .. to_pt(d3.y) .. '}}' + .. to_pt(d2.x) .. '}{' .. to_pt(d2.y) .. '}}{\\pgfqpoint{' + .. to_pt(d3.x) .. '}{' .. to_pt(d3.y) .. '}}' i = i + 1 - else + else error("illegal operation in edge path") end end diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/circular/Tantau2012.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/circular/Tantau2012.lua index bebb87ab3e1..8e0d7d5bc66 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/circular/Tantau2012.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/circular/Tantau2012.lua @@ -22,7 +22,7 @@ local Tantau2012 = {} declare { key = "simple necklace layout", algorithm = Tantau2012, - + postconditions = { upward_oriented = true }, @@ -48,15 +48,15 @@ function Tantau2012:run() local g = self.ugraph local vertices = g.vertices local n = #vertices - + local sib_dists = self:computeNodeDistances () local radii = self:computeNodeRadii() local diam, adjusted_radii = self:adjustNodeRadii(sib_dists, radii) - -- Compute total necessary length. For this, iterate over all - -- consecutive pairs and keep track of the necessary space for - -- this node. We imagine the nodes to be aligned from left to - -- right in a line. + -- Compute total necessary length. For this, iterate over all + -- consecutive pairs and keep track of the necessary space for + -- this node. We imagine the nodes to be aligned from left to + -- right in a line. local carry = 0 local positions = {} local function wrap(i) return (i-1)%n + 1 end @@ -67,11 +67,11 @@ function Tantau2012:run() local node_sep = lib.lookup_option('node post sep', vertices[i], g) + lib.lookup_option('node pre sep', vertices[wrap(i+1)], g) - local arc = node_sep + adjusted_radii[i] + adjusted_radii[wrap(i+1)] + local arc = node_sep + adjusted_radii[i] + adjusted_radii[wrap(i+1)] local needed = carry + arc local dist = math.sin( arc/diam ) * diam needed = needed + math.max ((radii[i] + radii[wrap(i+1)]+node_sep)-dist, 0) - carry = math.max(needed-sib_dists[i],0) + carry = math.max(needed-sib_dists[i],0) end local length = ideal_pos + carry @@ -98,15 +98,15 @@ function Tantau2012:computeNodeDistances() local missing_length = self.digraph.options['radius'] * 2 * math.pi - sum_length if missing_length > 0 then - -- Ok, the sib_dists to not add up to the desired minimum value. - -- What should we do? Hmm... We increase all by the missing amount: - for i=1,#vertices do - sib_dists[i] = sib_dists[i] + missing_length/#vertices - end + -- Ok, the sib_dists to not add up to the desired minimum value. + -- What should we do? Hmm... We increase all by the missing amount: + for i=1,#vertices do + sib_dists[i] = sib_dists[i] + missing_length/#vertices + end end sib_dists.total = math.max(self.digraph.options['radius'] * 2 * math.pi, sum_length) - + return sib_dists end @@ -130,24 +130,24 @@ function Tantau2012:adjustNodeRadii(sib_dists,radii) local total = 0 local max_rad = 0 for i=1,#radii do - total = total + 2*radii[i] + total = total + 2*radii[i] + lib.lookup_option('node post sep', self.digraph.vertices[i], self.digraph) + lib.lookup_option('node pre sep', self.digraph.vertices[i], self.digraph) - max_rad = math.max(max_rad, radii[i]) + max_rad = math.max(max_rad, radii[i]) end total = math.max(total, sib_dists.total, max_rad*math.pi) local diam = total/(math.pi) - + -- Now, adjust the radii: local adjusted_radii = {} for i=1,#radii do adjusted_radii[i] = (math.pi - 2*math.acos(radii[i]/diam))*diam/2 end - + return diam, adjusted_radii end -- done -return Tantau2012 +return Tantau2012
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/circular/doc.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/circular/doc.lua index 0bd9090a1c1..e532e783e11 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/circular/doc.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/circular/doc.lua @@ -19,23 +19,20 @@ local example = require 'pgf.gd.doc'.example key "simple necklace layout" summary -[[ -This simple layout arranges the nodes in a circle, which is -especially useful for drawing, well, circles of nodes. -]] +[[ This simple layout arranges the nodes in a circle, which is +especially useful for drawing, well, circles of nodes. ]] documentation [[ The name |simple necklace layout| is reminiscent of the more general -``necklace layout'', a term coined by Speckmann and Verbeek in +``necklace layout,'' a term coined by Speckmann and Verbeek in their paper -% \begin{itemize} - \item - Bettina Speckmann and Kevin Verbeek, - \newblock Necklace Maps, - \newblock \emph{IEEE Transactions on Visualization and Computer - Graphics,} 16(6):881--889, 2010. +\item + Bettina Speckmann and Kevin Verbeek, + \newblock Necklace Maps, + \newblock \emph{IEEE Transactions on Visualization and Computer + Graphics,} 16(6):881--889, 2010. \end{itemize} For a |simple necklace layout|, the centers of the nodes @@ -44,7 +41,7 @@ node at the |grow| direction (for |grow'|, the circle is clockwise). The order of the nodes is the order in which they appear in the graph, the edges are not taken into consideration, unless the |componentwise| option is given. -% + \begin{codeexample}[] \tikz[>=spaced stealth'] \graph [simple necklace layout, grow'=down, node sep=1em, @@ -52,38 +49,35 @@ in the graph, the edges are not taken into consideration, unless the { x_1 -> x_2 -> x_3 -> x_4 -> x_5 -> "\dots"[draw=none] -> "x_{n-1}" -> x_n -> x_1 - }; + }; \end{codeexample} - + When you give the |componentwise| option, the graph will be decomposed into connected components, which are then laid out individually and packed using the usual component packing mechanisms: -% + \begin{codeexample}[] \tikz \graph [simple necklace layout] { a -- b -- c -- d -- a, 1 -- 2 -- 3 -- 1 -}; +}; \end{codeexample} -% \begin{codeexample}[] \tikz \graph [simple necklace layout, componentwise] { a -- b -- c -- d -- a, 1 -- 2 -- 3 -- 1 -}; +}; \end{codeexample} - + The nodes are placed in such a way that -% \begin{enumerate} - \item The (angular) distance between the centers of consecutive - nodes is at least |node distance|, - \item the distance between the borders of consecutive nodes is at - least |node sep|, and - \item the radius is at least |radius|. +\item The (angular) distance between the centers of consecutive + nodes is at least |node distance|, +\item the distance between the borders of consecutive nodes is at + least |node sep|, and +\item the radius is at least |radius|. \end{enumerate} -% The radius of the circle is chosen near-minimal such that the above properties are satisfied. To be more precise, if all nodes are circles, the radius is chosen optimally while for, say, rectangular @@ -107,8 +101,8 @@ example node sep=0pt, node distance=0pt, nodes={draw,circle}] { 1 -- 2 [minimum size=30pt] -- 3 -- - 4 [minimum size=50pt] -- 5 [minimum size=40pt] -- 6 -- 7 }; - + 4 [minimum size=50pt] -- 5 [minimum size=40pt] -- 6 -- 7 }; + \draw [red] (0,-1.25) circle []; \end{tikzpicture} ]] @@ -119,7 +113,7 @@ example node sep=0pt, node distance=1cm, nodes={draw,circle}] { 1 -- 2 [minimum size=30pt] -- 3 -- - 4 [minimum size=50pt] -- 5 [minimum size=40pt] -- 6 -- 7 }; + 4 [minimum size=50pt] -- 5 [minimum size=40pt] -- 6 -- 7 }; ]] example @@ -128,7 +122,7 @@ example node sep=2pt, node distance=0pt, nodes={draw,circle}] { 1 -- 2 [minimum size=30pt] -- 3 -- - 4 [minimum size=50pt] -- 5 [minimum size=40pt] -- 6 -- 7 }; + 4 [minimum size=50pt] -- 5 [minimum size=40pt] -- 6 -- 7 }; ]] example @@ -137,6 +131,6 @@ example node sep=0pt, node distance=0pt, nodes={rectangle,draw}] { 1 -- 2 [minimum size=30pt] -- 3 -- - 4 [minimum size=50pt] -- 5 [minimum size=40pt] -- 6 -- 7 }; + 4 [minimum size=50pt] -- 5 [minimum size=40pt] -- 6 -- 7 }; ]] -------------------------------------------------------------------- diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/Anchoring.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/Anchoring.lua index 03a05ee627d..ccbb097583c 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/Anchoring.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/Anchoring.lua @@ -23,29 +23,29 @@ -- \emph{absolutely} once all relative positions have been computed. In -- case that the graph consists of several unconnected components, the -- situation is even more complicated. --- +-- -- The order in which the algorithm layer determines the node at which -- the graph should be anchored: --- % +-- -- \begin{enumerate} --- \item If the |anchor node=|\meta{node name} option given to the graph --- as a whole, the graph is anchored at \meta{node name}, provided --- there is a node of this name in the graph. (If there is no node of --- this name or if it is misspelled, the effect is the same as if this --- option had not been given at all.) --- \item Otherwise, if there is a node where the |anchor here| option is --- specified, the first node with this option set is used. --- \item Otherwise, if there is a node where the |desired at| option is --- set (perhaps implicitly through keys like |x|), the first such node --- is used. --- \item Finally, in all other cases, the first node is used. +-- \item If the |anchor node=|\meta{node name} option given to the graph +-- as a whole, the graph is anchored at \meta{node name}, provided +-- there is a node of this name in the graph. (If there is no node of +-- this name or if it is misspelled, the effect is the same as if this +-- option had not been given at all.) +-- \item Otherwise, if there is a node where the |anchor here| option is +-- specified, the first node with this option set is used. +-- \item Otherwise, if there is a node where the |desired at| option is +-- set (perhaps implicitly through keys like |x|), the first such node +-- is used. +-- \item Finally, in all other cases, the first node is used. -- \end{enumerate} -- -- In the above description, the ``first'' node refers to the node first -- encountered in the specification of the graph. -- -- Once the node has been determined, the graph is shifted so that --- this node lies at the position specified by |anchor at|. +-- this node lies at the poistion specified by |anchor at|. -- -- @end @@ -70,7 +70,7 @@ declare { type = "coordinate", documentation_in = "pgf.gd.control.doc" } - + --- declare { key = "anchor node", diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/ComponentAlign.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/ComponentAlign.lua index 5e5b0635bf4..dec07caaccd 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/ComponentAlign.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/ComponentAlign.lua @@ -47,22 +47,22 @@ local declare = require "pgf.gd.interface.InterfaceToAlgorithms".declare -- -- @end - + --- - + declare { key = "align here", type = "boolean", - summary = [[" - When this option is given to a node, this alignment line will go - through the origin of this node. If this option is passed to more - than one node of a component, the node encountered first in the - component is used. + summary = [[" + When this option is given to a node, this alignment line will go + through the origin of this node. If this option is passed to more + than one node of a component, the node encountered first in the + component is used. "]], - examples = [[" - \tikz \graph [binary tree layout, nodes={draw}] - { a, b -- c[align here], d -- e[second, align here] -- f }; + examples = [[" + \tikz \graph [binary tree layout, nodes={draw}] + { a, b -- c[align here], d -- e[second, align here] -- f }; "]] } @@ -72,94 +72,81 @@ declare { key = "component align", type = "string", initial = "first node", - + summary = [[" Specifies a ``strategy'' for the alignment of components. "]], - documentation = [[" - The following values are permissible: - % - \begin{itemize} - \item \declare{|first node|} - - In each component, the alignment line goes through the center of - the first node of the component encountered during specification - of the component. - % + documentation = [[" + The following values are permissible: + \begin{itemize} + \item \declare{|first node|} + In each component, the alignment line goes through the center of + the first node of the component encountered during specification + of the component. \begin{codeexample}[] \tikz \graph [binary tree layout, nodes={draw}, component align=first node] { a, b -- c, d -- e[second] -- f }; \end{codeexample} - % - \item \declare{|center|} - - The nodes of the component are projected onto the shift line. The - alignment line is now chosen so that it is exactly in the middle - between the maximum and minimum value that the projected nodes - have on the shift line. - % + \item \declare{|center|} + + The nodes of the component are projected onto the shift line. The + alignment line is now chosen so that it is exactly in the middle + between the maximum and minimum value that the projected nodes + have on the shift line. \begin{codeexample}[] \tikz \graph [binary tree layout, nodes={draw}, component align=center] { a, b -- c, d -- e[second] -- f }; \end{codeexample} - % \begin{codeexample}[] \tikz \graph [binary tree layout, nodes={draw}, component direction=90, component align=center] { a, b -- c, d -- e[second] -- f }; \end{codeexample} - % - \item \declare{|counterclockwise|} - - As for |center|, we project the nodes of the component onto the - shift line. The alignment line is now chosen so that it goes - through the center of the node whose center has the highest - projected value. - % + \item \declare{|counterclockwise|} + + As for |center|, we project the nodes of the component onto the + shift line. The alignment line is now chosen so that it goes + through the center of the node whose center has the highest + projected value. \begin{codeexample}[] \tikz \graph [binary tree layout, nodes={draw}, component align=counterclockwise] { a, b -- c, d -- e[second] -- f }; \end{codeexample} - % \begin{codeexample}[] \tikz \graph [binary tree layout, nodes={draw}, component direction=90, component align=counterclockwise] { a, b -- c, d -- e[second] -- f }; \end{codeexample} - The name |counterclockwise| is intended to indicate that the align - line goes through the node that comes last if we go from the - alignment direction in a counter-clockwise direction. - \item \declare{|clockwise|} - - Works like |counterclockwise|, only in the other direction: - % + The name |counterclockwise| is intended to indicate that the align + line goes through the node that comes last if we go from the + alignment direction in a counter-clockwise direction. + \item \declare{|clockwise|} + + Works like |counterclockwise|, only in the other direction: \begin{codeexample}[] \tikz \graph [binary tree layout, nodes={draw}, component align=clockwise] { a, b -- c, d -- e[second] -- f }; \end{codeexample} - % \begin{codeexample}[] \tikz \graph [binary tree layout, nodes={draw}, component direction=90, component align=clockwise] { a, b -- c, d -- e[second] -- f }; \end{codeexample} - % - \item \declare{|counterclockwise bounding box|} - - This method is quite similar to |counterclockwise|, only the - alignment line does not go through the center of the node with a - maximum projected value on the shift line, but through the maximum - value of the projected bounding boxes. For a left-to-right - packing, this means that the components are aligned so that the - bounding boxes of the components are aligned at the top. - % + \item \declare{|counterclockwise bounding box|} + + This method is quite similar to |counterclockwise|, only the + alignment line does not go through the center of the node with a + maximum projected value on the shift line, but through the maximum + value of the projected bounding boxes. For a left-to-right + packing, this means that the components are aligned so that the + bounding boxes of the components are aligned at the top. \begin{codeexample}[] \tikz \graph [tree layout, nodes={draw, align=center}, component sep=0pt, @@ -170,11 +157,10 @@ declare { component align=counterclockwise bounding box] { a, "high\\node" -- b}; \end{codeexample} - % - \item \declare{|clockwise bounding box|} - - Works like |counterclockwise bounding box|. - \end{itemize} + \item \declare{|clockwise bounding box|} + + Works like |counterclockwise bounding box|. + \end{itemize} "]] } @@ -187,16 +173,16 @@ declare { { key = "component align", value = "counterclockwise"}, }, - summary = [[" - Shorthand for |component direction=right| and - |component align=counterclockwise|. This means that, as the name - suggest, the components will be placed left-to-right and they are - aligned such that their top nodes are in a line. + summary = [[" + Shorthand for |component direction=right| and + |component align=counterclockwise|. This means that, as the name + suggest, the components will be placed left-to-right and they are + aligned such that their top nodes are in a line. "]], - examples = [[" - \tikz \graph [tree layout, nodes={draw, align=center}, - components go right top aligned] - { a, "high\\node" -- b}; + examples = [[" + \tikz \graph [tree layout, nodes={draw, align=center}, + components go right top aligned] + { a, "high\\node" -- b}; "]] } @@ -208,17 +194,17 @@ declare { { key = "component direction", value=0}, { key = "component align", value = "counterclockwise bounding box"}, }, - - summary = [[" - Like |components go right top aligned|, but with - |component align| set to |counterclockwise| |bounding box|. - This means that the components will be aligned with their bounding - boxed being top-aligned. + + summary = [[" + Like |components go right top aligned|, but with + |component align| set to |counterclockwise| |bounding box|. This means that the + components will be aligned with their bounding boxed being + top-aligned. "]], examples = [[" - \tikz \graph [tree layout, nodes={draw, align=center}, - components go right absolute top aligned] - { a, "high\\node" -- b}; + \tikz \graph [tree layout, nodes={draw, align=center}, + components go right absolute top aligned] + { a, "high\\node" -- b}; "]] } @@ -230,7 +216,7 @@ declare { { key = "component direction", value=0}, { key = "component align", value = "clockwise"}, }, - + summary = "See the other |components go ...| keys." } @@ -243,7 +229,7 @@ declare { { key = "component direction", value=0}, { key = "component align", value = "clockwise bounding box"}, }, - + summary = "See the other |components go ...| keys." } @@ -256,7 +242,7 @@ declare { { key = "component direction", value=0}, { key = "component align", value = "center"}, }, - + summary = "See the other |components go ...| keys." } @@ -269,11 +255,11 @@ declare { { key = "component direction", value=0}, { key = "component align", value = "first node"}, }, - - summary = [[" - Shorthand for |component direction=right| and - |component align=first node|. - "]] + + summary = [[" + Shorthand for |component direction=right| and + |component align=first node|. + "]] } @@ -285,13 +271,13 @@ declare { { key = "component direction", value=180}, { key = "component align", value = "clockwise"}, }, - + summary = "See the other |components go ...| keys.", - examples = [[" - \tikz \graph [tree layout, nodes={draw, align=center}, - components go left top aligned] - { a, "high\\node" -- b}; + examples = [[" + \tikz \graph [tree layout, nodes={draw, align=center}, + components go left top aligned] + { a, "high\\node" -- b}; "]] } @@ -304,7 +290,7 @@ declare { { key = "component direction", value=180}, { key = "component align", value = "clockwise bounding box"}, }, - + summary = "See the other |components go ...| keys." } @@ -318,7 +304,7 @@ declare { { key = "component direction", value=180}, { key = "component align", value = "counterclockwise"}, }, - + summary = "See the other |components go ...| keys." } @@ -332,7 +318,7 @@ declare { { key = "component direction", value=180}, { key = "component align", value = "counterclockwise bounding box"}, }, - + summary = "See the other |components go ...| keys." } @@ -374,15 +360,17 @@ declare { }, summary = "See the other |components go ...| keys.", - examples = {[[" - \tikz \graph [tree layout, nodes={draw, align=center}, - components go down left aligned] - { a, hello -- {world,s} }; - "]],[[" - \tikz \graph [tree layout, nodes={draw, align=center}, - components go up absolute left aligned] - { a, hello -- {world,s}}; - "]] + examples = { + [[" + \tikz \graph [tree layout, nodes={draw, align=center}, + components go down left aligned] + { a, hello -- {world,s} }; + "]], + [[" + \tikz \graph [tree layout, nodes={draw, align=center}, + components go up absolute left aligned] + { a, hello -- {world,s}}; + "]] } } diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/ComponentDirection.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/ComponentDirection.lua index f941ff226ec..a84800d94cf 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/ComponentDirection.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/ComponentDirection.lua @@ -25,32 +25,35 @@ declare { type = "direction", initial = "0", - summary = [[" - The \meta{angle} is used to determine the relative position of each - component relative to the previous one. The direction need not be a - multiple of |90|. As usual, you can use texts like |up| or - |right| instead of a number. + summary = [[" + The \meta{angle} is used to determine the relative position of each + component relative to the previous one. The direction need not be a + multiple of |90|. As usual, you can use texts like |up| or + |right| instead of a number. "]], - documentation = [[" - As the examples show, the direction only has an influence on the - relative positions of the components, not on the direction of growth - inside the components. In particular, the components are not rotated - by this option in any way. You can use the |grow| option or |orient| - options to orient individual components. + documentation = [[" + As the examples show, the direction only has an influence on the + relative positions of the components, not on the direction of growth + inside the components. In particular, the components are not rotated + by this option in any way. You can use the |grow| option or |orient| + options to orient individual components. "]], - examples = {[[" - \tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle}, - component direction=left] - { a, b, c -- d -- e, f -- g }; - "]],[[" - \tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle}, - component direction=10] - { a, b, c -- d -- e, f -- g }; - "]],[[" - \tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle}, - component direction=up] - { a, b, c [grow=right] -- d -- e, f[grow=45] -- g }; - "]] + examples = { + [[" + \tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle}, + component direction=left] + { a, b, c -- d -- e, f -- g }; + "]], + [[" + \tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle}, + component direction=10] + { a, b, c -- d -- e, f -- g }; + "]], + [[" + \tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle}, + component direction=up] + { a, b, c [grow=right] -- d -- e, f[grow=45] -- g }; + "]] } } diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/ComponentDistance.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/ComponentDistance.lua index 7ba4d000a7a..5bf473e9c6a 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/ComponentDistance.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/ComponentDistance.lua @@ -23,7 +23,7 @@ local declare = require "pgf.gd.interface.InterfaceToAlgorithms".declare -- -- @end - + --- declare { @@ -31,74 +31,70 @@ declare { type = "string", initial = "skyline", - documentation = [[" - Given two components, their distance is computed as follows in - dependence of \meta{method}: - % - \begin{itemize} - \item \declare{|rectangular|} - - Imagine a bounding box to be drawn around both components. They - are then shifted such that the padding (separating distance) - between the two boxes is the current value of |component sep|. - % - \begin{codeexample}[] - \tikz \graph [tree layout, nodes={draw}, component sep=0pt, - component packing=rectangular] - { a -- long text, longer text -- b}; - \end{codeexample} - % - \item \declare{|skyline|} - - The ``skyline method'' is used to compute the distance. It works - as follows: For simplicity, assume that the component direction is - right (other case work similarly, only everything is - rotated). Imaging the second component to be placed far right - beyond the first component. Now start moving the second component - back to the left until one of the nodes of the second component - touches a node of the first component, and stop. Again, the - padding |component sep| can be used to avoid the nodes actually - touching each other. - % - \begin{codeexample}[] - \tikz \graph [tree layout, nodes={draw}, component sep=0pt, - level distance=1.5cm, - component packing=skyline] - { a -- long text, longer text -- b}; - \end{codeexample} - - In order to avoid nodes of the second component ``passing through - a hole in the first component'', the actual algorithm is a bit - more complicated: For both components, a ``skyline'' is - computed. For the first component, consider an arbitrary - horizontal line. If there are one or more nodes on this line, the - rightmost point on any of the bounding boxes of these nodes will - be the point on the skyline of the first component for this - line. Similarly, for the second component, for each horizontal - level the skyline is given by the leftmost point on any of the - bounding boxes intersecting the line. - - Now, the interesting case are horizontal lines that do not - intersect any of the nodes of the first and/or second - component. Such lines represent ``holes'' in the skyline. For - them, the following rule is used: Move the horizontal line upward - and downward as little as possible until a height is reached where - there is a skyline defined. Then the skyline position on the - original horizontal line is the skyline position at the reached - line, minus (or, for the second component, plus) the distance by - which the line was moved. This means that the holes are ``filled - up by slanted roofs''. - % - \begin{codeexample}[] - \begin{tikzpicture} - \graph [tree layout, nodes={draw}, component sep=0pt, - component packing=skyline] - { a -- long text, longer text -- b}; - \draw[red] (long text.north east) -- ++(north west:1cm); - \end{tikzpicture} - \end{codeexample} - - \end{itemize} + documentation = [[" + Given two components, their distance is computed as follows in + depencende of \meta{method}: + \begin{itemize} + \item \declare{|rectangular|} + + Imagine a bounding box to be drawn around both components. They + are then shifted such that the padding (separating distance) + between the two boxes is the current value of |component sep|. + \begin{codeexample}[] + \tikz \graph [tree layout, nodes={draw}, component sep=0pt, + component packing=rectangular] + { a -- long text, longer text -- b}; + \end{codeexample} + \item \declare{|skyline|} + + The ``skyline method'' is used to compute the distance. It works + as follows: For simplicity, assume that the component direction is + right (other case work similary, only everything is + rotated). Imaging the second component to be placed far right + beyond the first component. Now start moving the second component + back to the left until one of the nodes of the second component + touches a node of the first component, and stop. Again, the + padding |component sep| can be used to avoid the nodes actually + touching each other. + + \begin{codeexample}[] + \tikz \graph [tree layout, nodes={draw}, component sep=0pt, + level distance=1.5cm, + component packing=skyline] + { a -- long text, longer text -- b}; + \end{codeexample} + + In order to avoid nodes of the second component ``passing through + a hole in the first component,'' the actual algorithm is a bit + more complicated: For both components, a ``skyline'' is + computed. For the first component, consider an arbitrary + horizontal line. If there are one or more nodes on this line, the + rightmost point on any of the bounding boxes of these nodes will + be the point on the skyline of the first component for this + line. Similarly, for the second component, for each horizontal + level the skyline is given by the leftmost point on any of the + bounding boxes intersecting the line. + + Now, the interesting case are horizontal lines that do not + intersect any of the nodes of the first and/or second + component. Such lines represent ``holes'' in the skyline. For + them, the following rule is used: Move the horizontal line upward + and downward as little as possible until a height is reached where + there is a skyline defined. Then the skyline position on the + original horizontal line is the skyline position at the reached + line, minus (or, for the second component, plus) the distance by + which the line was moved. This means that the holes are ``filled + up by slanted roofs.'' + \begin{codeexample}[] + \begin{tikzpicture} + \graph [tree layout, nodes={draw}, component sep=0pt, + component packing=skyline] + { a -- long text, longer text -- b}; + \draw[red] (long text.north east) -- ++(north west:1cm); + \end{tikzpicture} + \end{codeexample} + + \end{itemize} "]] } diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/ComponentOrder.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/ComponentOrder.lua index 78537b614cd..0cad5d7d9b5 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/ComponentOrder.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/ComponentOrder.lua @@ -13,7 +13,7 @@ local declare = require "pgf.gd.interface.InterfaceToAlgorithms".declare - + --- -- @section subsubsection {Ordering the Components} @@ -33,44 +33,46 @@ declare { initial = "by first specified node", summary = [[" - Selects a ``strategy'' for ordering the components. By default, - they are ordered in the way they appear in the input. + Selects a ``strategy'' for ordering the components. By default, + they are ordered in the way they appear in the input. "]], - documentation = [[" - The following values are permissible for \meta{strategy} - % - \begin{itemize} - \item \declare{|by first specified node|} - - The components are ordered ``in the way they appear in the input - specification of the graph''. More precisely, for each component - consider the node that is first encountered in the description - of the graph. Order the components in the same way as these nodes - appear in the graph description. - \item \declare{|increasing node number|} - - The components are ordered by increasing number of nodes. For - components with the same number of nodes, the first node in each - component is considered and they are ordered according to the - sequence in which these nodes appear in the input. - - \item \declare{|decreasing node number|} - As above, but in decreasing order. - \end{itemize} + documentation = [[" + The following values are permissible for \meta{strategy} + \begin{itemize} + \item \declare{|by first specified node|} + + The components are ordered ``in the way they appear in the input + specification of the graph''. More precisely, for each component + consider the node that is first encountered in the description + of the graph. Order the components in the same way as these nodes + appear in the graph description. + + \item \declare{|increasing node number|} + + The components are ordered by increasing number of nodes. For + components with the same number of nodes, the first node in each + component is considered and they are ordered according to the + sequence in which these nodes appear in the input. + + \item \declare{|decreasing node number|} + As above, but in decreasing order. + \end{itemize} "]], - examples = {[[" - \tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle}, - component order=by first specified node] - { a, b, c, f -- g, c -- d -- e }; - "]],[[" - \tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle}, - component order=increasing node number] - { a, b, c -- d -- e, f -- g }; - "]] + examples = { + [[" + \tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle}, + component order=by first specified node] + { a, b, c, f -- g, c -- d -- e }; + "]], + [[" + \tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle}, + component order=increasing node number] + { a, b, c -- d -- e, f -- g }; + "]] } -} - - +} + + --- declare { @@ -79,11 +81,11 @@ declare { { key = "component order", value = "increasing node number" } }, - summary = [[" - A shorthand for |component order=increasing node number|. - "]] + summary = [[" + A shorthand for |component order=increasing node number|. + "]] } - + --- declare { @@ -91,15 +93,15 @@ declare { use = { { key = "component order", value = "decreasing node number" }, }, - summary = [[" - A shorthand for |component order=decreasing node number|. + summary = [[" + A shorthand for |component order=decreasing node number|. "]], examples = [[" - \tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle}, - large components first] - { a, b, c -- d -- e, f -- g }; + \tikz \graph [tree layout, nodes={inner sep=1pt,draw,circle}, + large components first] + { a, b, c -- d -- e, f -- g }; "]] -} +} return Components
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/Components.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/Components.lua index c5019a56e23..9d9621e6da4 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/Components.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/Components.lua @@ -35,57 +35,57 @@ local declare = require "pgf.gd.interface.InterfaceToAlgorithms".declare -- -- The default method for placing the different components works as -- follows: --- % +-- -- \begin{enumerate} --- \item For each component, a layout is determined and the component is --- oriented as described --- Section~\ref{subsection-library-graphdrawing-standard-orientation} --- on the orientation of graphs. --- \item The components are sorted as prescribed by the --- |component order| key. --- \item The first component is now placed (conceptually) at the --- origin. (The final position of this and all other components will be --- determined later, namely in the anchoring phase, but let us imagine --- that the first component lies at the origin at this point.) --- \item The second component is now positioned relative to the first --- component. The ``direction'' in which the next component is placed --- relative to the first one is determined by the |component direction| --- key, so components can be placed from left to right or up to down or --- in any other direction (even something like $30^\circ$). However, --- both internally and in the following description, we assume that the --- components are placed from left to right; other directions are --- achieved by doing some (clever) rotating of the arrangement achieved --- in this way. +-- \item For each component, a layout is determined and the component is +-- oriented as described +-- Section~\ref{subsection-library-graphdrawing-standard-orientation} +-- on the orientation of graphs. +-- \item The components are sorted as prescribed by the +-- |component order| key. +-- \item The first component is now placed (conceptually) at the +-- origin. (The final position of this and all other components will be +-- determined later, namely in the anchoring phase, but let us imagine +-- that the first component lies at the origin at this point.) +-- \item The second component is now positioned relative to the first +-- component. The ``direction'' in which the next component is placed +-- relative to the first one is determined by the |component direction| +-- key, so components can be placed from left to right or up to down or +-- in any other direction (even something like $30^\circ$). However, +-- both internally and in the following description, we assume that the +-- components are placed from left to right; other directions are +-- achieved by doing some (clever) rotating of the arrangement achieved +-- in this way. -- --- So, we now wish to place the second component to the right of the --- first component. The component is first shifted vertically according --- to some alignment strategy. For instance, it can be shifted so that --- the topmost node of the first component and the topmost node of the --- second component have the same vertical position. Alternatively, we --- might require that certain ``alignment nodes'' in both components --- have the same vertical position. There are several other strategies, --- which can be configured using the |component align| key. +-- So, we now wish to place the second component to the right of the +-- first component. The component is first shifted vertically according +-- to some alignment strategy. For instance, it can be shifted so that +-- the topmost node of the first component and the topmost node of the +-- second component have the same vertical position. Alternatively, we +-- might require that certain ``alignment nodes'' in both components +-- have the same vertical position. There are several other strategies, +-- which can be configured using the |component align| key. -- --- One the vertical position has been fixed, the horizontal position is --- computed. Here, two different strategies are available: First, image --- rectangular bounding boxed to be drawn around both components. Then --- we shift the second component such that the right border of the --- bounding box of the first component touches the left border of the --- bounding box of the second component. Instead of having the bounding --- boxes ``touch'', we can also have a padding of |component sep| --- between them. The second strategy is more involved and also known as --- a ``skyline'' strategy, where (roughly) the components are --- ``moved together as near as possible so that nodes do not touch''. --- \item --- After the second component has been placed, the third component is --- considered and positioned relative to the second one, and so on. --- \item --- At the end, as hinted at earlier, the whole arrangement is rotate so --- that instead of ``going right'' the component go in the direction of --- |component direction|. Note, however, that this rotation applies only --- to the ``shift'' of the components; the components themselves are --- not rotated. Fortunately, this whole rotation process happens in the --- background and the result is normally exactly what you would expect. +-- One the vertical position has been fixed, the horizontal position is +-- computed. Here, two different strategies are available: First, image +-- rectangular bounding boxed to be drawn around both components. Then +-- we shift the second component such that the right border of the +-- bounding box of the first component touches the left border of the +-- bounding box of the second component. Instead of having the bounding +-- boxes ``touch,'' we can also have a padding of |component sep| +-- between them. The second strategy is more involved and also known as +-- a ``skyline'' strategy, where (roughly) the components are +-- ``moved together as near as possible so that nodes do not touch''. +-- \item +-- After the second component has been placed, the third component is +-- considered and positioned relative to the second one, and so on. +-- \item +-- At the end, as hinted at earlier, the whole arrangement is rotate so +-- that instead of ``going right'' the component go in the direction of +-- |component direction|. Note, however, that this rotation applies only +-- to the ``shift'' of the components; the components themselves are +-- not rotated. Fortunately, this whole rotation process happens in the +-- background and the result is normally exactly what you would expect. -- \end{enumerate} -- -- In the following, we go over the different keys that can be used to @@ -95,33 +95,35 @@ local declare = require "pgf.gd.interface.InterfaceToAlgorithms".declare --- - + declare { key = "componentwise", type = "boolean", - summary = [[" - For algorithms that also support drawing unconnected graphs, use - this key to enforce that the components of the graph are, - nevertheless, laid out individually. For algorithms that do not - support laying out unconnected graphs, this option has no effect; - rather it works as if this option were always set. + summary = [[" + For algorithms that also support drawing unconnected graphs, use + this key to enforce that the components of the graph are, + nevertheless, laid out individually. For algorithms that do not + support laying out unconnected graphs, this option has no effect; + rather it works as if this option were always set. "]], - examples = {[[" - \tikz \graph [simple necklace layout] - { - a -- b -- c -- d -- a, - 1 -- 2 -- 3 -- 1 - }; - "]],[[", - \tikz \graph [simple necklace layout, componentwise] - { - a -- b -- c -- d -- a, - 1 -- 2 -- 3 -- 1 - }; - "]] + examples = { + [[" + \tikz \graph [simple necklace layout] + { + a -- b -- c -- d -- a, + 1 -- 2 -- 3 -- 1 + }; + "]], + [[", + \tikz \graph [simple necklace layout, componentwise] + { + a -- b -- c -- d -- a, + 1 -- 2 -- 3 -- 1 + }; + "]] } -} - +} + diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/Distances.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/Distances.lua index 6dc5a13018d..c1b64729fab 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/Distances.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/Distances.lua @@ -24,24 +24,24 @@ local lib = require "pgf.gd.lib" -- general keys that will be used by many algorithms. -- -- There are different kinds of objects for which you can specify --- distances and paddings: --- % +-- distances and paddings: +-- -- \begin{itemize} --- \item You specify the ``natural'' distance between nodes --- connected by an edge using |node distance|, which is also available in --- normal \tikzname\ albeit for a slightly different purpose. However, --- not every algorithm will (or can) honor the key; see the description --- of each algorithm what it will ``make of this option''. --- \item A number of graph drawing algorithms arrange nodes in layers --- (or levels); we refer --- to the nodes on the same layer as siblings (although, in a tree, --- siblings are only nodes with the same parent; nevertheless we use --- ``sibling'' loosely also for nodes that are more like ``cousins''). --- \item When a graph consists of several connected component, many graph --- drawing algorithms will layout these components individually. The --- different components will then be arranged next to each other, see --- Section~\ref{section-gd-packing} for the details, such that between --- the nodes of any two components a padding is available. +-- \item You specify the ``natural'' distance between nodes +-- connected by an edge using |node distance|, which is also available in +-- normal \tikzname\ albeit for a slightly different purpose. However, +-- not every algorithm will (or can) honour the key; see the description +-- of each algorithm what it will ``make of this option''. +-- \item A number of graph drawing algorithms arrange nodes in layers +-- (or levels); we refer +-- to the nodes on the same layer as siblings (although, in a tree, +-- siblings are only nodes with the same parent; nevertheless we use +-- ``sibling'' loosely also for nodes that are more like ``cousins''). +-- \item When a graph consists of several connected component, many graph +-- drawing algorithms will layout these components individually. The +-- different components will then be arranged next to each other, see +-- Section~\ref{section-gd-packing} for the details, such that between +-- the nodes of any two components a padding is avaiable. -- \end{itemize} -- -- @end @@ -56,23 +56,23 @@ declare { type = "length", initial = "1cm", - summary = [[" - This is minimum distance that the centers of nodes connected by an - edge should have. It will not always be possible to satisfy this - desired distance, for instance in case the nodes are too big. In - this case, the \meta{length} is just considered as a lower bound. + summary = [[" + This is minimum distance that the centers of nodes connected by an + edge should have. It will not always be possible to satisfy this + desired distance, for instance in case the nodes are too big. In + this case, the \meta{length} is just considered as a lower bound. "]], examples = [[" - \begin{tikzpicture} - \graph [simple necklace layout, node distance=1cm, node sep=0pt, - nodes={draw,circle,as=.}] - { - 1 -- 2 [minimum size=2cm] -- 3 -- - 4 -- 5 -- 6 -- 7 --[orient=up] 8 - }; - \draw [red,|-|] (1.center) -- ++(0:1cm); - \draw [red,|-|] (5.center) -- ++(180:1cm); - \end{tikzpicture} + \begin{tikzpicture} + \graph [simple necklace layout, node distance=1cm, node sep=0pt, + nodes={draw,circle,as=.}] + { + 1 -- 2 [minimum size=2cm] -- 3 -- + 4 -- 5 -- 6 -- 7 --[orient=up] 8 + }; + \draw [red,|-|] (1.center) -- ++(0:1cm); + \draw [red,|-|] (5.center) -- ++(180:1cm); + \end{tikzpicture} "]] } @@ -84,24 +84,26 @@ declare { type = "length", initial = ".333em", - summary = [[" - This is a minimum ``padding'' or ``separation'' between the border - of nodes connected by an edge. Thus, if nodes are so big that nodes - with a distance of |node distance| would overlap (or - just come with \meta{dimension} distance of one another), their - distance is enlarged so that this distance is still satisfied. - The |pre| means that the padding is added to the node ``at the - front''. This make sense only for some algorithms, like for a - simple necklace layout. + summary = [[" + This is a minimum ``padding'' or ``separation'' between the border + of nodes connected by an edge. Thus, if nodes are so big that nodes + with a distance of |node distance| would overlap (or + just come with \meta{dimension} distance of one another), their + distance is enlarged so that this distance is still satisfied. + The |pre| means that the padding is added to the node ``at the + front.'' This make sense only for some algorithms, like for a + simple necklace layout. "]], - examples = {[[" - \tikz \graph [simple necklace layout, node distance=0cm, nodes={circle,draw}] - { 1--2--3--4--5--1 }; - "]],[[" - \tikz \graph [simple necklace layout, node distance=0cm, node sep=0mm, - nodes={circle,draw}] - { 1--2--3[node pre sep=5mm]--4--5[node pre sep=1mm]--1 }; - "]] + examples = { + [[" + \tikz \graph [simple necklace layout, node distance=0cm, nodes={circle,draw}] + { 1--2--3--4--5--1 }; + "]], + [[" + \tikz \graph [simple necklace layout, node distance=0cm, node sep=0mm, + nodes={circle,draw}] + { 1--2--3[node pre sep=5mm]--4--5[node pre sep=1mm]--1 }; + "]] } } @@ -112,13 +114,13 @@ declare { type = "length", initial = ".333em", - summary = [[" - Works like |node pre sep|. - "]] + summary = [[" + Works like |node pre sep|. + "]] } + - - + --- -- @param length A length. @@ -129,9 +131,9 @@ declare { { key = "node pre sep", value = function(v) return v/2 end }, { key = "node post sep", value = function(v) return v/2 end }, }, - summary = [[" - A shorthand for setting both |node pre sep| and |node post sep| to - $\meta{length}/2$. + summary = [[" + A shorthand for setting both |node pre sep| and |node post sep| to + $\meta{length}/2$. "]] } @@ -143,26 +145,26 @@ declare { type = "length", initial = "1cm", - summary = [[" - This is minimum distance that the centers of nodes on one - level should have from the centers of nodes on the next level. It - will not always be possible to satisfy this desired distance, for - instance in case the nodes are too big. In this case, the - \meta{length} is just considered as a lower bound. + summary = [[" + This is minimum distance that the centers of nodes on one + level should have from the centers of nodes on the next level. It + will not always be possible to satisfy this desired distance, for + instance in case the nodes are too big. In this case, the + \meta{length} is just considered as a lower bound. "]], examples = [[" - \begin{tikzpicture}[inner sep=2pt] - \draw [help lines] (0,0) grid (3.5,2); - \graph [layered layout, level distance=1cm, level sep=0] - { 1 [x=1,y=2] -- 2 -- 3 -- 1 }; - \graph [layered layout, level distance=5mm, level sep=0] - { 1 [x=3,y=2] -- 2 -- 3 -- 1, 3 -- {4,5} -- 6 -- 3 }; - \end{tikzpicture} + \begin{tikzpicture}[inner sep=2pt] + \draw [help lines] (0,0) grid (3.5,2); + \graph [layered layout, level distance=1cm, level sep=0] + { 1 [x=1,y=2] -- 2 -- 3 -- 1 }; + \graph [layered layout, level distance=5mm, level sep=0] + { 1 [x=3,y=2] -- 2 -- 3 -- 1, 3 -- {4,5} -- 6 -- 3 }; + \end{tikzpicture} "]] } - + --- -declare { +declare { key = "layer distance", type = "length", use = { @@ -177,25 +179,25 @@ declare { type = "length", initial = ".333em", - summary = [[" - This is a minimum ``padding'' or ``separation'' between the border - of the nodes on a level to any nodes on the previous level. Thus, if - nodes are so big that nodes on consecutive levels would overlap (or - just come with \meta{length} distance of one another), their - distance is enlarged so that this distance is still satisfied. - If a node on the previous level also has a |level post sep|, this - post padding and the \meta{dimension} add up. Thus, these keys - behave like the ``padding'' keys rather - than the ``margin'' key of cascading style sheets. + summary = [[" + This is a minimum ``padding'' or ``separation'' between the border + of the nodes on a level to any nodes on the previous level. Thus, if + nodes are so big that nodes on consecutive levels would overlap (or + just come with \meta{lrngth} distance of one another), their + distance is enlarged so that this distance is still satisfied. + If a node on the previous level also has a |level post sep|, this + post padding and the \meta{dimension} add up. Thus, these keys + behave like the ``padding'' keys rather + than the ``margin'' key of cascading style sheets. "]], examples = [[" - \begin{tikzpicture}[inner sep=2pt, level sep=0pt, sibling distance=0pt] - \draw [help lines] (0,0) grid (3.5,2); - \graph [layered layout, level distance=0cm, nodes=draw] - { 1 [x=1,y=2] -- {2,3[level pre sep=1mm],4[level pre sep=5mm]} -- 5 }; - \graph [layered layout, level distance=0cm, nodes=draw] - { 1 [x=3,y=2] -- {2,3,4} -- 5[level pre sep=5mm] }; - \end{tikzpicture} + \begin{tikzpicture}[inner sep=2pt, level sep=0pt, sibling distance=0pt] + \draw [help lines] (0,0) grid (3.5,2); + \graph [layered layout, level distance=0cm, nodes=draw] + { 1 [x=1,y=2] -- {2,3[level pre sep=1mm],4[level pre sep=5mm]} -- 5 }; + \graph [layered layout, level distance=0cm, nodes=draw] + { 1 [x=3,y=2] -- {2,3,4} -- 5[level pre sep=5mm] }; + \end{tikzpicture} "]] } @@ -206,13 +208,13 @@ declare { type = "length", initial = ".333em", - summary = [[" - Works like |level pre sep|. - "]] + summary = [[" + Works like |level pre sep|. + "]] } - + --- -declare { +declare { key = "layer pre sep", type = "length", use = { @@ -222,7 +224,7 @@ declare { } --- -declare { +declare { key = "layer post sep", type = "length", use = { @@ -245,17 +247,17 @@ declare { { key = "level post sep", value = function (v) return v/2 end }, }, - summary = [[" - A shorthand for setting both |level pre sep| and |level post sep| to - $\meta{length}/2$. Note that if you set |level distance=0| and - |level sep=1em|, you get a layout where any two consecutive layers - are ``spaced apart'' by |1em|. + summary = [[" + A shorthand for setting both |level pre sep| and |level post sep| to + $\meta{length}/2$. Note that if you set |level distance=0| and + |level sep=1em|, you get a layout where any two consecutive layers + are ``spaced apart'' by |1em|. "]] } --- -declare { +declare { key = "layer sep", type = "number", use = { @@ -271,25 +273,28 @@ declare { type = "length", initial = "1cm", - summary = [[" - This is minimum distance that the centers of node should have to the - center of the next node on the same level. As for levels, this is - just a lower bound. - For some layouts, like a simple necklace layout, the \meta{length} is - measured as the distance on the circle. + summary = [[" + This is minimum distance that the centers of node should have to the + center of the next node on the same level. As for levels, this is + just a lower bound. + For some layouts, like a simple necklace layout, the \meta{length} is + measured as the distance on the circle. "]], - examples = {[[" - \tikz \graph [tree layout, sibling distance=1cm, nodes={circle,draw}] - { 1--{2,3,4,5} }; - "]],[[" - \tikz \graph [tree layout, sibling distance=0cm, sibling sep=0pt, - nodes={circle,draw}] - { 1--{2,3,4,5} }; - "]],[[" - \tikz \graph [tree layout, sibling distance=0cm, sibling sep=0pt, - nodes={circle,draw}] - { 1--{2,3[sibling distance=1cm],4,5} }; - "]] + examples = { + [[" + \tikz \graph [tree layout, sibling distance=1cm, nodes={circle,draw}] + { 1--{2,3,4,5} }; + "]], + [[" + \tikz \graph [tree layout, sibling distance=0cm, sibling sep=0pt, + nodes={circle,draw}] + { 1--{2,3,4,5} }; + "]], + [[" + \tikz \graph [tree layout, sibling distance=0cm, sibling sep=0pt, + nodes={circle,draw}] + { 1--{2,3[sibling distance=1cm],4,5} }; + "]] } } @@ -301,13 +306,13 @@ declare { type = "length", initial = ".333em", - summary = [[" - Works like |level pre sep|, only for siblings. + summary = [[" + Works like |level pre sep|, only for siblings. "]], examples = [[" - \tikz \graph [tree layout, sibling distance=0cm, nodes={circle,draw}, - sibling sep=0pt] - { 1--{2,3[sibling pre sep=1cm],4,5} }; + \tikz \graph [tree layout, sibling distance=0cm, nodes={circle,draw}, + sibling sep=0pt] + { 1--{2,3[sibling pre sep=1cm],4,5} }; "]] } @@ -318,11 +323,11 @@ declare { type = "length", initial = ".333em", - summary = [[" - Works like |sibling pre sep|. + summary = [[" + Works like |sibling pre sep|. "]] } - + --- @@ -336,26 +341,26 @@ declare { { key = "sibling post sep", value = function(v) return v/2 end }, }, - summary = [[" - A shorthand for setting both |sibling pre sep| and |sibling post sep| to - $\meta{length}/2$. + summary = [[" + A shorthand for setting both |sibling pre sep| and |sibling post sep| to + $\meta{length}/2$. "]] } + + - - - + --- declare { key = "part distance", type = "length", initial = "1.5cm", - summary = [[" - This is minimum distance between the centers of ``parts'' of a - graph. What a ``part'' is depends on the algorithm. + summary = [[" + This is minimum distance between the centers of ``parts'' of a + graph. What a ``part'' is depends on the algorithm. "]] } @@ -377,7 +382,7 @@ declare { initial = "1em", summary = "A post-padding for pars." } - + --- @@ -391,9 +396,9 @@ declare { { key = "part post sep", value = function(v) return v/2 end }, }, - summary = [[" - A shorthand for setting both |part pre sep| and |part post sep| to - $\meta{length}/2$. + summary = [[" + A shorthand for setting both |part pre sep| and |part post sep| to + $\meta{length}/2$. "]] } @@ -407,31 +412,33 @@ declare { type = "length", initial = "1.5em", - summary = [[" - This is padding between the bounding boxes that nodes of different - connected components will have when they are placed next to each - other. + summary = [[" + This is pading between the bounding boxes that nodes of different + connected components will have when they are placed next to each + other. "]], - examples = {[[" - \tikz \graph [binary tree layout, sibling distance=4mm, level distance=8mm, - components go right top aligned, - component sep=1pt, nodes=draw] - { - 1 -> 2 -> {3->4[second]->5,6,7}; - a -> b[second] -> c[second] -> d -> e; - x -> y[second] -> z -> u[second] -> v; - }; - "]],[[" - \tikz \graph [binary tree layout, sibling distance=4mm, level distance=8mm, - components go right top aligned, - component sep=1em, nodes=draw] - { - 1 -> 2 -> {3->4[second]->5,6,7}; - a -> b[second] -> c[second] -> d -> e; - x -> y[second] -> z -> u[second] -> v; - }; - "]] - } + examples = { + [[" + \tikz \graph [binary tree layout, sibling distance=4mm, level distance=8mm, + components go right top aligned, + component sep=1pt, nodes=draw] + { + 1 -> 2 -> {3->4[second]->5,6,7}; + a -> b[second] -> c[second] -> d -> e; + x -> y[second] -> z -> u[second] -> v; + }; + "]], + [[" + \tikz \graph [binary tree layout, sibling distance=4mm, level distance=8mm, + components go right top aligned, + component sep=1em, nodes=draw] + { + 1 -> 2 -> {3->4[second]->5,6,7}; + a -> b[second] -> c[second] -> d -> e; + x -> y[second] -> z -> u[second] -> v; + }; + "]] + } } @@ -444,11 +451,11 @@ declare { initial = "2cm", summary = [[" - This is the minimum distance between the centers of bounding - boxes of connected components when they are placed next to each - other. (Not used, currently.) + This is the minimum distance between the centers of bounding + boxes of connected components when they are placed next to each + other. (Not used, currently.) "]] } -return Distances +return Distances
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/FineTune.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/FineTune.lua index 87d67b5b56f..be1666b255b 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/FineTune.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/FineTune.lua @@ -28,20 +28,20 @@ declare { type = "canvas coordinate", summary = [[" - This option allows you to slightly ``nudge'' (move) nodes after - they have been positioned by the given offset. The idea is that - this nudging is done after the position of the node has been - computed, so nudging has no influence on the actual graph - drawing algorithms. This, in turn, means that you can use - nudging to ``correct'' or ``optimize'' the positioning of nodes - after the algorithm has computed something. + This option allows you to slightly ``nudge'' (move) nodes after + they have been positioned by the given offset. The idea is that + this nudging is done after the position of the node has been + computed, so nudging has no influence on the actual graph + drawing algorithms. This, in turn, means that you can use + nudging to ``correct'' or ``optimize'' the positioning of nodes + after the algorithm has computed something. "]], examples = [[" - \tikz \graph [edges=rounded corners, nodes=draw, - layered layout, sibling distance=0] { - a -- {b, c, d[nudge=(up:2mm)]} -- e -- a; - }; + \tikz \graph [edges=rounded corners, nodes=draw, + layered layout, sibling distance=0] { + a -- {b, c, d[nudge=(up:2mm)]} -- e -- a; + }; "]] } @@ -58,10 +58,10 @@ declare { summary = "A shorthand for nudging a node upwards.", examples = [[" - \tikz \graph [edges=rounded corners, nodes=draw, - layered layout, sibling distance=0] { - a -- {b, c, d[nudge up=2mm]} -- e -- a; - }; + \tikz \graph [edges=rounded corners, nodes=draw, + layered layout, sibling distance=0] { + a -- {b, c, d[nudge up=2mm]} -- e -- a; + }; "]] } @@ -91,10 +91,10 @@ declare { summary = "Like |nudge up|, but left.", examples = [[" - \tikz \graph [edges=rounded corners, nodes=draw, - layered layout, sibling distance=0] { - a -- {b, c, d[nudge left=2mm]} -- e -- a; - }; + \tikz \graph [edges=rounded corners, nodes=draw, + layered layout, sibling distance=0] { + a -- {b, c, d[nudge left=2mm]} -- e -- a; + }; "]] } @@ -118,18 +118,18 @@ declare { type = "canvas coordinate", summary = [[" - Using this option you can provide a position for a node to wish - it will be forced after the graph algorithms have run. So, the node - is positioned normally and the graph drawing algorithm does not know - about the position specified using |regardless at|. However, - afterwards, the node is placed there, regardless of what the - algorithm has computed (all other nodes are unaffected). + Using this option you can provide a position for a node to wish + it will be forced after the graph algorithms have run. So, the node + is positioned normally and the graph drawing algorithm does not know + about the position specified using |regardless at|. However, + afterwards, the node is placed there, regardless of what the + algorithm has computed (all other nodes are unaffected). "]], examples = [[" - \tikz \graph [edges=rounded corners, nodes=draw, - layered layout, sibling distance=0] { - a -- {b,c,d[regardless at={(1,0)}]} -- e -- a; - }; + \tikz \graph [edges=rounded corners, nodes=draw, + layered layout, sibling distance=0] { + a -- {b,c,d[regardless at={(1,0)}]} -- e -- a; + }; "]] } @@ -148,17 +148,17 @@ declare { }, summary = [[" - This option combines |desired at| and |regardless at|. Thus, the - algorithm is ``told'' about the desired position. If it fails to place - the node at the desired position, it will be put there - regardless. The name of the key is intended to remind one of a node - being ``nailed'' to the canvas. + This option combines |desired at| and |regardless at|. Thus, the + algorithm is ``told'' about the desired position. If it fails to place + the node at the desired position, it will be put there + regardless. The name of the key is intended to remind one of a node + being ``nailed'' to the canvas. "]], examples = [[" - \tikz \graph [edges=rounded corners, nodes=draw, - layered layout, sibling distance=0] { - a -- {b,c,d[nail at={(1,0)}]} -- e[nail at={(1.5,-1)}] -- a; - }; + \tikz \graph [edges=rounded corners, nodes=draw, + layered layout, sibling distance=0] { + a -- {b,c,d[nail at={(1,0)}]} -- e[nail at={(1.5,-1)}] -- a; + }; "]] } diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/LayoutPipeline.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/LayoutPipeline.lua index 1c5e48b4c7e..c998ca490aa 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/LayoutPipeline.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/LayoutPipeline.lua @@ -21,48 +21,48 @@ -- Before an algorithm is applied, a number of transformations will -- have been applied, depending on the algorithm's |preconditions| -- field: --- % +-- -- \begin{itemize} --- \item |connected| +-- \item |connected| -- --- If this property is set for an algorithm (that is, in the --- |declare| statement for the algorithm the |predconditions| field --- has the entry |connected=true| set), then the graph will be --- decomposed into connected components. The algorithm is run on each --- component individually. --- \item |tree| +-- If this property is set for an algorithm (that is, in the +-- |declare| statement for the algorithm the |predconditions| field +-- has the entry |connected=true| set), then the graph will be +-- decomposed into connected components. The algorithm is run on each +-- component individually. +-- \item |tree| -- --- When set, the field |spanning_tree| of the algorithm will be set --- to a spanning tree of the graph. This option implies |connected|. --- \item |loop_free| +-- When set, the field |spanning_tree| of the algorithm will be set +-- to a spanning tree of the graph. This option implies |connected|. +-- \item |loop_free| -- --- When set, all loops (arcs from a vertex to itself) will have been --- removed when the algorithm runs. +-- When set, all loops (arcs from a vertex to itself) will have been +-- removed when the algorithm runs. -- --- \item |at_least_two_nodes| +-- \item |at_least_two_nodes| -- --- When explicitly set to |false| (this precondition is |true| by --- default), the algorithm will even be run if there is only a --- single vertex in the graph. +-- When explicitly set to |false| (this precondition is |true| by +-- default), the algorithm will even be run if there is only a +-- single vertex in the graph. -- \end{itemize} -- -- Once the algorithm has run, the algorithm's |postconditions| will -- be processed: --- % +-- -- \begin{itemize} --- \item |upward_oriented| +-- \item |upward_oriented| -- --- When set, the algorithm tells the layout pipeline that the graph --- has been laid out in a layered manner with each layer going from --- left to right and layers at a whole going upwards (positive --- $y$-coordinates). The graph will then be rotated and possibly --- swapped in accordance with the |grow| key set by the user. --- \item |fixed| +-- When set, the algorithm tells the layout pipeline that the graph +-- has been laid out in a layered manner with each layer going from +-- left to right and layers at a whole going upwards (positive +-- $y$-coordinates). The graph will then be rotated and possibly +-- swapped in accordance with the |grow| key set by the user. +-- \item |fixed| -- --- When set, no rotational postprocessing will be done after the --- algorithm has run. Usually, a graph is rotated to meet a user's --- |orient| settings. However, when the algorithm has already --- ``ideally'' rotated the graph, set this postcondition. +-- When set, no rotational postprocessing will be done after the +-- algorithm has run. Usually, a graph is rotated to meet a user's +-- |orient| settings. However, when the algorithm has already +-- ``ideally'' rotated the graph, set this postcondition. -- \end{itemize} -- -- @@ -71,22 +71,23 @@ -- posttransformations. This happens when users install additional -- algorithms in appropriate phases. In detail, the following happens -- in order: --- % +-- -- \begin{enumerate} --- \item If specified, the graph is decomposed into connected --- components and the following steps are applied to each component --- individually. --- \item All algorithms in the phase stack for the phase --- |preprocessing| are applied to the component. These algorithms are --- run one after the other in the order they appear in the phase stack. --- \item If necessary, the spanning tree is now computed and --- rotational information is gathered. --- \item The single algorithm in phase |main| is called. --- \item All algorithms in the phase stack for the phase --- |edge routing| are run. --- \item All algorithms in the phase stack for phase |postprocessing| --- are run. --- \item Edge syncing, orientation, and anchoring are applied. +-- \item If specified, the graph is decomposed into connected +-- components and the following steps are applied to each component +-- individually. +-- \item All algorithms in the phase stack for the phase +-- |preprocessing| are applied to the component. These algorithms are +-- run one after the other in the order they appear in the phase +-- stack. +-- \item If necessary, the spanning tree is now computed and +-- rotational information is gathered. +-- \item The single algorithm in phase |main| is called. +-- \item All algorithms in the phase stack for the phase +-- |edge routing| are run. +-- \item All algorithms in the phase stack for phase |postprocessing| +-- are run. +-- \item Edge syncing, orientation, and anchoring are applied. -- \end{enumerate} -- -- If sublayouts are used, all of the above (except for anchoring) @@ -127,39 +128,39 @@ local prepare_events --- The main ``graph drawing pipeline'' that handles the pre- and --- postprocessing for a graph. This method is called by the display --- interface. +-- The main ``graph drawing pipeline'' that handles the pre- and +-- postprocessing for a graph. This method is called by the diplay +-- interface. -- -- @param scope A graph drawing scope. function LayoutPipeline.run(scope) -- The pipeline... - + -- Step 1: Preparations - + -- Prepare events prepare_events(scope.events) - + -- Step 2: Recursively layout the graph, starting with the root layout local root_layout = assert(scope.collections[InterfaceCore.sublayout_kind][1], "no layout in scope") - + scope.syntactic_digraph = Sublayouts.layoutRecursively (scope, - root_layout, - LayoutPipeline.runOnLayout, - { root_layout }) - + root_layout, + LayoutPipeline.runOnLayout, + { root_layout }) + -- Step 3: Anchor the graph LayoutPipeline.anchor(scope.syntactic_digraph, scope) - + -- Step 4: Apply regardless transforms Sublayouts.regardless(scope.syntactic_digraph) - + -- Step 5: Cut edges LayoutPipeline.cutEdges(scope.syntactic_digraph) - + end @@ -173,7 +174,7 @@ end -- @param algorithm_class The to-be-applied algorithm class. -- @param layout_graph A subgraph of the syntactic digraph which is -- restricted to the current layout and in which sublayouts have --- been contracted to single nodes. +-- been contracted to single nodes. -- @param layout The layout to which the graph belongs. -- function LayoutPipeline.runOnLayout(scope, algorithm_class, layout_graph, layout) @@ -188,12 +189,12 @@ function LayoutPipeline.runOnLayout(scope, algorithm_class, layout_graph, layout local new_a = layout_copy:connect(a.tail,a.head) new_a.syntactic_edges = a.syntactic_edges end - + -- Step 1: Decompose the graph into connected components, if necessary: local syntactic_components if algorithm_class.preconditions.tree or algorithm_class.preconditions.connected or layout_graph.options.componentwise then - syntactic_components = LayoutPipeline.decompose(layout_copy) - LayoutPipeline.sortComponents(layout_graph.options['component order'], syntactic_components) + syntactic_components = LayoutPipeline.decompose(layout_copy) + LayoutPipeline.sortComponents(layout_graph.options['component order'], syntactic_components) else -- Only one component: The graph itself... syntactic_components = { layout_copy } @@ -201,17 +202,17 @@ function LayoutPipeline.runOnLayout(scope, algorithm_class, layout_graph, layout -- Step 2: For all components do: for i,syntactic_component in ipairs(syntactic_components) do - + -- Step 2.1: Reset random number generator to make sure that the -- same graph is always typeset in the same way. - lib.randomseed(layout_graph.options['random seed']) - + math.randomseed(layout_graph.options['random seed']) + local digraph = Direct.digraphFromSyntacticDigraph(syntactic_component) -- Step 2.3: If requested, remove loops if algorithm_class.preconditions.loop_free then for _,v in ipairs(digraph.vertices) do - digraph:disconnect(v,v) + digraph:disconnect(v,v) end end @@ -221,15 +222,15 @@ function LayoutPipeline.runOnLayout(scope, algorithm_class, layout_graph, layout -- Step 2.4a: Run preprocessor for _,class in ipairs(layout_graph.options.algorithm_phases["preprocessing stack"]) do class.new{ - digraph = digraph, - ugraph = ugraph, - scope = scope, - layout = layout, - layout_graph = layout_graph, - syntactic_component = syntactic_component, - }:run() + digraph = digraph, + ugraph = ugraph, + scope = scope, + layout = layout, + layout_graph = layout_graph, + syntactic_component = syntactic_component, + }:run() end - + -- Step 2.5: Create an algorithm object local algorithm = algorithm_class.new{ digraph = digraph, @@ -239,14 +240,14 @@ function LayoutPipeline.runOnLayout(scope, algorithm_class, layout_graph, layout layout_graph = layout_graph, syntactic_component = syntactic_component, } - + -- Step 2.7: Compute a spanning tree, if necessary if algorithm_class.preconditions.tree then local spanning_algorithm_class = syntactic_component.options.algorithm_phases["spanning tree computation"] algorithm.spanning_tree = - spanning_algorithm_class.new{ - ugraph = ugraph, - events = scope.events + spanning_algorithm_class.new{ + ugraph = ugraph, + events = scope.events }:run() end @@ -260,43 +261,43 @@ function LayoutPipeline.runOnLayout(scope, algorithm_class, layout_graph, layout or algorithm_class.preconditions.at_least_two_nodes == false then -- Main run of the algorithm: if algorithm_class.old_graph_model then - LayoutPipeline.runOldGraphModel(scope, digraph, algorithm_class, algorithm) + LayoutPipeline.runOldGraphModel(scope, digraph, algorithm_class, algorithm) else - algorithm:run () + algorithm:run () end end -- Step 2.9a: Run edge routers for _,class in ipairs(layout_graph.options.algorithm_phases["edge routing stack"]) do class.new{ - digraph = digraph, - ugraph = ugraph, - scope = scope, - layout = layout, - layout_graph = layout_graph, - syntactic_component = syntactic_component, - }:run() + digraph = digraph, + ugraph = ugraph, + scope = scope, + layout = layout, + layout_graph = layout_graph, + syntactic_component = syntactic_component, + }:run() end - + -- Step 2.9b: Run postprocessor for _,class in ipairs(layout_graph.options.algorithm_phases["postprocessing stack"]) do class.new{ - digraph = digraph, - ugraph = ugraph, - scope = scope, - layout = layout, - layout_graph = layout_graph, - syntactic_component = syntactic_component, - }:run() + digraph = digraph, + ugraph = ugraph, + scope = scope, + layout = layout, + layout_graph = layout_graph, + syntactic_component = syntactic_component, + }:run() end - + -- Step 2.10: Sync the graphs digraph:sync() ugraph:sync() if algorithm.spanning_tree then algorithm.spanning_tree:sync() end - + -- Step 2.11: Orient the graph LayoutPipeline.orient(algorithm.rotation_info, algorithm.postconditions, syntactic_component, scope) end @@ -316,7 +317,7 @@ end -- procedure described in -- Section~\ref{subsection-library-graphdrawing-anchoring}. These -- transformations are always performed. --- +-- -- @param graph A graph -- @param scope The scope @@ -324,7 +325,7 @@ function LayoutPipeline.anchor(graph, scope) -- Step 1: Find anchor node: local anchor_node - + local anchor_node_name = graph.options['anchor node'] if anchor_node_name then anchor_node = scope.node_names[anchor_node_name] @@ -336,10 +337,10 @@ function LayoutPipeline.anchor(graph, scope) lib.find (graph.vertices, function (v) return v.options['desired at'] end) or graph.vertices[1] end - + -- Sanity check assert(graph:contains(anchor_node), "anchor node is not in graph!") - + local desired = anchor_node.options['desired at'] or graph.options['anchor at'] local delta = desired - anchor_node.pos @@ -360,7 +361,7 @@ end --- -- This method tries to determine in which direction the graph is supposed to -- grow and in which direction the algorithm will grow the graph. These two --- pieces of information together produce a necessary rotation around some node. +-- pieces of information togehter produce a necessary rotation around some node. -- This rotation is returned in a table. -- -- Note that this method does not actually cause a rotation to happen; this is @@ -371,12 +372,12 @@ end -- @return A table containing the computed information. function LayoutPipeline.prepareRotateAround(postconditions, graph) - + -- Find the vertex from which we orient local swap = true local v,_,grow = lib.find (graph.vertices, function (v) return v.options["grow"] end) - + if not v and graph.options["grow"] then v,grow,swap = graph.vertices[1], graph.options["grow"], true end @@ -385,7 +386,7 @@ function LayoutPipeline.prepareRotateAround(postconditions, graph) v,_,grow = lib.find (graph.vertices, function (v) return v.options["grow'"] end) swap = false end - + if not v and graph.options["grow'"] then v,grow,swap = graph.vertices[1], graph.options["grow'"], false end @@ -393,15 +394,15 @@ function LayoutPipeline.prepareRotateAround(postconditions, graph) if not v then v, grow, swap = graph.vertices[1], -90, true end - + -- Now compute the rotation local info = {} local growth_direction = (postconditions.upward_oriented and 90) or (postconditions.upward_oriented_swapped and 90) - + if postconditions.upward_oriented_swapped then swap = not swap end - + if growth_direction == "fixed" then info.angle = 0 -- no rotation elseif growth_direction then @@ -415,9 +416,9 @@ function LayoutPipeline.prepareRotateAround(postconditions, graph) local other = lib.find_min( graph:outgoing(v), function (a) - if a.head ~= v and a:eventIndex() then - return a, a:eventIndex() - end + if a.head ~= v and a:eventIndex() then + return a, a:eventIndex() + end end) info.to_node = (other and other.head) or (graph.vertices[1] == v and graph.vertices[2] or graph.vertices[1]) @@ -439,57 +440,55 @@ end -- orientation for what the algorithm assumes. -- -- The ``bounding box'' actually consists of the fields --- % -- \begin{itemize} --- \item |sibling_pre|, --- \item |sibling_post|, --- \item |layer_pre|, and --- \item |layer_post|, +-- \item |sibling_pre|, +-- \item |sibling_post|, +-- \item |layer_pre|, and +-- \item |layer_post|, -- \end{itemize} --- % -- which correspond to ``min x'', ``min y'', ``min y'', and ``max y'' --- for a tree growing up. +-- for a tree growing up. -- -- The computation of the ``bounding box'' treats a centered circle in -- a special way, all other shapes are currently treated like a -- rectangle. -- -- @param rotation_info The table computed by the function prepareRotateAround --- @param packing_storage A storage in which the computed distances are stored. --- @param graph An graph +-- @param packing_storage A storage in which the computed distances are stored. +-- @param graph An graph -- @param vertices An array of to-be-prepared vertices inside graph function LayoutPipeline.prepareBoundingBoxes(rotation_info, adjusted_bb, graph, vertices) - + local angle = assert(rotation_info.angle, "angle field missing") local swap = rotation_info.swap - + for _,v in ipairs(vertices) do local bb = adjusted_bb[v] local a = angle - + if v.shape == "circle" then a = 0 -- no rotation for circles. end - + -- Fill the bounding box field, bb.sibling_pre = math.huge bb.sibling_post = -math.huge bb.layer_pre = math.huge bb.layer_post = -math.huge - + local c = math.cos(angle) local s = math.sin(angle) for _,p in ipairs(v.path:coordinates()) do local x = p.x*c + p.y*s local y = -p.x*s + p.y*c - + bb.sibling_pre = math.min (bb.sibling_pre, x) bb.sibling_post = math.max (bb.sibling_post, x) bb.layer_pre = math.min (bb.layer_pre, y) bb.layer_post = math.max (bb.layer_post, y) end - + -- Flip sibling per and post if flag: if swap then bb.sibling_pre, bb.sibling_post = -bb.sibling_post, -bb.sibling_pre @@ -502,7 +501,7 @@ end -- --- Rotate the whole graph around a point +-- Rotate the whole graph around a point -- -- Causes the graph to be rotated around \meta{around} so that what -- used to be the |from_angle| becomes the |to_angle|. If the flag |swap| @@ -517,21 +516,21 @@ end -- swapped (flipped) along the new angle function LayoutPipeline.rotateGraphAround(graph, around_x, around_y, from, to, swap) - + -- Translate to origin local t = Transform.new_shift(-around_x, -around_y) - + -- Rotate to zero degrees: t = Transform.concat(Transform.new_rotation(-from), t) - + -- Swap if swap then t = Transform.concat(Transform.new_scaling(1,-1), t) end - + -- Rotate to from degrees: t = Transform.concat(Transform.new_rotation(to), t) - + -- Translate back t = Transform.concat(Transform.new_shift(around_x, around_y), t) @@ -547,7 +546,7 @@ end --- +-- -- Orient the whole graph using two nodes -- -- The whole graph is rotated so that the line from the first node to @@ -558,17 +557,17 @@ end -- @param first_node -- @param seond_node -- @param target_angle --- @param swap +-- @param swap function LayoutPipeline.orientTwoNodes(graph, first_node, second_node, target_angle, swap) if first_node and second_node then -- Compute angle between first_node and second_node: local x = second_node.pos.x - first_node.pos.x local y = second_node.pos.y - first_node.pos.y - + local angle = math.atan2(y,x) LayoutPipeline.rotateGraphAround(graph, first_node.pos.x, - first_node.pos.y, angle, target_angle, swap) + first_node.pos.y, angle, target_angle, swap) end end @@ -577,25 +576,25 @@ end --- -- Performs a post-layout orientation of the graph by performing the -- steps documented in Section~\ref{subsection-library-graphdrawing-standard-orientation}. --- +-- -- @param rotation_info The info record computed by the function |prepareRotateAround|. -- @param postconditions The algorithm's postconditions. -- @param graph A to-be-oriented graph. -- @param scope The graph drawing scope. function LayoutPipeline.orient(rotation_info, postconditions, graph, scope) - + -- Sanity check if #graph.vertices < 2 then return end - + -- Step 1: Search for global graph orient options: local function f (orient, tail, head, flag) if orient and head and tail then local n1 = scope.node_names[tail] local n2 = scope.node_names[head] if graph:contains(n1) and graph:contains(n2) then - LayoutPipeline.orientTwoNodes(graph, n1, n2, orient/360*2*math.pi, flag) - return true + LayoutPipeline.orientTwoNodes(graph, n1, n2, orient/360*2*math.pi, flag) + return true end end end @@ -609,32 +608,32 @@ function LayoutPipeline.orient(rotation_info, postconditions, graph, scope) if f(-90, tail, head, false) then return end local tail, head = string.match(graph.options["vertical'"] or "", "^(.*) to (.*)$") if f(-90, tail, head, true) then return end - + -- Step 2: Search for a node with the orient option: for _, v in ipairs(graph.vertices) do local function f (key, flag) local orient = v.options[key] - local head = v.options["orient head"] + local head = v.options["orient head"] local tail = v.options["orient tail"] - + if orient and head then - local n2 = scope.node_names[head] - if graph:contains(n2) then - LayoutPipeline.orientTwoNodes(graph, v, n2, orient/360*2*math.pi, flag) - return true - end - elseif orient and tail then - local n1 = scope.node_names[tail] - if graph:contains(n1) then - LayoutPipeline.orientTwoNodes(graph, n1, v, orient/360*2*math.pi, flag) - return true - end + local n2 = scope.node_names[head] + if graph:contains(n2) then + LayoutPipeline.orientTwoNodes(graph, v, n2, orient/360*2*math.pi, flag) + return true + end + elseif orient and tail then + local n1 = scope.node_names[tail] + if graph:contains(n1) then + LayoutPipeline.orientTwoNodes(graph, n1, v, orient/360*2*math.pi, flag) + return true + end end end if f("orient", false) then return end if f("orient'", true) then return end end - + -- Step 3: Search for an edge with the orient option: for _, a in ipairs(graph.arcs) do if a:options("orient",true) then @@ -644,21 +643,21 @@ function LayoutPipeline.orient(rotation_info, postconditions, graph, scope) return LayoutPipeline.orientTwoNodes(graph, a.tail, a.head, a:options("orient'")/360*2*math.pi, true) end end - + -- Step 4: Search two nodes with a desired at option: local first, second, third - + for _, v in ipairs(graph.vertices) do if v.options['desired at'] then if first then - if second then - third = v - break - else - second = v - end - else - first = v + if second then + third = v + break + else + second = v + end + else + first = v end end end @@ -668,13 +667,13 @@ function LayoutPipeline.orient(rotation_info, postconditions, graph, scope) local b = second.options['desired at'] return LayoutPipeline.orientTwoNodes(graph, first, second, math.atan2(b.y-a.y,b.x-a.x), false) end - + -- Computed during preprocessing: if rotation_info.from_node and postconditions.fixed ~= true then local x = rotation_info.from_node.pos.x local y = rotation_info.from_node.pos.y local from_angle = rotation_info.from_angle or math.atan2(rotation_info.to_node.pos.y - y, rotation_info.to_node.pos.x - x) - + LayoutPipeline.rotateGraphAround(graph, x, y, from_angle, rotation_info.to_angle, rotation_info.swap) end end @@ -690,74 +689,74 @@ end -- -- @param graph A to-be-decomposed graph -- --- @return An array of graph objects that represent the connected components of the graph. +-- @return An array of graph objects that represent the connected components of the graph. function LayoutPipeline.decompose (digraph) -- The list of connected components (node sets) local components = {} - + -- Remember, which graphs have already been visited local visited = {} - + for _,v in ipairs(digraph.vertices) do if not visited[v] then -- Start a depth-first-search of the graph, starting at node n: local stack = { v } local component = Digraph.new { - syntactic_digraph = digraph.syntactic_digraph, - options = digraph.options + syntactic_digraph = digraph.syntactic_digraph, + options = digraph.options } - + while #stack >= 1 do - local tos = stack[#stack] - stack[#stack] = nil -- pop - - if not visited[tos] then - - -- Visit pos: - component:add { tos } - visited[tos] = true - - -- Push all unvisited neighbors: - for _,a in ipairs(digraph:incoming(tos)) do - local neighbor = a.tail - if not visited[neighbor] then - stack[#stack+1] = neighbor -- push - end - end - for _,a in ipairs(digraph:outgoing(tos)) do - local neighbor = a.head - if not visited[neighbor] then - stack[#stack+1] = neighbor -- push - end - end - end + local tos = stack[#stack] + stack[#stack] = nil -- pop + + if not visited[tos] then + + -- Visit pos: + component:add { tos } + visited[tos] = true + + -- Push all unvisited neighbors: + for _,a in ipairs(digraph:incoming(tos)) do + local neighbor = a.tail + if not visited[neighbor] then + stack[#stack+1] = neighbor -- push + end + end + for _,a in ipairs(digraph:outgoing(tos)) do + local neighbor = a.head + if not visited[neighbor] then + stack[#stack+1] = neighbor -- push + end + end + end end - + -- Ok, vertices will now contain all vertices reachable from n. components[#components+1] = component end end - + if #components < 2 then return { digraph } end - + for _,c in ipairs(components) do table.sort (c.vertices, function (u,v) return u.event.index < v.event.index end) for _,v in ipairs(c.vertices) do for _,a in ipairs(digraph:outgoing(v)) do - local new_a = c:connect(a.tail, a.head) - new_a.syntactic_edges = a.syntactic_edges + local new_a = c:connect(a.tail, a.head) + new_a.syntactic_edges = a.syntactic_edges end for _,a in ipairs(digraph:incoming(v)) do - local new_a = c:connect(a.tail, a.head) - new_a.syntactic_edges = a.syntactic_edges + local new_a = c:connect(a.tail, a.head) + new_a.syntactic_edges = a.syntactic_edges end end end - + return components end @@ -785,23 +784,23 @@ end -- Right now, we hardcode the functions here. Perhaps make this -- dynamic in the future. Could easily be done on the tikzlayer, --- actually. +-- acutally. LayoutPipeline.component_ordering_functions = { - ["increasing node number"] = - function (g,h) + ["increasing node number"] = + function (g,h) if #g.vertices == #h.vertices then - return g.vertices[1].event.index < h.vertices[1].event.index + return g.vertices[1].event.index < h.vertices[1].event.index else - return #g.vertices < #h.vertices + return #g.vertices < #h.vertices end end, - ["decreasing node number"] = - function (g,h) + ["decreasing node number"] = + function (g,h) if #g.vertices == #h.vertices then - return g.vertices[1].event.index < h.vertices[1].event.index + return g.vertices[1].event.index < h.vertices[1].event.index else - return #g.vertices > #h.vertices + return #g.vertices > #h.vertices end end, ["by first specified node"] = nil, @@ -811,27 +810,27 @@ LayoutPipeline.component_ordering_functions = { local function compute_rotated_bb(vertices, angle, sep, bb) - + local r = Transform.new_rotation(-angle) - + for _,v in ipairs(vertices) do -- Find the rotated bounding box field, local t = Transform.concat(r,Transform.new_shift(v.pos.x, v.pos.y)) - + local min_x = math.huge local max_x = -math.huge local min_y = math.huge local max_y = -math.huge - + for _,e in ipairs(v.path) do if type(e) == "table" then - local c = e:clone() - c:apply(t) - - min_x = math.min (min_x, c.x) - max_x = math.max (max_x, c.x) - min_y = math.min (min_y, c.y) - max_y = math.max (max_y, c.y) + local c = e:clone() + c:apply(t) + + min_x = math.min (min_x, c.x) + max_x = math.max (max_x, c.x) + min_y = math.min (min_y, c.y) + max_y = math.max (max_y, c.y) end end @@ -840,12 +839,12 @@ local function compute_rotated_bb(vertices, angle, sep, bb) max_x = max_x + sep min_y = min_y - sep max_y = max_y + sep - + local _,_,_,_,c_x,c_y = v:boundingBox() local center = Coordinate.new(c_x,c_y) - + center:apply(t) - + bb[v].min_x = min_x bb[v].max_x = max_x bb[v].min_y = min_y @@ -856,9 +855,9 @@ end ---- +--- -- This internal function packs the components of a graph. See --- Section~\ref{subsection-gd-component-packing} for details. +-- Section~\ref{subsection-gd-component-packing} for details. -- -- @param graph The graph -- @param components A list of components @@ -867,14 +866,14 @@ function LayoutPipeline.packComponents(syntactic_digraph, components) local vertices = Storage.newTableStorage() local bb = Storage.newTableStorage() - + -- Step 1: Preparation, rotation to target direction local sep = syntactic_digraph.options['component sep'] local angle = syntactic_digraph.options['component direction']/180*math.pi - + local mark = {} for _,c in ipairs(components) do - + -- Setup the lists of to-be-considered nodes local vs = {} for _,v in ipairs(c.vertices) do @@ -883,24 +882,24 @@ function LayoutPipeline.packComponents(syntactic_digraph, components) for _,a in ipairs(c.arcs) do for _,p in ipairs(a:pointCloud()) do - vs [#vs + 1] = Vertex.new { pos = p } + vs [#vs + 1] = Vertex.new { pos = p } end end vertices[c] = vs compute_rotated_bb(vs, angle, sep/2, bb) end - + local x_shifts = { 0 } local y_shifts = {} - + -- Step 2: Vertical alignment for i,c in ipairs(components) do local max_max_y = -math.huge local max_center_y = -math.huge local min_min_y = math.huge local min_center_y = math.huge - + for _,v in ipairs(c.vertices) do local info = bb[v] max_max_y = math.max(info.max_y, max_max_y) @@ -908,7 +907,7 @@ function LayoutPipeline.packComponents(syntactic_digraph, components) min_min_y = math.min(info.min_y, min_min_y) min_center_y = math.min(info.c_y, min_center_y) end - + -- Compute alignment line local valign = syntactic_digraph.options['component align'] local line @@ -922,15 +921,15 @@ function LayoutPipeline.packComponents(syntactic_digraph, components) line = min_center_y elseif valign == "first node" then line = bb[c.vertices[1]].c_y - else + else line = min_min_y end - + -- Overruled? for _,v in ipairs(c.vertices) do if v.options['align here'] then - line = bb[v].c_y - break + line = bb[v].c_y + break end end @@ -957,9 +956,9 @@ function LayoutPipeline.packComponents(syntactic_digraph, components) y_values[#y_values+1] = info.c_y end end - + table.sort(y_values) - + local y_ranks = {} local right_face = {} for i=1,#y_values do @@ -967,41 +966,41 @@ function LayoutPipeline.packComponents(syntactic_digraph, components) right_face[i] = -math.huge end - - + + for i=1,#components-1 do -- First, update right_face: local touched = {} - + for _,v in ipairs(vertices[components[i]]) do local info = bb[v] local border = info.max_x - + for i=y_ranks[info.min_y],y_ranks[info.max_y] do - touched[i] = true - right_face[i] = math.max(right_face[i], border) + touched[i] = true + right_face[i] = math.max(right_face[i], border) end end - + -- Fill up the untouched entries: local right_max = -math.huge for i=1,#y_values do if not touched[i] then - -- Search for next and previous touched - local interpolate = -math.huge - for j=i+1,#y_values do - if touched[j] then - interpolate = math.max(interpolate,right_face[j] - (y_values[j] - y_values[i])) - break - end - end - for j=i-1,1,-1 do - if touched[j] then - interpolate = math.max(interpolate,right_face[j] - (y_values[i] - y_values[j])) - break - end - end - right_face[i] = math.max(interpolate,right_face[i]) + -- Search for next and previous touched + local interpolate = -math.huge + for j=i+1,#y_values do + if touched[j] then + interpolate = math.max(interpolate,right_face[j] - (y_values[j] - y_values[i])) + break + end + end + for j=i-1,1,-1 do + if touched[j] then + interpolate = math.max(interpolate,right_face[j] - (y_values[i] - y_values[j])) + break + end + end + right_face[i] = math.max(interpolate,right_face[i]) end right_max = math.max(right_max, right_face[i]) end @@ -1017,30 +1016,30 @@ function LayoutPipeline.packComponents(syntactic_digraph, components) local border = info.min_x for i=y_ranks[info.min_y],y_ranks[info.max_y] do - touched[i] = true - left_face[i] = math.min(left_face[i], border) + touched[i] = true + left_face[i] = math.min(left_face[i], border) end end - + -- Fill up the untouched entries: local left_min = math.huge for i=1,#y_values do if not touched[i] then - -- Search for next and previous touched - local interpolate = math.huge - for j=i+1,#y_values do - if touched[j] then - interpolate = math.min(interpolate,left_face[j] + (y_values[j] - y_values[i])) - break - end - end - for j=i-1,1,-1 do - if touched[j] then - interpolate = math.min(interpolate,left_face[j] + (y_values[i] - y_values[j])) - break - end - end - left_face[i] = interpolate + -- Search for next and previous touched + local interpolate = math.huge + for j=i+1,#y_values do + if touched[j] then + interpolate = math.min(interpolate,left_face[j] + (y_values[j] - y_values[i])) + break + end + end + for j=i-1,1,-1 do + if touched[j] then + interpolate = math.min(interpolate,left_face[j] + (y_values[i] - y_values[j])) + break + end + end + left_face[i] = interpolate end left_min = math.min(left_min, left_face[i]) end @@ -1052,10 +1051,10 @@ function LayoutPipeline.packComponents(syntactic_digraph, components) shift = right_max - left_min else for i=1,#y_values do - shift = math.max(shift, right_face[i] - left_face[i]) + shift = math.max(shift, right_face[i] - left_face[i]) end end - + -- Adjust nodes: x_shifts[i+1] = shift for _,v in ipairs(vertices[components[i+1]]) do @@ -1064,12 +1063,12 @@ function LayoutPipeline.packComponents(syntactic_digraph, components) info.max_x = info.max_x + shift end end - + -- Now, rotate shifts for i,c in ipairs(components) do local x = x_shifts[i]*math.cos(angle) - y_shifts[i]*math.sin(angle) local y = x_shifts[i]*math.sin(angle) + y_shifts[i]*math.cos(angle) - + for _,v in ipairs(vertices[c]) do v.pos.x = v.pos.x + x v.pos.y = v.pos.y + y @@ -1095,13 +1094,13 @@ prepare_events = for i=1,#events do if events[i].kind == "begin" then - stack[#stack + 1] = i + stack[#stack + 1] = i elseif events[i].kind == "end" then - local tos = stack[#stack] - stack[#stack] = nil -- pop - - events[tos].end_index = i - events[i].begin_index = tos + local tos = stack[#stack] + stack[#stack] = nil -- pop + + events[tos].end_index = i + events[i].begin_index = tos end end end @@ -1125,48 +1124,48 @@ function LayoutPipeline.cutEdges(graph) local p = e.path p:makeRigid() local orig = p:clone() - - if e.options['tail cut'] and e.tail.options['cut policy'] == "as edge requests" - or e.tail.options['cut policy'] == "all" then - - local vpath = e.tail.path:clone() - vpath:shiftByCoordinate(e.tail.pos) - - local x = p:intersectionsWith (vpath) - - if #x > 0 then - p:cutAtBeginning(x[1].index, x[1].time) - end + + if e.options['tail cut'] and e.tail.options['cut policy'] == "as edge requests" + or e.tail.options['cut policy'] == "all" then + + local vpath = e.tail.path:clone() + vpath:shiftByCoordinate(e.tail.pos) + + local x = p:intersectionsWith (vpath) + + if #x > 0 then + p:cutAtBeginning(x[1].index, x[1].time) + end end - - if e.options['head cut'] and e.head.options['cut policy'] == "as edge requests" - or e.head.options['cut policy'] == "all" then - - local vpath = e.head.path:clone() - vpath:shiftByCoordinate(e.head.pos) - x = p:intersectionsWith (vpath) - if #x > 0 then - p:cutAtEnd(x[#x].index, x[#x].time) - else - -- Check whether there was an intersection with the original - --path: - local x2 = orig:intersectionsWith (vpath) - if #x2 > 0 then - -- Ok, after cutting the tail vertex, there is no longer - -- an intersection with the head vertex, but there used to - -- be one. This means that the vertices overlap and the - -- path should be ``inside'' them. Hmm... - if e.options['allow inside edges'] and #p > 1 then - local from = p[2] - local to = x2[1].point - p:clear() - p:appendMoveto(from) - p:appendLineto(to) - else - p:clear() - end - end - end + + if e.options['head cut'] and e.head.options['cut policy'] == "as edge requests" + or e.head.options['cut policy'] == "all" then + + local vpath = e.head.path:clone() + vpath:shiftByCoordinate(e.head.pos) + x = p:intersectionsWith (vpath) + if #x > 0 then + p:cutAtEnd(x[#x].index, x[#x].time) + else + -- Check whether there was an intersection with the original + --path: + local x2 = orig:intersectionsWith (vpath) + if #x2 > 0 then + -- Ok, after cutting the tail vertex, there is no longer + -- an intersection with the head vertex, but there used to + -- be one. This means that the vertices overlap and the + -- path should be ``inside'' them. Hmm... + if e.options['allow inside edges'] and #p > 1 then + local from = p[2] + local to = x2[1].point + p:clear() + p:appendMoveto(from) + p:appendLineto(to) + else + p:clear() + end + end + end end end end @@ -1201,7 +1200,7 @@ local function compatibility_digraph_to_graph(scope, g) for i,e in ipairs(scope.events) do graph.events[i] = e end - + -- Nodes for _,v in ipairs(g.vertices) do if not v.name then @@ -1213,13 +1212,13 @@ local function compatibility_digraph_to_graph(scope, g) local node = Node.new{ name = v.name, tex = { - tex_node = v.tex and v.tex.stored_tex_box_number, - shape = v.shape, - minX = minX, - maxX = maxX, - minY = minY, - maxY = maxY, - }, + tex_node = v.tex and v.tex.stored_tex_box_number, + shape = v.shape, + minX = minX, + maxX = maxX, + minY = minY, + maxY = maxY, + }, options = v.options, event_index = v.event.index, index = v.event.index, @@ -1235,38 +1234,38 @@ local function compatibility_digraph_to_graph(scope, g) local da = g.syntactic_digraph:arc(a.tail, a.head) if da then for _,m in ipairs(da.syntactic_edges) do - if not mark[m] then - mark[m] = true - local from_node = graph:findNode(da.tail.name) - local to_node = graph:findNode(da.head.name) - local edge = graph:createEdge(from_node, to_node, m.direction, nil, m.options, nil) - edge.event_index = m.event.index - edge.orig_m = m - graph.events[m.event.index] = { kind = 'edge', parameters = edge } - end + if not mark[m] then + mark[m] = true + local from_node = graph:findNode(da.tail.name) + local to_node = graph:findNode(da.head.name) + local edge = graph:createEdge(from_node, to_node, m.direction, nil, m.options, nil) + edge.event_index = m.event.index + edge.orig_m = m + graph.events[m.event.index] = { kind = 'edge', parameters = edge } + end end end local da = g.syntactic_digraph:arc(a.head, a.tail) - if da then + if da then for _,m in ipairs(da.syntactic_edges) do - if not mark[m] then - mark[m] = true - local from_node = graph:findNode(da.tail.name) - local to_node = graph:findNode(da.head.name) - local edge = graph:createEdge(from_node, to_node, m.direction, nil, m.options, nil) - edge.event_index = m.event.index - edge.orig_m = m - graph.events[m.event.index] = { kind = 'edge', parameters = edge } - end + if not mark[m] then + mark[m] = true + local from_node = graph:findNode(da.tail.name) + local to_node = graph:findNode(da.head.name) + local edge = graph:createEdge(from_node, to_node, m.direction, nil, m.options, nil) + edge.event_index = m.event.index + edge.orig_m = m + graph.events[m.event.index] = { kind = 'edge', parameters = edge } + end end end end - + table.sort(graph.edges, function(e1,e2) return e1.event_index < e2.event_index end) for _,n in ipairs (graph.nodes) do table.sort(n.edges, function(e1,e2) return e1.event_index < e2.event_index end) end - + -- Clusters for _, c in ipairs(scope.collections['same layer'] or {}) do @@ -1275,7 +1274,7 @@ local function compatibility_digraph_to_graph(scope, g) graph:addCluster(cluster) for _,v in ipairs(c.vertices) do if g:contains(v) then - cluster:addNode(graph:findNode(v.name)) + cluster:addNode(graph:findNode(v.name)) end end end @@ -1293,7 +1292,7 @@ local function compatibility_graph_to_digraph(graph) if #e.bend_points > 0 then local c = {} for _,x in ipairs(e.bend_points) do - c[#c+1] = Coordinate.new (x.x, x.y) + c[#c+1] = Coordinate.new (x.x, x.y) end e.orig_m:setPolylinePath(c) end @@ -1310,12 +1309,12 @@ function LayoutPipeline.runOldGraphModel(scope, digraph, algorithm_class, algori algorithm.graph = graph graph:registerAlgorithm(algorithm) - + -- If requested, remove loops if algorithm_class.preconditions.loop_free then Simplifiers:removeLoopsOldModel(algorithm) end - + -- If requested, collapse multiedges if algorithm_class.preconditions.simple then Simplifiers:collapseMultiedgesOldModel(algorithm) @@ -1325,12 +1324,12 @@ function LayoutPipeline.runOldGraphModel(scope, digraph, algorithm_class, algori -- Main run of the algorithm: algorithm:run () end - + -- If requested, expand multiedges if algorithm_class.preconditions.simple then Simplifiers:expandMultiedgesOldModel(algorithm) end - + -- If requested, restore loops if algorithm_class.preconditions.loop_free then Simplifiers:restoreLoopsOldModel(algorithm) @@ -1344,4 +1343,4 @@ end -- Done -return LayoutPipeline +return LayoutPipeline
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/NodeAnchors.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/NodeAnchors.lua index 80aa7ef420a..e7d44d7d10e 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/NodeAnchors.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/NodeAnchors.lua @@ -18,9 +18,9 @@ local declare = require "pgf.gd.interface.InterfaceToAlgorithms".declare -- -- \label{section-gd-anchors} -- --- When a graph has been laid out completely, the edges between the +-- When a graph has been layed out completely, the edges between the -- nodes must be drawn. Conceptually, an edge is ``between two --- nodes'', but when we actually draw the node, we do not really want +-- nodes,'' but when we actually draw the node, we do not really want -- the edge's path to start ``in the middle'' of the node; rather, we -- want it to start ``on the border'' and also end there. -- @@ -37,7 +37,7 @@ local declare = require "pgf.gd.interface.InterfaceToAlgorithms".declare -- inside the tail and head nodes, respectively. The edge path will -- then start and end at these points, however, they will usually be -- shortened so that they actually start and end on the intersection --- of the edge's path with the nodes' paths. +-- of the edge's path with the nodes' paths. --- @@ -47,41 +47,41 @@ declare { type = "string", initial = "", - summary = [[" - Specifies where in the tail vertex the edge should start. + summary = [[" + Specifies where in the tail vertex the edge should start. "]], documentation = [[" - This is either a string or a number, interpreted as an angle - (with 90 meaning ``up''). If it is a string, when the start of - the edge is computed, we try to look up the anchor in the tail - vertex's table of anchors (some anchors get installed in this - table by the display system). If it is not found, we test - whether it is one of the special ``direction anchors'' like - |north| or |south east|. If so, we convert them into points on - the border of the node that lie in the direction of a line - starting at the center to a point on the bounding box of the - node in the designated direction. Finally, if the anchor is a - number, we use a point on the border of the node that is on a - line from the center in the specified direction. - - If the anchor is set to the empty string (which is the default), - the anchor is interpreted as the |center| anchor inside the - graph drawing system. However, a display system may choose to - make a difference between the |center| anchor and an empty - anchor (\tikzname\ does: for options like |bend left| if the - anchor is empty, the bend line starts at the border of the node, - while for the anchor set explicitly to |center| it starts at the - center). - - Note that graph drawing algorithms need not take the - setting of this option into consideration. However, the final - rendering of the edge will always take it into consideration - (only, the setting may not be very sensible if the algorithm - ignored it). + This is either a string or a number, interpreted as an angle + (with 90 meaning ``up''). If it is a string, when the start of + the edge is computed, we try to look up the anchor in the tail + vertex's table of anchors (some anchors get installed in this + table by the display system). If it is not found, we test + whether it is one of the special ``direction anchors'' like + |north| or |south east|. If so, we convert them into points on + the border of the node that lie in the direction of a line + starting at the center to a point on the bounding box of the + node in the designated direction. Finally, if the anchor is a + number, we use a point on the border of the node that is on a + line from the center in the specified direction. + + If the anchor is set to the empty string (which is the default), + the anchor is interpreted as the |center| anchor inside the + graph drawing system. However, a display system may choose to + make a difference between the |center| anchor and an empty + anchor (\tikzname\ does: for options like |bend left| if the + anchor is empty, the bend line starts at the border of the node, + while for the anchor set explicitly to |center| it starts at the + center). + + Note that graph drawing algorithms need not take the + setting of this option into consideration. However, the final + rendering of the edge will always take it into consideration + (only, the setting may not be very sensible if the algorithm + ignored it). "]] } - + --- declare { @@ -101,10 +101,10 @@ declare { initial = true, summary = [[" - Decides whether the tail of an edge is ``cut'', meaning - that the edge's path will be shortened at the beginning so that - it starts only of the node's border rather than at the exact - position of the |tail anchor|, which may be inside the node. + Decides whether the tail of an edge is ``cut'', meaning + that the edge's path will be shortened at the beginning so that + it starts only of the node's border rather than at the exact + position of the |tail anchor|, which may be inside the node. "]] } @@ -130,24 +130,23 @@ declare { summary = "The policy for cutting edges entering or leaving a node.", documentation = [[" - This option is important for nodes only. It can have three - possible values: - % - \begin{itemize} + This option is important for nodes only. It can have three + possible values: + \begin{itemize} \item |as edge requests| Whether or not an edge entering or - leaving the node is cut depends on the setting of the edge's - |tail cut| and |head cut| options. This is the default. + leaving the node is cut depends on the setting of the edge's + |tail cut| and |head cut| options. This is the default. \item |all| All edges entering or leaving the node are cut, - regardless of the edges' cut values. + regardless of the edges' cut values. \item |none| No edge entering or leaving the node is cut, - regardless of the edges' cut values. - \end{itemize} + regardless of the edges' cut values. + \end{itemize} "]] } - + --- -declare { +declare { key = "allow inside edges", type = "boolean", initial = "true", @@ -155,21 +154,21 @@ declare { summary = "Decides whether an edge between overlapping nodes should be drawn.", documentation = [[" - If two vertices overlap, it may happen that when you draw an - edge between them, this edges would be completely inside the two - vertices. In this case, one could either not draw them or one - could draw a sort of ``inside edge''. + If two vertices overlap, it may happen that when you draw an + edge between them, this edges would be completely inside the two + vertices. In this case, one could either not draw them or one + could draw a sort of ``inside edge''. "]], - + examples = { [[" - \tikz \graph [no layout, nodes={draw, minimum size=20pt}] { - a [x=0, y=0] -- b [x=15pt, y=10pt] -- c[x=40pt] - }; - "]],[[" - \tikz \graph [no layout, nodes={draw, minimum size=20pt}, - allow inside edges=false] { - a [x=0, y=0] -- b [x=15pt, y=10pt] -- c[x=40pt] - }; - "]] + \tikz \graph [no layout, nodes={draw, minimum size=20pt}] { + a [x=0, y=0] -- b [x=15pt, y=10pt] -- c[x=40pt] + }; + "]], [[" + \tikz \graph [no layout, nodes={draw, minimum size=20pt}, + allow inside edges=false] { + a [x=0, y=0] -- b [x=15pt, y=10pt] -- c[x=40pt] + }; + "]] } }
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/Orientation.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/Orientation.lua index 1890fa4f39d..10f5ecdf471 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/Orientation.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/Orientation.lua @@ -27,7 +27,7 @@ -- you can specify that the line from a certain vertex to another -- vertex should have a certain slope. How these vertices and slopes -- are specified in explained momentarily. Second, you can specify a --- so-called ``growth direction'' for trees. +-- so-called ``growth direction'' for trees. -- -- @end @@ -48,40 +48,42 @@ declare { type = "direction", default = 0, - summary = [[" - This key specifies that the straight line from the |orient tail| to - the |orient head| should be at an angle of \meta{direction} relative to - the right-going $x$-axis. Which vertices are used as tail an head - depends on where the |orient| option is encountered: When used with - an edge, the tail is the edge's tail and the head is the edge's - head. When used with a node, the tail or the head must be specified - explicitly and the node is used as the node missing in the - specification. When used with a graph as a whole, both the head and - tail nodes must be specified explicitly. + summary = [[" + This key specifies that the straight line from the |orient tail| to + the |orient head| should be at an angle of \meta{direction} relative to + the right-going $x$-axis. Which vertices are used as tail an head + depends on where the |orient| option is encountered: When used with + an edge, the tail is the edge's tail und the head is the edge's + head. When used with a node, the tail or the head must be specified + explicitly and the node is used as the node missing in the + specification. When used with a graph as a whole, both the head and + tail nodes must be specified explicitly. "]], documentation = [[" - Note that the \meta{direction} is independent of the actual to-path - of an edge, which might define a bend or more complicated shapes. For - instance, a \meta{angle} of |45| requests that the end node is ``up - and right'' relative to the start node. - - You can also specify the standard direction texts |north| or |south east| - and so forth as \meta{direction} and also |up|, |down|, |left|, and - |right|. Also, you can specify |-| for ``right'' and \verb!|! for ``down''. - "]], - examples = {[[" - \tikz \graph [spring layout] - { - a -- { b, c, d, e -- {f, g, h} }; - h -- [orient=30] a; - }; - "]],[[" - \tikz \graph [spring layout] - { - a -- { b, c, d[> orient=right], e -- {f, g, h} }; - h -- a; - }; - "]] + Note that the \meta{direction} is independent of the actual to-path + of an edge, which might define a bend or more complicated shapes. For + instance, a \meta{angle} of |45| requests that the end node is ``up + and right'' relative to the start node. + + You can also specify the standard direction texts |north| or |south east| + and so forth as \meta{direction} and also |up|, |down|, |left|, and |right|. Also, you + can specify |-| for ``right'' and \verb!|! for ``down.'' + "]], + examples = { + [[" + \tikz \graph [spring layout] + { + a -- { b, c, d, e -- {f, g, h} }; + h -- [orient=30] a; + }; + "]], + [[" + \tikz \graph [spring layout] + { + a -- { b, c, d[> orient=right], e -- {f, g, h} }; + h -- a; + }; + "]] } } @@ -93,16 +95,16 @@ declare { type = "direction", default = 0, - summary = [[" - Same as |orient|, only the rest of the graph should be - flipped relative to the connection line. + summary = [[" + Same as |orient|, only the rest of the graph should be + flipped relative to the connection line. "]], examples = [[" - \tikz \graph [spring layout] - { - a -- { b, c, d[> orient'=right], e -- {f, g, h} }; - h -- a; - }; + \tikz \graph [spring layout] + { + a -- { b, c, d[> orient'=right], e -- {f, g, h} }; + h -- a; + }; "]] } @@ -112,24 +114,26 @@ declare { key = "orient tail", type = "string", - summary = [[" - Specifies the tail vertex for the orientation of a graph. See - |orient| for details. + summary = [[" + Specifies the tail vertex for the orientation of a graph. See + |orient| for details. "]], - examples = {[[" - \tikz \graph [spring layout] { - a [orient=|, orient tail=f] -- { b, c, d, e -- {f, g, h} }; - { h, g } -- a; - }; - "]],[[" - \tikz \graph [spring layout] { - a [orient=down, orient tail=h] -- { b, c, d, e -- {f, g, h} }; - { h, g } -- a; - }; - "]] + examples = { + [[" + \tikz \graph [spring layout] { + a [orient=|, orient tail=f] -- { b, c, d, e -- {f, g, h} }; + { h, g } -- a; + }; + "]], + [[" + \tikz \graph [spring layout] { + a [orient=down, orient tail=h] -- { b, c, d, e -- {f, g, h} }; + { h, g } -- a; + }; + "]] } } - + @@ -140,21 +144,23 @@ declare { key = "orient head", type = "string", - summary = [[" - Specifies the head vertex for the orientation of a graph. See - |orient| for details. + summary = [[" + Specifies the head vertex for the orientation of a graph. See + |orient| for details. "]], - examples = {[[" - \tikz \graph [spring layout] - { - a [orient=|, orient head=f] -- { b, c, d, e -- {f, g, h} }; - { h, g } -- a; - }; - "]],[[" - \tikz \graph [spring layout] { a -- b -- c -- a }; - \tikz \graph [spring layout, orient=10, - orient tail=a, orient head=b] { a -- b -- c -- a }; - "]] + examples = { + [[" + \tikz \graph [spring layout] + { + a [orient=|, orient head=f] -- { b, c, d, e -- {f, g, h} }; + { h, g } -- a; + }; + "]], + [[" + \tikz \graph [spring layout] { a -- b -- c -- a }; + \tikz \graph [spring layout, orient=10, + orient tail=a, orient head=b] { a -- b -- c -- a }; + "]] } } @@ -164,17 +170,17 @@ declare { key = "horizontal", type = "string", - summary = [[" - A shorthand for specifying |orient tail|, |orient head| and - |orient=0|. The tail will be everything before the part ``| to |'' - and the head will be everything following it. + summary = [[" + A shorthand for specifying |orient tail|, |orient head| and + |orient=0|. The tail will be everything before the part ``| to |'' + and the head will be everything following it. "]], - examples = [[" - \tikz \graph [spring layout] { a -- b -- c -- a }; - \tikz \graph [spring layout, horizontal=a to b] { a -- b -- c -- a }; + examples = [[" + \tikz \graph [spring layout] { a -- b -- c -- a }; + \tikz \graph [spring layout, horizontal=a to b] { a -- b -- c -- a }; "]] } - + @@ -184,11 +190,11 @@ declare { key = "horizontal'", type = "string", - summary = [[" - Like |horizontal|, but with a flip. + summary = [[" + Like |horizontal|, but with a flip. "]] } - + @@ -201,15 +207,16 @@ declare { key = "vertical", type = "string", - summary = [[" - A shorthand for specifying |orient tail|, |orient head| and |orient=-90|. + summary = [[" + A shorthand for specifying |orient tail|, |orient head| and + |orient=-90|. "]], examples = [[" - \tikz \graph [spring layout] { a -- b -- c -- a }; - \tikz \graph [spring layout, vertical=a to b] { a -- b -- c -- a }; + \tikz \graph [spring layout] { a -- b -- c -- a }; + \tikz \graph [spring layout, vertical=a to b] { a -- b -- c -- a }; "]] } - + @@ -220,8 +227,8 @@ declare { key = "vertical'", type = "string", - summary = [[" - Like |vertical|, but with a flip. + summary = [[" + Like |vertical|, but with a flip. "]] } @@ -233,50 +240,54 @@ declare { key = "grow", type = "direction", - summary = [[" - This key specifies in which direction the neighbors of a node - ``should grow''. For some graph drawing algorithms, especially for - those that layout trees, but also for those that produce layered - layouts, there is a natural direction in which the ``children'' of - a node should be placed. For instance, saying |grow=down| will cause - the children of a node in a tree to be placed in a left-to-right - line below the node (as always, you can replace the \meta{angle} - by direction texts). The children are requested to be placed in a - counter-clockwise fashion, the |grow'| key will place them in a - clockwise fashion. + summary = [[" + This key specifies in which direction the neighbors of a node + ``should grow.'' For some graph drawing algorithms, especially for + those that layout trees, but also for those that produce layered + layouts, there is a natural direction in which the ``children'' of + a node should be placed. For instance, saying |grow=down| will cause + the children of a node in a tree to be placed in a left-to-right + line below the node (as always, you can replace the \meta{angle} + by direction texts). The children are requested to be placed in a + counter-clockwise fashion, the |grow'| key will place them in a + clockwise fashion. "]], - documentation = [[" - Note that when you say |grow=down|, it is not necessarily the case - that any particular node is actually directly below the current - node; the key just requests that the direction of growth is downward. - - In principle, you can specify the direction of growth for each node - individually, but do not count on graph drawing algorithms to - honor these wishes. - - When you give the |grow=right| key to the graph as a whole, it will - be applied to all nodes. This happens to be exactly what you want: + documentation = [[" + Note that when you say |grow=down|, it is not necessarily the case + that any particular node is actually directly below the current + node; the key just requests that the direction of growth is + downward. + + In principle, you can specify the direction of growth for each node + individually, but do not count on graph drawing algorithms to + honour these wishes. + + When you give the |grow=right| key to the graph as a whole, it will + be applied to all nodes. This happens to be exactly what you want: "]], - examples = {[[" - \tikz \graph [layered layout, sibling distance=5mm] - { - a [grow=right] -- { b, c, d, e -- {f, g, h} }; - { h, g } -- a; - }; - "]],[[" - \tikz \graph [layered layout, grow=right, sibling distance=5mm] - { - a -- { b, c, d, e -- {f, g, h} }; - { h, g } -- a; - }; - "]],[[" - \tikz - \graph [layered layout, grow=-80] - { - {a,b,c} --[complete bipartite] {e,d,f} - --[complete bipartite] {g,h,i}; - }; - "]] + examples = { + [[" + \tikz \graph [layered layout, sibling distance=5mm] + { + a [grow=right] -- { b, c, d, e -- {f, g, h} }; + { h, g } -- a; + }; + "]], + [[" + \tikz \graph [layered layout, grow=right, sibling distance=5mm] + { + a -- { b, c, d, e -- {f, g, h} }; + { h, g } -- a; + }; + "]], + [[" + \tikz + \graph [layered layout, grow=-80] + { + {a,b,c} --[complete bipartite] {e,d,f} + --[complete bipartite] {g,h,i}; + }; + "]] } } @@ -289,11 +300,11 @@ declare { summary = "Same as |grow|, only with the children in clockwise order.", examples = [[" - \tikz \graph [layered layout, sibling distance=5mm] - { - a [grow'=right] -- { b, c, d, e -- {f, g, h} }; - { h, g } -- a; - }; + \tikz \graph [layered layout, sibling distance=5mm] + { + a [grow'=right] -- { b, c, d, e -- {f, g, h} }; + { h, g } -- a; + }; "]] } diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/Sublayouts.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/Sublayouts.lua index 970483193f0..c28d12db563 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/Sublayouts.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/Sublayouts.lua @@ -15,7 +15,7 @@ local function full_print(g, pref) for _,v in ipairs(g.vertices) do s = s .. tostring(v) .. "[" .. tostring(v.pos) .. "]\n " end - + s = s .. "\n" for _,a in ipairs(g.arcs) do @@ -23,16 +23,16 @@ local function full_print(g, pref) s = s .. tostring(e) .. "(" .. tostring(e.path) .. ")\n" end end - + pgf.debug((pref or "") .. s) end --- --- The |Sublayouts| module handles graphs for which multiple layouts are defined. +-- The |Sublayouts| module handles graphs for which multiple layouts are defined. -- -- Please see Section~\ref{section-gd-sublayouts} for an overview of --- sublayouts. +-- sublayouts. -- local Sublayouts = {} @@ -80,7 +80,7 @@ end -- Nudge positioning. You can call this function several times on the --- same graph; nudging will be done only once. +-- same graph; nudging will be done only once. -- -- @param graph A graph -- @@ -100,28 +100,28 @@ end -- -- @param scope A scope -- @param syntactic_digraph The syntactic digraph. --- @param test Only for vertices whose subgraph collection passes this test will we create subgraph nodes +-- @param test Only for vertices whose subgraph collection passes this test will we create subgraph nodes local function create_subgraph_node(scope, syntactic_digraph, vertex) - + local subgraph_collection = vertex.subgraph_collection local binding = InterfaceCore.binding - + local cloud = {} -- Add all points of n's collection, except for v itself, to the cloud: for _,v in ipairs(subgraph_collection.vertices) do if vertex ~= v then assert(syntactic_digraph:contains(v), "the layout must contain all nodes of the subgraph") for _,p in ipairs(v.path) do - if type(p) == "table" then - cloud[#cloud+1] = p + v.pos - end + if type(p) == "table" then + cloud[#cloud+1] = p + v.pos + end end end end for _,e in ipairs(subgraph_collection.edges) do for _,p in ipairs(e.path) do if type(p) == "table" then - cloud[#cloud+1] = p:clone() + cloud[#cloud+1] = p:clone() end end end @@ -137,13 +137,13 @@ local function create_subgraph_node(scope, syntactic_digraph, vertex) o[#o+1] = { key = "subgraph point cloud", value = table.concat(lib.imap(cloud, tostring)) } o[#o+1] = { key = "subgraph bounding box height", value = tostring(y_max-y_min) .. "pt" } o[#o+1] = { key = "subgraph bounding box width", value = tostring(x_max-x_min) .. "pt" } - + -- And now, the "grand call": binding:createVertex(vertex.subgraph_info) - + -- Shift it were it belongs vertex.pos:shift(c_x,c_y) - + -- Remember all the subnodes for nudging and regardless -- positioning local s = {} @@ -191,22 +191,22 @@ end -- @return A laid out graph. function Sublayouts.layoutRecursively(scope, layout, fun) - + -- Step 1: Iterate over all sublayouts of the current layout: local resulting_graphs = {} local loc = Storage.new() - + -- Now, iterate over all sublayouts for i,child in ipairs(layout:childrenOfKind(InterfaceCore.sublayout_kind)) do resulting_graphs[i] = Sublayouts.layoutRecursively(scope, child, fun) loc[resulting_graphs[i]] = child end - + -- Step 2: Run the merge process: local merged_graphs = {} - + while #resulting_graphs > 0 do - + local n = #resulting_graphs -- Setup marked array: @@ -214,57 +214,57 @@ function Sublayouts.layoutRecursively(scope, layout, fun) for i=1,n do marked[i] = false end - + -- Mark first graph and copy everything from there marked[1] = true local touched = Storage.new() for _,v in ipairs(resulting_graphs[1].vertices) do v.pos = positions[v][resulting_graphs[1]] touched[v] = true - end + end -- Repeatedly find a node that is connected to a marked node: local i = 1 while i <= n do if not marked[i] then - for j=1,n do - if marked[j] then - local v = intersection(resulting_graphs[i], resulting_graphs[j]) - if v then - -- Aha, they intersect at vertex v - - -- Mark the i-th graph: - marked[i] = true - connected_some_graph = true - - -- Shift the i-th graph: - local x_offset = v.pos.x - positions[v][resulting_graphs[i]].x - local y_offset = v.pos.y - positions[v][resulting_graphs[i]].y - - for _,u in ipairs(resulting_graphs[i].vertices) do - if not touched[u] then - touched[u] = true - u.pos = positions[u][resulting_graphs[i]]:clone() - u.pos:shift(x_offset, y_offset) - - for _,a in ipairs(resulting_graphs[i]:outgoing(u)) do - for _,e in ipairs(a.syntactic_edges) do - for _,p in ipairs(e.path) do - if type(p) == "table" then - p:shift(x_offset, y_offset) - end - end - end - end - end - end - - -- Restart - i = 0 - break - end - end - end + for j=1,n do + if marked[j] then + local v = intersection(resulting_graphs[i], resulting_graphs[j]) + if v then + -- Aha, they intersect at vertex v + + -- Mark the i-th graph: + marked[i] = true + connected_some_graph = true + + -- Shift the i-th graph: + local x_offset = v.pos.x - positions[v][resulting_graphs[i]].x + local y_offset = v.pos.y - positions[v][resulting_graphs[i]].y + + for _,u in ipairs(resulting_graphs[i].vertices) do + if not touched[u] then + touched[u] = true + u.pos = positions[u][resulting_graphs[i]]:clone() + u.pos:shift(x_offset, y_offset) + + for _,a in ipairs(resulting_graphs[i]:outgoing(u)) do + for _,e in ipairs(a.syntactic_edges) do + for _,p in ipairs(e.path) do + if type(p) == "table" then + p:shift(x_offset, y_offset) + end + end + end + end + end + end + + -- Restart + i = 0 + break + end + end + end end i = i + 1 end @@ -273,19 +273,19 @@ function Sublayouts.layoutRecursively(scope, layout, fun) local merge = Digraph.new {} merge.syntactic_digraph = merge local remaining = {} - + -- Add all vertices and edges: for i=1,n do if marked[i] then - merge:add (resulting_graphs[i].vertices) - for _,a in ipairs(resulting_graphs[i].arcs) do - local ma = merge:connect(a.tail,a.head) - for _,e in ipairs(a.syntactic_edges) do - ma.syntactic_edges[#ma.syntactic_edges+1] = e - end - end - else - remaining[#remaining + 1] = resulting_graphs[i] + merge:add (resulting_graphs[i].vertices) + for _,a in ipairs(resulting_graphs[i].arcs) do + local ma = merge:connect(a.tail,a.head) + for _,e in ipairs(a.syntactic_edges) do + ma.syntactic_edges[#ma.syntactic_edges+1] = e + end + end + else + remaining[#remaining + 1] = resulting_graphs[i] end end @@ -294,37 +294,37 @@ function Sublayouts.layoutRecursively(scope, layout, fun) -- Restart with rest: merged_graphs[#merged_graphs+1] = merge - + resulting_graphs = remaining end - + -- Step 3: Run the algorithm on the layout: - - local class = layout.options.algorithm_phases.main + + local class = layout.options.algorithm_phases.main assert (type(class) == "table", "algorithm selection failed") - + local algorithm = class local uncollapsed_subgraph_nodes = lib.imap( scope.collections[InterfaceCore.subgraph_node_kind] or {}, function (c) if c.parent_layout == layout then - return c.subgraph_node + return c.subgraph_node end end) - + -- Create a new syntactic digraph: local syntactic_digraph = Digraph.new { options = layout.options } syntactic_digraph.syntactic_digraph = syntactic_digraph - + -- Copy all vertices and edges from the collection... syntactic_digraph:add (layout.vertices) for _,e in ipairs(layout.edges) do syntactic_digraph:add {e.head, e.tail} - local arc = syntactic_digraph:connect(e.tail, e.head) + local arc = syntactic_digraph:connect(e.tail, e.head) arc.syntactic_edges[#arc.syntactic_edges+1] = e end @@ -335,13 +335,13 @@ function Sublayouts.layoutRecursively(scope, layout, fun) -- Test, if all vertices of the subgraph are in one of the merged graphs. for _,g in ipairs(merged_graphs) do if special_vertex_subset(vertices, g) then - -- Ok, we can create a subgraph now - create_subgraph_node(scope, syntactic_digraph, v) - -- Make it part of the collapse! - g:add{v} - -- Do not consider again - uncollapsed_subgraph_nodes[i] = false - break + -- Ok, we can create a subgraph now + create_subgraph_node(scope, syntactic_digraph, v) + -- Make it part of the collapse! + g:add{v} + -- Do not consider again + uncollapsed_subgraph_nodes[i] = false + break end end end @@ -353,7 +353,7 @@ function Sublayouts.layoutRecursively(scope, layout, fun) local intersection = {} for _,v in ipairs(g.vertices) do if syntactic_digraph:contains(v) then - intersection[#intersection+1] = v + intersection[#intersection+1] = v end end if #intersection > 0 then @@ -361,33 +361,33 @@ function Sublayouts.layoutRecursively(scope, layout, fun) -- hull) Hmm...: local array = {} for _,v in ipairs(g.vertices) do - local min_x, min_y, max_x, max_y = v:boundingBox() - array[#array+1] = Coordinate.new(min_x + v.pos.x, min_y + v.pos.y) - array[#array+1] = Coordinate.new(max_x + v.pos.x, max_y + v.pos.y) + local min_x, min_y, max_x, max_y = v:boundingBox() + array[#array+1] = Coordinate.new(min_x + v.pos.x, min_y + v.pos.y) + array[#array+1] = Coordinate.new(max_x + v.pos.x, max_y + v.pos.y) end for _,a in ipairs(g.arcs) do - for _,e in ipairs(a.syntactic_edges) do - for _,p in ipairs(e.path) do - if type(p) == "table" then - array[#array+1] = p - end - end - end + for _,e in ipairs(a.syntactic_edges) do + for _,p in ipairs(e.path) do + if type(p) == "table" then + array[#array+1] = p + end + end + end end local x_min, y_min, x_max, y_max, c_x, c_y = Coordinate.boundingBox(array) -- Shift the graph so that it is centered on the origin: for _,v in ipairs(g.vertices) do - v.pos:unshift(c_x,c_y) + v.pos:unshift(c_x,c_y) end for _,a in ipairs(g.arcs) do - for _,e in ipairs(a.syntactic_edges) do - for _,p in ipairs(e.path) do - if type(p) == "table" then - p:unshift(c_x,c_y) - end - end - end + for _,e in ipairs(a.syntactic_edges) do + for _,p in ipairs(e.path) do + if type(p) == "table" then + p:unshift(c_x,c_y) + end + end + end end x_min = x_min - c_x @@ -398,33 +398,33 @@ function Sublayouts.layoutRecursively(scope, layout, fun) local index = loc[g].event.index local v = Vertex.new { - -- Standard stuff - shape = "none", - kind = "node", - path = Path.new { - "moveto", - x_min, y_min, - x_min, y_max, - x_max, y_max, - x_max, y_min, - "closepath" - }, - options = {}, - event = scope.events[index] + -- Standard stuff + shape = "none", + kind = "node", + path = Path.new { + "moveto", + x_min, y_min, + x_min, y_max, + x_max, y_max, + x_max, y_min, + "closepath" + }, + options = {}, + event = scope.events[index] } - + -- Update node_event scope.events[index].parameters = v - + local collapse_vertex = syntactic_digraph:collapse( - intersection, - v, - nil, - function (new_arc, arc) - for _,e in ipairs(arc.syntactic_edges) do - new_arc.syntactic_edges[#new_arc.syntactic_edges+1] = e - end - end) + intersection, + v, + nil, + function (new_arc, arc) + for _,e in ipairs(arc.syntactic_edges) do + new_arc.syntactic_edges[#new_arc.syntactic_edges+1] = e + end + end) syntactic_digraph:remove(intersection) collapsed_vertices[#collapsed_vertices+1] = collapse_vertex @@ -432,14 +432,14 @@ function Sublayouts.layoutRecursively(scope, layout, fun) end -- Sort the vertices - table.sort(syntactic_digraph.vertices, function(u,v) return u.event.index < v.event.index end) - + table.sort(syntactic_digraph.vertices, function(u,v) return u.event.index < v.event.index end) + -- Should we "hide" the subgraph nodes? local hidden_node if not algorithm.include_subgraph_nodes then local subgraph_nodes = lib.imap (syntactic_digraph.vertices, - function (v) if v.kind == "subgraph node" then return v end end) - + function (v) if v.kind == "subgraph node" then return v end end) + if #subgraph_nodes > 0 then hidden_node = Vertex.new {} syntactic_digraph:collapse(subgraph_nodes, hidden_node) @@ -457,36 +457,36 @@ function Sublayouts.layoutRecursively(scope, layout, fun) -- Ok, everything setup! Run the algorithm... fun(scope, algorithm, syntactic_digraph, layout) - + if hidden_node then syntactic_digraph:expand(hidden_node) end - + -- Now, we need to expand the collapsed vertices once more: for i=#collapsed_vertices,1,-1 do syntactic_digraph:expand( collapsed_vertices[i], function (c, v) - v.pos:shiftByCoordinate(c.pos) + v.pos:shiftByCoordinate(c.pos) end, function (a, v) - for _,e in ipairs(a.syntactic_edges) do - for _,p in ipairs(e.path) do - if type(p) == "table" then - p:shiftByCoordinate(v.pos) - end - end - end + for _,e in ipairs(a.syntactic_edges) do + for _,p in ipairs(e.path) do + if type(p) == "table" then + p:shiftByCoordinate(v.pos) + end + end + end end ) for _,a in ipairs(syntactic_digraph:outgoing(collapsed_vertices[i])) do for _,e in ipairs(a.syntactic_edges) do - for _,p in ipairs(e.path) do - if type(p) == "table" then - p:shiftByCoordinate(a.tail.pos) - p:unshiftByCoordinate(e.tail.pos) - end - end + for _,p in ipairs(e.path) do + if type(p) == "table" then + p:shiftByCoordinate(a.tail.pos) + p:unshiftByCoordinate(e.tail.pos) + end + end end end end @@ -498,16 +498,16 @@ function Sublayouts.layoutRecursively(scope, layout, fun) create_subgraph_node(scope, syntactic_digraph, uncollapsed_subgraph_nodes[i]) end end - + -- Now seems like a good time to nudge and do regardless positioning nudge(syntactic_digraph) - -- Step 5: Cleanup + -- Step 5: Cleanup -- Push the computed position into the storage: for _,v in ipairs(syntactic_digraph.vertices) do positions[v][syntactic_digraph] = v.pos:clone() end - + return syntactic_digraph end @@ -531,6 +531,6 @@ end --- Done +-- Done -return Sublayouts +return Sublayouts
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/doc.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/doc.lua index c7adfab830e..2d8317bd72d 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/doc.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/doc.lua @@ -30,7 +30,6 @@ documentation Now, when you set this key for a single node of a graph, then, by shifting the graph around, this ``wish'' can obviously always be fulfill: -% \begin{codeexample}[] \begin{tikzpicture} \draw [help lines] (0,0) grid (3,2); @@ -40,7 +39,6 @@ always be fulfill: }; \end{tikzpicture} \end{codeexample} -% \begin{codeexample}[] \begin{tikzpicture} \draw [help lines] (0,0) grid (3,2); @@ -50,7 +48,6 @@ always be fulfill: }; \end{tikzpicture} \end{codeexample} -% Since the key's name is a bit long and since the many braces and parentheses are a bit cumbersome, there is a special support for this key inside a |graph|: The standard |/tikz/at| key is redefined @@ -60,7 +57,6 @@ specify an |at| position for a node whose position it to be computed by a graph drawing algorithm.) A nice side effect of this is that you can use the |x| and |y| keys (see Section~\ref{section-graphs-xy}) to specify desired positions: -% \begin{codeexample}[] \begin{tikzpicture} \draw [help lines] (0,0) grid (3,2); @@ -70,7 +66,6 @@ Section~\ref{section-graphs-xy}) to specify desired positions: }; \end{tikzpicture} \end{codeexample} -% \begin{codeexample}[] \begin{tikzpicture} \draw [help lines] (0,0) grid (3,2); @@ -80,7 +75,7 @@ Section~\ref{section-graphs-xy}) to specify desired positions: }; \end{tikzpicture} \end{codeexample} - + A problem arises when two or more nodes have this key set, because then your ``desires'' for placement and the positions computed by the graph drawing algorithm may clash. Graph drawing algorithms are @@ -88,10 +83,10 @@ the graph drawing algorithm may clash. Graph drawing algorithms are ignore these desired positions since they will be taken care of in the so-called post-anchoring phase, see below. However, for some algorithms it makes a lot of sense to fix the positions of some -nodes and only compute the positions of the other nodes relative -to these nodes. For instance, for a |spring layout| it makes perfect -sense that some nodes are ``nailed to the canvas'' while other -nodes can ``move freely''. +nodes and only compute the positions +of the other nodes relative to these nodes. For instance, for a +|spring layout| it makes perfect sense that some nodes are +``nailed to the canvas'' while other nodes can ``move freely''. ]] example @@ -139,21 +134,19 @@ key "anchor node" summary [[ This option can be used with a graph to specify a node that -should be used for anchoring the whole graph. +should be used for anchoring the whole graph. ]] documentation [[ When this option is specified, after the layout has been computed, the whole graph will be shifted in such a way that the \meta{node name} is -either -% +either \begin{itemize} - \item at the current value of |anchor at| or - \item at the position that is specified in the form of a - |desired at| for the \meta{node name}. +\item at the current value of |anchor at| or +\item at the position that is specified in the form of a + |desired at| for the \meta{node name}. \end{itemize} -% Note how in the last example |c| is placed at |(1,1)| rather than |b| as would happen by default. ]] @@ -170,7 +163,7 @@ example [[ \begin{tikzpicture} \draw [help lines] (0,0) grid (3,2); - + \graph [layered layout, anchor node=c, edges=rounded corners] { a -- {b [x=1,y=1], c [x=1,y=1] } -- d -- a}; \end{tikzpicture} @@ -185,15 +178,15 @@ key "anchor at" summary [[ -The coordinate at which the graph should be anchored when no -explicit anchor is given for any node. The initial value is the origin. +The coordinate at which the graph should be anchored when no +explicit anchor is given for any node. The initial value is the origin. ]] example [[ \begin{tikzpicture} \draw [help lines] (0,0) grid (2,2); - + \graph [layered layout, edges=rounded corners, anchor at={(1,2)}] { a -- {b, c [anchor here] } -- d -- a}; \end{tikzpicture} @@ -223,7 +216,7 @@ example [[ \begin{tikzpicture} \draw [help lines] (0,0) grid (2,2); - + \graph [layered layout, edges=rounded corners] { a -- {b, c [anchor here] } -- d -- a}; \end{tikzpicture} diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/library.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/library.lua index df7ce68dd94..e25e0cd628e 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/library.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/control/library.lua @@ -38,29 +38,29 @@ declare { type = "boolean", summary = "Specifies, that nodes should be drawn behind the edges", - documentation = [[" - Once a graph drawing algorithm has determined positions for the nodes, - they are drawn \emph{before} the edges are drawn; after - all, it is hard to draw an edge between nodes when their positions - are not yet known. However, we typically want the nodes to be - rendered \emph{after} or rather \emph{on top} of the edges. For - this reason, the default behavior is that the nodes at their - final positions are collected in a box that is inserted into the - output stream only after the edges have been drawn -- which has - the effect that the nodes will be placed ``on top'' of the - edges. - - This behavior can be changed using this option. When the key is - invoked, nodes are placed \emph{behind} the edges. + documentation = [[" + Once a graph drawing algorithm has determined positions for the nodes, + they are drawn \emph{before} the edges are drawn; after + all, it is hard to draw an edge between nodes when their positions + are not yet known. However, we typically want the nodes to be + rendered \emph{after} or rather \emph{on top} of the edges. For + this reason, the default behaviour is that the nodes at their + final positions are collected in a box that is inserted into the + output stream only after the edges have been drawn -- which has + the effect that the nodes will be placed ``on top'' of the + edges. + + This behaviour can be changed using this option. When the key is + invoked, nodes are placed \emph{behind} the edges. "]], examples = [[" - \tikz \graph [simple necklace layout, nodes={draw,fill=white}, - nodes behind edges] - { subgraph K_n [n=7], 1 [regardless at={(0,-1)}] }; + \tikz \graph [simple necklace layout, nodes={draw,fill=white}, + nodes behind edges] + { subgraph K_n [n=7], 1 [regardless at={(0,-1)}] }; "]] -} - +} + --- declare { @@ -69,13 +69,13 @@ declare { { key = "nodes behind edges", value = "false" }, }, - summary = [[" - This is the default placement of edges: Behind the nodes. + summary = [[" + This is the default placemenet of edges: Behind the nodes. "]], examples = [[" - \tikz \graph [simple necklace layout, nodes={draw,fill=white}, - edges behind nodes] - { subgraph K_n [n=7], 1 [regardless at={(0,-1)}] }; + \tikz \graph [simple necklace layout, nodes={draw,fill=white}, + edges behind nodes] + { subgraph K_n [n=7], 1 [regardless at={(0,-1)}] }; "]] } @@ -85,14 +85,14 @@ declare { type = "number", initial = "42", - summary = [[" - To ensure that the same is always shown in the same way when the - same algorithm is applied, the random is seed is reset on each call - of the graph drawing engine. To (possibly) get different results on - different runs, change this value. + summary = [[" + To ensure that the same is always shown in the same way when the + same algorithm is applied, the random is seed is reset on each call + of the graph drawing engine. To (possibly) get different results on + different runs, change this value. "]] } - + --- declare { @@ -111,42 +111,45 @@ declare { type = "number", initial = 1, - summary = [[" - Sets the ``weight'' of an edge or a node. For many algorithms, this - number tells the algorithm how ``important'' the edge or node is. - For instance, in a |layered layout|, an edge with a large |weight| - will be as short as possible. + summary = [[" + Sets the ``weight'' of an edge or a node. For many algorithms, this + number tells the algorithm how ``important'' the edge or node is. + For instance, in a |layered layout|, an edge with a large |weight| + will be as short as possible. "]], - examples = {[[" - \tikz \graph [layered layout] { - a -- {b,c,d} -- e -- a; - }; - "]],[[" - \tikz \graph [layered layout] { - a -- {b,c,d} -- e --[weight=3] a; - }; - "]] + examples = { + [[" + \tikz \graph [layered layout] { + a -- {b,c,d} -- e -- a; + }; + "]], + [[" + \tikz \graph [layered layout] { + a -- {b,c,d} -- e --[weight=3] a; + }; + "]] } } - - + + --- declare { key = "length", type = "length", initial = 1, - summary = [[" - Sets the ``length'' of an edge. Algorithms may take this value - into account when drawing a graph. - "]], - examples = {[[" - \tikz \graph [phylogenetic tree layout] { - a --[length=2] b --[length=1] {c,d}; - a --[length=3] e - }; + summary = [[" + Sets the ``length'' of an edge. Algorithms may take this value + into account when drawing a graph. "]], + examples = { + [[" + \tikz \graph [phylogenetic tree layout] { + a --[length=2] b --[length=1] {c,d}; + a --[length=3] e + }; + "]], } } @@ -158,24 +161,24 @@ declare { type = "number", initial = "0", - summary = [[" - The radius of a circular object used in graph drawing. + summary = [[" + The radius of a circular object used in graph drawing. "]] } - + --- - + declare { key = "no layout", algorithm = { run = function (self) - for _,v in ipairs(self.digraph.vertices) do - if v.options['desired at'] then - v.pos.x = v.options['desired at'].x - v.pos.y = v.options['desired at'].y - end - end + for _,v in ipairs(self.digraph.vertices) do + if v.options['desired at'] then + v.pos.x = v.options['desired at'].x + v.pos.y = v.options['desired at'].y + end + end end }, summary = "This layout does nothing.", } diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Cluster.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Cluster.lua index d7baed45daa..0b8d9e324fb 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Cluster.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Cluster.lua @@ -12,7 +12,7 @@ ---- The Cluster class defines a model of a cluster inside a graph. +--- The Cluser class defines a model of a cluster inside a graph. -- -- diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Edge.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Edge.lua index 7355597955e..7d6369d2bc9 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Edge.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Edge.lua @@ -43,7 +43,7 @@ Edge.NONE = "-!-" -- |nodes|: TODO \par -- |edge_nodes|: TODO \par -- |options|: TODO \par --- |tikz_options|: TODO \par +-- |tikz_options|: TODO \par -- |direction|: TODO \par -- |bend_points|: TODO \par -- |bend_nodes|: TODO \par @@ -90,14 +90,14 @@ end --- Returns the value of the edge option \meta{name}. -- -- @param name Name of the option. --- @param graph If this optional argument is given, --- in case the option is not set as a node parameter, +-- @param graph If this optional argument is given, +-- in case the option is not set as a node parameter, -- we try to look it up as a graph parameter. -- -- @return The value of the edge option \meta{name} or |nil|. -- function Edge:getOption(name, graph) - return lib.lookup_option(name, self, graph) + return lib.lookup_option(name, self, graph) end @@ -134,7 +134,7 @@ end --- Returns all nodes of the edge. -- --- Instead of calling |edge:getNodes()| the nodes can alternatively be +-- Instead of calling |edge:getNodes()| the nodes can alternatively be -- accessed directly with |edge.nodes|. -- -- @return All edges of the node. @@ -168,11 +168,11 @@ end ---- Gets first neighbor of the node (disregarding hyperedges). +--- Gets first neighbour of the node (disregarding hyperedges). -- --- @param node The node which first neighbor should be returned. +-- @param node The node which first neighbour should be returned. -- --- @return The first neighbor of the node. +-- @return The first neighbour of the node. -- function Edge:getNeighbour(node) if node == self.nodes[1] then @@ -199,7 +199,7 @@ function Edge:getHead() -- of <- edges is the first node local head_index = (self.direction == Edge.LEFT) and 1 or #self.nodes - -- if the edge should be assumed reversed, we simply switch head and + -- if the edge should be assumed reversed, we simply switch head and -- tail positions if self.reversed then head_index = (head_index == 1) and #self.nodes or 1 @@ -230,9 +230,9 @@ end -- -- This method only works for edges with two adjacent nodes. -- --- Edges may be reversed internally, so their head and tail might be switched. --- Whether or not this internal reversal is handled by this method --- can be specified with the optional second \meta{ignore\_reversed} parameter +-- Edges may be reversed internally, so their head and tail might be switched. +-- Whether or not this internal reversal is handled by this method +-- can be specified with the optional second \meta{ignore\_reversed} parameter -- which is |false| by default. -- -- @param node The node to check. @@ -246,7 +246,7 @@ function Edge:isHead(node) -- of <- edges is the first node local head_index = (self.direction == Edge.LEFT) and 1 or #self.nodes - -- if the edge should be assumed reversed, we simply switch head and + -- if the edge should be assumed reversed, we simply switch head and -- tail positions if self.reversed then head_index = (head_index == 1) and #self.nodes or 1 @@ -267,8 +267,8 @@ end -- This method only works for edges with two adjacent nodes. -- -- Edges may be reversed internally, so their head and tail might be switched. --- Whether or not this internal reversal is handled by this method --- can be specified with the optional second \meta{ignore\_reversed} parameter +-- Whether or not this internal reversal is handled by this method +-- can be specified with the optional second \meta{ignore\_reversed} parameter -- which is |false| by default. -- -- @param node The node to check. @@ -279,7 +279,7 @@ end -- function Edge:isTail(node, ignore_reversed) local result = false - + -- by default, the tail of -> edges is the first node and the tail -- of <- edges is the last node local tail_index = (self.direction == Edge.LEFT) and #self.nodes or 1 @@ -338,7 +338,7 @@ function Edge:__tostring() result = result .. table.concat(node_strings, ', ') end --return result .. ")" - + -- Note: the following lines generate a shorter string representation -- of the edge that is more readable and can be used for debugging. -- So please don't remove this: diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Graph.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Graph.lua index 161b89fd15d..23712278990 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Graph.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Graph.lua @@ -127,9 +127,9 @@ function Graph:addNode(node) if not self:findNode(node.name) then -- Does the node have an index, yet? if not node.index then - node.index = #self.nodes + 1 + node.index = #self.nodes + 1 end - + table.insert(self.nodes, node) end end @@ -143,8 +143,8 @@ end -- @return The removed node or |nil| if it was not found in the graph. -- function Graph:removeNode(node) - local _, index = lib.find(self.nodes, function (other) - return other.name == node.name + local _, index = lib.find(self.nodes, function (other) + return other.name == node.name end) if index then table.remove(self.nodes, index) @@ -170,7 +170,7 @@ end --- Looks up the first node for which the function \meta{test} returns |true|. -- --- @param test A function that takes one parameter (a |Node|) and returns +-- @param test A function that takes one parameter (a |Node|) and returns -- |true| or |false|. -- -- @return The first node for which \meta{test} returns |true|. @@ -183,7 +183,7 @@ end --- Like removeNode, but also deletes all adjacent edges of the removed node. -- --- This function also removes the deleted adjacent edges from all neighbors +-- This function also removes the deleted adjacent edges from all neighbours -- of the removed node. -- -- @param node The node to be deleted together with its adjacent edges. @@ -293,7 +293,7 @@ end ---- Creates and adds a new edge to the graph. +--- Creates and adds a new edge to the graph. -- -- @param first_node The first node of the new edge. -- @param second_node The second node of the new edge. @@ -305,7 +305,7 @@ end -- \item |Edge.BOTH| and -- \item |Edge.NONE| (for invisible edges). -- \end{itemize} --- @param edge_nodes A string of \tikzname\ edge nodes that needs to be passed +-- @param edge_nodes A string of \tikzname\ edge nodes that needs to be passed -- back to the \TeX layer unmodified. -- @param options The options of the new edge. -- @param tikz_options A table of \tikzname\ options to be used by graph drawing @@ -315,9 +315,9 @@ end -- function Graph:createEdge(first_node, second_node, direction, edge_nodes, options, tikz_options) local edge = Edge.new{ - direction = direction, + direction = direction, edge_nodes = edge_nodes, - options = options, + options = options, tikz_options = tikz_options } edge:addNode(first_node) @@ -393,4 +393,4 @@ end -- Done -return Graph +return Graph
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Iterators.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Iterators.lua index 903291a892d..9e41e1124ee 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Iterators.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Iterators.lua @@ -39,40 +39,40 @@ local lib = require("pgf.gd.lib") -- @return An iterator for traversing \meta{graph} in a topological order. -- function Iterators.topologicallySorted(dag) - -- track visited edges + -- track visited edges local deleted_edges = {} -- collect all sources (nodes with no incoming edges) of the dag local sources = lib.imap(dag.nodes, function (node) if node:getInDegree() == 0 then return node end end) -- return the iterator function - return function () + return function () while #sources > 0 do -- fetch the next sink from the queue local source = table.remove(sources, 1) -- get its outgoing edges local out_edges = source:getOutgoingEdges() - + -- iterate over all outgoing edges we haven't visited yet for _,edge in ipairs(out_edges) do - if not deleted_edges[edge] then - -- mark the edge as visited - deleted_edges[edge] = true - - -- get the node at the other end of the edge - local neighbour = edge:getNeighbour(source) - - -- get a list of all incoming edges of the neighbor that have - -- not been visited yet - local in_edges = lib.imap(neighbour:getIncomingEdges(), - function (edge) if not deleted_edges[edge] then return edge end end) - - -- if there are no such edges then we have a new source - if #in_edges == 0 then - sources[#sources+1] = neighbour - end - end + if not deleted_edges[edge] then + -- mark the edge as visited + deleted_edges[edge] = true + + -- get the node at the other end of the edge + local neighbour = edge:getNeighbour(source) + + -- get a list of all incoming edges of the neighbour that have + -- not been visited yet + local in_edges = lib.imap(neighbour:getIncomingEdges(), + function (edge) if not deleted_edges[edge] then return edge end end) + + -- if there are no such edges then we have a new source + if #in_edges == 0 then + sources[#sources+1] = neighbour + end + end end -- return the current source @@ -88,4 +88,4 @@ end -- Done -return Iterators +return Iterators
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Node.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Node.lua index 379a65fafd8..84d3d3ee11f 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Node.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Node.lua @@ -48,12 +48,12 @@ function Node.new(values) local new = { class = Node, name = nil, - tex = { + tex = { -- texNode = nil, -- maxX = nil, -- minX = nil, -- maxY = nil, - -- minY = nil + -- minY = nil }, edges = {}, -- pos = nil, @@ -69,8 +69,8 @@ function Node.new(values) new [k] = v end end - if not new.pos then - new.pos = Vector.new(2) + if not new.pos then + new.pos = Vector.new(2) end return new end @@ -91,8 +91,8 @@ end --- Returns the value of the node option \meta{name}. -- -- @param name Name of the node option. --- @param graph If this optional argument is given, --- in case the option is not set as a node parameter, +-- @param graph If this optional argument is given, +-- in case the option is not set as a node parameter, -- we try to look it up as a graph parameter. -- -- @return The value of the node option \meta{name} or |nil|. @@ -113,7 +113,7 @@ end ---- Computes the height of the node. +--- Computes the heigth of the node. -- -- @return Height of the node. -- @@ -155,7 +155,7 @@ end --- Returns all edges of the node. -- --- Instead of calling |node:getEdges()| the edges can alternatively be +-- Instead of calling |node:getEdges()| the edges can alternatively be -- accessed directly with |node.edges|. -- -- @return All edges of the node. @@ -168,7 +168,7 @@ end --- Returns the incoming edges of the node. Undefined result for hyperedges. -- --- @param ignore_reversed Optional parameter to consider reversed edges not +-- @param ignore_reversed Optional parameter to consider reversed edges not -- reversed for this method call. Defaults to |false|. -- -- @return Incoming edges of the node. This includes undirected edges @@ -176,16 +176,16 @@ end -- function Node:getIncomingEdges(ignore_reversed) return lib.imap(self.edges, - function (edge) - if edge:isHead(self, ignore_reversed) then return edge end - end) + function (edge) + if edge:isHead(self, ignore_reversed) then return edge end + end) end --- Returns the outgoing edges of the node. Undefined result for hyperedges. -- --- @param ignore_reversed Optional parameter to consider reversed edges not +-- @param ignore_reversed Optional parameter to consider reversed edges not -- reversed for this method call. Defaults to |false|. -- -- @return Outgoing edges of the node. This includes undirected edges @@ -193,9 +193,9 @@ end -- function Node:getOutgoingEdges(ignore_reversed) return lib.imap(self.edges, - function (edge) - if edge:isTail(self, ignore_reversed) then return edge end - end) + function (edge) + if edge:isTail(self, ignore_reversed) then return edge end + end) end @@ -204,7 +204,7 @@ end -- -- @see Node:getIncomingEdges(reversed) -- --- @param ignore_reversed Optional parameter to consider reversed edges not +-- @param ignore_reversed Optional parameter to consider reversed edges not -- reversed for this method call. Defaults to |false|. -- -- @return The number of incoming edges of the node. @@ -219,7 +219,7 @@ end -- -- @see Node:getOutgoingEdges() -- --- @param ignore_reversed Optional parameter to consider reversed edges not +-- @param ignore_reversed Optional parameter to consider reversed edges not -- reversed for this method call. Defaults to |false|. -- -- @return The number of outgoing edges of the node. @@ -230,7 +230,7 @@ end ---- Creates a shallow copy of the node. +--- Creates a shallow copy of the node. -- -- Most notably, the edges adjacent are not preserved in the copy. -- @@ -262,7 +262,7 @@ end -- -- @ignore This should not appear in the documentation. -- --- @return String representation of the node. +-- @return String represenation of the node. -- function Node:__tostring() local tmp = Node.__tostring @@ -277,4 +277,4 @@ end -- Done -return Node +return Node
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Vector.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Vector.lua index 8af7378154e..ef8500b5aeb 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Vector.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/deprecated/Vector.lua @@ -28,7 +28,7 @@ lib.Vector = Vector -- Class setup Vector.__index = function (t, k) - if k == "x" then + if k == "x" then return rawget(t,1) elseif k == "y" then return rawget(t,2) @@ -37,8 +37,8 @@ Vector.__index = end end Vector.__newindex = - function (t, k, v) - if k == "x" then + function (t, k, v) + if k == "x" then rawset(t,1,v) elseif k == "y" then rawset(t,2,v) @@ -52,9 +52,9 @@ Vector.__newindex = --- Creates a new vector with \meta{n} values using an optional \meta{fill\_function}. -- -- @param n The number of elements of the vector. (If omitted, then 2.) --- @param fill_function Optional function that takes a number between 1 and \meta{n} +-- @param fill_function Optional function that takes a number between 1 and \meta{n} -- and is expected to return a value for the corresponding element --- of the vector. If omitted, all elements of the vector will +-- of the vector. If omitted, all elements of the vector will -- be initialized with 0. -- -- @return A newly-allocated vector with \meta{n} elements. @@ -65,7 +65,7 @@ function Vector.new(n, fill_function) setmetatable(vector, Vector) local n = n or 2 - + if type(n) == 'table' then for k,v in pairs(n) do vector[k] = v @@ -74,7 +74,7 @@ function Vector.new(n, fill_function) -- fill vector elements with values if not fill_function then for i = 1,n do - rawset(vector,i,0) + rawset(vector,i,0) end else for i = 1,n do @@ -91,7 +91,7 @@ end --- Creates a copy of the vector that holds the same elements as the original. -- -- @return A newly-allocated copy of the vector holding exactly the same elements. --- +-- function Vector:copy() return Vector.new(#self, function (n) return self[n] end) end @@ -100,7 +100,7 @@ end --- Performs a vector addition and returns the result in a new vector. -- --- @param other The vector to add. +-- @param other The vector to add. -- -- @return A new vector with the result of the addition. -- @@ -114,7 +114,7 @@ end --- Subtracts two vectors and returns the result in a new vector. -- --- @param other Vector to subtract. +-- @param other Vector to subtract. -- -- @return A new vector with the result of the subtraction. -- @@ -196,7 +196,7 @@ end --- Updates the values of the vector in-place. -- -- @param update_function A function that is called for each element of the --- vector. The elements are replaced by the values +-- vector. The elements are replaced by the values -- returned from this function. -- function Vector:update(update_function) @@ -253,4 +253,4 @@ end -- Done -return Vector +return Vector
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc.lua index 78b68bbcb17..428091a9ae4 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc.lua @@ -17,17 +17,16 @@ -- when the documentation is kept in a separate file. -- -- Using the doc facility is easy: --- % +-- -- \begin{enumerate} --- \item In the |declare| statement of the key, you do not provide --- fields like |documentation| or |summary|. Rather, you provide the --- field |documentation_in|, which gets the name of a Lua file the --- will be read whenever one of the fields |documentation|, |summary|, --- or |examples| is requested for the key. --- \item When the key is requested, |require| will be applied to the --- filename given in the |documentation_in| field. --- \item In this file, you start with the following code: --- % +-- \item In the |declare| statement of the key, you do not provide +-- fields like |documentation| or |summary|. Rather, you provide the +-- field |documentation_in|, which gets the name of a Lua file the +-- will be read whenever one of the fields |documentation|, |summary|, +-- or |examples| is requested for the key. +-- \item When the key is requested, |require| will be applied to the +-- filename given in the |documentation_in| field. +-- \item In this file, you start with the following code: --\begin{codeexample}[code only] --local doc = require 'pgf.gd.doc' --local key = doc.key @@ -35,12 +34,10 @@ --local summary = doc.summary --local example = doc.example --\end{codeexample} --- % --- This will setup nice shortcuts for the commands you are going to --- use in your file. --- \item Next, for each to-be-lazily-documented key, add a block to --- the file like the following: --- % +-- This will setup nice shortcuts for the commands you are going to +-- use in your file. +-- \item Next, for each to-be-lazily-documented key, add a block to +-- the file like the following: --\begin{codeexample}[code only] -- --- -- key "my radius" @@ -53,18 +50,19 @@ -- example "\tikz \graph [foo layout, my radius=3] { c--d };" --\end{codeexample} -- --- Note that |[[| and |]]| are used in Lua for raw multi-line strings. +-- Note that |[[| and |]]| are used in Lua for raw multi-line +-- strings. -- --- The effect of the above code will be that for the key |my radius| --- the different field like |summary| or |documentation| get --- updated. The |key| function simple ``selects'' a key and subsequent --- commands like |summary| will update this key until a different key --- is selected through another use of |key|. +-- The effect of the above code will be that for the key |my radius| +-- the different field like |summary| or |documentation| get +-- updated. The |key| function simple ``selects'' a key and subsequent +-- commands like |summary| will update this key until a different key +-- is selected through another use of |key|. -- \end{enumerate} local doc = {} -local current_key +local current_key -- Namespace @@ -109,7 +107,7 @@ end --- --- Adds an example to the |examples| field of the last key selected +-- Adds an example to the |examples| field of the last key selected -- through the |key| command. -- -- @param string An additional example string. diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased.lua index 552dd00dc8b..37878cd20f4 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased.lua @@ -14,6 +14,6 @@ --- -- @section subsection {Force-Based Algorithms} -- --- +-- local _
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/FMMMLayout.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/FMMMLayout.lua index b7bab378191..0d987f7c5b6 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/FMMMLayout.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/FMMMLayout.lua @@ -20,7 +20,7 @@ local example = require 'pgf.gd.doc'.example key "FMMMLayout" summary "The fast multipole multilevel layout algorithm." -documentation +documentation [[ |FMMMLayout| implements a force-directed graph drawing method suited also for very large graphs. It is based on a @@ -29,12 +29,12 @@ approximating the repulsive forces in the system by rapidly evaluating potential fields. The implementation is based on the following publication: -% + \begin{itemize} - \item Stefan Hachul, Michael J\"unger: Drawing Large Graphs with - a Potential-Field-Based Multilevel Algorithm. \emph{12th - International Symposium on Graph Drawing 1998 (GD '04)}, - New York, LNCS 3383, pp. 285--295, 2004. +\item Stefan Hachul, Michael J\"unger: Drawing Large Graphs with + a Potential-Field-Based Multilevel Algorithm. \emph{12th + International Symposium on Graph Drawing 1998 (GD '04)}, New York, LNCS 3383, + pp. 285--295, 2004. \end{itemize} ]] @@ -44,7 +44,7 @@ example ]] -example +example [[ \tikz [nodes={text height=.7em, text depth=.2em, draw=black!20, thick, fill=white, font=\footnotesize}, @@ -65,7 +65,7 @@ example { "USG 2.0" -> "USG 3.0", "PWB 2.0", "Unix/TS 1.0" } -> "Unix/TS 3.0"; { "Unix/TS++", "CB Unix 3", "Unix/TS 3.0" } -> "TS 4.0" -> "System V.0" -> "System V.2" -> "System V.3"; - }; + }; ]] -------------------------------------------------------------------------------- @@ -74,7 +74,7 @@ example -------------------------------------------------------------------------------- key "FMMMLayout.randSeed" summary "Sets the random seed for the |FMMMLayout|." -documentation +documentation [[ By changing this number, you can vary the appearance of the generated graph drawing. This key is an alias for |random seed|, which in turn @@ -117,7 +117,7 @@ example [[ \tikz { \graph [FMMMLayout, node sep=5mm] { subgraph C_n[n=6]; }; - + \draw [red, ultra thick, |-|] (1.south) -- ++(down:5mm); } ]] diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/FastMultipoleEmbedder.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/FastMultipoleEmbedder.lua index 453078b1306..4b676aff121 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/FastMultipoleEmbedder.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/FastMultipoleEmbedder.lua @@ -18,27 +18,27 @@ local example = require 'pgf.gd.doc'.example -------------------------------------------------------------------------------- key "FastMultipoleEmbedder" -summary "Implementation of a fast multipole embedder by Martin Gronemann." +summary "Implementation of a fast multipole embedder by Martin Gronemann." -------------------------------------------------------------------------------- - + -------------------------------------------------------------------------------- key "FastMultipoleEmbedder.numIterations" summary "sets the maximum number of iterations" -------------------------------------------------------------------------------- - + -------------------------------------------------------------------------------- key "FastMultipoleEmbedder.multipolePrec" summary "sets the number of coefficients for the expansions. default = 4" -------------------------------------------------------------------------------- - + -------------------------------------------------------------------------------- key "FastMultipoleEmbedder.defaultEdgeLength" summary "" -------------------------------------------------------------------------------- - + -------------------------------------------------------------------------------- key "FastMultipoleEmbedder.defaultNodeSize" @@ -48,4 +48,4 @@ summary "" -- Local Variables: -- mode:latex --- End: +-- End: diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/GEMLayout.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/GEMLayout.lua index d0b94c2bb7a..674bc996f14 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/GEMLayout.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/GEMLayout.lua @@ -18,79 +18,79 @@ local example = require 'pgf.gd.doc'.example -------------------------------------------------------------------------------- key "GEMLayout" -summary "The energy-based GEM layout algorithm." - +summary "The energy-based GEM layout algorithm." + documentation [[ - The implementation used in |GEMLayout| is based on the following publication: - % - \begin{itemize} - \item Arne Frick, Andreas Ludwig, Heiko Mehldau: \emph{A Fast Adaptive Layout - Algorithm for Undirected Graphs.} Proc. Graph Drawing 1994, - LNCS 894, pp. 388-403, 1995. - \end{itemize} +The implementation used in |GEMLayout| is based on the following publication: +\begin{itemize} +\item Arne Frick, Andreas Ludwig, Heiko Mehldau: \emph{A Fast Adaptive Layout + Algorithm for Undirected Graphs.} Proc. Graph Drawing 1994, + LNCS 894, pp. 388-403, 1995. +\end{itemize} + ]] -------------------------------------------------------------------------------- - + -------------------------------------------------------------------------------- key "GEMLayout.numberOfRounds" summary "Sets the maximal number of round per node." -------------------------------------------------------------------------------- - + -------------------------------------------------------------------------------- key "GEMLayout.minimalTemperature" summary "Sets the minimal temperature." -------------------------------------------------------------------------------- - + -------------------------------------------------------------------------------- key "GEMLayout.initialTemperature" summary "Sets the initial temperature; must be $\\ge$ |minimalTemperature|." -------------------------------------------------------------------------------- - + -------------------------------------------------------------------------------- key "GEMLayout.gravitationalConstant" summary "Sets the gravitational constant; must be $\\ge 0$." -------------------------------------------------------------------------------- - + -------------------------------------------------------------------------------- key "GEMLayout.desiredLength" summary "Sets the desired edge length; must be $\\ge 0$." -------------------------------------------------------------------------------- - + -------------------------------------------------------------------------------- key "GEMLayout.maximalDisturbance" summary "Sets the maximal disturbance; must be $\\ge 0$." -------------------------------------------------------------------------------- - + -------------------------------------------------------------------------------- key "GEMLayout.rotationAngle" summary "Sets the opening angle for rotations ($0 \\le x \\le \\pi / 2$)." -------------------------------------------------------------------------------- - + -------------------------------------------------------------------------------- key "GEMLayout.oscillationAngle" summary "Sets the opening angle for oscillations ($0 \\le x \\le \\pi / 2$)." -------------------------------------------------------------------------------- - + -------------------------------------------------------------------------------- key "GEMLayout.rotationSensitivity" summary "Sets the rotation sensitivity ($0 \\le x \\le 1$)." -------------------------------------------------------------------------------- - + -------------------------------------------------------------------------------- key "GEMLayout.oscillationSensitivity" summary "Sets the oscillation sensitivity ($0 \\le x \\le 1$)." -------------------------------------------------------------------------------- - + -------------------------------------------------------------------------------- key "GEMLayout.attractionFormula" @@ -100,4 +100,4 @@ summary "sets the formula for attraction (1 = Fruchterman / Reingold, 2 = -- Local Variables: -- mode:latex --- End: +-- End: diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/MultilevelLayout.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/MultilevelLayout.lua index 6210c939412..4dc8d3b3fc7 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/MultilevelLayout.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/MultilevelLayout.lua @@ -18,7 +18,7 @@ local example = require 'pgf.gd.doc'.example -------------------------------------------------------------------------------- key "MultilevelLayout" -summary "A wrapper for the multilevel layout computation using the modular multi-level mixer." +summary "A wrapper for the multilevel layout computation using the modular multi-level mixer." example [[ \tikz \graph [MultilevelLayout] { @@ -30,4 +30,4 @@ example [[ -- Local Variables: -- mode:latex --- End: +-- End: diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/SpringEmbedderFR.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/SpringEmbedderFR.lua index ae3cf9c8ef8..b71d6629c13 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/SpringEmbedderFR.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/SpringEmbedderFR.lua @@ -18,29 +18,30 @@ local example = require 'pgf.gd.doc'.example -------------------------------------------------------------------------------- key "SpringEmbedderFR" -summary "The spring-embedder layout algorithm by Fruchterman and Reingold." - +summary "The spring-embedder layout algorithm by Fruchterman and Reingold." + documentation [[ - The implementation used in SpringEmbedderFR is based on the following - publication: +The implementation used in SpringEmbedderFR is based on the following +publication: + +Thomas M. J. Fruchterman, Edward M. Reingold: \emph{Graph Drawing by Force-directed +Placement}. Software - Practice and Experience 21(11), pp. 1129-1164, 1991. - Thomas M. J. Fruchterman, Edward M. Reingold: \emph{Graph Drawing by Force-directed - Placement}. Software - Practice and Experience 21(11), pp. 1129--1164, 1991. ]] -------------------------------------------------------------------------------- - + -------------------------------------------------------------------------------- key "SpringEmbedderFR.iterations" summary "Sets the number of iterations." -------------------------------------------------------------------------------- - + -------------------------------------------------------------------------------- key "SpringEmbedderFR.noise" summary "Sets the parameter noise." -------------------------------------------------------------------------------- - + -------------------------------------------------------------------------------- key "SpringEmbedderFR.scaleFunctionFactor" @@ -50,4 +51,4 @@ summary "Sets the scale function factor." -- Local Variables: -- mode:latex --- End: +-- End: diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/SpringEmbedderFRExact.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/SpringEmbedderFRExact.lua index 6286e9f3954..a79d94f7e2a 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/SpringEmbedderFRExact.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/SpringEmbedderFRExact.lua @@ -18,33 +18,33 @@ local example = require 'pgf.gd.doc'.example -------------------------------------------------------------------------------- key "SpringEmbedderFRExact" -summary "Declaration of Spring-Embedder (Fruchterman,Reingold) algorithm with exact force computations." +summary "Declaration of Spring-Embedder (Fruchterman,Reingold) algorithm with exact force computations." -------------------------------------------------------------------------------- - + -------------------------------------------------------------------------------- key "SpringEmbedderFRExact.iterations" summary "Sets the number of iterations." -------------------------------------------------------------------------------- - + -------------------------------------------------------------------------------- key "SpringEmbedderFRExact.noise" summary "Sets the parameter noise." -------------------------------------------------------------------------------- - + -------------------------------------------------------------------------------- key "SpringEmbedderFRExact.coolingFunction" summary "Sets the parameter coolingFunction to |factor| or to |logarithmic|." -------------------------------------------------------------------------------- - + -------------------------------------------------------------------------------- key "SpringEmbedderFRExact.idealEdgeLength" summary "Sets the ideal edge length to a length." -------------------------------------------------------------------------------- - + -------------------------------------------------------------------------------- key "SpringEmbedderFRExact.convTolerance" @@ -54,4 +54,4 @@ summary "" -- Local Variables: -- mode:latex --- End: +-- End: diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/SpringEmbedderKK.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/SpringEmbedderKK.lua index a4fd46aa775..0d130b19235 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/SpringEmbedderKK.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/SpringEmbedderKK.lua @@ -18,38 +18,40 @@ local example = require 'pgf.gd.doc'.example -------------------------------------------------------------------------------- key "SpringEmbedderKK" -summary "The spring embedder of Kamada and Kawai" - +summary "The spring embedder of Kamada and Kawai" + documentation [[ - The implementation used in |SpringEmbedderKK| is based on - the following publication: - - Tomihisa Kamada, Satoru Kawai: \emph{An Algorithm for Drawing - General Undirected Graphs.} Information Processing Letters 31, pp. 7--15, 1989. - - There are some parameters that can be tuned to optimize the - algorithm's behavior regarding runtime and layout quality. - First of all note that the algorithm uses all pairs shortest path - to compute the graph theoretic distance. This can be done either - with BFS (ignoring node sizes) in quadratic time or by using - e.g. Floyd's algorithm in cubic time with given edge lengths - that may reflect the node sizes. Also |m_computeMaxIt| decides - if the computation is stopped after a fixed maximum number of - iterations. The desirable edge length can either be set or computed - from the graph and the given layout. + The implementation used in |SpringEmbedderKK| is based on + the following publication: + + Tomihisa Kamada, Satoru Kawai: \emph{An Algorithm for Drawing + General Undirected Graphs.} Information Processing Letters 31, pp. 7--15, 1989. + + There are some parameters that can be tuned to optimize the + algorithm's behavior regarding runtime and layout quality. + First of all note that the algorithm uses all pairs shortest path + to compute the graph theoretic distance. This can be done either + with BFS (ignoring node sizes) in quadratic time or by using + e.g. Floyd's algorithm in cubic time with given edge lengths + that may reflect the node sizes. Also |m_computeMaxIt| decides + if the computation is stopped after a fixed maximum number of + iterations. The desirable edge length can either be set or computed + from the graph and the given layout. + ]] -------------------------------------------------------------------------------- - + -------------------------------------------------------------------------------- key "SpringEmbedderKK.stopTolerance" summary "Sets the value for the stop tolerance." -documentation [[ - Below this value, the system is regarded stable (balanced) and the - optimization stopped. +documentation +[[ +Below this value, the system is regarded stable (balanced) and the +optimization stopped. ]] -------------------------------------------------------------------------------- - + -------------------------------------------------------------------------------- key "SpringEmbedderKK.desLength" @@ -59,4 +61,4 @@ summary "Sets desirable edge length directly" -- Local Variables: -- mode:latex --- End: +-- End: diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/BarycenterPlacer.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/BarycenterPlacer.lua index e658a896bdc..55ac157e302 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/BarycenterPlacer.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/BarycenterPlacer.lua @@ -18,9 +18,9 @@ local example = require 'pgf.gd.doc'.example -------------------------------------------------------------------------------- key "BarycenterPlacer" -summary "?" +summary "?" -------------------------------------------------------------------------------- - + -------------------------------------------------------------------------------- key "BarycenterPlacer.weightedPositionPriority" @@ -30,4 +30,4 @@ summary "" -- Local Variables: -- mode:latex --- End: +-- End: diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/CirclePlacer.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/CirclePlacer.lua index e6f06add57d..1ef3e4914cb 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/CirclePlacer.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/CirclePlacer.lua @@ -18,21 +18,21 @@ local example = require 'pgf.gd.doc'.example -------------------------------------------------------------------------------- key "CirclePlacer" -summary "?" +summary "?" -------------------------------------------------------------------------------- - + -------------------------------------------------------------------------------- key "CirclePlacer.circleSize" summary "" -------------------------------------------------------------------------------- - + -------------------------------------------------------------------------------- key "CirclePlacer.radiusFixed" summary "" -------------------------------------------------------------------------------- - + -------------------------------------------------------------------------------- key "CirclePlacer.nodeSelection" @@ -42,4 +42,4 @@ summary "" -- Local Variables: -- mode:latex --- End: +-- End: diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/EdgeCoverMerger.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/EdgeCoverMerger.lua index e8723272ee2..82af7b56366 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/EdgeCoverMerger.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/EdgeCoverMerger.lua @@ -18,9 +18,9 @@ local example = require 'pgf.gd.doc'.example -------------------------------------------------------------------------------- key "EdgeCoverMerger" -summary "?" +summary "?" -------------------------------------------------------------------------------- - + -------------------------------------------------------------------------------- key "EdgeCoverMerger.factor" @@ -30,4 +30,4 @@ summary "" -- Local Variables: -- mode:latex --- End: +-- End: diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/IndependentSetMerger.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/IndependentSetMerger.lua index 81e2f37db0e..e65a9f41fe6 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/IndependentSetMerger.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/IndependentSetMerger.lua @@ -18,9 +18,9 @@ local example = require 'pgf.gd.doc'.example -------------------------------------------------------------------------------- key "IndependentSetMerger" -summary "?" +summary "?" -------------------------------------------------------------------------------- - + -------------------------------------------------------------------------------- key "IndependentSetMerger.searchDepthBase" @@ -30,4 +30,4 @@ summary "" -- Local Variables: -- mode:latex --- End: +-- End: diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/LocalBiconnectedMerger.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/LocalBiconnectedMerger.lua index 7fbca25e816..7e5e261f55f 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/LocalBiconnectedMerger.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/LocalBiconnectedMerger.lua @@ -18,9 +18,9 @@ local example = require 'pgf.gd.doc'.example -------------------------------------------------------------------------------- key "LocalBiconnectedMerger" -summary "?" +summary "?" -------------------------------------------------------------------------------- - + -------------------------------------------------------------------------------- key "LocalBiconnectedMerger.factor" @@ -30,4 +30,4 @@ summary "" -- Local Variables: -- mode:latex --- End: +-- End: diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/MatchingMerger.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/MatchingMerger.lua index e966b490563..e7f8144e3bb 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/MatchingMerger.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/MatchingMerger.lua @@ -18,9 +18,9 @@ local example = require 'pgf.gd.doc'.example -------------------------------------------------------------------------------- key "MatchingMerger" -summary "?" +summary "?" -------------------------------------------------------------------------------- - + -------------------------------------------------------------------------------- key "MatchingMerger.selectByNodeMass" @@ -30,4 +30,4 @@ summary "" -- Local Variables: -- mode:latex --- End: +-- End: diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/MedianPlacer.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/MedianPlacer.lua index 0b9d967db9c..10a8ba58994 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/MedianPlacer.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/MedianPlacer.lua @@ -18,10 +18,10 @@ local example = require 'pgf.gd.doc'.example -------------------------------------------------------------------------------- key "MedianPlacer" -summary "?" +summary "?" -------------------------------------------------------------------------------- -- Local Variables: -- mode:latex --- End: +-- End: diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/RandomMerger.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/RandomMerger.lua index 71bdbc7340d..aafb8afd2ad 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/RandomMerger.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/RandomMerger.lua @@ -18,9 +18,9 @@ local example = require 'pgf.gd.doc'.example -------------------------------------------------------------------------------- key "RandomMerger" -summary "?" +summary "?" -------------------------------------------------------------------------------- - + -------------------------------------------------------------------------------- key "RandomMerger.factor" @@ -30,4 +30,4 @@ summary "" -- Local Variables: -- mode:latex --- End: +-- End: diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/RandomPlacer.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/RandomPlacer.lua index c26946d4e11..a0c9738fa17 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/RandomPlacer.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/RandomPlacer.lua @@ -18,9 +18,9 @@ local example = require 'pgf.gd.doc'.example -------------------------------------------------------------------------------- key "RandomPlacer" -summary "?" +summary "?" -------------------------------------------------------------------------------- - + -------------------------------------------------------------------------------- key "RandomPlacer.circleSize" @@ -30,4 +30,4 @@ summary "" -- Local Variables: -- mode:latex --- End: +-- End: diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/SolarMerger.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/SolarMerger.lua index 76b084fa67e..99ff4c621d3 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/SolarMerger.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/SolarMerger.lua @@ -18,15 +18,15 @@ local example = require 'pgf.gd.doc'.example -------------------------------------------------------------------------------- key "SolarMerger" -summary "?" +summary "?" -------------------------------------------------------------------------------- - + -------------------------------------------------------------------------------- key "SolarMerger.simple" summary "" -------------------------------------------------------------------------------- - + -------------------------------------------------------------------------------- key "SolarMerger.massAsNodeRadius" @@ -36,4 +36,4 @@ summary "" -- Local Variables: -- mode:latex --- End: +-- End: diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/SolarPlacer.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/SolarPlacer.lua index 530ddbc0d89..eb186a56157 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/SolarPlacer.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/SolarPlacer.lua @@ -18,10 +18,10 @@ local example = require 'pgf.gd.doc'.example -------------------------------------------------------------------------------- key "SolarPlacer" -summary "?" +summary "?" -------------------------------------------------------------------------------- -- Local Variables: -- mode:latex --- End: +-- End: diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/ZeroPlacer.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/ZeroPlacer.lua index 6f579d0a453..e7722fd669a 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/ZeroPlacer.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/energybased/multilevelmixer/ZeroPlacer.lua @@ -18,7 +18,7 @@ local example = require 'pgf.gd.doc'.example -------------------------------------------------------------------------------- key "ZeroPlacer" -summary "?" +summary "?" -------------------------------------------------------------------------------- @@ -30,4 +30,4 @@ summary "" -- Local Variables: -- mode:latex --- End: +-- End: diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/layered.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/layered.lua index ffd3ea844dd..77a679d2be2 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/layered.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/layered.lua @@ -14,6 +14,6 @@ --- -- @section subsection {Algorithms for Drawing Layered Graphs} -- --- +-- local _
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/layered/CoffmanGrahamRanking.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/layered/CoffmanGrahamRanking.lua index fd13e9bd4b3..e2c09f21242 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/layered/CoffmanGrahamRanking.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/layered/CoffmanGrahamRanking.lua @@ -21,10 +21,10 @@ key "CoffmanGrahamRanking" summary "The ranking algorithm due to Coffman and Graham." documentation [[ -|CoffmanGrahamRanking| implements a node ranking algorithm based on +|CoffmanGrahamRanking| implements a node ranking algorithmn based on the Coffman--Graham scheduling algorithm, which can be used as first phase in |SugiyamaLayout|. The aim of the algorithm is to ensure that -the height of the ranking (the number of layers) is kept small. +the height of the ranking (the number of layers) is kept small. ]] -------------------------------------------------------------------- diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/layered/FastHierarchyLayout.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/layered/FastHierarchyLayout.lua index a7baad7e109..4d45270a01f 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/layered/FastHierarchyLayout.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/layered/FastHierarchyLayout.lua @@ -23,21 +23,21 @@ documentation [[ This class implements a hierarchy layout algorithm, that is, it layouts hierarchies with a given order of nodes on each -layer. It is used as a third phase of the Sugiyama algorithm. +layer. It is used as a third phase of the Sugiyama algorithm. All edges of the layout will have at most two bends. Additionally, for each edge having exactly two bends, the segment between them is drawn vertically. This applies in particular to the long edges arising in the first phase of the -Sugiyama algorithm. +Sugiyama algorithm. The implementation is based on: -% + \begin{itemize} - \item - Christoph Buchheim, Michael Jünger, Sebastian Leipert: A Fast - Layout Algorithm for k-Level Graphs. \emph{Proc. Graph - Drawing 2000}, volume 1984 of LNCS, pages 229--240, 2001. +\item + Christoph Buchheim, Michael Jünger, Sebastian Leipert: A Fast + Layout Algorithm for k-Level Graphs. \emph{Proc. Graph + Drawing 2000}, volumne 1984 of LNCS, pages 229--240, 2001. \end{itemize} ]] diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/layered/FastSimpleHierarchyLayout.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/layered/FastSimpleHierarchyLayout.lua index 4af6daa6207..719e6035699 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/layered/FastSimpleHierarchyLayout.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/layered/FastSimpleHierarchyLayout.lua @@ -24,31 +24,29 @@ documentation [[ This class implements a hierarchy layout algorithm, that is, it layouts hierarchies with a given order of nodes on each -layer. It is used as a third phase of the Sugiyama algorithm. +layer. It is used as a third phase of the Sugiyama algorithm. The algorithm runs in three phases: -% \begin{enumerate} - \item Alignment (4x) - \item Horizontal Compactation (4x) - \item Balancing +\item Alignment (4x) +\item Horizontal Compactation (4x) +\item Balancing \end{enumerate} -% The alignment and horizontal compactification phases are calculated downward, upward, left-to-right and right-to-left. The four -resulting layouts are combined in a balancing step. +resulting layouts are combined in a balancing step. Warning: The implementation is known to not always produce a correct layout. Therefore this Algorithm is for testing purpose -only. +only. The implementation is based on: -% + \begin{itemize} - \item - Ulrik Brandes, Boris Köpf: Fast and Simple Horizontal - Coordinate Assignment. \emph{LNCS} 2002, Volume 2265/2002, - pp. 33--36 +\item + Ulrik Brandes, Boris Köpf: Fast and Simple Horizontal + Coordinate Assignment. \emph{LNCS} 2002, Volume 2265/2002, + pp. 33--36 \end{itemize} ]] @@ -64,7 +62,7 @@ example -------------------------------------------------------------------- key "FastSimpleHierarchyLayout.layerDistance" -summary "Distance between the centers of nodes of two consecutive layers." +summary "Distance between the cetners of nodes of two consecutive layers." documentation [[ @@ -82,7 +80,7 @@ example -------------------------------------------------------------------- key "FastSimpleHierarchyLayout.siblingDistance" -summary "Distance between the centers of nodes of sibling nodes." +summary "Distance between the cetners of nodes of sibling nodes." documentation [[ diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/layered/GreedyCycleRemoval.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/layered/GreedyCycleRemoval.lua index d2f1d8eeeaf..788baece4ff 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/layered/GreedyCycleRemoval.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/layered/GreedyCycleRemoval.lua @@ -21,7 +21,7 @@ key "GreedyCycleRemoval" summary "Greedy algorithm for computing a maximal acyclic subgraph." documentation [[ - The algorithm applies a greedy heuristic to compute a maximal - acyclic subgraph and works in linear-time. +The algorithm applies a greedy heuristic to compute a maximal +acyclic subgraph and works in linear-time. ]] -------------------------------------------------------------------- diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/layered/LongestPathRanking.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/layered/LongestPathRanking.lua index 3d98fbe9c6a..e81bb2e1c30 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/layered/LongestPathRanking.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/layered/LongestPathRanking.lua @@ -21,11 +21,11 @@ key "LongestPathRanking" summary "The longest-path ranking algorithm." documentation [[ - |LongestPathRanking| implements the well-known longest-path ranking - algorithm, which can be used as first phase in |SugiyamaLayout|. The - implementation contains a special optimization for reducing edge - lengths, as well as special treatment of mixed-upward graphs (for - instance, \textsc{uml} class diagrams). +|LongestPathRanking| implements the well-known longest-path ranking +algorithm, which can be used as first phase in |SugiyamaLayout|. The +implementation contains a special optimization for reducing edge +lengths, as well as special treatment of mixed-upward graphs (for +instance, \textsc{uml} class diagrams). ]] -------------------------------------------------------------------- @@ -47,10 +47,10 @@ summary "If set to true, multi-edges will span at least two layers." key "LongestPathRanking.optimizeEdgeLength" summary [[ - If set to true the ranking algorithm tries to reduce edge - length even if this might increase the height of the layout. Choose - false, if the longest-path ranking known from the literature should be - used. +If set to true the ranking algorithm tries to reduce edge +length even if this might increase the height of the layout. Choose +false, if the longest-path ranking known from the literature should be +used. ]] -------------------------------------------------------------------- diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/layered/OptimalRanking.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/layered/OptimalRanking.lua index 25a8dd5262b..64eb7eadd80 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/layered/OptimalRanking.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/layered/OptimalRanking.lua @@ -21,9 +21,9 @@ key "OptimalRanking" summary "The optimal ranking algorithm." documentation [[ - The |OptimalRanking| implements the LP-based algorithm for - computing a node ranking with minimal edge lengths, which can - be used as first phase in |SugiyamaLayout|. +The |OptimalRanking| implements the LP-based algorithm for +computing a node ranking with minimal edge lengths, which can +be used as first phase in |SugiyamaLayout|. ]] -------------------------------------------------------------------- diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/layered/SiftingHeuristic.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/layered/SiftingHeuristic.lua index d0815a5b761..f54f0c33462 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/layered/SiftingHeuristic.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/layered/SiftingHeuristic.lua @@ -25,10 +25,10 @@ summary "The sifting heuristic for 2-layer crossing minimization." -------------------------------------------------------------------- key "SiftingHeuristic.strategy" -summary "Sets a so-called ``sifting strategy''." +summary "Sets a so-called ``sifting strategy.''" documentation [[ - The following values are permissible: |left_to_right|, |desc_degree|, - and |random|. +The following values are permissible: |left_to_right|, |desc_degree|, +and |random|. ]] -------------------------------------------------------------------- diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/layered/SugiyamaLayout.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/layered/SugiyamaLayout.lua index ab9d9ee77f7..ef68a1db0db 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/layered/SugiyamaLayout.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/layered/SugiyamaLayout.lua @@ -20,18 +20,19 @@ local example = require 'pgf.gd.doc'.example key "SugiyamaLayout" summary "The OGDF implementation of the Sugiyama algorithm." -documentation [[ - This layout represents a customizable implementation of Sugiyama's - layout algorithm. The implementation used in |SugiyamaLayout| is based - on the following publications: - - \begin{itemize} - \item Emden R. Gansner, Eleftherios Koutsofios, Stephen - C. North, Kiem-Phong Vo: A technique for drawing directed - graphs. \emph{IEEE Trans. Software Eng.} 19(3):214--230, 1993. - \item Georg Sander: \emph{Layout of compound directed graphs.} - Technical Report, Universität des Saarlandes, 1996. - \end{itemize} +documentation +[[ +This layout represents a customizable implementation of Sugiyama's +layout algorithm. The implementation used in |SugiyamaLayout| is based +on the following publications: + +\begin{itemize} +\item Emden R. Gansner, Eleftherios Koutsofios, Stephen + C. North, Kiem-Phong Vo: A technique for drawing directed + graphs. \emph{IEEE Trans. Software Eng.} 19(3):214--230, 1993. +\item Georg Sander: \emph{Layout of compound directed graphs.} + Technical Report, Universität des Saarlandes, 1996. +\end{itemize} ]] example @@ -39,14 +40,14 @@ example \tikz \graph [SugiyamaLayout] { a -- {b,c,d} -- e -- a }; ]] -example +example [[ \tikz \graph [SugiyamaLayout, grow=right] { a -- {b,c,d} -- e -- a }; ]] -example +example [[ \tikz [nodes={text height=.7em, text depth=.2em, draw=black!20, thick, fill=white, font=\footnotesize}, @@ -67,7 +68,7 @@ example { "USG 2.0" -> "USG 3.0", "PWB 2.0", "Unix/TS 1.0" } -> "Unix/TS 3.0"; { "Unix/TS++", "CB Unix 3", "Unix/TS 3.0" } -> "TS 4.0" -> "System V.0" -> "System V.2" -> "System V.3"; - }; + }; ]] -------------------------------------------------------------------------------- @@ -76,10 +77,10 @@ example -------------------------------------------------------------------------------- key "SugiyamaLayout.runs" summary "Determines, how many times the crossing minimization is repeated." -documentation +documentation [[ Each repetition (except for the first) starts with -randomly permuted nodes on each layer. Deterministic behavior can +randomly permuted nodes on each layer. Deterministic behaviour can be achieved by setting |SugiyamaLayout.runs| to 1. ]] -------------------------------------------------------------------------------- @@ -88,11 +89,12 @@ be achieved by setting |SugiyamaLayout.runs| to 1. -------------------------------------------------------------------------------- key "SugiyamaLayout.transpose" -documentation [[ - Determines whether the transpose step is performed - after each 2-layer crossing minimization; this step tries to - reduce the number of crossings by switching neighbored nodes on - a layer. +documentation +[[ +Determines whether the transpose step is performed +after each 2-layer crossing minimization; this step tries to +reduce the number of crossings by switching neighbored nodes on +a layer. ]] -------------------------------------------------------------------------------- @@ -100,10 +102,11 @@ documentation [[ -------------------------------------------------------------------------------- key "SugiyamaLayout.fails" -documentation [[ - The number of times that the number of crossings may - not decrease after a complete top-down bottom-up traversal, - before a run is terminated. +documentation +[[ +The number of times that the number of crossings may +not decrease after a complete top-down bottom-up traversal, +before a run is terminated. ]] -------------------------------------------------------------------------------- diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/misclayout.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/misclayout.lua index 9f5f291461a..bdf85e9905e 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/misclayout.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/misclayout.lua @@ -14,6 +14,6 @@ --- -- @section subsection {Miscellaneous Algorithms for Graph Drawing} -- --- +-- local _
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/misclayout/BalloonLayout.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/misclayout/BalloonLayout.lua index 2a250ecece6..bca8edd9ebc 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/misclayout/BalloonLayout.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/misclayout/BalloonLayout.lua @@ -20,7 +20,7 @@ local example = require 'pgf.gd.doc'.example key "BalloonLayout" summary "A ``balloon layout''." -documentation +documentation [[ This algorithm computes a radial (balloon) layout based on a spanning tree. The algorithm is partially based on the paper diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/misclayout/CircularLayout.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/misclayout/CircularLayout.lua index c5e2cf7a6c8..5c8a926384e 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/misclayout/CircularLayout.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/misclayout/CircularLayout.lua @@ -20,14 +20,14 @@ local example = require 'pgf.gd.doc'.example key "CircularLayout" summary "The circular layout algorithm." -documentation +documentation [[ -The implementation used in CircularLayout is based on the following publication: -% +The implementation used in CircularLayout is based on the following publication: + \begin{itemize} - \item Ugur Dogrus\"oz, Brendan Madden, Patrick Madden: Circular - Layout in the Graph Layout Toolkit. \emph{Proc. Graph Drawing 1996,} - LNCS 1190, pp. 92--100, 1997. +\item Ugur Dogrus\"oz, Brendan Madden, Patrick Madden: Circular + Layout in the Graph Layout Toolkit. \emph{Proc. Graph Drawing 1996,} + LNCS 1190, pp. 92--100, 1997. \end{itemize} ]] diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/planarity.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/planarity.lua index fb1abb5ccd6..c653bdc6b60 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/planarity.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/planarity.lua @@ -14,6 +14,6 @@ --- -- @section subsection {Algorithms for Drawing Planar Graphs} -- --- +-- local _
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/planarity/PlanarizationLayout.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/planarity/PlanarizationLayout.lua index e61f9281b97..516d119f553 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/planarity/PlanarizationLayout.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/doc/ogdf/planarity/PlanarizationLayout.lua @@ -20,17 +20,17 @@ local example = require 'pgf.gd.doc'.example key "PlanarizationLayout" summary "The planarization layout algorithm." -documentation +documentation [[ - A |PlanarizationLayout| represents a customizable implementation - of the planarization approach for drawing graphs. The implementation - used in PlanarizationLayout is based on the following publication: - % - \begin{itemize} - \item C. Gutwenger, P. Mutzel: \emph{An Experimental Study of Crossing - Minimization Heuristics.} 11th International Symposium on Graph - Drawing 2003, Perugia (GD '03), LNCS 2912, pp. 13--24, 2004. - \end{itemize} +A |PlanarizationLayout| represents a customizable implementation +of the planarization approach for drawing graphs. The implementation +used in PlanarizationLayout is based on the following publication: + +\begin{itemize} +\item C. Gutwenger, P. Mutzel: \emph{An Experimental Study of Crossing + Minimization Heuristics.} 11th International Symposium on Graph + Drawing 2003, Perugia (GD '03), LNCS 2912, pp. 13-24, 2004. +\end{itemize} ]] example @@ -44,12 +44,12 @@ example -------------------------------------------------------------------------------- key "PlanarizationLayout.preprocessCliques" summary "Configures, whether cliques are collapsed in a preprocessing step." -documentation +documentation [[ - If set to true, a preprocessing for cliques (complete subgraphs) - is performed and cliques will be laid out in a special form (straight-line, - not orthogonal). The preprocessing may reduce running time and improve - layout quality if the input graphs contains dense subgraphs. +If set to true, a preprocessing for cliques (complete subgraphs) +is performed and cliques will be laid out in a special form (straight-line, +not orthogonal). The preprocessing may reduce running time and improve +layout quality if the input graphs contains dense subgraphs. ]] -------------------------------------------------------------------------------- diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/examples/ASCIIDisplayer.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/examples/ASCIIDisplayer.lua index 5acc28396b2..ccaa91f9992 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/examples/ASCIIDisplayer.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/examples/ASCIIDisplayer.lua @@ -5,7 +5,7 @@ require "pgf.gd.layered.library" require "pgf.gd.force.library" local algorithm = io.read():match("%s*graph%s*%[(.-)%]") - + InterfaceToDisplay.pushPhase(algorithm, "main", 1) InterfaceToDisplay.pushOption("level distance", 6, 2) InterfaceToDisplay.pushOption("sibling distance", 8, 3) @@ -27,6 +27,6 @@ end InterfaceToDisplay.runGraphDrawingAlgorithm() InterfaceToDisplay.renderGraph() InterfaceToDisplay.endGraphDrawingScope() - + diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/examples/BindingToASCII.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/examples/BindingToASCII.lua index 2b5c9cc0b6a..9752254907a 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/examples/BindingToASCII.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/examples/BindingToASCII.lua @@ -22,10 +22,10 @@ function BindingToASCII:renderStop() for x=-30,30 do local s = canvas[x][y] for i=1,#s do - pos = x+30+i-math.floor(#s/2) - if not t[pos] or t[pos] == " " or t[pos] == "." then - t[pos] = string.sub(s,i,i) - end + pos = x+30+i-math.floor(#s/2) + if not t[pos] or t[pos] == " " or t[pos] == "." then + t[pos] = string.sub(s,i,i) + end end end print(table.concat(t)) @@ -41,46 +41,46 @@ function BindingToASCII:renderEdge(e) local function connect (p,q) local x1, y1, x2, y2 = math.floor(p.x+0.5), math.floor(p.y+0.5), math.floor(q.x+0.5), math.floor(q.y+0.5) - + -- Go upward with respect to x if x2 < x1 then x1, y1, x2, y2 = x2, y2, x1, y1 end - + local delta_x = x2-x1 local delta_y = y2-y1 if math.abs(delta_x) > math.abs(delta_y) then local slope = delta_y/delta_x for i=x1,x2 do - local x,y = i, math.floor(y1 + (i-x1)*slope + 0.5) + local x,y = i, math.floor(y1 + (i-x1)*slope + 0.5) - if canvas[x][y] == " " then - canvas[x][y] = '.' - end + if canvas[x][y] == " " then + canvas[x][y] = '.' + end end elseif math.abs(delta_y) > 0 then local slope = delta_x/delta_y for i=y1,y2,(y1<y2 and 1) or -1 do - local x,y = math.floor(x1 + (i-y1)*slope + 0.5), i + local x,y = math.floor(x1 + (i-y1)*slope + 0.5), i - if canvas[x][y] == " " then - canvas[x][y] = '.' - end + if canvas[x][y] == " " then + canvas[x][y] = '.' + end end end end - - + + local p = e.tail.pos - + for i=1,#e.path do if type(e.path[i]) == "table" then connect(p, e.path[i]) p = e.path[i] end end - + connect(p, e.head.pos) end diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/examples/SimpleDemo.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/examples/SimpleDemo.lua index 46eb4eff385..da850ff0dea 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/examples/SimpleDemo.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/examples/SimpleDemo.lua @@ -29,7 +29,7 @@ declare { function (self) local g = self.digraph local alpha = (2 * math.pi) / #g.vertices - + for i,vertex in ipairs(g.vertices) do local radius = vertex.options['radius'] or g.options['radius'] vertex.pos.x = radius * math.cos(i * alpha) @@ -39,19 +39,19 @@ declare { }, summary = [[" - This algorithm is the ``Hello World'' of graph drawing. + This algorithm is the ``Hello World'' of graph drawing. "]], - documentation = [=[" - The algorithm arranges nodes in a circle (without paying heed to the - sizes of the nodes or to the edges). In order to ``really'' layout - nodes in a circle, use |simple necklace layout|; the present layout - is only intended to demonstrate how much (or little) is needed to - implement a graph drawing algorithm. - % + documentation = [=[" + The algorithm + arranges nodes in a circle (without paying heed to the sizes of the + nodes or to the edges). In order to ``really'' layout nodes in a + circle, use |simple necklace layout|; the present layout is only intended + to demonstrate how much (or little) is needed to implement a graph + drawing algorithm. \begin{codeexample}[code only, tikz syntax=false] -- File pgf.gd.examples.SimpleDemo local declare = require "pgf.gd.interface.InterfaceToAlgorithms".declare - + declare { key = "simple demo layout", algorithm = { @@ -59,7 +59,7 @@ declare { function (self) local g = self.digraph local alpha = (2 * math.pi) / #g.vertices - + for i,vertex in ipairs(g.vertices) do local radius = vertex.options['radius'] or g.options['radius'] vertex.pos.x = radius * math.cos(i * alpha) @@ -73,10 +73,10 @@ declare { "]] } \end{codeexample} - - On the display layer (\tikzname, that is) the algorithm can now - immediately be employed; you just need to say - |\usegdlibrary{examples.SimpleDemo}| at the beginning - somewhere. + + On the display layer (\tikzname, that is) the algorithm can now + immediately be employed; you just need to say + |\usegdlibrary{examples.SimpleDemo}| at the beginning + somewhere. "]=] }
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/examples/SimpleEdgeDemo.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/examples/SimpleEdgeDemo.lua index c22c4decf22..8eb9d7d7019 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/examples/SimpleEdgeDemo.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/examples/SimpleEdgeDemo.lua @@ -31,34 +31,33 @@ declare { algorithm = SimpleEdgeDemo, summary = "This algorithm shows how edges can be created by an algorithm.", - documentation = [[" - For its job, the algorithm uses the function |createEdge|, which can be - called during the run of the algorithm to create edges in the - syntactic graph. The algorithm first does exactly the same as the - simple demo layout, then it creates an edge for every node where the - |new edge to| option is set. You will see in the code how this - option is declared and how we use it to look up a vertex in the - graph by its name. - % + documentation = [[" + For its job, the algorithm uses the function |createEdge|, which can be + called during the run of the algorithm to create edges in the + syntactic graph. The algorithm first does exactly the same as the + simple demo layout, then it creates an edge for every node where the + |new edge to| option is set. You will see in the code how this + option is declared and how we use it to look up a vertex in the + graph by its name. + \begin{codeexample}[] \tikz [simple edge demo layout] \graph [radius=2cm] { a, b, c, d, e, f; - + e -> [red] f; % normal edge - + % Edges generated by the algorithm: - a[new edge to=b]; + a[new edge to=b]; b[new edge to=d]; c[new edge to=f]; }; \end{codeexample} - - And the algorithm: - % + + And the algorithm: \begin{codeexample}[code only, tikz syntax=false] -- File pgf.gd.examples.SimpleEdgeDemo - + -- Imports local InterfaceToAlgorithms = require "pgf.gd.interface.InterfaceToAlgorithms" local declare = InterfaceToAlgorithms.declare @@ -72,9 +71,9 @@ declare { summary = "This algorithm shows...", } \end{codeexample} - - Next comes the declaration of the new option |new edge to|: - % + + Next comes the declaration of the new option |new edge to|: + \begin{codeexample}[code only, tikz syntax=false] declare { key = "new edge to", @@ -82,9 +81,9 @@ declare { summary = "This option takes the name of a vertex..." } \end{codeexample} - - Finally, the algorithm's code: - % + + Finally, the algorithm's code: + \begin{codeexample}[code only, tikz syntax=false] function SimpleEdgeDemo:run() -- As in a SimpleDemo: @@ -109,15 +108,15 @@ declare { key = "new edge to", type = "string", - summary = [[" - This option takes the name of a vertex. An edge leading to this - vertex is added to the syntactic digraph. - "]] + summary = [[" + This option takes the name of a vertex. An edge leading to this + vertex is added to the syntactic digraph. + "]] } function SimpleEdgeDemo:run() - + -- As in a SimpleDemo: local g = self.digraph local alpha = (2 * math.pi) / #g.vertices diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/examples/SimpleHuffman.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/examples/SimpleHuffman.lua index f81abf11058..270ecce2c90 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/examples/SimpleHuffman.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/examples/SimpleHuffman.lua @@ -31,26 +31,27 @@ local SimpleHuffman = {} declare { key = "simple Huffman layout", algorithm = SimpleHuffman, - + postconditions = { upward_oriented = true }, summary = [[" - This algorithm demonstrates how an algorithm can generate new nodes. + This algorithm demonstrates how an algorithm can generate new + nodes. "]], - documentation = [[" - The input graph should just consist of some nodes (without - edges) and each node should have a |probability| key set. The nodes - will then be arranged in a line (as siblings) and a Huffman tree - will be constructed ``above'' these nodes. For the construction of - the Huffman tree, new nodes are created and connected. - - \pgfgdset{ - HuffmanLabel/.style={/tikz/edge node={node[fill=white,font=\footnotesize,inner sep=1pt]{#1}}}, - HuffmanNode/.style={/tikz/.cd,circle,inner sep=0pt,outer sep=0pt,draw,minimum size=3pt} - } - + documentation = [[" + The input graph should just consist of some nodes (without + edges) and each node should have a |probability| key set. The nodes + will then be arranged in a line (as siblings) and a Huffman tree + will be constructed ``above'' these nodes. For the construction of + the Huffman tree, new nodes are created and connected. + + \pgfgdset{ + HuffmanLabel/.style={/tikz/edge node={node[fill=white,font=\footnotesize,inner sep=1pt]{#1}}}, + HuffmanNode/.style={/tikz/.cd,circle,inner sep=0pt,outer sep=0pt,draw,minimum size=3pt} + } + \begin{codeexample}[] \tikz \graph [simple Huffman layout, level distance=7mm, sibling distance=8mm, grow'=up] @@ -60,16 +61,14 @@ declare { c ["0.2", probability=0.2], d ["0.1", probability=0.1], e ["0.11", probability=0.11] -}; +}; \end{codeexample} - % - The file starts with some setups and declarations: - % + The file starts with some setups and declarations: \begin{codeexample}[code only, tikz syntax=false] -- File pgf.gd.examples.SimpleHuffman - + local declare = require "pgf.gd.interface.InterfaceToAlgorithms".declare - + -- The class local SimpleHuffman = {} @@ -86,7 +85,7 @@ declare { initial = "1", summary = "..." } - + -- Import local layered = require "pgf.gd.layered" local InterfaceToAlgorithms = require "pgf.gd.interface.InterfaceToAlgorithms" @@ -98,31 +97,29 @@ local layer = Storage.new() function SimpleHuffman:run() -- Construct a Huffman tree on top of the vertices... \end{codeexample} - - Next comes a setup, where we create the working list of vertices - that changes as the Huffman coding method proceeds: - % + + Next comes a setup, where we create the working list of vertices + that changes as the Huffman coding method proceeds: \begin{codeexample}[code only, tikz syntax=false] -- Shorthand local function prop (v) return probability[v] or v.options['probability'] end - + -- Copy the vertex table, since we are going to modify it: local vertices = {} for i,v in ipairs(self.ugraph.vertices) do vertices[i] = v end \end{codeexample} - - The initial vertices are arranged in a line on the last layer. The - function |ideal_sibling_distance| takes care of the rather - complicated handling of the (possibly rotated) bounding boxes and - separations. The |props| and |layer| are tables used by - algorithms to ``store stuff'' at a vertex or at an arc. The - table will be accessed by |arrange_layers_by_baselines| to - determine the ideal vertical placements. - % + + The initial vertices are arranged in a line on the last layer. The + function |ideal_sibling_distance| takes care of the rather + complicated handling of the (possibly rotated) bounding boxes and + separations. The |props| and |layer| are tables used by + algorithms to ``store stuff'' at a vertex or at an arc. The + table will be accessed by |arrange_layers_by_baselines| to + determine the ideal vertical placements. \begin{codeexample}[code only, tikz syntax=false] -- Now, arrange the nodes in a line: vertices [1].pos.x = 0 @@ -132,17 +129,16 @@ function SimpleHuffman:run() vertices [i].pos.x = vertices[i-1].pos.x + d layer[ vertices [i] ] = #vertices end -\end{codeexample} - - Now comes the actual Huffman algorithm: Always find the vertices - with a minimal probability\dots - % +\end{codeexample} + + Now comes the actual Huffman algorithm: Always find the vertices + with a minimal probability\dots \begin{codeexample}[code only, tikz syntax=false] -- Now, do the Huffman thing... while #vertices > 1 do -- Find two minimum probabilities local min1, min2 - + for i=1,#vertices do if not min1 or prop(vertices[i]) < prop(vertices[min1]) then min2 = min1 @@ -152,11 +148,9 @@ function SimpleHuffman:run() end end \end{codeexample} - % - \dots and connect them with a new node. This new node gets the - option |HuffmanNode|. It is now the job of the higher layers to map - this option to something ``nice''. - % + \dots and connect them with a new node. This new node gets the + option |HuffmanNode|. It is now the job of the higher layers to map + this option to something ``nice''. \begin{codeexample}[code only, tikz syntax=false] -- Create new node: local p = prop(vertices[min1]) + prop(vertices[min2]) @@ -165,29 +159,27 @@ function SimpleHuffman:run() layer[v] = #vertices-1 v.pos.x = (vertices[min1].pos.x + vertices[min2].pos.x)/2 vertices[#vertices + 1] = v - + InterfaceToAlgorithms.createEdge (self, v, vertices[min1], {generated_options = {{key="HuffmanLabel", value = "0"}}}) InterfaceToAlgorithms.createEdge (self, v, vertices[min2], {generated_options = {{key="HuffmanLabel", value = "1"}}}) - + table.remove(vertices, math.max(min1, min2)) table.remove(vertices, math.min(min1, min2)) end \end{codeexample} - % - Ok, we are mainly done now. Finish by computing vertical placements - and do formal cleanup. + Ok, we are mainly done now. Finish by computing vertical placements + and do formal cleanup. \begin{codeexample}[code only, tikz syntax=false] layered.arrange_layers_by_baselines(layers, self.adjusted_bb, self.ugraph) end \end{codeexample} - - In order to use the class, we have to make sure that, on the - display layer, the options |HuffmanLabel| and |HuffmanNode| are - defined. This is done by adding, for instance, the following to - \tikzname: - % + + In order to use the class, we have to make sure that, on the + display layer, the options |HuffmanLabel| and |HuffmanNode| are + defined. This is done by adding, for instance, the following to + \tikzname: \begin{codeexample}[code only] \pgfkeys{ /graph drawing/HuffmanLabel/.style={ @@ -199,8 +191,8 @@ end } \end{codeexample} "]] -} - +} + --- @@ -209,18 +201,18 @@ declare { type = "number", initial = "1", - summary = [[" - The probability parameter. It is used by the Huffman algorithm to - group nodes. - "]] + summary = [[" + The probability parameter. It is used by the Huffman algorithm to + group nodes. + "]] } - + -- Imports - + local Storage = require 'pgf.gd.lib.Storage' - + -- Storages - + local probability = Storage.new() local layer = Storage.new() @@ -232,13 +224,13 @@ function SimpleHuffman:run() local function prop (v) return probability[v] or v.options['probability'] end - + -- Copy the vertex table, since we are going to modify it: local vertices = {} for i,v in ipairs(self.ugraph.vertices) do vertices[i] = v end - + -- Now, arrange the nodes in a line: vertices [1].pos.x = 0 layer[vertices [1]] = #vertices @@ -247,7 +239,7 @@ function SimpleHuffman:run() vertices [i].pos.x = vertices[i-1].pos.x + d layer[vertices [i]] = #vertices end - + -- Now, do the Huffman thing... while #vertices > 1 do -- Find two minimum probabilities @@ -269,7 +261,7 @@ function SimpleHuffman:run() layer[v] = #vertices-1 v.pos.x = (vertices[min1].pos.x + vertices[min2].pos.x)/2 vertices[#vertices + 1] = v - + InterfaceToAlgorithms.createEdge (self, v, vertices[min1], {generated_options = {{key="HuffmanLabel", value = "0"}}}) InterfaceToAlgorithms.createEdge (self, v, vertices[min2], @@ -278,7 +270,7 @@ function SimpleHuffman:run() table.remove(vertices, math.max(min1, min2)) table.remove(vertices, math.min(min1, min2)) end - + layered.arrange_layers_by_baselines(layer, self.adjusted_bb, self.ugraph) end diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/examples/library.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/examples/library.lua index 0c977600a7e..85e74970095 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/examples/library.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/examples/library.lua @@ -16,7 +16,7 @@ -- graph drawing engine can be used. In particular, the algorithms of -- this package are not really meant to be used to layout graphs -- (although they can be used, in principle); rather you are invited --- to have a look at their implementation and to adapt them to your needs. +-- to have a look at their implementation and to adapt them to your needs. -- -- @library diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/experimental/evolving/GraphAnimationCoordination.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/experimental/evolving/GraphAnimationCoordination.lua index 31f8f27431b..2dd23937fe1 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/experimental/evolving/GraphAnimationCoordination.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/experimental/evolving/GraphAnimationCoordination.lua @@ -49,11 +49,11 @@ declare { type = "boolean", Initial = false, documentation = [[" - This key specifies, if a supernode changed its - visual properties since the last snapshot. - The default value is |false| and prevent the algorithm - to produce a lot of unnecessary animations. - "]] + This key specifies, if a supernode changed its + visual properties since the last snapshot. + The default value is |false| and prevent the algorithm + to produce a lot of unnecessary animations. + "]] } declare { @@ -70,12 +70,12 @@ declare { type = "number", initial = 0.5, documentation = [[" - This key specifies a minimum time in which a single node - has to be prohibited to be animated. - For a node with minimum rest time of 1s that exists in a snapshot - at time $t$ this means that all animations including movements and fadings - are only allowed before $t$-0.5s and after $t$+0.5s. - "]], + This key specifies a minimum time in which a single node + has to be prohibited to be animated. + For a node with minimum rest time of 1s that exists in a snapshot + at time $t$ this means that all animations including movements and fadings + are only allowed before $t$-0.5s and after $t$+0.5s. + "]], } declare { @@ -83,9 +83,9 @@ declare { type = "number", initial = math.huge, documentation = [[" - Use this key if you want to limit the time during nodes are allowed to move - when they changing their positions. - "]], + Use this key if you want to limit the time during nodes are allowed to move + when they changing their positions. + "]], } declare { @@ -93,10 +93,7 @@ declare { type = "boolean", initial = true, documentation = [[" - Use this key if you want to allow that the fade animations for or - disappearing nodes may occurs while the mid time between two snapshots. - If false then the appearing ends on the midtime and the disappearing - starts in this moment. + Use this key if you want to allow that the fade animations for or dissappearing nodes may occurs while the mid time between two snapshots. If false then the appearing ends on the midtime and the disappering starts in this moment. "]] } @@ -106,39 +103,40 @@ declare { algorithm = GraphAnimationCoordination, phase = "evolving graph animation", phase_default = true, - summary = [[" - This phase animates all vertices including movements and - fade in or fade out animations given an evolving graph as sequence - of single snapshot graphs. + summary = [[" + This phase animates all vertices including movements and + fade in or fade out animations given an evolving graph as sequence + of single snapshot graphs. "]], - documentation = [[" - This phase animates all vertices including movements and - fade in or fade out animations given an evolving graph as sequence - of single snapshot graphs. - - Your algorithm needs to work on evolving graphs and has to use - the |evolving graph animation| phase. You do not need to use - this key by yourself then because this key starts the default - algorithm algorithm of the phase. - % - \begin{codeexample}[] - local ga_class = self.digraph.options.algorithm_phases['evolving graph animation'] - -- animate graph - ga_class.new { - main_algorithm = self, - supergraph = supergraph, - digraph = self.digraph, - ugraph = self.ugraph - }:run() - \end{codeexample} - - This algorithm and phase require a supergraph instance and the original - digraph and ugraph. Note that you have to set the layout of the snapshot - nodes before running algorithms of this is useful. + documentation = [[" + This phase animates all vertices including movements and + fade in or fade out animations given an evolving graph as sequence + of single snapshot graphs. + + Your algorithm needs to work on evolving graphs and has to use + the |evolving graph animation| phase. You do not need to use + this key by yourself then because this key starts the default + algorithm algorithm of the phase. + + \begin{codeexample}[] + local ga_class = self.digraph.options.algorithm_phases['evolving graph animation'] + -- animate graph + ga_class.new { + main_algorithm = self, + supergraph = supergraph, + digraph = self.digraph, + ugraph = self.ugraph + }:run() + \end{codeexample} + + This algorithm and phase require a supergraph instance and the original digraph and ugraph. + Note that you have to set the layout of the snapshot nodes before running algorithms of this + is useful. + "]], } --- Help functions +-- Helpfunctions -- -- Appends a move animation to a given snapshot object such that the @@ -148,7 +146,7 @@ declare { -- -- This means if we want to move a node 1cm to the right the value of -- |c_from| has to be (0,0) while |c_to| must be (1,0). The argument --- |c_from| is useful for a node which has a position but its +-- |c_from| is usefull for a node which has a position but its -- previous node related to the same supervertex is at a different -- position. Then we can use this argument to move the new node to -- its origin position for smooth transitions. @@ -172,16 +170,16 @@ local function append_move_animation(object, c_from, c_to, t_start, t_end) local t1 = (7*t_start + 5*t_end)/12 local t2 = (5*t_start + 7*t_end)/12 table.insert(animations, { - attribute = "translate", - entries = { - { t = t_start, value = c_from}, --- { t = t1, value = c1 }, --- { t = t2, value = c2 }, - { t = t_end, value = c_to } - }, - options = { { key = "freeze at end", }, --- {key = "entry control", value="0}{1",} - } + attribute = "translate", + entries = { + { t = t_start, value = c_from}, +-- { t = t1, value = c1 }, +-- { t = t2, value = c2 }, + { t = t_end, value = c_to } + }, + options = { { key = "freeze at end", }, +-- {key = "entry control", value="0}{1",} + } }) object.animations = animations end @@ -189,26 +187,26 @@ end local function append_fade_animation(object, v_start, v_end, t_start, t_end) local animations = object.animations or {} - + if v_start == 0 then table.insert(animations, { - attribute = "stage", - entries = { { t = t_start, value = "true"}, }, - options = { { key = "freeze at end" } } + attribute = "stage", + entries = { { t = t_start, value = "true"}, }, + options = { { key = "freeze at end" } } }) elseif v_end == 0 and nil then table.insert(animations, { - attribute = "stage", - entries = { { t = t_end, value = "false"}, }, - options = { --{ key = "freeze at end" } - } - }) + attribute = "stage", + entries = { { t = t_end, value = "false"}, }, + options = { --{ key = "freeze at end" } + } + }) end table.insert(animations, { attribute = "opacity", entries = { - { t = t_start, value = v_start }, + { t = t_start, value = v_start }, { t = t_end, value = v_end } }, options = { { key = "freeze at end" } } }) @@ -223,13 +221,13 @@ local function eq_offset(a1, a2, b1, b2) local dy = ((a1.y-a2.y) - (b1.y-b2.y)) if dx<0 then dx = -dx end if dy<0 then dy = -dy end - return dx<0.001 and dy<0.001 + return dx<0.001 and dy<0.001 end -- -- Check if two arcs connect a pair of nodes at the same position. -- This can be used as an indicator that two consecutive arcs --- can be represented by the same arc object. +-- can be representet by the same arc object. -- local function eq_arc(arc1, arc2) if not arc1 or not arc2 then @@ -253,7 +251,7 @@ function GraphAnimationCoordination:run() self.next_node = Storage.new() self.visible_objects = Storage.new() - + self:precomputeNodes() self:precomputeEdges() self:animateNodeAppearing() @@ -265,7 +263,7 @@ end function GraphAnimationCoordination:generateNodeMotions(node_types) local supergraph = self.supergraph local graph = self.digraph - + for _, supervertex in ipairs(self.supergraph.vertices) do local lj = -1 local last_v = nil @@ -274,25 +272,25 @@ function GraphAnimationCoordination:generateNodeMotions(node_types) local vertex = supergraph:getSnapshotVertex(supervertex, s) if lj == j-1 and vertex and last_v then - local mrt1 = last_v.options["minimum rest time"]/2 - local mrt2 = vertex.options["minimum rest time"]/2 - + local mrt1 = last_v.options["minimum rest time"]/2 + local mrt2 = vertex.options["minimum rest time"]/2 + local s1 = Coordinate.new(0,0) - local e1 = Coordinate.new(vertex.pos.x-last_v.pos.x,-vertex.pos.y+last_v.pos.y) - - local s2 = Coordinate.new(-vertex.pos.x+last_v.pos.x,vertex.pos.y-last_v.pos.y) - local e2 = Coordinate.new(0,0) - - local t_end = s.timestamp - math.max(0, mrt2) - local t_start = last_time + math.max(0,mrt1) - - local representative = self.visible_objects[supervertex][s] - if representative == vertex then - append_move_animation(vertex, s2, e2, t_start, t_end) - append_move_animation(last_v, s1, e1, t_start, t_end) - else - append_move_animation(representative,s1,e1,t_start,t_end) - end + local e1 = Coordinate.new(vertex.pos.x-last_v.pos.x,-vertex.pos.y+last_v.pos.y) + + local s2 = Coordinate.new(-vertex.pos.x+last_v.pos.x,vertex.pos.y-last_v.pos.y) + local e2 = Coordinate.new(0,0) + + local t_end = s.timestamp - math.max(0, mrt2) + local t_start = last_time + math.max(0,mrt1) + + local representative = self.visible_objects[supervertex][s] + if representative == vertex then + append_move_animation(vertex, s2, e2, t_start, t_end) + append_move_animation(last_v, s1, e1, t_start, t_end) + else + append_move_animation(representative,s1,e1,t_start,t_end) + end end last_time = s.timestamp lj = j @@ -302,59 +300,59 @@ function GraphAnimationCoordination:generateNodeMotions(node_types) end - + function GraphAnimationCoordination:generateEdgeMotions() local supergraph = self.supergraph local graph = self.digraph - + for i, arc in ipairs(supergraph.arcs) do local head = arc.head local tail = arc.tail - + local last_arc = nil local last_time = nil local last_v = nil local last_w = nil - + for j, s in ipairs(supergraph.snapshots) do local v = supergraph:getSnapshotVertex(tail,s) local w = supergraph:getSnapshotVertex(head,s) if v and w then - local this_arc = graph:arc(v,w) --or graph:arc(w,v) + local this_arc = graph:arc(v,w) --or graph:arc(w,v) if this_arc then - if this_arc and last_arc then - local mrt1 = last_v.options["minimum rest time"]/2 - local mrt2 = v.options["minimum rest time"]/2 - - local s1 = Coordinate.new(0,0)--lv.pos - local e1 = Coordinate.new(v.pos.x-last_v.pos.x,-v.pos.y+last_v.pos.y) - - local s2 = Coordinate.new(-v.pos.x+last_v.pos.x,v.pos.y-last_v.pos.y) - local e2 = Coordinate.new(0,0) - - local t_end = s.timestamp - math.max(0,mrt2) - local t_start = last_time + math.max(0,mrt1) - - local representative = self.visible_objects[arc][s] - if representative == this_arc then - append_move_animation(last_arc, s1, e1, t_start,t_end) - append_move_animation(this_arc, s2, e2, t_start,t_end) - else - append_move_animation(representative,s1,e1,t_start,t_end) - end - this_arc = representative - end - last_arc = this_arc - last_v = v - last_time = s.timestamp - else - last_arc = nil - end + if this_arc and last_arc then + local mrt1 = last_v.options["minimum rest time"]/2 + local mrt2 = v.options["minimum rest time"]/2 + + local s1 = Coordinate.new(0,0)--lv.pos + local e1 = Coordinate.new(v.pos.x-last_v.pos.x,-v.pos.y+last_v.pos.y) + + local s2 = Coordinate.new(-v.pos.x+last_v.pos.x,v.pos.y-last_v.pos.y) + local e2 = Coordinate.new(0,0) + + local t_end = s.timestamp - math.max(0,mrt2) + local t_start = last_time + math.max(0,mrt1) + + local representative = self.visible_objects[arc][s] + if representative == this_arc then + append_move_animation(last_arc, s1, e1, t_start,t_end) + append_move_animation(this_arc, s2, e2, t_start,t_end) + else + append_move_animation(representative,s1,e1,t_start,t_end) + end + this_arc = representative + end + last_arc = this_arc + last_v = v + last_time = s.timestamp + else + last_arc = nil + end else - last_arc = nil + last_arc = nil end end end @@ -365,9 +363,9 @@ end -- @field t_transition The mid time between two snapshot times. -- @field fade_duration The duration of the fade animation -- @field overlapping A boolean defining if the animation occurs --- before and after the mid time (true) or if it +-- beofre and after the mid time (true) or if it -- starts/end only in one interval (false) --- @field closing A boolean specifying if this is an outfading time +-- @field closing A boolean specifieng if this is a outfading time local function compute_fade_times(t_transition, fade_duration, overlapping, closing) if overlapping then @@ -396,9 +394,9 @@ function GraphAnimationCoordination:animateNodeAppearing() local overlapping_out= true local minimum_rest_time = math.max(0,vertex.options["minimum rest time"]) local allow_overlapping = vertex.options["overlapping transition"] - local fadein_duration = 0.01 - local fadeout_duration = 0.01 - + local fadein_duration = 0.01 + local fadeout_duration = 0.01 + if self.is_first[vertex] then fadein_duration = self.ugraph.options["fadein time"] overlapping_in = false or allow_overlapping @@ -416,7 +414,7 @@ function GraphAnimationCoordination:animateNodeAppearing() fadeout_duration = (interval.to-interval.from-minimum_rest_time)/2 if overlapping then fadeout_duration = fadeout_duration*2 end end - + local fin = compute_fade_times(interval.from, fadein_duration, overlapping_in, false) local fout = compute_fade_times(interval.to, fadeout_duration, overlapping_out, true) @@ -424,23 +422,23 @@ function GraphAnimationCoordination:animateNodeAppearing() if representative~= vertex then table.insert(vertex.animations,{ - attribute = "stage", - entries = { { t = 0, value = "false"}, }, - options = {} + attribute = "stage", + entries = { { t = 0, value = "false"}, }, + options = {} }) end - + if interval.from > -math.huge and (vertex == representative or self.is_first[vertex]) then -- only appears if the snapshot node is its own repr. or if in the prev snapshot is -- no representative. - append_fade_animation(representative, 0, 1, fin.t_start, fin.t_end) + append_fade_animation(representative, 0, 1, fin.t_start, fin.t_end) end if interval.to < math.huge and (self.is_last[vertex] or self.last_rep[vertex]) then -- The snapshot node only disappears when the node is not visible - -- in the next or (this=)last snapshot: + -- in the next or (this=)last snapshot: append_fade_animation(representative, 1, 0, fout.t_start, fout.t_end) end - end + end end @@ -449,119 +447,121 @@ function GraphAnimationCoordination:animateEdgeAppearing() local supergraph = self.supergraph local graph = self.digraph for _,edge in ipairs(graph.arcs) do - local snapshot = supergraph:getSnapshot(edge.head) - local int = snapshot.interval - local superarc = supergraph:getSuperarc(edge) - local representative = self.visible_objects[superarc][snapshot] or edge - - local minimum_rest_time = math.max(0,edge.head.options["minimum rest time"]/2, - edge.tail.options["minimum rest time"]/2) - - local appears = math.max(int.from, int.from) - local disappears = math.min(int.to, int.to) - - local overlapping_in = true -- init true for crossfading - local overlapping_out= true - local fadein_duration = 0.01 - local fadeout_duration = 0.01 - local allow_overlapping = (edge.tail.options["overlapping transition"] and edge.head.options["overlapping transition"]) - - if self.is_first[edge] and not self.move_on_enter[edge] and not self.move_on_enter[edge.head] then - fadein_duration = self.ugraph.options["fadein time"] - overlapping_in = false or allow_overlapping - end - - if self.is_last[edge] and not self.move_on_leave[edge] then - fadeout_duration = self.ugraph.options["fadeout time"] - overlapping_out = false or allow_overlapping - end - - - if self.is_first[edge] - and (self.move_on_enter[edge.head] - or self.move_on_enter[edge.tail] ) - then - appears = snapshot.timestamp - minimum_rest_time - end - if self.is_last[edge] and - (self.move_on_leave[edge.head] - or self.move_on_leave[edge.tail] - ) then - disappears = snapshot.timestamp + minimum_rest_time - end - - local fin = compute_fade_times(appears, fadein_duration, overlapping_in,false) - local fout = compute_fade_times(disappears,fadeout_duration,overlapping_out,true) - - edge.animations = edge.animations or {} - - if representative~=edge then - table.insert(edge.animations,{ - attribute = "stage", - entries = { { t = 0, value = "false"}, }, - options = {}}) - end - - -- Fade in: - if appears > -math.huge and (edge == representative or self.is_first[edge]) then - append_fade_animation(representative, 0, 1, fin.t_start, fin.t_end ) - end + local snapshot = supergraph:getSnapshot(edge.head) + local int = snapshot.interval + local superarc = supergraph:getSuperarc(edge) + local representative = self.visible_objects[superarc][snapshot] or edge + + local minimum_rest_time = math.max(0,edge.head.options["minimum rest time"]/2, + edge.tail.options["minimum rest time"]/2) + + local appears = math.max(int.from, int.from) + local disappears = math.min(int.to, int.to) + + local overlapping_in = true -- init true for crossfading + local overlapping_out= true + local fadein_duration = 0.01 + local fadeout_duration = 0.01 + local allow_overlapping = (edge.tail.options["overlapping transition"] and edge.head.options["overlapping transition"]) + + if self.is_first[edge] and not self.move_on_enter[edge] and not self.move_on_enter[edge.head] then + fadein_duration = self.ugraph.options["fadein time"] + overlapping_in = false or allow_overlapping + end + + if self.is_last[edge] and not self.move_on_leave[edge] then + fadeout_duration = self.ugraph.options["fadeout time"] + overlapping_out = false or allow_overlapping + end + - -- Fade out: - if disappears < math.huge and (self.is_last[edge] or self.last_rep[edge])then - append_fade_animation(representative, 1, 0, fout.t_start,fout.t_end ) + if self.is_first[edge] + and (self.move_on_enter[edge.head] + or self.move_on_enter[edge.tail] ) + then + appears = snapshot.timestamp - minimum_rest_time + end + if self.is_last[edge] and + (self.move_on_leave[edge.head] + or self.move_on_leave[edge.tail] + ) then + disappears = snapshot.timestamp + minimum_rest_time + end + + local fin = compute_fade_times(appears, fadein_duration, overlapping_in,false) + local fout = compute_fade_times(disappears,fadeout_duration,overlapping_out,true) + + edge.animations = edge.animations or {} + + if representative~=edge then + table.insert(edge.animations,{ + attribute = "stage", + entries = { { t = 0, value = "false"}, }, + options = {}}) + end + + -- Fade in: + if appears > -math.huge and (edge == representative or self.is_first[edge]) then + append_fade_animation(representative, 0, 1, fin.t_start, fin.t_end ) + end + + -- Fade out: + if disappears < math.huge and (self.is_last[edge] or self.last_rep[edge])then + append_fade_animation(representative, 1, 0, fout.t_start,fout.t_end ) + end + end - end + end function GraphAnimationCoordination:precomputeNodes() local supergraph = self.supergraph - + for _, supernode in ipairs(supergraph.vertices) do - + local vis_nodes = {} self.visible_objects[supernode] = vis_nodes - + local any_previous_node = nil local previous_representant = nil local node_before = nil for i, s in ipairs(supergraph.snapshots) do - local node = supergraph:getSnapshotVertex(supernode, s) + local node = supergraph:getSnapshotVertex(supernode, s) if node then - -- assume the node is the last node - self.is_last[node] = true - - if node.options["modified"] then - -- modified - vis_nodes[s] = node - previous_representant = node - if any_previous_node then - self.last_rep[any_previous_node] = true - end - else - -- unmodified - previous_representant = previous_representant or node - vis_nodes[s] = previous_representant - end - any_previous_node = node - - if node_before then - self.is_last[node_before] = false - self.previous_node[node] = node_before - self.next_node[node_before] = node - - local do_move = (( node.pos.x ~= node_before.pos.x ) - or (node.pos.y ~= node_before.pos.y)) - self.move_on_enter[node] = do_move - self.move_on_leave[node_before] = do_move - else - self.is_first[node] = true - end - node_before = node + -- assume the node is the last node + self.is_last[node] = true + + if node.options["modified"] then + -- modified + vis_nodes[s] = node + previous_representant = node + if any_previous_node then + self.last_rep[any_previous_node] = true + end + else + -- unmodified + previous_representant = previous_representant or node + vis_nodes[s] = previous_representant + end + any_previous_node = node + + if node_before then + self.is_last[node_before] = false + self.previous_node[node] = node_before + self.next_node[node_before] = node + + local do_move = (( node.pos.x ~= node_before.pos.x ) + or (node.pos.y ~= node_before.pos.y)) + self.move_on_enter[node] = do_move + self.move_on_leave[node_before] = do_move + else + self.is_first[node] = true + end + node_before = node else - node_before = nil + node_before = nil end end end @@ -574,8 +574,8 @@ function GraphAnimationCoordination:precomputeEdges() local tail = arc.tail if not ( self.is_first[head] or self.is_first[tail]) then if not self.digraph:arc(self.previous_node[tail], self.previous_node[head]) then - -- new arc connects existing nodes - self.is_first[arc] = true + -- new arc connects existing nodes + self.is_first[arc] = true end else -- arc and at least one node is new. @@ -583,8 +583,8 @@ function GraphAnimationCoordination:precomputeEdges() end if not ( self.is_last[head] or self.is_last[tail]) then if not self.digraph:arc(self.next_node[tail],self.next_node[head]) then - -- arc disappears while nodes are still in the next snapshot - self.is_last[arc] = true + -- arc disappears while nodes are still in the next snapshot + self.is_last[arc] = true end else -- arc and at least one node disappears in the next snapshot @@ -603,34 +603,34 @@ function GraphAnimationCoordination:precomputeEdges() local previous_arc local previous_representant - + for _, s in ipairs(supergraph.arc_snapshots[superarc]) do - local head = supergraph:getSnapshotVertex(superarc.head, s) - local tail = supergraph:getSnapshotVertex(superarc.tail, s) - -- use the digraph because the snapshot arc is not synced - local arc = self.digraph:arc(tail, head) - - local modified = false - local opt_array = arc:optionsArray('modified') - for i = 1,#opt_array.aligned do - modified = modified or opt_array[i] - end - - if modified or - not eq_arc(arc, previous_arc) or self.is_first[arc] then - --modified - previous_representant = arc - vis_objects[s] = arc - if previous_arc then - self.last_rep[previous_arc] = true - end + local head = supergraph:getSnapshotVertex(superarc.head, s) + local tail = supergraph:getSnapshotVertex(superarc.tail, s) + -- use the digraph because the snapshot arc is not syncted + local arc = self.digraph:arc(tail, head) + + local modified = false + local opt_array = arc:optionsArray('modified') + for i = 1,#opt_array.aligned do + modified = modified or opt_array[i] + end + + if modified or + not eq_arc(arc, previous_arc) or self.is_first[arc] then + --modified + previous_representant = arc + vis_objects[s] = arc + if previous_arc then + self.last_rep[previous_arc] = true + end else - -- unmodified - previous_representant = previous_representant or arc - vis_objects[s] = previous_representant - end - previous_arc = arc - end + -- unmodified + previous_representant = previous_representant or arc + vis_objects[s] = previous_representant + end + previous_arc = arc + end end end -- Done diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/experimental/evolving/GreedyTemporalCycleRemoval.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/experimental/evolving/GreedyTemporalCycleRemoval.lua index 0c348bcc8fd..17c46aa352c 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/experimental/evolving/GreedyTemporalCycleRemoval.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/experimental/evolving/GreedyTemporalCycleRemoval.lua @@ -47,19 +47,19 @@ declare { algorithm = GreedyTemporalCycleRemoval, phase = "temporal cycle removal", phase_default = true, - summary = [[" - A temporal dependency cycle is a cyclic path in the supergraph of - an evolving graph. Use this key if you want remove all temporal - dependency cycles by a greedy strategy which incrementally inserts - edge checks if this edge creates a cycle and splits at least one node - into two supernode at a given time. + summary = [[" + A temporal dependency cycle is a cyclic path in the supergraph of + an evolving graph. Use this key if you want remove all temporal + dependency cycles by a greedy strategy which incrementally inserts + edge checks if this edge creates a cycle and splits at least one node + into two supernode at a given time. "]], - documentation = [[" - See ToDo + documentation = [[" + See ToDo "]] } --- Help functions +-- Helpfunctions local function reachable(graph, v, w) local visited = {} local queue = PriorityQueue.new() @@ -73,12 +73,12 @@ local function reachable(graph, v, w) for _, e in ipairs(outgoings) do local head = e.head if not visited[head] then - visited[head] = true - if head == w then - return true - else - queue:enqueue(head,1) - end + visited[head] = true + if head == w then + return true + else + queue:enqueue(head,1) + end end end end @@ -101,13 +101,13 @@ end -- Resolves all dependencies by splitting supernodes into multiple supernodes. -- To resolve a cycle each edge will be inserted into a dependency graph -- successively. Each time such edge closes a cycle the head and tail will --- be split at the related snapshot. +-- be splitet at the related snapshot. -- -- @param supergraph -- function GreedyTemporalCycleRemoval:iterativeCycleRemoval(supergraph, split_tail, split_head) -- Build up the global dependency graph - -- A supernode v directly depends on another supernode w if + -- A supernode v directly depends on another supernode w iff -- there is a snapshot in which w is a child of w local dependency_graph = Digraph.new(supergraph) local stable_arcs = {} @@ -115,57 +115,57 @@ function GreedyTemporalCycleRemoval:iterativeCycleRemoval(supergraph, split_tail --local tree = snapshot.spanning_tree for _,tree in ipairs(snapshot.spanning_trees) do local new_arcs = {} - + for _, e in ipairs(tree.arcs) do if e.head.kind ~= "dummy" and e.tail.kind~="dummy" then - table.insert(new_arcs, e) - - local sv = supergraph:getSupervertex(e.tail) - local sw = supergraph:getSupervertex(e.head) - local dep_arc = dependency_graph:arc(sv, sw) - - - if (not dep_arc) then - -- check if the edge v->w closes a cycle in the dependency graph - --pgf.debug{dependency_graph} - local cycle_arc = reachable(dependency_graph, sw, sv) - dep_arc = dependency_graph:connect(sv,sw) --- texio.write("\ncheck ".. sv.name.."->" .. sw.name) - if cycle_arc then - if split_tail then - supergraph:splitSupervertex(sv, { [1]=snapshot }) - end - if split_head then - supergraph:splitSupervertex(sw, { [1]=snapshot }) - end - - -- rebuild dependency graph - dependency_graph = Digraph.new(supergraph) - - for _, arc in ipairs(stable_arcs) do - dependency_graph:connect(arc.tail, arc.head) - end - - for _, arc in ipairs(new_arcs) do - local sv = supergraph:getSupervertex(arc.tail) - local sw = supergraph:getSupervertex(arc.head) - dependency_graph:connect(sv, sw) - end - end -- end of resolve cycle_arc - end + table.insert(new_arcs, e) + + local sv = supergraph:getSupervertex(e.tail) + local sw = supergraph:getSupervertex(e.head) + local dep_arc = dependency_graph:arc(sv, sw) + + + if (not dep_arc) then + -- check if the edge v->w closes a cycle in the dependencygraph + --pgf.debug{dependency_graph} + local cycle_arc = reachable(dependency_graph, sw, sv) + dep_arc = dependency_graph:connect(sv,sw) +-- texio.write("\ncheck ".. sv.name.."->" .. sw.name) + if cycle_arc then + if split_tail then + supergraph:splitSupervertex(sv, { [1]=snapshot }) + end + if split_head then + supergraph:splitSupervertex(sw, { [1]=snapshot }) + end + + -- rebuild dependency graph + dependency_graph = Digraph.new(supergraph) + + for _, arc in ipairs(stable_arcs) do + dependency_graph:connect(arc.tail, arc.head) + end + + for _, arc in ipairs(new_arcs) do + local sv = supergraph:getSupervertex(arc.tail) + local sw = supergraph:getSupervertex(arc.head) + dependency_graph:connect(sv, sw) + end + end -- end of resovle cycle_arc + end end end -- Stable Arcs: for _, arc in ipairs(new_arcs) do - + local sv = supergraph:getSupervertex(arc.tail) local sw = supergraph:getSupervertex(arc.head) local deparc = dependency_graph:arc(sv, sw) -- if not deparc or not stable_arcs[deparc] then --- stable_arcs[deparc] = true - table.insert(stable_arcs, deparc) +-- stable_arcs[deparc] = true + table.insert(stable_arcs, deparc) -- end - + end end -- end for spanning_tree end -- end for snapshot diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/experimental/evolving/Skambath2016.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/experimental/evolving/Skambath2016.lua index 2beec1e216e..23bbdf36a8c 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/experimental/evolving/Skambath2016.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/experimental/evolving/Skambath2016.lua @@ -6,7 +6,7 @@ -- 2. under the GNU Public License -- -- See the file doc/generic/pgf/licenses/LICENSE for more information --- +-- -- Imports require "pgf.gd.trees.ChildSpec" @@ -17,7 +17,7 @@ local Vertex = require "pgf.gd.model.Vertex" local declare = require("pgf.gd.interface.InterfaceToAlgorithms").declare local layered = require "pgf.gd.layered" local tlayered = require "pgf.gd.experimental.evolving.layered" -local SpanningTreeComputation = require "pgf.gd.trees.SpanningTreeComputation" +local SpanningTreeComputation = require "pgf.gd.trees.SpanningTreeComputation" local lib = require "pgf.gd.lib" local Storage = require "pgf.gd.lib.Storage" @@ -71,19 +71,19 @@ declare { --- Help functions +-- Helpfunctions --- -- Borders models the borderlines / the line of border vertices -- of a tree or subtree structure which can change over time. -- Each ordered and rooted tree or subtree has vertices per layer for which they --- are on the outer places. On the left or respectively on the right. +-- are on the outer places. On the left or respectivly on the right. -- The field |left| and |right| stores the both borderlines. -- A \emph{borderline} is an array. This array contains for each layer of the tree -- a table mapping a given snapshot to the related border-vertex of the layer -- in the snapshot. --- --- @field left +-- +-- @field left -- @field right -- local Borders = {} @@ -136,7 +136,7 @@ function Borders.copyBordersAtSnapshot(source, target, snapshot) level_border_left = target.left[i] or {} level_border_right = target.right[i] or {} assert(not level_border_left[snapshot] and not level_border_right[snapshot], - "border for a given snapshot already defined") + "border for a given snapshat already defined") level_border_left[snapshot] = source.left[i][snapshot] level_border_right[snapshot] = source.right[i][snapshot] target.left[i] = level_border_left @@ -149,7 +149,7 @@ end -- placed on the right next to the existing borders. For each level -- and time in which the group has a border the borders on the right -- will be replaced with this border. If it is not existing in the old --- borders then also the left border will be adapted +-- borders then also the left border will be adapted -- -- @param borders The existing borders. These will be modified with -- the borders of @@ -164,27 +164,27 @@ local function adapt_borders(borders, group_borders, snapshots, ignore_dummies) local r = borders.right[level] or {} for _, s in pairs(snapshots) do if ignore_dummies then - local gls,grs = group_borders.left[level][s], group_borders.right[level][s] - if gls~=nil then - if gls.kind~="dummy" then - l[s] = l[s] or gls - end - end - if grs~=nil then - if grs.kind~="dummy" then - r[s] = grs or r[s] - end - end + local gls,grs = group_borders.left[level][s], group_borders.right[level][s] + if gls~=nil then + if gls.kind~="dummy" then + l[s] = l[s] or gls + end + end + if grs~=nil then + if grs.kind~="dummy" then + r[s] = grs or r[s] + end + end else - l[s] = l[s] or group_borders.left[level][s] - r[s] = group_borders.right[level][s] or r[s] + l[s] = l[s] or group_borders.left[level][s] + r[s] = group_borders.right[level][s] or r[s] end - + end borders.left[level] = l borders.right[level] = r end - + end -- @@ -211,16 +211,16 @@ end local function shift_group(shift, group, snapshots, descendants) assert(group,"no group passed") assert(shift~=math.huge and shift ~=-math.huge, - "shift must be a valid finite length") + "shift must be a valid finit length") local shifted = {} -- remember which vertex was shifted during this run local anchor = -math.huge for _, s in ipairs(snapshots) do - local v = group[s] - if not shifted[v] and v then + local v = group[s] + if not shifted[v] and v then v.pos.x = v.pos.x + shift shifted[v] = true - -- also shift all descendants of the group vertex + -- also shift all descendants of the group vertex for _, d in ipairs(descendants[v]) do if not shifted[d] then d.pos.x = d.pos.x + shift @@ -228,28 +228,28 @@ local function shift_group(shift, group, snapshots, descendants) end end anchor = math.max(anchor, v.pos.x ) - end + end end return anchor end -- --- Traverse through the spanning tree |tree| of a snapshot and sort --- the child nodes into groups. A group summarizes for a given parent +-- Traverse through the spanneng tree |tree| of a snapshot and sort +-- the child nodes into groups. A group summarises for a given parent -- node all children node over time that are at the same child -- position. The k-th child group groups[i] maps each snapshot to the -- k-th node in the related snapshot. -- -- -- @field supergraph the supergraph --- +-- -- @field tree the tree or spanning tree to decide the indices of the -- child nodes -- -- @field childgroups a Storage which contains the list of childgroups -- for each supernode -- --- @field snapshot +-- @field snapshot -- local function precompute_childgroups(supergraph, tree, node, childgroups, snapshot) local outgoings = tree:outgoing(node) @@ -257,7 +257,7 @@ local function precompute_childgroups(supergraph, tree, node, childgroups, snaps local supervertex = supergraph:getSupervertex(node) local groups = childgroups[supervertex] or {} for i, e in ipairs(outgoings) do - + group = groups[i] or {} assert(e.head, "no edge") group[snapshot] = e.head @@ -274,7 +274,7 @@ end -- vertices in a tree by accumulation of the relative shifts on the -- path from the root to the vertex recursively. -- --- @param tree the tree in which the vertex's position should be +-- @param tree the tree in which the vertice's position should be -- computed. -- -- @param vertex the next vertex that gets its absolute coordinate. @@ -302,7 +302,7 @@ local function get_next(border_pair, next) local nr = next.right[border_pair.right] assert ((nl and nr) or (not nl and not nr)) return {left = nl, right = nr, - } + } end local function add_shift(abs_shift, border_pair, next) @@ -325,25 +325,25 @@ function Skambath2016:computeRequiredDistance(tree, vertex, i, shifts, next) if clumb.right.kind=="dummy" then shifts[clumb.right] = 0 end local v0 = outgoings[i].head local v1 = outgoings[i+1].head - local shift = layered.ideal_sibling_distance(self.adjusted_bb, self.ugraph, v0, v1) + shifts[clumb.right] + local shift = layered.ideal_sibling_distance(self.adjusted_bb, self.ugraph, v0, v1) + shifts[clumb.right] local last0 = {left = clumb.left, right = clumb.right} - local last1 = {left = v1, right = v1} + local last1 = {left = v1, right = v1} local next0 = get_next(last0, next) local next1 = get_next(last1, next) local abs_shift0 = {left = shifts[clumb.left], right = shifts[clumb.right]} - local abs_shift1 = {left = 0, right = 0} + local abs_shift1 = {left = 0, right = 0} while (next0.left and next1.left) do add_shift(abs_shift0, last0, next) add_shift(abs_shift1, last1, next) shift = math.max(shift, - layered.ideal_sibling_distance(self.adjusted_bb, - self.ugraph, - next0.right, - next1.left) - + abs_shift0.right - abs_shift1.left) --- texio.write("\n | "..(next0.right.name or "dummy").."<->"..(next1.left.name or "dummy").." :\t"..shift) + layered.ideal_sibling_distance(self.adjusted_bb, + self.ugraph, + next0.right, + next1.left) + + abs_shift0.right - abs_shift1.left) +-- texio.write("\n | "..(next0.right.name or "dummy").."<->"..(next1.left.name or "dummy").." :\t"..shift) last0, last1 = next0, next1 next0 = get_next(next0, next) next1 = get_next(next1, next) @@ -383,7 +383,7 @@ local function apply_shift(tree, vertex, i, shifts, next, border_ptr, shift) next.left[last0.left] = next1.left -- pgf.debug{last0,abs0,abs1,last1} next.left_shift[last0.left] = shift - abs0.left + (abs1.left + next.left_shift[last1.left] ) - + else -- both trees have the same height end @@ -398,11 +398,11 @@ function Skambath2016:run() local childgroups = Storage.new() local phases = self.digraph.options.algorithm_phases - + local so_class = phases['supergraph optimization'] local ga_class = phases['evolving graph animation'] local cr_class = phases['temporal cycle removal'] - + self.extended_version = self.digraph.options['missing nodes get space'] self.supergraph = Supergraph.generateSupergraph(self.digraph) local supergraph_original = Supergraph.generateSupergraph(self.digraph) @@ -414,8 +414,8 @@ function Skambath2016:run() digraph = self.digraph, ugraph = self.ugraph }:run() - - + + self:precomputeSpanningTrees() -- Resolve cyclic dependencies if exists. @@ -432,13 +432,13 @@ function Skambath2016:run() self:computeHorizontalLayout(childgroups, descendants) -- self:computeHorizontalLayoutFast() - - -- vertical positions + + -- vertical positions tlayered.arrange_layers_by_baselines(layers, - self.adjusted_bb, - self.ugraph, - self.supergraph.snapshots, - self.supergraph.vertex_snapshots) + self.adjusted_bb, + self.ugraph, + self.supergraph.snapshots, + self.supergraph.vertex_snapshots) -- animate graph ga_class.new { @@ -446,11 +446,11 @@ function Skambath2016:run() supergraph = supergraph_original, digraph = self.digraph, ugraph = self.ugraph - }:run() + }:run() end -- --- Compute the required shift value for a second tree to guarantee +-- Compute the required shift value for a second tree to garuantee -- a required node distance. -- @field right_borders The Border data structure for the right border of -- the left tree @@ -465,11 +465,11 @@ function Skambath2016:computeMinShift(right_borders, left_borders, selected_snap local max_level = math.min(#right_borders, #left_borders) local first_shift = 0 local snapshots = selected_snapshots or self.supergraph.snapshots - + for layer = 1, max_level do local rb, lb = right_borders[layer], left_borders[layer] for _,s in ipairs(snapshots) do - + local v1,v2 = rb[s],lb[s] if v1 and v2 then local local_shift = layered.ideal_sibling_distance(self.adjusted_bb, self.ugraph, v1, v2) + v1.pos.x - v2.pos.x @@ -497,7 +497,7 @@ function Skambath2016:computeMinShift(right_borders, left_borders, selected_snap if is_significant then shift = shift + self.ugraph.options['significant sep'] end - + return shift end @@ -521,20 +521,20 @@ function Skambath2016:computeHorizontalLayout(groups, descendants) end -- 1. Initialize Dependencies - + for _, snapshot in ipairs(self.supergraph.snapshots) do for _, spanning_tree in ipairs(snapshot.spanning_trees) do for _, arc in ipairs(spanning_tree.arcs) do - - local head = self.supergraph:getSupervertex(arc.head) - local tail = self.supergraph:getSupervertex(arc.tail) - - if(head and tail) then - if not dependency_graph:arc(tail, head) then - dependency_graph:connect(tail, head) - dep_counter[tail] = dep_counter[tail] + 1 - end - end + + local head = self.supergraph:getSupervertex(arc.head) + local tail = self.supergraph:getSupervertex(arc.tail) + + if(head and tail) then + if not dependency_graph:arc(tail, head) then + dependency_graph:connect(tail, head) + dep_counter[tail] = dep_counter[tail] + 1 + end + end end end end @@ -546,19 +546,19 @@ function Skambath2016:computeHorizontalLayout(groups, descendants) queue:enqueue(vertex, 1) end end - - -- 2. + + -- 2. while not queue:isEmpty() do - local vertex = queue:dequeue() + local vertex = queue:dequeue() local vertex_snapshots = self.supergraph:getSnapshots(vertex) - + -- a. Resolve dependencies on this vertex: local incomings = dependency_graph:incoming(vertex) - for _, e in ipairs(incomings) do + for _, e in ipairs(incomings) do dep_counter[e.tail] = dep_counter[e.tail] - 1 if dep_counter[e.tail] == 0 then - queue:enqueue(e.tail, 1) - end + queue:enqueue(e.tail, 1) + end end -- b. Compute borders of this supervertex: @@ -569,63 +569,63 @@ function Skambath2016:computeHorizontalLayout(groups, descendants) snapshot_vertex.pos.x = 0 snapshot_vertex.pos.y = 0 end - + local vertex_groups = groups[vertex] local last_pos_x = 0 if vertex_groups then -- c. Compute borders of groups: local all_group_borders = {} for i, group in ipairs(vertex_groups) do - local group_boders = Borders.new() - for _,s in ipairs(vertex_snapshots) do - local child = group[s] - if child then - local child_borders - if not (child.kind == "dummy") then - local superchild = self.supergraph:getSupervertex(child) - child_borders = subtree_borders[superchild] or Borders.new() - else - child_borders = Borders.new() - child_borders:addBoth(1, s, child) - end - assert(child.pos~=math.huge, "invalid child pos") - shift_group(-child.pos.x,{[s]=child},{[1]=s}, descendants) - Borders.copyBordersAtSnapshot(child_borders, group_boders, s) - end - end - all_group_borders[i] = group_boders + local group_boders = Borders.new() + for _,s in ipairs(vertex_snapshots) do + local child = group[s] + if child then + local child_borders + if not (child.kind == "dummy") then + local superchild = self.supergraph:getSupervertex(child) + child_borders = subtree_borders[superchild] or Borders.new() + else + child_borders = Borders.new() + child_borders:addBoth(1, s, child) + end + assert(child.pos~=math.huge, "invalid child pos") + shift_group(-child.pos.x,{[s]=child},{[1]=s}, descendants) + Borders.copyBordersAtSnapshot(child_borders, group_boders, s) + end + end + all_group_borders[i] = group_boders end - + -- d. Place groups and merge borders of groups: local last_group = nil last_pos_x = 0 local merged_borders = Borders.new() local final_borders = Borders.new() for i, group in ipairs(vertex_groups) do - local group_borders = all_group_borders[i] - if last_group_borders then - -- i. compute minimal shift - - local shift - shift = self:computeMinShift(merged_borders.right, group_borders.left) - - - assert(shift ~= math.huge and shift~=-math.huge, "invalid shift") - - -- ii. shift group - local anchor = shift_group(shift, group,vertex_snapshots, descendants) - last_pos_x = anchor - end - last_group_borders = group_borders - - -- iii. adapt borders - adapt_borders(merged_borders, - group_borders, - self.supergraph.snapshots) - adapt_borders(final_borders, - group_borders, - self.supergraph.snapshots, - not self.extended_version) + local group_borders = all_group_borders[i] + if last_group_borders then + -- i. compute minimal shift + + local shift + shift = self:computeMinShift(merged_borders.right, group_borders.left) + + + assert(shift ~= math.huge and shift~=-math.huge, "invalid shift") + + -- ii. shift group + local anchor = shift_group(shift, group,vertex_snapshots, descendants) + last_pos_x = anchor + end + last_group_borders = group_borders + + -- iii. adapt borders + adapt_borders(merged_borders, + group_borders, + self.supergraph.snapshots) + adapt_borders(final_borders, + group_borders, + self.supergraph.snapshots, + not self.extended_version) end -- for (group) vertex_borders:appendBelow(1, final_borders) end @@ -637,24 +637,24 @@ function Skambath2016:computeHorizontalLayout(groups, descendants) local snapshot_vertex = self.supergraph:getSnapshotVertex(vertex, s) snapshot_vertex.pos.x = x end - - subtree_borders[vertex] = vertex_borders + + subtree_borders[vertex] = vertex_borders end - -- align roots + -- align roots for _, s in ipairs(self.supergraph.snapshots) do local lastroot - local rborder + local rborder for i, spanning_tree in ipairs(s.spanning_trees) do local root = spanning_tree.root local rootborders = subtree_borders[self.supergraph:getSupervertex(root)] shift_group(-root.pos.x,{[s]=root},{[1]=s}, descendants) if i>1 then - local l = subtree_borders[self.supergraph:getSupervertex(lastroot)] - local r = rootborders - shift = math.max(self:computeMinShift(l.right, r.left, {[1]=s}), - self:computeMinShift(rborder.right,r.left, {[1]=s})) - shift_group(shift,{[s]=root},{[1]=s}, descendants) + local l = subtree_borders[self.supergraph:getSupervertex(lastroot)] + local r = rootborders + shift = math.max(self:computeMinShift(l.right, r.left, {[1]=s}), + self:computeMinShift(rborder.right,r.left, {[1]=s})) + shift_group(shift,{[s]=root},{[1]=s}, descendants) else rborder = Borders.new() end @@ -684,28 +684,28 @@ function Skambath2016:computeHorizontalLayoutFast() dependency_graph:add {vertex} end - + -- I. Initialize Dependencies (Build Dependency Graph) for _, snapshot in ipairs(self.supergraph.snapshots) do for _, spanning_tree in ipairs(snapshot.spanning_trees) do table.insert(all_trees, spanning_tree) shifts[spanning_tree] = Storage.new() next[spanning_tree] = {left= Storage.new(), - right= Storage.new(), - left_shift = Storage.new(), - right_shift = Storage.new() + right= Storage.new(), + left_shift = Storage.new(), + right_shift = Storage.new() } - + for _, arc in ipairs(spanning_tree.arcs) do - local head = self.supergraph:getSupervertex(arc.head) - local tail = self.supergraph:getSupervertex(arc.tail) - - if(head and tail) then - if not dependency_graph:arc(tail, head) then - dependency_graph:connect(tail, head) - dep_counter[tail] = dep_counter[tail] + 1 - end - end + local head = self.supergraph:getSupervertex(arc.head) + local tail = self.supergraph:getSupervertex(arc.tail) + + if(head and tail) then + if not dependency_graph:arc(tail, head) then + dependency_graph:connect(tail, head) + dep_counter[tail] = dep_counter[tail] + 1 + end + end end end end @@ -718,21 +718,21 @@ function Skambath2016:computeHorizontalLayoutFast() queue:enqueue(vertex, 1) end end - + while not queue:isEmpty() do -- Next node in topological order local vertex = queue:dequeue() -- texio.write("\n\n --- "..vertex.name .. " ---") --pgf.debug{next} local vertex_snapshots = self.supergraph:getSnapshots(vertex) - + -- a. Resolve dependencies on this vertex: local incomings = dependency_graph:incoming(vertex) - for _, e in ipairs(incomings) do + for _, e in ipairs(incomings) do dep_counter[e.tail] = dep_counter[e.tail] - 1 if dep_counter[e.tail] == 0 then - queue:enqueue(e.tail, 1) - end + queue:enqueue(e.tail, 1) + end end -- b. Compute maximum number of children over time: @@ -743,7 +743,7 @@ function Skambath2016:computeHorizontalLayoutFast() num_children = math.max(num_children, #(tree:outgoing(v))) shifts[tree][v] = 0 end - + -- c. Shift all subtrees in all snapshots: local hlp_ptr = Storage.new() local max_shift = 0 @@ -751,27 +751,27 @@ function Skambath2016:computeHorizontalLayoutFast() -- i) Compute the necessary shift between the i-th and (i+1)-th subtrees (per snapshot): local min_shift = 0 for t, s in ipairs(vertex_snapshots) do - local snapshot_vertex = self.supergraph:getSnapshotVertex(vertex, s) - local tree = s.spanning_trees[1] - local req_shift, hptr - req_shift, hptr = self:computeRequiredDistance(tree, - snapshot_vertex, - i, - shifts[tree], - next[tree] - ) - hlp_ptr[t] = hptr --- texio.write(" -> \t"..req_shift) - min_shift = math.max(min_shift, req_shift) + local snapshot_vertex = self.supergraph:getSnapshotVertex(vertex, s) + local tree = s.spanning_trees[1] + local req_shift, hptr + req_shift, hptr = self:computeRequiredDistance(tree, + snapshot_vertex, + i, + shifts[tree], + next[tree] + ) + hlp_ptr[t] = hptr +-- texio.write(" -> \t"..req_shift) + min_shift = math.max(min_shift, req_shift) end -- texio.write("\n \t\t".. min_shift ) - - -- ii) Synchronize distance between neighbored subtrees and apply shifts + + -- ii) Synchronize distance between neigbored subtrees and apply shifts for t, s in ipairs(vertex_snapshots) do - local snapshot_vertex = self.supergraph:getSnapshotVertex(vertex, s) - local tree = s.spanning_trees[1] - apply_shift(tree, snapshot_vertex, i, shifts[tree], next[tree], hlp_ptr[t], min_shift) + local snapshot_vertex = self.supergraph:getSnapshotVertex(vertex, s) + local tree = s.spanning_trees[1] + apply_shift(tree, snapshot_vertex, i, shifts[tree], next[tree], hlp_ptr[t], min_shift) end max_shift = min_shift @@ -781,22 +781,22 @@ function Skambath2016:computeHorizontalLayoutFast() local snapshot_vertex = self.supergraph:getSnapshotVertex(vertex, s) local tree = s.spanning_trees[1] local outgoings = tree:outgoing(snapshot_vertex) - + -- next[tree].left[snapshot_vertex] = outgoings[1].head for i = 1,#outgoings do - if i==1 then - next[tree].left_shift[snapshot_vertex] = - max_shift / 2 - next[tree].left[snapshot_vertex]= outgoings[i].head - end - shifts[tree][outgoings[i].head] = shifts[tree][outgoings[i].head] - max_shift / 2 - next[tree].right[snapshot_vertex] = outgoings[i].head - next[tree].right_shift[snapshot_vertex] = shifts[tree][outgoings[i].head] + if i==1 then + next[tree].left_shift[snapshot_vertex] = - max_shift / 2 + next[tree].left[snapshot_vertex]= outgoings[i].head + end + shifts[tree][outgoings[i].head] = shifts[tree][outgoings[i].head] - max_shift / 2 + next[tree].right[snapshot_vertex] = outgoings[i].head + next[tree].right_shift[snapshot_vertex] = shifts[tree][outgoings[i].head] end - + end - + end -- end while (all vertices have been processed) -- III. Accumulate absolute horizontal coordinates @@ -832,7 +832,7 @@ end -- --- +-- -- function Skambath2016:precomputeChildgroups(childgroups) for _,s in ipairs(self.supergraph.snapshots) do @@ -849,8 +849,8 @@ end -- function Skambath2016:precomputeSpanningTrees() local events = assert(self.scope.events, - "no events found for the spanning tree computation") - + "no events found for the spanning tree computation") + for i, s in ipairs(self.supergraph.snapshots) do -- The involved snapshot graph: local s_copy = Digraph.new(s) diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/experimental/evolving/Supergraph.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/experimental/evolving/Supergraph.lua index 99e79919b54..490b8b3191d 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/experimental/evolving/Supergraph.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/experimental/evolving/Supergraph.lua @@ -27,12 +27,12 @@ local declare = require("pgf.gd.interface.InterfaceToAlgorithms").declare -- and if there is a single snapshot in which two vertices are -- connected by an edge they are connected in the supergraph. -- --- Note that in \tikzname\ a \emph{node} is more than a single dot. A node +-- Note that in TikZ a \emph{node} is more than a single dot. A node -- has a content and different properties like background-color or a --- shape. Formally this can be modeled by function mapping vertices +-- shape. Formally this can be modelled by function mapping vertices -- to their properties. For evolving graphs this could be done in the --- same way. As this is difficult to be realized in PGF because there --- is no basic support for time dependent properties on nodes, each +-- same way. As this is difficult to be realised in PGF because there +-- is no basic support for time dependend properties on nodes, each -- vertex will be displayed over time by different single -- (snapshot-)nodes which can have different visual properties. This -- means for a vertex which we call |supervertex| in the following we @@ -53,7 +53,7 @@ local declare = require("pgf.gd.interface.InterfaceToAlgorithms").declare -- @field supervertices_by_id This storage maps a node identifier to the -- related supervertex such that PGF-nodes which belonging to -- the same superverticex can be identified --- +-- -- @field snapshots An array of all snapshots. Sorted in ascending order -- over the timestamps of the snapshots. -- @@ -64,7 +64,6 @@ local declare = require("pgf.gd.interface.InterfaceToAlgorithms").declare -- Assume we want to iterate over all snapshots -- for a certain pair of supernodes in which they are connected -- by an arc. The arc_snapshots storage helps in this case: --- % -- \begin{codeexample}[code only, tikz syntax=false] -- local supergraph = Supergraph.generateSupergraph(self.digraph) -- local u = supergraph.vertices[1] @@ -111,24 +110,24 @@ local get_snapshot -- -- @param snapshots An array of all existing snapshots -- @param timestamps A table which maps known timestamps to their --- related snapshots +-- related snapshots -- @param ugraph The ugraph of the underlying graph structure -- @param snapshot_time -- -- @return The snapshot instance found in the snapshots array for the --- wanted timestamp snapshot_time if it doesn't exists a new snapshot --- will be generated and added to the arrays +-- wanted timestamp snapshot_time if it does'nt exists a new snapshot +-- will be generated and added to the arrays -- function get_snapshot(snapshots, timestamps, ugraph, snapshot_time) local snapshot local snapshot_idx = timestamps[snapshot_time] - + if not snapshot_idx then -- store snapshot if it doesn't exists - snapshot_idx = timestamps.n + 1 + snapshot_idx = timestamps.n + 1 timestamps[snapshot_time] = snapshot_idx timestamps.n = timestamps.n + 1 - snapshot = Digraph.new { + snapshot = Digraph.new { syntactic_digraph = ugraph.syntactic_digraph, options = ugraph.options } @@ -137,7 +136,7 @@ function get_snapshot(snapshots, timestamps, ugraph, snapshot_time) else snapshot = snapshots[snapshot_idx] end - assert(snapshot~=nil, "an unexpected error occurred") + assert(snapshot~=nil, "an unexpected error occured") return snapshot end @@ -153,7 +152,7 @@ end -- -- @return The supergraph which is a |Digraph| that has a supervertex -- for each set of snapshot-vertices with the same |supernode| --- attribute. +-- attribute. -- function Supergraph.generateSupergraph(digraph) local new_supergraph @@ -162,35 +161,35 @@ function Supergraph.generateSupergraph(digraph) options = digraph.options, digraph = digraph, } - - -- array to store the supervertices for a given vertex name + + -- array to store the supervertices for a given vertex name local local_snapshots = {} -- array to store each snapshot graphs - + local timestamps = { n = 0 } -- set of snapshot times - -- separate and assign vertices to their snapshots and supervertices + -- separate and assign vertices to their snapshots and supervertives for i,vertex in ipairs(digraph.vertices) do local snapshot_time = assert(vertex.options["snapshot"], "Missing option 'snapshot' for vertex ".. vertex.name ..". ") local supernode_name = assert(vertex.options["supernode"], "Missing option 'supernode' for vertex"..vertex.name..". ") - + local snapshot = get_snapshot(local_snapshots, timestamps, digraph, snapshot_time) local supervertex = new_supergraph.supervertices_by_id[supernode_name] - + if not supervertex then - -- first appearance of the supernode id - supervertex = Vertex.new { - kind = "super", - name = supernode_name + -- first appeareance of the supernode id + supervertex = Vertex.new { + kind = "super", + name = supernode_name } supervertex.snapshots = {} supervertex.subvertex = {} - new_supergraph.supervertices_by_id[supernode_name] = supervertex + new_supergraph.supervertices_by_id[supernode_name] = supervertex new_supergraph:add{supervertex} supervertex.options = {} supervertex.options = vertex.options - end - + end + snapshot:add{vertex} new_supergraph.supervertices[vertex] = supervertex @@ -199,11 +198,11 @@ function Supergraph.generateSupergraph(digraph) end -- Create edges - for i, e in ipairs(digraph.arcs) do + for i, e in ipairs(digraph.arcs) do local u,v = e.tail, e.head local snapshot_tail = new_supergraph.vertex_snapshots[e.tail] local snapshot_head = new_supergraph.vertex_snapshots[e.head] - + assert(snapshot_head == snapshot_tail, "Arcs must connect nodes that exist at the same time.") -- connect in the snapshot graph @@ -212,18 +211,18 @@ function Supergraph.generateSupergraph(digraph) -- connect in the supergraph: local super_tail = new_supergraph.supervertices[u] local super_head = new_supergraph.supervertices[v] - + new_supergraph:assignToSuperarc(super_tail, super_head, snapshot_tail) end - + -- snapshots in temporal order - table.sort(local_snapshots, + table.sort(local_snapshots, function(s1,s2) return s1.timestamp < s2.timestamp end ) - - local previous_snapshot - + + local previous_snapshot + for i,s in ipairs(local_snapshots) do local start = -math.huge if previous_snapshot then @@ -236,18 +235,18 @@ function Supergraph.generateSupergraph(digraph) new_supergraph.snapshots = local_snapshots new_supergraph.snapshots_indices = Storage.new() - + for i, s in ipairs(new_supergraph.snapshots) do new_supergraph.snapshots_indices[s] = i end - + return new_supergraph end function Supergraph:getSnapshotStaticDuration(snapshot) assert(snapshot, "a snapshot as parameter expected, but got nil") - local idur = snapshot.interval.to - snapshot.interval.from + local idur = snapshot.interval.to - snapshot.interval.from assert(idur, "unexpected nil-value") local d1 = snapshot.interval.to - snapshot.timestamp local d2 = snapshot.timestamp - snapshot.interval.from @@ -273,9 +272,9 @@ function Supergraph:getDuration() end --- --- +-- -- @return The ratio of the time of a snapshot related to the global duration of the whole --- evolving trees. (The time between the last and first snapshot) +-- evlolving trees. (The time between the last and first snapshot) function Supergraph:getSnapshotRelativeDuration(snapshot) if self:getDuration() == 0 then return 1 @@ -295,7 +294,7 @@ end function Supergraph:getSupervertex(vertex) assert(vertex, "vertex required") assert(self.supervertices, "supervertex table is not defined") - return self.supervertices[vertex] + return self.supervertices[vertex] end function Supergraph:getSuperarc(arc) @@ -323,7 +322,7 @@ end --- -- For a given supervertex get the related vertex for a snapshot -- --- @param supervertex +-- @param supervertex -- -- @param snapshot -- @@ -341,7 +340,7 @@ function Supergraph:consecutiveSnapshots(snapshot1, snapshot2, n) local idx1 = self.snapshots_indices[snapshot1] --or -1 local idx2 = self.snapshots_indices[snapshot2] --or -1 local d = n or 1 - + return (idx2-idx1 <= d) or (idx1-idx2 <= d) end @@ -359,21 +358,21 @@ end -- their positions from the supergraph. -- function Supergraph:sharePositions(ugraph, ignore) - + for _,vertex in ipairs(ugraph.vertices) do if not ignore then vertex.pos.x = self.supervertices[vertex].pos.x vertex.pos.y = self.supervertices[vertex].pos.y else if not ignore.x then - vertex.pos.x = self.supervertices[vertex].pos.x + vertex.pos.x = self.supervertices[vertex].pos.x end if not ignore.y then - vertex.pos.y = self.supervertices[vertex].pos.y + vertex.pos.y = self.supervertices[vertex].pos.y end end - - + + end end @@ -381,7 +380,7 @@ function Supergraph:onAllSnapshotvertices(f, ugraph) for _,vertex in ipairs(ugraph.vertices) do local snapshot_vertex = self.supertvertices[vertex] if snapshot_vertex then - f(vertex, snapshot_vertex) + f(vertex, snapshot_vertex) end end end @@ -395,23 +394,23 @@ end -- the original vertex. -- If a supervertex has no subvertices then it will not be added to the graph. -- --- @param supervertex The supervertex which should be split. +-- @param supervertex The supervertex which should be splitted. -- -- @param snapshots An array of snapshots at which the supervertex --- should be split into a new one with the corresponding pgf-vertices. +-- should be splitted into a new one with the corresponding pgf-vertices. -- If there are more than one snapshots passed to the function -- for each snapshot there will be a new pseudo-vertex -- function Supergraph:splitSupervertex(supervertex, snapshots) assert(supervertex, "no supervertex defined") -- snapshots in temporal order - table.sort(snapshots, + table.sort(snapshots, function(s1,s2) return s1.timestamp < s2.timestamp end ) assert(#snapshots~=0) - + local edit_snapshots = supervertex.snapshots local first_removed = math.huge local rem_arcs = {} @@ -438,42 +437,42 @@ function Supergraph:splitSupervertex(supervertex, snapshots) local s = self.snapshots[j] local vertex = self:getSnapshotVertex(supervertex, s) if vertex then - self.supervertices[vertex] = pseudovertex - self:addSnapshotVertex(pseudovertex, s, vertex) - self:removeSnapshotVertex(supervertex, s) - - if not has_subvertices then - has_subvertices = true - self:add{pseudovertex} - end - - -- update edges: - local incoming = self.digraph:incoming(vertex) - local outgoing = self.digraph:outgoing(vertex) - - for _, arc in ipairs(incoming) do - local tail = self.supervertices[arc.tail] - local head = self.supervertices[arc.head] - self:assignToSuperarc(tail, pseudovertex, s) - - local super_arc = self:arc(tail, supervertex) - if not rem_arcs[super_arc] then - table.insert(rem_arcs, {arc = super_arc, snapshot = s}) - rem_arcs[super_arc] = true - end - end - - for _, arc in ipairs(outgoing) do - local tail = self.supervertices[arc.tail] - local head = self.supervertices[arc.head] - self:assignToSuperarc(pseudovertex, head, s) - - local super_arc = self:arc(supervertex, head) - if not rem_arcs[super_arc] then - table.insert(rem_arcs, {arc = super_arc, snapshot = s}) - rem_arcs[super_arc] = true - end - end + self.supervertices[vertex] = pseudovertex + self:addSnapshotVertex(pseudovertex, s, vertex) + self:removeSnapshotVertex(supervertex, s) + + if not has_subvertices then + has_subvertices = true + self:add{pseudovertex} + end + + -- update edges: + local incoming = self.digraph:incoming(vertex) + local outgoing = self.digraph:outgoing(vertex) + + for _, arc in ipairs(incoming) do + local tail = self.supervertices[arc.tail] + local head = self.supervertices[arc.head] + self:assignToSuperarc(tail, pseudovertex, s) + + local super_arc = self:arc(tail, supervertex) + if not rem_arcs[super_arc] then + table.insert(rem_arcs, {arc = super_arc, snapshot = s}) + rem_arcs[super_arc] = true + end + end + + for _, arc in ipairs(outgoing) do + local tail = self.supervertices[arc.tail] + local head = self.supervertices[arc.head] + self:assignToSuperarc(pseudovertex, head, s) + + local super_arc = self:arc(supervertex, head) + if not rem_arcs[super_arc] then + table.insert(rem_arcs, {arc = super_arc, snapshot = s}) + rem_arcs[super_arc] = true + end + end end end end @@ -482,14 +481,14 @@ function Supergraph:splitSupervertex(supervertex, snapshots) for _, removed_arc in ipairs(rem_arcs) do local snapshots = self.arc_snapshots[removed_arc.arc] for i=#snapshots,1,-1 do - local s = snapshots[i] - if s.timestamp >= removed_arc.snapshot.timestamp then - table.remove(snapshots, i) - end + local s = snapshots[i] + if s.timestamp >= removed_arc.snapshot.timestamp then + table.remove(snapshots, i) + end end if #snapshots==0 then - self:disconnect(removed_arc.arc.tail, removed_arc.arc.head) + self:disconnect(removed_arc.arc.tail, removed_arc.arc.head) end end end @@ -554,16 +553,16 @@ end -- function Supergraph:assignToSuperarc(super_tail, super_head, snapshot) assert(self:contains(super_tail) and self:contains(super_head), - "tried to connect supernodes not in the supergraph") - + "tried to connect supernodes not in the supergraph") + local super_arc = self:arc(super_tail, super_head) if not super_arc then - super_arc = self:connect(super_tail, super_head) + super_arc = self:connect(super_tail, super_head) end - + table.insert(self.arc_snapshots[super_arc], snapshot) self.arc_snapshots[super_arc][snapshot] = true - + return super_arc end diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/experimental/evolving/SupergraphVertexSplitOptimization.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/experimental/evolving/SupergraphVertexSplitOptimization.lua index b5a4ea22c94..2295e60513b 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/experimental/evolving/SupergraphVertexSplitOptimization.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/experimental/evolving/SupergraphVertexSplitOptimization.lua @@ -59,19 +59,19 @@ declare { algorithm = SupergraphVertexSplitOptimization, phase = "supergraph optimization", phase_default = true, - summary = [[" - Use this key if you want to disable animations. - Instead of producing animations the evolving graph animation phasephase animates all vertices including movements and - fade in or fade out animations. + summary = [[" + Use this key if you want to disable animations. + Instead of producing animations the evolving graph animation phasephase animates all vertices including movements and + fade in or fade out animations. "]], - documentation = [[" - See ToDo + documentation = [[" + See ToDo "]] } --- Help functions +-- Helpfunctions -- Implementation @@ -84,102 +84,102 @@ function SupergraphVertexSplitOptimization:run() local split_on_no_common_child = self.digraph.options["split on disjoint children"] local split_on_no_common_parent = self.digraph.options["split on disjoint parents"] local split_all = self.digraph.options["split all supervertices"] - + for _, supernode in ipairs(supergraph.vertices) do -- follow trace of the supernode local snapshots = supergraph:getSnapshots(supernode) local splitsnapshots = {} - + for i=2, #snapshots do local s = snapshots[i] local s_prev = snapshots[i - 1] local can_split = false if supergraph:consecutiveSnapshots(s_prev, s) then - local v1 = supergraph:getSnapshotVertex(supernode, s_prev) - local v2 = supergraph:getSnapshotVertex(supernode, s) - local is_child1 = {} - local is_parent1 = {} - local is_neighbor1 = {} - - local incoming1 = s_prev:incoming(v1) - local outgoing1 = s_prev:outgoing(v1) - - for _,e in ipairs(incoming1) do - local p = supergraph:getSupervertex(e.tail) - if p then - is_parent1[p] = true - is_neighbor1[p] = true - end - end - - for _,e in ipairs(outgoing1) do - local p = supergraph:getSupervertex(e.head) - if p then - is_child1[p] = true - is_neighbor1[p] = true - end - end - - local incoming2 = s:incoming(v2) - local outgoing2 = s:outgoing(v2) - - no_common_parent = true - no_common_child = true - no_common_neighbor = true - for _,e in ipairs(incoming2) do - local p = supergraph:getSupervertex(e.tail) - if p then - if is_neighbor1[p] then - no_common_neighbor = false - end - if is_parent1[p] then - no_common_parent = false - end - if (not no_common_neighbor) and (not no_common_parent) then - break - end - end - end - - for _,e in ipairs(outgoing2) do - local p = supergraph:getSupervertex(e.head) - if p then - if is_neighbor1[p] then - no_common_neighbor = false - end - if is_child1[p] then - no_common_child = false - end - if (not no_common_neighbor) and (not no_common_child) then - break - end - end - end - - - - if no_common_neighbor and split_on_no_common_neighbor then - can_split = true - --texio.write("[N@".. s.timestamp .."]") - end - if no_common_parent and split_on_no_common_parent then - can_split = true - --texio.write("[P@".. s.timestamp .."]") - end - if no_common_child and split_on_no_common_child then - can_split = true - --texio.write("[N@".. s.timestamp .."]") - end - if v2.options["split me"] then - can_split = true - end - else - can_split = true - --texio.write("[R@".. s.timestamp .."]") - end - if can_split or split_all then - table.insert(splitsnapshots, s) + local v1 = supergraph:getSnapshotVertex(supernode, s_prev) + local v2 = supergraph:getSnapshotVertex(supernode, s) + local is_child1 = {} + local is_parent1 = {} + local is_neighbor1 = {} + + local incoming1 = s_prev:incoming(v1) + local outgoing1 = s_prev:outgoing(v1) + + for _,e in ipairs(incoming1) do + local p = supergraph:getSupervertex(e.tail) + if p then + is_parent1[p] = true + is_neighbor1[p] = true + end + end + + for _,e in ipairs(outgoing1) do + local p = supergraph:getSupervertex(e.head) + if p then + is_child1[p] = true + is_neighbor1[p] = true + end + end + + local incoming2 = s:incoming(v2) + local outgoing2 = s:outgoing(v2) + + no_common_parent = true + no_common_child = true + no_common_neighbor = true + for _,e in ipairs(incoming2) do + local p = supergraph:getSupervertex(e.tail) + if p then + if is_neighbor1[p] then + no_common_neighbor = false + end + if is_parent1[p] then + no_common_parent = false + end + if (not no_common_neighbor) and (not no_common_parent) then + break + end + end + end + + for _,e in ipairs(outgoing2) do + local p = supergraph:getSupervertex(e.head) + if p then + if is_neighbor1[p] then + no_common_neighbor = false + end + if is_child1[p] then + no_common_child = false + end + if (not no_common_neighbor) and (not no_common_child) then + break + end + end + end + + + + if no_common_neighbor and split_on_no_common_neighbor then + can_split = true + --texio.write("[N@".. s.timestamp .."]") + end + if no_common_parent and split_on_no_common_parent then + can_split = true + --texio.write("[P@".. s.timestamp .."]") + end + if no_common_child and split_on_no_common_child then + can_split = true + --texio.write("[N@".. s.timestamp .."]") + end + if v2.options["split me"] then + can_split = true + end + else + can_split = true + --texio.write("[R@".. s.timestamp .."]") + end + if can_split or split_all then + table.insert(splitsnapshots, s) end end if #splitsnapshots>0 then diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/experimental/evolving/TimeSpec.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/experimental/evolving/TimeSpec.lua index 2b2168da1aa..13d453f1fd6 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/experimental/evolving/TimeSpec.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/experimental/evolving/TimeSpec.lua @@ -14,49 +14,47 @@ local declare = require("pgf.gd.interface.InterfaceToAlgorithms").declare --- declare { - key = "snapshot", - type = "time", - initial = "0s", - summary = "The time of the snapshot in which a PGF node should be visible.", - documentation = [[" - This option defines the time in seconds when respectively in which - state or snapshot of the graph the PGF represents a graph node. - "]], + key = "snapshot", + type = "time", + initial = "0s", + summary = "The time of the snapshot in which a PGF node should be visible.", + documentation = [[" + This option defines the time in seconds when respectively in which + state or snapshot of the graph the PGF represents a graph node. +"]] } --- declare { - key = "supernode", - type = "string", - initial = "null", - summary = "A unique name for a node a given PGF node should be assigned to.", - documentation = [[" - Because it should be possible that nodes can change their - appearance, they are represented by separate PGF nodes in each - snapshot. To identify PGF nodes of the same supernode we have to - specify this key. - "]], + key = "supernode", + type = "string", + initial = "null", + summary = "A unique name for a node a given PGF node should be assigned to.", + documentation = [[" + Because it should be possible that nodes can change their + appearance, they are represented by separate PGF nodes in each + snapshot. To identify PGF nodes of the same supernode we have to + specify this key. +"]] } --- declare { - key = "fadein time", - type = "time", - initial = "0.5s", - summary = [[" - The time in seconds it should take that a nodes will be fade in - when it disappears in the graph. - "]], + key = "fadein time", + type = "time", + initial = "0.5s", + summary = [["The time in seconds it should take that a nodes will be fade in + when it disappears in the graph"]], } --- declare { - key = "fadeout time", - type = "time", - initial = "0.5s", - summary = "", - documentation = "The same as |fadein time| but for disappearing nodes.", + key = "fadeout time", + type = "time", + initial = "0.5s", + summary = "", + documentation = "The same as |fadein time| but for disappearing nodes." } diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/experimental/evolving/doc.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/experimental/evolving/doc.lua index dbd81462758..801e3808bb4 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/experimental/evolving/doc.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/experimental/evolving/doc.lua @@ -26,27 +26,26 @@ documentation A method to create layouts for evolving graphs as an SVG animation.The Reingold--Tilford method is a standard method for drawing trees. It is described in: -The algorithm, which is based on the Reingold--Tilford algorithm and +The algorithm, which is based on the Reingold--Tilford algorithm and its implementation in |graphdrawing.trees|, is introduced in my Masthesis: -% \begin{itemize} - \item - M.\ Skambath, - \newblock Algorithmic Drawing of Evolving Trees, Masterthesis, 2016 +\item + M.\ Skambath, + \newblock Algorithmic Drawing of Evolving Trees, Masterthesis, 2016 \end{itemize} -You can use the same known graph macros as for other graph drawing -algorithms in Ti\emph{k}Z. In addition all keys and features that +You can use the same known graph macros as for other graph drawing +algorithms in Ti\emph{k}Z. In addition all keys and features that are available for the static tree algorithm can be used: -% + \begin{codeexample}[animation list={1,1.5,2,2.5,3,3.5,4}] \tikz \graph[animated binary tree layout, nodes={draw,circle}, auto supernode, - ] { - {[when=1] 15 -> {10 -> { ,11}, 20 }}, - {[when=2] 15 -> {10 -> {3,11}, 20 }}, - {[when=3] 15 -> {10 -> {3, }, 20 }}, - {[when=4] 15 -> {10 -> {3, }, 20 -> 18 }}, + ] { + {[when=1] 15 -> {10 -> { ,11}, 20 }}, + {[when=2] 15 -> {10 -> {3,11}, 20 }}, + {[when=3] 15 -> {10 -> {3, }, 20 }}, + {[when=4] 15 -> {10 -> {3, }, 20 -> 18 }}, }; \end{codeexample} ]] @@ -55,11 +54,11 @@ are available for the static tree algorithm can be used: example [[ \tikz[animated binary tree layout] - \graph[nodes={draw,circle}, auto supernode] { - {[when=1] 15 -> {10 -> { ,11}, 20 }}, - {[when=2] 15 -> {10 -> {3,11}, 20 }}, - {[when=3] 15 -> {10 -> {3, }, 20 }}, - {[when=4] 15 -> {10 -> {3, }, 20 -> 18 }}, + \graph[nodes={draw,circle}, auto supernode] { + {[when=1] 15 -> {10 -> { ,11}, 20 }}, + {[when=2] 15 -> {10 -> {3,11}, 20 }}, + {[when=3] 15 -> {10 -> {3, }, 20 }}, + {[when=4] 15 -> {10 -> {3, }, 20 -> 18 }}, }; ]] -------------------------------------------------------------------- @@ -77,17 +76,15 @@ key "animated binary tree layout" summary [[ A layout based on the Reingold--Tilford method for drawing -binary trees. -]] +binary trees. ]] documentation [[ This key executes: -% \begin{enumerate} - \item |animated tree layout|, thereby selecting the Reingold--Tilford method, - \item |minimum number of children=2|, thereby ensuring the all nodes - have (at least) two children or none at all, and +\item |animated tree layout|, thereby selecting the Reingold--Tilford method, +\item |minimum number of children=2|, thereby ensuring the all nodes + have (at least) two children or none at all, and \end{enumerate} ]] @@ -102,15 +99,14 @@ example -------------------------------------------------------------------- - + -------------------------------------------------------------------- key "extended animated binary tree layout" summary [[ This algorithm is similar to |animated binary tree layout|, only the option \texttt{missing nodes get space} is executed and the -\texttt{significant sep} is zero. -]] +\texttt{significant sep} is zero. ]] example [[ diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/experimental/evolving/layered.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/experimental/evolving/layered.lua index 15df9990f8e..dc1e8ab571c 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/experimental/evolving/layered.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/experimental/evolving/layered.lua @@ -23,7 +23,7 @@ local lib = require "pgf.gd.lib" local Storage = require "pgf.gd.lib.Storage" local layered = require "pgf.gd.layered" --- +-- -- This file defines some basic functions to compute and/or set the -- ideal distances between nodes of any kind of layered drawing of a -- graph. @@ -35,7 +35,7 @@ local layered = require "pgf.gd.layered" -- -- @param layers A |Storage| object assigning layers to vertices. -- @param paddings A |Storage| object storing the computed distances --- (paddings). +-- (paddings). -- @param graph The graph in which the nodes reside -- @param snapshots The list of snapshots over which the overlaying evolving -- graph exists @@ -56,47 +56,47 @@ function temporallayered.arrange_layers_by_baselines (layers, paddings, graph, s end if count_layers > 0 then - - + + -- Now compute ideal distances and store local height = 0 - + for _, s in ipairs(snapshots) do local layer_vertices = snapshots_layers[s] if #layer_vertices > 0 then -- sanity check - for _,v in ipairs(layer_vertices[1]) do - v.pos.y = 0 - end + for _,v in ipairs(layer_vertices[1]) do + v.pos.y = 0 + end end end - + for i=2, count_layers do local distance = 0 for _, s in ipairs(snapshots) do - local layer_vertices = snapshots_layers[s] - if #layer_vertices >= i then - distance = math.max( - distance, - layered.baseline_distance( - paddings, - s, - layer_vertices[i-1], - layer_vertices[i])) - end + local layer_vertices = snapshots_layers[s] + if #layer_vertices >= i then + distance = math.max( + distance, + layered.baseline_distance( + paddings, + s, + layer_vertices[i-1], + layer_vertices[i])) + end end - + height = height + distance - + for _, s in ipairs(snapshots) do - local layer_vertices = snapshots_layers[s] - if #layer_vertices >= i then - for _,v in ipairs(layer_vertices[i]) do - v.pos.y = height - end - end + local layer_vertices = snapshots_layers[s] + if #layer_vertices >= i then + for _,v in ipairs(layer_vertices[i]) do + v.pos.y = height + end + end end end - end + end end diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/CoarseGraph.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/CoarseGraph.lua index a4e51dfeff9..6cd46c60eb2 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/CoarseGraph.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/CoarseGraph.lua @@ -12,7 +12,7 @@ --- A class for handling "coarse" versions of a graph. Such versions contain --- less nodes and edges than the original graph while retaining the overall +-- less nodes and edges than the original graph while retaining the overall -- structure. local Graph = require "pgf.gd.deprecated.Graph" -- we subclass from here @@ -43,12 +43,12 @@ CoarseGraph.COARSEN_HYBRID = 2 --- Creates a new coarse graph derived from an existing graph. -- --- Generates a coarse graph for the input |Graph|. +-- Generates a coarse graph for the input |Graph|. -- --- Coarsening describes the process of reducing the amount of nodes in a graph --- by merging nodes into supernodes. There are different strategies, called --- schemes, that can be applied, like merging nodes that belong to edges in a --- maximal independent edge set or by creating supernodes based on a maximal +-- Coarsening describes the process of reducing the amount of nodes in a graph +-- by merging nodes into supernodes. There are different strategies, called +-- schemes, that can be applied, like merging nodes that belong to edges in a +-- maximal independent edge set or by creating supernodes based on a maximal -- independent node set. -- -- Coarsening is not performed automatically. The functions |CoarseGraph:coarsen| @@ -57,28 +57,28 @@ CoarseGraph.COARSEN_HYBRID = 2 -- the coarser version of the graph). -- -- Note, however, that the input \meta{graph} is always modified in-place, so --- if the original version of \meta{graph} is needed in parallel to its --- coarse representations, a deep copy of \meta{graph} needs to be passed over +-- if the original version of \meta{graph} is needed in parallel to its +-- coarse representations, a deep copy of \meta{grpah} needs to be passed over -- to |CoarseGraph.new|. -- -- @param graph An existing graph that needs to be coarsened. -- @param scheme Coarsening scheme to use. Possible values are:\par --- |CoarseGraph.COARSEN_INDEPENDENT_EDGES|: +-- |CoarseGraph.COARSEN_INDEPENDENT_EDGES|: -- Coarsen the input graph by computing a maximal independent edge set -- and collapsing edges from this set. The resulting coarse graph has -- at least 50% of the nodes of the input graph. This coarsening scheme --- gives slightly better results than +-- gives slightly better results than -- |CoarseGraph.COARSEN_INDEPENDENT_NODES| because it is less aggressive. -- However, this comes at higher computational cost.\par -- |CoarseGraph.COARSEN_INDEPENDENT_NODES|: -- Coarsen the input graph by computing a maximal independent node set, -- making nodes from this set supernodes in the coarse graph, merging --- adjacent nodes into the supernodes and connecting the supernodes --- if their graph distance is no greater than three. This scheme gives +-- adjacent nodes into the supernodes and connecting the supernodes +-- if their grpah distance is no greater than three. This scheme gives -- slightly worse results than |CoarseGraph.COARSEN_INDEPENDENT_EDGES| -- but is computationally more efficient.\par -- |CoarseGraph.COARSEN_HYBRID|: Combines the other schemes by starting --- with |CoarseGraph.COARSEN_INDEPENDENT_EDGES| and switching to +-- with |CoarseGraph.COARSEN_INDEPENDENT_EDGES| and switching to -- |CoarseGraph.COARSEN_INDEPENDENT_NODES| as soon as the first scheme -- does not reduce the amount of nodes by a factor of 25%. -- @@ -114,14 +114,14 @@ end local function pairs_by_sorted_keys (t, f) - local a = {} - for n in pairs(t) do a[#a + 1] = n end - table.sort (a, f) - local i = 0 - return function () - i = i + 1 - return a[i], t[a[i]] - end + local a = {} + for n in pairs(t) do a[#a + 1] = n end + table.sort (a, f) + local i = 0 + return function () + i = i + 1 + return a[i], t[a[i]] + end end @@ -153,33 +153,33 @@ function CoarseGraph:coarsen() -- add the supernode to the graph self.graph:addNode(supernode) - -- collect all neighbors of the nodes to merge, create a node -> edge mapping + -- collact all neighbours of the nodes to merge, create a node -> edge mapping local u_neighbours = lib.map(u.edges, function(edge) return edge, edge:getNeighbour(u) end) local v_neighbours = lib.map(v.edges, function(edge) return edge, edge:getNeighbour(v) end) - -- remove the two nodes themselves from the neighbor lists + -- remove the two nodes themselves from the neighbour lists u_neighbours = lib.map(u_neighbours, function (edge,node) if node ~= v then return edge,node end end) v_neighbours = lib.map(v_neighbours, function (edge,node) if node ~= u then return edge,node end end) - -- compute a list of neighbors u and v have in common + -- compute a list of neighbours u and v have in common local common_neighbours = lib.map(u_neighbours, - function (edge,node) - if v_neighbours[node] ~= nil then return edge,node end - end) + function (edge,node) + if v_neighbours[node] ~= nil then return edge,node end + end) - -- create a node -> edges mapping for common neighbors + -- create a node -> edges mapping for common neighbours common_neighbours = lib.map(common_neighbours, function (edge, node) return { edge, v_neighbours[node] }, node end) - -- drop common edges from the neighbor mappings + -- drop common edges from the neighbour mappings u_neighbours = lib.map(u_neighbours, function (val,node) if not common_neighbours[node] then return val,node end end) v_neighbours = lib.map(v_neighbours, function (val,node) if not common_neighbours[node] then return val,node end end) - -- merge neighbor lists + -- merge neighbour lists local disjoint_neighbours = custom_merge(u_neighbours, v_neighbours) - -- create edges between the supernode and the neighbors of the merged nodes + -- create edges between the supernode and the neighbours of the merged nodes for neighbour, edge in pairs_by_sorted_keys(disjoint_neighbours, function (n,m) return n.index < m.index end) do -- create a superedge to replace the existing one @@ -190,11 +190,11 @@ function CoarseGraph:coarsen() level = self.level, } - -- add the supernode and the neighbor to the edge + -- add the supernode and the neighbour to the edge if u_neighbours[neighbour] then superedge:addNode(neighbour) superedge:addNode(supernode) - + else superedge:addNode(supernode) superedge:addNode(neighbour) @@ -206,14 +206,14 @@ function CoarseGraph:coarsen() self.graph:deleteEdge(edge) end - -- do the same for all neighbors that the merged nodes have + -- do the same for all neighbours that the merged nodes have -- in common, except that the weights of the new edges are the - -- sums of the of the weights of the edges to the common neighbors + -- sums of the of the weights of the edges to the common neighbours for neighbour, edges in pairs_by_sorted_keys(common_neighbours, function (n,m) return n.index < m.index end) do local weights = 0 - for _,e in ipairs(edges) do - weights = weights + edge.weight - end + for _,e in ipairs(edges) do + weights = weights + edge.weight + end local superedge = Edge.new{ direction = Edge.UNDIRECTED, @@ -222,7 +222,7 @@ function CoarseGraph:coarsen() level = self.level, } - -- add the supernode and the neighbor to the edge + -- add the supernode and the neighbour to the edge superedge:addNode(supernode) superedge:addNode(neighbour) @@ -253,7 +253,7 @@ function CoarseGraph:revertSuperedge(superedge) -- TODO we can probably skip adding edges that have one or more -- subedges with the same level. But that needs more testing. - -- TODO we might have to pass the corresponding supernode to + -- TODO we might have to pass the corresponding supernode to -- this method so that we can move subnodes to the same -- position, right? Interpolating seems to work fine without -- though... @@ -345,14 +345,14 @@ function CoarseGraph:interpolate() self.graph:deleteNode(supernode) end end - + -- Make sure that the nodes and edges are in the correct order: table.sort (self.graph.nodes, function (a, b) return a.index < b.index end) table.sort (self.graph.edges, function (a, b) return a.index < b.index end) for _, n in pairs(self.graph.nodes) do table.sort (n.edges, function (a, b) return a.index < b.index end) end - + -- update the level self.level = self.level - 1 end @@ -396,22 +396,22 @@ function CoarseGraph:findMaximalMatching() -- mark the node as matched matched_nodes[node] = true - -- filter out edges adjacent to neighbors already matched + -- filter out edges adjacent to neighbours already matched local edges = lib.imap(node.edges, - function (edge) - if not matched_nodes[edge:getNeighbour(node)] then return edge end - end) + function (edge) + if not matched_nodes[edge:getNeighbour(node)] then return edge end + end) -- FIXME TODO We use a light-vertex matching here. This is -- different from the algorithm proposed by Hu which collapses -- edges based on a heavy-edge matching... if #edges > 0 then - -- sort edges by the weights of the node's neighbors + -- sort edges by the weights of the node's neighbours table.sort(edges, function (a, b) return a:getNeighbour(node).weight < b:getNeighbour(node).weight end) - -- match the node against the neighbor with minimum weight + -- match the node against the neighbour with minimum weight matched_nodes[edges[1]:getNeighbour(node)] = true table.insert(matching, edges[1]) end @@ -432,4 +432,4 @@ end -- done -return CoarseGraph +return CoarseGraph
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/ControlCoarsening.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/ControlCoarsening.lua index d69d5fc6c9c..17cd121b85e 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/ControlCoarsening.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/ControlCoarsening.lua @@ -28,48 +28,48 @@ declare { type = "boolean", initial = "true", - summary = [[" - Defines whether or not a multilevel approach is used that - iteratively coarsens the input graph into graphs $G_1,\dots,G_l$ - with a smaller and smaller number of nodes. The coarsening stops as - soon as a minimum number of nodes is reached, as set via the - |minimum coarsening size| option, or if, in the last iteration, the - number of nodes was not reduced by at least the ratio specified via - |downsize ratio|. + summary = [[" + Defines whether or not a multilevel approach is used that + iteratively coarsens the input graph into graphs $G_1,\dots,G_l$ + with a smaller and smaller number of nodes. The coarsening stops as + soon as a minimum number of nodes is reached, as set via the + |minimum coarsening size| option, or if, in the last iteration, the + number of nodes was not reduced by at least the ratio specified via + |downsize ratio|. "]], documentation = [[" - A random initial layout is computed for the coarsest graph $G_l$ first. - Afterwards, it is laid out by computing the attractive and repulsive - forces between its nodes. - - In the subsequent steps, the previous coarse graph $G_{l-1}$ is - restored and its node positions are interpolated from the nodes - in~$G_l$. The graph $G_{l-1}$ is again laid out by computing the forces - between its nodes. These steps are repeated with $G_{l-2},\dots,G_1$ until - the original input graph $G_0$ has been restored, interpolated - and laid out. - - The idea behind this approach is that, by arranging recursively - formed supernodes first and then interpolating and arranging their - subnodes step by step, the algorithm is less likely to settle in a - local energy minimum (of which there can be many, particularly for - large graphs). The quality of the drawings with coarsening enabled is - expected to be higher than graphics where this feature is not applied. - - The following example demonstrates how coarsening can improve the - quality of graph drawings generated with Walshaw's algorihtm - |spring electrical layout'|. - "]], + A random initial layout is computed for the coarsest graph $G_l$ first. + Afterwards, it is laid out by computing the attractive and repulsive + forces between its nodes. + + In the subsequent steps, the previous coarse graph $G_{l-1}$ is + restored and its node positions are interpolated from the nodes + in~$G_l$. The graph $G_{l-1}$ is again laid out by computing the forces + between its nodes. These steps are repeated with $G_{l-2},\dots,G_1$ until + the original input graph $G_0$ has been restored, interpolated + and laid out. + + The idea behind this approach is that, by arranging recursively + formed supernodes first and then interpolating and arranging their + subnodes step by step, the algorithm is less likely to settle in a + local energy minimum (of which there can be many, particularly for + large graphs). The quality of the drawings with coarsening enabled is + expected to be higher than graphics where this feature is not applied. + + The following example demonstrates how coarsening can improve the + quality of graph drawings generated with Walshaw's algorihtm + |spring electrical layout'|. + "]], examples = [[" - \tikz \graph [spring electrical layout', coarsen=false, vertical=3 to 4] - { - { [clique] 1, 2 } -- 3 -- 4 -- { 5, 6, 7 } - }; - - \tikz \graph [spring electrical layout', coarsen, vertical=3 to 4] - { - { [clique] 1, 2 } -- 3 -- 4 -- { 5, 6, 7 } - }; + \tikz \graph [spring electrical layout', coarsen=false, vertical=3 to 4] + { + { [clique] 1, 2 } -- 3 -- 4 -- { 5, 6, 7 } + }; + + \tikz \graph [spring electrical layout', coarsen, vertical=3 to 4] + { + { [clique] 1, 2 } -- 3 -- 4 -- { 5, 6, 7 } + }; "]] } @@ -80,29 +80,29 @@ declare { type = "number", initial = 2, - summary = [[" - Defines the minimum number of nodes down to which the graph is - coarsened iteratively. The first graph that has a smaller or equal - number of nodes becomes the coarsest graph $G_l$, where $l$ is the - number of coarsening steps. The algorithm proceeds with the steps - described in the documentation of the |coarsen| option. - "]], - documentation = [[" - In the following example the same graph is coarsened down to two - and four nodes, respectively. The layout of the original graph is - interpolated from the random initial layout and is not improved - further because the forces are not computed (0 iterations). Thus, - in the two graphs, the nodes are placed at exactly two and four - coordinates in the final drawing. - "]], + summary = [[" + Defines the minimum number of nodes down to which the graph is + coarsened iteratively. The first graph that has a smaller or equal + number of nodes becomes the coarsest graph $G_l$, where $l$ is the + number of coarsening steps. The algorithm proceeds with the steps + described in the documentation of the |coarsen| option. + "]], + documentation = [[" + In the following example the same graph is coarsened down to two + and four nodes, respectively. The layout of the original graph is + interpolated from the random initial layout and is not improved + further because the forces are not computed (0 iterations). Thus, + in the two graphs, the nodes are placed at exactly two and four + coordinates in the final drawing. + "]], examples = [[" - \tikz \graph [spring layout, iterations=0, - minimum coarsening size=2] - { subgraph C_n [n=8] }; - - \tikz \graph [spring layout, iterations=0, - minimum coarsening size=4] - { subgraph C_n [n=8] }; + \tikz \graph [spring layout, iterations=0, + minimum coarsening size=2] + { subgraph C_n [n=8] }; + + \tikz \graph [spring layout, iterations=0, + minimum coarsening size=4] + { subgraph C_n [n=8] }; "]] } @@ -113,36 +113,36 @@ declare { type = "number", initial = "0.25", - summary = [[" - Minimum ratio between 0 and 1 by which the number of nodes between - two coarse graphs $G_i$ and $G_{i+1}$ need to be reduced in order for - the coarsening to stop and for the algorithm to use $G_{i+1}$ as the - coarsest graph $G_l$. Aside from the input graph, the optimal value - of |downsize ratio| mostly depends on the coarsening scheme being - used. Possible schemes are |collapse independent edges| and - |connect independent nodes|. - "]], - documentation = [[" - Increasing this option possibly reduces the number of coarse - graphs computed during the coarsening phase as coarsening will stop as - soon as a coarse graph does not reduce the number of nodes - substantially. This may speed up the algorithm but if the size of the - coarsest graph $G_l$ is much larger than |minimum coarsening size|, the - multilevel approach may not produce drawings as good as with a lower - |downsize ratio|. - "]], + summary = [[" + Minimum ratio between 0 and 1 by which the number of nodes between + two coarse graphs $G_i$ and $G_{i+1}$ need to be reduced in order for + the coarsening to stop and for the algorithm to use $G_{i+1}$ as the + coarsest graph $G_l$. Aside from the input graph, the optimal value + of |downsize ratio| mostly depends on the coarsening scheme being + used. Possible schemes are |collapse independent edges| and + |connect independent nodes|. + "]], + documentation = [[" + Increasing this option possibly reduces the number of coarse + graphs computed during the coarsening phase as coarsening will stop as + soon as a coarse graph does not reduce the number of nodes + substantially. This may speed up the algorithm but if the size of the + coarsest graph $G_l$ is much larger than |minimum coarsening size|, the + multilevel approach may not produce drawings as good as with a lower + |downsize ratio|. + "]], examples = [[" - % 1. ratio too high, coarsening stops early, benefits are lost - \tikz \graph [spring electrical layout', - downsize ratio=1.0, - node distance=7mm, vertical=3 to 4] - { { [clique] 1, 2 } -- 3 -- 4 -- { 5, 6, 7 } }; - - % 2. ratio set to default, coarsening benefits are visible - \tikz \graph [spring electrical layout', - downsize ratio=0.2, - node distance=7mm, vertical=3 to 4] - { { [clique] 1, 2 } -- 3 -- 4 -- { 5, 6, 7 } }; + % 1. ratio too high, coarsening stops early, benefits are lost + \tikz \graph [spring electrical layout', + downsize ratio=1.0, + node distance=7mm, vertical=3 to 4] + { { [clique] 1, 2 } -- 3 -- 4 -- { 5, 6, 7 } }; + + % 2. ratio set to default, coarsening benefits are visible + \tikz \graph [spring electrical layout', + downsize ratio=0.2, + node distance=7mm, vertical=3 to 4] + { { [clique] 1, 2 } -- 3 -- 4 -- { 5, 6, 7 } }; "]] } diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/ControlDeclare.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/ControlDeclare.lua index af209d2c78b..6d80fff6aa6 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/ControlDeclare.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/ControlDeclare.lua @@ -19,7 +19,7 @@ local declare = require("pgf.gd.interface.InterfaceToAlgorithms").declare -- -- All force-based algorithms are based on -- a general pattern which we detail in the following. Numerous options --- can be used to influence the behavior of this general pattern; more +-- can be used to influence the behaviour of this general pattern; more -- specific options that apply only to individual algorithms are -- explained along with these algorithms. -- diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/ControlElectric.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/ControlElectric.lua index 47e3cee45da..7bd118d7b85 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/ControlElectric.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/ControlElectric.lua @@ -29,26 +29,29 @@ declare { type = "number", initial = 1, - summary = [[" - Defines the electric charge of the node. The stronger the - |electric charge| of a node the stronger the repulsion between the - node and others in the graph. A negative |electric charge| means that - other nodes are further attracted to the node rather than repulsed, - although in theory this effect strongly depends on how the - |spring electrical layout| algorithm works. - Two typical effects of increasing the |electric charge| are distortion - of symmetries and an upscaling of the drawings. + summary = [[" + Defines the electric charge of the node. The stronger the + |electric charge| of a node the stronger the repulsion between the + node and others in the graph. A negative |electric charge| means that + other nodes are further attracted to the node rather than repulsed, + although in theory this effect strongly depends on how the + |spring electrical layout| algorithm works. + Two typcal effects of increasing the |electric charge| are distortion + of symmetries and an upscaling of the drawings. "]], - examples = {[[" - \tikz \graph [spring electrical layout, horizontal=0 to 1] - { 0 [electric charge=1] -- subgraph C_n [n=10] }; - "]],[[" - \tikz \graph [spring electrical layout, horizontal=0 to 1] - { 0 [electric charge=5] -- subgraph C_n [n=10] }; - "]],[[" - \tikz \graph [spring electrical layout, horizontal=0 to 1] - { [clique] 1 [electric charge=5], 2, 3, 4 }; - "]] + examples = { + [[" + \tikz \graph [spring electrical layout, horizontal=0 to 1] + { 0 [electric charge=1] -- subgraph C_n [n=10] }; + "]], + [[" + \tikz \graph [spring electrical layout, horizontal=0 to 1] + { 0 [electric charge=5] -- subgraph C_n [n=10] }; + "]], + [[" + \tikz \graph [spring electrical layout, horizontal=0 to 1] + { [clique] 1 [electric charge=5], 2, 3, 4 }; + "]] } } @@ -60,16 +63,16 @@ declare { type = "number", initial = "1", - summary = [[" - Sometimes, when drawing symmetric and mesh-like graphs, the - peripheral distortion caused by long-range electric forces may be - undesired. Some electric force models allow to reduce long-range - forces and distortion effects by increasing - the order (exponent) of electric forces. Values between 0 and 1 - increase long-range electric forces and the scaling of the - generated layouts. Value greater than 1 decrease long-range - electric forces and results in shrinking drawings. - "]] + summary = [[" + Sometimes, when drawing symmetric and mesh-like graphs, the + peripheral distortion caused by long-range electric forces may be + undesired. Some electric force models allow to reduce long-range + forces and distortion effects by increasing + the order (epxonent) of electric forces. Values between 0 and 1 + increase long-range electric forces and the scaling of the + generated layouts. Value greater than 1 decrease long-range + electric forces and results in shrinking drawings. + "]] } @@ -79,19 +82,19 @@ declare { key = "approximate remote forces", type = "boolean", - summary = [[" - Force based algorithms often need to compute a force for each pair - of vertices, which, for larger numbers of vertices, can lead to a - significant time overhead. This problem can be addressed by - approximating these forces: For a vertex far removed from a cluster - of vertices, instead of computing the force contribution of each - vertex of the cluster individually, we form a sort of - ``supervertex'' at the ``gravitational center'' of the cluster and - then compute only the force between this supervertex and the single - vertex. - - \emph{Remark:} Currently, the implementation seems to be broken, at - least the results are somewhat strange when this key is used. - "]] + summary = [[" + Force based algorithms often need to compute a force for each pair + of vertices, which, for larger numbers of vertices, can lead to a + significant time overhead. This problem can be addressed by + approximating these forces: For a vertex far removed from a cluster + of vertices, instead of computing the force contribution of each + vertex of the cluster indiviually, we form a sort of + ``supervertex'' at the ``gravitational center'' of the cluster and + then compute only the force between this supervertex and the single + vertex. + + \emph{Remark:} Currently, the implementation seems to be broken, at + least the results are somewhat strange when this key is used. + "]] } diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/ControlIteration.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/ControlIteration.lua index b8d96630cdf..b845d9d1f89 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/ControlIteration.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/ControlIteration.lua @@ -30,34 +30,38 @@ declare { type = "number", initial = "500", - summary = [[" - Limits the number of iterations of algorithms for force-based - layouts to \meta{number}. + summary = [[" + Limits the number of iterations of algorithms for force-based + layouts to \meta{number}. + "]], + documentation = [[" + Depending on the characteristics of the input graph and the parameters + chosen for the algorithm, minimizing the system energy may require + many iterations. + + In these situations it may come in handy to limit the number of + iterations. This feature can also be useful to draw the same graph + after different iterations and thereby demonstrate how the spring or + spring-electrical algorithm improves the drawing step by step. + + The examples shows two drawings generated using two + different |iteration| limits. "]], - documentation = [[" - Depending on the characteristics of the input graph and the parameters - chosen for the algorithm, minimizing the system energy may require - many iterations. - - In these situations it may come in handy to limit the number of - iterations. This feature can also be useful to draw the same graph - after different iterations and thereby demonstrate how the spring or - spring-electrical algorithm improves the drawing step by step. - - The examples shows two drawings generated using two - different |iteration| limits. - "]], - examples = {[[" - \tikz \graph [spring layout, iterations=10] { subgraph K_n [n=4] }; - "]],[[" - \tikz \graph [spring layout, iterations=500] { subgraph K_n [n=4] }; - "]],[[" - \tikz \graph [spring electrical layout, iterations=10] - { subgraph K_n [n=4] }; - "]],[[" - \tikz \graph [spring electrical layout, iterations=500] - { subgraph K_n [n=4] }; - "]] + examples = { + [[" + \tikz \graph [spring layout, iterations=10] { subgraph K_n [n=4] }; + "]], + [[" + \tikz \graph [spring layout, iterations=500] { subgraph K_n [n=4] }; + "]], + [[" + \tikz \graph [spring electrical layout, iterations=10] + { subgraph K_n [n=4] }; + "]], + [[" + \tikz \graph [spring electrical layout, iterations=500] + { subgraph K_n [n=4] }; + "]] } } @@ -68,11 +72,11 @@ declare { type = "length", initial = "0", - summary = [[" - This parameter specifies the amount by which nodes will be - displaced in each iteration, initially. If set to |0| (which is the - default), an appropriate value is computed automatically. - "]] + summary = [[" + This parameter specifies the amount by which nodes will be + displaced in each iteration, initially. If set to |0| (which is the + default), an appropriate value is computed automatically. + "]] } --- @@ -82,28 +86,30 @@ declare { type = "number", initial = "0.95", - summary = [[" - This parameter helps in controlling how layouts evolve over - time. It is used to gradually reduce the step size - between one iteration to the next. + summary = [[" + This parameter helps in controlling how layouts evolve over + time. It is used to gradually reduce the step size + between one iteration to the next. "]], documentation = [[" - A small positive cooling factor - $\ge 0$ means that the movement of nodes is quickly or abruptly - reduced, while a large cooling factor $\le 1$ allows for a smoother - step by step layout refinement at the cost of more iterations. The - following example demonstrates how a smaller cooling factor may - result in a less balanced drawing. By default, Hu2006 spring, - Hu2006 spring electrical, and Walshaw2000 spring electrical use a - cooling factor of |0.95|. + A small positive cooling factor + $\ge 0$ means that the movement of nodes is quickly or abruptly + reduced, while a large cooling factor $\le 1$ allows for a smoother + step by step layout refinement at the cost of more iterations. The + following example demonstrates how a smaller cooling factor may + result in a less balanced drawing. By default, Hu2006 spring, + Hu2006 spring electrical, and Walshaw2000 spring electrical use a + cooling factor of |0.95|. "]], - examples = {[[" - \tikz \graph [spring layout, cooling factor=0.1] - { a -> b -> c -> a }; - "]],[[" - \tikz \graph [spring layout, cooling factor=0.5] - { a -> b -> c -> a }; - "]] + examples = { + [[" + \tikz \graph [spring layout, cooling factor=0.1] + { a -> b -> c -> a }; + "]], + [[" + \tikz \graph [spring layout, cooling factor=0.5] + { a -> b -> c -> a }; + "]] } } @@ -114,19 +120,21 @@ declare { type = "number", initial = "0.01", - summary = [[" - All spring and spring-electrical algorithms implemented in the - thesis terminate as soon as the maximum movement of any node drops - below $k \cdot \meta{tolerance}$. This tolerance factor can be changed - with the convergence tolerance option: + summary = [[" + All spring and spring-electrical algorithms implemented in the + thesis terminate as soon as the maximum movement of any node drops + below $k \cdot \meta{tolerance}$. This tolerance factor can be changed + with the convergence tolerance option: "]], - examples = {[[" - \tikz \graph [spring layout, convergence tolerance=0.001] - { { [clique] 1, 2 } -- 3 -- 4 -- { 5, 6, 7 } }; - "]],[[" - \tikz \graph [spring layout, convergence tolerance=1.0] - { { [clique] 1, 2 } -- 3 -- 4 -- { 5, 6, 7 } }; - "]] + examples = { + [[" + \tikz \graph [spring layout, convergence tolerance=0.001] + { { [clique] 1, 2 } -- 3 -- 4 -- { 5, 6, 7 } }; + "]], + [[" + \tikz \graph [spring layout, convergence tolerance=1.0] + { { [clique] 1, 2 } -- 3 -- 4 -- { 5, 6, 7 } }; + "]] } } diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/ControlSprings.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/ControlSprings.lua index 45b9c9ef55e..9252f7b1cb8 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/ControlSprings.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/ControlSprings.lua @@ -21,17 +21,15 @@ local declare = require("pgf.gd.interface.InterfaceToAlgorithms").declare -- length'', which can be configured using the general-purpose -- |node distance| parameter. It is the ``equilibrium length'' of a -- spring between two nodes in the graph. When an edge has this --- length, no forces will ``push'' or ``pull'' along the edge. +-- lenght, no forces will ``push'' or ``pull'' along the edge. -- -- The following examples shows how a simple graph can be scaled by -- changing the |node distance|: --- % -- \begin{codeexample}[] -- \tikz \graph [spring layout, node distance=7mm] { subgraph C_n[n=3] }; -- \tikz \graph [spring layout] { subgraph C_n[n=3] }; -- \tikz \graph [spring layout, node distance=15mm]{ subgraph C_n[n=3] }; -- \end{codeexample} --- % -- \begin{codeexample}[] -- \tikz \graph [spring electrical layout, node distance=0.7cm] { subgraph C_n[n=3] }; -- \tikz \graph [spring electrical layout] { subgraph C_n[n=3] }; @@ -49,12 +47,12 @@ declare { type = "number", initial = "0.01", - summary = [[" - The ``spring constant'' is a factor from Hooke's law describing the - ``stiffness'' of a spring. This factor is used inside spring-based - algorithms to determine how strongly edges ``pull'' and ``push'' at - the nodes they connect. - "]] -} + summary = [[" + The ``spring constant'' is a factor from Hooke's law describing the + ``stiffness'' of a spring. This factor is used inside spring-based + algorithms to determine how strongly edges ``pull'' and ``push'' at + the nodes they connect. + "]] + } diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/ControlStart.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/ControlStart.lua index 269b81a3d7c..b62be10c0a5 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/ControlStart.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/ControlStart.lua @@ -22,13 +22,12 @@ local declare = require("pgf.gd.interface.InterfaceToAlgorithms").declare -- Currently, the start configuration for force-based algorithms is a -- random distribution of the vertices. You can influence it by -- changing the |random seed|: --- % +-- --\begin{codeexample}[] --\tikz \graph [random seed=10, spring layout] { -- a -- {b, c, d} -- e -- f -- {g,h} -- {a,b,e}; --}; --\end{codeexample} --- % --\begin{codeexample}[] --\tikz \graph [random seed=11, spring layout] { -- a -- {b, c, d} -- e -- f -- {g,h} -- {a,b,e}; @@ -36,6 +35,6 @@ local declare = require("pgf.gd.interface.InterfaceToAlgorithms").declare --\end{codeexample} -- -- Other methods, like a planar preembedding, are not implemented --- currently. +-- currently. -- -- @end
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/QuadTree.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/QuadTree.lua index 3e1620dc21f..4e511746bb2 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/QuadTree.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/QuadTree.lua @@ -14,12 +14,12 @@ --- An implementation of a quad trees. -- -- The class QuadTree provides methods form handling quadtrees. --- +-- local QuadTree = { - -- Subclasses + -- Subclases Particle = {}, - Cell = {} + Cell = {} } QuadTree.__index = QuadTree @@ -45,7 +45,7 @@ end ---- Inserts a particle +--- Inserts a particle -- -- @param param A particle of type QuadTree.Particle -- @@ -76,7 +76,7 @@ end ---- Particle subclass +--- Partical subclass QuadTree.Particle.__index = QuadTree.Particle @@ -176,7 +176,7 @@ function QuadTree.Cell:insert(particle) if #self.subcells == 0 then self:createSubcells() end - + -- move particles to the new subcells for _,existing in ipairs(self.particles) do local cell = self:findSubcell(existing) @@ -210,7 +210,7 @@ function QuadTree.Cell:updateMass() for _,particle in ipairs(self.particles) do self.mass = self.mass + particle.mass for _,subparticle in ipairs(particle.subparticles) do - self.mass = self.mass + subparticle.mass + self.mass = self.mass + subparticle.mass end end else @@ -226,27 +226,27 @@ end function QuadTree.Cell:updateCenterOfMass() -- reset center of mass, assuming the cell is empty self.center_of_mass = nil - + if #self.subcells == 0 then -- the center of mass is the average position of the particles -- weighted by their masses self.center_of_mass = Vector.new (2) for _,p in ipairs(self.particles) do for _,sp in ipairs(p.subparticles) do - self.center_of_mass = self.center_of_mass:plus(sp.pos:timesScalar(sp.mass)) + self.center_of_mass = self.center_of_mass:plus(sp.pos:timesScalar(sp.mass)) end self.center_of_mass = self.center_of_mass:plus(p.pos:timesScalar(p.mass)) end self.center_of_mass = self.center_of_mass:dividedByScalar(self.mass) else - -- the center of mass is the average of the weighted centers of mass + -- the center of mass is the average of the weighted centers of mass -- of the subcells self.center_of_mass = Vector.new(2) for _,sc in ipairs(self.subcells) do if sc.center_of_mass then - self.center_of_mass = self.center_of_mass:plus(sc.center_of_mass:timesScalar(sc.mass)) + self.center_of_mass = self.center_of_mass:plus(sc.center_of_mass:timesScalar(sc.mass)) else - assert(sc.mass == 0) + assert(sc.mass == 0) end end self.center_of_mass = self.center_of_mass:dividedByScalar(self.mass) @@ -268,7 +268,7 @@ end function QuadTree.Cell:__tostring() return '((' .. self.x .. ', ' .. self.y .. ') ' - .. 'to (' .. self.x + self.width .. ', ' .. self.y + self.height .. '))' + .. 'to (' .. self.x + self.width .. ', ' .. self.y + self.height .. '))' .. (self.particle and ' => ' .. self.particle.name or '') .. (self.center_of_mass and ' mass ' .. self.mass .. ' at ' .. tostring(self.center_of_mass) or '') end @@ -277,4 +277,4 @@ end -- done -return QuadTree +return QuadTree
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/SpringElectricalHu2006.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/SpringElectricalHu2006.lua index a7230eb1f6d..9fa709a8053 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/SpringElectricalHu2006.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/SpringElectricalHu2006.lua @@ -23,7 +23,7 @@ local declare = require("pgf.gd.interface.InterfaceToAlgorithms").declare declare { key = "spring electrical Hu 2006 layout", algorithm = SpringElectricalHu2006, - + preconditions = { connected = true, loop_free = true, @@ -32,20 +32,20 @@ declare { old_graph_model = true, - summary = [[" - Implementation of a spring electrical graph drawing algorithm based on - a paper by Hu. - "]], - documentation = [[" - \begin{itemize} - \item - Y. Hu. - \newblock Efficient, high-quality force-directed graph drawing. - \newblock \emph{The Mathematica Journal}, 2006. - \end{itemize} - - There are some modifications compared to the original algorithm, - see the Diploma thesis of Pohlmann for details. + summary = [[" + Implementation of a spring electrical graph drawing algorithm based on + a paper by Hu. + "]], + documentation = [[" + \begin{itemize} + \item + Y. Hu. + \newblock Efficient, high-quality force-directed graph drawing. + \newblock \emph{The Mathematica Journal}, 2006. + \end{itemize} + + There are some modifications compared to the original algorithm, + see the Diploma thesis of Pohlmann for details. "]] } @@ -64,7 +64,7 @@ function SpringElectricalHu2006:run() -- Setup properties local options = self.digraph.options - + self.iterations = options['iterations'] self.cooling_factor = options['cooling factor'] self.initial_step_length = options['initial step length'] @@ -75,11 +75,11 @@ function SpringElectricalHu2006:run() self.approximate_repulsive_forces = options['approximate remote forces'] self.repulsive_force_order = options['electric force order'] - + self.coarsen = options['coarsen'] self.downsize_ratio = options['downsize ratio'] self.minimum_graph_size = options['minimum coarsening size'] - + -- Adjust types self.downsize_ratio = math.max(0, math.min(1, self.downsize_ratio)) self.graph_size = #self.graph.nodes @@ -103,24 +103,24 @@ function SpringElectricalHu2006:run() node.weight = 1 end end - + -- initialize edge weights for _,edge in ipairs(self.graph.edges) do edge.weight = 1 end -- initialize the coarse graph data structure. note that the algorithm - -- is the same regardless whether coarsening is used, except that the + -- is the same regardless whether coarsening is used, except that the -- number of coarsening steps without coarsening is 0 local coarse_graph = CoarseGraph.new(self.graph) -- check if the multilevel approach should be used if self.coarsen then - -- coarsen the graph repeatedly until only minimum_graph_size nodes - -- are left or until the size of the coarse graph was not reduced by + -- coarsen the graph repeatedly until only minimum_graph_size nodes + -- are left or until the size of the coarse graph was not reduced by -- at least the downsize ratio configured by the user - while coarse_graph:getSize() > self.minimum_graph_size - and coarse_graph:getRatio() <= (1 - self.downsize_ratio) + while coarse_graph:getSize() > self.minimum_graph_size + and coarse_graph:getRatio() <= (1 - self.downsize_ratio) do coarse_graph:coarsen() end @@ -188,8 +188,8 @@ end function SpringElectricalHu2006:computeInitialLayout(graph, spring_length) - -- TODO how can supernodes and fixed nodes go hand in hand? - -- maybe fix the supernode if at least one of its subnodes is + -- TODO how can supernodes and fixed nodes go hand in hand? + -- maybe fix the supernode if at least one of its subnodes is -- fixated? -- fixate all nodes that have a 'desired at' option. this will set the @@ -204,7 +204,7 @@ function SpringElectricalHu2006:computeInitialLayout(graph, spring_length) if not graph.nodes[1].fixed and not graph.nodes[2].fixed then -- both nodes can be moved, so we assume node 1 is fixed at (0,0) graph.nodes[1].pos.x = 0 - graph.nodes[1].pos.y = 0 + graph.nodes[1].pos.y = 0 end -- position the loose node relative to the fixed node, with @@ -220,7 +220,7 @@ function SpringElectricalHu2006:computeInitialLayout(graph, spring_length) else -- use a random positioning technique - local function positioning_func(n) + local function positioning_func(n) local radius = 3 * spring_length * self.graph_density * math.sqrt(self.graph_size) / 2 return lib.random(-radius, radius) end @@ -228,8 +228,8 @@ function SpringElectricalHu2006:computeInitialLayout(graph, spring_length) -- compute initial layout based on the random positioning technique for _,node in ipairs(graph.nodes) do if not node.fixed then - node.pos.x = positioning_func(1) - node.pos.y = positioning_func(2) + node.pos.x = positioning_func(1) + node.pos.y = positioning_func(2) end end end @@ -268,7 +268,7 @@ function SpringElectricalHu2006:computeForceLayout(graph, spring_length, step_up -- adjust the initial step length automatically if desired by the user local step_length = self.initial_step_length == 0 and spring_length or self.initial_step_length - + -- convergence criteria etc. local converged = false local energy = math.huge @@ -293,114 +293,6 @@ function SpringElectricalHu2006:computeForceLayout(graph, spring_length, step_up for _,v in ipairs(graph.nodes) do if not v.fixed then - -- vector for the displacement of v - local d = Vector.new(2) - - -- compute repulsive forces - if self.approximate_repulsive_forces then - -- determine the cells that have a repulsive influence on v - local cells = quadtree:findInteractionCells(v, barnes_hut_criterion) - - -- compute the repulsive force between these cells and v - for _,cell in ipairs(cells) do - -- check if the cell is a leaf - if #cell.subcells == 0 then - -- compute the forces between the node and all particles in the cell - for _,particle in ipairs(cell.particles) do - local real_particles = lib.copy(particle.subparticles) - table.insert(real_particles, particle) - - for _,real_particle in ipairs(real_particles) do - local delta = real_particle.pos:minus(v.pos) - - -- enforce a small virtual distance if the node and the cell's - -- center of mass are located at (almost) the same position - if delta:norm() < 0.1 then - delta:update(function (n, value) return 0.1 + lib.random() * 0.1 end) - end - - -- compute the repulsive force vector - local repulsive_force = approximated_repulsive_force(delta:norm(), real_particle.mass) - local force = delta:normalized():timesScalar(repulsive_force) - - -- move the node v accordingly - d = d:plus(force) - end - end - else - -- compute the distance between the node and the cell's center of mass - local delta = cell.center_of_mass:minus(v.pos) - - -- enforce a small virtual distance if the node and the cell's - -- center of mass are located at (almost) the same position - if delta:norm() < 0.1 then - delta:update(function (n, value) return 0.1 + lib.random() * 0.1 end) - end - - -- compute the repulsive force vector - local repulsive_force = approximated_repulsive_force(delta:norm(), cell.mass) - local force = delta:normalized():timesScalar(repulsive_force) - - -- move the node v accordingly - d = d:plus(force) - end - end - else - for _,u in ipairs(graph.nodes) do - if v ~= u then - -- compute the distance between u and v - local delta = u.pos:minus(v.pos) - - -- enforce a small virtual distance if the nodes are - -- located at (almost) the same position - if delta:norm() < 0.1 then - delta:update(function (n, value) return 0.1 + lib.random() * 0.1 end) - end - - -- compute the repulsive force vector - local repulsive_force = accurate_repulsive_force(delta:norm(), u.weight) - local force = delta:normalized():timesScalar(repulsive_force) - - -- move the node v accordingly - d = d:plus(force) - end - end - end - - -- compute attractive forces between v and its neighbors - for _,edge in ipairs(v.edges) do - local u = edge:getNeighbour(v) - - -- compute the distance between u and v - local delta = u.pos:minus(v.pos) - - -- enforce a small virtual distance if the nodes are - -- located at (almost) the same position - if delta:norm() < 0.1 then - delta:update(function (n, value) return 0.1 + lib.random() * 0.1 end) - end - - -- compute the spring force vector between u and v - local attr_force = attractive_force(delta:norm()) - local force = delta:normalized():timesScalar(attr_force) - - -- move the node v accordingly - d = d:plus(force) - end - - -- really move the node now - -- TODO note how all nodes are moved by the same amount (step_length) - -- while Walshaw multiplies the normalized force with min(step_length, - -- d:norm()). could that improve this algorithm even further? - v.pos = v.pos:plus(d:normalized():timesScalar(step_length)) - - -- TODO Hu doesn't mention this but the energy of a particle is - -- typically considered as the product of its mass and the square of - -- its forces. This means we should probably take the weight of - -- the node v into the equation, doesn't it? - -- - -- update the energy function - energy = energy + math.pow(d:norm(), 2) -- vector for the displacement of v local d = Vector.new(2) @@ -424,7 +316,7 @@ function SpringElectricalHu2006:computeForceLayout(graph, spring_length, step_up -- enforce a small virtual distance if the node and the cell's -- center of mass are located at (almost) the same position if delta:norm() < 0.1 then - delta:update(function (n, value) return 0.1 + lib.random() * 0.1 end) + delta:update(function (n, value) return 0.1 + math.random() * 0.1 end) end -- compute the repulsive force vector @@ -442,7 +334,7 @@ function SpringElectricalHu2006:computeForceLayout(graph, spring_length, step_up -- enforce a small virtual distance if the node and the cell's -- center of mass are located at (almost) the same position if delta:norm() < 0.1 then - delta:update(function (n, value) return 0.1 + lib.random() * 0.1 end) + delta:update(function (n, value) return 0.1 + math.random() * 0.1 end) end -- compute the repulsive force vector @@ -462,7 +354,7 @@ function SpringElectricalHu2006:computeForceLayout(graph, spring_length, step_up -- enforce a small virtual distance if the nodes are -- located at (almost) the same position if delta:norm() < 0.1 then - delta:update(function (n, value) return 0.1 + lib.random() * 0.1 end) + delta:update(function (n, value) return 0.1 + math.random() * 0.1 end) end -- compute the repulsive force vector @@ -485,7 +377,7 @@ function SpringElectricalHu2006:computeForceLayout(graph, spring_length, step_up -- enforce a small virtual distance if the nodes are -- located at (almost) the same position if delta:norm() < 0.1 then - delta:update(function (n, value) return 0.1 + lib.random() * 0.1 end) + delta:update(function (n, value) return 0.1 + math.random() * 0.1 end) end -- compute the spring force vector between u and v @@ -521,9 +413,9 @@ function SpringElectricalHu2006:computeForceLayout(graph, spring_length, step_up local delta = x.pos:minus(old_positions[x]) max_movement = math.max(delta:norm(), max_movement) end - - -- the algorithm will converge if the maximum movement is below a - -- threshold depending on the spring length and the convergence + + -- the algorithm will converge if the maximum movement is below a + -- threshold depending on the spring length and the convergence -- tolerance if max_movement < spring_length * self.convergence_tolerance then converged = true @@ -580,7 +472,7 @@ function SpringElectricalHu2006:buildQuadtree(graph) -- larger than the minimum position if min_pos:equals(max_pos) then max_pos = max_pos:plus(Vector.new(2, function (n) - return 0.1 + lib.random() * 0.1 + return 0.1 + math.random() * 0.1 end)) end @@ -592,8 +484,8 @@ function SpringElectricalHu2006:buildQuadtree(graph) -- create the quadtree quadtree = QuadTree.new(min_pos.x, min_pos.y, - max_pos.x - min_pos.x, - max_pos.y - min_pos.y) + max_pos.x - min_pos.x, + max_pos.y - min_pos.y) -- insert nodes into the quadtree for _,node in ipairs(graph.nodes) do diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/SpringElectricalLayouts.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/SpringElectricalLayouts.lua index 6ab74fc3676..df7dc70a745 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/SpringElectricalLayouts.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/SpringElectricalLayouts.lua @@ -30,11 +30,11 @@ declare { { key = "spring constant", value = "0.2" } }, - summary = [[" - This key selects Hu's 2006 spring electrical layout with - appropriate settings for some parameters. - "]] -} + summary = [[" + This key selects Hu's 2006 spring electrical layout with + appropriate settings for some parameters. + "]] + } --- @@ -47,8 +47,8 @@ declare { { key = "convergence tolerance", value = "0.001" }, }, - summary = [[" - This key selects Walshaw's 2000 spring electrical layout with - appropriate settings for some parameters. - "]] -} + summary = [[" + This key selects Walshaw's 2000 spring electrical layout with + appropriate settings for some parameters. + "]] + } diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/SpringElectricalWalshaw2000.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/SpringElectricalWalshaw2000.lua index 5f7978da4eb..02fd09a72d9 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/SpringElectricalWalshaw2000.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/SpringElectricalWalshaw2000.lua @@ -26,7 +26,7 @@ local declare = require("pgf.gd.interface.InterfaceToAlgorithms").declare declare { key = "spring electrical Walshaw 2000 layout", algorithm = SpringElectricalWalshaw2000, - + preconditions = { connected = true, loop_free = true, @@ -35,42 +35,42 @@ declare { old_graph_model = true, - summary = [[" - Implementation of a spring electrical graph drawing algorithm based on - a paper by Walshaw. - "]], - documentation = [[" - \begin{itemize} - \item - C. Walshaw. - \newblock A multilevel algorithm for force-directed graph drawing. - \newblock In J. Marks, editor, \emph{Graph Drawing}, Lecture Notes in - Computer Science, 1984:31--55, 2001. - \end{itemize} - - The following modifications compared to the original algorithm were applied: - % - \begin{itemize} - \item An iteration limit was added. - \item The natural spring length for all coarse graphs is computed based - on the formula presented by Walshaw, so that the natural spring - length of the original graph (coarse graph 0) is the same as - the value requested by the user. - \item Users can define custom node and edge weights. - \item Coarsening stops when $|V(G_i+1)|/|V(G_i)| < p$ where $p = 0.75$. - \item Coarsening stops when the maximal matching is empty. - \item The runtime of the algorithm is improved by use of a quadtree - data structure like Hu does in his algorithm. - \item A limiting the number of levels of the quadtree is not implemented. - \end{itemize} + summary = [[" + Implementation of a spring electrical graph drawing algorithm based on + a paper by Walshaw. + "]], + documentation = [[" + \begin{itemize} + \item + C. Walshaw. + \newblock A multilevel algorithm for force-directed graph + drawing. + \newblock In J. Marks, editor, \emph{Graph Drawing}, Lecture Notes in + Computer Science, 1984:31--55, 2001. + \end{itemize} + + The following modifications compared to the original algorithm were applied: + \begin{itemize} + \item An iteration limit was added. + \item The natural spring length for all coarse graphs is computed based + on the formula presented by Walshaw, so that the natural spring + length of the original graph (coarse graph 0) is the same as + the value requested by the user. + \item Users can define custom node and edge weights. + \item Coarsening stops when $|V(G_i+1)|/|V(G_i)| < p$ where $p = 0.75$. + \item Coarsening stops when the maximal matching is empty. + \item Theruntime of the algorithm is improved by use of a quadtree + data structure like Hu does in his algorithm. + \item A limiting the number of levels of the quadtree is not implemented. + \end{itemize} "]] } - + -- TODO Implement the following keys (or whatever seems appropriate -- and doable for this algorithm): -- - /tikz/desired at -- - /tikz/influence cutoff distance --- - /tikz/spring stiffness (could this be the equivalent to the electric +-- - /tikz/spring stiffness (could this be the equivalent to the electric -- charge of nodes? -- - /tikz/natural spring dimension per edge -- @@ -91,10 +91,10 @@ local lib = require "pgf.gd.lib" function SpringElectricalWalshaw2000:run() - + -- Setup parameters local options = self.digraph.options - + self.iterations = options['iterations'] self.cooling_factor = options['cooling factor'] self.initial_step_length = options['initial step length'] @@ -105,7 +105,7 @@ function SpringElectricalWalshaw2000:run() self.approximate_repulsive_forces = options['approximate remote forces'] self.repulsive_force_order = options['electric force order'] - + self.coarsen = options['coarsen'] self.downsize_ratio = options['downsize ratio'] self.minimum_graph_size = options['minimum coarsening size'] @@ -133,7 +133,7 @@ function SpringElectricalWalshaw2000:run() node.weight = 1 end - -- a node is charged if its weight derives from the default setting + -- a node is charged if its weight derives from the default setting -- of 1 (where it has no influence on the forces) node.charged = node.weight ~= 1 end @@ -142,17 +142,17 @@ function SpringElectricalWalshaw2000:run() for _,edge in ipairs(self.graph.edges) do edge.weight = 1 end - - + + -- initialize the coarse graph data structure. note that the algorithm - -- is the same regardless whether coarsening is used, except that the + -- is the same regardless whether coarsening is used, except that the -- number of coarsening steps without coarsening is 0 local coarse_graph = CoarseGraph.new(self.graph) -- check if the multilevel approach should be used if self.coarsen then - -- coarsen the graph repeatedly until only minimum_graph_size nodes - -- are left or until the size of the coarse graph was not reduced by + -- coarsen the graph repeatedly until only minimum_graph_size nodes + -- are left or until the size of the coarse graph was not reduced by -- at least the downsize ratio configured by the user while coarse_graph:getSize() > self.minimum_graph_size and coarse_graph:getRatio() < (1 - self.downsize_ratio) @@ -162,7 +162,7 @@ function SpringElectricalWalshaw2000:run() end -- compute the natural spring length for the coarsest graph in a way - -- that will result in the desired natural spring length in the + -- that will result in the desired natural spring length in the -- original graph local spring_length = self.natural_spring_length / math.pow(math.sqrt(4/7), coarse_graph:getLevel()) @@ -186,17 +186,17 @@ function SpringElectricalWalshaw2000:run() else -- generate a random initial layout for the coarsest graph self:computeInitialLayout(coarse_graph.graph, spring_length) - + -- apply the force-based algorithm to improve the layout self:computeForceLayout(coarse_graph.graph, spring_length) - end + end end function SpringElectricalWalshaw2000:computeInitialLayout(graph, spring_length) - -- TODO how can supernodes and fixed nodes go hand in hand? - -- maybe fix the supernode if at least one of its subnodes is + -- TODO how can supernodes and fixed nodes go hand in hand? + -- maybe fix the supernode if at least one of its subnodes is -- fixated? -- fixate all nodes that have a 'desired at' option. this will set the @@ -237,8 +237,8 @@ function SpringElectricalWalshaw2000:computeInitialLayout(graph, spring_length) -- compute initial layout based on the random positioning technique for _,node in ipairs(graph.nodes) do if not node.fixed then - node.pos.x = positioning_func(1) - node.pos.y = positioning_func(2) + node.pos.x = positioning_func(1) + node.pos.y = positioning_func(2) end end end @@ -248,9 +248,9 @@ end function SpringElectricalWalshaw2000:computeForceLayout(graph, spring_length) -- global (=repulsive) force function - local function accurate_repulsive_force(distance, weight) + local function accurate_repulsive_force(distance, weight) return - self.spring_constant * weight * math.pow(spring_length, self.repulsive_force_order + 1) / math.pow(distance, self.repulsive_force_order) - end + end -- global (=repulsive, approximated) force function local function approximated_repulsive_force(distance, mass) @@ -258,8 +258,8 @@ function SpringElectricalWalshaw2000:computeForceLayout(graph, spring_length) end -- local (spring) force function - local function attractive_force(distance, d, weight, charged, repulsive_force) - -- for charged nodes, never subtract the repulsive force; we want ALL other + local function attractive_force(distance, d, weight, charged, repulsive_force) + -- for charged nodes, never subtract the repulsive force; we want ALL other -- nodes to be attracted more / repulsed less (not just non-adjacent ones), -- depending on the charge of course if charged then @@ -285,9 +285,9 @@ function SpringElectricalWalshaw2000:computeForceLayout(graph, spring_length) -- convergence criteria local converged = false local i = 0 - + while not converged and i < self.iterations do - + -- assume that we are converging converged = true i = i + 1 @@ -303,137 +303,137 @@ function SpringElectricalWalshaw2000:computeForceLayout(graph, spring_length) -- iterate over all nodes for _,v in ipairs(graph.nodes) do if not v.fixed then - -- vector for the displacement of v - local d = Vector.new(2) - - -- repulsive force induced by other nodes - local repulsive_forces = {} - - -- compute repulsive forces - if self.approximate_repulsive_forces then - -- determine the cells that have an repulsive influence on v - local cells = quadtree:findInteractionCells(v, barnes_hut_criterion) - - -- compute the repulsive force between these cells and v - for _,cell in ipairs(cells) do - -- check if the cell is a leaf - if #cell.subcells == 0 then - -- compute the forces between the node and all particles in the cell - for _,particle in ipairs(cell.particles) do - -- build a table that contains the particle plus all its subparticles - -- (particles at the same position) - local real_particles = lib.copy(particle.subparticles) - table.insert(real_particles, particle) - - for _,real_particle in ipairs(real_particles) do - local delta = real_particle.pos:minus(v.pos) - - -- enforce a small virtual distance if the node and the cell's - -- center of mass are located at (almost) the same position - if delta:norm() < 0.1 then - delta:update(function (n, value) return 0.1 + lib.random() * 0.1 end) - end - - -- compute the repulsive force vector - local repulsive_force = approximated_repulsive_force(delta:norm(), real_particle.mass) - local force = delta:normalized():timesScalar(repulsive_force) - - -- remember the repulsive force for the particle so that we can - -- subtract it later when computing the attractive forces with - -- adjacent nodes - repulsive_forces[real_particle.node] = repulsive_force - - -- move the node v accordingly - d = d:plus(force) - end - end - else - -- compute the distance between the node and the cell's center of mass - local delta = cell.center_of_mass:minus(v.pos) - - -- enforce a small virtual distance if the node and the cell's - -- center of mass are located at (almost) the same position - if delta:norm() < 0.1 then - delta:update(function (n, value) return 0.1 + lib.random() * 0.1 end) - end - - -- compute the repulsive force vector - local repulsive_force = approximated_repulsive_force(delta:norm(), cell.mass) - local force = delta:normalized():timesScalar(repulsive_force) - - -- TODO for each neighbor of v, check if it is in this cell. - -- if this is the case, compute the quadtree force for the mass - -- 'node.weight / cell.mass' and remember this as the repulsive - -- force of the neighbor; (it is not necessarily at - -- the center of mass of the cell, so the result is only an - -- approximation of the real repulsive force generated by the - -- neighbor) - - -- move the node v accordingly - d = d:plus(force) - end - end - else - for _,u in ipairs(graph.nodes) do - if u.name ~= v.name then - -- compute the distance between u and v - local delta = u.pos:minus(v.pos) - - -- enforce a small virtual distance if the nodes are - -- located at (almost) the same position - if delta:norm() < 0.1 then - delta:update(function (n, value) return 0.1 + lib.random() * 0.1 end) - end - - -- compute the repulsive force vector - local repulsive_force = accurate_repulsive_force(delta:norm(), u.weight) - local force = delta:normalized():timesScalar(repulsive_force) - - -- remember the repulsive force so we can later subtract them - -- when computing the attractive forces - repulsive_forces[u] = repulsive_force - - -- move the node v accordingly - d = d:plus(force) - end - end - end - - -- compute attractive forces between v and its neighbors - for _,edge in ipairs(v.edges) do - local u = edge:getNeighbour(v) - - -- compute the distance between u and v - local delta = u.pos:minus(v.pos) - - -- enforce a small virtual distance if the nodes are - -- located at (almost) the same position - if delta:norm() < 0.1 then - delta:update(function (n, value) return 0.1 + lib.random() * 0.1 end) - end - - -- compute the spring force between them - local attr_force = attractive_force(delta:norm(), #v.edges, u.weight, u.charged, repulsive_forces[u]) - local force = delta:normalized():timesScalar(attr_force) - - -- move the node v accordingly - d = d:plus(force) - end - - -- remember the previous position of v - old_position = v.pos:copy() - - if d:norm() > 0 then - -- reposition v according to the force vector and the current temperature - v.pos = v.pos:plus(d:normalized():timesScalar(math.min(step_length, d:norm()))) - end - - -- we need to improve the system energy as long as any of - -- the node movements is large enough to assume we're far - -- away from the minimum system energy - if v.pos:minus(old_position):norm() > spring_length * self.convergence_tolerance then - converged = false - end + -- vector for the displacement of v + local d = Vector.new(2) + + -- repulsive force induced by other nodes + local repulsive_forces = {} + + -- compute repulsive forces + if self.approximate_repulsive_forces then + -- determine the cells that have an repulsive influence on v + local cells = quadtree:findInteractionCells(v, barnes_hut_criterion) + + -- compute the repulsive force between these cells and v + for _,cell in ipairs(cells) do + -- check if the cell is a leaf + if #cell.subcells == 0 then + -- compute the forces between the node and all particles in the cell + for _,particle in ipairs(cell.particles) do + -- build a table that contains the particle plus all its subparticles + -- (particles at the same position) + local real_particles = lib.copy(particle.subparticles) + table.insert(real_particles, particle) + + for _,real_particle in ipairs(real_particles) do + local delta = real_particle.pos:minus(v.pos) + + -- enforce a small virtual distance if the node and the cell's + -- center of mass are located at (almost) the same position + if delta:norm() < 0.1 then + delta:update(function (n, value) return 0.1 + math.random() * 0.1 end) + end + + -- compute the repulsive force vector + local repulsive_force = approximated_repulsive_force(delta:norm(), real_particle.mass) + local force = delta:normalized():timesScalar(repulsive_force) + + -- remember the repulsive force for the particle so that we can + -- subtract it later when computing the attractive forces with + -- adjacent nodes + repulsive_forces[real_particle.node] = repulsive_force + + -- move the node v accordingly + d = d:plus(force) + end + end + else + -- compute the distance between the node and the cell's center of mass + local delta = cell.center_of_mass:minus(v.pos) + + -- enforce a small virtual distance if the node and the cell's + -- center of mass are located at (almost) the same position + if delta:norm() < 0.1 then + delta:update(function (n, value) return 0.1 + math.random() * 0.1 end) + end + + -- compute the repulsive force vector + local repulsive_force = approximated_repulsive_force(delta:norm(), cell.mass) + local force = delta:normalized():timesScalar(repulsive_force) + + -- TODO for each neighbour of v, check if it is in this cell. + -- if this is the case, compute the quadtree force for the mass + -- 'node.weight / cell.mass' and remember this as the repulsive + -- force of the neighbour; (it is not necessarily at + -- the center of mass of the cell, so the result is only an + -- approximation of the real repulsive force generated by the + -- neighbour) + + -- move te node v accordingly + d = d:plus(force) + end + end + else + for _,u in ipairs(graph.nodes) do + if u.name ~= v.name then + -- compute the distance between u and v + local delta = u.pos:minus(v.pos) + + -- enforce a small virtual distance if the nodes are + -- located at (almost) the same position + if delta:norm() < 0.1 then + delta:update(function (n, value) return 0.1 + math.random() * 0.1 end) + end + + -- compute the repulsive force vector + local repulsive_force = accurate_repulsive_force(delta:norm(), u.weight) + local force = delta:normalized():timesScalar(repulsive_force) + + -- remember the repulsive force so we can later subtract them + -- when computing the attractive forces + repulsive_forces[u] = repulsive_force + + -- move the node v accordingly + d = d:plus(force) + end + end + end + + -- compute attractive forces between v and its neighbours + for _,edge in ipairs(v.edges) do + local u = edge:getNeighbour(v) + + -- compute the distance between u and v + local delta = u.pos:minus(v.pos) + + -- enforce a small virtual distance if the nodes are + -- located at (almost) the same position + if delta:norm() < 0.1 then + delta:update(function (n, value) return 0.1 + math.random() * 0.1 end) + end + + -- compute the spring force between them + local attr_force = attractive_force(delta:norm(), #v.edges, u.weight, u.charged, repulsive_forces[u]) + local force = delta:normalized():timesScalar(attr_force) + + -- move the node v accordingly + d = d:plus(force) + end + + -- remember the previous position of v + old_position = v.pos:copy() + + if d:norm() > 0 then + -- reposition v according to the force vector and the current temperature + v.pos = v.pos:plus(d:normalized():timesScalar(math.min(step_length, d:norm()))) + end + + -- we need to improve the system energy as long as any of + -- the node movements is large enough to assume we're far + -- away from the minimum system energy + if v.pos:minus(old_position):norm() > spring_length * self.convergence_tolerance then + converged = false + end end end @@ -488,7 +488,7 @@ function SpringElectricalWalshaw2000:buildQuadtree(graph) -- larger than the minimum position if min_pos:equals(max_pos) then max_pos = max_pos:plus(Vector.new(2, function (n) - return 0.1 + lib.random() * 0.1 + return 0.1 + math.random() * 0.1 end)) end @@ -500,8 +500,8 @@ function SpringElectricalWalshaw2000:buildQuadtree(graph) -- create the quadtree quadtree = QuadTree.new(min_pos.x, min_pos.y, - max_pos.x - min_pos.x, - max_pos.y - min_pos.y) + max_pos.x - min_pos.x, + max_pos.y - min_pos.y) -- insert nodes into the quadtree for _,node in ipairs(graph.nodes) do diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/SpringHu2006.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/SpringHu2006.lua index 51e278b904c..b53bc9bff98 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/SpringHu2006.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/SpringHu2006.lua @@ -25,7 +25,7 @@ local declare = require("pgf.gd.interface.InterfaceToAlgorithms").declare declare { key = "spring Hu 2006 layout", algorithm = SpringHu2006, - + preconditions = { connected = true, loop_free = true, @@ -34,20 +34,20 @@ declare { old_graph_model = true, - summary = [[" - Implementation of a spring graph drawing algorithm based on - a paper by Hu. - "]], - documentation = [[" - \begin{itemize} - \item - Y. Hu. - \newblock Efficient, high-quality force-directed graph drawing. - \newblock \emph{The Mathematica Journal}, 2006. - \end{itemize} - - There are some modifications compared to the original algorithm, - see the Diploma thesis of Pohlmann for details. + summary = [[" + Implementation of a spring graph drawing algorithm based on + a paper by Hu. + "]], + documentation = [[" + \begin{itemize} + \item + Y. Hu. + \newblock Efficient, high-quality force-directed graph drawing. + \newblock \emph{The Mathematica Journal}, 2006. + \end{itemize} + + There are some modifications compared to the original algorithm, + see the Diploma thesis of Pohlmann for details. "]] } @@ -65,26 +65,26 @@ local lib = require("pgf.gd.lib") function SpringHu2006:run() - + -- Setup some parameters local options = self.digraph.options - + self.iterations = options['iterations'] self.cooling_factor = options['cooling factor'] self.initial_step_length = options['initial step length'] self.convergence_tolerance = options['convergence tolerance'] self.natural_spring_length = options['node distance'] - + self.coarsen = options['coarsen'] self.downsize_ratio = options['downsize ratio'] self.minimum_graph_size = options['minimum coarsening size'] -- Setup - + self.downsize_ratio = math.max(0, math.min(1, tonumber(self.downsize_ratio))) - + self.graph_size = #self.graph.nodes self.graph_density = (2 * #self.graph.edges) / (#self.graph.nodes * (#self.graph.nodes - 1)) @@ -96,7 +96,7 @@ function SpringHu2006:run() assert(self.natural_spring_length >= 0, 'the natural spring dimension (value: ' .. self.natural_spring_length .. ') needs to be greater than or equal to 0') assert(self.downsize_ratio >= 0 and self.downsize_ratio <= 1, 'the downsize ratio (value: ' .. self.downsize_ratio .. ') needs to be between 0 and 1') assert(self.minimum_graph_size >= 2, 'the minimum coarsening size of coarse graphs (value: ' .. self.minimum_graph_size .. ') needs to be greater than or equal to 2') - + -- initialize node weights for _,node in ipairs(self.graph.nodes) do node.weight = 1 @@ -106,20 +106,20 @@ function SpringHu2006:run() for _,edge in ipairs(self.graph.edges) do edge.weight = 1 end - - + + -- initialize the coarse graph data structure. note that the algorithm - -- is the same regardless whether coarsening is used, except that the + -- is the same regardless whether coarsening is used, except that the -- number of coarsening steps without coarsening is 0 local coarse_graph = CoarseGraph.new(self.graph) -- check if the multilevel approach should be used if self.coarsen then - -- coarsen the graph repeatedly until only minimum_graph_size nodes - -- are left or until the size of the coarse graph was not reduced by + -- coarsen the graph repeatedly until only minimum_graph_size nodes + -- are left or until the size of the coarse graph was not reduced by -- at least the downsize ratio configured by the user - while coarse_graph:getSize() > self.minimum_graph_size - and coarse_graph:getRatio() <= (1 - self.downsize_ratio) + while coarse_graph:getSize() > self.minimum_graph_size + and coarse_graph:getRatio() <= (1 - self.downsize_ratio) do coarse_graph:coarsen() end @@ -192,8 +192,8 @@ end function SpringHu2006:computeInitialLayout(graph, spring_length) - -- TODO how can supernodes and fixed nodes go hand in hand? - -- maybe fix the supernode if at least one of its subnodes is + -- TODO how can supernodes and fixed nodes go hand in hand? + -- maybe fix the supernode if at least one of its subnodes is -- fixated? -- fixate all nodes that have a 'desired at' option. this will set the @@ -208,7 +208,7 @@ function SpringHu2006:computeInitialLayout(graph, spring_length) if not graph.nodes[1].fixed and not graph.nodes[2].fixed then -- both nodes can be moved, so we assume node 1 is fixed at (0,0) graph.nodes[1].pos.x = 0 - graph.nodes[1].pos.y = 0 + graph.nodes[1].pos.y = 0 end -- position the loose node relative to the fixed node, with @@ -223,16 +223,16 @@ function SpringHu2006:computeInitialLayout(graph, spring_length) end else -- use a random positioning technique - local function positioning_func(n) + local function positioning_func(n) local radius = 2 * spring_length * self.graph_density * math.sqrt(self.graph_size) / 2 return lib.random(-radius, radius) end -- compute initial layout based on the random positioning technique for _,node in ipairs(graph.nodes) do - if not node.fixed then - node.pos.x = positioning_func(1) - node.pos.y = positioning_func(2) + if not node.fixed then + node.pos.x = positioning_func(1) + node.pos.y = positioning_func(2) end end end @@ -253,7 +253,7 @@ function SpringHu2006:computeForceLayout(graph, spring_length, step_update_func) -- adjust the initial step length automatically if desired by the user local step_length = self.initial_step_length == 0 and spring_length or self.initial_step_length - + -- convergence criteria etc. local converged = false local energy = math.huge @@ -273,39 +273,6 @@ function SpringHu2006:computeForceLayout(graph, spring_length, step_update_func) for _,v in ipairs(graph.nodes) do if not v.fixed then - -- vector for the displacement of v - local d = Vector.new(2) - - for _,u in ipairs(graph.nodes) do - if v ~= u then - -- compute the distance between u and v - local delta = u.pos:minus(v.pos) - - -- enforce a small virtual distance if the nodes are - -- located at (almost) the same position - if delta:norm() < 0.1 then - delta:update(function (n, value) return 0.1 + lib.random() * 0.1 end) - end - - local graph_distance = (distances[u] and distances[u][v]) and distances[u][v] or #graph.nodes + 1 - - -- compute the repulsive force vector - local force = repulsive_force(delta:norm(), graph_distance, v.weight) - local force = delta:normalized():timesScalar(force) - - -- move the node v accordingly - d = d:plus(force) - end - end - - -- really move the node now - -- TODO note how all nodes are moved by the same amount (step_length) - -- while Walshaw multiplies the normalized force with min(step_length, - -- d:norm()). could that improve this algorithm even further? - v.pos = v.pos:plus(d:normalized():timesScalar(step_length)) - - -- update the energy function - energy = energy + math.pow(d:norm(), 2) -- vector for the displacement of v local d = Vector.new(2) @@ -317,7 +284,7 @@ function SpringHu2006:computeForceLayout(graph, spring_length, step_update_func) -- enforce a small virtual distance if the nodes are -- located at (almost) the same position if delta:norm() < 0.1 then - delta:update(function (n, value) return 0.1 + lib.random() * 0.1 end) + delta:update(function (n, value) return 0.1 + math.random() * 0.1 end) end local graph_distance = (distances[u] and distances[u][v]) and distances[u][v] or #graph.nodes + 1 @@ -351,9 +318,9 @@ function SpringHu2006:computeForceLayout(graph, spring_length, step_update_func) local delta = x.pos:minus(old_positions[x]) max_movement = math.max(delta:norm(), max_movement) end - - -- the algorithm will converge if the maximum movement is below a - -- threshold depending on the spring length and the convergence + + -- the algorithm will converge if the maximum movement is below a + -- threshold depending on the spring length and the convergence -- tolerance if max_movement < spring_length * self.convergence_tolerance then converged = true diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/SpringLayouts.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/SpringLayouts.lua index e3ac58d5718..5554410816e 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/SpringLayouts.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/SpringLayouts.lua @@ -29,8 +29,8 @@ declare { { key = "spring Hu 2006 layout" }, }, - summary = [[" - This key selects Hu's 2006 spring layout with appropriate settings - for some parameters. - "]] -} + summary = [[" + This key selects Hu's 2006 spring layout with appropriate settings + for some parameters. + "]] + } diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms/FruchtermanReingold.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms/FruchtermanReingold.lua index 2450bba2a20..6c9677aeabb 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms/FruchtermanReingold.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms/FruchtermanReingold.lua @@ -20,39 +20,33 @@ local Storage = require "pgf.gd.lib.Storage" declare { key = "spring electric no coarsen layout", algorithm = SpringElectricNoCoarsenClass, - preconditions = { connected = true }, + preconditions = { connected = true }, postconditions = {fixed = true}, - summary = [[ - This layout uses the algorithm proposed by Fruchterman and Reingold to draw graphs." - ]], - - documentation = [[ - The Fruchterman-Reingold algorithm is one if the oldest methods - for force-based graph drawing. It is described in: - % - \begin{itemize} - \item - Thomas M.~J.~ Fruchterman and Edward M.~ Reingold, - \newblock Graph Drawing by Force-directed Placement, - \newblock \emph{Software -- practice and experience,} - 21(1 1), 1129-1164, 1991. - \end{itemize} - % - Fruchterman and Reingold had to principles in graph drawing: - % - \begin{enumerate} - \item Vertices connected by an edge should be drawn close to another and - \item in general, vertices should not be drawn too close to each other. - \end{itemize} - % - The spring electric no coarsen layout uses spring forces as attractive - forces influencing vertex pairs connected by an edge and electric forces - as repulsive forces between all vertex pairs. The original algorithm - also contained a frame that stopped the vertices from drifting too far - apart, but this concept was not implemented. This algorithm will not be - affected by coarsening. This layout was implemented by using the Jedi - framework. + summary = [[This layout uses the algorithm proposed by Fruchterman and Reingold to draw graphs."]], + + documentation = + [[The Fruchterman-Reingold algorithm is one if the oldest methods + for force-based graph drawing. It is described in: + \begin{itemize} + \item + Thomas M.~J.~ Fruchterman and Edward M.~ Reingold, + \newblock Graph Drawing by Force-directed Placement, + \newblock \emph{Software -- practice and experience,} + 21(1 1), 1129-1164, 1991. + \end{itemize} + Fruchterman and Reingold had to principles in graph drawing: + \begin{enumerate} + \item Vertices connected by an edge should be drawn close toa another and + \item in general, vertices should not be drawn too close to each other. + \end{itemize} + The spring electric no coarsen layout uses spring forces as attractive + forces influecing vertex pairs connected by an edge and electric forces + as repulsive forces between all vertex pairs. The original algorithm + also contained a frame that stopped the vertices from drifting too far + apart, but this concept was not implemented. This algorithm will not be affected + by coarsening. This layout was implemented + by using the Jedi framework. ]], example = @@ -68,14 +62,14 @@ declare { g -- {h, i, j}, h -- {i, j}, i -- j - }; + }; ]], example = [[ \graph[spring electric no coarsen layout, speed = 0.25, node distance = 0.25cm, horizontal = c to l, nodes={as=,circle, draw, inner sep=3pt,outer sep=0pt}, coarsen = false, maximum step = 1]{ a -> b -> c -> {d1 -> e -> f -> g -> h -> i -> {j1 -> e, j2 -> l}, d2 -> l -> m}, m -> a - }; + }; ]] } @@ -86,7 +80,7 @@ declare { --define a local time function local time_fun_1 -function time_fun_1 (t_total, t_now) +function time_fun_1 (t_total, t_now) if t_now/t_total <= 0.5 then return 0.5 else @@ -118,7 +112,7 @@ function SpringElectricNoCoarsenClass:run() } -- run algorithm - spring_electric_no_coarsen:run() + spring_electric_no_coarsen:run() end return SpringElectricNoCoarsenClass
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms/HuSpringElectricalFW.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms/HuSpringElectricalFW.lua index 57cd1547b6c..08ccad1308f 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms/HuSpringElectricalFW.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms/HuSpringElectricalFW.lua @@ -20,31 +20,29 @@ declare { key = "jedi spring electric layout", algorithm = HuClass, documentation_in = "documentation_hu_layout", - preconditions = { connected = true }, + preconditions = { connected = true }, postconditions = {fixed = true}, - summary = "This layout uses the spring electric algorithm proposed by Hu to draw graphs.", + summary = "This layout uses the spring electric algorithm proposed by Hu to draw graphs.", - documentation = [[ - The spring electric algorithm by Hu uses two kinds of forces and coarsening. - It is described in: - % - \begin{itemize} - \item - Yifan Hu, - \newblock Efficient, high quality force-directed graph drawing, - \newblock \emph{The Mathematica Journal,} - 10(1), 37--71, 2006. - \end{itemize} - % - This algorithm uses spring forces as attractive forces between vertices - connected by an edge and electric forces as repulsive forces between - all vertex pairs. Hu introduces coarsening, a procedure which repeatedly - merges vertices in order to obtain a smaller version of the graph, to - overcome local minima. He also uses the Barnes-Hut algorithm to enhance - the runtime of his algorithms. This algorithm is not used in this - implementation. This layout was implemented by using the Jedi framework. - ]], + documentation = + [[The spring electric algorithm by Hu uses two kinds of forces and coarsening. + It is described in: + \begin{itemize} + \item + Yifan Hu, + \newblock Efficient, high quality force-directed graph drawing, + \newblock \emph{The Mathematica Journal,} + 10(1), 37-71, 2006. + \end{itemize} + This algorithm uses spring forces as attractive forces between vertices + connected by an edge and electric forces as repulsive forces between + all vertex pairs. Hu introduces coarsening, a procedure which repeatedly + merges vertices in order to obtain a smaller version of the graph, to + overcome local minima. He also uses the Barnes-Hut algorithm to enhance + the runtime of his algorithms. This algorithm is not used in this + implementation. This layout was implemented by using the Jedi framework. + ]], example = [[ @@ -54,15 +52,15 @@ declare { b -- {c, d, e}, c -- {d, e}, d --e - }; - ]], + }; + ]], example = [[ \tikz \graph[spring electric fw layout, speed = 0.35, node distance = 1cm, horizontal = c to l, nodes={as=,circle, draw, inner sep=3pt,outer sep=0pt}, maximum displacement per step = 10]{ a -> b -> c -> {d1 -> e -> f -> g -> h -> i -> {j1 -> e, j2 -> l}, d2 -> l -> m}, m -> a - }; + }; ]] } diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms/SimpleSpring.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms/SimpleSpring.lua index 4dbae2b1f4c..20a1be5de0e 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms/SimpleSpring.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms/SimpleSpring.lua @@ -19,34 +19,35 @@ declare { key = "trivial spring layout", algorithm = SimpleSpringClass, documentation_in = "pgf.gd.doc.jedi.algorithms.SimpleSpringLayout", - preconditions = { connected = true }, + preconditions = { connected = true }, postconditions = {fixed = true}, - summary = "This layout uses only spring forces to draw graphs.", + summary = "This layout uses only spring forces to draw graphs.", - documentation = [[ - The simple spring algorithm only uses one force kind: A spring force - that serves as both attractive and repulsive force. The edges are modeled as - springs and act according to Hoke's law: They have an ideal length and will - expand if they are contracted below this length, pushing the adjacent - vertices away from each other, and contract if it is stretched, pulling the - adjacent vertices towards each other. This ideal length is given by the - parameter |node distance|. There is no force repelling vertices that are not - connected to each other, which can lead to vertices being placed at the same - point. It is not a very powerful layout and will probably fail with large - graphs, especially if they have few edges. It can however be used to - demonstrate the effect of spring forces. This layout was implemented by using - the Jedi framework. - ]], + documentation = + [[The simple spring algorithm only uses one force kind: A spring force + that serves as both attracitve and repuslive force. The edges are modeled as + springs and act according to Hoke's law: They have an ideal length and will + expand if they are contracted below this length, pushing the adjacent + vertices away from each other, and contract if it is stretched, pulling the + adjacent vertices towards each other. This ideal length is given by the + parameter |node distance|. There is no force repelling vertices that are not + connected to each other, which can lead to vertices being placed at the same + point. It is not a very powerfull layout and will probably fail with large + graphs, especially if they have few edges. It can however be used to + demonstrate the effect of spring forces. This layout was implemented by using + the Jedi framework. + ]], - example = [[ - \tikz - \graph[simple spring layout, node distance = 3cm, speed = 2, nodes={as=,circle, draw, inner sep=3pt,outer sep=0pt}, coarsen = true, maximum step = 1]{ - a -- {b, c, d, e}, - b -- {c, d, e}, - c -- {d, e}, - d --e - }; + example = + [[ + \tikz + \graph[simple spring layout, node distance = 3cm, speed = 2, nodes={as=,circle, draw, inner sep=3pt,outer sep=0pt}, coarsen = true, maximum step = 1]{ + a -- {b, c, d, e}, + b -- {c, d, e}, + c -- {d, e}, + d --e + }; ]] } @@ -68,7 +69,7 @@ function SimpleSpringClass:run() } -- run algorithm - simple_spring:run() + simple_spring:run() end return SimpleSpringClass
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms/SocialGravityCloseness.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms/SocialGravityCloseness.lua index 1c8a1bb8d91..12e6c02e4bf 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms/SocialGravityCloseness.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms/SocialGravityCloseness.lua @@ -24,64 +24,63 @@ declare { algorithm = SocialClass, postconditions = {fixed = true}, - summary = [[ - This layout uses the social gravity algorithm proposed by Bannister - with closeness mass to draw graphs. - ]], + summary = [[This layout uses the social gravity algorithm proposed by Bannister + with closeness mass to draw graphs.]], - documentation = [[ - Bannister et all described a social gravity algorithm that can be - implemented with different kinds of gravity. - It is described in: - % - \begin{itemize} - \item Michael J.~ Bannister and David Eppstein and Michael T~. Goodrich - and Lowell Trott, - \newblock Force-Directed Graph Drawing Using Social Gravity and Scaling, - \newblock \emph{CoRR,} - abs/1209.0748, 2012. - \end{itemize} - % - This implementation uses the closeness mass to determine the gravity of each - vertex. There are three forces in this algorithm: A spring force as - attractive force between vertices connected by an edge, an electric force as - repulsive force between all vertex pairs, and a gravitational force pulling - all vertices closer to their midpoint. The gravitational force depends on - the social mass of a vertex, which can be determined in different ways. This - algorithm uses the closeness mass. The closeness of a vertex $u$ is the - reciprocal of the sum of the shortest path from $u$ to every other vertex - $v$. The gravitational force leads to more "important" vertices ending up - closer to the middle of the drawing, since the social mass of a vertex is - proportional to its importance. The social layouts work especially well on - unconnected graphs like forests. This layout was implemented by using the - Jedi framework. - ]], + documentation = + [[Bannister et all described a social gravity algorithm that can be + implemented with different kinds of gravity. + It is described in: + \begin{itemize} + \item + Michael J.~ Bannister and David Eppstein and Michael T~. Goodrich and + Lowell Trott, + \newblock Force-Directed Graph Drawing Using Social Gravity and Scaling, + \newblock \emph{CoRR,} + abs/1209.0748, 2012. + \end{itemize} + This implementation uses the closeness mass to determine the gravity of each + vertex. There are three forces in this algorithm: A spring force as + attractive force between vertices connected by an edge, an electric force as + repulsive force between all vertex pairs, and a gravitational force pulling + all vertices closer to their midpoint. The gravitational force depends on + the social mass of a vertex, which can be determined in different ways. This + algorithm uses the closeness mass. The closeness of a vertex $u$ is the + reciprocal of the sum of the shortest path from $u$ to every other vertex + $v$. The gravitational force leads to more "important" vertices ending up + closer to the middle of the drawing, since the social mass of a vertex is + proportinal to its importance. The social layouts work especially well on + unconnected graphs like forests. This layout was implemented by using the + Jedi framework. + ]], - example = [[ - \tikz - \graph[social closeness layout, speed = 0.9, gravity = 0.2, node distance = 0.65cm, nodes={as=,circle, draw, inner sep=3pt,outer sep=0pt}, find equilibrium = true, maximum step = 5]{ - a -- a1 -- a2 -- a, - b -- b1 -- b2 -- b, - c -- c1 -- c2 -- c, - d -- d1 -- d2 -- d, - e -- e1 -- e2 -- e, - f -- f1 -- f2 -- f, - g -- g1 -- g2 -- g, - h -- h1 -- h2 -- h, - i -- i1 -- i2 -- i, - j -- j1 -- j2 -- j, - a -- b -- c -- d -- e -- f -- g -- h -- i -- j -- a - }; - ]], + example = + [[ + \tikz + \graph[social closeness layout, speed = 0.9, gravity = 0.2, node distance = 0.65cm, nodes={as=,circle, draw, inner sep=3pt,outer sep=0pt}, find equilibrium = true, maximum step = 5]{ + a -- a1 -- a2 -- a, + b -- b1 -- b2 -- b, + c -- c1 -- c2 -- c, + d -- d1 -- d2 -- d, + e -- e1 -- e2 -- e, + f -- f1 -- f2 -- f, + g -- g1 -- g2 -- g, + h -- h1 -- h2 -- h, + i -- i1 -- i2 -- i, + j -- j1 -- j2 -- j, + a -- b -- c -- d -- e -- f -- g -- h -- i -- j -- a + }; + ]], - example = [[ - \tikz - \graph[social closeness layout, speed = 0.35, node distance = 0.7cm, maximum step = 5, nodes={as=,circle, draw, inner sep=3pt,outer sep=0pt}, radius = 1cm, gravity = 2]{ - a -- {a1 -- a2, a3}, - b -- {b1, b2 -- b3 -- b4 --{b5, b6}}, - c -- {c1--c2}, - d -- {d1, d2, d3 -- {d4, d5}, d6 --{d7, d8}} - }; + example = + [[ + \tikz + \graph[social closeness layout, speed = 0.35, node distance = 0.7cm, maximum step = 5, nodes={as=,circle, draw, inner sep=3pt,outer sep=0pt}, radius = 1cm, gravity = 2]{ + a -- {a1 -- a2, a3}, + b -- {b1, b2 -- b3 -- b4 --{b5, b6}}, + c -- {c1--c2}, + d -- {d1, d2, d3 -- {d4, d5}, d6 --{d7, d8}} + }; ]] } @@ -94,7 +93,7 @@ function SocialClass:run() tmp = fw_attributes[vertex] local sum = 0 for i, w in pairs(n) do - sum = sum + w + sum = sum + w end sum = sum / # self.ugraph.vertices tmp.mass = 1/sum @@ -109,21 +108,21 @@ function SocialClass:run() social_gravity:addForce{ force_type = ForceCanvasDistance, fun_u = function (data) return data.k/(data.d*data.d) end, - epoch = {"after expand", "during expand"} + epoch = {"after expand", "during expand"} } social_gravity:addForce{ force_type = ForceCanvasPosition, fun_u = function (data) return data.attributes[data.u].mass*data.attributes.options.gravity end, - epoch = {"after expand", "during expand"} + epoch = {"after expand", "during expand"} } social_gravity:addForce{ force_type = ForceGraphDistance, fun_u = function (data) return -data.d/(data.k*data.k) end, n = 1, - epoch = {"after expand", "during expand"} + epoch = {"after expand", "during expand"} } social_gravity:run() end -return SocialClass +return SocialClass
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms/SocialGravityDegree.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms/SocialGravityDegree.lua index 6408349107b..8e94a561871 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms/SocialGravityDegree.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/algorithms/SocialGravityDegree.lua @@ -23,63 +23,60 @@ declare { algorithm = SocialClass, postconditions = {fixed = true}, - summary = [[ - This layout uses the social gravity algorithm proposed by Bannister - with closeness mass to draw graphs.]], - - documentation = [[ - Bannister et all described a social gravity algorithm that can be - implemented with different kinds of gravity. - It is described in: - % - \begin{itemize} - \item - Michael J.~ Bannister and David Eppstein and Michael T~. Goodrich and - Lowell Trott, - \newblock Force-Directed Graph Drawing Using Social Gravity and Scaling, - \newblock \emph{CoRR,} abs/1209.0748, 2012. - \end{itemize} - % - This implementation uses the degree mass to determine the gravity of each - vertex. There are three forces in this algorithm: A spring force as - attractive force between vertices connected by an edge, an electric force as - repulsive force between all vertex pairs, and a gravitational force pulling - all vertices closer to their midpoint. The gravitational force depends on - the social mass of a vertex, which can be determined in different ways. This - algorithm uses the degree of each vertex as its mass. The gravitational - force leads to more "important" vertices ending up closer to the middle of - the drawing, since the social mass of a vertex is proportional to its - importance. The social layouts work especially well on unconnected graphs - like forests. This layout was implemented by using the Jedi framework. - ]], + summary = [[This layout uses the social gravity algorithm proposed by Bannister + with closeness mass to draw graphs.]], + + documentation = + [[Bannister et all described a social gravity algorithm that can be + implemented with different kinds of gravity. + It is described in: + \begin{itemize} + \item + Michael J.~ Bannister and David Eppstein and Michael T~. Goodrich and + Lowell Trott, + \newblock Force-Directed Graph Drawing Using Social Gravity and Scaling, + \newblock \emph{CoRR,} + abs/1209.0748, 2012. + \end{itemize} + This implementation uses the degree mass to determine the gravity of each + vertex. There are three forces in this algorithm: A spring force as + attractive force between vertices connected by an edge, an electric force as + repulsive force between all vertex pairs, and a gravitational force pulling + all vertices closer to their midpoint. The gravitational force depends on + the social mass of a vertex, which can be determined in different ways. This + algorithm uses the degree of each vertex as its mass. The gravitational + force leads to more "important" vertices ending up closer to the middle of + the drawing, since the social mass of a vertex is proportinal to its + importance. The social layouts work especially well on unconnected graphs + like forests. This layout was implemented by using the Jedi framework. + ]], example = [[ - \tikz - \graph[social degree layout, speed = 0.9, gravity = 0.2, node distance = 0.65cm, nodes={as=,circle, draw, inner sep=3pt,outer sep=0pt}, find equilibrium = true, maximum step = 5]{ - a -- a1 -- a2 -- a, - b -- b1 -- b2 -- b, - c -- c1 -- c2 -- c, - d -- d1 -- d2 -- d, - e -- e1 -- e2 -- e, - f -- f1 -- f2 -- f, - g -- g1 -- g2 -- g, - h -- h1 -- h2 -- h, - i -- i1 -- i2 -- i, - j -- j1 -- j2 -- j, - a -- b -- c -- d -- e -- f -- g -- h -- i -- j -- a - }; - ]], + \graph[social degree layout, speed = 0.9, gravity = 0.2, node distance = 0.65cm, nodes={as=,circle, draw, inner sep=3pt,outer sep=0pt}, find equilibrium = true, maximum step = 5]{ + a -- a1 -- a2 -- a, + b -- b1 -- b2 -- b, + c -- c1 -- c2 -- c, + d -- d1 -- d2 -- d, + e -- e1 -- e2 -- e, + f -- f1 -- f2 -- f, + g -- g1 -- g2 -- g, + h -- h1 -- h2 -- h, + i -- i1 -- i2 -- i, + j -- j1 -- j2 -- j, + a -- b -- c -- d -- e -- f -- g -- h -- i -- j -- a + }; + ]], example = [[ - \tikz - \graph[social degree layout, speed = 0.35, node distance = 0.7cm, maximum step = 15, nodes={as=,circle, draw, inner sep=3pt,outer sep=0pt}, radius = 1cm, gravity = 0.2]{ - a -- {a1 -- a2, a3}, - b -- {b1, b2 -- b3 -- b4 --{b5, b6}}, - c -- {c1--c2}, - d -- {d1, d2, d3 -- {d4, d5}, d6 --{d7, d8}} - }; + \tikz + \graph[social degree layout, speed = 0.35, node distance = 0.7cm, maximum step = 15, nodes={as=,circle, draw, inner sep=3pt,outer sep=0pt}, radius = 1cm, gravity = 0.2]{ + a -- {a1 -- a2, a3}, + b -- {b1, b2 -- b3 -- b4 --{b5, b6}}, + c -- {c1--c2}, + d -- {d1, d2, d3 -- {d4, d5}, d6 --{d7, d8}} + }; ]] } @@ -88,30 +85,30 @@ declare { key = "gravity", type = "number", initial = 0.2, - + summary = "The gravity key describes the magnitude of the gravitational force.", - documentation = [[ - This parameter currently only affects the \lstinline{social degree layout} - and the \lstinline{social closeness layout}. The gravity key determines the - strength used to pull the vertices to the center of the canvas. - ]], + documentation = + [[ + This parameter currently only affects the \lstinline{social degree layout} + and the \lstinline{social closeness layout}. The gravity key determines the + strength used to pull the vertices to the center of the canvas. + ]], example = [[ - \tikz - \graph[social degree layout, iterations = 100, maximum time = 100, maximum step = 10]{ - a1[weight = 2] -- {a2, a3, a4, a5}, - b1 -- {b2 -- {b3, b4}, b5} - }; - ]], - - example = [[ - \tikz - \graph[social degree layout, iterations = 100, maximum time = 100, gravity = 0.5, maximum step = 10]{ - a1 -- {a2 [mass = 2], a3, a4, a5}, - b1 -- {b2 -- {b3, b4}, b5} - }; + \graph[social degree layout, iterations = 100, maximum time = 100, maximum step = 10]{ + a1[weight = 2] -- {a2, a3, a4, a5}, + b1 -- {b2 -- {b3, b4}, b5} + }; + ]], + + example = + [[ + \graph[social degree layout, iterations = 100, maximum time = 100, gravity = 0.5, maximum step = 10]{ + a1 -- {a2 [mass = 2], a3, a4, a5}, + b1 -- {b2 -- {b3, b4}, b5} + }; ]] } @@ -138,7 +135,7 @@ function time_fun_3 (t_total, t_now) end end --- define table to store variables if needed +-- define table to store variables if needed local fw_attributes = Storage.newTableStorage() function SocialClass:run() @@ -151,7 +148,7 @@ function SocialClass:run() -- add options to storage table fw_attributes.options = self.ugraph.options - + -- generate new force class local social_gravity = ForceController.new(self.ugraph, fw_attributes) @@ -177,7 +174,7 @@ function SocialClass:run() } -- run algorithm - social_gravity:run() + social_gravity:run() end return SocialClass
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/base/CoarseGraphFW.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/base/CoarseGraphFW.lua index 04872146547..f33d44e6ae1 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/base/CoarseGraphFW.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/base/CoarseGraphFW.lua @@ -9,12 +9,12 @@ --- A class for creating and handling "coarse" versions of a graph. Such versions contain --- less nodes and edges than the original graph while retaining the overall --- structure. This class offers functions to create coarse graphs and to expand them --- to regain their original size. +-- less nodes and edges than the original graph while retaining the overall +-- structure. This class offers functions to create coarse graphs and to expand them +-- to regain their original size. -- Imports -local Digraph = require "pgf.gd.model.Digraph" +local Digraph = require "pgf.gd.model.Digraph" local Vertex = require "pgf.gd.model.Vertex" local Arc = require "pgf.gd.model.Arc" @@ -25,26 +25,26 @@ CoarseGraph.__index = CoarseGraph --- Creates a new coarse graph derived from an existing graph. -- --- Generates a coarse graph for the input |Digraph|. +-- Generates a coarse graph for the input |Digraph|. -- --- Coarsening describes the process of reducing the amount of vertices in a graph --- by merging vertices into pseudo-vertices. There are different strategies, --- to decide which vertices should be merged, like merging vertices that belong to edges in a --- maximal independent edge set or by creating pseudo-vertices based on a maximal --- independent node set. Those strategies are called --- schemes. +-- Coarsening describes the process of reducing the amount of vertices in a graph +-- by merging vertices into pseudo-vertices. There are different strategies, +-- to decide which vertices should be merged, like merging vertices that belong to edges in a +-- maximal independent edge set or by creating pseudo-verties based on a maximal +-- independent node set. Those strategies are called +-- schemes. -- -- Coarsening is not performed automatically. The function |CoarseGraph:coarsen| -- can be used to further coarsen the graph, or the function |CoarseGraph:uncoarsen| -- can be used to restore the previous state. -- -- Note, however, that the input \meta{graph} is always modified in-place, so --- if the original version of \meta{graph} is needed in parallel to its --- coarse representations, a deep copy of \meta{graph} needs to be passed over +-- if the original version of \meta{graph} is needed in parallel to its +-- coarse representations, a deep copy of \meta{grpah} needs to be passed over -- to |CoarseGraph.new|. -- -- @param graph An existing graph that needs to be coarsened. --- @param fw_attributes The user defined attributes, possibly attached to vertices. +-- @param fw_attributes The user defined attributes, possibly attached to vertices. function CoarseGraph.new(ugraph, fw_attributes) local coarse_graph = { @@ -62,10 +62,10 @@ end -- locals for performance local find_maximal_matching, arc_function --- This function performs one coarsening step: It finds all independent vertex --- set according to |scheme|, coarsens them and adds the newly created --- vertices to the collapsed_vertices table, associating them with the current --- level. +-- This function performs one coarsening step: It finds all independent vertex +-- set according to |scheme|, coarsens them and adds the newly created +-- vertices to the collapsed_vertices table, associating them with the current +-- level. function CoarseGraph:coarsen() -- update the level self.level = self.level + 1 @@ -87,32 +87,32 @@ function CoarseGraph:coarsen() local collapse_vertices = {a_h, a_t} collapse_vertex = Vertex.new {weight = 0, mass = 0} - ugraph:collapse(collapse_vertices, - collapse_vertex, - function (a,b) - a.weight = a.weight + b.weight - a.mass = a.mass + b.mass - if fw_attributes then - for key,value in pairs(fw_attributes[b]) do - if fw_attributes.functions[key] then - fw_attributes.functions[key](a,b) - elseif type(value) == "number" then - local tmp = fw_attributes[a] - if not tmp[key] then - tmp[key] = 0 + ugraph:collapse(collapse_vertices, + collapse_vertex, + function (a,b) + a.weight = a.weight + b.weight + a.mass = a.mass + b.mass + if fw_attributes then + for key,value in pairs(fw_attributes[b]) do + if fw_attributes.functions[key] then + fw_attributes.functions[key](a,b) + elseif type(value) == "number" then + local tmp = fw_attributes[a] + if not tmp[key] then + tmp[key] = 0 + end + tmp[key] = tmp[key] + value + end + end + end + end, + function (a,b) + if a.weight == nil then + a.weight = b.weight + else + a.weight = a.weight + b.weight end - tmp[key] = tmp[key] + value - end - end - end - end, - function (a,b) - if a.weight == nil then - a.weight = b.weight - else - a.weight = a.weight + b.weight - end - end) + end) local c_v_p = collapse_vertex.pos local a_h_p = a_h.pos @@ -133,19 +133,19 @@ function CoarseGraph:coarsen() self.ratio = #vertices / old_graph_size end --- This function expands all vertices associated with the current level, then +-- This function expands all vertices assoicated with the current level, then -- updates the level. function CoarseGraph:uncoarsen() local a = self.collapsed_vertices[self.level] local ugraph = self.ugraph - local random = lib.random - local randomseed = lib.randomseed + local random = math.random + local randomseed = math.randomseed for j=#a,1,-1 do randomseed(42) local to_expand = a[j] - ugraph:expand(to_expand, function(a,b) + ugraph:expand(to_expand, function(a,b) b.pos.x = a.pos.x + random()*10 b.pos.y = a.pos.y + random()*10 end) @@ -176,13 +176,13 @@ function CoarseGraph:getGraph() return self.ugraph end --- Private helper function to determine whether the second vertex in the +-- Private helper function to determine whether the second vertex in the -- current arc has been matched already -- -- @param arc The arc in question -- @param vertex One of the arc's endpoints, either head or tail -- @param matched_vertices The table holding all matched vertices --- +-- -- @return The arc if the other endpoint has not been matched yet function arc_function (arc, vertex, matched_vertices) local x @@ -191,22 +191,22 @@ function arc_function (arc, vertex, matched_vertices) else x = arc.tail end - if not matched_vertices[x] then - return arc + if not matched_vertices[x] then + return arc end end --- The function finding a maximum matching of independent arcs. +-- The function finding a maximum matching of independent arcs. -- -- @param ugraph The current graph -- --- @return A table of arcs which are in the matching +-- @return A table of arcs wich are in the matching function find_matching(ugraph) local matching = {} local matched_vertices = {} local unmatched_vertices = {} local vertices = ugraph.vertices - + -- iterate over nodes in random order for _,j in ipairs(lib.random_permutation(#vertices)) do local vertex = vertices[j] @@ -240,7 +240,7 @@ function find_matching(ugraph) return x.weight < y.weight end) - -- match the node against the neighbor with minimum weight + -- match the node against the neighbour with minimum weight matched_vertices[arcs[1].head] = true matched_vertices[arcs[1].tail] = true table.insert(matching, arcs[1]) @@ -261,4 +261,4 @@ end -- done -return CoarseGraph +return CoarseGraph
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/base/ForceController.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/base/ForceController.lua index ab30ada5b32..1762fcf07eb 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/base/ForceController.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/base/ForceController.lua @@ -8,27 +8,26 @@ -- See the file doc/generic/pgf/licenses/LICENSE for more information ---- This class is the most basic class for the Jedi framework. It manages the --- forces, epochs, options and streamlines the graph drawing process. +--- This class is the most basic class for the Jedi framework. It manages the +-- forces, epochs, options and streamlines the graph drawing process. -- In detail, the force template will do the following: --- % -- \begin{itemize} --- \item Hold the table with all epochs currently defined, and provide --- a function to add new ones --- \item Hold the table associating forces with the epochs, and provide a --- function to add new ones --- \item Define all the non-algorithm-specific options provided by Jedi --- \item Assert user options to catch exceptions --- \item Save user options and library functions to local variables to enhance --- runtime. --- \item Add any forces that are indicated by set options --- \item Find and call the initial positioning algorithm requested --- \item Determine if coarsening is enabled, and manage coarsening process if so --- \item Call the preprocessing function of each force to obtain a vertex list the --- force will be applied to --- \item Calculate the forces affecting each vertex. --- \item Move the vertices, check for equilibria/used up iterations, update --- virtual time +-- \item Hold the table with all epochs currently defined, and provide +-- a function to add new ones +-- \item Hold the table associating forces with the epochs, and provide a +-- function to add new ones +-- \item Define all the non-algorithm-specific options provided by Jedi +-- \item Assert user options to catch exceptions +-- \item Save user options and library functions to local variables to enchance +-- runtime. +-- \item Add any forces that are indicated by set options +-- \item Find and call the initial positioning algorithm requested +-- \item Determine if coarsening is enabled, and manage coarsening process if so +-- \item Call the proprocesing function of each force to obtain a vertex list the +-- force will be applied to +-- \item Calculate the forces affecting each vertex. +-- \item Move the vertices, check for equilibria/used up iterations, update +-- virtual time -- \end{itemize} local ForceController = {} @@ -43,7 +42,7 @@ local ForcePullToPoint = require "pgf.gd.force.jedi.forcetypes.ForcePullToPoint" local ForcePullToGrid = require "pgf.gd.force.jedi.forcetypes.ForcePullToGrid" local epochs = { - [1] = "preprocessing", + [1] = "preprocessing", [2] = "initial layout", [3] = "start coarsening process", [4] = "before coarsen", @@ -60,14 +59,14 @@ local epochs = { } -- Automatic parameter generation for epoch-variables -for _,e in ipairs(epochs) do - --- +for _,e in ipairs(epochs) do + --- declare { key = "iterations " .. e, type = "number" } - --- + --- declare { key = "maximum displacement per step " .. e, type = "number" @@ -116,9 +115,9 @@ end -- @return An integer value matching the epch's index, or $-1$ if epoch was not found function ForceController:findEpoch(epoch) - for j, e in ipairs(epochs) do + for j, e in ipairs(epochs) do if e == epoch then - return j + return j end end return -1 @@ -133,17 +132,17 @@ local sum_up, options, move_vertices, get_net_force, preprocessing, epoch_forces --- Creating a new force algorithm -- @params ugraph The ugraph object the graph drawing algorithm will run on --- @params fw_attributes The storage object holding the additional attributes defined by +-- @params fw_attributes The storage object holding the additional attributes defined by -- the engineer -- -- @returns A new instance of force template function ForceController.new(ugraph, fw_attributes) - return setmetatable( + return setmetatable( {epoch_forces = {}, ugraph = ugraph, fw_attributes = fw_attributes, pull_to_point = false, - }, ForceController) + }, ForceController) end --- Running the force algorithm @@ -179,16 +178,16 @@ function ForceController:run() end -- Initialize epoch_forces table entries as empty tables - for _, e in ipairs(epochs) do + for _, e in ipairs(epochs) do if not self.epoch_forces[e] then self.epoch_forces[e] = {} end end - -- Find initial positioning algorithm + -- Find inital positioning algorithm local initial_positioning_class = options.algorithm_phases['initial positioning force framework'] -- initial_types[self.initial_layout] - -- If snap to grid option is set and no force was added yet, add an extra + -- If snap to grid option is set and no force was added yet, add an extra -- force to post-processing if snap_to_grid then self:addForce{ @@ -212,15 +211,15 @@ function ForceController:run() local end_coarsen = self:findEpoch("end coarsen") local start_expand = self:findEpoch("start expand") local end_expand = self:findEpoch("end expand") - + -- iterate over epoch table local i = 1 - while i <= #epochs do + while i <= #epochs do local e = epochs[i] local iterations = options["iterations "..e] or options["iterations"] - -- assert input + -- assert input assert(iterations >= 0, 'iterations (value: ' .. iterations .. ') needs to be greater than 0') -- Check for desired vertices and collect them in a table if any are found @@ -228,7 +227,7 @@ function ForceController:run() local desired_vertices = {} -- initialize node weights for _,vertex in ipairs(vertices) do - if vertex.options then + if vertex.options then if vertex.options["desired at"] then desired = true desired_vertices[vertex] = vertex.options["desired at"] @@ -236,7 +235,7 @@ function ForceController:run() end end - -- Add pull to point force if desired vertices were found and engineer did not add + -- Add pull to point force if desired vertices were found and engineer did not add -- this force if desired and not self.pull_to_point then self:addForce{ @@ -250,9 +249,9 @@ function ForceController:run() -- vertices = coarse_graph.ugraph.vertices -- arcs = coarse_graph.ugraph.arcs if i >= start_coarsening and i < end_coarsening then - -- coarsen the graph repeatedly until only minimum_graph_size nodes - -- are left or until the size of the coarse graph was not reduced by - -- at least the downsize ratio configured by the user + -- coarsen the graph repeatedly until only minimum_graph_size nodes + -- are left or until the size of the coarse graph was not reduced by + -- at least the downsize ratio configured by the user if i >= start_coarsen and i < start_expand then if coarse_graph:getSize() > minimum_graph_size and coarse_graph:getRatio() <= (1 - downsize_ratio) then if i == start_coarsen then @@ -260,9 +259,9 @@ function ForceController:run() elseif i < end_coarsen then preprocessing(coarse_graph.ugraph.vertices, coarse_graph.ugraph.arcs, e, coarse_graph.ugraph) move_vertices(coarse_graph.ugraph.vertices, e) - else + else i = start_coarsen - 1 - end + end end end @@ -272,13 +271,13 @@ function ForceController:run() local spring_length = natural_spring_length if not vertices_initalized then - initial_positioning_class.new { vertices = coarse_graph.ugraph.vertices, - options = options, - desired_vertices = desired_vertices + initial_positioning_class.new { vertices = coarse_graph.ugraph.vertices, + options = options, + desired_vertices = desired_vertices }:run() vertices_initalized = true end - + preprocessing(coarse_graph.ugraph.vertices, coarse_graph.ugraph.arcs, e, coarse_graph.ugraph) -- set the spring length to the average arc length of the initial layout @@ -306,9 +305,9 @@ function ForceController:run() elseif i < end_expand then preprocessing(coarse_graph.ugraph.vertices, coarse_graph.ugraph.arcs, e, coarse_graph.ugraph) move_vertices(coarse_graph.ugraph.vertices, e) - else + else i = start_expand - 1 - end + end else preprocessing(coarse_graph.ugraph.vertices, coarse_graph.ugraph.arcs, e, coarse_graph.ugraph) move_vertices(coarse_graph.ugraph.vertices, e) @@ -318,9 +317,9 @@ function ForceController:run() elseif i < start_coarsening or i > end_coarsening then if not vertices_initalized then initial_positioning_class.new { - vertices = coarse_graph.ugraph.vertices, - options = options, - desired_vertices = desired_vertices }:run() + vertices = coarse_graph.ugraph.vertices, + options = options, + desired_vertices = desired_vertices }:run() vertices_initalized = true end preprocessing(coarse_graph.ugraph.vertices, coarse_graph.ugraph.arcs, e, coarse_graph.ugraph) @@ -331,9 +330,9 @@ function ForceController:run() if i < start_coarsening or i > end_coarsening then if not vertices_initalized then initial_positioning_class.new { - vertices = vertices, - options = options, - desired_vertices = desired_vertices }:run() + vertices = vertices, + options = options, + desired_vertices = desired_vertices }:run() vertices_initalized = true end preprocessing(vertices, arcs, e, ugraph) @@ -349,7 +348,7 @@ end -- -- @params v The vertices of the current graph -- @params a The arcs of the current graph --- @params epoch The preprocessing algorithm will only be applied to the forces +-- @params epoch The preprocessing algorithm will only be applied to the forces -- associated with this epoch. -- @params ugraph The current graph object @@ -360,8 +359,8 @@ function preprocessing(v, a, epoch, ugraph) end ---- Adding forces to the algorithm. --- +--- Adding forces to the algorithm. +-- -- @params force_data A table containing force type, time function, force function, -- capping thresholds and the epochs in which this force will be active @@ -375,7 +374,7 @@ function ForceController:addForce(force_data) if force_data.epoch == nil then force_data.epoch = {} end - for _,e in ipairs(force_data.epoch) do + for _,e in ipairs(force_data.epoch) do local tab = self.epoch_forces[e] if not tab then tab = {} @@ -383,10 +382,10 @@ function ForceController:addForce(force_data) tab[#tab +1] = f self.epoch_forces[e] = tab end -end +end ---- Moving vertices according to force functions until the maximum number of +--- Moving vertices according to force functions until the maximum number of -- iterations is reached -- -- @params vertices The vertices in the current graph @@ -409,16 +408,16 @@ function move_vertices(vertices, epoch, g) local max_time = options["maximum time ".. epoch] or options["maximum time"] local d_t = max_time/iterations local t_now = 0 - local random = lib.random - local randomseed = lib.randomseed - + local random = math.random + local randomseed = math.randomseed + for j = 1 , iterations do t_now = t_now + d_t net_forces = get_net_force(vertices, j, t_now, epoch) - + -- normalize the force vector if necessary for v, c in pairs(net_forces) do - local n = sqrt(c.x*c.x+c.y*c.y) + local n = sqrt(c.x*c.x+c.y*c.y) if n > max_step then local factor = max_step/n c.x = c.x*factor @@ -430,7 +429,7 @@ function move_vertices(vertices, epoch, g) if not find_equilibrium or sum_up(net_forces)*d_t > epsilon then local cool_down_dt = d_t if cool_down_dt > 1 then - cool_down_dt = 1 + 1/d_t + cool_down_dt = 1 + 1/d_t end for _, v in ipairs(vertices) do local factor = 1/(v.mass or 1) @@ -455,9 +454,9 @@ end -- @params t_now The current virtual time -- @params epoch The current epoch -- --- @return A table of coordinate-objects associated with vertices. The --- coordinate object hold the calculated net displacement for --- the $x$ and $y$ coordinate. +-- @return A table of coordinate-objects associated with vertices. The +-- coordinate object hold the calculated net displacement for +-- the $x$ and $y$ coordinate. function get_net_force(vertices, j, t_now, epoch) local net_forces = {} local natural_spring_length = options["node distance"] @@ -465,11 +464,11 @@ function get_net_force(vertices, j, t_now, epoch) for _,v in ipairs(vertices) do net_forces[v] = Coordinate.new(0,0) end - + for _,force_class in ipairs(epoch_forces[epoch]) do force_class:applyTo{net_forces = net_forces, options = options, j = j, t_now = t_now, k = natural_spring_length} end - + return net_forces end @@ -486,4 +485,4 @@ function sum_up(tab) return sum end -return ForceController +return ForceController
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/base/ForceTemplate.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/base/ForceTemplate.lua index 29370fc0297..06b61870ff4 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/base/ForceTemplate.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/base/ForceTemplate.lua @@ -8,8 +8,8 @@ -- See the file doc/generic/pgf/licenses/LICENSE for more information ---- This is the parent class for forces. It provides a constructor and methods --- stubs to be overwritten in the subclasses. +--- This is the parent class for forces. It provides a constructor and methods +-- stubs to be overwritten in the subclasses. -- Imports local lib = require "pgf.gd.lib" @@ -33,11 +33,11 @@ function ForceTemplate:preprocess(v) end -- Method stub for applying the forces --- --- @param data A table holding data like the table the forces are collected +-- +-- @param data A table holding data like the table the forces are collected -- in, the current iteration, the current time stamp, some options -- or the natural spring length - + function ForceTemplate:applyTo(data) end diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/base/InitialTemplate.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/base/InitialTemplate.lua index 762717f64a1..ad315e7a660 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/base/InitialTemplate.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/base/InitialTemplate.lua @@ -8,11 +8,11 @@ -- See the file doc/generic/pgf/licenses/LICENSE for more information ---- This is the parent class for initial layout algorithms. It provides a --- constructor and methods stubs to be overwritten in the subclasses as well +--- This is the parent class for initial layout algorithms. It provides a +-- constructor and methods stubs to be overwritten in the subclasses as well -- as placing vertices which are |desired at| a certain point. --- Imports +-- Imports local lib = require "pgf.gd.lib" local InitialTemplate = lib.class {} @@ -21,14 +21,14 @@ local InitialTemplate = lib.class {} function InitialTemplate:constructor() self.vertices = self.vertices self.options = self.options - self.desired_vertices = self.desired_vertices + self.desired_vertices = self.desired_vertices end -- Method placing |desired at| vertices at the point they are desired -- --- @params desired_vertices A table containing all the vertices where the +-- @params desired_vertices A table containing all the vertices where the -- |desired at| option is set. --- +-- -- @return |placed| A boolean array stating if vertices have been placed yet -- @return |centroid_x| The x-coordinate of the midpoint of all placed vertices -- @return |centroid_y| The y-coordinate of the midpoint of all placed vertices @@ -37,7 +37,7 @@ function InitialTemplate:desired(desired_vertices) local placed = {} local centroid_x, centroid_y = 0, 0 - + local size = 0 for v, da in pairs(desired_vertices) do local p = v.pos @@ -53,7 +53,7 @@ function InitialTemplate:desired(desired_vertices) centroid_x = centroid_x / size centroid_y = centroid_y / size end - + return placed, centroid_x, centroid_y end diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/base/PathLengthsFW.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/base/PathLengthsFW.lua index 2d50677fa5f..cf7cbddc20f 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/base/PathLengthsFW.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/base/PathLengthsFW.lua @@ -7,9 +7,9 @@ -- -- See the file doc/generic/pgf/licenses/LICENSE for more information ---- This is a helper class providing different functions that deal with graph --- distances. This class can be used by engineers and implementers if they --- need to calculate anything regarding graph distances. +--- This is a helper class providing different functions that deal with graph +-- distances. This class can be used by engineers and implementers if they +-- need to calculate anything regarding graph distances. local PathLengths = {} @@ -17,12 +17,12 @@ local PathLengths = {} local PriorityQueue = require "pgf.gd.lib.PriorityQueue" local Preprocessing = require "pgf.gd.force.jedi.base.Preprocessing" --- This algorithm conducts a breadth first search on the graph it is given. --- +-- This algorithm conducts a breadth first search on the graph it is given. +-- -- @param ugraph The graph on which the search should be conducted -- --- @return A table holding every vertex $v$ as key and a table as value. The --- value table holds all other vertices $u$ as keys and their shortest +-- @return A table holding every vertex $v$ as key and a table as value. The +-- value table holds all other vertices $u$ as keys and their shortest -- distance to $v$ as value function PathLengths:breadthFirstSearch(ugraph) @@ -57,12 +57,12 @@ end -- @param ugraph The graph where the paths should be found -- @param source The source vertex -- --- @return |distance| A table holding every vertex $v$ as key and a table as --- value. The value table holds all other vertices $u$ as +-- @return |distance| A table holding every vertex $v$ as key and a table as +-- value. The value table holds all other vertices $u$ as -- keys and their shortest distance to $v$ as value --- @return |levels| A table holding the levels of the graph as keys and a +-- @return |levels| A table holding the levels of the graph as keys and a -- table holding the vertices found on that level as values --- @return |parent| A table holding each vertex as key and it's parent vertex +-- @return |parent| A tbale holding each vertex as key and it's parent vertex -- as value function PathLengths:dijkstra(ugraph, source) @@ -113,13 +113,13 @@ function PathLengths:dijkstra(ugraph, source) return distance, levels, parent end --- This function finds the pseudo diameter of the graph, which is the longest --- shortest path in the graph +-- This function finds the pseudo diameter of the graph, which is the longest +-- shortest path in the graph -- -- @param ugraph The graph who's pseudo diameter is wanted -- -- @ return |diameter| The pseudo diameter of the graph --- @ return |start_node| The start node of the longest shortest path in the +-- @ return |start_node| The start node of the longest shortest path in the -- graph -- @ return |end_node| The end node of the longest shortest path in the graph diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/base/Preprocessing.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/base/Preprocessing.lua index de59e0cb5cc..182a1e4fa79 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/base/Preprocessing.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/base/Preprocessing.lua @@ -8,10 +8,10 @@ -- See the file doc/generic/pgf/licenses/LICENSE for more information ---- This file holds functions to create lists of vertex pairs. All --- functions return a Graph object containing the vertices of the --- original graph and an edge between the vertices forming a pair --- under the specified conditions. The lists can be precomputed to +--- This file holds functions to create lists of vertex pairs. All +-- functions return a Graph object containing the vertices of the +-- original graph and an edge between the vertices forming a pair +-- under the specified conditions. The lists can be precomouted to -- enhance performance. local PreprocessClass = {} @@ -21,7 +21,7 @@ local declare = require "pgf.gd.interface.InterfaceToAlgorithms".declare local Digraph = require "pgf.gd.model.Digraph" --- Creates a graph object with an arc between all pairwise disjoint vertex +-- Creates a graph object with an arc between all pairwise disjoint vertex -- pairs and returns the arc table -- -- @param vertices The vertices of the original graph @@ -29,94 +29,94 @@ local Digraph = require "pgf.gd.model.Digraph" -- @return An arc table function PreprocessClass.allPairs(vertices) - local aP = Digraph.new{} - for _, vertex in ipairs(vertices) do - for _, vertex2 in ipairs(vertices) do - if vertex ~= vertex2 then - if not aP:contains(vertex) then - aP:add {vertex} - end - if not aP:contains(vertex2) then - aP:add {vertex2} - end - if not aP:arc(vertex, vertex2) and not aP:arc(vertex2, vertex) then - aP:connect(vertex, vertex2) - end - end - end - end - return aP.arcs + local aP = Digraph.new{} + for _, vertex in ipairs(vertices) do + for _, vertex2 in ipairs(vertices) do + if vertex ~= vertex2 then + if not aP:contains(vertex) then + aP:add {vertex} + end + if not aP:contains(vertex2) then + aP:add {vertex2} + end + if not aP:arc(vertex, vertex2) and not aP:arc(vertex2, vertex) then + aP:connect(vertex, vertex2) + end + end + end + end + return aP.arcs end --- Creates a graph object with an arc between all pairwise disjoint vertex --- pairs that are connected by a shortest path of length n in the original +-- Creates a graph object with an arc between all pairwise disjoint vertex +-- pairs that are connected by a shortest path of length n in the original -- graph and returns the arc table -- -- @param vertices The vertices of the original graph -- @param arcs The arcs of the original graph --- @param n The length of the shortest path we are looking for +-- @param n The length of the shortest path we are looking for -- -- @return An arc table function PreprocessClass.overExactlyNPairs(vertices, arcs, n) - local waste, p_full = PreprocessClass.overMaxNPairs(vertices, arcs, n) - local waste, p_small = PreprocessClass.overMaxNPairs(vertices, arcs, n-1) - for _, paar in ipairs(p_full.arcs) do - if p_small:arc(paar.head, paar.tail) ~= nil or p_small:arc(paar.tail, paar.head) ~= nil then - p_full:disconnect(paar.head, paar.tail) - p_full:disconnect(paar.tail, paar.head) - end - end - return p_full.arcs + local waste, p_full = PreprocessClass.overMaxNPairs(vertices, arcs, n) + local waste, p_small = PreprocessClass.overMaxNPairs(vertices, arcs, n-1) + for _, paar in ipairs(p_full.arcs) do + if p_small:arc(paar.head, paar.tail) ~= nil or p_small:arc(paar.tail, paar.head) ~= nil then + p_full:disconnect(paar.head, paar.tail) + p_full:disconnect(paar.tail, paar.head) + end + end + return p_full.arcs end --- Creates a graph object with an arc between all pairwise disjoint vertex --- pairs that are connected by a shortest path of length n or shorter in the +-- Creates a graph object with an arc between all pairwise disjoint vertex +-- pairs that are connected by a shortest path of length n or shorter in the -- original graph and returns the arc table --- +-- -- @param vertices The vertices of the original graph -- @param arcs The arcs of the original graph --- @param n The length of the shortest path we are looking for +-- @param n The length of the shortest path we are looking for -- -- @return An arc table function PreprocessClass.overMaxNPairs(vertices, arcs, n) - assert(n >= 0, 'n (value: ' .. n.. ') needs to be greater or equal 0') - local p = Digraph.new{} - local oneHop = Digraph.new{} - if n> 0 then - for _, arc in ipairs(arcs) do - local vertex = arc.head - local vertex2 = arc.tail - if not p:contains(vertex) then - p:add {vertex} - oneHop:add {vertex} - end - if not p:contains(vertex2) then - p:add {vertex2} - oneHop:add {vertex2} - end - if p:arc(vertex, vertex2) == nil and p:arc(vertex2, vertex) == nil then - p:connect(vertex, vertex2) - oneHop:connect(vertex, vertex2) - end - end - end + assert(n >= 0, 'n (value: ' .. n.. ') needs to be greater or equal 0') + local p = Digraph.new{} + local oneHop = Digraph.new{} + if n> 0 then + for _, arc in ipairs(arcs) do + local vertex = arc.head + local vertex2 = arc.tail + if not p:contains(vertex) then + p:add {vertex} + oneHop:add {vertex} + end + if not p:contains(vertex2) then + p:add {vertex2} + oneHop:add {vertex2} + end + if p:arc(vertex, vertex2) == nil and p:arc(vertex2, vertex) == nil then + p:connect(vertex, vertex2) + oneHop:connect(vertex, vertex2) + end + end + end - n = n-1 - while n > 0 do - for _, paar in ipairs(p.arcs) do - for _, vertex in ipairs(vertices) do - if paar.head ~= vertex and p:arc(paar.head, vertex) == nil and p:arc(vertex, paar.head) == nil and (oneHop:arc(paar.tail, vertex) ~= nil or oneHop:arc(vertex, paar.tail) ~= nil) then - p:connect(paar.head, vertex) - end - end - end - n = n-1 - end - return p.arcs, p + n = n-1 + while n > 0 do + for _, paar in ipairs(p.arcs) do + for _, vertex in ipairs(vertices) do + if paar.head ~= vertex and p:arc(paar.head, vertex) == nil and p:arc(vertex, paar.head) == nil and (oneHop:arc(paar.tail, vertex) ~= nil or oneHop:arc(vertex, paar.tail) ~= nil) then + p:connect(paar.head, vertex) + end + end + end + n = n-1 + end + return p.arcs, p end -return PreprocessClass +return PreprocessClass
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/doc.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/doc.lua index 19baca73336..620c035d523 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/doc.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/doc.lua @@ -19,17 +19,17 @@ key "maximum step" summary [[ -This option determines the maximum distance every vertex is allowed to travel -in one iteration. +This option determines the maximum ditance every vertex is allowed to travel +in one iteration. ]] documentation [[ -No matter how large the forces influencing a vertex, the effect -on the drawing should be limited to avoid vertices "jumping" from one side of -the canvas to each other due to a strong force pulling them further than their -ideal destination. The amount of space a vertex is allowed to travel in one -iteration is limited by the \lstinline{maximum step} parameter. It is $5000$ +No matter how large the forces influencing a vertex, the effect +on the drawing should be limited to avoid vertices "jumping" from one side of +the canvas to each other due to a strong force pulling them further than their +ideal destination. The amount of space a vertex is allowed to travel in one +iteration is limited by the \lstinline{maximum step} parameter. It is $5000$ by default. That means by default, this parameter should not get in your way. ]] @@ -40,7 +40,7 @@ example \graph[social degree layout, iterations = 2, maximum time = 2, maximum step = 6pt, coarsen = false]{ a1 -- {a2, a3, a4, a5}, b1 -- {b2 -- {b3, b4}, b5} - }; + }; ]] example @@ -49,7 +49,7 @@ example \graph[social degree layout, iterations = 2, maximum time = 2, maximum step = 12pt, coarsen = false]{ a1 -- {a2, a3, a4, a5}, b1 -- {b2 -- {b3, b4}, b5} - }; + }; ]] -------------------------------------------------------------------- @@ -61,15 +61,13 @@ example key "speed" summary -[[ -This is a factor every calculated step is multiplied by. -]] +[[ This is a factor every calculated step is multiplied by.]] documentation [[ The speed is the distance a vertex travels if it is influenced by a force of -$1$N$\cdot\gamma$. The speed is only a factor that will influence the total -amount every vertex can move: Half the speed makes half the movement, twice +$1$N$\cdot\gamma$. The speed is only a factor that will influence the total +amount every vertex can move: Half the speed makes half the movement, twice the speed doubles the distance traveled. ]] @@ -79,7 +77,7 @@ example \graph[social degree layout, iterations = 1, maximum time = 1, maximum step = 100, speed = 0.2, coarsen = false]{ a1 -- {a2, a3, a4, a5}, b1 -- {b2 -- {b3, b4}, b5} - }; + }; ]] example @@ -88,7 +86,7 @@ example \graph[social degree layout, iterations = 1, maximum time= 1, maximum step = 100, speed = 0.4, coarsen = false]{ a1 -- {a2, a3, a4, a5}, b1 -- {b2 -- {b3, b4}, b5} - }; + }; ]] -------------------------------------------------------------------- @@ -98,19 +96,17 @@ example key "maximum time" summary -[[ -The highest amount of virtual time the algorithm is allowed to take. -]] +[[ The highest amount of virtual time the algorithm is allowed to take.]] documentation [[ -This option is part of the virtual time construct of Jedi. The virtual time -concept allows graph drawing algorithm engineers to switch forces on and of -after a relative or absolute amount of time has elapsed. If the iterations -stay the same, doubling the maximum time has the same effect as doubling the -speed: Vertices move faster, but it is possible they miss their intended -destination. Also increasing the iterations changes the "resolution" of the -graph drawing algorithm: More steps are simulated in the same time. +This option is part of the virtual time construct of Jedi. The virtual time +concept allows graph drawing algorithm engineers to switch forces on and of +after a relative or absolute amount of time has elapsed. If the iterations +stay the same, doubling the maximum time has the same effect as doubling the +speed: Vertices move faster, but it is possible they miss their intended +destination. Also increasing the iterations changes the "resolution" of the +graph drawing algorithm: More steps are simulated in the same time. ]] example @@ -119,7 +115,7 @@ example \graph[social degree layout, iterations = 20, maximum time = 100, coarsen = false, maximum step = 0.5, gravity = 2]{ a1 -- {a2, a3, a4, a5}, b1 -- {b2 -- {b3, b4}, b5} - }; + }; ]] example @@ -128,31 +124,29 @@ example \graph[social degree layout, iterations = 20, maximum time = 200, coarsen = false, maximum step = 0.5, gravity = 2]{ a1 -- {a2, a3, a4, a5}, b1 -- {b2 -- {b3, b4}, b5} - }; + }; ]] -------------------------------------------------------------------- - + -------------------------------------------------------------------- key "find equilibrium" summary -[[ -If this option is |true|, the framework checks the vertex movement to detect -low movement near the equilibrium and stop the algorithm. -]] +[[ If this option is |true|, the framework checks the vertex movment to detect +low movement near the equilibrium and stop the algorithm]] documentation [[ -Since we often do not know how many iterations are enough, the framework will -detect when the vertices (almost) stop moving and stop the algorithm. After -each iteration, the framework adds up the net force influencing all the -vertices. If it falls below the threshold |epsilon|, the algorithm -will ignore the left over iterations and terminate. You can disable this -behavior by setting this parameter to |false|. Allowing the framework to find -the equilibrium usually saves you time, while allowing more iterations (or a -lower threshold) generates higher quality drawings. +Since we often do not know how many iterations are enough, the framework will +detect when the vertices (almost) stop moving and stop the algorithm. After +each iteration, the framework adds up the net force influencing all the +vertices. If it falls below the threshold |epsilon|, the algorithm +will ignore the left over iterations and terminate. You can disable this +behavior by setting this parameter to |false|. Allowing the framework to find +the equilibrium usually saves you time, while allowing more iterations (or a + lower threshold) generates higher quality drawings. ]] example @@ -161,7 +155,7 @@ example \graph[social degree layout, iterations = 300, maximum time = 300, coarsen = false, maximum step = 10, epsilon = 10]{ a1 -- {a2, a3, a4, a5}, b1 -- {b2 -- {b3, b4}, b5} - }; + }; ]] example @@ -170,7 +164,7 @@ example \graph[social degree layout, iterations = 300, maximum time = 300, maximum step = 10, find equilibrium = false]{ a1 -- {a2, a3, a4, a5}, b1 -- {b2 -- {b3, b4}, b5} - }; + }; ]] -------------------------------------------------------------------- @@ -180,15 +174,13 @@ example key "epsilon" summary -[[ -The threshold for the |find equilibrium| option. -]] +[[ The threshold for the |find equilibrium| option.]] documentation [[ -This key specifies the threshold for the |find equilibrium| option. The lower -epsilon, the longer the graph drawing algorithm will take, but the closer the -resulting drawing will be to the true energy minimum. +This key specifies the threshold for the |find equilibrium| option. The lower +epsilon, the longer the graph drawing algorithm will take, but the closer the +resulting drawing will be to the true energy minimum. ]] example @@ -197,7 +189,7 @@ example \graph[social degree layout, iterations = 200, maximum time = 200, maximum step = 10, coarsen = false, epsilon = 2]{ a1 -- {a2, a3, a4, a5}, b1 -- {b2 -- {b3, b4}, b5} - }; + }; ]] example @@ -206,7 +198,7 @@ example \graph[social degree layout, iterations = 200, maximum time = 200, maximum step = 10, epsilon = 12, coarsen = false]{ a1 -- {a2, a3, a4, a5}, b1 -- {b2 -- {b3, b4}, b5} - }; + }; ]] -------------------------------------------------------------------- @@ -216,17 +208,15 @@ example key "snap to grid" summary -[[ -This option enables the post-processing step |snap to grid|. -]] +[[ This option enables the post-processing step |snap to grid|.]] documentation [[ -This key is the on/off-switch for the grid forces. The |snap to grid| option -triggers a form of post-processing were all vertices are pulled to the closest -point on a virtual grid. Please note that there is no repulsive force between -the vertices, so it is possible that two vertices are pulled to the same grid -point. The grid size is determined by the parameters |grid x length| and +This key is the on/off-switch for the grid forces. The |snap to grid| option +triggers a form of post-processing were all vertices are pulled to the closest +point on a virtual grid. Please note that there is no repulsive force between +the vertices, so it is possible that two vertices are pulled to the same grid +point. The grid size is determined by the parameters |grid x length| and |grid y length|. ]] @@ -236,7 +226,7 @@ example \graph[social degree layout, iterations = 100, maximum time = 100, maximum step = 10]{ a1 -- {a2, a3, a4, a5}, b1 -- {b2 -- {b3, b4}, b5} - }; + }; ]] example @@ -245,7 +235,7 @@ example \graph[social degree layout, iterations = 100, maximum time = 100, snap to grid =true, grid x length = 5mm, grid y length = 5mm, maximum step = 10]{ a1 -- {a2, a3, a4, a5}, b1 -- {b2 -- {b3, b4}, b5} - }; + }; ]] -------------------------------------------------------------------- @@ -255,15 +245,13 @@ example key "grid x length" summary -[[ -This option determines the cell size in $x$ direction for the |snap to grid| -option. -]] +[[ This option determines the cell size in $x$ direction for the |snap to grid| +option.]] documentation [[ -The size of the cells of the virtual grid can be configured by the user. This -key allows a configuration of the horizontal cell width. +The size of the cells of the virtual grid can be configured by the user. This +key allows a configuration of the horizontal cell width. ]] example @@ -272,7 +260,7 @@ example \graph[social degree layout, iterations = 100, maximum time = 100, snap to grid =true, grid x length = 5mm, grid y length = 5mm, maximum step = 10]{ a1 -- {a2, a3, a4, a5}, b1 -- {b2 -- {b3, b4}, b5} - }; + }; ]] example @@ -281,7 +269,7 @@ example \graph[social degree layout, iterations = 100, maximum time = 100, snap to grid =true, grid x length = 9mm, grid y length = 5mm, maximum step = 10]{ a1 -- {a2, a3, a4, a5}, b1 -- {b2 -- {b3, b4}, b5} - }; + }; ]] -------------------------------------------------------------------- @@ -291,10 +279,8 @@ example key "grid y length" summary -[[ -This option determines the cell size in $x$ direction for the |snap to grid| -option. -]] +[[ This option determines the cell size in $x$ direction for the |snap to grid| +option.]] documentation [[ @@ -307,7 +293,7 @@ example \graph[social degree layout, iterations = 100, maximum time = 100, snap to grid =true, grid x length = 5mm, grid y length = 5mm, maximum step = 10]{ a1 -- {a2, a3, a4, a5}, b1 -- {b2 -- {b3, b4}, b5} - }; + }; ]] example @@ -316,7 +302,7 @@ example \graph[social degree layout, iterations = 100, maximum time = 100, snap to grid =true, grid x length = 5mm, grid y length = 9mm, maximum step = 10]{ a1 -- {a2, a3, a4, a5}, b1 -- {b2 -- {b3, b4}, b5} - }; + }; ]] -------------------------------------------------------------------- @@ -326,18 +312,18 @@ key "mass" summary [[ - The mass of a vertex determines how fast it can move. Vertices - with higher mass move slower. + The mass of a vertex determines how fast it can move. Vertices + with higher mass move slower. ]] documentation [[ - The mass of a vertex determines how fast this vertex - moves. Mass is directly inverse proportional to the distance the vertex - moves. In contrast to the global speed factor, mass usually only affects a - single vertex. A vertex with a higher mass will move slower if affected by - the same mass than a vertex with a lower mass. By default, each vertex has a - mass of $1$. + The mass of a vertex determines how fast this vertex + moves. Mass is directly inverse proportional to the distance the vertex + moves. In contrast to the global speed factor, mass usually only affects a + single vertex. A vertex with a higher mass will move slower if affected by + the same mass than a vertex with a lower mass. By default, each vertex has a + mass of $1$. ]] example @@ -346,7 +332,7 @@ example \graph[social degree layout, iterations = 100, maximum time = 100, maximum displacement per step = 10]{ a1 -- {a2, a3, a4, a5}, b1 -- {b2 -- {b3, b4}, b5} - }; + }; ]] example @@ -355,7 +341,7 @@ example \graph[social degree layout, iterations = 100, maximum time = 100, maximum displacement per step = 10]{ a1 -- {a2, a3, a4, a5}, b1[mass = 4] -- {b2 -- {b3, b4}, b5} - }; + }; ]] -------------------------------------------------------------------- @@ -365,13 +351,13 @@ key "coarsening weight" summary [[ - The coarsening weight of a vertex determines when it will be - coarsened. + The coarsening weight of a vertex determines when it will be + coarsened. ]] documentation [[ - Vertices with higher coarsening weight are considered more important and - will be coarsened later, or not at all. + Vertices with higher coarsening weight are considered more important and + will be coarsened later, or not at all. ]] -------------------------------------------------------------------- diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/forcetypes/ForceAbsoluteValue.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/forcetypes/ForceAbsoluteValue.lua index 4634b701235..774743e52e6 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/forcetypes/ForceAbsoluteValue.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/forcetypes/ForceAbsoluteValue.lua @@ -7,9 +7,9 @@ -- -- See the file doc/generic/pgf/licenses/LICENSE for more information ---- This is a subclass of ForceTemplate, which is used to implement forces --- that work on individual vertices. Forces of this kind simply add an --- absolute value set in the force data to each vertex' $x$ and $y$ coordinate +--- This is a subclass of ForceTemplate, which is used to implement forces +-- that work on individual vertices. Forces of this kind simply add an +-- absolute value set in the force data to each vertex' $x$ and $y$ coodinate -- Imports local ForceTemplate = require "pgf.gd.force.jedi.base.ForceTemplate" @@ -31,11 +31,11 @@ function ForceAbsoluteValue:constructor () end --- This force class works on a vertex array that is part of the force data --- defined when adding the force. This array is copied into p. All vertices of --- the graph are saved in the local variable |ver|. +-- This force class works on a vertex array that is part of the force data +-- defined when adding the force. This array is copied into p. All vertices of +-- the graph are saved in the local variable |ver|. -- --- @param v The vertices of the graph we are trying to find a layout for. +-- @param v The vertices of the graph we are trying to find a layout for. function ForceAbsoluteValue:preprocess(v) self.ver = v @@ -43,12 +43,12 @@ function ForceAbsoluteValue:preprocess(v) end --- Applying the force to the vertices and adding the effect to the passed net +-- Applying the force to the vertices and adding the effect to the passed net -- force array --- --- @param data The parameters needed to apply the force: The options table, --- the current time stamp, an array containing the summed up net --- forces +-- +-- @param data The parameters needed to aplly the force: The options table, +-- the current time stamp, an array containing the summed up net +-- forces function ForceAbsoluteValue:applyTo(data) -- locals for speed @@ -61,13 +61,13 @@ function ForceAbsoluteValue:applyTo(data) local time_fun = self.force.time_fun -- Evaluate time function - local time_factor = time_fun(t_max, t_now) + local time_factor = time_fun(t_max, t_now) if time_factor == 0 then return end for _,v in ipairs(self.ver) do - for _, i in ipairs (self.p) do + for _, i in ipairs (self.p) do -- Is the vertex in the list? if v.name == i then diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/forcetypes/ForceCanvasDistance.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/forcetypes/ForceCanvasDistance.lua index 8cea1aec6a8..6d9e69745ed 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/forcetypes/ForceCanvasDistance.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/forcetypes/ForceCanvasDistance.lua @@ -8,9 +8,9 @@ -- See the file doc/generic/pgf/licenses/LICENSE for more information ---- This is a subclass of ForceTemplate, which is used to implement forces between --- vertex pairs. The forces depend on the canvas distance of the vertices in --- the pair. This class is e.~g.~ used for electric forces. +--- This is a subclass of ForceTemplate, which is used to implement forces between +-- vertex pairs. The forces depend on the canvas distance of the vertices in +-- the pair. This class is e.~g.~ used for electric forces. -- Imports local ForceTemplate = require "pgf.gd.force.jedi.base.ForceTemplate" @@ -22,7 +22,7 @@ local max = math.max local sqrt = math.sqrt local min = math.min --- Implementation starts here: +-- Implementation starts here: local ForceCanvasDistance = lib.class { base_class = ForceTemplate } function ForceCanvasDistance:constructor () @@ -31,24 +31,24 @@ function ForceCanvasDistance:constructor () end --- This force class works on all pairwise disjoint vertex pairs. This --- function generates a new graph object containing all vertices from the --- original graph and arcs between all pairwise disjoint vertex pairs. The --- arcs-table of this new object will be saved in the variable |p|. --- --- @param v The vertices of the graph we are trying to find a layout for. +-- This force class works on all pairwise disjoint vertex pairs. This +-- function generates a new graph object containing all vertices from the +-- original graph and arcs between all pairwise disjoint vertex pairs. The +-- arcs-table of this new object will be saved in the variable |p|. +-- +-- @param v The vertices of the graph we are trying to find a layout for. function ForceCanvasDistance:preprocess(v) self.p = Preprocessing.allPairs(v) end --- Applying the force to the vertices and adding the effect to the passed net +-- Applying the force to the vertices and adding the effect to the passed net -- force array --- --- @param data The parameters needed to apply the force: The options table, --- the current time stamp, an array containing the summed up net --- forces +-- +-- @param data The parameters needed to aplly the force: The options table, +-- the current time stamp, an array containing the summed up net +-- forces function ForceCanvasDistance:applyTo(data) -- locals for speed @@ -68,7 +68,7 @@ function ForceCanvasDistance:applyTo(data) if time_factor == 0 then return end - + if not fun_v then local data = { k = k, attributes = fw_attributes } for _, i in ipairs(p) do @@ -103,7 +103,7 @@ function ForceCanvasDistance:applyTo(data) else x = min(cap, g) end - + if h <= 0 then y = max(-cap, h) else @@ -168,7 +168,7 @@ function ForceCanvasDistance:applyTo(data) else x_tail = min(cap, g_tail) end - + if h_head <= 0 then y_head = max(-cap, h_head) else diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/forcetypes/ForceCanvasPosition.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/forcetypes/ForceCanvasPosition.lua index 41edaba3588..377ab22c348 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/forcetypes/ForceCanvasPosition.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/forcetypes/ForceCanvasPosition.lua @@ -8,9 +8,9 @@ -- See the file doc/generic/pgf/licenses/LICENSE for more information ---- This is a subclass of ForceTemplate, which is used to implement forces --- that work on individual vertices. The forces depend on the canvas position --- of the vertices. This class is e.~g.~ used for gravitational forces. +--- This is a subclass of ForceTemplate, which is used to implement forces +-- that work on individual vertices. The forces depend on the canvas position +-- of the vertices. This class is e.~g.~ used for gravitational forces. local ForceTemplate = require "pgf.gd.force.jedi.base.ForceTemplate" local lib = require "pgf.gd.lib" @@ -30,23 +30,23 @@ function ForceCanvasPosition:constructor () end --- This force class works on individual vertices and only depends on their --- current position. Thus the vertex table of the current graph is simply --- copied to the variable |p|. --- --- @param v The vertices of the graph we are trying to find a layout for. +-- This force class works on individual vertices and only depends on their +-- current position. Thus the vertex table of the current graph is simply +-- copied to the variable |p|. +-- +-- @param v The vertices of the graph we are trying to find a layout for. function ForceCanvasPosition:preprocess(v) self.p = v end --- Applying the force to the vertices and adding the effect to the passed net +-- Applying the force to the vertices and adding the effect to the passed net -- force array --- --- @param data The parameters needed to apply the force: The options table, --- the current time stamp, an array containing the summed up net --- forces +-- +-- @param data The parameters needed to aplly the force: The options table, +-- the current time stamp, an array containing the summed up net +-- forces function ForceCanvasPosition:applyTo(data) --localize diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/forcetypes/ForceGraphDistance.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/forcetypes/ForceGraphDistance.lua index 86d67f2678f..628f1192ac0 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/forcetypes/ForceGraphDistance.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/forcetypes/ForceGraphDistance.lua @@ -8,9 +8,9 @@ -- See the file doc/generic/pgf/licenses/LICENSE for more information ---- This is a subclass of ForceTemplate, which is used to implement forces between --- vertex pairs. The forces depend on the graph distance of the vertices in --- the pair. This class is e.\,g.\ used for spring forces. +--- This is a subclass of ForceTemplate, which is used to implement forces between +-- vertex pairs. The forces depend on the graph distance of the vertices in +-- the pair. This class is e.~g.~ used for spring forces. local ForceTemplate = require "pgf.gd.force.jedi.base.ForceTemplate" @@ -32,26 +32,26 @@ function ForceGraphDistance:constructor () end --- This force class works on all pairwise disjoint vertex pairs connected by --- a path of length maximum $n$. The parameter $n$ is given by the engineer in --- the force declaration. This function generates a new graph object --- containing all vertices from the original graph and arcs between all --- pairwise disjoint vertex pairs. The arcs-table of this new object will be --- saved in the variable |p|. --- --- @param v The vertices of the graph we are trying to find a layout for. +-- This force class works on all pairwise disjoint vertex pairs connected by +-- a path of length maximum $n$. The parameter $n$ is given by the engineer in +-- the force declaration. This function generates a new graph object +-- containing all vertices from the original graph and arcs between all +-- pairwise disjoint vertex pairs. The arcs-table of this new object will be +-- saved in the variable |p|. +-- +-- @param v The vertices of the graph we are trying to find a layout for. function ForceGraphDistance:preprocess(v, a) self.p = Preprocessing.overExactlyNPairs(v, a, self.force.n) end --- Applying the force to the vertices and adding the effect to the passed net +-- Applying the force to the vertices andadding the effect to the passed net -- force array --- --- @param data The parameters needed to apply the force: The options table, --- the current time stamp, an array containing the summed up net --- forces +-- +-- @param data The parameters needed to aplly the force: The options table, +-- the current time stamp, an array containing the summed up net +-- forces function ForceGraphDistance:applyTo(data) -- locals for speed @@ -86,12 +86,12 @@ function ForceGraphDistance:applyTo(data) local y = p2_pos.y - p1_pos.y local d = max(sqrt(x*x+y*y),0.1) - -- apply force function to distance and k (natural spring length) + -- apply force function to distance and k (natural spring length) data.u = p2 data.v = p1 data.d = d local e = fun_u(data) - + -- Include time function local f = e * time_factor / d @@ -106,7 +106,7 @@ function ForceGraphDistance:applyTo(data) else x = min(cap, g) end - + if g <= 0 then y = max(-cap, h) else @@ -147,7 +147,7 @@ function ForceGraphDistance:applyTo(data) data.d = d local e_head = fun_u(data) local e_tail = fun_v(data) - + -- Include time function local f_head = time_factor * e_head / d local f_tail = time_factor * e_tail / d @@ -172,7 +172,7 @@ function ForceGraphDistance:applyTo(data) else x_tail = min(cap, g_tail) end - + if h_head <= 0 then y_head = max(-cap, h_head) else diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/forcetypes/ForcePullToGrid.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/forcetypes/ForcePullToGrid.lua index 5f53f5da784..b196a8a6a95 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/forcetypes/ForcePullToGrid.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/forcetypes/ForcePullToGrid.lua @@ -8,12 +8,12 @@ -- See the file doc/generic/pgf/licenses/LICENSE for more information ---- This is a subclass of ForceTemplate, which is used to implement forces --- that work on individual vertices and pulls them to a virtual grid with --- cells of the size determined by the user options |grid x length| and --- |grid y length|. The forces depend on the canvas position --- of the vertices relative to th next grid point. This class is e.\,g.\ used --- for the post-processing technique |snap to grid|. +--- This is a subclass of ForceTemplate, which is used to implement forces +-- that work on individual vertices and pulls them to a virtual grid with +-- cells of the size determined by the user options |grid x length| and +-- |grid y length|. The forces depend on the canvas position +-- of the vertices relative to th next grid point. This class is e.~g.~ used +-- for the post-processing technique |snap to grid|. -- Imports @@ -40,22 +40,22 @@ function ForcePullToGrid:constructor () self.p = {} end --- This force class works on individual vertices and only depends on their --- current position. Thus the vertex table of the current graph is simply --- copied to the variable |p|. --- --- @param v The vertices of the graph we are trying to find a layout for. +-- This force class works on individual vertices and only depends on their +-- current position. Thus the vertex table of the current graph is simply +-- copied to the variable |p|. +-- +-- @param v The vertices of the graph we are trying to find a layout for. function ForcePullToGrid:preprocess(v) self.p = v end --- Applying the force to the vertices and adding the effect to the passed net +-- Applying the force to the vertices andadding the effect to the passed net -- force array --- --- @param data The parameters needed to apply the force: The options table, --- the current time stamp, an array containing the summed up net +-- +-- @param data The parameters needed to aplly the force: The options table, +-- the current time stamp, an array containing the summed up net -- forces function ForcePullToGrid:applyTo(data) @@ -71,7 +71,7 @@ function ForcePullToGrid:applyTo(data) local length = 5--self.options["node distance"] -- Evaluate time function - local time_factor = time_fun(t_max, t_now) + local time_factor = time_fun(t_max, t_now) if time_factor == 0 then return end @@ -89,7 +89,7 @@ function ForcePullToGrid:applyTo(data) local l = -d/(length*length) -- Include time function - local h = l * time_factor + local h = l * time_factor -- scale effect according to direction local f = x * h @@ -102,7 +102,7 @@ function ForcePullToGrid:applyTo(data) else x = min(cap, f) end - + if g <= 0 then y = max(-cap, g) else diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/forcetypes/ForcePullToPoint.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/forcetypes/ForcePullToPoint.lua index 985b8eec2e5..908fdcf6b2e 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/forcetypes/ForcePullToPoint.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/forcetypes/ForcePullToPoint.lua @@ -7,11 +7,11 @@ -- -- See the file doc/generic/pgf/licenses/LICENSE for more information ---- This is a subclass of ForceTemplate, which is used to implement forces --- that work on individual vertices and pulls them to a specific point on the --- canvas. This point is given by the |desired at| option. The forces depend --- on the canvas position of the vertices relative to the canvas point it is --- pulled to. +--- This is a subclass of ForceTemplate, which is used to implement forces +-- that work on individual vertices and pulls them to a specific point on the +-- canvas. This point is given by the |desired at| option. The forces depend +-- on the canvas position of the vertices relative to the canvas point it is +-- pulled to. -- Imports @@ -33,17 +33,17 @@ function ForcePullToPoint:constructor () self.p = {} end --- This force class works on individual vertices and depends on their --- current position as well as the point it is desired at. Thus all vertices --- where the |desired at| option is set are added to the table |p| together --- with the point where they are wanted. --- --- @param v The vertices of the graph we are trying to find a layout for. +-- This force class works on individual vertices and depends on their +-- current position as well as the point it is desired at. Thus all vertices +-- where the |desired at| option is set are added to the table |p| together +-- with the point where they are wanted. +-- +-- @param v The vertices of the graph we are trying to find a layout for. function ForcePullToPoint:preprocess(v) for _,vertex in ipairs(v) do if vertex.options then - local da = vertex.options["desired at"] + local da = vertex.options["desired at"] if da then self.p[vertex]= {da} end @@ -52,12 +52,12 @@ function ForcePullToPoint:preprocess(v) end --- Applying the force to the vertices and adding the effect to the passed net +-- Applying the force to the vertices andadding the effect to the passed net -- force array --- --- @param data The parameters needed to apply the force: The options table, --- the current time stamp, an array containing the summed up net --- forces +-- +-- @param data The parameters needed to aplly the force: The options table, +-- the current time stamp, an array containing the summed up net +-- forces function ForcePullToPoint:applyTo(data) -- locals for speed @@ -69,7 +69,7 @@ function ForcePullToPoint:applyTo(data) local time_fun = self.force.time_fun -- Evaluate time function - local time_factor = time_fun(t_max, t_now) + local time_factor = time_fun(t_max, t_now) if time_factor == 0 then return end @@ -85,7 +85,7 @@ function ForcePullToPoint:applyTo(data) local d = max(sqrt(x*x+y*y),0.1) -- Include time function - local h = d * time_factor + local h = d * time_factor -- scale effect according to direction local f = x * h @@ -98,7 +98,7 @@ function ForcePullToPoint:applyTo(data) else x = min(cap, f) end - + if g <= 0 then y = max(-cap, g) else diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/initialpositioning/CircularInitialPositioning.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/initialpositioning/CircularInitialPositioning.lua index ab8f1fad9a6..1ed35653c93 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/initialpositioning/CircularInitialPositioning.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/initialpositioning/CircularInitialPositioning.lua @@ -7,7 +7,7 @@ -- -- See the file doc/generic/pgf/licenses/LICENSE for more information ---- This class implements an initial position algorithm for graph drawing, placing the vertices on +--- This class implements an inital position algorithm for graph drawing, placing the vertices on -- a circle with th radius given by the |radius| key local declare = require "pgf.gd.interface.InterfaceToAlgorithms".declare local InitialTemplate = require "pgf.gd.force.jedi.base.InitialTemplate" @@ -21,7 +21,7 @@ declare { key = "circular initial position", algorithm = CircularInitialPositioning, phase = "initial positioning force framework", - phase_default = true + phase_default = true } -- Implementation starts here: @@ -33,7 +33,7 @@ end function CircularInitialPositioning:run() -- locals for speed local vertices = self.vertices - local tmp = (self.options["node pre sep"] + self.options["node post sep"]) + + local tmp = (self.options["node pre sep"] + self.options["node post sep"]) + (self.options["sibling pre sep"] + self.options["sibling post sep"]) local min_radius = tmp * #self.vertices/2/math.pi local radius = math.max(self.options.radius, min_radius) diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/initialpositioning/GridInitialPositioning.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/initialpositioning/GridInitialPositioning.lua index 2b131e8ad9f..cb710b35d60 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/initialpositioning/GridInitialPositioning.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/initialpositioning/GridInitialPositioning.lua @@ -7,8 +7,8 @@ -- -- See the file doc/generic/pgf/licenses/LICENSE for more information ---- This class implements an initial position algorithm for graph drawing, --- placing the vertices on a grid with square cells with width |node distance| +--- This class implements an inital position algorithm for graph drawing, placing the vertices on +-- a grid with square cells with width |node distance| local declare = require "pgf.gd.interface.InterfaceToAlgorithms".declare local InitialTemplate = require "pgf.gd.force.jedi.base.InitialTemplate" local lib = require "pgf.gd.lib" @@ -45,7 +45,7 @@ function GridInitialPositioning:run() if placed[vertex] == nil then if i <= (y/dist+1)*n then x = x + dist - else + else x = 0 y = y + dist end diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/initialpositioning/RandomInitialPositioning.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/initialpositioning/RandomInitialPositioning.lua index ce3a40582c5..39a58b9e2bd 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/initialpositioning/RandomInitialPositioning.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/initialpositioning/RandomInitialPositioning.lua @@ -7,8 +7,8 @@ -- -- See the file doc/generic/pgf/licenses/LICENSE for more information ---- This class implements an initial position algorithm for graph drawing, --- placing the vertices at random positions. +--- This class implements an inital position algorithm for graph drawing, placing the vertices at +-- random positions. local declare = require "pgf.gd.interface.InterfaceToAlgorithms".declare local InitialTemplate = require "pgf.gd.force.jedi.base.InitialTemplate" local lib = require "pgf.gd.lib" @@ -30,7 +30,7 @@ end function RandomInitialPositioning:run() -- locals for speed - local random = lib.random + local random = math.random local vertices = self.vertices local desired_vertices = self.desired_vertices -- place vertices where the |desired at | option has been set first @@ -39,11 +39,11 @@ function RandomInitialPositioning:run() for _, vertex in ipairs(vertices) do -- place all other vertices with respect to the one already placed if placed[vertex] == nil then - p = vertex.pos + p = vertex.pos p.x = 100 * random() + centroid_x p.y = 100 * random() + centroid_y end end end -return RandomInitialPositioning +return RandomInitialPositioning
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/library.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/library.lua index 5d5554ce351..4cc7128b16a 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/library.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/jedi/library.lua @@ -9,14 +9,14 @@ --- The library providing the graph drawing framework Jedi --- This library requires all graph drawing algorithms and initial --- positioning algorithms provided with the first release of Jedi. --- It also defines the mass key attached to all vertices. +-- This labrary requires all graph drawing algorithms and inital +-- positioning algorithms provided with the first release of Jedi. +-- It also defines the mass key attached to all vertices. -- Library name local jedi --- require initial positioning algorithms +-- require inital positioning algorithms require "pgf.gd.force.jedi.initialpositioning.CircularInitialPositioning" require "pgf.gd.force.jedi.initialpositioning.RandomInitialPositioning" require "pgf.gd.force.jedi.initialpositioning.GridInitialPositioning" @@ -101,7 +101,7 @@ declare { key = "mass", type = "number", initial = "1", - + documentation_in = "pgf.gd.force.jedi.doc" } @@ -110,6 +110,6 @@ declare { key = "coarsening weight", type = "number", initial = "1", - + documentation_in = "pgf.gd.force.jedi.doc" } diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/library.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/library.lua index acfda34ffce..be0faf465c1 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/library.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/force/library.lua @@ -24,43 +24,43 @@ -- When you start thinking about for a moment, it turns out that there -- are endless variations of the force model. All of these models have -- the following in common, however: --- % -- \begin{itemize} --- \item ``Forces'' pull and push at the nodes in different directions. --- \item The effect of these forces is simulated by iteratively moving --- all the nodes simultaneously a little in the direction of the forces --- and by then recalculating the forces. --- \item The iteration is stopped either after a certain number of --- iterations or when a \emph{global energy minimum} is reached (a very --- scientific way of saying that nothing happens anymore). +-- \item ``Forces'' pull and push at the nodes in different +-- directions. +-- \item The effect of these forces is simulated by iteratively moving +-- all the nodes simultaneously a little in the direction of the forces +-- and by then recalculating the forces. +-- \item The iteration is stopped either after a certain number of +-- iterations or when a \emph{global energy minimum} is reached (a very +-- scientific way of saying that nothing happens anymore). -- \end{itemize} -- -- The main difference between the different force-based approaches is -- how the forces are determined. Here are some ideas what could cause a -- force to be exerted between two nodes (and there are more): --- % -- \begin{itemize} --- \item If the nodes are connected by an edge, one can treat the edge as --- a ``spring'' that has a ``natural spring dimension''. If the nodes --- are nearer than the spring dimension, they are push apart; if they --- are farther aways than the spring dimension, they are pulled together. --- \item If two nodes are connected by a path of a certain length, the --- nodes may ``wish to be at a distance proportional to the path --- length''. If they are nearer, they are pushed apart; if they are --- farther, they are pulled together. (This is obviously a --- generalization of the previous idea.) --- \item There may be a general force field that pushes nodes apart (an --- electrical field), so that nodes do not tend to ``cluster''. --- \item There may be a general force field that pulls nodes together (a --- gravitational field), so that nodes are not too loosely scattered. --- \item There may be highly nonlinear forces depending on the distance of --- nodes, so that nodes very near to each get pushed apart strongly, --- but the effect wears of rapidly at a distance. (Such forces are --- known as strong nuclear forces.) --- \item There rotational forces caused by the angles between the edges --- leaving a node. Such forces try to create a \emph{perfect angular --- resolution} (a very scientific way of saying that all angles --- at a node are equal). +-- \item If the nodes are connected by an edge, one can treat the edge as +-- a ``spring'' that has a ``natural spring dimension.'' If the nodes +-- are nearer than the spring dimension, they are push apart; if they +-- are farther aways than the spring dimension, they are pulled +-- together. +-- \item If two nodes are connected by a path of a certain length, the +-- nodes may ``wish to be at a distance proportional to the path +-- length''. If they are nearer, they are pushed apart; if they are +-- farther, they are pulled together. (This is obviously a +-- generalization of the previous idea.) +-- \item There may be a general force field that pushes nodes apart (an +-- electrical field), so that nodes do not tend to ``cluster''. +-- \item There may be a general force field that pulls nodes together (a +-- gravitational field), so that nodes are not too loosely scattered. +-- \item There may be highly nonlinear forces depending on the distance of +-- nodes, so that nodes very near to each get pushed apart strongly, +-- but the effect wears of rapidly at a distance. (Such forces are +-- known as strong nuclear forces.) +-- \item There rotational forces caused by the angles between the edges +-- leaving a node. Such forces try to create a \emph{perfect angular +-- resolution} (a very scientific way of saying that all angles +-- at a node are equal). -- \end{itemize} -- -- Force-based algorithms combine one or more of the above ideas into a @@ -70,33 +70,33 @@ -- Currently, three algorithms are implemented in this library, two of -- which are from the first of the following paper, while the third is -- from the third paper: --- % +-- -- \begin{itemize} --- \item --- Y. Hu. --- \newblock Efficient, high-quality force-directed graph drawing. --- \newblock \emph{The Mathematica Journal}, 2006. --- \item --- C. Walshaw. --- \newblock A multilevel algorithm for force-directed graph --- drawing. --- \newblock In J. Marks, editor, \emph{Graph Drawing}, Lecture Notes in --- Computer Science, 1984:31--55, 2001. +-- \item +-- Y. Hu. +-- \newblock Efficient, high-quality force-directed graph drawing. +-- \newblock \emph{The Mathematica Journal}, 2006. +-- \item +-- C. Walshaw. +-- \newblock A multilevel algorithm for force-directed graph +-- drawing. +-- \newblock In J. Marks, editor, \emph{Graph Drawing}, Lecture Notes in +-- Computer Science, 1984:31--55, 2001. -- \end{itemize} -- -- Our implementation is described in detail in the following -- diploma thesis: --- % +-- -- \begin{itemize} --- \item --- Jannis Pohlmann, --- \newblock \emph{Configurable Graph Drawing Algorithms --- for the \tikzname\ Graphics Description Language,} --- \newblock Diploma Thesis, --- \newblock Institute of Theoretical Computer Science, Universit\"at --- zu L\"ubeck, 2011.\\[.5em] --- \newblock Online at --- \url{http://www.tcs.uni-luebeck.de/downloads/papers/2011/}\\ \url{2011-configurable-graph-drawing-algorithms-jannis-pohlmann.pdf} +-- \item +-- Jannis Pohlmann, +-- \newblock \emph{Configurable Graph Drawing Algorithms +-- for the \tikzname\ Graphics Description Language,} +-- \newblock Diploma Thesis, +-- \newblock Institute of Theoretical Computer Science, Univerist\"at +-- zu L\"ubeck, 2011.\\[.5em] +-- \newblock Online at +-- \url{http://www.tcs.uni-luebeck.de/downloads/papers/2011/}\\ \url{2011-configurable-graph-drawing-algorithms-jannis-pohlmann.pdf} -- \end{itemize} -- -- In the future, I hope that most, if not all, of the force-based diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/interface/InterfaceCore.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/interface/InterfaceCore.lua index 8473eb3f109..8dfbae44850 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/interface/InterfaceCore.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/interface/InterfaceCore.lua @@ -18,7 +18,7 @@ -- |InterfaceToDisplay| use, in particular, the data structures -- provided by this class. -- --- @field binding This field stores the ``binding''. The graph drawing +-- @field binding This field stores the ``binding.'' The graph drawing -- system is ``bound'' to the display layer through such a binding (a -- subclass of |Binding|). Such a binding can be thought of as a -- ``driver'' in operating systems terminology: It is a small set of @@ -28,7 +28,7 @@ -- completely new Lua instance. -- -- @field scopes This is a stack of graph drawing scopes. All --- interface methods refer to the top of this stack. +-- interface methods refer to the top of this stack. -- -- @field collection_kinds This table stores which collection kinds -- have been defined together with their properties. @@ -59,7 +59,7 @@ local InterfaceCore = { -- The phase kinds phase_kinds = {}, - + -- Internals for handling the options stack option_stack = {}, option_cache_height = nil, @@ -186,6 +186,6 @@ function InterfaceCore.convert(s,t) end --- Done +-- Done return InterfaceCore diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/interface/InterfaceToAlgorithms.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/interface/InterfaceToAlgorithms.lua index 1187fbc3136..f1b203e550c 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/interface/InterfaceToAlgorithms.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/interface/InterfaceToAlgorithms.lua @@ -15,13 +15,13 @@ -- This class provides the interface between the graph drawing system -- and algorithms. Another class, |InterfaceToDisplay|, binds the -- display layers (like \tikzname\ or a graph drawing editor) to the --- graph drawing system ``from the other side''. +-- graph drawing system ``from the other side''. -- -- The functions declared here can be used by algorithms to -- communicate with the graph drawing system, which will usually -- forward the ``requests'' of the algorithms to the display layers in -- some way. For instance, when you declare a new parameter, this --- parameter will become available on the display layer. +-- parameter will become available on the display layer. local InterfaceToAlgorithms = {} @@ -58,7 +58,7 @@ local declare_handlers -- registered handler, we call the |test| function. If it returns -- neither |nil| nor |false|, the |handler| field of this handler is -- called. If it returns |true|, the handler immediately --- finishes. Otherwise, the next handler is tried. +-- finishes. Otherwise, the next handler is tried. function InterfaceToAlgorithms.addHandler(test, handler) table.insert(declare_handlers, 1, { test = test, handler = handler }) @@ -76,7 +76,7 @@ local key_metatable = {} -- for use on the display layer. There is just one function for -- handling all declarations in order to make the declarations -- easy-to-use since you just need to import a single function: --- % +-- --\begin{codeexample}[code only, tikz syntax=false] --local declare = require "pgf.gd.interface.InterfaceToAlgorithms".declare --\end{codeexample} @@ -84,11 +84,11 @@ local key_metatable = {} -- You can now use |declare| it as follows: You pass it a table -- containing information about the to-be-declared key. The table -- \emph{must} have a field |key| whose value is unique and must be a --- string. If the value of |key| is, say, |"foo"|, the --- parameter can be set on the display layer such as, say, the +-- string. If the value of |key| is, say, |"foo"|, the +-- parameter can be set on the display layer such as, say, the -- \tikzname\ layer, using |/graph drawing/foo|. Here is a typical --- example of how a declaration is done: --- % +-- example of how a declaration is done: +-- --\begin{codeexample}[code only, tikz syntax=false] -- --- -- declare { @@ -126,7 +126,7 @@ local key_metatable = {} -- faster to read (both for humans and for computers). Second, for C -- code, it is quite inconvenient to have long strings inside a C -- file. In such cases, you can use the |documentation_in| field: --- % +-- --\begin{codeexample}[code only, tikz syntax=false] -- --- -- declare { @@ -138,7 +138,7 @@ local key_metatable = {} --\end{codeexample} -- -- The |some_filename| must be the name of a Lua file that will be --- read ``on demand'', that is, whenever someone tries to access the +-- read ``on demand,'' that is, whenever someone tries to access the -- documentation, summary, or examples field of the key, this file -- will be loaded using |require|. The file should then use -- |pgf.gd.doc| to install the missing information in the keys. @@ -146,15 +146,14 @@ local key_metatable = {} -- \medskip\noindent\textbf{The Use Field.} -- When you declare a key, you can provide a |use| field. If present, -- you must set it to an array of small tables which have two fields: --- % -- \begin{itemize} --- \item |key| This is the name of another key or a function. --- \item |value| This is either a value (like a string or a number) or --- a function or |nil|. +-- \item |key| This is the name of another key or a function. +-- \item |value| This is either a value (like a string or a number) or +-- a function or |nil|. -- \end{itemize} -- -- Here is an example: --- % +-- --\begin{codeexample}[code only, tikz syntax=false] -- --- -- declare { @@ -177,8 +176,8 @@ local key_metatable = {} -- the array had been set explicitly to the value given by the |value| -- field. If the |value| is a function, we pass a different value to -- the key, namely the result of applying the function to the value --- originally passed to the original key. Here is a typical example: --- % +-- originally passed to the original key. Here is a typical example: +-- --\begin{codeexample}[code only, tikz syntax=false] -- --- -- declare { @@ -194,7 +193,7 @@ local key_metatable = {} -- -- Just like the value, the key itself can also be a function. In this -- case, the to-be-used key is also computed by applying the function --- to the value passed to the original key. +-- to the value passed to the original key. -- -- As mentioned at the beginning, |declare| is a work-horse that will call -- different internal functions depending on whether you declare a @@ -210,7 +209,7 @@ local key_metatable = {} function InterfaceToAlgorithms.declare (t) local keys = InterfaceCore.keys - + -- Sanity check: assert (type(t.key) == "string" and t.key ~= "", "parameter key may not be the empty string") if keys[t.key] or t.keys == "algorithm_phases" then @@ -220,14 +219,14 @@ function InterfaceToAlgorithms.declare (t) for _,h in ipairs (declare_handlers) do if h.test(t) then if h.handler(t) then - break + break end end end -- Attach metatable: setmetatable (t, key_metatable) - + -- Set! keys[t.key] = t keys[#keys + 1] = t @@ -247,10 +246,10 @@ end --- --- This function is called by |declare| for ``normal parameter keys'', +-- This function is called by |declare| for ``normal parameter keys,'' -- which are all keys for which no special field like |algorithm| or -- |layer| is declared. You write --- % +-- --\begin{codeexample}[code only, tikz syntax=false] -- --- -- declare { @@ -267,7 +266,6 @@ end -- When an author writes |my node[electrical charge=5-3]| in the -- description of her graph, the object |vertex| corresponding to the -- node |my node| will have a field |options| attached to it with --- % --\begin{codeexample}[code only, tikz syntax=false] --vertex.options["electrical charge"] == 2 --\end{codeexample} @@ -275,40 +273,40 @@ end -- The |type| field does not refer to Lua types. Rather, these types are -- sensible types for graph drawing and they are mapped by the higher -- layers to Lua types. In detail, the following types are available: --- % +-- -- \begin{itemize} --- \item |number| A dimensionless number. Will be mapped to a normal --- Lua |number|. So, when the author writes |foo=5*2|, the |foo| key --- of the |options| field of the corresponding object will be set to --- |10.0|. --- \item |length| A ``dimension'' in the sense of \TeX\ (a number with --- a dimension like |cm| attached to it). It is the job of the display --- layer to map this to a number in ``\TeX\ points'', that is, to a --- multiple of $1/72.27$th of an inch. --- \item |time| A ``time'' in the sense of |\pgfparsetime|. Examples --- are |6s| or |0.1min| or |6000ms|, all of which will map to |6|. --- \item |string| Some text. Will be mapped to a Lua |string|. --- \item |canvas coordinate| A position on the canvas. Will be mapped --- to a |model.Coordinate|. --- \item |boolean| A Boolean value. --- \item |raw| Some to-be-executed Lua text. --- \item |direction| Normally, an angle; however, --- the special values of |down|, |up|, |left|, |right| as well as the --- directions |north|, |north west|, and so on are also legal on the --- display layer. All of them will be mapped to a number. Furthermore, --- a vertical bar (\verb!|!) will be mapped to |-90| and a minus sign --- (|-|) will be mapped to |0|. --- \item |hidden| A key of this type ``cannot be set'', that is, --- users cannot set this key at all. However algorithms can still read --- this key and, through the use of |alias|, can use the key as a --- handle to another key. --- \item |user value| The key stores a Lua user value (userdata). Such --- keys can only be set from C since user values cannot be created in --- Lua (let alone in \tikzname). +-- \item |number| A dimensionless number. Will be mapped to a normal +-- Lua |number|. So, when the author writes |foo=5*2|, the |foo| key +-- of the |options| field of the corresponding object will be set to +-- |10.0|. +-- \item |length| A ``dimension'' in the sense of \TeX\ (a number with +-- a dimension like |cm| attached to it). It is the job of the display +-- layer to map this to a number in ``\TeX\ points,'' that is, to a +-- multiple of $1/72.27$th of an inch. +-- \item |time| A ``time'' in the sense of |\pgfparsetime|. Examples +-- are |6s| or |0.1min| or |6000ms|, all of which will map to |6|. +-- \item |string| Some text. Will be mapped to a Lua |string|. +-- \item |canvas coordinate| A position on the canvas. Will be mapped +-- to a |model.Coordinate|. +-- \item |boolean| A Boolean value. +-- \item |raw| Some to-be-executed Lua text. +-- \item |direction| Normally, an angle; however, +-- the special values of |down|, |up|, |left|, |right| as well as the +-- directions |north|, |north west|, and so on are also legal on the +-- display layer. All of them will be mapped to a number. Furthermore, +-- a vertical bar (\verb!|!) will be mapped to |-90| and a minus sign +-- (|-|) will be mapped to |0|. +-- \item |hidden| A key of this type ``cannot be set,'' that is, +-- users cannot set this key at all. However algorithms can still read +-- this key and, through the use of |alias|, can use the key as a +-- handle to another key. +-- \item |user value| The key stores a Lua user value (userdata). Such +-- keys can only be set from C since user values cannot be created in +-- Lua (let alone in \tikzname). -- \end{itemize} -- -- If the |type| field is missing, it is automatically set to --- |"string"|. +-- |"string"|. -- -- A parameter can have an |initial| value. This value will be used -- whenever the parameter has not been set explicitly for an object. @@ -318,7 +316,7 @@ end -- no value is provided. For a key of type |"boolean"|, if no -- |default| is provided, |"true"| will be used automatically. -- --- A parameter can have an |alias| field. This field must be set to +-- A parameter can habe an |alias| field. This field must be set to -- the name of another key or to a function. Whenever you access the -- current key and this key is not set, the |alias| key is tried -- instead. If it is set, its value will be returned (if the |alias| @@ -326,7 +324,7 @@ end -- alias is not set either and neither does it have an initial value, -- the |initial| value is used. Note that in case the alias has its -- |initial| field set, the |initial| value of the current key will --- never be used. +-- never be used. -- -- The main purpose of the current key is to allow algorithms to -- introduce their own terminology for keys while still having access @@ -334,7 +332,7 @@ end -- class uses the name |layerDistance| for what would be called -- |level distance| in the rest of the graph drawing system. In this -- case, we can declare the |layerDistance| key as follows: --- % +-- --\begin{codeexample}[code only, tikz syntax=false] -- declare { -- key = "layerDistance", @@ -351,7 +349,7 @@ end -- -- Note that there is a difference between |alias| and the |use| -- field: Suppose we write --- % +-- --\begin{codeexample}[code only, tikz syntax=false] -- declare { -- key = "layerDistance", @@ -368,7 +366,7 @@ end -- -- If the alias is a function, it will be called with the option table -- as its parameter. You can thus say things like --- % +-- --\begin{codeexample}[code only, tikz syntax=false] -- declare { -- key = "layerDistance", @@ -379,9 +377,9 @@ end -- } --\end{codeexample} -- --- As a special courtesy to C code, you can also set the key +-- As a special curtesy to C code, you can also set the key -- |alias_function_string|, which allows you to put the function into --- a string that is read using |loadstring|. +-- a string that is read using |loadstring|. -- -- (You cannot call this function directly, it is included for -- documentation purposes only.) @@ -391,36 +389,36 @@ end local function declare_parameter (t) t.type = t.type or "string" - + if t.type == "boolean" and t.default == nil then t.default = true end - + -- Normal key assert (type(t.type) == "string", "key type must be a string") - + -- Declare via the hub: - if t.type ~= "hidden" then + if t.type ~= "hidden" then InterfaceCore.binding:declareCallback(t) - + -- Handle initials: if t.initial then InterfaceCore.option_initial[t.key] = InterfaceCore.convert(t.initial, t.type) end end - + if t.alias_function_string and not t.alias then local count = 0 t.alias = load ( function () - count = count + 1 - if count == 1 then - return "return " - elseif count == 2 then - return t.alias_function_string - else - return nil - end + count = count + 1 + if count == 1 then + return "return " + elseif count == 2 then + return t.alias_function_string + else + return nil + end end)() end @@ -437,17 +435,16 @@ end --- -- This function is called by |declare| for ``algorithm --- keys''. These keys are normally used without a value as in just +-- keys.'' These keys are normally used without a value as in just -- |\graph[tree layout]|, but you can optionally pass a value to -- them. In this case, this value must be the name of a \emph{phase} -- and the algorithm of this phase will be set (and not the -- default phase of the key), see the description of phases below for --- details. +-- details. -- -- Algorithm keys are detected by the presence of the field |algorithm| -- in the table |t| passed to |declare|. Here is an example of how it -- is used: --- % --\begin{codeexample}[code only, tikz syntax=false] -- local ReingoldTilford1981 = {} -- @@ -500,7 +497,7 @@ end -- drawing engine which ``phase'' of the graph drawing process your -- option applies to. Each time you select an algorithm later on -- through use of the algorithm's key, the algorithm for this phase --- will be set; algorithms of other phases will not be changed. +-- will be set; algorithms of other phases will not be changed. -- For instance, when an algorithm is part of the spanning tree -- computation, its phase will be |"spanning tree computation"| and -- using its key does not change the main algorithm, but only the @@ -508,7 +505,7 @@ end -- current graph (in case this is needed by the main algorithm). In -- case the |phase| field is missing, the phase |main| is used. Thus, -- when no phase field is given, the key will change the main --- algorithm used to draw the graph. +-- algorithm used to draw the graph. -- -- Later on, the algorithm set for the current phase can be accessed -- through the special |algorithm_phases| field of |options| @@ -522,12 +519,12 @@ end -- -- The following example shows the declaration of an algorithm that is -- the default for the phase |"spanning tree computation"|: --- % +-- --\begin{codeexample}[code only, tikz syntax=false] -- --- -- declare { -- key = "breadth first spanning tree", --- algorithm = { +-- algorithm = { -- run = -- function (self) -- return SpanningTreeComputation.computeSpanningTree(self.ugraph, false, self.events) @@ -541,7 +538,7 @@ end -- -- The algorithm is called as follows during a run of the main -- algorithms: --- % +-- --\begin{codeexample}[code only, tikz syntax=false] -- local graph = ... -- the graph object -- local spanning_algorithm_class = graph.options.algorithm_phases["spanning tree computation"] @@ -570,7 +567,7 @@ end local function declare_algorithm (t) -- Algorithm declaration! assert(type(t.algorithm) == "table" or type(t.algorithm) == "string") - + t.phase = t.phase or "main" local function make_class () @@ -581,7 +578,7 @@ local function declare_algorithm (t) else class = lib.class(require(t.algorithm)) end - + -- Now, save pre- and postconditions class.preconditions = t.preconditions or {} class.postconditions = t.postconditions or {} @@ -605,26 +602,26 @@ local function declare_algorithm (t) -- Save in the algorithm_classes table: InterfaceCore.algorithm_classes[t.key] = store_me - + assert(t.type == nil, "type may not be set for an algorithm key") t.type = "string" - + -- Install! InterfaceCore.binding:declareCallback(t) - + if t.phase_default then assert (not InterfaceCore.option_initial.algorithm_phases[t.phase], - "default algorithm for phase already set") + "default algorithm for phase already set") assert (type(store_me) == "table", - "default algorithms must be loaded immediately") + "default algorithms must be loaded immediately") InterfaceCore.option_initial.algorithm_phases[t.phase] = store_me InterfaceCore.option_initial.algorithm_phases[t.phase .. " stack"] = { store_me } else InterfaceCore.option_initial.algorithm_phases[t.phase .. " stack"] = { dummy = true -- Remove once Lua Link Bug is fixed - } - end - + } + end + return true end @@ -632,44 +629,42 @@ end --- --- This function is called by |declare| for ``collection kinds''. They --- are detected by the presence of the field |layer| +-- This function is called by |declare| for ``collection kinds.'' They +-- are detected by the presence of the field |layer| -- in the table |t| passed to |declare|. See the class |Collection| -- for details on what a collection and a collection kind is. -- -- The |key| field of the table |t| passed to this function is both -- the name of the to-be-declared collection kind as well as the key -- that is used on the display layer to indicate that a node or edge --- belongs to a collection. +-- belongs to a collection. -- -- \medskip -- \noindent\textbf{The Display Layer.} --- Let us first have a look at what happens on the display layer: +-- Let us first have a look at what happens on the display layer: -- A key |t.key| is setup on the display layer that, when used inside -- a graph drawing scope, starts a new collection of the specified -- kind. ``Starts'' means that all nodes and edges mentioned in the -- rest of the current option scope will belong to a new collection --- of kind |t.key|. --- % +-- of kind |t.key|. +-- --\begin{codeexample}[code only, tikz syntax=false] --declare { key = "hyper", layer = 1 } --\end{codeexample} --- % -- you can say on the \tikzname\ layer --- % ---\begin{codeexample}[code only] +--\begin{codeexample}[code only] -- \graph { -- a, b, c, d; -- { [hyper] a, b, c } -- { [hyper] b, c, d } -- }; --\end{codeexample} --- +-- -- In this case, the nodes |a|, |b|, |c| will belong to a collection of -- kind |hyper|. The nodes |b|, |c|, and |d| will (also) belong to -- another collection of the same kind |hyper|. You can nest -- collections; in this case, nodes will belong to several --- collections. +-- collections. -- -- The effect of declaring a collection kind on the algorithm layer -- it, first of all, that |scope.collections| will have a field named @@ -679,37 +674,37 @@ end -- hyperedges, each of which is a table with the following fields: The -- |vertices| and |edges| fields each contain arrays of all objects -- being part of the collection. The |sub| field is an array of --- ``subcollections'', that is, all collections that were started +-- ``subcollections,'' that is, all collections that were started -- inside another collection. (For the collection kinds |hyper| and -- |same layer| this makes no sense, but subgraphs could, for instance, -- be nested.) --- +-- -- \medskip -- \noindent\textbf{Rendering of Collections.} -- For some kinds of collections, it makes sense to \emph{render} them, -- but only after the graph drawing algorithm has run. For this -- purpose, the binding layer will use a callback for each collection --- kind and each collection, see the |Binding| class for details. +-- kind and each collection, see the |Binding| class for details. -- Suppose, for instance, you would -- like hyperedges to be rendered. In this case, a graph drawing -- algorithm should iterate over all collections of type |hyper| and -- compute some hints on how to render the hyperedge and store this -- information in the |generated_options| table of the hyperedge. Then, --- the binding layer will ask the display layer to run some some code --- that is able to read key--value pairs passed to +-- the binding layer will ask the dislay layer to run some some code +-- that is able to read key--value pairs passed to -- it (which are the key--value pairs of the |generated_options| table) -- and use this information to nicely draw the hyperedge. -- -- The number |t.layer| determines in which order the different -- collection kinds are rendered. --- +-- -- The last parameter, the layer number, is used to specify the order -- in which the different collection kinds are rendered. The higher the -- number, the later the collection will be rendered. Thus, if there is -- a collection kind with layer number 10 and another with layer number -- 20, all collections of the first kind will be rendered first, -- followed by all collections of the second kind. --- +-- -- Collections whose layer kinds are non-negative get rendered -- \emph{after} the nodes and edges have already been rendered. In -- contrast, collections with a negative layer number get shown @@ -717,7 +712,7 @@ end -- -- (You cannot call this function directly, it is included for -- documentation purposes only.) --- +-- -- @param t The table originally passed to |declare|. local function declare_collection_kind (t) @@ -727,11 +722,11 @@ local function declare_collection_kind (t) local kind = t.key local kinds = InterfaceCore.collection_kinds local new_entry = { kind = kind, layer = layer } - + -- Insert into table part: kinds[kind] = new_entry - -- Insert into array part: + -- Insert into array part: local found for i=1,#kinds do if kinds[i].layer > layer or (kinds[i].layer == layer and kinds[i].kind > kind) then @@ -741,7 +736,7 @@ local function declare_collection_kind (t) end kinds[#kinds+1] = new_entry - + -- Bind InterfaceCore.binding:declareCallback(t) @@ -813,22 +808,22 @@ local unique_count = 1 -- -- For these reasons, the following happens, when a new vertex is -- created using the function: --- % +-- -- \begin{enumerate} --- \item The vertex is added to the syntactic digraph. --- \item It is added to all layouts on the current layout stack. When --- a graph drawing algorithm is run, it is not necessarily run on the --- original syntactic digraph. Rather, a sequence / stack of nested --- layouts may currently --- be processed and the vertex is added to all of them. --- \item The vertex is added to both the |digraph| and the |ugraph| of --- the current algorithm. +-- \item The vertex is added to the syntactic digraph. +-- \item It is added to all layouts on the current layout stack. When +-- a graph drawing algorithm is run, it is not necessarily run on the +-- original syntactic digraph. Rather, a sequence / stack of nested +-- layouts may currently +-- be processed and the vertex is added to all of them. +-- \item The vertex is added to both the |digraph| and the |ugraph| of +-- the current algorithm. -- \end{enumerate} -- -- @param algorithm An algorithm for whose syntactic digraph the node --- should be added +-- should be added -- @param init A table of initial values for the node that is passed --- to |Binding:createVertex|, see that function for details. +-- to |Binding:createVertex|, see that function for details. -- -- @return The newly created node -- @@ -837,7 +832,7 @@ function InterfaceToAlgorithms.createVertex(algorithm, init) -- Setup local scope = InterfaceCore.topScope() local binding = InterfaceCore.binding - + -- Setup node if not init.name then init.name = "internal@gd@node@" .. unique_count @@ -846,29 +841,29 @@ function InterfaceToAlgorithms.createVertex(algorithm, init) -- Does vertex already exist? assert (not scope.node_names[name], "node already created") - + if not init.shape or init.shape == "none" then init.shape = "rectangle" end - + -- Call binding binding:createVertex(init) - + local v = assert(scope.node_names[init.name], "internal node creation failed") - + -- Add vertex to the algorithm's digraph and ugraph - algorithm.syntactic_component:add {v} - algorithm.digraph:add {v} + algorithm.syntactic_component:add {v} + algorithm.digraph:add {v} algorithm.ugraph:add {v} - - -- Compute bounding boxes: + + -- Compute bounding boxes: LayoutPipeline.prepareBoundingBoxes(algorithm.rotation_info, algorithm.adjusted_bb, algorithm.digraph, {v}) - + -- Add the node to the layout stack: add_to_collections(algorithm.layout, "vertices", v) algorithm.layout_graph:add { v } - + return v end @@ -878,41 +873,40 @@ end -- Generate a new edge in the syntactic digraph. This method is quite -- similar to |createVertex| and has the same effects with respect to -- the edge: The edge is added to the syntactic digraph and also to --- all layouts on the layout stack. Furthermore, appropriate edges are +-- all layouts on the layout stack. Forthermore, appropriate edges are -- added to the |digraph| and the |ugraph| of the algorithm currently --- running. +-- running. -- --- @param algorithm An algorithm for whose syntactic digraph the node should be added +-- @param algorithm An algorithm for whose syntactic digraph the node should be added -- @param tail A syntactic tail vertex -- @param head A syntactic head vertex -- @param init A table of initial values for the edge. -- -- The following fields are useful for |init|: --- % -- \begin{itemize} --- \item |init.direction| If present, a direction for the edge. Defaults to "--". --- \item |init.options| If present, some options for the edge. --- \item |init.generated_options| A table that is passed back to the --- display layer as a list of key-value pairs in the syntax of --- |declare_parameter|. +-- \item |init.direction| If present, a direction for the edge. Defaults to "--". +-- \item |init.options| If present, some options for the edge. +-- \item |init.generated_options| A table that is passed back to the +-- display layer as a list of key-value pairs in the syntax of +-- |declare_parameter|. -- \end{itemize} function InterfaceToAlgorithms.createEdge(algorithm, tail, head, init) init = init or {} - + -- Setup local scope = InterfaceCore.topScope() local binding = InterfaceCore.binding local syntactic_digraph = algorithm.layout_graph local syntactic_component = algorithm.syntactic_component - + assert (syntactic_digraph:contains(tail) and - syntactic_digraph:contains(head), - "attempting to create edge between nodes that are not in the syntactic digraph") - + syntactic_digraph:contains(head), + "attempting to create edge between nodes that are not in the syntactic digraph") + local arc = syntactic_digraph:connect(tail, head) - + local edge = Edge.new { head = head, tail = tail, @@ -922,16 +916,16 @@ function InterfaceToAlgorithms.createEdge(algorithm, tail, head, init) generated_options = init.generated_options } - -- Add to arc + -- Add to arc arc.syntactic_edges[#arc.syntactic_edges+1] = edge - + local s_arc = syntactic_component:connect(tail, head) s_arc.syntactic_edges = arc.syntactic_edges - + -- Create Event local e = InterfaceToDisplay.createEvent ("edge", { arc, #arc.syntactic_edges }) edge.event = e - + -- Make part of collections for _,c in ipairs(edge.options.collections) do LookupTable.addOne(c.edges, edge) @@ -940,7 +934,7 @@ function InterfaceToAlgorithms.createEdge(algorithm, tail, head, init) -- Call binding binding.storage[edge] = {} binding:everyEdgeCreation(edge) - + -- Add edge to digraph and ugraph local direction = edge.direction if direction == "->" then @@ -956,13 +950,13 @@ function InterfaceToAlgorithms.createEdge(algorithm, tail, head, init) -- Add edge to layouts add_to_collections(algorithm.layout, "edges", edge) - + end --- Done +-- Done return InterfaceToAlgorithms diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/interface/InterfaceToC.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/interface/InterfaceToC.lua index 282727b66a3..2aeb2e6a7aa 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/interface/InterfaceToC.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/interface/InterfaceToC.lua @@ -32,17 +32,16 @@ local lib = require "pgf.gd.lib" -- |algorithm| field is set to an algorithm class object whose |run| -- method calls the function passed via the -- |algorithm_written_in_c| field. It will be called with the --- following parameters (in that order): --- % +-- following parameters (in that order): -- \begin{enumerate} --- \item The to-be-laid out digraph. This will not be the whole layout --- graph (syntactic digraph) if preprocessing like decomposition into --- connected components is used. --- \item An array of the digraph's vertices, but with the table part --- hashing vertex objects to their indices in the array part. --- \item An array of the syntactic edges of the digraph. Like the --- array, the table part will hash back the indices of the edge objects. --- \item The algorithm object. +-- \item The to-be-laid out digraph. This will not be the whole layout +-- graph (syntactic digraph) if preprocessing like decomposition into +-- connected components is used. +-- \item An array of the digraph's vertices, but with the table part +-- hashing vertex objects to their indices in the array part. +-- \item An array of the syntactic edges of the digraph. Like the +-- array, the table part will hash back the indices of the edge objects. +-- \item The algorithm object. -- \end{enumerate} -- -- @param t The table originally passed to |declare|. @@ -50,29 +49,29 @@ local lib = require "pgf.gd.lib" function InterfaceToC.declare_algorithm_written_in_c (t) t.algorithm = { run = function (self) - local back_table = lib.icopy(self.ugraph.vertices) - for i,v in ipairs(self.ugraph.vertices) do - back_table[v] = i - end - local edges = {} - for _,a in ipairs(self.ugraph.arcs) do - local b = self.layout_graph:arc(a.tail,a.head) - if b then - lib.icopy(b.syntactic_edges, edges) - end - end - for i=1,#edges do - edges[edges[i]] = i - end - collectgarbage("stop") -- Remove once Lua Link Bug is fixed - t.algorithm_written_in_c (self.digraph, back_table, edges, self) - collectgarbage("restart") -- Remove once Lua Link Bug is fixed - end - } + local back_table = lib.icopy(self.ugraph.vertices) + for i,v in ipairs(self.ugraph.vertices) do + back_table[v] = i + end + local edges = {} + for _,a in ipairs(self.ugraph.arcs) do + local b = self.layout_graph:arc(a.tail,a.head) + if b then + lib.icopy(b.syntactic_edges, edges) + end + end + for i=1,#edges do + edges[edges[i]] = i + end + collectgarbage("stop") -- Remove once Lua Link Bug is fixed + t.algorithm_written_in_c (self.digraph, back_table, edges, self) + collectgarbage("restart") -- Remove once Lua Link Bug is fixed + end + } end -- Done -return InterfaceToC +return InterfaceToC
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/interface/InterfaceToDisplay.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/interface/InterfaceToDisplay.lua index 23018efcaa5..c0ddf0dc8ce 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/interface/InterfaceToDisplay.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/interface/InterfaceToDisplay.lua @@ -73,10 +73,10 @@ local option_cache = nil -- The option cache --- --- Initialize the binding. This function is called once by the display +-- Initiliaze the binding. This function is called once by the display -- layer at the very beginning. For instance, \tikzname\ does the -- following call: --- % +-- --\begin{codeexample}[code only, tikz syntax=false] --InterfaceToDisplay.bind(require "pgf.gd.bindings.BindingToPGF") --\end{codeexample} @@ -90,10 +90,10 @@ local option_cache = nil -- The option cache function InterfaceToDisplay.bind(class) assert (not InterfaceCore.binding, "binding already initialized") - + -- Create a new object InterfaceCore.binding = setmetatable({}, class) - + -- Load these libraries, which contain many standard declarations: require "pgf.gd.model.library" require "pgf.gd.control.library" @@ -113,7 +113,7 @@ end -- once more. -- -- Each graph drawing scope comes with a syntactic digraph that is --- build using methods like |addVertex| or |addEdge|. +-- build using methods like |addVertex| or |addEdge|. -- -- @param height The to-be-used height of the options stack. All -- options above this height will be popped prior to attacking the @@ -123,14 +123,14 @@ function InterfaceToDisplay.beginGraphDrawingScope(height) -- Create a new scope table local scope = Scope.new {} - + -- Setup syntactic digraph: local g = scope.syntactic_digraph - + g.options = get_current_options_table(height) g.syntactic_digraph = g g.scope = scope - + -- Push scope: InterfaceCore.scopes[#InterfaceCore.scopes + 1] = scope end @@ -138,7 +138,7 @@ end --- --- Arranges the current graph using the specified algorithm and options. +-- Arranges the current graph using the specified algorithm and options. -- -- This function should be called after the graph drawing scope has -- been opened and the syntactic digraph has been completely @@ -165,22 +165,22 @@ function InterfaceToDisplay.runGraphDrawingAlgorithm() -- Setup local scope = InterfaceCore.topScope() assert(not scope.coroutine, "coroutine already created for current gd scope") - + -- The actual drawing function local function run () if #scope.syntactic_digraph.vertices == 0 then -- Nothing needs to be done return end - + LayoutPipeline.run(scope) end - + scope.coroutine = coroutine.create(run) -- Run it: - InterfaceToDisplay.resumeGraphDrawingCoroutine() - + InterfaceToDisplay.resumeGraphDrawingCoroutine() + -- End timing: local stop = os.clock() @@ -204,10 +204,10 @@ function InterfaceToDisplay.resumeGraphDrawingCoroutine() -- Setup local scope = InterfaceCore.topScope() local binding = InterfaceCore.binding - + -- Asserts assert(scope.coroutine, "coroutine not created for current gd scope") - + -- Run local ok, text = coroutine.resume(scope.coroutine) assert(ok, text) @@ -258,7 +258,7 @@ end -- to the current |Binding|. -- -- @param anchors A table of anchors (mapping anchor positions to --- |Coordinates|). +-- |Coordinates|). function InterfaceToDisplay.createVertex(name, shape, path, height, binding_infos, anchors) @@ -266,7 +266,7 @@ function InterfaceToDisplay.createVertex(name, shape, path, height, binding_info -- Setup local scope = InterfaceCore.topScope() local binding = InterfaceCore.binding - + -- Does vertex already exist? local v = scope.node_names[name] assert (not v or not v.created_on_display_layer, "node already created") @@ -304,18 +304,18 @@ function vertex_created(v,scope) -- Create Event local e = InterfaceToDisplay.createEvent ("node", v) v.event = e - + -- Create name lookup scope.node_names[v.name] = v - + -- Add vertex to graph scope.syntactic_digraph:add {v} - + -- Add to collections for _,c in ipairs(v.options.collections) do LookupTable.addOne(c.vertices, v) end - + end @@ -326,9 +326,9 @@ end -- ``surrounds'' the vertices of a subgraph. The special property of a -- subgraph node opposed to a normal node is that it is created only -- after the subgraph has been laid out. However, the difference to a --- collection like |hyper| is that the node is available immediately as +-- collection like |hyper| is that the node is availble immediately as -- a normal node in the sense that you can connect edges to it. --- +-- -- What happens internally is that subgraph nodes get ``registered'' -- immediately both on the display level and on the algorithm level, -- but the actual node is only created inside the layout pipeline @@ -339,7 +339,7 @@ end -- contains all vertices (and edges) being part of the subgraph. For -- this reason, this method is a |push...| method, since it pushes -- something on the options stack. --- +-- -- The |init| parameter will be used during the creation of the node, -- see |Binding:createVertex| for details on the fields. Note that -- |init.text| is often not displayed for such ``vast'' nodes as those @@ -350,34 +350,34 @@ end -- -- The |init.generated_options| will be augmented by additional -- key--value pairs when the vertex is created: --- % --- \begin{itemize} --- \item The key |subgraph point cloud| will have as its value a --- string that is be a list of points (without separating commas) --- like |"(10pt,20pt)(0pt,0pt)(30pt,40pt)"|, always in --- this syntax. The list will contain all points inside the --- subgraph. In particular, a bounding box around these points will --- encompass all nodes and bend points of the subgraph. --- The bounding box of this point cloud is guaranteed to be centered on --- the origin. --- \item The key |subgraph bounding box width| will have as its value --- the width of a bounding box (in \TeX\ points, as a string with the --- suffix |"pt"|). --- \item The key |subgraph bounding box height| stores the height of a --- bounding box. --- \end{itemize} -- +-- \begin{itemize} +-- \item The key |subgraph point cloud| will have as its value a +-- string that is be a list of points (without +-- separating commas) like |"(10pt,20pt)(0pt,0pt)(30pt,40pt)"|, always in +-- this syntax. The list will contain all points inside the +-- subgraph. In particular, a bounding box around these points will +-- encompass all nodes and bend points of the subgraph. +-- The bounding box of this point cloud is guaranteed to be centered on +-- the origin. +-- \item The key |subgraph bounding box width| will have as its value +-- the width of a bounding box (in \TeX\ points, as a string with the +-- suffix |"pt"|). +-- \item The key |subgraph bounding box height| stores the height of a +-- bounding box. +-- \end{itemize} +-- -- @param name The name of the node. -- @param height Height of the options stack. Note that this method -- pushes something (namely a collection) on the options stack. -- @param info A table passed to |Binding:createVertex|, see that function. -- function InterfaceToDisplay.pushSubgraphVertex(name, height, info) - + -- Setup local scope = InterfaceCore.topScope() local binding = InterfaceCore.binding - + -- Does vertex already exist? assert (not scope.node_names[name], "node already created") @@ -387,7 +387,7 @@ function InterfaceToDisplay.pushSubgraphVertex(name, height, info) kind = "subgraph node", options = get_current_options_table(height-1) } - + vertex_created(v,scope) -- Store info @@ -429,12 +429,12 @@ function InterfaceToDisplay.addToVertexOptions(name, height) -- Setup local scope = InterfaceCore.topScope() - + -- Does vertex already exist? local v = assert (scope.node_names[name], "node is missing, cannot add options") - + v.options = get_current_options_table(height, v.options) - + -- Add to collections for _,c in ipairs(v.options.collections) do LookupTable.addOne(c.vertices, v) @@ -464,8 +464,8 @@ end -- -- @param tail Name of the node the edge begins at. -- @param head Name of the node the edge ends at. --- @param direction Direction of the edge (e.g. |--| for an undirected edge --- or |->| for a directed edge from the first to the second +-- @param direction Direction of the edge (e.g. |--| for an undirected edge +-- or |->| for a directed edge from the first to the second -- node). -- @param height The option stack height, see for instance |createVertex|. -- @@ -477,12 +477,12 @@ function InterfaceToDisplay.createEdge(tail, head, direction, height, binding_in -- Setup local scope = InterfaceCore.topScope() local binding = InterfaceCore.binding - + -- Does vertex already exist? local h = scope.node_names[head] local t = scope.node_names[tail] assert (h and t, "attempting to create edge between nodes that are not in the graph") - + -- Create Arc object local arc = scope.syntactic_digraph:connect(t, h) @@ -493,14 +493,14 @@ function InterfaceToDisplay.createEdge(tail, head, direction, height, binding_in direction = direction, options = get_current_options_table(height) } - - -- Add to arc + + -- Add to arc arc.syntactic_edges[#arc.syntactic_edges+1] = edge - + -- Create Event local e = InterfaceToDisplay.createEvent ("edge", { arc, #arc.syntactic_edges }) edge.event = e - + -- Make part of collections for _,c in ipairs(edge.options.collections) do LookupTable.addOne(c.edges, edge) @@ -509,15 +509,15 @@ function InterfaceToDisplay.createEdge(tail, head, direction, height, binding_in -- Call binding binding.storage[edge] = binding_infos binding:everyEdgeCreation(edge) - + end - + --- --- Push an option to the stack of options. +-- Push an option to the stack of options. -- -- As a graph is parsed, a stack of ``current options'' -- is created. To add something to this table, the display layers may @@ -533,7 +533,7 @@ end -- resulting stack height. -- -- In addition to this stack height, this function returns a Boolean --- value indicating whether a ``main algorithm phase was set''. This +-- value indicating whether a ``main algorithm phase was set.'' This -- happens whenever a key is executed (directly or indirectly through -- the |use| field) that selects an algorithm for the ``main'' -- algorithm phase. This information may help the caller to setup the @@ -546,7 +546,7 @@ end -- above this height will be removed. -- -- @return A new stack height --- @return A Boolean that is |true| if the main algorithm phase was +-- @return A Boolean that is |true| iff the main algorithm phase was -- set by the option or one option |use|d by it. -- @return The newly created entry on the stack. If more entries are -- created through the use of the |use| field, the original entry is @@ -555,65 +555,65 @@ end function InterfaceToDisplay.pushOption(key, value, height) assert(type(key) == "string", "illegal key") - + local key_record = assert(InterfaceCore.keys[key], "unknown key") local main_phase_set = false - + if value == nil and key_record.default then value = key_record.default end - + -- Find out what kind of key we are pushing: - + if key_record.algorithm then -- Push a phase if type(InterfaceCore.algorithm_classes[key]) == "function" then - -- Call the constructor function + -- Call the constructor function InterfaceCore.algorithm_classes[key] = InterfaceCore.algorithm_classes[key]() end local algorithm = InterfaceCore.algorithm_classes[key] - + assert (algorithm, "algorithm class not found") - + push_on_option_stack(phase_unique, - { phase = value or key_record.phase, algorithm = algorithm }, - height) - + { phase = value or key_record.phase, algorithm = algorithm }, + height) + if key_record.phase == "main" then main_phase_set = true end - + elseif key_record.layer then -- Push a collection local stack = InterfaceCore.option_stack local scope = InterfaceCore.topScope() - + -- Get the stack above "height": local options = get_current_options_table(height-1) - + -- Create the collection event local event = InterfaceToDisplay.createEvent ("collection", key) - + -- Create collection object: local collection = Collection.new { kind = key, options = options, event = event } - + -- Store in collections table of current scope: local collections = scope.collections[key] or {} collections[#collections + 1] = collection scope.collections[key] = collections - + -- Build collection tree collection:registerAsChildOf(options.collections[#options.collections]) - + -- Push on stack push_on_option_stack(collections_unique, collection, height) - + else - + -- A normal key push_on_option_stack(key, InterfaceCore.convert(value, InterfaceCore.keys[key].type), height) - + end local newly_created = InterfaceCore.option_stack[#InterfaceCore.option_stack] @@ -626,10 +626,10 @@ function InterfaceToDisplay.pushOption(key, value, height) local use_k = u.key local use_v = u.value if type(use_k) == "function" then - use_k = use_k(value) + use_k = use_k(value) end if type(use_v) == "function" then - use_v = use_v(value) + use_v = use_v(value) end height, flag = InterfaceToDisplay.pushOption(use_k, use_v, height+1) main_phase_set = main_phase_set or flag @@ -655,7 +655,7 @@ end --- --- Creates an event and adds it to the event string of the current scope. +-- Creates an event and adds it to the event string of the current scope. -- -- @param kind Name/kind of the event. -- @param parameters Parameters of the event. @@ -679,7 +679,7 @@ end -- keys's names. In particular, you can then iterate over it using -- |ipairs| and you can check whether a key is defined by accessing -- the table at the key's name. Each entry of the table is the --- original table passed to |InterfaceToAlgorithms.declare|. +-- original table passed to |InterfaceToAlgorithms.declare|. -- -- @return A lookup table of all declared keys. @@ -699,7 +699,7 @@ end -- whole graph. -- -- In detail, this function calls: --- % +-- --\begin{codeexample}[code only, tikz syntax=false] --local binding = InterfaceCore.binding -- @@ -719,14 +719,14 @@ end function InterfaceToDisplay.renderGraph() local scope = InterfaceCore.topScope() local syntactic_digraph = scope.syntactic_digraph - + local binding = InterfaceCore.binding - + binding:renderStart() render_vertices(syntactic_digraph.vertices) render_edges(syntactic_digraph.arcs) render_collections(scope.collections) - binding:renderStop() + binding:renderStop() end @@ -743,16 +743,15 @@ end -- binding layer. -- -- Consider the following code: --- % ---\begin{codeexample}[code only] +--\begin{codeexample}[code only] --\graph [... layout] { -- a -- b -- c -- d; --}; --\end{codeexample} --- +-- -- In this case, after the graph drawing algorithm has run, the -- present function will call: --- % +-- --\begin{codeexample}[code only, tikz syntax=false] --local binding = InterfaceCore.binding -- @@ -780,25 +779,24 @@ end -- function is called to render the different collection kinds. -- -- Collection kinds rendered in the order provided by the |layer| --- field passed to |declare| during the declaration of the collection +-- field passed to |declare| during the declaration of the colleciton -- kind, see also |declare_collection|. If several collection kinds -- have the same layer, they are rendered in lexicographical ordering -- (to ensure that they are always rendered in the same order). -- -- Consider the following code: --- % --\begin{codeexample}[code only, tikz syntax=false] --declare { key = "hyper", layer = 1 } --\end{codeexample} -- you can say on the \tikzname\ layer ---\begin{codeexample}[code only] +--\begin{codeexample}[code only] --\graph { -- a, b, c, d; -- { [hyper] a, b, c } -- { [hyper] b, c, d } --}; --\end{codeexample} --- +-- -- In this case, after the graph drawing algorithm has run, the -- present function will call: -- @@ -811,12 +809,12 @@ end --binding:renderCollectionStopKind("hyper", 1) --\end{codeexample} -- --- @param collections The |collections| table of the current scope. +-- @param collections The |collections| table of the current scope. function render_collections(collections) local kinds = InterfaceCore.collection_kinds local binding = InterfaceCore.binding - + for i=1,#kinds do local kind = kinds[i].kind local layer = kinds[i].layer @@ -824,7 +822,7 @@ function render_collections(collections) if layer ~= 0 then binding:renderCollectionStartKind(kind, layer) for _,c in ipairs(collections[kind] or {}) do - binding:renderCollection(c) + binding:renderCollection(c) end binding:renderCollectionStopKind(kind, layer) end @@ -839,20 +837,19 @@ end -- -- When the graph drawing algorithm is done, the interface will first -- rendering the vertices using |render_vertices|, followed by calling --- this function, which in turn calls appropriate callbacks to the +-- this function, which in turn calls appropriate callbacks to the -- binding layer. -- -- Consider the following code: --- % ---\begin{codeexample}[code only] +--\begin{codeexample}[code only] -- \graph [... layout] { -- a -- b -- c -- d; -- }; --\end{codeexample} --- +-- -- In this case, after the graph drawing algorithm has run, the -- present function will call: --- % +-- --\begin{codeexample}[code only, tikz syntax=false] -- local binding = InterfaceCore.binding -- @@ -880,14 +877,14 @@ local aliases = InterfaceCore.option_aliases local option_initial = InterfaceCore.option_initial local option_metatable = { - __index = + __index = function (t, key) local k = aliases[key] if k then - local v = (type(k) == "string" and t[k]) or (type(k) == "function" and k(t)) or nil - if v ~= nil then - return v - end + local v = (type(k) == "string" and t[k]) or (type(k) == "function" and k(t)) or nil + if v ~= nil then + return v + end end return option_initial[key] end @@ -904,19 +901,19 @@ local option_metatable = { -- with object.) -- -- (This function is local and internal and included only for documentation --- purposes.) +-- purposes.) -- -- @param height The stack height for which the option table is -- required. -- @param table If non |nil|, the options will be added to this --- table. +-- table. -- -- @return The option table as described above. function get_current_options_table (height, table) local stack = InterfaceCore.option_stack assert (height >= 0 and height <= #stack, "height value out of bounds") - + if height == InterfaceCore.option_cache_height and not table then return option_cache else @@ -929,49 +926,49 @@ function get_current_options_table (height, table) local cache if not table then cache = setmetatable( - { - algorithm_phases = setmetatable({}, InterfaceCore.option_initial.algorithm_phases), - collections = {} - }, option_metatable) + { + algorithm_phases = setmetatable({}, InterfaceCore.option_initial.algorithm_phases), + collections = {} + }, option_metatable) else cache = lib.copy(table) cache.algorithm_phases = lib.copy(cache.algorithm_phases) cache.collections = lib.copy(cache.collections) end - + local algorithm_phases = cache.algorithm_phases local collections = cache.collections local keys = InterfaceCore.keys - + local function handle (k, v) if k == phase_unique then - algorithm_phases[v.phase] = v.algorithm - local phase_stack = v.phase .. " stack" - local t = rawget(algorithm_phases, phase_stack) - if not t then - t = algorithm_phases[phase_stack] - assert(type(t) == "table", "unknown phase") - t = lib.copy(t) - algorithm_phases[phase_stack] = t - end - t[#t + 1] = v.algorithm + algorithm_phases[v.phase] = v.algorithm + local phase_stack = v.phase .. " stack" + local t = rawget(algorithm_phases, phase_stack) + if not t then + t = algorithm_phases[phase_stack] + assert(type(t) == "table", "unknown phase") + t = lib.copy(t) + algorithm_phases[phase_stack] = t + end + t[#t + 1] = v.algorithm elseif k == collections_unique then - LookupTable.addOne(collections, v) + LookupTable.addOne(collections, v) else - cache[k] = v + cache[k] = v end end - + for _,s in ipairs(stack) do handle (s.key, s.value) end - + -- Cache it, if this was not added: if not table then InterfaceCore.option_cache_height = height option_cache = cache end - + return cache end end @@ -982,21 +979,21 @@ end function push_on_option_stack(key, value, height) local stack = InterfaceCore.option_stack - - assert (type(height) == "number" and height > 0 and height <= #stack + 1, - "height value out of bounds") - + + assert (type(height) == "number" and height > 0 and height <= #stack + 1, + "height value out of bounds") + -- Clear superfluous part of stack for i=#stack,height+1,-1 do stack[i] = nil end stack[height] = { key = key, value = value } - InterfaceCore.option_cache_height = nil -- invalidate cache + InterfaceCore.option_cache_height = nil -- invalidate cache end --- Done +-- Done -return InterfaceToDisplay +return InterfaceToDisplay
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/interface/Scope.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/interface/Scope.lua index a750308e692..438925a2213 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/interface/Scope.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/interface/Scope.lua @@ -25,8 +25,8 @@ -- inform an algorithm about the input. -- -- For each graph drawing scope, a new |Scope| object is --- created. Graph drawing scopes are kept track of using a stack, but --- only the top of this stack is available to the interface classes. +-- created. Graph drawing scopes are kepts track of using a stack, but +-- only the top of this stack is available to the interface classes. -- -- @field syntactic_digraph The syntactic digraph is a digraph that -- faithfully encodes the way the input graph is represented @@ -77,16 +77,16 @@ local Digraph = require "pgf.gd.model.Digraph" function Scope.new(initial) return setmetatable(lib.copy(initial, - { - syntactic_digraph = Digraph.new{}, - events = {}, - node_names = {}, - coroutine = nil, - collections = {}, - }), Scope) + { + syntactic_digraph = Digraph.new{}, + events = {}, + node_names = {}, + coroutine = nil, + collections = {}, + }), Scope) end --- Done +-- Done -return Scope +return Scope
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered.lua index 6988e7a3d9d..dd897fbe8ac 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered.lua @@ -20,7 +20,7 @@ require("pgf.gd").layered = layered local lib = require "pgf.gd.lib" local Storage = require "pgf.gd.lib.Storage" --- +-- -- This file defines some basic functions to compute and/or set the -- ideal distances between nodes of any kind of layered drawing of a -- graph. @@ -30,7 +30,7 @@ local Storage = require "pgf.gd.lib.Storage" -- Compute the ideal distance between two siblings -- -- @param paddings A |Storage| object in which the computed distances --- (paddings) are stored. +-- (paddings) are stored. -- @param graph The graph object -- @param n1 The first node -- @param n2 The second node @@ -55,9 +55,9 @@ function layered.ideal_sibling_distance (paddings, graph, n1, n2) sep = (n1_is_node and lib.lookup_option('sibling post sep', n1, graph) or 0) + (n2_is_node and lib.lookup_option('sibling pre sep', n2, graph) or 0) end - - return math.max(ideal_distance, sep + - ((n1_is_node and paddings[n1].sibling_post) or 0) - + + return math.max(ideal_distance, sep + + ((n1_is_node and paddings[n1].sibling_post) or 0) - ((n2_is_node and paddings[n2].sibling_pre) or 0)) end @@ -88,7 +88,7 @@ function layered.baseline_distance (paddings, graph, l1, l2) if #l1 == 0 or #l2 == 0 then return 0 end - + local layer_distance = -math.huge local layer_pre_sep = -math.huge local layer_post_sep = -math.huge @@ -110,7 +110,7 @@ function layered.baseline_distance (paddings, graph, l1, l2) min_pre = math.min(min_pre, paddings[n].layer_pre) end end - + return math.max(layer_distance, layer_post_sep + layer_pre_sep + max_post - min_pre) end @@ -121,18 +121,18 @@ end -- -- @param layers A |Storage| object assigning layers to vertices. -- @param paddings A |Storage| object storing the computed distances --- (paddings). +-- (paddings). -- @param graph The graph in which the nodes reside function layered.arrange_layers_by_baselines (layers, paddings, graph) local layer_vertices = Storage.newTableStorage() - + -- Decompose into layers: for _,v in ipairs(graph.vertices) do table.insert(layer_vertices[layers[v]], v) end - + if #layer_vertices > 0 then -- sanity check -- Now compute ideal distances and store local height = 0 @@ -140,12 +140,12 @@ function layered.arrange_layers_by_baselines (layers, paddings, graph) for _,v in ipairs(layer_vertices[1]) do v.pos.y = 0 end - + for i=2,#layer_vertices do height = height + layered.baseline_distance(paddings, graph, layer_vertices[i-1], layer_vertices[i]) for _,v in ipairs(layer_vertices[i]) do - v.pos.y = height + v.pos.y = height end end end @@ -156,4 +156,4 @@ end -- Done -return layered +return layered
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/CrossingMinimizationGansnerKNV1993.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/CrossingMinimizationGansnerKNV1993.lua index da9ff9698c0..3fe3eac2552 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/CrossingMinimizationGansnerKNV1993.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/CrossingMinimizationGansnerKNV1993.lua @@ -58,7 +58,7 @@ function CrossingMinimizationGansnerKNV1993:computeInitialRankOrdering() local function init(search) for i=#self.graph.nodes,1,-1 do - local node = self.graph.nodes[i] + local node = self.graph.nodes[i] if direction == 'down' then if node:getInDegree() == 0 then search:push(node) @@ -81,7 +81,7 @@ function CrossingMinimizationGansnerKNV1993:computeInitialRankOrdering() self.ranking:setRankPosition(node, pos) if direction == 'down' then - local out = node:getOutgoingEdges() + local out = node:getOutgoingEdges() for i=#out,1,-1 do local neighbour = out[i]:getNeighbour(node) if not search:getDiscovered(neighbour) then @@ -90,9 +90,9 @@ function CrossingMinimizationGansnerKNV1993:computeInitialRankOrdering() end end else - local into = node:getIncomingEdges() - for i=#into,1,-1 do - local neighbour = into[i]:getNeighbour(node) + local into = node:getIncomingEdges() + for i=#into,1,-1 do + local neighbour = into[i]:getNeighbour(node) if not search:getDiscovered(neighbour) then search:push(neighbour) search:setDiscovered(neighbour) @@ -122,7 +122,7 @@ function CrossingMinimizationGansnerKNV1993:countRankCrossings(ranking) local crossings = 0 local ranks = ranking:getRanks() - + for rank_index = 2, #ranks do local nodes = ranking:getNodes(ranks[rank_index]) for i = 1, #nodes-1 do @@ -170,7 +170,7 @@ function CrossingMinimizationGansnerKNV1993:countNodeCrossings(ranking, left_nod left_edges = left_node:getOutgoingEdges() right_edges = right_node:getOutgoingEdges() end - + local crossings = 0 local function left_neighbour_on_other_rank(edge) @@ -186,20 +186,20 @@ function CrossingMinimizationGansnerKNV1993:countNodeCrossings(ranking, left_nod for _,left_edge in ipairs(left_edges) do if left_neighbour_on_other_rank(left_edge) then local left_neighbour = left_edge:getNeighbour(left_node) - + for _,right_edge in ipairs(right_edges) do - if right_neighbour_on_other_rank(right_edge) then - local right_neighbour = right_edge:getNeighbour(right_node) - - local left_position = ranking:getRankPosition(left_neighbour) - local right_position = ranking:getRankPosition(right_neighbour) - - local neighbour_diff = right_position - left_position - - if neighbour_diff < 0 then - crossings = crossings + 1 - end - end + if right_neighbour_on_other_rank(right_edge) then + local right_neighbour = right_edge:getNeighbour(right_node) + + local left_position = ranking:getRankPosition(left_neighbour) + local right_position = ranking:getRankPosition(right_neighbour) + + local neighbour_diff = right_position - left_position + + if neighbour_diff < 0 then + crossings = crossings + 1 + end + end end end end @@ -252,7 +252,7 @@ function CrossingMinimizationGansnerKNV1993:computeMedianPosition(node, prev_ran function (edge) local n = edge:getNeighbour(node) if self.ranking:getRank(n) == prev_rank then - return self.ranking:getRankPosition(n) + return self.ranking:getRankPosition(n) end end) diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/CycleRemovalBergerS1990a.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/CycleRemovalBergerS1990a.lua index 76deb8adaf6..55207b845d3 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/CycleRemovalBergerS1990a.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/CycleRemovalBergerS1990a.lua @@ -10,6 +10,7 @@ -- @release $Header$ + local CycleRemovalBergerS1990a = {} local lib = require("pgf.gd.lib") @@ -26,20 +27,20 @@ function CycleRemovalBergerS1990a:run() for _,node in ipairs(self.graph.nodes) do -- get all outgoing edges that have not been removed yet local out_edges = lib.imap(node:getOutgoingEdges(), - function (edge) - if not removed[edge] then return edge end - end) + function (edge) + if not removed[edge] then return edge end + end) -- get all incoming edges that have not been removed yet local in_edges = lib.imap(node:getIncomingEdges(), - function (edge) - if not removed[edge] then return edge end - end) + function (edge) + if not removed[edge] then return edge end + end) if #out_edges >= #in_edges then - -- we have more outgoing than incoming edges, reverse all incoming + -- we have more outgoing than incoming edges, reverse all incoming -- edges and mark all incident edges as removed - + for _,edge in ipairs(out_edges) do removed[edge] = true end @@ -71,4 +72,4 @@ end -- done -return CycleRemovalBergerS1990a +return CycleRemovalBergerS1990a
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/CycleRemovalBergerS1990b.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/CycleRemovalBergerS1990b.lua index d8f28980c87..218ecbd2099 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/CycleRemovalBergerS1990b.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/CycleRemovalBergerS1990b.lua @@ -28,20 +28,20 @@ function CycleRemovalBergerS1990b:run() -- get all outgoing edges that have not been removed yet -- get all outgoing edges that have not been removed yet local out_edges = lib.imap(node:getOutgoingEdges(), - function (edge) - if not removed[edge] then return edge end - end) + function (edge) + if not removed[edge] then return edge end + end) -- get all incoming edges that have not been removed yet local in_edges = lib.imap(node:getIncomingEdges(), - function (edge) - if not removed[edge] then return edge end - end) + function (edge) + if not removed[edge] then return edge end + end) if #out_edges >= #in_edges then - -- we have more outgoing than incoming edges, reverse all incoming + -- we have more outgoing than incoming edges, reverse all incoming -- edges and mark all incident edges as removed - + for _,edge in ipairs(out_edges) do removed[edge] = true end @@ -73,4 +73,4 @@ end -- done -return CycleRemovalBergerS1990b +return CycleRemovalBergerS1990b
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/CycleRemovalGansnerKNV1993.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/CycleRemovalGansnerKNV1993.lua index e52b0d38d1a..b480b7c4e70 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/CycleRemovalGansnerKNV1993.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/CycleRemovalGansnerKNV1993.lua @@ -23,10 +23,10 @@ function CycleRemovalGansnerKNV1993:run () -- -- ignore self-loops -- - -- merge multiple edges into one edge each, whose weight is the sum of the + -- merge multiple edges into one edge each, whose weight is the sum of the -- individual edge weights -- - -- ignore leaf nodes that are not part of the user-defined sets (their ranks + -- ignore leaf nodes that are not part of the user-defined sets (their ranks -- are trivially determined) -- -- ensure that supernodes S_min and S_max are assigned first and last ranks @@ -36,10 +36,10 @@ function CycleRemovalGansnerKNV1993:run () -- ensure the supernodes S_min and S_max are are the only nodes in these ranks -- for all nodes with indegree of 0, insert temporary edge (S_min, v) with delta=0 -- for all nodes with outdegree of 0, insert temporary edge (v, S_max) with delta=0 - + -- classify edges as tree/forward, cross and back edges using a DFS traversal local tree_or_forward_edges, cross_edges, back_edges = Simplifiers:classifyEdges(self.graph) - + -- reverse the back edges in order to make the graph acyclic for _,edge in ipairs(back_edges) do edge.reversed = true diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/NetworkSimplex.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/NetworkSimplex.lua index 0ccf7694cae..40078405f90 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/NetworkSimplex.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/NetworkSimplex.lua @@ -14,10 +14,10 @@ --- This file contains an implementation of the network simplex method ---- for node ranking and x coordinate optimization in layered drawing +--- for node ranking and x coordinate optimization in layered drawing --- algorithms, as proposed in --- ---- "A Technique for Drawing Directed Graphs" +--- "A Technique for Drawing Directed Graphs" -- by Gansner, Koutsofios, North, Vo, 1993. @@ -57,7 +57,7 @@ end function NetworkSimplex:run() assert (#self.graph.nodes > 0, "graph must contain at least one node") - + -- initialize the tree edge search index self.search_index = 1 @@ -72,7 +72,7 @@ function NetworkSimplex:run() self.low = {} self.parent_edge = {} self.ranking = Ranking.new() - + if #self.graph.nodes == 1 then self.ranking:setRank(self.graph.nodes[1], 1) else @@ -86,19 +86,19 @@ function NetworkSimplex:rankNodes() -- construct feasible tree of tight edges self:constructFeasibleTree() - -- iteratively replace edges with negative cut values + -- iteratively replace edges with negative cut values -- with non-tree edges (chosen by minimum slack) local leave_edge = self:findNegativeCutEdge() while leave_edge do local enter_edge = self:findReplacementEdge(leave_edge) - + assert(enter_edge, 'no non-tree edge to replace ' .. tostring(leave_edge) .. ' could be found') -- exchange leave_edge and enter_edge in the tree, updating -- the ranks and cut values of all nodes self:exchangeTreeEdges(leave_edge, enter_edge) - -- find the next tree edge with a negative cut value, if + -- find the next tree edge with a negative cut value, if -- there are any left leave_edge = self:findNegativeCutEdge() end @@ -108,7 +108,7 @@ function NetworkSimplex:rankNodes() self.ranking:normalizeRanks() -- move nodes to feasible ranks with the least number of nodes - -- in order to avoid crowding and to improve the overall aspect + -- in order to avoid crowding and to improve the overall aspect -- ratio of the drawing self:balanceRanksTopBottom() elseif self.balancing == NetworkSimplex.BALANCE_LEFT_RIGHT then @@ -140,7 +140,7 @@ function NetworkSimplex:constructFeasibleTree() if min_slack_edge then local delta = self:edgeSlack(min_slack_edge) - + if delta > 0 then local head = min_slack_edge:getHead() local tail = min_slack_edge:getTail() @@ -193,7 +193,7 @@ function NetworkSimplex:findReplacementEdge(leave_edge) local v = nil local direction = nil - + if self.lim[tail] < self.lim[head] then v = tail direction = 'in' @@ -206,7 +206,7 @@ function NetworkSimplex:findReplacementEdge(leave_edge) local enter_edge = nil local slack = math.huge - -- TODO Jannis: Get rid of this recursion: + -- TODO Janns: Get rid of this recursion: local function find_edge(v, direction) @@ -250,7 +250,7 @@ function NetworkSimplex:findReplacementEdge(leave_edge) local tree_tail = self.tree_node[tail] assert(tail and tree_tail) - + if not self.tree_edge[edge] then if not self:inTailComponentOf(tree_tail, search_root) then if self:edgeSlack(edge) < slack or not enter_edge then @@ -280,7 +280,7 @@ function NetworkSimplex:findReplacementEdge(leave_edge) end find_edge(v, direction) - + return enter_edge end @@ -293,7 +293,7 @@ function NetworkSimplex:exchangeTreeEdges(leave_edge, enter_edge) local cutval = self.cut_value[leave_edge] local head = self.tree_node[enter_edge:getHead()] local tail = self.tree_node[enter_edge:getTail()] - + local ancestor = self:updateCutValuesUpToCommonAncestor(tail, head, cutval, true) local other_ancestor = self:updateCutValuesUpToCommonAncestor(head, tail, cutval, false) @@ -322,7 +322,7 @@ function NetworkSimplex:balanceRanksTopBottom() -- node to in/out weight mappings local in_weight = {} local out_weight = {} - + -- node to lowest/highest possible rank mapping local min_rank = {} local max_rank = {} @@ -335,22 +335,22 @@ function NetworkSimplex:balanceRanksTopBottom() for _,edge in ipairs(node:getIncomingEdges()) do -- accumulate the weights of all incoming edges in_weight[node] = (in_weight[node] or 0) + edge.weight - + -- update the minimum allowed rank (which is the maximum of - -- the ranks of all parent neighbors plus the minimum level + -- the ranks of all parent neighbours plus the minimum level -- separation caused by the connecting edges) local neighbour = edge:getNeighbour(node) local neighbour_rank = self.ranking:getRank(neighbour) min_rank[node] = math.max(min_rank[node], neighbour_rank + edge.minimum_levels) end - + for _,edge in ipairs(node:getOutgoingEdges()) do -- accumulate the weights of all outgoing edges out_weight[node] = (out_weight[node] or 0) + edge.weight -- update the maximum allowed rank (which is the minimum of - -- the ranks of all child neighbors minus the minimum level - -- separation caused by the connecting edges) + -- the ranks of all child neighbours minus the minimum level + -- sparation caused by the connecting edges) local neighbour = edge:getNeighbour(node) local neighbour_rank = self.ranking:getRank(neighbour) max_rank[node] = math.min(max_rank[node], neighbour_rank - edge.minimum_levels) @@ -400,7 +400,7 @@ end function NetworkSimplex:computeInitialRanking() - + -- queue for nodes to rank next local queue = {} @@ -408,7 +408,7 @@ function NetworkSimplex:computeInitialRanking() local function enqueue(node) table.insert(queue, node) end local function dequeue() return table.remove(queue, 1) end - -- reset the two-dimensional mapping from ranks to lists + -- reset the two-dimensional mapping from ranks to lists -- of corresponding nodes self.ranking:reset() @@ -418,7 +418,7 @@ function NetworkSimplex:computeInitialRanking() -- add all sinks to the queue for _,node in ipairs(self.graph.nodes) do local edges = node:getIncomingEdges() - + remaining_edges[node] = #edges if #edges == 0 then @@ -428,23 +428,23 @@ function NetworkSimplex:computeInitialRanking() -- run long as there are nodes to be ranked while #queue > 0 do - + -- fetch the next unranked node from the queue local node = dequeue() -- get a list of its incoming edges local in_edges = node:getIncomingEdges() - + -- determine the minimum possible rank for the node local rank = 1 for _,edge in ipairs(in_edges) do local neighbour = edge:getNeighbour(node) if self.ranking:getRank(neighbour) then - -- the minimum possible rank is the maximum of all neighbor ranks plus + -- the minimum possible rank is the maximum of all neighbour ranks plus -- the corresponding edge lengths rank = math.max(rank, self.ranking:getRank(neighbour) + edge.minimum_levels) end - end + end -- rank the node self.ranking:setRank(node, rank) @@ -452,7 +452,7 @@ function NetworkSimplex:computeInitialRanking() -- get a list of the node's outgoing edges local out_edges = node:getOutgoingEdges() - -- queue neighbors of nodes for which all incoming edges have been scanned + -- queue neighbours of nodes for which all incoming edges have been scanned for _,edge in ipairs(out_edges) do local head = edge:getHead() remaining_edges[head] = remaining_edges[head] - 1 @@ -480,7 +480,7 @@ function NetworkSimplex:findTightTree() for _,v in ipairs(in_edges) do edges[#edges + 1] = v end - + for _,edge in ipairs(edges) do local neighbour = edge:getNeighbour(node) if (not marked[neighbour]) and math.abs(self:edgeSlack(edge)) < 0.00001 then @@ -489,7 +489,7 @@ function NetworkSimplex:findTightTree() for _,node in ipairs(edge.nodes) do marked[node] = true end - + if #self.tree.edges == #self.graph.nodes-1 then return true end @@ -502,7 +502,7 @@ function NetworkSimplex:findTightTree() return false end - + for _,node in ipairs(self.graph.nodes) do self.tree = Graph.new() self.tree_node = {} @@ -511,7 +511,7 @@ function NetworkSimplex:findTightTree() self.orig_edge = {} build_tight_tree(node) - + if #self.tree.edges > 0 then break end @@ -561,10 +561,10 @@ function NetworkSimplex:initializeCutValues() local function visit(search, data) search:setVisited(data, true) - + local into = data.node:getIncomingEdges() local out = data.node:getOutgoingEdges() - + for i=#into,1,-1 do local edge = into[i] if edge ~= data.parent_edge then @@ -621,10 +621,10 @@ function NetworkSimplex:calculateDFSRange(root, edge_from_parent, lowest) -- next we push all outgoing and incoming edges in reverse order -- to simulate recursive calls - + local into = data.node:getIncomingEdges() local out = data.node:getOutgoingEdges() - + for i=#into,1,-1 do local edge = into[i] if edge ~= data.parent_edge then @@ -748,8 +748,8 @@ end function NetworkSimplex:nextSearchIndex() local index = 1 - - -- avoid tree edge index out of bounds by resetting the search index + + -- avoid tree edge index out of bounds by resetting the search index -- as soon as it leaves the range of edge indices in the tree if self.search_index > #self.tree.edges then self.search_index = 1 @@ -774,10 +774,10 @@ function NetworkSimplex:rerank(node, delta) local orig_node = self.orig_node[data.node] self.ranking:setRank(orig_node, self.ranking:getRank(orig_node) - data.delta) - + local into = data.node:getIncomingEdges() local out = data.node:getOutgoingEdges() - + for i=#into,1,-1 do local edge = into[i] if edge ~= self.parent_edge[data.node] then @@ -800,10 +800,10 @@ end function NetworkSimplex:rerankBeforeReplacingEdge(leave_edge, enter_edge) local delta = self:edgeSlack(enter_edge) - + if delta > 0 then local tail = leave_edge:getTail() - + if #tail.edges == 1 then self:rerank(tail, delta) else @@ -863,8 +863,8 @@ function NetworkSimplex:addEdgeToTree(edge) -- create tree nodes if necessary for _,node in ipairs(edge.nodes) do - local tree_node - + local tree_node + if self.tree_node[node] then tree_node = self.tree_node[node] else diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/NodePositioningGansnerKNV1993.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/NodePositioningGansnerKNV1993.lua index 3e5a0f8f873..3af15ad1593 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/NodePositioningGansnerKNV1993.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/NodePositioningGansnerKNV1993.lua @@ -32,9 +32,9 @@ function NodePositioningGansnerKNV1993:run() local simplex = NetworkSimplex.new(auxiliary_graph, NetworkSimplex.BALANCE_LEFT_RIGHT) simplex:run() local x_ranking = simplex.ranking - + local layers = Storage.new() - + local ranks = self.ranking:getRanks() for _,rank in ipairs(ranks) do local nodes = self.ranking:getNodes(rank) @@ -45,7 +45,7 @@ function NodePositioningGansnerKNV1993:run() end layered.arrange_layers_by_baselines(layers, self.main_algorithm.adjusted_bb, self.main_algorithm.ugraph) - + -- Copy back for _,rank in ipairs(ranks) do local nodes = self.ranking:getNodes(rank) diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/NodeRankingGansnerKNV1993.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/NodeRankingGansnerKNV1993.lua index d6765ae2f0a..4a53acf8646 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/NodeRankingGansnerKNV1993.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/NodeRankingGansnerKNV1993.lua @@ -142,7 +142,7 @@ function NodeRankingGansnerKNV1993:expandClusters() end self.graph:addEdge(edge) end - + for _,node in ipairs(self.cluster_nodes) do self.ranking:setRank(node, nil) self.graph:deleteNode(node) diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/NodeRankingMinimumHeight.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/NodeRankingMinimumHeight.lua index 644b99c28a9..8aa98bd03ad 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/NodeRankingMinimumHeight.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/NodeRankingMinimumHeight.lua @@ -28,8 +28,8 @@ function NodeRankingMinimumHeight:run() ranking:setRank(node, 1) else local max_rank = -math.huge - for _,edge in ipairs(edges) do - max_rank = math.max(max_rank, ranking:getRank(edge:getNeighbour(node))) + for _,edge in ipairs(edge) do + max_rank = math.max(max_rank, ranking:getRank(edge:getNeighbour(node))) end assert(max_rank >= 1) @@ -44,4 +44,4 @@ end -- done -return NodeRankingMinimumHeight +return NodeRankingMinimumHeight
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/Ranking.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/Ranking.lua index 6ed63b0249d..228039b536f 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/Ranking.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/Ranking.lua @@ -12,8 +12,8 @@ ---- The Ranking class is used by the Sugiyama algorithm to compute an --- ordering on the nodes of a layer +--- The Ranking class is used by the Sugiyama algorithm to compute an ordering on the +-- nodes of a layer local Ranking = {} Ranking.__index = Ranking @@ -43,7 +43,7 @@ end function Ranking:copy() local copied_ranking = Ranking.new() - + -- copy rank to nodes mapping for rank, nodes in pairs(self.rank_to_nodes) do copied_ranking.rank_to_nodes[rank] = lib.copy(self.rank_to_nodes[rank]) @@ -113,7 +113,7 @@ function Ranking:setRank(node, new_rank) if rank == new_rank then return end - + if rank then for n = pos+1, #self.rank_to_nodes[rank] do local other_node = self.rank_to_nodes[rank][n] @@ -196,7 +196,7 @@ function Ranking:normalizeRanks() for node in pairs(self.position_in_rank) do local rank, pos = self:getNodeInfo(node) local new_rank = rank - (min_rank - 1) - + self.rank_to_nodes[new_rank] = self.rank_to_nodes[new_rank] or {} self.rank_to_nodes[new_rank][pos] = node diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/Sugiyama.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/Sugiyama.lua index c91818dc300..3ab9596322d 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/Sugiyama.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/Sugiyama.lua @@ -42,7 +42,7 @@ local Vector = require "pgf.gd.deprecated.Vector" declare { key = "layered layout", algorithm = Sugiyama, - + preconditions = { connected = true, loop_free = true, @@ -54,44 +54,46 @@ declare { old_graph_model = true, - summary = [[" - The |layered layout| is the key used to select the modular Sugiyama - layout algorithm. + summary = [[" + The |layered layout| is the key used to select the modular Sugiyama + layout algorithm. "]], documentation = [[" - This algorithm consists of five consecutive steps, each of which can be - configured independently of the other ones (how this is done is - explained later in this section). Naturally, the ``best'' heuristics - are selected by default, so there is typically no need to change the - settings, but what is the ``best'' method for one graph need not be - the best one for another graph. - - As can be seen in the first example, the algorithm will not only - position the nodes of a graph, but will also perform an edge - routing. This will look visually quite pleasing if you add the - |rounded corners| option: + This algorithm consists of five consecutive steps, each of which can be + configured independently of the other ones (how this is done is + explained later in this section). Naturally, the ``best'' heuristics + are selected by default, so there is typically no need to change the + settings, but what is the ``best'' method for one graph need not be + the best one for another graph. + + As can be seen in the first example, the algorithm will not only + position the nodes of a graph, but will also perform an edge + routing. This will look visually quite pleasing if you add the + |rounded corners| option: "]], - examples = {[[" - \tikz \graph [layered layout, sibling distance=7mm] - { - a -> { - b, - c -> { d, e, f } - } -> - h -> - a - }; - "]],[[" - \tikz [rounded corners] \graph [layered layout, sibling distance=7mm] - { - a -> { - b, - c -> { d, e, f } - } -> - h -> - a - }; - "]] + examples = { + [[" + \tikz \graph [layered layout, sibling distance=7mm] + { + a -> { + b, + c -> { d, e, f } + } -> + h -> + a + }; + "]], + [[" + \tikz [rounded corners] \graph [layered layout, sibling distance=7mm] + { + a -> { + b, + c -> { d, e, f } + } -> + h -> + a + }; + "]] } } @@ -102,16 +104,16 @@ declare { type = "number", initial = "1", - summary = [[" - The minimum number of levels that an edge must span. It is a bit of - the opposite of the |weight| parameter: While a large |weight| - causes an edge to become shorter, a larger |minimum layers| value - causes an edge to be longer. + summary = [[" + The minimum number of levels that an edge must span. It is a bit of + the opposite of the |weight| parameter: While a large |weight| + causes an edge to become shorter, a larger |minimum layers| value + causes an edge to be longer. "]], examples = [[" - \tikz \graph [layered layout] { - a -- {b [> minimum layers=3], c, d} -- e -- a; - }; + \tikz \graph [layered layout] { + a -- {b [> minimum layers=3], c, d} -- e -- a; + }; "]] } @@ -122,48 +124,48 @@ declare { key = "same layer", layer = 0, - summary = [[" - The |same layer| collection allows you to enforce that several nodes - a on the same layer of a layered layout (this option is also known - as |same rank|). You use it like this: + summary = [[" + The |same layer| collection allows you to enforce that several nodes + a on the same layer of a layered layout (this option is also known + as |same rank|). You use it like this: "]], examples = {[[" - \tikz \graph [layered layout] { - a -- b -- c -- d -- e; - - { [same layer] a, b }; - { [same layer] d, e }; - }; + \tikz \graph [layered layout] { + a -- b -- c -- d -- e; + + { [same layer] a, b }; + { [same layer] d, e }; + }; "]],[[" - \tikz [rounded corners] \graph [layered layout] { - 1972 -> 1976 -> 1978 -> 1980 -> 1982 -> 1984 -> 1986 -> 1988 -> 1990 -> future; - - { [same layer] 1972, Thompson }; - { [same layer] 1976, Mashey, Bourne }, - { [same layer] 1978, Formshell, csh }, - { [same layer] 1980, esh, vsh }, - { [same layer] 1982, ksh, "System-V" }, - { [same layer] 1984, v9sh, tcsh }, - { [same layer] 1986, "ksh-i" }, - { [same layer] 1988, KornShell ,Perl, rc }, - { [same layer] 1990, tcl, Bash }, - { [same layer] "future", POSIX, "ksh-POSIX" }, - - Thompson -> { Mashey, Bourne, csh -> tcsh}, - Bourne -> { ksh, esh, vsh, "System-V", v9sh -> rc, Bash}, - { "ksh-i", KornShell } -> Bash, - { esh, vsh, Formshell, csh } -> ksh, - { KornShell, "System-V" } -> POSIX, - ksh -> "ksh-i" -> KornShell -> "ksh-POSIX", - Bourne -> Formshell, - - { [edge={draw=none}] - Bash -> tcl, - KornShell -> Perl - } - }; - "]] - } + \tikz [rounded corners] \graph [layered layout] { + 1972 -> 1976 -> 1978 -> 1980 -> 1982 -> 1984 -> 1986 -> 1988 -> 1990 -> future; + + { [same layer] 1972, Thompson }; + { [same layer] 1976, Mashey, Bourne }, + { [same layer] 1978, Formshell, csh }, + { [same layer] 1980, esh, vsh }, + { [same layer] 1982, ksh, "System-V" }, + { [same layer] 1984, v9sh, tcsh }, + { [same layer] 1986, "ksh-i" }, + { [same layer] 1988, KornShell ,Perl, rc }, + { [same layer] 1990, tcl, Bash }, + { [same layer] "future", POSIX, "ksh-POSIX" }, + + Thompson -> { Mashey, Bourne, csh -> tcsh}, + Bourne -> { ksh, esh, vsh, "System-V", v9sh -> rc, Bash}, + { "ksh-i", KornShell } -> Bash, + { esh, vsh, Formshell, csh } -> ksh, + { KornShell, "System-V" } -> POSIX, + ksh -> "ksh-i" -> KornShell -> "ksh-POSIX", + Bourne -> Formshell, + + { [edge={draw=none}] + Bash -> tcl, + KornShell -> Perl + } + }; + "]] + } } @@ -174,15 +176,15 @@ function Sugiyama:run() if #self.graph.nodes <= 1 then return end - + local options = self.digraph.options - - local cycle_removal_algorithm_class = options.algorithm_phases['cycle removal'] + + local cycle_removal_algorithm_class = options.algorithm_phases['cycle removal'] local node_ranking_algorithm_class = options.algorithm_phases['node ranking'] local crossing_minimization_algorithm_class = options.algorithm_phases['crossing minimization'] local node_positioning_algorithm_class = options.algorithm_phases['node positioning'] local edge_routing_algorithm_class = options.algorithm_phases['layer edge routing'] - + self:preprocess() -- Helper function for collapsing multiedges @@ -195,14 +197,14 @@ function Sugiyama:run() -- Create a subalgorithm object. Needed so that removed loops -- are not stored on top of removed loops from main call. - local cluster_subalgorithm = { graph = self.graph } + local cluster_subalgorithm = { graph = self.graph } self.graph:registerAlgorithm(cluster_subalgorithm) self:mergeClusters() Simplifiers:removeLoopsOldModel(cluster_subalgorithm) Simplifiers:collapseMultiedgesOldModel(cluster_subalgorithm, collapse) - + cycle_removal_algorithm_class.new { main_algorithm = self, graph = self.graph }:run() self.ranking = node_ranking_algorithm_class.new{ main_algorithm = self, graph = self.graph }:run() self:restoreCycles() @@ -211,12 +213,12 @@ function Sugiyama:run() Simplifiers:restoreLoopsOldModel(cluster_subalgorithm) self:expandClusters() - + -- Now do actual computation Simplifiers:collapseMultiedgesOldModel(cluster_subalgorithm, collapse) cycle_removal_algorithm_class.new{ main_algorithm = self, graph = self.graph }:run() self:insertDummyNodes() - + -- Main algorithm crossing_minimization_algorithm_class.new{ main_algorithm = self, @@ -228,13 +230,13 @@ function Sugiyama:run() graph = self.graph, ranking = self.ranking }:run() - + -- Cleanup self:removeDummyNodes() Simplifiers:expandMultiedgesOldModel(cluster_subalgorithm) edge_routing_algorithm_class.new{ main_algorithm = self, graph = self.graph }:run() self:restoreCycles() - + end @@ -279,14 +281,14 @@ function Sugiyama:insertDummyNodes() local dummy = Node.new{ pos = Vector.new(), name = 'dummy@' .. neighbour.name .. '@to@' .. node.name .. '@at@' .. rank, - kind = "dummy", - orig_vertex = pgf.gd.model.Vertex.new{} + kind = "dummy", + orig_vertex = pgf.gd.model.Vertex.new{} } dummy_id = dummy_id + 1 self.graph:addNode(dummy) - self.ugraph:add {dummy.orig_vertex} + self.ugraph:add {dummy.orig_vertex} self.ranking:setRank(dummy, rank) @@ -304,7 +306,7 @@ function Sugiyama:insertDummyNodes() local target = dummies[i] local dummy_edge = Edge.new{ - direction = Edge.RIGHT, + direction = Edge.RIGHT, reversed = false, weight = edge.weight, -- TODO or should we divide the weight of the original edge by the number of virtual edges? } @@ -352,8 +354,8 @@ function Sugiyama:removeDummyNodes() if edge.reversed then local bp = edge.bend_points for i=1,#bp/2 do - local j = #bp + 1 - i - bp[i], bp[j] = bp[j], bp[i] + local j = #bp + 1 - i + bp[i], bp[j] = bp[j], bp[i] end end @@ -373,7 +375,7 @@ function Sugiyama:mergeClusters() self.original_nodes = {} for _,cluster in ipairs(self.graph.clusters) do - + local cluster_node = cluster.nodes[1] table.insert(self.cluster_nodes, cluster_node) @@ -473,4 +475,4 @@ end -- done -return Sugiyama +return Sugiyama
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/crossing_minimization.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/crossing_minimization.lua index 54a1fafb231..6bede7eb015 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/crossing_minimization.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/crossing_minimization.lua @@ -48,11 +48,11 @@ local declare = require("pgf.gd.interface.InterfaceToAlgorithms").declare -- the nodes of a specific layer are reordered using a neighbored -- layer as a fixed reference. This problem is known as one-sided -- crossing minimization, which unfortunately is NP-hard. In the --- following various heuristics to solve this problem are +-- following various heuristics to solve this problem are -- presented. -- -- For more details, please see Section 4.1.4 of Pohlmann's Diploma --- thesis. +-- thesis. -- -- @end @@ -66,16 +66,16 @@ declare { phase = "crossing minimization", phase_default = true, - summary = [[" - Gansner et al. combine an initial ordering based on a depth-first - search with the median and greedy switch heuristics applied in the - form of an alternating layer-by-layer sweep based on a weighted - median. + summary = [[" + Gansner et al. combine an initial ordering based on a depth-first + search with the median and greedy switch heuristics applied in the + form of an alternating layer-by-layer sweep based on a weighted + median. "]], - documentation = [[" - For more details, please see Section~4.1.4 of Pohlmann's Diploma - thesis. - - This is the default algorithm for crossing minimization. - "]] -} + documentation = [[" + For more details, please see Section 4.1.4 of Pohlmann's Diploma + thesis. + + This is the default algorithm for crossing minimization. + "]] + } diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/cycle_removal.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/cycle_removal.lua index 18670df14e8..63c43f5b14f 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/cycle_removal.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/cycle_removal.lua @@ -34,38 +34,39 @@ declare { phase = "cycle removal", phase_default = true, - summary = [[" - Selects a cycle removal algorithm that is especially - appropriate for graphs specified ``by hand''. + summary = [[" + Selects a cycle removal algorithm that is especially + appropriate for graphs specified ``by hand''. "]], - documentation = [[" - When graphs are created by humans manually, one can - make assumptions about the input graph that would otherwise not - be possible. For instance, it seems reasonable to assume that the - order in which nodes and edges are entered by the user somehow - reflects the natural flow the user has had in mind for the graph. - - In order to preserve the natural flow of the input graph, Gansner - et al.\ propose to remove cycles by performing a series of - depth-first searches starting at individual nodes in the order they - appear in the graph. This algorithm implicitly constructs a spanning - tree of the nodes reached during the searches. It thereby partitions - the edges of the graph into tree edges and non-tree edges. The - non-tree edges are further subdivided into forward edges, cross edges, - and back edges. Forward edges point from a tree nodes to one of their - descendants. Cross edges connect unrelated branches in the search tree. - Back edges connect descendants to one of their ancestors. It is not - hard to see that reversing back edges will not only introduce no new - cycles but will also make any directed graph acyclic. - Gansner et al.\ argue that this approach is more stable than others - in that fewer inappropriate edges are reversed compared to other - methods, despite the lack of a provable upper bound for the number - of reversed edges. - - See section~4.1.1 of Pohlmann's Diplom thesis for more details. - - This is the default algorithm for cycle removals. - "]] + documentation = [[" + When graphs are created by humans manually, one can + make assumptions about the input graph that would otherwise not + be possible. For instance, it seems reasonable to assume that the + order in which nodes and edges are entered by the user somehow + reflects the natural flow the user has had in mind for the graph. + + In order to preserve the natural flow of the input graph, Gansner + et al.\ propose to remove cycles by performing a series of + depth-first searches starting at individual nodes in the order they + appear in the graph. This algorithm + implicitly constructs a spanning tree of the nodes reached during + the searches. It thereby partitions the edges of the graph into + tree edges and non-tree edges. The non-tree edges are further + subdivided into forward edges, cross edges, and back edges. Forward + edges point from a tree nodes to one of their descendants. Cross + edges connect unrelated branches in + the search tree. Back edges connect descendants to one of their + ancestors. It is not hard to see that reversing back edges will not + only introduce no new cycles but will also make any directed graph + acyclic. Gansner et al.\ argue that this approach is more stable + than others in that fewer inappropriate edges are reversed compared + to other methods, despite the lack of a provable upper bound + for the number of reversed edges. + + See section 4.1.1 of Pohlmann's Diplom thesis for more details. + + This is the default algorithm for cycle removals. + "]] } --- @@ -75,12 +76,12 @@ declare { algorithm = "pgf.gd.layered.CycleRemovalEadesLS1993", phase = "cycle removal", - summary = [[" - This algorithm implements a greedy heuristic of Eades et al.\ for - cycle removal that prioritizes sources and sinks. + summary = [[" + This algorithm implements a greedy heuristic of Eades et al.\ for + cycle removal that prioritizes sources and sinks. "]], - documentation = [[" - See section~4.1.1 of Pohlmann's Diploma theses for details. + documentation = [[" + See section 4.1.1 of Pohlmann's Diploma theses for details. "]] } @@ -92,12 +93,12 @@ declare { algorithm = "pgf.gd.layered.CycleRemovalEadesLS1993", phase = "cycle removal", - summary = [[" - This algorithm implements a greedy heuristic of Eades et al.\ for - cycle removal that prioritizes sources and sinks. + summary = [[" + This algorithm implements a greedy heuristic of Eades et al.\ for + cycle removal that prioritizes sources and sinks. "]], - documentation = [[" - See section~4.1.1 of Pohlmann's Diploma theses for details. + documentation = [[" + See section 4.1.1 of Pohlmann's Diploma theses for details. "]] } @@ -108,13 +109,14 @@ declare { algorithm = "pgf.gd.layered.CycleRemovalBergerS1990a", phase = "cycle removal", - summary = [[" - This algorithm implements a greedy heuristic of Berger and Shor for - cycle removal. It is not really compared to the other heuristics and - only included for demonstration purposes. + summary = [[" + This algorithm implements a greedy heuristic of Berger and Shor for + cycle removal. It + is not really compared to the other heuristics and only included + for demonstration purposes. "]], - documentation = [[" - See section~4.1.1 of Pohlmann's Diploma theses for details. + documentation = [[" + See section 4.1.1 of Pohlmann's Diploma theses for details. "]] } @@ -125,12 +127,13 @@ declare { algorithm = "pgf.gd.layered.CycleRemovalBergerS1990b", phase = "cycle removal", - summary = [[" - This algorithm implements a randomized greedy heuristic of Berger - and Shor for cycle removal. It, too, is not really compared to - the other heuristics and only included for demonstration purposes. + summary = [[" + This algorithm implements a randomized greedy heuristic of Berger + and Shor for cycle removal. It, too, is not really compared to + the other heuristics and only included for demonstration purposes. "]], - documentation = [[" - See section~4.1.1 of Pohlmann's Diploma theses for details. + documentation = [[" + See section 4.1.1 of Pohlmann's Diploma theses for details. "]] - }
\ No newline at end of file + } + diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/edge_routing.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/edge_routing.lua index eb9939c74ce..b790d527e3d 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/edge_routing.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/edge_routing.lua @@ -21,10 +21,10 @@ local declare = require("pgf.gd.interface.InterfaceToAlgorithms").declare -- step. This makes sense if all nodes have the same size and -- shape. In practical scenarios, however, this assumption often does -- not hold. In these cases, advanced techniques may have to be --- applied in order to avoid overlaps of nodes and edges. +-- applied in order to avoid overlaps of nodes and edges. -- --- For more details, please see Section~4.1.5 of Pohlmann's Diploma --- thesis. +-- For more details, please see Section 4.1.5 of Pohlmann's Diploma +-- thesis. -- -- @end @@ -38,12 +38,13 @@ declare { phase = "layer edge routing", phase_default = true, - summary = [[" - This edge routing algorithm uses polygonal lines to connect nodes. + summary = [[" + This edge routing algorithm uses polygonal lines to connect nodes. "]], - documentation = [[" - For more details, please see Section~4.1.5 of Pohlmann's Diploma thesis. - - This is the default algorithm for edge routing. - "]] -} + documentation = [[" + For more details, please see Section 4.1.5 of Pohlmann's Diploma + thesis. + + This is the default algorithm for edge routing. + "]] + } diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/library.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/library.lua index 950e02ffa36..9f681929ecb 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/library.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/library.lua @@ -30,37 +30,34 @@ -- implemented it as part of his Diploma thesis. Please consult this -- thesis for a detailed explanation of the Sugiyama method and its -- history: --- % +-- -- \begin{itemize} --- \item --- Jannis Pohlmann, --- \newblock \emph{Configurable Graph Drawing Algorithms --- for the \tikzname\ Graphics Description Language,} --- \newblock Diploma Thesis, --- \newblock Institute of Theoretical Computer Science, Universit\"at --- zu L\"ubeck, 2011.\\[.5em] --- \newblock Available online via --- \url{http://www.tcs.uni-luebeck.de/downloads/papers/2011/}\\ --- \url{2011-configurable-graph-drawing-algorithms-jannis-pohlmann.pdf} --- \\[.5em] --- (Note that since the publication of this thesis some option names --- have been changed. Most noticeably, the option name --- |layered drawing| was changed to |layered layout|, which is somewhat --- more consistent with other names used in the graph drawing --- libraries. Furthermore, the keys for choosing individual --- algorithms for the different algorithm phases, have all changed.) +-- \item +-- Jannis Pohlmann, +-- \newblock \emph{Configurable Graph Drawing Algorithms +-- for the \tikzname\ Graphics Description Language,} +-- \newblock Diploma Thesis, +-- \newblock Institute of Theoretical Computer Science, Univerist\"at +-- zu L\"ubeck, 2011.\\[.5em] +-- \newblock Available online via +-- \url{http://www.tcs.uni-luebeck.de/downloads/papers/2011/}\\ \url{2011-configurable-graph-drawing-algorithms-jannis-pohlmann.pdf} +-- \\[.5em] +-- (Note that since the publication of this thesis some option names +-- have been changed. Most noticeably, the option name +-- |layered drawing| was changed to |layered layout|, which is somewhat +-- more consistent with other names used in the graph drawing +-- libraries. Furthermore, the keys for choosing individual +-- algorithms for the different algorithm phases, have all changed.) -- \end{itemize} -- -- The Sugiyama methods lays out a graph in five steps: --- % -- \begin{enumerate} --- \item Cycle removal. --- \item Layer assignment (sometimes called node ranking). --- \item Crossing minimization (also referred to as node ordering). --- \item Node positioning (or coordinate assignment). --- \item Edge routing. +-- \item Cycle removal. +-- \item Layer assignment (sometimes called node ranking). +-- \item Crossing minimization (also referred to as node ordering). +-- \item Node positioning (or coordinate assignment). +-- \item Edge routing. -- \end{enumerate} --- % -- It turns out that behind each of these steps there lurks an -- NP-complete problem, which means, in practice, that each step is -- impossible to perform optimally for larger graphs. For this reason, @@ -70,11 +67,11 @@ -- A distinctive feature of Pohlmann's implementation of the Sugiyama -- method for \tikzname\ is that the algorithms used for each of the -- steps can easily be exchanged, just specify a different option. For --- the user, this means that by specifying a different option and thereby --- using a different heuristic for one of the steps, a better layout can --- often be found. For the researcher, this means that one can very --- easily test new approaches and new heuristics without having to --- implement all of the other steps anew. +-- the user, this means that by specifying a different +-- option and thereby using a different heuristic for one of the steps, a +-- better layout can often be found. For the researcher, this means that +-- one can very easily test new approaches and new heuristics without +-- having to implement all of the other steps anew. -- -- @library diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/node_positioning.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/node_positioning.lua index e51382d6427..8fa55f9cbb9 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/node_positioning.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/node_positioning.lua @@ -22,14 +22,15 @@ local declare = require("pgf.gd.interface.InterfaceToAlgorithms").declare -- small and edges are drawn as vertically as possible. Another goal -- is to avoid node and edge overlaps which is crucial in particular -- if the nodes are allowed to have non-uniform sizes. The --- $y$-coordinates of the nodes have no influence on the number of +-- y-coordinates of the nodes have no influence on the number of -- bends. Obviously, nodes need to be separated enough geometrically -- so that they do not overlap. It feels natural to aim at separating -- all layers in the drawing by the same amount. Large nodes, however, -- may force node positioning algorithms to override this uniform --- level distance in order to avoid overlaps. +-- level distance in order to avoid overlaps. -- --- For more details, please see Section~4.1.2 of Pohlmann's Diploma thesis. +-- For more details, please see Section 4.1.2 of Pohlmann's Diploma +-- thesis. -- -- @end @@ -43,13 +44,14 @@ declare { phase = "node positioning", phase_default = true, - summary = [[" - This node positioning method, due to Gasner et al., is based on a - linear optimization problem. + summary = [[" + This node positioning method, due to Gasner et al., is based on a + linear optimization problem. "]], - documentation = [[" - For more details, please see Section~4.1.3 of Pohlmann's Diploma thesis. - - This is the default algorithm for layer assignments. - "]] -} + documentation = [[" + For more details, please see Section 4.1.3 of Pohlmann's Diploma + thesis. + + This is the default algorithm for layer assignments. + "]] + } diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/node_ranking.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/node_ranking.lua index c663d9ce366..7aef0bde5fc 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/node_ranking.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/layered/node_ranking.lua @@ -18,15 +18,15 @@ local declare = require("pgf.gd.interface.InterfaceToAlgorithms").declare -- -- Algorithms for producing layered drawings place nodes on discrete -- layers from top to bottom. Layer assignment is the problem of --- finding a partition so that for all edges $e = (u,v) \in E(G)$ the +-- finding a partition so that for all edges $e = (u,v) \in E(G)$ the -- equation $\mathit{layer}(u) < \mathit{layer}(v)$ holds. Such a -- partition is called a \emph{layering}. This definition can be extended by -- introducing edge weights or priorities and minimum length -- constraints which has practical applications and allows users to -- fine-tune the results. -- --- For more details, please see Section~4.1.2 of Pohlmann's Diploma --- thesis. +-- For more details, please see Section 4.1.2 of Pohlmann's Diploma +-- thesis. -- -- @end @@ -40,17 +40,17 @@ declare { phase = "node ranking", phase_default = true, - summary = [[" - This layer assignment method, due to Gasner et al., is based on a - linear optimization problem. + summary = [[" + This layer assigment method, due to Gasner et al., is based on a + linear optimization problem. "]], - documentation = [[" - For more details, please see Section~4.1.2 of Pohlmann's Diploma - thesis. - - This is the default algorithm for layer assignments. - "]] -} + documentation = [[" + For more details, please see Section 4.1.2 of Pohlmann's Diploma + thesis. + + This is the default algorithm for layer assignments. + "]] + } @@ -61,12 +61,14 @@ declare { algorithm = "pgf.gd.layered.NodeRankingMinimumHeight", phase = "node ranking", - summary = [[" - This layer assignment method minimizes the height of the resulting graph. + summary = [[" + This layer assigment method minimizes the height of the resulting + graph. "]], - documentation = [[" - For more details, please see Section~4.1.3 of Pohlmann's Diploma thesis. - "]] -} + documentation = [[" + For more details, please see Section 4.1.3 of Pohlmann's Diploma + thesis. + "]] + } diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/lib.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/lib.lua index cc39ddd6070..bcd4f6cfc1e 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/lib.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/lib.lua @@ -67,7 +67,7 @@ end function lib.find_min(array, f) local best = math.huge local best_result - local best_index + local best_index for i=1,#array do local t = array[i] local result, p = f(t,i,array) @@ -89,9 +89,9 @@ end -- Copies a table while preserving its metatable. -- -- @param source The table to copy. --- @param target The table to which values are to be copied or |nil| if a new +-- @param target The table to which values are to be copied or |nil| if a new -- table is to be allocated. --- +-- -- @return The |target| table or a newly allocated table containing all -- keys and values of the |source| table. -- @@ -110,10 +110,10 @@ end -- Copies an array while preserving its metatable. -- -- @param source The array to copy. --- @param target The array to which values are to be copied or |nil| if a new +-- @param target The array to which values are to be copied or |nil| if a new -- table is to be allocated. The elements of the -- |source| array will be added at the end. --- +-- -- @return The |target| table or a newly allocated table containing all -- keys and values of the |source| table. -- @@ -129,7 +129,7 @@ end --- --- Apply a function to all pairs of a table, resulting in a new table. +-- Apply a function to all pairs of a table, resulting in a new table. -- -- @param source The table. -- @param fun A function taking two arguments (|val| and |key|, in @@ -140,7 +140,7 @@ end -- takes only a single argument and returns only a single argument, -- you have a ``classical'' value mapper. Also note that if -- |new_value| is |nil|, the value is removed from the table. --- +-- -- @return The new table. -- function lib.map(source, fun) @@ -159,7 +159,7 @@ end --- -- Apply a function to all elements of an array, resulting in a new --- array. +-- array. -- -- @param source The array. -- @param fun A function taking two arguments (|val| and |i|, the @@ -169,14 +169,14 @@ end -- element is skipped. If this function is not provided (is |nil|), -- the identity function is used. -- @param new The target array (if |nil|, a new array is create). --- % +-- --\begin{codeexample}[code only] -- local a = lib.imap(array, function(v) if some_test(v) then return v end end) --\end{codeexample} -- -- The above code is a filter that will remove all elements from the -- array that do not pass |some_test|. --- % +-- --\begin{codeexample}[code only] -- lib.imap(a, lib.id, b) --\end{codeexample} @@ -238,27 +238,23 @@ end -- option table of an object contains the name field is done using -- |rawget| for all but the last parameter. This means that when you -- write --- % --\begin{codeexample}[code only] --lib.lookup_option("foo", vertex, graph) --\end{codeexample} --- % --- and if |/graph drawing/foo| has an initial value set, if the +-- and if |/graph drawin/foo| has an inital value set, if the -- parameter is not explicitly set in a vertex, you will get the value -- set for the graph or, if it is not set there either, the initial --- value. In contrast, if you write --- % +-- value. In contrast, if you write --\begin{codeexample}[code only] -- vertex.options["foo"] or graph.options["foo"] --\end{codeexample} --- % -- what happens is that the first access to |.options| will -- \emph{always} return something when an initial parameter has been --- set for the option |foo|. +-- set for the option |foo|. -- --- @param name The name of the options +-- @param name The name of the options -- @param ... Any number of objects. Each must have an options --- field. +-- field. -- -- @return The found option @@ -266,10 +262,10 @@ function lib.lookup_option(name, ...) local list = {...} for i=1,#list-1 do local o = list[i].options - if o then + if o then local v = rawget(o, name) if v then - return v + return v end end end @@ -284,12 +280,12 @@ end -- a |new| function, which takes an optional table of |initial| values -- and which outputs a new table whose metatable is the -- class. The |new| function will call the function |constructor| if --- it exists. Furthermore, the class object's |__index| is set to itself +-- it exsist. Furthermore, the class object's |__index| is set to itself -- and its meta table is set to the |base_class| field of the -- table. If |t| is |nil|, a new table is created. -- -- Here is a typical usage of this function: --- % +-- --\begin{codeexample}[code only] --local Point = lib.class {} -- @@ -301,14 +297,13 @@ end -- --print(p:length()) --\end{codeexample} --- % -- We can subclass this as follows: --- % +-- --\begin{codeexample}[code only] --local Point3D = lib.class { base_class = Point } -- --function Point3D:length() --- local l = Point.length(self) -- Call base class's function +-- local l = Point.length(self) -- Call base class's function -- return math.sqrt(l*l + self.z*self.zdy) --end -- @@ -323,31 +318,31 @@ end function lib.class(t) t = t or {} - + -- First, setup indexing, if necessary if not t.__index then t.__index = t end - + -- Second, setup new method, if necessary - t.new = t.new or - function (initial) - + t.new = t.new or + function (initial) + -- Create new object local obj = {} for k,v in pairs(initial or {}) do - obj[k] = v + obj[k] = v end setmetatable(obj, t) if obj.constructor then - obj:constructor() + obj:constructor() end - + return obj end - - -- Third, setup inheritance, if necessary + + -- Third, setup inheritence, if necessary if not getmetatable(t) then setmetatable(t, t.base_class) end @@ -364,8 +359,8 @@ end -- a table) for which some methods are needed only seldomly. In this -- case, you can put these methods in a separate file and then use -- |ondemand| to indicate that the methods are found in a --- another file. --- % +-- another file. +-- --\begin{codeexample}[code only] -- -- File Foo.lua -- local Foo = {} @@ -393,24 +388,23 @@ end function lib.ondemand(filename, table, name) return function(...) - require (filename) - return table[name] (...) - end + require (filename) + return table[name] (...) + end end --- --- This implements the a random number generator similar to the one --- provided by Lua, but based on the tex.uniformdeviate primitive to --- avoid differences in random numbers due to platform specifics. +-- This implements the legacy random number generator of Lua 5.2 in +-- pure Lua. This is needed for Lua 5.3 compatibility to obtain +-- consitent results. -- -- @param l Lower bound -- @param u Upper bound -- @return A random number function lib.random(l,u) - local fraction_one = 268435456 - local r = tex.uniform_rand(fraction_one)/fraction_one + local r = math.random() if l and u then assert(l <= u) return math.floor(r*(u-l+1)) + l @@ -422,14 +416,6 @@ function lib.random(l,u) end end ---- --- Provide the seed for the random number generator --- --- @param seed random seed -function lib.randomseed(seed) - tex.init_rand(seed) -end - -- Done return lib diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/lib/Bezier.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/lib/Bezier.lua index e4fe21d9422..292f9e56bf2 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/lib/Bezier.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/lib/Bezier.lua @@ -13,7 +13,7 @@ --- -- This library offers a number of methods for working with Bezi\'er --- curves. +-- curves. local Bezier = {} @@ -29,7 +29,7 @@ local Coordinate = require 'pgf.gd.model.Coordinate' --- -- Compute a point ``along a curve at a time''. You provide the four -- coordinates of the curve and a time. You get a point on the curve --- as return value as well as the two support vector for curve +-- as return value as well as the two suport vector for curve -- before this point and two support vectors for the curve after the -- point. -- @@ -115,7 +115,7 @@ function Bezier.supportsForPointsAtTime(from, p1, t1, p2, t2, to) local f1b = t1 * s1^2 * 3 local f1c = t1^2 * s1 * 3 local f1d = t1^3 - + local f2a = s2^3 local f2b = t2 * s2^2 * 3 local f2c = t2^2 * s2 * 3 @@ -127,7 +127,7 @@ function Bezier.supportsForPointsAtTime(from, p1, t1, p2, t2, to) -- -- p1.y - from.y * f1a - to.y * f1d = sup1.y * f1b + sup2.y * f1c -- p2.y - from.y * f2a - to.y * f2d = sup1.y * f2b + sup2.y * f2c - + local a = f1b local b = f1c local c = p1.x - from.x * f1a - to.x * f1d @@ -138,16 +138,16 @@ function Bezier.supportsForPointsAtTime(from, p1, t1, p2, t2, to) local det = a*e - b*d local x1 = -(b*f - e*c)/det local x2 = -(c*d - a*f)/det - + local c = p1.y - from.y * f1a - to.y * f1d local f = p2.y - from.y * f2a - to.y * f2d - + local det = a*e - b*d local y1 = -(b*f - e*c)/det local y2 = -(c*d - a*f)/det return Coordinate.new(x1,y1), Coordinate.new(x2,y2) - + end diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/lib/Direct.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/lib/Direct.lua index 81728a1a444..aaad047c702 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/lib/Direct.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/lib/Direct.lua @@ -30,12 +30,12 @@ local Digraph = require "pgf.gd.model.Digraph" -- arrows. For instance, while "a <- b" will cause an arc from a to be -- to be added to the syntactic digraph, calling this function will -- return a digraph in which there is an arc from b to a rather than --- the other way round. In detail, "a <- b" is translated as just +-- the other way round. In detail, "a <- b" is tranlated as just -- described, "a -> b" yields an arc from a to b as expected, "a <-> b" -- and "a -- b" yield arcs in both directions and, finally, "a -!- b" -- yields no arc at all. -- --- @param syntactic_digraph A syntactic digraph, usually the "input" +-- @param syntactic_digraph A syntacitic digraph, usually the "input" -- graph as specified syntactically be the user. -- -- @return A new "semantic" digraph object. @@ -49,12 +49,12 @@ function Direct.digraphFromSyntacticDigraph(syntactic_digraph) for _,m in ipairs(a.syntactic_edges) do local direction = m.direction if direction == "->" then - digraph:connect(a.tail, a.head) + digraph:connect(a.tail, a.head) elseif direction == "<-" then - digraph:connect(a.head, a.tail) + digraph:connect(a.head, a.tail) elseif direction == "--" or direction == "<->" then - digraph:connect(a.tail, a.head) - digraph:connect(a.head, a.tail) + digraph:connect(a.tail, a.head) + digraph:connect(a.head, a.tail) end -- Case -!-: No edges... end @@ -92,4 +92,4 @@ end -- Done -return Direct +return Direct
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/lib/Event.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/lib/Event.lua index 880796ce973..952f37796eb 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/lib/Event.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/lib/Event.lua @@ -19,7 +19,7 @@ -- arcs, and a digraph object representing this graph get -- constructed. However, even though syntactic annotations such as -- options for the vertices and arcs are attached to them and can be --- accessed through the graph objects, some syntactic information is +-- accessed through the graph objects, some syntactic inforamtion is -- neither represented in the digraph object nor in the vertices and -- the arcs. A typical example is a ``missing'' node in a tree: Since -- it is missing, there is neither a vertex object nor arc objects @@ -35,37 +35,37 @@ -- -- The following events are created during the parsing process by the -- standard parsers of \tikzname: --- % +-- -- \begin{itemize} --- \item[|node|] When a node of the input graph has been parsed and --- a |Vertex| object has been created for it, an event with kind --- |node| is created. The |parameter| of this event is the --- just-created vertex. +-- \item[|node|] When a node of the input graph has been parsed and +-- a |Vertex| object has been created for it, an event with kind +-- |node| is created. The |parameter| of this event is the +-- just-created vertex. -- --- The same kind of event is used to indicate ``missing'' nodes. In --- this case, the |parameters| field is |nil|. --- \item[|edge|] When an edge of the input graph has been parsed, an --- event is created of kind |edge|. The |parameters| field will store --- an array with two entries: The first is the |Arc| object whose --- |syntactic_edges| field stores the |edge|. The second is the index --- of the edge inside the |syntactic_edges| field. --- \item[|begin|] --- Signals the beginning of a group, which will be ended with a --- corresponding |end| event later on. The |parameters| field will --- indicate the kind of group. Currently, only the string --- |"descendants"| is used as |parameters|, indicating the start of --- several nodes that are descendants of a given node. This --- information can be used by algorithms for reconstructing the --- input structure of trees. --- \item[|end|] Signals the end of a group begun by a |begin| event --- earlier on. +-- The same kind of event is used to indicate ``missing'' nodes. In +-- this case, the |parameters| field is |nil|. +-- \item[|edge|] When an edge of the input graph has been parsed, an +-- event is created of kind |edge|. The |parameters| field will store +-- an array with two entries: The first is the |Arc| object whose +-- |syntactic_edges| field stores the |edge|. The second is the index +-- of the edge inside the |syntactic_edges| field. +-- \item[|begin|] +-- Signals the beginning of a group, which will be ended with a +-- corresponding |end| event later on. The |parameters| field will +-- indicate the kind of group. Currently, only the string +-- |"descendants"| is used as |parameters|, indicating the start of +-- several nodes that are descendants of a given node. This +-- information can be used by algorithms for reconstructing the +-- input structure of trees. +-- \item[|end|] Signals the end of a group begun by a |begin| event +-- earlier on. -- \end{itemize} --- --- @field kind A string representing the kind of the events. +-- +-- @field kind A string representing the kind of the events. -- @field parameters Kind-specific parameters. -- @field index A number that stores the events logical position in -- the sequence of events. The number need not be an integer array --- index. +-- index. -- local Event = {} Event.__index = Event diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/lib/LookupTable.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/lib/LookupTable.lua index fc2043d5237..0014c94a375 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/lib/LookupTable.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/lib/LookupTable.lua @@ -13,7 +13,7 @@ --- -- This table provides two utility functions for managing ``lookup --- tables''. Such a table is a mixture of an array and a hashtable: +-- tables.'' Such a table is a mixture of an array and a hashtable: -- It stores (only) tables. Each table is stored once in a normal -- array position. Additionally, the lookup table is also indexed at -- the position of the table (used as a key) and this position is set @@ -30,7 +30,7 @@ require("pgf.gd.lib").LookupTable = LookupTable --- -- Add all elements in the |array| to a lookup table. If an element of -- the array is already present in the table, it will not be added --- again. +-- again. -- -- This operation takes time $O(|\verb!array!|)$. -- @@ -50,7 +50,7 @@ end --- -- Add one element to a lookup table. If it is already present in the --- table, it will not be added again. +-- table, it will not be added again. -- -- This operation takes time $O(1)$. -- diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/lib/PathLengths.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/lib/PathLengths.lua index 4bfa896ef95..05b480713b0 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/lib/PathLengths.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/lib/PathLengths.lua @@ -27,11 +27,11 @@ local PriorityQueue = require "pgf.gd.lib.PriorityQueue" --- --- Performs the Dijkstra algorithm to solve the single-source shortest path problem. +-- Performs the Dijkstra algorithm to solve the single-source shortes path problem. -- --- The algorithm computes the shortest paths from |source| to all nodes --- in the graph. It also generates a table with distance level sets, each of --- which contain all nodes that have the same corresponding distance to +-- The algorithm computes the shortest paths from |source| to all nodes +-- in the graph. It also generates a table with distance level sets, each of +-- which contain all nodes that have the same corresponding distance to -- |source|. Finally, a mapping of nodes to their parents along the -- shortest paths is generated to allow the reconstruction of the paths -- that were chosen by the Dijkstra algorithm. @@ -39,7 +39,7 @@ local PriorityQueue = require "pgf.gd.lib.PriorityQueue" -- @param graph The graph to compute the shortest paths for. -- @param source The node to compute the distances to. -- --- @return A mapping of nodes to their distance to |source|. +-- @return A mapping of nodes to their distance to |source|. -- @return An array of distance level sets. The set at index |i| contains -- all nodes that have a distance of |i| to |source|. -- @return A mapping of nodes to their parents to allow the reconstruction @@ -95,7 +95,7 @@ end --- --- Performs the Floyd-Warshall algorithm to solve the all-source shortest path problem. +-- Performs the Floyd-Warshall algorithm to solve the all-source shortes path problem. -- -- @param graph The graph to compute the shortest paths for. -- diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/lib/PriorityQueue.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/lib/PriorityQueue.lua index 3fd29cdb748..378800fbf5b 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/lib/PriorityQueue.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/lib/PriorityQueue.lua @@ -107,7 +107,7 @@ end --- Internals: An implementation of Fibonacci heaps. +-- Internals: An implementation of fibonacci heaps. FibonacciHeap.__index = FibonacciHeap @@ -200,7 +200,7 @@ function FibonacciHeap:decreaseValue(node, value) assert(value <= node.value) node.value = value - + if node.value < node.parent.value then local parent = node.parent self:cutFromParent(node) @@ -231,7 +231,7 @@ end function FibonacciHeap:linkRoots(root, child) child.root = root child.parent = root - + child = self:removeTableElement(self.trees, child) table.insert(root.children, child) diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/lib/Simplifiers.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/lib/Simplifiers.lua index bcb72761909..abb428b8725 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/lib/Simplifiers.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/lib/Simplifiers.lua @@ -12,7 +12,7 @@ --- The Simplifiers class is a singleton object. --- Its methods allow implement methods for simplifying graphs, for instance +-- Its methods allow implement methods for simplifing graphs, for instance -- for removing loops or multiedges or computing spanning trees. local Simplifiers = {} @@ -104,7 +104,7 @@ function Simplifiers:classifyEdges(graph) completed[node] = true pop() else - for i=#edges_to_traverse,1,-1 do + for i=#edges_to_traverse,1,-1 do local neighbour = edges_to_traverse[i]:getNeighbour(node) discovered[neighbour] = true push(neighbour) @@ -199,9 +199,9 @@ function Simplifiers:collapseMultiedgesOldModel(algorithm, collapse_action) collapsed_edges[multiedge[neighbour]] = {} end - if collapse_action then - collapse_action(multiedge[neighbour], edge, graph) - end + if collapse_action then + collapse_action(multiedge[neighbour], edge, graph) + end table.insert(collapsed_edges[multiedge[neighbour]], edge) end @@ -251,12 +251,12 @@ function Simplifiers:expandMultiedgesOldModel(algorithm) -- Copy bend points for _,p in ipairs(multiedge.bend_points) do - edge.bend_points[#edge.bend_points+1] = p:copy() + edge.bend_points[#edge.bend_points+1] = p:copy() end -- Copy options for k,v in pairs(multiedge.algorithmically_generated_options) do - edge.algorithmically_generated_options[k] = v + edge.algorithmically_generated_options[k] = v end for _,node in ipairs(edge.nodes) do @@ -276,4 +276,4 @@ end -- Done -return Simplifiers +return Simplifiers
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/lib/Stack.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/lib/Stack.lua index 75084b6e38b..dfab15697de 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/lib/Stack.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/lib/Stack.lua @@ -13,7 +13,7 @@ --- A Stack is a very simple wrapper around an array -- --- +-- local Stack = {} Stack.__index = Stack diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/lib/Storage.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/lib/Storage.lua index e029fdf7ff8..eb520e77452 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/lib/Storage.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/lib/Storage.lua @@ -19,12 +19,12 @@ -- storage. Also, you can specify that for each object of the storage -- you store a table. In this case, there is no need to initialize -- this table for each object; rather, when you write into such a --- table and it does not yet exist, it is created ``on the fly''. +-- table and it does not yet exist, it is created ``on the fly''. -- -- The typical way you use storages is best explained with the -- following example: Suppose you want to write a depth-first search -- algorithm for a graph. This algorithm might wish to mark all nodes --- it has visited. It could just say |v.marked = true|, but this might +-- it has visisted. It could just say |v.marked = true|, but this might -- clash with someone else also using the |marked| key. The solution is -- to create a |marked| storage. The algorithm can first say --\begin{codeexample}[code only, tikz syntax=false] @@ -40,13 +40,13 @@ -- no longer in use get removed automatically. You can also make it a -- member variable of the algorithm class, which allows you make the -- information about which objects are marked globally --- accessible. +-- accessible. -- -- Now suppose the algorithm would like to store even more stuff in -- the storage. For this, we might use a table and can use the fact -- that a storage will automatically create a table when necessary: --\begin{codeexample}[code only, tikz syntax=false] ---local info = Storage.newTableStorage() +--local info = Storage.newTableStorage() -- --info[v].marked = true -- the "info[v]" table is -- -- created automatically here @@ -66,7 +66,7 @@ require("pgf.gd.lib").Storage = Storage local SimpleStorageMetaTable = { __mode = "k" } --- The advanced metatable for table storages: +-- The adcanved metatable for table storages: local TableStorageMetaTable = { __mode = "k", @@ -91,7 +91,7 @@ end --- -- Create a new storage object which will install a table for every --- entry automatically. +-- entry automatilly. -- -- @return A new |Storage| instance. diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/lib/Transform.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/lib/Transform.lua index 7695b1b2395..1f81b269202 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/lib/Transform.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/lib/Transform.lua @@ -42,7 +42,7 @@ function Transform.new(a,b,c,d,x,y) end ---- Creates a new transformation object that represents a shift. +--- Creates a new transformation object that represents a shift. -- -- @param x An x-shift -- @param y A y-shift @@ -54,7 +54,7 @@ function Transform.new_shift(x,y) end ---- Creates a new transformation object that represents a rotation. +--- Creates a new transformation object that represents a rotation. -- -- @param angle An angle -- @@ -67,7 +67,7 @@ function Transform.new_rotation(angle) end ---- Creates a new transformation object that represents a scaling. +--- Creates a new transformation object that represents a scaling. -- -- @param x The horizontal scaling -- @param y The vertical scaling (if missing, the horizontal scaling is used) @@ -94,8 +94,8 @@ function Transform.concat(a,b) local a1, a2, a3, a4, a5, a6, b1, b2, b3, b4, b5, b6 = a[1], a[2], a[3], a[4], a[5], a[6], b[1], b[2], b[3], b[4], b[5], b[6] return { a1*b1 + a2*b3, a1*b2 + a2*b4, - a3*b1 + a4*b3, a3*b2 + a4*b4, - a1*b5 + a2*b6 + a5, a3*b5 + a4*b6 + a6 } + a3*b1 + a4*b3, a3*b2 + a4*b4, + a1*b5 + a2*b6 + a5, a3*b5 + a4*b6 + a6 } end @@ -117,4 +117,4 @@ end -- Done -return Transform +return Transform
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/model/Arc.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/model/Arc.lua index e007e9b59b7..997a452399f 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/model/Arc.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/model/Arc.lua @@ -14,10 +14,10 @@ -- An arc is a light-weight object representing an arc from a vertex -- in a graph to another vertex. You may not create an |Arc| by -- yourself, which is why there is no |new| method, arc creation is --- done by the Digraph class. +-- done by the Digraph class. -- -- Every arc belongs to exactly one graph. If you want the same arc in --- another graph, you need to newly connect two vertices in the other graph. +-- another graph, you need to newly connect two vertices in the other graph. -- -- You may read the |head| and |tail| fields, but you may not write -- them. In order to store data for an arc, use |Storage| objects. @@ -28,7 +28,7 @@ -- be multiple edges between two vertices. This means, in particular, -- that an arc has no |options| field. Rather, it has several -- |optionsXxxx| functions, that will search for options in all of the --- syntactic edges that ``belong'' to an edge. +-- synactic edges that ``belong'' to an edge. -- -- In order to \emph{set} options of the edges, you can set the -- |generated_options| field of an arc (which is |nil| by default), see @@ -72,7 +72,7 @@ -- @field animations If non-nil, some animations to be passed back -- to the original syntactic edges. See the description of the -- |animations| field for |Vertex| for details on the syntax. --- @field syntactic_edges In case this arc is an arc in the syntactic +-- @field syntactic_edges In case this arc is an arc in the syntatic -- digraph (and only then), this field contains an array containing -- syntactic edges (``real'' edges in the syntactic digraph) that -- underly this arc. Otherwise, the field will be empty or |nil|. @@ -106,17 +106,15 @@ local lib = require 'pgf.gd.lib' -- If your algorithm gets confused by multiple edges, try saying -- |a:options(your_option)|. This will always give the ``most -- sensible'' choice of the option if there are multiple edges --- corresponding to the same arc. +-- corresponding to the same arc. -- -- @param option A string option like |"length"|. -- --- @return A table with the following contents: --- % +-- @return A table with the following contents: -- \begin{enumerate} --- \item It is an array of all values the option has for edges --- corresponding to |self| in the syntactic digraph. Suppose, for --- instance, you write the following: --- % +-- \item It is an array of all values the option has for edges +-- corresponding to |self| in the syntactic digraph. Suppose, for +-- instance, you write the following: --\begin{codeexample}[code only] --graph { -- tail -- [length=1] head, % multi edge 1 @@ -127,32 +125,31 @@ local lib = require 'pgf.gd.lib' -- tail -- [length=2] head, % multi edge 6 --} --\end{codeexample} --- % --- Suppose, furthermore, that |length| has been setup as an edge --- option. Now suppose that |a| is the arc from the vertex |tail| to --- the vertex |head|. Calling |a:optionsArray('length')| will --- yield the array part |{1,3,2,8,7}|. The reason for the ordering is --- as follows: First come all values |length| had for syntactic edges --- going from |self.tail| to |self.head| in the order they appear in the --- graph description. Then come all values the options has for syntactic --- edges going from |self.head| to |self.tail|. The reason for this --- slightly strange behavior is that many algorithms do not really --- care whether someone writes |a --[length=1] b| or --- |b --[length=1] a|; in both cases they would ``just'' like to know --- that the length is~|1|. --- --- \item There is field called |aligned|, which is an array storing --- the actual syntactic edge objects whose values can be found in the --- array part of the returned table. However, |aligned| contains only --- the syntactic edges pointing ``in the same direction'' as the arc, --- that is, the tail and head of the syntactic edge are the same as --- those of the arc. In the above example, this array would contain --- the edges with the comment numbers |1|, |2|, and |6|. --- --- Using the length of this array and the fact that the ``aligned'' --- values come first in the table, you can easily iterate over the --- |option|'s values of only those edges that are aligned with the arc: --- % +-- Suppose, furthermore, that |length| has been setup as an edge +-- option. Now suppose that |a| is the arc from the vertex |tail| to +-- the vertex |head|. Calling |a:optionsArray('length')| will +-- yield the array part |{1,3,2,8,7}|. The reason for the ordering is +-- as follows: First come all values |length| had for syntactic edges +-- going from |self.tail| to |self.head| in the order they appear in the graph +-- description. Then come all values the options has for syntactic +-- edges going from |self.head| to |self.tail|. The reason for this +-- slightly strange behaviour is that many algorithms do not really +-- care whether someone writes |a --[length=1] b| or +-- |b --[length=1] a|; in both cases they would ``just'' like to know +-- that the length is~|1|. +-- +-- \item There is field called |aligned|, which is an array storing +-- the actual syntactic edge objects whose values can be found in the +-- array part of the returned table. However, |aligned| contains only +-- the syntactic edges pointing ``in the same direction'' as the arc, +-- that is, the tail and head of the syntactic edge are the same as +-- those of the arc. In the above example, this array would contain +-- the edges with the comment numbers |1|, |2|, and |6|. +-- +-- Using the length of this array and the fact that the ``aligned'' +-- values come first in the table, you can easily iterate over the +-- |option|'s values of only those edges that are aligned with the arc: +-- --\begin{codeexample}[code only, tikz syntax=false] --local a = g:arc(tail.head) -- some arc --local opt = a:optionsArray('length') @@ -161,16 +158,17 @@ local lib = require 'pgf.gd.lib' -- sum = sum + opt[i] --end --\end{codeexample} --- % --- \item There is a field called |anti_aligned|, which is an array --- containing exactly the edges in the array part of the table not --- aligned with the arc. The numbering start at |1| as usual, so the --- $i$th entry of this table corresponds to the entry at position $i + --- \verb!#opt.aligned!$ of the table. --- \end{enumerate} +-- +--\item There is a field called |anti_aligned|, which is an array +-- containing exactly the edges in the array part of the table not +-- aligned with the arc. The numbering start at |1| as usual, so the +-- $i$th entry of this table corresponds to the entry at position $i + +-- \verb!#opt.aligned!$ of the table. +-- +--\end{enumerate} -- function Arc:optionsArray(option) - + local cache = self.option_cache local t = cache[option] if t then @@ -187,23 +185,23 @@ function Arc:optionsArray(option) if arc then for _,m in ipairs(arc.syntactic_edges) do if m.options[option] ~= nil then - aligned[#aligned + 1] = m + aligned[#aligned + 1] = m end end table.sort(aligned, function (a,b) return a.event.index < b.event.index end) end - + local arc = head ~= tail and s_graph:arc(head, tail) local anti_aligned = {} if arc then for _,m in ipairs(arc.syntactic_edges) do if m.options[option] ~= nil then - anti_aligned[#anti_aligned + 1] = m + anti_aligned[#anti_aligned + 1] = m end end table.sort(anti_aligned, function (a,b) return a.event.index < b.event.index end) end - + -- Now merge them together local t = { aligned = aligned, anti_aligned = anti_aligned } for i=1,#aligned do @@ -213,7 +211,7 @@ function Arc:optionsArray(option) t[#t+1] = anti_aligned[i].options[option] end cache[option] = t - + return t end @@ -223,11 +221,11 @@ end -- Returns the first option, that is, the first entry of -- |Arc:optionsArray(option)|. However, if the |only_aligned| -- parameter is set to true and there is no option with any aligned --- syntactic edge, |nil| is returned. +-- synactic edge, |nil| is returned. -- -- @param option An option -- @param only_aligned If true, only aligned syntactic edges will be --- considered. +-- considered. -- @return The first entry of the |optionsArray| function Arc:options(option, only_aligned) if only_aligned then @@ -258,7 +256,7 @@ end -- edges will be considered. -- -- @return If the option is not set for any (aligned) syntactic edges --- corresponding to |self|, |nil| is returned. If there is exactly one +-- corresponding to |self|, |nil| is returned. If there is exectly one -- edge, the value of this edge is returned. Otherwise, the result of -- repeatedly applying the |accumulator| function as described -- above. @@ -267,7 +265,6 @@ end -- |accumulator| function again. -- -- @usage Here is typical usage: --- % --\begin{codeexample}[code only, tikz syntax=false] --local total_length = a:optionsAccumulated('length', function (a,b) return a+b end) or 0 --\end{codeexample} @@ -280,7 +277,7 @@ function Arc:optionsAccumulated(option, accumulator, only_aligned) if v == nil then v = opt[1] for i=2,#aligned do - v = accumulator(v, opt[i]) + v = accumulator(v, opt[i]) end align[accumulator] = v end @@ -290,7 +287,7 @@ function Arc:optionsAccumulated(option, accumulator, only_aligned) if v == nil then v = opt[1] for i=2,#opt do - v = accumulator(v, opt[i]) + v = accumulator(v, opt[i]) end opt[accumulator] = v end @@ -304,7 +301,7 @@ end -- Compute the syntactic head and tail of an arc. For this, we have a -- look at the syntactic digraph underlying the arc. If there is at -- least once syntactic edge going from the arc's tail to the arc's --- head, the arc's tail and head are returned. Otherwise, we test +-- head, the arc's tail and head are returned. Otherweise, we test -- whether there is a syntactic edge in the other direction and, if -- so, return head and tail in reverse order. Finally, if there is no -- syntactic edge at all corresponding to the arc in either direction, @@ -341,15 +338,15 @@ function Arc:pointCloud () if a then for _,e in ipairs(a.syntactic_edges) do for _,p in ipairs(e.path) do - if type(p) == "table" then - cloud[#cloud + 1] = p - end + if type(p) == "table" then + cloud[#cloud + 1] = p + end end end end self.cached_point_cloud = cloud return cloud -end +end @@ -380,7 +377,7 @@ function Arc:eventIndex () end self.cached_event_index = e return e -end +end @@ -392,16 +389,21 @@ end -- edge involved in the arc. -- -- The priority of an edge is computed as follows: --- % +-- -- \begin{enumerate} --- \item If the option |"span priority"| is set, this number --- will be used. --- \item If the edge has the same head as the arc, we lookup the key\\ --- |"span priority " .. edge.direction|. If set, we use this value. --- \item If the edge has a different head from the arc (the arc is --- ``reversed'' with respect to the syntactic edge), we lookup the key --- |"span priority reversed " .. edge.direction|. If set, we use this value. --- \item Otherwise, we use priority 5. +-- \item If the option |"span priority"| is set, this number +-- will be used. +-- +-- \item If the edge has the same head as the arc, we lookup the key\\ +-- |"span priority " .. edge.direction|. If set, we use +-- this value. +-- +-- \item If the edge has a different head from the arc (the arc is +-- ``reversed'' with respect to the syntactic edge), we lookup the key +-- |"span priority reversed " .. edge.direction|. If set, +-- we use this value. +-- +-- \item Otherwise, we use priority 5. -- \end{enumerate} -- -- @return The priority of the arc, as described above. @@ -410,7 +412,7 @@ function Arc:spanPriority() if self.cached_span_priority then return self.cached_span_priority end - + local head = self.head local tail = self.tail local min @@ -420,8 +422,8 @@ function Arc:spanPriority() if a then for _,m in ipairs(a.syntactic_edges) do local p = - m.options["span priority"] or - lib.lookup_option("span priority " .. m.direction, m, g) + m.options["span priority"] or + lib.lookup_option("span priority " .. m.direction, m, g) min = math.min(p or 5, min or math.huge) end @@ -431,15 +433,15 @@ function Arc:spanPriority() if a then for _,m in ipairs(a.syntactic_edges) do local p = - m.options["span priority"] or - lib.lookup_option("span priority reversed " .. m.direction, m, g) - + m.options["span priority"] or + lib.lookup_option("span priority reversed " .. m.direction, m, g) + min = math.min(p or 5, min or math.huge) end end - + self.cached_span_priority = min or 5 - + return min or 5 end @@ -459,7 +461,6 @@ end -- which will replace the function in the |Path|. -- -- You use this method like this: --- % --\begin{codeexample}[code only, tikz syntax=false] --... --local arc = g:connect(s,t) @@ -484,34 +485,34 @@ function Arc:sync() local a = self.syntactic_digraph:arc(tail,head) if a and #a.syntactic_edges>0 then for _,e in ipairs(a.syntactic_edges) do - local clone = path:clone() - for i=1,#clone do - local p = clone[i] - if type(p) == "function" then - clone[i] = p(e) - if type(clone[i]) == "table" then - clone[i] = clone[i]:clone() - end - end - end - e.path = clone + local clone = path:clone() + for i=1,#clone do + local p = clone[i] + if type(p) == "function" then + clone[i] = p(e) + if type(clone[i]) == "table" then + clone[i] = clone[i]:clone() + end + end + end + e.path = clone end end local a = head ~= tail and self.syntactic_digraph:arc(head,tail) if a and #a.syntactic_edges>0 then for _,e in ipairs(a.syntactic_edges) do - local clone = path:reversed() - for i=1,#clone do - local p = clone[i] - if type(p) == "function" then - clone[i] = p(e) - if type(clone[i]) == "table" then - clone[i] = clone[i]:clone() - end - end - end - e.path = clone - end + local clone = path:reversed() + for i=1,#clone do + local p = clone[i] + if type(p) == "function" then + clone[i] = p(e) + if type(clone[i]) == "table" then + clone[i] = clone[i]:clone() + end + end + end + e.path = clone + end end end if self.generated_options then @@ -520,19 +521,19 @@ function Arc:sync() local a = self.syntactic_digraph:arc(tail,head) if a and #a.syntactic_edges>0 then for _,e in ipairs(a.syntactic_edges) do - for _,o in ipairs(self.generated_options) do - e.generated_options[#e.generated_options+1] = o - end + for _,o in ipairs(self.generated_options) do + e.generated_options[#e.generated_options+1] = o + end end end local a = head ~= tail and self.syntactic_digraph:arc(head,tail) if a and #a.syntactic_edges>0 then for _,e in ipairs(a.syntactic_edges) do - for _,o in ipairs(self.generated_options) do - e.generated_options[#e.generated_options+1] = o - end + for _,o in ipairs(self.generated_options) do + e.generated_options[#e.generated_options+1] = o + end end - end + end end if self.animations then local head = self.head @@ -540,17 +541,17 @@ function Arc:sync() local a = self.syntactic_digraph:arc(tail,head) if a and #a.syntactic_edges>0 then for _,e in ipairs(a.syntactic_edges) do - for _,o in ipairs(self.animations) do - e.animations[#e.animations+1] = o - end + for _,o in ipairs(self.animations) do + e.animations[#e.animations+1] = o + end end end local a = head ~= tail and self.syntactic_digraph:arc(head,tail) if a and #a.syntactic_edges>0 then for _,e in ipairs(a.syntactic_edges) do - for _,o in ipairs(self.animations) do - e.animations[#e.animations+1] = o - end + for _,o in ipairs(self.animations) do + e.animations[#e.animations+1] = o + end end end end @@ -571,8 +572,8 @@ end -- method to get a function that will, later on, compute the correct -- position of the anchor as needed. -- --- Here is the code you would use to create the above-mentioned path: --- % +-- Here is the code you would use to create the abovementioned path: +-- --\begin{codeexample}[code only, tikz syntax=false] --local a = g:connect(tail,head) --... @@ -584,19 +585,19 @@ end -- -- Normally, however, you will not write code as detailed as the above -- and you would just write instead of the last three lines: --- % +-- --\begin{codeexample}[code only, tikz syntax=false] --arc:setPolylinePath { Coordinate.new (10, 10) } --\end{codeexample} function Arc:tailAnchorForArcPath() return function (edge) - local a = edge.options['tail anchor'] - if a == "" then - a = "center" - end - return self.tail:anchor(a) + self.tail.pos - end + local a = edge.options['tail anchor'] + if a == "" then + a = "center" + end + return self.tail:anchor(a) + self.tail.pos + end end --- @@ -604,12 +605,12 @@ end function Arc:headAnchorForArcPath() return function (edge) - local a = edge.options['head anchor'] - if a == "" then - a = "center" - end - return self.head:anchor(a) + self.head.pos - end + local a = edge.options['head anchor'] + if a == "" then + a = "center" + end + return self.head:anchor(a) + self.head.pos + end end @@ -632,7 +633,7 @@ function Arc:setPolylinePath(coordinates) end p:appendLineto(self:headAnchorForArcPath()) - + self.path = p end diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/model/Collection.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/model/Collection.lua index abc454b7dbb..8ebb6f144cf 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/model/Collection.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/model/Collection.lua @@ -20,11 +20,11 @@ -- vertices that should be on the same level in a layered algorithm, -- or, indeed, subgraphs that are rendered in a special way. -- --- Collections are grouped into ``kinds''. All collections of a given +-- Collections are grouped into ``kinds.'' All collections of a given -- kind can be accessed by algorithms through an array whose elements --- are the collections. On the display layer, for each kind a separate --- key is available to indicate that a node or an edge belongs to a --- collection. +-- are the collections. On the displya layer, for each kind a separate +-- key is available to indicate that a node or an edge belongs to a +-- collection. -- -- Collections serve two purposes: First, they can be seen as ``hints'' -- to graph drawing algorithms that certain nodes and/or edges ``belong @@ -48,14 +48,14 @@ -- was in force when the collection was created. -- -- @field child_collections An array of all collections that are --- direct children of this collection (that is, +-- direct children of this collection (that is, -- they were defined while the current collection was the most -- recently defined collection on the options stack). However, you -- should use the methods |children|, |descendants|, and so to access -- this field. -- -- @field parent_collection The parent collection of the current --- collection. This field may be |nil| in case a collection has no parent. +-- colleciton. This field may be |nil| in case a collection has no parent. -- -- @field event An |Event| object that was create for this -- collection. Its |kind| will be |"collection"| while its |parameter| @@ -86,7 +86,7 @@ local Storage = require "pgf.gd.lib.Storage" -- function Collection.new(t) assert (type(t.kind) == "string" and t.kind ~= "", "collection kind not set") - + return setmetatable( { vertices = t.vertices or {}, @@ -111,7 +111,7 @@ end function Collection:registerAsChildOf(parent) self.parent = parent - if parent then + if parent then assert (getmetatable(parent) == Collection, "parent must be a collection") parent.child_collections[#parent.child_collections+1] = self end @@ -149,10 +149,10 @@ end function Collection:childrenOfKind(kind) local function rec (c, a) for _,d in ipairs(c.child_collections) do - if d.kind == kind then - a[#a + 1] = d + if d.kind == kind then + a[#a + 1] = d else - rec (d, a) + rec (d, a) end end return a @@ -163,7 +163,7 @@ end --- -- The descendants of a collection are its children, plus their --- children, plus their children, and so on. +-- children, plus their children, and so on. -- -- @return An array of all descendants of |self|. It will be in -- preorder. @@ -184,15 +184,15 @@ end --- -- The descendants of a collection of the given |kind|. -- --- @param kind A collection kind. +-- @param kind A colleciton kind. -- -- @return An array of all descendants of |self| of the given |kind|. function Collection:descendantsOfKind(kind) local function rec (c, a) for _,d in ipairs(c.child_collections) do - if d.kind == kind then - a[#a + 1] = d + if d.kind == kind then + a[#a + 1] = d end rec (d, a) end @@ -205,4 +205,4 @@ end -- Done -return Collection +return Collection
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/model/Coordinate.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/model/Coordinate.lua index 3a4448ab089..815544ee705 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/model/Coordinate.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/model/Coordinate.lua @@ -10,17 +10,17 @@ -- @release $Header$ ---- +--- -- A Coordinate models a position on the drawing canvas. -- -- It has an |x| field and a |y| field, which are numbers that will be -- interpreted as \TeX\ points (1/72.27th of an inch). The $x$-axis goes -- right and the $y$-axis goes up. -- --- @field x +-- @field x -- @field y -- --- There is also a static field called |origin| that is always equal to the origin. +-- There is also a static field called |origin| that is always equal to the origin. local Coordinate = {} Coordinate.__index = Coordinate @@ -61,7 +61,7 @@ end --- Apply a transformation matrix to a coordinate, -- see |pgf.gd.lib.Transform| for details. -- --- @param t A transformation. +-- @param t A tansformation. function Coordinate:apply(t) local x = self.x @@ -74,7 +74,7 @@ end --- Shift a coordinate -- -- @param a An $x$ offset --- @param b A $y$ offset +-- @param b A $y$ offset function Coordinate:shift(a,b) self.x = self.x + a @@ -87,7 +87,7 @@ end -- inversed coordinate; only faster). -- -- @param a An $x$ offset --- @param b A $y$ offset +-- @param b A $y$ offset function Coordinate:unshift(a,b) self.x = self.x - a @@ -110,7 +110,7 @@ end --- -- Like |unshift|, only for coordinate parameters. -- --- @param c Another coordinate. +-- @param c Another coordinate. function Coordinate:unshiftByCoordinate(c) self.x = self.x - c.x @@ -119,7 +119,7 @@ end --- --- Moves the coordinate a fraction of |f| along a straight line to |c|. +-- Moves the coordinate a fraction of |f| along a straight line to |c|. -- -- @param c Another coordinate -- @param f A fraction @@ -268,13 +268,13 @@ end -- @return |max_x| -- @return |max_y| -- @return |center_x| The center of the bounding box --- @return |center_y| +-- @return |center_y| function Coordinate.boundingBox(array) if #array > 0 then local min_x, min_y = math.huge, math.huge local max_x, max_y = -math.huge, -math.huge - + for i=1,#array do local c = array[i] local x = c.x @@ -284,7 +284,7 @@ function Coordinate.boundingBox(array) if x > max_x then max_x = x end if y > max_y then max_y = y end end - + return min_x, min_y, max_x, max_y, (min_x+max_x) / 2, (min_y+max_y) / 2 end end diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/model/Digraph.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/model/Digraph.lua index 30b600e308d..5c48059a605 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/model/Digraph.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/model/Digraph.lua @@ -12,12 +12,12 @@ ---- +--- -- Each |Digraph| instance models a \emph{directed, simple} -- graph. ``Directed'' means that all edges ``point'' from a head node -- to a tail node. ``Simple'' means that between any nodes there can be -- (at most) one edge. Since these properties are a bit at odds with --- the normal behavior of ``nodes'' and ``edges'' in \tikzname, +-- the normal behaviour of ``nodes'' and ``edges'' in \tikzname, -- different names are used for them inside the |model| namespace: -- The class modeling ``edges'' is actually called |Arc| to stress -- that an arc has a specific ``start'' (the tail) and a specific @@ -31,17 +31,14 @@ -- Since digraphs are constantly created and modified inside the graph -- drawing engine, some care was taken to ensure that all operations -- work as quickly as possible. In particular: --- % -- \begin{itemize} --- \item Adding an array of $k$ vertices using the |add| method needs --- time $O(k)$. --- \item Adding an arc between two vertices needs time $O(1)$. --- \item Accessing both the |vertices| and the |arcs| fields takes time --- $O(1)$, provided only the above operations are used. +-- \item Adding an array of $k$ vertices using the |add| method needs +-- time $O(k)$. +-- \item Adding an arc between two vertices needs time $O(1)$. +-- \item Accessing both the |vertices| and the |arcs| fields takes time +-- $O(1)$, provided only the above operations are used. -- \end{itemize} --- % -- Deleting vertices and arcs takes more time: --- % -- \begin{itemize} -- \item Deleting the vertices given in an array of $k$ vertices from a -- graph with $n$ vertices takes time $O(\max\{n,c\})$ where $c$ is the @@ -53,12 +50,12 @@ -- number of outgoing arcs at the arc's tail and $h_i$ is the number -- of incoming arcs at the arc's head. After a call to |disconnect|, -- the next use of the |arcs| field will take time $O(|V| + |E|)$, --- while subsequent accesses take time $O(1)$ -- till the +-- while subsequent accesses take time $O(1)$ -- till the -- next use of |disconnect|. This means that once you start deleting -- arcs using |disconnect|, you should perform as many additional -- |disconnect|s as possible before accessing |arcs| one more. -- \end{itemize} --- +-- -- \medskip -- \noindent\emph{Stability.} The |vertices| field and the array -- returned by |Digraph:incoming| and |Digraph:outgoing| are @@ -66,7 +63,7 @@ -- when you use |ipairs| on the will be the ordering in which the -- vertices or arcs were added to the graph. Even when you remove a -- vertex or an arc, the ordering of the remaining elements stays the --- same. +-- same. -- -- @field vertices This array contains the vertices that are part of -- the digraph. Internally, this array @@ -106,18 +103,15 @@ -- given vertex |v|, you cannot say something like |v.outgoings| or -- perhaps |v:getOutgoings()|. Rather, you have to say |g:outgoing(v)| -- to get this list: --- % --\begin{codeexample}[code only, tikz syntax=false] ---for _,a in ipairs(g:outgoing(v)) do -- g is a Digraph object. +--for _,a in ipairs(g:outgoing(v)) do -- g is a Digraph object. -- pgf.debug ("There is an arc leaving " .. tostring(v) .. -- " heading to " .. tostring(a.head)) --end --\end{codeexample} --- % --- Naturally, there is also a method |g:incoming()|. --- --- To iterate over all arcs of a graph you can say: --- % +-- Naturally, there is also a method |g:incoming()|. +-- +-- To iterate over all arcs of a graph you can say: --\begin{codeexample}[code only, tikz syntax=false] --for _,v in ipairs(g.vertices) do -- for _,a in ipairs(g:outgoing(v)) do @@ -128,7 +122,7 @@ -- -- However, it will often be more convenient and, in case the there -- are far less arcs than vertices, also faster to write --- +-- --\begin{codeexample}[code only, tikz syntax=false] --for _,a in ipairs(g.arcs) do -- ... @@ -136,7 +130,7 @@ --\end{codeexample} -- -- @field arcs For any two vertices |t| and |h| of a graph, there may --- or may not be +-- or may not be -- an arc from |t| to |h|. If this is the case, there is an |Arc| -- object that represents this arc. Note that, since |Digraph|s are -- always simple graphs, there can be at most one such object for every @@ -144,7 +138,7 @@ -- an |Arc| through a |Storage|, see the |Storage| class for -- details. Each |Arc| for an edge of the syntactic digraph stores -- an array called |syntactic_edges| of all the multiple edges that --- are present in the user's input. +-- are present in the user's input. -- -- Unlike vertices, the arc objects of a graph are always local to a -- graph; an |Arc| object can never be part of two digraphs at the same @@ -170,7 +164,7 @@ -- point, the |arcs| array is reconstructed by adding all arcs of all -- nodes to it. -- --- The bottom line of the behavior of the |arcs| field is that (a) the +-- The bottom line of the behaviour of the |arcs| field is that (a) the -- ordering of the elements may change abruptly whenever you remove an -- arc from a graph and (b) performing $k$ |disconnect| operations in -- sequence takes time $O(k)$, provided you do not access the |arcs| @@ -194,12 +188,12 @@ local function recalc_arcs (digraph) end end digraph.arcs = arcs - return arcs + return arcs end -Digraph.__index = +Digraph.__index = function (t, k) - if k == "arcs" then + if k == "arcs" then return recalc_arcs(t) else return rawget(Digraph,k) @@ -229,7 +223,7 @@ local Vertex = require "pgf.gd.model.Vertex" -- created graphs always have an empty arcs set. This means that -- writing |Digraph.new(g)| where |g| is a graph creates a new graph -- whose vertex set is the same as |g|'s, but where there are no edges: --- % +-- --\begin{codeexample}[code only, tikz syntax=false] --local g = Digraph.new {} --g:add { v1, v2, v3 } @@ -245,8 +239,8 @@ local Vertex = require "pgf.gd.model.Vertex" --local h = Digraph.new (g) --for _,a in ipairs(g.arcs) do h:connect(a.tail, a.head) end --\end{codeexample} --- --- This operation takes time $O(1)$. +-- +-- This operation takes time $O(1)$. -- -- @param initial A table of initial values. It is permissible that -- this array contains a |vertices| field. In this @@ -274,7 +268,7 @@ function Digraph.new(initial) digraph.vertices = {} digraph.arcs = {} - if vertices then + if vertices then digraph:add(vertices) end return digraph @@ -315,25 +309,25 @@ end -- function Digraph:remove(array) local vertices = self.vertices - + -- Mark all to-be-deleted nodes for i=1,#array do local v = array[i] assert(vertices[v], "to-be-deleted node is not in graph") vertices[v] = false end - + -- Disconnect them for i=1,#array do self:disconnect(array[i]) end - + LookupTable.remove(self.vertices, array) end ---- Test, whether a graph contains a given vertex. +--- Test, whether a graph contains a given vertex. -- -- This operation takes time $O(1)$. -- @@ -348,7 +342,7 @@ end --- -- Returns the arc between two nodes, provided it exists. Otherwise, --- |nil| is returned. +-- |nil| is retured. -- -- This operation takes time $O(1)$. -- @@ -366,7 +360,7 @@ end ---- +--- -- Returns an array containing the outgoing arcs of a vertex. You may -- only iterate over his array using ipairs, not using pairs. -- @@ -421,7 +415,7 @@ function Digraph:orderOutgoing(v, vertices) -- Compute ordering of the arcs local reordered = {} for _,arc in ipairs(outgoing) do - reordered [lookup[arc.head]] = arc + reordered [lookup[arc.head]] = arc end -- Copy back @@ -463,7 +457,7 @@ function Digraph:orderIncoming(v, vertices) -- Compute ordering of the arcs local reordered = {} for _,arc in ipairs(incoming) do - reordered [lookup[arc.head]] = arc + reordered [lookup[arc.head]] = arc end -- Copy back @@ -476,9 +470,9 @@ end ---- +--- -- Connects two nodes by an arc and returns the newly created arc --- object. If they are already connected, the existing arc is returned. +-- object. If they are already connected, the existing arc is returned. -- -- This operation takes time $O(1)$. -- @@ -528,10 +522,10 @@ end ---- +--- -- Disconnect either a single vertex |v| from all its neighbors (remove all -- incoming and outgoing arcs of this vertex) or, in case two nodes --- are given as parameter, remove the arc between them, if it exists. +-- are given as parameter, remove the arc between them, if it exsits. -- -- This operation takes time $O(|I_v| + |I_t|)$, where $I_x$ is the set -- of vertices incident to $x$, to remove the single arc between $v$ and @@ -551,23 +545,23 @@ function Digraph:disconnect(v, t) -- Remove: s_outgoings[t] = nil for i=1,#s_outgoings do - if s_outgoings[i].head == t then - table.remove (s_outgoings, i) - break - end + if s_outgoings[i].head == t then + table.remove (s_outgoings, i) + break + end end t_incomings[v] = nil for i=1,#t_incomings do - if t_incomings[i].tail == v then - table.remove (t_incomings, i) - break - end + if t_incomings[i].tail == v then + table.remove (t_incomings, i) + break + end end self.arcs = nil -- invalidate arcs field end else -- Case 1: Remove all arcs incident to v: - + -- Step 1: Delete all incomings arcs: local incomings = assert(v.incomings[self], "node not in graph") local vertices = self.vertices @@ -575,15 +569,15 @@ function Digraph:disconnect(v, t) for i=1,#incomings do local s = incomings[i].tail if s ~= v and vertices[s] then -- skip self-loop and to-be-deleted nodes - -- Remove this arc from s: - local s_outgoings = s.outgoings[self] - s_outgoings[v] = nil - for i=1,#s_outgoings do - if s_outgoings[i].head == v then - table.remove (s_outgoings, i) - break - end - end + -- Remove this arc from s: + local s_outgoings = s.outgoings[self] + s_outgoings[v] = nil + for i=1,#s_outgoings do + if s_outgoings[i].head == v then + table.remove (s_outgoings, i) + break + end + end end end @@ -592,14 +586,14 @@ function Digraph:disconnect(v, t) for i=1,#outgoings do local t = outgoings[i].head if t ~= v and vertices[t] then - local t_incomings = t.incomings[self] - t_incomings[v] = nil - for i=1,#t_incomings do - if t_incomings[i].tail == v then - table.remove (t_incomings, i) - break - end - end + local t_incomings = t.incomings[self] + t_incomings[v] = nil + for i=1,#t_incomings do + if t_incomings[i].tail == v then + table.remove (t_incomings, i) + break + end + end end end @@ -616,12 +610,12 @@ end ---- +--- -- An arc is changed so that instead of connecting |self.tail| -- and |self.head|, it now connects a new |head| and |tail|. The -- difference to first disconnecting and then reconnecting is that all -- fields of the arc (other than |head| and |tail|, of course), will --- be ``moved along''. Reconnecting an arc in the same way as before has no +-- be ``moved along.'' Reconnecting an arc in the same way as before has no -- effect. -- -- If there is already an arc at the new position, fields of the @@ -643,16 +637,16 @@ end -- function Digraph:reconnect(arc, tail, head) assert (arc and tail and head, "connect with nil parameters") - + if arc.head == head and arc.tail == tail then -- Nothing to be done return arc else local new_arc = self:connect(tail, head) - + for k,v in pairs(arc) do if k ~= "head" and k ~= "tail" then - new_arc[k] = v + new_arc[k] = v end end @@ -688,11 +682,11 @@ end -- A collapse vertex will store the collapsed vertices so that you can -- call |expand| later on to ``restore'' the vertices and arcs that -- were saved during a collapse. This storage is \emph{not} local to --- the graph in which the collapse occurred. +-- the graph in which the collapse occured. -- -- @param collapse_vertices An array of to-be-collapsed vertices -- @param collapse_vertex The vertex that represents the collapse. If --- missing, a vertex will be created automatically and added to the graph. +-- missing, a vertex will be created automatically and added to the graph. -- @param vertex_fun This function is called for each to-be-collapsed -- vertex. The parameters are the collapse vertex and the -- to-be-collapsed vertex. May be |nil|. @@ -700,7 +694,7 @@ end -- between |rep| and some other vertex. The arguments are the new arc -- and the original arc. May be |nil|. -- --- @return The new vertex that represents the collapsed vertices. +-- @return The new vertex that represents the collapsed vertices. function Digraph:collapse(collapse_vertices, collapse_vertex, vertex_fun, arc_fun) @@ -710,7 +704,7 @@ function Digraph:collapse(collapse_vertices, collapse_vertex, vertex_fun, arc_fu collapse_vertex = Vertex.new {} end self:add {collapse_vertex} - + -- Copy the collapse_vertices and create lookup local cvs = {} for i=1,#collapse_vertices do @@ -722,29 +716,29 @@ function Digraph:collapse(collapse_vertices, collapse_vertex, vertex_fun, arc_fu -- Connected collapse_vertex appropriately local collapsed_arcs = {} - + if not arc_fun then arc_fun = function () end end - + for _,v in ipairs(cvs) do if vertex_fun then vertex_fun (collapse_vertex, v) end for _,a in ipairs(v.outgoings[self]) do if cvs[a.head] ~= true then - arc_fun (self:connect(collapse_vertex, a.head), a) - collapsed_arcs[#collapsed_arcs + 1] = a + arc_fun (self:connect(collapse_vertex, a.head), a) + collapsed_arcs[#collapsed_arcs + 1] = a end end for _,a in ipairs(v.incomings[self]) do if cvs[a.tail] ~= true then - arc_fun (self:connect(a.tail, collapse_vertex), a) + arc_fun (self:connect(a.tail, collapse_vertex), a) end collapsed_arcs[#collapsed_arcs + 1] = a end end - + -- Remember the old vertices. collapse_vertex.collapsed_vertices = cvs collapse_vertex.collapsed_arcs = collapsed_arcs @@ -776,7 +770,7 @@ function Digraph:expand(vertex, vertex_fun, arc_fun) -- Add all vertices: self:add(cvs) - if vertex_fun then + if vertex_fun then for _,v in ipairs(cvs) do vertex_fun(vertex, v) end @@ -785,13 +779,13 @@ function Digraph:expand(vertex, vertex_fun, arc_fun) -- Add all arcs: for _,arc in ipairs(vertex.collapsed_arcs) do local new_arc = self:connect(arc.tail, arc.head) - + for k,v in pairs(arc) do if k ~= "head" and k ~= "tail" then - new_arc[k] = v + new_arc[k] = v end end - + if arc_fun then arc_fun(new_arc, vertex) end @@ -815,7 +809,7 @@ end ---- +--- -- Computes a string representation of this graph including all nodes -- and edges. The syntax of this representation is such that it can be -- used directly in \tikzname's |graph| syntax. @@ -831,13 +825,13 @@ function Digraph:__tostring() if #out_arcs > 0 then local t = {} for j,a in ipairs(out_arcs) do - t[j] = tostring(a.head) + t[j] = tostring(a.head) end astrings[#astrings + 1] = " " .. tostring(v) .. " -> { " .. table.concat(t,", ") .. " }" end end return "graph [id=" .. tostring(self.vertices) .. "] {\n {\n" .. - table.concat(vstrings, ",\n") .. "\n }; \n" .. + table.concat(vstrings, ",\n") .. "\n }; \n" .. table.concat(astrings, ";\n") .. "\n}"; end @@ -846,4 +840,4 @@ end -- Done -return Digraph +return Digraph
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/model/Edge.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/model/Edge.lua index 45cbc60f9f7..87b06661e54 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/model/Edge.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/model/Edge.lua @@ -10,12 +10,12 @@ -- @release $Header$ ---- +--- -- An |Edge| is a ``syntactic'' connection between two -- vertices that represents a connection present in the syntactic -- digraph. Unlike an |Arc|, |Edge| objects are not controlled by the -- |Digraph| class. Also unlike |Arc| objects, there can be several --- edges between the same vertices, namely whenever several such edges +-- edges betwen the same vertices, namely whenever several such edges -- are present in the syntactic digraph. -- -- In detail, the relationship between arcs and edges is as follows: @@ -33,15 +33,15 @@ -- second one. Whether -- an edge is directed or not depends on the |direction| of the edge, which -- may be one of the following: --- % +-- -- \begin{enumerate} --- \item |"->"| --- \item |"--"| --- \item |"<-"| --- \item |"<->"| --- \item |"-!-"| +-- \item |"->"| +-- \item |"--"| +-- \item |"<-"| +-- \item |"<->"| +-- \item |"-!-"| -- \end{enumerate} --- +-- -- -- @field head The head vertex of this edge. -- @@ -63,7 +63,7 @@ -- |InterfaceToAlgorithms|. -- -- @field animations An array of animations, see the |animations| --- field of the |Vertex| class for the syntax. +-- field of the |Vertex| class for the syntax. local Edge = {} Edge.__index = Edge @@ -79,14 +79,14 @@ require("pgf.gd.model").Edge = Edge local Path = require "pgf.gd.model.Path" ---- +--- -- Create a new edge. The |initial| parameter allows you to setup -- some initial values. -- -- @usage --\begin{codeexample}[code only, tikz syntax=false] --local v = Edge.new { tail = v1, head = v2 } ---\end{codeexample} +--\end{codeexample} -- -- @param initial Values to override defaults. -- -- @return A new edge object. @@ -125,10 +125,10 @@ end -- Note that you typically do not use this function, but use the -- corresponding function of the |Arc| class. Use this function only -- if there are multiple edges between two vertices that need to be --- routed differently. +-- routed differently. +-- +-- Here is the code you would use to create the abovementioned path: -- --- Here is the code you would use to create the above-mentioned path: --- % --\begin{codeexample}[code only, tikz syntax=false] --local a = g:connect(tail,head) --local e = a.syntactic_edges[1] @@ -140,19 +140,19 @@ end --\end{codeexample} -- -- As for the |Arc| class, you can also setup a polyline more easily: --- % +-- --\begin{codeexample}[code only, tikz syntax=false] --e:setPolylinePath { Coordinate.new (10, 10) } --\end{codeexample} function Edge:tailAnchorForEdgePath() return function () - local a = self.options['tail anchor'] - if a == "" then - a = "center" - end - return self.tail:anchor(a) + self.tail.pos - end + local a = self.options['tail anchor'] + if a == "" then + a = "center" + end + return self.tail:anchor(a) + self.tail.pos + end end --- @@ -160,12 +160,12 @@ end function Edge:headAnchorForEdgePath() return function () - local a = self.options['head anchor'] - if a == "" then - a = "center" - end - return self.head:anchor(a) + self.head.pos - end + local a = self.options['head anchor'] + if a == "" then + a = "center" + end + return self.head:anchor(a) + self.head.pos + end end @@ -188,7 +188,7 @@ function Edge:setPolylinePath(coordinates) end p:appendLineto(self:headAnchorForEdgePath()) - + self.path = p end diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/model/Hyperedge.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/model/Hyperedge.lua index cc265023fa5..3819e193689 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/model/Hyperedge.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/model/Hyperedge.lua @@ -11,7 +11,7 @@ ---- +--- -- @section subsection {Hyperedges} -- -- @end @@ -28,19 +28,19 @@ declare { key = "hyper", layer = -10, - summary = [[" - A \emph{hyperedge} of a graph does not connect just two nodes, but - is any subset of the node set (although a normal edge is also a - hyperedge that happens to contain just two nodes). Internally, a - collection of kind |hyper| is created. Currently, there is - no default renderer for hyper edges. + summary = [[" + A \emph{hyperedge} of a graph does not connect just two nodes, but + is any subset of the node set (although a normal edge is also a + hyperedge that happens to contain just two nodes). Internally, a + collection of kind |hyper| is created. Currently, there is + no default renderer for hyper edges. "]], documentation = [[" \begin{codeexample}[code only] \graph { % The nodes: a, b, c, d; - + % The edges: {[hyper] a,b,c}; {[hyper] b,c,d}; @@ -50,7 +50,7 @@ declare { \end{codeexample} "]] } - --- Done + +-- Done return Hyperedge
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/model/Path.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/model/Path.lua index cbd0f079bfb..93cd44cc218 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/model/Path.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/model/Path.lua @@ -10,32 +10,32 @@ -- @release $Header$ ---- +--- -- A Path models a path in the plane. -- -- Following the PostScript/\textsc{pdf}/\textsc{svg} convention, a -- path consists of a series of path segments, each of which can be --- closed or not. Each path segment, in turn, consists of a series of --- Bézier curves and straight line segments; see +-- closed or not. Each path segement, in turn, consists of a series of +-- Bézier curvers and straight line segments; see -- Section~\ref{section-paths} for an introduction to paths in -- general. -- -- A |Path| object is a table whose array part stores --- |Coordinate| objects, |strings|, and |function|s that --- describe the path of the edge. The following strings are allowed in +-- |Coordinate| objects, |strings|, and |function|s that +-- describe the path of the edge. The following strings are allowed in -- this array: --- % +-- -- \begin{itemize} --- \item |"moveto"| The line's path should stop at the current --- position and then start anew at the next coordinate in the array. --- \item |"lineto"| The line should continue from the current position --- to the next coordinate in the array. --- \item |"curveto"| The line should continue form the current --- position with a Bézier curve that is specified by the next three --- |Coordinate| objects (in the usual manner). --- \item |"closepath"| The line's path should be ``closed'' in the sense --- that the current subpath that was started with the most recent --- moveto operation should now form a closed curve. +-- \item |"moveto"| The line's path should stop at the current +-- position and then start anew at the next coordinate in the array. +-- \item |"lineto"| The line should continue from the current position +-- to the next coordinate in the array. +-- \item |"curveto"| The line should continue form the current +-- position with a Bézier curve that is specified bz the next three +-- |Coordinate| objects (in the usual manner). +-- \item |"closepath"| The line's path should be ``closed'' in the sense +-- that the current subpath that was started with the most recent +-- moveto operation should now form a closed curve. -- \end{itemize} -- -- Instead of a |Coordinate|, a |Path| may also contain a function. In @@ -93,36 +93,36 @@ function Path.new(initial) while i <= #initial do local e = initial[i] if type(e) == "string" then - assert (count == 0, "illformed path") - if e == "moveto" then - count = 1 - elseif e == "lineto" then - count = 1 - elseif e == "closepath" then - count = 0 - elseif e == "curveto" then - count = 3 - else - error ("unknown path command " .. e) - end - new[#new+1] = e + assert (count == 0, "illformed path") + if e == "moveto" then + count = 1 + elseif e == "lineto" then + count = 1 + elseif e == "closepath" then + count = 0 + elseif e == "curveto" then + count = 3 + else + error ("unknown path command " .. e) + end + new[#new+1] = e elseif type(e) == "number" then - if count == 0 then - new[#new+1] = "lineto" - else - count = count - 1 - end - new[#new+1] = Coordinate.new(e,initial[i+1]) - i = i + 1 + if count == 0 then + new[#new+1] = "lineto" + else + count = count - 1 + end + new[#new+1] = Coordinate.new(e,initial[i+1]) + i = i + 1 elseif type(e) == "table" or type(e) == "function" then - if count == 0 then - new[#new+1] = "lineto" - else - count = count - 1 - end - new[#new+1] = e + if count == 0 then + new[#new+1] = "lineto" + else + count = count - 1 + end + new[#new+1] = e else - error ("invalid object on path") + error ("invalid object on path") end i = i + 1 end @@ -158,7 +158,7 @@ end -- @return A copy of the reversed path function Path:reversed() - + -- First, build segments local subpaths = {} local subpath = {} @@ -169,7 +169,7 @@ function Path:reversed() subpath = {} end end - + local prev local start @@ -178,9 +178,9 @@ function Path:reversed() local x = self[i] if x == "lineto" then subpath[#subpath+1] = { - action = 'lineto', - from = prev, - to = self[i+1] + action = 'lineto', + from = prev, + to = self[i+1] } prev = self[i+1] i = i + 2 @@ -192,9 +192,9 @@ function Path:reversed() i = i + 2 elseif x == "closepath" then subpath [#subpath + 1] = { - action = "closepath", - from = prev, - to = start, + action = "closepath", + from = prev, + to = start, } prev = nil start = nil @@ -203,11 +203,11 @@ function Path:reversed() elseif x == "curveto" then local s1, s2, to = self[i+1], self[i+2], self[i+3] subpath [#subpath + 1] = { - action = "curveto", - from = prev, - to = to, - support_1 = s1, - support_2 = s2, + action = "curveto", + from = prev, + to = to, + support_1 = s1, + support_2 = s2, } prev = self[i+3] i = i + 4 @@ -216,7 +216,7 @@ function Path:reversed() end end closepath () - + local new = Path.new () for _,subpath in ipairs(subpaths) do @@ -226,29 +226,29 @@ function Path:reversed() else -- We start with a moveto to the end point: new:appendMoveto(subpath[#subpath].to) - + -- Now walk backwards: for i=#subpath,1,-1 do - if subpath[i].action == "lineto" then - new:appendLineto(subpath[i].from) - elseif subpath[i].action == "closepath" then - new:appendLineto(subpath[i].from) - elseif subpath[i].action == "curveto" then - new:appendCurveto(subpath[i].support_2, - subpath[i].support_1, - subpath[i].from) - else - error("illegal path command") - end + if subpath[i].action == "lineto" then + new:appendLineto(subpath[i].from) + elseif subpath[i].action == "closepath" then + new:appendLineto(subpath[i].from) + elseif subpath[i].action == "curveto" then + new:appendCurveto(subpath[i].support_2, + subpath[i].support_1, + subpath[i].from) + else + error("illegal path command") + end end -- Append a closepath, if necessary if subpath[#subpath].action == "closepath" then - new:appendClosepath() + new:appendClosepath() end end end - + return new end @@ -314,7 +314,7 @@ end -- Appends a |moveto| to the path. -- -- @param x A |Coordinate| or |function| or, if the |y| parameter is --- not |nil|, a number that is the $x$-part of a coordinate. +-- not |nil|, a number that is the $x$-part of a coordiante . -- @param y The $y$-part of the coordinate. function Path:appendMoveto(x,y) @@ -327,7 +327,7 @@ end -- Appends a |lineto| to the path. -- -- @param x A |Coordinate| or |function|, if the |y| parameter is not --- |nil|, a number that is the $x$-part of a coordinate. +-- |nil|, a number that is the $x$-part of a coordiante . -- @param y The $y$-part of the coordinate. function Path:appendLineto(x,y) @@ -362,7 +362,7 @@ function Path:appendCurveto(a,b,c,d,e,f) self[#self + 1] = a self[#self + 1] = b self[#self + 1] = c - end + end end @@ -371,7 +371,7 @@ end --- --- Makes a path ``rigid'', meaning that all coordinates that are only +-- Makes a path ``rigid,'' meaning that all coordinates that are only -- given as functions are replaced by the values these functions -- yield. @@ -406,7 +406,7 @@ end -- Returns a bounding box of the path. This will not necessarily be -- the minimal bounding box in case the path contains curves because, -- then, the support points of the curve are used for the computation --- rather than the actual bounding box of the path. +-- rather than the actual boinding box of the path. -- -- If the path contains no coordinates, all return values are 0. -- @@ -415,22 +415,22 @@ end -- @return |max_x| -- @return |max_y| -- @return |center_x| The center of the bounding box --- @return |center_y| +-- @return |center_y| function Path:boundingBox() if #self > 0 then local min_x, min_y = math.huge, math.huge local max_x, max_y = -math.huge, -math.huge - + for i=1,#self do local c = rigid(self[i]) if type(c) == "table" then - local x = c.x - local y = c.y - if x < min_x then min_x = x end - if y < min_y then min_y = y end - if x > max_x then max_x = x end - if y > max_y then max_y = y end + local x = c.x + local y = c.y + if x < min_x then min_x = x end + if y < min_y then min_y = y end + if x > max_x then max_x = x end + if y > max_y then max_y = y end end end @@ -453,22 +453,21 @@ local eps = 0.0001 --- -- Computes all intersections of a path with another path and returns -- them as an array of coordinates. The intersections will be sorted --- ``along the path |self|''. The implementation uses a +-- ``along the path |self|.'' The implementation uses a -- divide-and-conquer approach that should be reasonably fast in --- practice. +-- practice. -- -- @param path Another path -- -- @return Array of all intersections of |path| with |self| in the -- order they appear on |self|. Each entry of this array is a table -- with the following fields: --- % -- \begin{itemize} --- \item |index| The index of the segment in |self| where --- the intersection occurs. --- \item |time| The ``time'' at which a point traveling along the --- segment from its start point to its end point. --- \item |point| The point itself. +-- \item |index| The index of the segment in |self| where +-- the intersection occurs. +-- \item |time| The ``time'' at which a point travelling along the +-- segment from its start point to its end point. +-- \item |point| The point itself. -- \end{itemize} function Path:intersectionsWith(path) @@ -479,13 +478,13 @@ function Path:intersectionsWith(path) local memo2 = prepare_memo(p2) local intersections = {} - + local function intersect_segments(i1, i2) - + local s1 = p1[i1] local s2 = p2[i2] local r = {} - + if s1.action == 'lineto' and s2.action == 'lineto' then local a = s2.to.x - s2.from.x local b = s1.from.x - s1.to.x @@ -493,103 +492,103 @@ function Path:intersectionsWith(path) local d = s2.to.y - s2.from.y local e = s1.from.y - s1.to.y local f = s2.from.y - s1.from.y - + local det = a*e - b*d - + if math.abs(det) > eps*eps then - local t, s = (c*d - a*f)/det, (b*f - e*c)/det + local t, s = (c*d - a*f)/det, (b*f - e*c)/det - if t >= 0 and t<=1 and s>=0 and s <= 1 then - local p = s1.from:clone() - p:moveTowards(s1.to, t) - return { { time = t, point = p } } - end + if t >= 0 and t<=1 and s>=0 and s <= 1 then + local p = s1.from:clone() + p:moveTowards(s1.to, t) + return { { time = t, point = p } } + end end elseif s1.action == 'lineto' and s2.action == 'curveto' then intersect_curves (0, 1, - s1.from.x, s1.from.y, - s1.from.x*2/3+s1.to.x*1/3, s1.from.y*2/3+s1.to.y*1/3, - s1.from.x*1/3+s1.to.x*2/3, s1.from.y*1/3+s1.to.y*2/3, - s1.to.x, s1.to.y, - s2.from.x, s2.from.y, - s2.support_1.x, s2.support_1.y, - s2.support_2.x, s2.support_2.y, - s2.to.x, s2.to.y, - r) + s1.from.x, s1.from.y, + s1.from.x*2/3+s1.to.x*1/3, s1.from.y*2/3+s1.to.y*1/3, + s1.from.x*1/3+s1.to.x*2/3, s1.from.y*1/3+s1.to.y*2/3, + s1.to.x, s1.to.y, + s2.from.x, s2.from.y, + s2.support_1.x, s2.support_1.y, + s2.support_2.x, s2.support_2.y, + s2.to.x, s2.to.y, + r) elseif s1.action == 'curveto' and s2.action == 'lineto' then intersect_curves (0, 1, - s1.from.x, s1.from.y, - s1.support_1.x, s1.support_1.y, - s1.support_2.x, s1.support_2.y, - s1.to.x, s1.to.y, - s2.from.x, s2.from.y, - s2.from.x*2/3+s2.to.x*1/3, s2.from.y*2/3+s2.to.y*1/3, - s2.from.x*1/3+s2.to.x*2/3, s2.from.y*1/3+s2.to.y*2/3, - s2.to.x, s2.to.y, - r) + s1.from.x, s1.from.y, + s1.support_1.x, s1.support_1.y, + s1.support_2.x, s1.support_2.y, + s1.to.x, s1.to.y, + s2.from.x, s2.from.y, + s2.from.x*2/3+s2.to.x*1/3, s2.from.y*2/3+s2.to.y*1/3, + s2.from.x*1/3+s2.to.x*2/3, s2.from.y*1/3+s2.to.y*2/3, + s2.to.x, s2.to.y, + r) else intersect_curves (0, 1, - s1.from.x, s1.from.y, - s1.support_1.x, s1.support_1.y, - s1.support_2.x, s1.support_2.y, - s1.to.x, s1.to.y, - s2.from.x, s2.from.y, - s2.support_1.x, s2.support_1.y, - s2.support_2.x, s2.support_2.y, - s2.to.x, s2.to.y, - r) + s1.from.x, s1.from.y, + s1.support_1.x, s1.support_1.y, + s1.support_2.x, s1.support_2.y, + s1.to.x, s1.to.y, + s2.from.x, s2.from.y, + s2.support_1.x, s2.support_1.y, + s2.support_2.x, s2.support_2.y, + s2.to.x, s2.to.y, + r) end return r end - + local function intersect (i1, j1, i2, j2) if i1 > j1 or i2 > j2 then return end - + local bb1 = bb(i1, j1, memo1) local bb2 = bb(i2, j2, memo2) - + if boxes_intersect(bb1, bb2) then -- Ok, need to do something if i1 == j1 and i2 == j2 then - local intersects = intersect_segments (i1, i2) - for _,t in ipairs(intersects) do - intersections[#intersections+1] = { - time = t.time, - index = p1[i1].path_pos, - point = t.point - } - end + local intersects = intersect_segments (i1, i2) + for _,t in ipairs(intersects) do + intersections[#intersections+1] = { + time = t.time, + index = p1[i1].path_pos, + point = t.point + } + end elseif i1 == j1 then - local m2 = math.floor((i2 + j2) / 2) - intersect(i1, j1, i2, m2) - intersect(i1, j1, m2+1, j2) + local m2 = math.floor((i2 + j2) / 2) + intersect(i1, j1, i2, m2) + intersect(i1, j1, m2+1, j2) elseif i2 == j2 then - local m1 = math.floor((i1 + j1) / 2) - intersect(i1, m1, i2, j2) - intersect(m1+1, j1, i2, j2) + local m1 = math.floor((i1 + j1) / 2) + intersect(i1, m1, i2, j2) + intersect(m1+1, j1, i2, j2) else - local m1 = math.floor((i1 + j1) / 2) - local m2 = math.floor((i2 + j2) / 2) - intersect(i1, m1, i2, m2) - intersect(m1+1, j1, i2, m2) - intersect(i1, m1, m2+1, j2) - intersect(m1+1, j1, m2+1, j2) + local m1 = math.floor((i1 + j1) / 2) + local m2 = math.floor((i2 + j2) / 2) + intersect(i1, m1, i2, m2) + intersect(m1+1, j1, i2, m2) + intersect(i1, m1, m2+1, j2) + intersect(m1+1, j1, m2+1, j2) end - end + end end - + -- Run the recursion intersect(1, #p1, 1, #p2) -- Sort table.sort(intersections, function(a,b) - return a.index < b.index or - a.index == b.index and a.time < b.time - end) - + return a.index < b.index or + a.index == b.index and a.time < b.time + end) + -- Remove duplicates local remains = {} remains[1] = intersections[1] @@ -609,15 +608,15 @@ end function boxes_intersect (bb1, bb2) return (bb1.max_x >= bb2.min_x - eps*eps and - bb1.min_x <= bb2.max_x + eps*eps and - bb1.max_y >= bb2.min_y - eps*eps and - bb1.min_y <= bb2.max_y + eps*eps) + bb1.min_x <= bb2.max_x + eps*eps and + bb1.max_y >= bb2.min_y - eps*eps and + bb1.min_y <= bb2.max_y + eps*eps) end -- Turns a path into a sequence of segments, each being either a -- lineto or a curveto from some point to another point. It also sets --- up a memorization array for the bounding boxes. +-- up a memoization array for the bounding boxes. function segmentize (path) @@ -628,20 +627,20 @@ function segmentize (path) local i = 1 while i <= #path do local x = path[i] - + if x == "lineto" then x = rigid(path[i+1]) s [#s + 1] = { - path_pos = i, - action = "lineto", - from = prev, - to = x, - bb = { - min_x = math.min(prev.x, x.x), - max_x = math.max(prev.x, x.x), - min_y = math.min(prev.y, x.y), - max_y = math.max(prev.y, x.y), - } + path_pos = i, + action = "lineto", + from = prev, + to = x, + bb = { + min_x = math.min(prev.x, x.x), + max_x = math.max(prev.x, x.x), + min_y = math.min(prev.y, x.y), + max_y = math.max(prev.y, x.y), + } } prev = x i = i + 2 @@ -651,16 +650,16 @@ function segmentize (path) i = i + 2 elseif x == "closepath" then s [#s + 1] = { - path_pos = i, - action = "lineto", - from = prev, - to = start, - bb = { - min_x = math.min(prev.x, start.x), - max_x = math.max(prev.x, start.x), - min_y = math.min(prev.y, start.y), - max_y = math.max(prev.y, start.y), - } + path_pos = i, + action = "lineto", + from = prev, + to = start, + bb = { + min_x = math.min(prev.x, start.x), + max_x = math.max(prev.x, start.x), + min_y = math.min(prev.y, start.y), + max_y = math.max(prev.y, start.y), + } } prev = nil start = nil @@ -668,18 +667,18 @@ function segmentize (path) elseif x == "curveto" then local s1, s2, to = rigid(path[i+1]), rigid(path[i+2]), rigid(path[i+3]) s [#s + 1] = { - action = "curveto", - path_pos = i, - from = prev, - to = to, - support_1 = s1, - support_2 = s2, - bb = { - min_x = math.min(prev.x, s1.x, s2.x, to.x), - max_x = math.max(prev.x, s1.x, s2.x, to.x), - min_y = math.min(prev.y, s1.y, s2.y, to.y), - max_y = math.max(prev.y, s1.y, s2.y, to.y), - } + action = "curveto", + path_pos = i, + from = prev, + to = to, + support_1 = s1, + support_2 = s2, + bb = { + min_x = math.min(prev.x, s1.x, s2.x, to.x), + max_x = math.max(prev.x, s1.x, s2.x, to.x), + min_y = math.min(prev.y, s1.y, s2.y, to.y), + max_y = math.max(prev.y, s1.y, s2.y, to.y), + } } prev = path[i+3] i = i + 4 @@ -693,16 +692,16 @@ end function prepare_memo (s) - + local memo = {} - + memo.base = #s - + -- Fill memo table for i,e in ipairs (s) do memo[i*#s + i] = e.bb end - + return memo end @@ -713,8 +712,8 @@ end function bb (i, j, memo) local b = memo[memo.base*i + j] if not b then - assert (i < j, "memorization table filled incorrectly") - + assert (i < j, "memoization table filled incorrectly") + local mid = math.floor((i+j)/2) local bb1 = bb (i, mid, memo) local bb2 = bb (mid+1, j, memo) @@ -726,21 +725,21 @@ function bb (i, j, memo) } memo[memo.base*i + j] = b end - + return b end --- Intersect two Bézier curves. +-- Intersect two Bezier curves. function intersect_curves(t0, t1, - c1_ax, c1_ay, c1_bx, c1_by, - c1_cx, c1_cy, c1_dx, c1_dy, - c2_ax, c2_ay, c2_bx, c2_by, - c2_cx, c2_cy, c2_dx, c2_dy, - intersections) - + c1_ax, c1_ay, c1_bx, c1_by, + c1_cx, c1_cy, c1_dx, c1_dy, + c2_ax, c2_ay, c2_bx, c2_by, + c2_cx, c2_cy, c2_dx, c2_dy, + intersections) + -- Only do something, if the bounding boxes intersect: local c1_min_x = math.min(c1_ax, c1_bx, c1_cx, c1_dx) local c1_max_x = math.max(c1_ax, c1_bx, c1_cx, c1_dx) @@ -750,12 +749,12 @@ function intersect_curves(t0, t1, local c2_max_x = math.max(c2_ax, c2_bx, c2_cx, c2_dx) local c2_min_y = math.min(c2_ay, c2_by, c2_cy, c2_dy) local c2_max_y = math.max(c2_ay, c2_by, c2_cy, c2_dy) - + if c1_max_x >= c2_min_x and c1_min_x <= c2_max_x and c1_max_y >= c2_min_y and - c1_min_y <= c2_max_y then - + c1_min_y <= c2_max_y then + -- Everything "near together"? if c1_max_x - c1_min_x < eps and c1_max_y - c1_min_y < eps then @@ -766,57 +765,57 @@ function intersect_curves(t0, t1, local d = c2_dy - c2_ay local e = c1_ay - c1_dy local f = c2_ay - c1_ay - + local det = a*e - b*d local t - + t = (c*d - a*f)/det if t<0 then - t=0 + t=0 elseif t>1 then - t=1 + t=1 end intersections [#intersections + 1] = { - time = t0 + t*(t1-t0), - point = Coordinate.new(c1_ax + t*(c1_dx-c1_ax), c1_ay+t*(c1_dy-c1_ay)) + time = t0 + t*(t1-t0), + point = Coordinate.new(c1_ax + t*(c1_dx-c1_ax), c1_ay+t*(c1_dy-c1_ay)) } else -- Cut 'em in half! local c1_ex, c1_ey = (c1_ax + c1_bx)/2, (c1_ay + c1_by)/2 local c1_fx, c1_fy = (c1_bx + c1_cx)/2, (c1_by + c1_cy)/2 local c1_gx, c1_gy = (c1_cx + c1_dx)/2, (c1_cy + c1_dy)/2 - + local c1_hx, c1_hy = (c1_ex + c1_fx)/2, (c1_ey + c1_fy)/2 local c1_ix, c1_iy = (c1_fx + c1_gx)/2, (c1_fy + c1_gy)/2 - + local c1_jx, c1_jy = (c1_hx + c1_ix)/2, (c1_hy + c1_iy)/2 - + local c2_ex, c2_ey = (c2_ax + c2_bx)/2, (c2_ay + c2_by)/2 local c2_fx, c2_fy = (c2_bx + c2_cx)/2, (c2_by + c2_cy)/2 local c2_gx, c2_gy = (c2_cx + c2_dx)/2, (c2_cy + c2_dy)/2 - + local c2_hx, c2_hy = (c2_ex + c2_fx)/2, (c2_ey + c2_fy)/2 local c2_ix, c2_iy = (c2_fx + c2_gx)/2, (c2_fy + c2_gy)/2 - + local c2_jx, c2_jy = (c2_hx + c2_ix)/2, (c2_hy + c2_iy)/2 intersect_curves (t0, (t0+t1)/2, - c1_ax, c1_ay, c1_ex, c1_ey, c1_hx, c1_hy, c1_jx, c1_jy, - c2_ax, c2_ay, c2_ex, c2_ey, c2_hx, c2_hy, c2_jx, c2_jy, - intersections) + c1_ax, c1_ay, c1_ex, c1_ey, c1_hx, c1_hy, c1_jx, c1_jy, + c2_ax, c2_ay, c2_ex, c2_ey, c2_hx, c2_hy, c2_jx, c2_jy, + intersections) intersect_curves (t0, (t0+t1)/2, - c1_ax, c1_ay, c1_ex, c1_ey, c1_hx, c1_hy, c1_jx, c1_jy, - c2_jx, c2_jy, c2_ix, c2_iy, c2_gx, c2_gy, c2_dx, c2_dy, - intersections) + c1_ax, c1_ay, c1_ex, c1_ey, c1_hx, c1_hy, c1_jx, c1_jy, + c2_jx, c2_jy, c2_ix, c2_iy, c2_gx, c2_gy, c2_dx, c2_dy, + intersections) intersect_curves ((t0+t1)/2, t1, - c1_jx, c1_jy, c1_ix, c1_iy, c1_gx, c1_gy, c1_dx, c1_dy, - c2_ax, c2_ay, c2_ex, c2_ey, c2_hx, c2_hy, c2_jx, c2_jy, - intersections) + c1_jx, c1_jy, c1_ix, c1_iy, c1_gx, c1_gy, c1_dx, c1_dy, + c2_ax, c2_ay, c2_ex, c2_ey, c2_hx, c2_hy, c2_jx, c2_jy, + intersections) intersect_curves ((t0+t1)/2, t1, - c1_jx, c1_jy, c1_ix, c1_iy, c1_gx, c1_gy, c1_dx, c1_dy, - c2_jx, c2_jy, c2_ix, c2_iy, c2_gx, c2_gy, c2_dx, c2_dy, - intersections) + c1_jx, c1_jy, c1_ix, c1_iy, c1_gx, c1_gy, c1_dx, c1_dy, + c2_jx, c2_jy, c2_ix, c2_iy, c2_gx, c2_gy, c2_dx, c2_dy, + intersections) end end end @@ -829,30 +828,30 @@ end -- segment and everything in the segment before the given time is -- removed from the path. -- --- @param index The index of a path segment. +-- @param index The index of a path segment. -- @param time A time along the specified path segment. function Path:cutAtBeginning(index, time) - + local cut_path = Path:new () - + -- Ok, first, we need to find the segment *before* the current -- one. Usually, this will be a moveto or a lineto, but things could -- be different. assert (type(self[index-1]) == "table" or type(self[index-1]) == "function", - "segment before intersection does not end with a coordinate") + "segment before intersection does not end with a coordinate") local from = rigid(self[index-1]) local action = self[index] - + -- Now, depending on the type of segment, we do different things: if action == "lineto" then - + -- Ok, compute point: local to = rigid(self[index+1]) from:moveTowards(to, time) - + -- Ok, this is easy: We start with a fresh moveto ... cut_path[1] = "moveto" cut_path[2] = from @@ -889,20 +888,20 @@ function Path:cutAtBeginning(index, time) for i=index+4,#self do cut_path[#cut_path+1] = self[i] end - + elseif action == "closepath" then -- Let us find the start point: - local found + local found for i=index,1,-1 do if self[i] == "moveto" then - -- Bingo: - found = i - break + -- Bingo: + found = i + break end end assert(found, "no moveto found in path") - + local to = rigid(self[found+1]) from:moveTowards(to,time) @@ -935,36 +934,36 @@ end -- Shorten a path at the end. This method works like |cutAtBeginning|, -- only the path is cut at the end. -- --- @param index The index of a path segment. +-- @param index The index of a path segment. -- @param time A time along the specified path segment. function Path:cutAtEnd(index, time) local cut_path = Path:new () - + -- Ok, first, we need to find the segment *before* the current -- one. Usually, this will be a moveto or a lineto, but things could -- be different. assert (type(self[index-1]) == "table" or type(self[index-1]) == "function", - "segment before intersection does not end with a coordinate") + "segment before intersection does not end with a coordinate") local from = rigid(self[index-1]) local action = self[index] - + -- Now, depending on the type of segment, we do different things: if action == "lineto" then - + -- Ok, compute point: local to = rigid(self[index+1]) to:moveTowards(from, 1-time) - + for i=1,index do cut_path[i] = self[i] end cut_path[index+1] = to - + elseif action == "curveto" then - + local s1 = rigid(self[index+1]) local s2 = rigid(self[index+2]) local to = rigid(self[index+3]) @@ -987,20 +986,20 @@ function Path:cutAtEnd(index, time) cut_path[index+1] = s1 cut_path[index+2] = s2 cut_path[index+3] = to - + elseif action == "closepath" then -- Let us find the start point: - local found + local found for i=index,1,-1 do if self[i] == "moveto" then - -- Bingo: - found = i - break + -- Bingo: + found = i + break end end assert(found, "no moveto found in path") - + local to = rigid(self[found+1]:clone()) to:moveTowards(from,1-time) @@ -1029,7 +1028,7 @@ end -- ``Pads'' the path. The idea is the following: Suppose we stroke the -- path with a pen whose width is twice the value |padding|. The outer -- edge of this stroked drawing is now a path by itself. The path will --- be a bit longer and ``larger''. The present function tries to +-- be a bit longer and ``larger.'' The present function tries to -- compute an approximation to this resulting path. -- -- The algorithm used to compute the enlarged part does not necessarily @@ -1041,29 +1040,29 @@ end -- function Path:pad(padding) - + local padded = self:clone() padded:makeRigid() if padding == 0 then return padded end - + -- First, decompose the path into subpaths: local subpaths = {} local subpath = {} local start_index = 1 - + local function closepath(end_index) if #subpath >= 1 then subpath.start_index = start_index subpath.end_index = end_index start_index = end_index + 1 - + local start = 1 if (subpath[#subpath] - subpath[1]):norm() < 0.01 and subpath[2] then - start = 2 - subpath.skipped = subpath[1] + start = 2 + subpath.skipped = subpath[1] end subpath[#subpath + 1] = subpath[start] subpath[#subpath + 1] = subpath[start+1] @@ -1071,11 +1070,11 @@ function Path:pad(padding) subpath = {} end end - + for i,p in ipairs(padded) do if p ~= "closepath" then if type(p) == "table" then - subpath[#subpath + 1] = p + subpath[#subpath + 1] = p end else closepath (i) @@ -1088,7 +1087,7 @@ function Path:pad(padding) local new_coordinates = {} local _,_,_,_,c_x,c_y = Coordinate.boundingBox(subpath) local c = Coordinate.new(c_x,c_y) - + -- Find out the orientation of the path local count = 0 for i=1,#subpath-2 do @@ -1096,19 +1095,19 @@ function Path:pad(padding) local d1 = subpath[i+2] - subpath[i+1] local diff = math.atan2(d2.y,d2.x) - math.atan2(d1.y,d1.x) - + if diff < -math.pi then - count = count + 1 + count = count + 1 elseif diff > math.pi then - count = count - 1 + count = count - 1 end end - + for i=2,#subpath-1 do local p = subpath[i] local d1 = subpath[i] - subpath[i-1] local d2 = subpath[i+1] - subpath[i] - + local orth1 = Coordinate.new(-d1.y, d1.x) local orth2 = Coordinate.new(-d2.y, d2.x) @@ -1116,21 +1115,21 @@ function Path:pad(padding) orth2:normalize() if count < 0 then - orth1:scale(-1) - orth2:scale(-1) + orth1:scale(-1) + orth2:scale(-1) end -- Ok, now we want to compute the intersection of the lines -- perpendicular to p + padding*orth1 and p + padding*orth2: - + local det = orth1.x * orth2.y - orth1.y * orth2.x local c if math.abs(det) < 0.1 then - c = orth1 + orth2 - c:scale(padding/2) + c = orth1 + orth2 + c:scale(padding/2) else - c = Coordinate.new (padding*(orth2.y-orth1.y)/det, padding*(orth1.x-orth2.x)/det) + c = Coordinate.new (padding*(orth2.y-orth1.y)/det, padding*(orth1.x-orth2.x)/det) end new_coordinates[i] = c+p @@ -1147,50 +1146,50 @@ function Path:pad(padding) local p = subpath[1] local new_p = new_coordinates[#subpath-2] p.x = new_p.x - p.y = new_p.y + p.y = new_p.y end - + -- Now, we need to correct the curveto fields: for i=subpath.start_index,subpath.end_index do if self[i] == 'curveto' then - local from = rigid(self[i-1]) - local s1 = rigid(self[i+1]) - local s2 = rigid(self[i+2]) - local to = rigid(self[i+3]) - - local p1x, p1y, _, _, h1x, h1y = - Bezier.atTime(from.x, from.y, s1.x, s1.y, s2.x, s2.y, - to.x, to.y, 1/3) - - local p2x, p2y, _, _, _, _, h2x, h2y = - Bezier.atTime(from.x, from.y, s1.x, s1.y, s2.x, s2.y, - to.x, to.y, 2/3) - - local orth1 = Coordinate.new (p1y - h1y, -(p1x - h1x)) - orth1:normalize() - orth1:scale(-padding) - - local orth2 = Coordinate.new (p2y - h2y, -(p2x - h2x)) - orth2:normalize() - orth2:scale(padding) - - if count < 0 then - orth1:scale(-1) - orth2:scale(-1) - end - - local new_s1, new_s2 = - Bezier.supportsForPointsAtTime(padded[i-1], - Coordinate.new(p1x+orth1.x,p1y+orth1.y), 1/3, - Coordinate.new(p2x+orth2.x,p2y+orth2.y), 2/3, - padded[i+3]) - - padded[i+1] = new_s1 - padded[i+2] = new_s2 + local from = rigid(self[i-1]) + local s1 = rigid(self[i+1]) + local s2 = rigid(self[i+2]) + local to = rigid(self[i+3]) + + local p1x, p1y, _, _, h1x, h1y = + Bezier.atTime(from.x, from.y, s1.x, s1.y, s2.x, s2.y, + to.x, to.y, 1/3) + + local p2x, p2y, _, _, _, _, h2x, h2y = + Bezier.atTime(from.x, from.y, s1.x, s1.y, s2.x, s2.y, + to.x, to.y, 2/3) + + local orth1 = Coordinate.new (p1y - h1y, -(p1x - h1x)) + orth1:normalize() + orth1:scale(-padding) + + local orth2 = Coordinate.new (p2y - h2y, -(p2x - h2x)) + orth2:normalize() + orth2:scale(padding) + + if count < 0 then + orth1:scale(-1) + orth2:scale(-1) + end + + local new_s1, new_s2 = + Bezier.supportsForPointsAtTime(padded[i-1], + Coordinate.new(p1x+orth1.x,p1y+orth1.y), 1/3, + Coordinate.new(p2x+orth2.x,p2y+orth2.y), 2/3, + padded[i+3]) + + padded[i+1] = new_s1 + padded[i+2] = new_s2 end end end - + return padded end @@ -1203,12 +1202,12 @@ end -- the following happens: We first invert the transformation -- and apply it to the start point. Then we compute the arc -- ``normally'', as if no transformation matrix were present. Then we --- apply the transformation matrix to all computed points. +-- apply the transformation matrix to all computed points. -- -- @function Path:appendArc(start_angle,end_angle,radius,trans) -- -- @param start_angle The start angle of the arc. Must be specified in --- degrees. +-- degrees. -- @param end_angle the end angle of the arc. -- @param radius The radius of the circle on which this arc lies. -- @param trans A transformation matrix. If |nil|, the identity @@ -1233,7 +1232,7 @@ Path.appendArc = lib.ondemand("Path_arced", Path, "appendArc") -- of the circle. -- @param clockwise If true, the arc will be clockwise. Otherwise (the -- default, if nothing or |nil| is given), the arc will be counter --- clockwise. +-- clockise. -- @param trans A transformation matrix. If missing, -- the identity matrix is assumed. @@ -1250,7 +1249,7 @@ function Path:__tostring() local i = 1 while i <= #self do local p = self[i] - + if p == "lineto" then r [#r+1] = " -- " .. tostring(rigid(self[i+1])) i = i + 1 @@ -1275,4 +1274,4 @@ end -- Done -return Path +return Path
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/model/Path_arced.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/model/Path_arced.lua index 1875b8d1a50..92dd8ad87ac 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/model/Path_arced.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/model/Path_arced.lua @@ -61,7 +61,7 @@ local function cos_quarter(x) end local function atan2deg(y,x) - + -- Works like atan2, but returns the angle in degrees and, returns -- exactly a multiple of 90 if x or y are zero @@ -80,14 +80,14 @@ local function atan2deg(y,x) else return atan2(y,x) * to_deg end - + end local function subarc (path, startx, starty, start_angle, delta, radius, trans, center_x, center_y) - + local end_angle = start_angle + delta local factor = tan (delta*to_rad/4) * 1.333333333333333333333 * radius - + local s1, c1, s190, c190, s2, c2, s290, c290 if start_angle % 90 == 0 then @@ -103,7 +103,7 @@ local function subarc (path, startx, starty, start_angle, delta, radius, trans, local a2 = end_angle * to_rad s2, c2, s290, c290 = sin(a2), cos(a2), sin(a2-pi_half), cos(a2-pi_half) end - + local lastx, lasty = center_x + c2*radius, center_y + s2*radius path[#path + 1] = "curveto" @@ -116,14 +116,14 @@ local function subarc (path, startx, starty, start_angle, delta, radius, trans, path[#path-1]:apply(trans) path[#path ]:apply(trans) end - + return lastx, lasty, end_angle end local function arc (path, start, start_angle, end_angle, radius, trans, centerx, centery) - + -- @param path is the path object -- @param start is the start coordinate -- @param start_angle is given in degrees @@ -132,65 +132,65 @@ local function arc (path, start, start_angle, end_angle, radius, trans, centerx, -- @param trans is an optional transformation matrix that gets applied to all computed points -- @param centerx optionally: x-part of the center of the circle -- @param centery optionally: y-part of the center of the circle - + local startx, starty = start.x, start.y - + -- Compute center: centerx = centerx or startx - cos(start_angle*to_rad)*radius centery = centery or starty - sin(start_angle*to_rad)*radius - + if start_angle < end_angle then -- First, ensure that the angles are in a reasonable range: start_angle = start_angle % 360 end_angle = end_angle % 360 - + if end_angle <= start_angle then - -- In case the modulo has inadvertently moved the end angle + -- In case the modulo has inadvertedly moved the end angle -- before the start angle: end_angle = end_angle + 360 end - + -- Ok, now create a series of arcs that are at most quarter-cycles: while start_angle < end_angle do if start_angle + 179 < end_angle then - -- Add a quarter cycle: - startx, starty, start_angle = subarc(path, startx, starty, start_angle, 90, radius, trans, centerx, centery) + -- Add a quarter cycle: + startx, starty, start_angle = subarc(path, startx, starty, start_angle, 90, radius, trans, centerx, centery) elseif start_angle + 90 < end_angle then - -- Add 60 degrees to ensure that there are no small segments - -- at the end - startx, starty, start_angle = subarc(path, startx, starty, start_angle, (end_angle-start_angle)/2, radius, trans, centerx, centery) + -- Add 60 degrees to ensure that there are no small segments + -- at the end + startx, starty, start_angle = subarc(path, startx, starty, start_angle, (end_angle-start_angle)/2, radius, trans, centerx, centery) else - subarc(path, startx, starty, start_angle, end_angle - start_angle, radius, trans, centerx, centery) - break + subarc(path, startx, starty, start_angle, end_angle - start_angle, radius, trans, centerx, centery) + break end end - + elseif start_angle > end_angle then -- First, ensure that the angles are in a reasonable range: start_angle = start_angle % 360 end_angle = end_angle % 360 - + if end_angle >= start_angle then -- In case the modulo has inadvertedly moved the end angle -- before the start angle: end_angle = end_angle - 360 end - + -- Ok, now create a series of arcs that are at most quarter-cycles: while start_angle > end_angle do if start_angle - 179 > end_angle then - -- Add a quarter cycle: - startx, starty, start_angle = subarc(path, startx, starty, start_angle, -90, radius, trans, centerx, centery) + -- Add a quarter cycle: + startx, starty, start_angle = subarc(path, startx, starty, start_angle, -90, radius, trans, centerx, centery) elseif start_angle - 90 > end_angle then - -- Add 60 degrees to ensure that there are no small segments - -- at the end - startx, starty, start_angle = subarc(path, startx, starty, start_angle, (end_angle-start_angle)/2, radius, trans, centerx, centery) + -- Add 60 degrees to ensure that there are no small segments + -- at the end + startx, starty, start_angle = subarc(path, startx, starty, start_angle, (end_angle-start_angle)/2, radius, trans, centerx, centery) else - subarc(path, startx, starty, start_angle, end_angle - start_angle, radius, trans, centerx, centery) - break + subarc(path, startx, starty, start_angle, end_angle - start_angle, radius, trans, centerx, centery) + break end end - + -- else, do nothing end end @@ -199,10 +199,10 @@ end -- Doc see Path.lua function Path:appendArc(start_angle,end_angle,radius, trans) - + local start = rigid(self[#self]) assert(type(start) == "table", "trying to append an arc to a path that does not end with a coordinate") - + if trans then start = start:clone() start:apply(Transform.invert(trans)) @@ -223,13 +223,13 @@ function Path:appendArcTo (target, radius_or_center, clockwise, trans) local trans_target = target local centerx, centery, radius - + if type(radius_or_center) == "number" then radius = radius_or_center else centerx, centery = radius_or_center.x, radius_or_center.y end - + if trans then start = start:clone() trans_target = target:clone() @@ -242,56 +242,56 @@ function Path:appendArcTo (target, radius_or_center, clockwise, trans) centerx, centery = t.x, t.y end end - + if not centerx then -- Compute center local dx, dy = target.x - start.x, target.y - start.y if abs(dx) == abs(dy) and abs(dx) == radius then if (dx < 0 and dy < 0) or (dx > 0 and dy > 0) then - centerx = start.x - centery = trans_target.y + centerx = start.x + centery = trans_target.y else - centerx = trans_target.x - centery = start.y + centerx = trans_target.x + centery = start.y end else local l_sq = dx*dx + dy*dy if l_sq >= radius*radius*4*0.999999 then - centerx = (start.x+trans_target.x) / 2 - centery = (start.y+trans_target.y) / 2 - assert(l_sq <= radius*radius*4/0.999999, "radius too small for arc") + centerx = (start.x+trans_target.x) / 2 + centery = (start.y+trans_target.y) / 2 + assert(l_sq <= radius*radius*4/0.999999, "radius too small for arc") else -- Normalize - local l = sqrt(l_sq) - local nx = dx / l - local ny = dy / l - - local e = sqrt(radius*radius - 0.25*l_sq) - - centerx = start.x + 0.5*dx - ny*e - centery = start.y + 0.5*dy + nx*e + local l = sqrt(l_sq) + local nx = dx / l + local ny = dy / l + + local e = sqrt(radius*radius - 0.25*l_sq) + + centerx = start.x + 0.5*dx - ny*e + centery = start.y + 0.5*dy + nx*e end end end - + local start_dx, start_dy, target_dx, target_dy = start.x - centerx, start.y - centery, trans_target.x - centerx, trans_target.y - centery - + if not radius then -- Center is given, compute radius: radius_sq = start_dx^2 + start_dy^2 -- Ensure that the circle is, indeed, centered: assert (abs(target_dx^2 + target_dy^2 - radius_sq)/radius_sq < 1e-5, "attempting to add an arc with incorrect center") - + radius = sqrt(radius_sq) end -- Compute start and end angle: - local start_angle = atan2deg(start_dy, start_dx) - local end_angle = atan2deg(target_dy, target_dx) + local start_angle = atan2deg(start_dy, start_dx) + local end_angle = atan2deg(target_dy, target_dx) if clockwise then if end_angle > start_angle then @@ -302,7 +302,7 @@ function Path:appendArcTo (target, radius_or_center, clockwise, trans) end_angle = end_angle + 360 end end - + arc (self, start, start_angle, end_angle, radius, trans, centerx, centery) -- Patch last point to avoid rounding problems: @@ -313,4 +313,4 @@ end -- Done -return true +return true
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/model/Vertex.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/model/Vertex.lua index 677ea4fbd06..c287181992f 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/model/Vertex.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/model/Vertex.lua @@ -39,12 +39,12 @@ -- path lives in a special ``local'' coordinate system, that is, all -- coordinates of this path should actually be considered relative to -- the vertex' |pos| field. Note that the path is typically, but not --- always, ``centered'' on the origin. A graph drawing algorithm +-- alwyas, ``centered'' on the origin. A graph drawing algorithm -- should arrange the vertices in such a way that the origins in the -- path coordinate systems are aligned. -- -- To illustrate the difference between the origin and the vertex --- center, consider a tree drawing algorithm in which a node |root| has +-- center, conside a tree drawing algorithm in which a node |root| has -- three children |a|, |b|, and |g|. Now, if we were to simply center -- these three letters vertically and arrange them in a line, the -- letters would appear to ``jump up and down'' since the height of @@ -100,7 +100,7 @@ -- |options|, which must be a table of the same syntax as the -- |options| field. For the |entries| array, each element must be -- table with two field: |t| must be set to a number, representing a --- time in seconds, and |value|, which must be set to a value that +-- time in secondds, and |value|, which must be set to a value that -- the |attribute| should have at the given time. The entries and the -- options will then be interpreted as described in \pgfname's basic -- layer animation system, except that where a |\pgfpoint| is expected @@ -207,29 +207,29 @@ local anchor_cache = Storage.new () local directions = { north = function(min_x, min_y, max_x, max_y) - return (min_x+max_x)/2, max_y - end, + return (min_x+max_x)/2, max_y + end, south = function(min_x, min_y, max_x, max_y) - return (min_x+max_x)/2, min_y - end, + return (min_x+max_x)/2, min_y + end, east = function(min_x, min_y, max_x, max_y) - return max_x, (min_y+max_y)/2 - end, + return max_x, (min_y+max_y)/2 + end, west = function(min_x, min_y, max_x, max_y) - return min_x, (min_y+max_y)/2 - end, + return min_x, (min_y+max_y)/2 + end, ["north west"] = function(min_x, min_y, max_x, max_y) - return min_x, max_y - end, + return min_x, max_y + end, ["north east"] = function(min_x, min_y, max_x, max_y) - return max_x, max_y - end, + return max_x, max_y + end, ["south west"] = function(min_x, min_y, max_x, max_y) - return min_x, min_y - end, + return min_x, min_y + end, ["south east"] = function(min_x, min_y, max_x, max_y) - return max_x, min_y - end, + return max_x, min_y + end, } --- @@ -260,10 +260,10 @@ function Vertex:anchor(anchor) else local n = tonumber(anchor) if n then - local x1, y1, x2, y2 = self:boundingBox() - local r = math.max(x2-x1, y2-y1) - b = Coordinate.new(r*math.cos(n/180*math.pi),r*math.sin(n/180*math.pi)) - b:shiftByCoordinate(self.anchors.center) + local x1, y1, x2, y2 = self:boundingBox() + local r = math.max(x2-x1, y2-y1) + b = Coordinate.new(r*math.cos(n/180*math.pi),r*math.sin(n/180*math.pi)) + b:shiftByCoordinate(self.anchors.center) end end if not b then diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/pedigrees/Koerner2015.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/pedigrees/Koerner2015.lua index 32927530a29..df366a31687 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/pedigrees/Koerner2015.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/pedigrees/Koerner2015.lua @@ -29,9 +29,9 @@ local declare = InterfaceToAlgorithms.declare declare { key = "mate", type = "boolean", - - summary = [[" - Edges of type |mate| join mates. + + summary = [[" + Edges of type |mate| join mates. "]], } @@ -41,51 +41,50 @@ declare { key = "child", type = "boolean", - summary = [[" - Edges of type |child| join a parent to a child. The parent is the tail - of the edge, the child is the head. + summary = [[" + Edges of type |child| join a parent to a child. The parent is the tail of the edge, the child is the head. "]], } - + --- declare { key = "sibling", type = "boolean", - summary = [[" - Edges of type |sibling| join a siblings (persons with identical parents). + summary = [[" + Edges of type |sibling| join a siblings (persons with identical parents). "]], } - + --- declare { key = "simple pedigree layout", algorithm = Koerner2015, - + postconditions = { upward_oriented = true }, - summary = [[" - A simple algorithm for drawing a pedigree. + summary = [[" + A simple algorithm for drawing a pedigree. "]], documentation = [[" ... "]], examples = [[" - \tikz \graph [simple pedigree layout, default edge operator=complete bipartite] - { - Eve -- [mate] Felix; - { Eve, Felix } -> [child] { George, Hank }; - - Alice -- [mate] Bob; - { Alice, Bob } -> [child] { Charly, Dave, Eve }; - }; + \tikz \graph [simple pedigree layout, default edge operator=complete bipartite] + { + Eve -- [mate] Felix; + { Eve, Felix } -> [child] { George, Hank }; + + Alice -- [mate] Bob; + { Alice, Bob } -> [child] { Charly, Dave, Eve }; + }; "]] } - - + + function Koerner2015:run() local g = self.digraph @@ -94,9 +93,9 @@ function Koerner2015:run() local visited = {} local ranks = {} - + local queue = { { g.vertices[1], 1 } } - + local queue_start = 1 local queue_end = 1 @@ -111,51 +110,51 @@ function Koerner2015:run() queue_start = queue_start + 1 return v,r end - + while queue_start <= queue_end do -- Pop local v, rank = get() ranks[v] = rank - + visited [v] = true -- Follow mates: for _,a in ipairs(g:outgoing(v)) do if a:options("sibling") then - if not visited[a.head] then - put(a.head, rank) - end + if not visited[a.head] then + put(a.head, rank) + end end end for _,a in ipairs(g:incoming(v)) do if a:options("child") then - if not visited[a.tail] then - put(a.tail, rank-1) - end + if not visited[a.tail] then + put(a.tail, rank-1) + end end end for _,a in ipairs(g:outgoing(v)) do if a:options("child") then - if not visited[a.head] then - put(a.head, rank+1) - end + if not visited[a.head] then + put(a.head, rank+1) + end end end for _,a in ipairs(g:outgoing(v)) do if a:options("mate") then - if not visited[a.head] then - put(a.head, rank) - end + if not visited[a.head] then + put(a.head, rank) + end end end end - + for i,v in ipairs(g.vertices) do v.pos.x = i*50 v.pos.y = ranks[v] * 50 end - + end return Koerner2015 diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/AuthorDefinedPhylogeny.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/AuthorDefinedPhylogeny.lua index 04e1ca49f1a..f1acbd71281 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/AuthorDefinedPhylogeny.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/AuthorDefinedPhylogeny.lua @@ -34,22 +34,22 @@ declare { phase_default = true, summary = [[" - When this key is used, the phylogenetic tree must be specified - by the author (rather than being generated algorithmically). + When this key is used, the phylogenetic tree must be specified + by the author (rather than being generated algorithmically). "]], documentation = [[" - A spanning tree of the input graph will be computed first (it - must be connected, otherwise errors will result). - The evolutionary length of the edges must be specified through - the use of the |length| key for each edge. + A spanning tree of the input graph will be computed first (it + must be connected, otherwise errors will result). + The evolutionary length of the edges must be specified through + the use of the |length| key for each edge. "]], examples = [[" - \tikz \graph [phylogenetic tree layout] { - a -- { - b [>length=2] --[length=1] { c, d }, - e [>length=3] - } - }; + \tikz \graph [phylogenetic tree layout] { + a -- { + b [>length=2] --[length=1] { c, d }, + e [>length=3] + } + }; "]] } diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/BalancedMinimumEvolution.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/BalancedMinimumEvolution.lua index ef40f0ee60d..d2b64270796 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/BalancedMinimumEvolution.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/BalancedMinimumEvolution.lua @@ -34,44 +34,44 @@ declare { algorithm = BalancedMinimumEvolution, phase = "phylogenetic tree generation", - summary = [[" - The BME (Balanced Minimum Evolution) algorithm tries to minimize - the total tree length. + summary = [[" + The BME (Balanced Minimum Evolution) algorithm tries to minimize + the total tree length. "]], documentation = [[" - This algorithm is from Desper and Gascuel, \emph{Fast and - Accurate Phylogeny Reconstruction Algorithms Based on the - Minimum-Evolution Principle}, 2002. The tree is built in a way - that minimizes the total tree length. The leaves are inserted - into the tree one after another, creating new edges and new - nodes. After every insertion the distance matrix has to be - updated. + This algorithm is from Desper and Gascuel, \emph{Fast and + Accurate Phylogeny Reconstruction Algorithms Based on the + Minimum-Evolution Principle}, 2002. The tree is built in a way + that minimizes the total tree length. The leaves are inserted + into the tree one after another, creating new edges and new + nodes. After every insertion the distance matrix has to be + updated. "]], examples = [[" - \tikz \graph [phylogenetic tree layout, - balanced minimum evolution, - grow'=right, sibling distance=0pt, - distance matrix={ - 0 4 9 9 9 9 9 - 4 0 9 9 9 9 9 - 9 9 0 2 7 7 7 - 9 9 2 0 7 7 7 - 9 9 7 7 0 3 5 - 9 9 7 7 3 0 5 - 9 9 7 7 5 5 0}] - { a, b, c, d, e, f, g }; + \tikz \graph [phylogenetic tree layout, + balanced minimum evolution, + grow'=right, sibling distance=0pt, + distance matrix={ + 0 4 9 9 9 9 9 + 4 0 9 9 9 9 9 + 9 9 0 2 7 7 7 + 9 9 2 0 7 7 7 + 9 9 7 7 0 3 5 + 9 9 7 7 3 0 5 + 9 9 7 7 5 5 0}] + { a, b, c, d, e, f, g }; "]] } - - - - + + + + function BalancedMinimumEvolution:run() - + self.tree = Digraph.new(self.main_algorithm.digraph) - + self.distances = Storage.newTableStorage() - + local vertices = self.tree.vertices -- Sanity checks: @@ -79,25 +79,25 @@ function BalancedMinimumEvolution:run() self.tree:connect(vertices[1],vertices[2]) return self.tree elseif #vertices > 2 then - + -- Setup storages: self.is_leaf = Storage.new() - + -- First, build the initial distance matrix: local matrix = DistanceMatrix.graphDistanceMatrix(self.tree) - + -- Store distance information in the distance fields of the storages: for _,u in ipairs(vertices) do for _,v in ipairs(vertices) do self.distances[u][v] = matrix[u][v] end end - + -- Run BME self:runBME() -- Run postoptimizations - local optimization_class = self.tree.options.algorithm_phases['phylogenetic tree optimization'] + local optimization_class = self.tree.options.algorithm_phases['phylogenetic tree optimization'] optimization_class.new { main_algorithm = self.main_algorithm, tree = self.tree, @@ -106,11 +106,11 @@ function BalancedMinimumEvolution:run() is_leaf = self.is_leaf, }:run() end - - -- Finish + + -- Finish self:computeFinalLengths() self:createFinalEdges() - + return self.tree end @@ -119,8 +119,8 @@ end -- the BME (Balanced Minimum Evolution) algorithm -- [DESPER and GASCUEL: Fast and Accurate Phylogeny Reconstruction --- Algorithms Based on the Minimum-Evolution Principle, 2002] --- +-- Algorithms Based on the Minimum-Evolution Principle, 2002] +-- -- The tree is built in a way that minimizes the total tree length. -- The leaves are inserted into the tree one after another, creating new edges and new nodes. -- After every insertion the distance matrix has to be updated. @@ -129,14 +129,14 @@ function BalancedMinimumEvolution:runBME() local leaves = {} local is_leaf = self.is_leaf local distances = self.distances - + -- get user input for i, vertex in ipairs (g.vertices) do leaves[i] = vertex is_leaf[vertex] = true end - -- create the new node which will be connected to the first three leaves + -- create the new node which will be connected to the first three leaves local new_node = InterfaceToAlgorithms.createVertex( self.main_algorithm, { @@ -147,12 +147,12 @@ function BalancedMinimumEvolution:runBME() g:add {new_node} -- set the distances of new_node to subtrees local distance_1_2 = self:distance(leaves[1],leaves[2]) - local distance_1_3 = self:distance(leaves[1],leaves[3]) - local distance_2_3 = self:distance(leaves[2],leaves[3]) + local distance_1_3 = self:distance(leaves[1],leaves[3]) + local distance_2_3 = self:distance(leaves[2],leaves[3]) distances[new_node][leaves[1]] = 0.5*(distance_1_2 + distance_1_3) - distances[new_node][leaves[2]] = 0.5*(distance_1_2 + distance_2_3) - distances[new_node][leaves[3]] = 0.5*(distance_1_3 + distance_2_3) - + distances[new_node][leaves[2]] = 0.5*(distance_1_2 + distance_2_3) + distances[new_node][leaves[3]] = 0.5*(distance_1_3 + distance_2_3) + --connect the first three leaves to the new node for i = 1,3 do g:connect(new_node, leaves[i]) @@ -166,7 +166,7 @@ function BalancedMinimumEvolution:runBME() -- note that the function called stores the k_dists before they are overwritten self:computeAverageDistancesToAllSubtreesForK(g.vertices[i], { }, k,k_dists) end - + -- find the best insertion point local best_arc = self:findBestEdge(g.vertices[1],nil,k_dists) local head = best_arc.head @@ -175,8 +175,8 @@ function BalancedMinimumEvolution:runBME() -- remove the old arc g:disconnect(tail, head) g:disconnect(head, tail) - - -- create the new node + + -- create the new node local new_node = InterfaceToAlgorithms.createVertex( self.main_algorithm, { @@ -187,28 +187,28 @@ function BalancedMinimumEvolution:runBME() } ) g:add{new_node} - + -- gather the vertices that will be connected to the new node... local vertices_to_connect = { head, tail, leaves[k] } - + -- ...and connect them for _, vertex in pairs (vertices_to_connect) do g:connect(new_node, vertex) g:connect(vertex, new_node) end - + if not is_leaf[tail] then - distances[leaves[k]][tail] = k_dists[head][tail] + distances[leaves[k]][tail] = k_dists[head][tail] end if not is_leaf[head] then - distances[leaves[k]][head] = k_dists[tail][head] + distances[leaves[k]][head] = k_dists[tail][head] end -- insert distances from k to subtrees into actual matrix... self:setAccurateDistancesForK(new_node,nil,k,k_dists,leaves) - + -- set the distance from k to the new node, which was created by inserting k into the graph - distances[leaves[k]][new_node] = 0.5*( self:distance(leaves[k], head) + self:distance(leaves[k],tail)) - + distances[leaves[k]][new_node] = 0.5*( self:distance(leaves[k], head) + self:distance(leaves[k],tail)) + -- update the average distances local values = {} values.s = head -- s--u is the arc into which k has been inserted @@ -218,9 +218,9 @@ function BalancedMinimumEvolution:runBME() end end --- +-- -- Updates the average distances from k to all subtrees --- +-- -- @param vertex The starting point of the recursion -- @param values The values needed for the recursion -- - s, u The nodes which span the edge into which k has been @@ -228,27 +228,27 @@ end -- - new_node The new_node which has been created to insert k -- - l (l-1) is the number of edges between the -- new_node and the current subtree Y --- +-- -- values.new_node, values.u and values.s must be set -- the depth first search must begin at the new node, thus vertex --- must be set to the newly created node +-- must be set to the newly created node function BalancedMinimumEvolution:updateAverageDistances(vertex, values, k, leaves) local g = self.tree local leaf_k = leaves[k] local y, z, x if not values.visited then values.visited = {} - values.visited[leaf_k] = leaf_k -- we don't want to visit k! + values.visited[leaf_k] = leaf_k -- we don't want to visit k! end -- there are (l-1) edges between new_node and y if not values.l then values.l = 1 end if not values.new_node then values.new_node = g:outgoing(leaf_k)[1].head end --values.s and values.u must be set - + -- the two nodes which connect the edge on which k was inserted: s,u local new_node = values.new_node - local l = values.l + local l = values.l local visited = values.visited visited[vertex] = vertex @@ -258,7 +258,7 @@ function BalancedMinimumEvolution:updateAverageDistances(vertex, values, k, leav local l = values.l local y1= values.y1 - -- calculate distance between Y{k} and X + -- calculate distance between Y{k} and X local old_distance -- the distance between Y{/k} and X needed for calculating the new distance if y == new_node then -- this y didn't exist in the former tree; so use y1 (see below) old_distance = self:distance(x,y1) @@ -269,7 +269,7 @@ function BalancedMinimumEvolution:updateAverageDistances(vertex, values, k, leav local new_distance = old_distance + math.pow(2,-l) * ( self:distance(leaf_k,x) - self:distance(x,y1) ) self.distances[x][y] = new_distance self.distances[y][x] = new_distance -- symmetric matrix - + values.x_visited[x] = x --go deeper to next x for _, x_arc in ipairs (self.tree:outgoing(x)) do @@ -292,7 +292,7 @@ function BalancedMinimumEvolution:updateAverageDistances(vertex, values, k, leav else assert(values.y1,"no y1 set!") end - + z = arc.head -- root of the subtree we're looking at y = arc.tail -- the root of the subtree-complement of Z @@ -300,7 +300,7 @@ function BalancedMinimumEvolution:updateAverageDistances(vertex, values, k, leav values.x_visited = {} values.x_visited[y] = y -- we don't want to go there, as we want to stay within Z loop_over_x( z,y, values ) -- visit all possible subtrees of Z - + -- go to next Z values.l = values.l+1 -- moving further away from the new_node self:updateAverageDistances(z,values,k,leaves) @@ -321,18 +321,18 @@ end -- stored -- - outgoing_arcs The table containing the outgoing arcs -- of the current vertex --- +-- -- @return The average distance of the new node #k to any subtree -- The distances are stored as follows: -- example: distances[center][a] -- center is any vertex, thus if center is an inner vertex --- it has 3 neighbors a,b and c, which can all be seen as the +-- it has 3 neighbours a,b and c, which can all be seen as the -- roots of subtrees A,B,C. -- distances[center][a] gives us the distance of the new -- node k to the subtree A. --- if center is a leaf, it has only one neighbor, which +-- if center is a leaf, it has only one neighbour, which -- can also be seen as the root of the subtree T\{center} --- +-- function BalancedMinimumEvolution:computeAverageDistancesToAllSubtreesForK(vertex, values, k, k_dists) local is_leaf = self.is_leaf local arcs = self.tree.arcs @@ -340,13 +340,13 @@ function BalancedMinimumEvolution:computeAverageDistancesToAllSubtreesForK(verte local center_vertex = vertex -- for every vertex a table is created, in which the distances to all -- its subtrees will be stored - + values.outgoing_arcs = values.outgoing_arcs or self.tree:outgoing(center_vertex) for _, arc in ipairs (values.outgoing_arcs) do local root = arc.head -- this vertex can be seen as the root of a subtree if is_leaf[root] then -- we know the distance of k to the leaf! k_dists[center_vertex][root] = self:distance(vertices[k], root) - else -- to compute the distance we need the root's neighboring vertices, which we can access by its outgoing arcs + else -- to compute the distance we need the root's neighbouring vertices, which we can access by its outgoing arcs local arc1, arc2 local arc_back -- the arc we came from for _, next_arc in ipairs (self.tree:outgoing(root)) do @@ -356,25 +356,25 @@ function BalancedMinimumEvolution:computeAverageDistancesToAllSubtreesForK(verte else arc_back = next_arc end - end - + end + values.outgoing_arcs = { arc1, arc2, arc_back } -- go deeper, if the distances for the next center node haven't been set yet - if not (k_dists[root][arc1.head] and k_dists[root][arc2.head]) then + if not (k_dists[root][arc1.head] and k_dists[root][arc2.head]) then self:computeAverageDistancesToAllSubtreesForK(root, values, k,k_dists) end - + -- set the distance between k and subtree - k_dists[center_vertex][root] = 1/2 * (k_dists[root][arc1.head] + k_dists[root][arc2.head]) - end + k_dists[center_vertex][root] = 1/2 * (k_dists[root][arc1.head] + k_dists[root][arc2.head]) + end end end -- -- Sets the distances from k to subtrees --- In computeAverageDistancesToAllSubtreesForK the distances to ALL possible +-- In computeAverageDistancesToAllSubtreesForK the distances to ALL possbile -- subtrees are computed. Once k is inserted many of those subtrees don't -- exist for k, as k is now part of them. In this function all -- still accurate subtrees and their distances to k are @@ -386,7 +386,7 @@ end function BalancedMinimumEvolution:setAccurateDistancesForK(center,visited,k,k_dists,leaves) local visited = visited or {} local distances = self.distances - + visited[center] = center local outgoings = self.tree:outgoing(center) for _,arc in ipairs (outgoings) do @@ -395,11 +395,11 @@ function BalancedMinimumEvolution:setAccurateDistancesForK(center,visited,k,k_di local distance -- set the distance if not distances[leaves[k]][vertex] and k_dists[center] then - distance = k_dists[center][vertex] -- use previously calculated distance + distance = k_dists[center][vertex] -- use previously calculated distance distances[leaves[k]][vertex] = distance distances[vertex][leaves[k]] = distance end - -- go deeper + -- go deeper if not visited[vertex] then self:setAccurateDistancesForK(vertex,visited,k,k_dists,leaves) end @@ -419,7 +419,7 @@ end -- - visited: The vertices that already have been visited -- - tree_length: The current tree_length -- - best_arc: The current best_arc, such that the tree --- length is minimized +-- length is minimzed -- - min_length: The smallest tree_length found so far function BalancedMinimumEvolution:findBestEdge(vertex, values, k_dists) local arcs = self.tree.arcs @@ -437,9 +437,9 @@ function BalancedMinimumEvolution:findBestEdge(vertex, values, k_dists) c = arc.head --last visited arc end end - + for i, arc in ipairs (unvisited_arcs) do - local change_in_tree_length = 0 + local change_in_tree_length = 0 -- set tree length to 0 for first insertion arc if not values.tree_length then values.tree_length = 0 @@ -456,15 +456,15 @@ function BalancedMinimumEvolution:findBestEdge(vertex, values, k_dists) values.tree_length = values.tree_length + change_in_tree_length end -- if the tree length becomes shorter, this is the new best arc - -- for the insertion of leaf k + -- for the insertion of leaf k if values.tree_length < values.min_length then values.best_arc = arc values.min_length = values.tree_length end - + -- go deeper self:findBestEdge(arc.head, values, k_dists) - + values.tree_length = values.tree_length - change_in_tree_length end return values.best_arc @@ -527,7 +527,7 @@ function BalancedMinimumEvolution:distance(a, b) else local distances = self.distances return distances[a][b] or distances[b][a] - end + end end @@ -543,7 +543,7 @@ function BalancedMinimumEvolution:computeFinalLengths() for _, arc in ipairs(g.arcs) do local head = arc.head local tail = arc.tail - local distance + local distance local a,b,c,d -- assert, that the length hasn't already been computed for this arc if not lengths[head][tail] then diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/BalancedNearestNeighbourInterchange.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/BalancedNearestNeighbourInterchange.lua index 1980afe7ad0..8077790224a 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/BalancedNearestNeighbourInterchange.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/BalancedNearestNeighbourInterchange.lua @@ -25,7 +25,7 @@ local lib = require("pgf.gd.lib") -- Shorthand: local declare = InterfaceToAlgorithms.declare - + --- declare { key = "balanced nearest neighbour interchange", @@ -33,45 +33,45 @@ declare { phase = "phylogenetic tree optimization", phase_default = true, - summary = [[" - The BNNI (Balanced Nearest Neighbor Interchange) is a - postprocessing algorithm for phylogenetic trees. It swaps two - distant 3-subtrees if the total tree length is reduced by doing - so, until no such swaps are left. + summary = [[" + The BNNI (Balanced Nearest Neighbour Interchange) is a + postprocessing algorithm for phylogenetic trees. It swaps two + distant 3-subtrees if the total tree length is reduced by doing + so, until no such swaps are left. "]], documentation = [[" - This algorithm is from Desper and Gascuel, \emph{Fast and - Accurate Phylogeny Reconstruction Algorithms Based on the - Minimum-Evolution Principle}, 2002. + This algorithm is from Desper and Gascuel, \emph{Fast and + Accurate Phylogeny Reconstruction Algorithms Based on the + Minimum-Evolution Principle}, 2002. "]] } - + --- declare { key = "no phylogenetic tree optimization", algorithm = { run = function(self) end }, phase = "phylogenetic tree optimization", - summary = [[" - Switches off any phylogenetic tree optimization. + summary = [[" + Switches off any phylogenetic tree optimization. "]], } - - + + -- creates a binary heap, implementation as an array as described in --- the respective wikipedia article +-- the respective wikipedia article local function new_heap() local heap = {} - + function heap:insert(element, value) local object = { element = element, value = value } heap[#heap+1]= object - + local i = #heap local parent = math.floor(i/2) - + -- sort the new object into its correct place while heap[parent] and heap[parent].value < heap[i].value do heap[i] = heap[parent] @@ -80,43 +80,43 @@ local function new_heap() parent = math.floor(i/2) end end - + -- deletes the top element from the heap function heap:remove_top_element() -- replace first element with last and delete the last element local element = heap[1].element heap[1] = heap[#heap] heap[#heap] = nil - + local i = 1 - local left_child = 2*i + local left_child = 2*i local right_child = 2*i +1 -- sort the new top element into its correct place by swapping it -- against its largest child - while heap[left_child] do + while heap[left_child] do local largest_child = left_child if heap[right_child] and heap[left_child].value < heap[right_child].value then - largest_child = right_child + largest_child = right_child end if heap[largest_child].value > heap[i].value then heap[largest_child], heap[i] = heap[i], heap[largest_child] i = largest_child - left_child = 2*i + left_child = 2*i right_child = 2*i +1 - else + else return element end end return element end - return heap + return heap end --- BNNI (Balanced Nearest Neighbor Interchange) +-- BNNI (Balanced Nearest Neighbour Interchange) -- [DESPER and GASCUEL: Fast and Accurate Phylogeny Reconstruction Algorithms Based on the Minimum-Evolution Principle, 2002] -- swaps two distant-3 subtrees if the total tree length is reduced by doing so, until no such swaps are left -- @@ -140,21 +140,21 @@ function BalancedNearestNeighbourInterchange:run() -- achieve best swap and update the distance matrix, until there is -- no more swap to perform - while #possible_swaps > 0 do + while #possible_swaps > 0 do -- get the best swap and delete it from the heap local swap = possible_swaps:remove_top_element() --[part of step 3 (a)] - + -- Check if the indicated swap is still possible. Another swap may -- have interfered. if g:arc(swap.v, swap.subtree1) and g:arc(swap.w, swap.subtree2) and g:arc(swap.v, swap.w) and g:arc(swap.a, swap.v) and g:arc(swap.d, swap.w) then -- insert new arcs and delete the old ones to perform the swap [part of step 3 (a)] - + -- disconnect old arcs g:disconnect(swap.v, swap.subtree1) g:disconnect(swap.subtree1, swap.v) g:disconnect(swap.w, swap.subtree2) g:disconnect(swap.subtree2, swap.w) - + -- connect new arcs g:connect(swap.v, swap.subtree2) g:connect(swap.subtree2, swap.v) @@ -164,7 +164,7 @@ function BalancedNearestNeighbourInterchange:run() --update distance matrix self:updateBNNI(swap) - -- update heap: check neighboring arcs for new possible swaps + -- update heap: check neighbouring arcs for new possible swaps -- [step 3 (e)] self:getBestSwap(g:arc(swap.a,swap.v), possible_swaps) self:getBestSwap(g:arc(swap.subtree2, swap.v), possible_swaps) @@ -179,7 +179,7 @@ end -- -- Gets the distance between two nodes as specified in the distances -- fields. Note: this function assumes that the distance from a to b --- is the +-- is the -- same as the distance from b to a. -- -- @param a,b The nodes @@ -196,11 +196,11 @@ end -- updates the distance matrix after a swap has been performed [step3(b),(c),(d)] -- -- @param swap A table containing the information on the performed swap --- subtree1, subtree2: the two subtrees, which --- were swapped --- a, d: The other two subtrees bordering the --- swapping edge --- v, w : the two nodes connecting the swapping edge +-- subtree1, subtree2: the two subtrees, which +-- were swapped +-- a, d: The other two subtrees bordering the +-- swapping edge +-- v, w : the two nodes connecting the swapping edge function BalancedNearestNeighbourInterchange:updateBNNI(swap) local g = self.tree @@ -211,7 +211,7 @@ function BalancedNearestNeighbourInterchange:updateBNNI(swap) local v = swap.v local w = swap.w local distances = self.distances - + -- updates the distances in one of the four subtrees adjacent to the -- swapping edge function update_BNNI_subtree(swap, values) @@ -222,10 +222,10 @@ function BalancedNearestNeighbourInterchange:updateBNNI(swap) local v = swap.v local d = swap.same local w = swap.w - + if not values then values = { - visited = {[v] = v}, + visited = {[v] = v}, possible_ys = {v}, x = a, y = v @@ -239,16 +239,16 @@ function BalancedNearestNeighbourInterchange:updateBNNI(swap) local y = values.y local ys = values.possible_ys local l = 0 -- number of edges between y and v - + local dist_x_b = self:distance(x,b) local dist_x_c = self:distance(x,c) visited[x] = x --mark current x as visited - + -- loop over possible y's: for _, y in ipairs (ys) do -- update distance [step 3(b)] - local distance = self:distance(x,y) - 2^(-l-2)*dist_x_b + 2^(-l-2)*dist_x_c - + local distance = self:distance(x,y) - 2^(-l-2)*dist_x_b + 2^(-l-2)*dist_x_c + if y == w then y = v end -- the old distance w,x was used for the new distance calculation, but it needs to be -- saved under its appropriate new name according to its new root. this case only arises when looking at x's -- in one of the swapped subtrees (b or c) @@ -257,13 +257,13 @@ function BalancedNearestNeighbourInterchange:updateBNNI(swap) distances[y][x] = distance l = l+1 -- length + 1, as the next y will be further away from v end - + -- update the distance between x and w (root of subtree c and d) -- [step 3(c)] local distance = 1/2 * (self:distance(x,b) + self:distance(x,d)) distances[x][w] = distance distances[w][x] = distance - + -- go to next possible x's table.insert(ys, x) -- when we're at the next possible x, y can also be the current x for _,arc in ipairs (g:outgoing(x)) do @@ -274,13 +274,13 @@ function BalancedNearestNeighbourInterchange:updateBNNI(swap) end end end - + -- name the nodes/subtrees in a general way that allows the use of the function update_BNNI_subtree local update_a = {subtree = a, farther = b, nearer = c, v = v, same = d, w = w} local update_b = {subtree = b, farther = a, nearer = d, v = w, same = c, w = v, swapped_branch = true} local update_c = {subtree = c, farther = d, nearer = a, v = v, same = b, w = w, swapped_branch = true} local update_d = {subtree = d, farther = c, nearer = b, v = w, same = a, w = v} - + -- update the distances within the subtrees a,b,c,d respectively update_BNNI_subtree(update_a) update_BNNI_subtree(update_b) @@ -288,7 +288,7 @@ function BalancedNearestNeighbourInterchange:updateBNNI(swap) update_BNNI_subtree(update_d) -- update the distance between subtrees v and w [step 3 (d)]: - local distance = 1/4*( self:distance(a,b) + self:distance(a,d) + self:distance(c,b) + self:distance(c,d) ) + local distance = 1/4*( self:distance(a,b) + self:distance(a,d) + self:distance(c,b) + self:distance(c,d) ) distances[v][w] = distance distances[w][v] = distance end @@ -314,19 +314,19 @@ function BalancedNearestNeighbourInterchange:getBestSwap(arc, heap_of_swaps) local v = arc.tail local w = arc.head local is_leaf = self.is_leaf - + -- only look at inner edges: if not is_leaf[v] and not is_leaf[w] then -- get the roots of the adjacent subtrees local a, b, c, d - for _,outgoing in ipairs (g:outgoing(v)) do + for _,outgoing in ipairs (g:outgoing(v)) do local head = outgoing.head if head ~= w then a = a or head b = head end end - + for _,outgoing in ipairs (g:outgoing(w)) do local head = outgoing.head if head ~= v then @@ -334,7 +334,7 @@ function BalancedNearestNeighbourInterchange:getBestSwap(arc, heap_of_swaps) d = head end end - + -- get the distances between the four subtrees local a_b = self:distance(a,b) local a_c = self:distance(a,c) @@ -349,9 +349,9 @@ function BalancedNearestNeighbourInterchange:getBestSwap(arc, heap_of_swaps) -- difference in total tree length between old tree and new tree when nodes b and d are swapped local swap2 = 1/4*(a_b + c_d - a_d - b_c) - + -- choose the best swap that reduces the total tree length most (T-T' > 0) - if swap1 > swap2 and swap1 > 0 then + if swap1 > swap2 and swap1 > 0 then -- v,w = the nodes connecting the edge across which the swap is performed -- subtree1 = one of the nodes to be swapped; connected to v -- subtree2 = the other node to be swapped; connected to w @@ -360,7 +360,7 @@ function BalancedNearestNeighbourInterchange:getBestSwap(arc, heap_of_swaps) local swap = { v = v, w = w, subtree1 = b, subtree2 = c, a = a, d = d } -- insert the swap into the heap possible_swaps:insert(swap, swap1) - elseif swap2 > 0 then + elseif swap2 > 0 then local swap = { v = v, w = w, subtree1 = b, subtree2 = d, d = c, a = a } possible_swaps:insert(swap, swap2) end diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/DistanceMatrix.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/DistanceMatrix.lua index a65a83da17b..d44f098161f 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/DistanceMatrix.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/DistanceMatrix.lua @@ -27,22 +27,22 @@ declare { type = "string", summary = [[" - A list of vertices that are used in the parsing of the - |distance matrix| key. If this key is not used at all, all - vertices of the graph will be used for the computation of a - distance matrix. + A list of vertices that are used in the parsing of the + |distance matrix| key. If this key is not used at all, all + vertices of the graph will be used for the computation of a + distance matrix. "]], documentation = [[" - The vertices must be separated by spaces and/or - commas. For vertices containing spaces or commas, the vertex - names may be surrounded by single or double quotes (as in - Lua). Typical examples are |a, b, c| or |"hello world", 'foo'|. + The vertices must be separated by spaces and/or + commas. For vertices containing spaces or commas, the vertex + names may be surrounded by single or double quotes (as in + Lua). Typical examples are |a, b, c| or |"hello world", 'foo'|. "]] } + - - + --- declare { @@ -50,95 +50,88 @@ declare { type = "string", summary = [[" - A distance matrix specifies ``desired distances'' between - vertices in a graph. These distances are used, in particular, in - algorithms for computing phylogenetic trees. + A distance matrix specifies ``desired distances'' between + vertices in a graph. These distances are used, in particular, in + algorithms for computing phylogenetic trees. "]], documentation = [[" - When this key is parsed, the key |distance matrix vertices| is - considered first. It is used to determine a list of vertices - for which a distance matrix is computed, see that key for - details. Let $n$ be the number of vertices derived from that - key. - - The string passed to the |distance matrix| key is basically - a sequence of numbers that are used to fill an $n \times n$ - matrix. This works as follows: We keep track of a \emph{current - position $p$} in the matrix, starting at the upper left corner - of the matrix. We read the numbers in the string - one by one, write it to the current position of the matrix, and - advance the current position by going right one step; if we go - past the right end of the matrix, we ``wrap around'' by going - back to the left border of the matrix, but one line down. If we - go past the bottom of the matrix, we start at the beginning once - more. - - This basic behavior can be modified in different ways. First, - when a number is followed by a semicolon instead of a comma or a - space (which are the ``usual'' ways of indicating the end of a - number), we immediately go down to the next line. Second, - instead of a number you can directly provide a \emph{position} - in the matrix and the current position will be set to this - position. Such a position information is detected by a - greater-than sign (|>|). It must be followed by - % - \begin{itemize} + When this key is parsed, the key |distance matrix vertices| is + considered first. It is used to determine a list of vertices + for which a distance matrix is computed, see that key for + details. Let $n$ be the number of vertices derived from that + key. + + The string passed to the |distance matrix| key is basically + a sequence of numbers that are used to fill an $n \times n$ + matrix. This works as follows: We keep track of a \emph{current + position $p$} in the matrix, starting at the upper left corner + of the matrix. We read the numbers in the string + one by one, write it to the current position of the matrix, and + advance the current position by going right one step; if we go + past the right end of the matrix, we ``wrap around'' by going + back to the left border of the matrix, but one line down. If we + go past the bottom of the matrix, we start at the beginning once + more. + + This basic behaviour can be modified in different ways. First, + when a number is followed by a semicolon instead of a comma or a + space (which are the ``usual'' ways of indicating the end of a + number), we immediately go down to the next line. Second, + instead of a number you can directly provide a \emph{position} + in the matrix and the current position will be set to this + position. Such a position information is detected by a + greater-than sign (|>|). It must be followed by + \begin{itemize} \item a number or a vertex name or \item a number or a vertex name, a comma, and another number or vertex name or \item a comma and a number and a vertex name. - \end{itemize} - % - Examples of the respective cases are |>1|, |>a,b|, and - |>,5|. The semantics is as follows: In all cases, if a vertex - name rather than a number is given, it is converted into a - number (namely the index of the vertex inside the matrix). Then, - in the first case, the column of the current position is set to - the given number; in the second case, the columns is set to the - first number and the column is set to the second number; and in - the third case only the row is set to the given number. (This - idea is that following the |>|-sign comes a ``coordinate pair'' - whose components are separated by a comma, but part of that pair - may be missing.) If a vertex name contains special symbols like - a space or a comma, you must surround it by single or double - quotation marks (as in Lua). - - Once the string has been parsed completely, the matrix may be - filled only partially. In this case, for each missing entry - $(x,y)$, we try to set it to the value of the entry $(y,x)$, - provided that entry is set. If neither are set, the entry is set - to $0$. - - Let us now have a look at several examples that all produce the - same matrix. The vertices are |a|, |b|, |c|. - % + \end{itemize} + Examples of the respective cases are |>1|, |>a,b|, and + |>,5|. The semantics is as follows: In all cases, if a vertex + name rather than a number is given, it is converted into a + number (namely the index of the vertex inside the matrix). Then, + in the first case, the column of the current position is set to + the given number; in the second case, the columns is set to the + first number and the column is set to the second number; and in + the third case only the row is set to the given number. (This + idea is that following the |>|-sign comes a ``coordinate pair'' + whose components are separated by a comma, but part of that pair + may be missing.) If a vertex name contains special symbols like + a space or a comma, you must surround it by single or double + quotation marks (as in Lua). + + Once the string has been parsed completely, the matrix may be + filled only partially. In this case, for each missing entry + $(x,y)$, we try to set it to the value of the entry $(y,x)$, + provided that entry is set. If neither are set, the entry is set + to $0$. + + Let us now have a look at several examples that all produce the + same matrix. The vertices are |a|, |b|, |c|. \begin{codeexample}[code only, tikz syntax=false] 0, 1, 2 1, 0, 3 2, 3, 0 \end{codeexample} - % \begin{codeexample}[code only, tikz syntax=false] 0 1 2 1 0 3 2 3 0 \end{codeexample} - % \begin{codeexample}[code only, tikz syntax=false] ; 1; 2 3 \end{codeexample} - % \begin{codeexample}[code only, tikz syntax=false] >,b 1; 2 3 \end{codeexample} - % \begin{codeexample}[code only, tikz syntax=false] >b 1 2 >c 3 \end{codeexample} "]] } - + --- @@ -147,38 +140,34 @@ declare { type = "string", summary = [[" - This key is used to specify the ``desired distances'' between - a vertex and the other vertices in a graph. + This key is used to specify the ``desired distances'' between + a vertex and the other vertices in a graph. "]], documentation = [[" - This key works similar to the |distance matrix| key, only it is - passed to a vertex instead of to a whole graph. The syntax is - the same, only the notion of different ``rows'' is not - used. Here are some examples that all have the same effect, - provided the nodes are |a|, |b|, and |c|. - % + This key works similar to the |distance matrix| key, only it is + passed to a vertex instead of to a whole graph. The syntax is + the same, only the notion of different ``rows'' is not + used. Here are some examples that all have the same effect, + provided the nodes are |a|, |b|, and |c|. \begin{codeexample}[code only, tikz syntax=false] 0, 1, 2 \end{codeexample} - % \begin{codeexample}[code only, tikz syntax=false] 0 1 2 \end{codeexample} - % \begin{codeexample}[code only, tikz syntax=false] >b 1 2 \end{codeexample} - % \begin{codeexample}[code only, tikz syntax=false] >c 2, >b 1 \end{codeexample} "]] } + - -local function to_index(s, indices) +local function to_index(s, indices) if s and s ~= "" then if s:sub(1,1) == '"' then local _, _, m = s:find('"(.*)"') @@ -189,9 +178,9 @@ local function to_index(s, indices) else local num = tonumber(s) if not num then - return indices[InterfaceToAlgorithms.findVertexByName(s)] + return indices[InterfaceToAlgorithms.findVertexByName(s)] else - return num + return num end end end @@ -199,7 +188,7 @@ end local function compute_indices(vertex_string, vertices) local indices = {} - + if not vertex_string then for i,v in ipairs(vertices) do indices[i] = v @@ -211,17 +200,17 @@ local function compute_indices(vertex_string, vertices) while pos <= #vertex_string do local start = vertex_string:sub(pos,pos) if not start:find("[%s,]") then - local _, vertex - if start == '"' then - _, pos, vertex = vertex_string:find('"(.-)"', pos) - elseif start == "'" then - _, pos, vertex = vertex_string:find("'(.-)'", pos) - else - _, pos, vertex = vertex_string:find("([^,%s'\"]*)", pos) - end - local v = assert(InterfaceToAlgorithms.findVertexByName(vertex), "unknown vertex name '" .. vertex .. "'") - indices [#indices + 1] = v - indices [v] = #indices + local _, vertex + if start == '"' then + _, pos, vertex = vertex_string:find('"(.-)"', pos) + elseif start == "'" then + _, pos, vertex = vertex_string:find("'(.-)'", pos) + else + _, pos, vertex = vertex_string:find("([^,%s'\"]*)", pos) + end + local v = assert(InterfaceToAlgorithms.findVertexByName(vertex), "unknown vertex name '" .. vertex .. "'") + indices [#indices + 1] = v + indices [v] = #indices end pos = pos + 1 end @@ -233,24 +222,24 @@ end --- -- Compute a distance matrix based on the values of a --- |distance matrix| and a |distance matrix vertices|. +-- |distance matrix| and a |distance matrix vertices|. -- -- @param matrix_string A distance matrix string -- @param vertex_string A distance matrix vertex string -- @param vertices An array of all vertices in the graph. -- -- @return A distance matrix. This matrix will contain both a --- two-dimensional array (accessed through numbers) and also a +-- two-dimensional array (accessed through numbers) and also a -- two-dimensional hash table (accessed through vertex indices). Thus, -- you can write both |m[1][1]| and also |m[v][v]| to access the first -- entry of this matrix, provided |v == vertices[1]|. -- @return An index vector. This is an array of the vertices -- identified for the |vertex_string| parameter. -function DistanceMatrix.computeDistanceMatrix(matrix_string, vertex_string, vertices) +function DistanceMatrix.computeDistanceMatrix(matrix_string, vertex_string, vertices) -- First, we create a table of the vertices we need to consider: local indices = compute_indices(vertex_string, vertices) - + -- Second, build matrix. local n = #indices local m = {} @@ -266,29 +255,29 @@ function DistanceMatrix.computeDistanceMatrix(matrix_string, vertex_string, vert local start = matrix_string:sub(pos,pos) if not start:find("[%s,]") then if start == '>' then - local _, parse - _, pos, parse = matrix_string:find(">([^%s>;]*)", pos) - local a, b - if parse:find(",") then - _,_,a,b = parse:find("(.*),(.*)") - else - a = parse - end - x = to_index(a, indices) or x - y = to_index(b, indices) or y + local _, parse + _, pos, parse = matrix_string:find(">([^%s>;]*)", pos) + local a, b + if parse:find(",") then + _,_,a,b = parse:find("(.*),(.*)") + else + a = parse + end + x = to_index(a, indices) or x + y = to_index(b, indices) or y elseif start == ';' then - x = 1 - y = y + 1 + x = 1 + y = y + 1 elseif start == ',' then - x = x + 1 + x = x + 1 else - local _, n - _, pos, n = matrix_string:find("([^,;%s>]*)", pos) - local num = assert(tonumber(n), "number expected in distance matrix") - m[x][y] = num - x = x + 1 - -- Skip everything up to first comma: - _, pos = matrix_string:find("(%s*,?)", pos+1) + local _, n + _, pos, n = matrix_string:find("([^,;%s>]*)", pos) + local num = assert(tonumber(n), "number expected in distance matrix") + m[x][y] = num + x = x + 1 + -- Skip everything up to first comma: + _, pos = matrix_string:find("(%s*,?)", pos+1) end end pos = pos + 1 @@ -305,7 +294,7 @@ function DistanceMatrix.computeDistanceMatrix(matrix_string, vertex_string, vert for x=1,n do for y=1,n do if not m[x][y] then - m[x][y] = m[y][x] or 0 + m[x][y] = m[y][x] or 0 end end end @@ -337,11 +326,11 @@ end -- double indexed, once by numbers and once be vertex objects. -- @return An index vector. This is an array of the vertices -- identified for the |vertex_string| parameter. - -function DistanceMatrix.computeDistanceVector(vector_string, vertex_string, vertices) + +function DistanceMatrix.computeDistanceVector(vector_string, vertex_string, vertices) -- First, we create a table of the vertices we need to consider: local indices = compute_indices(vertex_string, vertices) - + -- Second, build matrix. local n = #indices local m = {} @@ -352,19 +341,19 @@ function DistanceMatrix.computeDistanceVector(vector_string, vertex_string, vert local start = vector_string:sub(pos,pos) if not start:find("[%s,]") then if start == '>' then - local _, parse - _, pos, parse = vector_string:find(">([^%s>;]*)", pos) - x = to_index(parse, indices) or x + local _, parse + _, pos, parse = vector_string:find(">([^%s>;]*)", pos) + x = to_index(parse, indices) or x elseif start == ',' then - x = x + 1 + x = x + 1 else - local _, n - _, pos, n = vector_string:find("([^,;%s>]*)", pos) - local num = assert(tonumber(n), "number expected in distance matrix") - m[x] = num - x = x + 1 - -- Skip everything up to first comma: - _, pos = vector_string:find("(%s*,?)", pos+1) + local _, n + _, pos, n = vector_string:find("([^,;%s>]*)", pos) + local num = assert(tonumber(n), "number expected in distance matrix") + m[x] = num + x = x + 1 + -- Skip everything up to first comma: + _, pos = vector_string:find("(%s*,?)", pos+1) end end pos = pos + 1 @@ -387,7 +376,7 @@ end --- -- Compute a distance matrix for a graph that incorporates all -- information stored in the different options of the graph and the --- vertices. +-- vertices. -- -- @param graph A digraph object. -- @@ -407,7 +396,7 @@ function DistanceMatrix.graphDistanceMatrix(digraph) indices[i] = v indices[v] = i end - + if digraph.options['distance matrix'] then local sub, vers = DistanceMatrix.computeDistanceMatrix( digraph.options['distance matrix'], @@ -417,7 +406,7 @@ function DistanceMatrix.graphDistanceMatrix(digraph) for x=1,#vers do for y=1,#vers do - m[vers[x]][vers[y]] = sub[x][y] + m[vers[x]][vers[y]] = sub[x][y] end end end @@ -425,24 +414,24 @@ function DistanceMatrix.graphDistanceMatrix(digraph) for i,v in ipairs(vertices) do if v.options['distances'] then local sub, vers = DistanceMatrix.computeDistanceVector( - v.options['distances'], - v.options['distance matrix vertices'], - vertices + v.options['distances'], + v.options['distance matrix vertices'], + vertices ) - + for x=1,#vers do - m[vers[x]][v] = sub[x] + m[vers[x]][v] = sub[x] end end end - + -- Fill up number versions: for x,vx in ipairs(vertices) do for y,vy in ipairs(vertices) do m[x][y] = m[vx][vy] end end - + return m end diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/Maeusle2012.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/Maeusle2012.lua index a9acc488652..528110b57ea 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/Maeusle2012.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/Maeusle2012.lua @@ -39,36 +39,36 @@ declare { algorithm = { base_class = Maeusle2012, run = function (self) - local root = self:getRoot() - self:setPosForRectangularLayout(root) - end + local root = self:getRoot() + self:setPosForRectangularLayout(root) + end }, phase = "phylogenetic tree layout", phase_default = true, - summary = [[" - A rooted rectangular phylogram is... + summary = [[" + A rooted rectangular phylogram is... "]], documentation = [[" - ... + ... "]], examples = [[" - \tikz \graph [phylogenetic tree layout, - rooted rectangular phylogram, - balanced minimum evolution, - distance matrix={ - 0 4 9 9 9 9 9 - 4 0 9 9 9 9 9 - 9 9 0 2 7 7 7 - 9 9 2 0 7 7 7 - 9 9 7 7 0 3 5 - 9 9 7 7 3 0 5 - 9 9 7 7 5 5 0}] - { a, b, c, d, e, f, g }; + \tikz \graph [phylogenetic tree layout, + rooted rectangular phylogram, + balanced minimum evolution, + distance matrix={ + 0 4 9 9 9 9 9 + 4 0 9 9 9 9 9 + 9 9 0 2 7 7 7 + 9 9 2 0 7 7 7 + 9 9 7 7 0 3 5 + 9 9 7 7 3 0 5 + 9 9 7 7 5 5 0}] + { a, b, c, d, e, f, g }; "]] } - ---- + +--- declare { key = "rectangular phylogram", use = { { key = "rooted rectangular phylogram" } }, @@ -81,35 +81,35 @@ declare { algorithm = { base_class = Maeusle2012, run = function (self) - local root = self:getRoot() - self:setXPos(root) - self:setYPosForStraightLayout(root) - end + local root = self:getRoot() + self:setXPos(root) + self:setYPosForStraightLayout(root) + end }, phase = "phylogenetic tree layout", - summary = [[" - A rooted straight phylogram is... + summary = [[" + A rooted straight phylogram is... "]], documentation = [[" - ... + ... "]], examples = [[" - \tikz \graph [phylogenetic tree layout, - rooted straight phylogram, - balanced minimum evolution, grow=right, - distance matrix={ - 0 4 9 9 9 9 9 - 4 0 9 9 9 9 9 - 9 9 0 2 7 7 7 - 9 9 2 0 7 7 7 - 9 9 7 7 0 3 5 - 9 9 7 7 3 0 5 - 9 9 7 7 5 5 0}] - { a, b, c, d, e, f, g }; + \tikz \graph [phylogenetic tree layout, + rooted straight phylogram, + balanced minimum evolution, grow=right, + distance matrix={ + 0 4 9 9 9 9 9 + 4 0 9 9 9 9 9 + 9 9 0 2 7 7 7 + 9 9 2 0 7 7 7 + 9 9 7 7 0 3 5 + 9 9 7 7 3 0 5 + 9 9 7 7 5 5 0}] + { a, b, c, d, e, f, g }; "]]} - ---- + +--- declare { key = "straight phylogram", use = { { key = "rooted straight phylogram" } }, @@ -122,91 +122,91 @@ declare { algorithm = { base_class = Maeusle2012, run = function (self) - local root1, root2 = self:getRoot() - self:setPosForUnrootedRectangular(root2, root1) - end + local root1, root2 = self:getRoot() + self:setPosForUnrootedRectangular(root2, root1) + end }, phase = "phylogenetic tree layout", - summary = [[" - A unrooted rectangular phylogram is... + summary = [[" + A unrooted rectangular phylogram is... "]], documentation = [[" - ... + ... "]], examples = [[" - \tikz \graph [phylogenetic tree layout, - unrooted rectangular phylogram, - balanced minimum evolution, grow=right, - distance matrix={ - 0 4 9 9 9 9 9 - 4 0 9 9 9 9 9 - 9 9 0 2 7 7 7 - 9 9 2 0 7 7 7 - 9 9 7 7 0 3 5 - 9 9 7 7 3 0 5 - 9 9 7 7 5 5 0}] - { a, b, c, d, e, f, g }; + \tikz \graph [phylogenetic tree layout, + unrooted rectangular phylogram, + balanced minimum evolution, grow=right, + distance matrix={ + 0 4 9 9 9 9 9 + 4 0 9 9 9 9 9 + 9 9 0 2 7 7 7 + 9 9 2 0 7 7 7 + 9 9 7 7 0 3 5 + 9 9 7 7 3 0 5 + 9 9 7 7 5 5 0}] + { a, b, c, d, e, f, g }; "]] } - + --- declare { key = "unrooted straight phylogram", algorithm = { base_class = Maeusle2012, run = function (self) - local root1, root2 = self:getRoot() - self:setPosForUnrootedStraight(root2, root1) - end + local root1, root2 = self:getRoot() + self:setPosForUnrootedStraight(root2, root1) + end }, phase = "phylogenetic tree layout", - summary = [[" - A unrooted straight phylogram is... + summary = [[" + A unrooted straight phylogram is... "]], documentation = [[" - ... + ... "]], examples = [[" - \tikz \graph [phylogenetic tree layout, - unrooted straight phylogram, - balanced minimum evolution, grow=right, - distance matrix={ - 0 4 9 9 9 9 9 - 4 0 9 9 9 9 9 - 9 9 0 2 7 7 7 - 9 9 2 0 7 7 7 - 9 9 7 7 0 3 5 - 9 9 7 7 3 0 5 - 9 9 7 7 5 5 0}] - { a, b, c, d, e, f, g }; + \tikz \graph [phylogenetic tree layout, + unrooted straight phylogram, + balanced minimum evolution, grow=right, + distance matrix={ + 0 4 9 9 9 9 9 + 4 0 9 9 9 9 9 + 9 9 0 2 7 7 7 + 9 9 2 0 7 7 7 + 9 9 7 7 0 3 5 + 9 9 7 7 3 0 5 + 9 9 7 7 5 5 0}] + { a, b, c, d, e, f, g }; "]] } - - + + --- declare { key = "evolutionary unit length", type = "length", initial = "1cm", - summary = [[" - Specifies how long a ``unit'' of evolutionary time should be on - paper. For instance, if two nodes in a phylogenetic tree have an - evolutionary distance of 3 and this length is set to |1cm|, then - they will be |3cm| apart in a straight-line phylogram. + summary = [[" + Specifies how long a ``unit'' of evolutionary time should be on + paper. For instance, if two nodes in a phylogenetic tree have an + evolutionary distance of 3 and this length is set to |1cm|, then + they will be |3cm| apart in a straight-line phylogram. "]], documentation = [[" - (This key used to be called |distance scaling factor|.) + (This key used to be called |distance scaling factor|.) "]], } + - - + -- -- Gets the edge length between two nodes --- +-- -- @param vertex1, vertex2 The two nodes -- -- @return The length of the edge between the two nodes @@ -221,12 +221,12 @@ end -- @param vertex The starting point; should usually be the root -- @param values Values needed for the recursion -- @param vertex2 A node that will not be visited; this parameter should only be set --- for an unrooted layout to ensure that only the half of the tree is set. +-- for an unrooted layout to ensure that only the half of the tree is set. function Maeusle2012:setPosForRectangularLayout(vertex, values, vertex2) local arcs = self.tree.arcs local vertices = self.tree.vertices local adjusted_bb = self.main_algorithm.adjusted_bb - + values = values or { length = 0, -- current path length visited = {}, -- all nodes that have already been visited @@ -235,10 +235,10 @@ function Maeusle2012:setPosForRectangularLayout(vertex, values, vertex2) local vertex_is_leaf = true values.visited[vertex] = true - + local children = {} -- a table containing all children of the - -- current vertex (for the later determination of inner vertices - -- x-positions) + --current vertex (for the later determination of inner vertices + --x-positions) for _, arc in ipairs (self.tree:outgoing(vertex)) do @@ -251,10 +251,10 @@ function Maeusle2012:setPosForRectangularLayout(vertex, values, vertex2) -- go deeper self:setPosForRectangularLayout(arc.head, values, vertex2) - + -- get the children of the current vertex children[#children+1] = arc.head - + values.length = values.length - arc_length end end @@ -263,9 +263,9 @@ function Maeusle2012:setPosForRectangularLayout(vertex, values, vertex2) -- subtract layer_pre, thus the leaf itself is NOT part of the -- edge length vertex.pos.y = - adjusted_bb[vertex].layer_pre - + values.leaves[#values.leaves+1] = vertex - + -- x coordinate: -- the x coordinates of the leaves are the first to be set; the -- first leave stays at x = 0, the x coordinates for the other @@ -276,7 +276,7 @@ function Maeusle2012:setPosForRectangularLayout(vertex, values, vertex2) local ideal_distance = layered.ideal_sibling_distance(adjusted_bb, self.tree, vertex, left_sibling ) vertex.pos.x = left_sibling.pos.x + ideal_distance end - + else -- the vertex is an inner node -- the x position of an inner vertex is at the center of its children. @@ -287,12 +287,12 @@ function Maeusle2012:setPosForRectangularLayout(vertex, values, vertex2) if child.pos.x < left_child.pos.x then left_child = child end if child.pos.x > right_child.pos.x then right_child = child end end - + -- position between child with highest and child with lowest x-value, -- if number of children is even local index_of_middle_child = math.ceil(#children/2) local even = #children/2 == index_of_middle_child - + if even then vertex.pos.x = (left_child.pos.x + right_child.pos.x) / 2 index_of_middle_child = 0 @@ -301,33 +301,33 @@ function Maeusle2012:setPosForRectangularLayout(vertex, values, vertex2) table.remove(children, index_of_middle_child) -- don't bend the edge to this node, as it it above it anyway end end - + -- set the node's y-coordinate, using the calculated length - -- and a scaling factor + -- and a scaling factor vertex.pos.y = vertex.pos.y + (values.length * self.tree.options['evolutionary unit length']) - + -- if this is the second subtree to be set of an unrooted tree, have -- it grow in the other direction if values.second_subtree then vertex.pos.y = -vertex.pos.y end - + -- bend the edges for the rectangular layout for i,child in ipairs(children) do self:bendEdge90Degree(child, vertex) end - + return values end -- Sets only the x-positions of all nodes using a depth-first search. -- This is necessary for straight-edge layouts. --- +-- -- @param vertex The starting point of the depth-first search; should usually be the root -- @param values Values needed for the recursion -- @param vertex2 A node that will not be visited; this parameter should only be set --- for an unrooted layout to ensure that only the half of the tree is set. +-- for an unrooted layout to ensure that only the half of the tree is set. function Maeusle2012:setXPos(vertex, values, vertex2) local arcs = self.tree.arcs local vertices = self.tree.vertices @@ -349,26 +349,26 @@ function Maeusle2012:setXPos(vertex, values, vertex2) -- go deeper self:setXPos(arc.head, values, vertex2) - + -- get the children of the current vertex - table.insert(children, arc.head) + table.insert(children, arc.head) end end -- set the x-position of a leaf if vertex_is_leaf then - + table.insert(values.leaves, vertex) - + if #values.leaves > 1 then local left_sibling = values.leaves[#values.leaves-1] local ideal_distance = layered.ideal_sibling_distance(self.main_algorithm.adjusted_bb, self.tree, vertex, left_sibling ) vertex.pos.x = left_sibling.pos.x + ideal_distance end - + -- set x position of an inner node, which is at the center of its -- children - else + else -- determine the outer children local left_child = children[1] local right_child = left_child @@ -376,12 +376,12 @@ function Maeusle2012:setXPos(vertex, values, vertex2) if child.pos.x < left_child.pos.x then left_child = child end if child.pos.x > right_child.pos.x then right_child = child end end - + -- position between child with highest and child with lowest x-value, -- if number of children is even local index_of_middle_child = math.ceil(#children/2) local even = #children/2 == index_of_middle_child - + if even then vertex.pos.x = (left_child.pos.x + right_child.pos.x) / 2 else -- if number of children is odd, position above the middle child @@ -406,7 +406,7 @@ function Maeusle2012:setYPosForStraightLayout(vertex, values, vertex2) local arcs = self.tree.arcs local vertices = self.tree.vertices local adjusted_bb = self.main_algorithm.adjusted_bb - + values = values or { length = 0, -- current path length visited = {}, -- all nodes that have already been visited @@ -421,7 +421,7 @@ function Maeusle2012:setYPosForStraightLayout(vertex, values, vertex2) if not values.visited[arc.head] and arc.head ~= vertex2 then -- if arc.head hasn't been visited, the current vertex cannot be a leaf vertex_is_leaf = false - + -- calculate the arc length with the help of the Pythagorean -- theorem local a @@ -439,10 +439,10 @@ function Maeusle2012:setYPosForStraightLayout(vertex, values, vertex2) -- go deeper self:setYPosForStraightLayout(arc.head, values, vertex2) - + -- get the children of the current vertex - table.insert(children, arc.head) - + table.insert(children, arc.head) + values.length = values.length - arc_length end end @@ -451,13 +451,13 @@ function Maeusle2012:setYPosForStraightLayout(vertex, values, vertex2) -- subtract layer_pre, thus the leaf itself is NOT part of the -- edge length vertex.pos.y = - adjusted_bb[vertex].layer_pre - + table.insert(values.leaves, vertex) end - - -- set the node's y-coordinate, using the calculated length + + -- set the node's y-coordinate, using the calculated length vertex.pos.y = vertex.pos.y + values.length - + -- if this is the second subtree to be set of an unrooted tree, have -- it grow in the other direction if values.second_subtree then vertex.pos.y = -vertex.pos.y end @@ -472,7 +472,7 @@ end -- @param vertex1 The root of the first subtree -- @param vertex2 The root of the second subtree. function Maeusle2012:correctXPos(vertex1, vertex2, straight) - + -- correct the x-positions -- -- @param vertex Starting point of the depth-first search @@ -484,12 +484,12 @@ function Maeusle2012:correctXPos(vertex1, vertex2, straight) for _, arc in ipairs (self.tree:outgoing(vertex)) do if not values.visited[arc.head] and arc.head ~= vertex2 then - - table.insert(children, arc.head) + + table.insert(children, arc.head) x_correction(arc.head, values, vertex2) end end - + vertex.pos.x = vertex.pos.x + values.diff if not straight then for i,child in ipairs(children) do @@ -499,9 +499,9 @@ function Maeusle2012:correctXPos(vertex1, vertex2, straight) return values end - + -- compute the difference of the x-positions of the two subtrees' - -- roots + -- roots local diff = vertex1.pos.x - vertex2.pos.x local values = { visited = {} } if diff < 0 then @@ -510,7 +510,7 @@ function Maeusle2012:correctXPos(vertex1, vertex2, straight) elseif diff > 0 then values.diff = diff x_correction(vertex2, values, vertex1) - end + end end @@ -521,10 +521,10 @@ end -- Two neighboring vertices are chosen as roots; one half of the tree -- is drawn in one direction, the other half 180° to the other -- direction. --- --- @param vertex1, vertex2: The vertices functioning as roots +-- +-- @param vertex1, vertex2: The vertices functioning as roots function Maeusle2012:setPosForUnrootedRectangular(vertex1, vertex2) - -- set positions for first half of the tree... + -- set positions for first half of the tree... self:setPosForRectangularLayout(vertex2,false,vertex1) local vals={ length = self:edgeLength(vertex1, vertex2), -- the length between the two roots @@ -547,14 +547,14 @@ end -- Two neighboring vertices are chosen as roots; one half of the tree -- is drawn in one direction, the other half 180° to the other -- direction. --- +-- -- @param vertex1, vertex2: The vertices functioning as roots function Maeusle2012:setPosForUnrootedStraight(vertex1, vertex2) -- first set the x-positions of the two subtrees... local vals = {visited = {}, leaves = {} } self:setXPos(vertex2, vals, vertex1) self:setXPos(vertex1, vals, vertex2) - + -- ... and then the y-positions self:setYPosForStraightLayout(vertex2, false, vertex1) local vals={ @@ -576,7 +576,7 @@ end -- Bends the arc between two nodes by 90 degree by updating the arc's -- path --- +-- -- @param head The head of the arc -- @param tail The tail of the arc function Maeusle2012:bendEdge90Degree(head, tail) @@ -597,7 +597,7 @@ function Maeusle2012:findLongestPath() local paths_to_leaves = self:getPathLengthsToLeaves(starting_point) local path_lengths = paths_to_leaves.path_lengths local paths = paths_to_leaves.paths - + -- looks for the longest path and identifies its end-point local function find_head_of_longest_path(path_lengths, paths) local longest_path @@ -615,7 +615,7 @@ function Maeusle2012:findLongestPath() end return node end - + -- find the longest path leading away from the starting point and identify -- the leaf it leads to. Use that leaf as the tail for the next path -- search @@ -626,11 +626,11 @@ function Maeusle2012:findLongestPath() path_lengths = paths_to_leaves.path_lengths paths = paths_to_leaves.paths local head = find_head_of_longest_path(path_lengths, paths) - + local path_information = { path = paths_to_leaves.paths[head], -- longest path length = path_lengths[head] } -- length of that path - + return path_information end @@ -659,7 +659,7 @@ function Maeusle2012:getPathLengthsToLeaves(vertex, values) } table.insert(values.path,vertex) end - + local vertex_is_leaf = true values.visited[vertex] = true @@ -671,13 +671,13 @@ function Maeusle2012:getPathLengthsToLeaves(vertex, values) vertex_is_leaf = false local arc_length = self.lengths[vertex][arc.head] values.length = values.length + arc_length - + -- add arc.head to path... table.insert(values.path,arc.head) - + -- ... and go down that path self:getPathLengthsToLeaves(arc.head, values) - + -- remove arc.head again to go a different path table.remove(values.path) values.length = values.length - arc_length @@ -699,7 +699,7 @@ function Maeusle2012:getPathLengthsToLeaves(vertex, values) paths = values.paths, leaves = values.leaves } return path_information -end +end -- Gets the root of a tree @@ -732,13 +732,13 @@ function Maeusle2012:computeCenterOfPath() local node3 = path[i+2] local dist_node_1_2, dist_node_2_3 --distances between node1 and node2, and node2 and node3 - dist_node_1_2 = self:edgeLength(node1, node2) - if node3 then dist_node_2_3 = self:edgeLength(node2, node3) end - length = length + dist_node_1_2 -- length between first vertex on the path and current node2 - + dist_node_1_2 = self:edgeLength(node1, node2) + if node3 then dist_node_2_3 = self:edgeLength(node2, node3) end + length = length + dist_node_1_2 -- length between first vertex on the path and current node2 + if length == longest_path.length/2 then root = node2 -- if there is a node exactly at the half of the path, use this node as root - + -- and find nearest neighbor of the root if node3 == nil or dist_node_1_2 < dist_node_2_3 then -- neu 3.8 neighbor_of_root = node1 @@ -765,12 +765,12 @@ function Maeusle2012:computeCenterOfPath() node0 = path[i-1] dist_node_0_1 = self:edgeLength(node0, node1) if dist_node_0_1 < dist_node_1_2 then neighbor_of_root = node0 end - end + end end break end end - + return root, neighbor_of_root end diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/PhylogeneticTree.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/PhylogeneticTree.lua index 242ccf183ff..f66f2553306 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/PhylogeneticTree.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/PhylogeneticTree.lua @@ -29,53 +29,53 @@ local declare = InterfaceToAlgorithms.declare declare { key = "phylogenetic tree layout", algorithm = PhylogeneticTree, - + postconditions = { upward_oriented = true }, - summary = [[" - Layout for drawing phylogenetic trees. + summary = [[" + Layout for drawing phylogenetic trees. "]], documentation = [[" - ... + ... "]], examples = [[" - \tikz \graph [phylogenetic tree layout, upgma, - distance matrix={ - 0 4 9 9 9 9 9 - 4 0 9 9 9 9 9 - 9 9 0 2 7 7 7 - 9 9 2 0 7 7 7 - 9 9 7 7 0 3 5 - 9 9 7 7 3 0 5 - 9 9 7 7 5 5 0}] - { a, b, c, d, e, f, g }; + \tikz \graph [phylogenetic tree layout, upgma, + distance matrix={ + 0 4 9 9 9 9 9 + 4 0 9 9 9 9 9 + 9 9 0 2 7 7 7 + 9 9 2 0 7 7 7 + 9 9 7 7 0 3 5 + 9 9 7 7 3 0 5 + 9 9 7 7 5 5 0}] + { a, b, c, d, e, f, g }; "]] } - - + + -- Computes a phylogenetic tree and/or visualizes it -- - computes a phylogenetic tree according to what the "phylogenetic -- algorithm" key is set to -- - invokes a graph drawing algorithm according to what the --- "phylogenetic layout" key is set to +-- "phylogenetic layout" key is set to function PhylogeneticTree:run() - + local options = self.digraph.options - + -- Two storages for some information computed by the phylogenetic - -- tree generation algorithm + -- tree generation algorithm local lengths = Storage.newTableStorage() - + -- First, compute the phylogenetic tree local tree = options.algorithm_phases['phylogenetic tree generation'].new { main_algorithm = self, lengths = lengths }:run() - + tree = Direct.ugraphFromDigraph(tree) - + -- Second, layout the tree local layout_class = options.algorithm_phases['phylogenetic tree layout'] layout_class.new { diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/SokalMichener1958.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/SokalMichener1958.lua index 6a665b67322..8be5c1d51e9 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/SokalMichener1958.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/SokalMichener1958.lua @@ -35,33 +35,33 @@ declare { algorithm = SokalMichener1958, phase = "phylogenetic tree generation", - summary = [[" - The UPGMA (Unweighted Pair Group Method using arithmetic - Averages) algorithm of Sokal and Michener, 1958. It generates a - graph on the basis of such a distance matrix by generating nodes - and computing the edge lengths. - "]], + summary = [[" + The UPGMA (Unweighted Pair Group Method using arithmetic + Averages) algorithm of Sokal and Michener, 1958. It generates a + graph on the basis of such a distance matrix by generating nodes + and computing the edge lengths. + "]], documentation = [[" - This algorithm uses a distance matrix, ideally an ultrametric - one, to compute the graph. + This algorithm uses a distance matrix, ideally an ultrametric + one, to compute the graph. "]], examples = [[" - \tikz \graph [phylogenetic tree layout, sibling distance=0pt, sibling sep=2pt, - unweighted pair group method using arithmetic averages, - distance matrix={ - 0 4 9 9 9 9 9 - 4 0 9 9 9 9 9 - 9 9 0 2 7 7 7 - 9 9 2 0 7 7 7 - 9 9 7 7 0 3 5 - 9 9 7 7 3 0 5 - 9 9 7 7 5 5 0}] - { a, b, c, d, e, f, g }; + \tikz \graph [phylogenetic tree layout, sibling distance=0pt, sibling sep=2pt, + unweighted pair group method using arithmetic averages, + distance matrix={ + 0 4 9 9 9 9 9 + 4 0 9 9 9 9 9 + 9 9 0 2 7 7 7 + 9 9 2 0 7 7 7 + 9 9 7 7 0 3 5 + 9 9 7 7 3 0 5 + 9 9 7 7 5 5 0}] + { a, b, c, d, e, f, g }; "]] } - - ---- + + +--- declare { key = "upgma", use = { { key = "unweighted pair group method using arithmetic averages" } }, @@ -79,14 +79,14 @@ declare { -- field must be a |Storage| object that will get filled with the -- distances computed by this algorithm. The |lengths| field must also -- be a |Storage| for the computed distances. --- +-- function SokalMichener1958:run() self.distances = Storage.newTableStorage() - + self.tree = Digraph.new(self.main_algorithm.digraph) - - -- store the phylogenetic tree object, containing all user-specified + + -- store the phylogentic tree object, containing all user-specified -- graph information self:runUPGMA() self:createFinalEdges() @@ -109,19 +109,19 @@ function SokalMichener1958:runUPGMA() local g = self.tree local clusters = {} - + -- create the clusters for _,v in ipairs(g.vertices) do clusters[#clusters+1] = self:newCluster(v) end - -- Initialize the distances of these clusters: + -- Iniitialise the distances of these clusters: for _,cx in ipairs(clusters) do for _,cy in ipairs(clusters) do cx.distances[cy] = matrix[cx.root][cy.root] end end - + -- search for clusters with smallest distance and merge them while #clusters > 1 do local minimum_distance = math.huge @@ -153,7 +153,7 @@ function SokalMichener1958:newCluster(vertex) distances = {}, -- cached cluster distances to all other clusters cluster_height = 0 -- this value is equivalent to half the distance of the last two clusters -- that have been merged to form the current cluster; - -- necessary for determining the distances of newly generated nodes to their children. + -- necessary for determining the distances of newly generated nodes to their children. } end @@ -184,7 +184,7 @@ end -- @param distance The distance between the two clusters function SokalMichener1958:mergeClusters(clusters, index_of_first_cluster, index_of_second_cluster, distance) - + local g = self.tree local cluster1 = clusters[index_of_first_cluster] local cluster2 = clusters[index_of_second_cluster] @@ -199,7 +199,7 @@ function SokalMichener1958:mergeClusters(clusters, index_of_first_cluster, index cluster.distances[cluster1] = dist end end - + -- delete cluster2 table.remove(clusters, index_of_second_cluster) @@ -218,8 +218,8 @@ function SokalMichener1958:mergeClusters(clusters, index_of_first_cluster, index local distance1 = distance/2-cluster1.cluster_height self.distances[new_node][cluster1.root] = distance1 local distance2 = distance/2-cluster2.cluster_height - self.distances[new_node][cluster2.root] = distance2 - + self.distances[new_node][cluster2.root] = distance2 + -- these distances are also the final edge lengths, thus: self.lengths[new_node][cluster1.root] = distance1 self.lengths[cluster1.root][new_node] = distance1 @@ -229,7 +229,7 @@ function SokalMichener1958:mergeClusters(clusters, index_of_first_cluster, index g:connect(new_node, cluster1.root) g:connect(new_node, cluster2.root) - + cluster1.root = new_node cluster1.size = cluster1.size + cluster2.size cluster1.cluster_height = distance/2 -- set new height of the cluster @@ -252,7 +252,7 @@ function SokalMichener1958:createFinalEdges() InterfaceToAlgorithms.createEdge( self.main_algorithm, arc.tail, arc.head, { generated_options = { - { key = "phylogenetic edge", value = tostring(self.lengths[arc.tail][arc.head]) } + { key = "phylogenetic edge", value = tostring(self.lengths[arc.tail][arc.head]) } }}) end end diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/library.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/library.lua index 5ab821c4a81..29183a57739 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/library.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/phylogenetics/library.lua @@ -12,7 +12,7 @@ --- --- A phylogenetic tree (or network) depicts the evolutionary history +-- A phylogenetic tree (or network) depicts the evolutionary histroy -- of species or, more generally, so called taxa. The present library -- includes a number of algorithms for drawing phylogenetic trees. -- diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/planar/BoyerMyrvold2004.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/planar/BoyerMyrvold2004.lua index f587861d79d..f30c940a921 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/planar/BoyerMyrvold2004.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/planar/BoyerMyrvold2004.lua @@ -41,7 +41,7 @@ first in the dfs) -leastancestor Dfi of the vertex with lowest dfi that can be reached using one back edge -(non-tree edge) +(non-tree edge) -lowpoint Dfi of the vertex with lowest dfi that can be reached using any number of @@ -119,143 +119,143 @@ local Embedding = require "pgf.gd.planar.Embedding" BM.__index = BM function BM.new() - local t = {} - setmetatable(t, BM) - return t + local t = {} + setmetatable(t, BM) + return t end -- initializes some data structures at the beginning -- takes the ugraph of the layout algorithm as input function BM:init(g) - self.inputgraph = g - self.numvertices = #g.vertices - self.vertices = {} - self.verticesbyinputvertex = Storage.new() - self.verticesbylowpoint = Storage.newTableStorage() - self.shortcircuitedges = {} - for _, inputvertex in ipairs(self.inputgraph.vertices) do - local vertex = { - sign = 1, - childlist = LinkedList.new(), - adjlistlinks = {}, - pertinentroots = LinkedList.new(), - inputvertex = inputvertex, - } - setmetatable(vertex, Embedding.vertexmetatable) - self.verticesbyinputvertex[inputvertex] = vertex - end + self.inputgraph = g + self.numvertices = #g.vertices + self.vertices = {} + self.verticesbyinputvertex = Storage.new() + self.verticesbylowpoint = Storage.newTableStorage() + self.shortcircuitedges = {} + for _, inputvertex in ipairs(self.inputgraph.vertices) do + local vertex = { + sign = 1, + childlist = LinkedList.new(), + adjlistlinks = {}, + pertinentroots = LinkedList.new(), + inputvertex = inputvertex, + } + setmetatable(vertex, Embedding.vertexmetatable) + self.verticesbyinputvertex[inputvertex] = vertex + end end --[[ local function nilmax(a, b) - if a == nil then return b end - if b == nil then return a end - return math.max(a, b) + if a == nil then return b end + if b == nil then return a end + return math.max(a, b) end local function nilmin(a, b) - if a == nil then return b end - if b == nil then return a end - return math.min(a, b) + if a == nil then return b end + if b == nil then return a end + return math.min(a, b) end --]] -- the depth-first search of the preprocessing function BM:predfs(inputvertex, parent) - local dfi = #self.vertices + 1 - local vertex = self.verticesbyinputvertex[inputvertex] - self.vertices[dfi] = vertex - -- set the dfs infos in the vertex - vertex.dfi = dfi - vertex.dfsparent = parent - vertex.leastancestor = dfi - vertex.lowpoint = dfi - -- find neighbors - for _, arc in ipairs(self.inputgraph:outgoing(inputvertex)) do - local ninputvertex = arc.head - assert(ninputvertex ~= inputvertex, "Self-loop detected!") - local nvertex = self.verticesbyinputvertex[ninputvertex] - if nvertex.dfi == nil then - -- new vertex discovered - self:predfs(ninputvertex, vertex) -- recursive call - vertex.lowpoint = math.min(vertex.lowpoint, nvertex.lowpoint) - elseif parent and ninputvertex ~= parent.inputvertex then - -- back edge found - vertex.leastancestor = math.min(vertex.leastancestor, nvertex.dfi) - vertex.lowpoint = math.min(vertex.lowpoint, nvertex.dfi) - end - end - -- put vertex into lowpoint sort bucket - table.insert(self.verticesbylowpoint[vertex.lowpoint], vertex) + local dfi = #self.vertices + 1 + local vertex = self.verticesbyinputvertex[inputvertex] + self.vertices[dfi] = vertex + -- set the dfs infos in the vertex + vertex.dfi = dfi + vertex.dfsparent = parent + vertex.leastancestor = dfi + vertex.lowpoint = dfi + -- find neighbors + for _, arc in ipairs(self.inputgraph:outgoing(inputvertex)) do + local ninputvertex = arc.head + assert(ninputvertex ~= inputvertex, "Self-loop detected!") + local nvertex = self.verticesbyinputvertex[ninputvertex] + if nvertex.dfi == nil then + -- new vertex discovered + self:predfs(ninputvertex, vertex) -- recursive call + vertex.lowpoint = math.min(vertex.lowpoint, nvertex.lowpoint) + elseif parent and ninputvertex ~= parent.inputvertex then + -- back edge found + vertex.leastancestor = math.min(vertex.leastancestor, nvertex.dfi) + vertex.lowpoint = math.min(vertex.lowpoint, nvertex.dfi) + end + end + -- put vertex into lowpoint sort bucket + table.insert(self.verticesbylowpoint[vertex.lowpoint], vertex) end -- the preprocessing at the beginning of the algorithm -- does the depth-first search and the bucket sort for the child lists function BM:preprocess() - -- make dfs starting at an arbitrary vertex - self:predfs(self.inputgraph.vertices[1]) - -- create separated child lists with bucket sort - for i = 1, self.numvertices do - for _, vertex in ipairs(self.verticesbylowpoint[i]) do - if vertex.dfsparent then - vertex.childlistelement - = vertex.dfsparent.childlist:addback(vertex) - end - end - end + -- make dfs starting at an arbitrary vertex + self:predfs(self.inputgraph.vertices[1]) + -- create separated child lists with bucket sort + for i = 1, self.numvertices do + for _, vertex in ipairs(self.verticesbylowpoint[i]) do + if vertex.dfsparent then + vertex.childlistelement + = vertex.dfsparent.childlist:addback(vertex) + end + end + end end -- adds tree edges and the corresponding virtual root vertices -- of the currentvertex function BM:add_trivial_edges(vertex) - -- find all dfs children - for _, arc in ipairs(self.inputgraph:outgoing(vertex.inputvertex)) do - local nvertex = self.verticesbyinputvertex[arc.head] - if nvertex.dfsparent == vertex then - -- create root vertex - local rootvertex = { - isroot = true, - rootparent = vertex, - rootchild = nvertex, - adjlistlinks = {}, - name = tostring(vertex) .. "^" .. tostring(nvertex) - } - setmetatable(rootvertex, Embedding.vertexmetatable) - nvertex.parentroot = rootvertex - -- create half edges - local halfedge1 = {target = nvertex, links = {}} - local halfedge2 = {target = rootvertex, links = {}} - halfedge1.twin = halfedge2 - halfedge2.twin = halfedge1 - -- create circular adjacency lists - halfedge1.links[0] = halfedge1 - halfedge1.links[1] = halfedge1 - halfedge2.links[0] = halfedge2 - halfedge2.links[1] = halfedge2 - -- create links to adjacency lists - rootvertex.adjlistlinks[0] = halfedge1 - rootvertex.adjlistlinks[1] = halfedge1 - nvertex.adjlistlinks[0] = halfedge2 - nvertex.adjlistlinks[1] = halfedge2 - end - end + -- find all dfs children + for _, arc in ipairs(self.inputgraph:outgoing(vertex.inputvertex)) do + local nvertex = self.verticesbyinputvertex[arc.head] + if nvertex.dfsparent == vertex then + -- create root vertex + local rootvertex = { + isroot = true, + rootparent = vertex, + rootchild = nvertex, + adjlistlinks = {}, + name = tostring(vertex) .. "^" .. tostring(nvertex) + } + setmetatable(rootvertex, Embedding.vertexmetatable) + nvertex.parentroot = rootvertex + -- create half edges + local halfedge1 = {target = nvertex, links = {}} + local halfedge2 = {target = rootvertex, links = {}} + halfedge1.twin = halfedge2 + halfedge2.twin = halfedge1 + -- create circular adjacency lists + halfedge1.links[0] = halfedge1 + halfedge1.links[1] = halfedge1 + halfedge2.links[0] = halfedge2 + halfedge2.links[1] = halfedge2 + -- create links to adjacency lists + rootvertex.adjlistlinks[0] = halfedge1 + rootvertex.adjlistlinks[1] = halfedge1 + nvertex.adjlistlinks[0] = halfedge2 + nvertex.adjlistlinks[1] = halfedge2 + end + end end -- for the external face vertex which was entered through link vin -- returns the successor on the external face and the link through -- which it was entered local function get_successor_on_external_face(vertex, vin) - local halfedge = vertex.adjlistlinks[1 - vin] - local svertex = halfedge.target - local sin - if vertex.adjlistlinks[0] == vertex.adjlistlinks[1] then - sin = vin - elseif svertex.adjlistlinks[0].twin == halfedge then - sin = 0 - else - sin = 1 - end - return svertex, sin + local halfedge = vertex.adjlistlinks[1 - vin] + local svertex = halfedge.target + local sin + if vertex.adjlistlinks[0] == vertex.adjlistlinks[1] then + sin = vin + elseif svertex.adjlistlinks[0].twin == halfedge then + sin = 0 + else + sin = 1 + end + return svertex, sin end -- the "walkup", used to identify the pertinent subgraph, @@ -266,63 +266,63 @@ end -- currentvertex: the vertex of the current step -- returns a root vertex of the current step, if one was found local function walkup(backvertex, currentvertex) - local currentindex = currentvertex.dfi - -- set the backedgeflag - backvertex.backedgeindex = currentindex - -- initialize traversal variables for both directions - local x, xin, y, yin = backvertex, 1, backvertex, 0 - while x ~= currentvertex do - if x.visited == currentindex or y.visited == currentindex then - -- we found a path that already has the pertinent roots marked - return nil - end - -- mark vertices as visited for later calls - x.visited = currentindex - y.visited = currentindex - - -- check for rootvertex - local rootvertex - if x.isroot then - rootvertex = x - elseif y.isroot then - rootvertex = y - end - if rootvertex then - local rootchild = rootvertex.rootchild - local rootparent = rootvertex.rootparent - if rootvertex.rootparent == currentvertex then - -- we found the other end of the back edge - return rootvertex - elseif rootchild.lowpoint < currentindex then - -- the block we just traversed is externally active - rootvertex.pertinentrootselement - = rootparent.pertinentroots:addback(rootvertex) - else - -- the block we just traversed is internally active - rootvertex.pertinentrootselement - = rootparent.pertinentroots:addfront(rootvertex) - end - -- jump to parent block - x, xin, y, yin = rootvertex.rootparent, 1, rootvertex.rootparent, 0 - else - -- just continue on the external face - x, xin = get_successor_on_external_face(x, xin) - y, yin = get_successor_on_external_face(y, yin) - end - end + local currentindex = currentvertex.dfi + -- set the backedgeflag + backvertex.backedgeindex = currentindex + -- initialize traversal variables for both directions + local x, xin, y, yin = backvertex, 1, backvertex, 0 + while x ~= currentvertex do + if x.visited == currentindex or y.visited == currentindex then + -- we found a path that already has the pertinent roots marked + return nil + end + -- mark vertices as visited for later calls + x.visited = currentindex + y.visited = currentindex + + -- check for rootvertex + local rootvertex + if x.isroot then + rootvertex = x + elseif y.isroot then + rootvertex = y + end + if rootvertex then + local rootchild = rootvertex.rootchild + local rootparent = rootvertex.rootparent + if rootvertex.rootparent == currentvertex then + -- we found the other end of the back edge + return rootvertex + elseif rootchild.lowpoint < currentindex then + -- the block we just traversed is externally active + rootvertex.pertinentrootselement + = rootparent.pertinentroots:addback(rootvertex) + else + -- the block we just traversed is internally active + rootvertex.pertinentrootselement + = rootparent.pertinentroots:addfront(rootvertex) + end + -- jump to parent block + x, xin, y, yin = rootvertex.rootparent, 1, rootvertex.rootparent, 0 + else + -- just continue on the external face + x, xin = get_successor_on_external_face(x, xin) + y, yin = get_successor_on_external_face(y, yin) + end + end end -- inverts the adjacency of a vertex -- i. e. reverses the order of the adjacency list and flips the links local function invert_adjacency(vertex) - -- reverse the list - for halfedge in Embedding.adjacency_iterator(vertex.adjlistlinks[0]) do - halfedge.links[0], halfedge.links[1] - = halfedge.links[1], halfedge.links[0] - end - -- flip links - vertex.adjlistlinks[0], vertex.adjlistlinks[1] - = vertex.adjlistlinks[1], vertex.adjlistlinks[0] + -- reverse the list + for halfedge in Embedding.adjacency_iterator(vertex.adjlistlinks[0]) do + halfedge.links[0], halfedge.links[1] + = halfedge.links[1], halfedge.links[0] + end + -- flip links + vertex.adjlistlinks[0], vertex.adjlistlinks[1] + = vertex.adjlistlinks[1], vertex.adjlistlinks[0] end -- merges two blocks by merging the virtual root of the child block @@ -336,76 +336,76 @@ end -- pin - the link of the parent through which we have entered it -- during the walkdown local function mergeblocks(mergeinfo) - local root = mergeinfo.root - local parent = mergeinfo.parent - local rout = mergeinfo.rootout - local pin = mergeinfo.parentin - if pin == rout then - -- flip required - invert_adjacency(root) - root.rootchild.sign = -1 - --rout = 1 - rout -- not needed - end - - -- redirect edges of the root vertex - for halfedge in Embedding.adjacency_iterator(root.adjlistlinks[0]) do - halfedge.twin.target = parent - end - - -- remove block from data structures - root.rootchild.parentroot = nil - parent.pertinentroots:remove(root.pertinentrootselement) - parent.childlist:remove(root.rootchild.childlistelement) - - -- merge adjacency lists - parent.adjlistlinks[0].links[1] = root.adjlistlinks[1] - parent.adjlistlinks[1].links[0] = root.adjlistlinks[0] - root.adjlistlinks[0].links[1] = parent.adjlistlinks[1] - root.adjlistlinks[1].links[0] = parent.adjlistlinks[0] - parent.adjlistlinks[pin] = root.adjlistlinks[pin] + local root = mergeinfo.root + local parent = mergeinfo.parent + local rout = mergeinfo.rootout + local pin = mergeinfo.parentin + if pin == rout then + -- flip required + invert_adjacency(root) + root.rootchild.sign = -1 + --rout = 1 - rout -- not needed + end + + -- redirect edges of the root vertex + for halfedge in Embedding.adjacency_iterator(root.adjlistlinks[0]) do + halfedge.twin.target = parent + end + + -- remove block from data structures + root.rootchild.parentroot = nil + parent.pertinentroots:remove(root.pertinentrootselement) + parent.childlist:remove(root.rootchild.childlistelement) + + -- merge adjacency lists + parent.adjlistlinks[0].links[1] = root.adjlistlinks[1] + parent.adjlistlinks[1].links[0] = root.adjlistlinks[0] + root.adjlistlinks[0].links[1] = parent.adjlistlinks[1] + root.adjlistlinks[1].links[0] = parent.adjlistlinks[0] + parent.adjlistlinks[pin] = root.adjlistlinks[pin] end -- inserts a half edge pointing to "to" into the adjacency list of "from", -- replacing the link "linkindex" local function insert_half_edge(from, linkindex, to) - local halfedge = {target = to, links = {}} - halfedge.links[ linkindex] = from.adjlistlinks[ linkindex] - halfedge.links[1 - linkindex] = from.adjlistlinks[1 - linkindex] - from.adjlistlinks[ linkindex].links[1 - linkindex] = halfedge - from.adjlistlinks[1 - linkindex].links[ linkindex] = halfedge - from.adjlistlinks[linkindex] = halfedge - return halfedge + local halfedge = {target = to, links = {}} + halfedge.links[ linkindex] = from.adjlistlinks[ linkindex] + halfedge.links[1 - linkindex] = from.adjlistlinks[1 - linkindex] + from.adjlistlinks[ linkindex].links[1 - linkindex] = halfedge + from.adjlistlinks[1 - linkindex].links[ linkindex] = halfedge + from.adjlistlinks[linkindex] = halfedge + return halfedge end -- connect the vertices x and y through the links xout and yin -- if shortcircuit is true, the edge will be marked as a short circuit edge -- and removed at the end of the algorithm function BM:embed_edge(x, xout, y, yin, shortcircuit) - -- create half edges - local halfedgex = insert_half_edge(x, xout, y) - local halfedgey = insert_half_edge(y, yin, x) - halfedgex.twin = halfedgey - halfedgey.twin = halfedgex - -- short circuit handling - if shortcircuit then - halfedgex.shortcircuit = true - halfedgey.shortcircuit = true - table.insert(self.shortcircuitedges, halfedgex) - table.insert(self.shortcircuitedges, halfedgey) - end + -- create half edges + local halfedgex = insert_half_edge(x, xout, y) + local halfedgey = insert_half_edge(y, yin, x) + halfedgex.twin = halfedgey + halfedgey.twin = halfedgex + -- short circuit handling + if shortcircuit then + halfedgex.shortcircuit = true + halfedgey.shortcircuit = true + table.insert(self.shortcircuitedges, halfedgex) + table.insert(self.shortcircuitedges, halfedgey) + end end -- returns true if the given vertex is pertinent at the current step local function pertinent(vertex, currentindex) - return vertex.backedgeindex == currentindex - or not vertex.pertinentroots:empty() + return vertex.backedgeindex == currentindex + or not vertex.pertinentroots:empty() end --- returns true if the given vertex is externally active at the current step +-- returns ttue if the given vertex is externally active at the current step local function externally_active(vertex, currentindex) - return vertex.leastancestor < currentindex - or (not vertex.childlist:empty() - and vertex.childlist:first().lowpoint < currentindex) + return vertex.leastancestor < currentindex + or (not vertex.childlist:empty() + and vertex.childlist:first().lowpoint < currentindex) end -- the "walkdown", which merges the pertinent subgraph and embeds @@ -414,148 +414,148 @@ end -- which the walkdown will start at -- currentvertex - the vertex of the current step function BM:walkdown(childrootvertex, currentvertex) - local currentindex = currentvertex.dfi - local mergestack = {} - local numinsertededges = 0 -- to return the number for count check - -- two walkdowns into both directions - for vout = 0,1 do - -- initialize the traversal variables - local w, win = get_successor_on_external_face(childrootvertex, 1 - vout) - while w ~= childrootvertex do - if w.backedgeindex == currentindex then - -- we found a backedge endpoint - -- merge all pertinent roots we found - while #mergestack > 0 do - mergeblocks(table.remove(mergestack)) - end - -- embed the back edge - self:embed_edge(childrootvertex, vout, w, win) - numinsertededges = numinsertededges + 1 - w.backedgeindex = 0 -- this shouldn't be necessary - end - if not w.pertinentroots:empty() then - -- we found a pertinent vertex with child blocks - -- create merge info for the later merge - local mergeinfo = {} - mergeinfo.parent = w - mergeinfo.parentin = win - local rootvertex = w.pertinentroots:first() - mergeinfo.root = rootvertex - -- check both directions for active vertices - local x, xin = get_successor_on_external_face(rootvertex, 1) - local y, yin = get_successor_on_external_face(rootvertex, 0) - local xpertinent = pertinent(x, currentindex) - local xexternallyactive = externally_active(x, currentindex) - local ypertinent = pertinent(y, currentindex) - local yexternallyactive = externally_active(y, currentindex) - -- chose the direction with the best vertex - if xpertinent and not xexternallyactive then - w, win = x, xin - mergeinfo.rootout = 0 - elseif ypertinent and not yexternallyactive then - w, win = y, yin - mergeinfo.rootout = 1 - elseif xpertinent then - w, win = x, xin - mergeinfo.rootout = 0 - else - w, win = y, yin - mergeinfo.rootout = 1 - end - -- this is what the paper says, but it might cause problems - -- not sure though... - --[[if w == x then - mergeinfo.rootout = 0 - else - mergeinfo.rootout = 1 - end--]] - table.insert(mergestack, mergeinfo) - elseif not pertinent(w, currentindex) - and not externally_active(w, currentindex) then - -- nothing to see here, just continue on the external face - w, win = get_successor_on_external_face(w, win) - else - -- this is a stopping vertex, walkdown will end here - -- paper puts this into the if, - -- but this should always be the case, i think - assert(childrootvertex.rootchild.lowpoint < currentindex) - if #mergestack == 0 then - -- we're in the block we started at, so we embed a back edge - self:embed_edge(childrootvertex, vout, w, win, true) - end - break - end - end - if #mergestack > 0 then - -- this means, there is a pertinent vertex blocked by stop vertices, - -- so the graph is not planar and we can skip the second walkdown - break - end - end - return numinsertededges + local currentindex = currentvertex.dfi + local mergestack = {} + local numinsertededges = 0 -- to return the number for count check + -- two walkdowns into both directions + for vout = 0,1 do + -- initialize the traversal variables + local w, win = get_successor_on_external_face(childrootvertex, 1 - vout) + while w ~= childrootvertex do + if w.backedgeindex == currentindex then + -- we found a backedge endpoint + -- merge all pertinent roots we found + while #mergestack > 0 do + mergeblocks(table.remove(mergestack)) + end + -- embed the back edge + self:embed_edge(childrootvertex, vout, w, win) + numinsertededges = numinsertededges + 1 + w.backedgeindex = 0 -- this shouldn't be necessary + end + if not w.pertinentroots:empty() then + -- we found a pertinent vertex with child blocks + -- create merge info for the later merge + local mergeinfo = {} + mergeinfo.parent = w + mergeinfo.parentin = win + local rootvertex = w.pertinentroots:first() + mergeinfo.root = rootvertex + -- check both directions for active vertices + local x, xin = get_successor_on_external_face(rootvertex, 1) + local y, yin = get_successor_on_external_face(rootvertex, 0) + local xpertinent = pertinent(x, currentindex) + local xexternallyactive = externally_active(x, currentindex) + local ypertinent = pertinent(y, currentindex) + local yexternallyactive = externally_active(y, currentindex) + -- chose the direction with the best vertex + if xpertinent and not xexternallyactive then + w, win = x, xin + mergeinfo.rootout = 0 + elseif ypertinent and not yexternallyactive then + w, win = y, yin + mergeinfo.rootout = 1 + elseif xpertinent then + w, win = x, xin + mergeinfo.rootout = 0 + else + w, win = y, yin + mergeinfo.rootout = 1 + end + -- this is what the paper sais, but it might cause problems + -- not sure though... + --[[if w == x then + mergeinfo.rootout = 0 + else + mergeinfo.rootout = 1 + end--]] + table.insert(mergestack, mergeinfo) + elseif not pertinent(w, currentindex) + and not externally_active(w, currentindex) then + -- nothing to see here, just continue on the external face + w, win = get_successor_on_external_face(w, win) + else + -- this is a stopping vertex, walkdown will end here + -- paper puts this into the if, + -- but this should always be the case, i think + assert(childrootvertex.rootchild.lowpoint < currentindex) + if #mergestack == 0 then + -- we're in the block we started at, so we embed a back edge + self:embed_edge(childrootvertex, vout, w, win, true) + end + break + end + end + if #mergestack > 0 then + -- this means, there is a pertinent vertex blocked by stop vertices, + -- so the graph is not planar and we can skip the second walkdown + break + end + end + return numinsertededges end -- embeds the back edges for the current vertex -- walkup and walkdown are called from here -- returns true, if all back edges could be embedded function BM:add_back_edges(vertex) - local pertinentroots = {} -- not in the paper - local numbackedges = 0 - -- find all back edges to vertices with lower dfi - for _, arc in ipairs(self.inputgraph:outgoing(vertex.inputvertex)) do - local nvertex = self.verticesbyinputvertex[arc.head] - if nvertex.dfi > vertex.dfi - and nvertex.dfsparent ~= vertex - and nvertex ~= vertex.dfsparent then - numbackedges = numbackedges + 1 - -- do the walkup - local rootvertex = walkup(nvertex, vertex) - if rootvertex then - -- remember the root vertex the walkup found, so we don't - -- have to call the walkdown for all root vertices - -- (or even know what the root vertices are) - table.insert(pertinentroots, rootvertex) - end - end - end - -- for all root vertices the walkup found - local insertededges = 0 - while #pertinentroots > 0 do - -- do the walkdown - insertededges = insertededges - + self:walkdown(table.remove(pertinentroots), vertex) - end - if insertededges ~= numbackedges then - -- not all back edges could be embedded -> graph is not planar - return false - end - return true + local pertinentroots = {} -- not in the paper + local numbackedges = 0 + -- find all back edges to vertices with lower dfi + for _, arc in ipairs(self.inputgraph:outgoing(vertex.inputvertex)) do + local nvertex = self.verticesbyinputvertex[arc.head] + if nvertex.dfi > vertex.dfi + and nvertex.dfsparent ~= vertex + and nvertex ~= vertex.dfsparent then + numbackedges = numbackedges + 1 + -- do the walkup + local rootvertex = walkup(nvertex, vertex) + if rootvertex then + -- remember the root vertex the walkup found, so we don't + -- have to call the walkdown for all root vertices + -- (or even know what the root vertices are) + table.insert(pertinentroots, rootvertex) + end + end + end + -- for all root vertices the walkup found + local insertededges = 0 + while #pertinentroots > 0 do + -- do the walkdown + insertededges = insertededges + + self:walkdown(table.remove(pertinentroots), vertex) + end + if insertededges ~= numbackedges then + -- not all back edges could be embedded -> graph is not planar + return false + end + return true end -- the depth-first search of the postprocessing -- flips the blocks according to the sign field function BM:postdfs(vertex, sign) - sign = sign or 1 - local root = vertex.parentroot - if root then - sign = 1 - else - sign = sign * vertex.sign - end - - if sign == -1 then - -- number of flips is odd, so we need to flip here - invert_adjacency(vertex) - end - - -- for all dfs children - for _, arc in ipairs(self.inputgraph:outgoing(vertex.inputvertex)) do - local nvertex = self.verticesbyinputvertex[arc.head] - if nvertex.dfsparent == vertex then - -- recursive call - self:postdfs(nvertex, sign) - end - end + sign = sign or 1 + local root = vertex.parentroot + if root then + sign = 1 + else + sign = sign * vertex.sign + end + + if sign == -1 then + -- number of flips is odd, so we need to flip here + invert_adjacency(vertex) + end + + -- for all dfs children + for _, arc in ipairs(self.inputgraph:outgoing(vertex.inputvertex)) do + local nvertex = self.verticesbyinputvertex[arc.head] + if nvertex.dfsparent == vertex then + -- recursive call + self:postdfs(nvertex, sign) + end + end end -- the postprocessing at the end of the algorithm @@ -565,91 +565,91 @@ end -- merges root vertices -- and cleans up the vertices function BM:postprocess() - -- flip components - self:postdfs(self.vertices[1]) - - -- unlink the short circuit edges - for _, halfedge in ipairs(self.shortcircuitedges) do - halfedge.links[0].links[1] = halfedge.links[1] - halfedge.links[1].links[0] = halfedge.links[0] - end - - -- vertex loop - local rootvertices = {} - local edgetoface = {} - for _, vertex in ipairs(self.vertices) do - -- check for root vertex and save it - local root = vertex.parentroot - if root then - table.insert(rootvertices, root) - end - - -- clean up links and create adjacency matrix - local link = vertex.adjlistlinks[0] - local adjmat = {} - vertex.adjmat = adjmat - if link then - -- make sure the link points to a half edge - -- that is no short circuit edge - while link.shortcircuit do - link = link.links[0] - end - -- create link - vertex.link = link - - -- create adjacency matrix - for halfedge in Embedding.adjacency_iterator(link) do - setmetatable(halfedge, Embedding.halfedgemetatable) - local target = halfedge.target - if target.isroot then - target = target.rootparent - end - adjmat[target] = halfedge - end - end - - -- clean up vertex - vertex.sign = nil - vertex.childlist = nil - vertex.adjlistlinks = nil - vertex.pertinentroots = nil - vertex.dfi = nil - vertex.dfsparent = nil - vertex.leastancestor = nil - vertex.lowpoint = nil - vertex.parentroot = nil - end - - -- root vertex loop - for _, root in ipairs(rootvertices) do - -- make sure the links point to a half edges - -- that are no short circuit edge - local link = root.adjlistlinks[0] - while link.shortcircuit do - link = link.links[0] - end - - -- merge into parent - local rootparent = root.rootparent - local parentlink = rootparent.link - local adjmat = rootparent.adjmat - for halfedge in Embedding.adjacency_iterator(link) do - setmetatable(halfedge, Embedding.halfedgemetatable) - halfedge.twin.target = rootparent - adjmat[halfedge.target] = halfedge - end - if parentlink == nil then - assert(rootparent.link == nil) - rootparent.link = link - else - -- merge adjacency lists - parentlink.links[0].links[1] = link - link.links[0].links[1] = parentlink - local tmp = link.links[0] - link.links[0] = parentlink.links[0] - parentlink.links[0] = tmp - end - end + -- flip components + self:postdfs(self.vertices[1]) + + -- unlink the short circuit edges + for _, halfedge in ipairs(self.shortcircuitedges) do + halfedge.links[0].links[1] = halfedge.links[1] + halfedge.links[1].links[0] = halfedge.links[0] + end + + -- vertex loop + local rootvertices = {} + local edgetoface = {} + for _, vertex in ipairs(self.vertices) do + -- check for root vertex and save it + local root = vertex.parentroot + if root then + table.insert(rootvertices, root) + end + + -- clean up links and create adjacency matrix + local link = vertex.adjlistlinks[0] + local adjmat = {} + vertex.adjmat = adjmat + if link then + -- make sure the link points to a half edge + -- that is no short circuit edge + while link.shortcircuit do + link = link.links[0] + end + -- create link + vertex.link = link + + -- create adjacency matrix + for halfedge in Embedding.adjacency_iterator(link) do + setmetatable(halfedge, Embedding.halfedgemetatable) + local target = halfedge.target + if target.isroot then + target = target.rootparent + end + adjmat[target] = halfedge + end + end + + -- clean up vertex + vertex.sign = nil + vertex.childlist = nil + vertex.adjlistlinks = nil + vertex.pertinentroots = nil + vertex.dfi = nil + vertex.dfsparent = nil + vertex.leastancestor = nil + vertex.lowpoint = nil + vertex.parentroot = nil + end + + -- root vertex loop + for _, root in ipairs(rootvertices) do + -- make sure the links point to a half edges + -- that are no short circuit edge + local link = root.adjlistlinks[0] + while link.shortcircuit do + link = link.links[0] + end + + -- merge into parent + local rootparent = root.rootparent + local parentlink = rootparent.link + local adjmat = rootparent.adjmat + for halfedge in Embedding.adjacency_iterator(link) do + setmetatable(halfedge, Embedding.halfedgemetatable) + halfedge.twin.target = rootparent + adjmat[halfedge.target] = halfedge + end + if parentlink == nil then + assert(rootparent.link == nil) + rootparent.link = link + else + -- merge adjacency lists + parentlink.links[0].links[1] = link + link.links[0].links[1] = parentlink + local tmp = link.links[0] + link.links[0] = parentlink.links[0] + parentlink.links[0] = tmp + end + end end -- the entry point of the algorithm @@ -659,20 +659,20 @@ end -- from the respective adjacency list -- the adjacency lists are in a circular order in respect to the plane graph function BM:run() - self:preprocess() - -- main loop over all vertices from lowest dfi to highest - for i = self.numvertices, 1, -1 do - local vertex = self.vertices[i] - self:add_trivial_edges(vertex) - if not self:add_back_edges(vertex) then - -- graph not planar - return nil - end - end - self:postprocess() - local embedding = Embedding.new() - embedding.vertices = self.vertices - return embedding + self:preprocess() + -- main loop over all vertices from lowest dfi to highest + for i = self.numvertices, 1, -1 do + local vertex = self.vertices[i] + self:add_trivial_edges(vertex) + if not self:add_back_edges(vertex) then + -- graph not planar + return nil + end + end + self:postprocess() + local embedding = Embedding.new() + embedding.vertices = self.vertices + return embedding end return BM diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/planar/Embedding.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/planar/Embedding.lua index 8d9d3b53b14..50fc3672207 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/planar/Embedding.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/planar/Embedding.lua @@ -6,783 +6,782 @@ require("pgf.gd.planar").Embedding = E local LinkedList = require("pgf.gd.planar.LinkedList") E.vertexmetatable = { - __tostring = function(v) - if v.name then - return v.name - elseif v.inputvertex then - return v.inputvertex.name - else - return tostring(v) - end - end + __tostring = function(v) + if v.name then + return v.name + elseif v.inputvertex then + return v.inputvertex.name + else + return tostring(v) + end + end } E.halfedgemetatable = { - __tostring = function(e) - return tostring(e.twin.target) - .. " -> " - .. tostring(e.target) - end + __tostring = function(e) + return tostring(e.twin.target) + .. " -> " + .. tostring(e.target) + end } -- create class properties E.__index = E function E.new() - local t = { - vertices = {}, - } - setmetatable(t, E) - return t + local t = { + vertices = {}, + } + setmetatable(t, E) + return t end function E:add_vertex(name, inputvertex, virtual) - virtual = virtual or nil - local vertex = { - adjmat = {}, - name = name, - inputvertex = inputvertex, - virtual = virtual, - } - setmetatable(vertex, E.vertexmetatable) - table.insert(self.vertices, vertex) - return vertex + virtual = virtual or nil + local vertex = { + adjmat = {}, + name = name, + inputvertex = inputvertex, + virtual = virtual, + } + setmetatable(vertex, E.vertexmetatable) + table.insert(self.vertices, vertex) + return vertex end function E:add_edge(v1, v2, after1, after2, virtual) - assert(v1.link == nil or v1 == after1.twin.target) - assert(v2.link == nil or v2 == after2.twin.target) - assert(v1.adjmat[v2] == nil) - assert(v2.adjmat[v1] == nil) - - virtual = virtual or nil - - local halfedge1 = { - target = v2, - virtual = virtual, - links = {}, - } - local halfedge2 = { - target = v1, - virtual = virtual, - links = {}, - } - halfedge1.twin = halfedge2 - halfedge2.twin = halfedge1 - - setmetatable(halfedge1, E.halfedgemetatable) - setmetatable(halfedge2, E.halfedgemetatable) - - if v1.link == nil then - v1.link = halfedge1 - halfedge1.links[0] = halfedge1 - halfedge1.links[1] = halfedge1 - else - halfedge1.links[0] = after1.links[0] - after1.links[0].links[1] = halfedge1 - halfedge1.links[1] = after1 - after1.links[0] = halfedge1 - end - - if v2.link == nil then - v2.link = halfedge2 - halfedge2.links[0] = halfedge2 - halfedge2.links[1] = halfedge2 - else - halfedge2.links[0] = after2.links[0] - after2.links[0].links[1] = halfedge2 - halfedge2.links[1] = after2 - after2.links[0] = halfedge2 - end - - v1.adjmat[v2] = halfedge1 - v2.adjmat[v1] = halfedge2 - - return halfedge1, halfedge2 + assert(v1.link == nil or v1 == after1.twin.target) + assert(v2.link == nil or v2 == after2.twin.target) + assert(v1.adjmat[v2] == nil) + assert(v2.adjmat[v1] == nil) + + virtual = virtual or nil + + local halfedge1 = { + target = v2, + virtual = virtual, + links = {}, + } + local halfedge2 = { + target = v1, + virtual = virtual, + links = {}, + } + halfedge1.twin = halfedge2 + halfedge2.twin = halfedge1 + + setmetatable(halfedge1, E.halfedgemetatable) + setmetatable(halfedge2, E.halfedgemetatable) + + if v1.link == nil then + v1.link = halfedge1 + halfedge1.links[0] = halfedge1 + halfedge1.links[1] = halfedge1 + else + halfedge1.links[0] = after1.links[0] + after1.links[0].links[1] = halfedge1 + halfedge1.links[1] = after1 + after1.links[0] = halfedge1 + end + + if v2.link == nil then + v2.link = halfedge2 + halfedge2.links[0] = halfedge2 + halfedge2.links[1] = halfedge2 + else + halfedge2.links[0] = after2.links[0] + after2.links[0].links[1] = halfedge2 + halfedge2.links[1] = after2 + after2.links[0] = halfedge2 + end + + v1.adjmat[v2] = halfedge1 + v2.adjmat[v1] = halfedge2 + + return halfedge1, halfedge2 end function E:remove_virtual() - local virtuals = {} - for i, v in ipairs(self.vertices) do - if v.virtual then - table.insert(virtuals, i) - else - local start = v.link - local current = start - repeat - current = current.links[0] - if current.virtual then - current.links[0].links[1] = current.links[1] - current.links[1].links[0] = current.links[0] - v.adjmat[current.target] = nil - current.target.adjmat[v] = nil - end - until current == start - end - end - for i = #virtuals, 1, -1 do - self.vertices[virtuals[i]] = self.vertices[#self.vertices] - table.remove(self.vertices) - end + local virtuals = {} + for i, v in ipairs(self.vertices) do + if v.virtual then + table.insert(virtuals, i) + else + local start = v.link + local current = start + repeat + current = current.links[0] + if current.virtual then + current.links[0].links[1] = current.links[1] + current.links[1].links[0] = current.links[0] + v.adjmat[current.target] = nil + current.target.adjmat[v] = nil + end + until current == start + end + end + for i = #virtuals, 1, -1 do + self.vertices[virtuals[i]] = self.vertices[#self.vertices] + table.remove(self.vertices) + end end -- for the use in for-loops -- iterates over the adjacency list of a vertex -- given a half edge to start and a direction (0 or 1, default 0) function E.adjacency_iterator(halfedge, direction) - direction = direction or 0 - local function next_edge(startedge, prevedge) - if prevedge == nil then - return startedge - else - local nextedge = prevedge.links[direction] - if nextedge ~= startedge then - return nextedge - else - return nil - end - end - end - return next_edge, halfedge, nil + direction = direction or 0 + local function next_edge(startedge, prevedge) + if prevedge == nil then + return startedge + else + local nextedge = prevedge.links[direction] + if nextedge ~= startedge then + return nextedge + else + return nil + end + end + end + return next_edge, halfedge, nil end function E.face_iterator(halfedge, direction) - direction = direction or 0 - local function next_edge(startedge, prevedge) - if prevedge == nil then - return startedge - else - local nextedge = prevedge.twin.links[1 - direction] - if nextedge ~= startedge then - return nextedge - else - return nil - end - end - end - return next_edge, halfedge, nil + direction = direction or 0 + local function next_edge(startedge, prevedge) + if prevedge == nil then + return startedge + else + local nextedge = prevedge.twin.links[1 - direction] + if nextedge ~= startedge then + return nextedge + else + return nil + end + end + end + return next_edge, halfedge, nil end function E:triangulate() - local visited = {} - for _, vertex in ipairs(self.vertices) do - for start in E.adjacency_iterator(vertex.link) do - if not visited[start] then - local prev = start - local beforestart = start.links[0].twin - local current = start.twin.links[1] - local next = current.twin.links[1] - visited[start] = true - visited[current] = true - visited[next] = true - while next ~= beforestart do - local halfedge1, halfedge2 - if vertex ~= current.target - and not vertex.adjmat[current.target] then - halfedge1, halfedge2 = self:add_edge( - vertex, current.target, - prev, next, - true - ) - - prev = halfedge1 - current = next - next = next.twin.links[1] - elseif not prev.target.adjmat[next.target] then - halfedge1, halfedge2 = self:add_edge( - prev.target, next.target, - current, next.twin.links[1], - true - ) - - current = halfedge1 - next = halfedge2.links[1] - else - local helper = next.twin.links[1] - halfedge1, halfedge2 = self:add_edge( - current.target, helper.target, - next, helper.twin.links[1], - true - ) - - next = halfedge1 - end - - visited[next] = true - visited[halfedge1] = true - visited[halfedge2] = true - end - end - end - end + local visited = {} + for _, vertex in ipairs(self.vertices) do + for start in E.adjacency_iterator(vertex.link) do + if not visited[start] then + local prev = start + local beforestart = start.links[0].twin + local current = start.twin.links[1] + local next = current.twin.links[1] + visited[start] = true + visited[current] = true + visited[next] = true + while next ~= beforestart do + local halfedge1, halfedge2 + if vertex ~= current.target + and not vertex.adjmat[current.target] then + halfedge1, halfedge2 = self:add_edge( + vertex, current.target, + prev, next, + true + ) + + prev = halfedge1 + current = next + next = next.twin.links[1] + elseif not prev.target.adjmat[next.target] then + halfedge1, halfedge2 = self:add_edge( + prev.target, next.target, + current, next.twin.links[1], + true + ) + + current = halfedge1 + next = halfedge2.links[1] + else + local helper = next.twin.links[1] + halfedge1, halfedge2 = self:add_edge( + current.target, helper.target, + next, helper.twin.links[1], + true + ) + + next = halfedge1 + end + + visited[next] = true + visited[halfedge1] = true + visited[halfedge2] = true + end + end + end + end end function E:canonical_order(v1, v2, vn) - local n = #self.vertices - local order = { v1 } - local marks = { [v1] = "ordered", [v2] = 0 } - local visited = {} - local vk = v1 - local candidates = LinkedList.new() - local listelements = {} - for k = 1, n-2 do - for halfedge in E.adjacency_iterator(vk.link) do - local vertex = halfedge.target - if vertex ~= vn then - local twin = halfedge.twin - visited[twin] = true - if marks[vertex] == nil then - marks[vertex] = "visited" - elseif marks[vertex] ~= "ordered" then - local neighbor1 = visited[twin.links[0]] - local neighbor2 = visited[twin.links[1]] - if marks[vertex] == "visited" then - if neighbor1 or neighbor2 then - marks[vertex] = 1 - listelements[vertex] = candidates:addback(vertex) - else - marks[vertex] = 2 - end - else - if neighbor1 == neighbor2 then - if neighbor1 and neighbor2 then - marks[vertex] = marks[vertex] - 1 - else - marks[vertex] = marks[vertex] + 1 - end - if marks[vertex] == 1 then - listelements[vertex] - = candidates:addback(vertex) - elseif listelements[vertex] then - candidates:remove(listelements[vertex]) - listelements[vertex] = nil - end - end - end - end - end - end - vk = candidates:popfirst() - order[k+1] = vk - marks[vk] = "ordered" - end - order[n] = vn - return order + local n = #self.vertices + local order = { v1 } + local marks = { [v1] = "ordered", [v2] = 0 } + local visited = {} + local vk = v1 + local candidates = LinkedList.new() + local listelements = {} + for k = 1, n-2 do + for halfedge in E.adjacency_iterator(vk.link) do + local vertex = halfedge.target + if vertex ~= vn then + local twin = halfedge.twin + visited[twin] = true + if marks[vertex] == nil then + marks[vertex] = "visited" + elseif marks[vertex] ~= "ordered" then + local neighbor1 = visited[twin.links[0]] + local neighbor2 = visited[twin.links[1]] + if marks[vertex] == "visited" then + if neighbor1 or neighbor2 then + marks[vertex] = 1 + listelements[vertex] = candidates:addback(vertex) + else + marks[vertex] = 2 + end + else + if neighbor1 == neighbor2 then + if neighbor1 and neighbor2 then + marks[vertex] = marks[vertex] - 1 + else + marks[vertex] = marks[vertex] + 1 + end + if marks[vertex] == 1 then + listelements[vertex] + = candidates:addback(vertex) + elseif listelements[vertex] then + candidates:remove(listelements[vertex]) + listelements[vertex] = nil + end + end + end + end + end + end + vk = candidates:popfirst() + order[k+1] = vk + marks[vk] = "ordered" + end + order[n] = vn + return order end function E:get_biggest_face() - local number = 0 - local edge - local visited = {} - for _, vertex in ipairs(self.vertices) do - for start in E.adjacency_iterator(vertex.link) do - local count = 0 - if not visited[start] then - visited[start] = true - local current = start - repeat - count = count + 1 - current = current.twin.links[1] - until current == start - if count > number then - number = count - edge = start - end - end - end - end - return edge, number + local number = 0 + local edge + local visited = {} + for _, vertex in ipairs(self.vertices) do + for start in E.adjacency_iterator(vertex.link) do + local count = 0 + if not visited[start] then + visited[start] = true + local current = start + repeat + count = count + 1 + current = current.twin.links[1] + until current == start + if count > number then + number = count + edge = start + end + end + end + end + return edge, number end function E:surround_by_triangle(faceedge, facesize) - local divisor = 3 - if facesize > 3 then - divisor = 4 - end - local basenodes = math.floor(facesize / divisor) - local extranodes = facesize % divisor - local attachnodes = { basenodes, basenodes, basenodes } - if facesize > 3 then - attachnodes[2] = basenodes * 2 - end - for i = 1,extranodes do - attachnodes[i] = attachnodes[i] + 1 - end - - local v = { - self:add_vertex("$v_1$", nil, true), - self:add_vertex("$v_n$", nil, true), - self:add_vertex("$v_2$", nil, true) - } - for i = 1,3 do - local currentv = v[i] - local nextv = v[i % 3 + 1] - self:add_edge(currentv, nextv, currentv.link, nextv.link, true) - end - - local current = faceedge - local next = current.twin.links[1] - for i = 1,3 do - local vertex = v[i] - local otheredge = vertex.adjmat[v[i % 3 + 1]] - local previnserted = otheredge.links[1] - for count = 1, attachnodes[i] do - if not vertex.adjmat[current.target] then - previnserted, _ = self:add_edge( - vertex, current.target, - previnserted, next, - true - ) - end - - current = next - next = next.twin.links[1] - end - if not vertex.adjmat[current.target] then - previnserted, _ = self:add_edge( - vertex, current.target, - previnserted, next, - true - ) - current = previnserted - end - end - return v[1], v[3], v[2] + local divisor = 3 + if facesize > 3 then + divisor = 4 + end + local basenodes = math.floor(facesize / divisor) + local extranodes = facesize % divisor + local attachnodes = { basenodes, basenodes, basenodes } + if facesize > 3 then + attachnodes[2] = basenodes * 2 + end + for i = 1,extranodes do + attachnodes[i] = attachnodes[i] + 1 + end + + local v = { + self:add_vertex("$v_1$", nil, true), + self:add_vertex("$v_n$", nil, true), + self:add_vertex("$v_2$", nil, true) + } + for i = 1,3 do + local currentv = v[i] + local nextv = v[i % 3 + 1] + self:add_edge(currentv, nextv, currentv.link, nextv.link, true) + end + + local current = faceedge + local next = current.twin.links[1] + for i = 1,3 do + local vertex = v[i] + local otheredge = vertex.adjmat[v[i % 3 + 1]] + local previnserted = otheredge.links[1] + for count = 1, attachnodes[i] do + if not vertex.adjmat[current.target] then + previnserted, _ = self:add_edge(vertex, current.target, + previnserted, next, + true + ) + end + + current = next + next = next.twin.links[1] + end + if not vertex.adjmat[current.target] then + previnserted, _ = self:add_edge( + vertex, current.target, + previnserted, next, + true + ) + current = previnserted + end + end + return v[1], v[3], v[2] end function E:improve() - local pairdata = {} - local inpair = {} - for i, v1 in ipairs(self.vertices) do - for j = i + 1, #self.vertices do - local v2 = self.vertices[j] - local pd = self:find_pair_components(v1, v2) - if pd then - inpair[v1] = true - inpair[v2] = true - table.insert(pairdata, pd) - end - end - if not inpair[v1] then - local pd = self:find_pair_components(v1, nil) - if pd then - inpair[v1] = true - table.insert(pairdata, pd) - end - end - end - - local changed - local runs = 1 - local edgepositions = {} - repeat - changed = false - for i, pd in ipairs(pairdata) do - self:improve_separation_pair(pd) - end - -- check for changes - for i, v in ipairs(self.vertices) do - local start = v.link - local current = start - local counter = 1 - repeat - if counter ~= edgepositions[current] then - changed = true - edgepositions[current] = counter - end - counter = counter + 1 - current = current.links[0] - until current == start - end - runs = runs + 1 - until changed == false or runs > 100 + local pairdata = {} + local inpair = {} + for i, v1 in ipairs(self.vertices) do + for j = i + 1, #self.vertices do + local v2 = self.vertices[j] + local pd = self:find_pair_components(v1, v2) + if pd then + inpair[v1] = true + inpair[v2] = true + table.insert(pairdata, pd) + end + end + if not inpair[v1] then + local pd = self:find_pair_components(v1, nil) + if pd then + inpair[v1] = true + table.insert(pairdata, pd) + end + end + end + + local changed + local runs = 1 + local edgepositions = {} + repeat + changed = false + for i, pd in ipairs(pairdata) do + self:improve_separation_pair(pd) + end + -- check for changes + for i, v in ipairs(self.vertices) do + local start = v.link + local current = start + local counter = 1 + repeat + if counter ~= edgepositions[current] then + changed = true + edgepositions[current] = counter + end + counter = counter + 1 + current = current.links[0] + until current == start + end + runs = runs + 1 + until changed == false or runs > 100 end function E:find_pair_components(v1, v2) - local visited = {} - local companchors = {} - local edgecomps = {} - local compvertices = {} - local islinear = {} - local edgeindices = {} - - local pair = { v1, v2 } - local start = v1.link - local current = start - local edgeindex = 1 - -- start searches from v1 - repeat - edgeindices[current] = edgeindex - edgeindex = edgeindex + 1 - if not edgecomps[current] then - local compindex = #companchors + 1 - local ca, il - edgecomps[current] = compindex - compvertices[compindex] = {} - local target = current.target - if target == v2 then - edgecomps[current.twin] = compindex - ca = 3 - il = true - else - ca, il = self:component_dfs( - target, - pair, - visited, - edgecomps, - compvertices[compindex], - compindex - ) - end - companchors[compindex] = ca - islinear[compindex] = il - end - current = current.links[0] - until current == start - - if v2 then - start = v2.link - current = start - local lastincomp = true - local edgeindex = 1 - -- now find the remaining blocks at v2 - repeat - edgeindices[current] = edgeindex - edgeindex = edgeindex + 1 - if not edgecomps[current] then - local compindex = #companchors + 1 - edgecomps[current] = compindex - compvertices[compindex] = {} - self:component_dfs( - current.target, - pair, - visited, - edgecomps, - compvertices[compindex], - compindex - ) - companchors[compindex] = 2 - end - current = current.links[0] - until current == start - end - - -- init compedges, tricomps, twocomps - local tricomps = {} - local twocomps = {{}, {}} - for i, anchors in ipairs(companchors) do - if anchors == 3 then - table.insert(tricomps, i) - else - table.insert(twocomps[anchors], i) - end - end - - local flipimmune = #tricomps == 2 - and (islinear[tricomps[1]] or islinear[tricomps[2]]) - if (#tricomps < 2 or flipimmune) - and (v2 ~= nil or #twocomps[1] < 2) then - return nil - end - - -- order tri comps cyclic - local function sorter(a, b) - return #compvertices[a] < #compvertices[b] - end - - table.sort(tricomps, sorter) - - -- determine order of comps - local numtricomps = #tricomps - local comporder = { {}, {} } - local bottom = math.ceil(numtricomps / 2) - local top = bottom + 1 - for i, comp in ipairs(tricomps) do - if i % 2 == 1 then - comporder[1][bottom] = comp - comporder[2][numtricomps - bottom + 1] = comp - bottom = bottom - 1 - else - comporder[1][top] = comp - comporder[2][numtricomps - top + 1] = comp - top = top + 1 - end - end - - local pairdata = { - pair = pair, - companchors = companchors, - edgecomps = edgecomps, - edgeindices = edgeindices, - compvertices = compvertices, - tricomps = tricomps, - twocomps = twocomps, - comporder = comporder, - } - return pairdata + local visited = {} + local companchors = {} + local edgecomps = {} + local compvertices = {} + local islinear = {} + local edgeindices = {} + + local pair = { v1, v2 } + local start = v1.link + local current = start + local edgeindex = 1 + -- start searches from v1 + repeat + edgeindices[current] = edgeindex + edgeindex = edgeindex + 1 + if not edgecomps[current] then + local compindex = #companchors + 1 + local ca, il + edgecomps[current] = compindex + compvertices[compindex] = {} + local target = current.target + if target == v2 then + edgecomps[current.twin] = compindex + ca = 3 + il = true + else + ca, il = self:component_dfs( + target, + pair, + visited, + edgecomps, + compvertices[compindex], + compindex + ) + end + companchors[compindex] = ca + islinear[compindex] = il + end + current = current.links[0] + until current == start + + if v2 then + start = v2.link + current = start + local lastincomp = true + local edgeindex = 1 + -- now find the remaining blocks at v2 + repeat + edgeindices[current] = edgeindex + edgeindex = edgeindex + 1 + if not edgecomps[current] then + local compindex = #companchors + 1 + edgecomps[current] = compindex + compvertices[compindex] = {} + self:component_dfs( + current.target, + pair, + visited, + edgecomps, + compvertices[compindex], + compindex + ) + companchors[compindex] = 2 + end + current = current.links[0] + until current == start + end + + -- init compedges, tricomps, twocomps + local tricomps = {} + local twocomps = {{}, {}} + for i, anchors in ipairs(companchors) do + if anchors == 3 then + table.insert(tricomps, i) + else + table.insert(twocomps[anchors], i) + end + end + + local flipimmune = #tricomps == 2 + and (islinear[tricomps[1]] or islinear[tricomps[2]]) + if (#tricomps < 2 or flipimmune) + and (v2 ~= nil or #twocomps[1] < 2) then + return nil + end + + -- order tri comps cyclic + local function sorter(a, b) + return #compvertices[a] < #compvertices[b] + end + + table.sort(tricomps, sorter) + + -- determine order of comps + local numtricomps = #tricomps + local comporder = { {}, {} } + local bottom = math.ceil(numtricomps / 2) + local top = bottom + 1 + for i, comp in ipairs(tricomps) do + if i % 2 == 1 then + comporder[1][bottom] = comp + comporder[2][numtricomps - bottom + 1] = comp + bottom = bottom - 1 + else + comporder[1][top] = comp + comporder[2][numtricomps - top + 1] = comp + top = top + 1 + end + end + + local pairdata = { + pair = pair, + companchors = companchors, + edgecomps = edgecomps, + edgeindices = edgeindices, + compvertices = compvertices, + tricomps = tricomps, + twocomps = twocomps, + comporder = comporder, + } + return pairdata end function E:component_dfs(v, pair, visited, edgecomps, compvertices, compindex) - visited[v] = true - local start = v.link - local current = start - local companchors = 1 - local numedges = 0 - local islinear = true - table.insert(compvertices, v) - repeat - numedges = numedges + 1 - local target = current.target - if target == pair[1] or target == pair[2] then - edgecomps[current.twin] = compindex - if target == pair[2] then - companchors = 3 - end - elseif not visited[target] then - local ca, il = self:component_dfs( - target, - pair, - visited, - edgecomps, - compvertices, - compindex - ) - if ca == 3 then - companchors = 3 - end - islinear = islinear and il - end - current = current.links[0] - until current == start - return companchors, islinear and numedges == 2 + visited[v] = true + local start = v.link + local current = start + local companchors = 1 + local numedges = 0 + local islinear = true + table.insert(compvertices, v) + repeat + numedges = numedges + 1 + local target = current.target + if target == pair[1] or target == pair[2] then + edgecomps[current.twin] = compindex + if target == pair[2] then + companchors = 3 + end + elseif not visited[target] then + local ca, il = self:component_dfs( + target, + pair, + visited, + edgecomps, + compvertices, + compindex + ) + if ca == 3 then + companchors = 3 + end + islinear = islinear and il + end + current = current.links[0] + until current == start + return companchors, islinear and numedges == 2 end function E:improve_separation_pair(pairdata) - local pair = pairdata.pair - local companchors = pairdata.companchors - local edgecomps = pairdata.edgecomps - local edgeindices = pairdata.edgeindices - local compvertices = pairdata.compvertices - local tricomps = pairdata.tricomps - local twocomps = pairdata.twocomps - local comporder = pairdata.comporder - local v1 = pair[1] - local v2 = pair[2] - - local compedges = {} - for i = 1, #companchors do - compedges[i] = {{}, {}} - end - - local numtricomps = #tricomps - local numtwocomps = { #twocomps[1], #twocomps[2] } - - -- find compedges - for i = 1, #pair do - -- first find an edge that is the first of a triconnected component - local start2 - if v2 then - start = pair[i].link - current = start - local last - repeat - local comp = edgecomps[current] - if companchors[comp] == 3 then - if last == nil then - last = comp - elseif last ~= comp then - start2 = current - break - end - end - current = current.links[0] - until current == start - else - start2 = pair[i].link - end - -- now list the edges by components - current = start2 - repeat - table.insert(compedges[edgecomps[current]][i], current) - current = current.links[0] - until current == start2 - end - - -- count edges on each side of tri comps - local edgecount = {} - for _, comp in ipairs(tricomps) do - edgecount[comp] = {} - for i = 1, #pair do - local count = 1 - local current = compedges[comp][i][1] - local other = pair[3 - i] - while current.target ~= other do - count = count + 1 - current = current.twin.links[0] - end - edgecount[comp][i] = count - end - end - - -- determine which comps have to be flipped - local flips = {} - local numflips = 0 - local allflipped = true - for i, comp in ipairs(comporder[1]) do - local side1, side2 - if i > numtricomps / 2 then - side1 = edgecount[comp][1] - side2 = edgecount[comp][2] - else - side1 = edgecount[comp][2] - side2 = edgecount[comp][1] - end - if side1 > side2 then - numflips = numflips + 1 - flips[comp] = true - elseif side1 < side2 then - allflipped = false - end - end - - if allflipped then - for i, comp in ipairs(tricomps) do - flips[comp] = false - end - else - for i, comp in ipairs(tricomps) do - if flips[comp] then - for _, v in ipairs(compvertices[comp]) do - local start = v.link - local current = start - repeat - current.links[0], current.links[1] - = current.links[1], current.links[0] - current = current.links[1] - until current == start - end - end - end - end - - -- order edges cyclic per component (one cycle for all tri comps) - for i = 1, #pair do - if v2 then - local co - if allflipped then - co = comporder[3 - i] - else - co = comporder[i] - end - - local id = co[numtricomps] - lastedges = compedges[id][i] - if flips[id] then - lastedge = lastedges[1] - else - lastedge = lastedges[#lastedges] - end - - -- tri comps - for _, id in ipairs(co) do - local edges = compedges[id][i] - local from - local to - local step - if flips[id] then - from = #edges - to = 1 - step = -1 - else - from = 1 - to = #edges - step = 1 - end - for k = from, to, step do - local edge = edges[k] - lastedge.links[0] = edge - edge.links[1] = lastedge - lastedge = edge - end - end - end - - -- two comps - for _, id in ipairs(twocomps[i]) do - lastedges = compedges[id][i] - lastedge = lastedges[#lastedges] - for _, edge in ipairs(compedges[id][i]) do - lastedge.links[0] = edge - edge.links[1] = lastedge - lastedge = edge - end - end - end - - -- now merge the cycles - for i = 1, #pair do - local outeredges = {} - -- find the biggest face of the tri comps - if v2 then - local biggestedge - local biggestsize - local biggestindex - local start = compedges[tricomps[1]][i][1] - local current = start - repeat - local size = self:get_face_size(current) - if not biggestedge or size > biggestsize - or (size == biggestsize - and edgeindices[current] > biggestindex) then - biggestedge = current - biggestsize = size - biggestindex = edgeindices[current] - end - current = current.links[0] - until current == start - outeredges[1] = biggestedge - end - - -- now for every two comp - for _, id in ipairs(twocomps[i]) do - local biggestedge - local biggestsize - local biggestindex - local start = compedges[id][i][1] - local current = start - repeat - local size = self:get_face_size(current) - if not biggestedge or size > biggestsize - or (size == biggestsize - and edgeindices[current] > biggestindex) then - biggestedge = current - biggestsize = size - biggestindex = edgeindices[current] - end - current = current.links[0] - until current == start - table.insert(outeredges, biggestedge) - end - - -- now merge all comps at the outer edges - local lastedge = outeredges[#outeredges].links[0] - for _, edge in ipairs(outeredges) do - local nextlastedge = edge.links[0] - lastedge.links[1] = edge - edge.links[0] = lastedge - lastedge = nextlastedge - end - end + local pair = pairdata.pair + local companchors = pairdata.companchors + local edgecomps = pairdata.edgecomps + local edgeindices = pairdata.edgeindices + local compvertices = pairdata.compvertices + local tricomps = pairdata.tricomps + local twocomps = pairdata.twocomps + local comporder = pairdata.comporder + local v1 = pair[1] + local v2 = pair[2] + + local compedges = {} + for i = 1, #companchors do + compedges[i] = {{}, {}} + end + + local numtricomps = #tricomps + local numtwocomps = { #twocomps[1], #twocomps[2] } + + -- find compedges + for i = 1, #pair do + -- first find an edge that is the first of a triconnected component + local start2 + if v2 then + start = pair[i].link + current = start + local last + repeat + local comp = edgecomps[current] + if companchors[comp] == 3 then + if last == nil then + last = comp + elseif last ~= comp then + start2 = current + break + end + end + current = current.links[0] + until current == start + else + start2 = pair[i].link + end + -- now list the edges by components + current = start2 + repeat + table.insert(compedges[edgecomps[current]][i], current) + current = current.links[0] + until current == start2 + end + + -- count edges on each side of tri comps + local edgecount = {} + for _, comp in ipairs(tricomps) do + edgecount[comp] = {} + for i = 1, #pair do + local count = 1 + local current = compedges[comp][i][1] + local other = pair[3 - i] + while current.target ~= other do + count = count + 1 + current = current.twin.links[0] + end + edgecount[comp][i] = count + end + end + + -- determine which comps have to be flipped + local flips = {} + local numflips = 0 + local allflipped = true + for i, comp in ipairs(comporder[1]) do + local side1, side2 + if i > numtricomps / 2 then + side1 = edgecount[comp][1] + side2 = edgecount[comp][2] + else + side1 = edgecount[comp][2] + side2 = edgecount[comp][1] + end + if side1 > side2 then + numflips = numflips + 1 + flips[comp] = true + elseif side1 < side2 then + allflipped = false + end + end + + if allflipped then + for i, comp in ipairs(tricomps) do + flips[comp] = false + end + else + for i, comp in ipairs(tricomps) do + if flips[comp] then + for _, v in ipairs(compvertices[comp]) do + local start = v.link + local current = start + repeat + current.links[0], current.links[1] + = current.links[1], current.links[0] + current = current.links[1] + until current == start + end + end + end + end + + -- order edges cyclic per component (one cycle for all tri comps) + for i = 1, #pair do + if v2 then + local co + if allflipped then + co = comporder[3 - i] + else + co = comporder[i] + end + + local id = co[numtricomps] + lastedges = compedges[id][i] + if flips[id] then + lastedge = lastedges[1] + else + lastedge = lastedges[#lastedges] + end + + -- tri comps + for _, id in ipairs(co) do + local edges = compedges[id][i] + local from + local to + local step + if flips[id] then + from = #edges + to = 1 + step = -1 + else + from = 1 + to = #edges + step = 1 + end + for k = from, to, step do + local edge = edges[k] + lastedge.links[0] = edge + edge.links[1] = lastedge + lastedge = edge + end + end + end + + -- two comps + for _, id in ipairs(twocomps[i]) do + lastedges = compedges[id][i] + lastedge = lastedges[#lastedges] + for _, edge in ipairs(compedges[id][i]) do + lastedge.links[0] = edge + edge.links[1] = lastedge + lastedge = edge + end + end + end + + -- now merge the cycles + for i = 1, #pair do + local outeredges = {} + -- find the biggest face of the tri comps + if v2 then + local biggestedge + local biggestsize + local biggestindex + local start = compedges[tricomps[1]][i][1] + local current = start + repeat + local size = self:get_face_size(current) + if not biggestedge or size > biggestsize + or (size == biggestsize + and edgeindices[current] > biggestindex) then + biggestedge = current + biggestsize = size + biggestindex = edgeindices[current] + end + current = current.links[0] + until current == start + outeredges[1] = biggestedge + end + + -- now for every two comp + for _, id in ipairs(twocomps[i]) do + local biggestedge + local biggestsize + local biggestindex + local start = compedges[id][i][1] + local current = start + repeat + local size = self:get_face_size(current) + if not biggestedge or size > biggestsize + or (size == biggestsize + and edgeindices[current] > biggestindex) then + biggestedge = current + biggestsize = size + biggestindex = edgeindices[current] + end + current = current.links[0] + until current == start + table.insert(outeredges, biggestedge) + end + + -- now merge all comps at the outer edges + local lastedge = outeredges[#outeredges].links[0] + for _, edge in ipairs(outeredges) do + local nextlastedge = edge.links[0] + lastedge.links[1] = edge + edge.links[0] = lastedge + lastedge = nextlastedge + end + end end function E:get_face_size(halfedge) - local size = 0 - local current = halfedge - repeat - size = size + 1 - current = current.twin.links[1] - until current == halfedge - return size + local size = 0 + local current = halfedge + repeat + size = size + 1 + current = current.twin.links[1] + until current == halfedge + return size end return E diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/planar/LinkedList.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/planar/LinkedList.lua index 35f8418fdf0..99a23501858 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/planar/LinkedList.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/planar/LinkedList.lua @@ -3,86 +3,86 @@ local LinkedList = {} LinkedList.__index = LinkedList function LinkedList.new() - local list = {elements = {}} - setmetatable(list, LinkedList) - return list + local list = {elements = {}} + setmetatable(list, LinkedList) + return list end function LinkedList:addback(payload) - if payload == nil then - error("Need a payload!", 2) - end - local element = { payload = payload } - if self.head then - local tail = self.head.prev - self.head.prev = element - tail.next = element - element.next = self.head - element.prev = tail - else - self.head = element - element.next = element - element.prev = element - end - self.elements[element] = true - return element + if payload == nil then + error("Need a payload!", 2) + end + local element = { payload = payload } + if self.head then + local tail = self.head.prev + self.head.prev = element + tail.next = element + element.next = self.head + element.prev = tail + else + self.head = element + element.next = element + element.prev = element + end + self.elements[element] = true + return element end function LinkedList:addfront(payload) - self.head = self:addback(payload) - return self.head + self.head = self:addback(payload) + return self.head end function LinkedList:remove(element) - if self.elements[element] == nil then - error("Element not in list!", 2) - end - if self.head == element then - if element.next == element then - self.head = nil - else - self.head = element.next - end - end - element.prev.next = element.next - element.next.prev = element.prev - self.elements[element] = nil + if self.elements[element] == nil then + error("Element not in list!", 2) + end + if self.head == element then + if element.next == element then + self.head = nil + else + self.head = element.next + end + end + element.prev.next = element.next + element.next.prev = element.prev + self.elements[element] = nil end function LinkedList:popfirst() - if self.head == nil then - return nil - end - local element = self.head - if element.next == element then - self.head = nil - else - self.head = element.next - element.next.prev = element.prev - element.prev.next = element.next - end - self.elements[element] = nil - return element.payload + if self.head == nil then + return nil + end + local element = self.head + if element.next == element then + self.head = nil + else + self.head = element.next + element.next.prev = element.prev + element.prev.next = element.next + end + self.elements[element] = nil + return element.payload end function LinkedList:poplast() - if self.head == nil then - return nil - end - self.head = self.head.prev - return self:popfirst() + if self.head == nil then + return nil + end + self.head = self.head.prev + return self:popfirst() end function LinkedList:first() - return self.head and self.head.payload + return self.head and self.head.payload end function LinkedList:last() - return self.head and self.head.prev.payload + return self.head and self.head.prev.payload end function LinkedList:empty() - return self.head == nil + return self.head == nil end return LinkedList diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/planar/List.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/planar/List.lua index 22a91e65710..564216a8c37 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/planar/List.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/planar/List.lua @@ -3,47 +3,47 @@ local List = {} List.__index = List function List.new() - local t = {first = 0, last = -1} - setmetatable(t, List) - return t + local t = {first = 0, last = -1} + setmetatable(t, List) + return t end function List:pushleft(value) - local first = self.first - 1 - self.first = first - self[first] = value + local first = self.first - 1 + self.first = first + self[first] = value end function List:pushright(value) - local last = self.last + 1 - self.last = last - self[last] = value + local last = self.last + 1 + self.last = last + self[last] = value end function List:popleft() - local first = self.first - if first > self.last then error("List is empty") end - local value = self[first] - self[first] = nil - self.first = first + 1 - return value + local first = self.first + if first > self.last then error("List is empty") end + local value = self[first] + self[first] = nil + self.first = first + 1 + return value end function List:popright() - local last = self.last - if self.first > last then error("List is empty") end - local value = self[last] - self[last] = nil - self.last = last - 1 - return value + local last = self.last + if self.first > last then error("List is empty") end + local value = self[last] + self[last] = nil + self.last = last - 1 + return value end function List:size() - return self.last - self.first + 1 + return self.last - self.first + 1 end function List:empty() - return self.last < self.first + return self.last < self.first end return List diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/planar/PDP.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/planar/PDP.lua index 8c159cf61dc..fbf94a52502 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/planar/PDP.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/planar/PDP.lua @@ -11,564 +11,564 @@ local Path = require "pgf.gd.model.Path" PDP.__index = PDP function PDP.new(ugraph, embedding, - delta, gamma, coolingfactor, - expiterations, - startrepexp, endrepexp, - startattexp, endattexp, - appthreshold, stretchthreshold, - stresscounterthreshold, - numdivisions) - local t = { - ugraph = ugraph, - embedding = embedding, - delta = delta , - gamma = gamma, - coolingfactor = coolingfactor, - expiterations = expiterations, - startrepexp = startrepexp, - endrepexp = endrepexp, - startattexp = startattexp, - endattexp = endattexp, - appthreshold = appthreshold, - stretchthreshold = stretchthreshold, - stresscounterthreshold = stresscounterthreshold, - numdivisions = numdivisions, - posxs = {}, - posys = {}, - cvsxs = {}, - cvsys = {}, - embeddingedges = {}, - edgeids = {}, - numedgeids = 0, - vertexids = {}, - numvertexids = 0, - vertexpairs1 = {}, - vertexpairs2 = {}, - pairconnected = {}, - edgepairsvertex = {}, - edgepairsedge = {}, - edgevertex1 = {}, - edgevertex2 = {}, - edgedeprecated = {}, - subdivisionedges = {}, - subdivisionvertices = {}, - temperature = 1, - } - - setmetatable(t, PDP) - return t + delta, gamma, coolingfactor, + expiterations, + startrepexp, endrepexp, + startattexp, endattexp, + appthreshold, stretchthreshold, + stresscounterthreshold, + numdivisions) + local t = { + ugraph = ugraph, + embedding = embedding, + delta = delta , + gamma = gamma, + coolingfactor = coolingfactor, + expiterations = expiterations, + startrepexp = startrepexp, + endrepexp = endrepexp, + startattexp = startattexp, + endattexp = endattexp, + appthreshold = appthreshold, + stretchthreshold = stretchthreshold, + stresscounterthreshold = stresscounterthreshold, + numdivisions = numdivisions, + posxs = {}, + posys = {}, + cvsxs = {}, + cvsys = {}, + embeddingedges = {}, + edgeids = {}, + numedgeids = 0, + vertexids = {}, + numvertexids = 0, + vertexpairs1 = {}, + vertexpairs2 = {}, + pairconnected = {}, + edgepairsvertex = {}, + edgepairsedge = {}, + edgevertex1 = {}, + edgevertex2 = {}, + edgedeprecated = {}, + subdivisionedges = {}, + subdivisionvertices = {}, + temperature = 1, + } + + setmetatable(t, PDP) + return t end function PDP:run() - self:normalize_size() - self:find_force_pairs() - - local delta = self.delta - local gamma = self.gamma - local coolingfactor = self.coolingfactor - local expiterations = self.expiterations - local startrepexp = self.startrepexp - local endattexp = self.endattexp - local startattexp = self.startattexp - local endrepexp = self.endrepexp - - local vertexpairs1 = self.vertexpairs1 - local vertexpairs2 = self.vertexpairs2 - local pairconnected = self.pairconnected - local edgepairsvertex = self.edgepairsvertex - local edgepairsedge = self.edgepairsedge - local edgevertex1 = self.edgevertex1 - local edgevertex2 = self.edgevertex2 - local edgedeprecated = self.edgedeprecated - - local forcexs = {} - local forceys = {} - local posxs = self.posxs - local posys = self.posys - local cvsxs = self.cvsxs - local cvsys = self.cvsys - local numcvs = {} - for i, v in ipairs(self.embedding.vertices) do - cvsxs[i] = {} - cvsys[i] = {} - posxs[i] = v.inputvertex.pos.x - posys[i] = v.inputvertex.pos.y - end - - local numorigvertices = self.numvertexids - local numorigedges = self.numedgeids - local numdivisions = self.numdivisions - local divdelta = delta / (numdivisions + 1) - local stresscounter = {} - for i = 1, self.numedgeids do - stresscounter[i] = 0 - end - - local appthreshold = self.appthreshold - local stretchthreshold = self.stretchthreshold - local stresscounterthreshold = self.stresscounterthreshold - - for i = 1, numorigedges do - local iv1 = self.embedding.vertices[edgevertex1[i]].inputvertex - local iv2 = self.embedding.vertices[edgevertex2[i]].inputvertex - local arc = self.ugraph:arc(iv1, iv2) - --TODO subdivide edge if desired - --self:subdivide_edge(i) - end - - -- main loop - local iteration = 0 - repeat - iteration = iteration + 1 - local temperature = self.temperature - local ratio = math.min(1, iteration / expiterations) - local repexp = startrepexp + (endrepexp - startrepexp) * ratio - local attexp = startattexp + (endattexp - startattexp) * ratio - for i = 1, self.numvertexids do - forcexs[i] = 0 - forceys[i] = 0 - numcvs[i] = 0 - end - -- vertex-vertex forces - for i = 1, #vertexpairs1 do - local id1 = vertexpairs1[i] - local id2 = vertexpairs2[i] - local diffx = posxs[id2] - posxs[id1] - local diffy = posys[id2] - posys[id1] - local dist2 = diffx * diffx + diffy * diffy - local dist = math.sqrt(dist2) - local dirx = diffx / dist - local diry = diffy / dist - assert(dist ~= 0) - - local useddelta = delta - local hasdivvertex = id1 > numorigvertices or id2 > numorigvertices - - -- calculate attractive force - if pairconnected[i] then - if hasdivvertex then - useddelta = divdelta - end - local mag = (dist / useddelta) ^ attexp * useddelta - local fax = mag * dirx - local fay = mag * diry - forcexs[id1] = forcexs[id1] + fax - forceys[id1] = forceys[id1] + fay - forcexs[id2] = forcexs[id2] - fax - forceys[id2] = forceys[id2] - fay - elseif hasdivvertex then - useddelta = gamma - end - - -- calculate repulsive force - local mag = (useddelta / dist) ^ repexp * useddelta - local frx = mag * dirx - local fry = mag * diry - forcexs[id1] = forcexs[id1] - frx - forceys[id1] = forceys[id1] - fry - forcexs[id2] = forcexs[id2] + frx - forceys[id2] = forceys[id2] + fry - end - - -- edge-vertex forces and collisions - for i = 1, #edgepairsvertex do - local edgeid = edgepairsedge[i] - if not edgedeprecated[edgeid] then - local id1 = edgepairsvertex[i] - local id2 = edgevertex1[edgeid] - local id3 = edgevertex2[edgeid] - assert(id2 ~= id1 and id3 ~= id1) - - local abx = posxs[id3] - posxs[id2] - local aby = posys[id3] - posys[id2] - local dab2 = abx * abx + aby * aby - local dab = math.sqrt(dab2) - assert(dab ~= 0) - local abnx = abx / dab - local abny = aby / dab - local avx = posxs[id1] - posxs[id2] - local avy = posys[id1] - posys[id2] - local daiv = abnx * avx + abny * avy - local ivx = posxs[id2] + abnx * daiv - local ivy = posys[id2] + abny * daiv - local vivx = ivx - posxs[id1] - local vivy = ivy - posys[id1] - local dviv2 = vivx * vivx + vivy * vivy - local dviv = math.sqrt(dviv2) - local afactor, bfactor = 1, 1 - local cvx - local cvy - if daiv < 0 then - cvx = -avx / 2 - cvy = -avy / 2 - local norm2 = cvx * cvx + cvy * cvy - bfactor = 1 + (cvx * abx + cvy * aby) / norm2 - elseif daiv > dab then - cvx = (abx - avx) / 2 - cvy = (aby - avy) / 2 - local norm2 = cvx * cvx + cvy * cvy - afactor = 1 - (cvx * abx + cvy * aby) / norm2 - else - if edgeid < numorigedges - and dviv < gamma * appthreshold - and dab > delta * stretchthreshold then - stresscounter[edgeid] = stresscounter[edgeid] + 1 - end - assert(dviv > 0) - cvx = vivx / 2 - cvy = vivy / 2 - -- calculate edge repulsive force - local dirx = -vivx / dviv - local diry = -vivy / dviv - local mag = (gamma / dviv) ^ repexp * gamma - local fex = mag * dirx - local fey = mag * diry - local abratio = daiv / dab - forcexs[id1] = forcexs[id1] + fex - forceys[id1] = forceys[id1] + fey - forcexs[id2] = forcexs[id2] - fex * (1 - abratio) - forceys[id2] = forceys[id2] - fey * (1 - abratio) - forcexs[id3] = forcexs[id3] - fex * abratio - forceys[id3] = forceys[id3] - fey * abratio - end - local nv = numcvs[id1] + 1 - local na = numcvs[id2] + 1 - local nb = numcvs[id3] + 1 - numcvs[id1] = nv - numcvs[id2] = na - numcvs[id3] = nb - cvsxs[id1][nv] = cvx - cvsys[id1][nv] = cvy - cvsxs[id2][na] = -cvx * afactor - cvsys[id2][na] = -cvy * afactor - cvsxs[id3][nb] = -cvx * bfactor - cvsys[id3][nb] = -cvy * bfactor - end - end - - -- clamp forces - local scalefactor = 1 - local collision = false - for i = 1, self.numvertexids do - local forcex = forcexs[i] - local forcey = forceys[i] - forcex = forcex * temperature - forcey = forcey * temperature - forcexs[i] = forcex - forceys[i] = forcey - local forcenorm2 = forcex * forcex + forcey * forcey - local forcenorm = math.sqrt(forcenorm2) - scalefactor = math.min(scalefactor, delta * 3 * temperature / forcenorm) - local cvys = cvsys[i] - for j, cvx in ipairs(cvsxs[i]) do - local cvy = cvys[j] - local cvnorm2 = cvx * cvx + cvy * cvy - local cvnorm = math.sqrt(cvnorm2) - local projforcenorm = (cvx * forcex + cvy * forcey) / cvnorm - if projforcenorm > 0 then - local factor = cvnorm * 0.9 / projforcenorm - if factor < scalefactor then - scalefactor = factor - collision = true - end - end - end - end - local moved = false - for i = 1, self.numvertexids do - local forcex = forcexs[i] * scalefactor - local forcey = forceys[i] * scalefactor - posxs[i] = posxs[i] + forcex - posys[i] = posys[i] + forcey - local forcenorm2 = forcex * forcex + forcey * forcey - if forcenorm2 > 0.0001 * delta * delta then moved = true end - end - - -- subdivide stressed edges - if numdivisions > 0 then - for i = 1, numorigedges do - if stresscounter[i] > stresscounterthreshold then - self:subdivide_edge(i) - stresscounter[i] = 0 - end - end - end - self.temperature = self.temperature * coolingfactor - until not collision and not moved - print("\nfinished PDP after " .. iteration .. " iterations") - - -- write the positions back - for i, v in ipairs(self.embedding.vertices) do - v.inputvertex.pos.x = posxs[i] - v.inputvertex.pos.y = posys[i] - end - - -- route the edges - for i = 1, self.numedgeids do - if self.subdivisionvertices[i] then - local iv1 = self.embedding.vertices[self.edgevertex1[i]].inputvertex - local iv2 = self.embedding.vertices[self.edgevertex2[i]].inputvertex - local arc = self.ugraph:arc(iv1, iv2) - local p = Path.new() - p:appendMoveto(arc.tail.pos:clone()) - for _, vid in ipairs(self.subdivisionvertices[i]) do - p:appendLineto(self.posxs[vid], self.posys[vid]) - end - p:appendLineto(arc.head.pos:clone()) - arc.path = p - end - end + self:normalize_size() + self:find_force_pairs() + + local delta = self.delta + local gamma = self.gamma + local coolingfactor = self.coolingfactor + local expiterations = self.expiterations + local startrepexp = self.startrepexp + local endattexp = self.endattexp + local startattexp = self.startattexp + local endrepexp = self.endrepexp + + local vertexpairs1 = self.vertexpairs1 + local vertexpairs2 = self.vertexpairs2 + local pairconnected = self.pairconnected + local edgepairsvertex = self.edgepairsvertex + local edgepairsedge = self.edgepairsedge + local edgevertex1 = self.edgevertex1 + local edgevertex2 = self.edgevertex2 + local edgedeprecated = self.edgedeprecated + + local forcexs = {} + local forceys = {} + local posxs = self.posxs + local posys = self.posys + local cvsxs = self.cvsxs + local cvsys = self.cvsys + local numcvs = {} + for i, v in ipairs(self.embedding.vertices) do + cvsxs[i] = {} + cvsys[i] = {} + posxs[i] = v.inputvertex.pos.x + posys[i] = v.inputvertex.pos.y + end + + local numorigvertices = self.numvertexids + local numorigedges = self.numedgeids + local numdivisions = self.numdivisions + local divdelta = delta / (numdivisions + 1) + local stresscounter = {} + for i = 1, self.numedgeids do + stresscounter[i] = 0 + end + + local appthreshold = self.appthreshold + local stretchthreshold = self.stretchthreshold + local stresscounterthreshold = self.stresscounterthreshold + + for i = 1, numorigedges do + local iv1 = self.embedding.vertices[edgevertex1[i]].inputvertex + local iv2 = self.embedding.vertices[edgevertex2[i]].inputvertex + local arc = self.ugraph:arc(iv1, iv2) + --TODO subdivide edge if desired + --self:subdivide_edge(i) + end + + -- main loop + local iteration = 0 + repeat + iteration = iteration + 1 + local temperature = self.temperature + local ratio = math.min(1, iteration / expiterations) + local repexp = startrepexp + (endrepexp - startrepexp) * ratio + local attexp = startattexp + (endattexp - startattexp) * ratio + for i = 1, self.numvertexids do + forcexs[i] = 0 + forceys[i] = 0 + numcvs[i] = 0 + end + -- vertex-vertex forces + for i = 1, #vertexpairs1 do + local id1 = vertexpairs1[i] + local id2 = vertexpairs2[i] + local diffx = posxs[id2] - posxs[id1] + local diffy = posys[id2] - posys[id1] + local dist2 = diffx * diffx + diffy * diffy + local dist = math.sqrt(dist2) + local dirx = diffx / dist + local diry = diffy / dist + assert(dist ~= 0) + + local useddelta = delta + local hasdivvertex = id1 > numorigvertices or id2 > numorigvertices + + -- calculate attractive force + if pairconnected[i] then + if hasdivvertex then + useddelta = divdelta + end + local mag = (dist / useddelta) ^ attexp * useddelta + local fax = mag * dirx + local fay = mag * diry + forcexs[id1] = forcexs[id1] + fax + forceys[id1] = forceys[id1] + fay + forcexs[id2] = forcexs[id2] - fax + forceys[id2] = forceys[id2] - fay + elseif hasdivvertex then + useddelta = gamma + end + + -- calculate repulsive force + local mag = (useddelta / dist) ^ repexp * useddelta + local frx = mag * dirx + local fry = mag * diry + forcexs[id1] = forcexs[id1] - frx + forceys[id1] = forceys[id1] - fry + forcexs[id2] = forcexs[id2] + frx + forceys[id2] = forceys[id2] + fry + end + + -- edge-vertex forces and collisions + for i = 1, #edgepairsvertex do + local edgeid = edgepairsedge[i] + if not edgedeprecated[edgeid] then + local id1 = edgepairsvertex[i] + local id2 = edgevertex1[edgeid] + local id3 = edgevertex2[edgeid] + assert(id2 ~= id1 and id3 ~= id1) + + local abx = posxs[id3] - posxs[id2] + local aby = posys[id3] - posys[id2] + local dab2 = abx * abx + aby * aby + local dab = math.sqrt(dab2) + assert(dab ~= 0) + local abnx = abx / dab + local abny = aby / dab + local avx = posxs[id1] - posxs[id2] + local avy = posys[id1] - posys[id2] + local daiv = abnx * avx + abny * avy + local ivx = posxs[id2] + abnx * daiv + local ivy = posys[id2] + abny * daiv + local vivx = ivx - posxs[id1] + local vivy = ivy - posys[id1] + local dviv2 = vivx * vivx + vivy * vivy + local dviv = math.sqrt(dviv2) + local afactor, bfactor = 1, 1 + local cvx + local cvy + if daiv < 0 then + cvx = -avx / 2 + cvy = -avy / 2 + local norm2 = cvx * cvx + cvy * cvy + bfactor = 1 + (cvx * abx + cvy * aby) / norm2 + elseif daiv > dab then + cvx = (abx - avx) / 2 + cvy = (aby - avy) / 2 + local norm2 = cvx * cvx + cvy * cvy + afactor = 1 - (cvx * abx + cvy * aby) / norm2 + else + if edgeid < numorigedges + and dviv < gamma * appthreshold + and dab > delta * stretchthreshold then + stresscounter[edgeid] = stresscounter[edgeid] + 1 + end + assert(dviv > 0) + cvx = vivx / 2 + cvy = vivy / 2 + -- calculate edge repulsive force + local dirx = -vivx / dviv + local diry = -vivy / dviv + local mag = (gamma / dviv) ^ repexp * gamma + local fex = mag * dirx + local fey = mag * diry + local abratio = daiv / dab + forcexs[id1] = forcexs[id1] + fex + forceys[id1] = forceys[id1] + fey + forcexs[id2] = forcexs[id2] - fex * (1 - abratio) + forceys[id2] = forceys[id2] - fey * (1 - abratio) + forcexs[id3] = forcexs[id3] - fex * abratio + forceys[id3] = forceys[id3] - fey * abratio + end + local nv = numcvs[id1] + 1 + local na = numcvs[id2] + 1 + local nb = numcvs[id3] + 1 + numcvs[id1] = nv + numcvs[id2] = na + numcvs[id3] = nb + cvsxs[id1][nv] = cvx + cvsys[id1][nv] = cvy + cvsxs[id2][na] = -cvx * afactor + cvsys[id2][na] = -cvy * afactor + cvsxs[id3][nb] = -cvx * bfactor + cvsys[id3][nb] = -cvy * bfactor + end + end + + -- clamp forces + local scalefactor = 1 + local collision = false + for i = 1, self.numvertexids do + local forcex = forcexs[i] + local forcey = forceys[i] + forcex = forcex * temperature + forcey = forcey * temperature + forcexs[i] = forcex + forceys[i] = forcey + local forcenorm2 = forcex * forcex + forcey * forcey + local forcenorm = math.sqrt(forcenorm2) + scalefactor = math.min(scalefactor, delta * 3 * temperature / forcenorm) + local cvys = cvsys[i] + for j, cvx in ipairs(cvsxs[i]) do + local cvy = cvys[j] + local cvnorm2 = cvx * cvx + cvy * cvy + local cvnorm = math.sqrt(cvnorm2) + local projforcenorm = (cvx * forcex + cvy * forcey) / cvnorm + if projforcenorm > 0 then + local factor = cvnorm * 0.9 / projforcenorm + if factor < scalefactor then + scalefactor = factor + collision = true + end + end + end + end + local moved = false + for i = 1, self.numvertexids do + local forcex = forcexs[i] * scalefactor + local forcey = forceys[i] * scalefactor + posxs[i] = posxs[i] + forcex + posys[i] = posys[i] + forcey + local forcenorm2 = forcex * forcex + forcey * forcey + if forcenorm2 > 0.0001 * delta * delta then moved = true end + end + + -- subdivide stressed edges + if numdivisions > 0 then + for i = 1, numorigedges do + if stresscounter[i] > stresscounterthreshold then + self:subdivide_edge(i) + stresscounter[i] = 0 + end + end + end + self.temperature = self.temperature * coolingfactor + until not collision and not moved + print("\nfinished PDP after " .. iteration .. " iterations") + + -- write the positions back + for i, v in ipairs(self.embedding.vertices) do + v.inputvertex.pos.x = posxs[i] + v.inputvertex.pos.y = posys[i] + end + + -- route the edges + for i = 1, self.numedgeids do + if self.subdivisionvertices[i] then + local iv1 = self.embedding.vertices[self.edgevertex1[i]].inputvertex + local iv2 = self.embedding.vertices[self.edgevertex2[i]].inputvertex + local arc = self.ugraph:arc(iv1, iv2) + local p = Path.new() + p:appendMoveto(arc.tail.pos:clone()) + for _, vid in ipairs(self.subdivisionvertices[i]) do + p:appendLineto(self.posxs[vid], self.posys[vid]) + end + p:appendLineto(arc.head.pos:clone()) + arc.path = p + end + end end function PDP:subdivide_edge(edgeid) - assert(self.subdivisionedges[edgeid] == nil) - local numdivisions = self.numdivisions - local subdivisionedges = {} - local subdivisionvertices = {} - local id1 = self.edgevertex1[edgeid] - local id2 = self.edgevertex2[edgeid] - local x1 = self.posxs[id1] - local y1 = self.posys[id1] - local x2 = self.posxs[id2] - local y2 = self.posys[id2] - local prevvertexid = id1 - for i = 1, numdivisions do - -- create new edge and vertex - local newvertexid1 = self.numvertexids + i - table.insert(subdivisionvertices, newvertexid1) - self.posxs[newvertexid1] = (x1 * (numdivisions + 1 - i) + x2 * i) - / (numdivisions + 1) - self.posys[newvertexid1] = (y1 * (numdivisions + 1 - i) + y2 * i) - / (numdivisions + 1) - self.cvsxs[newvertexid1] = {} - self.cvsys[newvertexid1] = {} - - local newedgeid = self.numedgeids + i - table.insert(subdivisionedges, newedgeid) - table.insert(self.edgevertex1, prevvertexid) - table.insert(self.edgevertex2, newvertexid1) - prevvertexid = newvertexid1 - - -- pair the new vertex - -- with first vertex of the edge being divided - table.insert(self.vertexpairs1, self.edgevertex1[edgeid]) - table.insert(self.vertexpairs2, newvertexid1) - table.insert(self.pairconnected, i == 1) - - -- with second vertex of the edge being divided - table.insert(self.vertexpairs1, self.edgevertex2[edgeid]) - table.insert(self.vertexpairs2, newvertexid1) - table.insert(self.pairconnected, i == numdivisions) - - -- with each other - for j = i + 1, numdivisions do - local newvertexid2 = self.numvertexids + j - table.insert(self.vertexpairs1, newvertexid1) - table.insert(self.vertexpairs2, newvertexid2) - table.insert(self.pairconnected, j == i + 1) - end - - -- with new edges - -- before vertex - for j = 1, i - 1 do - local newedgeid = self.numedgeids + j - table.insert(self.edgepairsvertex, newvertexid1) - table.insert(self.edgepairsedge, newedgeid) - end - -- after vertex - for j = i + 2, numdivisions + 1 do - local newedgeid = self.numedgeids + j - table.insert(self.edgepairsvertex, newvertexid1) - table.insert(self.edgepairsedge, newedgeid) - end - - -- pair the new edges with vertices of the edge being divided - if i > 1 then - table.insert(self.edgepairsvertex, id1) - table.insert(self.edgepairsedge, newedgeid) - end - table.insert(self.edgepairsvertex, id2) - table.insert(self.edgepairsedge, newedgeid) - end - -- create last edge - table.insert(subdivisionedges, self.numedgeids + numdivisions + 1) - table.insert(self.edgevertex1, prevvertexid) - table.insert(self.edgevertex2, id2) - - -- pair last edge with first vertex of the edge being divided - table.insert(self.edgepairsvertex, id1) - table.insert(self.edgepairsedge, self.numedgeids + numdivisions + 1) - - self.subdivisionedges[edgeid] = subdivisionedges - self.subdivisionvertices[edgeid] = subdivisionvertices - - -- pair new edges and vertices with existing edges and vertices - local sameface = false - local start = self.embeddingedges[edgeid] - local twin = start.twin - local donevertices = { [start.target] = true, [twin.target] = true } - local doneedges = { [start] = true, [twin] = true } - local current = start.twin.links[1] - for twice = 1, 2 do - while current ~= start do - if current == twin then - sameface = true - end - - -- pair edge with the new vertices - -- or pair subdivision of edge with new vertices and edges - if not doneedges[current] then - local currentedgeid = self.edgeids[current] - if self.subdivisionvertices[currentedgeid] then - for _, vid in ipairs(self.subdivisionvertices[currentedgeid]) do - for i = 1, numdivisions do - local newvertexid = self.numvertexids + i - table.insert(self.vertexpairs1, vid) - table.insert(self.vertexpairs2, newvertexid) - self.pairconnected[#self.vertexpairs1] = false - end - for i = 1, numdivisions + 1 do - local newedgeid = self.numedgeids + i - table.insert(self.edgepairsvertex, vid) - table.insert(self.edgepairsedge, newedgeid) - end - end - for _, eid in ipairs(self.subdivisionedges[currentedgeid]) do - for i = 1, numdivisions do - local newvertexid = self.numvertexids + i - table.insert(self.edgepairsvertex, newvertexid) - table.insert(self.edgepairsedge, eid) - end - end - else - for i = 1, numdivisions do - local newvertexid = self.numvertexids + i - table.insert(self.edgepairsvertex, newvertexid) - table.insert(self.edgepairsedge, currentedgeid) - end - end - doneedges[current] = true - end - - -- pair target vertex with the new vertices and edges - local vertexid = self.vertexids[current.target] - if not donevertices[current.target] then - for i = 1, numdivisions do - local newvertexid = self.numvertexids + i - table.insert(self.vertexpairs1, vertexid) - table.insert(self.vertexpairs2, newvertexid) - self.pairconnected[#self.vertexpairs1] = false - end - for i = 1, numdivisions + 1 do - local newedgeid = self.numedgeids + i - table.insert(self.edgepairsvertex, vertexid) - table.insert(self.edgepairsedge, newedgeid) - end - end - current = current.twin.links[1] - end - start = self.embeddingedges[edgeid].twin - current = start.twin.links[1] - if sameface then - break - end - end - - self.edgedeprecated[edgeid] = true - self.numvertexids = self.numvertexids + numdivisions - self.numedgeids = self.numedgeids + numdivisions + 1 + assert(self.subdivisionedges[edgeid] == nil) + local numdivisions = self.numdivisions + local subdivisionedges = {} + local subdivisionvertices = {} + local id1 = self.edgevertex1[edgeid] + local id2 = self.edgevertex2[edgeid] + local x1 = self.posxs[id1] + local y1 = self.posys[id1] + local x2 = self.posxs[id2] + local y2 = self.posys[id2] + local prevvertexid = id1 + for i = 1, numdivisions do + -- create new edge and vertex + local newvertexid1 = self.numvertexids + i + table.insert(subdivisionvertices, newvertexid1) + self.posxs[newvertexid1] = (x1 * (numdivisions + 1 - i) + x2 * i) + / (numdivisions + 1) + self.posys[newvertexid1] = (y1 * (numdivisions + 1 - i) + y2 * i) + / (numdivisions + 1) + self.cvsxs[newvertexid1] = {} + self.cvsys[newvertexid1] = {} + + local newedgeid = self.numedgeids + i + table.insert(subdivisionedges, newedgeid) + table.insert(self.edgevertex1, prevvertexid) + table.insert(self.edgevertex2, newvertexid1) + prevvertexid = newvertexid1 + + -- pair the new vertex + -- with first vertex of the edge being devided + table.insert(self.vertexpairs1, self.edgevertex1[edgeid]) + table.insert(self.vertexpairs2, newvertexid1) + table.insert(self.pairconnected, i == 1) + + -- with second vertex of the edge being devided + table.insert(self.vertexpairs1, self.edgevertex2[edgeid]) + table.insert(self.vertexpairs2, newvertexid1) + table.insert(self.pairconnected, i == numdivisions) + + -- with each other + for j = i + 1, numdivisions do + local newvertexid2 = self.numvertexids + j + table.insert(self.vertexpairs1, newvertexid1) + table.insert(self.vertexpairs2, newvertexid2) + table.insert(self.pairconnected, j == i + 1) + end + + -- with new edges + -- before vertex + for j = 1, i - 1 do + local newedgeid = self.numedgeids + j + table.insert(self.edgepairsvertex, newvertexid1) + table.insert(self.edgepairsedge, newedgeid) + end + -- after vertex + for j = i + 2, numdivisions + 1 do + local newedgeid = self.numedgeids + j + table.insert(self.edgepairsvertex, newvertexid1) + table.insert(self.edgepairsedge, newedgeid) + end + + -- pair the new edges with vertices of the edge being devided + if i > 1 then + table.insert(self.edgepairsvertex, id1) + table.insert(self.edgepairsedge, newedgeid) + end + table.insert(self.edgepairsvertex, id2) + table.insert(self.edgepairsedge, newedgeid) + end + -- create last edge + table.insert(subdivisionedges, self.numedgeids + numdivisions + 1) + table.insert(self.edgevertex1, prevvertexid) + table.insert(self.edgevertex2, id2) + + -- pair last edge with first vertex of the edge being devided + table.insert(self.edgepairsvertex, id1) + table.insert(self.edgepairsedge, self.numedgeids + numdivisions + 1) + + self.subdivisionedges[edgeid] = subdivisionedges + self.subdivisionvertices[edgeid] = subdivisionvertices + + -- pair new edges and vertices with existing edges and vertices + local sameface = false + local start = self.embeddingedges[edgeid] + local twin = start.twin + local donevertices = { [start.target] = true, [twin.target] = true } + local doneedges = { [start] = true, [twin] = true } + local current = start.twin.links[1] + for twice = 1, 2 do + while current ~= start do + if current == twin then + sameface = true + end + + -- pair edge with the new vertices + -- or pair subdivision of edge with new vertices and edges + if not doneedges[current] then + local currentedgeid = self.edgeids[current] + if self.subdivisionvertices[currentedgeid] then + for _, vid in ipairs(self.subdivisionvertices[currentedgeid]) do + for i = 1, numdivisions do + local newvertexid = self.numvertexids + i + table.insert(self.vertexpairs1, vid) + table.insert(self.vertexpairs2, newvertexid) + self.pairconnected[#self.vertexpairs1] = false + end + for i = 1, numdivisions + 1 do + local newedgeid = self.numedgeids + i + table.insert(self.edgepairsvertex, vid) + table.insert(self.edgepairsedge, newedgeid) + end + end + for _, eid in ipairs(self.subdivisionedges[currentedgeid]) do + for i = 1, numdivisions do + local newvertexid = self.numvertexids + i + table.insert(self.edgepairsvertex, newvertexid) + table.insert(self.edgepairsedge, eid) + end + end + else + for i = 1, numdivisions do + local newvertexid = self.numvertexids + i + table.insert(self.edgepairsvertex, newvertexid) + table.insert(self.edgepairsedge, currentedgeid) + end + end + doneedges[current] = true + end + + -- pair target vertex with the new vertices and edges + local vertexid = self.vertexids[current.target] + if not donevertices[current.target] then + for i = 1, numdivisions do + local newvertexid = self.numvertexids + i + table.insert(self.vertexpairs1, vertexid) + table.insert(self.vertexpairs2, newvertexid) + self.pairconnected[#self.vertexpairs1] = false + end + for i = 1, numdivisions + 1 do + local newedgeid = self.numedgeids + i + table.insert(self.edgepairsvertex, vertexid) + table.insert(self.edgepairsedge, newedgeid) + end + end + current = current.twin.links[1] + end + start = self.embeddingedges[edgeid].twin + current = start.twin.links[1] + if sameface then + break + end + end + + self.edgedeprecated[edgeid] = true + self.numvertexids = self.numvertexids + numdivisions + self.numedgeids = self.numedgeids + numdivisions + 1 end function PDP:find_force_pairs() - local donevertices = {} - -- number all vertices - local vertexids = self.vertexids - for i, v in ipairs(self.embedding.vertices) do - vertexids[v] = i - end - self.numvertexids = #self.embedding.vertices - - local edgeids = self.edgeids - local numedgeids = 0 - -- number all edges - for _, v in ipairs(self.embedding.vertices) do - local id = vertexids[v] - local start = v.link - local current = start - repeat - local targetid = vertexids[current.target] - if edgeids[current] == nil then - table.insert(self.edgevertex1, id) - table.insert(self.edgevertex2, targetid) - numedgeids = numedgeids + 1 - edgeids[current] = numedgeids - edgeids[current.twin] = numedgeids - self.embeddingedges[numedgeids] = current - end - current = current.links[0] - until current == start - end - - -- find all force pairs - for _, v in ipairs(self.embedding.vertices) do - local id = vertexids[v] - donevertices[id] = true - local vertexset = {} - local edgeset = {} - local start = v.link - repeat - local targetid = vertexids[start.target] - if vertexset[targetid] == nil and not donevertices[targetid] then - table.insert(self.pairconnected, true) - table.insert(self.vertexpairs1, id) - table.insert(self.vertexpairs2, targetid) - vertexset[targetid] = true - end - local current = start.twin.links[1] - while current.target ~= v do - local targetid = vertexids[current.target] - if vertexset[targetid] == nil and not donevertices[targetid] then - table.insert(self.pairconnected, self.ugraph:arc(v.inputvertex, current.target.inputvertex) ~= nil) - table.insert(self.vertexpairs1, id) - table.insert(self.vertexpairs2, targetid) - vertexset[targetid] = true - end - if edgeset[current] == nil then - table.insert(self.edgepairsvertex, id) - table.insert(self.edgepairsedge, edgeids[current]) - edgeset[current] = true - edgeset[current.twin] = true - end - current = current.twin.links[1] - end - start = start.links[0] - until start == v.link - end - - self.numedgeids = numedgeids + local donevertices = {} + -- number all vertices + local vertexids = self.vertexids + for i, v in ipairs(self.embedding.vertices) do + vertexids[v] = i + end + self.numvertexids = #self.embedding.vertices + + local edgeids = self.edgeids + local numedgeids = 0 + -- number all edges + for _, v in ipairs(self.embedding.vertices) do + local id = vertexids[v] + local start = v.link + local current = start + repeat + local targetid = vertexids[current.target] + if edgeids[current] == nil then + table.insert(self.edgevertex1, id) + table.insert(self.edgevertex2, targetid) + numedgeids = numedgeids + 1 + edgeids[current] = numedgeids + edgeids[current.twin] = numedgeids + self.embeddingedges[numedgeids] = current + end + current = current.links[0] + until current == start + end + + -- find all force pairs + for _, v in ipairs(self.embedding.vertices) do + local id = vertexids[v] + donevertices[id] = true + local vertexset = {} + local edgeset = {} + local start = v.link + repeat + local targetid = vertexids[start.target] + if vertexset[targetid] == nil and not donevertices[targetid] then + table.insert(self.pairconnected, true) + table.insert(self.vertexpairs1, id) + table.insert(self.vertexpairs2, targetid) + vertexset[targetid] = true + end + local current = start.twin.links[1] + while current.target ~= v do + local targetid = vertexids[current.target] + if vertexset[targetid] == nil and not donevertices[targetid] then + table.insert(self.pairconnected, self.ugraph:arc(v.inputvertex, current.target.inputvertex) ~= nil) + table.insert(self.vertexpairs1, id) + table.insert(self.vertexpairs2, targetid) + vertexset[targetid] = true + end + if edgeset[current] == nil then + table.insert(self.edgepairsvertex, id) + table.insert(self.edgepairsedge, edgeids[current]) + edgeset[current] = true + edgeset[current.twin] = true + end + current = current.twin.links[1] + end + start = start.links[0] + until start == v.link + end + + self.numedgeids = numedgeids end function PDP:normalize_size() - local minx = math.huge - local maxx = -math.huge - local miny = math.huge - local maxy = -math.huge - - for _, v in ipairs(self.ugraph.vertices) do - minx = math.min(minx, v.pos.x) - maxx = math.max(maxx, v.pos.x) - miny = math.min(miny, v.pos.y) - maxy = math.max(maxy, v.pos.y) - end - - local area = (maxx - minx) * (maxy - miny) - local gridarea = #self.ugraph.vertices * self.delta * self.delta - - local scale = math.sqrt(gridarea) / math.sqrt(area) - - for _, v in ipairs(self.ugraph.vertices) do - v.pos = v.pos * scale - end + local minx = math.huge + local maxx = -math.huge + local miny = math.huge + local maxy = -math.huge + + for _, v in ipairs(self.ugraph.vertices) do + minx = math.min(minx, v.pos.x) + maxx = math.max(maxx, v.pos.x) + miny = math.min(miny, v.pos.y) + maxy = math.max(maxy, v.pos.y) + end + + local area = (maxx - minx) * (maxy - miny) + local gridarea = #self.ugraph.vertices * self.delta * self.delta + + local scale = math.sqrt(gridarea) / math.sqrt(area) + + for _, v in ipairs(self.ugraph.vertices) do + v.pos = v.pos * scale + end end -- done diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/planar/PlanarLayout.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/planar/PlanarLayout.lua index 9e5b8d72ec0..8796148de80 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/planar/PlanarLayout.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/planar/PlanarLayout.lua @@ -15,145 +15,145 @@ local createEdge = InterfaceToAlgorithms.createEdge local createVertex = InterfaceToAlgorithms.createVertex InterfaceToAlgorithms.declare { - key = "planar layout", - algorithm = PlanarLayout, - preconditions = { - connected = true, - loop_free = true, - simple = true, - }, - postconditions = { - fixed = true, - }, - summary = [[" - The planar layout draws planar graphs without edge crossings. - "]], - documentation = [[" - The planar layout is a pipeline of algorithms to produce - a crossings-free drawing of a planar graph. - First a combinatorical embedding of the graph is created using - the Algorithm from Boyer and Myrvold. - The combinatorical Embedding is then being improved by - by the Sort and Flip algorithm and triangulated afterwards. - To determine the actual node positions the shift method - by de Fraysseix, Pach and Pollack is used. - Finally the force based Planar Drawing Postprocessing improves the drawing. - "]], - examples = { - [[" - \tikz \graph [nodes={draw, circle}] { - a -- { - b -- { - d -- i, - e, - f - }, - c -- { - g, - h - } - }, - f --[no span edge] a, - h --[no span edge] a, - i --[no span edge] g, - f --[no span edge] g, - c --[no span edge] d, - e --[no span edge] c - } - "]] - } + key = "planar layout", + algorithm = PlanarLayout, + preconditions = { + connected = true, + loop_free = true, + simple = true, + }, + postconditions = { + fixed = true, + }, + summary = [[" + The planar layout draws planar graphs without edge crossings. + "]], + documentation = [[" + The planar layout is a pipeline of algorithms to produce + a crossings-free drawing of a planar graph. + First a combinatorical embedding of the graph is created using + the Algorithm from Boyer and Myrvold. + The combinatorical Embedding is then being improved by + by the Sort and Flip algorithm and triangulated afterwards. + To determine the actual node positions the shift method + by de Fraysseix, Pach and Pollack is used. + Finally the force based Planar Drawing Postprocessing improves the drawing. + "]], + examples = { + [[" + \tikz \graph [nodes={draw, circle}] { + a -- { + b -- { + d -- i, + e, + f + }, + c -- { + g, + h + } + }, + f --[no span edge] a, + h --[no span edge] a, + i --[no span edge] g, + f --[no span edge] g, + c --[no span edge] d, + e --[no span edge] c + } + "]] + } } function PlanarLayout:run() - --local file = io.open("timing.txt", "a") - - local options = self.digraph.options - - -- get embedding - local bm = BoyerMyrvold.new() - bm:init(self.ugraph) - local embedding = bm:run() - - assert(embedding, "Graph is not planar") - - --local start = os.clock() - if options["use sf"] then - embedding:improve() - end - - -- choose external face - local exedge, exsize = embedding:get_biggest_face() - - -- surround graph with triangle - local v1, v2, vn = embedding:surround_by_triangle(exedge, exsize) - - -- make maximal planar - embedding:triangulate() - - if options["show virtual"] then - -- add virtual vertices to input graph - for _, vertex in ipairs(embedding.vertices) do - if vertex.virtual then - vertex.inputvertex = createVertex(self, { - name = nil,--vertex.name, - generated_options = {}, - text = vertex.name - }) - vertex.virtual = false - end - end - - -- add virtual edges to input graph - for _, vertex in ipairs(embedding.vertices) do - for halfedge in Embedding.adjacency_iterator(vertex.link) do - if halfedge.virtual then - createEdge( - self, - vertex.inputvertex, - halfedge.target.inputvertex - ) - end - halfedge.virtual = false - end - end - end - - -- create canonical ordering - local order = embedding:canonical_order(v1, v2, vn) - - local sm = ShiftMethod.new() - sm:init(order) - local gridpos = sm:run() - - local gridspacing = options["grid spacing"] - for _, v in ipairs(order) do - if not v.virtual then - local iv = v.inputvertex - iv.pos.x = gridpos[v].x * gridspacing - iv.pos.y = gridpos[v].y * gridspacing - end - end - - embedding:remove_virtual() - - --start = os.clock() - if options["use pdp"] then - local pdp = PDP.new( - self.ugraph, embedding, - options["node distance"], - options["node distance"], - options["pdp cooling factor"], - options["exponent change iterations"], - options["start repulsive exponent"], - options["end repulsive exponent"], - options["start attractive exponent"], - options["end attractive exponent"], - options["edge approach threshold"], - options["edge stretch threshold"], - options["stress counter threshold"], - options["edge divisions"] - ) - pdp:run() - end + --local file = io.open("timing.txt", "a") + + local options = self.digraph.options + + -- get embedding + local bm = BoyerMyrvold.new() + bm:init(self.ugraph) + local embedding = bm:run() + + assert(embedding, "Graph is not planar") + + --local start = os.clock() + if options["use sf"] then + embedding:improve() + end + + -- choose external face + local exedge, exsize = embedding:get_biggest_face() + + -- surround graph with triangle + local v1, v2, vn = embedding:surround_by_triangle(exedge, exsize) + + -- make maximal planar + embedding:triangulate() + + if options["show virtual"] then + -- add virtual vertices to input graph + for _, vertex in ipairs(embedding.vertices) do + if vertex.virtual then + vertex.inputvertex = createVertex(self, { + name = nil,--vertex.name, + generated_options = {}, + text = vertex.name + }) + vertex.virtual = false + end + end + + -- add virtual edges to input graph + for _, vertex in ipairs(embedding.vertices) do + for halfedge in Embedding.adjacency_iterator(vertex.link) do + if halfedge.virtual then + createEdge( + self, + vertex.inputvertex, + halfedge.target.inputvertex + ) + end + halfedge.virtual = false + end + end + end + + -- create canonical ordering + local order = embedding:canonical_order(v1, v2, vn) + + local sm = ShiftMethod.new() + sm:init(order) + local gridpos = sm:run() + + local gridspacing = options["grid spacing"] + for _, v in ipairs(order) do + if not v.virtual then + local iv = v.inputvertex + iv.pos.x = gridpos[v].x * gridspacing + iv.pos.y = gridpos[v].y * gridspacing + end + end + + embedding:remove_virtual() + + --start = os.clock() + if options["use pdp"] then + local pdp = PDP.new( + self.ugraph, embedding, + options["node distance"], + options["node distance"], + options["pdp cooling factor"], + options["exponent change iterations"], + options["start repulsive exponent"], + options["end repulsive exponent"], + options["start attractive exponent"], + options["end attractive exponent"], + options["edge approach threshold"], + options["edge stretch threshold"], + options["stress counter threshold"], + options["edge divisions"] + ) + pdp:run() + end end diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/planar/ShiftMethod.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/planar/ShiftMethod.lua index c568ca56964..9716aa27e4a 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/planar/ShiftMethod.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/planar/ShiftMethod.lua @@ -8,121 +8,121 @@ local Embedding = require("pgf.gd.planar.Embedding") SM.__index = SM function SM.new() - local t = {} - setmetatable(t, SM) - return t + local t = {} + setmetatable(t, SM) + return t end function SM:init(vertices) - self.vertices = vertices - self.xoff = {} - self.pos = {} - for _, v in ipairs(vertices) do - self.pos[v] = {} - end - self.left = {} - self.right = {} + self.vertices = vertices + self.xoff = {} + self.pos = {} + for _, v in ipairs(vertices) do + self.pos[v] = {} + end + self.left = {} + self.right = {} end function SM:run() - local v1 = self.vertices[1] - local v2 = self.vertices[2] - local v3 = self.vertices[3] + local v1 = self.vertices[1] + local v2 = self.vertices[2] + local v3 = self.vertices[3] - self.xoff[v1] = 0 - self.pos[v1].y = 0 - self.right[v1] = v3 + self.xoff[v1] = 0 + self.pos[v1].y = 0 + self.right[v1] = v3 - self.xoff[v3] = 1 - self.pos[v3].y = 1 - self.right[v3] = v2 + self.xoff[v3] = 1 + self.pos[v3].y = 1 + self.right[v3] = v2 - self.xoff[v2] = 1 - self.pos[v2].y = 0 + self.xoff[v2] = 1 + self.pos[v2].y = 0 - local n = #self.vertices - for k = 4, n do - local vk = self.vertices[k] - local wplink, wqlink, wp1qsum - if k ~= n then - wplink, wqlink, wp1qsum = self:get_attachments(vk) - else - wplink, wqlink, wp1qsum = self:get_last_attachments(vk, v1, v2) - end - local wp, wq = wplink.target, wqlink.target - local wp1 = wplink.links[0].target - local wq1 = wqlink.links[1 - 0].target - self.xoff[wp1] = self.xoff[wp1] + 1 - self.xoff[wq] = self.xoff[wq] + 1 - wp1qsum = wp1qsum + 2 - self.xoff[vk] = (wp1qsum + self.pos[wq].y - self.pos[wp].y) / 2 - self.pos[vk].y = (wp1qsum + self.pos[wq].y + self.pos[wp].y) / 2 - -- = self.xoff[vk] + self.pos[wp].y ? - self.right[wp] = vk - if wp ~= wq1 then - self.left[vk] = wp1 - self.right[wq1] = nil - self.xoff[wp1] = self.xoff[wp1] - self.xoff[vk] - end - self.right[vk] = wq - self.xoff[wq] = wp1qsum - self.xoff[vk] - end - self.pos[v1].x = 0 - self:accumulate_offset(v1, 0) - return self.pos + local n = #self.vertices + for k = 4, n do + local vk = self.vertices[k] + local wplink, wqlink, wp1qsum + if k ~= n then + wplink, wqlink, wp1qsum = self:get_attachments(vk) + else + wplink, wqlink, wp1qsum = self:get_last_attachments(vk, v1, v2) + end + local wp, wq = wplink.target, wqlink.target + local wp1 = wplink.links[0].target + local wq1 = wqlink.links[1 - 0].target + self.xoff[wp1] = self.xoff[wp1] + 1 + self.xoff[wq] = self.xoff[wq] + 1 + wp1qsum = wp1qsum + 2 + self.xoff[vk] = (wp1qsum + self.pos[wq].y - self.pos[wp].y) / 2 + self.pos[vk].y = (wp1qsum + self.pos[wq].y + self.pos[wp].y) / 2 + -- = self.xoff[vk] + self.pos[wp].y ? + self.right[wp] = vk + if wp ~= wq1 then + self.left[vk] = wp1 + self.right[wq1] = nil + self.xoff[wp1] = self.xoff[wp1] - self.xoff[vk] + end + self.right[vk] = wq + self.xoff[wq] = wp1qsum - self.xoff[vk] + end + self.pos[v1].x = 0 + self:accumulate_offset(v1, 0) + return self.pos end function SM:get_attachments(vk) - local wplink, wqlink - local wp1qsum = 0 - local start = vk.link - local startattach = self.xoff[start.target] ~= nil - local current = start.links[0] - local last = start - repeat - local currentattach = self.xoff[current.target] ~= nil - local lastattach = self.xoff[last.target] ~= nil - if currentattach ~= lastattach then - if currentattach then - wplink = current - else - wqlink = last - end - if currentattach == startattach and not startattach then - break - end - currentattach = lastattach - elseif currentattach then - wp1qsum = wp1qsum + self.xoff[current.target] - end - last = current - current = current.links[0] - until last == start - return wplink, wqlink, wp1qsum + local wplink, wqlink + local wp1qsum = 0 + local start = vk.link + local startattach = self.xoff[start.target] ~= nil + local current = start.links[0] + local last = start + repeat + local currentattach = self.xoff[current.target] ~= nil + local lastattach = self.xoff[last.target] ~= nil + if currentattach ~= lastattach then + if currentattach then + wplink = current + else + wqlink = last + end + if currentattach == startattach and not startattach then + break + end + currentattach = lastattach + elseif currentattach then + wp1qsum = wp1qsum + self.xoff[current.target] + end + last = current + current = current.links[0] + until last == start + return wplink, wqlink, wp1qsum end function SM:get_last_attachments(vn, v1, v2) - local wplink, wqlink - local wp1qsum = 0 - for halfedge in Embedding.adjacency_iterator(vn.link, ccwdir) do - local target = halfedge.target - if target == v1 then - wplink = halfedge - elseif target == v2 then - wqlink = halfedge - end - wp1qsum = wp1qsum + self.xoff[target] - end - return wplink, wqlink, wp1qsum + local wplink, wqlink + local wp1qsum = 0 + for halfedge in Embedding.adjacency_iterator(vn.link, ccwdir) do + local target = halfedge.target + if target == v1 then + wplink = halfedge + elseif target == v2 then + wqlink = halfedge + end + wp1qsum = wp1qsum + self.xoff[target] + end + return wplink, wqlink, wp1qsum end function SM:accumulate_offset(v, x) - x = x + self.xoff[v] - self.pos[v].x = x - local l = self.left[v] - local r = self.right[v] - if l then self:accumulate_offset(l, x) end - if r then self:accumulate_offset(r, x) end + x = x + self.xoff[v] + self.pos[v].x = x + local l = self.left[v] + local r = self.right[v] + if l then self:accumulate_offset(l, x) end + if r then self:accumulate_offset(r, x) end end return SM diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/planar/parameters.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/planar/parameters.lua index 603f2ee7cce..9e18eb07246 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/planar/parameters.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/planar/parameters.lua @@ -2,143 +2,143 @@ local declare = require("pgf.gd.interface.InterfaceToAlgorithms").declare declare { - key = "use pdp", - type = "boolean", - initial = "true", - - summary = [[" - Whether or not to use the Planar Drawing Postprocessing - to improve the drawing. - "]] + key = "use pdp", + type = "boolean", + initial = "true", + + summary = [[" + Whether or not to use the Planar Drawing Postprocessing + to improve the drawing. + "]] } declare { - key = "use sf", - type = "boolean", - initial = "true", - - summary = [[" - Whether or not to use the Sort and Flip Algorithm - to improve the combinatorical embedding. - "]] + key = "use sf", + type = "boolean", + initial = "true", + + summary = [[" + Whether or not to use the Sort and Flip Algorithm + to improve the combinatorical embedding. + "]] } declare { - key = "grid spacing", - type = "number", - initial = "10", - - summary = [[" - If the |use pdp| option is not set, - this sets the spacing of the grid used by the shift method. - A bigger grid spacing will result in a bigger drawing. - "]] + key = "grid spacing", + type = "number", + initial = "10", + + summary = [[" + If the |use pdp| option is not set, + this sets the spacing of the grid used by the shift method. + A bigger grid spacing will result in a bigger drawing. + "]] } declare { - key = "pdp cooling factor", - type = "number", - initial = "0.98", - - summary = [[" - This sets the cooling factor used by the Planar Drawing Postprocessing. - A higher cooling factor can result in better quality of the drawing, - but will increase the run time of the algorithm. - "]] + key = "pdp cooling factor", + type = "number", + initial = "0.98", + + summary = [[" + This sets the cooling factor used by the Planar Drawing Postprocessing. + A higher cooling factor can result in better quality of the drawing, + but will increase the run time of the algorithm. + "]] } declare { - key = "start repulsive exponent", - type = "number", - initial = "2", + key = "start repulsive exponent", + type = "number", + initial = "2", - summary = [[" - Start value of the exponent used in the calculation of all repulsive forces in PDP - "]] + summary = [[" + Start value of the exponent used in the calculation of all repulsive forces in PDP + "]] } declare { - key = "end repulsive exponent", - type = "number", - initial = "2", + key = "end repulsive exponent", + type = "number", + initial = "2", - summary = [[" - End value of the exponent used in the calculation of all repulsive forces in PDP. - "]] + summary = [[" + End value of the exponent used in the calculation of all repulsive forces in PDP. + "]] } declare { - key = "start attractive exponent", - type = "number", - initial = "2", - - summary = [[" - Start value of the exponent used in PDP's calculation of the attractive force between - nodes connected by an edge. - "]] + key = "start attractive exponent", + type = "number", + initial = "2", + + summary = [[" + Start value of the exponent used in PDP's calculation of the attractive force between + nodes connected by an edge. + "]] } declare { - key = "end attractive exponent", - type = "number", - initial = "2", - - summary = [[" - End value of the exponent used in PDP's calculation of the attractive force between - nodes connected by an edge. - "]] + key = "end attractive exponent", + type = "number", + initial = "2", + + summary = [[" + End value of the exponent used in PDP's calculation of the attractive force between + nodes connected by an edge. + "]] } declare { - key = "exponent change iterations", - type = "number", - initial = "1", - - summary = [[" - The number of iterations over which to modify the force exponents. - In iteration one the exponents will have their start value and in iteration - |exponent change iterations| they will have their end value. - "]] + key = "exponent change iterations", + type = "number", + initial = "1", + + summary = [[" + The number of iterations over which to modify the force exponents. + In iteration one the exponents will have their start value and in iteration + |exponent change iterations| they will have their end value. + "]] } declare { - key = "edge approach threshold", - type = "number", - initial = "0.3", - - summary = [[" - The maximum ration between the actual and the desired node-edge distance - which is required to count an edge as stressed. - "]] + key = "edge approach threshold", + type = "number", + initial = "0.3", + + summary = [[" + The maximum ration between the actual and the desired node-edge distance + which is required to count an edge as stressed. + "]] } declare { - key = "edge stretch threshold", - type = "number", - initial = "1.5", - - summary = [[" - The minimum ration between the actual and the desired edge length - which is required to count an edge as stressed. - "]] + key = "edge stretch threshold", + type = "number", + initial = "1.5", + + summary = [[" + The minimum ration between the actual and the desired edge length + which is required to count an edge as stressed. + "]] } declare { - key = "stress counter threshold", - type = "number", - initial = "30", + key = "stress counter threshold", + type = "number", + initial = "30", - summary = [[" - The number of iterations an edge has to be under stress before it will be subdivided. - "]] + summary = [[" + The number of iterations an edge has to be under stress before it will be subdevided. + "]] } declare { - key = "edge divisions", - type = "number", - initial = "0", + key = "edge divisions", + type = "number", + initial = "0", - summary = [[" - The number of edges in which stressed edges will be subdivided. - "]] + summary = [[" + The number of edges in which stressed edges will be subdivided. + "]] } diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/routing/Hints.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/routing/Hints.lua index 7d34726f47b..1f68bd99f5f 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/routing/Hints.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/routing/Hints.lua @@ -17,7 +17,7 @@ -- vertex positioning algorithms from the choice of edge routing -- algorithm. For instance, for a simple necklace routing, it is -- unclear whether the edges on the necklace should be routing ``along --- the necklace'' or not. Thus, necklace routing algorithms will +-- the necklace'' or not. Thus, necklace routing algoirthms will -- ``hint'' that a necklace is present and only when the -- |necklace routing| algorithm is selected will these hints lead to -- actual bending of edges. @@ -47,14 +47,14 @@ local necklaces = Storage.new() -- Adds a necklace hint. In this case, the hint indicates that the -- given sequence of vertices lie on a circle. -- --- The idea is that an algorithm may specify that in a --- given graph certain sequences of nodes form a ``necklace'', which +-- The idea is that an algorithm may specify that in a +-- given graph certain sequences of nodes form a ``necklace,'' which -- is typically a circle. There may be more than one necklace inside a --- given graph. For each necklace, +-- given graph. For each necklace, -- whenever an arc connects subsequent nodes on the necklace, they get -- bend in such a way that they lie follow the path of the -- necklace. If an arc lies on more than one necklace, the ``last one --- wins''. +-- wins.'' -- -- @param ugraph The ugraph to which this hint is added -- @param necklace The sequence of vertices that form the necklace. If @@ -68,7 +68,7 @@ local necklaces = Storage.new() function Hints.addNecklaceCircleHint(ugraph, necklace, center, clockwise) local a = necklaces[ugraph] or {} necklaces[ugraph] = a - + a[#a+1] = { necklace = necklace, center = center or Coordinate.origin, @@ -95,6 +95,6 @@ function Hints.getNecklaceHints(ugraph) end -- done - + return Hints diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/routing/NecklaceRouting.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/routing/NecklaceRouting.lua index defcf9f8c61..9a99ea2275f 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/routing/NecklaceRouting.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/routing/NecklaceRouting.lua @@ -35,28 +35,28 @@ declare { summary = "Bends all edges of a graph that lie on ``necklaces'' along these necklaces.", documentation = [[" - Some graph drawing algorithms lay out some or all nodes along a - path, which is then called a \emph{necklace}. For instance, the - |simple necklace layout| places all nodes on a circle and that - circle is the ``necklace''. When the |necklace routing| edge - routing algorithm is selected, all edges that connect subsequent - nodes on such a necklace are bend in such a way that the - ``follow the necklace path''. In the example case, this will - cause all edges that connect adjacent nodes to become arcs on - of the circle on which the nodes lie. - - Note that local edge routing options for an edge may overrule - the edge routing computed by the algorithm as in the edge from 6 - to 7 in the example. + Some graph drawing algorithms lay out some or all nodes along a + path, which is then called a \emph{necklace.} For instance, the + |simple necklace layout| places all nodes on a circle and that + circle is the ``necklace.'' When the |necklace rounting| edge + routing algorithm is selected, all edges that connect subsequent + nodes on such a necklace are bend in such a way that the + ``follow the necklace path.'' In the example case, this will + cause all edges that connect adjacent nodes to become arcs on + of the circle on which the nodes lie. + + Note that local edge routing options for an edge may overrule + the edge routing computed by the algorithm as in the edge from 6 + to 7 in the example. "]], - + examples = [[" - \tikz \graph [simple necklace layout, node distance=1.5cm, - necklace routing, - nodes={draw,circle}, edges={>={Stealth[round,sep,bend]}}] - { 1 -> 2 [minimum size=30pt] <- 3 <-> 4 -- - 5 -- 6 -- [bend left] 7 -- 1 -- 4 }; - "]] + \tikz \graph [simple necklace layout, node distance=1.5cm, + necklace routing, + nodes={draw,circle}, edges={>={Stealth[round,sep,bend]}}] + { 1 -> 2 [minimum size=30pt] <- 3 <-> 4 -- + 5 -- 6 -- [bend left] 7 -- 1 -- 4 }; + "]] } @@ -65,19 +65,19 @@ declare { function NecklaceRouting:run() local ugraph = self.ugraph - + for _,entry in ipairs(Hints.getNecklaceHints(ugraph)) do assert (entry.center) -- no other necklace types, yet local prev for _,vertex in ipairs(entry.necklace) do if prev then - local a = ugraph:arc(prev, vertex) - if a then - local p = Path.new() - p:appendMoveto(a.tail.pos:clone()) - p:appendArcTo(a.head.pos:clone(), entry.center, entry.clockwise) - a.path = p - end + local a = ugraph:arc(prev, vertex) + if a then + local p = Path.new() + p:appendMoveto(a.tail.pos:clone()) + p:appendArcTo(a.head.pos:clone(), entry.center, entry.clockwise) + a.path = p + end end prev = vertex end @@ -87,4 +87,4 @@ end -- done -return NecklaceRouting +return NecklaceRouting
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/tools/make_gd_wrap.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/tools/make_gd_wrap.lua index a0aee6501cc..b13dcb9abb4 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/tools/make_gd_wrap.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/tools/make_gd_wrap.lua @@ -17,7 +17,7 @@ -- algorithm implemented in C and wish to invoke it from Lua, you need -- a wrapper that manages the translation between Lua and C. This -- program is intended to make it (reasonably) easy to produce such a --- wrapper. +-- wraper. @@ -29,7 +29,7 @@ Usage: make_gd_wrap library1 library2 ... libraryn template library_name target_ This program will read all of the graph drawing library files using Lua's require. Then, it will iterate over all declared algorithm keys -(declared using declare { algorithm_written_in_c = ... }) and will +(declared using declare { algorithm_written_in_c = ... }) and will produce the code for library for the required target C files based on the template. "]]) @@ -82,79 +82,79 @@ local factories = {} local factories_reg = {} for _,k in ipairs(keys) do - + if k.algorithm_written_in_c and k.code then local library, fun_name = k.algorithm_written_in_c:match("(.*)%.(.*)") - - if target == library then + + if target == library then -- First, gather the includes: if type(k.includes) == "string" then - if not includes[k.includes] then - includes[#includes + 1] = k.includes - includes[k.includes] = true - end + if not includes[k.includes] then + includes[#includes + 1] = k.includes + includes[k.includes] = true + end elseif type(k.includes) == "table" then - for _,i in ipairs(k.includes) do - if not includes[i] then - includes[#includes + 1] = i - includes[i] = true - end - end + for _,i in ipairs(k.includes) do + if not includes[i] then + includes[#includes + 1] = i + includes[i] = true + end + end end - + -- Second, create a code block: functions[#functions+1] = functions_dec:gsub("%$([%w_]-)%b{}", - { - function_name = fun_name, - function_body = k.code - }) - + { + function_name = fun_name, + function_body = k.code + }) + -- Third, create functions_registry entry functions_registry[#functions_registry + 1] = functions_reg_dec:gsub("%$([%w_]-)%b{}", - { - function_name = fun_name, - function_body = k.code - }) + { + function_name = fun_name, + function_body = k.code + }) end end - + if k.module_class then - + -- First, gather the includes: if type(k.includes) == "string" then if not includes[k.includes] then - includes[#includes + 1] = k.includes - includes[k.includes] = true + includes[#includes + 1] = k.includes + includes[k.includes] = true end elseif type(k.includes) == "table" then for _,i in ipairs(k.includes) do - if not includes[i] then - includes[#includes + 1] = i - includes[i] = true - end + if not includes[i] then + includes[#includes + 1] = i + includes[i] = true + end end end - + -- Second, create a code block: factories[#factories+1] = factories_dec:gsub( "%$([%w_]-)%b{}", { - factory_class = k.module_class, - factory_code = k.code, - factory_base = k.module_base, - factory_name = k.module_class .. '_factory' + factory_class = k.module_class, + factory_code = k.code, + factory_base = k.module_base, + factory_name = k.module_class .. '_factory' }) - + -- Third, create factories_registry entry factories_reg[#factories_reg + 1] = factories_reg_dec:gsub( "%$([%w_]-)%b{}", { - factory_class = k.module_class, - factory_code = k.code, - factory_base = k.module_base, - factory_name = k.module_class .. '_factory' + factory_class = k.module_class, + factory_code = k.code, + factory_base = k.module_base, + factory_name = k.module_class .. '_factory' }) end end @@ -180,4 +180,4 @@ file:write ((template:gsub( }))) file:close() - +
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/ChildSpec.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/ChildSpec.lua index 5af36428858..0b975fd3291 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/ChildSpec.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/ChildSpec.lua @@ -33,11 +33,10 @@ -- of specifying ``missing first children'' or, more generally, missing -- children that are not ``at the end'' of the list of children. For -- this, there are three methods: --- % +-- -- \begin{enumerate} --- \item When you use the |child| syntax, you can use the |missing| key --- with the |child| command to indicate a missing child: --- % +-- \item When you use the |child| syntax, you can use the |missing| key +-- with the |child| command to indicate a missing child: -- \begin{codeexample}[] -- \tikz [binary tree layout, level distance=5mm] -- \node {a} @@ -52,18 +51,15 @@ -- child { node {g} -- } } }; -- \end{codeexample} --- % --- \item When using the |graph| syntax, you can use an ``empty node'', --- which really must be completely empty and may not even contain a --- slash, to indicate a missing node: --- % +-- \item When using the |graph| syntax, you can use an ``empty node'', +-- which really must be completely empty and may not even contain a +-- slash, to indicate a missing node: -- \begin{codeexample}[] -- \tikz [binary tree layout, level distance=5mm] -- \graph { a -> { b -> c -> d, e -> { , f -> { , g} } } }; -- \end{codeexample} --- % --- \item You can simply specify the index of a child directly using --- the key |desired child index|. +-- \item You can simply specify the index of a child directly using +-- the key |desired child index|. -- \end{enumerate} -- -- @end @@ -82,27 +78,27 @@ declare { initial = "0", summary = [[" - Specifies how many children a tree node must have at least. If - there are less, ``virtual'' children are added. + Specifies how many children a tree node must have at least. If + there are less, ``virtual'' children are added. "]], - documentation = [[" - When this key is set to |2| or more, the following happens: We first - compute a spanning tree for the graph, see - Section~\ref{subsection-gd-spanning-tree}. Then, whenever a node is - not a leaf in this spanning tree (when it has at least one child), - we add ``virtual'' or ``dummy'' nodes as children of the node until - the total number of real and dummy children is at least - \meta{number}. If there where at least \meta{number} children at the - beginning, nothing happens. - - The new children are added after the existing children. This means - that, for instance, in a tree with \meta{number} set to |2|, for - every node with a single child, this child will be the first child - and the second child will be missing. + documentation = [[" + When this key is set to |2| or more, the following happens: We first + compute a spanning tree for the graph, see + Section~\ref{subsection-gd-spanning-tree}. Then, whenever a node is + not a leaf in this spanning tree (when it has at least one child), + we add ``virtual'' or ``dummy'' nodes as children of the node until + the total number of real and dummy children is at least + \meta{number}. If there where at least \meta{number} children at the + beginning, nothing happens. + + The new children are added after the existing children. This means + that, for instance, in a tree with \meta{number} set to |2|, for + every node with a single child, this child will be the first child + and the second child will be missing. "]], examples = [[" - \tikz \graph [binary tree layout,level distance=5mm] - { a -> { b->c->d, e->f->g } }; + \tikz \graph [binary tree layout,level distance=5mm] + { a -> { b->c->d, e->f->g } }; "]] } @@ -112,60 +108,65 @@ declare { key = "desired child index", type = "number", - summary = [[" - Pass this key to a node to tell the graph drawing engine which child - number you ``desired'' for the node. Whenever all desires for the - children of a node are conflict-free, they will all be met; children - for which no desired indices were given will remain at their - position, whenever possible, but will ``make way'' for children with - a desired position. + summary = [[" + Pass this key to a node to tell the graph drawing engine which child + number you ``desired'' for the node. Whenever all desires for the + children of a node are conflict-free, they will all be met; children + for which no desired indices were given will remain at their + position, whenever possible, but will ``make way'' for children with + a desired position. "]], documentation = [[" - In detail, the following happens: We first - determine the total number of children (real or dummy) needed, which - is the maximum of the actual number of children, of the - \texttt{minimum number of children}, and of the highest desired - child index. Then we go over all children that have a desired child - index and put they at this position. If the position is already - taken (because some other child had the same desired index), the - next free position is used with a wrap-around occurring at the - end. Next, all children without a desired index are place using the - same mechanism, but they want to be placed at the position they had - in the original spanning tree. - - While all of this might sound a bit complicated, the application of - the key in a binary tree is pretty straightforward: To indicate that - a node is a ``right'' child in a tree, just add \texttt{desired child index=2} - to it. This will make it a second child, possibly causing the fist - child to be missing. If there are two nodes specified as children of - a node, by saying \texttt{desired child index=}\meta{number} for one - of them, you will cause it be first or second child, depending on - \meta{number}, and cause the \emph{other} child to become the other - child. - - Since |desired child index=2| is a bit long, the following shortcuts - are available: |first|, |second|, |third|, and |fourth|. - You might wonder why |second| is used rather than |right|. The - reason is that trees may also grow left and right and, additionally, - the |right| and |left| keys are already in use for - anchoring. Naturally, you can locally redefine them, if you want. + In detail, the following happens: We first + determine the total number of children (real or dummy) needed, which + is the maximum of the actual number of children, of the + \texttt{minimum number of children}, and of the highest desired + child index. Then we go over all children that have a desired child + index and put they at this position. If the position is already + taken (because some other child had the same desired index), the + next free position is used with a wrap-around occurring at the + end. Next, all children without a desired index are place using the + same mechanism, but they want to be placed at the position they had + in the original spanning tree. + + While all of this might sound a bit complicated, the application of + the key in a binary tree is pretty straightforward: To indicate that + a node is a ``right'' child in a tree, just add \texttt{desired child index=2} + to it. This will make it a second child, possibly causing the fist + child to be missing. If there are two nodes specified as children of + a node, by saying \texttt{desired child index=}\meta{number} for one + of them, you will cause it be first or second child, depending on + \meta{number}, and cause the \emph{other} child to become the other + child. + + Since |desired child index=2| is a bit long, the following shortcuts + are available: |first|, |second|, |third|, and |fourth|. + You might wonder why |second| is used rather than |right|. The + reason is that trees may also grow left and right and, additionally, + the |right| and |left| keys are already in use for + anchoring. Naturally, you can locally redefine them, if you want. "]], - examples = {[[" - \tikz \graph [binary tree layout, level distance=5mm] - { a -> b[second] }; - "]],[[" - \tikz \graph [binary tree layout, level distance=5mm] - { a -> { b[second], c} }; - "]],[[" - \tikz \graph [binary tree layout, level distance=5mm] - { a -> { b, c[first]} }; - "]],[[" - \tikz \graph [binary tree layout, level distance=5mm] - { a -> { b[second], c[second]} }; - "]],[[" - \tikz \graph [binary tree layout, level distance=5mm] - { a -> { b[third], c[first], d} }; - "]] + examples = { + [[" + \tikz \graph [binary tree layout, level distance=5mm] + { a -> b[second] }; + "]], + [[" + \tikz \graph [binary tree layout, level distance=5mm] + { a -> { b[second], c} }; + "]], + [[" + \tikz \graph [binary tree layout, level distance=5mm] + { a -> { b, c[first]} }; + "]], + [[" + \tikz \graph [binary tree layout, level distance=5mm] + { a -> { b[second], c[second]} }; + "]], + [[" + \tikz \graph [binary tree layout, level distance=5mm] + { a -> { b[third], c[first], d} }; + "]] } } @@ -178,9 +179,9 @@ declare { { key = "desired child index", value = 1}, }, - summary = [[" - A shorthand for setting the desired child number to |1|. - "]] + summary = [[" + A shorthand for setting the desired child number to |1|. + "]] } --- @@ -191,11 +192,11 @@ declare { { key = "desired child index", value = 2}, }, - summary = [[" - A shorthand for setting the desired child number to |2|. - "]] + summary = [[" + A shorthand for setting the desired child number to |2|. + "]] } - + --- @@ -205,11 +206,11 @@ declare { { key = "desired child index", value = 3}, }, - summary = [[" - A shorthand for setting the desired child number to |3|. + summary = [[" + A shorthand for setting the desired child number to |3|. "]] } - + --- @@ -219,7 +220,8 @@ declare { { key = "desired child index", value = 4} }, - summary = [[" - A shorthand for setting the desired child number to |4|. + summary = [[" + A shorthand for setting the desired child number to |4|. "]] } + diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/ReingoldTilford1981.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/ReingoldTilford1981.lua index 69babd443c7..8eba23a2106 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/ReingoldTilford1981.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/ReingoldTilford1981.lua @@ -27,7 +27,7 @@ local Storage = require "pgf.gd.lib.Storage" declare { key = "tree layout", algorithm = ReingoldTilford1981, - + preconditions = { connected = true, tree = true @@ -69,7 +69,7 @@ declare { }, documentation_in = "pgf.gd.trees.doc" } - + --- declare { key = "extended binary tree layout", @@ -86,16 +86,16 @@ declare { -- Now comes the implementation: - + function ReingoldTilford1981:run() local root = self.spanning_tree.root local layers = Storage.new() local descendants = Storage.new() - + self.extended_version = self.digraph.options['missing nodes get space'] - + self:precomputeDescendants(root, 1, layers, descendants) self:computeHorizontalPosition(root, layers, descendants) layered.arrange_layers_by_baselines(layers, self.adjusted_bb, self.ugraph) @@ -113,7 +113,7 @@ function ReingoldTilford1981:precomputeDescendants(node, depth, layers, descenda my_descendants[#my_descendants + 1] = d end end - + layers[node] = depth descendants[node] = my_descendants end @@ -121,7 +121,7 @@ end function ReingoldTilford1981:computeHorizontalPosition(node, layers, descendants) - + local children = self.spanning_tree:outgoing(node) node.pos.x = 0 @@ -133,19 +133,19 @@ function ReingoldTilford1981:computeHorizontalPosition(node, layers, descendants for i=1,#children do self:computeHorizontalPosition(children[i].head, layers, descendants) end - + -- Now, compute minimum distances and shift them local right_borders = {} for i=1,#children-1 do - + local local_right_borders = {} - + -- Advance "right border" of the subtree rooted at -- the i-th child for _,d in ipairs(descendants[children[i].head]) do local layer = layers[d] - local x = d.pos.x + local x = d.pos.x if self.extended_version or not (layer > child_depth and d.kind == "dummy") then if not right_borders[layer] or right_borders[layer].pos.x < x then right_borders[layer] = d @@ -160,7 +160,7 @@ function ReingoldTilford1981:computeHorizontalPosition(node, layers, descendants -- Now left for i+1 st child for _,d in ipairs(descendants[children[i+1].head]) do local layer = layers[d] - local x = d.pos.x + local x = d.pos.x if self.extended_version or not (layer > child_depth and d.kind == "dummy") then if not left_borders[layer] or left_borders[layer].pos.x > x then left_borders[layer] = d @@ -179,13 +179,13 @@ function ReingoldTilford1981:computeHorizontalPosition(node, layers, descendants local n1 = right_borders[layer] if n1 then shift = math.max( - shift, + shift, layered.ideal_sibling_distance(self.adjusted_bb, self.ugraph, n1, n2) + n1.pos.x - n2.pos.x ) end if local_right_borders[layer] then if layer > child_depth and - (left_borders[layer].pos.x - local_right_borders[layer].pos.x <= first_dist) then + (left_borders[layer].pos.x - local_right_borders[layer].pos.x <= first_dist) then is_significant = true end end @@ -200,7 +200,7 @@ function ReingoldTilford1981:computeHorizontalPosition(node, layers, descendants d.pos.x = d.pos.x + shift end end - + -- Finally, position root in the middle: node.pos.x = (children[1].head.pos.x + children[#children].head.pos.x) / 2 end diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/SpanningTreeComputation.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/SpanningTreeComputation.lua index 8951ce0538c..791fb81e658 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/SpanningTreeComputation.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/SpanningTreeComputation.lua @@ -18,7 +18,7 @@ -- Although the algorithms of this library are tailored to layout trees, -- they will work for any graph as input. First, if the graph is not -- connected, it is decomposed into connected components and these are --- laid out individually. Second, for each component, a spanning tree of +-- laid out individiually. Second, for each component, a spanning tree of -- the graph is computed first and the layout is computed for this -- spanning tree; all other edges will still be drawn, but they have no -- impact on the placement of the nodes. If the graph is already a tree, @@ -28,9 +28,9 @@ -- a non-tree graph has many different possible spanning trees. You can -- choose between different methods for deciding on a spanning tree, it -- is even possible to implement new algorithms. (In the future, the --- computation of spanning trees and the cycle removal in layered graph +-- computation of spanning trees and the cylce removal in layered graph -- drawing algorithms will be unified, but, currently, they are --- implemented differently.) +-- implemented differently.) -- -- Selects the (sub)algorithm that is to be used for computing spanning -- trees whenever this is requested by a tree layout algorithm. The @@ -39,15 +39,15 @@ --\begin{codeexample}[] --\tikz \graph [tree layout, breadth first spanning tree] --{ --- 1 -- {2,3,4,5} -- 6; ---}; +-- 1 -- {2,3,4,5} -- 6; +--}; --\end{codeexample} --\begin{codeexample}[] --\tikz \graph [tree layout, depth first spanning tree] --{ --- 1 --[bend right] {2,3,4,5 [>bend left]} -- 6; ---}; ---\end{codeexample} +-- 1 --[bend right] {2,3,4,5 [>bend left]} -- 6; +--}; +--\end{codeexample} -- -- @end @@ -82,91 +82,90 @@ local declare = require("pgf.gd.interface.InterfaceToAlgorithms").declare -- declare { key = "breadth first spanning tree", - algorithm = { + algorithm = { run = function (self) - return SpanningTreeComputation.computeSpanningTree(self.ugraph, false, self.events) + return SpanningTreeComputation.computeSpanningTree(self.ugraph, false, self.events) end }, phase = "spanning tree computation", phase_default = true, - summary = [[" - This key selects ``breadth first'' as the (sub)algorithm for - computing spanning trees. Note that this key does not cause a graph - drawing scope to start; the key only has an effect in conjunction - with keys like |tree layout|. -"]], - documentation = [[" - The algorithm will be called whenever a graph drawing algorithm - needs a spanning tree on which to operate. It works as follows: - % - \begin{enumerate} - \item It looks for a node for which the |root| parameter is - set. If there are several such nodes, the first one is used. - If there are no such nodes, the first node is used. - - Let call the node determined in this way the \emph{root node}. - \item For every edge, a \emph{priority} is determined, which is a - number between 1 and 10. How this happens, exactly, will be - explained in a moment. Priority 1 means ``most important'' while - priority 10 means ``least important''. - \item Starting from the root node, we now perform a breadth first - search through the tree, thereby implicitly building a spanning - tree: Suppose for a moment that all edges have priority~1. Then, - the algorithm works just the way that a normal breadth first - search is performed: We keep a queue of to-be-visited nodes and - while this queue is not empty, we remove its first node. If this - node has not yet been visited, we add all its neighbors at the - end of the queue. When a node is taken out of the queue, we make - it the child of the node whose neighbor it was when it was - added. Since the queue follows the ``first in, first out'' - principle (it is a fifo queue), the children of the root will be - all nodes at distance $1$ form the root, their children will be - all nodes at distance $2$, and so on. - \item Now suppose that some edges have a priority different - from~1, in which case things get more complicated. We now keep - track of one fifo queue for each of the ten possible - priorities. When we consider the neighbors of a node, we actually - consider all its incident edges. Each of these edges has a certain - priority and the neighbor is put into the queue of the edge's - priority. Now, we still remove nodes normally from the queue for - priority~1; only if this queue is empty and there is still a node - in the queue for priority~2 we remove the first element from this - queue (and proceed as before). If the second queue is also empty, - we try the third, and so on up to the tenth queue. If all queues - are empty, the algorithm stops. - \end{enumerate} - - The effect of the ten queues is the following: If the edges of - priority $1$ span the whole graph, a spanning tree consisting solely - of these edges will be computed. However, if they do not, once we - have visited reachable using only priority 1 edges, we will extend - the spanning tree using a priority 2 edge; but then we once switch - back to using only priority 1 edges. If neither priority~1 nor - priority~2 edges suffice to cover the whole graph, priority~3 edges - are used, and so on. + summary = [[" + This key selects ``breadth first'' as the (sub)algorithm for + computing spanning trees. Note that this key does not cause a graph + drawing scope to start; the key only has an effect in conjunction + with keys like |tree layout|. + "]], + documentation = [[" + The algorithm will be called whenever a graph drawing algorithm + needs a spanning tree on which to operate. It works as follows: + \begin{enumerate} + \item It looks for a node for which the |root| parameter is + set. If there are several such nodes, the first one is used. If there + are no such nodes, the first node is used. + + Let call the node determined in this way the \emph{root node}. + \item For every edge, a \emph{priority} is determined, which is a + number between 1 and 10. How this happens, exactly, will be + explained in a moment. Priority 1 means ``most important'' while + priority 10 means ``least important''. + \item Starting from the root node, we now perform a breadth first + search through the tree, thereby implicitly building a spanning + tree: Suppose for a moment that all edges have priority~1. Then, + the algorithm works just the way that a normal breadth first + search is performed: We keep a queue of to-be-visited nodes and + while this queue is not empty, we remove its first node. If this + node has not yet been visited, we add all its neighbors at the + end of the queue. When a node is taken out of the queue, we make + it the child of the node whose neighbor it was when it was + added. Since the queue follows the ``first in, first out'' + principle (it is a fifo queue), the children of the root will be + all nodes at distance $1$ form the root, their children will be + all nodes at distance $2$, and so on. + \item Now suppose that some edges have a priority different + from~1, in which case things get more complicated. We now keep + track of one fifo queue for each of the ten possible + priorities. When we consider the neighbors of a node, we actually + consider all its incident edges. Each of these edges has a certain + priority and the neighbor is put into the queue of the edge's + priority. Now, we still remove nodes normally from the queue for + priority~1; only if this queue is empty and there is still a node + in the queue for priority~2 we remove the first element from this + queue (and proceed as before). If the second queue is also empty, + we try the third, and so on up to the tenth queue. If all queues + are empty, the algorithm stops. + \end{enumerate} + + The effect of the ten queues is the following: If the edges of + priority $1$ span the whole graph, a spanning tree consisting solely + of these edges will be computed. However, if they do not, once we + have visited reachable using only priority 1 edges, we will extend + the spanning tree using a priority 2 edge; but then we once switch + back to using only priority 1 edges. If neither priority~1 nor + priority~2 edges suffice to cover the whole graph, priority~3 edges + are used, and so on. "]] -} + } --- declare { key = "depth first spanning tree", - algorithm = { + algorithm = { run = function (self) - return SpanningTreeComputation.computeSpanningTree(self.ugraph, true, self.events) + return SpanningTreeComputation.computeSpanningTree(self.ugraph, true, self.events) end }, phase = "spanning tree computation", - summary = [[" - Works exactly like |breadth first spanning tree| (same handling of - priorities), only the queues are now lifo instead of - fifo. - "]] -} + summary = [[" + Works exactly like |breadth first spanning tree| (same handling of + priorities), only the queues are now lifo instead of + fifo. + "]] + } --- -- @@ -175,13 +174,13 @@ declare { type = "boolean", default = true, - summary = [[" - This Boolean parameter is used in the computation of spanning - trees. When can be set for a node, this node will be used as the - root for the spanning tree computation. If several nodes have this - option set, the first node will be used. - "]] -} + summary = [[" + This Boolean parameter is used in the computation of spanning + trees. When can be set for a node, this node will be used as the + root for the spanning tree computation. If several nodes have this + option set, the first node will be used. + "]] + } --- @@ -190,29 +189,29 @@ declare { key = "span priority", type = "number", - summary = [[" - Explicitly sets the ``span priority'' of an edge to \meta{number}, which must be - a number between |1| and |10|. The priority of edges is used by - spanning tree computations, see |breadth first spanning tree|. - "]] -} - + summary = [[" + Explicitly sets the ``span priority'' of an edge to \meta{number}, which must be + a number between |1| and |10|. The priority of edges is used by + spanning tree computations, see |breadth first spanning tree|. + "]] + } + --- --- when it comes to choosing which edges are part of the spanning tree. +-- when it comes to choosing which edges are part of the spanning tree. declare { key = "span edge", use = { { key = "span priority", value = 1 }, }, - summary = [[" - An easy-to-remember shorthand for |span priority=1|. When this key - is used with an edge, it will always be preferred over other edges - "]] -} - + summary = [[" + An easy-to-remember shorthand for |span priority=1|. When this key + is used with an edge, it will always be preferred over other edges + "]] + } + @@ -224,29 +223,29 @@ declare { { key = "span priority", value = 10 }, }, - summary = [[" - An easy-to-remember shorthand for |span priority=10|. This causes - the edge to be used only as a last resort as part of a spanning - tree. - "]], - documentation = [[" - In the example, we add lots of edges that would normally be - preferred in the computation of the spanning tree, but use - |no span edge| to cause the algorithm to ignore these edges. - "]], - examples = [[" - \tikz \graph [tree layout, nodes={draw}, sibling distance=0pt, - every group/.style={ - default edge kind=->, no span edge, - path=source}] - { - 5 -> { - "1,3" -> {0,2,4}, - 11 -> { - "7,9" -> { 6, 8, 10 } + summary = [[" + An easy-to-remember shorthand for |span priority=10|. This causes + the edge to be used only as a last resort as part of a spanning + tree. + "]], + documentation = [[" + In the example, we add lots of edges that would normally be + preferred in the computation of the spanning tree, but use + |no span edge| to cause the algorithm to ignore these edges. + "]], + examples = [[" + \tikz \graph [tree layout, nodes={draw}, sibling distance=0pt, + every group/.style={ + default edge kind=->, no span edge, + path=source}] + { + 5 -> { + "1,3" -> {0,2,4}, + 11 -> { + "7,9" -> { 6, 8, 10 } + } } - } - }; + }; "]] } @@ -258,85 +257,79 @@ declare { type = "number", initial = "3", - summary = [[" - This key stores the span priority of all edges whose direction is - |->|. There are similar keys for all other directions, such as - |span priority <-| and so on. + summary = [[" + This key stores the span priority of all edges whose direction is + |->|. There are similar keys for all other directions, such as + |span priority <-| and so on. "]], - documentation = [[" - When you write - % + documentation = [[" + When you write \begin{codeexample}[code only] -graph { a -> b -- c <- [span priority=2] d } +graph { a -> b -- c <- [span priority=2] d } \end{codeexample} - % - the priority of the edge from |a| to |b| would be the current - value of the key |span priority ->|, the priority of the edge from - |b| to |c| would be the current value of |span priority --|, and - the priority of the edge from |c| to |d| would be |2|, regardless - of the value of |span priority <-|. - - The defaults for the priorities are: - % - \begin{itemize} - \item |span priority -> = 3| - \item |span priority -- = 5| - \item |span priority <-> = 5| - \item |span priority <- = 8| - \item |span priority -!- = 10| - \end{itemize} + the priority of the edge from |a| to |b| would be the current + value of the key |span priority ->|, the priority of the edge from + |b| to |c| would be the current value of |span priority --|, and + the priority of the edge from |c| to |d| would be |2|, regardless + of the value of |span priority <-|. + + The defaults for the priorities are: + \begin{itemize} + \item |span priority -> = 3| + \item |span priority -- = 5| + \item |span priority <-> = 5| + \item |span priority <- = 8| + \item |span priority -!- = 10| + \end{itemize} "]] } - + --- - + declare { key = "span priority reversed ->", type = "number", initial = "9", - documentation = [[" - This key stores the span priority of traveling across reversed - edges whose actual direction is |->| (again, there are similar keys - for all other directions). + documentation = [[" + This key stores the span priority of traveling across reversed + edges whose actual direction is |->| (again, there are similar keys + for all other directions). "]], - documentation = [[" - When you write - % + documentation = [[" + When you write \begin{codeexample}[code only] -graph { a -> b -- c <- [span priority=2] d } +graph { a -> b -- c <- [span priority=2] d } \end{codeexample} - % - there are, in addition to the priorities indicated above, also - further edge priorities: The priority of the (reversed) edge |b| - to |a| is |span priority reversed ->|, the priority of the - (reversed) edge |c| to |b| is |span priority reversed --|, and the - span priority of the reversed edge |d| to |c| is |2|, regardless - of the value of |span priority reversed <-|. - - The defaults for the priorities are: - % - \begin{itemize} - \item |span priority reversed -> = 9| - \item |span priority reversed -- = 5| - \item |span priority reversed <-> = 5| - \item |span priority reversed <- = 7| - \item |span priority reversed -!- = 10| - \end{itemize} - - The default priorities are set in such a way, that non-reversed |->| - edges have top priorities, |--| and |<->| edges have the same - priorities in either direction, and |<-| edges have low priority in - either direction (but going |a <- b| from |b| to |a| is given higher - priority than going from |a| to |b| via this edge and also higher - priority than going from |b| to |a| in |a -> b|). - - Keys like |span using directed| change the priorities ``en bloc''. + there are, in addition to the priorities indicated above, also + further edge priorities: The priority of the (reversed) edge |b| + to |a| is |span priority reversed ->|, the priority of the + (reversed) edge |c| to |b| is |span priority reversed --|, and the + span priority of the reversed edge |d| to |c| is |2|, regardless + of the value of |span priority reversed <-|. + + The defaults for the priorities are: + \begin{itemize} + \item |span priority reversed -> = 9| + \item |span priority reversed -- = 5| + \item |span priority reversed <-> = 5| + \item |span priority reversed <- = 7| + \item |span priority reversed -!- = 10| + \end{itemize} + + The default priorities are set in such a way, that non-reversed |->| + edges have top priorities, |--| and |<->| edges have the same + priorities in either direction, and |<-| edges have low priority in + either direction (but going |a <- b| from |b| to |a| is given higher + priority than going from |a| to |b| via this edge and also higher + priority than going from |b| to |a| in |a -> b|). + + Keys like |span using directed| change the priorities ``en bloc''. "]] } - + declare { key = "span priority <-", @@ -395,23 +388,23 @@ declare { { key = "span priority <->", value = 3}, { key = "span priority reversed <->", value = 3}, }, - summary = [[" - This style sets a priority of |3| for all edges that are directed - and ``go along the arrow direction'', that is, we go from |a| to - |b| with a priority of |3| for the cases |a -> b|, |b <- a|, - |a <-> b|, and |b <-> a|. - This strategy is nice with trees specified with both forward and - backward edges. + summary = [[" + This style sets a priority of |3| for all edges that are directed + and ``go along the arrow direction'', that is, we go from |a| to + |b| with a priority of |3| for the cases |a -> b|, |b <- a|, + |a <-> b|, and |b <-> a|. + This strategy is nice with trees specified with both forward and + backward edges. "]], - examples = [[" - \tikz \graph [tree layout, nodes={draw}, sibling distance=0pt, - span using directed] - { - 3 <- 5[root] -> 8, - 1 <- 3 -> 4, - 7 <- 8 -> 9, - 1 -- 4 -- 7 -- 9 - }; + examples = [[" + \tikz \graph [tree layout, nodes={draw}, sibling distance=0pt, + span using directed] + { + 3 <- 5[root] -> 8, + 1 <- 3 -> 4, + 7 <- 8 -> 9, + 1 -- 4 -- 7 -- 9 + }; "]] } @@ -431,9 +424,9 @@ declare { { key = "span priority reversed --", value = 5}, { key = "span priority reversed -!-", value = 5}, }, - - summary = [[" - Assings a uniform priority of 5 to all edges. + + summary = [[" + Assings a uniform priority of 5 to all edges. "]] } @@ -447,7 +440,7 @@ declare { -- determined through an edge priority function. -- -- @param ugraph An undirected graph for which the spanning tree --- should be computed +-- should be computed -- @param dfs True if depth first should be used, false if breadth -- first should be used. -- @@ -456,7 +449,7 @@ declare { function SpanningTreeComputation.computeSpanningTree (ugraph, dfs, events) local tree = Digraph.new (ugraph) -- copy vertices - + local edge_priorities = ugraph.options['/graph drawing/edge priorities'] local root = lib.find(ugraph.vertices, function (v) return v.options['root'] end) or ugraph.vertices[1] @@ -467,7 +460,7 @@ function SpanningTreeComputation.computeSpanningTree (ugraph, dfs, events) local marked = {} local stacks = { -- 10 stacks for 10 priorities, with 1 being the highest - { { parent = nil, node = root}, top = 1, bottom = 1 }, + { { parent = nil, node = root}, top = 1, bottom = 1 }, { top = 0, bottom = 1}, { top = 0, bottom = 1}, { top = 0, bottom = 1}, @@ -478,51 +471,51 @@ function SpanningTreeComputation.computeSpanningTree (ugraph, dfs, events) { top = 0, bottom = 1}, { top = 0, bottom = 1} } - + local function stack_is_non_empty (s) return s.top >= s.bottom end - + while lib.find(stacks, stack_is_non_empty) do local parent, node - + for _,stack in ipairs(stacks) do if stack_is_non_empty(stack) then - -- Pop - parent = stack[stack.top].parent - node = stack[stack.top].node - - stack[stack.top] = nil - stack.top = stack.top - 1 - - break + -- Pop + parent = stack[stack.top].parent + node = stack[stack.top].node + + stack[stack.top] = nil + stack.top = stack.top - 1 + + break end end - + if not marked[node] then - + -- The node is good! marked[node] = true - + if parent then - tree:connect(parent,node) + tree:connect(parent,node) end - + local arcs = ugraph:outgoing(node) - + for j=1,#arcs do - local arc = arcs[dfs and j or #arcs - j + 1] - local head = arc.head - - if not marked[head] then - local priority = arc:spanPriority() - local stack = assert(stacks[priority], "illegal edge priority") - if dfs then - stack.top = stack.top + 1 - stack[stack.top] = { parent = node, node = head} - else - stack.bottom = stack.bottom - 1 - stack[stack.bottom] = { parent = node, node = head} - end - end + local arc = arcs[dfs and j or #arcs - j + 1] + local head = arc.head + + if not marked[head] then + local priority = arc:spanPriority() + local stack = assert(stacks[priority], "illegal edge priority") + if dfs then + stack.top = stack.top + 1 + stack[stack.top] = { parent = node, node = head} + else + stack.bottom = stack.bottom - 1 + stack[stack.bottom] = { parent = node, node = head} + end + end end end end @@ -532,105 +525,106 @@ function SpanningTreeComputation.computeSpanningTree (ugraph, dfs, events) for i,v in ipairs(tree.vertices) do copy[i] = v end - + -- Now, setup child lists for _,v in ipairs(copy) do -- Children as they come from the spanning tree computation tree:sortOutgoing(v, function (a,b) return a:eventIndex() < b:eventIndex() end) local outgoings = tree:outgoing(v) - + -- Compute children as they come in the event list: local children = {} - + local i = (v.event.index or 0)+1 while i <= #events and events[i].kind == "edge" do i = i + 1 end - + if events[i] and events[i].kind == "begin" and events[i].parameters == "descendants" then -- Ok, the node is followed by a descendants group -- Now scan for nodes that are not inside a descendants group local stop = events[i].end_index local j = i+1 while j <= stop do - if events[j].kind == "node" then - children[#children+1] = events[j].parameters - elseif events[j].kind == "begin" and events[j].parameters == "descendants" then - j = events[j].end_index - end - j = j + 1 + if events[j].kind == "node" then + children[#children+1] = events[j].parameters + elseif events[j].kind == "begin" and events[j].parameters == "descendants" then + j = events[j].end_index + end + j = j + 1 end -- Test, whether outgoings and children contain the same nodes: local function same_elements() - local hash = {} - for v,c in ipairs(outgoings) do - hash[c.head] = true - end - local count = 0 - for _,c in pairs(children) do - if c ~= "" then - count = count + 1 - if not hash[c] or count > #outgoings then - return false - end - end - end - return count == #outgoings + local hash = {} + for v,c in ipairs(outgoings) do + hash[c.head] = true + end + local count = 0 + for _,c in pairs(children) do + if c ~= "" then + count = count + 1 + if not hash[c] or count > #outgoings then + return false + end + end + end + return count == #outgoings end if same_elements() and #outgoings > 0 then - -- increase number of children, if necessary - local needed = math.max(#children, lib.lookup_option('minimum number of children', v, ugraph)) - for i=1,#children do - if children[i] ~= "" then - local d = children[i].options['desired child index'] - needed = d and math.max(needed, d) or needed - end - end - - local new_children = {} - for i=1,#children do - if children[i] ~= "" then - local d = children[i].options['desired child index'] - if d then - local target = d - - while new_children[target] do - target = 1 + (target % #children) - end - new_children[target] = children[i] - end - end - end - for i=1,#children do - if children[i] ~= "" then - local d = children[i].options['desired child index'] - if not d then - local target = i - - while new_children[target] do - target = 1 + (target % #children) - end - new_children[target] = children[i] - end - end - end - for i=1,needed do - if not new_children[i] then - local new_child = Vertex.new{ kind = "dummy" } - new_children[i] = new_child - tree:add {new_child} - tree:connect(v,new_child) - end - end - - tree:orderOutgoing(v,new_children) + + -- increase number of children, if necessary + local needed = math.max(#children, lib.lookup_option('minimum number of children', v, ugraph)) + for i=1,#children do + if children[i] ~= "" then + local d = children[i].options['desired child index'] + needed = d and math.max(needed, d) or needed + end + end + + local new_children = {} + for i=1,#children do + if children[i] ~= "" then + local d = children[i].options['desired child index'] + if d then + local target = d + + while new_children[target] do + target = 1 + (target % #children) + end + new_children[target] = children[i] + end + end + end + for i=1,#children do + if children[i] ~= "" then + local d = children[i].options['desired child index'] + if not d then + local target = i + + while new_children[target] do + target = 1 + (target % #children) + end + new_children[target] = children[i] + end + end + end + for i=1,needed do + if not new_children[i] then + local new_child = Vertex.new{ kind = "dummy" } + new_children[i] = new_child + tree:add {new_child} + tree:connect(v,new_child) + end + end + + tree:orderOutgoing(v,new_children) end end end - + tree.root = root return tree diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/doc.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/doc.lua index 169c7ff5e19..753f386bb9e 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/doc.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/doc.lua @@ -25,55 +25,49 @@ documentation [[ The Reingold--Tilford method is a standard method for drawing trees. It is described in: -% \begin{itemize} - \item - E.~M.\ Reingold and J.~S.\ Tilford, - \newblock Tidier drawings of trees, - \newblock \emph{IEEE Transactions on Software Engineering,} - 7(2), 223--228, 1981. +\item + E.~M.\ Reingold and J.~S.\ Tilford, + \newblock Tidier drawings of trees, + \newblock \emph{IEEE Transactions on Software Engineering,} + 7(2), 223--228, 1981. \end{itemize} -% My implementation in |graphdrawing.trees| follows the following paper, which introduces some nice extensions of the basic algorithm: -% \begin{itemize} - \item - A.\ Br\"uggemann-Klein, D.\ Wood, - \newblock Drawing trees nicely with \TeX, - \emph{Electronic Publishing,} 2(2), 101--115, 1989. +\item + A.\ Br\"uggemann-Klein, D.\ Wood, + \newblock Drawing trees nicely with \TeX, + \emph{Electronic Publishing,} 2(2), 101--115, 1989. \end{itemize} -% As a historical remark, Br\"uggemann-Klein and Wood have implemented their version of the Reingold--Tilford algorithm directly in \TeX\ (resulting in the Tree\TeX\ style). With the power of Lua\TeX\ at our disposal, the 2012 implementation in the |graphdrawing.tree| library is somewhat more powerful and cleaner, but it really was an impressive achievement to implement this algorithm back in 1989 -directly in \TeX. +directly in \TeX. The basic idea of the Reingold--Tilford algorithm is to use the following rules to position the nodes of a tree (the following description assumes that the tree grows downwards, other growth directions are handled by the automatic orientation mechanisms of -the graph drawing library): -% +the graph drawing library): \begin{enumerate} - \item For a node, recursively compute a layout for each of its children. - \item Place the tree rooted at the first child somewhere on the page. - \item Place the tree rooted at the second child to the right of the - first one as near as possible so that no two nodes touch (and such - that the |sibling sep| padding is not violated). - \item Repeat for all subsequent children. - \item Then place the root above the child trees at the middle - position, that is, at the half-way point between the left-most and - the right-most child of the node. +\item For a node, recursively compute a layout for each of its children. +\item Place the tree rooted at the first child somewhere on the page. +\item Place the tree rooted at the second child to the right of the + first one as near as possible so that no two nodes touch (and such + that the |sibling sep| padding is not violated). +\item Repeat for all subsequent children. +\item Then place the root above the child trees at the middle + position, that is, at the half-way point between the left-most and + the right-most child of the node. \end{enumerate} -% The standard keys |level distance|, |level sep|, |sibling distance|, and |sibling sep|, as well as the |pre| and |post| versions of these keys, as taken into consideration when nodes are positioned. See also -Section~\ref{subsection-gd-dist-pad} for details on these keys. +Section~\ref{subsection-gd-dist-pad} for details on these keys. \noindent\textbf{Handling of Missing Children.} As described in Section~\ref{section-gd-missing-children}, you can @@ -82,7 +76,6 @@ space should be reserved for them. This is exactly what happens: When the subtrees of the children of a node are arranged, each position with a missing child is treated as if a zero-width, zero-height subtree were present at that positions: -% \begin{codeexample}[] \tikz [tree layout, nodes={draw,circle}] \node {r} @@ -92,9 +85,7 @@ zero-height subtree were present at that positions: } child[missing]; \end{codeexample} -% or in |graph| syntax: -% \begin{codeexample}[] \tikz \graph [tree layout, nodes={draw,circle}] { @@ -106,36 +97,31 @@ or in |graph| syntax: } }; \end{codeexample} -% More than one child can go missing: -% \begin{codeexample}[] \tikz \graph [tree layout, nodes={draw,circle}, sibling sep=0pt] { r -> { a, , ,b -> {c,d}, ,e} }; \end{codeexample} -% Although missing children are taken into consideration for the computation of the placement of the children of a root node relative to one another and also for the computation of the position of the root node, they are usually \emph{not} considered as part of the ``outline'' of a subtree (the \texttt{minimum number of children} key ensures that |b|, |c|, |e|, and |f| all have a missing right -child): -% +child): \begin{codeexample}[] \tikz \graph [tree layout, minimum number of children=2, nodes={draw,circle}] { a -> { b -> c -> d, e -> f -> g } }; \end{codeexample} -% This behaviour of ``ignoring'' missing children in later stages of -the recursion can be changed using the key |missing nodes get space|. +the recursion can be changed using the key |missing nodes get space|. \noindent\textbf{Significant Pairs of Siblings.} Br\"uggemann-Klein and Wood have proposed an extension of the Reingold--Tilford method that is intended to better highlight the overall structure of a tree. Consider the following two trees: -% + \begin{codeexample}[] \tikz [baseline=(a.base), tree layout, minimum number of children=2, sibling distance=5mm, level distance=5mm] @@ -147,8 +133,7 @@ overall structure of a tree. Consider the following two trees: \graph [nodes={circle, inner sep=0pt, minimum size=2mm, fill, as=}]{ a -- { b -- c -- d -- e, i -- j -- { f -- {g,h}, k } } }; -\end{codeexample} -% +\end{codeexample} As observed by Br\"uggemann-Klein and Wood, the two trees are structurally quite different, but the Reingold--Tilford method places the nodes at exactly the same positions and only one edge @@ -164,7 +149,6 @@ example. A \emph{significant pair} is a pair of siblings where the minimum distance is encountered on any level other than the first level. Thus, in the first example there is no significant pair, while in the second example |a| and |b| form such a pair. -% \begin{codeexample}[] \tikz \graph [tree layout, minimum number of children=2, level distance=5mm, nodes={circle,draw}] @@ -174,7 +158,6 @@ while in the second example |a| and |b| form such a pair. level distance=5mm, nodes={circle,draw}] { / -> { a -> / -> /, b -> / -> / }}; \end{codeexample} -% Whenever the algorithm encounters a significant pair, it adds extra space between the siblings as specified by the |significant sep| key. @@ -207,8 +190,9 @@ key "missing nodes get space" summary [[ -When set to true, missing children are treated as if they where -zero-width, zero-height nodes during the whole tree layout process. +When set to true, missing children are treated as if they +where zero-width, zero-height nodes during the whole tree layout +process. ]] @@ -228,10 +212,8 @@ example key "significant sep" summary -[[ -This space is added to significant pairs by the modified -Reingold--Tilford algorithm. -]] +[[ This space is added to signifcant pairs by the modified +Reingold--Tilford algorithm. ]] example [[ @@ -256,22 +238,18 @@ example key "binary tree layout" summary -[[ -A layout based on the Reingold--Tilford method for drawing -binary trees. -]] +[[ A layout based on the Reingold--Tilford method for drawing +binary trees. ]] documentation [[ This key executes: -% \begin{enumerate} - \item |tree layout|, thereby selecting the Reingold--Tilford method, - \item |minimum number of children=2|, thereby ensuring the all nodes - have (at least) two children or none at all, and - \item |significant sep=10pt| to highlight significant pairs. +\item |tree layout|, thereby selecting the Reingold--Tilford method, +\item |minimum number of children=2|, thereby ensuring the all nodes + have (at least) two children or none at all, and +\item |significant sep=10pt| to highlight significant pairs. \end{enumerate} -% In the examples, the last one is taken from the paper of Br\"uggemann-Klein and Wood. It demonstrates nicely the advantages of having the full power of \tikzname's anchoring and the @@ -292,33 +270,31 @@ example \tikz \graph [binary tree layout] { Knuth -> { Beeton -> Kellermann [second] -> Carnes, - Tobin -> Plass -> { Lamport, Spivak } + Tobin -> Plass -> { Lamport, Spivak } } };\qquad \tikz [>=spaced stealth'] \graph [binary tree layout, grow'=right, level sep=1.5em, nodes={right, fill=blue!50, text=white, chamfered rectangle}, - edges={decorate,decoration={snake, post length=5pt}}] + edges={decorate,decoration={snake, post length=5pt}}] { Knuth -> { Beeton -> Kellermann [second] -> Carnes, - Tobin -> Plass -> { Lamport, Spivak } + Tobin -> Plass -> { Lamport, Spivak } } }; ]] -------------------------------------------------------------------- - + -------------------------------------------------------------------- key "extended binary tree layout" summary -[[ -This algorithm is similar to |binary tree layout|, only the +[[ This algorithm is similar to |binary tree layout|, only the option \texttt{missing nodes get space} is executed and the -\texttt{significant sep} is zero. -]] +\texttt{significant sep} is zero. ]] example [[ @@ -329,3 +305,5 @@ example }; ]] -------------------------------------------------------------------- + + diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/library.lua b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/library.lua index a0019666ac8..b8e36982cfc 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/library.lua +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/lua/pgf/gd/trees/library.lua @@ -16,7 +16,7 @@ -- Sections \ref{section-library-graphs} -- and~\ref{section-trees}). The job of the graph drawing algorithms from -- this library is to turn the specification of trees into beautiful --- layouts. +-- layouts. -- -- We start this section with a description of algorithms, then we have a -- look at how missing children can be specified and at what happens when diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/tex/pgflibrarygraphdrawing.circular.code.tex b/Master/texmf-dist/tex/generic/pgf/graphdrawing/tex/pgflibrarygraphdrawing.circular.code.tex index cdcd7a54cb3..61f2e4bed00 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/tex/pgflibrarygraphdrawing.circular.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/tex/pgflibrarygraphdrawing.circular.code.tex @@ -11,6 +11,6 @@ \ProvidesFileRCS{pgflibrarygraphdrawing.circular.code.tex} -\usegdlibrary{circular}% +\usegdlibrary{circular} \endinput diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/tex/pgflibrarygraphdrawing.examples.code.tex b/Master/texmf-dist/tex/generic/pgf/graphdrawing/tex/pgflibrarygraphdrawing.examples.code.tex index 90ebe0f15af..c5c4997d627 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/tex/pgflibrarygraphdrawing.examples.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/tex/pgflibrarygraphdrawing.examples.code.tex @@ -9,9 +9,9 @@ \ProvidesFileRCS{pgflibrarygraphdrawing.examples.code.tex} -\usepgflibrary{graphdrawing}% +\usepgflibrary{graphdrawing} -\usegdlibrary{examples}% +\usegdlibrary{examples} \endinput diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/tex/pgflibrarygraphdrawing.force.code.tex b/Master/texmf-dist/tex/generic/pgf/graphdrawing/tex/pgflibrarygraphdrawing.force.code.tex index 2ffad530012..cd6851466a3 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/tex/pgflibrarygraphdrawing.force.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/tex/pgflibrarygraphdrawing.force.code.tex @@ -11,9 +11,9 @@ -\usepgflibrary{graphdrawing}% +\usepgflibrary{graphdrawing} -\usegdlibrary{force}% +\usegdlibrary{force} \endinput @@ -81,7 +81,7 @@ % % Edge parameters for spring algorithms. % -}% +} \pgfgddeclareforwardedkeys{/graph drawing}{ % diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/tex/pgflibrarygraphdrawing.layered.code.tex b/Master/texmf-dist/tex/generic/pgf/graphdrawing/tex/pgflibrarygraphdrawing.layered.code.tex index 940c8236cf3..794fff40275 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/tex/pgflibrarygraphdrawing.layered.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/tex/pgflibrarygraphdrawing.layered.code.tex @@ -9,9 +9,9 @@ \ProvidesFileRCS{pgflibrarygraphdrawing.layered.code.tex} -\usepgflibrary{graphdrawing}% +\usepgflibrary{graphdrawing} -\usegdlibrary{layered}% +\usegdlibrary{layered} \endinput diff --git a/Master/texmf-dist/tex/generic/pgf/graphdrawing/tex/pgflibrarygraphdrawing.trees.code.tex b/Master/texmf-dist/tex/generic/pgf/graphdrawing/tex/pgflibrarygraphdrawing.trees.code.tex index 87ff6eee233..10231f221ad 100644 --- a/Master/texmf-dist/tex/generic/pgf/graphdrawing/tex/pgflibrarygraphdrawing.trees.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/graphdrawing/tex/pgflibrarygraphdrawing.trees.code.tex @@ -11,9 +11,9 @@ \ProvidesFileRCS{pgflibrarygraphdrawing.trees.code.tex} -\usepgflibrary{graphdrawing}% -\usepgflibrary{graphdrawing.layered}% +\usepgflibrary{graphdrawing} +\usepgflibrary{graphdrawing.layered} -\usegdlibrary{trees}% +\usegdlibrary{trees} \endinput diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.pathmorphing.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.pathmorphing.code.tex index 72ed4ca6b6e..3f628da582d 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.pathmorphing.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.pathmorphing.code.tex @@ -111,7 +111,7 @@ }% \state{zigzag}[width=\pgfmetadecorationsegmentlength, next state=line to] { - \decoration{zigzag} + \decoration{zigzag} }% \state{final} { diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.shapes.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.shapes.code.tex index 08781d04fb8..6b1571518b6 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.shapes.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/decorations/pgflibrarydecorations.shapes.code.tex @@ -127,16 +127,16 @@ % The shape background decoration -% +% % The shape background decoration adds repeated instances of % the background path of a specified shape along the path. The shape % must have been declared by \pgfdeclareshape. If a shape has % specialized keys (e.g. the number of points on a star, or the apex % angle the isosceles triangle), these can be specified in the usual manner. -% +% % The separation between shapes in the path can be specified and can % be between the center of the shape or the border of the shape. -% +% % The height and width of the shape can be independently or % simultaneously scaled (linearly) along the path. It is also % possible to prevent the shapes being sloped parallel to the @@ -220,7 +220,7 @@ \edef\pgf@lib@shapedecoration@height{\the\pgf@y}% \pgf@y-\pgf@y% \pgfmathaddtolength\pgf@y{\pgfkeysvalueof{/pgf/decoration/shape end height}}% - \edef\pgf@lib@shapedecoration@heightchange{\the\pgf@y}% + \edef\pgf@lib@shapedecoration@heightchange{\the\pgf@y}% % % Calculate the sep. % @@ -271,7 +271,7 @@ \ifpgfshapedecorationscaled% \pgf@xa\pgf@lib@shapedecoration@widthchange\relax% \divide\pgf@xa\c@pgf@counta% - \edef\pgf@lib@shapedecoration@specialwidth{\the\pgf@xa}% + \edef\pgf@lib@shapedecoration@specialwidth{\the\pgf@xa}% \fi% \else% \pgf@lib@shapedecoration@betweenbordersfalse% @@ -283,7 +283,7 @@ \advance\pgf@x5pt\relax% An arbitrary value >0pt. \edef\pgf@lib@shapedecoration@initialise{\the\pgf@x}% \fi% - \fi% + \fi% \else% % % Between centers. @@ -345,7 +345,7 @@ % \pgf@y\pgfdecoratedcompleteddistance% \advance\pgf@y\pgfdecoratedremainingdistance% - \pgfmathdivide@{\pgfmath@tonumber{\pgfdecoratedcompleteddistance}}{\pgfmath@tonumber{\pgf@y}}% + \pgfmathdivide@{\pgfmath@tonumber{\pgfdecoratedcompleteddistance}}{\pgfmath@tonumber{\pgf@y}}% \fi% % % Get the new width. @@ -370,8 +370,8 @@ \pgf@x\pgfmathresult\pgf@x% \advance\pgf@x\pgf@lib@shapedecoration@startwidth\relax% \fi% - \fi% - \edef\pgf@lib@shapedecoration@width{\the\pgf@x}% + \fi% + \edef\pgf@lib@shapedecoration@width{\the\pgf@x}% % % New height = R*h + H % @@ -387,7 +387,7 @@ \edef\pgf@lib@shapedecoration@beforeshape{\the\pgf@x}% \else% \def\pgf@lib@shapedecoration@beforeshape{0pt}% - \fi% + \fi% }] {}% \state{shape}[width=+0sp,next state=after shape] @@ -424,7 +424,7 @@ % % And draw the shape path. % - \csname pgf@sh@bg@\pgfkeysvalueof{/pgf/decoration/shape}\endcsname% + \csname pgf@sh@bg@\pgfkeysvalueof{/pgf/decoration/shape}\endcsname% }% \state{after shape} [ diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/luamath/pgf/luamath/functions.lua b/Master/texmf-dist/tex/generic/pgf/libraries/luamath/pgf/luamath/functions.lua index 367d6ae298f..3eecaf99c0a 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/luamath/pgf/luamath/functions.lua +++ b/Master/texmf-dist/tex/generic/pgf/libraries/luamath/pgf/luamath/functions.lua @@ -14,24 +14,24 @@ local pgfluamathfunctions = pgfluamathfunctions or {} -- Maps function names to their function. -- --- Note that this allows to register functions which are not in pgfluamathfunctions. +-- Note that this allows to register functions which are not in pgfluamathfunctions. -- -- Note that the string keys are not necessarily the same as the function --- names. In particular, the math expression "not(1,1)" will execute notPGF(1,1) +-- names. In particular, the math expression "not(1,1)" will execute notPGF(1,1) -- -- Note that each function which is added to pgfluamathfunctions will _automatically_ be inserted into this map, see __newindex. -- (I fear it will not be erased directly...) pgfluamathfunctions.stringToFunctionMap = {} local newFunctionAllocatedCallback = function(table,key,value) - local keyName = tostring(key):gsub("PGF","") - if not value then - stringToFunctionMap[keyName] = nil - elseif type(value) == 'function' then - -- remember it, and strip PGF suffix (i.e. remember 'not' instead of 'notPGF') - pgfluamathfunctions.stringToFunctionMap[keyName] = value - end - rawset(table,key,value) + local keyName = tostring(key):gsub("PGF","") + if not value then + stringToFunctionMap[keyName] = nil + elseif type(value) == 'function' then + -- remember it, and strip PGF suffix (i.e. remember 'not' instead of 'notPGF') + pgfluamathfunctions.stringToFunctionMap[keyName] = value + end + rawset(table,key,value) end setmetatable(pgfluamathfunctions, { __newindex = newFunctionAllocatedCallback }) @@ -56,16 +56,16 @@ pgfluamathfunctions.stringToFunctionMap["TrigFormat"] = nil -- choice is one of the valid choices in TrigFormat. function pgfluamathfunctions.setTrigFormat(choice) - if choice == 'deg' then - trigFormatToRadians = mathrad - radiansToTrigFormat = mathdeg - elseif choice == 'rad' then - local identity = function(x) return x end - trigFormatToRadians = identity - radiansToTrigFormat = identity - else - error("The argument '" .. tostring(choice) .. "' is no valid choice for setTrigFormat.") - end + if choice == 'deg' then + trigFormatToRadians = mathrad + radiansToTrigFormat = mathdeg + elseif choice == 'rad' then + local identity = function(x) return x end + trigFormatToRadians = identity + radiansToTrigFormat = identity + else + error("The argument '" .. tostring(choice) .. "' is no valid choice for setTrigFormat.") + end end pgfluamathfunctions.stringToFunctionMap["setTrigFormat"] = nil @@ -75,422 +75,422 @@ pgfluamathfunctions.stringToFunctionMap["setRandomSeed"] = nil ------------------------------------------- function pgfluamathfunctions.add(x,y) - return x+y + return x+y end function pgfluamathfunctions.subtract(x,y) - return x-y + return x-y end function pgfluamathfunctions.neg(x) - return -x + return -x end function pgfluamathfunctions.multiply(x,y) - return x*y + return x*y end function pgfluamathfunctions.veclen(x,y) - return mathsqrt(x*x+y*y) + return mathsqrt(x*x+y*y) end function pgfluamathfunctions.divide(x,y) - return x/y + return x/y end function pgfluamathfunctions.div(x,y) - return mathfloor(x/y) + return mathfloor(x/y) end function pgfluamathfunctions.pow(x,y) - -- do not use math.pow -- it is deprecated as of LUA 5.3 - return x^y + -- do not use math.pow -- it is deprecated as of LUA 5.3 + return x^y end function pgfluamathfunctions.factorial(x) -- TODO: x must be an integer - if x == 0 then - return 1 - else - return x * pgfluamathfunctions.factorial(x-1) - end + if x == 0 then + return 1 + else + return x * pgfluamathfunctions.factorial(x-1) + end end function pgfluamathfunctions.ifthenelse(x,y,z) - if x~= 0 then - return y - else - return z - end + if x~= 0 then + return y + else + return z + end end function pgfluamathfunctions.equal(x,y) - if x == y then - return 1 - else - return 0 - end + if x == y then + return 1 + else + return 0 + end end function pgfluamathfunctions.greater(x,y) - if x > y then - return 1 - else - return 0 - end + if x > y then + return 1 + else + return 0 + end end function pgfluamathfunctions.less(x,y) - if x < y then - return 1 - else - return 0 - end + if x < y then + return 1 + else + return 0 + end end function pgfluamathfunctions.min(x,y) - return mathmin(x,y) + return mathmin(x,y) end function pgfluamathfunctions.max(x,y) - return mathmax(x,y) + return mathmax(x,y) end function pgfluamathfunctions.notequal(x,y) - if x ~= y then - return 1 - else - return 0 - end + if x ~= y then + return 1 + else + return 0 + end end function pgfluamathfunctions.notless(x,y) - if x >= y then - return 1 - else - return 0 - end + if x >= y then + return 1 + else + return 0 + end end function pgfluamathfunctions.notgreater(x,y) - if x <= y then - return 1 - else - return 0 - end + if x <= y then + return 1 + else + return 0 + end end function pgfluamathfunctions.andPGF(x,y) - if (x ~= 0) and (y ~= 0) then - return 1 - else - return 0 - end + if (x ~= 0) and (y ~= 0) then + return 1 + else + return 0 + end end function pgfluamathfunctions.orPGF(x,y) - if (x ~= 0) or (y ~= 0) then - return 1 - else - return 0 - end + if (x ~= 0) or (y ~= 0) then + return 1 + else + return 0 + end end function pgfluamathfunctions.notPGF(x) - if x == 0 then - return 1 - else - return 0 - end + if x == 0 then + return 1 + else + return 0 + end end function pgfluamathfunctions.pi() - return mathpi + return mathpi end function pgfluamathfunctions.e() - return mathexp(1) + return mathexp(1) end function pgfluamathfunctions.abs(x) - return mathabs(x) + return mathabs(x) end function pgfluamathfunctions.floor(x) - return mathfloor(x) + return mathfloor(x) end function pgfluamathfunctions.ceil(x) - return mathceil(x) + return mathceil(x) end function pgfluamathfunctions.exp(x) - return mathexp(x) + return mathexp(x) end function pgfluamathfunctions.ln(x) - return mathlog(x) + return mathlog(x) end local logOf10 = mathlog(10) function pgfluamathfunctions.log10(x) - return mathlog(x) / logOf10 + return mathlog(x) / logOf10 end local logOf2 = mathlog(2) function pgfluamathfunctions.log2(x) - return mathlog(x) / logOf2 + return mathlog(x) / logOf2 end function pgfluamathfunctions.sqrt(x) - return mathsqrt(x) + return mathsqrt(x) end function pgfluamathfunctions.sign(x) - if x < 0 then - return -1.0 - elseif x == 0 then - return 0.0 - else - return 1.0 - end + if x < 0 then + return -1.0 + elseif x == 0 then + return 0.0 + else + return 1.0 + end end function pgfluamathfunctions.real(x) - -- "ensure that x contains a decimal point" is kind of a no-op here, isn't it!? - return x + -- "ensure that x contains a decimal point" is kind of a no-op here, isn't it!? + return x end function pgfluamathfunctions.rnd() - return mathrandom() + return mathrandom() end function pgfluamathfunctions.rand() - return -1 + mathrandom() *2 + return -1 + mathrandom() *2 end function pgfluamathfunctions.random(x,y) - if x == nil and y == nil then - return mathrandom() - elseif y == nil then - return mathrandom(x) - else - return mathrandom(x,y) - end + if x == nil and y == nil then + return mathrandom() + elseif y == nil then + return mathrandom(x) + else + return mathrandom(x,y) + end end function pgfluamathfunctions.deg(x) - return mathdeg(x) + return mathdeg(x) end function pgfluamathfunctions.rad(x) - return mathrad(x) + return mathrad(x) end function pgfluamathfunctions.round(x) - if x<0 then - return -mathfloor(mathabs(x)+0.5) - else - return mathfloor(x + 0.5) - end + if x<0 then + return -mathfloor(mathabs(x)+0.5) + else + return mathfloor(x + 0.5) + end end function pgfluamathfunctions.gcd(a, b) - if b == 0 then - return a - else - return pgfluamathfunctions.gcd(b, a%b) - end + if b == 0 then + return a + else + return pgfluamathfunctions.gcd(b, a%b) + end end function pgfluamathfunctions.isprime(a) - local ifisprime = true - if a == 1 then - ifisprime = false - elseif a == 2 then - ifisprime = true --- if a > 2 then - else - local i, imax = 2, mathceil(mathsqrt(a)) + 1 - while ifisprime and (i < imax) do - if pgfluamathfunctions.gcd(a,i) ~= 1 then - ifisprime = false + local ifisprime = true + if a == 1 then + ifisprime = false + elseif a == 2 then + ifisprime = true +-- if a > 2 then + else + local i, imax = 2, mathceil(mathsqrt(a)) + 1 + while ifisprime and (i < imax) do + if pgfluamathfunctions.gcd(a,i) ~= 1 then + ifisprime = false + end + i = i + 1 end - i = i + 1 - end - end - if ifisprime then - return 1 - else - return 0 - end + end + if ifisprime then + return 1 + else + return 0 + end end - + function pgfluamathfunctions.split_braces_to_explist(s) - -- (Thanks to mpg and zappathustra from fctt) - -- Make unpack available whatever lua version is used - -- (unpack in lua 5.1 table.unpack in lua 5.2) - local unpack = table.unpack or unpack - local t = {} - for i in s:gmatch('%b{}') do - table.insert(t, tonumber(i:sub(2, -2))) - end - return unpack(t) + -- (Thanks to mpg and zappathustra from fctt) + -- Make unpack available whatever lua version is used + -- (unpack in lua 5.1 table.unpack in lua 5.2) + local unpack = table.unpack or unpack + local t = {} + for i in s:gmatch('%b{}') do + table.insert(t, tonumber(i:sub(2, -2))) + end + return unpack(t) end function pgfluamathfunctions.split_braces_to_table(s) - local t = {} - for i in s:gmatch('%b{}') do - table.insert(t, tonumber(i:sub(2, -2))) - end - return t + local t = {} + for i in s:gmatch('%b{}') do + table.insert(t, tonumber(i:sub(2, -2))) + end + return t end function pgfluamathfunctions.mathtrue() - return 1.0 + return 1.0 end pgfluamathfunctions.stringToFunctionMap["true"] = pgfluamathfunctions.mathtrue function pgfluamathfunctions.mathfalse() - return 0.0 + return 0.0 end pgfluamathfunctions.stringToFunctionMap["false"] = pgfluamathfunctions.mathfalse function pgfluamathfunctions.frac(a) - -- should be positive, apparently - return mathabs(a - pgfluamathfunctions.int(a)) + -- should be positive, apparently + return mathabs(a - pgfluamathfunctions.int(a)) end function pgfluamathfunctions.int(a) - if a < 0 then - return -mathfloor(mathabs(a)) - else - return mathfloor(a) - end + if a < 0 then + return -mathfloor(mathabs(a)) + else + return mathfloor(a) + end end function pgfluamathfunctions.iseven(a) - if (a % 2) == 0 then - return 1.0 - else - return 0.0 - end + if (a % 2) == 0 then + return 1.0 + else + return 0.0 + end end function pgfluamathfunctions.isodd(a) - if (a % 2) == 0 then - return 0.0 - else - return 1.0 - end + if (a % 2) == 0 then + return 0.0 + else + return 1.0 + end end function pgfluamathfunctions.mod(x,y) - if x/y < 0 then - return -(mathabs(x)%mathabs(y)) - else - return mathabs(x)%mathabs(y) - end + if x/y < 0 then + return -(mathabs(x)%mathabs(y)) + else + return mathabs(x)%mathabs(y) + end end function pgfluamathfunctions.Mod(x,y) - local tmp = pgfluamathfunctions.mod(x,y) - if tmp < 0 then - tmp = tmp + y - end - return tmp + local tmp = pgfluamathfunctions.mod(x,y) + if tmp < 0 then + tmp = tmp + y + end + return tmp end function pgfluamathfunctions.Sin(x) - return mathsin(trigFormatToRadians(x)) + return mathsin(trigFormatToRadians(x)) end pgfluamathfunctions.sin=pgfluamathfunctions.Sin function pgfluamathfunctions.cosh(x) - -- math.cosh is deprecated as of LUA 5.3 . reimplement it: - return 0.5* (mathexp(x) + mathexp(-x)) + -- math.cosh is deprecated as of LUA 5.3 . reimplement it: + return 0.5* (mathexp(x) + mathexp(-x)) end function pgfluamathfunctions.sinh(x) - -- math.sinh is deprecated as of LUA 5.3 . reimplement it: - return 0.5* (mathexp(x) - mathexp(-x)) + -- math.sinh is deprecated as of LUA 5.3 . reimplement it: + return 0.5* (mathexp(x) - mathexp(-x)) end local sinh = pgfluamathfunctions.sinh local cosh = pgfluamathfunctions.cosh function pgfluamathfunctions.tanh(x) - -- math.tanh is deprecated as of LUA 5.3 . reimplement it: - return sinh(x)/cosh(x) + -- math.tanh is deprecated as of LUA 5.3 . reimplement it: + return sinh(x)/cosh(x) end function pgfluamathfunctions.Cos(x) - return mathcos(trigFormatToRadians(x)) + return mathcos(trigFormatToRadians(x)) end pgfluamathfunctions.cos=pgfluamathfunctions.Cos function pgfluamathfunctions.Tan(x) - return mathtan(trigFormatToRadians(x)) + return mathtan(trigFormatToRadians(x)) end pgfluamathfunctions.tan=pgfluamathfunctions.Tan function pgfluamathfunctions.aSin(x) - return radiansToTrigFormat(mathasin(x)) + return radiansToTrigFormat(mathasin(x)) end pgfluamathfunctions.asin=pgfluamathfunctions.aSin function pgfluamathfunctions.aCos(x) - return radiansToTrigFormat(mathacos(x)) + return radiansToTrigFormat(mathacos(x)) end pgfluamathfunctions.acos=pgfluamathfunctions.aCos function pgfluamathfunctions.aTan(x) - return radiansToTrigFormat(mathatan(x)) + return radiansToTrigFormat(mathatan(x)) end pgfluamathfunctions.atan=pgfluamathfunctions.aTan local mathatan2 if math.atan2 == nil then - -- math.atan2 has been deprecated since LUA 5.3 - mathatan2 = function (y,x) return mathatan(y,x) end + -- math.atan2 has been deprecated since LUA 5.3 + mathatan2 = function (y,x) return mathatan(y,x) end else - mathatan2 = math.atan2 + mathatan2 = math.atan2 end function pgfluamathfunctions.aTan2(y,x) - return radiansToTrigFormat(mathatan2(y,x)) + return radiansToTrigFormat(mathatan2(y,x)) end pgfluamathfunctions.atan2=pgfluamathfunctions.aTan2 pgfluamathfunctions.atantwo=pgfluamathfunctions.aTan2 function pgfluamathfunctions.cot(x) - return pgfluamathfunctions.cos(x) / pgfluamathfunctions.sin(x) + return pgfluamathfunctions.cos(x) / pgfluamathfunctions.sin(x) end function pgfluamathfunctions.sec(x) - return 1 / pgfluamathfunctions.cos(x) + return 1 / pgfluamathfunctions.cos(x) end function pgfluamathfunctions.cosec(x) - return 1 / pgfluamathfunctions.sin(x) + return 1 / pgfluamathfunctions.sin(x) end function pgfluamathfunctions.pointnormalised (pgfx, pgfy) - local pgfx_normalised, pgfy_normalised - if pgfx == 0. and pgfy == 0. then - -- Original pgf macro gives this result - tex.dimen['pgf@x'] = "0pt" - tex.dimen['pgf@y'] = "1pt" - else - pgfx_normalised = pgfx/math.sqrt(pgfx^2 + pgfy^2) - pgfx_normalised = pgfx_normalised - pgfx_normalised%0.00001 - pgfy_normalised = pgfy/math.sqrt(pgfx^2 + pgfy^2) - pgfy_normalised = pgfy_normalised - pgfy_normalised%0.00001 - tex.dimen['pgf@x'] = tostring(pgfx_normalised) .. "pt" - tex.dimen['pgf@y'] = tostring(pgfy_normalised) .. "pt" - end - return nil + local pgfx_normalised, pgfy_normalised + if pgfx == 0. and pgfy == 0. then + -- Orginal pgf macro gives this result + tex.dimen['pgf@x'] = "0pt" + tex.dimen['pgf@y'] = "1pt" + else + pgfx_normalised = pgfx/math.sqrt(pgfx^2 + pgfy^2) + pgfx_normalised = pgfx_normalised - pgfx_normalised%0.00001 + pgfy_normalised = pgfy/math.sqrt(pgfx^2 + pgfy^2) + pgfy_normalised = pgfy_normalised - pgfy_normalised%0.00001 + tex.dimen['pgf@x'] = tostring(pgfx_normalised) .. "pt" + tex.dimen['pgf@y'] = tostring(pgfy_normalised) .. "pt" + end + return nil end local isnan = function(x) - return x ~= x + return x ~= x end pgfluamathfunctions.isnan = isnan @@ -509,44 +509,44 @@ local stringsub = string.sub -- like tonumber(x), but it also accepts nan, inf, infty, and the TeX FPU format function pgfluamathfunctions.tonumber(x) - if type(x) == 'number' then return x end - if not x then return x end - - local len = stringlen(x) - local result = globaltonumber(x) - if not result then - if len >2 and stringsub(x,2,2) == 'Y' and stringsub(x,len,len) == ']' then - -- Ah - some TeX FPU input of the form 1Y1.0e3] . OK. transform it - local flag = stringsub(x,1,1) - if flag == '0' then - -- ah, 0.0 - result = 0.0 - elseif flag == '1' then - result = globaltonumber(stringsub(x,3, len-1)) - elseif flag == '2' then - result = globaltonumber("-" .. stringsub(x,3, len-1)) - elseif flag == '3' then - result = nan - elseif flag == '4' then - result = infty - elseif flag == '5' then - result = -infty - end - else - local lower = x:lower() - if lower == 'nan' then - result = nan - elseif lower == "-nan" then - result = nan - elseif lower == 'inf' or lower == 'infty' then - result = infty - elseif lower == '-inf' or lower == '-infty' then - result = -infty - end - end - end - - return result + if type(x) == 'number' then return x end + if not x then return x end + + local len = stringlen(x) + local result = globaltonumber(x) + if not result then + if len >2 and stringsub(x,2,2) == 'Y' and stringsub(x,len,len) == ']' then + -- Ah - some TeX FPU input of the form 1Y1.0e3] . OK. transform it + local flag = stringsub(x,1,1) + if flag == '0' then + -- ah, 0.0 + result = 0.0 + elseif flag == '1' then + result = globaltonumber(stringsub(x,3, len-1)) + elseif flag == '2' then + result = globaltonumber("-" .. stringsub(x,3, len-1)) + elseif flag == '3' then + result = nan + elseif flag == '4' then + result = infty + elseif flag == '5' then + result = -infty + end + else + local lower = x:lower() + if lower == 'nan' then + result = nan + elseif lower == "-nan" then + result = nan + elseif lower == 'inf' or lower == 'infty' then + result = infty + elseif lower == '-inf' or lower == '-infty' then + result = -infty + end + end + end + + return result end local stringlen = string.len @@ -558,69 +558,69 @@ local stringbyte = string.byte local NULL_CHAR = string.byte("0",1) local function discardTrailingZeros(x) - local result = x - -- printf is too stupid: I would like to have - -- 1. a fast method - -- 2. a reliable method - -- 3. full precision of x - -- 4. a fixed point representation - -- the 'f' modifier has trailing zeros (stupid!) - -- the 'g' modified can switch to scientific notation (no-go!) - local periodOff = stringfind(result, '.',1,true) - if periodOff ~= nil then - -- strip trailing zeros - local chars = { stringbyte(result,1,#result) }; - local lastNonZero = #chars - for i = #chars, periodOff, -1 do - if chars[i] ~= NULL_CHAR then lastNonZero=i; break; end - end - if lastNonZero ~= #chars then - -- Ah: we had at least one trailing zero. - -- discard all but the last. - lastNonZero = mathmax(periodOff+1,lastNonZero) - end - result = stringsub(result, 1, lastNonZero) - end - return result; + local result = x + -- printf is too stupid: I would like to have + -- 1. a fast method + -- 2. a reliable method + -- 3. full precision of x + -- 4. a fixed point representation + -- the 'f' modifier has trailing zeros (stupid!) + -- the 'g' modified can switch to scientific notation (no-go!) + local periodOff = stringfind(result, '.',1,true) + if periodOff ~= nil then + -- strip trailing zeros + local chars = { stringbyte(result,1,#result) }; + local lastNonZero = #chars + for i = #chars, periodOff, -1 do + if chars[i] ~= NULL_CHAR then lastNonZero=i; break; end + end + if lastNonZero ~= #chars then + -- Ah: we had at least one trailing zero. + -- discard all but the last. + lastNonZero = mathmax(periodOff+1,lastNonZero) + end + result = stringsub(result, 1, lastNonZero) + end + return result; end local function discardTrailingZerosFromMantissa(x) - local mantissaStart = stringfind(x, "e") + local mantissaStart = stringfind(x, "e") - local mantissa = stringsub(x,1,mantissaStart-1) - local exponent = stringsub(x,mantissaStart) + local mantissa = stringsub(x,1,mantissaStart-1) + local exponent = stringsub(x,mantissaStart) - return discardTrailingZeros(mantissa) .. exponent + return discardTrailingZeros(mantissa) .. exponent end -- a helper function which has no catcode issues when communicating with TeX: function pgfluamathfunctions.tostringfixed(x) - if x == nil then - return "" - end + if x == nil then + return "" + end - return discardTrailingZeros(stringformat("%f", x)) + return discardTrailingZeros(stringformat("%f", x)) end -- converts an input number to a string which is accepted by the TeX FPU function pgfluamathfunctions.toTeXstring(x) - local result = "" - if x ~= nil then - if x == infty then result = "4Y0.0e0]" - elseif x == -infty then result = "5Y0.0e0]" - elseif isnan(x) then result = "3Y0.0e0]" - elseif x == 0 then result = "0Y0.0e0]" - else - result = discardTrailingZerosFromMantissa(stringformat("%.10e", x)) - if x > 0 then - result = "1Y" .. result .. "]" - else - result = "2Y" .. stringsub(result,2) .. "]" - end + local result = "" + if x ~= nil then + if x == infty then result = "4Y0.0e0]" + elseif x == -infty then result = "5Y0.0e0]" + elseif isnan(x) then result = "3Y0.0e0]" + elseif x == 0 then result = "0Y0.0e0]" + else + result = discardTrailingZerosFromMantissa(stringformat("%.10e", x)) + if x > 0 then + result = "1Y" .. result .. "]" + else + result = "2Y" .. stringsub(result,2) .. "]" + end + end end - end - return result + return result end return pgfluamathfunctions diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/luamath/pgf/luamath/parser.lua b/Master/texmf-dist/tex/generic/pgf/libraries/luamath/pgf/luamath/parser.lua index 42b690e6cf8..30eff2e6992 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/luamath/pgf/luamath/parser.lua +++ b/Master/texmf-dist/tex/generic/pgf/libraries/luamath/pgf/luamath/parser.lua @@ -8,7 +8,7 @@ -- -- See the file doc/generic/pgf/licenses/LICENSE for more details. -- --- $Id$ +-- $Id$ -- -- usage: -- @@ -32,22 +32,22 @@ local V = lpeg.V local match = lpeg.match local space_pattern = S(" \n\r\t")^0 -local tex_unit = - P('pt') + P('mm') + P('cm') + P('in') + - -- while valid units, the font-depending ones need special attention... move them to the TeX side. For now. - -- P('ex') + P('em') + - P('bp') + P('pc') + +local tex_unit = + P('pt') + P('mm') + P('cm') + P('in') + + -- while valid units, the font-depending ones need special attention... move them to the TeX side. For now. + -- P('ex') + P('em') + + P('bp') + P('pc') + P('dd') + P('cc') + P('sp'); local one_digit_pattern = R("09") local positive_integer_pattern = one_digit_pattern^1 -- FIXME : it might be a better idea to remove '-' from all number_patterns! Instead, rely on the prefix operator 'neg' to implement negative numbers. -- Is that wise? It is certainly less efficient... -local integer_pattern = S("+-")^-1 * positive_integer_pattern +local integer_pattern = S("+-")^-1 * positive_integer_pattern -- Valid positive decimals are |xxx.xxx|, |.xxx| and |xxx.| -local positive_integer_or_decimal_pattern = positive_integer_pattern * ( P(".") * one_digit_pattern^0)^-1 + - (P(".") * one_digit_pattern^1) -local integer_or_decimal_pattern = S("+-")^-1 * positive_integer_or_decimal_pattern +local positive_integer_or_decimal_pattern = positive_integer_pattern * ( P(".") * one_digit_pattern^0)^-1 + + (P(".") * one_digit_pattern^1) +local integer_or_decimal_pattern = S("+-")^-1 * positive_integer_or_decimal_pattern local fpu_pattern = R"05" * P"Y" * positive_integer_or_decimal_pattern * P"e" * S("+-")^-1 * R("09")^1 * P"]" local unbounded_pattern = P"inf" + P"INF" + P"nan" + P"NaN" + P"Inf" local number_pattern = C(unbounded_pattern + fpu_pattern + integer_or_decimal_pattern * (S"eE" * integer_pattern + C(tex_unit))^-1) @@ -57,7 +57,7 @@ local underscore_pattern = P("_") local letter_pattern = R("az","AZ") local alphanum__pattern = letter_pattern + one_digit_pattern + underscore_pattern -local identifier_pattern = letter_pattern^1 * alphanum__pattern^0 +local identifier_pattern = letter_pattern^1 * alphanum__pattern^0 local openparen_pattern = P("(") * space_pattern local closeparen_pattern = P(")") @@ -94,56 +94,56 @@ local function eval (v1, op, v2) elseif (op == "*") then return v1 * v2 elseif (op == "/") then return v1 / v2 else - error("This function must not be invoked for operator "..op) + error("This function must not be invoked for operator "..op) end end local pgfStringToFunctionMap = pgfluamathfunctions.stringToFunctionMap local function function_eval(name, ... ) - local f = pgfStringToFunctionMap[name] - if not f then - error("Function '" .. name .. "' is undefined (did not find pgfluamathfunctions."..name .." (looked into pgfluamathfunctions.stringToFunctionMap))") - end - -- FIXME: validate signature - return f(...) + local f = pgfStringToFunctionMap[name] + if not f then + error("Function '" .. name .. "' is undefined (did not find pgfluamathfunctions."..name .." (looked into pgfluamathfunctions.stringToFunctionMap))") + end + -- FIXME: validate signature + return f(...) end -local func = - (C(identifier_pattern) * space_pattern * openparen_pattern * Exp * (comma_pattern * Exp)^0 * closeparen_pattern) / function_eval; +local func = + (C(identifier_pattern) * space_pattern * openparen_pattern * Exp * (comma_pattern * Exp)^0 * closeparen_pattern) / function_eval; local functionWithoutArg = identifier_pattern / function_eval -- this is what can occur as exponent after '^'. -- I have the impression that the priorities could be implemented in a better way than this... but it seems to work. -local pow_exponent = - -- allows 2^-4, 2^1e4, 2^2 - -- FIXME : why not 2^1e2 ? - Cg(C(integer_or_decimal_pattern) - -- 2^pi, 2^multiply(2,2) - + Cg(func+functionWithoutArg) - -- 2^(2+2) - + openparen_pattern * Exp * closeparen_pattern ) +local pow_exponent = + -- allows 2^-4, 2^1e4, 2^2 + -- FIXME : why not 2^1e2 ? + Cg(C(integer_or_decimal_pattern) + -- 2^pi, 2^multiply(2,2) + + Cg(func+functionWithoutArg) + -- 2^(2+2) + + openparen_pattern * Exp * closeparen_pattern ) local function prefix_eval(op, x) - if op == "-" then - return pgfluamathfunctions.neg(x) - elseif op == "!" then - return pgfluamathfunctions.notPGF(x) - else - error("This function must not be invoked for operator "..op) - end + if op == "-" then + return pgfluamathfunctions.neg(x) + elseif op == "!" then + return pgfluamathfunctions.notPGF(x) + else + error("This function must not be invoked for operator "..op) + end end local prefix_operator = C( S"-!" ) local prefix_operator_pattern = (prefix_operator * space_pattern * Cg(Prefix) ) / prefix_eval --- apparently, we need to distinguish between <expr> ! and <expr> != <expr2>: +-- apparently, we need to distinghuish between <expr> ! and <expr> != <expr2>: local postfix_operator = C( S"r!" - P"!=" ) + C(P"^") * space_pattern * pow_exponent pgfluamathfunctions.functionMustBeEvaluatedInTeX = function() - error("The function in this context cannot be evaluated by LUA because it depends on TeX macros.") + error("The function in this context cannot be evaluated by LUA because it depends on TeX macros.") end local ternary_eval = pgfluamathfunctions.ifthenelse @@ -156,117 +156,118 @@ local pow_eval = pgfluamathfunctions.pow -- @param op either nil or the postfix operator -- @param arg either nil or the (mandatory) argument for 'op' local function postfix_eval(prefix, op, arg) - local result - if op == nil then - result = prefix - elseif op == "r" then - if arg then error("parser setup error: expected nil argument") end - result = deg(prefix) - elseif op == "!" then - if arg then error("parser setup error: expected nil argument") end - result = factorial_eval(prefix) - elseif op == "^" then - if not arg then error("parser setup error: ^ with its argument") end - result = pow_eval(prefix, arg) - else - error("Parser setup error: " .. tostring(op) .. " unexpected in this context") - end - return result + local result + if op == nil then + result = prefix + elseif op == "r" then + if arg then error("parser setup error: expected nil argument") end + result = deg(prefix) + elseif op == "!" then + if arg then error("parser setup error: expected nil argument") end + result = factorial_eval(prefix) + elseif op == "^" then + if not arg then error("parser setup error: ^ with its argument") end + result = pow_eval(prefix, arg) + else + error("Parser setup error: " .. tostring(op) .. " unexpected in this context") + end + return result end local function equality_eval(v1, op, v2) - local fct - if (op == "==") then fct = pgfluamathfunctions.equal - elseif (op == "!=") then fct = pgfluamathfunctions.notequal - else - error("This function must not be invoked for operator "..op) - end - return fct(v1,v2) + local fct + if (op == "==") then fct = pgfluamathfunctions.equal + elseif (op == "!=") then fct = pgfluamathfunctions.notequal + else + error("This function must not be invoked for operator "..op) + end + return fct(v1,v2) end local function relational_eval(v1, op, v2) - local fct - if (op == "<") then fct = pgfluamathfunctions.less - elseif (op == ">") then fct = pgfluamathfunctions.greater - elseif (op == ">=") then fct = pgfluamathfunctions.notless - elseif (op == "<=") then fct = pgfluamathfunctions.notgreater - else - error("This function must not be invoked for operator "..op) - end - return fct(v1,v2) + local fct + if (op == "<") then fct = pgfluamathfunctions.less + elseif (op == ">") then fct = pgfluamathfunctions.greater + elseif (op == ">=") then fct = pgfluamathfunctions.notless + elseif (op == "<=") then fct = pgfluamathfunctions.notgreater + else + error("This function must not be invoked for operator "..op) + end + return fct(v1,v2) end -- @return either the box property or nil -- @param cs "wd", "ht", or "dp" -- @param intSuffix some integer local function get_tex_box(cs, intSuffix) - -- assume get_tex_box is only called when a dimension is required. - local result - pgfluamathparser.units_declared = true - local box =tex.box[tonumber(intSuffix)] - if not box then error("There is no box " .. intSuffix) end - if cs == "wd" then - result = box.width / 65536 - elseif cs == "ht" then - result = box.height / 65536 - elseif cs == "dp" then - result = box.depth / 65536 - else - result = nil - end - return result + -- assume get_tex_box is only called when a dimension is required. + local result + pgfluamathparser.units_declared = true + local box =tex.box[tonumber(intSuffix)] + if not box then error("There is no box " .. intSuffix) end + if cs == "wd" then + result = box.width / 65536 + elseif cs == "ht" then + result = box.height / 65536 + elseif cs == "dp" then + result = box.depth / 65536 + else + result = nil + end + return result end local function controlsequence_eval(cs, intSuffix) - local result - if intSuffix and #intSuffix >0 then - if cs == "count" then - result= pgfluamathparser.get_tex_count(intSuffix) - elseif cs == "dimen" then - result= pgfluamathparser.get_tex_dimen(intSuffix) - else - result = get_tex_box(cs,intSuffix) - if not result then - -- this can happen - we cannot expand \chardef'ed boxes here. - -- this will be done by the TeX part - error('I do not know/support the TeX register "\\' .. cs .. '"') - end - end - else - result = pgfluamathparser.get_tex_register(cs) - end - return result + local result + if intSuffix and #intSuffix >0 then + if cs == "count" then + result= pgfluamathparser.get_tex_count(intSuffix) + elseif cs == "dimen" then + result= pgfluamathparser.get_tex_dimen(intSuffix) + else + result = get_tex_box(cs,intSuffix) + if not result then + -- this can happen - we cannot expand \chardef'ed boxes here. + -- this will be done by the TeX part + error('I do not know/support the TeX register "\\' .. cs .. '"') + end + end + else + result = pgfluamathparser.get_tex_register(cs) + end + return result end pgfluamathparser.units_declared = false function pgfluamathparser.get_tex_register(register) - -- register is a string which could be a count or a dimen. - if pcall(tex.getcount, register) then - return tex.count[register] - elseif pcall(tex.getdimen, register) then - pgfluamathparser.units_declared = true - return tex.dimen[register] / 65536 -- return in points. - else - error('I do not know the TeX register "' .. register .. '"') - return nil - end + -- register is a string which could be a count or a dimen. + if pcall(tex.getcount, register) then + return tex.count[register] + elseif pcall(tex.getdimen, register) then + pgfluamathparser.units_declared = true + return tex.dimen[register] / 65536 -- return in points. + else + error('I do not know the TeX register "' .. register .. '"') + return nil + end + end function pgfluamathparser.get_tex_count(count) - -- count is expected to be a number - return tex.count[tonumber(count)] + -- count is expected to be a number + return tex.count[tonumber(count)] end function pgfluamathparser.get_tex_dimen(dimen) - -- dimen is expected to be a number - pgfluamathparser.units_declared = true - return tex.dimen[tonumber(dimen)] / 65536 + -- dimen is expected to be a number + pgfluamathparser.units_declared = true + return tex.dimen[tonumber(dimen)] / 65536 end function pgfluamathparser.get_tex_sp(dimension) - -- dimension should be a string - pgfluamathparser.units_declared = true - return tex.sp(dimension) / 65536 + -- dimension should be a string + pgfluamathparser.units_declared = true + return tex.sp(dimension) / 65536 end @@ -281,66 +282,66 @@ local LogicalAnd = V"LogicalAnd" local pgftonumber = pgfluamathfunctions.tonumber local tonumber_withunit = pgfluamathparser.get_tex_sp local function number_optional_units_eval(x, unit) - if not unit then - return pgftonumber(x) - else - return tonumber_withunit(x) - end + if not unit then + return pgftonumber(x) + else + return tonumber_withunit(x) + end end -- @param scale the number. -- @param controlsequence either nil in which case just the number must be returned or a control sequence -- @see controlsequence_eval local function scaled_controlsequence_eval(scale, controlsequence, intSuffix) - if controlsequence==nil then - return scale - else - return scale * controlsequence_eval(controlsequence, intSuffix) - end + if controlsequence==nil then + return scale + else + return scale * controlsequence_eval(controlsequence, intSuffix) + end end -- Grammar -- --- for me: +-- for me: -- - use '/' to evaluate all expressions which contain a _constant_ number of captures. -- - use Cf to evaluate expressions which contain a _dynamic_ number of captures -- -- see unittest_luamathparser.tex for tons of examples local G = P{ "initialRule", - initialRule = space_pattern* Exp * -1; - -- ternary operator (or chained ternary operators): - -- FIXME : is this chaining a good idea!? - Exp = Cf( LogicalOr * Cg(P"?" * space_pattern * LogicalOr * P":" *space_pattern * LogicalOr )^0, ternary_eval) ; - LogicalOr = Cf(LogicalAnd * (P"||" * space_pattern * LogicalAnd)^0, pgfluamathfunctions.orPGF); - LogicalAnd = Cf(Equality * (P"&&" * space_pattern * Equality)^0, pgfluamathfunctions.andPGF); - Equality = Cf(Relational * Cg(EqualityOp * Relational)^0, equality_eval); - Relational = Cf(Summand * Cg(RelationalOp * Summand)^0, relational_eval); - Summand = Cf(Term * Cg(TermOp * Term)^0, eval) ; - Term = Cf(Prefix * Cg(FactorOp * Prefix)^0, eval); - Prefix = prefix_operator_pattern + Postfix; - -- this calls 'postfix_eval' with nil arguments if it is no postfix operation.. but that does not hurt (right?) - Postfix = Factor * (postfix_operator * space_pattern)^-1 / postfix_eval; - Factor = - ( - number_pattern / number_optional_units_eval * - -- this construction will evaluate number_pattern with 'number_optional_units_eval' FIRST. - -- also accept '0.5 \pgf@x' here: - space_pattern *controlsequence_pattern^-1 / scaled_controlsequence_eval - + func - + functionWithoutArg - + openparen_pattern * Exp * closeparen_pattern - + controlsequence_pattern / controlsequence_eval - ) *space_pattern - ; + initialRule = space_pattern* Exp * -1; + -- ternary operator (or chained ternary operators): + -- FIXME : is this chaining a good idea!? + Exp = Cf( LogicalOr * Cg(P"?" * space_pattern * LogicalOr * P":" *space_pattern * LogicalOr )^0, ternary_eval) ; + LogicalOr = Cf(LogicalAnd * (P"||" * space_pattern * LogicalAnd)^0, pgfluamathfunctions.orPGF); + LogicalAnd = Cf(Equality * (P"&&" * space_pattern * Equality)^0, pgfluamathfunctions.andPGF); + Equality = Cf(Relational * Cg(EqualityOp * Relational)^0, equality_eval); + Relational = Cf(Summand * Cg(RelationalOp * Summand)^0, relational_eval); + Summand = Cf(Term * Cg(TermOp * Term)^0, eval) ; + Term = Cf(Prefix * Cg(FactorOp * Prefix)^0, eval); + Prefix = prefix_operator_pattern + Postfix; + -- this calls 'postfix_eval' with nil arguments if it is no postfix operation.. but that does not hurt (right?) + Postfix = Factor * (postfix_operator * space_pattern)^-1 / postfix_eval; + Factor = + ( + number_pattern / number_optional_units_eval * + -- this construction will evaluate number_pattern with 'number_optional_units_eval' FIRST. + -- also accept '0.5 \pgf@x' here: + space_pattern *controlsequence_pattern^-1 / scaled_controlsequence_eval + + func + + functionWithoutArg + + openparen_pattern * Exp * closeparen_pattern + + controlsequence_pattern / controlsequence_eval + ) *space_pattern + ; } -- does not reset units_declared. local function pgfmathparseinternal(str) - local result = match(G,str) - if result == nil then - error("The string '" .. str .. "' is no valid PGF math expression. Please check for syntax errors.") - end - return result + local result = match(G,str) + if result == nil then + error("The string '" .. str .. "' is no valid PGF math expression. Please check for syntax errors.") + end + return result end @@ -348,12 +349,12 @@ end -- -- @param str a string like "1+1" which is accepted by the PGF math language -- @return the result of the expression. --- +-- -- Throws an error if the string is no valid expression. function pgfluamathparser.pgfmathparse(str) - pgfluamathparser.units_declared = false + pgfluamathparser.units_declared = false - return pgfmathparseinternal(str) + return pgfmathparseinternal(str) end local pgfmathparse = pgfluamathparser.pgfmathparse @@ -378,7 +379,7 @@ local stackOfLocalFunctions = {} -- -- ATTENTION: local functions behave DIFFERENTLY in LUA! -- In LUA, local variables are not expanded whereas TeX expands them. --- The difference is +-- The difference is -- -- declare function={mu1(\x,\i)=\x^\i;} -- \pgfmathparse{mu1(-5,2)} --> -25 @@ -392,53 +393,53 @@ local stackOfLocalFunctions = {} -- BUT: that "simulated expansion" broke the second case because LUA will evaluate "x" and hand -5 to the local function. -- I decided to keep it as is. Perhaps we should fix PGF's expansion approach in TeX (which is ugly anyway) function pgfluamathparser.pushLocalExpressionFunction(name, numArgs, expression) - -- now we have "tmpVar1^tmpVar2" instead of "#1^#2" - local normalizedExpr = expression:gsub("#", tmpFunctionArgumentPrefix) - local restores = {} - local tmpVars = {} - for i=1,numArgs do - local tmpVar = tmpFunctionArgumentPrefix .. tostring(i) - tmpVars[i] = tmpVar - end - - local newFunction = function(...) - local args = table.pack(...) - - -- define "tmpVar1" ... "tmpVarN" to return args[i]. - -- Of course, we need to restore "tmpVar<i>" after we return! - for i=1,numArgs do - local tmpVar = tmpVars[i] - local value = args[i] - restores[i] = pgfStringToFunctionMap[tmpVar] - pgfStringToFunctionMap[tmpVar] = function () return value end - end - - -- parse our expression. - - -- FIXME : this here is an attempt to mess around with "units_declared". - -- It would be better to call pgfmathparse and introduce some - -- semaphore to check if pgfmathparse is a nested call-- in this case, it should - -- not reset units_declared. But there is no "finally" block and pcall is crap (looses stack trace). - local success,result = pcall(pgfmathparseinternal, normalizedExpr) - - -- remove 'tmpVar1', ... from the function table: - for i=1,numArgs do - local tmpVar = tmpVars[i] - pgfStringToFunctionMap[tmpVar] = restores[i] - end - - if success==false then error(result) end - return result - end - table.insert(stackOfLocalFunctions, name) - pgfStringToFunctionMap[name] = newFunction + -- now we have "tmpVar1^tmpVar2" instead of "#1^#2" + local normalizedExpr = expression:gsub("#", tmpFunctionArgumentPrefix) + local restores = {} + local tmpVars = {} + for i=1,numArgs do + local tmpVar = tmpFunctionArgumentPrefix .. tostring(i) + tmpVars[i] = tmpVar + end + + local newFunction = function(...) + local args = table.pack(...) + + -- define "tmpVar1" ... "tmpVarN" to return args[i]. + -- Of course, we need to restore "tmpVar<i>" after we return! + for i=1,numArgs do + local tmpVar = tmpVars[i] + local value = args[i] + restores[i] = pgfStringToFunctionMap[tmpVar] + pgfStringToFunctionMap[tmpVar] = function () return value end + end + + -- parse our expression. + + -- FIXME : this here is an attempt to mess around with "units_declared". + -- It would be better to call pgfmathparse and introduce some + -- semaphore to check if pgfmathparse is a nested call-- in this case, it should + -- not reset units_declared. But there is no "finally" block and pcall is crap (looses stack trace). + local success,result = pcall(pgfmathparseinternal, normalizedExpr) + + -- remove 'tmpVar1', ... from the function table: + for i=1,numArgs do + local tmpVar = tmpVars[i] + pgfStringToFunctionMap[tmpVar] = restores[i] + end + + if success==false then error(result) end + return result + end + table.insert(stackOfLocalFunctions, name) + pgfStringToFunctionMap[name] = newFunction end function pgfluamathparser.popLocalExpressionFunction() - local name = stackOfLocalFunctions[#stackOfLocalFunctions] - pgfStringToFunctionMap[name] = nil - -- this removes the last element: - table.remove(stackOfLocalFunctions) + local name = stackOfLocalFunctions[#stackOfLocalFunctions] + pgfStringToFunctionMap[name] = nil + -- this removes the last element: + table.remove(stackOfLocalFunctions) end @@ -446,36 +447,36 @@ end -- @param expression the input expression (string) -- @param outputFormatChoice 0 if the result should be a fixed point number, 1 if it should be in FPU format -- @param showErrorMessage (boolean) true if any error should be displayed, false if errors should simply result in an invocation of TeX's parser (the default) --- +-- -- it defines \pgfmathresult and \ifpgfmathunitsdeclared function pgfluamathparser.texCallParser(expression, outputFormatChoice, showErrorMessage) - local success, result - if showErrorMessage then - result = pgfmathparse(expression) - success = true - else - success, result = pcall(pgfmathparse, expression) - end - - if success and result then - local result_str - if outputFormatChoice == 0 then - -- luamath/output format=fixed - result_str = tostringfixed(result) - else - -- luamath/output format=fixed - result_str = tostringfpu(result) - end - tex.sprint("\\def\\pgfmathresult{" .. result_str .. "}") - if pgfluamathparser.units_declared then - tex.sprint("\\pgfmathunitsdeclaredtrue") - else - tex.sprint("\\pgfmathunitsdeclaredfalse") - end - else - tex.sprint("\\def\\pgfmathresult{}") - tex.sprint("\\pgfmathunitsdeclaredfalse") - end + local success, result + if showErrorMessage then + result = pgfmathparse(expression) + success = true + else + success, result = pcall(pgfmathparse, expression) + end + + if success and result then + local result_str + if outputFormatChoice == 0 then + -- luamath/output format=fixed + result_str = tostringfixed(result) + else + -- luamath/output format=fixed + result_str = tostringfpu(result) + end + tex.sprint("\\def\\pgfmathresult{" .. result_str .. "}") + if pgfluamathparser.units_declared then + tex.sprint("\\pgfmathunitsdeclaredtrue") + else + tex.sprint("\\pgfmathunitsdeclaredfalse") + end + else + tex.sprint("\\def\\pgfmathresult{}") + tex.sprint("\\pgfmathunitsdeclaredfalse") + end end return pgfluamathparser diff --git a/Master/texmf-dist/tex/generic/pgf/libraries/luamath/pgflibraryluamath.code.tex b/Master/texmf-dist/tex/generic/pgf/libraries/luamath/pgflibraryluamath.code.tex index 300ba52e989..c559a0cc1ba 100644 --- a/Master/texmf-dist/tex/generic/pgf/libraries/luamath/pgflibraryluamath.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/libraries/luamath/pgflibraryluamath.code.tex @@ -62,15 +62,15 @@ \pgfutil@ifluatex \let\pgfutil@directlua\directlua \pgfutil@directlua{% - tex.enableprimitives('pgfutil@',{'luaescapestring'})}% + tex.enableprimitives('pgfutil@',{'luaescapestring'})} \else - \def\pgfutil@directlua#1{}% - \def\pgfutil@luaescapestring#1{}% + \def\pgfutil@directlua#1{} + \def\pgfutil@luaescapestring#1{} \fi \pgfutil@directlua{% pgfluamathfunctions = require("pgf.luamath.functions") - pgfluamathparser = require("pgf.luamath.parser")}% + pgfluamathparser = require("pgf.luamath.parser")} % Patch some configuration macros such that the modifications are @@ -78,7 +78,7 @@ \pgfkeys{ /pgf/trig format/deg/.add code={}{\directlua{pgfluamathfunctions.setTrigFormat("deg")}\aftergroup\pgfmath@settrigformat}, /pgf/trig format/rad/.add code={}{\directlua{pgfluamathfunctions.setTrigFormat("rad")}\aftergroup\pgfmath@settrigformat}, -}% +} % ... and reactivate the key: \pgfmathiftrigonometricusesdeg{% \pgfkeys{/pgf/trig format/deg}% diff --git a/Master/texmf-dist/tex/generic/pgf/lua/pgf/manual/DocumentParser.lua b/Master/texmf-dist/tex/generic/pgf/lua/pgf/manual/DocumentParser.lua index d2f6780822c..2f367dfdd4d 100644 --- a/Master/texmf-dist/tex/generic/pgf/lua/pgf/manual/DocumentParser.lua +++ b/Master/texmf-dist/tex/generic/pgf/lua/pgf/manual/DocumentParser.lua @@ -18,7 +18,7 @@ -- @field renderers This array must consist of tables having two -- fields: |test| and |renderer|. The first must be set to a function -- that is called with an information table as parameter and must --- return |true| if the function stored in the |renderer| should be +-- return |true| if the funciton stored in the |renderer| should be -- called. (Typically, the |test| will test whether the ``head line'' -- following a documentation block has a special form.) @@ -46,11 +46,11 @@ local collect_infos, render_infos function DocumentParser.include(filename, typ) local fullname = assert(kpse.find_file(filename:gsub("%.", "/"), typ or "lua") - or kpse.find_file(filename:gsub("%.", "\\"), typ or "lua"), - "file " .. filename .. " not found") + or kpse.find_file(filename:gsub("%.", "\\"), typ or "lua"), + "file " .. filename .. " not found") local file, error = io.open(fullname) - + -- First, let us read the file into a table to make handling easier: local lines = {} @@ -61,33 +61,33 @@ function DocumentParser.include(filename, typ) -- A table storing the current output. The array part contains TeX -- lines, the table part contains information about special table.s local output = {} - + -- Now, start the main parser loop. local i = 1 while i <= #lines do if lines[i]:match("^%-%-%-") then local infos = collect_infos (lines, i) - + infos.filename = filename - + render_infos(infos, output) - + i = infos.last_line end - + i = i + 1 end - + -- Render output: for _,l in ipairs(output) do if type(l) == "string" then - tex.print(l) + tex.print(l) else l() end end - + end @@ -140,7 +140,7 @@ local function process_string(s) if min < math.huge then -- Now, trim 'em all! for i=1,#t do - t[i] = string.sub(t[i],min,-2) + t[i] = string.sub(t[i],min,-2) end end return t @@ -156,7 +156,7 @@ local function process_examples(t) if type(t) == "string" then t = {t} end - + local n = {} for i=1,#t do n[i] = process_string(strip_quotes(t[i])) @@ -176,7 +176,7 @@ DocumentParser.addRenderer ( return infos.keywords["function"] or infos.head_line:match("^%s*function%s+") or - infos.head_line:match("^%s*local%s+function%s+") + infos.head_line:match("^%s*local%s+function%s+") end, function (infos, output) -- The renderer @@ -185,43 +185,43 @@ DocumentParser.addRenderer ( local k = infos.keywords["function"][1] infos.head_line = k:match("^%s*@(.*)") end - + local rest = infos.head_line:match("function%s+(.*)") local tab = rest:match("([^(]*[%.%:]).*") local fun = rest:match("[^(]*[%.%:](.-)%s*%(") or rest:match("(.-)%s*%(") local pars = rest:match(".-%((.*)%)") - + -- Render the head print_on_output_escape(output, [[\begin{luacommand}]]) output[#output+1] = "{" .. (tab or "") .. fun .. "}" - print_on_output_escape(output, - "{", tab or "", "}", - "{", fun, "}", - "{", pars, "}") + print_on_output_escape(output, + "{", tab or "", "}", + "{", fun, "}", + "{", pars, "}") if tab then local table_name = tab:sub(1,-2) local t = output[table_name] or {} t[#t+1] = { - link = "pgf/lua/" .. tab .. fun, - text = "function " .. tab .. "\\declare{" .. fun .. "} (" .. pars .. ")" + link = "pgf/lua/" .. tab .. fun, + text = "function " .. tab .. "\\declare{" .. fun .. "} (" .. pars .. ")" } output[table_name] = t end - + local mode = "text" for _,l in ipairs(infos.doc_lines) do if mode ~= "done" then - mode = print_docline_on_output(output, l, mode) + mode = print_docline_on_output(output, l, mode) end end close_mode(output, mode) print_on_output(output, [[\end{luacommand}]]) - + end ) - + -- The table renderer DocumentParser.addRenderer ( @@ -238,43 +238,43 @@ DocumentParser.addRenderer ( local k = infos.keywords["table"][1] infos.head_line = k:match("^%s*@table(.*)") .. "=" end - + local name = infos.head_line:match("^%s*local%s+(.-)%s*=") or - infos.head_line:match("^%s*(.*)%s*=") - + infos.head_line:match("^%s*(.*)%s*=") + -- Render the head print_on_output_escape(output, - [[\begin{luatable}]], - "{", name:match("(.*[%.%:]).*") or "", "}", - "{", name:match(".*[%.%:](*-)") or name,"}", - "{", infos.filename, "}") + [[\begin{luatable}]], + "{", name:match("(.*[%.%:]).*") or "", "}", + "{", name:match(".*[%.%:](*-)") or name,"}", + "{", infos.filename, "}") local mode = "text" for _,l in ipairs(infos.doc_lines) do mode = print_docline_on_output(output, l, mode) end close_mode(output, mode) - + output[#output+1] = function () - if output[name] then - tex.print("\\par\\emph{Alphabetical method summary:}\\par{\\small") - table.sort(output[name], function (a,b) return a.text < b.text end) - for _,l in ipairs(output[name]) do - tex.print("\\texttt{\\hyperlink{" .. l.link .. "}{" .. l.text:gsub("_", "\\_") .. "}}\\par") - end - tex.print("}") - end + if output[name] then + tex.print("\\par\\emph{Alphabetical method summary:}\\par{\\small") + table.sort(output[name], function (a,b) return a.text < b.text end) + for _,l in ipairs(output[name]) do + tex.print("\\texttt{\\hyperlink{" .. l.link .. "}{" .. l.text:gsub("_", "\\_") .. "}}\\par") + end + tex.print("}") + end end - + print_on_output(output, [[\end{luatable}]]) - + end ) + - - + -- The library renderer DocumentParser.addRenderer ( function (infos) @@ -283,9 +283,9 @@ DocumentParser.addRenderer ( end, function (infos, output) -- The renderer - + local name = infos.filename:gsub("%.library$",""):gsub("^pgf%.gd%.","") - + -- Render the head print_on_output_escape(output, "\\begin{lualibrary}{", name, "}") @@ -294,13 +294,13 @@ DocumentParser.addRenderer ( mode = print_docline_on_output(output, l, mode) end close_mode(output, mode) - + print_on_output(output, "\\end{lualibrary}") - + end ) - + -- The section renderer DocumentParser.addRenderer ( function (infos) @@ -317,7 +317,7 @@ DocumentParser.addRenderer ( end ) - + -- The documentation (plain text) renderer DocumentParser.addRenderer ( function (infos) @@ -342,19 +342,19 @@ DocumentParser.addRenderer ( return infos.keywords["declare"] or infos.head_line:match("declare%s*{") or - infos.head_line:match("^%s*key%s*") + infos.head_line:match("^%s*key%s*") end, function (infos, output) -- The renderer local key_name - + if infos.keywords["declare"] then local k = infos.keywords["declare"][1] key_name = k:match("^%s*@declare%s*(.*)") elseif infos.head_line:match("^%s*key%s*") then key_name = infos.head_line:match('^%s*key%s*"(.*)"') or - infos.head_line:match("^%s*key%s*'(.*)'") + infos.head_line:match("^%s*key%s*'(.*)'") else local l = infos.lines [infos.last_line + 1] key_name = l:match('key%s*=%s*"(.*)"') or l:match("key%s*=%s*'(.*)'") @@ -362,48 +362,48 @@ DocumentParser.addRenderer ( assert (key_name, "could not determine key") local key = assert (keys[key_name], "unknown key '" .. key_name .. "'") - + -- Render the head if key.type then print_on_output_escape(output, - "\\begin{luadeclare}", - "{", key.key, "}", - "{\\meta{", key.type, "}}", - "{", key.default or "", "}", - "{", key.initial or "", "}") + "\\begin{luadeclare}", + "{", key.key, "}", + "{\\meta{", key.type, "}}", + "{", key.default or "", "}", + "{", key.initial or "", "}") else print_on_output_escape(output, - "\\begin{luadeclarestyle}", - "{", key.key, "}", - "{}", - "{", key.default or "", "}", - "{", key.initial or "", "}") - end - - + "\\begin{luadeclarestyle}", + "{", key.key, "}", + "{}", + "{", key.default or "", "}", + "{", key.initial or "", "}") + end + + local mode = "text" - + print_lines_on_output(output, process_string(strip_quotes(key.summary))) print_lines_on_output(output, process_string(strip_quotes(key.documentation))) if key.examples then local e = process_examples(key.examples) print_on_output(output, - "\\par\\smallskip\\emph{Example" .. (((#e>1) and "s") or "") .. "}\\par") + "\\par\\smallskip\\emph{Example" .. (((#e>1) and "s") or "") .. "}\\par") for _,example in ipairs(e) do - print_on_output(output, "\\begin{codeexample}[]") - print_lines_on_output(output, example) - print_on_output(output, "\\end{codeexample}") + print_on_output(output, "\\begin{codeexample}[]") + print_lines_on_output(output, example) + print_on_output(output, "\\end{codeexample}") end end - - print_on_output(output, key.type and "\\end{luadeclare}" or "\\end{luadeclarestyle}") + + print_on_output(output, key.type and "\\end{luadeclare}" or "\\end{luadeclarestyle}") end ) --- The empty line +-- The empty line DocumentParser.addRenderer ( function (infos) -- The test @@ -421,8 +421,8 @@ function print_lines_on_output(output, lines) output[#output+1] = l end end - -function print_on_output(output, ...) + +function print_on_output(output, ...) local args = {...} if #args > 0 then for i = 1, #args do @@ -432,7 +432,7 @@ function print_on_output(output, ...) end end -function print_on_output_escape(output, ...) +function print_on_output_escape(output, ...) local args = {...} if #args > 0 then for i = 1, #args do @@ -453,9 +453,9 @@ function print_docline_on_output(output, l, mode) mode = open_mode (output, "param") end print_on_output(output, "\\item[\\texttt{", - l:match("%s@param%s+(.-)%s"):gsub("_", "\\_"), - "}] ", - l:match("%s@param%s+.-%s+(.*)")) + l:match("%s@param%s+(.-)%s"):gsub("_", "\\_"), + "}] ", + l:match("%s@param%s+.-%s+(.*)")) elseif l:match("^%s*@return%s+") then if mode ~= "return" then close_mode (output, mode) @@ -468,26 +468,26 @@ function print_docline_on_output(output, l, mode) mode = open_mode (output, "text") end print_on_output(output, "\\par\\emph{See also:} \\texttt{", - l:match("%s@see%s+(.*)"):gsub("_", "\\_"), - "}") + l:match("%s@see%s+(.*)"):gsub("_", "\\_"), + "}") elseif l:match("^%s*@usage%s+") then if mode ~= "text" then close_mode (output, mode) mode = open_mode (output, "text") end print_on_output(output, "\\par\\emph{Usage:} ", - l:match("%s@usage%s+(.*)")) + l:match("%s@usage%s+(.*)")) elseif l:match("^%s*@field+") then close_mode (output, mode) mode = open_mode (output, "field") print_on_output(output, "{", - (l:match("%s@field%s+(.-)%s") or l:match("%s@field%s+(.*)")):gsub("_", "\\_"), - "}", - l:match("%s@field%s+.-%s+(.*)")) + (l:match("%s@field%s+(.-)%s") or l:match("%s@field%s+(.*)")):gsub("_", "\\_"), + "}", + l:match("%s@field%s+.-%s+(.*)")) elseif l:match("^%s*@done") or l:match("^%s*@text") then close_mode(output, mode) print_on_output(output, l) - + mode = "text" elseif l:match("^%s*@library") then -- do nothing @@ -501,8 +501,8 @@ function print_docline_on_output(output, l, mode) else print_on_output(output, l) end - - return mode + + return mode end function open_mode (output, mode) @@ -529,7 +529,7 @@ end function collect_infos (lines, i, state) - + local doc_lines = {} local keywords = {} @@ -543,13 +543,13 @@ function collect_infos (lines, i, state) end return line end - + -- Copy triple matches: while lines[i] and lines[i]:match("^%-%-%-") do doc_lines [#doc_lines + 1] = find_keywords(lines[i]:sub(4)) i = i + 1 end - + -- Continue with double matches: while lines[i] and lines[i]:match("^%-%-") do doc_lines [#doc_lines + 1] = find_keywords(lines[i]:sub(3)) @@ -557,7 +557,7 @@ function collect_infos (lines, i, state) end local head_line = "" - + if not keywords["end"] then -- Skip empty lines while lines[i] and lines[i]:match("^%s*$") do @@ -568,7 +568,7 @@ function collect_infos (lines, i, state) i = i - 1 end end - + return { lines = lines, last_line = i, @@ -576,7 +576,7 @@ function collect_infos (lines, i, state) keywords = keywords, head_line = head_line } - + end @@ -589,9 +589,9 @@ function render_infos(infos, state) return end end - + pgf.debug(infos) - error("Unknown documentation type") + error("Unkown documentation type") end diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex index fb629421d54..fd3eea1b0bf 100644 --- a/Master/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmath.code.tex @@ -23,4 +23,4 @@ \input pgfmathcalc.code.tex \input pgfmathfloat.code.tex -\endinput +\endinput
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex index 58c51558c8a..5cc58e62e5d 100644 --- a/Master/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathcalc.code.tex @@ -40,7 +40,7 @@ \pgfmath@selectfont% #1#2\unskip% \expandafter\endgroup% - \expandafter#1\the#1\relax% + \expandafter#1\the#1\relax% }% {% \pgfmathparse{#2}% @@ -68,7 +68,7 @@ \advance#1#2\unskip% \expandafter% \endgroup% - \expandafter#1\the#1\relax% + \expandafter#1\the#1\relax% }% {% \pgfmathparse{#2}% @@ -202,7 +202,7 @@ \def\pgfmathsetmacro#1#2{% \begingroup% \pgfmathparse{#2}% - \let#1=\pgfmathresult + \let#1=\pgfmathresult \pgfmath@smuggleone{#1}% \endgroup% } @@ -264,7 +264,7 @@ % *** The following commands DO NOT WORK without the rest of PGF *** % % (a dumping ground for stuff that doesn't really belong anywhere else) - + % \pgfmathanglebetweenpoints % % Define \pgfmathresult as the angle between points #1 and #2 @@ -354,7 +354,7 @@ -% \pgfmathpointintersectionoflineandarc +% \pgfmathpointintersectionoflineandarc % % A bit experimental at the moment: % @@ -385,10 +385,10 @@ \pgf@polar@#6 and #6\@@% \fi% \edef\xarcradius{\the\pgf@x}% - \edef\yarcradius{\the\pgf@y}% + \edef\yarcradius{\the\pgf@y}% % % Get the start and end angles of the arc... - % + % \pgfmathsetmacro\s{#4}% \pgfmathsetmacro\e{#5}% % @@ -420,7 +420,7 @@ \pgfmathadd@{\s}{\e}% \pgfmathdivide@{\pgfmathresult}{2}% \let\p\pgfmathresult% - \ifdim\p pt=\s pt\relax% + \ifdim\p pt=\s pt\relax% \else% \pgfmathanglebetweenpoints{#2}{% \pgfpointadd{#3}{% @@ -466,14 +466,14 @@ \ifdim\pgfmathresult pt<\m pt\relax% \let\m\pgfmathresult% \let\n\p% - \fi% + \fi% \repeatpgfmathloop% \pgfpointadd{#3}{\pgfpointpolar{\n}{\xarcradius and \yarcradius}}% }% } % \pgfmathangleonellipse -% +% % Find the angle corresponding to a point on the border of an ellispe. % % #1 - the point on the border. @@ -489,7 +489,7 @@ \fi% \pgf@xa\pgf@x% \pgf@ya\pgf@y% - \pgf@process{#1}% + \pgf@process{#1}% \ifdim\pgf@x=0pt\relax% \pgfutil@tempdima1pt\relax% \else% @@ -530,7 +530,7 @@ \ifdim\pgf@y=0pt\relax% \pgfutil@tempdima0pt\relax% \fi% - \fi% + \fi% \fi% \pgfmath@returnone\pgfutil@tempdima% \endgroup% diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex index bda29cb51b7..006d6ea4046 100644 --- a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfloat.code.tex @@ -13,23 +13,23 @@ \pgfkeys{ - % The bug 3430171 (wrong minus sign spacing in pgfmathprintnumber) - % has been fixed in 2.10 CVS. Since it changes the spacing, its - % effects can be undone with this compatibility switch. - /pgf/compat/number printer/.is choice, - /pgf/compat/number printer/2.10/.code={% - \def\pgfmathprintnumber@begingroup{\bgroup}% - \def\pgfmathprintnumber@endgroup{\egroup}% - }, - % I do not know the version number of the next release at this - % time. Please be so kind and KEEP THIS NAME INTACT. Add an alias - % if needed. - /pgf/compat/number printer/next after 2.10/.code={% - \def\pgfmathprintnumber@begingroup{\begingroup}% - \def\pgfmathprintnumber@endgroup{\endgroup}% - }, - % activate the fix by default. - /pgf/compat/number printer/next after 2.10,% + % The bug 3430171 (wrong minus sign spacing in pgfmathprintnumber) + % has been fixed in 2.10 CVS. Since it changes the spacing, its + % effects can be undone with this compatibility switch. + /pgf/compat/number printer/.is choice, + /pgf/compat/number printer/2.10/.code={% + \def\pgfmathprintnumber@begingroup{\bgroup}% + \def\pgfmathprintnumber@endgroup{\egroup}% + }, + % I do not know the version number of the next release at this + % time. Please be so kind and KEEP THIS NAME INTACT. Add an alias + % if needed. + /pgf/compat/number printer/next after 2.10/.code={% + \def\pgfmathprintnumber@begingroup{\begingroup}% + \def\pgfmathprintnumber@endgroup{\endgroup}% + }, + % activate the fix by default. + /pgf/compat/number printer/next after 2.10,% } @@ -55,7 +55,7 @@ % can be changed with options. \def\pgfmathfloat@round@precision{2} -% I introduced this to access the "original" precision in case a +% I introduced this to acces the "original" precision in case a % formatted changes it locally... in this case, the formatter may % overwrite \pgfmathfloat@round@precision@orig to provide the original % one. @@ -70,7 +70,7 @@ % [FLAGS] MANTISSE EXPONENT % meaning % [+-]X.XXXXXXX*10^C -% where +% where % X.XXXXXX is a mantissa with first number != 0, C is an integer and % FLAGS contains the sign and some other special cases. % @@ -78,7 +78,7 @@ % computation is COMPLETELY STRING BASED. % This allows numbers such at 10000000 or 5.23e-10 to be represented % properly, although TeX-registers would produce overflow/underflow -% errors in these cases. +% errors in these cases. % % It is to be used to compute logs, because log(X*10^Y) = log(X) + log(10)*Y % @@ -98,12 +98,12 @@ % FLAGS MANTISSE 'e' EXPONENT % where % FLAGS is a number in [0-5] where -% 0 == '0' (the number is +- 0.0), -% 1 == '+', -% 2 == '-', -% 3 == 'not a number' -% 4 == '+ infinity' -% 5 == '- infinity' +% 0 == '0' (the number is +- 0.0), +% 1 == '+', +% 2 == '-', +% 3 == 'not a number' +% 4 == '+ infinity' +% 5 == '- infinity' % % MANTISSE is a normalised number 1 <= M < 10. It always contains a % period and at least one digit after the period. @@ -116,15 +116,15 @@ % \pgfmathfloatparsenumber{141.212} % -> \pgfmathresult = 11.41212e2 \def\pgfmathfloatparsenumber#1{% - \begingroup - \edef\pgfmathresult{#1}% - \expandafter\pgfflt@impl\pgfmathresult\pgfflt@EOI - \ifpgfmathfloatparsenumberpendingperiod - \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.0}% - \fi - \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% - \pgfmath@smuggleone\pgfmathresult - \endgroup + \begingroup + \edef\pgfmathresult{#1}% + \expandafter\pgfflt@impl\pgfmathresult\pgfflt@EOI + \ifpgfmathfloatparsenumberpendingperiod + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.0}% + \fi + \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% + \pgfmath@smuggleone\pgfmathresult + \endgroup } % The same as \pgfmathfloatparsenumber, but does not perform sanity checking. @@ -135,36 +135,36 @@ % register #2, mantissa to dimen register #3 and exponent to count % register #4. \def\pgfmathfloattoregisters#1#2#3#4{% - \expandafter\pgfmathfloat@decompose#1\relax{#2}{#3}{#4}% + \expandafter\pgfmathfloat@decompose#1\relax{#2}{#3}{#4}% } % the same, but writes the mantissa into a token register. \def\pgfmathfloattoregisterstok#1#2#3#4{% - \expandafter\pgfmathfloat@decompose@tok#1\relax{#2}{#3}{#4}% + \expandafter\pgfmathfloat@decompose@tok#1\relax{#2}{#3}{#4}% } % Extracts the flags of #1 into the count register #2. \def\pgfmathfloatgetflags#1#2{% - \expandafter\pgfmathfloat@decompose@F#1\relax{#2}% + \expandafter\pgfmathfloat@decompose@F#1\relax{#2}% } % Extracts the flags of #1 into the macro #2. \def\pgfmathfloatgetflagstomacro#1#2{% - \expandafter\pgfmathfloat@decompose@Fmacro#1\relax{#2}% + \expandafter\pgfmathfloat@decompose@Fmacro#1\relax{#2}% }% % Extracts the mantissa of #1 into the dimen register #2. \def\pgfmathfloatgetmantissa#1#2{% - \expandafter\pgfmathfloat@decompose@M#1\relax{#2}% + \expandafter\pgfmathfloat@decompose@M#1\relax{#2}% } \let\pgfmathfloatgetmantisse=\pgfmathfloatgetmantissa % Extracts the mantissa of #1 into the token register #2. \def\pgfmathfloatgetmantissatok#1#2{% - \expandafter\pgfmathfloat@decompose@Mtok#1\relax{#2}% + \expandafter\pgfmathfloat@decompose@Mtok#1\relax{#2}% } \let\pgfmathfloatgetmantissetok=\pgfmathfloatgetmantissatok % Extracts the exponent of #1 into the count register #2. \def\pgfmathfloatgetexponent#1#2{% - \expandafter\pgfmathfloat@decompose@E#1\relax{#2}% + \expandafter\pgfmathfloat@decompose@E#1\relax{#2}% } @@ -179,22 +179,22 @@ % format. \def\pgfmathfloat@to@FMeE@style#1{\expandafter\pgfmathfloat@to@FMeE@style@#1\relax\relax}% \def\pgfmathfloat@to@FMeE@style@#1#2{% - \ifx#2Y% - \expandafter\pgfmathfloat@to@FMeE@style@@% - \else - \expandafter\pgfmathfloat@to@FMeE@style@error% - \fi - #1#2% + \ifx#2Y% + \expandafter\pgfmathfloat@to@FMeE@style@@% + \else + \expandafter\pgfmathfloat@to@FMeE@style@error% + \fi + #1#2% }% \def\pgfmathfloat@to@FMeE@style@@#1Y#2e#3]\relax\relax{\def\pgfmathresult{#1#2e#3}}% \def\pgfmathfloat@to@FMeE@style@error#1\relax\relax{% - \begingroup - \pgfmathfloatparsenumber@handleerror{wrong lowlevel format}{#1}{#1}% - \xdef\pgfmathfloat@decompose@TMP{% - \noexpand\pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% - }% - \endgroup - \pgfmathfloat@decompose@TMP + \begingroup + \pgfmathfloatparsenumber@handleerror{wrong lowlevel format}{#1}{#1}% + \xdef\pgfmathfloat@decompose@TMP{% + \noexpand\pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% + }% + \endgroup + \pgfmathfloat@decompose@TMP }% @@ -208,12 +208,12 @@ % \expandafter\pgfmathfloat@decompose\pgfmathresult\relax\pgfmathfloat@a@S\pgfmathfloat@a@M\pgfmathfloat@a@E % -> the three temp registers contain flags, mantissa and exponent \def\pgfmathfloat@decompose#1#2{% sanitize! - \ifx#2Y% - \expandafter\pgfmathfloat@decompose@% - \else - \expandafter\pgfmathfloat@decompose@error% - \fi - #1#2% + \ifx#2Y% + \expandafter\pgfmathfloat@decompose@% + \else + \expandafter\pgfmathfloat@decompose@error% + \fi + #1#2% } \def\pgfmathfloat@decompose@#1Y#2e#3]\relax#4#5#6{% #4=#1\relax @@ -227,12 +227,12 @@ % \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E % -> the three temp registers contain flags, mantissa and exponent \def\pgfmathfloat@decompose@tok#1#2{% - \ifx#2Y% - \expandafter\pgfmathfloat@decompose@tok@% - \else - \expandafter\pgfmathfloat@decompose@tok@error% - \fi - #1#2% + \ifx#2Y% + \expandafter\pgfmathfloat@decompose@tok@% + \else + \expandafter\pgfmathfloat@decompose@tok@error% + \fi + #1#2% }% \def\pgfmathfloat@decompose@tok@#1Y#2e#3]\relax#4#5#6{% #4=#1\relax @@ -243,44 +243,44 @@ % \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@a@S % -> \pgfmathfloat@a@S contains the flags field. \def\pgfmathfloat@decompose@F#1#2{% - \ifx#2Y% - \expandafter\pgfmathfloat@decompose@F@% - \else - \expandafter\pgfmathfloat@decompose@F@error% - \fi - #1#2% + \ifx#2Y% + \expandafter\pgfmathfloat@decompose@F@% + \else + \expandafter\pgfmathfloat@decompose@F@error% + \fi + #1#2% }% \def\pgfmathfloat@decompose@Fmacro#1#2{% - \ifx#2Y% - \expandafter\pgfmathfloat@decompose@Fmacro@% - \else - \expandafter\pgfmathfloat@decompose@F@error% - \fi - #1#2% + \ifx#2Y% + \expandafter\pgfmathfloat@decompose@Fmacro@% + \else + \expandafter\pgfmathfloat@decompose@F@error% + \fi + #1#2% }% \def\pgfmathfloat@decompose@M#1#2{% - \ifx#2Y% - \expandafter\pgfmathfloat@decompose@M@% - \else - \expandafter\pgfmathfloat@decompose@M@error% - \fi - #1#2% + \ifx#2Y% + \expandafter\pgfmathfloat@decompose@M@% + \else + \expandafter\pgfmathfloat@decompose@M@error% + \fi + #1#2% }% \def\pgfmathfloat@decompose@E#1#2{% - \ifx#2Y% - \expandafter\pgfmathfloat@decompose@E@% - \else - \expandafter\pgfmathfloat@decompose@E@error% - \fi - #1#2% + \ifx#2Y% + \expandafter\pgfmathfloat@decompose@E@% + \else + \expandafter\pgfmathfloat@decompose@E@error% + \fi + #1#2% }% \def\pgfmathfloat@decompose@Mtok#1#2{% - \ifx#2Y% - \expandafter\pgfmathfloat@decompose@Mtok@% - \else - \expandafter\pgfmathfloat@decompose@Mtok@error% - \fi - #1#2% + \ifx#2Y% + \expandafter\pgfmathfloat@decompose@Mtok@% + \else + \expandafter\pgfmathfloat@decompose@Mtok@error% + \fi + #1#2% }% \def\pgfmathfloat@decompose@F@#1Y#2e#3]\relax#4{#4=#1\relax}% \def\pgfmathfloat@decompose@Fmacro@#1Y#2e#3]\relax#4{\def#4{#1}}% @@ -289,67 +289,67 @@ \def\pgfmathfloat@decompose@E@#1Y#2e#3]\relax#4{#4=#3\relax}% \def\pgfmathfloat@decompose@error#1\relax#2#3#4{% - \begingroup - \pgfmathfloatparsenumber@handleerror{wrong lowlevel format}{#1}{#1}% - \xdef\pgfmathfloat@decompose@TMP{% - \noexpand#2=\the\pgfmathfloat@a@S\space - \noexpand#3=\the\pgfmathfloat@a@Mtok pt - \noexpand#4=\the\pgfmathfloat@a@E\space - }% - \endgroup - \pgfmathfloat@decompose@TMP + \begingroup + \pgfmathfloatparsenumber@handleerror{wrong lowlevel format}{#1}{#1}% + \xdef\pgfmathfloat@decompose@TMP{% + \noexpand#2=\the\pgfmathfloat@a@S\space + \noexpand#3=\the\pgfmathfloat@a@Mtok pt + \noexpand#4=\the\pgfmathfloat@a@E\space + }% + \endgroup + \pgfmathfloat@decompose@TMP }% \def\pgfmathfloat@decompose@tok@error#1\relax#2#3#4{% - \begingroup - \pgfmathfloatparsenumber@handleerror{wrong lowlevel format}{#1}{#1}% - \xdef\pgfmathfloat@decompose@TMP{% - \noexpand#2=\the\pgfmathfloat@a@S\space - \noexpand#3={\the\pgfmathfloat@a@Mtok}% - \noexpand#4=\the\pgfmathfloat@a@E\space - }% - \endgroup - \pgfmathfloat@decompose@TMP + \begingroup + \pgfmathfloatparsenumber@handleerror{wrong lowlevel format}{#1}{#1}% + \xdef\pgfmathfloat@decompose@TMP{% + \noexpand#2=\the\pgfmathfloat@a@S\space + \noexpand#3={\the\pgfmathfloat@a@Mtok}% + \noexpand#4=\the\pgfmathfloat@a@E\space + }% + \endgroup + \pgfmathfloat@decompose@TMP }% \def\pgfmathfloat@decompose@F@error#1\relax#2{% - \begingroup - \pgfmathfloatparsenumber@handleerror{wrong lowlevel format}{#1}{#1}% - \xdef\pgfmathfloat@decompose@TMP{\noexpand#2=\the\pgfmathfloat@a@S\space}% - \endgroup - \pgfmathfloat@decompose@TMP + \begingroup + \pgfmathfloatparsenumber@handleerror{wrong lowlevel format}{#1}{#1}% + \xdef\pgfmathfloat@decompose@TMP{\noexpand#2=\the\pgfmathfloat@a@S\space}% + \endgroup + \pgfmathfloat@decompose@TMP }% \def\pgfmathfloat@decompose@M@error#1\relax#2{% - \begingroup - \pgfmathfloatparsenumber@handleerror{wrong lowlevel format}{#1}{#1}% - \xdef\pgfmathfloat@decompose@TMP{\noexpand#2=\the\pgfmathfloat@a@Mtok pt }% - \endgroup - \pgfmathfloat@decompose@TMP + \begingroup + \pgfmathfloatparsenumber@handleerror{wrong lowlevel format}{#1}{#1}% + \xdef\pgfmathfloat@decompose@TMP{\noexpand#2=\the\pgfmathfloat@a@Mtok pt }% + \endgroup + \pgfmathfloat@decompose@TMP }% \def\pgfmathfloat@decompose@Mtok@error#1\relax#2{% - \begingroup - \pgfmathfloatparsenumber@handleerror{wrong lowlevel format}{#1}{#1}% - \xdef\pgfmathfloat@decompose@TMP{\noexpand#2={\the\pgfmathfloat@a@Mtok}}% - \endgroup - \pgfmathfloat@decompose@TMP + \begingroup + \pgfmathfloatparsenumber@handleerror{wrong lowlevel format}{#1}{#1}% + \xdef\pgfmathfloat@decompose@TMP{\noexpand#2={\the\pgfmathfloat@a@Mtok}}% + \endgroup + \pgfmathfloat@decompose@TMP }% \def\pgfmathfloat@decompose@E@error#1\relax#2{% - \begingroup - \pgfmathfloatparsenumber@handleerror{wrong lowlevel format}{#1}{#1}% - \xdef\pgfmathfloat@decompose@TMP{\noexpand#2=\the\pgfmathfloat@a@E\space}% - \endgroup - \pgfmathfloat@decompose@TMP + \begingroup + \pgfmathfloatparsenumber@handleerror{wrong lowlevel format}{#1}{#1}% + \xdef\pgfmathfloat@decompose@TMP{\noexpand#2=\the\pgfmathfloat@a@E\space}% + \endgroup + \pgfmathfloat@decompose@TMP }% % Takes a floating point number #1 as input and writes flags to macro % #2, mantissa to macro #3 and exponent to macro #4. \def\pgfmathfloattomacro#1#2#3#4{% - \begingroup - \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E - \xdef\pgfmathfloat@glob@TMP{% - \noexpand\def\noexpand#2{\the\pgfmathfloat@a@S}% - \noexpand\def\noexpand#3{\the\pgfmathfloat@a@Mtok}% - \noexpand\def\noexpand#4{\the\pgfmathfloat@a@E}% - }% - \endgroup - \pgfmathfloat@glob@TMP + \begingroup + \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \xdef\pgfmathfloat@glob@TMP{% + \noexpand\def\noexpand#2{\the\pgfmathfloat@a@S}% + \noexpand\def\noexpand#3{\the\pgfmathfloat@a@Mtok}% + \noexpand\def\noexpand#4{\the\pgfmathfloat@a@E}% + }% + \endgroup + \pgfmathfloat@glob@TMP } @@ -358,7 +358,7 @@ % % All arguments are characters and will be expanded using '\edef'. \def\pgfmathfloatcreate#1#2#3{% - \edef\pgfmathresult{#1Y#2e#3]}% + \edef\pgfmathresult{#1Y#2e#3]}% }% % This is the character present in any low-level floating point % number. It is assumed to be the SECOND character of a float (after @@ -373,54 +373,54 @@ % \pgfmathfloattofixed{142e1} % -> \pgfmathresult = 42.0 \def\pgfmathfloattofixed@#1{% - \begingroup - \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E - \ifcase\pgfmathfloat@a@S - \def\pgfmathresult{0.0}% - \or - \expandafter\pgfmathfloattofixed@impl\the\pgfmathfloat@a@Mtok\relax - \or - \expandafter\pgfmathfloattofixed@impl\the\pgfmathfloat@a@Mtok\relax - \pgfmathfloat@a@Mtok=\expandafter{\pgfmathresult}% - \edef\pgfmathresult{-\the\pgfmathfloat@a@Mtok}% - \or\def\pgfmathresult{nan}% - \or\def\pgfmathresult{inf}% - \or\def\pgfmathresult{-inf}% - \fi - \pgfmath@smuggleone\pgfmathresult - \endgroup + \begingroup + \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \ifcase\pgfmathfloat@a@S + \def\pgfmathresult{0.0}% + \or + \expandafter\pgfmathfloattofixed@impl\the\pgfmathfloat@a@Mtok\relax + \or + \expandafter\pgfmathfloattofixed@impl\the\pgfmathfloat@a@Mtok\relax + \pgfmathfloat@a@Mtok=\expandafter{\pgfmathresult}% + \edef\pgfmathresult{-\the\pgfmathfloat@a@Mtok}% + \or\def\pgfmathresult{nan}% + \or\def\pgfmathresult{inf}% + \or\def\pgfmathresult{-inf}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup } \let\pgfmathfloattofixed=\pgfmathfloattofixed@ % Converts a float to an integer (in integer format). % -% @see \pgfmathfloatint +% @see \pgfmathfloatint \def\pgfmathfloattoint#1{% - \pgfmathfloattofixed{#1}% - \expandafter\pgfmathfloattoint@@\pgfmathresult\relax + \pgfmathfloattofixed{#1}% + \expandafter\pgfmathfloattoint@@\pgfmathresult\relax }% \def\pgfmathfloattoint@@#1.#2\relax{% - \def\pgfmathresult{#1}% + \def\pgfmathresult{#1}% }% % Converts a floating point number to scientific format 1.234e5. % % This operation is very fast. \def\pgfmathfloattosci@#1{% - \begingroup - \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E - \ifcase\pgfmathfloat@a@S - \def\pgfmathresult{0.0e0}% - \or - \edef\pgfmathresult{\the\pgfmathfloat@a@Mtok e\the\pgfmathfloat@a@E}% - \or - \edef\pgfmathresult{-\the\pgfmathfloat@a@Mtok e\the\pgfmathfloat@a@E}% - \or\def\pgfmathresult{nan}% - \or\def\pgfmathresult{inf}% - \or\def\pgfmathresult{-inf}% - \fi - \pgfmath@smuggleone\pgfmathresult - \endgroup + \begingroup + \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \ifcase\pgfmathfloat@a@S + \def\pgfmathresult{0.0e0}% + \or + \edef\pgfmathresult{\the\pgfmathfloat@a@Mtok e\the\pgfmathfloat@a@E}% + \or + \edef\pgfmathresult{-\the\pgfmathfloat@a@Mtok e\the\pgfmathfloat@a@E}% + \or\def\pgfmathresult{nan}% + \or\def\pgfmathresult{inf}% + \or\def\pgfmathresult{-inf}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup }% \let\pgfmathfloattosci=\pgfmathfloattosci@ @@ -430,36 +430,36 @@ \def\pgfmathfloatvalueof#1{\expandafter\pgfmathfloatvalueof@@#1@@}% % Make it fool proof such that the following arguments work: -% \pgfmathfloatvalueof{1Y1.0e1} -> 1.0e1 -% \pgfmathfloatvalueof{2Y1.0e1} -> -1.0e1 +% \pgfmathfloatvalueof{1Y1.0e1} -> 1.0e1 +% \pgfmathfloatvalueof{2Y1.0e1} -> -1.0e1 % and wrong arguments as well: -% \pgfmathfloatvalueof{1} -> 1 -% \pgfmathfloatvalueof{1e2} -> 1e2 +% \pgfmathfloatvalueof{1} -> 1 +% \pgfmathfloatvalueof{1e2} -> 1e2 \def\pgfmathfloatvalueof@@#1#2{% - \if#2Y% - % keep in mind that \pgfmathfloatvalueof should be expandable! - % We must not use \let here. Let's hope that #1 and #2 are - % single tokens (not something which was enclosed by curly - % braces...) - \expandafter\pgfmathfloatvalueof@@@\expandafter#1\expandafter#2% - \else - % Oh - no float!? Ok, we cannot report errors in this context. - % So: make it a feature and return the input argument as-is. - % Might be useful, in fact... - \expandafter\pgfmathfloatvalueof@abort\expandafter#1\expandafter#2% - \fi + \if#2Y% + % keep in mind that \pgfmathfloatvalueof should be expandable! + % We must not use \let here. Let's hope that #1 and #2 are + % single tokens (not something which was enclosed by curly + % braces...) + \expandafter\pgfmathfloatvalueof@@@\expandafter#1\expandafter#2% + \else + % Oh - no float!? Ok, we cannot report errors in this context. + % So: make it a feature and return the input argument as-is. + % Might be useful, in fact... + \expandafter\pgfmathfloatvalueof@abort\expandafter#1\expandafter#2% + \fi } \def\pgfmathfloatvalueof@@@#1Y#2e#3]@@{% - \ifcase#1 % - 0.0e0% - \or - #2e#3% - \or - -#2e#3% - \or nan% - \or inf% - \or -inf% - \fi + \ifcase#1 % + 0.0e0% + \or + #2e#3% + \or + -#2e#3% + \or nan% + \or inf% + \or -inf% + \fi }% \def\pgfmathfloatvalueof@abort#1@@{#1}% @@ -472,7 +472,7 @@ % See \pgfmathroundtozerofill if you want trailing zeros and fixed % width. % -% This method is PURELY text based and can work with arbitrary +% This method is PURELY text based and can work with arbirtrary % precision (well, limited to TeX's stack size and integer size). % % Examples: @@ -487,16 +487,16 @@ % % SIDE EFFECT: the global variable \ifpgfmathfloatroundhasperiod will be set. \def\pgfmathroundto#1{% - \pgfmathfloatroundhasperiodtrue - \begingroup - \pgfmathfloat@fixed@digits@after@periodfalse - \pgfmathroundto@impl{#1}% - \pgfmath@smuggleone\pgfmathresult - \endgroup + \pgfmathfloatroundhasperiodtrue + \begingroup + \pgfmathfloat@fixed@digits@after@periodfalse + \pgfmathroundto@impl{#1}% + \pgfmath@smuggleone\pgfmathresult + \endgroup } -% Overloaded method. +% Overloaded method. % % This variant always uses a FIXED number behind the period and fills % in zeros if necessary. @@ -509,255 +509,255 @@ % % SIDE EFFECT: the global variable \ifpgfmathfloatroundhasperiod will be set. \def\pgfmathroundtozerofill#1{% - \pgfmathfloatroundhasperiodtrue - \begingroup - \pgfmathfloat@fixed@digits@after@periodtrue - \pgfmathroundto@impl{#1}% - \pgfmath@smuggleone\pgfmathresult - \endgroup + \pgfmathfloatroundhasperiodtrue + \begingroup + \pgfmathfloat@fixed@digits@after@periodtrue + \pgfmathroundto@impl{#1}% + \pgfmath@smuggleone\pgfmathresult + \endgroup } % see \pgfmathprintnumber@fixed@style for docs \def\pgfmathprintnumber@fixed@styleDEFAULT#1#2#3e#4\relax{% - \begingroup - \pgfkeysgetvalue{/pgf/number format/set decimal separator}\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP - \pgfkeysgetvalue{/pgf/number format/@dec sep mark}\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP@MARK - \pgfkeysgetvalue{/pgf/number format/set thousands separator}\pgfmathprintnumber@fixed@styleDEFAULT@THOUSAND@SEP - \c@pgf@counta=#4\relax % it is the exponent here. - \ifnum#2=0 - \c@pgf@counta=0 - \fi - \def\pgfmathresult{}% - \ifpgfmathfloatroundhasperiod - \expandafter\pgfmathprintnumber@fixed@styleDEFAULT@impl@period#1\pgfmathfloat@EOI - \else - \expandafter\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod#1\pgfmathfloat@EOI\pgfmathfloat@EOI\pgfmathfloat@EOI% - \begingroup - \toks0=\expandafter{\pgfmathresult}% - \toks1=\expandafter{\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP@MARK}% - \xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 }% - \endgroup - \let\pgfmathresult=\pgfmathfloat@glob@TMP - \fi - \pgfmath@smuggleone\pgfmathresult - \endgroup + \begingroup + \pgfkeysgetvalue{/pgf/number format/set decimal separator}\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP + \pgfkeysgetvalue{/pgf/number format/@dec sep mark}\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP@MARK + \pgfkeysgetvalue{/pgf/number format/set thousands separator}\pgfmathprintnumber@fixed@styleDEFAULT@THOUSAND@SEP + \c@pgf@counta=#4\relax % it is the exponent here. + \ifnum#2=0 + \c@pgf@counta=0 + \fi + \def\pgfmathresult{}% + \ifpgfmathfloatroundhasperiod + \expandafter\pgfmathprintnumber@fixed@styleDEFAULT@impl@period#1\pgfmathfloat@EOI + \else + \expandafter\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod#1\pgfmathfloat@EOI\pgfmathfloat@EOI\pgfmathfloat@EOI% + \begingroup + \toks0=\expandafter{\pgfmathresult}% + \toks1=\expandafter{\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP@MARK}% + \xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 }% + \endgroup + \let\pgfmathresult=\pgfmathfloat@glob@TMP + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup } \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@period#1.#2\pgfmathfloat@EOI{% - \ifpgfmathprintnumberskipzeroperiod - \def\pgfmathfloat@loc@TMPb{#1}% - \ifx\pgfmathfloatparsenumber@tok@ZERO\pgfmathfloat@loc@TMPb - \else - \def\pgfmathfloat@loc@TMPc{-0}% - \ifx\pgfmathfloat@loc@TMPc\pgfmathfloat@loc@TMPb - \def\pgfmathresult{-}% - \else - \def\pgfmathfloat@loc@TMPc{+0}% - \ifx\pgfmathfloat@loc@TMPc\pgfmathfloat@loc@TMPb - \def\pgfmathresult{+}% - \else - \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod#1\pgfmathfloat@EOI\pgfmathfloat@EOI\pgfmathfloat@EOI - \fi - \fi - \fi - \else - \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod#1\pgfmathfloat@EOI\pgfmathfloat@EOI\pgfmathfloat@EOI - \fi - \ifpgfmathprintnumber@thousand@sep@in@fractional - \let\pgfmathresultfractional\pgfutil@empty% - \pgfmathprintnumber@thousand@sep@in@fractional#2MMMM\@@ - \else - \def\pgfmathresultfractional{#2}% - \fi - \begingroup - \toks0=\expandafter{\pgfmathresult}% - \toks1=\expandafter{\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP@MARK}% - \toks2=\expandafter{\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP}% - \toks3=\expandafter{\pgfmathresultfractional}% - \xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 \the\toks2 \the\toks3 }% - \endgroup - \let\pgfmathresult=\pgfmathfloat@glob@TMP + \ifpgfmathprintnumberskipzeroperiod + \def\pgfmathfloat@loc@TMPb{#1}% + \ifx\pgfmathfloatparsenumber@tok@ZERO\pgfmathfloat@loc@TMPb + \else + \def\pgfmathfloat@loc@TMPc{-0}% + \ifx\pgfmathfloat@loc@TMPc\pgfmathfloat@loc@TMPb + \def\pgfmathresult{-}% + \else + \def\pgfmathfloat@loc@TMPc{+0}% + \ifx\pgfmathfloat@loc@TMPc\pgfmathfloat@loc@TMPb + \def\pgfmathresult{+}% + \else + \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod#1\pgfmathfloat@EOI\pgfmathfloat@EOI\pgfmathfloat@EOI + \fi + \fi + \fi + \else + \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod#1\pgfmathfloat@EOI\pgfmathfloat@EOI\pgfmathfloat@EOI + \fi + \ifpgfmathprintnumber@thousand@sep@in@fractional + \let\pgfmathresultfractional\pgfutil@empty% + \pgfmathprintnumber@thousand@sep@in@fractional#2MMMM\@@ + \else + \def\pgfmathresultfractional{#2}% + \fi + \begingroup + \toks0=\expandafter{\pgfmathresult}% + \toks1=\expandafter{\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP@MARK}% + \toks2=\expandafter{\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP}% + \toks3=\expandafter{\pgfmathresultfractional}% + \xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 \the\toks2 \the\toks3 }% + \endgroup + \let\pgfmathresult=\pgfmathfloat@glob@TMP }% % assigns \pgfmathresult such that it contains the formatted result. % It assumes that none of the following tokens contains a period. \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod{% - \ifx\pgfmathprintnumber@fixed@styleDEFAULT@THOUSAND@SEP\pgfutil@empty - \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{% - \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printall}% - \else - \ifnum\c@pgf@counta<0\relax % exponent of the number in this context - \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{% - \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printall}% - \else - \ifnum\c@pgf@counta<\pgfkeysvalueof{/pgf/number format/min exponent for 1000 sep}\relax - \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{% - \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printall}% - \else - \advance\c@pgf@counta by1 % counta:= total number of digits, N. - \c@pgf@countb=\c@pgf@counta - \divide\c@pgf@countb by3 % countb := N DIV 3 - \c@pgf@countc=\c@pgf@countb - \multiply\c@pgf@countc by3 - \advance\c@pgf@counta by-\c@pgf@countc% now counta := N MOD 3 - \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{% - \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printsign - }% - \fi - \fi - \fi - \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT + \ifx\pgfmathprintnumber@fixed@styleDEFAULT@THOUSAND@SEP\pgfutil@empty + \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{% + \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printall}% + \else + \ifnum\c@pgf@counta<0\relax % exponent of the number in this context + \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{% + \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printall}% + \else + \ifnum\c@pgf@counta<\pgfkeysvalueof{/pgf/number format/min exponent for 1000 sep}\relax + \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{% + \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printall}% + \else + \advance\c@pgf@counta by1 % counta:= total number of digits, N. + \c@pgf@countb=\c@pgf@counta + \divide\c@pgf@countb by3 % countb := N DIV 3 + \c@pgf@countc=\c@pgf@countb + \multiply\c@pgf@countc by3 + \advance\c@pgf@counta by-\c@pgf@countc% now counta := N MOD 3 + \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{% + \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printsign + }% + \fi + \fi + \fi + \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT } \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printsign#1{% - \def\pgfmathfloat@loc@TMPb{#1}% - \ifx\pgfmathfloat@loc@TMPb\pgfmathfloatparsenumber@tok@MINUS - \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult #1}% - \let\pgfmathfloat@loc@TMPb=\pgfutil@empty - \else - \ifx\pgfmathfloat@loc@TMPb\pgfmathfloatparsenumber@tok@PLUS - \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult #1}% - \let\pgfmathfloat@loc@TMPb=\pgfutil@empty - \else - \ifpgfmathprintnumber@showpositive - \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult +}% - \fi - \fi - \fi - \ifnum\c@pgf@counta>0 % \c@pgf@counta = N MOD 3 in this context - \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{% - \expandafter\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printtrailingdigits\pgfmathfloat@loc@TMPb - }% - \else - \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{% - \expandafter\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@counteverythird\pgfmathfloat@loc@TMPb - }% - \fi - \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT + \def\pgfmathfloat@loc@TMPb{#1}% + \ifx\pgfmathfloat@loc@TMPb\pgfmathfloatparsenumber@tok@MINUS + \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult #1}% + \let\pgfmathfloat@loc@TMPb=\pgfutil@empty + \else + \ifx\pgfmathfloat@loc@TMPb\pgfmathfloatparsenumber@tok@PLUS + \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult #1}% + \let\pgfmathfloat@loc@TMPb=\pgfutil@empty + \else + \ifpgfmathprintnumber@showpositive + \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult +}% + \fi + \fi + \fi + \ifnum\c@pgf@counta>0 % \c@pgf@counta = N MOD 3 in this context + \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{% + \expandafter\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printtrailingdigits\pgfmathfloat@loc@TMPb + }% + \else + \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{% + \expandafter\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@counteverythird\pgfmathfloat@loc@TMPb + }% + \fi + \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT } \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printtrailingdigits#1#2{% - \ifcase\c@pgf@counta % = N MOD 3 in this context - % does not happen per construction - \or - \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult #1}% - \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{% - \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@counteverythird#2% - }% - \or - \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult #1#2}% - \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{% - \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@counteverythird% - }% - \fi - \ifnum\c@pgf@countb>0\relax % \c@pgf@countb = N DIV 3 in this context - \begingroup - \toks0=\expandafter{\pgfmathresult}% - \toks1=\expandafter{\pgfmathprintnumber@fixed@styleDEFAULT@THOUSAND@SEP}% - \xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 }% - \endgroup - \let\pgfmathresult=\pgfmathfloat@glob@TMP - \fi - \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT + \ifcase\c@pgf@counta % = N MOD 3 in this context + % does not happen per construction + \or + \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult #1}% + \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{% + \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@counteverythird#2% + }% + \or + \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult #1#2}% + \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{% + \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@counteverythird% + }% + \fi + \ifnum\c@pgf@countb>0\relax % \c@pgf@countb = N DIV 3 in this context + \begingroup + \toks0=\expandafter{\pgfmathresult}% + \toks1=\expandafter{\pgfmathprintnumber@fixed@styleDEFAULT@THOUSAND@SEP}% + \xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 }% + \endgroup + \let\pgfmathresult=\pgfmathfloat@glob@TMP + \fi + \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT } \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@counteverythird#1#2#3{% - \ifnum\c@pgf@countb>0\relax - \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult #1#2#3}% - \advance\c@pgf@countb by-1 - \ifnum\c@pgf@countb>0\relax - \begingroup - \toks0=\expandafter{\pgfmathresult}% - \toks1=\expandafter{\pgfmathprintnumber@fixed@styleDEFAULT@THOUSAND@SEP}% - \xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 }% - \endgroup - \let\pgfmathresult=\pgfmathfloat@glob@TMP - \fi - \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{% - \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@counteverythird% - }% - \else - % in this case, #1#2#3 are expected to be - % \pgfmathfloat@EOI\pgfmathfloat@EOI\pgfmathfloat@EOI - %-------------------------------------------------- - % \def\pgfmathfloat@loc@TMPb{\pgfmathfloat@EOI\pgfmathfloat@EOI\pgfmathfloat@EOI}% - % \def\pgfmathfloat@loc@TMPc{#1#2#3}% - % \ifx\pgfmathfloat@loc@TMPc\pgfmathfloat@loc@TMPb - % \else - % \pgfmath@error{INTERNAL ERROR in fixed style - The input sequence did not terminate as expected; which indicates a wrong exponent argument provided to \string\pgfmathprintnumber@fixed@style}{}% - % \fi - %-------------------------------------------------- - \let\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT=\relax - \fi - \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT + \ifnum\c@pgf@countb>0\relax + \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult #1#2#3}% + \advance\c@pgf@countb by-1 + \ifnum\c@pgf@countb>0\relax + \begingroup + \toks0=\expandafter{\pgfmathresult}% + \toks1=\expandafter{\pgfmathprintnumber@fixed@styleDEFAULT@THOUSAND@SEP}% + \xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 }% + \endgroup + \let\pgfmathresult=\pgfmathfloat@glob@TMP + \fi + \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT{% + \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@counteverythird% + }% + \else + % in thise case, #1#2#3 are expected to be + % \pgfmathfloat@EOI\pgfmathfloat@EOI\pgfmathfloat@EOI + %-------------------------------------------------- + % \def\pgfmathfloat@loc@TMPb{\pgfmathfloat@EOI\pgfmathfloat@EOI\pgfmathfloat@EOI}% + % \def\pgfmathfloat@loc@TMPc{#1#2#3}% + % \ifx\pgfmathfloat@loc@TMPc\pgfmathfloat@loc@TMPb + % \else + % \pgfmath@error{INTERNAL ERROR in fixed style - The input sequence did not terminate as expected; which indicates a wrong exponent argument provided to \string\pgfmathprintnumber@fixed@style}{}% + % \fi + %-------------------------------------------------- + \let\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT=\relax + \fi + \pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@NEXT } % \pgfmathprintnumber@thousand@sep@in@fractional 01234525MMMM\@@ % -> % 012<sep>345<sep>25 \def\pgfmathprintnumber@thousand@sep@in@fractional#1#2#3#4{% - \if#4M% - % Ok, no further separator - \def\pgfmathprint@next{\pgfmathprintnumber@thousand@sep@in@fractional@finish#1#2#3#4}% - \else - \begingroup - \toks0=\expandafter{\pgfmathresultfractional}% - \toks1={#1#2#3}% - \toks2=\expandafter{\pgfmathprintnumber@fixed@styleDEFAULT@THOUSAND@SEP}% - \xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 \the\toks2 }% - \endgroup - \let\pgfmathresultfractional=\pgfmathfloat@glob@TMP - \def\pgfmathprint@next{\pgfmathprintnumber@thousand@sep@in@fractional#4}% - \fi - \pgfmathprint@next + \if#4M% + % Ok, no further separator + \def\pgfmathprint@next{\pgfmathprintnumber@thousand@sep@in@fractional@finish#1#2#3#4}% + \else + \begingroup + \toks0=\expandafter{\pgfmathresultfractional}% + \toks1={#1#2#3}% + \toks2=\expandafter{\pgfmathprintnumber@fixed@styleDEFAULT@THOUSAND@SEP}% + \xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 \the\toks2 }% + \endgroup + \let\pgfmathresultfractional=\pgfmathfloat@glob@TMP + \def\pgfmathprint@next{\pgfmathprintnumber@thousand@sep@in@fractional#4}% + \fi + \pgfmathprint@next }% \def\pgfmathprintnumber@thousand@sep@in@fractional@finish#1M{% - \expandafter\def\expandafter\pgfmathresultfractional\expandafter{\pgfmathresultfractional #1}% - \pgfmathprintnumber@thousand@sep@in@fractional@finish@ + \expandafter\def\expandafter\pgfmathresultfractional\expandafter{\pgfmathresultfractional #1}% + \pgfmathprintnumber@thousand@sep@in@fractional@finish@ }% \def\pgfmathprintnumber@thousand@sep@in@fractional@finish@#1\@@{}% \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printall#1{% - \def\pgfmathfloat@loc@TMPb{#1}% - \let\pgfmathfloat@loc@TMPc=\pgfutil@empty - \ifx\pgfmathfloat@loc@TMPb\pgfmathfloatparsenumber@tok@MINUS - \else - \ifx\pgfmathfloat@loc@TMPb\pgfmathfloatparsenumber@tok@PLUS - \else - \ifpgfmathprintnumber@showpositive - \def\pgfmathfloat@loc@TMPc{+}% - \fi - \fi - \fi - \expandafter\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printall@\pgfmathfloat@loc@TMPc#1% + \def\pgfmathfloat@loc@TMPb{#1}% + \let\pgfmathfloat@loc@TMPc=\pgfutil@empty + \ifx\pgfmathfloat@loc@TMPb\pgfmathfloatparsenumber@tok@MINUS + \else + \ifx\pgfmathfloat@loc@TMPb\pgfmathfloatparsenumber@tok@PLUS + \else + \ifpgfmathprintnumber@showpositive + \def\pgfmathfloat@loc@TMPc{+}% + \fi + \fi + \fi + \expandafter\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printall@\pgfmathfloat@loc@TMPc#1% } \def\pgfmathprintnumber@fixed@styleDEFAULT@impl@noperiod@printall@#1\pgfmathfloat@EOI\pgfmathfloat@EOI\pgfmathfloat@EOI{% - \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult #1}% + \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult #1}% }% % @deprecated. It has been replaced by \pgfmathprintnumber@fixed@styleDEFAULT % #1 maybe a macro \def\pgfmathprintnumber@fixed@stylePERIOD#1#2#3e#4\relax{% - \def\pgfmathresult{#1}% + \def\pgfmathresult{#1}% } % @deprecated. It has been replaced by \pgfmathprintnumber@fixed@styleDEFAULT % #1 maybe a macro \def\pgfmathprintnumber@fixed@styleCOMMA#1#2#3e#4\relax{% - \ifpgfmathfloatroundhasperiod - \expandafter\pgfmathprintnumber@fixed@styleCOMMA@impl#1\pgfmathfloat@EOI - \else - \def\pgfmathresult{#1}% - \fi + \ifpgfmathfloatroundhasperiod + \expandafter\pgfmathprintnumber@fixed@styleCOMMA@impl#1\pgfmathfloat@EOI + \else + \def\pgfmathresult{#1}% + \fi } \def\pgfmathprintnumber@fixed@styleCOMMA@impl#1.#2\pgfmathfloat@EOI{\def\pgfmathresult{#1{,}#2}} % The default style to display fixed point numbers. % -% It does not apply numerics, but it is responsible for typesetting the +% It does not apply numerics, but it is responsable for typesetting the % rounded number. % It can access the \ifpgfmathfloatroundhasperiod boolean. % % Arguments: % #1#2#3e#4\relax -% Input: +% Input: % #1 the fixed point number to be displayed (maybe a macro). % #2#3e#4: the (possibly unformatted) floating point representation % which belongs to #1. This format is returned (only!) by @@ -766,7 +766,7 @@ \let\pgfmathprintnumber@fixed@style=\pgfmathprintnumber@fixed@styleDEFAULT -% Rounds a normalized floating point number to \pgfmathfloat@round@precision +% Rounds a normalized floating point number to \pgfmathfloat@round@precision % digits precision and writes the result to \pgfmathresult. % % This method uses \pgfmathroundto for the mantissa. @@ -776,13 +776,13 @@ % SIDE EFFECT: the global variable \ifpgfmathfloatroundhasperiod will be set to % whether the final mantissa #5 has a period or not. \def\pgfmathfloatround#1{% - \pgfmathfloatroundhasperiodtrue - \begingroup - \pgfmathfloat@fixed@digits@after@periodfalse - \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E - \pgfmathfloatround@impl - \pgfmath@smuggleone\pgfmathresult - \endgroup + \pgfmathfloatroundhasperiodtrue + \begingroup + \pgfmathfloat@fixed@digits@after@periodfalse + \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \pgfmathfloatround@impl + \pgfmath@smuggleone\pgfmathresult + \endgroup } % Overload. @@ -795,13 +795,13 @@ % SIDE EFFECT: the global variable \ifpgfmathfloatroundhasperiod will be set to % whether the final mantissa #5 has a period or not. \def\pgfmathfloatroundzerofill#1{% - \pgfmathfloatroundhasperiodtrue - \begingroup - \pgfmathfloat@fixed@digits@after@periodtrue - \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E - \pgfmathfloatround@impl - \pgfmath@smuggleone\pgfmathresult - \endgroup + \pgfmathfloatroundhasperiodtrue + \begingroup + \pgfmathfloat@fixed@digits@after@periodtrue + \expandafter\pgfmathfloat@decompose@tok#1\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \pgfmathfloatround@impl + \pgfmath@smuggleone\pgfmathresult + \endgroup } \newif\ifpgfmathfloatround@allow@empty@mantissa @@ -811,134 +811,134 @@ % #2: mantissa % #3: exponent % #4: CODE to display if the mantissa is drawn. -% This code will be shown just before the exponent. -% Example: #4=\cdot +% This code will be shown just before the exponent. +% Example: #4=\cdot % #5: CODE to display if the mantissa is NOT draw. (unused currently) -% Might be used to display '10^1' instead of '1*10^1'. +% Might be used to display '10^1' instead of '1*10^1'. % #6: CODE to display the exponent. \def\pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\relax#4#5#6{% - \pgfkeysgetvalue{/pgf/number format/@sci exponent mark}\pgfmathfloatrounddisplaystyle@e@mark - \ifcase#1\relax - \pgfmathprintnumber@fixed@style{#2}#1#2e0\relax% - \expandafter\pgfmathfloatrounddisplaystyle@shared@impl@\expandafter{\pgfmathresult}{#4#6}% - \or - \def\pgfmathfloat@loc@TMPa{1}% "should draw mantissa=1" - \ifpgfmathfloatround@allow@empty@mantissa - \else - \ifdim#2pt=\pgfmathfloatround@mantissa@ONE - \def\pgfmathfloat@loc@TMPa{0}% do not draw it. - \fi - \fi - % - \if1\pgfmathfloat@loc@TMPa - \pgfmathprintnumber@fixed@style{#2}#1#2e0\relax% - \expandafter\pgfmathfloatrounddisplaystyle@shared@impl@\expandafter{\pgfmathresult}{#4#6}% - \else - \def\pgfmathfloat@loc@TMPa{0}% - \pgfmathfloatrounddisplaystyle@shared@impl@{#5}{#6}% - \fi - \or - \def\pgfmathfloat@loc@TMPa{1}% "should draw mantissa=1" - \ifpgfmathfloatround@allow@empty@mantissa - \else - \ifdim#2pt=\pgfmathfloatround@mantissa@ONE - \def\pgfmathfloat@loc@TMPa{0}% do not draw it. - \fi - \fi - % - \if1\pgfmathfloat@loc@TMPa - \pgfmathprintnumber@fixed@style{-#2}#1#2e0\relax% - \expandafter\pgfmathfloatrounddisplaystyle@shared@impl@\expandafter{\pgfmathresult}{#4#6}% - \else - \def\pgfmathfloat@loc@TMPa{0}% - \pgfmathfloatrounddisplaystyle@shared@impl@{-#5}{#6}% - \fi - \or - \pgfmathfloatrounddisplaystyle@shared@impl@@{\hbox{NaN}}{}% - \or - \ifpgfmathprintnumber@showpositive - \pgfmathfloatrounddisplaystyle@shared@impl@@{+\infty}{}% - \else - \pgfmathfloatrounddisplaystyle@shared@impl@@{\infty}{}% - \fi - \or - \pgfmathfloatrounddisplaystyle@shared@impl@@{-\infty}{}% - \fi + \pgfkeysgetvalue{/pgf/number format/@sci exponent mark}\pgfmathfloatrounddisplaystyle@e@mark + \ifcase#1\relax + \pgfmathprintnumber@fixed@style{#2}#1#2e0\relax% + \expandafter\pgfmathfloatrounddisplaystyle@shared@impl@\expandafter{\pgfmathresult}{#4#6}% + \or + \def\pgfmathfloat@loc@TMPa{1}% "should draw mantissa=1" + \ifpgfmathfloatround@allow@empty@mantissa + \else + \ifdim#2pt=\pgfmathfloatround@mantissa@ONE + \def\pgfmathfloat@loc@TMPa{0}% do not draw it. + \fi + \fi + % + \if1\pgfmathfloat@loc@TMPa + \pgfmathprintnumber@fixed@style{#2}#1#2e0\relax% + \expandafter\pgfmathfloatrounddisplaystyle@shared@impl@\expandafter{\pgfmathresult}{#4#6}% + \else + \def\pgfmathfloat@loc@TMPa{0}% + \pgfmathfloatrounddisplaystyle@shared@impl@{#5}{#6}% + \fi + \or + \def\pgfmathfloat@loc@TMPa{1}% "should draw mantissa=1" + \ifpgfmathfloatround@allow@empty@mantissa + \else + \ifdim#2pt=\pgfmathfloatround@mantissa@ONE + \def\pgfmathfloat@loc@TMPa{0}% do not draw it. + \fi + \fi + % + \if1\pgfmathfloat@loc@TMPa + \pgfmathprintnumber@fixed@style{-#2}#1#2e0\relax% + \expandafter\pgfmathfloatrounddisplaystyle@shared@impl@\expandafter{\pgfmathresult}{#4#6}% + \else + \def\pgfmathfloat@loc@TMPa{0}% + \pgfmathfloatrounddisplaystyle@shared@impl@{-#5}{#6}% + \fi + \or + \pgfmathfloatrounddisplaystyle@shared@impl@@{\hbox{NaN}}{}% + \or + \ifpgfmathprintnumber@showpositive + \pgfmathfloatrounddisplaystyle@shared@impl@@{+\infty}{}% + \else + \pgfmathfloatrounddisplaystyle@shared@impl@@{\infty}{}% + \fi + \or + \pgfmathfloatrounddisplaystyle@shared@impl@@{-\infty}{}% + \fi } % #1: the part before the exponent code % #2: the part for the exponent code. \def\pgfmathfloatrounddisplaystyle@shared@impl@#1#2{% - \pgfmathprintnumber@begingroup - \toks0={#1}% - \toks1=\expandafter{\pgfmathfloatrounddisplaystyle@e@mark #2}% - \xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 }% - \pgfmathprintnumber@endgroup - \let\pgfmathresult=\pgfmathfloat@glob@TMP + \pgfmathprintnumber@begingroup + \toks0={#1}% + \toks1=\expandafter{\pgfmathfloatrounddisplaystyle@e@mark #2}% + \xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 }% + \pgfmathprintnumber@endgroup + \let\pgfmathresult=\pgfmathfloat@glob@TMP }% % Same as \pgfmathfloatrounddisplaystyle@shared@impl@, but it also % inserts the '@dec sep mark' at the end. \def\pgfmathfloatrounddisplaystyle@shared@impl@@#1#2{% - \pgfmathprintnumber@begingroup - \toks0={#1}% - \toks1=\expandafter{\pgfmathfloatrounddisplaystyle@e@mark #2}% - \pgfkeysgetvalue{/pgf/number format/@dec sep mark}\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP@MARK - \toks2=\expandafter{\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP@MARK}% - \xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 \the\toks2 }% - \pgfmathprintnumber@endgroup - \let\pgfmathresult=\pgfmathfloat@glob@TMP + \pgfmathprintnumber@begingroup + \toks0={#1}% + \toks1=\expandafter{\pgfmathfloatrounddisplaystyle@e@mark #2}% + \pgfkeysgetvalue{/pgf/number format/@dec sep mark}\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP@MARK + \toks2=\expandafter{\pgfmathprintnumber@fixed@styleDEFAULT@DEC@SEP@MARK}% + \xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 \the\toks2 }% + \pgfmathprintnumber@endgroup + \let\pgfmathresult=\pgfmathfloat@glob@TMP } \def\pgfmathfloatrounddisplaystyle@std#1#2e#3\relax{% - \pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\relax{\cdot}{}{10^{#3}}% + \pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\relax{\cdot}{}{10^{#3}}% } \def\pgfmathfloatrounddisplaystyle@subscript#1#2e#3\relax{% - \pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\relax{}{1}{_{#3}}% + \pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\relax{}{1}{_{#3}}% } \def\pgfmathfloatrounddisplaystyle@superscript#1#2e#3\relax{% - \pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\relax{}{1}{^{#3}}% + \pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\relax{}{1}{^{#3}}% } \def\pgfmathfloatrounddisplaystyle@e#1#2e#3\relax{% - \ifnum#3<0\relax - \pgfmathprintnumber@begingroup - \count0=#3\relax - \multiply\count0 by-1 - \xdef\pgfmathfloat@glob@TMP{e{-}\the\count0}% - \pgfmathprintnumber@endgroup% - \let\pgfmathresult=\pgfmathfloat@glob@TMP - \else - \def\pgfmathresult{e{+}#3}% - \fi - \def\pgfmathfloat@loc@TMPb{\pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\relax{}{1}}% - \expandafter\pgfmathfloat@loc@TMPb\expandafter{\pgfmathresult}% + \ifnum#3<0\relax + \pgfmathprintnumber@begingroup + \count0=#3\relax + \multiply\count0 by-1 + \xdef\pgfmathfloat@glob@TMP{e{-}\the\count0}% + \pgfmathprintnumber@endgroup% + \let\pgfmathresult=\pgfmathfloat@glob@TMP + \else + \def\pgfmathresult{e{+}#3}% + \fi + \def\pgfmathfloat@loc@TMPb{\pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\relax{}{1}}% + \expandafter\pgfmathfloat@loc@TMPb\expandafter{\pgfmathresult}% } \def\pgfmathfloatrounddisplaystyle@E#1#2e#3\relax{% - \ifnum#3<0\relax - \pgfmathprintnumber@begingroup - \count0=#3\relax - \multiply\count0 by-1 - \xdef\pgfmathfloat@glob@TMP{E{-}\the\count0}% - \pgfmathprintnumber@endgroup% - \let\pgfmathresult=\pgfmathfloat@glob@TMP - \else - \def\pgfmathresult{E{+}#3}% - \fi - \def\pgfmathfloat@loc@TMPb{\pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\relax{}{1}}% - \expandafter\pgfmathfloat@loc@TMPb\expandafter{\pgfmathresult}% + \ifnum#3<0\relax + \pgfmathprintnumber@begingroup + \count0=#3\relax + \multiply\count0 by-1 + \xdef\pgfmathfloat@glob@TMP{E{-}\the\count0}% + \pgfmathprintnumber@endgroup% + \let\pgfmathresult=\pgfmathfloat@glob@TMP + \else + \def\pgfmathresult{E{+}#3}% + \fi + \def\pgfmathfloat@loc@TMPb{\pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\relax{}{1}}% + \expandafter\pgfmathfloat@loc@TMPb\expandafter{\pgfmathresult}% } \def\pgfmathfloatrounddisplaystyle@generic#1#2e#3\relax{% - \begingroup - \pgfkeysvalueof {/pgf/number format/sci generic/@/.@cmd}{#3}{#1}{#2}\pgfeov - \pgfkeysgetvalue{/pgf/number format/sci generic/mantissa sep}\pgfmathdisplay@aftermantissa - \pgfkeysgetvalue{/pgf/number format/sci generic/empty mantissa sep}\pgfmathdisplay@nomantissa - \pgfkeysgetvalue{/pgf/number format/sci generic/exponent}\pgfmathdisplay@e - \toks0=\expandafter{\pgfmathdisplay@aftermantissa}% - \toks1=\expandafter{\pgfmathdisplay@nomantissa}% - \toks2=\expandafter{\pgfmathdisplay@e}% - \xdef\pgfmathfloat@glob@TMP{\noexpand\pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\noexpand\relax{\the\toks0}{\the\toks1}{\the\toks2}}% - \endgroup - \pgfmathfloat@glob@TMP + \begingroup + \pgfkeysvalueof {/pgf/number format/sci generic/@/.@cmd}{#3}{#1}{#2}\pgfeov + \pgfkeysgetvalue{/pgf/number format/sci generic/mantissa sep}\pgfmathdisplay@aftermantissa + \pgfkeysgetvalue{/pgf/number format/sci generic/empty mantissa sep}\pgfmathdisplay@nomantissa + \pgfkeysgetvalue{/pgf/number format/sci generic/exponent}\pgfmathdisplay@e + \toks0=\expandafter{\pgfmathdisplay@aftermantissa}% + \toks1=\expandafter{\pgfmathdisplay@nomantissa}% + \toks2=\expandafter{\pgfmathdisplay@e}% + \xdef\pgfmathfloat@glob@TMP{\noexpand\pgfmathfloatrounddisplaystyle@shared@impl#1#2e#3\noexpand\relax{\the\toks0}{\the\toks1}{\the\toks2}}% + \endgroup + \pgfmathfloat@glob@TMP } % A macro which takes the argument '<SIGN><MANTISSE>e<EXPONENT>' and @@ -947,7 +947,7 @@ % % PRECONDITION: % the floating point number has already been rounded properly and -% the mantissa has been rounded correctly. +% the mantissa has been rounded correcty. % % The argument needs to be in the format returned by % \pgfmathfloat@to@FMeE@style and terminated by '\relax'. @@ -971,331 +971,331 @@ \newif\ifpgfmathprintnumber@thousand@sep@in@fractional \pgfkeys{% - /pgf/number format/.is family, - /pgf/number format, - fixed/.code= \pgfmath@set@number@printer{pgfmathprintnumber@FIXED}, - sci/.code= \pgfmath@set@number@printer{pgfmathprintnumber@SCI}, - std/.code= {\pgfmath@set@number@printer{pgfmathprintnumber@STD}\pgfmathprintnumber@STD@setparam{#1}}, - std/.default=,% - relative round mode/.is choice, - relative round mode/fixed/.code={\def\pgfmathprintnumber@RELATIVE@choice@roundtofixed{1}}, - relative round mode/mantissa/.code={\def\pgfmathprintnumber@RELATIVE@choice@roundtofixed{0}}, - relative round mode/compatible/.code={\def\pgfmathprintnumber@RELATIVE@choice@roundtofixed{2}}, - % relative={<exponent base 10>} - relative/.code={% - \pgfmath@set@number@printer{pgfmathprintnumber@RELATIVE}% - \pgfmathround@@orig{#1}% - \expandafter\pgfmathfloattoint@@\pgfmathresult\relax - \let\pgfmathprintnumber@RELATIVE@param=\pgfmathresult - },% - relative/.value required, - relative*/.style={/pgf/number format/relative={#1},/pgf/number format/relative round mode=fixed}, - every relative/.style=std, - relative style/.style={/pgf/number format/every relative/.append style={#1}}, - fixed relative/.code= \pgfmath@set@number@printer{pgfmathprintnumber@FIXED@RELATIVE}, - int detect/.code= \pgfmath@set@number@printer{pgfmathprintnumber@INT@DETECT}, - int trunc/.code= \pgfmath@set@number@printer{pgfmathprintnumber@INT@TRUNC}, - frac/.code= \pgfmath@set@number@printer{pgfmathprintnumber@frac},% - frac TeX/.initial=\frac, - frac whole format/.code={\def\pgfmathresult{#1}}, - frac denom/.initial=, - frac whole/.is if=pgfmathprintnumber@frac@whole, - frac whole=true, - frac shift/.initial=4, - frac warning/.is if=pgfmathprintnumber@frac@warn, - frac warning=true, - assume math mode/.is if=pgfmathprintnumber@assumemathmode, - assume math mode/.default=true, - fixed zerofill/.is if= pgfmathfloat@usezerofill@fixed, - fixed zerofill/.default=true, - sci zerofill/.is if= pgfmathfloat@usezerofill@sci, - sci zerofill/.default=true, - zerofill/.style= {/pgf/number format/fixed zerofill=#1,/pgf/number format/sci zerofill=#1}, - zerofill/.default= true, - precision/.store in= \pgfmathfloat@round@precision, - sci precision/.code={% - \edef\pgfmathfloat@loc@TMPa{#1}% - \ifx\pgfmathfloat@loc@TMPa\pgfutil@empty - \def\pgfmathprintnumber@sci@precision{\pgfmathfloat@round@precision}% - \else - \let\pgfmathprintnumber@sci@precision=\pgfmathfloat@loc@TMPa - \fi - },% - sci precision/.default=, - sci precision=, - fixed default/.code= {\let\pgfmathprintnumber@fixed@style=\pgfmathprintnumber@fixed@styleDEFAULT}, - set decimal separator/.initial=, - dec sep/.style={/pgf/number format/set decimal separator={#1}}, - @dec sep mark/.initial=, - @sci exponent mark/.initial=, - set thousands separator/.initial=, - 1000 sep in fractionals/.is if=pgfmathprintnumber@thousand@sep@in@fractional, - 1000 sep in fractionals/.default=true, - 1000 sep/.style={/pgf/number format/set thousands separator={#1}}, - min exponent for 1000 sep/.initial=0, - use period/.style= {/pgf/number format/set decimal separator={.},/pgf/number format/set thousands separator={{{,}}}}, - use comma/.style= {/pgf/number format/set decimal separator={{{,}}},/pgf/number format/set thousands separator={.}}, - showpos/.is if=pgfmathprintnumber@showpositive, - showpos/.default=true, - print sign/.is if=pgfmathprintnumber@showpositive, - print sign/.default=true, - read comma as period/.is if=pgfmathparsenumber@comma@as@period, - read comma as period/.default=true, - skip 0./.is if=pgfmathprintnumberskipzeroperiod, - skip 0./.default=true, - skip 0.= false, - use period, - sci 10^e/.code= {\let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@std}, - sci 10e/.code= {\let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@std}, - sci e/.code= {\let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@e}, - sci E/.code= {\let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@E}, - sci subscript/.code= {\let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@subscript}, - sci superscript/.code= {\let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@superscript}, - sci generic/.code= {% - \let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@generic - \pgfkeysdefargs{/pgf/number format/sci generic/@}% - {##1##2##3}% - {\pgfqkeys{/pgf/number format/sci generic}{#1}}% - }, - sci generic/mantissa sep/.initial=,% - sci generic/empty mantissa sep/.initial=,% - sci generic/mantisse sep/.style={/pgf/number format/sci generic/mantissa sep={#1}},% - sci generic/empty mantisse sep/.style={/pgf/number format/sci generic/empty mantissa sep={#1}},% - sci generic/exponent/.initial=,% - sci generic/.value required, - verbatim/.code={% - \pgfqkeys{/pgf/number format}{% - sci generic={mantissa sep=,exponent={e##1}}, - 1000 sep=, - skip 0.=false, - print sign=false, - dec sep=., - assume math mode, - frac TeX=\pgfmathfloatfrac@verbatim, - frac whole format/.code={\def\pgfmathresult{##1 }}, - @dec sep mark=, - @sci exponent mark=, - }% - }, - retain unit mantissa/.is if=pgfmathfloatround@allow@empty@mantissa, - retain unit mantissa/.default=true, - retain unit mantissa=true, - % - % allows to replace the implementation, for example - % 'implementation=\num'. This is experimental -- it is unclear - % if all consumers work well since they rely on the keys in - % /pgf/number format. - implementation/.code={\def\pgfmathprintnumber@protected{#1}}, + /pgf/number format/.is family, + /pgf/number format, + fixed/.code= \pgfmath@set@number@printer{pgfmathprintnumber@FIXED}, + sci/.code= \pgfmath@set@number@printer{pgfmathprintnumber@SCI}, + std/.code= {\pgfmath@set@number@printer{pgfmathprintnumber@STD}\pgfmathprintnumber@STD@setparam{#1}}, + std/.default=,% + relative round mode/.is choice, + relative round mode/fixed/.code={\def\pgfmathprintnumber@RELATIVE@choice@roundtofixed{1}}, + relative round mode/mantissa/.code={\def\pgfmathprintnumber@RELATIVE@choice@roundtofixed{0}}, + relative round mode/compatible/.code={\def\pgfmathprintnumber@RELATIVE@choice@roundtofixed{2}}, + % relative={<exponent base 10>} + relative/.code= {% + \pgfmath@set@number@printer{pgfmathprintnumber@RELATIVE}% + \pgfmathround@@orig{#1}% + \expandafter\pgfmathfloattoint@@\pgfmathresult\relax + \let\pgfmathprintnumber@RELATIVE@param=\pgfmathresult + },% + relative/.value required, + relative*/.style={/pgf/number format/relative={#1},/pgf/number format/relative round mode=fixed}, + every relative/.style=std, + relative style/.style={/pgf/number format/every relative/.append style={#1}}, + fixed relative/.code= \pgfmath@set@number@printer{pgfmathprintnumber@FIXED@RELATIVE}, + int detect/.code= \pgfmath@set@number@printer{pgfmathprintnumber@INT@DETECT}, + int trunc/.code= \pgfmath@set@number@printer{pgfmathprintnumber@INT@TRUNC}, + frac/.code= \pgfmath@set@number@printer{pgfmathprintnumber@frac},% + frac TeX/.initial=\frac, + frac whole format/.code={\def\pgfmathresult{#1}}, + frac denom/.initial=, + frac whole/.is if=pgfmathprintnumber@frac@whole, + frac whole=true, + frac shift/.initial=4, + frac warning/.is if=pgfmathprintnumber@frac@warn, + frac warning=true, + assume math mode/.is if=pgfmathprintnumber@assumemathmode, + assume math mode/.default=true, + fixed zerofill/.is if= pgfmathfloat@usezerofill@fixed, + fixed zerofill/.default=true, + sci zerofill/.is if= pgfmathfloat@usezerofill@sci, + sci zerofill/.default=true, + zerofill/.style= {/pgf/number format/fixed zerofill=#1,/pgf/number format/sci zerofill=#1}, + zerofill/.default= true, + precision/.store in= \pgfmathfloat@round@precision, + sci precision/.code={% + \edef\pgfmathfloat@loc@TMPa{#1}% + \ifx\pgfmathfloat@loc@TMPa\pgfutil@empty + \def\pgfmathprintnumber@sci@precision{\pgfmathfloat@round@precision}% + \else + \let\pgfmathprintnumber@sci@precision=\pgfmathfloat@loc@TMPa + \fi + },% + sci precision/.default=, + sci precision=, + fixed default/.code= {\let\pgfmathprintnumber@fixed@style=\pgfmathprintnumber@fixed@styleDEFAULT}, + set decimal separator/.initial=, + dec sep/.style={/pgf/number format/set decimal separator={#1}}, + @dec sep mark/.initial=, + @sci exponent mark/.initial=, + set thousands separator/.initial=, + 1000 sep in fractionals/.is if=pgfmathprintnumber@thousand@sep@in@fractional, + 1000 sep in fractionals/.default=true, + 1000 sep/.style={/pgf/number format/set thousands separator={#1}}, + min exponent for 1000 sep/.initial=0, + use period/.style= {/pgf/number format/set decimal separator={.},/pgf/number format/set thousands separator={{{,}}}}, + use comma/.style= {/pgf/number format/set decimal separator={{{,}}},/pgf/number format/set thousands separator={.}}, + showpos/.is if=pgfmathprintnumber@showpositive, + showpos/.default=true, + print sign/.is if=pgfmathprintnumber@showpositive, + print sign/.default=true, + read comma as period/.is if=pgfmathparsenumber@comma@as@period, + read comma as period/.default=true, + skip 0./.is if=pgfmathprintnumberskipzeroperiod, + skip 0./.default=true, + skip 0.= false, + use period, + sci 10^e/.code= {\let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@std}, + sci 10e/.code= {\let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@std}, + sci e/.code= {\let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@e}, + sci E/.code= {\let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@E}, + sci subscript/.code= {\let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@subscript}, + sci superscript/.code= {\let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@superscript}, + sci generic/.code= {% + \let\pgfmathfloatrounddisplaystyle=\pgfmathfloatrounddisplaystyle@generic + \pgfkeysdefargs{/pgf/number format/sci generic/@}% + {##1##2##3}% + {\pgfqkeys{/pgf/number format/sci generic}{#1}}% + }, + sci generic/mantissa sep/.initial=,% + sci generic/empty mantissa sep/.initial=,% + sci generic/mantisse sep/.style={/pgf/number format/sci generic/mantissa sep={#1}},% + sci generic/empty mantisse sep/.style={/pgf/number format/sci generic/empty mantissa sep={#1}},% + sci generic/exponent/.initial=,% + sci generic/.value required, + verbatim/.code={% + \pgfqkeys{/pgf/number format}{% + sci generic={mantissa sep=,exponent={e##1}}, + 1000 sep=, + skip 0.=false, + print sign=false, + dec sep=., + assume math mode, + frac TeX=\pgfmathfloatfrac@verbatim, + frac whole format/.code={\def\pgfmathresult{##1 }}, + @dec sep mark=, + @sci exponent mark=, + }% + }, + retain unit mantissa/.is if=pgfmathfloatround@allow@empty@mantissa, + retain unit mantissa/.default=true, + retain unit mantissa=true, + % + % allows to replace the implementation, for example + % 'implementation=\num'. This is experimental -- it is inclear + % if all consumers work well since they rely on the keys in + % /pgf/number format. + implementation/.code={\def\pgfmathprintnumber@protected{#1}}, } \def\pgfmathprintnumber@STD#1{% - % parse the input: - \pgfmathfloatparsenumber{#1}% - \pgfmathfloat@to@FMeE@style\pgfmathresult - \expandafter\pgfmathprintnumber@STD@issci\pgfmathresult\relax + % parse the input: + \pgfmathfloatparsenumber{#1}% + \pgfmathfloat@to@FMeE@style\pgfmathresult + \expandafter\pgfmathprintnumber@STD@issci\pgfmathresult\relax } \def\pgfmathprintnumber@STD@setparam#1{% - \edef\pgfmathfloat@loc@TMPb{#1}% - \ifx\pgfmathfloat@loc@TMPb\pgfutil@empty - % DEFAULT for lower and upper bound. - \def\pgfmathprintnumber@STD@getlowerbound{% - \c@pgf@counta=\pgfmathfloat@round@precision@orig\relax - \divide\c@pgf@counta by-2\relax - }% - \def\pgfmathprintnumber@STD@upperbound{4}% - \else - \expandafter\pgfutil@in@\expandafter:\expandafter{\pgfmathfloat@loc@TMPb}% - \ifpgfutil@in@ - % we have -4:5 or something like that. - % parse both values: - \def\pgfmathfloat@loc@TMPa##1:##2\relax{% - \edef\pgfmathprintnumber@STD@getlowerbound{% - \noexpand\c@pgf@counta=##1\space - }% - \edef\pgfmathprintnumber@STD@upperbound{##2}% - }% - \expandafter\pgfmathfloat@loc@TMPa\pgfmathfloat@loc@TMPb\relax - \else - % we have just the lower bound: - \def\pgfmathprintnumber@STD@upperbound{4}% - \edef\pgfmathprintnumber@STD@getlowerbound{% - \noexpand\c@pgf@counta=\pgfmathfloat@loc@TMPb\space - }% - \fi - \fi + \edef\pgfmathfloat@loc@TMPb{#1}% + \ifx\pgfmathfloat@loc@TMPb\pgfutil@empty + % DEFAULT for lower and upper bound. + \def\pgfmathprintnumber@STD@getlowerbound{% + \c@pgf@counta=\pgfmathfloat@round@precision@orig\relax + \divide\c@pgf@counta by-2\relax + }% + \def\pgfmathprintnumber@STD@upperbound{4}% + \else + \expandafter\pgfutil@in@\expandafter:\expandafter{\pgfmathfloat@loc@TMPb}% + \ifpgfutil@in@ + % we have -4:5 or something like that. + % parse both values: + \def\pgfmathfloat@loc@TMPa##1:##2\relax{% + \edef\pgfmathprintnumber@STD@getlowerbound{% + \noexpand\c@pgf@counta=##1\space + }% + \edef\pgfmathprintnumber@STD@upperbound{##2}% + }% + \expandafter\pgfmathfloat@loc@TMPa\pgfmathfloat@loc@TMPb\relax + \else + % we have just the lower bound: + \def\pgfmathprintnumber@STD@upperbound{4}% + \edef\pgfmathprintnumber@STD@getlowerbound{% + \noexpand\c@pgf@counta=\pgfmathfloat@loc@TMPb\space + }% + \fi + \fi }% \def\pgfmathprintnumber@STD@issci#1#2e#3\relax{% - \expandafter\ifnum#1<3 - \expandafter\ifnum#3>\pgfmathprintnumber@STD@upperbound\relax - \pgfmathprintnumber@SCI@issci#1#2e#3\relax% - \else - \begingroup - \pgfmathprintnumber@STD@getlowerbound - \ifnum#3<\c@pgf@counta - \pgfmathprintnumber@SCI@issci#1#2e#3\relax% - \else - \pgfmathprintnumber@FIXED@issci#1#2e#3\relax% - \fi - \pgfmath@smuggleone\pgfmathresult - \endgroup - \fi - \else% nan or inf: - \pgfmathfloatrounddisplaystyle#1#2e#3\relax% - \fi + \expandafter\ifnum#1<3 + \expandafter\ifnum#3>\pgfmathprintnumber@STD@upperbound\relax + \pgfmathprintnumber@SCI@issci#1#2e#3\relax% + \else + \begingroup + \pgfmathprintnumber@STD@getlowerbound + \ifnum#3<\c@pgf@counta + \pgfmathprintnumber@SCI@issci#1#2e#3\relax% + \else + \pgfmathprintnumber@FIXED@issci#1#2e#3\relax% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup + \fi + \else% nan or inf: + \pgfmathfloatrounddisplaystyle#1#2e#3\relax% + \fi } \def\pgfmathprintnumber@RELATIVE#1{% - % parse the input: - \pgfmathfloatparsenumber{#1}% - \pgfmathfloat@to@FMeE@style\pgfmathresult - \expandafter\pgfmathprintnumber@RELATIVE@issci\pgfmathresult\relax + % parse the input: + \pgfmathfloatparsenumber{#1}% + \pgfmathfloat@to@FMeE@style\pgfmathresult + \expandafter\pgfmathprintnumber@RELATIVE@issci\pgfmathresult\relax } \def\pgfmathprintnumber@RELATIVE@choice@roundtofixed@warn{% - \pgf@typeout{! Package pgf warning: the use of /pgf/number format/relative is discouraged (buggy). Please use 'relative*' instead or type \string\pgfkeys{/pgf/number format/relative round mode=fixed} into your preamble.}% - \global\let\pgfmathprintnumber@RELATIVE@choice@roundtofixed@warn=\relax + \pgf@typeout{! Package pgf warning: the use of /pgf/number format/relative is discouraged (buggy). Please use 'relative*' instead or type \string\pgfkeys{/pgf/number format/relative round mode=fixed} into your preamble.}% + \global\let\pgfmathprintnumber@RELATIVE@choice@roundtofixed@warn=\relax } \def\pgfmathprintnumber@RELATIVE@issci#1#2e#3\relax{% - \begingroup - % format X / 10^{relative}: - \c@pgf@counta=#3\relax - \advance\c@pgf@counta by-\pgfmathprintnumber@RELATIVE@param\relax - \pgfmathfloatcreate{#1}{#2}{\the\c@pgf@counta}% - % OK, round it to the desired precision: - \if0\pgfmathprintnumber@RELATIVE@choice@roundtofixed - % relative round mode=mantissa - \def\b@round@fixed{0}% - \else - \if1\pgfmathprintnumber@RELATIVE@choice@roundtofixed - % relative round mode=fixed - \def\b@round@fixed{1}% - \else - \pgfmathprintnumber@RELATIVE@choice@roundtofixed@warn - % relative round mode=compatible - \ifnum\c@pgf@counta>0 - % hm. for positive exponents, we should round the - % mantissa rather than only the fractional part. - \def\b@round@fixed{0}% - \else - % negative exponent -> round fixed representation: - \def\b@round@fixed{1}% - \fi - \fi - \fi - \if1\b@round@fixed - % round fixed representation: - \pgfmathfloattofixed\pgfmathresult - \expandafter\pgfmathroundto\expandafter{\pgfmathresult}% - \pgfmathfloatparsenumber{\pgfmathresult}% - \pgfmathfloatroundhasperiodtrue% make sure the code below works: - \else - % round the mantissa: - \expandafter\pgfmathfloatround\expandafter{\pgfmathresult}% - \fi - % Now, compute result * 10^{relative} and format the result: - \pgfmathfloattoregisterstok\pgfmathresult\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E - \ifnum\pgfmathfloat@a@S=0 - \pgfmathfloat@a@E=\pgfmathfloat@a@S % avoid 0 * 10^8 - \else - \advance\pgfmathfloat@a@E by+\pgfmathprintnumber@RELATIVE@param\relax - \fi - \edef\pgfmathresultX{% - \the\pgfmathfloat@a@S - \the\pgfmathfloat@a@Mtok - \ifpgfmathfloatroundhasperiod\else.0\fi - e\the\pgfmathfloat@a@E}% - % call another formatter for the result (but avoid rounding inside of it): - \pgfqkeys{/pgf/number format}{/pgf/number format/every relative, - fixed zerofill=false,% useless here! - sci zerofill=false}% - \ifx\pgfmathprintnumber@issci\pgfmathprintnumber@RELATIVE@issci - \pgfmath@error{The '/pgf/number format/every relative' style should set a valid display style}% - \fi - \let\pgfmathfloat@round@precision@orig=\pgfmathfloat@round@precision - \def\pgfmathfloat@round@precision{9999}% - \expandafter\pgfmathprintnumber@issci\pgfmathresultX\relax% - \pgfmath@smuggleone\pgfmathresult - \endgroup + \begingroup + % format X / 10^{relative}: + \c@pgf@counta=#3\relax + \advance\c@pgf@counta by-\pgfmathprintnumber@RELATIVE@param\relax + \pgfmathfloatcreate{#1}{#2}{\the\c@pgf@counta}% + % OK, round it to the desired precision: + \if0\pgfmathprintnumber@RELATIVE@choice@roundtofixed + % relative round mode=mantissa + \def\b@round@fixed{0}% + \else + \if1\pgfmathprintnumber@RELATIVE@choice@roundtofixed + % relative round mode=fixed + \def\b@round@fixed{1}% + \else + \pgfmathprintnumber@RELATIVE@choice@roundtofixed@warn + % relative round mode=compatible + \ifnum\c@pgf@counta>0 + % hm. for positive exponents, we should round the + % mantissa rather than only the fractional part. + \def\b@round@fixed{0}% + \else + % negative exponent -> round fixed representation: + \def\b@round@fixed{1}% + \fi + \fi + \fi + \if1\b@round@fixed + % round fixed representation: + \pgfmathfloattofixed\pgfmathresult + \expandafter\pgfmathroundto\expandafter{\pgfmathresult}% + \pgfmathfloatparsenumber{\pgfmathresult}% + \pgfmathfloatroundhasperiodtrue% make sure the code below works: + \else + % round the mantissa: + \expandafter\pgfmathfloatround\expandafter{\pgfmathresult}% + \fi + % Now, compute result * 10^{relative} and format the result: + \pgfmathfloattoregisterstok\pgfmathresult\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \ifnum\pgfmathfloat@a@S=0 + \pgfmathfloat@a@E=\pgfmathfloat@a@S % avoid 0 * 10^8 + \else + \advance\pgfmathfloat@a@E by+\pgfmathprintnumber@RELATIVE@param\relax + \fi + \edef\pgfmathresultX{% + \the\pgfmathfloat@a@S + \the\pgfmathfloat@a@Mtok + \ifpgfmathfloatroundhasperiod\else.0\fi + e\the\pgfmathfloat@a@E}% + % call another formatter for the result (but avoid rounding inside of it): + \pgfqkeys{/pgf/number format}{/pgf/number format/every relative, + fixed zerofill=false,% useless here! + sci zerofill=false}% + \ifx\pgfmathprintnumber@issci\pgfmathprintnumber@RELATIVE@issci + \pgfmath@error{The '/pgf/number format/every relative' style should set a valid display style}% + \fi + \let\pgfmathfloat@round@precision@orig=\pgfmathfloat@round@precision + \def\pgfmathfloat@round@precision{9999}% + \expandafter\pgfmathprintnumber@issci\pgfmathresultX\relax% + \pgfmath@smuggleone\pgfmathresult + \endgroup } \def\pgfmathprintnumber@FIXED@RELATIVE#1{% - % parse the input: - \pgfmathfloatparsenumber{#1}% - \pgfmathfloat@to@FMeE@style\pgfmathresult - \expandafter\pgfmathprintnumber@FIXED@RELATIVE@issci\pgfmathresult\relax + % parse the input: + \pgfmathfloatparsenumber{#1}% + \pgfmathfloat@to@FMeE@style\pgfmathresult + \expandafter\pgfmathprintnumber@FIXED@RELATIVE@issci\pgfmathresult\relax } \def\pgfmathprintnumber@FIXED@RELATIVE@issci#1#2e#3\relax{% - \begingroup - \pgfmathfloatcreate{#1}{#2}{#3}% - % we want the first <precision> digits - not the first - % <precision>+1 digits: - \c@pgf@counta=\pgfmathfloat@round@precision\relax - \advance\c@pgf@counta by-1 - \edef\pgfmathfloat@round@precision{\the\c@pgf@counta}% - \pgfmathfloatround{\pgfmathresult}% - \pgfmathfloattoregisterstok\pgfmathresult\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E - \ifnum\pgfmathfloat@a@S=0 - \pgfmathfloat@a@E=\pgfmathfloat@a@S % avoid 0 * 10^8 - \fi - \edef\pgfmathresultX{% - \the\pgfmathfloat@a@S - \the\pgfmathfloat@a@Mtok - \ifpgfmathfloatroundhasperiod\else.0\fi - e\the\pgfmathfloat@a@E}% - \let\pgfmathfloat@round@precision@orig=\pgfmathfloat@round@precision - \pgfmathfloat@usezerofill@fixedfalse - \def\pgfmathfloat@round@precision{9999}% typeset all remaining digits! - \expandafter\pgfmathprintnumber@FIXED@issci\pgfmathresultX\relax% - \pgfmath@smuggleone\pgfmathresult - \endgroup + \begingroup + \pgfmathfloatcreate{#1}{#2}{#3}% + % we want the first <precision> digits - not the first + % <precision>+1 digits: + \c@pgf@counta=\pgfmathfloat@round@precision\relax + \advance\c@pgf@counta by-1 + \edef\pgfmathfloat@round@precision{\the\c@pgf@counta}% + \pgfmathfloatround{\pgfmathresult}% + \pgfmathfloattoregisterstok\pgfmathresult\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \ifnum\pgfmathfloat@a@S=0 + \pgfmathfloat@a@E=\pgfmathfloat@a@S % avoid 0 * 10^8 + \fi + \edef\pgfmathresultX{% + \the\pgfmathfloat@a@S + \the\pgfmathfloat@a@Mtok + \ifpgfmathfloatroundhasperiod\else.0\fi + e\the\pgfmathfloat@a@E}% + \let\pgfmathfloat@round@precision@orig=\pgfmathfloat@round@precision + \pgfmathfloat@usezerofill@fixedfalse + \def\pgfmathfloat@round@precision{9999}% typeset all remaining digits! + \expandafter\pgfmathprintnumber@FIXED@issci\pgfmathresultX\relax% + \pgfmath@smuggleone\pgfmathresult + \endgroup } \def\pgfmathprintnumber@frac#1{% - % parse the input: - \pgfmathfloatparsenumber{#1}% - \pgfmathfloatgetfrac{\pgfmathresult}% - \expandafter\pgfmathprintnumber@frac@formatresult\pgfmathresult + % parse the input: + \pgfmathfloatparsenumber{#1}% + \pgfmathfloatgetfrac{\pgfmathresult}% + \expandafter\pgfmathprintnumber@frac@formatresult\pgfmathresult } \def\pgfmathprintnumber@frac@issci#1#2e#3\relax{% - \pgfmathfloatcreate{#1}{#2}{#3}% - \pgfmathfloatgetfrac{\pgfmathresult}% - \expandafter\pgfmathprintnumber@frac@formatresult\pgfmathresult + \pgfmathfloatcreate{#1}{#2}{#3}% + \pgfmathfloatgetfrac{\pgfmathresult}% + \expandafter\pgfmathprintnumber@frac@formatresult\pgfmathresult } \def\pgfmathprintnumber@frac@formatresult#1#2#3{% - \begingroup - \pgfkeysgetvalue{/pgf/number format/frac TeX}\pgfmathresult - \toks0=\expandafter{\pgfmathresult}% - \def\pgfmathfloat@loc@TMPa{#1}% - \ifx\pgfmathfloat@loc@TMPa\pgfutil@empty - \ifpgfmathprintnumber@showpositive - \def\pgfmathfloat@loc@TMPa{+}% - \fi - \else - \ifx\pgfmathfloat@loc@TMPa-% - \else - \ifx\pgfmathfloat@loc@TMPa+% - \else - \ifpgfmathprintnumber@showpositive - \edef\pgfmathfloat@loc@TMPa{+\pgfmathfloat@loc@TMPa}% - \fi - \def\pgfmathfloat@loc@TMPb{\pgfkeysvalueof{/pgf/number format/frac whole format/.@cmd}}% - \expandafter\pgfmathfloat@loc@TMPb\pgfmathfloat@loc@TMPa\pgfeov - \let\pgfmathfloat@loc@TMPa=\pgfmathresult - \fi - \fi - \fi - \toks1=\expandafter{\pgfmathfloat@loc@TMPa}% - \edef\pgfmathresult{% - \the\toks1 \ifnum#2=0 \else\the\toks0 {#2}{#3}\fi% - }% - \pgfmath@smuggleone\pgfmathresult - \endgroup + \begingroup + \pgfkeysgetvalue{/pgf/number format/frac TeX}\pgfmathresult + \toks0=\expandafter{\pgfmathresult}% + \def\pgfmathfloat@loc@TMPa{#1}% + \ifx\pgfmathfloat@loc@TMPa\pgfutil@empty + \ifpgfmathprintnumber@showpositive + \def\pgfmathfloat@loc@TMPa{+}% + \fi + \else + \ifx\pgfmathfloat@loc@TMPa-% + \else + \ifx\pgfmathfloat@loc@TMPa+% + \else + \ifpgfmathprintnumber@showpositive + \edef\pgfmathfloat@loc@TMPa{+\pgfmathfloat@loc@TMPa}% + \fi + \def\pgfmathfloat@loc@TMPb{\pgfkeysvalueof{/pgf/number format/frac whole format/.@cmd}}% + \expandafter\pgfmathfloat@loc@TMPb\pgfmathfloat@loc@TMPa\pgfeov + \let\pgfmathfloat@loc@TMPa=\pgfmathresult + \fi + \fi + \fi + \toks1=\expandafter{\pgfmathfloat@loc@TMPa}% + \edef\pgfmathresult{% + \the\toks1 \ifnum#2=0 \else\the\toks0 {#2}{#3}\fi% + }% + \pgfmath@smuggleone\pgfmathresult + \endgroup }% % Defines \pgfmathresult to contain three sets of braces containing @@ -1311,179 +1311,179 @@ % % The numerator and denominator is always a number (not empty) \def\pgfmathfloatgetfrac#1{% - \pgfutil@ifundefined{pgfmathfloatmultiply@}{% - \pgfmath@PackageError{Sorry, the number format 'frac' requires '\string\usetikzlibrary{fpu}' (and, optionally, \string\usepackage{fp}) in order to work correctly}% - \edef\pgfmathresult{{#1}{0}{1}}% - }{% - \pgfmathfloatgetfrac@{#1}% - }% + \pgfutil@ifundefined{pgfmathfloatmultiply@}{% + \pgfmath@PackageError{Sorry, the number format 'frac' requires '\string\usetikzlibrary{fpu}' (and, optionally, \string\usepackage{fp}) in order to work correctly}% + \edef\pgfmathresult{{#1}{0}{1}}% + }{% + \pgfmathfloatgetfrac@{#1}% + }% }% \def\pgfmathfloatgetfrac@#1{% - \begingroup - \edef\pgfmathfloat@arg{#1}% - \expandafter\pgfmathfloat@decompose@tok\pgfmathfloat@arg\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E - \def\pgfmathfloat@loc@TMPa{0}% - \ifcase\pgfmathfloat@a@S - % #1 = 0: - \def\pgfmathresult{{0}{0}{1}}% - \or% #1 > 0 - \pgfmathfloat@a@S=1 - \def\pgfmathfloat@loc@TMPa{1}% - \or% #1 < 0 - \pgfmathfloat@a@S=-1 - \def\pgfmathfloat@loc@TMPa{1}% - \or - \edef\pgfmathresult{{}{NaN}{1}}% - \or - \edef\pgfmathresult{{}{\infty}{1}}% - \or - \edef\pgfmathresult{{-}{\infty}{1}}% - \fi - \if1\pgfmathfloat@loc@TMPa - \ifnum\pgfmathfloat@a@E<0 - \def\pgfmathfloat@wholenumber{}% - \else - \pgfmathfloatcreate{1}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% - \pgfmathfloattofixed\pgfmathresult% - \def\pgfmathfloat@loc@TMPa##1.##2\relax{% - \def\pgfmathfloat@wholenumber{##1}% - \pgfmathfloatparsenumber{0.##2}% - }% - \expandafter\pgfmathfloat@loc@TMPa\pgfmathresult\relax - \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@b@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E - \fi - % - \def\pgfmathfloat@loc@TMPa##1.##2\relax{% - \def\pgfmathfloat@mantissa@first{##1}% - \def\pgfmathfloat@mantissa@ltone{0.##2}% - }% - \expandafter\pgfmathfloat@loc@TMPa\the\pgfmathfloat@a@Mtok\relax - % - \def\pgfmathfloat@loc@@to@int##1.##2\relax##3{% - ##3=##1 - \ifdim0.##2pt>0.5pt - \advance##3 by1 - \fi - }% - % - % alias registers names: - \let\pgfmathresultnumerator=\pgfmathfloat@b@S - \let\pgfmathresultdenom=\pgfmathfloat@b@E - % - \pgfkeysgetvalue{/pgf/number format/frac denom}\pgfmath@target@denominator - \ifx\pgfmath@target@denominator\pgfutil@empty - % - \pgfmathfloat@a@E=-\pgfmathfloat@a@E - \ifdim\pgfmathfloat@mantissa@ltone pt=0pt - \def\pgfmathfloat@factor{1}% - \edef\pgfmathfloat@scaled@numerator{\the\pgfmathfloat@a@Mtok}% - \else - % FIXME : this here is numerically instable. - % - % The errors of 1/r are magnified by 10^k which - % doesn't work. - \pgfutil@ifundefined{FPdiv}{% - \pgfmathfloatparsenumber{\pgfmathfloat@mantissa@ltone}% - \pgfmathfloatreciprocal@{\pgfmathresult}% - }{% - % \usepackage{fp}. - % yields higher absolute precision. - \FPmessagesfalse% - \FPdebugfalse% - \FPdiv\pgfmathresult{1}{\pgfmathfloat@mantissa@ltone}% - \pgfmathfloatparsenumber{\pgfmathresult}% - }% - \let\pgfmathfloat@inv=\pgfmathresult - \pgfmathfloatcreate{1}{1.0}{\pgfkeysvalueof{/pgf/number format/frac shift}}% - \let\pgfmathfloat@scalebaseten=\pgfmathresult - \pgfmathfloatmultiply@{\pgfmathfloat@inv}{\pgfmathfloat@scalebaseten}% - \let\pgfmathfloat@factor=\pgfmathresult - % - \expandafter\pgfmathfloatparsenumber\expandafter{\the\pgfmathfloat@a@Mtok}% - \let\pgfmathfloat@loc@TMPa=\pgfmathresult - \pgfmathfloatmultiply@{\pgfmathfloat@factor}{\pgfmathfloat@loc@TMPa}% - \pgfmathfloattofixed\pgfmathresult - \let\pgfmathfloat@scaled@numerator=\pgfmathresult - % - \pgfmathfloattofixed\pgfmathfloat@factor - \expandafter\pgfmathfloat@loc@@to@int\pgfmathresult\relax{\pgfmathfloat@b@S}% - \edef\pgfmathfloat@factor{\the\pgfmathfloat@b@S}% - \fi - % - % - \pgfmathresultdenom=\pgfmathfloat@factor\relax - \pgfmathfloat@multiply@ten@to@the@E\pgfmathresultdenom - % - \expandafter\pgfmathfloat@loc@@to@int\pgfmathfloat@scaled@numerator\relax{\pgfmathresultnumerator}% - %\message{scale = \pgfmathfloat@factor; Z = \the\pgfmathresultnumerator\space ( von \pgfmathfloat@scaled@numerator), N = \the\pgfmathresultdenom.}% - % - \pgfmathgreatestcommondivisor{\pgfmathresultnumerator}{\pgfmathresultdenom}% - \divide\pgfmathresultnumerator by\pgfmathresult\relax - \divide\pgfmathresultdenom by\pgfmathresult\relax - \ifpgfmathprintnumber@frac@warn - \ifnum\pgfmathresultdenom>1000 - \pgfutil@ifundefined{FPdiv}{% - \pgfmathfloattosci@\pgfmathfloat@arg - \pgf@typeout{! Package pgf /pgf/number format/frac warning=true: /pgf/number format/frac of `\pgfmathresult' = \the\pgfmathresultnumerator\space / \the\pgfmathresultdenom\space might be large due to instabilities. Try \string\usepackage{fp} to improve accuracy.}% - }{}% - \fi - \fi - \else - % use target denominator: - \pgfmathresultdenom=\pgfmath@target@denominator\relax - \pgfmathfloatcreate{1}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% - \pgfmathfloattofixed\pgfmathresult - \pgf@xa=\pgfmathresult pt - \multiply\pgf@xa by\pgfmathresultdenom - \edef\pgfmathfloat@scaled@numerator{\pgf@sys@tonumber\pgf@xa}% - \expandafter\pgfmathfloat@loc@@to@int\pgfmathfloat@scaled@numerator\relax{\pgfmathresultnumerator}% - \fi - \ifpgfmathprintnumber@frac@whole - \else - \ifx\pgfmathfloat@wholenumber\pgfutil@empty - \else - \count0=\pgfmathfloat@wholenumber\relax - \multiply\count0 by\pgfmathresultdenom - \advance\pgfmathresultnumerator by\count0 - \def\pgfmathfloat@wholenumber{}% - \fi - \fi - \ifnum\pgfmathfloat@a@S<0 - \edef\pgfmathresult{{-\pgfmathfloat@wholenumber}{\the\pgfmathresultnumerator}{\the\pgfmathresultdenom}}% - \else - \edef\pgfmathresult{{\pgfmathfloat@wholenumber}{\the\pgfmathresultnumerator}{\the\pgfmathresultdenom}}% - \fi - \fi - \pgfmath@smuggleone\pgfmathresult - \endgroup + \begingroup + \edef\pgfmathfloat@arg{#1}% + \expandafter\pgfmathfloat@decompose@tok\pgfmathfloat@arg\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \def\pgfmathfloat@loc@TMPa{0}% + \ifcase\pgfmathfloat@a@S + % #1 = 0: + \def\pgfmathresult{{0}{0}{1}}% + \or% #1 > 0 + \pgfmathfloat@a@S=1 + \def\pgfmathfloat@loc@TMPa{1}% + \or% #1 < 0 + \pgfmathfloat@a@S=-1 + \def\pgfmathfloat@loc@TMPa{1}% + \or + \edef\pgfmathresult{{}{NaN}{1}}% + \or + \edef\pgfmathresult{{}{\infty}{1}}% + \or + \edef\pgfmathresult{{-}{\infty}{1}}% + \fi + \if1\pgfmathfloat@loc@TMPa + \ifnum\pgfmathfloat@a@E<0 + \def\pgfmathfloat@wholenumber{}% + \else + \pgfmathfloatcreate{1}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% + \pgfmathfloattofixed\pgfmathresult% + \def\pgfmathfloat@loc@TMPa##1.##2\relax{% + \def\pgfmathfloat@wholenumber{##1}% + \pgfmathfloatparsenumber{0.##2}% + }% + \expandafter\pgfmathfloat@loc@TMPa\pgfmathresult\relax + \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@b@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \fi + % + \def\pgfmathfloat@loc@TMPa##1.##2\relax{% + \def\pgfmathfloat@mantissa@first{##1}% + \def\pgfmathfloat@mantissa@ltone{0.##2}% + }% + \expandafter\pgfmathfloat@loc@TMPa\the\pgfmathfloat@a@Mtok\relax + % + \def\pgfmathfloat@loc@@to@int##1.##2\relax##3{% + ##3=##1 + \ifdim0.##2pt>0.5pt + \advance##3 by1 + \fi + }% + % + % alias registers names: + \let\pgfmathresultnumerator=\pgfmathfloat@b@S + \let\pgfmathresultdenom=\pgfmathfloat@b@E + % + \pgfkeysgetvalue{/pgf/number format/frac denom}\pgfmath@target@denominator + \ifx\pgfmath@target@denominator\pgfutil@empty + % + \pgfmathfloat@a@E=-\pgfmathfloat@a@E + \ifdim\pgfmathfloat@mantissa@ltone pt=0pt + \def\pgfmathfloat@factor{1}% + \edef\pgfmathfloat@scaled@numerator{\the\pgfmathfloat@a@Mtok}% + \else + % FIXME : this here is numerically instable. + % + % The errors of 1/r are magnified by 10^k which + % doesn't work. + \pgfutil@ifundefined{FPdiv}{% + \pgfmathfloatparsenumber{\pgfmathfloat@mantissa@ltone}% + \pgfmathfloatreciprocal@{\pgfmathresult}% + }{% + % \usepackage{fp}. + % yields higher absolute precision. + \FPmessagesfalse% + \FPdebugfalse% + \FPdiv\pgfmathresult{1}{\pgfmathfloat@mantissa@ltone}% + \pgfmathfloatparsenumber{\pgfmathresult}% + }% + \let\pgfmathfloat@inv=\pgfmathresult + \pgfmathfloatcreate{1}{1.0}{\pgfkeysvalueof{/pgf/number format/frac shift}}% + \let\pgfmathfloat@scalebaseten=\pgfmathresult + \pgfmathfloatmultiply@{\pgfmathfloat@inv}{\pgfmathfloat@scalebaseten}% + \let\pgfmathfloat@factor=\pgfmathresult + % + \expandafter\pgfmathfloatparsenumber\expandafter{\the\pgfmathfloat@a@Mtok}% + \let\pgfmathfloat@loc@TMPa=\pgfmathresult + \pgfmathfloatmultiply@{\pgfmathfloat@factor}{\pgfmathfloat@loc@TMPa}% + \pgfmathfloattofixed\pgfmathresult + \let\pgfmathfloat@scaled@numerator=\pgfmathresult + % + \pgfmathfloattofixed\pgfmathfloat@factor + \expandafter\pgfmathfloat@loc@@to@int\pgfmathresult\relax{\pgfmathfloat@b@S}% + \edef\pgfmathfloat@factor{\the\pgfmathfloat@b@S}% + \fi + % + % + \pgfmathresultdenom=\pgfmathfloat@factor\relax + \pgfmathfloat@multiply@ten@to@the@E\pgfmathresultdenom + % + \expandafter\pgfmathfloat@loc@@to@int\pgfmathfloat@scaled@numerator\relax{\pgfmathresultnumerator}% + %\message{scale = \pgfmathfloat@factor; Z = \the\pgfmathresultnumerator\space ( von \pgfmathfloat@scaled@numerator), N = \the\pgfmathresultdenom.}% + % + \pgfmathgreatestcommondivisor{\pgfmathresultnumerator}{\pgfmathresultdenom}% + \divide\pgfmathresultnumerator by\pgfmathresult\relax + \divide\pgfmathresultdenom by\pgfmathresult\relax + \ifpgfmathprintnumber@frac@warn + \ifnum\pgfmathresultdenom>1000 + \pgfutil@ifundefined{FPdiv}{% + \pgfmathfloattosci@\pgfmathfloat@arg + \pgf@typeout{! Package pgf /pgf/number format/frac warning=true: /pgf/number format/frac of `\pgfmathresult' = \the\pgfmathresultnumerator\space / \the\pgfmathresultdenom\space might be large due to instabilities. Try \string\usepackage{fp} to improve accuracy.}% + }{}% + \fi + \fi + \else + % use target denominator: + \pgfmathresultdenom=\pgfmath@target@denominator\relax + \pgfmathfloatcreate{1}{\the\pgfmathfloat@a@Mtok}{\the\pgfmathfloat@a@E}% + \pgfmathfloattofixed\pgfmathresult + \pgf@xa=\pgfmathresult pt + \multiply\pgf@xa by\pgfmathresultdenom + \edef\pgfmathfloat@scaled@numerator{\pgf@sys@tonumber\pgf@xa}% + \expandafter\pgfmathfloat@loc@@to@int\pgfmathfloat@scaled@numerator\relax{\pgfmathresultnumerator}% + \fi + \ifpgfmathprintnumber@frac@whole + \else + \ifx\pgfmathfloat@wholenumber\pgfutil@empty + \else + \count0=\pgfmathfloat@wholenumber\relax + \multiply\count0 by\pgfmathresultdenom + \advance\pgfmathresultnumerator by\count0 + \def\pgfmathfloat@wholenumber{}% + \fi + \fi + \ifnum\pgfmathfloat@a@S<0 + \edef\pgfmathresult{{-\pgfmathfloat@wholenumber}{\the\pgfmathresultnumerator}{\the\pgfmathresultdenom}}% + \else + \edef\pgfmathresult{{\pgfmathfloat@wholenumber}{\the\pgfmathresultnumerator}{\the\pgfmathresultdenom}}% + \fi + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup }% \def\pgfmathfloat@gobble@until@relax#1\relax{} % computes the greatest common divisor of two integer numbers (in % integer arithmetics). \def\pgfmathgreatestcommondivisor#1#2{% - \begingroup - \count0=#1\relax - \count1=#2\relax - \ifnum\count0=0 - \edef\pgfmathresult{\the\count1}% - \else - \pgfmathgreatestcommondivisor@loop - \edef\pgfmathresult{\the\count0}% - \fi - \pgfmath@smuggleone\pgfmathresult - \endgroup + \begingroup + \count0=#1\relax + \count1=#2\relax + \ifnum\count0=0 + \edef\pgfmathresult{\the\count1}% + \else + \pgfmathgreatestcommondivisor@loop + \edef\pgfmathresult{\the\count0}% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup } \def\pgfmathgreatestcommondivisor@loop{% - \ifnum\count1=0 - \else - \ifnum\count0>\count1 - \advance\count0 by-\count1 - \else - \advance\count1 by-\count0 - \fi - \expandafter\pgfmathgreatestcommondivisor@loop - \fi + \ifnum\count1=0 + \else + \ifnum\count0>\count1 + \advance\count0 by-\count1 + \else + \advance\count1 by-\count0 + \fi + \expandafter\pgfmathgreatestcommondivisor@loop + \fi }% % multiplies a TeX register by 10^E where E is stored in the register @@ -1491,146 +1491,146 @@ % % #1 a TeX register \def\pgfmathfloat@multiply@ten@to@the@E#1{% - \ifnum\pgfmathfloat@a@E>0 - \multiply#1 by10 - \advance\pgfmathfloat@a@E by-1 - \def\pgfmathfloat@multiply@ten@to@the@E@next{\pgfmathfloat@multiply@ten@to@the@E{#1}}% - \else - \let\pgfmathfloat@multiply@ten@to@the@E@next=\relax% - \fi - \pgfmathfloat@multiply@ten@to@the@E@next + \ifnum\pgfmathfloat@a@E>0 + \multiply#1 by10 + \advance\pgfmathfloat@a@E by-1 + \def\pgfmathfloat@multiply@ten@to@the@E@next{\pgfmathfloat@multiply@ten@to@the@E{#1}}% + \else + \let\pgfmathfloat@multiply@ten@to@the@E@next=\relax% + \fi + \pgfmathfloat@multiply@ten@to@the@E@next }% \def\pgfmathprintnumber@INT@TRUNC#1{% - \pgfmathfloatparsenumber{#1}% - \pgfmathfloat@to@FMeE@style\pgfmathresult - \expandafter\pgfmathprintnumber@INT@TRUNC@issci\pgfmathresult\relax + \pgfmathfloatparsenumber{#1}% + \pgfmathfloat@to@FMeE@style\pgfmathresult + \expandafter\pgfmathprintnumber@INT@TRUNC@issci\pgfmathresult\relax } \def\pgfmathprintnumber@INT@TRUNC@impl#1.#2\relax#3#4e#5\relax{% - \pgfmathfloatroundhasperiodfalse - \pgfmathprintnumber@fixed@style{#1}#3#4e#5\relax% + \pgfmathfloatroundhasperiodfalse + \pgfmathprintnumber@fixed@style{#1}#3#4e#5\relax% } \def\pgfmathprintnumber@INT@TRUNC@issci#1#2e#3\relax{% - \ifnum#1<3\relax - \pgfmathfloatcreate{#1}{#2}{#3}% - \pgfmathfloattofixed{\pgfmathresult}% - \expandafter\pgfmathprintnumber@INT@TRUNC@impl\pgfmathresult\relax#1#2e#3\relax - \else - \pgfmathfloatrounddisplaystyle#1#2e#3\relax% - \fi + \ifnum#1<3\relax + \pgfmathfloatcreate{#1}{#2}{#3}% + \pgfmathfloattofixed{\pgfmathresult}% + \expandafter\pgfmathprintnumber@INT@TRUNC@impl\pgfmathresult\relax#1#2e#3\relax + \else + \pgfmathfloatrounddisplaystyle#1#2e#3\relax% + \fi } % Invokes '#2' if '#1' is actually an integer or '#3' if not. % -% As a side-effect, \pgfretval will be set to the integer value if it +% As a side--effect, \pgfretval will be set to the integer value if it % actually *is* an integer. Otherwise, \pgfretval will contain the % parsed floating point number. % % #1 a number constant (not necessarily a parsed float). \def\pgfmathifisint#1#2#3{% - \gdef\pgfmathfloatisint@@{0}% - \begingroup - \pgfmathfloatparsenumber{#1}% - \let\pgfretval\pgfmathresult - \pgfmathfloat@to@FMeE@style\pgfmathresult - \expandafter\pgfmathfloatisint@\pgfmathresult\relax - \pgfmath@smuggleone\pgfretval - \endgroup - \if1\pgfmathfloatisint@@ #2\else #3\fi + \gdef\pgfmathfloatisint@@{0}% + \begingroup + \pgfmathfloatparsenumber{#1}% + \let\pgfretval\pgfmathresult + \pgfmathfloat@to@FMeE@style\pgfmathresult + \expandafter\pgfmathfloatisint@\pgfmathresult\relax + \pgfmath@smuggleone\pgfretval + \endgroup + \if1\pgfmathfloatisint@@ #2\else #3\fi }% \def\pgfmathfloatisint@#1#2e#3\relax{% - \ifnum#1<3\relax - \pgfmathfloatcreate{#1}{#2}{#3}% - \pgfmathfloattofixed{\pgfmathresult}% - \def\pgfmathfloat@round@precision{6}% - \expandafter\pgfmathroundto\expandafter{\pgfmathresult}% - \ifpgfmathfloatroundhasperiod - \else - \let\pgfretval\pgfmathresult% - \gdef\pgfmathfloatisint@@{1}% - \fi - \fi + \ifnum#1<3\relax + \pgfmathfloatcreate{#1}{#2}{#3}% + \pgfmathfloattofixed{\pgfmathresult}% + \def\pgfmathfloat@round@precision{6}% + \expandafter\pgfmathroundto\expandafter{\pgfmathresult}% + \ifpgfmathfloatroundhasperiod + \else + \let\pgfretval\pgfmathresult% + \gdef\pgfmathfloatisint@@{1}% + \fi + \fi } \def\pgfmathprintnumber@INT@DETECT#1{% - \pgfmathfloatparsenumber{#1}% - \pgfmathfloat@to@FMeE@style\pgfmathresult - \expandafter\pgfmathprintnumber@INT@DETECT@issci\pgfmathresult\relax + \pgfmathfloatparsenumber{#1}% + \pgfmathfloat@to@FMeE@style\pgfmathresult + \expandafter\pgfmathprintnumber@INT@DETECT@issci\pgfmathresult\relax } \def\pgfmathprintnumber@INT@DETECT@issci#1#2e#3\relax{% - \begingroup - \ifnum#1<3\relax - \pgfmathfloatcreate{#1}{#2}{#3}% - \pgfmathfloattofixed{\pgfmathresult}% - \let\pgfmathfloat@round@precision@=\pgfmathfloat@round@precision - \def\pgfmathfloat@round@precision{6}% - \expandafter\pgfmathroundto\expandafter{\pgfmathresult}% - \let\pgfmathfloat@round@precision=\pgfmathfloat@round@precision@ - \ifpgfmathfloatroundhasperiod - \pgfmathprintnumber@SCI@issci#1#2e#3\relax - \else - \expandafter\pgfmathprintnumber@fixed@style\expandafter{\pgfmathresult}#1#2e#3\relax - \fi - \else - \pgfmathfloatrounddisplaystyle#1#2e#3\relax% - \fi - \pgfmath@smuggleone\pgfmathresult - \endgroup + \begingroup + \ifnum#1<3\relax + \pgfmathfloatcreate{#1}{#2}{#3}% + \pgfmathfloattofixed{\pgfmathresult}% + \let\pgfmathfloat@round@precision@=\pgfmathfloat@round@precision + \def\pgfmathfloat@round@precision{6}% + \expandafter\pgfmathroundto\expandafter{\pgfmathresult}% + \let\pgfmathfloat@round@precision=\pgfmathfloat@round@precision@ + \ifpgfmathfloatroundhasperiod + \pgfmathprintnumber@SCI@issci#1#2e#3\relax + \else + \expandafter\pgfmathprintnumber@fixed@style\expandafter{\pgfmathresult}#1#2e#3\relax + \fi + \else + \pgfmathfloatrounddisplaystyle#1#2e#3\relax% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup } \def\pgfmathprintnumber@FIXED#1{% - \pgfmathfloatparsenumber{#1}% - \pgfmathfloat@to@FMeE@style\pgfmathresult - \expandafter\pgfmathprintnumber@FIXED@issci\pgfmathresult\relax + \pgfmathfloatparsenumber{#1}% + \pgfmathfloat@to@FMeE@style\pgfmathresult + \expandafter\pgfmathprintnumber@FIXED@issci\pgfmathresult\relax } \def\pgfmathprintnumber@FIXED@issci#1#2e#3\relax{% - \begingroup - \ifnum#1<3 - \pgfmathfloatcreate{#1}{#2}{#3}% - \pgfmathfloattofixed{\pgfmathresult}% - \ifpgfmathfloat@usezerofill@fixed - \expandafter\pgfmathroundtozerofill\expandafter{\pgfmathresult}% - \else - \expandafter\pgfmathroundto\expandafter{\pgfmathresult}% - \fi - \ifpgfmathfloatroundmayneedrenormalize - \pgfmathfloat@a@E=#3\relax - \advance\pgfmathfloat@a@E by1 - \edef\pgfmathfloat@loc@TMPb{\noexpand\pgfmathprintnumber@fixed@style{\pgfmathresult}#1#2e\the\pgfmathfloat@a@E}% - \pgfmathfloat@loc@TMPb\relax% - \else - \expandafter\pgfmathprintnumber@fixed@style\expandafter{\pgfmathresult}#1#2e#3\relax% - \fi - \else% nan or inf: - \pgfmathfloatrounddisplaystyle#1#2e#3\relax% - \fi - \pgfmath@smuggleone\pgfmathresult - \endgroup + \begingroup + \ifnum#1<3 + \pgfmathfloatcreate{#1}{#2}{#3}% + \pgfmathfloattofixed{\pgfmathresult}% + \ifpgfmathfloat@usezerofill@fixed + \expandafter\pgfmathroundtozerofill\expandafter{\pgfmathresult}% + \else + \expandafter\pgfmathroundto\expandafter{\pgfmathresult}% + \fi + \ifpgfmathfloatroundmayneedrenormalize + \pgfmathfloat@a@E=#3\relax + \advance\pgfmathfloat@a@E by1 + \edef\pgfmathfloat@loc@TMPb{\noexpand\pgfmathprintnumber@fixed@style{\pgfmathresult}#1#2e\the\pgfmathfloat@a@E}% + \pgfmathfloat@loc@TMPb\relax% + \else + \expandafter\pgfmathprintnumber@fixed@style\expandafter{\pgfmathresult}#1#2e#3\relax% + \fi + \else% nan or inf: + \pgfmathfloatrounddisplaystyle#1#2e#3\relax% + \fi + \pgfmath@smuggleone\pgfmathresult + \endgroup } \def\pgfmathprintnumber@SCI#1{% - \pgfmathfloatparsenumber{#1}% - \pgfmathfloat@to@FMeE@style\pgfmathresult - \expandafter\pgfmathprintnumber@SCI@issci\pgfmathresult\relax + \pgfmathfloatparsenumber{#1}% + \pgfmathfloat@to@FMeE@style\pgfmathresult + \expandafter\pgfmathprintnumber@SCI@issci\pgfmathresult\relax } \def\pgfmathprintnumber@SCI@issci#1#2e#3\relax{% - \begingroup - \pgfmathfloatcreate{#1}{#2}{#3}% - \edef\pgfmathfloat@round@precision{\pgfmathprintnumber@sci@precision}% - \ifpgfmathfloat@usezerofill@sci - \pgfmathfloatroundzerofill{\pgfmathresult}% - \else - \pgfmathfloatround{\pgfmathresult}% - \fi - \pgfmathfloat@to@FMeE@style\pgfmathresult - \expandafter\pgfmathfloatrounddisplaystyle\pgfmathresult\relax - \pgfmath@smuggleone\pgfmathresult - \endgroup + \begingroup + \pgfmathfloatcreate{#1}{#2}{#3}% + \edef\pgfmathfloat@round@precision{\pgfmathprintnumber@sci@precision}% + \ifpgfmathfloat@usezerofill@sci + \pgfmathfloatroundzerofill{\pgfmathresult}% + \else + \pgfmathfloatround{\pgfmathresult}% + \fi + \pgfmathfloat@to@FMeE@style\pgfmathresult + \expandafter\pgfmathfloatrounddisplaystyle\pgfmathresult\relax + \pgfmath@smuggleone\pgfmathresult + \endgroup } % Prints argument #1 using the current pretty printer environment (all @@ -1638,89 +1638,89 @@ % % You may specify optional arguments with \pgfmathprintnumber[...]. \def\pgfmathprintnumber{% - % \protect allows to supply \pgfmathprintnumber inside of latex - % captions. The \csname yields \relax in case protect is undefined. - \pgf@texdist@protect\pgfmathprintnumber@protected + % \protect allows to supply \pgfmathprintnumber inside of latex + % captions. The \csname yields \relax in case protect is undefined. + \pgf@texdist@protect\pgfmathprintnumber@protected }% \def\pgfmathprintnumber@protected{% - \pgfutil@ifnextchar[% - {\pgfmathprintnumber@OPT}% - {\pgfmathprintnumber@noopt}% + \pgfutil@ifnextchar[% + {\pgfmathprintnumber@OPT}% + {\pgfmathprintnumber@noopt}% } \def\pgfmathprintnumber@noopt#1{% - \pgfmathprintnumber@{#1}% - \ifpgfmathprintnumber@assumemathmode - \pgfmathresult - \else - \pgfutilensuremath{\pgfmathresult}% - \fi + \pgfmathprintnumber@{#1}% + \ifpgfmathprintnumber@assumemathmode + \pgfmathresult + \else + \pgfutilensuremath{\pgfmathresult}% + \fi }% \def\pgfmathprintnumber@OPT[#1]#2{% - \begingroup - \pgfqkeys{/pgf/number format}{#1}% - \pgfmathprintnumber@{#2}% - \ifpgfmathprintnumber@assumemathmode - \pgfmathresult - \else - \pgfutilensuremath{\pgfmathresult}% - \fi - \endgroup + \begingroup + \pgfqkeys{/pgf/number format}{#1}% + \pgfmathprintnumber@{#2}% + \ifpgfmathprintnumber@assumemathmode + \pgfmathresult + \else + \pgfutilensuremath{\pgfmathresult}% + \fi + \endgroup }% % As \pgfmathprintnumber, but it produces its output into the second % argument. \def\pgfmathprintnumberto{% - \pgfutil@ifnextchar[% - {\pgfmathprintnumberto@OPT}% - {\pgfmathprintnumberto@noopt}% + \pgfutil@ifnextchar[% + {\pgfmathprintnumberto@OPT}% + {\pgfmathprintnumberto@noopt}% } \def\pgfmathprintnumberto@noopt#1#2{% - \begingroup - \pgfmathprintnumber@{#1}% - \ifpgfmathprintnumber@assumemathmode - \global\let\pgfmathfloat@glob@TMP=\pgfmathresult - \else - \toks0=\expandafter{\pgfmathresult}% - \xdef\pgfmathfloat@glob@TMP{\noexpand\pgfutilensuremath{\the\toks0 }}% - \fi - \endgroup - \let#2=\pgfmathfloat@glob@TMP + \begingroup + \pgfmathprintnumber@{#1}% + \ifpgfmathprintnumber@assumemathmode + \global\let\pgfmathfloat@glob@TMP=\pgfmathresult + \else + \toks0=\expandafter{\pgfmathresult}% + \xdef\pgfmathfloat@glob@TMP{\noexpand\pgfutilensuremath{\the\toks0 }}% + \fi + \endgroup + \let#2=\pgfmathfloat@glob@TMP }% \def\pgfmathprintnumberto@OPT[#1]#2#3{% - \begingroup - \pgfqkeys{/pgf/number format}{#1}% - \pgfmathprintnumber@{#2}% - \ifpgfmathprintnumber@assumemathmode - \global\let\pgfmathfloat@glob@TMP=\pgfmathresult - \else - \toks0=\expandafter{\pgfmathresult}% - \xdef\pgfmathfloat@glob@TMP{\noexpand\pgfutilensuremath{\the\toks0 }}% - \fi - \endgroup - \let#3=\pgfmathfloat@glob@TMP + \begingroup + \pgfqkeys{/pgf/number format}{#1}% + \pgfmathprintnumber@{#2}% + \ifpgfmathprintnumber@assumemathmode + \global\let\pgfmathfloat@glob@TMP=\pgfmathresult + \else + \toks0=\expandafter{\pgfmathresult}% + \xdef\pgfmathfloat@glob@TMP{\noexpand\pgfutilensuremath{\the\toks0 }}% + \fi + \endgroup + \let#3=\pgfmathfloat@glob@TMP }% - + % Changes the current number pretty printer to #1. % % #1 is the macro base name for the pretty print routine, without the % leading '\'. \def\pgfmath@set@number@printer#1{% - \expandafter\let\expandafter\pgfmathprintnumber@\csname #1\endcsname - \expandafter\let\expandafter\pgfmathprintnumber@issci\csname #1@issci\endcsname + \expandafter\let\expandafter\pgfmathprintnumber@\csname #1\endcsname + \expandafter\let\expandafter\pgfmathprintnumber@issci\csname #1@issci\endcsname } \pgfkeys{/pgf/number format/std} %%%%%%%%%%%%%%%%%%%%%%%%%% -% +% % IMPL % %%%%%%%%%%%%%%%%%%%%%%%%%% -% equals only itself when compared with \ifx: +% equals only itsself when compared with \ifx: \def\pgfmathfloat@EOI{\pgfmathfloat@EOI}% % Re-use counters internally. @@ -1734,33 +1734,34 @@ \newif\ifpgfmathround@impl@PREPERIOD@is@negative@zero % PRECONDITION: -% \ifpgfmathfloatroundhasperiod=\iftrue holds outside of the current TeX group. +% \ifpgfmathfloatroundhasperiod=\iftrue holds outside of the +% current TeX group. % % POSTCONDITION: % \ifpgfmathfloatroundhasperiod will be set correctly AFTER the % current TeX group. % \ifpgfmathfloatroundmayneedrenormalize will be set globally \def\pgfmathroundto@impl#1{% - \edef\pgfmathround@input{#1}% - \global\pgfmathfloatroundmayneedrenormalizefalse - \pgfmathfloat@tmptoks={}% - \let\pgfmathround@next=\pgfutil@empty - \let\pgfmathround@cur=\pgfutil@empty - \let\pgfmathresult=\pgfutil@empty - \expandafter\c@pgfmathroundto@prec\pgfmathfloat@round@precision\relax - \c@pgfmathroundto@lastzeros=0 - \c@pgfmathroundto@offsetbehindperiod=-1 % means: no period found so far - \pgfmathround@impl@PREPERIOD@is@negative@zerotrue - \expandafter\pgfmathroundto@impl@ITERATE@NODOT@firstcall\pgfmathround@input\pgfmathfloat@EOI + \edef\pgfmathround@input{#1}% + \global\pgfmathfloatroundmayneedrenormalizefalse + \pgfmathfloat@tmptoks={}% + \let\pgfmathround@next=\pgfutil@empty + \let\pgfmathround@cur=\pgfutil@empty + \let\pgfmathresult=\pgfutil@empty + \expandafter\c@pgfmathroundto@prec\pgfmathfloat@round@precision\relax + \c@pgfmathroundto@lastzeros=0 + \c@pgfmathroundto@offsetbehindperiod=-1 % means: no period found so far + \pgfmathround@impl@PREPERIOD@is@negative@zerotrue + \expandafter\pgfmathroundto@impl@ITERATE@NODOT@firstcall\pgfmathround@input\pgfmathfloat@EOI } % \pgfmathroundto implementation in WORDS: % -% coarse idea: -% 1. collect all digits/sign BEFORE the first period in REVERSE order -% 2. then, collect UP TO \prec digits after the period in REVERSE order +% coarse idea: +% 1. collect all digits/sign BEFORE the first period in REVERSE order +% 2. then, collect UP TO \prec digits after the period in REVERSE order % Steps 1. and 2. lead to the digit [sign] sequence -% "x_{-p} x_{-p+1} ... x_{-2} x_{-1} '.' x_0 ... x_r" +% "x_{-p} x_{-p+1} ... x_{-2} x_{-1} '.' x_0 ... x_r" % where 'r' is the total number of digits. The integer 'p' denotes the % ACTUALLY collected number of digits behind the period. % @@ -1773,31 +1774,31 @@ % 2. The case with p=k and x_{-p-1} is a further, next character. % % Then, for case 1.): -% discard any unused zeros at the tail of our number (possibly -% including the period) +% discard any unused zeros at the tail of our number (possibly +% including the period) % % and in case 2.) % if NEXT DIGIT < 5: % do exactly the same as in case 1.) above and discard any % following digits. % else -% let q := -p -% while(x_q = 9 and q<=r ) -% if q>=0 -% set x_q = '0' -% else -% discard digit x_q='9' -% fi -% ++q -% if q=0 -% discard the period -% fi -% end while -% if q = r+1 -% insert a '1' -% else -% set x_q = x_q + 1 -% fi +% let q := -p +% while(x_q = 9 and q<=r ) +% if q>=0 +% set x_q = '0' +% else +% discard digit x_q='9' +% fi +% ++q +% if q=0 +% discard the period +% fi +% end while +% if q = r+1 +% insert a '1' +% else +% set x_q = x_q + 1 +% fi % fi % % All these loops have been implemented in spaghetti-code below. @@ -1806,22 +1807,22 @@ % counting logic). % % Some comments: -% - The token register \pgfmathfloat@tmptoks is used to accumulate the REVERSED input number. -% - \pgfmathfloat@EOI always denotes 'END OF INPUT'. -% - in the second stage, we need to reverse \pgfmathfloat@tmptoks. -% This is -- again -- done with \pgfmathfloat@tmptoks. +% - The token register \pgfmathfloat@tmptoks is used to accumulate the REVERSED input number. +% - \pgfmathfloat@EOI always denotes 'END OF INPUT'. +% - in the second stage, we need to reverse \pgfmathfloat@tmptoks. +% This is -again- done with \pgfmathfloat@tmptoks. \def\pgfmathroundto@impl@discard@period#1.#2\pgfmathfloat@EOI{% - \pgfmathfloatroundhasperiodfalse - \aftergroup\pgfmathfloatroundhasperiodfalse - \def\pgfmathresult{#1}% + \pgfmathfloatroundhasperiodfalse + \aftergroup\pgfmathfloatroundhasperiodfalse + \def\pgfmathresult{#1}% } \def\pgfmathroundto@impl@gobble@rest@and@start#1\pgfmathfloat@EOI{% - \pgfmathroundto@impl@start + \pgfmathroundto@impl@start } \def\pgfmathroundto@impl@gobble@and@start\pgfmathfloat@EOI{% - \pgfmathroundto@impl@start + \pgfmathroundto@impl@start } \def\pgfmathroundto@impl@gobble\pgfmathfloat@EOI{}% \def\pgfmathroundto@impl@gobble@rest#1\pgfmathfloat@EOI{}% @@ -1829,281 +1830,281 @@ % This method will be invoked as soon as the first step, the reverse % collection of up to PREC digits after the period, has finished. \def\pgfmathroundto@impl@start{% - \ifx\pgfmathround@next\pgfutil@empty - \ifnum\c@pgfmathroundto@offsetbehindperiod<0 - % no period found. - \ifpgfmathfloat@fixed@digits@after@period - \ifnum\c@pgfmathroundto@prec=0\relax - \pgfmathfloatroundhasperiodfalse - \aftergroup\pgfmathfloatroundhasperiodfalse - \edef\pgfmathresult{\pgfmathround@input}% - \else - \pgfmathfloat@tmptoks=\expandafter{\pgfmathround@input.}% - \c@pgfmathroundto@offsetbehindperiod=\c@pgfmathroundto@prec - \pgfmathroundto@impl@append@zeros - \edef\pgfmathresult{\the\pgfmathfloat@tmptoks}% - \fi - \else - \pgfmathfloatroundhasperiodfalse - \aftergroup\pgfmathfloatroundhasperiodfalse - \edef\pgfmathresult{\pgfmathround@input}% - \fi - \else - %\ifnum\c@pgfmathroundto@offsetbehindperiod>\c@pgfmathroundto@prec - % \pgfmath@error{Internal logic error in pgfmathroundto at [I] - should not have happened!?}{}% - %\fi - \pgfmathroundto@impl@finish@with@truncation - \fi - \else - %\ifnum\c@pgfmathroundto@offsetbehindperiod=\c@pgfmathroundto@prec - %\else - % \pgfmath@error{Internal logic error in pgfmathroundto at [II] - should not have happened!? I have offsetbehindperiod=\the\c@pgfmathroundto@offsetbehindperiod and prec = \the\c@pgfmathroundto@prec}{}% - %\fi - \expandafter\ifnum\pgfmathround@next<5\relax - \pgfmathroundto@impl@finish@with@truncation - \else - \multiply\c@pgfmathroundto@offsetbehindperiod by-1 - \expandafter\pgfmathroundto@impl@ADD@ONE\the\pgfmathfloat@tmptoks\pgfmathfloat@EOI - \fi - \fi -} - + \ifx\pgfmathround@next\pgfutil@empty + \ifnum\c@pgfmathroundto@offsetbehindperiod<0 + % no period found. + \ifpgfmathfloat@fixed@digits@after@period + \ifnum\c@pgfmathroundto@prec=0\relax + \pgfmathfloatroundhasperiodfalse + \aftergroup\pgfmathfloatroundhasperiodfalse + \edef\pgfmathresult{\pgfmathround@input}% + \else + \pgfmathfloat@tmptoks=\expandafter{\pgfmathround@input.}% + \c@pgfmathroundto@offsetbehindperiod=\c@pgfmathroundto@prec + \pgfmathroundto@impl@append@zeros + \edef\pgfmathresult{\the\pgfmathfloat@tmptoks}% + \fi + \else + \pgfmathfloatroundhasperiodfalse + \aftergroup\pgfmathfloatroundhasperiodfalse + \edef\pgfmathresult{\pgfmathround@input}% + \fi + \else + %\ifnum\c@pgfmathroundto@offsetbehindperiod>\c@pgfmathroundto@prec + % \pgfmath@error{Internal logic error in pgfmathroundto at [I] - should not have happened!?}{}% + %\fi + \pgfmathroundto@impl@finish@with@truncation + \fi + \else + %\ifnum\c@pgfmathroundto@offsetbehindperiod=\c@pgfmathroundto@prec + %\else + % \pgfmath@error{Internal logic error in pgfmathroundto at [II] - should not have happened!? I have offsetbehindperiod=\the\c@pgfmathroundto@offsetbehindperiod and prec = \the\c@pgfmathroundto@prec}{}% + %\fi + \expandafter\ifnum\pgfmathround@next<5\relax + \pgfmathroundto@impl@finish@with@truncation + \else + \multiply\c@pgfmathroundto@offsetbehindperiod by-1 + \expandafter\pgfmathroundto@impl@ADD@ONE\the\pgfmathfloat@tmptoks\pgfmathfloat@EOI + \fi + \fi +} + % takes the current input and decides whether trailing zeros shall be % discarded or more zeros need to be filled in. \def\pgfmathroundto@impl@finish@with@truncation{% - \ifpgfmathfloat@fixed@digits@after@period - \expandafter\pgfmathroundto@impl@REVERSE\the\pgfmathfloat@tmptoks\pgfmathfloat@EOI - \ifnum\c@pgfmathroundto@lastzeros=\c@pgfmathroundto@offsetbehindperiod - \ifpgfmathround@impl@PREPERIOD@is@negative@zero - % write '0.0000' instead of '-0.0000': - \expandafter\pgfmathroundto@impl@discard@minus\the\pgfmathfloat@tmptoks\pgfmathfloat@EOI - \fi - \fi - \ifnum\c@pgfmathroundto@prec=0\relax - \expandafter\pgfmathroundto@impl@discard@period\the\pgfmathfloat@tmptoks\pgfmathfloat@EOI - \else - \advance\c@pgfmathroundto@prec by-\c@pgfmathroundto@offsetbehindperiod - \c@pgfmathroundto@offsetbehindperiod=\c@pgfmathroundto@prec - \pgfmathroundto@impl@append@zeros - \edef\pgfmathresult{\the\pgfmathfloat@tmptoks}% - \fi - \else - \pgfmathroundto@impl@discard@suffix@zeros - \fi + \ifpgfmathfloat@fixed@digits@after@period + \expandafter\pgfmathroundto@impl@REVERSE\the\pgfmathfloat@tmptoks\pgfmathfloat@EOI + \ifnum\c@pgfmathroundto@lastzeros=\c@pgfmathroundto@offsetbehindperiod + \ifpgfmathround@impl@PREPERIOD@is@negative@zero + % write '0.0000' instead of '-0.0000': + \expandafter\pgfmathroundto@impl@discard@minus\the\pgfmathfloat@tmptoks\pgfmathfloat@EOI + \fi + \fi + \ifnum\c@pgfmathroundto@prec=0\relax + \expandafter\pgfmathroundto@impl@discard@period\the\pgfmathfloat@tmptoks\pgfmathfloat@EOI + \else + \advance\c@pgfmathroundto@prec by-\c@pgfmathroundto@offsetbehindperiod + \c@pgfmathroundto@offsetbehindperiod=\c@pgfmathroundto@prec + \pgfmathroundto@impl@append@zeros + \edef\pgfmathresult{\the\pgfmathfloat@tmptoks}% + \fi + \else + \pgfmathroundto@impl@discard@suffix@zeros + \fi } \def\pgfmathroundto@impl@discard@minus-#1\pgfmathfloat@EOI{\pgfmathfloat@tmptoks={#1}}% % appends \c@pgfmathroundto@offsetbehindperiod zeros at the end of \pgfmathfloat@tmptoks. \def\pgfmathroundto@impl@append@zeros{% - \ifnum\c@pgfmathroundto@offsetbehindperiod>0 - \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}% - \advance\c@pgfmathroundto@offsetbehindperiod by-1 - \pgfmathroundto@impl@append@zeros - \fi + \ifnum\c@pgfmathroundto@offsetbehindperiod>0 + \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}% + \advance\c@pgfmathroundto@offsetbehindperiod by-1 + \pgfmathroundto@impl@append@zeros + \fi } \def\pgfmathroundto@impl@ADD@ONE{% - \pgfmathfloat@tmptoks={}% no longer needed because its old value will be read from input - \pgfmathroundto@impl@ADD@ONE@ITERATE + \pgfmathfloat@tmptoks={}% no longer needed because its old value will be read from input + \pgfmathroundto@impl@ADD@ONE@ITERATE } \def\pgfmathroundto@impl@ADD@ONE@ITERATE{% - \pgfutil@ifnextchar\pgfmathfloat@EOI{% - \global\pgfmathfloatroundmayneedrenormalizetrue - \edef\pgfmathresult{1\the\pgfmathfloat@tmptoks}% - \pgfmathroundto@impl@gobble - }{% - \pgfutil@ifnextchar.{% - \ifnum\c@pgfmathroundto@prec=0 - % silently discard period in special case precision=0 - \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ADD@ONE@ITERATE@gobble@dot}% - \else - \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ADD@ONE@NEXT@COLLECT}% - \fi - \pgfmathround@nextcmd - }{% - \pgfutil@ifnextchar+{% - \global\pgfmathfloatroundmayneedrenormalizetrue - \edef\pgfmathresult{1\the\pgfmathfloat@tmptoks}% - \pgfmathroundto@impl@gobble@rest - }{% - \pgfutil@ifnextchar-{% - \global\pgfmathfloatroundmayneedrenormalizetrue - \edef\pgfmathresult{-1\the\pgfmathfloat@tmptoks}% - \pgfmathroundto@impl@gobble@rest - }{% - \pgfmathroundto@impl@ADD@ONE@NEXT - }% - }% - }% - }% + \pgfutil@ifnextchar\pgfmathfloat@EOI{% + \global\pgfmathfloatroundmayneedrenormalizetrue + \edef\pgfmathresult{1\the\pgfmathfloat@tmptoks}% + \pgfmathroundto@impl@gobble + }{% + \pgfutil@ifnextchar.{% + \ifnum\c@pgfmathroundto@prec=0 + % silently discard period in special case precision=0 + \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ADD@ONE@ITERATE@gobble@dot}% + \else + \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ADD@ONE@NEXT@COLLECT}% + \fi + \pgfmathround@nextcmd + }{% + \pgfutil@ifnextchar+{% + \global\pgfmathfloatroundmayneedrenormalizetrue + \edef\pgfmathresult{1\the\pgfmathfloat@tmptoks}% + \pgfmathroundto@impl@gobble@rest + }{% + \pgfutil@ifnextchar-{% + \global\pgfmathfloatroundmayneedrenormalizetrue + \edef\pgfmathresult{-1\the\pgfmathfloat@tmptoks}% + \pgfmathroundto@impl@gobble@rest + }{% + \pgfmathroundto@impl@ADD@ONE@NEXT + }% + }% + }% + }% } \def\pgfmathroundto@impl@ADD@ONE@ITERATE@gobble@dot.{% - \pgfmathfloatroundhasperiodfalse - \aftergroup\pgfmathfloatroundhasperiodfalse - \pgfmathroundto@impl@ADD@ONE@ITERATE + \pgfmathfloatroundhasperiodfalse + \aftergroup\pgfmathfloatroundhasperiodfalse + \pgfmathroundto@impl@ADD@ONE@ITERATE } \def\pgfmathroundto@impl@ADD@ONE@NEXT@COLLECT#1{% - \pgfmathfloat@tmptoks=\expandafter{\expandafter#1\the\pgfmathfloat@tmptoks}% - \pgfmathroundto@impl@ADD@ONE@ITERATE + \pgfmathfloat@tmptoks=\expandafter{\expandafter#1\the\pgfmathfloat@tmptoks}% + \pgfmathroundto@impl@ADD@ONE@ITERATE } \def\pgfmathroundto@impl@ADD@ONE@NEXT#1{% - \ifnum#1=9 - \ifnum\c@pgfmathroundto@offsetbehindperiod<0 - \ifpgfmathfloat@fixed@digits@after@period - \pgfmathfloat@tmptoks=\expandafter{\expandafter0\the\pgfmathfloat@tmptoks}% - \else - % silently DROP digit - \fi - \else - \pgfmathfloat@tmptoks=\expandafter{\expandafter0\the\pgfmathfloat@tmptoks}% - \fi - \advance\c@pgfmathroundto@offsetbehindperiod by1 - \ifnum\c@pgfmathroundto@offsetbehindperiod=0 - \ifpgfmathfloat@fixed@digits@after@period - \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ADD@ONE@ITERATE}% - \else - \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ADD@ONE@ITERATE@gobble@dot}% - \fi - \else - \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ADD@ONE@ITERATE}% - \fi - \else - % re-use this counter: - \c@pgfmathroundto@lastzeros=#1 - \advance\c@pgfmathroundto@lastzeros by1 - \edef\pgfmathresult{\the\c@pgfmathroundto@lastzeros\the\pgfmathfloat@tmptoks}% - \pgfmathfloat@tmptoks=\expandafter{\pgfmathresult}% - \def\pgfmathround@nextcmd{\pgfmathroundto@impl@REVERSE@ITERATE}% - \fi - \pgfmathround@nextcmd + \ifnum#1=9 + \ifnum\c@pgfmathroundto@offsetbehindperiod<0 + \ifpgfmathfloat@fixed@digits@after@period + \pgfmathfloat@tmptoks=\expandafter{\expandafter0\the\pgfmathfloat@tmptoks}% + \else + % silently DROP digit + \fi + \else + \pgfmathfloat@tmptoks=\expandafter{\expandafter0\the\pgfmathfloat@tmptoks}% + \fi + \advance\c@pgfmathroundto@offsetbehindperiod by1 + \ifnum\c@pgfmathroundto@offsetbehindperiod=0 + \ifpgfmathfloat@fixed@digits@after@period + \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ADD@ONE@ITERATE}% + \else + \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ADD@ONE@ITERATE@gobble@dot}% + \fi + \else + \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ADD@ONE@ITERATE}% + \fi + \else + % re-use this counter: + \c@pgfmathroundto@lastzeros=#1 + \advance\c@pgfmathroundto@lastzeros by1 + \edef\pgfmathresult{\the\c@pgfmathroundto@lastzeros\the\pgfmathfloat@tmptoks}% + \pgfmathfloat@tmptoks=\expandafter{\pgfmathresult}% + \def\pgfmathround@nextcmd{\pgfmathroundto@impl@REVERSE@ITERATE}% + \fi + \pgfmathround@nextcmd } \def\pgfmathroundto@impl@discard@suffix@zeros{% - \ifnum\c@pgfmathroundto@lastzeros=\c@pgfmathroundto@offsetbehindperiod - \ifpgfmathround@impl@PREPERIOD@is@negative@zero - \pgfmathfloatroundhasperiodfalse - \aftergroup\pgfmathfloatroundhasperiodfalse - \def\pgfmathresult{0}% write '0' instead of '-0' - \else - \expandafter\pgfmathroundto@impl@discard@period\pgfmathround@input\pgfmathfloat@EOI - \fi - \else - \ifnum\c@pgfmathroundto@lastzeros=0 - \expandafter\pgfmathroundto@impl@REVERSE\the\pgfmathfloat@tmptoks\pgfmathfloat@EOI - \else - \expandafter\pgfmathroundto@impl@discard@suffix@zeros@ITERATE\the\pgfmathfloat@tmptoks\pgfmathfloat@EOI - \fi - \fi -} - -% PRECONDITION: -% \c@pgfmathroundto@lastzeros > 0 + \ifnum\c@pgfmathroundto@lastzeros=\c@pgfmathroundto@offsetbehindperiod + \ifpgfmathround@impl@PREPERIOD@is@negative@zero + \pgfmathfloatroundhasperiodfalse + \aftergroup\pgfmathfloatroundhasperiodfalse + \def\pgfmathresult{0}% write '0' instead of '-0' + \else + \expandafter\pgfmathroundto@impl@discard@period\pgfmathround@input\pgfmathfloat@EOI + \fi + \else + \ifnum\c@pgfmathroundto@lastzeros=0 + \expandafter\pgfmathroundto@impl@REVERSE\the\pgfmathfloat@tmptoks\pgfmathfloat@EOI + \else + \expandafter\pgfmathroundto@impl@discard@suffix@zeros@ITERATE\the\pgfmathfloat@tmptoks\pgfmathfloat@EOI + \fi + \fi +} + +% PRECONDITION: +% \c@pgfmathroundto@lastzeros > 0 \def\pgfmathroundto@impl@discard@suffix@zeros@ITERATE#1{% - \advance\c@pgfmathroundto@lastzeros by-1 - \ifnum\c@pgfmathroundto@lastzeros=0 - \def\pgfmathround@nextcmd{\pgfmathroundto@impl@REVERSE}% - \else - \def\pgfmathround@nextcmd{\pgfmathroundto@impl@discard@suffix@zeros@ITERATE}% - \fi - \pgfmathround@nextcmd + \advance\c@pgfmathroundto@lastzeros by-1 + \ifnum\c@pgfmathroundto@lastzeros=0 + \def\pgfmathround@nextcmd{\pgfmathroundto@impl@REVERSE}% + \else + \def\pgfmathround@nextcmd{\pgfmathroundto@impl@discard@suffix@zeros@ITERATE}% + \fi + \pgfmathround@nextcmd } % Usage: % \pgfmathroundto@impl@REVERSE#1\pgfmathfloat@EOI % -> writes #1 reversed into \pgfmathfloat@tmptoks \def\pgfmathroundto@impl@REVERSE{% - \pgfmathfloat@tmptoks={}% - \pgfmathroundto@impl@REVERSE@ITERATE + \pgfmathfloat@tmptoks={}% + \pgfmathroundto@impl@REVERSE@ITERATE } \def\pgfmathroundto@impl@REVERSE@ITERATE{% - \pgfutil@ifnextchar\pgfmathfloat@EOI{% - \edef\pgfmathresult{\the\pgfmathfloat@tmptoks}% - \pgfmathroundto@impl@gobble - }{% - \pgfmathroundto@impl@REVERSE@NEXT - }% + \pgfutil@ifnextchar\pgfmathfloat@EOI{% + \edef\pgfmathresult{\the\pgfmathfloat@tmptoks}% + \pgfmathroundto@impl@gobble + }{% + \pgfmathroundto@impl@REVERSE@NEXT + }% } \def\pgfmathroundto@impl@REVERSE@NEXT#1{% - \pgfmathfloat@tmptoks=\expandafter{\expandafter#1\the\pgfmathfloat@tmptoks}% - \pgfmathroundto@impl@REVERSE@ITERATE + \pgfmathfloat@tmptoks=\expandafter{\expandafter#1\the\pgfmathfloat@tmptoks}% + \pgfmathroundto@impl@REVERSE@ITERATE } \def\pgfmathroundto@impl@BEGIN@DOT.{% - \pgfmathfloat@tmptoks=\expandafter{\expandafter.\the\pgfmathfloat@tmptoks}% - \c@pgfmathroundto@offsetbehindperiod=0 - \pgfmathroundto@impl@ITERATE@DOT + \pgfmathfloat@tmptoks=\expandafter{\expandafter.\the\pgfmathfloat@tmptoks}% + \c@pgfmathroundto@offsetbehindperiod=0 + \pgfmathroundto@impl@ITERATE@DOT } \def\pgfmathroundto@impl@ITERATE@DOT{% - \pgfutil@ifnextchar\pgfmathfloat@EOI{% - % finished. - \pgfmathroundto@impl@gobble@and@start - }{% - \pgfmathroundto@impl@NEXT@DOT - }% + \pgfutil@ifnextchar\pgfmathfloat@EOI{% + % finished. + \pgfmathroundto@impl@gobble@and@start + }{% + \pgfmathroundto@impl@NEXT@DOT + }% } \def\pgfmathroundto@impl@NEXT@DOT#1{% - \ifnum\c@pgfmathroundto@offsetbehindperiod=\c@pgfmathroundto@prec - \def\pgfmathround@next{#1}% - \def\pgfmathround@nextcmd{\pgfmathroundto@impl@gobble@rest@and@start}% - \else - \advance\c@pgfmathroundto@offsetbehindperiod by1 - \ifnum#1=0 - \advance\c@pgfmathroundto@lastzeros by1 - \else - \c@pgfmathroundto@lastzeros=0 - \fi - \pgfmathfloat@tmptoks=\expandafter{\expandafter#1\the\pgfmathfloat@tmptoks}% - \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ITERATE@DOT}% - \fi - \pgfmathround@nextcmd + \ifnum\c@pgfmathroundto@offsetbehindperiod=\c@pgfmathroundto@prec + \def\pgfmathround@next{#1}% + \def\pgfmathround@nextcmd{\pgfmathroundto@impl@gobble@rest@and@start}% + \else + \advance\c@pgfmathroundto@offsetbehindperiod by1 + \ifnum#1=0 + \advance\c@pgfmathroundto@lastzeros by1 + \else + \c@pgfmathroundto@lastzeros=0 + \fi + \pgfmathfloat@tmptoks=\expandafter{\expandafter#1\the\pgfmathfloat@tmptoks}% + \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ITERATE@DOT}% + \fi + \pgfmathround@nextcmd }% % in contrast to pgfmathroundto@impl@ITERATE@NODOT, this method here % checks also for signs \def\pgfmathroundto@impl@ITERATE@NODOT@firstcall#1{% - \def\pgfmathround@cur{#1}% - \ifx\pgfmathround@cur\pgfmathfloat@EOI - \pgfmathround@impl@PREPERIOD@is@negative@zerofalse - \def\pgfmathround@nextcmd{\pgfmathroundto@impl@start}% - \else - \ifx\pgfmathround@cur\pgfmathfloatparsenumber@tok@PERIOD - \pgfmathround@impl@PREPERIOD@is@negative@zerofalse - \def\pgfmathround@nextcmd{\pgfmathroundto@impl@BEGIN@DOT.}% - \else - \ifx\pgfmathround@cur\pgfmathfloatparsenumber@tok@MINUS - \else - \pgfmathround@impl@PREPERIOD@is@negative@zerofalse - \fi - \pgfmathfloat@tmptoks=\expandafter{\expandafter#1\the\pgfmathfloat@tmptoks}% - \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ITERATE@NODOT}% - \fi - \fi - \pgfmathround@nextcmd + \def\pgfmathround@cur{#1}% + \ifx\pgfmathround@cur\pgfmathfloat@EOI + \pgfmathround@impl@PREPERIOD@is@negative@zerofalse + \def\pgfmathround@nextcmd{\pgfmathroundto@impl@start}% + \else + \ifx\pgfmathround@cur\pgfmathfloatparsenumber@tok@PERIOD + \pgfmathround@impl@PREPERIOD@is@negative@zerofalse + \def\pgfmathround@nextcmd{\pgfmathroundto@impl@BEGIN@DOT.}% + \else + \ifx\pgfmathround@cur\pgfmathfloatparsenumber@tok@MINUS + \else + \pgfmathround@impl@PREPERIOD@is@negative@zerofalse + \fi + \pgfmathfloat@tmptoks=\expandafter{\expandafter#1\the\pgfmathfloat@tmptoks}% + \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ITERATE@NODOT}% + \fi + \fi + \pgfmathround@nextcmd } \def\pgfmathroundto@impl@ITERATE@NODOT#1{% - \def\pgfmathround@cur{#1}% - \ifx\pgfmathround@cur\pgfmathfloat@EOI - \def\pgfmathround@nextcmd{\pgfmathroundto@impl@start}% - \else - \ifx\pgfmathround@cur\pgfmathfloatparsenumber@tok@PERIOD - \def\pgfmathround@nextcmd{\pgfmathroundto@impl@BEGIN@DOT.}% - \else - \ifx\pgfmathround@cur\pgfmathfloatparsenumber@tok@ZERO - \else - \pgfmathround@impl@PREPERIOD@is@negative@zerofalse - \fi - \pgfmathfloat@tmptoks=\expandafter{\expandafter#1\the\pgfmathfloat@tmptoks}% - \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ITERATE@NODOT}% - \fi - \fi - \pgfmathround@nextcmd + \def\pgfmathround@cur{#1}% + \ifx\pgfmathround@cur\pgfmathfloat@EOI + \def\pgfmathround@nextcmd{\pgfmathroundto@impl@start}% + \else + \ifx\pgfmathround@cur\pgfmathfloatparsenumber@tok@PERIOD + \def\pgfmathround@nextcmd{\pgfmathroundto@impl@BEGIN@DOT.}% + \else + \ifx\pgfmathround@cur\pgfmathfloatparsenumber@tok@ZERO + \else + \pgfmathround@impl@PREPERIOD@is@negative@zerofalse + \fi + \pgfmathfloat@tmptoks=\expandafter{\expandafter#1\the\pgfmathfloat@tmptoks}% + \def\pgfmathround@nextcmd{\pgfmathroundto@impl@ITERATE@NODOT}% + \fi + \fi + \pgfmathround@nextcmd } %-------------------------------------------- @@ -2122,20 +2123,20 @@ % \ifpgfmathfloatroundhasperiod will be set after the current TeX % group. \def\pgfmathfloatround@impl{% - \expandafter\pgfmathroundto@impl\expandafter{\the\pgfmathfloat@a@Mtok}% - \ifpgfmathfloatroundmayneedrenormalize - \ifpgfmathfloatroundhasperiod - \expandafter\pgfmathfloatround@impl@renormalize\pgfmathresult\pgfmathfloat@EOI% - \else - \expandafter\pgfmathfloatround@impl@renormalize\pgfmathresult.\pgfmathfloat@EOI% - \fi - \advance\pgfmathfloat@a@E by1 - \fi - \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\pgfmathresult}{\the\pgfmathfloat@a@E}% + \expandafter\pgfmathroundto@impl\expandafter{\the\pgfmathfloat@a@Mtok}% + \ifpgfmathfloatroundmayneedrenormalize + \ifpgfmathfloatroundhasperiod + \expandafter\pgfmathfloatround@impl@renormalize\pgfmathresult\pgfmathfloat@EOI% + \else + \expandafter\pgfmathfloatround@impl@renormalize\pgfmathresult.\pgfmathfloat@EOI% + \fi + \advance\pgfmathfloat@a@E by1 + \fi + \pgfmathfloatcreate{\the\pgfmathfloat@a@S}{\pgfmathresult}{\the\pgfmathfloat@a@E}% } \def\pgfmathfloatround@impl@renormalize#1#2.#3\pgfmathfloat@EOI{% - \pgfmathroundto@impl{#1.#2#3}% + \pgfmathroundto@impl{#1.#2#3}% } @@ -2145,106 +2146,106 @@ % ATTENTION: this thing REQUIRES a period in the mantissa! % collects everything into \pgfmathresult \def\pgfmathfloattofixed@impl#1.#2\relax{% - \ifnum\pgfmathfloat@a@E<0 - \ifcase-\pgfmathfloat@a@E - \or%e-1 - \pgfmathfloat@a@Mtok={0.}% - \or%e-2 - \pgfmathfloat@a@Mtok={0.0}% - \or%e-3 - \pgfmathfloat@a@Mtok={0.00}% - \or%e-4 - \pgfmathfloat@a@Mtok={0.000}% - \or%e-5 - \pgfmathfloat@a@Mtok={0.0000}% - \or%e-6 - \pgfmathfloat@a@Mtok={0.00000}% - \or%e-7 - \pgfmathfloat@a@Mtok={0.000000}% - \or%e-8 - \pgfmathfloat@a@Mtok={0.0000000}% - \or%e-9 - \pgfmathfloat@a@Mtok={0.00000000}% - \or%e-10 - \pgfmathfloat@a@Mtok={0.000000000}% - \else%<= -11 - \pgfmathfloat@a@Mtok={0.0000000000}% - \advance\pgfmathfloat@a@E by10 - \pgfutil@loop - \ifnum\pgfmathfloat@a@E<-1 - \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok 0}% - \advance\pgfmathfloat@a@E by1 - \pgfutil@repeat - \fi - \def\pgfmathfloat@loc@TMPb{#2}% - \def\pgfmathfloat@loc@TMPc{0}% - \ifx\pgfmathfloat@loc@TMPb\pgfmathfloat@loc@TMPc - \edef\pgfmathresult{\the\pgfmathfloat@a@Mtok #1}% - \else - \edef\pgfmathresult{\the\pgfmathfloat@a@Mtok #1#2}% - \fi - \else - %-------------------------------------------------- - % \ifnum\pgfmathfloat@a@E=0% - % \edef\pgfmathresult{#1.#2}% - % \else - % \pgfmathfloat@a@Mtok={#1}% - % \pgfmathfloattofixed@impl@collectmantissa#2\count\pgfmathfloat@a@E - % \edef\pgfmathresult{\the\pgfmathfloat@a@Mtok}% - % \fi - %-------------------------------------------------- - \pgfmathfloat@a@Mtok{#1}% - \pgfmathfloattofixed@impl@pos#2000000000\pgfmathfloat@EOI - \edef\pgfmathresult{\the\pgfmathfloat@a@Mtok}% - \fi + \ifnum\pgfmathfloat@a@E<0 + \ifcase-\pgfmathfloat@a@E + \or%e-1 + \pgfmathfloat@a@Mtok={0.}% + \or%e-2 + \pgfmathfloat@a@Mtok={0.0}% + \or%e-3 + \pgfmathfloat@a@Mtok={0.00}% + \or%e-4 + \pgfmathfloat@a@Mtok={0.000}% + \or%e-5 + \pgfmathfloat@a@Mtok={0.0000}% + \or%e-6 + \pgfmathfloat@a@Mtok={0.00000}% + \or%e-7 + \pgfmathfloat@a@Mtok={0.000000}% + \or%e-8 + \pgfmathfloat@a@Mtok={0.0000000}% + \or%e-9 + \pgfmathfloat@a@Mtok={0.00000000}% + \or%e-10 + \pgfmathfloat@a@Mtok={0.000000000}% + \else%<= -11 + \pgfmathfloat@a@Mtok={0.0000000000}% + \advance\pgfmathfloat@a@E by10 + \pgfutil@loop + \ifnum\pgfmathfloat@a@E<-1 + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok 0}% + \advance\pgfmathfloat@a@E by1 + \pgfutil@repeat + \fi + \def\pgfmathfloat@loc@TMPb{#2}% + \def\pgfmathfloat@loc@TMPc{0}% + \ifx\pgfmathfloat@loc@TMPb\pgfmathfloat@loc@TMPc + \edef\pgfmathresult{\the\pgfmathfloat@a@Mtok #1}% + \else + \edef\pgfmathresult{\the\pgfmathfloat@a@Mtok #1#2}% + \fi + \else + %-------------------------------------------------- + % \ifnum\pgfmathfloat@a@E=0% + % \edef\pgfmathresult{#1.#2}% + % \else + % \pgfmathfloat@a@Mtok={#1}% + % \pgfmathfloattofixed@impl@collectmantissa#2\count\pgfmathfloat@a@E + % \edef\pgfmathresult{\the\pgfmathfloat@a@Mtok}% + % \fi + %-------------------------------------------------- + \pgfmathfloat@a@Mtok{#1}% + \pgfmathfloattofixed@impl@pos#2000000000\pgfmathfloat@EOI + \edef\pgfmathresult{\the\pgfmathfloat@a@Mtok}% + \fi } % FIXME: this implementation here is very fast, but it introduces trailing zeros. Is that acceptable? \def\pgfmathfloattofixed@impl@pos#1#2#3#4#5#6#7#8#9\pgfmathfloat@EOI{% - \ifcase\pgfmathfloat@a@E - % e+0 - \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok .#1#2#3#4#5#6#7#8#9}% - \or%e+1 - \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1.#2#3#4#5#6#7#8#9}% - \or%e+2 - \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2.#3#4#5#6#7#8#9}% - \or%e+3 - \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2#3.#4#5#6#7#8#9}% - \or%e+4 - \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2#3#4.#5#6#7#8#9}% - \or%e+5 - \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2#3#4#5.#6#7#8#9}% - \or%e+6 - \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2#3#4#5#6.#7#8#9}% - \or%e+7 - \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2#3#4#5#6#7.#8#9}% - \or%e+8 - \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2#3#4#5#6#7#8.#9}% - \else%>=9 - \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2#3#4#5#6#7#8}% - \advance\pgfmathfloat@a@E by-8 - \pgfmathfloattofixed@impl@collectmantissa#9\count\pgfmathfloat@a@E - \fi + \ifcase\pgfmathfloat@a@E + % e+0 + \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok .#1#2#3#4#5#6#7#8#9}% + \or%e+1 + \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1.#2#3#4#5#6#7#8#9}% + \or%e+2 + \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2.#3#4#5#6#7#8#9}% + \or%e+3 + \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2#3.#4#5#6#7#8#9}% + \or%e+4 + \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2#3#4.#5#6#7#8#9}% + \or%e+5 + \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2#3#4#5.#6#7#8#9}% + \or%e+6 + \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2#3#4#5#6.#7#8#9}% + \or%e+7 + \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2#3#4#5#6#7.#8#9}% + \or%e+8 + \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2#3#4#5#6#7#8.#9}% + \else%>=9 + \pgfmathfloat@a@Mtok\expandafter{\the\pgfmathfloat@a@Mtok #1#2#3#4#5#6#7#8}% + \advance\pgfmathfloat@a@E by-8 + \pgfmathfloattofixed@impl@collectmantissa#9\count\pgfmathfloat@a@E + \fi }% \def\pgfmathfloattofixed@impl@collectmantissa#1#2\count#3{% - \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok #1}% - \advance\pgfmathfloat@a@E by-1% - \def\pgfmathfloat@loc@TMPb{#2}% - \ifx\pgfmathfloat@loc@TMPb\pgfutil@empty - \pgfutil@loop - \ifnum\pgfmathfloat@a@E>0% - \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok 0}% - \advance\pgfmathfloat@a@E by-1% - \pgfutil@repeat - \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok .0}% - \else - \ifnum\pgfmathfloat@a@E=0 - \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok .#2}% - \else - \pgfmathfloattofixed@impl@collectmantissa#2\count#3% - \fi - \fi + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok #1}% + \advance\pgfmathfloat@a@E by-1% + \def\pgfmathfloat@loc@TMPb{#2}% + \ifx\pgfmathfloat@loc@TMPb\pgfutil@empty + \pgfutil@loop + \ifnum\pgfmathfloat@a@E>0% + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok 0}% + \advance\pgfmathfloat@a@E by-1% + \pgfutil@repeat + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok .0}% + \else + \ifnum\pgfmathfloat@a@E=0 + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok .#2}% + \else + \pgfmathfloattofixed@impl@collectmantissa#2\count#3% + \fi + \fi } @@ -2275,46 +2276,46 @@ % % It assigns \pgfmathfloat@a@S, \pgfmathfloat@a@Mtok, \pgfmathfloat@a@E. \def\pgfflt@impl#1{% - \pgfmathfloatparsenumberpendingperiodfalse - \pgfmathfloat@tmptoks={}% this register is used to collect PENDING ZEROS - \pgfmathfloat@a@E=0 - % start parsing: check for sign: - \expandafter\ifx\csname pgfflt@#1\endcsname\relax - \pgfmathfloat@a@S=1 - \expandafter\pgfflt@init\expandafter#1% - \else - \expandafter\expandafter\csname pgfflt@#1\endcsname - \fi + \pgfmathfloatparsenumberpendingperiodfalse + \pgfmathfloat@tmptoks={}% this register is used to collect PENDING ZEROS + \pgfmathfloat@a@E=0 + % start parsing: check for sign: + \expandafter\ifx\csname pgfflt@#1\endcsname\relax + \pgfmathfloat@a@S=1 + \expandafter\pgfflt@init\expandafter#1% + \else + \expandafter\expandafter\csname pgfflt@#1\endcsname + \fi } % State transitions: \expandafter\def\csname pgfflt@+\endcsname{% - \pgfmathfloat@a@S=1 % - \pgfflt@init}% + \pgfmathfloat@a@S=1 % + \pgfflt@init}% \expandafter\def\csname pgfflt@-\endcsname{% - \pgfmathfloat@a@S=2 % - \pgfflt@init}% + \pgfmathfloat@a@S=2 % + \pgfflt@init}% \expandafter\def\csname pgfflt@\pgfflt@EOI\endcsname{% - \pgfmathfloatparsenumber@handleerror{empty number}{}{}}% + \pgfmathfloatparsenumber@handleerror{empty number}{}{}}% \pgfkeys{ - /pgf/fpu/handlers/empty number/.style 2 args={% - /pgf/fpu/handlers/invalid number={#1}{#2}% - }, - /pgf/fpu/empty number is zero/.style={% - /pgf/fpu/handlers/empty number/.code 2 args={% - \pgfmathfloatcreate{0}{0.0}{0}% - }% - },% - /pgf/fpu/handlers/invalid separator/.code 2 args={% - \pgfmath@error{Could not parse input '#1' as a floating point number, sorry. The unreadable part was near the decimal separator '#2'. Do you need the option 'read comma as period'?}{}% - }, - /pgf/fpu/handlers/invalid number/.code 2 args={% - \pgfmath@error{Could not parse input '#1' as a floating point number, sorry. The unreadable part was near '#2'.}{}% - }, - /pgf/fpu/handlers/wrong lowlevel format/.code 2 args={% - \pgfmath@error{Sorry, an internal routine of the floating point unit got an ill-formatted floating point number `#1'. The unreadable part was near '#2'.}{}% - \let\pgfmathresult=\pgfutil@empty - }, + /pgf/fpu/handlers/empty number/.style 2 args={% + /pgf/fpu/handlers/invalid number={#1}{#2}% + }, + /pgf/fpu/empty number is zero/.style={% + /pgf/fpu/handlers/empty number/.code 2 args={% + \pgfmathfloatcreate{0}{0.0}{0}% + }% + },% + /pgf/fpu/handlers/invalid separator/.code 2 args={% + \pgfmath@error{Could not parse input '#1' as a floating point number, sorry. The unreadable part was near the decimal separator '#2'. Do you need the option 'read comma as period'?}{}% + }, + /pgf/fpu/handlers/invalid number/.code 2 args={% + \pgfmath@error{Could not parse input '#1' as a floating point number, sorry. The unreadable part was near '#2'.}{}% + }, + /pgf/fpu/handlers/wrong lowlevel format/.code 2 args={% + \pgfmath@error{Sorry, an internal routine of the floating point unit got an ill-formatted floating point number `#1'. The unreadable part was near '#2'.}{}% + \let\pgfmathresult=\pgfutil@empty + }, } % #1 the error handler @@ -2322,30 +2323,30 @@ % #3 the part which produced the error % % POSTCONDITION: the three registers -% \pgfmathfloat@a@S -% \pgfmathfloat@a@Mtok -% \pgfmathfloat@a@E +% \pgfmathfloat@a@S +% \pgfmathfloat@a@Mtok +% \pgfmathfloat@a@E % will contain the number which results from the error handler. \def\pgfmathfloatparsenumber@handleerror#1#2#3{% - \let\pgfmathresult=\pgfutil@empty - \pgfmathfloatparsenumberpendingperiodfalse - \pgfkeys{/pgf/fpu/handlers/#1={#2}{#3}}% - \ifx\pgfmathresult\pgfutil@empty - \pgfmathfloat@a@S=3 - \pgfmathfloat@a@Mtok={0.0}% - \pgfmathfloat@a@E=0 - \else - \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E - \fi + \let\pgfmathresult=\pgfutil@empty + \pgfmathfloatparsenumberpendingperiodfalse + \pgfkeys{/pgf/fpu/handlers/#1={#2}{#3}}% + \ifx\pgfmathresult\pgfutil@empty + \pgfmathfloat@a@S=3 + \pgfmathfloat@a@Mtok={0.0}% + \pgfmathfloat@a@E=0 + \else + \expandafter\pgfmathfloat@decompose@tok\pgfmathresult\relax\pgfmathfloat@a@S\pgfmathfloat@a@Mtok\pgfmathfloat@a@E + \fi } \def\pgfflt@error#1\pgfflt@EOI{% - \begingroup - \pgfmathfloat@a@Mtok={#1}% - \xdef\pgfmathfloat@glob@TMP{% - \noexpand\pgfmathfloatparsenumber@handleerror - {invalid number}{\pgfmathresult}{\the\pgfmathfloat@a@Mtok}}% - \endgroup - \pgfmathfloat@glob@TMP + \begingroup + \pgfmathfloat@a@Mtok={#1}% + \xdef\pgfmathfloat@glob@TMP{% + \noexpand\pgfmathfloatparsenumber@handleerror + {invalid number}{\pgfmathresult}{\the\pgfmathfloat@a@Mtok}}% + \endgroup + \pgfmathfloat@glob@TMP }% @@ -2353,11 +2354,11 @@ % FROM: checksign. % \def\pgfflt@init#1{% - \expandafter\ifx\csname pgffltA@#1\endcsname\relax - \expandafter\pgfflt@error\expandafter#1% - \else - \expandafter\expandafter\csname pgffltA@#1\endcsname - \fi} + \expandafter\ifx\csname pgffltA@#1\endcsname\relax + \expandafter\pgfflt@error\expandafter#1% + \else + \expandafter\expandafter\csname pgffltA@#1\endcsname + \fi} % state transitions: \expandafter\def\csname pgffltA@0\endcsname{\pgfflt@leadingzero}% FIXME: inline optimization! \expandafter\def\csname pgffltA@1\endcsname{\pgfflt@nonzerodigit1}% @@ -2370,82 +2371,82 @@ \expandafter\def\csname pgffltA@8\endcsname{\pgfflt@nonzerodigit8}% \expandafter\def\csname pgffltA@9\endcsname{\pgfflt@nonzerodigit9}% \def\pgfflt@nonzerodigit#1{% - \pgfmathfloat@a@Mtok={#1}% - \pgfmathfloatparsenumberpendingperiodtrue - \pgfflt@positiveexp}% + \pgfmathfloat@a@Mtok={#1}% + \pgfmathfloatparsenumberpendingperiodtrue + \pgfflt@positiveexp}% \expandafter\def\csname pgffltA@n\endcsname{\pgfflt@readnan}% FIXME: inlining? \expandafter\def\csname pgffltA@N\endcsname{\pgfflt@readnan}% FIXME: inlining? \expandafter\def\csname pgffltA@i\endcsname{\pgfflt@readinf}% FIXME: inlining? \expandafter\def\csname pgffltA@I\endcsname{\pgfflt@readinf}% FIXME: inlining? \expandafter\def\csname pgffltA@.\endcsname{% read '.9' like '0.9' - \pgfmathfloat@a@E=-1 - \pgfflt@leadingzero@foundperiod}% + \pgfmathfloat@a@E=-1 + \pgfflt@leadingzero@foundperiod}% \expandafter\def\csname pgffltA@,\endcsname{% read ',9' like '0,9' - \pgfmathfloat@frenchinput{% - \pgfmathfloat@a@E=-1 - \pgfflt@leadingzero@foundperiod - }% + \pgfmathfloat@frenchinput{% + \pgfmathfloat@a@E=-1 + \pgfflt@leadingzero@foundperiod + }% }% \def\pgfmathfloat@frenchinput#1{% - \ifpgfmathparsenumber@comma@as@period - \def\pgf@marshal{#1}% - \expandafter\pgf@marshal - \else - \expandafter\pgfflt@error@separator\expandafter,% - \fi + \ifpgfmathparsenumber@comma@as@period + \def\pgf@marshal{#1}% + \expandafter\pgf@marshal + \else + \expandafter\pgfflt@error@separator\expandafter,% + \fi }% \def\pgfflt@error@separator#1\pgfflt@EOI{% - \begingroup - \pgfmathfloat@a@Mtok={#1}% - \xdef\pgfmathfloat@glob@TMP{% - \noexpand\pgfmathfloatparsenumber@handleerror - {invalid separator}{\pgfmathresult}{\the\pgfmathfloat@a@Mtok}}% - \endgroup - \pgfmathfloat@glob@TMP + \begingroup + \pgfmathfloat@a@Mtok={#1}% + \xdef\pgfmathfloat@glob@TMP{% + \noexpand\pgfmathfloatparsenumber@handleerror + {invalid separator}{\pgfmathresult}{\the\pgfmathfloat@a@Mtok}}% + \endgroup + \pgfmathfloat@glob@TMP }% \def\pgfflt@finish#1\pgfflt@EOI{} \def\pgfflt@readnan #1#2{% - \def\pgfflt@readnan@ok{1}% - \if#1a\else\if#1A\else\def\pgfflt@readnan@ok{0}\fi\fi - \if#2n\else\if#2N\else\def\pgfflt@readnan@ok{0}\fi\fi - \if\pgfflt@readnan@ok1% - \pgfmathfloat@a@S=3\relax% - \pgfmathfloat@a@Mtok={0.0}% - \pgfmathfloat@a@E=0% - \expandafter\pgfflt@finish - \else - \def\pgfflt@readnan@{\pgfflt@error #1#2}% - \expandafter\pgfflt@readnan@ - \fi + \def\pgfflt@readnan@ok{1}% + \if#1a\else\if#1A\else\def\pgfflt@readnan@ok{0}\fi\fi + \if#2n\else\if#2N\else\def\pgfflt@readnan@ok{0}\fi\fi + \if\pgfflt@readnan@ok1% + \pgfmathfloat@a@S=3\relax% + \pgfmathfloat@a@Mtok={0.0}% + \pgfmathfloat@a@E=0% + \expandafter\pgfflt@finish + \else + \def\pgfflt@readnan@{\pgfflt@error #1#2}% + \expandafter\pgfflt@readnan@ + \fi } \def\pgfflt@readinf #1#2{% - \def\pgfflt@readinf@ok{1}% - \if#1n\else\if#1N\else\def\pgfflt@readinf@ok{0}\fi\fi - \if#2f\else\if#2F\else\def\pgfflt@readinf@ok{0}\fi\fi - \if\pgfflt@readinf@ok1% - \ifnum\pgfmathfloat@a@S=1 % - \pgfmathfloat@a@S=4 % - \pgfmathfloat@a@Mtok={0.0}% - \else - \pgfmathfloat@a@S=5 % - \pgfmathfloat@a@Mtok={0.0}% - \fi - \pgfmathfloat@a@E=0 % - \expandafter\pgfflt@finish - \else - \def\pgfflt@readinf@{\pgfflt@error #1#2}% - \expandafter\pgfflt@readinf@ - \fi + \def\pgfflt@readinf@ok{1}% + \if#1n\else\if#1N\else\def\pgfflt@readinf@ok{0}\fi\fi + \if#2f\else\if#2F\else\def\pgfflt@readinf@ok{0}\fi\fi + \if\pgfflt@readinf@ok1% + \ifnum\pgfmathfloat@a@S=1 % + \pgfmathfloat@a@S=4 % + \pgfmathfloat@a@Mtok={0.0}% + \else + \pgfmathfloat@a@S=5 % + \pgfmathfloat@a@Mtok={0.0}% + \fi + \pgfmathfloat@a@E=0 % + \expandafter\pgfflt@finish + \else + \def\pgfflt@readinf@{\pgfflt@error #1#2}% + \expandafter\pgfflt@readinf@ + \fi } \def\pgfflt@leadingzero#1{% - \expandafter\ifx\csname pgffltB@#1\endcsname\relax - \expandafter\pgfflt@error\expandafter#1% - \else - \expandafter\expandafter\csname pgffltB@#1\endcsname - \fi} + \expandafter\ifx\csname pgffltB@#1\endcsname\relax + \expandafter\pgfflt@error\expandafter#1% + \else + \expandafter\expandafter\csname pgffltB@#1\endcsname + \fi} % State transitions: \expandafter\def\csname pgffltB@0\endcsname{\pgfflt@leadingzero}% \expandafter\def\csname pgffltB@1\endcsname{\pgfmathfloat@a@Mtok={1}\pgfmathfloatparsenumberpendingperiodtrue \pgfflt@positiveexp} @@ -2459,35 +2460,35 @@ \expandafter\def\csname pgffltB@9\endcsname{\pgfmathfloat@a@Mtok={9}\pgfmathfloatparsenumberpendingperiodtrue \pgfflt@positiveexp} \expandafter\def\csname pgffltB@\pgfmathfloat@POSTFLAGSCHAR\endcsname{\pgfmathfloat@a@Mtok={0}\pgfflt@readlowlevelfloat}% \expandafter\def\csname pgffltB@.\endcsname{% - \pgfmathfloat@a@E=-1 - \pgfflt@leadingzero@foundperiod}% + \pgfmathfloat@a@E=-1 + \pgfflt@leadingzero@foundperiod}% \expandafter\def\csname pgffltB@,\endcsname{% - \pgfmathfloat@frenchinput{% - \pgfmathfloat@a@E=-1 - \pgfflt@leadingzero@foundperiod - }% + \pgfmathfloat@frenchinput{% + \pgfmathfloat@a@E=-1 + \pgfflt@leadingzero@foundperiod + }% }% \expandafter\def\csname pgffltB@e\endcsname{% - \pgfmathfloat@a@S=0\relax% - \pgfmathfloat@a@Mtok={0.0}% - \pgfmathfloat@a@E=0% - \pgfflt@readexponent}% + \pgfmathfloat@a@S=0\relax% + \pgfmathfloat@a@Mtok={0.0}% + \pgfmathfloat@a@E=0% + \pgfflt@readexponent}% \let\pgffltB@E=\pgffltB@e \expandafter\def\csname pgffltB@\pgfflt@EOI\endcsname{% - \pgfmathfloat@a@S=0\relax% - \pgfmathfloat@a@Mtok={0.0}% - \pgfmathfloat@a@E=0}% + \pgfmathfloat@a@S=0\relax% + \pgfmathfloat@a@Mtok={0.0}% + \pgfmathfloat@a@E=0}% \def\pgfflt@leadingzero@foundperiod#1{% - \expandafter\ifx\csname pgffltC@#1\endcsname\relax - \expandafter\pgfflt@error\expandafter#1% - \else - \expandafter\expandafter\csname pgffltC@#1\endcsname - \fi} + \expandafter\ifx\csname pgffltC@#1\endcsname\relax + \expandafter\pgfflt@error\expandafter#1% + \else + \expandafter\expandafter\csname pgffltC@#1\endcsname + \fi} % State transitions: \expandafter\def\csname pgffltC@0\endcsname{% - \advance\pgfmathfloat@a@E by-1 - \pgfflt@leadingzero@foundperiod}% + \advance\pgfmathfloat@a@E by-1 + \pgfflt@leadingzero@foundperiod}% \expandafter\def\csname pgffltC@1\endcsname{\pgfmathfloat@a@Mtok={1}\pgfmathfloatparsenumberpendingperiodtrue\pgfflt@finish@number@after@period}% \expandafter\def\csname pgffltC@2\endcsname{\pgfmathfloat@a@Mtok={2}\pgfmathfloatparsenumberpendingperiodtrue\pgfflt@finish@number@after@period}% \expandafter\def\csname pgffltC@3\endcsname{\pgfmathfloat@a@Mtok={3}\pgfmathfloatparsenumberpendingperiodtrue\pgfflt@finish@number@after@period}% @@ -2498,28 +2499,28 @@ \expandafter\def\csname pgffltC@8\endcsname{\pgfmathfloat@a@Mtok={8}\pgfmathfloatparsenumberpendingperiodtrue\pgfflt@finish@number@after@period}% \expandafter\def\csname pgffltC@9\endcsname{\pgfmathfloat@a@Mtok={9}\pgfmathfloatparsenumberpendingperiodtrue\pgfflt@finish@number@after@period}% \expandafter\def\csname pgffltC@e\endcsname{% - \pgfmathfloat@a@S=0\relax% - \pgfmathfloat@a@Mtok={0.0}% - \pgfmathfloat@a@E=0% - \pgfflt@readexponent}% + \pgfmathfloat@a@S=0\relax% + \pgfmathfloat@a@Mtok={0.0}% + \pgfmathfloat@a@E=0% + \pgfflt@readexponent}% \let\pgffltC@E=\pgffltC@e \expandafter\def\csname pgffltC@\pgfflt@EOI\endcsname{% - \pgfmathfloat@a@S=0\relax% - \pgfmathfloat@a@Mtok={0.0}% - \pgfmathfloat@a@E=0}% + \pgfmathfloat@a@S=0\relax% + \pgfmathfloat@a@Mtok={0.0}% + \pgfmathfloat@a@E=0}% \def\pgfflt@positiveexp#1{% - \expandafter\ifx\csname pgffltD@#1\endcsname\relax - \expandafter\pgfflt@error\expandafter#1% - \else - \expandafter\expandafter\csname pgffltD@#1\endcsname - \fi} + \expandafter\ifx\csname pgffltD@#1\endcsname\relax + \expandafter\pgfflt@error\expandafter#1% + \else + \expandafter\expandafter\csname pgffltD@#1\endcsname + \fi} % State transitions: \expandafter\def\csname pgffltD@0\endcsname{% - \advance\pgfmathfloat@a@E by1 - \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}% - \pgfflt@pendingzeros@positiveexp}% + \advance\pgfmathfloat@a@E by1 + \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}% + \pgfflt@pendingzeros@positiveexp}% \expandafter\def\csname pgffltD@1\endcsname{\pgffltD@nonzerodigit1}% \expandafter\def\csname pgffltD@2\endcsname{\pgffltD@nonzerodigit2}% \expandafter\def\csname pgffltD@3\endcsname{\pgffltD@nonzerodigit3}% @@ -2536,51 +2537,51 @@ \let\pgffltD@E=\pgffltD@e \expandafter\def\csname pgffltD@\pgfflt@EOI\endcsname{}% NOP \def\pgffltD@nonzerodigit#1{% - \advance\pgfmathfloat@a@E by1 - \ifpgfmathfloatparsenumberpendingperiod - \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.}% - \pgfmathfloatparsenumberpendingperiodfalse - \fi - \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok#1}% - \pgfflt@positiveexp}% + \advance\pgfmathfloat@a@E by1 + \ifpgfmathfloatparsenumberpendingperiod + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.}% + \pgfmathfloatparsenumberpendingperiodfalse + \fi + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok#1}% + \pgfflt@positiveexp}% % Read a low-level floating point. % Since we are in the second state, \pgfmathfloat@a@Mtok contains the % FLAGS. The post-flags-char has also been read. \def\pgfflt@readlowlevelfloat#1e#2]\pgfflt@EOI{% - \pgfmathfloatparsenumberpendingperiodfalse - \pgfmathfloat@a@S=\the\pgfmathfloat@a@Mtok\relax - \pgfmathfloat@a@Mtok={#1}% - \pgfmathfloat@a@E=#2 + \pgfmathfloatparsenumberpendingperiodfalse + \pgfmathfloat@a@S=\the\pgfmathfloat@a@Mtok\relax + \pgfmathfloat@a@Mtok={#1}% + \pgfmathfloat@a@E=#2 }% \def\pgfflt@readexponent#1\pgfflt@EOI{% - \afterassignment\pgfflt@readexponent@ - \pgfmathfloat@b@E=#1 \pgfflt@EOI% the white space is important, otherwise \pgfflt@EOI will be expanded. + \afterassignment\pgfflt@readexponent@ + \pgfmathfloat@b@E=#1 \pgfflt@EOI% the white space is important, otherwise \pgfflt@EOI will be expanded. } \def\pgfflt@readexponent@#1{% - \advance\pgfmathfloat@a@E by\pgfmathfloat@b@E\relax - % - % sanity checking: - \def\pgfmathfloat@loc@TMPb{#1}% - \ifx\pgfmathfloat@loc@TMPb\pgfflt@EOI@unexpanded - \else - \def\pgfmathfloat@loc@TMPb{\pgfflt@error#1}% - \expandafter\pgfmathfloat@loc@TMPb - \fi + \advance\pgfmathfloat@a@E by\pgfmathfloat@b@E\relax + % + % sanity checking: + \def\pgfmathfloat@loc@TMPb{#1}% + \ifx\pgfmathfloat@loc@TMPb\pgfflt@EOI@unexpanded + \else + \def\pgfmathfloat@loc@TMPb{\pgfflt@error#1}% + \expandafter\pgfmathfloat@loc@TMPb + \fi } \def\pgfflt@pendingzeros@positiveexp#1{% - \expandafter\ifx\csname pgffltE@#1\endcsname\relax - \expandafter\pgfflt@error\expandafter#1% - \else - \expandafter\expandafter\csname pgffltE@#1\endcsname - \fi} + \expandafter\ifx\csname pgffltE@#1\endcsname\relax + \expandafter\pgfflt@error\expandafter#1% + \else + \expandafter\expandafter\csname pgffltE@#1\endcsname + \fi} % State transitions: \expandafter\def\csname pgffltE@0\endcsname{% - \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}% - \advance\pgfmathfloat@a@E by1 - \pgfflt@pendingzeros@positiveexp}% + \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}% + \advance\pgfmathfloat@a@E by1 + \pgfflt@pendingzeros@positiveexp}% \expandafter\def\csname pgffltE@1\endcsname{\pgffltE@nonzerodigit1}% \expandafter\def\csname pgffltE@2\endcsname{\pgffltE@nonzerodigit2}% \expandafter\def\csname pgffltE@3\endcsname{\pgffltE@nonzerodigit3}% @@ -2596,26 +2597,26 @@ \let\pgffltE@E=\pgffltE@e \expandafter\def\csname pgffltE@\pgfflt@EOI\endcsname{}% NOP \def\pgffltE@nonzerodigit#1{% - \advance\pgfmathfloat@a@E by1 - \ifpgfmathfloatparsenumberpendingperiod - \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.}% - \pgfmathfloatparsenumberpendingperiodfalse - \fi - \pgfmathfloat@a@Mtok=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfmathfloat@a@Mtok\the\pgfmathfloat@tmptoks}% - \pgfmathfloat@tmptoks={}% - \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok#1}% - \pgfflt@positiveexp}% + \advance\pgfmathfloat@a@E by1 + \ifpgfmathfloatparsenumberpendingperiod + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.}% + \pgfmathfloatparsenumberpendingperiodfalse + \fi + \pgfmathfloat@a@Mtok=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfmathfloat@a@Mtok\the\pgfmathfloat@tmptoks}% + \pgfmathfloat@tmptoks={}% + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok#1}% + \pgfflt@positiveexp}% \def\pgfflt@finish@number@after@period#1{% - \expandafter\ifx\csname pgffltF@#1\endcsname\relax - \expandafter\pgfflt@error\expandafter#1% - \else - \expandafter\expandafter\csname pgffltF@#1\endcsname - \fi} + \expandafter\ifx\csname pgffltF@#1\endcsname\relax + \expandafter\pgfflt@error\expandafter#1% + \else + \expandafter\expandafter\csname pgffltF@#1\endcsname + \fi} % State transitions: \expandafter\def\csname pgffltF@0\endcsname{% - \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}% - \pgfflt@pendingzeros}% + \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}% + \pgfflt@pendingzeros}% \expandafter\def\csname pgffltF@1\endcsname{\pgffltF@nonzerodigit1}% \expandafter\def\csname pgffltF@2\endcsname{\pgffltF@nonzerodigit2}% \expandafter\def\csname pgffltF@3\endcsname{\pgffltF@nonzerodigit3}% @@ -2629,26 +2630,26 @@ \let\pgffltF@E=\pgffltF@e \expandafter\def\csname pgffltF@\pgfflt@EOI\endcsname{}% NOP \def\pgffltF@nonzerodigit#1{% - \ifpgfmathfloatparsenumberpendingperiod - \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.}% - \pgfmathfloatparsenumberpendingperiodfalse - \fi - \pgfmathfloat@a@Mtok=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfmathfloat@a@Mtok\the\pgfmathfloat@tmptoks}% - \pgfmathfloat@tmptoks={}% - \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok#1}% - \pgfflt@finish@number@after@period}% + \ifpgfmathfloatparsenumberpendingperiod + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.}% + \pgfmathfloatparsenumberpendingperiodfalse + \fi + \pgfmathfloat@a@Mtok=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfmathfloat@a@Mtok\the\pgfmathfloat@tmptoks}% + \pgfmathfloat@tmptoks={}% + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok#1}% + \pgfflt@finish@number@after@period}% \def\pgfflt@pendingzeros#1{% - \expandafter\ifx\csname pgffltG@#1\endcsname\relax - \expandafter\pgfflt@error\expandafter#1% - \else - \expandafter\expandafter\csname pgffltG@#1\endcsname - \fi} + \expandafter\ifx\csname pgffltG@#1\endcsname\relax + \expandafter\pgfflt@error\expandafter#1% + \else + \expandafter\expandafter\csname pgffltG@#1\endcsname + \fi} % State transitions: \expandafter\def\csname pgffltG@0\endcsname{% - \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}% - \pgfflt@pendingzeros}% + \pgfmathfloat@tmptoks=\expandafter{\the\pgfmathfloat@tmptoks0}% + \pgfflt@pendingzeros}% \expandafter\def\csname pgffltG@1\endcsname{\pgffltG@nonzerodigit1}% \expandafter\def\csname pgffltG@2\endcsname{\pgffltG@nonzerodigit2}% \expandafter\def\csname pgffltG@3\endcsname{\pgffltG@nonzerodigit3}% @@ -2662,13 +2663,13 @@ \let\pgffltG@E=\pgffltG@e \expandafter\def\csname pgffltG@\pgfflt@EOI\endcsname{}% NOP \def\pgffltG@nonzerodigit#1{% - \ifpgfmathfloatparsenumberpendingperiod - \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.}% - \pgfmathfloatparsenumberpendingperiodfalse - \fi - \pgfmathfloat@a@Mtok=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfmathfloat@a@Mtok\the\pgfmathfloat@tmptoks}% - \pgfmathfloat@tmptoks={}% - \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok#1}% - \pgfflt@finish@number@after@period}% + \ifpgfmathfloatparsenumberpendingperiod + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok.}% + \pgfmathfloatparsenumberpendingperiodfalse + \fi + \pgfmathfloat@a@Mtok=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfmathfloat@a@Mtok\the\pgfmathfloat@tmptoks}% + \pgfmathfloat@tmptoks={}% + \pgfmathfloat@a@Mtok=\expandafter{\the\pgfmathfloat@a@Mtok#1}% + \pgfflt@finish@number@after@period}% \endinput diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.base.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.base.code.tex index 9370a219fe3..581cdaade5f 100644 --- a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.base.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.base.code.tex @@ -14,46 +14,46 @@ % Base conversion operations for the parser. % \pgfmathdeclarefunction{bin}{1}{% - \begingroup% - \afterassignment\pgfmath@gobbletilpgfmath@% - \c@pgfmath@counta=#1\relax\pgfmath@% - \expandafter\pgfmathbasetobase\expandafter\pgfmathresult\expandafter{\the\c@pgfmath@counta}{10}{2}% - \pgfmath@smuggleone\pgfmathresult% - \endgroup% + \begingroup% + \afterassignment\pgfmath@gobbletilpgfmath@% + \c@pgfmath@counta=#1\relax\pgfmath@% + \expandafter\pgfmathbasetobase\expandafter\pgfmathresult\expandafter{\the\c@pgfmath@counta}{10}{2}% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% } \pgfmathdeclarefunction{hex}{1}{% - \begingroup% - \afterassignment\pgfmath@gobbletilpgfmath@% - \c@pgfmath@counta=#1\relax\pgfmath@% - \expandafter\pgfmathbasetobase\expandafter\pgfmathresult\expandafter{\the\c@pgfmath@counta}{10}{16}% - \pgfmath@smuggleone\pgfmathresult% - \endgroup% -} + \begingroup% + \afterassignment\pgfmath@gobbletilpgfmath@% + \c@pgfmath@counta=#1\relax\pgfmath@% + \expandafter\pgfmathbasetobase\expandafter\pgfmathresult\expandafter{\the\c@pgfmath@counta}{10}{16}% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% +} \pgfmathdeclarefunction{Hex}{1}{% - \begingroup% - \afterassignment\pgfmath@gobbletilpgfmath@% - \c@pgfmath@counta=#1\relax\pgfmath@% - \expandafter\pgfmathbasetoBase\expandafter\pgfmathresult\expandafter{\the\c@pgfmath@counta}{10}{16}% - \pgfmath@smuggleone\pgfmathresult% - \endgroup% + \begingroup% + \afterassignment\pgfmath@gobbletilpgfmath@% + \c@pgfmath@counta=#1\relax\pgfmath@% + \expandafter\pgfmathbasetoBase\expandafter\pgfmathresult\expandafter{\the\c@pgfmath@counta}{10}{16}% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% } \pgfmathdeclarefunction{oct}{1}{% - \begingroup% - \afterassignment\pgfmath@gobbletilpgfmath@% - \c@pgfmath@counta=#1\relax\pgfmath@% - \expandafter\pgfmathbasetobase\expandafter\pgfmathresult\expandafter{\the\c@pgfmath@counta}{10}{8}% - \pgfmath@smuggleone\pgfmathresult% - \endgroup% + \begingroup% + \afterassignment\pgfmath@gobbletilpgfmath@% + \c@pgfmath@counta=#1\relax\pgfmath@% + \expandafter\pgfmathbasetobase\expandafter\pgfmathresult\expandafter{\the\c@pgfmath@counta}{10}{8}% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% } % Additional macros: % \pgfmathbasetodec % -% Convert a representation of an integer from -% the specified base to base 10. +% Convert a representation of an integer from +% the spcified base to base 10. % % #1 - a macro to store the result. % #2 - the representation of a number (i.e. not a register) @@ -66,62 +66,62 @@ % \mynumber <- 23 % \def\pgfmathbasetodec#1#2#3{% - \pgfmath@checknumber{#2}% - \pgfmath@checkbase{#3}% - \def\pgfmath@base{#3}% - \def\pgfmath@base@macro{#1}% - \c@pgfmath@counta=1\relax% - \let\pgfmath@reversed=\pgfmath@empty% - \expandafter\pgfmathbasetodec@#2\pgfmath@base@stop} - + \pgfmath@checknumber{#2}% + \pgfmath@checkbase{#3}% + \def\pgfmath@base{#3}% + \def\pgfmath@base@macro{#1}% + \c@pgfmath@counta=1\relax% + \let\pgfmath@reversed=\pgfmath@empty% + \expandafter\pgfmathbasetodec@#2\pgfmath@base@stop} + \def\pgfmathbasetodec@#1{% - \ifx#1\pgfmath@base@stop% - \c@pgfmath@countb=0% - \divide\c@pgfmath@counta by\pgfmath@base\relax% - \expandafter\pgfmathbasetodec@@% - \else% - \edef\pgfmath@reversed{\pgfmath@reversed#1}% - \expandafter\multiply\expandafter\c@pgfmath@counta\pgfmath@base\relax% - \expandafter\pgfmathbasetodec@% - \fi} + \ifx#1\pgfmath@base@stop% + \c@pgfmath@countb=0% + \divide\c@pgfmath@counta by\pgfmath@base\relax% + \expandafter\pgfmathbasetodec@@% + \else% + \edef\pgfmath@reversed{\pgfmath@reversed#1}% + \expandafter\multiply\expandafter\c@pgfmath@counta\pgfmath@base\relax% + \expandafter\pgfmathbasetodec@% + \fi} \def\pgfmathbasetodec@@{\expandafter\pgfmathbasetodec@@@\pgfmath@reversed\pgfmathbasetodec} - + \def\pgfmathbasetodec@@@#1{% - \ifx\pgfmathbasetodec#1\relax% - \expandafter\edef\pgfmath@base@macro{\the\c@pgfmath@countb}% - \let\pgfmath@next=\pgfmathbasetodec@@@@% - \else% - \chardef\pgfmath@charnum`#1\relax% - \c@pgfmath@countc=\pgfmath@charnum\relax% - \ifnum\c@pgfmath@countc>96\relax% - \advance\c@pgfmath@countc by-87\relax% - \else - \ifnum\c@pgfmath@countc>64\relax% - \advance\c@pgfmath@countc by-55\relax% - \else - \advance\c@pgfmath@countc by-48\relax% - \fi% - \fi% - \ifnum\c@pgfmath@countc<\pgfmath@base\relax% - \multiply\c@pgfmath@countc by\c@pgfmath@counta% - \advance\c@pgfmath@countb by\c@pgfmath@countc% - \divide\c@pgfmath@counta by\pgfmath@base\relax% - \let\pgfmath@next\pgfmathbasetodec@@@% - \else - \pgfmath@error{Digit `#1' invalid for base \pgfmath@base}% - \let\pgfmath@next=\relax% - \fi% - \fi% - \pgfmath@next} + \ifx\pgfmathbasetodec#1\relax% + \expandafter\edef\pgfmath@base@macro{\the\c@pgfmath@countb}% + \let\pgfmath@next=\pgfmathbasetodec@@@@% + \else% + \chardef\pgfmath@charnum`#1\relax% + \c@pgfmath@countc=\pgfmath@charnum\relax% + \ifnum\c@pgfmath@countc>96\relax% + \advance\c@pgfmath@countc by-87\relax% + \else + \ifnum\c@pgfmath@countc>64\relax% + \advance\c@pgfmath@countc by-55\relax% + \else + \advance\c@pgfmath@countc by-48\relax% + \fi% + \fi% + \ifnum\c@pgfmath@countc<\pgfmath@base\relax% + \multiply\c@pgfmath@countc by\c@pgfmath@counta% + \advance\c@pgfmath@countb by\c@pgfmath@countc% + \divide\c@pgfmath@counta by\pgfmath@base\relax% + \let\pgfmath@next\pgfmathbasetodec@@@% + \else + \pgfmath@error{Digit `#1' invalid for base \pgfmath@base}% + \let\pgfmath@next=\relax% + \fi% + \fi% + \pgfmath@next} \def\pgfmathbasetodec@@@@{% - \expandafter\pgfmath@ensurenumberlength\expandafter{\pgfmath@base@macro}% + \expandafter\pgfmath@ensurenumberlength\expandafter{\pgfmath@base@macro}% } % \pgfmathdectobase % -% Convert a representation of an integer from -% base 10 to the specified base. Letters for bases +% Convert a representation of an integer from +% base 10 to the spcified base. Letters for bases % greater than 10 are in lowercase. % % #1 - a macro to store the result. @@ -135,25 +135,25 @@ % \mynumber <- 7f % \def\pgfmathdectobase#1#2#3{% - \pgfmath@checknumber{#2}% - \pgfmath@checkbase{#3}% - \c@pgfmath@counta=#2\relax% - \let#1=\pgfmath@empty% - \pgfmathloop - \ifnum\c@pgfmath@counta>0\relax% - \c@pgfmath@countb=\c@pgfmath@counta% - \divide\c@pgfmath@countb by#3\relax% - \multiply\c@pgfmath@countb by-#3\relax% - \advance\c@pgfmath@countb by\c@pgfmath@counta% - \edef#1{\csname pgfmath@lowercase digit@\the\c@pgfmath@countb\endcsname#1}% - \divide\c@pgfmath@counta by#3\relax% - \repeatpgfmathloop% - \pgfmath@ensurenumberlength{#1}} + \pgfmath@checknumber{#2}% + \pgfmath@checkbase{#3}% + \c@pgfmath@counta=#2\relax% + \let#1=\pgfmath@empty% + \pgfmathloop + \ifnum\c@pgfmath@counta>0\relax% + \c@pgfmath@countb=\c@pgfmath@counta% + \divide\c@pgfmath@countb by#3\relax% + \multiply\c@pgfmath@countb by-#3\relax% + \advance\c@pgfmath@countb by\c@pgfmath@counta% + \edef#1{\csname pgfmath@lowercase digit@\the\c@pgfmath@countb\endcsname#1}% + \divide\c@pgfmath@counta by#3\relax% + \repeatpgfmathloop% + \pgfmath@ensurenumberlength{#1}} % \pgfmathdectoBase % -% Convert a representation of an integer from -% base 10 to the specified base. Letters for bases +% Convert a representation of an integer from +% base 10 to the spcified base. Letters for bases % greater than 10 are in uppercase. % % #1 - a macro to store the result. @@ -165,45 +165,45 @@ % \pgfmathdectoBase\mynumber{127}{16} % % \mynumber <- 7F -% +% \def\pgfmathdectoBase#1#2#3{% - \pgfmath@checkbase{#3}% - \pgfmath@checknumber{#2}% - \c@pgfmath@counta=#2\relax% - \let#1=\pgfmath@empty% - \pgfmathloop - \ifnum\c@pgfmath@counta>0\relax% - \c@pgfmath@countb=\c@pgfmath@counta% - \divide\c@pgfmath@countb by#3\relax% - \multiply\c@pgfmath@countb by-#3\relax% - \advance\c@pgfmath@countb by\c@pgfmath@counta% - \edef#1{\csname pgfmath@uppercase digit@\the\c@pgfmath@countb\endcsname#1}% - \divide\c@pgfmath@counta by#3\relax% - \repeatpgfmathloop% - \pgfmath@ensurenumberlength{#1}} + \pgfmath@checkbase{#3}% + \pgfmath@checknumber{#2}% + \c@pgfmath@counta=#2\relax% + \let#1=\pgfmath@empty% + \pgfmathloop + \ifnum\c@pgfmath@counta>0\relax% + \c@pgfmath@countb=\c@pgfmath@counta% + \divide\c@pgfmath@countb by#3\relax% + \multiply\c@pgfmath@countb by-#3\relax% + \advance\c@pgfmath@countb by\c@pgfmath@counta% + \edef#1{\csname pgfmath@uppercase digit@\the\c@pgfmath@countb\endcsname#1}% + \divide\c@pgfmath@counta by#3\relax% + \repeatpgfmathloop% + \pgfmath@ensurenumberlength{#1}} \def\pgfmath@base@digits@create{% - \def\pgfmath@base@digit@style{lowercase digit}% - \c@pgfmath@counta=0\relax% - \pgfmath@base@digits@create@0123456789abcdefghijklmnopqrstuvwxyz\pgfmath@base@digits@create% - \def\pgfmath@base@digit@style{uppercase digit}% - \c@pgfmath@counta=0\relax% - \pgfmath@base@digits@create@0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\pgfmath@base@digits@create} + \def\pgfmath@base@digit@style{lowercase digit}% + \c@pgfmath@counta=0\relax% + \pgfmath@base@digits@create@0123456789abcdefghijklmnopqrstuvwxyz\pgfmath@base@digits@create% + \def\pgfmath@base@digit@style{uppercase digit}% + \c@pgfmath@counta=0\relax% + \pgfmath@base@digits@create@0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\pgfmath@base@digits@create} \def\pgfmath@base@digits@create@#1{% - \ifx\pgfmath@base@digits@create#1\relax% - \else% - \expandafter\pgfmath@def\expandafter{\pgfmath@base@digit@style}{\the\c@pgfmath@counta}{#1}% - \advance\c@pgfmath@counta by1\relax% - \expandafter\pgfmath@base@digits@create@% - \fi} + \ifx\pgfmath@base@digits@create#1\relax% + \else% + \expandafter\pgfmath@def\expandafter{\pgfmath@base@digit@style}{\the\c@pgfmath@counta}{#1}% + \advance\c@pgfmath@counta by1\relax% + \expandafter\pgfmath@base@digits@create@% + \fi} \pgfmath@base@digits@create % \pgfmathbasetobase % -% Convert a representation of an integer from +% Convert a representation of an integer from % between the specified bases. Letters for target -% bases greater than 10 are in uppercase. +% bases greater than 10 are in lppercase. % % #1 - a macro to store the result. % #2 - a number (in a macro, not a register) @@ -215,15 +215,15 @@ % \pgfmathbasetobase\mynumber{4321}{5}{9} % % \mynumber <- 721 -% +% \def\pgfmathbasetobase#1#2#3#4{% - \pgfmathbasetodec{\pgfmath@base@temp}{#2}{#3}% - \pgfmathdectobase{#1}{\pgfmath@base@temp}{#4}% + \pgfmathbasetodec{\pgfmath@base@temp}{#2}{#3}% + \pgfmathdectobase{#1}{\pgfmath@base@temp}{#4}% } % \pgfmathbasetobase % -% Convert a representation of an integer from +% Convert a representation of an integer from % between the specified bases. Letters for target % bases greater than 10 are in uppercase. % @@ -237,34 +237,34 @@ % \pgfmathbasetobase\mynumber{1234}{5}{12} % % \mynumber <- 142 -% +% \def\pgfmathbasetoBase#1#2#3#4{% - \pgfmathbasetodec{\pgfmath@base@temp}{#2}{#3}% - \pgfmathdectoBase{#1}{\pgfmath@base@temp}{#4}% + \pgfmathbasetodec{\pgfmath@base@temp}{#2}{#3}% + \pgfmathdectoBase{#1}{\pgfmath@base@temp}{#4}% } \def\pgfmath@checkbase#1{% - \ifnum#1<2\relax% - \pgfmath@error{Cannot process numbers in base `#1'.}% - \else% - \ifnum#1>36\relax% - \pgfmath@error{Cannot process numbers in base `#1'.}% - \fi% - \fi} - + \ifnum#1<2\relax% + \pgfmath@error{Cannot process numbers in base `#1'.}% + \else% + \ifnum#1>36\relax% + \pgfmath@error{Cannot process numbers in base `#1'.}% + \fi% + \fi} + \def\pgfmath@checknumber#1{% - \expandafter\pgfmath@checknumber@#1\pgfmath@} + \expandafter\pgfmath@checknumber@#1\pgfmath@} \def\pgfmath@checknumber@#1#2\pgfmath@{% - \ifx#1-% - \pgfmath@error{Cannot process negative numbers.}% - \fi} + \ifx#1-% + \pgfmath@error{Cannot process negative numbers.}% + \fi} % \pgfmath@ensurenumberlength % % Internal macro for making a representation of a number have -% a specific length, byte prefixing zeros to the number. +% a specific length, byt prefixing zeros to the number. % -% #1 - a macro containing a representation of an integer. +% #1 - a macro contatining a representation of an integer. % #2 - the number of digits to ensure. % % e.g. @@ -277,54 +277,55 @@ % \foo <- 000007FF % \def\pgfmath@ensurenumberlength#1{% - \def\pgfmath@base@tempa{#1}% - \expandafter\c@pgfmath@counta\pgfmath@basenumberlength\relax% - \expandafter\pgfmath@ensurenumberlength@#1\pgfmath@ensurenumberlength} + \def\pgfmath@base@tempa{#1}% + \expandafter\c@pgfmath@counta\pgfmath@basenumberlength\relax% + \expandafter\pgfmath@ensurenumberlength@#1\pgfmath@ensurenumberlength} \def\pgfmath@ensurenumberlength@#1{% - \ifx\pgfmath@ensurenumberlength#1\relax% - \expandafter\pgfmath@ensurenumberlength@@% - \else% - \advance\c@pgfmath@counta by-1\relax% - \expandafter\pgfmath@ensurenumberlength@ - \fi} + \ifx\pgfmath@ensurenumberlength#1\relax% + \expandafter\pgfmath@ensurenumberlength@@% + \else% + \advance\c@pgfmath@counta by-1\relax% + \expandafter\pgfmath@ensurenumberlength@ + \fi} \def\pgfmath@ensurenumberlength@@{% - \edef\pgfmath@base@tempb{\pgfmath@base@tempa}% - \pgfmath@ensurenumberlength@@@} + \edef\pgfmath@base@tempb{\pgfmath@base@tempa}% + \pgfmath@ensurenumberlength@@@} \def\pgfmath@ensurenumberlength@@@{% - \ifnum\c@pgfmath@counta>0\relax% - \advance\c@pgfmath@counta by-1\relax% - \edef\pgfmath@base@tempb{0\pgfmath@base@tempb}% - \expandafter\pgfmath@ensurenumberlength@@@% - \fi% - \expandafter\edef\pgfmath@base@tempa{\pgfmath@base@tempb}} - + \ifnum\c@pgfmath@counta>0\relax% + \advance\c@pgfmath@counta by-1\relax% + \edef\pgfmath@base@tempb{0\pgfmath@base@tempb}% + \expandafter\pgfmath@ensurenumberlength@@@% + \fi% + \expandafter\edef\pgfmath@base@tempa{\pgfmath@base@tempb}} + \def\pgfmathsetbasenumberlength#1{\def\pgfmath@basenumberlength{#1}} \pgfmathsetbasenumberlength{1}% % \pgfmathtodigitlist\marg{macro}\marg{number}} % -% This command converts \meta{number} into a comma-separated -% list of digits and stores the result in \meta{macro}. -% The \marg{number} is \emph{not} parsed before processing. +% This command converts \meta{number} into a comma-separated +% list of digits and stores the result in \meta{macro}. +% The \marg{number} is \emph{not} parsed before processing. % \def\pgfmathtodigitlist#1#2{% - \def\pgfmath@temp{#1}% - \let\pgfmath@digitlist=\pgfutil@empty% - \edef\pgfmath@@tmp{#2}% - \expandafter\pgfmath@todigitlist\pgfmath@@tmp @% + \def\pgfmath@temp{#1}% + \let\pgfmath@digitlist=\pgfutil@empty% + \edef\pgfmath@@tmp{#2}% + \expandafter\pgfmath@todigitlist\pgfmath@@tmp @% } \def\pgfmath@base@atchar{@} \def\pgfmath@todigitlist#1{% - \def\pgfmath@digit{#1}% - \ifx\pgfmath@digit\pgfmath@base@atchar% - \expandafter\let\pgfmath@temp=\pgfmath@digitlist% - \else% - \ifx\pgfmath@digitlist\pgfutil@empty% - \edef\pgfmath@digitlist{#1}% - \else% - \edef\pgfmath@digitlist{\pgfmath@digitlist,#1}% - \fi% - \expandafter\pgfmath@todigitlist% - \fi% + \def\pgfmath@digit{#1}% + \ifx\pgfmath@digit\pgfmath@base@atchar% + \expandafter\let\pgfmath@temp=\pgfmath@digitlist% + \else% + \ifx\pgfmath@digitlist\pgfutil@empty% + \edef\pgfmath@digitlist{#1}% + \else% + \edef\pgfmath@digitlist{\pgfmath@digitlist,#1}% + \fi% + \expandafter\pgfmath@todigitlist% + \fi% } + diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.basic.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.basic.code.tex index 2dbf154d8be..b6ac16c8bf3 100644 --- a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.basic.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.basic.code.tex @@ -14,7 +14,7 @@ % add function. % \pgfmathdeclarefunction{add}{2}{% - \begingroup% + \begingroup% \pgfmath@x=#1pt\relax% \pgfmath@y=#2pt\relax% \advance\pgfmath@x by\pgfmath@y% @@ -26,7 +26,7 @@ % subtract function. % \pgfmathdeclarefunction{subtract}{2}{% - \begingroup% + \begingroup% \pgfmath@x=#1pt\relax% \pgfmath@y=#2pt\relax% \advance\pgfmath@x by-\pgfmath@y% @@ -37,11 +37,11 @@ % neg function. % \pgfmathdeclarefunction{neg}{1}{% - \begingroup% - \pgfmath@x=-#1pt\relax% - \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@x}}% - \pgfmath@smuggleone\pgfmathresult% - \endgroup% + \begingroup% + \pgfmath@x=-#1pt\relax% + \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@x}}% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% } % change the precedence for neg. % Otherwise, unary minus and exponentiation won't have the correct precedence @@ -64,206 +64,206 @@ \newif\ifpgfmath@divide@period \pgfmathdeclarefunction{divide}{2}{% - \begingroup% - \pgfmath@x=#1pt\relax% - \pgfmath@y=#2pt\relax% - \let\pgfmath@sign=\pgfmath@empty% - \ifdim0pt=\pgfmath@y% - \pgfmath@error{You've asked me to divide `#1' by `#2', % - but I cannot divide any number by `#2'}% - \fi% - \afterassignment\pgfmath@xa% - \c@pgfmath@counta\the\pgfmath@y\relax% - \ifdim0pt=\pgfmath@xa% - \divide\pgfmath@x by\c@pgfmath@counta% - \else% - \ifdim0pt>\pgfmath@x% - \def\pgfmath@sign{-}% - \pgfmath@x=-\pgfmath@x% - \fi% - \ifdim0pt>\pgfmath@y% - \expandafter\def\expandafter\pgfmath@sign\expandafter{\pgfmath@sign-}% - \pgfmath@y=-\pgfmath@y% - \fi% - \ifdim1pt>\pgfmath@y% - \pgfmathreciprocal@{\pgfmath@tonumber{\pgfmath@y}}% - \pgfmath@x=\pgfmath@sign\pgfmathresult\pgfmath@x% - \else% - \def\pgfmathresult{0}% - \pgfmath@divide@periodtrue% - \c@pgfmath@counta=0\relax% - \pgfmathdivide@@% - \pgfmath@x=\pgfmath@sign\pgfmathresult pt\relax% - \fi% - \fi% - \pgfmath@returnone\pgfmath@x% - \endgroup% + \begingroup% + \pgfmath@x=#1pt\relax% + \pgfmath@y=#2pt\relax% + \let\pgfmath@sign=\pgfmath@empty% + \ifdim0pt=\pgfmath@y% + \pgfmath@error{You've asked me to divide `#1' by `#2', % + but I cannot divide any number by `#2'}% + \fi% + \afterassignment\pgfmath@xa% + \c@pgfmath@counta\the\pgfmath@y\relax% + \ifdim0pt=\pgfmath@xa% + \divide\pgfmath@x by\c@pgfmath@counta% + \else% + \ifdim0pt>\pgfmath@x% + \def\pgfmath@sign{-}% + \pgfmath@x=-\pgfmath@x% + \fi% + \ifdim0pt>\pgfmath@y% + \expandafter\def\expandafter\pgfmath@sign\expandafter{\pgfmath@sign-}% + \pgfmath@y=-\pgfmath@y% + \fi% + \ifdim1pt>\pgfmath@y% + \pgfmathreciprocal@{\pgfmath@tonumber{\pgfmath@y}}% + \pgfmath@x=\pgfmath@sign\pgfmathresult\pgfmath@x% + \else% + \def\pgfmathresult{0}% + \pgfmath@divide@periodtrue% + \c@pgfmath@counta=0\relax% + \pgfmathdivide@@% + \pgfmath@x=\pgfmath@sign\pgfmathresult pt\relax% + \fi% + \fi% + \pgfmath@returnone\pgfmath@x% + \endgroup% } \def\pgfmath@small@number{0.00002} \def\pgfmathdivide@@{% - \let\pgfmath@next=\relax% - \ifdim\pgfmath@small@number pt<\pgfmath@x% - \ifdim\pgfmath@small@number pt<\pgfmath@y% - \ifdim\pgfmath@y>\pgfmath@x% - \ifpgfmath@divide@period% - \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult.}% - \pgfmath@divide@periodfalse% - \fi% - \pgfmathdivide@dimenbyten\pgfmath@y% - \ifdim\pgfmath@y>\pgfmath@x% - \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult0}% - \fi% - \else% - \c@pgfmath@counta=\pgfmath@x% - \c@pgfmath@countb=\pgfmath@y% - \divide\c@pgfmath@counta by\c@pgfmath@countb% - \pgfmath@ya=\c@pgfmath@counta\pgfmath@y% - \advance\pgfmath@x by-\pgfmath@ya% - \def\pgfmath@next{% - \toks0=\expandafter{\pgfmathresult}% - \edef\pgfmathresult{\the\toks0 \the\c@pgfmath@counta}% - }% - \ifpgfmath@divide@period - \else - % we are behind the period. It may happen that the - % result is more than one digit - in that case, - % introduce special handling: - \ifnum\c@pgfmath@counta>9 % - \expandafter\pgfmathdivide@advance@last@digit\pgfmathresult CCCCC\@@ - \advance\c@pgfmath@counta by-10 % - \ifnum\c@pgfmath@counta=0 - \let\pgfmath@next=\relax - \fi - \fi - \fi - \pgfmath@next - \fi% - \let\pgfmath@next=\pgfmathdivide@@% - \fi% - \fi% - \pgfmath@next% + \let\pgfmath@next=\relax% + \ifdim\pgfmath@small@number pt<\pgfmath@x% + \ifdim\pgfmath@small@number pt<\pgfmath@y% + \ifdim\pgfmath@y>\pgfmath@x% + \ifpgfmath@divide@period% + \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult.}% + \pgfmath@divide@periodfalse% + \fi% + \pgfmathdivide@dimenbyten\pgfmath@y% + \ifdim\pgfmath@y>\pgfmath@x% + \expandafter\def\expandafter\pgfmathresult\expandafter{\pgfmathresult0}% + \fi% + \else% + \c@pgfmath@counta=\pgfmath@x% + \c@pgfmath@countb=\pgfmath@y% + \divide\c@pgfmath@counta by\c@pgfmath@countb% + \pgfmath@ya=\c@pgfmath@counta\pgfmath@y% + \advance\pgfmath@x by-\pgfmath@ya% + \def\pgfmath@next{% + \toks0=\expandafter{\pgfmathresult}% + \edef\pgfmathresult{\the\toks0 \the\c@pgfmath@counta}% + }% + \ifpgfmath@divide@period + \else + % we are behind the period. It may happen that the + % result is more than one digit - in that case, + % introduce special handling: + \ifnum\c@pgfmath@counta>9 % + \expandafter\pgfmathdivide@advance@last@digit\pgfmathresult CCCCC\@@ + \advance\c@pgfmath@counta by-10 % + \ifnum\c@pgfmath@counta=0 + \let\pgfmath@next=\relax + \fi + \fi + \fi + \pgfmath@next + \fi% + \let\pgfmath@next=\pgfmathdivide@@% + \fi% + \fi% + \pgfmath@next% } % advances the last digit found in the number. Any missing digits are % supposed to be filled with 'C'. \def\pgfmathdivide@advance@last@digit#1.#2#3#4#5#6#7\@@{% - \pgfmath@ya=\pgfmathresult pt % - \if#2C% - \pgfmath@xa=1pt % - \else - \if#3C% - \pgfmath@xa=0.1pt % - \else - \if#4C% - \pgfmath@xa=0.01pt % - \else - \if#5C% - \pgfmath@xa=0.001pt % - \else - \if#6C% - \pgfmath@xa=0.0001pt % - \else - \pgfmath@xa=0.00001pt % - \fi - \fi - \fi - \fi - \fi - \advance\pgfmath@ya by\pgfmath@xa - \edef\pgfmathresult{\pgfmath@tonumber@notrailingzero\pgfmath@ya}% + \pgfmath@ya=\pgfmathresult pt % + \if#2C% + \pgfmath@xa=1pt % + \else + \if#3C% + \pgfmath@xa=0.1pt % + \else + \if#4C% + \pgfmath@xa=0.01pt % + \else + \if#5C% + \pgfmath@xa=0.001pt % + \else + \if#6C% + \pgfmath@xa=0.0001pt % + \else + \pgfmath@xa=0.00001pt % + \fi + \fi + \fi + \fi + \fi + \advance\pgfmath@ya by\pgfmath@xa + \edef\pgfmathresult{\pgfmath@tonumber@notrailingzero\pgfmath@ya}% }% { \catcode`\p=12 \catcode`\t=12 \gdef\Pgf@geT@NO@TRAILING@ZERO#1.#2pt{% - #1.% - \ifnum#2=0 \else #2\fi + #1.% + \ifnum#2=0 \else #2\fi } } \def\pgfmath@tonumber@notrailingzero#1{\expandafter\Pgf@geT@NO@TRAILING@ZERO\the#1} \def\pgfmathdivide@dimenbyten#1{% - \edef\pgfmath@temp{\pgfmath@tonumber{#1}}% - \expandafter\pgfmathdivide@@dimenbyten\pgfmath@temp\@@#1\@@} + \edef\pgfmath@temp{\pgfmath@tonumber{#1}}% + \expandafter\pgfmathdivide@@dimenbyten\pgfmath@temp\@@#1\@@} \def\pgfmathdivide@@dimenbyten#1.#2\@@#3\@@{% - \pgfmath@tempcnta=#1\relax% - \divide\pgfmath@tempcnta by10\relax% - \pgfmath@tempcntb=\pgfmath@tempcnta% - \multiply\pgfmath@tempcnta by-10\relax% - \advance\pgfmath@tempcnta by#1\relax% - #3=\the\pgfmath@tempcntb.\the\pgfmath@tempcnta#2pt\relax% + \pgfmath@tempcnta=#1\relax% + \divide\pgfmath@tempcnta by10\relax% + \pgfmath@tempcntb=\pgfmath@tempcnta% + \multiply\pgfmath@tempcnta by-10\relax% + \advance\pgfmath@tempcnta by#1\relax% + #3=\the\pgfmath@tempcntb.\the\pgfmath@tempcnta#2pt\relax% } % reciprocal function. % \pgfmathdeclarefunction{reciprocal}{1}{% - \begingroup% - \expandafter\pgfmath@x#1pt\relax% - \ifdim\pgfmath@x=0pt\relax% - \pgfmath@error{You asked me to calculate `1/#1', but I cannot divide any number by zero}{}% - \fi% - \edef\pgfmath@reciprocaltemp{\pgfmath@tonumber{\pgfmath@x}}% - \expandafter\pgfmathreciprocal@@\pgfmath@reciprocaltemp0000000\pgfmath@} + \begingroup% + \expandafter\pgfmath@x#1pt\relax% + \ifdim\pgfmath@x=0pt\relax% + \pgfmath@error{You asked me to calculate `1/#1', but I cannot divide any number by zero}{}% + \fi% + \edef\pgfmath@reciprocaltemp{\pgfmath@tonumber{\pgfmath@x}}% + \expandafter\pgfmathreciprocal@@\pgfmath@reciprocaltemp0000000\pgfmath@} \def\pgfmathreciprocal@@#1.#2#3#4#5#6#7\pgfmath@{% - \c@pgfmath@counta#2#3#4#5#6\relax% - % If the number is an integer, use TeX arithmetic. - \ifnum\c@pgfmath@counta=0\relax% - \pgfmath@x1pt\relax% - \divide\pgfmath@x#1\relax% - \else% - \ifnum#1>100\relax% - \c@pgfmath@counta#1#2#3#4\relax% - \c@pgfmath@countb1000000000\relax% - \divide\c@pgfmath@countb\c@pgfmath@counta% - \c@pgfmath@counta\c@pgfmath@countb% - \divide\c@pgfmath@counta10000\relax% - \pgfmath@x\c@pgfmath@counta pt\relax% - \multiply\c@pgfmath@counta-10000\relax% - \advance\c@pgfmath@countb\c@pgfmath@counta% - \pgfmath@y\c@pgfmath@countb pt\relax% - \divide\pgfmath@y1000000\relax% - \advance\pgfmath@x\pgfmath@y% - \else% - \c@pgfmath@counta#1#2#3#4#5#6\relax% - \c@pgfmath@countb1000000000\relax% - \divide\c@pgfmath@countb\c@pgfmath@counta% - \c@pgfmath@counta\c@pgfmath@countb% - \divide\c@pgfmath@counta10000\relax% - \pgfmath@x\c@pgfmath@counta pt\relax% - \multiply\c@pgfmath@counta-10000\relax% - \advance\c@pgfmath@countb\c@pgfmath@counta% - \pgfmath@y\c@pgfmath@countb pt\relax% - \pgfmath@y.1\pgfmath@y% Yes! This way is more accurate. Go figure... - \pgfmath@y.1\pgfmath@y% - \pgfmath@y.1\pgfmath@y% - \pgfmath@y.1\pgfmath@y% - \advance\pgfmath@x\pgfmath@y% - \fi% - \fi% - \pgfmath@returnone\pgfmath@x% - \endgroup% + \c@pgfmath@counta#2#3#4#5#6\relax% + % If the number is an integer, use TeX arithmatic. + \ifnum\c@pgfmath@counta=0\relax% + \pgfmath@x1pt\relax% + \divide\pgfmath@x#1\relax% + \else% + \ifnum#1>100\relax% + \c@pgfmath@counta#1#2#3#4\relax% + \c@pgfmath@countb1000000000\relax% + \divide\c@pgfmath@countb\c@pgfmath@counta% + \c@pgfmath@counta\c@pgfmath@countb% + \divide\c@pgfmath@counta10000\relax% + \pgfmath@x\c@pgfmath@counta pt\relax% + \multiply\c@pgfmath@counta-10000\relax% + \advance\c@pgfmath@countb\c@pgfmath@counta% + \pgfmath@y\c@pgfmath@countb pt\relax% + \divide\pgfmath@y1000000\relax% + \advance\pgfmath@x\pgfmath@y% + \else% + \c@pgfmath@counta#1#2#3#4#5#6\relax% + \c@pgfmath@countb1000000000\relax% + \divide\c@pgfmath@countb\c@pgfmath@counta% + \c@pgfmath@counta\c@pgfmath@countb% + \divide\c@pgfmath@counta10000\relax% + \pgfmath@x\c@pgfmath@counta pt\relax% + \multiply\c@pgfmath@counta-10000\relax% + \advance\c@pgfmath@countb\c@pgfmath@counta% + \pgfmath@y\c@pgfmath@countb pt\relax% + \pgfmath@y.1\pgfmath@y% Yes! This way is more accurate. Go figure... + \pgfmath@y.1\pgfmath@y% + \pgfmath@y.1\pgfmath@y% + \pgfmath@y.1\pgfmath@y% + \advance\pgfmath@x\pgfmath@y% + \fi% + \fi% + \pgfmath@returnone\pgfmath@x% + \endgroup% } % div function. % \pgfmathdeclarefunction{div}{2}{% - \begingroup% - \pgfmathdivide@{#1}{#2}% - \ifdim\pgfmathresult pt<0pt\relax% - \pgfmathceil@{\pgfmathresult}% - \else% - \pgfmathfloor@{\pgfmathresult}% - \fi% - \afterassignment\pgfmath@gobbletilpgfmath@% - \c@pgfmath@counta=\pgfmathresult\relax\pgfmath@% - \edef\pgfmathresult{\the\c@pgfmath@counta}% - \pgfmath@smuggleone\pgfmathresult% - \endgroup% + \begingroup% + \pgfmathdivide@{#1}{#2}% + \ifdim\pgfmathresult pt<0pt\relax% + \pgfmathceil@{\pgfmathresult}% + \else% + \pgfmathfloor@{\pgfmathresult}% + \fi% + \afterassignment\pgfmath@gobbletilpgfmath@% + \c@pgfmath@counta=\pgfmathresult\relax\pgfmath@% + \edef\pgfmathresult{\the\c@pgfmath@counta}% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% } % mod function. @@ -285,27 +285,27 @@ % Mod function (never negative). % \pgfmathdeclarefunction{Mod}{2}{% - \begingroup% - \pgfmathmod@{#1}{#2}% - \pgfmath@x=\pgfmathresult pt\relax% - \ifdim\pgfmath@x<0pt\relax% - \advance\pgfmath@x by#2pt\relax% - \fi% - \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@x}}% - \pgfmath@smuggleone\pgfmathresult% - \endgroup% + \begingroup% + \pgfmathmod@{#1}{#2}% + \pgfmath@x=\pgfmathresult pt\relax% + \ifdim\pgfmath@x<0pt\relax% + \advance\pgfmath@x by#2pt\relax% + \fi% + \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@x}}% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% } % abs function. % \pgfmathdeclarefunction{abs}{1}{% - \begingroup% - \expandafter\pgfmath@x#1pt\relax% - \ifdim\pgfmath@x<0pt\relax% - \pgfmath@x-\pgfmath@x% - \fi% - \pgfmath@returnone\pgfmath@x% - \endgroup% + \begingroup% + \expandafter\pgfmath@x#1pt\relax% + \ifdim\pgfmath@x<0pt\relax% + \pgfmath@x-\pgfmath@x% + \fi% + \pgfmath@returnone\pgfmath@x% + \endgroup% } % sign(x) @@ -334,189 +334,189 @@ % uses coefficients contributed by Alain Matthes. % \pgfmathdeclarefunction{ln}{1}{% - \begingroup% - \expandafter\pgfmath@x#1pt\relax% - \ifdim\pgfmath@x>0pt\else% - \pgfmath@error{I cannot calculate the logarithm of `#1'}{}% - \fi% - \c@pgfmath@counta=0\relax% - \ifdim\pgfmath@x>2pt\relax% - \ifdim\pgfmath@x<128pt\relax% - \ifdim\pgfmath@x<8pt\relax% - \ifdim\pgfmath@x<4pt\relax% - \divide\pgfmath@x by2\relax% - \c@pgfmath@counta=1\relax% - \else% - \divide\pgfmath@x by4\relax% - \c@pgfmath@counta=2\relax% - \fi% - \else% - \ifdim\pgfmath@x<32pt\relax% - \ifdim\pgfmath@x<16pt\relax% - \divide\pgfmath@x by8\relax% - \c@pgfmath@counta=3\relax% - \else% - \divide\pgfmath@x by16\relax% - \c@pgfmath@counta=4\relax% - \fi% - \else% - \ifdim\pgfmath@x<64pt\relax% - \divide\pgfmath@x by32\relax% - \c@pgfmath@counta=5\relax% - \else% - \divide\pgfmath@x by64\relax% - \c@pgfmath@counta=6\relax% - \fi% - \fi% - \fi% - \else% - \ifdim\pgfmath@x<2048pt\relax% - \ifdim\pgfmath@x<512pt\relax% - \ifdim\pgfmath@x<256pt\relax% - \divide\pgfmath@x by128\relax% - \c@pgfmath@counta=7\relax% - \else% - \divide\pgfmath@x by256\relax% - \c@pgfmath@counta=8\relax% - \fi% - \else% - \ifdim\pgfmath@x<1024pt\relax% - \divide\pgfmath@x by512\relax% - \c@pgfmath@counta=9\relax% - \else% - \divide\pgfmath@x by1024\relax% - \c@pgfmath@counta=10\relax% - \fi% - \fi% - \else% - \ifdim\pgfmath@x<8192pt\relax% - \ifdim\pgfmath@x<4096pt\relax% - \divide\pgfmath@x by2048\relax% - \c@pgfmath@counta=11\relax% - \else% - \divide\pgfmath@x by4096\relax% - \c@pgfmath@counta =12\relax% - \fi% - \else% - \divide\pgfmath@x by8192\relax% - \c@pgfmath@counta=13\relax% - \fi% - \fi% - \fi% - \else% - \ifdim\pgfmath@x<1pt\relax% - \ifdim\pgfmath@x>0.0078125pt\relax% 2^-7 - \ifdim\pgfmath@x>0.125pt\relax% 2^-3 - \ifdim\pgfmath@x>0.5pt\relax% 2^-1 - \multiply\pgfmath@x by2\relax% - \c@pgfmath@counta=-1\relax% - \else% - \multiply\pgfmath@x by4\relax% - \c@pgfmath@counta=-2\relax% - \fi% - \else% - \ifdim\pgfmath@x>0.03125pt\relax% 2^-5 - \ifdim\pgfmath@x>0.0625pt\relax% - \multiply\pgfmath@x by8\relax% - \c@pgfmath@counta=-3\relax% - \else% - \multiply\pgfmath@x by16\relax% - \c@pgfmath@counta=-4\relax% - \fi% - \else% - \ifdim\pgfmath@x>0.015625pt\relax% 2^-6 - \multiply\pgfmath@x by32\relax% - \c@pgfmath@counta=-5\relax% - \else% - \multiply\pgfmath@x by64\relax% - \c@pgfmath@counta=-6\relax% - \fi% - \fi% - \fi% - \else% - \ifdim\pgfmath@x>0.000244140625pt\relax% 2^-11 - \ifdim\pgfmath@x>0.001953125pt\relax% 2^-9 - \ifdim\pgfmath@x>0.00390625pt\relax% 2^-8 - \multiply\pgfmath@x by128\relax% - \c@pgfmath@counta=-7\relax% - \else% - \multiply\pgfmath@x by256\relax% - \c@pgfmath@counta=-8\relax% - \fi% - \else% - \ifdim\pgfmath@x>0.0009765625pt\relax% 2^-10 - \multiply\pgfmath@x by512\relax% - \c@pgfmath@counta=-9\relax% - \else% - \multiply\pgfmath@x by1024\relax% - \c@pgfmath@counta=-10\relax% - \fi% - \fi% - \else% - \ifdim\pgfmath@x>0.0001220703125pt\relax% 2^13 - \ifdim\pgfmath@x>0.0002441406256pt\relax% 2^12 - \multiply\pgfmath@x by2048\relax% - \c@pgfmath@counta=-11\relax% - \else% - \multiply\pgfmath@x by4096\relax% - \c@pgfmath@counta=-12\relax% - \fi% - \else% - \multiply\pgfmath@x by8192\relax% - \c@pgfmath@counta=-13\relax% - \fi% - \fi% - \fi% - \fi% - \fi% - % - % Use A+(B+(C+(D+(E+F*x)*x)*x)*x)*x - % - % where: - % A = -2.787927935 - % B = 5.047861502 - % C = -3.489886985 - % D = 1.589480044 - % E = -.4025153233 - % F = 0.04300521312 - % - \edef\pgfmath@temp{\pgfmath@tonumber{\pgfmath@x}}% - \pgfmath@x=0.04300521312\pgfmath@x% - \advance\pgfmath@x by-.4025153233pt\relax% - \pgfmath@x=\pgfmath@temp\pgfmath@x% - \advance\pgfmath@x by1.589480044pt\relax% - \pgfmath@x=\pgfmath@temp\pgfmath@x% - \advance\pgfmath@x by-3.489886985pt\relax% - \pgfmath@x=\pgfmath@temp\pgfmath@x% - \advance\pgfmath@x by5.047861502pt\relax% - \pgfmath@x=\pgfmath@temp\pgfmath@x% - \advance\pgfmath@x by-2.787927935pt\relax% - \advance\pgfmath@x by\c@pgfmath@counta pt\relax% - \pgfmath@x=0.6931471806\pgfmath@x% - \pgfmath@returnone\pgfmath@x% - \endgroup% + \begingroup% + \expandafter\pgfmath@x#1pt\relax% + \ifdim\pgfmath@x>0pt\else% + \pgfmath@error{I cannot calculate the logarithm of `#1'}{}% + \fi% + \c@pgfmath@counta=0\relax% + \ifdim\pgfmath@x>2pt\relax% + \ifdim\pgfmath@x<128pt\relax% + \ifdim\pgfmath@x<8pt\relax% + \ifdim\pgfmath@x<4pt\relax% + \divide\pgfmath@x by2\relax% + \c@pgfmath@counta=1\relax% + \else% + \divide\pgfmath@x by4\relax% + \c@pgfmath@counta=2\relax% + \fi% + \else% + \ifdim\pgfmath@x<32pt\relax% + \ifdim\pgfmath@x<16pt\relax% + \divide\pgfmath@x by8\relax% + \c@pgfmath@counta=3\relax% + \else% + \divide\pgfmath@x by16\relax% + \c@pgfmath@counta=4\relax% + \fi% + \else% + \ifdim\pgfmath@x<64pt\relax% + \divide\pgfmath@x by32\relax% + \c@pgfmath@counta=5\relax% + \else% + \divide\pgfmath@x by64\relax% + \c@pgfmath@counta=6\relax% + \fi% + \fi% + \fi% + \else% + \ifdim\pgfmath@x<2048pt\relax% + \ifdim\pgfmath@x<512pt\relax% + \ifdim\pgfmath@x<256pt\relax% + \divide\pgfmath@x by128\relax% + \c@pgfmath@counta=7\relax% + \else% + \divide\pgfmath@x by256\relax% + \c@pgfmath@counta=8\relax% + \fi% + \else% + \ifdim\pgfmath@x<1024pt\relax% + \divide\pgfmath@x by512\relax% + \c@pgfmath@counta=9\relax% + \else% + \divide\pgfmath@x by1024\relax% + \c@pgfmath@counta=10\relax% + \fi% + \fi% + \else% + \ifdim\pgfmath@x<8192pt\relax% + \ifdim\pgfmath@x<4096pt\relax% + \divide\pgfmath@x by2048\relax% + \c@pgfmath@counta=11\relax% + \else% + \divide\pgfmath@x by4096\relax% + \c@pgfmath@counta =12\relax% + \fi% + \else% + \divide\pgfmath@x by8192\relax% + \c@pgfmath@counta=13\relax% + \fi% + \fi% + \fi% + \else% + \ifdim\pgfmath@x<1pt\relax% + \ifdim\pgfmath@x>0.0078125pt\relax% 2^-7 + \ifdim\pgfmath@x>0.125pt\relax% 2^-3 + \ifdim\pgfmath@x>0.5pt\relax% 2^-1 + \multiply\pgfmath@x by2\relax% + \c@pgfmath@counta=-1\relax% + \else% + \multiply\pgfmath@x by4\relax% + \c@pgfmath@counta=-2\relax% + \fi% + \else% + \ifdim\pgfmath@x>0.03125pt\relax% 2^-5 + \ifdim\pgfmath@x>0.0625pt\relax% + \multiply\pgfmath@x by8\relax% + \c@pgfmath@counta=-3\relax% + \else% + \multiply\pgfmath@x by16\relax% + \c@pgfmath@counta=-4\relax% + \fi% + \else% + \ifdim\pgfmath@x>0.015625pt\relax% 2^-6 + \multiply\pgfmath@x by32\relax% + \c@pgfmath@counta=-5\relax% + \else% + \multiply\pgfmath@x by64\relax% + \c@pgfmath@counta=-6\relax% + \fi% + \fi% + \fi% + \else% + \ifdim\pgfmath@x>0.000244140625pt\relax% 2^-11 + \ifdim\pgfmath@x>0.001953125pt\relax% 2^-9 + \ifdim\pgfmath@x>0.00390625pt\relax% 2^-8 + \multiply\pgfmath@x by128\relax% + \c@pgfmath@counta=-7\relax% + \else% + \multiply\pgfmath@x by256\relax% + \c@pgfmath@counta=-8\relax% + \fi% + \else% + \ifdim\pgfmath@x>0.0009765625pt\relax% 2^-10 + \multiply\pgfmath@x by512\relax% + \c@pgfmath@counta=-9\relax% + \else% + \multiply\pgfmath@x by1024\relax% + \c@pgfmath@counta=-10\relax% + \fi% + \fi% + \else% + \ifdim\pgfmath@x>0.0001220703125pt\relax% 2^13 + \ifdim\pgfmath@x>0.0002441406256pt\relax% 2^12 + \multiply\pgfmath@x by2048\relax% + \c@pgfmath@counta=-11\relax% + \else% + \multiply\pgfmath@x by4096\relax% + \c@pgfmath@counta=-12\relax% + \fi% + \else% + \multiply\pgfmath@x by8192\relax% + \c@pgfmath@counta=-13\relax% + \fi% + \fi% + \fi% + \fi% + \fi% + % + % Use A+(B+(C+(D+(E+F*x)*x)*x)*x)*x + % + % where: + % A = -2.787927935 + % B = 5.047861502 + % C = -3.489886985 + % D = 1.589480044 + % E = -.4025153233 + % F = 0.04300521312 + % + \edef\pgfmath@temp{\pgfmath@tonumber{\pgfmath@x}}% + \pgfmath@x=0.04300521312\pgfmath@x% + \advance\pgfmath@x by-.4025153233pt\relax% + \pgfmath@x=\pgfmath@temp\pgfmath@x% + \advance\pgfmath@x by1.589480044pt\relax% + \pgfmath@x=\pgfmath@temp\pgfmath@x% + \advance\pgfmath@x by-3.489886985pt\relax% + \pgfmath@x=\pgfmath@temp\pgfmath@x% + \advance\pgfmath@x by5.047861502pt\relax% + \pgfmath@x=\pgfmath@temp\pgfmath@x% + \advance\pgfmath@x by-2.787927935pt\relax% + \advance\pgfmath@x by\c@pgfmath@counta pt\relax% + \pgfmath@x=0.6931471806\pgfmath@x% + \pgfmath@returnone\pgfmath@x% + \endgroup% } % log2 function. % \pgfmathdeclarefunction{log2}{1}{% - \begingroup% - \pgfmathln@{#1}% - \pgfmath@x=\pgfmathresult pt\relax% - \pgfmath@x=1.442695041\pgfmath@x% 1/ln(2). - \pgfmath@returnone\pgfmath@x% - \endgroup% + \begingroup% + \pgfmathln@{#1}% + \pgfmath@x=\pgfmathresult pt\relax% + \pgfmath@x=1.442695041\pgfmath@x% 1/ln(2). + \pgfmath@returnone\pgfmath@x% + \endgroup% } % log10 function % -\pgfmathdeclarefunction{log10}{1}{% - \begingroup% - \pgfmathln@{#1}% - \pgfmath@x=\pgfmathresult pt\relax% - \pgfmath@x=0.43429441\pgfmath@x% 1/ln(10). - \pgfmath@returnone\pgfmath@x% - \endgroup% +\pgfmathdeclarefunction{log10}{1}{% + \begingroup% + \pgfmathln@{#1}% + \pgfmath@x=\pgfmathresult pt\relax% + \pgfmath@x=0.43429441\pgfmath@x% 1/ln(10). + \pgfmath@returnone\pgfmath@x% + \endgroup% } % This is needed since \pgfmathlog2 and \pgfmathlog10 are not legal macro names @@ -527,7 +527,7 @@ % exp function. % -\pgfmathdeclarefunction{exp}{1}{% +\pgfmathdeclarefunction{exp}{1}{% \begingroup \pgfmath@xc=#1pt\relax \pgfmath@yc=#1pt\relax @@ -559,186 +559,186 @@ % sqrt function. % -\pgfmathdeclarefunction{sqrt}{1}{% - \begingroup% - \expandafter\pgfmath@x#1pt\relax% - \ifdim\pgfmath@x<0pt\relax% - \pgfmath@error{I cannot calculate the square-root of the negative number `#1'}{}% - \else% - \ifdim\pgfmath@x<10pt\relax% - \def\pgfmath@zeros{0}% - \def\pgfmath@targetiterations{1}% - \else% - \ifdim\pgfmath@x<100pt\relax% - \def\pgfmath@zeros{}% - \def\pgfmath@targetiterations{1}% - \else% - \ifdim\pgfmath@x<1000pt\relax% - \def\pgfmath@zeros{0}% - \def\pgfmath@targetiterations{2}% - \else% - \ifdim\pgfmath@x<10000pt\relax% - \def\pgfmath@zeros{}% - \def\pgfmath@targetiterations{2}% - \else% - \def\pgfmath@zeros{0}% - \def\pgfmath@targetiterations{3}% - \fi\fi\fi\fi\fi% - \edef\pgfmath@temp{\pgfmath@zeros\pgfmath@tonumber{\pgfmath@x}}% - \expandafter\pgfmath@sqrt@\pgfmath@temp\pgfmath@% +\pgfmathdeclarefunction{sqrt}{1}{% + \begingroup% + \expandafter\pgfmath@x#1pt\relax% + \ifdim\pgfmath@x<0pt\relax% + \pgfmath@error{I cannot calculate the square-root of the negative number `#1'}{}% + \else% + \ifdim\pgfmath@x<10pt\relax% + \def\pgfmath@zeros{0}% + \def\pgfmath@targetiterations{1}% + \else% + \ifdim\pgfmath@x<100pt\relax% + \def\pgfmath@zeros{}% + \def\pgfmath@targetiterations{1}% + \else% + \ifdim\pgfmath@x<1000pt\relax% + \def\pgfmath@zeros{0}% + \def\pgfmath@targetiterations{2}% + \else% + \ifdim\pgfmath@x<10000pt\relax% + \def\pgfmath@zeros{}% + \def\pgfmath@targetiterations{2}% + \else% + \def\pgfmath@zeros{0}% + \def\pgfmath@targetiterations{3}% + \fi\fi\fi\fi\fi% + \edef\pgfmath@temp{\pgfmath@zeros\pgfmath@tonumber{\pgfmath@x}}% + \expandafter\pgfmath@sqrt@\pgfmath@temp\pgfmath@% } \def\pgfmath@sqrt@#1.#2\pgfmath@{\pgfmath@@sqrt@#1#2\pgfmath@empty\pgfmath@empty\pgfmath@} \def\pgfmath@@sqrt@#1#2{% - \c@pgfmath@countb=#1#2\relax% - \ifnum\c@pgfmath@countb>35\relax% - \ifnum\c@pgfmath@countb>63\relax% - \ifnum\c@pgfmath@countb>80\relax% - \c@pgfmath@counta=9\relax% - \else% - \c@pgfmath@counta=8\relax% - \fi% - \else% - \ifnum\c@pgfmath@countb>48\relax% - \c@pgfmath@counta=7\relax% - \else% - \c@pgfmath@counta=6\relax% - \fi% - \fi% - \else% - \ifnum\c@pgfmath@countb>15\relax% - \ifnum\c@pgfmath@countb>24\relax% - \c@pgfmath@counta5\relax% - \else% - \c@pgfmath@counta=4\relax% - \fi% - \else% - \ifnum\c@pgfmath@countb>3\relax% - \ifnum\c@pgfmath@countb>8\relax% - \c@pgfmath@counta=3\relax% - \else% - \c@pgfmath@counta=2\relax% - \fi% - \else% - \ifnum\c@pgfmath@countb>0\relax% - \c@pgfmath@counta=1\relax% - \else% - \c@pgfmath@counta=0\relax% - \fi% - \fi% - \fi% - \fi% - \edef\pgfmath@root{\the\c@pgfmath@counta}% - \edef\pgfmath@rootspecial{\the\c@pgfmath@counta}% - \multiply\c@pgfmath@counta by-\c@pgfmath@counta\relax% - \advance\c@pgfmath@counta by#1#2\relax% - \edef\pgfmath@remainder{\the\c@pgfmath@counta}% - \pgfmath@@@sqrt@% + \c@pgfmath@countb=#1#2\relax% + \ifnum\c@pgfmath@countb>35\relax% + \ifnum\c@pgfmath@countb>63\relax% + \ifnum\c@pgfmath@countb>80\relax% + \c@pgfmath@counta=9\relax% + \else% + \c@pgfmath@counta=8\relax% + \fi% + \else% + \ifnum\c@pgfmath@countb>48\relax% + \c@pgfmath@counta=7\relax% + \else% + \c@pgfmath@counta=6\relax% + \fi% + \fi% + \else% + \ifnum\c@pgfmath@countb>15\relax% + \ifnum\c@pgfmath@countb>24\relax% + \c@pgfmath@counta5\relax% + \else% + \c@pgfmath@counta=4\relax% + \fi% + \else% + \ifnum\c@pgfmath@countb>3\relax% + \ifnum\c@pgfmath@countb>8\relax% + \c@pgfmath@counta=3\relax% + \else% + \c@pgfmath@counta=2\relax% + \fi% + \else% + \ifnum\c@pgfmath@countb>0\relax% + \c@pgfmath@counta=1\relax% + \else% + \c@pgfmath@counta=0\relax% + \fi% + \fi% + \fi% + \fi% + \edef\pgfmath@root{\the\c@pgfmath@counta}% + \edef\pgfmath@rootspecial{\the\c@pgfmath@counta}% + \multiply\c@pgfmath@counta by-\c@pgfmath@counta\relax% + \advance\c@pgfmath@counta by#1#2\relax% + \edef\pgfmath@remainder{\the\c@pgfmath@counta}% + \pgfmath@@@sqrt@% } \def\pgfmath@@@sqrt@#1#2{% - \ifx\pgfmath@empty#1% - \edef\pgfmath@remainder{\pgfmath@remainder00}% - \def\pgfmath@tokens{\pgfmath@empty\pgfmath@empty}% - \else% - \ifx\pgfmath@empty#2% - \edef\pgfmath@remainder{\pgfmath@remainder#10}% - \def\pgfmath@tokens{\pgfmath@empty\pgfmath@empty}% - \else% - \edef\pgfmath@remainder{\pgfmath@remainder#1#2}% - \def\pgfmath@tokens{}% - \fi\fi% - \c@pgfmath@counta=\pgfmath@rootspecial\relax% - \multiply\c@pgfmath@counta by20\relax% - \c@pgfmath@countb=\c@pgfmath@counta% - \multiply\c@pgfmath@countb by6\relax% - \advance\c@pgfmath@countb by36\relax% - \c@pgfmath@countc=\c@pgfmath@counta% - \multiply\c@pgfmath@countc by2\relax% - \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax% - \advance\c@pgfmath@countb by-\c@pgfmath@countc% - \advance\c@pgfmath@countb by-20\relax% - \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax% - \advance\c@pgfmath@countb by-\c@pgfmath@countc% - \advance\c@pgfmath@countb by-12\relax% - \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax% - \advance\c@pgfmath@countb by-\c@pgfmath@counta% - \advance\c@pgfmath@countb by-3\relax% - \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax% - \def\pgfmath@digit{0}% - \else% - \def\pgfmath@digit{1}% - \fi% - \else% - \advance\c@pgfmath@countb by\c@pgfmath@counta% - \advance\c@pgfmath@countb by5\relax% - \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax% - \def\pgfmath@digit{2}% - \else% - \def\pgfmath@digit{3}% - \fi% - \fi% - \else% - \advance\c@pgfmath@countb by\c@pgfmath@counta% - \advance\c@pgfmath@countb by9\relax% - \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax% - \def\pgfmath@digit{4}% - \else% - \def\pgfmath@digit{5}% - \fi% - \fi% - \else% - \advance\c@pgfmath@countb by\c@pgfmath@countc% - \advance\c@pgfmath@countb by28\relax% - \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax% - \advance\c@pgfmath@countb by-\c@pgfmath@counta% - \advance\c@pgfmath@countb by-15\relax% - \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax% - \def\pgfmath@digit{6}% - \else% - \def\pgfmath@digit{7}% - \fi% - \else% - \advance\c@pgfmath@countb by\c@pgfmath@counta% - \advance\c@pgfmath@countb by17\relax% - \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax% - \def\pgfmath@digit{8}% - \else% - \def\pgfmath@digit{9}% - \fi% - \fi% - \fi% - \edef\pgfmath@rootspecial{\pgfmath@rootspecial\pgfmath@digit}% - \advance\c@pgfmath@counta by\pgfmath@digit\relax% - \multiply\c@pgfmath@counta by-\pgfmath@digit\relax% - \advance\c@pgfmath@counta by\pgfmath@remainder\relax% - \edef\pgfmath@remainder{\the\c@pgfmath@counta}% - \c@pgfmath@counta=\pgfmath@targetiterations\relax% - \advance\c@pgfmath@counta by-1\relax% - \edef\pgfmath@targetiterations{\the\c@pgfmath@counta}% - \ifnum\c@pgfmath@counta=0\relax% - \edef\pgfmath@root{\pgfmath@root.\pgfmath@digit}% - \else% - \edef\pgfmath@root{\pgfmath@root\pgfmath@digit}% - \fi% - \ifnum\c@pgfmath@counta=-4\relax% -n+1 digits of precision. - \let\pgfmath@next\pgfmath@sqrt@end% - \else% - \let\pgfmath@next\pgfmath@@@sqrt@% - \fi% - \expandafter\pgfmath@next\pgfmath@tokens% + \ifx\pgfmath@empty#1% + \edef\pgfmath@remainder{\pgfmath@remainder00}% + \def\pgfmath@tokens{\pgfmath@empty\pgfmath@empty}% + \else% + \ifx\pgfmath@empty#2% + \edef\pgfmath@remainder{\pgfmath@remainder#10}% + \def\pgfmath@tokens{\pgfmath@empty\pgfmath@empty}% + \else% + \edef\pgfmath@remainder{\pgfmath@remainder#1#2}% + \def\pgfmath@tokens{}% + \fi\fi% + \c@pgfmath@counta=\pgfmath@rootspecial\relax% + \multiply\c@pgfmath@counta by20\relax% + \c@pgfmath@countb=\c@pgfmath@counta% + \multiply\c@pgfmath@countb by6\relax% + \advance\c@pgfmath@countb by36\relax% + \c@pgfmath@countc=\c@pgfmath@counta% + \multiply\c@pgfmath@countc by2\relax% + \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax% + \advance\c@pgfmath@countb by-\c@pgfmath@countc% + \advance\c@pgfmath@countb by-20\relax% + \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax% + \advance\c@pgfmath@countb by-\c@pgfmath@countc% + \advance\c@pgfmath@countb by-12\relax% + \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax% + \advance\c@pgfmath@countb by-\c@pgfmath@counta% + \advance\c@pgfmath@countb by-3\relax% + \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax% + \def\pgfmath@digit{0}% + \else% + \def\pgfmath@digit{1}% + \fi% + \else% + \advance\c@pgfmath@countb by\c@pgfmath@counta% + \advance\c@pgfmath@countb by5\relax% + \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax% + \def\pgfmath@digit{2}% + \else% + \def\pgfmath@digit{3}% + \fi% + \fi% + \else% + \advance\c@pgfmath@countb by\c@pgfmath@counta% + \advance\c@pgfmath@countb by9\relax% + \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax% + \def\pgfmath@digit{4}% + \else% + \def\pgfmath@digit{5}% + \fi% + \fi% + \else% + \advance\c@pgfmath@countb by\c@pgfmath@countc% + \advance\c@pgfmath@countb by28\relax% + \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax% + \advance\c@pgfmath@countb by-\c@pgfmath@counta% + \advance\c@pgfmath@countb by-15\relax% + \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax% + \def\pgfmath@digit{6}% + \else% + \def\pgfmath@digit{7}% + \fi% + \else% + \advance\c@pgfmath@countb by\c@pgfmath@counta% + \advance\c@pgfmath@countb by17\relax% + \ifnum\c@pgfmath@countb>\pgfmath@remainder\relax% + \def\pgfmath@digit{8}% + \else% + \def\pgfmath@digit{9}% + \fi% + \fi% + \fi% + \edef\pgfmath@rootspecial{\pgfmath@rootspecial\pgfmath@digit}% + \advance\c@pgfmath@counta by\pgfmath@digit\relax% + \multiply\c@pgfmath@counta by-\pgfmath@digit\relax% + \advance\c@pgfmath@counta by\pgfmath@remainder\relax% + \edef\pgfmath@remainder{\the\c@pgfmath@counta}% + \c@pgfmath@counta=\pgfmath@targetiterations\relax% + \advance\c@pgfmath@counta by-1\relax% + \edef\pgfmath@targetiterations{\the\c@pgfmath@counta}% + \ifnum\c@pgfmath@counta=0\relax% + \edef\pgfmath@root{\pgfmath@root.\pgfmath@digit}% + \else% + \edef\pgfmath@root{\pgfmath@root\pgfmath@digit}% + \fi% + \ifnum\c@pgfmath@counta=-4\relax% -n+1 digits of precision. + \let\pgfmath@next\pgfmath@sqrt@end% + \else% + \let\pgfmath@next\pgfmath@@@sqrt@% + \fi% + \expandafter\pgfmath@next\pgfmath@tokens% } \def\pgfmath@sqrt@end#1\pgfmath@{% - \edef\pgfmathresult{\pgfmath@root}% - \pgfmath@smuggleone\pgfmathresult% - \endgroup} + \edef\pgfmathresult{\pgfmath@root}% + \pgfmath@smuggleone\pgfmathresult% + \endgroup} % \pgfmathpow % % Calculates #1 ^ #2 % -\pgfmathdeclarefunction{pow}{2}{% +\pgfmathdeclarefunction{pow}{2}{% \begingroup% \pgfmath@xa=#1pt% \pgfmath@xb=#2pt% @@ -775,27 +775,27 @@ \pgfmathexp@{\pgfmath@tonumber{\pgfmath@x}}% \pgfmath@x=\pgfmathresult pt\relax% \fi% - \fi + \fi \pgfmath@returnone\pgf@x% \endgroup% } % factorial function. % -\pgfmathdeclarefunction{factorial}{1}{% - \begingroup% - \afterassignment\pgfmath@gobbletilpgfmath@% - \c@pgfmath@counta=#1\relax\pgfmath@% - \pgfmath@x=1pt\relax% - \pgfmathloop% - \ifnum\c@pgfmath@counta<2\relax% - \else% - \multiply\pgfmath@x by\c@pgfmath@counta% - \advance\c@pgfmath@counta by-1\relax% - \repeatpgfmathloop% - \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@x}}% - \pgfmath@smuggleone\pgfmathresult% - \endgroup% +\pgfmathdeclarefunction{factorial}{1}{% + \begingroup% + \afterassignment\pgfmath@gobbletilpgfmath@% + \c@pgfmath@counta=#1\relax\pgfmath@% + \pgfmath@x=1pt\relax% + \pgfmathloop% + \ifnum\c@pgfmath@counta<2\relax% + \else% + \multiply\pgfmath@x by\c@pgfmath@counta% + \advance\c@pgfmath@counta by-1\relax% + \repeatpgfmathloop% + \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@x}}% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% } % Local Variables: diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.code.tex index d1c3c43443e..b35e3d2595b 100644 --- a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.code.tex @@ -15,49 +15,45 @@ % % Use \pgfmathdeclarefunction* to force a redefinition if the function exists already. \def\pgfmathdeclarefunction{\pgfmath@ifnextchar*\pgfmathdeclarefunction@force\pgfmathdeclarefunction@check} -\def\pgfmathdeclarefunction@check#1{% - \expandafter\ifx\csname pgfmath@function@#1\endcsname\relax\else% - \pgfmath@error{The function `#1' already exists}{}% - \fi% - \pgfmath@declarefunction{#1}% +\def\pgfmathdeclarefunction@check#1#2#3{% + \expandafter\ifx\csname pgfmath@function@#1\endcsname\relax% + \pgfmath@declarefunction{#1}{#2}{#3}% + \else% + \pgfmath@error{The function `#1' already exists}{}% + \fi% } \def\pgfmathdeclarefunction@force*{\pgfmath@declarefunction}% \def\pgfmathredeclarefunction#1#2{% - \expandafter\ifx\csname pgfmath@function@#1\endcsname\relax% - \pgfmath@error{The function `#1' does not exist}{}% - \else% + \expandafter\ifx\csname pgfmath@function@#1\endcsname\relax% + \pgfmath@error{The function `#1' does not exist}{}% + \else% % was: \pgfmath@namedef{pgfmath#1@}{#2}% TT - \edef\pgf@marshal{\noexpand\pgfmathdeclarefunction*{#1}{\csname pgfmath@operation@#1@arity\endcsname}}% + \edef\pgf@marshal{\noexpand\pgfmathdeclarefunction*{#1}{\csname pgfmath@operation@#1@arity\endcsname}}% \pgf@marshal{#2}% - \fi% + \fi% } \def\pgfmath@declarefunction#1#2{% - \pgfmath@namedef{pgfmath@function@#1}{#1}% - \pgfmath@namedef{pgfmath@operation@#1@type}{function}% - \pgfmath@namedef{pgfmath@operation@#1@arity}{#2}% - \pgfmath@namedef{pgfmath@operation@#1@infix}{#1}% - \pgfmath@namedef{pgfmath@operation@#1@precedence}{1000}% - \expandafter\ifx\csname pgfmath@operation@#1@arity\endcsname\pgfmath@dots% - \pgfmath@namedef{pgfmath@operation@#1@arity}{1}% - \else% - \ifnum\csname pgfmath@operation@#1@arity\endcsname>9\relax% - \pgfmath@namedef{pgfmath@operation@#1@arity}{1}% - \fi% - \fi% - \edef\pgfmath@marshal{% - \noexpand\pgfmath@@declarefunction% - {\expandafter\noexpand\csname pgfmath#1\endcsname}% - {\expandafter\noexpand\csname pgfmath#1@\endcsname}% - {\csname pgfmath@operation@#1@arity\endcsname}% - }% - \begingroup% - \catcode`\^^I=9\relax% - \catcode`\ =9\relax% - \catcode`\~=10\relax% - \endlinechar=`\ \relax - \pgfmath@marshal% + \pgfmath@namedef{pgfmath@function@#1}{#1}% + \pgfmath@namedef{pgfmath@operation@#1@type}{function}% + \pgfmath@namedef{pgfmath@operation@#1@arity}{#2}% + \pgfmath@namedef{pgfmath@operation@#1@infix}{#1}% + \pgfmath@namedef{pgfmath@operation@#1@precedence}{1000}% + \expandafter\ifx\csname pgfmath@operation@#1@arity\endcsname\pgfmath@dots% + \pgfmath@namedef{pgfmath@operation@#1@arity}{1}% + \else% + \ifnum\csname pgfmath@operation@#1@arity\endcsname>9\relax% + \pgfmath@namedef{pgfmath@operation@#1@arity}{1}% + \fi% + \fi% + \edef\pgfmath@marshal{% + \noexpand\pgfmath@@declarefunction% + {\expandafter\noexpand\csname pgfmath#1\endcsname}% + {\expandafter\noexpand\csname pgfmath#1@\endcsname}% + {\csname pgfmath@operation@#1@arity\endcsname}% + }% + \pgfmath@marshal% } % #1 - \pgfmath<name>. @@ -66,116 +62,115 @@ % #4 - code for function <name>. % \def\pgfmath@@declarefunction#1#2#3#4{% Function of arity 0 - 9. - \endgroup% - \ifcase#3\relax% - \def#1{#2}% - \def\pgfmath@@head{\def#2}% - \or - \def#1##1{\pgfmathparse{##1}\expandafter#2\expandafter{\pgfmathresult}}% - \def\pgfmath@@head{\def#2####1}% - \else% - \pgfmath@toks={}% - \pgfmathloop% - \ifnum\pgfmathcounter>#3\relax% - \else% - \expandafter\pgfmath@addto@toks\expandafter{\pgfmath@char@hash}% - \expandafter\pgfmath@addto@toks\expandafter{\pgfmathcounter}% - \repeatpgfmathloop% - \edef\pgfmath@head{\noexpand\def\noexpand#1\the\pgfmath@toks}% - \edef\pgfmath@@head{\noexpand\def\noexpand#2\the\pgfmath@toks}% - \pgfmath@toks={}% - \def\pgfmath@arguments{}% - \pgfmathloop% - \ifnum\pgfmathcounter>#3\relax% - \else% - \pgfmath@addto@toks{\pgfmathparse}% - \expandafter\expandafter\expandafter\pgfmath@addto@toks% - \expandafter\expandafter\expandafter{\expandafter\expandafter\expandafter% - {\expandafter\pgfmath@char@hash\pgfmathcounter}}% - \pgfmath@addto@toks{\let}% - \expandafter\pgfmath@addto@toks\expandafter{% - \csname pgfmath@argument@\pgfmathcounter\endcsname=\pgfmathresult}% - \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter% - \pgfmath@arguments\expandafter\expandafter\expandafter{\expandafter% - \pgfmath@arguments\expandafter{\csname pgfmath@argument@\pgfmathcounter\endcsname}}% - \repeatpgfmathloop% - \expandafter\pgfmath@addto@toks\expandafter{\expandafter#2\pgfmath@arguments}% - \edef\pgfmath@body{{\the\pgfmath@toks}}% - \expandafter\pgfmath@head\pgfmath@body% - \fi% - \pgfmath@@head{#4}% + \ifcase#3\relax% + \def#1{#2}% + \def#2{#4}% + \or + \def#1##1{\pgfmathparse{##1}\expandafter#2\expandafter{\pgfmathresult}}% + \def#2##1{#4}% + \else% + \pgfmath@toks={}% + \pgfmathloop% + \ifnum\pgfmathcounter>#3\relax% + \else% + \expandafter\pgfmath@addto@toks\expandafter{\pgfmath@char@hash}% + \expandafter\pgfmath@addto@toks\expandafter{\pgfmathcounter}% + \repeatpgfmathloop% + \edef\pgfmath@head{\noexpand\def\noexpand#1\the\pgfmath@toks}% + \edef\pgfmath@@head{\noexpand\def\noexpand#2\the\pgfmath@toks}% + \pgfmath@toks={}% + \def\pgfmath@arguments{}% + \pgfmathloop% + \ifnum\pgfmathcounter>#3\relax% + \else% + \pgfmath@addto@toks{\pgfmathparse}% + \expandafter\expandafter\expandafter\pgfmath@addto@toks% + \expandafter\expandafter\expandafter{\expandafter\expandafter\expandafter% + {\expandafter\pgfmath@char@hash\pgfmathcounter}}% + \pgfmath@addto@toks{\let}% + \expandafter\pgfmath@addto@toks\expandafter{% + \csname pgfmath@argument@\pgfmathcounter\endcsname=\pgfmathresult}% + \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter% + \pgfmath@arguments\expandafter\expandafter\expandafter{\expandafter% + \pgfmath@arguments\expandafter{\csname pgfmath@argument@\pgfmathcounter\endcsname}}% + \repeatpgfmathloop% + \expandafter\pgfmath@addto@toks\expandafter{\expandafter#2\pgfmath@arguments}% + \edef\pgfmath@body{{\the\pgfmath@toks}}% + \expandafter\pgfmath@head\pgfmath@body% + \pgfmath@@head{#4}% + \fi% } \def\pgfmath@addto@toks#1{% - \edef\pgfmath@toks@expanded{\the\pgfmath@toks}% - \expandafter\pgfmath@toks\expandafter{\pgfmath@toks@expanded#1}} + \edef\pgfmath@toks@expanded{\the\pgfmath@toks}% + \expandafter\pgfmath@toks\expandafter{\pgfmath@toks@expanded#1}} % Key for declaring local functions. % \pgfkeys{% - /pgf/declare function/.code={% - \pgfmath@local@functions#1@=@;% - } + /pgf/declare function/.code={% + \pgfmath@local@functions#1@=@;% + } } \def\pgfmath@local@gobbleone#1{} \def\pgfmath@local@at{@}% \def\pgfmath@local@functions{% - \pgfutil@ifnextchar x{\pgfmath@local@@functions}{\pgfmath@local@@functions}% + \pgfutil@ifnextchar x{\pgfmath@local@@functions}{\pgfmath@local@@functions}% } \def\pgfmath@local@@functions#1=#2;{% - \def\pgfmath@local@temp{#1}% - \ifx\pgfmath@local@temp\pgfmath@local@at% - \let\pgfmath@local@next=\relax% - \else% - \pgfmath@local@function#1=#2;% - \let\pgfmath@local@next=\pgfmath@local@functions% - \fi% - \pgfmath@local@next% + \def\pgfmath@local@temp{#1}% + \ifx\pgfmath@local@temp\pgfmath@local@at% + \let\pgfmath@local@next=\relax% + \else% + \pgfmath@local@function#1=#2;% + \let\pgfmath@local@next=\pgfmath@local@functions% + \fi% + \pgfmath@local@next% } \def\pgfmath@local@function{% - \let\pgfmath@local@name=\pgfutil@empty% - \let\pgfmath@local@args=\pgfutil@empty% - \let\pgfmath@local@body=\pgfutil@empty% - \pgfmath@local@@function} + \let\pgfmath@local@name=\pgfutil@empty% + \let\pgfmath@local@args=\pgfutil@empty% + \let\pgfmath@local@body=\pgfutil@empty% + \pgfmath@local@@function} \def\pgfmath@local@@function#1{% - \if#1=% - \let\pgfmath@local@next=\pgfmath@local@function@body% - \else% - \if#1(% - \let\pgfmath@local@next=\pgfmath@local@function@args% - \else% - \expandafter\def\expandafter\pgfmath@local@name\expandafter{\pgfmath@local@name#1}% - \let\pgfmath@local@next=\pgfmath@local@@function% - \fi% - \fi% - \pgfmath@local@next% + \if#1=% + \let\pgfmath@local@next=\pgfmath@local@function@body% + \else% + \if#1(% + \let\pgfmath@local@next=\pgfmath@local@function@args% + \else% + \expandafter\def\expandafter\pgfmath@local@name\expandafter{\pgfmath@local@name#1}% + \let\pgfmath@local@next=\pgfmath@local@@function% + \fi% + \fi% + \pgfmath@local@next% } \def\pgfmath@local@function@args#1){% - \def\pgfmath@local@args{#1}% - \pgfmath@local@@function} + \def\pgfmath@local@args{#1}% + \pgfmath@local@@function} \def\pgfmath@local@function@body#1;{% - \def\pgfmath@local@body{#1}% - \begingroup% - \c@pgf@counta=0\relax% - \ifx\pgfmath@local@args\pgfmath@empty% - \expandafter\pgfmath@toks\expandafter=\expandafter{\pgfmath@local@body}% - \else% - \pgfmath@toks={}% - \expandafter\pgfmath@local@function@@body\pgfmath@local@args,,% - \fi% - \xdef\pgfmath@local@temp{% - \noexpand\pgfmathnotifynewdeclarefunction{\pgfmath@local@name}{\the\c@pgf@counta}% - {\the\pgfmath@toks}% - }% - \endgroup% - \pgfmath@local@temp% + \def\pgfmath@local@body{#1}% + \begingroup% + \c@pgf@counta=0\relax% + \ifx\pgfmath@local@args\pgfmath@empty% + \expandafter\pgfmath@toks\expandafter=\expandafter{\pgfmath@local@body}% + \else% + \pgfmath@toks={}% + \expandafter\pgfmath@local@function@@body\pgfmath@local@args,,% + \fi% + \xdef\pgfmath@local@temp{% + \noexpand\pgfmathnotifynewdeclarefunction{\pgfmath@local@name}{\the\c@pgf@counta}% + {\the\pgfmath@toks}% + }% + \endgroup% + \pgfmath@local@temp% } % #1: the name @@ -183,76 +178,76 @@ % #3: a math expression containing '#1', '#2', ... ,'#'<n> % This callback is overwritten by pgflibraryluamath. \def\pgfmathnotifynewdeclarefunction#1#2#3{% - \pgfmathdeclarefunction{#1}{#2}{\pgfmathparse{#3}}% + \pgfmathdeclarefunction{#1}{#2}{\pgfmathparse{#3}}% }% \def\pgfmath@local@function@@body#1,{% - \def\pgfmath@local@test{#1}% - \ifx\pgfmath@local@test\pgfutil@empty% - \let\pgfmath@local@next=\relax% - \else% - \edef\pgfmath@local@var@string{@\expandafter\pgfmath@local@gobbleone\string#1}% - \advance\c@pgf@counta by1\relax% - \expandafter\expandafter\expandafter\pgfmath@toks\expandafter\expandafter\expandafter=% - \expandafter\expandafter\expandafter{\expandafter\pgfmath@char@hash\the\c@pgf@counta}% - \edef#1{\the\pgfmath@toks}% - \pgfmath@toks={}% - \expandafter\pgfmath@local@function@@@body\pgfmath@local@body @% - \edef\pgfmath@local@body{\the\pgfmath@toks}% - \let\pgfmath@local@next=\pgfmath@local@function@@body% - \fi% - \pgfmath@local@next% + \def\pgfmath@local@test{#1}% + \ifx\pgfmath@local@test\pgfutil@empty% + \let\pgfmath@local@next=\relax% + \else% + \edef\pgfmath@local@var@string{@\expandafter\pgfmath@local@gobbleone\string#1}% + \advance\c@pgf@counta by1\relax% + \expandafter\expandafter\expandafter\pgfmath@toks\expandafter\expandafter\expandafter=% + \expandafter\expandafter\expandafter{\expandafter\pgfmath@char@hash\the\c@pgf@counta}% + \edef#1{\the\pgfmath@toks}% + \pgfmath@toks={}% + \expandafter\pgfmath@local@function@@@body\pgfmath@local@body @% + \edef\pgfmath@local@body{\the\pgfmath@toks}% + \let\pgfmath@local@next=\pgfmath@local@function@@body% + \fi% + \pgfmath@local@next% } - + \def\pgfmath@local@function@@@body{% - \pgfutil@ifnextchar\bgroup{\pgfmath@local@function@@@body@bgroup}% - {\pgfmath@local@function@@@body@nobgroup}}% + \pgfutil@ifnextchar\bgroup{\pgfmath@local@function@@@body@bgroup}% + {\pgfmath@local@function@@@body@nobgroup}}% \def\pgfmath@local@function@@@body@bgroup#1{% - \begingroup% - \pgfmath@toks={}% - \pgfmath@local@function@@@body#1 @% - \xdef\pgfmath@local@temp{{\the\pgfmath@toks}}% - \endgroup% - \expandafter\pgfmath@addto@toks\expandafter{\pgfmath@local@temp}% - \pgfmath@local@function@@@body% + \begingroup% + \pgfmath@toks={}% + \pgfmath@local@function@@@body#1 @% + \xdef\pgfmath@local@temp{{\the\pgfmath@toks}}% + \endgroup% + \expandafter\pgfmath@addto@toks\expandafter{\pgfmath@local@temp}% + \pgfmath@local@function@@@body% } \def\pgfmath@local@function@@@body@nobgroup#1{% - \ifx#1@% - \let\pgfmath@local@next=\relax% - \else% - \let\pgfmath@local@next=\pgfmath@local@function@@@body% - \edef\pgfmath@local@var@@string{@\expandafter\pgfmath@local@gobbleone\string#1}% - \ifx\pgfmath@local@var@@string\pgfmath@local@var@string% - \expandafter\pgfmath@addto@toks\expandafter{#1}% - \else% - \edef\pgfmath@local@temp{\the\pgfmath@toks}% - \pgfmath@toks={#1}% - \edef\pgfmath@local@@temp{\the\pgfmath@toks}% - \expandafter\pgfmath@toks\expandafter=\expandafter{\pgfmath@local@temp}% - \expandafter\pgfmath@addto@toks\expandafter{\pgfmath@local@@temp}% - \fi% - \fi% - \pgfmath@local@next% + \ifx#1@% + \let\pgfmath@local@next=\relax% + \else% + \let\pgfmath@local@next=\pgfmath@local@function@@@body% + \edef\pgfmath@local@var@@string{@\expandafter\pgfmath@local@gobbleone\string#1}% + \ifx\pgfmath@local@var@@string\pgfmath@local@var@string% + \expandafter\pgfmath@addto@toks\expandafter{#1}% + \else% + \edef\pgfmath@local@temp{\the\pgfmath@toks}% + \pgfmath@toks={#1}% + \edef\pgfmath@local@@temp{\the\pgfmath@toks}% + \expandafter\pgfmath@toks\expandafter=\expandafter{\pgfmath@local@temp}% + \expandafter\pgfmath@addto@toks\expandafter{\pgfmath@local@@temp}% + \fi% + \fi% + \pgfmath@local@next% } % Allows to define 'x' as some \TeX command '#2'. \def\pgfmathdeclarepseudoconstant#1#2{% - \pgfmathdeclarefunction*{#1}{0}{#2}% + \pgfmathdeclarefunction*{#1}{0}{#2}% }% % Redefines a pseudo constant '#1'. \def\pgfmathredeclarepseudoconstant#1#2{% - \pgfmathredeclarefunction{#1}{#2}% + \pgfmathredeclarefunction{#1}{#2}% }% - + \input pgfmathfunctions.basic.code.tex \input pgfmathfunctions.trigonometric.code.tex \input pgfmathfunctions.random.code.tex -\input pgfmathfunctions.comparison.code.tex -\input pgfmathfunctions.base.code.tex -\input pgfmathfunctions.round.code.tex -\input pgfmathfunctions.misc.code.tex +\input pgfmathfunctions.comparison.code.tex +\input pgfmathfunctions.base.code.tex +\input pgfmathfunctions.round.code.tex +\input pgfmathfunctions.misc.code.tex \input pgfmathfunctions.integerarithmetics.code.tex diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.comparison.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.comparison.code.tex index f6e69993e8c..54a8d64220e 100644 --- a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.comparison.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.comparison.code.tex @@ -14,7 +14,7 @@ \pgfmathdeclarefunction{greater}{2}{% \begingroup% \ifdim#1pt>#2pt\relax% - \def\pgfmathresult{1}% + \def\pgfmathresult{1}% \else% \def\pgfmathresult{0}% \fi% @@ -26,7 +26,7 @@ \pgfmathdeclarefunction{less}{2}{% \begingroup% \ifdim#1pt<#2pt\relax% - \def\pgfmathresult{1}% + \def\pgfmathresult{1}% \else% \def\pgfmathresult{0}% \fi% @@ -38,7 +38,7 @@ \pgfmathdeclarefunction{equal}{2}{% \begingroup% \ifdim#1pt=#2pt\relax% - \def\pgfmathresult{1}% + \def\pgfmathresult{1}% \else% \def\pgfmathresult{0}% \fi% @@ -48,26 +48,26 @@ \let\pgfmathequalto=\pgfmathequal -% approxequalto function from Christian Feuersaenger. +% approxequalto function from Christian Feuersanger. % \newif\ifpgfmathcomparison \pgfmathdeclarefunction{approxequalto}{2}{% - \begingroup% - \pgfmath@x=#1pt\relax% - \pgfmath@y=#2pt\relax% - \advance\pgfmath@x by-\pgfmath@y% - \ifdim\pgfmath@x<0pt\relax% - \multiply\pgfmath@x by-1\relax% - \fi - \ifdim\pgfmath@x<0.0001pt\relax% - \def\pgfmathresult{1.0}% - \global\pgfmathcomparisontrue% - \else% - \def\pgfmathresult{0.0}% - \global\pgfmathcomparisonfalse% - \fi% - \pgfmath@smuggleone\pgfmathresult% - \endgroup% + \begingroup% + \pgfmath@x=#1pt\relax% + \pgfmath@y=#2pt\relax% + \advance\pgfmath@x by-\pgfmath@y% + \ifdim\pgfmath@x<0pt\relax% + \multiply\pgfmath@x by-1\relax% + \fi + \ifdim\pgfmath@x<0.0001pt\relax% + \def\pgfmathresult{1.0}% + \global\pgfmathcomparisontrue% + \else% + \def\pgfmathresult{0.0}% + \global\pgfmathcomparisonfalse% + \fi% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% } @@ -75,14 +75,14 @@ % ifthenelse function. % \pgfmathdeclarefunction{ifthenelse}{3}{% - \begingroup% - \ifdim#1pt=0.0pt\relax% - \expandafter\def\expandafter\pgfmathresult\expandafter{#3}% - \else% - \expandafter\def\expandafter\pgfmathresult\expandafter{#2}% - \fi% - \pgfmath@smuggleone\pgfmathresult% - \endgroup% + \begingroup% + \ifdim#1pt=0.0pt\relax% + \expandafter\def\expandafter\pgfmathresult\expandafter{#3}% + \else% + \expandafter\def\expandafter\pgfmathresult\expandafter{#2}% + \fi% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% } % notequal function. @@ -90,7 +90,7 @@ \pgfmathdeclarefunction{notequal}{2}{% \begingroup% \ifdim#1pt=#2pt\relax% - \def\pgfmathresult{0}% + \def\pgfmathresult{0}% \else% \def\pgfmathresult{1}% \fi% @@ -103,7 +103,7 @@ \pgfmathdeclarefunction{notless}{2}{% \begingroup% \ifdim#1pt<#2pt\relax% - \def\pgfmathresult{0}% + \def\pgfmathresult{0}% \else% \def\pgfmathresult{1}% \fi% @@ -116,7 +116,7 @@ \pgfmathdeclarefunction{notgreater}{2}{% \begingroup% \ifdim#1pt>#2pt\relax% - \def\pgfmathresult{0}% + \def\pgfmathresult{0}% \else% \def\pgfmathresult{1}% \fi% @@ -128,15 +128,15 @@ % \pgfmathdeclarefunction{and}{2}{% \begingroup% - \def\pgfmathresult{1}% + \def\pgfmathresult{1}% \ifdim#1pt=0pt\relax% - \def\pgfmathresult{0}% - \else% - \ifdim#2pt=0pt\relax% - \def\pgfmathresult{0}% - \fi% - \fi% - \pgfmath@smuggleone\pgfmathresult% + \def\pgfmathresult{0}% + \else% + \ifdim#2pt=0pt\relax% + \def\pgfmathresult{0}% + \fi% + \fi% + \pgfmath@smuggleone\pgfmathresult% \endgroup% } @@ -144,16 +144,16 @@ % \pgfmathdeclarefunction{or}{2}{% \begingroup% - \def\pgfmathresult{0}% - \ifdim#1pt=0pt\relax% - \ifdim#2pt=0pt\relax% - \else% - \def\pgfmathresult{1}% - \fi% - \else% - \def\pgfmathresult{1}% - \fi% - \pgfmath@smuggleone\pgfmathresult% + \def\pgfmathresult{0}% + \ifdim#1pt=0pt\relax% + \ifdim#2pt=0pt\relax% + \else% + \def\pgfmathresult{1}% + \fi% + \else% + \def\pgfmathresult{1}% + \fi% + \pgfmath@smuggleone\pgfmathresult% \endgroup% } @@ -161,12 +161,12 @@ % \pgfmathdeclarefunction{not}{1}{% \begingroup% - \ifdim#1pt=0pt\relax% - \def\pgfmathresult{1}% - \else% - \def\pgfmathresult{0}% - \fi% - \pgfmath@smuggleone\pgfmathresult% + \ifdim#1pt=0pt\relax% + \def\pgfmathresult{1}% + \else% + \def\pgfmathresult{0}% + \fi% + \pgfmath@smuggleone\pgfmathresult% \endgroup% } diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.integerarithmetics.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.integerarithmetics.code.tex index ab8f4e6d3c1..9094da50dc9 100644 --- a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.integerarithmetics.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.integerarithmetics.code.tex @@ -11,28 +11,28 @@ \pgfmathcontinuelooptrue \pgfmath@xa=#1pt \pgfmath@xb=#2pt - \ifdim\pgfmath@xa=0pt\relax + \ifdim\pgfmath@xa=0pt \pgfmathcontinueloopfalse \pgfmath@xa=\pgfmath@xb - \fi - \ifdim\pgfmath@xb=0pt\relax + \fi + \ifdim\pgfmath@xb=0pt \pgfmathcontinueloopfalse \pgfmath@xb=\pgfmath@xa \fi - \ifdim\pgfmath@xa<0pt\relax + \ifdim\pgfmath@xa<0pt \pgfmath@xa=-\pgfmath@xa \fi - \ifdim\pgfmath@xb<0pt\relax + \ifdim\pgfmath@xb<0pt \pgfmath@xb=-\pgfmath@xb \fi \loop - \ifpgfmathcontinueloop + \ifpgfmathcontinueloop \ifdim\pgfmath@xa=\pgfmath@xb \pgfmathcontinueloopfalse \else - \ifdim\pgfmath@xa>\pgfmath@xb + \ifdim\pgfmath@xa>\pgfmath@xb \advance\pgfmath@xa by-\pgfmath@xb - \else + \else \advance\pgfmath@xb by-\pgfmath@xa \fi \fi @@ -42,14 +42,14 @@ \endgroup} \newif\ifpgfmath@isprime@unknown -\newif\ifpgfmath@isprime +\newif\ifpgfmath@isprime \pgfmathdeclarefunction{isprime}{1}{% \begingroup \pgfmath@isprime@unknowntrue \pgfmathsetcount\c@pgfmath@counta{abs(int(#1))}% - \ifcase\c@pgfmath@counta\relax - % |#1| = 0 + \ifcase\c@pgfmath@counta\relax + % |#1| = 0 \pgfmath@isprimefalse \pgfmath@isprime@unknownfalse \or @@ -66,17 +66,17 @@ \pgfmath@isprime@unknownfalse \else % |#1| > 3 - \ifodd\c@pgfmath@counta\relax + \ifodd\c@pgfmath@counta\relax \else \pgfmath@isprimefalse \pgfmath@isprime@unknownfalse \fi - \fi + \fi \ifpgfmath@isprime@unknown \c@pgfmath@countd=3 \pgfmath@isprimetrue \pgfmathloop - \c@pgfmath@countb=\c@pgfmath@counta + \c@pgfmath@countb=\c@pgfmath@counta \divide\c@pgfmath@countb by\c@pgfmath@countd \ifnum\c@pgfmath@countb>\c@pgfmath@countd \pgfmath@isprime@unknowntrue @@ -84,7 +84,7 @@ \pgfmath@isprime@unknownfalse \fi \multiply\c@pgfmath@countb by\c@pgfmath@countd - \ifnum\c@pgfmath@countb=\c@pgfmath@counta + \ifnum\c@pgfmath@countb=\c@pgfmath@counta \global\pgfmath@isprimefalse \pgfmath@isprime@unknownfalse \fi diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.code.tex index bab8fefd4eb..9b807992787 100644 --- a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.misc.code.tex @@ -11,116 +11,116 @@ % % Version 1.414213 29/9/2007 -% veclen function adapted from ideas due to Rouben Rostamian. +% veclen function adpated from ideas due to Rouben Rostamian. % -% Calculate the Euclidean length of a 2D vector. +% Calcluate the Eulidean length of a 2D vector. % % -\pgfmathdeclarefunction{veclen}{2}{% +\pgfmathdeclarefunction{veclen}{2}{% \begingroup% \pgfmath@x#1pt\relax% \pgfmath@y#2pt\relax% - \ifdim\pgfmath@x<0pt\relax% - \pgfmath@x-\pgfmath@x% - \fi% - \ifdim\pgfmath@y<0pt\relax% - \pgfmath@y-\pgfmath@y% - \fi% - \ifdim\pgfmath@x=0pt\relax% - \pgfmath@x\pgfmath@y% - \else% - \ifdim\pgfmath@y=0pt\relax% - \else% - \ifdim\pgfmath@x>\pgfmath@y% - \pgfmath@xa\pgfmath@x% - \pgfmath@x\pgfmath@y% - \pgfmath@y\pgfmath@xa% - \fi% - % We use a scaling factor to reduce errors. - \ifdim\pgfmath@y>10000pt\relax% - \c@pgfmath@counta1500\relax% - \else% - \ifdim\pgfmath@y>1000pt\relax% - \c@pgfmath@counta150\relax% - \else% - \ifdim\pgfmath@y>100pt\relax% - \c@pgfmath@counta50\relax% - \else% - \c@pgfmath@counta1\relax% - \fi% - \fi% - \fi% - \divide\pgfmath@x\c@pgfmath@counta\relax% - \divide\pgfmath@y\c@pgfmath@counta\relax% - \pgfmathreciprocal@{\pgfmath@tonumber{\pgfmath@y}}% - \pgfmath@x\pgfmathresult\pgfmath@x% - \pgfmath@xa\pgfmath@tonumber{\pgfmath@x}\pgfmath@x% - \edef\pgfmath@temp{\pgfmath@tonumber{\pgfmath@xa}}% - % - % Use A+x^2*(B+x^2*(C+x^2*(D+E*x^2))) - % where - % A = +1.000012594 - % B = +0.4993615349 - % C = -0.1195159052 - % D = +0.04453994279 - % E = -0.01019210944 - % - \pgfmath@x-0.01019210944\pgfmath@xa% - \advance\pgfmath@x0.04453994279pt\relax% - \pgfmath@x\pgfmath@temp\pgfmath@x% - \advance\pgfmath@x-0.1195159052pt\relax% - \pgfmath@x\pgfmath@temp\pgfmath@x% - \advance\pgfmath@x0.4993615349pt\relax% - \pgfmath@x\pgfmath@temp\pgfmath@x% - \advance\pgfmath@x1.000012594pt\relax% - \ifdim\pgfmath@y<0pt\relax% - \pgfmath@y-\pgfmath@y% - \fi% - \pgfmath@x\pgfmath@tonumber{\pgfmath@y}\pgfmath@x% - % Invert the scaling factor. - \multiply\pgfmath@x\c@pgfmath@counta\relax% - \fi% - \fi% - \pgfmath@returnone\pgfmath@x% - \endgroup% + \ifdim\pgfmath@x<0pt\relax% + \pgfmath@x-\pgfmath@x% + \fi% + \ifdim\pgfmath@y<0pt\relax% + \pgfmath@y-\pgfmath@y% + \fi% + \ifdim\pgfmath@x=0pt\relax% + \pgfmath@x\pgfmath@y% + \else% + \ifdim\pgfmath@y=0pt\relax% + \else% + \ifdim\pgfmath@x>\pgfmath@y% + \pgfmath@xa\pgfmath@x% + \pgfmath@x\pgfmath@y% + \pgfmath@y\pgfmath@xa% + \fi% + % We use a scaling factor to reduce errors. + \ifdim\pgfmath@y>10000pt\relax% + \c@pgfmath@counta1500\relax% + \else% + \ifdim\pgfmath@y>1000pt\relax% + \c@pgfmath@counta150\relax% + \else% + \ifdim\pgfmath@y>100pt\relax% + \c@pgfmath@counta50\relax% + \else% + \c@pgfmath@counta1\relax% + \fi% + \fi% + \fi% + \divide\pgfmath@x\c@pgfmath@counta\relax% + \divide\pgfmath@y\c@pgfmath@counta\relax% + \pgfmathreciprocal@{\pgfmath@tonumber{\pgfmath@y}}% + \pgfmath@x\pgfmathresult\pgfmath@x% + \pgfmath@xa\pgfmath@tonumber{\pgfmath@x}\pgfmath@x% + \edef\pgfmath@temp{\pgfmath@tonumber{\pgfmath@xa}}% + % + % Use A+x^2*(B+x^2*(C+x^2*(D+E*x^2))) + % where + % A = +1.000012594 + % B = +0.4993615349 + % C = -0.1195159052 + % D = +0.04453994279 + % E = -0.01019210944 + % + \pgfmath@x-0.01019210944\pgfmath@xa% + \advance\pgfmath@x0.04453994279pt\relax% + \pgfmath@x\pgfmath@temp\pgfmath@x% + \advance\pgfmath@x-0.1195159052pt\relax% + \pgfmath@x\pgfmath@temp\pgfmath@x% + \advance\pgfmath@x0.4993615349pt\relax% + \pgfmath@x\pgfmath@temp\pgfmath@x% + \advance\pgfmath@x1.000012594pt\relax% + \ifdim\pgfmath@y<0pt\relax% + \pgfmath@y-\pgfmath@y% + \fi% + \pgfmath@x\pgfmath@tonumber{\pgfmath@y}\pgfmath@x% + % Invert the scaling factor. + \multiply\pgfmath@x\c@pgfmath@counta\relax% + \fi% + \fi% + \pgfmath@returnone\pgfmath@x% + \endgroup% } % Hyperbolic functions contributed by Martin Heller. % \pgfmathdeclarefunction{cosh}{1}{% - \begingroup - \edef\pgfmath@arg{#1}% - \pgfmathexp@{\pgfmath@arg}% - \pgfmath@x=\pgfmathresult pt\relax% - \pgfmathexp@{-\pgfmath@arg}% - \advance\pgfmath@x by\pgfmathresult pt\relax% - \divide\pgfmath@x by2\relax% - \pgfmath@returnone\pgfmath@x% - \endgroup} + \begingroup + \edef\pgfmath@arg{#1}% + \pgfmathexp@{\pgfmath@arg}% + \pgfmath@x=\pgfmathresult pt\relax% + \pgfmathexp@{-\pgfmath@arg}% + \advance\pgfmath@x by\pgfmathresult pt\relax% + \divide\pgfmath@x by2\relax% + \pgfmath@returnone\pgfmath@x% + \endgroup} \pgfmathdeclarefunction{sinh}{1}{% - \begingroup - \edef\pgfmath@arg{#1}% - \pgfmathexp@{\pgfmath@arg}% - \pgfmath@x=\pgfmathresult pt\relax% - \pgfmathexp@{-\pgfmath@arg}% - \advance\pgfmath@x by-\pgfmathresult pt\relax% - \divide\pgfmath@x by2\relax% - \pgfmath@returnone\pgfmath@x% - \endgroup + \begingroup + \edef\pgfmath@arg{#1}% + \pgfmathexp@{\pgfmath@arg}% + \pgfmath@x=\pgfmathresult pt\relax% + \pgfmathexp@{-\pgfmath@arg}% + \advance\pgfmath@x by-\pgfmathresult pt\relax% + \divide\pgfmath@x by2\relax% + \pgfmath@returnone\pgfmath@x% + \endgroup }% \pgfmathdeclarefunction{tanh}{1}{% - \begingroup - \edef\pgfmath@arg{#1}% - \pgfmathsinh@{\pgfmath@arg}% - \pgfmath@x=\pgfmathresult pt\relax% - \pgfmathcosh@{\pgfmath@arg}% - \pgfmath@y=\pgfmathresult pt\relax% - \pgfmathdivide@{\pgfmath@tonumber{\pgfmath@x}}{\pgfmath@tonumber{\pgfmath@y}}% - \pgfmath@x=\pgfmathresult pt\relax% - \pgfmath@returnone\pgfmath@x% - \endgroup + \begingroup + \edef\pgfmath@arg{#1}% + \pgfmathsinh@{\pgfmath@arg}% + \pgfmath@x=\pgfmathresult pt\relax% + \pgfmathcosh@{\pgfmath@arg}% + \pgfmath@y=\pgfmathresult pt\relax% + \pgfmathdivide@{\pgfmath@tonumber{\pgfmath@x}}{\pgfmath@tonumber{\pgfmath@y}}% + \pgfmath@x=\pgfmathresult pt\relax% + \pgfmath@returnone\pgfmath@x% + \endgroup }% % \pgfmathscientific @@ -134,136 +134,136 @@ % NB These arguments *are not parsed*, as the long mantissa would be lost. % \def\pgfmathscientific#1#2{% - \begingroup% - \edef\pgfmath@sci@exponent{#2}% - \pgfmath@x#1pt\relax% - \ifdim\pgfmath@x<0pt\relax% - \pgfmath@x-\pgfmath@x% - \edef\pgfmath@sci@sign{-}% - \expandafter\edef\expandafter\pgfmath@temp\expandafter{\expandafter\pgfmath@gobbleone#1}% - \else% - \edef\pgfmath@sci@sign{+}% - \edef\pgfmath@temp{#1}% - \fi% - \expandafter\pgfmath@in@\expandafter.\expandafter{#1}% - \ifpgfmath@in@% - \else% - \edef\pgfmath@temp{\pgfmath@temp.0}% - \fi% - \expandafter\pgfmath@scientific@@\pgfmath@temp00000000000\pgfmath@} + \begingroup% + \edef\pgfmath@sci@exponent{#2}% + \pgfmath@x#1pt\relax% + \ifdim\pgfmath@x<0pt\relax% + \pgfmath@x-\pgfmath@x% + \edef\pgfmath@sci@sign{-}% + \expandafter\edef\expandafter\pgfmath@temp\expandafter{\expandafter\pgfmath@gobbleone#1}% + \else% + \edef\pgfmath@sci@sign{+}% + \edef\pgfmath@temp{#1}% + \fi% + \expandafter\pgfmath@in@\expandafter.\expandafter{#1}% + \ifpgfmath@in@% + \else% + \edef\pgfmath@temp{\pgfmath@temp.0}% + \fi% + \expandafter\pgfmath@scientific@@\pgfmath@temp00000000000\pgfmath@} \def\pgfmath@scientific@@#1.#2#3#4#5#6{% - \edef\pgfmath@sci@int{#1}% - \edef\pgfmath@sci@mantissaA{#2#3#4#5#6}% - \pgfmath@scientific@@@} - + \edef\pgfmath@sci@int{#1}% + \edef\pgfmath@sci@mantissaA{#2#3#4#5#6}% + \pgfmath@scientific@@@} + \def\pgfmath@scientific@@@#1#2#3#4#5#6\pgfmath@{% - \edef\pgfmath@sci@mantissaB{#1#2#3#4#5}% - \c@pgfmath@counta\pgfmath@sci@exponent\relax% + \edef\pgfmath@sci@mantissaB{#1#2#3#4#5}% + \c@pgfmath@counta\pgfmath@sci@exponent\relax% \ifnum\c@pgfmath@counta<-4\relax% \pgfmath@x0pt\relax% \else% - \c@pgfmath@countb\c@pgfmath@counta% - \ifnum\c@pgfmath@counta<0\relax% - \c@pgfmath@counta-\c@pgfmath@counta% - \fi% - \pgfmathpow@{10}{\the\c@pgfmath@counta}% - \afterassignment\pgfmath@gobbletilpgfmath@ - \c@pgfmath@countc\pgfmathresult\relax\pgfmath@ - \edef\pgfmath@sci@factor{\the\c@pgfmath@countc}% - \ifnum\c@pgfmath@countb<0\relax% - % xE-y: easy... - \pgfmath@x\pgfmath@sci@int.\pgfmath@sci@mantissaA pt\relax% - \divide\pgfmath@x\pgfmath@sci@factor\relax% - \else% - % xE+y: - % Must do this way so as not lose digits in a long mantissa. Sigh... - \c@pgfmath@counta\pgfmath@sci@int% - \c@pgfmath@countb\pgfmath@sci@mantissaA% - \multiply\c@pgfmath@counta\pgfmath@sci@factor\relax% - \multiply\c@pgfmath@countb\pgfmath@sci@factor\relax% - \c@pgfmath@countc\c@pgfmath@countb% - \divide\c@pgfmath@countb100000\relax% - \advance\c@pgfmath@counta\c@pgfmath@countb% - \multiply\c@pgfmath@countb100000\relax% - \advance\c@pgfmath@countc-\c@pgfmath@countb% - \c@pgfmath@countb\pgfmath@sci@mantissaB\relax% - \multiply\c@pgfmath@countb\pgfmath@sci@factor\relax% - \divide\c@pgfmath@countb100000\relax% - \advance\c@pgfmath@countc\c@pgfmath@countb% - \advance\c@pgfmath@countc100000\relax% - \edef\pgfmath@sci@result{\pgfmath@sci@sign\the\c@pgfmath@counta.\expandafter\pgfmath@gobbleone\the\c@pgfmath@countc pt}% - \pgfmath@x\pgfmath@sci@result\relax% - \fi\fi% - \pgfmath@returnone\pgfmath@x% - \endgroup} - + \c@pgfmath@countb\c@pgfmath@counta% + \ifnum\c@pgfmath@counta<0\relax% + \c@pgfmath@counta-\c@pgfmath@counta% + \fi% + \pgfmathpow@{10}{\the\c@pgfmath@counta}% + \afterassignment\pgfmath@gobbletilpgfmath@ + \c@pgfmath@countc\pgfmathresult\relax\pgfmath@ + \edef\pgfmath@sci@factor{\the\c@pgfmath@countc}% + \ifnum\c@pgfmath@countb<0\relax% + % xE-y: easy... + \pgfmath@x\pgfmath@sci@int.\pgfmath@sci@mantissaA pt\relax% + \divide\pgfmath@x\pgfmath@sci@factor\relax% + \else% + % xE+y: + % Must do this way so as not lose digits in a long mantissa. Sigh... + \c@pgfmath@counta\pgfmath@sci@int% + \c@pgfmath@countb\pgfmath@sci@mantissaA% + \multiply\c@pgfmath@counta\pgfmath@sci@factor\relax% + \multiply\c@pgfmath@countb\pgfmath@sci@factor\relax% + \c@pgfmath@countc\c@pgfmath@countb% + \divide\c@pgfmath@countb100000\relax% + \advance\c@pgfmath@counta\c@pgfmath@countb% + \multiply\c@pgfmath@countb100000\relax% + \advance\c@pgfmath@countc-\c@pgfmath@countb% + \c@pgfmath@countb\pgfmath@sci@mantissaB\relax% + \multiply\c@pgfmath@countb\pgfmath@sci@factor\relax% + \divide\c@pgfmath@countb100000\relax% + \advance\c@pgfmath@countc\c@pgfmath@countb% + \advance\c@pgfmath@countc100000\relax% + \edef\pgfmath@sci@result{\pgfmath@sci@sign\the\c@pgfmath@counta.\expandafter\pgfmath@gobbleone\the\c@pgfmath@countc pt}% + \pgfmath@x\pgfmath@sci@result\relax% + \fi\fi% + \pgfmath@returnone\pgfmath@x% + \endgroup} + % width function. % \pgfmathdeclarefunction{width}{1}{% - \begingroup% - \setbox\pgfmath@box=\hbox{{\pgfmath@selectfont{#1}}}% - \pgfmath@x=\wd\pgfmath@box% - \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@x}}% - \pgfmath@smuggleone\pgfmathresult% - \endgroup% + \begingroup% + \setbox\pgfmath@box=\hbox{{\pgfmath@selectfont{#1}}}% + \pgfmath@x=\wd\pgfmath@box% + \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@x}}% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% } % height function. % \pgfmathdeclarefunction{height}{1}{% - \begingroup% - \setbox\pgfmath@box=\hbox{{\pgfmath@selectfont{#1}}}% - \pgfmath@x=\ht\pgfmath@box% - \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@x}}% - \pgfmath@smuggleone\pgfmathresult% - \endgroup% + \begingroup% + \setbox\pgfmath@box=\hbox{{\pgfmath@selectfont{#1}}}% + \pgfmath@x=\ht\pgfmath@box% + \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@x}}% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% } % depth function. % \pgfmathdeclarefunction{depth}{1}{% - \begingroup% - \setbox\pgfmath@box=\hbox{{\pgfmath@selectfont{#1}}}% - \pgfmath@x=\dp\pgfmath@box% - \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@x}}% - \pgfmath@smuggleone\pgfmathresult% - \endgroup% + \begingroup% + \setbox\pgfmath@box=\hbox{{\pgfmath@selectfont{#1}}}% + \pgfmath@x=\dp\pgfmath@box% + \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@x}}% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% } % array function. % \pgfmathdeclarefunction{array}{2}{% - \begingroup% - \afterassignment\pgfmath@gobbletilpgfmath@\pgfmath@count=#2\relax\pgfmath@% - \expandafter\pgfmatharray@@#1\pgfmath@stop% + \begingroup% + \afterassignment\pgfmath@gobbletilpgfmath@\pgfmath@count=#2\relax\pgfmath@% + \expandafter\pgfmatharray@@#1\pgfmath@stop% } \def\pgfmath@token@stop{\pgfmath@stop}% \def\pgfmatharray@@#1{% - \def\pgfmath@temp{#1}% - \advance\pgfmath@count by-1\relax% - \ifx\pgfmath@temp\pgfmath@token@stop% - \pgfmath@error{Array index out of bounds.}{}% - \def\pgfmathresult{0}% - \pgfmath@smuggleone\pgfmathresult\endgroup% - \let\pgfmath@next=\relax% - \else% - \ifnum\pgfmath@count=-1\relax% - \def\pgfmathresult{#1}% - \let\pgfmath@next=\pgfmatharray@@@% - \else% - \let\pgfmath@next=\pgfmatharray@@% - \fi% - \fi% - \pgfmath@next} + \def\pgfmath@temp{#1}% + \advance\pgfmath@count by-1\relax% + \ifx\pgfmath@temp\pgfmath@token@stop% + \pgfmath@error{Array index out of bounds.}{}% + \def\pgfmathresult{0}% + \pgfmath@smuggleone\pgfmathresult\endgroup% + \let\pgfmath@next=\relax% + \else% + \ifnum\pgfmath@count=-1\relax% + \def\pgfmathresult{#1}% + \let\pgfmath@next=\pgfmatharray@@@% + \else% + \let\pgfmath@next=\pgfmatharray@@% + \fi% + \fi% + \pgfmath@next} \def\pgfmatharray@@@#1\pgfmath@stop{% - \pgfmath@smuggleone\pgfmathresult\endgroup% + \pgfmath@smuggleone\pgfmathresult\endgroup% } % dim function: return dimension of an array @@ -288,55 +288,55 @@ % max function. % \pgfmathdeclarefunction{max}{...}{% - \begingroup% - \pgfmath@x=-16383pt\relax% - \pgfmathmax@@#1{}} + \begingroup% + \pgfmath@x=-16383pt\relax% + \pgfmathmax@@#1{}} \def\pgfmathmax@@#1{% - \def\pgfmath@temp{#1}% - \ifx\pgfmath@temp\pgfmath@empty% - \let\pgfmath@next=\pgfmathmax@@@% - \else% - \ifdim#1pt>\pgfmath@x% - \pgfmath@x=#1pt\relax% - \fi% - \let\pgfmath@next=\pgfmathmax@@% - \fi% - \pgfmath@next} + \def\pgfmath@temp{#1}% + \ifx\pgfmath@temp\pgfmath@empty% + \let\pgfmath@next=\pgfmathmax@@@% + \else% + \ifdim#1pt>\pgfmath@x% + \pgfmath@x=#1pt\relax% + \fi% + \let\pgfmath@next=\pgfmathmax@@% + \fi% + \pgfmath@next} \def\pgfmathmax@@@{\pgfmath@returnone\pgfmath@x\endgroup}% -% For computability with old code. +% For compatability with old code. \def\pgfmathmax#1#2{% - \pgfmathparse{#1,#2}% - \expandafter\pgfmathmax@\expandafter{\pgfmathresult}% + \pgfmathparse{#1,#2}% + \expandafter\pgfmathmax@\expandafter{\pgfmathresult}% } % min function. % \pgfmathdeclarefunction{min}{...}{% - \begingroup% - \pgfmath@x=16383pt\relax% - \pgfmathmin@@#1{}} + \begingroup% + \pgfmath@x=16383pt\relax% + \pgfmathmin@@#1{}} \def\pgfmathmin@@#1{% - \def\pgfmath@temp{#1}% - \ifx\pgfmath@temp\pgfmath@empty% - \let\pgfmath@next=\pgfmathmin@@@% - \else% - \ifdim#1pt<\pgfmath@x% - \pgfmath@x=#1pt\relax% - \fi% - \let\pgfmath@next=\pgfmathmin@@% - \fi% - \pgfmath@next} + \def\pgfmath@temp{#1}% + \ifx\pgfmath@temp\pgfmath@empty% + \let\pgfmath@next=\pgfmathmin@@@% + \else% + \ifdim#1pt<\pgfmath@x% + \pgfmath@x=#1pt\relax% + \fi% + \let\pgfmath@next=\pgfmathmin@@% + \fi% + \pgfmath@next} \def\pgfmathmin@@@{\pgfmath@returnone\pgfmath@x\endgroup}% -% For computability with old code. +% For compatability with old code. \def\pgfmathmin#1#2{% - \pgfmathparse{#1,#2}% - \expandafter\pgfmathmin@\expandafter{\pgfmathresult}% + \pgfmathparse{#1,#2}% + \expandafter\pgfmathmin@\expandafter{\pgfmathresult}% } @@ -346,4 +346,4 @@ \pgfmathdeclarefunction{scalar}{1}{% \def\pgfmathresult{#1}% \global\pgfmathunitsdeclaredfalse% -} +}
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.random.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.random.code.tex index 531383dfdcd..44b8ef8f6ef 100644 --- a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.random.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.random.code.tex @@ -7,7 +7,7 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. -% This file defines the pseudorandom numbers. +% This file defines the pesudorandom numbers. % % Version 1.414213 29/9/2007 @@ -15,8 +15,8 @@ % % See: % \book@{pressetal1992, -% author = {William H. Press and Brian P. Flannery and Saul A. -% Teukolsky and William T. Vetterling}, +% author = {William H. Press and Brian P. Flannery and Saul A. +% Teukolsky and William T. Vetterling}, % title = {Numerical Recipies in C}, % edition = {Second}, % publisher = {Cambridge University Press} @@ -30,26 +30,23 @@ \begingroup \c@pgfmath@counta=\time% \multiply\c@pgfmath@counta by\year% -\ifnum\c@pgfmath@counta=0 - \c@pgfmath@counta=1 -\fi -\xdef\pgfmath@rnd@z{\the\c@pgfmath@counta}% The seed. +\xdef\pgfmath@rnd@z{\the\c@pgfmath@counta}% The seed. \endgroup % \pgfmathsetseed % -% Explicitly set the seed for the generator -% +% Explictly set the seed for the generator +% % #1 -> the new seed. % \def\pgfmathsetseed#1{% - % Attention pgflibraryluamath.code.tex relies on the fact that - % this method also modifies \pgfmathresult: - \pgfmathparse{#1}\expandafter\pgfmath@setseed\pgfmathresult.0\pgfmath@stop + % Attention pgflibraryluamath.code.tex relies on the fact that + % this method also modifies \pgfmathresult: + \pgfmathparse{#1}\expandafter\pgfmath@setseed\pgfmathresult.0\pgfmath@stop }% -\def\pgfmath@setseed#1.#2\pgfmath@stop{\def\pgfmath@rnd@z{#1}}% +\def\pgfmath@setseed#1.#2\pgfmath@stop{\def\pgfmath@rnd@z{#1}}% -% Alternative parameters - see Press et al (1992) p278-279, +% Alternative paramaters - see Press et al (1992) p278-279, % for discussion. % % a=16807 q=127773 r=2836 @@ -60,33 +57,33 @@ \def\pgfmath@rnd@q{30845} % \pgfmathgeneratepseudorandomnumber -% +% % A linear congruency generator for generating % pseudo-random numbers. Generates numbers in % the range 1 - 2^31-1. % \def\pgfmathgeneratepseudorandomnumber{% - \begingroup% - \c@pgfmath@counta=\pgfmath@rnd@z% - \c@pgfmath@countb=\pgfmath@rnd@z% - \c@pgfmath@countc=\pgfmath@rnd@q% - \divide\c@pgfmath@counta by\c@pgfmath@countc% - \multiply\c@pgfmath@counta by-\c@pgfmath@countc% - \advance\c@pgfmath@counta by\c@pgfmath@countb - \c@pgfmath@countc=\pgfmath@rnd@a% - \multiply\c@pgfmath@counta by\c@pgfmath@countc% - \c@pgfmath@countc=\pgfmath@rnd@q% - \divide\c@pgfmath@countb by\c@pgfmath@countc% - \c@pgfmath@countc=\pgfmath@rnd@r% - \multiply\c@pgfmath@countb by\c@pgfmath@countc% - \advance\c@pgfmath@counta by-\c@pgfmath@countb% - \ifnum\c@pgfmath@counta<0\relax% - \c@pgfmath@countb=\pgfmath@rnd@m% - \advance\c@pgfmath@counta by\c@pgfmath@countb% - \fi% - \xdef\pgfmath@rnd@z{\the\c@pgfmath@counta}% - \endgroup% - \edef\pgfmathresult{\pgfmath@rnd@z}% + \begingroup% + \c@pgfmath@counta=\pgfmath@rnd@z% + \c@pgfmath@countb=\pgfmath@rnd@z% + \c@pgfmath@countc=\pgfmath@rnd@q% + \divide\c@pgfmath@counta by\c@pgfmath@countc% + \multiply\c@pgfmath@counta by-\c@pgfmath@countc% + \advance\c@pgfmath@counta by\c@pgfmath@countb + \c@pgfmath@countc=\pgfmath@rnd@a% + \multiply\c@pgfmath@counta by\c@pgfmath@countc% + \c@pgfmath@countc=\pgfmath@rnd@q% + \divide\c@pgfmath@countb by\c@pgfmath@countc% + \c@pgfmath@countc=\pgfmath@rnd@r% + \multiply\c@pgfmath@countb by\c@pgfmath@countc% + \advance\c@pgfmath@counta by-\c@pgfmath@countb% + \ifnum\c@pgfmath@counta<0\relax% + \c@pgfmath@countb=\pgfmath@rnd@m% + \advance\c@pgfmath@counta by\c@pgfmath@countb% + \fi% + \xdef\pgfmath@rnd@z{\the\c@pgfmath@counta}% + \endgroup% + \edef\pgfmathresult{\pgfmath@rnd@z}% } % \pgfmathrnd @@ -94,22 +91,22 @@ % Generates a pseudo-random number between 0 and 1. % \pgfmathdeclarefunction{rnd}{0}{% - \begingroup% - \pgfmathgeneratepseudorandomnumber% - \c@pgfmath@counta\pgfmathresult% - \c@pgfmath@countb\c@pgfmath@counta% - \divide\c@pgfmath@countb100001\relax% To get one. - \multiply\c@pgfmath@countb-100001\relax% - \advance\c@pgfmath@countb\c@pgfmath@counta% - \advance\c@pgfmath@countb1000000\relax% - \expandafter\pgfmathrnd@@\the\c@pgfmath@countb\pgfmath@% - \pgfmath@returnone\pgfmath@x% - \endgroup% + \begingroup% + \pgfmathgeneratepseudorandomnumber% + \c@pgfmath@counta\pgfmathresult% + \c@pgfmath@countb\c@pgfmath@counta% + \divide\c@pgfmath@countb100001\relax% To get one. + \multiply\c@pgfmath@countb-100001\relax% + \advance\c@pgfmath@countb\c@pgfmath@counta% + \advance\c@pgfmath@countb1000000\relax% + \expandafter\pgfmathrnd@@\the\c@pgfmath@countb\pgfmath@% + \pgfmath@returnone\pgfmath@x% + \endgroup% }% \def\pgfmathrnd@@#1#2#3\pgfmath@{% - \edef\pgfmath@temp{#2.#3}% - \pgfmath@x=\pgfmath@temp pt\relax% + \edef\pgfmath@temp{#2.#3}% + \pgfmath@x=\pgfmath@temp pt\relax% }% % \pgfmathrand @@ -117,57 +114,57 @@ % Generates a pseudo-random number between -1 and 1. % \pgfmathdeclarefunction{rand}{0}{% - \begingroup% - \pgfmathgeneratepseudorandomnumber% - \c@pgfmath@counta\pgfmathresult% - \c@pgfmath@countb\c@pgfmath@counta% - \divide\c@pgfmath@countb200001\relax% - \multiply\c@pgfmath@countb-200001\relax% - \advance\c@pgfmath@countb\c@pgfmath@counta% - \advance\c@pgfmath@countb-100000\relax% - \ifnum\c@pgfmath@countb<0\relax% - \advance\c@pgfmath@countb-1000000\relax% - \else% - \advance\c@pgfmath@countb1000000\relax% - \fi% - \expandafter\pgfmathrand@@\the\c@pgfmath@countb\pgfmath@% - \pgfmath@returnone\pgfmath@x% - \endgroup% + \begingroup% + \pgfmathgeneratepseudorandomnumber% + \c@pgfmath@counta\pgfmathresult% + \c@pgfmath@countb\c@pgfmath@counta% + \divide\c@pgfmath@countb200001\relax% + \multiply\c@pgfmath@countb-200001\relax% + \advance\c@pgfmath@countb\c@pgfmath@counta% + \advance\c@pgfmath@countb-100000\relax% + \ifnum\c@pgfmath@countb<0\relax% + \advance\c@pgfmath@countb-1000000\relax% + \else% + \advance\c@pgfmath@countb1000000\relax% + \fi% + \expandafter\pgfmathrand@@\the\c@pgfmath@countb\pgfmath@% + \pgfmath@returnone\pgfmath@x% + \endgroup% }% \def\pgfmathrand@@#1#2#3#4\pgfmath@{% - \ifx#1-% - \edef\pgfmath@temp{-#3.#4}% - \else% - \edef\pgfmath@temp{#2.#3#4}% - \fi% - \pgfmath@x=\pgfmath@temp pt\relax% + \ifx#1-% + \edef\pgfmath@temp{-#3.#4}% + \else% + \edef\pgfmath@temp{#2.#3#4}% + \fi% + \pgfmath@x=\pgfmath@temp pt\relax% }% \pgfmathdeclarefunction{random}{...}{% - \begingroup% - \def\pgfmath@temp{#1}% - \ifx\pgfmath@temp\pgfmath@empty% - \pgfmathrnd@% - \else% - \expandafter\pgfmathrandom@@#1\pgfmath@stop% - \fi% - \pgfmath@smuggleone\pgfmathresult% - \endgroup} + \begingroup% + \def\pgfmath@temp{#1}% + \ifx\pgfmath@temp\pgfmath@empty% + \pgfmathrnd@% + \else% + \expandafter\pgfmathrandom@@#1\pgfmath@stop% + \fi% + \pgfmath@smuggleone\pgfmathresult% + \endgroup} \def\pgfmathrandom@@{\futurelet\pgfmath@token\pgfmathrandom@@@} \def\pgfmathrandom@@@{% - \ifx\pgfmath@token\bgroup% - \expandafter\pgfmath@random@@@@% - \else% - \expandafter\pgfmath@random@@@@@% - \fi% + \ifx\pgfmath@token\bgroup% + \expandafter\pgfmath@random@@@@% + \else% + \expandafter\pgfmath@random@@@@@% + \fi% } \def\pgfmath@random@@@@@#1\pgfmath@stop{% - \pgfmathrandominteger\pgfmathresult{1}{#1}% + \pgfmathrandominteger\pgfmathresult{1}{#1}% } \def\pgfmath@random@@@@#1#2\pgfmath@stop{% - \pgfmathrandominteger\pgfmathresult{#1}{#2}% + \pgfmathrandominteger\pgfmathresult{#1}{#2}% } % \pgfmathrandominteger @@ -179,29 +176,29 @@ % #3 - the upper limit of the range. % \def\pgfmathrandominteger#1#2#3{% - \begingroup% - \pgfmathgeneratepseudorandomnumber% - \c@pgfmath@counta#2\relax% - \c@pgfmath@countb#3\relax% - \c@pgfmath@countc\c@pgfmath@countb% - % OK. Maybe #2 > #3. - \ifnum\c@pgfmath@counta>\c@pgfmath@countb\relax% - \c@pgfmath@countc\c@pgfmath@countb% - \c@pgfmath@countb\c@pgfmath@counta% - \c@pgfmath@counta\c@pgfmath@countc% - \fi% - \advance\c@pgfmath@countc1\relax% - \advance\c@pgfmath@countc-\c@pgfmath@counta% - \c@pgfmath@counta\pgfmathresult\relax% - \c@pgfmath@countb\c@pgfmath@counta% - \divide\c@pgfmath@countb\c@pgfmath@countc% - \multiply\c@pgfmath@countb-\c@pgfmath@countc% - \advance\c@pgfmath@counta\c@pgfmath@countb% - \advance\c@pgfmath@counta#2\relax% - \edef\pgfmathresult{\the\c@pgfmath@counta}% - \pgfmath@smuggleone{\pgfmathresult}% - \endgroup% - \edef#1{\pgfmathresult}% + \begingroup% + \pgfmathgeneratepseudorandomnumber% + \c@pgfmath@counta#2\relax% + \c@pgfmath@countb#3\relax% + \c@pgfmath@countc\c@pgfmath@countb% + % OK. Maybe #2 > #3. + \ifnum\c@pgfmath@counta>\c@pgfmath@countb\relax% + \c@pgfmath@countc\c@pgfmath@countb% + \c@pgfmath@countb\c@pgfmath@counta% + \c@pgfmath@counta\c@pgfmath@countc% + \fi% + \advance\c@pgfmath@countc1\relax% + \advance\c@pgfmath@countc-\c@pgfmath@counta% + \c@pgfmath@counta\pgfmathresult\relax% + \c@pgfmath@countb\c@pgfmath@counta% + \divide\c@pgfmath@countb\c@pgfmath@countc% + \multiply\c@pgfmath@countb-\c@pgfmath@countc% + \advance\c@pgfmath@counta\c@pgfmath@countb% + \advance\c@pgfmath@counta#2\relax% + \edef\pgfmathresult{\the\c@pgfmath@counta}% + \pgfmath@smuggleone{\pgfmathresult}% + \endgroup% + \edef#1{\pgfmathresult}% } % \pgfmathdeclarerandomlist @@ -212,24 +209,24 @@ % #2 - a list of comma separated elements. % \def\pgfmathdeclarerandomlist#1#2{% - \def\pgfmath@randomlistname{#1}% - \begingroup% - \c@pgfmath@counta=1\relax% - % {} is a possible random element so (locally) - % redefine \pgfmath@empty. - \def\pgfmath@empty{pgfmath@empty}% - \expandafter\pgfmath@scanrandomlist#2{pgfmath@empty}} + \def\pgfmath@randomlistname{#1}% + \begingroup% + \c@pgfmath@counta=1\relax% + % {} is a possible random element so (locally) + % redefine \pgfmath@empty. + \def\pgfmath@empty{pgfmath@empty}% + \expandafter\pgfmath@scanrandomlist#2{pgfmath@empty}} \def\pgfmath@scanrandomlist#1{% - \def\pgfmath@scanneditem{#1}% - \ifx\pgfmath@scanneditem\pgfmath@empty% - \advance\c@pgfmath@counta-1\relax% - \expandafter\xdef\csname pgfmath@randomlist@\pgfmath@randomlistname\endcsname{\the\c@pgfmath@counta}% - \endgroup% - \else% - \expandafter\gdef\csname pgfmath@randomlist@\pgfmath@randomlistname @\the\c@pgfmath@counta\endcsname{#1}% - \advance\c@pgfmath@counta1\relax% - \expandafter\pgfmath@scanrandomlist% - \fi} + \def\pgfmath@scanneditem{#1}% + \ifx\pgfmath@scanneditem\pgfmath@empty% + \advance\c@pgfmath@counta-1\relax% + \expandafter\xdef\csname pgfmath@randomlist@\pgfmath@randomlistname\endcsname{\the\c@pgfmath@counta}% + \endgroup% + \else% + \expandafter\gdef\csname pgfmath@randomlist@\pgfmath@randomlistname @\the\c@pgfmath@counta\endcsname{#1}% + \advance\c@pgfmath@counta1\relax% + \expandafter\pgfmath@scanrandomlist% + \fi} % \pgfmathrandomitem % @@ -239,7 +236,8 @@ % #2 - the name of the list. % \def\pgfmathrandomitem#1#2{% - \pgfmath@ifundefined{pgfmath@randomlist@#2}{\pgfmath@error{Unknown random list `#2'}}{% - \edef\pgfmath@randomlistlength{\csname pgfmath@randomlist@#2\endcsname}% - \pgfmathrandominteger{\pgfmath@randomtemp}{1}{\pgfmath@randomlistlength}% - \def#1{\csname pgfmath@randomlist@#2@\pgfmath@randomtemp\endcsname}}} + \pgfmath@ifundefined{pgfmath@randomlist@#2}{\pgfmath@error{Unknown random list `#2'}}{% + \edef\pgfmath@randomlistlength{\csname pgfmath@randomlist@#2\endcsname}% + \pgfmathrandominteger{\pgfmath@randomtemp}{1}{\pgfmath@randomlistlength}% + \def#1{\csname pgfmath@randomlist@#2@\pgfmath@randomtemp\endcsname}}} + diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.round.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.round.code.tex index 4bd05c18c41..07f7b8b6d90 100644 --- a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.round.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.round.code.tex @@ -13,111 +13,111 @@ % round function. Uses asymmetric half-up rounding. % -\pgfmathdeclarefunction{round}{1}{% - \begingroup% - \expandafter\pgfmath@x#1pt\relax% - \afterassignment\pgfmath@xa% - \expandafter\c@pgfmath@counta\the\pgfmath@x\relax% - \pgfmath@xb\pgfmath@x% - \ifdim\pgfmath@xb<0pt\relax% - \ifdim\pgfmath@xa<0.5pt\relax% - \else% - \advance\c@pgfmath@counta-1\relax% - \fi% - \else% - \ifdim\pgfmath@xa<0.5pt\relax% - \else% - \advance\c@pgfmath@counta1\relax% - \fi% - \fi% - \pgfmath@returnone\the\c@pgfmath@counta pt% - \endgroup% +\pgfmathdeclarefunction{round}{1}{% + \begingroup% + \expandafter\pgfmath@x#1pt\relax% + \afterassignment\pgfmath@xa% + \expandafter\c@pgfmath@counta\the\pgfmath@x\relax% + \pgfmath@xb\pgfmath@x% + \ifdim\pgfmath@xb<0pt\relax% + \ifdim\pgfmath@xa<0.5pt\relax% + \else% + \advance\c@pgfmath@counta-1\relax% + \fi% + \else% + \ifdim\pgfmath@xa<0.5pt\relax% + \else% + \advance\c@pgfmath@counta1\relax% + \fi% + \fi% + \pgfmath@returnone\the\c@pgfmath@counta pt% + \endgroup% }% % floor function. % -\pgfmathdeclarefunction{floor}{1}{% - \begingroup% - \expandafter\pgfmath@x#1pt\relax% - \afterassignment\pgfmathfloor@collect@remainder% - \expandafter\c@pgfmath@counta\the\pgfmath@x\pgfmath@% - \expandafter\pgfmath@x#1pt\relax% - \ifdim\pgfmath@x<0pt\relax% - \ifdim\pgfmathfloor@remainder>0pt - \advance\c@pgfmath@counta by -1\relax% - \else - % ok, we stripped only '0'. - \fi - \fi% - \pgfmath@x\c@pgfmath@counta pt\relax% - \pgfmath@returnone\pgfmath@x% - \endgroup% +\pgfmathdeclarefunction{floor}{1}{% + \begingroup% + \expandafter\pgfmath@x#1pt\relax% + \afterassignment\pgfmathfloor@collect@remainder% + \expandafter\c@pgfmath@counta\the\pgfmath@x\pgfmath@% + \expandafter\pgfmath@x#1pt\relax% + \ifdim\pgfmath@x<0pt\relax% + \ifdim\pgfmathfloor@remainder>0pt + \advance\c@pgfmath@counta by -1\relax% + \else + % ok, we stripped only '0'. + \fi + \fi% + \pgfmath@x\c@pgfmath@counta pt\relax% + \pgfmath@returnone\pgfmath@x% + \endgroup% }% \def\pgfmathfloor@collect@remainder#1\pgfmath@{% - \def\pgfmathfloor@remainder{#1}% - \ifx\pgfmathfloor@remainder\pgfutil@empty - \def\pgfmathfloor@remainder{0}% - \fi + \def\pgfmathfloor@remainder{#1}% + \ifx\pgfmathfloor@remainder\pgfutil@empty + \def\pgfmathfloor@remainder{0}% + \fi }% % ceil function. % -\pgfmathdeclarefunction{ceil}{1}{% - \begingroup% - \expandafter\pgfmath@x#1pt\relax% - \afterassignment\pgfmath@gobbletilpgfmath@% - \expandafter\c@pgfmath@counta\the\pgfmath@x\relax\pgfmath@% - \pgfmath@y\pgfmath@x% - \advance\pgfmath@y-\c@pgfmath@counta pt\relax% - \pgfmath@x\c@pgfmath@counta pt\relax% - \ifdim\pgfmath@y>0pt\relax% - \advance\pgfmath@x1pt\relax% - \fi% - \pgfmath@returnone\pgfmath@x% - \endgroup% +\pgfmathdeclarefunction{ceil}{1}{% + \begingroup% + \expandafter\pgfmath@x#1pt\relax% + \afterassignment\pgfmath@gobbletilpgfmath@% + \expandafter\c@pgfmath@counta\the\pgfmath@x\relax\pgfmath@% + \pgfmath@y\pgfmath@x% + \advance\pgfmath@y-\c@pgfmath@counta pt\relax% + \pgfmath@x\c@pgfmath@counta pt\relax% + \ifdim\pgfmath@y>0pt\relax% + \advance\pgfmath@x1pt\relax% + \fi% + \pgfmath@returnone\pgfmath@x% + \endgroup% }% % int function % \pgfmathdeclarefunction{int}{1}{% - \begingroup% - \expandafter\pgfmathint@@#1.\pgfmath@stop - \pgfmath@smuggleone\pgfmathresult% - \endgroup} + \begingroup% + \expandafter\pgfmathint@@#1.\pgfmath@stop + \pgfmath@smuggleone\pgfmathresult% + \endgroup} \def\pgfmathint@@#1.#2\pgfmath@stop{% - \def\pgfmath@temp{#1}% - \ifx\pgfmath@temp\pgfmath@empty% - \def\pgfmathresult{0}% - \else% - \pgfmath@in@{#1}{+-+0-0}% - \ifpgfmath@in@ - \def\pgfmathresult{0}% - \else% - \def\pgfmathresult{#1}% - \fi% - \fi} + \def\pgfmath@temp{#1}% + \ifx\pgfmath@temp\pgfmath@empty% + \def\pgfmathresult{0}% + \else% + \pgfmath@in@{#1}{+-+0-0}% + \ifpgfmath@in@ + \def\pgfmathresult{0}% + \else% + \def\pgfmathresult{#1}% + \fi% + \fi} % frac function. % -\pgfmathdeclarefunction{frac}{1}{% - \begingroup% - \expandafter\pgfmathfrac@@#1.\pgfmath@stop% - \pgfmath@smuggleone\pgfmathresult% - \endgroup} +\pgfmathdeclarefunction{frac}{1}{% + \begingroup% + \expandafter\pgfmathfrac@@#1.\pgfmath@stop% + \pgfmath@smuggleone\pgfmathresult% + \endgroup} \def\pgfmathfrac@@#1.{% - \pgfmath@ifnextchar\pgfmath@stop{\def\pgfmathresult{0.0}\pgfmath@gobbleone}{\pgfmathfrac@@@}% + \pgfmath@ifnextchar\pgfmath@stop{\def\pgfmathresult{0.0}\pgfmath@gobbleone}{\pgfmathfrac@@@}% } \def\pgfmathfrac@@@#1.\pgfmath@stop{\def\pgfmathresult{0.#1}} % real function. % \pgfmathdeclarefunction{real}{1}{% - \begingroup% - \pgfmath@x=#1pt\relax% - \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@x}}% - \pgfmath@smuggleone\pgfmathresult% - \endgroup% + \begingroup% + \pgfmath@x=#1pt\relax% + \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@x}}% + \pgfmath@smuggleone\pgfmathresult% + \endgroup% } diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.trigonometric.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.trigonometric.code.tex index 76b58bc0f16..aa98934e807 100644 --- a/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.trigonometric.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathfunctions.trigonometric.code.tex @@ -9,7 +9,7 @@ % This file defines the trigonometric functions/functions. % -% Much of this file is based on ideas and code (particularly +% Much of this file is based on ideas and code (particularly % the old \pgfcoremath.code.tex) due to Till Tantau. % % Version 1.414213 29/9/2007 @@ -19,25 +19,25 @@ \pgfmathdeclarefunction{pi}{0}{\def\pgfmathresult{3.141592654}} \pgfkeys{ - /pgf/trig format/.is choice, - % attention: the luamath library will hook into these code keys. - /pgf/trig format/deg/.code={\def\pgfmath@trig@format@choice{0}}, - /pgf/trig format/rad/.code={\def\pgfmath@trig@format@choice{1}}, - /pgf/trig format/deg, + /pgf/trig format/.is choice, + % attention: the luamath library will hook into these code keys. + /pgf/trig format/deg/.code={\def\pgfmath@trig@format@choice{0}}, + /pgf/trig format/rad/.code={\def\pgfmath@trig@format@choice{1}}, + /pgf/trig format/deg, } % Executes #1 if 'trig format=deg' and #2 otherwise. \def\pgfmathiftrigonometricusesdeg#1#2{% - \if0\pgfmath@trig@format@choice - #1% - \else - #2% - \fi + \if0\pgfmath@trig@format@choice + #1% + \else + #2% + \fi }% -% \pgfmathradians -% (for compatibility with 1.18 beta, will be deprecated) -% +% \pgfmathradians +% (for comptability with 1.18 beta, will be deprecated) +% % Convert #1 from radians to degrees (accurate to 1 deg). % \pgfmathdeclarefunction{radians}{1}{% @@ -49,13 +49,13 @@ }% % \pgfmathdeg -% +% % Convert #1 from radians to degrees. % -\pgfmathdeclarefunction{deg}{1}{% +\pgfmathdeclarefunction{deg}{1}{% \begingroup% \expandafter\pgfmath@x#1pt\relax% - \pgfmath@scale@rad@to@deg\pgfmath@x + \pgfmath@scale@rad@to@deg\pgfmath@x \pgfmath@returnone\pgfmath@x% \endgroup% }% @@ -65,24 +65,24 @@ }% % \pgfmathrad -% +% % Convert #1 from degrees to radians. % -\pgfmathdeclarefunction{rad}{1}{% +\pgfmathdeclarefunction{rad}{1}{% \begingroup% \expandafter\pgfmath@x#1pt\relax% - \pgfmath@scale@deg@to@rad\pgfmath@x + \pgfmath@scale@deg@to@rad\pgfmath@x \pgfmath@returnone\pgfmath@x% \endgroup% }% \def\pgfmath@scale@deg@to@rad#1{% - #1=3.14159#1% + #1=3.14159#1% \divide#1180\relax% }% % \pgfmathsin -% +% % Calculate the sine of #1 (in degrees). % \pgfmathdeclarefunction{sin}{1}{% @@ -91,10 +91,10 @@ % \begingroup% \expandafter\pgfmath@x#1pt\relax% - \if1\pgfmath@trig@format@choice - % trig format=rad - \pgfmath@scale@rad@to@deg\pgfmath@x - \fi + \if1\pgfmath@trig@format@choice + % trig format=rad + \pgfmath@scale@rad@to@deg\pgfmath@x + \fi \advance\pgfmath@x-90pt\relax% \afterassignment\pgfmath@gobbletilpgfmath@ \expandafter\c@pgfmath@counta\the\pgfmath@x\relax\pgfmath@ @@ -128,7 +128,7 @@ } % \pgfmathcos -% +% % Calculate the cosine of #1 (in degrees). % \pgfmathdeclarefunction{cos}{1}{% @@ -137,12 +137,12 @@ % \begingroup% \expandafter\pgfmath@x#1pt\relax% - \if1\pgfmath@trig@format@choice - % trig format=rad - \pgfmath@scale@rad@to@deg\pgfmath@x - \fi + \if1\pgfmath@trig@format@choice + % trig format=rad + \pgfmath@scale@rad@to@deg\pgfmath@x + \fi \afterassignment\pgfmath@gobbletilpgfmath@% - \expandafter\c@pgfmath@counta\the\pgfmath@x\relax\pgfmath@% + \expandafter\c@pgfmath@counta\the\pgfmath@x\relax\pgfmath@% \divide\c@pgfmath@counta360\relax% \multiply\c@pgfmath@counta-360\relax% \advance\pgfmath@x\c@pgfmath@counta pt\relax% @@ -173,7 +173,7 @@ } % \pgfmathsincos -% +% % Calculate the sin and cosine of #1 (in degrees). % \def\pgfmathsincos#1{% @@ -186,7 +186,7 @@ } % \pgfmathtan -% +% % Calculate the tangent of #1 (in degrees). % \pgfmathdeclarefunction{tan}{1}{% @@ -203,16 +203,16 @@ } % \pgfmathcosec -% +% % Calculate the cosec of #1 (in degrees). % -\pgfmathdeclarefunction{cosec}{1}{% +\pgfmathdeclarefunction{cosec}{1}{% \expandafter\pgfmathsin@\expandafter{#1}% \pgfmathreciprocal@{\pgfmathresult}% } % \pgfmathsec -% +% % Calculate the sec of #1 (in degrees). % \pgfmathdeclarefunction{sec}{1}{% @@ -221,10 +221,10 @@ } % \pgfmathcot -% +% % Calculate the cotangent of #1 (in degrees). % -\pgfmathdeclarefunction{cot}{1}{% +\pgfmathdeclarefunction{cot}{1}{% \begingroup% \edef\pgfmath@temparg{#1}% \pgfmathsin@{\pgfmath@temparg}% @@ -262,10 +262,10 @@ \ifdim\pgfmath@xa<0pt\relax% \pgfmath@x-\pgfmath@x% \fi% - \if1\pgfmath@trig@format@choice - % trig format=rad - \pgfmath@scale@deg@to@rad\pgfmath@x - \fi + \if1\pgfmath@trig@format@choice + % trig format=rad + \pgfmath@scale@deg@to@rad\pgfmath@x + \fi \pgfmath@returnone\pgfmath@x% \endgroup% } @@ -301,7 +301,7 @@ % \pgfmathacos % % The acos of #1 -% +% \pgfmathdeclarefunction{acos}{1}{% \begingroup% \pgfmath@x#1pt\relax% @@ -318,10 +318,10 @@ \pgfmath@x-\pgfmath@x% \advance\pgfmath@x by180pt\relax% \fi% - \if1\pgfmath@trig@format@choice - % trig format=rad - \pgfmath@scale@deg@to@rad\pgfmath@x - \fi + \if1\pgfmath@trig@format@choice + % trig format=rad + \pgfmath@scale@deg@to@rad\pgfmath@x + \fi \pgfmath@returnone\pgfmath@x% \endgroup% } @@ -351,10 +351,10 @@ \ifdim\pgfmath@xa<0pt\relax% \pgfmath@x-\pgfmath@x% \fi% - \if1\pgfmath@trig@format@choice - % trig format=rad - \pgfmath@scale@deg@to@rad\pgfmath@x - \fi + \if1\pgfmath@trig@format@choice + % trig format=rad + \pgfmath@scale@deg@to@rad\pgfmath@x + \fi \pgfmath@returnone\pgfmath@x% \endgroup% } @@ -362,8 +362,8 @@ \pgfmathdeclarefunction{atan2}{2}{% % Note: first parameter is y (!), second is x (!) \begingroup% - \let\pgfmath@trig@format@choice@@=\pgfmath@trig@format@choice - \def\pgfmath@trig@format@choice{0}% + \let\pgfmath@trig@format@choice@@=\pgfmath@trig@format@choice + \def\pgfmath@trig@format@choice{0}% \pgfmath@y=#1pt\relax% \ifdim\pgfmath@y<0pt\relax% \pgfmath@y=-\pgfmath@y% @@ -402,12 +402,12 @@ \pgfmath@x=-\pgfmath@x% \fi% \fi% - \if1\pgfmath@trig@format@choice@@ - % trig format=rad - \pgfmath@scale@deg@to@rad\pgfmath@x - \fi + \if1\pgfmath@trig@format@choice@@ + % trig format=rad + \pgfmath@scale@deg@to@rad\pgfmath@x + \fi \pgfmath@returnone\pgfmath@x% - \endgroup% + \endgroup% } % This is needed since \pgfmathatan2 is not a legal macro name @@ -557,7 +557,7 @@ \pgfmath@def{cosfrac}{94}{0.72862} \pgfmath@def{cosfrac}{95}{0.72499} \pgfmath@def{cosfrac}{96}{0.72138} \pgfmath@def{cosfrac}{97}{0.71779} \pgfmath@def{cosfrac}{98}{0.71421} \pgfmath@def{cosfrac}{99}{0.71065} -\pgfmath@def{cosfrac}{100}{0.70710} +\pgfmath@def{cosfrac}{100}{0.70710} % Oh No! Some really loooooong tables. \pgfmath@def{atan}{0}{0.00000} \pgfmath@def{atan}{1}{0.05729} @@ -1060,8 +1060,8 @@ \pgfmath@def{atan}{994}{44.82759} \pgfmath@def{atan}{995}{44.85640} \pgfmath@def{atan}{996}{44.88517} \pgfmath@def{atan}{997}{44.91392} \pgfmath@def{atan}{998}{44.94264} \pgfmath@def{atan}{999}{44.97133} -\pgfmath@def{atan}{1000}{45.00000} - +\pgfmath@def{atan}{1000}{45.00000} + \pgfmath@def{acos}{0}{90.00000} \pgfmath@def{acos}{1}{89.94270} \pgfmath@def{acos}{2}{89.88540} \pgfmath@def{acos}{3}{89.82811} \pgfmath@def{acos}{4}{89.77081} \pgfmath@def{acos}{5}{89.71352} diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathode.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathode.code.tex index cb3d0d26ca8..d8837897558 100644 --- a/Master/texmf-dist/tex/generic/pgf/math/pgfmathode.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathode.code.tex @@ -36,12 +36,12 @@ %********************************************************************** % Numerically solve a differential system with 1st order Runge-Kutta -% (Euler method) +% (Euler method) % dq1/dt = f1(t,q1,q2,...,qN) % dq2/dt = f2(t,q1,q2,...,qN) % ... % dqN/dt = fN(t,q1,q2,...,qN) -% +% % #1: A pgf array where the solution will be stored. % At the end: % #1 -> {{t(0),q1(t(0)),q2(t(0)),...,qN(t(0))}, @@ -58,7 +58,7 @@ % * First order example: dq/dt = -q + 5 with IC=(t=0,q(0)=0) % \pgfmathodeRKI{\Sol}{{-\Sol[1]+5}}{{0,0}}{3.5}{100} % * Second order example: {dq1/dt=q2, dq2/dt=-q2/2-sin(q1)} (damped -% pendulum) +% pendulum) % \pgfmathodeRKI{\Sol}{{\Sol[2],-\Sol[2]/2-sin(deg(\Sol[1]))}}% % {{0,-1,5}}{15}{50} @@ -71,8 +71,8 @@ % The set of rhs {f1(t,q1,q2,...,qN),...,fN(t,q1,q2,...,qN)} is % given in terms of #1[0],#1[1],...,#1[N]. We need to transform to % #1[\pgfmathode@timeindex][0],...,#1[\pgfmathode@timeindex][N], that is - % add [\pgfmathode@timeindex] after every occurrence of #1 in #2. - % No need to brace #2 since it is already surrounded by braces. The + % add [\pgfmathode@timeindex] after every occurence of #1 in #2. + % No need to brace #2 since it is already surounded by braces. The % result is stored in \pgfmathode@func \pgfmathode@addindextofunc[#1]#2% % Set time step. Actually the number of time steps is #5-1, so we @@ -93,9 +93,9 @@ \foreach \pgfmathode@funcindex in {1,...,\pgfmathode@dimfunc} {% % The RKI algorithm % qk[t(i)] = Deltat*fk(t(i-1),q1(t(i-1)),...qN(t(i-1))) + - % qk[t(i-1)] - % Note: this part can be really slow due to array management in - % pgfmath. + % qk[t(i-1)] + % Note: this part can be really slow due to array managment in + % pgfmath. % TODO: find a better way (at least inside this loop) \pgfmathparse{% \pgfmathode@Deltat*(\pgfmathode@func[\pgfmathode@funcindex-1])+ @@ -132,7 +132,7 @@ % Start the function loop \foreach \pgfmathode@funcindex in {1,...,\pgfmathode@dimfunc} {% % The RKIV algorithm - % qk[t(i)] = qk[t(i-1)] + + % qk[t(i)] = qk[t(i-1)] + % (1/6) * (j1k + 2j2k + 2j3k + j4k) % where j1k = fk(t(i-1),q1(t(i-1)),...qN(t(i-1))) * Deltat % j2k = fk(t(i-1)+.5*Deltat, @@ -175,4 +175,4 @@ \endgroup} -\endinput +\endinput
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex index f9afe04d72d..0ede2314cfe 100644 --- a/Master/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex @@ -24,7 +24,7 @@ \fi \pgfmath@parse@next} -\def\pgfmath@catcodes{% Maybe unnecessary. +\def\pgfmath@catcodes{% Maybe unecessary. \catcode`\==12 % \catcode`\,=12 % \catcode`\|=12 % @@ -36,23 +36,23 @@ \pgfmath@catcodes \pgfmath@quickparsetrue \pgfmathparse@} - + \def\pgfmathparse@#1{% - % No (math) units yet. + % No (math) units yet. \global\pgfmathunitsdeclaredfalse \global\pgfmathmathunitsdeclaredfalse - % Expand expression so any remaining CSs are registers + % Expand expression so any reamining CSs are registers % or box dimensions (i.e. |\wd|, |\ht|, |\dp|). \edef\pgfmath@expression{#1}% - % - \expandafter\pgfmathparse@trynumber@loop\pgfmath@expression\pgfmath@parse@stop - % - % this here is the _real_ parser. it is invoked by - % \pgfmathparse@trynumber@loop if that says "this is no number" - %\pgfmathparse@@\pgfmath@parse@stop% + % + \expandafter\pgfmathparse@trynumber@loop\pgfmath@expression\pgfmath@parse@stop + % + % this here is the _real_ parser. it is invoked by + % \pgfmathparse@trynumber@loop if that says "this is no number" + %\pgfmathparse@@\pgfmath@parse@stop% } -\def\pgfmath@parse@stop{\pgfmath@parse@stop}% equals only itself +\def\pgfmath@parse@stop{\pgfmath@parse@stop}% equals only itsself \def\pgfmathparse@trynumber@token{numeric} \begingroup @@ -66,52 +66,52 @@ % % #1 a single token \def\pgfmathparse@trynumber@loop{% - \futurelet\pgfmath@token@let\pgfmathparse@trynumber@loop@ + \futurelet\pgfmath@token@let\pgfmathparse@trynumber@loop@ }% \def\pgfmathparse@trynumber@loop@#1{% - \ifx\pgfmath@token@let\pgf@let@space@token - % Hm. we found a white space... and we have no support for - % trimming. That means we have to assume that the white space - % occurred somewhere in the middle - and fall back to the - % expensive method. - \def\pgfmath@parse@next{\pgfmathparse@@#1}% - \else - \ifx\pgfmath@token@let\bgroup% - % oh! We found '{' #1. - % Well, these braces appear to be special; fall back to - % the complicated routine... - \let\pgfmath@parse@next=\pgfmathparse@@ - \else - \ifx\pgfmath@token@let\pgfmath@parse@stop - % Ah: we have passed the check! The expression consists only - % of 0123456789. , so do not parse anything and return it - % as-is! - \let\pgfmath@parse@next=\pgfmathparse@expression@is@number - \else - \expandafter\ifx\csname pgfmath@token@\pgfmathparse@trynumber@token @\string#1\endcsname\relax% - % hm. It is none of 0123456789. - \let\pgfmath@parse@next=\pgfmathparse@@ - \else - % continue... we only found one of 0123456789. so - % far... - \let\pgfmath@parse@next=\pgfmathparse@trynumber@loop - \fi - \fi - \fi - \fi - \pgfmath@parse@next + \ifx\pgfmath@token@let\pgf@let@space@token + % Hm. we found a white space... and we have no support for + % trimming. That means we have to assume that the white space + % occurred somewhere in the middle - and fall back to the + % expensive method. + \def\pgfmath@parse@next{\pgfmathparse@@#1}% + \else + \ifx\pgfmath@token@let\bgroup% + % oh! We found '{' #1. + % Well, these braces appear to be special; fall back to + % the complicated routine... + \let\pgfmath@parse@next=\pgfmathparse@@ + \else + \ifx\pgfmath@token@let\pgfmath@parse@stop + % Ah: we have passed the check! The expression consists only + % of 0123456789. , so do not parse anything and return it + % as-is! + \let\pgfmath@parse@next=\pgfmathparse@expression@is@number + \else + \expandafter\ifx\csname pgfmath@token@\pgfmathparse@trynumber@token @\string#1\endcsname\relax% + % hm. It is none of 0123456789. + \let\pgfmath@parse@next=\pgfmathparse@@ + \else + % continue... we only found one of 0123456789. so + % far... + \let\pgfmath@parse@next=\pgfmathparse@trynumber@loop + \fi + \fi + \fi + \fi + \pgfmath@parse@next }% \def\pgfmathparse@expression@is@number{% - \let\pgfmathresult=\pgfmath@expression + \let\pgfmathresult=\pgfmath@expression \pgfmath@smuggleone\pgfmathresult% \endgroup \ignorespaces }% \def\pgfmathparse@@#1\pgfmath@parse@stop{% % We are inside a group (opened in |\pgfmathparse| or - % |\pgfmathqparse|). - % Stuff for calc compatibility. + % |\pgfmathqparse|). + % Stuff for calc compatiability. \let\real=\pgfmath@calc@real \let\minof=\pgfmath@calc@minof \let\maxof=\pgfmath@calc@maxof @@ -141,7 +141,7 @@ \let\pgfmathpostparse=\relax -% For compatibility with older version. +% For compatiability with older version. % \def\pgfmathscaleresult{% \ifpgfmathunitsdeclared @@ -178,7 +178,7 @@ \pgfmath@next% }% -% Stuff for computability with the calc package. +% Stuff for compatability with the calc package. % \def\pgfmath@calc@real#1{#1} \def\pgfmath@calc@minof#1#2{min(#1,#2)} @@ -208,14 +208,14 @@ \edef\pgfmath@char@hash{\the\pgfmath@toks} \def\pgfmath@tokens@make#1#2{% - % Defines for each token or balanced text in |#2| a control sequence + % Defines for each token or balenced text in |#2| a control sequence % |\pgfmath@token@<#1>@\string<one token from #2>| and stores |#2| % in it. \def\pgfmath@prefix{#1}% % Note the empty group |{}| at the end that ends the loop in % |\pgfmath@token@@make|. \expandafter\pgfmath@tokens@@make#2{}} - + \def\pgfmath@tokens@@make#1{% \def\pgfmath@token{#1}% \ifx\pgfmath@token\pgfmath@empty @@ -265,7 +265,7 @@ \let\pgfmath@parse@nobgroup@after=#2% \futurelet\pgfmath@token@let% \pgfmath@parse@@ifbgroup} - + \def\pgfmath@parse@@ifbgroup{% \ifx\pgfmath@token@let\bgroup \let\pgfmath@parse@next=\pgfmath@parse@@@ifbgroup @@ -305,9 +305,9 @@ \def\pgfmath@parse@@operand{% \pgfmath@parse@ifbgroup{\pgfmath@parse@@operand}{\pgfmath@parse@@operand@}} -% An operand is +% An operand is % * |+| (unary plus), -% * |-| (unary minus), +% * |-| (unary minus), % * a prefix operator \def\pgfmath@parse@@operand@#1{% \def\pgfmath@token{#1}% @@ -396,8 +396,8 @@ % 4. A box dimension (e.g., \wd\mybox). % 5. A box dimension preceded by a number or a count register. % 6. Scientific notation (e.g., 1.234567e-10). -% 7. A binary, hexadecimal, or octal number. -% +% 7. A binary, hexadeciaml, or octal number. +% \def\pgfmath@parse@number{\pgfmath@parse@ifbgroup{\pgfmath@parse@number}{\pgfmath@parse@number@}} \def\pgfmath@parse@number@#1{% \let\pgfmath@token=\pgfmath@token@next% @@ -430,7 +430,7 @@ \pgfmath@count=\pgfmath@token% \expandafter\def\expandafter\pgfmath@number\expandafter{\the\pgfmath@count}% \expandafter\ifcat\pgfmath@token@next\relax% - % A CS following a count register should be \wd, \ht or \dp. + % A CS following a count register should be \wd, \ht or \dp. \let\pgfmath@parse@next=\pgfmath@parse@number% \else% \let\pgfmathresult=\pgfmath@number% @@ -464,7 +464,7 @@ \expandafter\ifx\csname pgfmath@token@mathunit@\pgfmath@token\expandafter\string\pgfmath@token@next\endcsname\relax% % ...none of the above... \ifx\pgfmath@base\pgfmath@empty% - \let\pgfmathresult=\pgfmath@number% + \let\pgfmathresult=\pgfmath@number% \else% \ifx\pgfmath@number\pgfmath@char@zero% \let\pgfmathresult=\pgfmath@number% @@ -491,7 +491,7 @@ \let\pgfmath@parse@next=\pgfmath@parse@base% \fi% \else% ... and here, it is the exponent characters. - \let\pgfmath@parse@next=\pgfmath@parse@exponent% + \let\pgfmath@parse@next=\pgfmath@parse@exponent% \fi% \else% ...but here it is units. \global\pgfmathunitsdeclaredtrue% @@ -555,7 +555,7 @@ \expandafter\def\expandafter\pgfmath@number\expandafter{\the\pgfmath@count}% \def\pgfmath@token@next{#1}% \expandafter\ifcat\pgfmath@token@next\relax% - % A CS following a count register should be \wd, \ht or \dp. + % A CS following a count register should be \wd, \ht or \dp. \let\pgfmath@parse@next=\pgfmath@parse@number% \else% \let\pgfmathresult=\pgfmath@number% @@ -579,7 +579,7 @@ \pgfmath@parse@@operator% } -% Parse binary or hexadecimal numbers (octal numbers done elsewhere). +% Parse binary or hexadecimal numbers (octal numbers done elsehwere). % \def\pgfmath@parse@base{% \ifnum\pgfmath@base=2\relax% @@ -596,7 +596,7 @@ \let\pgfmath@number=\pgfmath@empty% \expandafter\pgfmath@parse@next\pgfmath@token@next% } - + \def\pgfmath@parse@binary#1{% \expandafter\ifx\csname pgfmath@token@binary@#1\endcsname\relax% \expandafter\pgfmathbasetobase\expandafter\pgfmathresult\expandafter{\pgfmath@number}{2}{10}% @@ -622,7 +622,7 @@ \fi% \pgfmath@parse@next% } - + % Parse a function. % \def\pgfmath@parse@function{\pgfmath@parse@ifbgroup{\pgfmath@parse@function}{\pgfmath@parse@@function}} @@ -645,7 +645,7 @@ \expandafter\def\expandafter\pgfmath@function\expandafter{\pgfmath@function#1}% \let\pgfmath@parse@next=\pgfmath@parse@function@% \fi% - \else% It is from A-Z, a-z, or _. + \else% It is from from A-Z, a-z, or _. \edef\pgfmath@function{\pgfmath@function#1}% \let\pgfmath@parse@next=\pgfmath@parse@function@% \fi% @@ -683,7 +683,7 @@ \pgfmath@parse@ifbgroup{\pgfmath@parse@@operator@@}{\pgfmath@parse@@operator@@}}% \def\pgfmath@parse@@operator@@#1{% ...and second token. \def\pgfmath@token@next{#1}% - \pgfmath@parse@@@operator} + \pgfmath@parse@@@operator} \def\pgfmath@parse@@@operator{% \expandafter\ifx\csname pgfmath@operator@\pgfmath@token\expandafter\string\pgfmath@token@next\endcsname\relax% @@ -770,10 +770,10 @@ % \def\pgfmath@operator@@@process{% Process an operator. \pgfmath@stack@pop@operation\pgfmath@@operator% - \pgfmath@stack@pop@operand\pgfmath@operand@a% + \pgfmath@stack@pop@operand\pgfmath@operand@a% \ifcase\csname pgfmath@operation@\pgfmath@@operator @arity\endcsname\relax% % Zero arity operators (!). - \or% + \or% \pgfmath@operator@@@@process{\pgfmath@operand@a}% \or% \pgfmath@stack@pop@operand\pgfmath@operand@b% @@ -781,7 +781,7 @@ \or% \pgfmath@stack@pop@operand\pgfmath@operand@b% \expandafter\pgfmath@operator@@@@process\expandafter% - {\expandafter\pgfmath@operand@b\expandafter}\pgfmath@operand@a% + {\expandafter\pgfmath@operand@b\expandafter}\pgfmath@operand@a% \else% % No operators with more than tenary arity. \fi% @@ -807,7 +807,7 @@ \else% \expandafter\pgfmath@function@@@@process\expandafter{\pgfmath@@operand}% \fi% - \fi% + \fi% } \def\pgfmath@function@@@@process{\csname pgfmath\pgfmath@@function @\endcsname} @@ -834,7 +834,7 @@ \def\pgfmath@stack@pop@operation#1{% \pgfmath@stack@pop\pgfmath@stack@operation{#1}% \let\pgfmath@stack@operation@top=\pgfmath@stack@top} - + % REMARK: This method will be overwritten by the FPU library. Please % keep any changes consistent. \def\pgfmath@stack@push@operand#1{% @@ -844,11 +844,11 @@ \def\pgfmath@stack@pop@operand#1{% \pgfmath@stack@pop\pgfmath@stack@operand{#1}% \let\pgfmath@stack@operand@top=\pgfmath@stack@top} - + % Declare an operator for the parser. % -% It is not recommended that new operators be created as +% It is not recommended that new operators be created as % the parser is not fully robust for arbitrary operators. % \def\pgfmathdeclareoperator#1#2#3#4#5{% @@ -896,7 +896,7 @@ \pgfmathdeclareoperator{)}{@endgroup} {0}{postfix}{4} \pgfmathdeclareoperator{\pgfmath@bgroup}{@startarray}{1}{prefix} {3} -\pgfmathdeclareoperator{\pgfmath@egroup}{@endarray} {1}{postfix}{2}% +\pgfmathdeclareoperator{\pgfmath@egroup}{@endarray} {1}{postfix}{2}% % Special operators. \pgfmathdeclareoperator{"}{}{1}{prefix}{1} diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex index d98ecb25d59..44d39c75b6a 100644 --- a/Master/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathutil.code.tex @@ -1,9 +1,9 @@ % Copyright 2007 Mark Wibrow % -% but subject to the LaTeX Project Public License +% but subject to the LaTeX Project Public License % (http://www.latex-project.org/lppl.txt) % -% and the GNU Public License +% and the GNU Public License % (http://www.gnu.org/licenses/gpl.txt) % @@ -21,30 +21,30 @@ % #2 - a control sequence. % \def\pgfmath@ensureregister#1#2{% - \begingroup% - \setbox0=\hbox\bgroup\begingroup% In case #2 is a defined macro. Unlikely, but you never know... - \afterassignment\pgfmath@@ensureregister% - \noexpand#20.0pt\let\pgfmath@temp\relax\relax\pgfmath@#2#1\pgfmath@} + \begingroup% + \setbox0=\hbox\bgroup\begingroup% In case #2 is a defined macro. Unlikely, but you never know... + \afterassignment\pgfmath@@ensureregister% + \noexpand#20.0pt\let\pgfmath@temp\relax\relax\pgfmath@#2#1\pgfmath@} \def\pgfmath@@ensureregister#1#2\pgfmath@#3#4#5\pgfmath@{% - \endgroup\egroup% - \endgroup% - \ifx#4c% - \ifx#1.% Already a count register. - \else% - \csname newcount\endcsname#3% This gets round \outer in plain TeX. - \fi% - \else% - \ifx#4d% - \ifx\let#1% Already a dimen register. - \else% - \csname newdimen\endcsname#3% - \fi% - \fi% - \fi% + \endgroup\egroup% + \endgroup% + \ifx#4c% + \ifx#1.% Already a count register. + \else% + \csname newcount\endcsname#3% This gets round \outer in plain TeX. + \fi% + \else% + \ifx#4d% + \ifx\let#1% Already a dimen register. + \else% + \csname newdimen\endcsname#3% + \fi% + \fi% + \fi% } -% Check registers exist. If not, create them. +% Check registers exist. If not, create them. % \pgfmath@ensureregister{dimen}{\pgf@x} \pgfmath@ensureregister{dimen}{\pgf@xa} @@ -91,63 +91,63 @@ \let\pgfmath@tempcntb\pgfutil@tempcntb % Now check if pgfutil and pgf@sys stuff exists. If it does, fine. -% Just \let pgfmath versions. If not, define pgfmath versions (Arghhh). +% Just \let pgfmath versions. If not, define pgfmath versions (Arghhh). % % \...ifnextchar % \ifx\pgfutil@ifnextchar\pgfmath@undefined% - \long\def\pgfmath@ifnextchar#1#2#3{% + \long\def\pgfmath@ifnextchar#1#2#3{% \let\pgfmath@reserved@d#1% \def\pgfmath@reserved@a{#2}% \def\pgfmath@reserved@b{#3}% \futurelet\pgfmath@let@token\pgfmath@ifnch} - \def\pgfmath@ifnch{% - \ifx\pgfmath@let@token\pgfmath@sptoken% - \let\pgfmath@reserved@c\pgfmath@xifnch% - \else% - \ifx\pgfmath@let@token\pgfmath@reserved@d% - \let\pgfmath@reserved@c\pgfmath@reserved@a% - \else% - \let\pgfmath@reserved@c\pgfmath@reserved@b% - \fi% - \fi% - \pgfmath@reserved@c} - {% - \def\:{\global\let\pgfmath@sptoken= } \: - \def\:{\pgfmath@xifnch} \expandafter\gdef\: {\futurelet\pgfmath@let@token\pgfmath@ifnch} - }% + \def\pgfmath@ifnch{% + \ifx\pgfmath@let@token\pgfmath@sptoken% + \let\pgfmath@reserved@c\pgfmath@xifnch% + \else% + \ifx\pgfmath@let@token\pgfmath@reserved@d% + \let\pgfmath@reserved@c\pgfmath@reserved@a% + \else% + \let\pgfmath@reserved@c\pgfmath@reserved@b% + \fi% + \fi% + \pgfmath@reserved@c} + {% + \def\:{\global\let\pgfmath@sptoken= } \: + \def\:{\pgfmath@xifnch} \expandafter\gdef\: {\futurelet\pgfmath@let@token\pgfmath@ifnch} + }% \else% - \let\pgfmath@ifnextchar\pgfutil@ifnextchar% - % Still need to define \pgfmath@sptoken (cannot \let). - {% - \def\:{\global\let\pgfmath@sptoken= } \: - }% + \let\pgfmath@ifnextchar\pgfutil@ifnextchar% + % Still need to define \pgfmath@sptoken (cannot \let). + {% + \def\:{\global\let\pgfmath@sptoken= } \: + }% \fi% % \...ifundefined % \ifx\pgfutil@ifundefined\pgfmath@undefined% - \long\def\pgfmath@ifundefined#1{% - \expandafter\ifx\csname#1\endcsname\relax% - \expandafter\pgfmath@firstoftwo% - \else% - \expandafter\pgfmath@secondoftwo% - \fi}% + \long\def\pgfmath@ifundefined#1{% + \expandafter\ifx\csname#1\endcsname\relax% + \expandafter\pgfmath@firstoftwo% + \else% + \expandafter\pgfmath@secondoftwo% + \fi}% \else% - \let\pgfmath@ifundefined\pgfutil@ifundefined% + \let\pgfmath@ifundefined\pgfutil@ifundefined% \fi% % \...selectfont % \ifx\pgfutil@selectfont\pgfmath@undefined% - \ifx\selectfont\pgfmath@undefined% - \let\pgfmath@selectfont\rm% Plain TeX and ConTeXt. - \else% - \let\pgfmath@selectfont\selectfont% LaTeX. - \fi% + \ifx\selectfont\pgfmath@undefined% + \let\pgfmath@selectfont\rm% Plain TeX and ConTeXt. + \else% + \let\pgfmath@selectfont\selectfont% LaTeX. + \fi% \else% - \let\pgfmath@selectfont\pgfutil@selectfont% + \let\pgfmath@selectfont\pgfutil@selectfont% \fi% % New definition easier than fussing around with let. @@ -163,43 +163,43 @@ % \ifx\pgf@sys@tonumber\pgfmath@undefined% {\catcode`\p=12\catcode`\t=12\gdef\Pgf@geT#1pt{#1}} - \def\pgfmath@tonumber#1{\expandafter\Pgf@geT\the#1} + \def\pgfmath@tonumber#1{\expandafter\Pgf@geT\the#1} \else% - \let\pgfmath@tonumber\pgf@sys@tonumber% + \let\pgfmath@tonumber\pgf@sys@tonumber% \fi% % \PackageWarning and \PackageError % \ifx\PackageWarning\pgfmath@undefined - \def\pgfmath@PackageWarning#1#2{\immediate\write-1{Package #1: Warning! #2.}}% + \def\pgfmath@PackageWarning#1#2{\immediate\write-1{Package #1: Warning! #2.}}% \else% - \let\pgfmath@PackageWarning\PackageWarning% + \let\pgfmath@PackageWarning\PackageWarning% \fi% \ifx\PackageError\pgfmath@undefined - \def\pgfmath@PackageError#1#2#3{\errmessage{Package #1 Error: #2.}}% + \def\pgfmath@PackageError#1#2#3{\errmessage{Package #1 Error: #2.}}% \else% - \let\pgfmath@PackageError\PackageError% + \let\pgfmath@PackageError\PackageError% \fi% \def\pgfmath@error#1#2{% - \pgfmath@PackageError{PGF Math}{% - #1% - \pgfutil@ifundefined{pgfmath@expression}{}{ (in '\pgfmath@expression')}% - }{#2}% + \pgfmath@PackageError{PGF Math}{% + #1% + \pgfutil@ifundefined{pgfmath@expression}{}{ (in '\pgfmath@expression')}% + }{#2}% } \def\pgfmath@warning#1{% - \pgfmath@PackageWarning{PGF Math}{% - #1% - \pgfutil@ifundefined{pgfmath@expression}{}{ (in '\pgfmath@expression')}% - }% + \pgfmath@PackageWarning{PGF Math}{% + #1% + \pgfutil@ifundefined{pgfmath@expression}{}{ (in '\pgfmath@expression')}% + }% } % \pgfmath@pt % % Needed to test for 'pt' resulting from expansion using \the. % -{\catcode`\p=12\catcode`\t=12\gdef\PgfmaTh@PT{pt}} +{\catcode`\p=12\catcode`\t=12\gdef\PgfmaTh@PT{pt}} \edef\pgfmath@pt{\PgfmaTh@PT}% % \pgfmath@empty @@ -214,7 +214,7 @@ % \pgfmath@gobbletilpgfmath@ % % Gobble stream until \pgfmath@ {which is undefined}. -% +% \def\pgfmath@gobbletilpgfmath@#1\pgfmath@{} \def\pgfmath@gobbleone#1{}% @@ -231,17 +231,17 @@ % \newif\ifpgfmathcontinueloop \def\pgfmathloop#1\repeatpgfmathloop{% - \def\pgfmathcounter{1}% - \def\pgfmath@iterate{% - #1\relax% - {% Do this inside a group, just in case... - \c@pgfmath@counta\pgfmathcounter% - \advance\c@pgfmath@counta1\relax% - \xdef\pgfmathloop@temp{\the\c@pgfmath@counta}% - }% - \edef\pgfmathcounter{\pgfmathloop@temp}% - \expandafter\pgfmath@iterate\fi}% - \pgfmath@iterate\let\pgfmath@iterate\relax} + \def\pgfmathcounter{1}% + \def\pgfmath@iterate{% + #1\relax% + {% Do this inside a group, just in case... + \c@pgfmath@counta\pgfmathcounter% + \advance\c@pgfmath@counta1\relax% + \xdef\pgfmathloop@temp{\the\c@pgfmath@counta}% + }% + \edef\pgfmathcounter{\pgfmathloop@temp}% + \expandafter\pgfmath@iterate\fi}% + \pgfmath@iterate\let\pgfmath@iterate\relax} \let\repeatpgfmathloop\fi \def\pgfmathbreakloop{\let\pgfmath@iterate\relax}% @@ -251,7 +251,7 @@ % % Changed by TT: made faster and simpler since it is used % *heavily*. #1 must be something that can be assigned to a -% dimension. +% dimension. % \def\pgfmath@returnone#1\endgroup{% \pgfmath@x#1% @@ -269,6 +269,6 @@ % followed by \endgroup % \def\pgfmath@smuggleone#1\endgroup{% - \expandafter\endgroup\expandafter\def\expandafter#1\expandafter{#1}} + \expandafter\endgroup\expandafter\def\expandafter#1\expandafter{#1}} \let\pgfmathsmuggle=\pgfmath@smuggleone diff --git a/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduleanimations.code.tex b/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduleanimations.code.tex index d4e82cb1af5..4860107d1c2 100644 --- a/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduleanimations.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduleanimations.code.tex @@ -34,15 +34,15 @@ % times must be given in ascending order. Between the times given in % this way, the values of the attribute will be interpolated; you can % influence the details of how this interpolation is done using -% additional keys. +% additional keys. % % The keys in #2 are given in key-value syntax and can be given in any % order, except that the entry keys must be given in order of -% ascending times. +% ascending times. % % The syntax of the second parameter of the entry key depends on % #1. Currently, these are: -% +% % Attribute Value Type % --------------------------------------- % fill opacity scalar @@ -71,7 +71,7 @@ \def\pgfanimateattribute#1#2{% \pgfanimateattributecode{#1}{\pgfkeys{/pgf/animation/.cd,#2}}% -}% +} % Variant of \pgfanimateattribute @@ -91,7 +91,7 @@ \csname pgf@animation@check@\pgf@animation@attribute\endcsname% \pgfsysanimate{\pgf@animation@attribute}% }% -}% +} @@ -124,8 +124,8 @@ % \fill (0,0) rectangle (1,1); % } -\def\pgfsnapshot#1{\pgfparsetime{#1}\expandafter\pgfsysanimsnapshot\expandafter{\pgftimeresult}}% -\def\pgfsnapshotafter#1{\pgfparsetime{#1}\expandafter\pgfsysanimsnapshotafter\expandafter{\pgftimeresult}}% +\def\pgfsnapshot#1{\pgfparsetime{#1}\expandafter\pgfsysanimsnapshot\expandafter{\pgftimeresult}} +\def\pgfsnapshotafter#1{\pgfparsetime{#1}\expandafter\pgfsysanimsnapshotafter\expandafter{\pgftimeresult}} % The animation attributes @@ -155,23 +155,23 @@ view/.code=\pgf@animate@attr{viewbox}{viewbox}, dash/.code=\pgf@animate@attr{dash}{dash}, none/.code=\pgf@animate@attr{none}{none}, -}% +} \def\pgf@animate@attr#1#2{% \def\pgf@animation@attribute{#1}% \expandafter\let\expandafter\pgfanim@type@parser\csname pgfanim@parse@type@#2\endcsname% -}% +} % The time parser -% +% % #1 = a time -% +% % This macro parses the time in #1, but adds some support for times: -% +% % 1) The postfix operator "s" is added, which has no effect. -% 2) The postfix operator "ms" is added, which divides a number by +% 2) The postfix operator "ms" is added, which devides a number by % 1000, so "2ms" equals "0.002". % 3) The postfix operator "min" is added, which multiplies a number by % 60. @@ -195,11 +195,11 @@ \pgfmathparse{#1}% \expandafter\endgroup% \expandafter\def\expandafter\pgftimeresult\expandafter{\pgfmathresult}% -}% +} \newif\ifpgfanim@m@encountered \newif\ifpgfanim@i@encountered -\pgfmathdeclarefunction{@seconds}{1}{% +\pgfmathdeclarefunction{@seconds}{1}{% \begingroup% \expandafter\pgfmath@x#1pt\relax% \ifpgfanim@m@encountered% @@ -228,7 +228,7 @@ \pgfmath@returnone\pgfmath@x% \endgroup% }% -\pgfmathdeclarefunction{@minutes}{1}{% +\pgfmathdeclarefunction{@minutes}{1}{% \ifpgfanim@i@encountered% \global\pgfanim@i@encounteredfalse% \else% @@ -240,7 +240,7 @@ \pgfmath@returnone\pgfmath@x% \endgroup% }% -\pgfmathdeclarefunction{@hours}{1}{% +\pgfmathdeclarefunction{@hours}{1}{% \begingroup% \expandafter\pgfmath@x#1pt\relax% \pgfmath@x3600\pgfmath@x\relax% @@ -255,23 +255,23 @@ \advance\pgfmath@x by\pgfmath@y% \pgfmath@returnone\pgfmath@x% \endgroup% -}% +} % Sets general animation attributes -% +% % #1 = key-value pairs that are executed for the path /pgf/animation/ -\def\pgfanimationset{\pgfqkeys{/pgf/animation}}% +\def\pgfanimationset{\pgfqkeys{/pgf/animation}} % Sets the target animation scope that should be animated. -% +% % #1 = A name that will be used with an idscope. % % Example: -% +% % \pgfanimateattribute{fill opacity}{whom=some scope, entry={0s}{1}, entry={1s}{0}} % \begin{scope}[name=some scope] % \draw (0,0) -- (1,1); @@ -286,7 +286,7 @@ \let\pgf@anim@whom@id\pgf@anim@id% \let\pgf@anim@whom@type\pgf@anim@type% } -}% +} \def\pgf@anim@decomp#1{% \edef\pgf@temp{#1}% @@ -296,45 +296,45 @@ \else% \expandafter\pgf@anim@decomp@\pgf@temp.\pgf@stop% \fi% -}% +} \def\pgf@anim@decomp@#1.#2\pgf@stop{% \def\pgf@anim@id@name{#1}% \def\pgf@anim@type{#2}% -}% +} % Assigns a name to this animation so that it can be used as an event % id in another animation -% +% % #1 = A name -% +% % The name "previous" is special and always refers to the most recent -% animation before the animation currently being constructed. +% animation before the animation currently being constructed. % % Example: -% +% % \pgfanimateattribute{fill opacity}{name=anim 1, entry={0s}{1}, entry={1s}{0}} % \pgfanimateattribute{fill opacity}{begin on={end,of=anim 1}, entry={0s}{1}, entry={1s}{0}} \pgfanimationset{ - name/.code=\pgfuseid{#1}, -}% + name/.code=\pgfuseid{#1} +} % Configures whether an animation can be restarted -% +% % Some animations can restart when certain events take place. This key -% configures this. Setting it to -% +% configures this. Setting it to +% % "true" allows a restart at any time, % "false" does not allow a restart, % "when not active" allows a restart only, when the element is not -% active. +% active. % % Example: -% +% % \pgfanimateattribute{fill opacity}{entry={0s}{1}, entry={1s}{0}, restart=false} \pgfanimationset{ @@ -343,29 +343,29 @@ restart/true/.code=\pgfsysanimkeyrestartalways, restart/false/.code=\pgfsysanimkeyrestartnever, restart/never/.code=\pgfsysanimkeyrestartnever, - restart/when not active/.code=\pgfsysanimkeyrestartwhennotactive, -}% + restart/when not active/.code=\pgfsysanimkeyrestartwhennotactive +} % Sets the number times an animation should repeat -% +% % #1 = A string of the following form: -% +% % [<empty> | <number> | for <time>] ["accumulating"] -% +% % When empty (the default value) the animation repeats forever. % % When a <number> is provided, the animation will repeat <number> -% times, which need not be an integer. -% -% When a <time> is given, the repeating will stop after this much time. -% +% times, which need not be an integer. +% +% When a <time> is given, the repeating will stop after this much time. +% % When the optional "accumulating" is specified, the repeat % accumulates, otherwise each repeat begins with the original start -% value. +% value. % % Example: -% +% % \pgfanimateattribute{fill opacity}{repeats, entry={0s}{1}, entry={6s}{0}} % \pgfanimateattribute{fill opacity}{repeats=2, entry={0s}{1}, entry={6s}{0}} % \pgfanimateattribute{fill opacity}{repeats=2 accumulating, entry={0s}{1}, entry={6s}{0}} @@ -385,25 +385,25 @@ repeats/.default=, repeat/.style={repeats={#1}}, repeat/.default=, -}% +} \def\pgfanim@parse@acc#1accumulating\pgf@stop{% \pgfanim@parse@noacc{#1}% -}% +} \def\pgfanim@parse@noacc#1{% - \pgfutil@in@{\pgf@stop for}{\pgf@stop#1}% + \pgfutil@in@{\pgf@stop for}{\pgf@stop#1}% \ifpgfutil@in@% \pgfanim@parse@for#1\pgf@stop% \else% \def\pgf@temp{#1}% \ifx\pgf@temp\pgfutil@empty% \pgfsysanimkeyrepeatindefinite% - \else% + \else% \pgfmathparse{#1}% \expandafter\pgfsysanimkeyrepeat\expandafter{\pgfmathresult}% \fi% \fi% -}% -\def\pgfanim@parse@for for#1\pgf@stop{\pgfparsetime{#1}\expandafter\pgfsysanimkeyrepeatdur\expandafter{\pgftimeresult}}% +} +\def\pgfanim@parse@for for#1\pgf@stop{\pgfparsetime{#1}\expandafter\pgfsysanimkeyrepeatdur\expandafter{\pgftimeresult}} @@ -413,30 +413,30 @@ % (relative to the current context). The "begin..." options may be % used multiple times and their effects accumulate, likewise for the % "end..." options. -% +% % #1 = A time -% +% % Example: -% +% % \pgfanimateattribute{fill opacity}{begin=2s, end=2.5s, entry={0s}{1}, entry={1s}{0}} \pgfanimationset{ begin/.code=\pgfparsetime{#1}\expandafter\pgfsysanimkeyoffset\expandafter{\pgftimeresult}{begin}, end/.code=\pgfparsetime{#1}\expandafter\pgfsysanimkeyoffset\expandafter{\pgftimeresult}{end}, -}% +} % Specifies that an animation should begin (or end) when a certain -% event takes place. -% +% event takes place. +% % #1 = A list of key-value pairs. -% +% % The following keys are allowed: -% +% % event=some event : The begin / end is triggered by that event. The % list of allowed events is defined in the SVG -% standard. +% standard. % of=some name : The event does not refer to the current group, % but to the object named "some name", which must % previously have been named \pgfuseid. If some @@ -447,11 +447,11 @@ % repeat=number : The trigger is that an animation has been % repeated number times. % delay=time : A delay, may be negative. -% +% % These keys are executed with the path prefix /pgf/animation/events. -% +% % Some of them are predefined: -% +% % "click" is a shorthand for "event=click" % "focus in" is a shorthand for "event=focusin" % "focus out" is a shorthand for "event=focusout" @@ -468,7 +468,7 @@ % % % Begin after 5s or when clicked: % \pgfanimateattribute{fill opacity}{begin=5s, begin on=click, entry={0s}{1}, entry={1s}{0}} -% +% % % Begin, when an object named "button" is clicked % \pgfanimateattribute{fill opacity}{begin on={click, of=button}, entry={0s}{1}, entry={1s}{0}, name=another animation} % @@ -477,8 +477,8 @@ \pgfanimationset{ begin on/.code={\pgfanim@make@event{#1}{begin}},% - end on/.code={\pgfanim@make@event{#1}{end}}, -}% + end on/.code={\pgfanim@make@event{#1}{end}} +} \def\pgfanim@make@event#1#2{% \let\pgfanim@event@event\pgfutil@empty% @@ -501,7 +501,7 @@ \else% \pgfsysanimkeyaccesskey{\pgfanim@event@key}{\pgfanim@event@delay}{#2}% \fi% -}% +} \pgfkeys{/pgf/animation/events/.cd, event/.store in=\pgfanim@event@event, @@ -530,12 +530,12 @@ mouse move/.style={event=mousemove}, mouse out/.style={event=mouseout}, begin/.style={event=begin}, - end/.style={event=end}, -}% + end/.style={event=end} +} % Specifies the timeline start for a snapshot -% +% % #1 = a time % % Description: @@ -548,18 +548,18 @@ \pgfanimationset{ begin snapshot/.code= \pgfparsetime{#1}\expandafter\pgfsysanimkeysnapshotstart\expandafter{\pgftimeresult} -}% +} -% Specifies the origin for transforming animations -% +% Specifies the origin for tranforming animations +% % #1 = a pgf point % % Specifies the origin of transformations (for instance, a rotate will -% rotate around this point). +% rotate around this point). % % Example: -% +% % \pgfanimateattribute{rotate}{entry={0s}{0}, entry={1s}{90}, origin=\pgfpoint{1cm}{1cm}} \pgfanimationset{ @@ -572,42 +572,42 @@ \noexpand\pgf@anim@save@transform{\noexpand\pgftransformshift{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}}% }% \pgf@marshal% - }, -}% + } +} \pgfsysanimkeycanvastransform{{\pgflowlevelsynccm}}{\pgftransforminvert\pgflowlevelsynccm}% -% Specifies the transforming for the animation coordinate system -% +% Specifies the tranforming for the animation coordinate system +% % #1 = code that changes the pgf coordinate system % % Specifies an additional transformation of the coordinate system for -% animations. +% animations. % % Example: -% +% % \pgfanimateattribute{shift}{entry={0s}{\pgfpointorigin}, entry={1s}{\pgfpoint{1cm}{0cm}}, transform=\pgftransformrotate{30}} \pgfanimationset{ transform/.code={% \pgfsysanimkeycanvastransform{#1{\pgflowlevelsynccm}}{\pgftransforminvert\pgflowlevelsynccm}% \pgf@anim@save@transform{#1}% - }, -}% + } +} % Specifies a motion path. -% +% % #1 = pgf commands for constructing a path % % Use this key to specify a motion path for the motion attribute. The % values of the "entry" key specify fractions along this path. % % Example: -% +% % \pgfanimateattribute{motion}{ % entry={0s}{0}, entry={1s}{1}, % along=\pgfpathmoveto{\pgfpointorigin} \pgfpathlineto{\pgfpoint{1cm}{1cm}} @@ -625,18 +625,18 @@ }% \expandafter\pgf@anim@protocol@path@size\pgfanim@the@path\pgf@stop% \expandafter\pgfsysanimkeymovealong\expandafter{\pgfanim@the@path}% -}% +} % Specifies a motion soft path. -% +% % #1 = a pgf soft path (result of calling \pgfsyssoftpath@getcurrentpath) % % Use this key to specify a motion path for the motion attribute when % a softpath has already been constructed. % % Example: -% +% % \pgfanimateattribute{motion}{entry={0s}{0}, entry={1s}{1}, % along softpath=\pgfsyssoftpath@movetotoken {0pt}{0pt}\pgfsyssoftpath@linetotoken {10pt}{10pt}} @@ -644,22 +644,22 @@ along softpath/.code=% \pgf@anim@protocol@path@size#1\pgf@stop% \pgfsysanimkeymovealong{#1}% -}% +} \def\pgf@anim@protocol@path@size{% \pgfutil@ifnextchar\pgf@stop\relax\pgf@anim@protocol@path@size@% -}% +} \def\pgf@anim@protocol@path@size@#1#2#3{% \pgf@protocolanimsizes@direct{#2}{#3}% \pgf@anim@protocol@path@size% -}% +} % Configures whether the motion is rotated along the path. -% +% % Example: -% +% % \pgfanimateattribute{motion}{rotate along, entry={0s}{0}, entry={1s}{1}, % along=\pgfpathmoveto{\pgfpointorigin} \pgfpathlineto{\pgfpoint{1cm}{1cm}}} @@ -668,12 +668,12 @@ rotate along/.default=true, rotate along/true/.code=\pgfsysanimkeyrotatealong, rotate along/false/.code=\pgfsysanimkeynorotatealong, -}% +} % Specifies an entry -% +% % #1 = A time. This time will be parsed using \pgfparsetime % #2 = A value. The format of this value depends on the current type % of the animation attribute. (So for an animation of the "fill @@ -683,15 +683,15 @@ % value will be used. For SVG, this is allowed only when exactly % two entries are specified and this special value is used for % the first one. -% +% % Example: -% +% % \pgfanimateattribute{fill opacity}{entry={0s}{0}, entry={1s}{1}} -\pgfanimationset{entry/.code 2 args=\pgf@anim@entry{#1}{#2}}% +\pgfanimationset{entry/.code 2 args=\pgf@anim@entry{#1}{#2}} \def\pgf@anim@entry#1#2{% \pgf@anim@entry@giventrue% - \pgfparsetime{#1}% + \pgfparsetime{#1}% \edef\pgf@marshal{\noexpand\pgfsysanimkeytime{\pgftimeresult}\pgf@anim@entry@spline\pgf@anim@exit@spline}% \pgf@marshal% \def\pgf@temp{#2}% @@ -700,39 +700,39 @@ \else% \pgfanim@type@parser{#2}% \fi% -}% -\def\pgf@special@current@text{current value}% +} +\def\pgf@special@current@text{current value} \newif\ifpgf@anim@entry@given % Specifies a base value -% +% % #1 = A value. The format is as for the entry key. -% +% % Description: % % Will set the "base" value of the animation, which is a value that is -% used when the animation is not active. +% used when the animation is not active. % % Example: -% +% % \pgfanimateattribute{fill opacity}{base = 0.5, entry={0s}{0.5}, entry={1s}{1}} -\pgfanimationset{base/.code=\pgf@anim@base{#1}}% +\pgfanimationset{base/.code=\pgf@anim@base{#1}} \def\pgf@anim@base#1{% \pgfsysanimkeybase% \pgfanim@type@parser{#1}% -}% +} % Specifies that there is an entry "at infinity". -% +% % When an animation ends, its "effect" can either persist or it can be % removed. Setting "freeze at end" to true will cause it to persist, % otherwise it will be removed. % % Example: -% +% % \pgfanimateattribute{fill opacity}{entry={0s}{1}, entry={1s}{0}, freeze at end} \pgfanimationset{ @@ -740,7 +740,7 @@ freeze at end/.default=true, freeze at end/true/.code=\pgfsysanimkeyfreezeatend, freeze at end/false/.code=\pgfsysanimkeyremoveatend, -}% +} @@ -757,7 +757,7 @@ % value as, say, 1s is 55, at 2s it is 60, and so on. % % Unfortunately, the linear interpolation does not "look" nice in many -% cases since the acceleration of a linear interpolation is zero +% cases since the acceleration of a linear interpolation is zero % during the animation, but infinite at the beginning and at the end; % which looks "jerky". % @@ -803,12 +803,12 @@ }, stay/.code=\let\pgf@anim@exit@spline\pgfsys@stay@text,% jump/.code=\let\pgf@anim@entry@spline\pgfsys@jump@text,% - linear/.style={entry control={1}{1},exit control={0}{0}}, -}% -\def\pgf@anim@entry@spline@base{{1}{1}}% -\def\pgf@anim@exit@spline@base{{0}{0}}% + linear/.style={entry control={1}{1},exit control={0}{0}} +} +\def\pgf@anim@entry@spline@base{{1}{1}} +\def\pgf@anim@exit@spline@base{{0}{0}} -\def\pgf@anim@reset@linear{\let\pgf@anim@entry@spline\pgf@anim@entry@spline@base\let\pgf@anim@exit@spline\pgf@anim@exit@spline@base}% +\def\pgf@anim@reset@linear{\let\pgf@anim@entry@spline\pgf@anim@entry@spline@base\let\pgf@anim@exit@spline\pgf@anim@exit@spline@base} \pgf@anim@reset@linear @@ -838,8 +838,8 @@ \pgfmathsetmacro\pgf@anim@marker@extra@shorten@end{#1}% \edef\pgf@anim@marker@extra@shorten@end{\pgf@anim@marker@extra@shorten@end pt}% \fi% - }, -}% + } +} \def\pgf@anim@marker@extra@shorten@start{0pt}% \def\pgf@anim@marker@extra@shorten@end{0pt}% \def\pgf@anim@marker@shorten@start{0pt}% @@ -865,14 +865,14 @@ \else% \pgf@anim@parser@arrows#1\pgf@stop% \fi% - }, -}% + } +} \def\pgf@anim@parser@arrows#1-#2\pgf@stop{% \pgf@anim@prepare@arrow@start{#1}% \pgf@anim@prepare@arrow@end{#2}% \expandafter\expandafter\expandafter\pgfsysanimkeytipmarkers\expandafter\expandafter\expandafter{\expandafter\pgf@anim@marker@id@start\expandafter}\expandafter{\pgf@anim@marker@id@end}% -}% +} \def\pgf@anim@prepare@arrow@start#1{% \def\pgf@anim@temp{#1}% @@ -888,7 +888,7 @@ }% \let\pgf@anim@marker@shorten@start\pgf@anim@temp% \fi% -}% +} \def\pgf@anim@prepare@arrow@end#1{% \def\pgf@anim@temp{#1}% @@ -903,7 +903,7 @@ }% \let\pgf@anim@marker@shorten@end\pgf@anim@marker@shorten% \fi% -}% +} % Draw an arrow using markers @@ -940,13 +940,13 @@ \expandafter\global\expandafter\let\csname pgfanim@marker@cache@\pgf@anim@marker@id@list\endcsname#2% \expandafter\global\expandafter\let\csname pgfanim@marker@cachel@\pgf@anim@marker@id@list\endcsname#3% \fi% -}% +} \def\pgf@anim@marker@id@test#1#2{% \pgfarrows@getid{#1}{#2}% \expandafter\expandafter\expandafter\pgf@arrow@drawer@shift\csname pgf@ar@ends@\pgf@arrow@id\endcsname% \xdef\pgf@anim@marker@id@list{\pgf@anim@marker@id@list:\pgf@arrow@id\ifpgfarrowswap s\else n\fi\pgfarrows@slant w\the\pgf@xc}% -}% +} \def\pgf@anim@drawer@marker#1#2{% % Prepare: @@ -954,7 +954,7 @@ \pgfarrows@getid{#1}{#2}% % Do shift: \expandafter\expandafter\expandafter\pgf@arrow@drawer@shift\csname pgf@ar@ends@\pgf@arrow@id\endcsname% - % Do slant: + % Do slant: \ifdim\pgfarrows@slant pt=0pt% \else% \pgftransformxslant{\pgfarrows@slant}% @@ -969,11 +969,11 @@ \pgf@arrows@color@setup% \pgflowlevelsynccm\csname pgf@ar@cache@\pgf@arrow@id\endcsname% \pgfsys@endscope% - }% + }% \expandafter}% % Transform to next tip: \expandafter\pgftransformxshift\expandafter{\the\pgf@xc}% -}% +} @@ -986,53 +986,53 @@ % The parsers % Parse no value -% +% % #1 is ignored -% +% % Example: -% +% % entry = {0s}{5+6} \def\pgfanim@parse@type@none#1{% \pgfsysanimvalnone% -}% +} % Parse a scalar -% +% % #1 is a number parsed using \pgfmathparse -% +% % Example: -% +% % entry = {0s}{5+6} \def\pgfanim@parse@type@scalar#1{% \pgfmathparse{#1}% \expandafter\pgfsysanimvalscalar\expandafter{\pgfmathresult}% -}% +} -% Parse a dimension -% +% Parse a dimension +% % #1 is a number parsed using \pgfmathparse -% +% % Example: -% +% % entry = {0s}{5cm + 2pt} \def\pgfanim@parse@type@dimension#1{% \pgfmathparse{#1}% \expandafter\pgfsysanimvaldimension\expandafter{\pgfmathresult pt}% -}% +} % Parse a mapped text -% +% % #1 is a text. It is looked up in \pgf@anim@map@#1 and gets replaced % by what this macro expands to. -% +% % Example: -% +% % entry = {0s}{true} \def\pgfanim@parse@type@mapped#1{% @@ -1044,24 +1044,24 @@ \fi% \expandafter}% \expandafter\pgfsysanimvaltext\expandafter{\pgf@temp}% -}% +} -% Parse a color -% +% Parse a color +% % #1 is a color -% +% % entry = {0s}{blue!20} \def\pgfanim@parse@type@color#1{% \pgfsysanimvalcolor{#1}% -}% +} % Parse a path -% +% % #1 is a sequence of pgf path construction commands -% +% % entry = {0s}{\pgfpathmoveto{\pgfpointorigin} \pgfpathlineto{\pgfpoint{1cm}{1cm}}} \def\pgfanim@parse@type@path#1{% @@ -1075,13 +1075,13 @@ \pgfsyssoftpath@setcurrentpath\pgfanim@save@path% }% \expandafter\pgfanim@parse@type@softpath\expandafter{\pgfanim@the@path}% -}% +} % Parse a softpath -% +% % #1 is a sequence of pgf softpath token commands -% +% % entry = {0s}{\pgfsyssoftpath@movetotoken {0pt}{0pt}\pgfsyssoftpath@linetotoken {10pt}{10pt}} \def\pgfanim@parse@type@softpath#1{% @@ -1103,52 +1103,52 @@ \fi% \expandafter}% \expandafter\pgfsysanimvalpath\expandafter{\pgf@anim@path}% -}% +} \def\pgf@anim@shorten@path{% \pgf@precise@shorteningfalse% \let\pgf@path@shortening@distance\pgf@path@shortening@distance@end% - % + % % Step 1: Split - % + % \pgfprocesssplitpath{\pgf@anim@path}% \pgfprocesssplitsubpath{\pgfprocessresultpathsuffix}% - % + % % Step 2: extract - % + % \expandafter\pgf@parse@end\pgfprocessresultsubpathsuffix\pgf@stop\pgf@stop\pgf@stop% - % + % % Step 3: prep end - % + % \pgf@prep@end% - % + % % Step 4: shorten end - % + % \ifdim\pgf@path@shortening@distance=0pt\else\pgf@do@shorten@end\fi% % \let\pgf@path@shortening@distance\pgf@path@shortening@distance@start% - % + % % Step 5: extract - % + % \expandafter\pgf@parse@start\pgfprocessresultpathsuffix\pgf@stop\pgf@stop\pgf@stop% - % + % % Step 6: prep start - % + % \pgf@prep@start% - % + % % Step 7: shorten start - % + % \ifdim\pgf@path@shortening@distance=0pt\else\pgf@do@shorten@start\fi% \expandafter\expandafter\expandafter\def% \expandafter\expandafter\expandafter\pgf@anim@path% \expandafter\expandafter\expandafter{\expandafter\pgfprocessresultpathprefix\pgfprocessresultpathsuffix}% -}% +} -% Parse a point -% +% Parse a point +% % #1 is a point % % entry = {0s}{\pgfpoint{1cm}{2cm}} @@ -1157,13 +1157,13 @@ \pgf@process{#1}% \pgf@protocolanimsizes\pgf@x\pgf@y% \expandafter\expandafter\expandafter\pgfsysanimvaltranslate\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgf@x\expandafter}\expandafter{\the\pgf@y}% -}% +} -% Parse a scaling -% +% Parse a scaling +% % #1 = if #1 contains a comma, the two parts are passed to -% pgfmathparse, otherwise the whole thing is passed to pgfmathparse. +% pgfmathparse, otherwise the whole thing is passed to pgfmathparse. % % entry = {0s}{2} % entry = {0s}{2,1} @@ -1176,18 +1176,18 @@ \pgfmathparse{#1}% \expandafter\pgfsysanimvalscale\expandafter{\pgfmathresult}{\pgfmathresult}% \fi% -}% +} \def\pgfanim@unpack@comma#1,#2\pgf@stop{% \pgfmathsetmacro{\pgf@anim@temp@x}{#1}% \pgfmathsetmacro{\pgf@anim@temp@y}{#2}% \expandafter\expandafter\expandafter\pgfsysanimvalscale\expandafter\expandafter\expandafter{\expandafter\pgf@anim@temp@x\expandafter}\expandafter{\pgf@anim@temp@y}% -}% +} -% Parse a viewbox -% -% #1 consists of two points, each in parentheses +% Parse a viewbox +% +% #1 consists of two points, each in paranetheses % % entry = {0s}{{\pgfpoint{1cm}{2cm}}{\pgfpoint{3cm}{4cm}}} @@ -1195,9 +1195,9 @@ {% \pgfanim@unpack@viewbox#1% \xdef\pgf@anim@caller{\noexpand\pgfsysanimvalviewbox{\the\pgf@x}{\the\pgf@y}{\the\pgf@xa}{\the\pgf@ya}}% - }% + }% \pgf@anim@caller% -}% +} \def\pgfanim@unpack@viewbox#1#2{% \pgfpointtransformed{#2}% \pgf@xa\pgf@x% @@ -1213,13 +1213,13 @@ \pgf@y=\pgf@ya% \pgf@ya=\pgf@yb% \fi% -}% +} % Parse a dash pattern -% +% % #1,#2 is a dash pattern as in \pgfsetdash % % entry = {0s}{{{1pt}{2pt}{3pt}{1pt}}{1pt}} @@ -1230,13 +1230,13 @@ \def\pgf@next{\pgf@strip}% \pgf@strip#1{pgf@stop}% \expandafter\pgfsysanimvaldash\expandafter{\pgf@temp}{#2}% -}% +} -% +% % % Bounding box adjustments in animations. % @@ -1245,10 +1245,10 @@ \def\pgf@protocolanimsizes#1#2{% \edef\pgf@temp{\noexpand\pgf@anim@handle@point{\the#1}{\the#2}}% \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter\pgf@protocolanim@list\expandafter\expandafter\expandafter{\expandafter\pgf@protocolanim@list\pgf@temp}% -}% +} \def\pgf@protocolanimsizes@direct#1#2{% \expandafter\def\expandafter\pgf@protocolanim@list\expandafter{\pgf@protocolanim@list\pgf@anim@handle@point{#1}{#2}}% -}% +} \let\pgf@protocolanim@list\pgfutil@empty \def\pgf@animation@check@translate{% @@ -1256,7 +1256,7 @@ \else% \expandafter\expandafter\expandafter\pgf@animation@check@translate@\expandafter\expandafter\expandafter{\expandafter\pgf@protocolanim@list\expandafter}\expandafter{\pgf@anim@saved@transform}% \fi% -}% +} \let\pgf@animation@check@motion\pgf@animation@check@translate \def\pgf@animation@check@translate@#1#2{% @@ -1279,7 +1279,7 @@ \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter\pgf@path@size@hook\expandafter\expandafter\expandafter{% \expandafter\pgf@path@size@hook\expandafter\pgf@anim@bb\pgf@temp}% }{}% -}% +} \def\pgf@anim@handle@point#1#2{% \pgf@x#1\pgf@y#2% \pgf@pos@transform\pgf@x\pgf@y% @@ -1287,8 +1287,8 @@ \ifdim\pgf@x>\pgf@picmaxx\pgf@picmaxx\pgf@x\fi% \ifdim\pgf@y<\pgf@picminy\pgf@picminy\pgf@y\fi% \ifdim\pgf@y>\pgf@picmaxy\pgf@picmaxy\pgf@y\fi% -}% - +} + \newdimen\pgf@anim@dim \def\pgf@anim@bb#1#2#3#4{% (#1,#2) lower left, (#3, #4) upper right @@ -1304,11 +1304,11 @@ \pgf@anim@dim\pgf@size@hook@y% \advance\pgf@anim@dim by#4\relax% \ifdim\pgf@anim@dim>\pgf@picmaxy\global\pgf@picmaxy\pgf@anim@dim\fi% -}% +} \def\pgf@anim@save@transform#1{% \def\pgf@anim@saved@transform{#1}% -}% +} \let\pgf@anim@saved@transform\pgfutil@empty% \endinput diff --git a/Master/texmf-dist/tex/generic/pgf/modules/pgfmodulebending.code.tex b/Master/texmf-dist/tex/generic/pgf/modules/pgfmodulebending.code.tex index 888db712043..cc9ed651c71 100644 --- a/Master/texmf-dist/tex/generic/pgf/modules/pgfmodulebending.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/modules/pgfmodulebending.code.tex @@ -14,8 +14,8 @@ % This file defines commands for drawing bending arrows and lines. % -\usepgfmodule{nonlineartransformations}% -\usepgflibrary{curvilinear}% +\usepgfmodule{nonlineartransformations} +\usepgflibrary{curvilinear} % Configuration options for arrow tips: @@ -25,14 +25,13 @@ /pgf/arrow keys/flex/.default=1, /pgf/arrow keys/flex'/.code=\pgfarrowsaddtooptions{\pgf@arrows@the@rigidity#1pt\let\pgf@arrow@flex@mode\pgf@arrow@mode@is@flex@prime}, /pgf/arrow keys/flex'/.default=1, - /pgf/arrow - keys/bend/.code=\pgfarrowsaddtooptions{\let\pgf@arrow@flex@mode\pgf@arrow@mode@is@bend}, -}% + /pgf/arrow keys/bend/.code=\pgfarrowsaddtooptions{\let\pgf@arrow@flex@mode\pgf@arrow@mode@is@bend} +} -\def\pgf@arrow@mode@is@flex{1}% -\def\pgf@arrow@mode@is@flex@prime{2}% -\def\pgf@arrow@mode@is@bend{3}% +\def\pgf@arrow@mode@is@flex{1} +\def\pgf@arrow@mode@is@flex@prime{2} +\def\pgf@arrow@mode@is@bend{3} \newdimen\pgf@arrows@the@rigidity @@ -40,21 +39,21 @@ % % Handle the end of a curve % -% +% -% First, the preparation. This is, essentially, setting up the +% First, the preparation. This is, essenatially, setting up the % nonlinear transformation \def\pgf@prep@curveend{ \pgftransformreset% \pgfsetcurvilinearbeziercurve{\pgfpointlastonpath}{\pgfpointsecondlastonpath}{\pgfpointthirdlastonpath}{\pgfpointfourthlastonpath} -}% +} % Second, the shortening. \def\pgf@do@shorten@curvedend{% \expandafter\expandafter\expandafter\pgf@do@shorten@curvedend@unpack\expandafter\pgfpointfourthlastonpath\pgfpointthirdlastonpath% -}% +} \def\pgf@do@shorten@curvedend@unpack\pgfqpoint#1#2\pgfqpoint#3#4{% \pgf@process{\pgfcurvilineardistancetotime{\pgf@path@shortening@distance}}% % Compute new curve: @@ -74,13 +73,13 @@ \expandafter\expandafter\expandafter\def% \expandafter\expandafter\expandafter\pgfprocessresultpathsuffix% \expandafter\expandafter\expandafter{\expandafter\pgfprocessresultsubpathprefix\pgfprocessresultsubpathsuffix}% -}% +} % Third, the drawing \def\pgf@do@draw@curvedend{% \pgf@do@draw@curved\pgf@end@tip@sequence% -}% +} \def\pgf@do@draw@curved#1{% {% @@ -90,7 +89,7 @@ \let\pgf@arrow@handle@dot\relax% #1% }% -}% +} \def\pgf@draw@curved#1#2{% % Prepare: @@ -106,9 +105,9 @@ \ifcase\pgf@arrow@flex@mode\relax% \expandafter\expandafter\expandafter\pgf@arrow@drawer@rigid\csname pgf@ar@visual@\pgf@arrow@id\endcsname% like flex \or% - \expandafter\expandafter\expandafter\pgf@arrow@drawer@rigid\csname pgf@ar@visual@\pgf@arrow@id\endcsname% + \expandafter\expandafter\expandafter\pgf@arrow@drawer@rigid\csname pgf@ar@visual@\pgf@arrow@id\endcsname% \or% - \expandafter\expandafter\expandafter\pgf@arrow@drawer@rigid\csname pgf@ar@ends@\pgf@arrow@id\endcsname% + \expandafter\expandafter\expandafter\pgf@arrow@drawer@rigid\csname pgf@ar@ends@\pgf@arrow@id\endcsname% \or% \pgf@arrow@drawer@bend% \fi% @@ -117,8 +116,8 @@ \expandafter}% % Transform to next tip: \expandafter\pgf@xb\the\pgf@xb% -}% -\def\pgf@falsetext{false}% +} +\def\pgf@falsetext{false} \def\pgf@arrow@drawer@rigid@shift#1#2#3{% tip end, back end, line end, sep % Let xa be the actual back end of the current arrow plus the back end: @@ -128,14 +127,14 @@ \pgf@x#1% \advance\pgf@x by\pgfarrowsep% \advance\pgf@xb by-\pgf@x% -}% +} \def\pgf@arrow@drawer@bend{% \pgftransformnonlinear{\pgf@arrow@bending@mode{\pgf@x}{\pgf@y}} \pgftransformscale{-1}% \pgftransformxshift{-\pgf@xa}% - % Do slant: + % Do slant: \ifdim\pgfarrows@slant pt=0pt% \else% \pgftransformxslant{\pgfarrows@slant}% @@ -151,7 +150,7 @@ \endpgfscope% }% \pgf@arrows@bending@hull% -}% +} \def\pgf@arrow@drawer@rigid#1#2#3{% (rigid) start, (rigid) end, dummy % Compute the rigid positions: @@ -170,7 +169,7 @@ \pgf@xc#1% \pgf@xc-\pgf@xc% \pgftransformxshift{+\pgf@xc}% - % Do slant: + % Do slant: \ifdim\pgfarrows@slant pt=0pt% \else% \pgftransformxslant{\pgfarrows@slant}% @@ -184,7 +183,7 @@ \pgflowlevelsynccm\csname pgf@ar@cache@\pgf@arrow@id\endcsname% \endpgfscope% \pgf@arrows@rigid@hull% -}% +} \def\pgf@bending@do@tangent{% \pgf@xb\pgf@xa% @@ -211,7 +210,7 @@ \advance\pgf@xb by-\pgf@xa% \advance\pgf@yb by-\pgf@ya% \pgf@process{\pgfpointnormalised{\pgf@x=\pgf@xb\pgf@y=\pgf@yb}} -}% +} \def\pgf@bending@possible@degenerate{% \ifx\pgf@curvilinear@line@a\pgf@curvilinear@line@b% degenerate! @@ -232,7 +231,7 @@ \else% \pgf@bending@do@tangent@normal% \fi% -}% +} \def\pgf@bending@do@flex{ \pgf@xb\pgf@xa% @@ -249,7 +248,7 @@ \pgf@process{\pgfpointcurveattime{\pgf@xb}{\pgf@curvilinear@line@a}{\pgf@curvilinear@line@b}{\pgf@curvilinear@line@c}{\pgf@curvilinear@line@d}}% \pgf@xb\pgf@x\pgf@yb\pgf@y% \pgftransformarrow{\pgfqpoint{\pgf@xb}{\pgf@yb}}{\pgfqpoint{\pgf@xc}{\pgf@yc}}% -}% +} @@ -267,20 +266,20 @@ \pgf@temp% \pgf@arrow@bending@update@bb% \fi% - \fi% -}% + \fi% +} \def\pgf@arrow@bending@hull@point@first#1#2{% \pgfpointtransformednonlinear{\pgfqpoint{#1}{#2}}% \pgf@xa\pgf@x\pgf@xb\pgf@x% \pgf@ya\pgf@y\pgf@yb\pgf@y% \let\pgf@arrow@hull@point\pgf@arrow@bending@hull@point@other% -}% +} \def\pgf@arrow@bending@hull@point@other#1#2{% \pgfpointtransformednonlinear{\pgfqpoint{#1}{#2}}% \ifdim\pgf@x<\pgf@xa\pgf@xa\pgf@x\else\ifdim\pgf@x>\pgf@xb\pgf@xb\pgf@x\fi\fi% \ifdim\pgf@y<\pgf@ya\pgf@ya\pgf@y\else\ifdim\pgf@y>\pgf@yb\pgf@yb\pgf@y\fi\fi% -}% +} \def\pgf@arrow@bending@update@bb{% \ifdim\pgf@picmaxx=-16000pt\relax% @@ -294,7 +293,7 @@ \ifdim\pgf@xb>\pgf@picmaxx\global\pgf@picmaxx\pgf@xb\fi% \ifdim\pgf@yb>\pgf@picmaxy\global\pgf@picmaxy\pgf@yb\fi% \fi% -}% +} @@ -303,21 +302,21 @@ % % Handle the start of a curve % -% +% -% First, the preparation. +% First, the preparation. \def\pgf@prep@curvedstart{ \pgftransformreset% \pgfsetcurvilinearbeziercurve{\pgfpointfirstonpath}{\pgfpointsecondonpath}{\pgfpointthirdonpath}{\pgfpointfourthonpath}% -}% +} % Second, the shortening. \def\pgf@do@shorten@curvedstart{% \expandafter\expandafter\expandafter\pgf@do@shorten@curvedstart@unpack\expandafter\pgfpointthirdonpath\pgfpointfourthonpath% -}% +} \def\pgf@do@shorten@curvedstart@unpack\pgfqpoint#1#2\pgfqpoint#3#4{% \pgf@process{\pgfcurvilineardistancetotime{\pgf@path@shortening@distance}}% % Compute new curve: @@ -340,14 +339,14 @@ \expandafter\expandafter\expandafter\def% \expandafter\expandafter\expandafter\pgfprocessresultpathsuffix% \expandafter\expandafter\expandafter{\expandafter\pgfprocessresultpathsuffix\pgfsubpathend}% -}% +} % Third, the drawing \def\pgf@do@draw@curvedstart{% \pgf@do@draw@curved\pgf@start@tip@sequence% -}% +} diff --git a/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduledatavisualization.code.tex b/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduledatavisualization.code.tex index 541c7de8d48..a1122b91370 100644 --- a/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduledatavisualization.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduledatavisualization.code.tex @@ -9,34 +9,34 @@ \ProvidesFileRCS{pgfmoduledatavisualization.code.tex} -\usepgfmodule{oo,shapes}% -\usepgflibrary{fpu}% +\usepgfmodule{oo,shapes} +\usepgflibrary{fpu} -% This module defines the basic framework for data visualization. +% This module defines the basic framework for data visualization. % In order to visualize data, you first need data. The format for this % data is not specified, indeed, different formats are possible. A % data point is created each time the command \pgfdatapoint is % used. The "parameters" of the data point are just the current values -% of the keys or macros in the current scope. +% of the keys or macros in the current scope. % % A set of data points created using the \pgfdata command. % When a data point is created, a number of signals are emitted, see % the description of \pgfdatapoint. To actually visualize something, % objects should be created that listen to these signals and that -% handle them. +% handle them. % % The following class manages a data visualization \pgfooclass{data visualization} -{% +{ % Class data visualization % % This class is used to "manage" a data visualization. It provides % methods for hooking into the data visualization process and its % constructor initializes the signals that are issued during a data - % visualization. + % visualization. % % When a data visualization object is created, a whole bunch of % signal objects. You should then create objects that connect to @@ -77,20 +77,20 @@ % 12. "at end visualization" code % 13. "end visualization" phase signal % 14. "after visualization" code - \attribute before survey;% - \attribute at start survey;% - \attribute at end survey;% - \attribute after survey;% - \attribute before visualization;% - \attribute at start visualization;% - \attribute at end visualization;% - \attribute after visualization;% - + \attribute before survey; + \attribute at start survey; + \attribute at end survey; + \attribute after survey; + \attribute before visualization; + \attribute at start visualization; + \attribute at end visualization; + \attribute after visualization; + % % Survey counts and handling % - - \attribute survey count=1;% + + \attribute survey count=1; % Each time a survey is done before the visualization is done, this % count is incremented. Normally, there is only one survey, but % objects may request another survey or even more surveys to be @@ -98,28 +98,28 @@ % accessing this count (via the get survey count method), you can % find out which survey is currently being done. - \attribute number of surveys=1;% + \attribute number of surveys=1; % By increasing this count, you can request additional surveys to be % done. - + % Stores the to-be-visualized data - \attribute data;% - + \attribute data; + % Stores the signal objects - \attribute prepare datapoint signal;% - \attribute map datapoint signal;% - \attribute transform datapoint signal;% - \attribute visualize datapoint signal;% - \attribute finish datapoint signal;% - \attribute survey datapoint signal;% - \attribute phase signal;% - \attribute path signal;% - \attribute direction signal;% - \attribute style signal;% - - + \attribute prepare datapoint signal; + \attribute map datapoint signal; + \attribute transform datapoint signal; + \attribute visualize datapoint signal; + \attribute finish datapoint signal; + \attribute survey datapoint signal; + \attribute phase signal; + \attribute path signal; + \attribute direction signal; + \attribute style signal; + + % Constructor % % Inits the signals @@ -139,71 +139,71 @@ % \pgfoothis.get handle(\pgf@dv@me) \pgfkeyslet{/pgf/data visualization/obj}\pgf@dv@me - }% + } % The phase signal will emit the following constants: - \def\pgfdvbeforesurvey{1}% - \def\pgfdvbeginsurvey{2}% - \def\pgfdvendsurvey{3}% - \def\pgfdvaftersurvey{4}% - \def\pgfdvbeforevisualization{5}% - \def\pgfdvbeginvisualization{6}% - \def\pgfdvendvisualization{7}% - \def\pgfdvaftervisualization{8}% + \def\pgfdvbeforesurvey{1} + \def\pgfdvbeginsurvey{2} + \def\pgfdvendsurvey{3} + \def\pgfdvaftersurvey{4} + \def\pgfdvbeforevisualization{5} + \def\pgfdvbeginvisualization{6} + \def\pgfdvendvisualization{7} + \def\pgfdvaftervisualization{8} % The path signale will meit the following constants: - \def\pgfdvpathmovetotoken{5}% - \def\pgfdvpathlinetotoken{6}% - \def\pgfdvdirectionfromtoken{7}% - \def\pgfdvdirectiontotoken{8}% - \def\pgfdvdirectionattoken{9}% + \def\pgfdvpathmovetotoken{5} + \def\pgfdvpathlinetotoken{6} + \def\pgfdvdirectionfromtoken{7} + \def\pgfdvdirectiontotoken{8} + \def\pgfdvdirectionattoken{9} % Method % % Connect the object #1's slot "#2" to the signal named "#3" \method connect(#1,#2,#3) { \pgfoovalueof{#3}.connect(#1,#2) - }% - + } + % Method % % Add data that is to be visualized. The code #1 should call the % \pgfdatapoint macro for each data point it creates. \method add data(#1) { \pgf@dv@stripped@add#1\pgf@stop - }% + } \def\pgf@dv@stripped@add#1\pgf@stop{% \pgfooappend{data}{#1}% - }% - + } + % Setters \method before survey(#1) { \pgfooappend{before survey}{#1} - }% + } \method at start survey(#1) { \pgfooappend{at start survey}{#1} - }% + } \method before visualization(#1) { \pgfooappend{before visualization}{#1} - }% + } \method at start visualization(#1) { \pgfooappend{at start visualization}{#1} - }% + } % Method \method at end survey(#1) { \pgfooprefix{at end survey}{#1} - }% + } \method after survey(#1) { \pgfooprefix{after survey}{#1} - }% + } \method at end visualization(#1) { \pgfooprefix{at end visualization}{#1} - }% + } \method after visualization(#1) { \pgfooprefix{after visualization}{#1} - }% + } % Method @@ -220,9 +220,9 @@ \pgfooget{path signal}\pgf@signalpath \pgfooget{direction signal}\pgf@signaldirection \pgfooget{style signal}\pgf@signalstyle - }% - + } + % Survey method % % Call this method to "survey" the data. This should be done before @@ -247,21 +247,21 @@ \ifnum\c@pgf@counta<\c@pgf@countb \advance\c@pgf@counta by1\relax \pgfooeset{survey count}{\the\c@pgf@counta} - \pgfutil@repeat - }% + \pgfutil@repeat + } % Getter \method get survey count(#1) { \pgfooget{survey count}{#1} - }% + } % Request another survey to be done \method do an additional survey() { \c@pgf@counta=\pgfoovalueof{number of surveys}\relax \advance\c@pgf@counta by1\relax \pgfooeset{number of surveys}{\the\c@pgf@counta} - }% - + } + % Visualize method % % This method will cause the actual visualization. @@ -278,8 +278,8 @@ \pgf@signalphase.emit(\pgfdvendvisualization)% \pgfoovalueof{after visualization} \pgf@signalphase.emit(\pgfdvaftervisualization)% - }% -}% + } +} % @@ -290,8 +290,7 @@ % be. \pgfkeys{/data point/.unknown/.code={% \pgfkeyssetvalue{/data point/\pgfkeyscurrentname}{#1} - }, -}% + }} @@ -313,13 +312,13 @@ % points are produced and handled in order to find out things like % their number or the minimum and maximum values of attributes, so % that axes and picture sizes can be prepared correctly. In the -% visualization phase, data point are actually shown. +% visualization phase, data point are actually shown. % % During the survey phase, for each data point the signal % "surveydatapoint" is emitted. % % During the visualization phase, more signals are emitted. A prepare -% signal is emitted first, giving all objects a +% signal is emitted first, giving all objects a % chance to "prepare" for the data point. Note that it is permissible % for an object to manipulate the data point here (and also % in later on). @@ -327,11 +326,11 @@ % Next, the command \pgfdvmapdatapointtocanvas is called. Mainly, % the effect of this command is to setup the keys /data point/canvas x % and /data point/canvas y, see the description of this command for -% more details. +% more details. % % The next step consists of signaling "visualize data point". Objects % listening to this will cause some form of visualization of the -% data point to occur. +% data point to occur. % % Before the visualization is started, it is checked whether the key % /data point/name is set (to a non-empty value). If so, @@ -345,7 +344,7 @@ \pgf@signalpreparedatapoint.emit()% \pgf@signalmapdatapoint.emit()% \pgf@signalsurveydatapoint.emit()% -}% +} \def\pgfdatapoint@visualizationphase{% \pgf@signalpreparedatapoint.emit()% @@ -356,7 +355,7 @@ }{}% \pgf@signalvisualizedatapoint.emit()% \pgf@signalfinishdatapoint.emit()% -}% +} @@ -374,7 +373,7 @@ % lets listening objects "map" the object by setting up % attributes of the data point. The second asks objects % listening to this signal to transform the current transformation -% matrix. After the signals, we compute where +% matrix. After the signals, we compute where % the origin lies inside this transformed coordinate system. Then the % two keys /data point/canvas x and /data point/canvas y are set to % the values of this position. The local scope ends (but the settings @@ -392,7 +391,7 @@ \noexpand\pgfkeyssetvalue{/data point/canvas y}{\the\pgf@y} }% \pgf@marshal% -}% +} % Help functions for locating a canvas data point % @@ -403,7 +402,7 @@ \def\pgfpointdvdatapoint{% \pgfqpoint{\pgfkeysvalueof{/data point/canvas x}}{\pgfkeysvalueof{/data point/canvas y}}% -}% +} \def\pgfpointdvlocaldatapoint{% {% @@ -414,7 +413,7 @@ \pgf@signaltransformdatapoint.emit()% \pgfpointtransformed{\pgfpointorigin}% }% -}% +} @@ -463,7 +462,7 @@ #3{}% \fi% }% -}% +} % Handle a moveto @@ -472,7 +471,7 @@ % given by the canvas position of the current local data point. \def\pgfpathdvmoveto{% \pgfdv@generic{\pgf@signalpath}{\pgfdvpathmovetotoken}{\pgfpathmoveto} -}% +} % Handle a lineto @@ -481,7 +480,7 @@ % given by the canvas position of the current local data point. \def\pgfpathdvlineto{% \pgfdv@generic{\pgf@signalpath}{\pgfdvpathlinetotoken}{\pgfpathlineto} -}% +} @@ -492,9 +491,9 @@ % #2 = code for setting the attributes of the second point % % The current point should be a point on a line from #1 to -% #2. Both points as well as the current point are +% #2. Both points as well as the current point are % localized on the canvas and a vector pointing from the first point -% to the second one is returned. However, for instance in polar +% to the second one is returned. However, for instance in polar % coordinates the vector may actually "point along" the angle axis. % % Internally, this command first sets up the first data point and then @@ -520,7 +519,7 @@ } }}} } -}% +} @@ -535,7 +534,7 @@ % Run the rendering pipeline on a dataset and/or save the dataset. -% +% % #1 = options with path /pgf/data/ % #2 = optionally data given inline in curly braces. % @@ -544,7 +543,7 @@ % This command is used to define a data set. For a single data % visualization, multiple data sets can be defined, they will % accumulate. Data can be in different formats, as specified by the -% "format" key, and you can define new formats. +% "format" key, and you can define new formats. % % The settings of the following keys are important: % @@ -556,17 +555,17 @@ % % /pgf/data/read from file % determines where the data is. -% +% % /pgf/data/store in group % when nonempty, the data is stored here instead of being fed to the % rendering pipeline % % /pgf/data/use group -% when nonempty, data that has previously been stored here using +% when nonempty, data that has previsouly been stored here using % |define group| is read from here and all other keys are ignored % % If "read from file" is empty, the data is stored in the argument that -% follows. Otherwise, the data is read from the specified source file. +% follows. Otherwise, the data is read from the specified source file. % This data is stored in an internal variable, which is local to the % current group. % @@ -578,7 +577,7 @@ % handler is started for each data set. This works as follows: first, % the handler's startup code is executed. Then for each line of the % data file/the data given inline, the line handler function is -% called. Finally, the data format end handler is called. +% called. Finally, the data format end handler is called. % % The format handler's job is to call \pgfdatapoint each time a % complete data point has been produced. @@ -598,18 +597,18 @@ % \pgfdata[format=space separated columns] % { % % today -% 2000 2300 2100 2200 +% 2000 2300 2100 2200 % 2000 2350 2200 2500 -% 2200 2300 2250 2260 -% 1800 2260 2260 1900 +% 2200 2300 2250 2260 +% 1800 2260 2260 1900 % 2000 2300 2100 2200 % } % % \pgfdata[format=comma separated columns] % { % % yesterday -% 2000, 2350, 2200, 2250 -% 2200, 2300, 2250, 2260 +% 2000, 2350, 2200, 2250 +% 2200, 2300, 2250, 2260 % } % % \pgfdata[read from file=data.csv,format=comma separated columns] @@ -617,7 +616,7 @@ % \dv.survey() % \dv.visualize() -\def\pgfdata{\pgfutil@ifnextchar[{\pgf@datagroup@data@opt}{\pgf@datagroup@data@opt[]}}%}% +\def\pgfdata{\pgfutil@ifnextchar[{\pgf@datagroup@data@opt}{\pgf@datagroup@data@opt[]}}%} \def\pgf@datagroup@data@opt[#1]{% % Ok, add one data thing... \begingroup% @@ -637,10 +636,10 @@ \csname pgf@dv@group@@\pgf@dv@use@group\endcsname% }% \fi% - \endgroup% + \endgroup% \expandafter\pgf@dv@cont@code% \fi% -}% +} \def\pgf@datagroup@data@opt@cont{% \pgfkeysgetvalue{/pgf/data/format}\pgf@dv@format% \expandafter\let\expandafter\pgf@dv@format@catcodes\csname pgfdv@format@\pgf@dv@format @catcodes\endcsname% @@ -654,8 +653,8 @@ \let\pgf@next\pgf@datagroup@grab@external% \fi% \pgf@next% -}% - +} + \def\pgf@datagroup@grab@inline{% \pgfutil@ifnextchar\bgroup{% \begingroup% @@ -663,13 +662,13 @@ \pgf@dv@format@catcodes% \pgf@datagroup@grab@@inline}% {\pgferror{Opening brace expected}}% -}% +} \def\pgf@datagroup@grab@external{% \fi% \endgroup% \pgf@dv@do@adddata{\pgfkeysvalueof{/pgf/data visualization/obj}.add data({{{\pgf@datagroup@do@external}}})}% \pgf@dv@cont@code% -}% +} \def\pgf@dv@do@adddata#1{% \pgfkeysgetvalue{/pgf/data/store in group}\pgf@dv@temp% @@ -678,9 +677,9 @@ \else% \expandafter\pgfutil@g@addto@macro\csname pgf@dv@group@@\pgf@dv@temp\endcsname{#1}% \fi% -}% +} -{\catcode`\^=7 \catcode`\^^M=13 +{\catcode`\^^M=\active% \gdef\pgf@datagroup@grab@@inline#1{% \endgroup% \pgf@dv@do@adddata{\pgfkeysvalueof{/pgf/data visualization/obj}.add data({{{\pgf@datagroup@do@inline#1^^M\pgf@@eol}}})}% @@ -689,7 +688,7 @@ \pgf@dv@cont@code% }% }% -\def\pgf@@eol{\pgf@eol}% +\def\pgf@@eol{\pgf@eol} \def\pgf@do@data#1#2{% \begingroup% @@ -701,7 +700,7 @@ #2% \csname pgfdv@format@\pgfkeysvalueof{/pgf/data/format}@end\endcsname% \endgroup% -}% +} % @@ -717,7 +716,7 @@ \pgf@datagroup@readline% \fi \immediate\closein\r@pgf@reada% -}% +} \def\pgf@partext{\par}% \def\pgf@datagroup@readline{% @@ -732,7 +731,7 @@ \fi% \fi% \ifeof\r@pgf@reada\else\expandafter\pgf@datagroup@readline\fi% -}% +} % @@ -741,9 +740,9 @@ \def\pgf@datagroup@do@inline{% \pgf@dv@handle@line% -}% +} -{\catcode`\^=7 \catcode`\^^M=13 +{\catcode`\^^M=\active% \gdef\pgf@dv@handle@line{% \pgfutil@ifnextchar^^M{\pgf@dv@format@emptyline\expandafter\pgf@dv@handle@line\pgfutil@gobble}% {\pgfutil@ifnextchar\pgf@@eol{\pgfutil@gobble}{\pgf@dv@handle@nonemptyline}}% @@ -752,7 +751,7 @@ \pgf@dv@format@line#1\pgfeol% \pgf@dv@handle@line% }% -}% +} \pgfkeys{ /pgf/data/data visualization obj/.initial=\undefined, @@ -763,7 +762,7 @@ /pgf/data/store in group/.initial=, /pgf/data/new group/.code={\expandafter\global\expandafter\let\csname pgf@dv@group@@#1\endcsname\pgfutil@empty}, /pgf/data/use group/.initial=, -}% +} @@ -800,7 +799,7 @@ \expandafter\def\csname pgfdv@format@#1@line\endcsname#4\pgfeol{#5}% \expandafter\def\csname pgfdv@format@#1@empty\endcsname{#6}% \expandafter\def\csname pgfdv@format@#1@end\endcsname{#7}% -}% +} @@ -827,7 +826,7 @@ % \pgfdatapoint % } -\pgfdeclaredataformat{TeX code}{}{}{#1}{#1 }{}{}% +\pgfdeclaredataformat{TeX code}{}{}{#1}{#1 }{}{} @@ -845,10 +844,10 @@ % x=7, y=6, lo=10 % } -\pgfdeclaredataformat{named}{}{}{#1}{\pgf@dv@parse@named#1,\pgf@stop}{}{}% +\pgfdeclaredataformat{named}{}{}{#1}{\pgf@dv@parse@named#1,\pgf@stop}{}{} \def\pgf@dv@parse@named{% \pgfutil@ifnextchar\pgf@stop{\pgfdatapoint\pgfutil@gobble}{\pgf@dv@parse@named@} -}% +} \def\pgf@dv@parse@named@#1=#2,#3\pgf@stop{% \foreach \pgf@dv@temp in {#2} {% \def\pgf@dv@tempb{/data point/#1=}% @@ -856,7 +855,7 @@ \expandafter\expandafter\expandafter{\expandafter\pgf@dv@tempb\pgf@dv@temp}% \pgf@dv@parse@named#3\pgf@stop% } -}% +} @@ -869,12 +868,12 @@ % A table consists of a head line, which contains the attribute names % of the values that will be found in the following lines. Each line % (except for the headline) contains one data point. -% +% % Inside each line the data points are separated by a separator like a % comma or a space or a colon. The separator can be configured using % the key /pgf/data/separator (leave the separator empty or set it to % \space for a space as separator). The default separator is a comma. -% +% % Some tables will miss the headline. In this case, using the % /pgf/data/headline key you can provide a headline yourself. % @@ -912,14 +911,14 @@ \let\pgf@dv@separator\space \fi \expandafter\def\expandafter\pgf@dv@till@separator% - \expandafter##\expandafter1\pgf@dv@separator{\pgf@dv@table@handle{##1}} + \expandafter##\expandafter1\pgf@dv@separator{\pgf@dv@table@handle{##1}} \expandafter\def\expandafter\pgf@dv@till@separator@head% - \expandafter##\expandafter1\pgf@dv@separator{\pgf@dv@head@handle{##1}} + \expandafter##\expandafter1\pgf@dv@separator{\pgf@dv@head@handle{##1}} \ifx\pgf@dv@headline\pgfutil@empty % Ok, read headline from file \pgfdv@firstlinetrue \else - % Headline already set + % Headline already set \pgfdv@firstlinefalse \expandafter\pgf@dv@parse@headline\expandafter{\pgf@dv@headline} \fi @@ -934,27 +933,27 @@ \c@pgf@counta=0\relax% keep track of attribute number \def\pgf@marshal{\pgf@dv@parse@table#1} \expandafter\expandafter\expandafter\pgf@marshal% - \expandafter\pgf@dv@separator\expandafter\pgfeol\pgf@dv@separator + \expandafter\pgf@dv@separator\expandafter\pgfeol\pgf@dv@separator \pgfdatapoint } \fi } -{}% ignore empty lines -{}% no special end code +{} % ignore empty lines +{} % no special end code \newif\ifpgfdv@firstline \pgfkeys{ /pgf/data/separator/.initial={,}, /pgf/data/headline/.initial= -}% -\def\pgf@dv@spacetext{\space}% +} +\def\pgf@dv@spacetext{\space} \def\pgf@dv@parse@table{% \pgfutil@ifnextchar"% Special, but ignored right now... {\pgferror{csv with quotes not yet implemented}} {\pgf@dv@till@separator} -}% +} \def\pgf@dv@table@handle#1{% \def\pgf@temp{#1}% \ifx\pgf@temp\pgfeoltext% @@ -970,8 +969,8 @@ \pgfkeyssetvalue{/data point/\pgf@dv@target}{#1} \let\pgf@next=\pgf@dv@parse@table% \fi% - \pgf@next% -}% + \pgf@next% +} @@ -979,14 +978,14 @@ \c@pgf@counta=0\relax% keep track of attribute number \def\pgf@marshal{\pgf@dv@doparse@headline#1} \expandafter\expandafter\expandafter\pgf@marshal% - \expandafter\pgf@dv@separator\expandafter\pgfeol\pgf@dv@separator -}% + \expandafter\pgf@dv@separator\expandafter\pgfeol\pgf@dv@separator +} \def\pgf@dv@doparse@headline{% \pgfutil@ifnextchar"% Special, but ignored right now... {\pgferror{csv with quotes not yet implemented}} {\pgf@dv@till@separator@head} -}% +} \def\pgf@dv@head@handle#1{% \def\pgf@temp{#1}% \ifx\pgf@temp\pgfeoltext% @@ -997,10 +996,10 @@ \pgfkeyssetvalue{/pgf/data/table/attribute \the\c@pgf@counta}{#1} \let\pgf@next=\pgf@dv@doparse@headline% \fi% - \pgf@next% -}% + \pgf@next% +} -\def\pgfeoltext{\pgfeol}% +\def\pgfeoltext{\pgfeol} % @@ -1013,16 +1012,16 @@ % math engine is used. In the future, something fancy build on luatex % might be used, so it would we should not rely directly on the % fpu library code. -% +% % The system works as follows: First, you "enter" a number into the % engine. When you do so, it is converted into some internal % representation that cannot be accessed any more and is called a % "math variable" henceforth. All commands of the % math system only work on math variables. -% +% % In order to "exit" a value stored in a math variable from the % engine, some other macros can be used. -% +% % Operations like addition or multiplication take two math variables % and store the result in another math variable. @@ -1032,95 +1031,95 @@ % % #1 = a math variable (a macro name) that is to store the value % #2 = an expression describing a number -% +% % % Description: -% +% % The #2 should be an expression that evaluates to a number. However, % due to the way the pgf math engine(s) work, currently, there are % several restrictions/the syntax is not as simple as one might % hope. Fortunately, the syntax is hopefully compatible with % easier-to-use future systems. -% +% % The syntax is as follows: #2 may be -% +% % 1. a simple high-precision number. This number is currently directly % passed to \pgfmathfloatparsenumber, so typical permissible values % are "100" or "10000000000000" or "nan" or "-5.673543345345e9000" -% +% % 2. a mathematical expression, which *must* be surrounded by -% parentheses. From a "mathematical" point of view these -% parentheses are superfluous, but the they are used to help pgf +% parantheses. From a "mathematical" point of view these +% parantheses are superfluous, but the they are used to help pgf % distinguish expressions from high-precision numbers. (If, in the % future, expressions may contain high precision numbers, the -% parentheses will simply be ignored.) -% +% parantheses will simply be ignored.) +% % The expression is evaluated using \pgfmathparse, which means that % TeX-precision is used. This means, for instance, that numbers % larger than about 16500 will create error messages. -% +% % The advantage is that you may say write things like "(5+6)" or % "(pi/2)". -% +% % 3. In case #2 starts with an exclamation mark (indicating an % "escape"), everything following the mark is simply evaluated by % TeX. The effect of evaluating #2 should be that the math % variable "\pgfdvmathvalue" is set to some value. This value will % then be transferred to #1. -% +% % 4. In case #2 is the result of calling \pgfdvmathexitbyserializing, the % "serialized" value is restored. The idea is that the serialized % will turn its internal representation of a number into something % that can be stored as a text somewhere. -% +% % Currently, "@" at the beginning of #2 is used to indicate that % what follows is a serialized version of a math variable. -% +% % In order to determine which of the above cases is to be used for a % variable, the first symbol #2 is checked, *after* the first symbol -% of #2 has been expanded once (using \expandafter once). +% of #2 has been expanded once (using \expandafter once). % % Example: % % \pgfdvmathenter{\mymacro}{20000000000000} % \pgfdvmathenter{\mymacro}{(5+pi)} % \pgfdvmathenter{\mymacro}{!\pgfdvmathadd{\pgfdvmathvalue}{\a}{\b}} -% +% % \pgfdvmathenter{\foo}{5} % \pgfdvmathexitbyserializing{\somevalue}{\foo} % \pgfdvmathenter{\mymacro}{\somevalue} \def\pgfdvmathenter#1#2{% \expandafter\pgfdvmathenter@check\expandafter#1#2\pgfdvmath@end% -}% +} \def\pgfdvmathenter@check#1{% \pgfutil@ifnextchar @{\pgfdvmath@internal#1}{% \pgfutil@ifnextchar ({\pgfdvmath@expression#1}{%) \pgfutil@ifnextchar !{\pgfdvmath@execute#1}{\pgfdvmath@normal#1}}}% -}% +} \def\pgfdvmath@internal#1@#2\pgfdvmath@end{% \def#1{#2}% -}% +} \def\pgfdvmath@expression#1(#2)#3\pgfdvmath@end{% \pgfmathparse{#2}% \pgfmathfloatparsenumber{\pgfmathresult}% \let#1=\pgfmathresult% -}% +} \def\pgfdvmath@execute#1!#2\pgfdvmath@end{% #2% \let#1=\pgfdvmathvalue% -}% +} \def\pgfdvmath@normal#1#2\pgfdvmath@end{% \pgfmathfloatparsenumber{#2}% \let#1=\pgfmathresult% -}% +} % Print a math variable in the math engine using \pgfmathprintnumber % -% #1 = math variable +% #1 = math variable % % Description: % @@ -1133,15 +1132,15 @@ \def\pgfdvmathexitbyprinting#1{% \pgfmathprintnumber{#1}% -}% +} % Exit a math variable as a number in a scientific and portable number -% format in a macro +% format in a macro % % #1 = macro in which to store the value -% #2 = math variable +% #2 = math variable % % Description: % @@ -1155,18 +1154,18 @@ \def\pgfdvmathexitbyscientificformat#1#2{% \edef#1{\pgfmathfloatvalueof#2}% -}% +} % Exit a math variable as a "serialized" (= string-based) -% version. +% version. % % #1 = macro in which to store the value -% #2 = math variable +% #2 = math variable % % Description: -% +% % The serialized version can be reentered using % \pgfmathenter and is similar to \pgfdvmathexitbyscientificformat, % but exiting and entering are (a bit) faster. @@ -1178,7 +1177,7 @@ \def\pgfdvmathexitbyserializing#1#2{% \edef#1{@#2}% -}% +} @@ -1204,19 +1203,19 @@ \def\pgfdvmathadd#1#2#3{% \pgfmathfloatadd{#2}{#3}% \let#1=\pgfmathresult% -}% +} \def\pgfdvmathsub#1#2#3{% \pgfmathfloatsubtract{#2}{#3}% \let#1=\pgfmathresult% -}% +} \def\pgfdvmathmul#1#2#3{% \pgfmathfloatmultiply{#2}{#3}% \let#1=\pgfmathresult% -}% +} \def\pgfdvmathdiv#1#2#3{% \pgfmathfloatdivide{#2}{#3}% \let#1=\pgfmathresult% -}% +} % Multiply by small number % @@ -1235,20 +1234,20 @@ % \pgfdvmathadd{\b}{\a}{0.2} % % \b now stores 400 -\def\pgfdvmathmulfixed#1#2#3{% +\def\pgfdvmathmulfixed#1#2#3{% \pgfmathfloatmultiplyfixed{#2}{#3}% \let#1=\pgfmathresult% -}% +} % Log, ln and exponent functions -% +% % #1 = a math variable % #2 = a math variable -% +% % Description -% +% % \pgfdvmathln will compute #1 = ln(#2) % \pgfdvmathlog will compute #1 = log_{10}(#2) % \pgfdvmathexp will compute #1 = exp(#2) @@ -1257,18 +1256,18 @@ \def\pgfdvmathln#1#2{% \pgfmathfloatln{#2}% \let#1=\pgfmathresult% -}% +} \def\pgfdvmathlog#1#2{% \pgfmathfloatln{#2}% \pgfmathfloatmultiply{\pgfmathresult}{\pgfdvmathalwaysloge}% \let#1=\pgfmathresult% -}% +} \def\pgfdvmathexp#1#2{% \pgfmathfloatexp{#2}% \let#1=\pgfmathresult% -}% +} \def\pgfdvmathpowten#1#2{% \pgfmathfloattofixed{#2}% @@ -1292,16 +1291,16 @@ \fi \fi \let#1=\pgfmathresult% -}% +} % Floor functions -% +% % #1 = a math variable % #2 = a math variable -% +% % Description -% +% % Sets #1 to the largest integer less or equal to #2 \def\pgfdvmathfloor#1#2{% @@ -1324,7 +1323,7 @@ \or\let#1=#2% \fi% }% -}% +} % Advanced unary operations @@ -1346,7 +1345,7 @@ \def\pgfdvmathunaryop#1#2#3{% \csname pgfmathfloat#2\endcsname{#3}% \let#1=\pgfmathresult% -}% +} % Advanced binary operations @@ -1370,7 +1369,7 @@ \def\pgfdvmathbinop#1#2#3#4{% \csname pgfmathfloat#2\endcsname{#3}{#4}% \let#1=\pgfmathresult% -}% +} @@ -1391,7 +1390,7 @@ \def\pgfdvmathifless#1#2#3#4{% \pgfmathfloatlessthan{#1}{#2}% \ifpgfmathfloatcomparison#3\else#4\fi% -}% +} @@ -1399,7 +1398,7 @@ % % % Standard objects for data visualization -% +% % @@ -1408,7 +1407,7 @@ % \pgfooclass{linear transformer} -{% +{ % Class linear transformer % % This class is a transformer class. It reacts to the transform @@ -1418,22 +1417,22 @@ % current value of this.origin. If the current value is 1, the % system is shifted to this.origin + this.unit vector. For other % values of /data point/this.attribuate, the shift is interpolated - % between these two values. - + % between these two values. - \attribute attribute;% + + \attribute attribute; % The attribute (/data point/this.attribute) by which % the unit vector is multiplied. If it is empty (which is % different from 0), no transformation is done at all. - \attribute origin = \pgfpointorigin;% + \attribute origin = \pgfpointorigin; % The shift in case the /data point/this.attribute is 0. - \attribute unit vector;% + \attribute unit vector; % The coordinate system is additionally shifted by this amount % times the current value of /data point/this.attribute. - + % Constructor % % #1 = attribute that is being transformed. Example: x @@ -1444,20 +1443,20 @@ \pgf@process{#2} \edef\pgf@temp{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}} \pgfoolet{unit vector}\pgf@temp% - }% + } % Method \method default connects() { \pgfoothis.get handle(\pgf@dv@me) \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,transform,transform datapoint signal) - }% - + } + % Setter \method set origin(#1) { \pgf@process{#1} \edef\pgf@temp{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}} \pgfoolet{origin}\pgf@temp% - }% + } % Slot % @@ -1480,8 +1479,9 @@ \fi% \fi% \fi% - }% -}% + } + +} % @@ -1489,7 +1489,7 @@ % \pgfooclass{interval mapper} -{% +{ % Class interval mapper % % This interval mapper reacts to the map datapoint signal. Its purpose is to @@ -1507,15 +1507,15 @@ % It is permissible to specify an additional non-linear % transformation function f. In this case, for an input value x the % position of f(x) inside the interval [f(a),f(b)] is determined and - % this position is linearly mapped to [c,d]. + % this position is linearly mapped to [c,d]. % % For example, if f(x) = log_10 (x) and the first range [a,b] = % [10,1000] and the second range is [1,2], then 10 is mapped to 1, % 100 is mapped to 1.5 (since f(100) = 3 lies in the middle % between f(10) = 2 and f(1000) = 4) and 100000 is mapped to 3. + - - \attribute in;% + \attribute in; % The name of the input attribute. If the value of this attribute % is empty or undefined, no mapping is done. % @@ -1523,30 +1523,30 @@ % has a value different from \relax, it will always be used instead % of the in attribute itself. This can be useful to temporarily % set a constant value to a key inside a mapping chain. - % + % % If the subkey /is min or max is set to "min" or "max", the mapping % will always be done to the respective out min or out max values. - \attribute out;% + \attribute out; % The name of the output attribute. - - \attribute trans;% + + \attribute trans; % Stores (more or less) the transformation function. - \attribute out min;% + \attribute out min; % Start of the second range (the value of c). - \attribute out min;% + \attribute out min; % End of the second range (the value of d). - \attribute trans in min;% + \attribute trans in min; % Transformed value of the start of the first range (the value % f(a)). - \attribute scale;% + \attribute scale; % The scaling factor, that is, the value of (f(b)-f(a))/(d-c). - + % Constructor % % #1 = input attribute. Example: velocity. @@ -1568,13 +1568,13 @@ #3% }% \fi% - }% + } % Method \method default connects() { \pgfoothis.get handle(\pgf@dv@me) \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,map,map datapoint signal) - }% + } % Method % @@ -1584,7 +1584,7 @@ % #4 = out interval maximum % % This method will (re)compute the correct mappings for the interval - % mapper. + % mapper. \method set interval values(#1,#2,#3,#4) { {% \pgfdvmathenter{\pgf@in@interval@min}{#1} @@ -1604,18 +1604,18 @@ \pgfoovalueof{trans} \let\pgf@in@interval@max@transformed=\pgfvalue \pgfdvmathsub{\pgf@diff@in@transformed}{\pgf@in@interval@max@transformed}{\pgf@in@interval@min@transformed} - % + % % Precompute the scaling - % + % \pgfdvmathdiv{\pgf@scale}{\pgf@out@diff}{\pgf@diff@in@transformed}% \pgfoolet{scale}{\pgf@scale}% }{% \pgfoolet{scale}\pgf@dv@no@scale% }% }% - }% - \def\pgf@dv@no@scale{noscale}% - + } + \def\pgf@dv@no@scale{noscale} + % Slot \method map() { \pgfooget{scale}\pgf@dv@scale @@ -1650,18 +1650,18 @@ \fi% \fi% \fi% - }% + } \def\pgf@dv@set@out@min{% \pgfkeyslet{/data point/\pgfoovalueof{out}/is min or max}\pgf@min@text% \pgfooget{out min}{\pgf@minmax@temp}% \pgf@dv@set@out@now% - }% + } \def\pgf@dv@set@out@max{% \pgfkeyslet{/data point/\pgfoovalueof{out}/is min or max}\pgf@max@text% \pgfooget{out max}{\pgf@minmax@temp}% \pgf@dv@set@out@now% - }% + } \def\pgf@dv@set@out@now{% \pgfkeysgetvalue{/data point/\pgfoovalueof{out}/offset}\pgf@dv@external@offset% \ifx\pgf@dv@external@offset\relax\else% @@ -1673,8 +1673,8 @@ \fi \fi \pgfkeyslet{/data point/\pgfoovalueof{out}}\pgf@minmax@temp% - }% - + } + \def\pgf@dv@mapper@trans{ \pgfooget{trans in min}{\pgf@dv@trans@in@min}% \pgfooget{scale}{\pgf@dv@scale}% @@ -1692,7 +1692,7 @@ \fi \pgfdvmathexitbyserializing{\pgf@temp}{\pgfvalue}% \pgfkeyslet{/data point/\pgfoovalueof{out}}\pgf@temp% - }% + } \def\pgf@dv@mapper@pos@check{% \pgfkeysgetvalue{/data point/\pgfoovalueof{in}/out pos}\pgf@dv@pos@value% @@ -1708,8 +1708,8 @@ \pgfdvmathexitbyserializing{\pgf@temp}{\pgf@out@val}% \pgfkeyslet{/data point/\pgfoovalueof{out}}\pgf@temp% \fi\fi% - }% - + } + \def\pgf@dv@mapper@goto@mid{% % Ok, compute transformed min position: \pgfooget{out min}{\pgf@out@interval@min} @@ -1719,8 +1719,8 @@ \pgfdvmathadd{\pgf@out@val}{\pgf@out@interval@min}{\pgf@out@interval@max}% \pgfdvmathexitbyserializing{\pgf@temp}{\pgf@out@val}% \pgfkeyslet{/data point/\pgfoovalueof{out}}\pgf@temp% - }% -}% + } +} @@ -1730,7 +1730,7 @@ \newif\ifpgf@dvignore \pgfooclass{scaling mapper} -{% +{ % Class scaling mapper % % A scaling mapper is (mainly) used to scale an attribute in such a way @@ -1747,16 +1747,16 @@ % and a interval mapper for then mapping the values to the scaled % values. Additionally, interval objects are needed. - \attribute in;% + \attribute in; % The to-be-scaled attribute; - \attribute out;% + \attribute out; % The attribute storing the scaled value. - \attribute in range obj;% + \attribute in range obj; % This interval keep track of the range of the in attribute - - \attribute scaling spec;% + + \attribute scaling spec; % A specification of how the scaling should be performed. % % The format is the following: @@ -1777,24 +1777,24 @@ % that deforms the linear mapping. In case f is specified, % f(#1) is mapped to #2 and f(#3) is mapped to #4. - \attribute spec maps min;% + \attribute spec maps min; % When the scaling spec maps "min" to some value, rather than some % specific value to that value, then spec maps min will be set to % \pgfutil@firstoftwo, otherwise to \pgfutil@secondoftwo - \attribute spec maps max;% + \attribute spec maps max; % Like spec maps min - \attribute function;% + \attribute function; % Stores the function - - \attribute interval mapper;% + + \attribute interval mapper; % Stores the interval mapper object - - \attribute range surveyor;% + + \attribute range surveyor; % Stores the range surveyor object - - + + % Constructor % % #1 = in attribute @@ -1825,54 +1825,54 @@ % % % The interval mapper: - % + % \pgfoonew{interval mapper}=new interval mapper(#1,#2,#4) \pgfoovalueof{interval mapper}.default connects() - }% + } % Method \method default connects() { \pgfoothis.get handle(\pgf@dv@me) \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,phase,phase signal) - }% + } % Getter % % Returns an interval object that stores the range of the in - % attribute. + % attribute. \method get in range interval() { \pgfooget{in range obj}\pgfdvinrangeinterval - }% - - + } + + % Getter % % Returns the out attribute. - % + % \method get out() { \pgfooget{out}\pgfdvout - }% + } % Getter % % Returns the function attribute. - % + % \method get function(#1) { \pgfooget{function}#1 - }% + } % Method % % #1 = a included in value - % + % % This method only affects the survey. The value #1 is recorded as % if it were encountered for the in attribute at some point. - % + % \method include in value(#1) { \pgfoovalueof{range surveyor}.include attribute value({#1}) - }% - + } + % Method % % #1 = value for the attribute @@ -1880,7 +1880,7 @@ % Sets the attribute to the (evaluated) given value (evaluation % using \pgfmathparse). When the value is evaluated, the values of % \pgfdvmin and \pgfdvmax will be set to the minimum and maximum - % values of the in interval. (See \pgfdvmathenter with the "!"-notation). + % values of the in interval. (See \pgfdvmathenter with the "!"-notation). % % In case #1 is set to the special value "min", it evaluates to % \pgfdvmin, when set to "max" it evaluates to \pgfdvmax. @@ -1902,14 +1902,14 @@ \fi% \pgfdvmathexitbyserializing{\pgf@dv@serial}{\pgf@dv@value}% \pgfkeyslet{/data point/\pgfoovalueof{in}}\pgf@dv@serial% - }% + } \def\pgf@dv@lib@set@mm{ \pgfooget{in range obj}\pgfdvinrangeinterval \pgfdvinrangeinterval.get min and max()% - }% - + } - % Slot + + % Slot \method phase(#1) { \ifx#1\pgfdvendsurvey % Ok, we setup the interval mapper. @@ -1925,9 +1925,9 @@ \pgf@lib@dv@min@at,\pgf@lib@dv@max@at) \fi \fi - }% - + } + % Internal helper \def\pgf@lib@dv@parse@scaling#1 at#2and #3 at#4\pgf@stop{% \def\pgf@lib@dv@min{#1}% @@ -1952,10 +1952,10 @@ \pgfdvmathexitbyserializing{\pgf@lib@dv@min@at}{\pgf@lib@dv@min@at@mv} \pgfdvmathexitbyserializing{\pgf@lib@dv@max}{\pgf@lib@dv@max@mv} \pgfdvmathexitbyserializing{\pgf@lib@dv@max@at}{\pgf@lib@dv@max@at@mv} - }% - \def\pgf@min@text{min}% - \def\pgf@max@text{max}% -}% + } + \def\pgf@min@text{min} + \def\pgf@max@text{max} +} @@ -1966,13 +1966,13 @@ % \pgfooclass{range surveyor} -{% +{ % Class range surveyor % % A range surveyor is used only in the survey phase. Its job is to % determine the minimum and maximum values of an attribute that are % "seen" during the survey phase. Based on this value, the size of, - % say, an axis can be determined later on. + % say, an axis can be detemined later on. % % You can also set the key "sub attributes" of the attribute. In % this case, this key should contain -- as the name suggests -- a @@ -1984,12 +1984,12 @@ % "/data point/velocity", then "/data point/velocity/sub attributes" % should be set to "\pgfdvsub{/min}\pgfdvsub{/max}". - \attribute attribute;% + \attribute attribute; % The to-be-surveyed attribute - \attribute interval obj;% + \attribute interval obj; % The interval object that protocols the minimum and maximum - % values. + % values. % Constructor @@ -2000,27 +2000,27 @@ \method range surveyor(#1,#2) { \pgfooset{attribute}{#1} \pgfoolet{interval obj}#2 - }% + } % Method \method default connects() { \pgfoothis.get handle(\pgf@dv@me) \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,survey,survey datapoint signal) - }% + } % Method % % #1 = a value - % + % % Adjust the interval as if during the survey this value were - % encountered + % encountered \method include attribute value(#1) { \pgf@dv@assign@val@stripped#1\pgf@stop% \pgfoovalueof{interval obj}.adjust(\pgf@dv@range@surv) - }% + } \def\pgf@dv@assign@val@stripped#1\pgf@stop{% \def\pgf@dv@val{#1} - }% + } % Slot % @@ -2032,7 +2032,7 @@ \let\pgfdvsub\pgf@dv@range@surv@sub \pgfdvsub{}% \pgfkeysvalueof{/data point/\pgfoovalueof{attribute}/sub attributes} - }% + } \def\pgf@dv@range@surv@sub#1{ \pgfkeysgetvalue{/data point/\pgfoovalueof{attribute}#1}\pgf@dv@val% @@ -2044,7 +2044,7 @@ \pgfoovalueof{interval obj}.adjust(\pgf@dv@range@surv)% \fi% \fi% - }% + } \def\pgf@dv@range@surv{% \pgfdvmathenter{\pgf@dv@value}{\pgf@dv@val}% @@ -2059,8 +2059,8 @@ \else% \pgfdvmathifless{\pgfdvmax}{\pgf@dv@value}{\let\pgfdvmax\pgf@dv@value}{}% \fi% - }% -}% + } +} @@ -2068,19 +2068,19 @@ % Visualizers % -\usepgflibrary{plothandlers}% +\usepgflibrary{plothandlers} \pgfooclass{plot handler visualizer} -{% +{ % Class plot handler visualizer % % This visualizer uses one or more plot handlers to visualize data points. - % As the data points are processed, the canvas positions of the data + % As the data points are processed, the canvas positions of the data % points are recorded. At the end of a group of data points, the % recorded stream of canvas position is visualized (rendered) - % using plot handlers. For instance, when the lineto plot handler + % using plot handlers. For instance, when the lineto plot handler % is used, the data points are connected by straight lines, when the % curveto plot handler is used, they are connected by smooth curves % and so on. @@ -2092,7 +2092,7 @@ % You can specify a "filter", which will cause only those data % points to be visualized by the visualizer that pass the test. The % filter should set \pgfdvfilterpassedfalse for to-be-filtered data - % point. + % point. % % You can specify "projection code" that changes the canvas x and % canvas y positions. This projection code allows you to draw, say, @@ -2103,35 +2103,35 @@ % the visualizer, should store code that is to be executed directly % before and after the stream of coordinates is created. Typically, % these keys will store commands to use the path created by the plot - % handler. + % handler. - \attribute handlers;% + \attribute handlers; % The to-be-used handlers - - \attribute name;% + + \attribute name; % The attribute - - \attribute filter=\pgfdvnamedvisualizerfilter;% + + \attribute filter=\pgfdvnamedvisualizerfilter; % Filter code - - \attribute positions;% + + \attribute positions; % An internal protocol of the positions on the stream - - \attribute cache;% + + \attribute cache; % An internal cache. Positions are first inserted into this % cache. Every 100 steps this cache is moved to positions. The idea % behind this is that it will avoid the quadratic time increase that % is normally caused when a protocol is build in TeX. - - \attribute projection code;% + + \attribute projection code; % This code is empty by default. However, you can set it for % instance to the following - % + % % \pgfkeyssetvalue{/data point/y=0}\pgfdvmapdatapointtocanvas - % + % % in order to visualize the data point with its y-coordinate % replaced by 0. - + % Constructor % % #1 = A name @@ -2141,24 +2141,24 @@ \method plot handler visualizer(#1,#2) { \pgfooset{name}{#1} \pgfooset{handlers}{#2} - }% - + } + % Method \method default connects() { \pgfoothis.get handle(\pgf@dv@me) \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,protocol,visualize datapoint signal) \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,phase,phase signal) - }% + } % Setter \method set filter(#1) { \pgfooset{filter}{#1} - }% + } % Setter \method set projection code(#1) { \pgfooset{projection code}{#1} - }% + } % Slot \method protocol() { @@ -2167,7 +2167,7 @@ \ifpgfdvfilterpassed% \pgf@dv@line@cache@it \fi% - }% + } \def\pgf@dv@line@cache@it{ % Cache it @@ -2199,14 +2199,14 @@ \let\pgf@dv@cache\pgfutil@empty \fi \pgfoolet{cache}\pgf@dv@cache - }% - + } + % Slot \method phase(#1) {% \ifx#1\pgfdvendvisualization% \pgfoothis.render()% \fi% - }% + } % Internal method \method render() { @@ -2227,19 +2227,19 @@ \endpgfscope \pgfoolet{positions}\pgfutil@empty \pgfoolet{cache}\pgfutil@empty - }% + } - \def\pgf@dv@ph#1#2{\ifpgfdvnewstream\pgfplotstreamstart\pgfdvnewstreamfalse\fi\pgfplotstreampoint{\pgfqpoint{#1}{#2}}}% - \def\pgf@dv@outliner{\ifpgfdvnewstream\else\pgfplotstreamend\pgfdvnewstreamtrue\fi}% -}% + \def\pgf@dv@ph#1#2{\ifpgfdvnewstream\pgfplotstreamstart\pgfdvnewstreamfalse\fi\pgfplotstreampoint{\pgfqpoint{#1}{#2}}} + \def\pgf@dv@outliner{\ifpgfdvnewstream\else\pgfplotstreamend\pgfdvnewstreamtrue\fi} +} \newif\ifpgfdvnewstream \newcount\pgf@lib@dv@cache@count \pgfkeys{% /data point/outlier/.initial=, - /data point/outlier/.default=true, -}% + /data point/outlier/.default=true +} % A possible filter for unnamed visualizers @@ -2250,10 +2250,10 @@ % % In a data visualization with multiple visualizers, data points % typically "belong" only to a single visualizer. It is, thus, -% necessary to filter data points according to the current +% necessary to filter data points accoring to the current % visualizer. This current visualizer is assumed to be stored in /data % point/visualizer. -% +% % When objects allow you to set a filter, you can use this filter to % test against /data point/set being equal to #1. @@ -2264,14 +2264,14 @@ \else \pgfdvfilterpassedfalse \fi% -}% +} % A filter for named visualizer -% +% % Description: -% +% % This filter works like \pgfdvvisualizerfilter, only it assumes the % the object defines a "name" attribute. In this case, the value of % /data point/set is tested against this attribute. @@ -2283,12 +2283,12 @@ \else \pgfdvfilterpassedfalse \fi% -}% +} \pgfooclass{rectangle visualizer} -{% +{ % Class rectangle visualizer % % This visualizer visualizes a datapoint as a rectangle. It needs @@ -2296,33 +2296,33 @@ % point/<name>/attribute 2 store two attributes names a1 to a2. Then, % provided the current value of /data point/set equals name, for % each data point a rectangle between (a1/min,a2/min) and - % (a1/max,a2/max) is created. - + % (a1/max,a2/max) is created. + - \attribute name;% + \attribute name; % The name - - \attribute a1;% - \attribute a2;% + + \attribute a1; + \attribute a2; % The attributes, filled from /data point/<name>/attribute 1 and 2 - + % Constructor % - % #1 = first attribute - % #2 = second attribute + % #1 = first attribute + % #2 = second attribute % \method rectangle visualizer(#1) { \pgfooset{name}{#1} - }% + } % Method \method default connects() { \pgfoothis.get handle(\pgf@dv@me) \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,visualize,visualize datapoint signal) \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,phase,phase signal) - }% - + } + % Slot \method phase(#1) {% \ifx#1\pgfdvbeginsurvey% @@ -2331,8 +2331,8 @@ \pgfkeyssetvalue{\pgfoovalueof{a1}/sub attributes}{\pgfdvsub{/min}\pgfdvsub{/max}} \pgfkeyssetvalue{\pgfoovalueof{a2}/sub attributes}{\pgfdvsub{/min}\pgfdvsub{/max}} \fi% - }% - + } + % Slot \method visualize() { { @@ -2342,7 +2342,7 @@ \pgf@dv@rect@do \fi } - }% + } \def\pgf@dv@rect@do{ \pgfkeysgetvalue{\pgfoovalueof{a1}/min}\pgf@dv@amin @@ -2371,8 +2371,8 @@ \fi\fi \fi\fi \fi\fi - }% -}% + } +} \newcount\pgf@lib@dv@cache@count @@ -2383,12 +2383,12 @@ % \pgfooclass{label visualizer} -{% +{ % Class label visualizer % % The job of this class is to visualize a label of a curve or some % other object. - % + % % The idea is as follows: This class monitors a certain % attribute. When this attribute reaches a certain value for the % first time, the following happens: A normalized vector of the line @@ -2397,29 +2397,29 @@ % coordinate system is shifted so that the current data point is at % the origin. Then, some drawing code is executed. - \attribute attribute;% + \attribute attribute; % The monitored attribute - \attribute filter;% + \attribute filter; % Filter code, see plot handler visualizer doc. - - \attribute threshold;% + + \attribute threshold; % When the attribute exceeds this threshold, the drawing code is % executed - \attribute before canvas position=;% + \attribute before canvas position=; % Stores canvas position of the data point before the interesting one - - \attribute canvas position=;% + + \attribute canvas position=; % Stores canvas position of the data point - \attribute code;% + \attribute code; % To-be-executed code when the label should be drawn - - + + % Constructor % - % #1 = attribute + % #1 = attribute % #2 = a macro, storing the threshold % #3 = code % #4 = filter code @@ -2430,14 +2430,14 @@ \pgfoolet{threshold}\pgf@temp \pgfooset{code}{#3} \pgfooset{filter}{#4} - }% + } % Method \method default connects() { \pgfoothis.get handle(\pgf@dv@me) \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,test,visualize datapoint signal) \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,phase,phase signal) - }% + } % Slot \method test() { @@ -2451,7 +2451,7 @@ \pgf@dv@label@vis@record \fi% \fi% - }% + } \def\pgf@dv@label@vis@record{ % Record current position @@ -2479,8 +2479,8 @@ }% \fi\fi% \fi% - }% - + } + % Slot \method phase(#1) {% \ifx#1\pgfdvendvisualization% @@ -2490,8 +2490,9 @@ \pgfoovalueof{code} \endscope \fi% - }% -}% + } + +} @@ -2499,12 +2500,12 @@ % Style sheets % \pgfooclass{style attribute} -{% +{ % Class style attribute - % + % % Instances of this class are used to select a style based on the % current value of an attribute. - % + % % Instances of this class monitor an attribute. Whenever the "style" % signal is raised, the object investigates the current value of the % attribute. It then looks up /pgf/data visualization/style @@ -2513,27 +2514,27 @@ % /pgf/data visualization/style sheets/<name of style sheet>/default % style is executed with the value as a parameter. - \attribute attribute;% + \attribute attribute; % The name of the attribute - \attribute style sheet name;% + \attribute style sheet name; % The styling function % Constructor % % #1 = attribute (including, if present, /data point/) - % #2 = style sheet name + % #2 = style sheet name % \method style attribute(#1,#2) { \pgfooset{attribute}{#1} \pgfooset{style sheet name}{#2} - }% + } % Method \method default connects() { \pgfoothis.get handle(\pgf@dv@me) \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,invoke style,style signal) - }% + } % Slots \method invoke style() { @@ -2549,22 +2550,22 @@ \pgfkeysalso{\pgf@temp/default style/.expand once=\pgf@dv@temp@val} } \fi\fi% - }% -}% + } +} % Declares a new style sheet -% -% #1 = name of style sheet +% +% #1 = name of style sheet % #2 = settings -% +% % Description: -% +% % This is a shortcut for doing a /.cd to /pgf/data visualization/style sheets/#1 \def\pgfdvdeclarestylesheet#1#2{ \pgfkeys{/pgf/data visualization/style sheets/#1/.cd,#2} -}% +} @@ -2579,22 +2580,22 @@ % \pgfooclass{legend} -{% +{ % Class legend - % + % % This class is used to collect entries into a legend. The idea is % that, say, for each line of a picture you would like to have an % entry in a legend. Then you prepare these entries and send % them to a legend container object. It will collect the entries - % and, at the end, arrange them in rows and columns by + % and, at the end, arrange them in rows and columns by % separating them using \pgfdvnextcell and \pgfdvendrow. % % By surrounding the resulting arrangement by a call to \pgfmatrix or % a call to \halign you can then create a legend. - % + % % To specify how the entries should be arranged, a size % specification and two directions are needed. - % + % % For the size specification you specify either the ideal number of % columns and the maximum number of rows or you specify the ideal % number of rows and the maximum number of columns. In the first @@ -2609,10 +2610,10 @@ % columns that the ideal number -- to ensure that no column contains % more than the desired number. The case is symmetric, but with the % roles of columns and rows exchanged. - % + % % Here is an example: You specify that you want 2 columns, ideally, % each having a maximum of 4 entries. Here is what you would get: - % + % % Number of entries & Number of resulting columns ... & ... and rows % 1 & 1 & 1 % 2 & 2 & 1 @@ -2628,7 +2629,7 @@ % 12 & 3 & 4 % 13 & 4 & 4 % - % + % % Once the number of columns and rows has been computed, the next % step is to "fill" the table. For this, eight strategies may be % specified: right then down, right then up, left then down, left @@ -2638,14 +2639,14 @@ % arrangement. However, once the maximum number of elements in a row % has been reached, the a new row should be started that is placed % above ("up") then just-assembled row. - % - % - % + % + % + % % % Example: - % + % % You create an object \legend and then call - % + % % \pgfoofnew \legend=new legend(columns,2,3,down then right) % \legend.add entry(first) % \legend.add entry(second) @@ -2654,37 +2655,37 @@ % \legend.add entry(fifth) % \legend.add entry(sixth) % \legend.add entry(seventh) - % \legend.get arrangement(\arrangement) - % + % \legend.get arrangment(\arrangement) + % % Then \arrangment will expand to - % + % % first \pgfdvnextcell fourth \pgfdvnextcell seventh \pgfdvendrow % second \pgfdvnextcell fifth \pgfdvnextcell third \pgfdvendrow % third \pgfdvendrow sixth \pgfdvnextcell \pgfdvendrow - % + % % By saying \let\pgfdvendrow=\\ and \let\pgfdvnextcell=&, you % can use \arrangment inside a table. + + + \attribute entries; + % Collectes the entries - - \attribute entries;% - % Collects the entries - - \attribute columns or rows;% + \attribute columns or rows; % Specifies whether columns or rows are specified - \attribute ideal;% + \attribute ideal; % The ideal number of columns/rows - \attribute max;% + \attribute max; % The maximum number of entries per column/row - \attribute strategy;% + \attribute strategy; % Specifies how the matrix should be filled - - \attribute number of entries=0;% + + \attribute number of entries=0; % Counts the number of entries that have been stored - - + + % Constructor % % #1 = "columns" or "rows" -> specifies whether the ideal number and @@ -2698,11 +2699,11 @@ \pgfooset{ideal}{#2} \pgfooset{max}{#3} \pgfooset{strategy}{#4} - }% + } % Method \method default connects() { - }% + } % Method \method add entry(#1) { @@ -2710,19 +2711,19 @@ \c@pgf@counta=\pgfoovalueof{number of entries}\relax% \advance\c@pgf@counta by1\relax% \pgfooeset{number of entries}{\the\c@pgf@counta} - }% + } % Method \method get arrangement(#1) { { - % + % % Step 1: Compute the desired number of rows or columns - % - % + % + % % Compute the ideal number of entries per row/column (called % "target" in the following) and entries per colum/row (called % "per target" in the following) - % + % % if (number of entries > ideal) \ifnum\pgfoovalueof{number of entries}>\pgfoovalueof{ideal}\relax% % { @@ -2761,9 +2762,9 @@ \c@pgf@counta=\pgfoovalueof{number of entries}\relax% \c@pgf@countb=1\relax% \fi% - % - % Ensure that counta = rows, countb = columns - % + % + % Ensure that counta = rows, countb = columns + % \pgfooget{columns or rows}\pgf@temp \ifx\pgf@temp\pgf@dv@columnstext% \c@pgf@countc=\c@pgf@counta\relax @@ -2771,14 +2772,14 @@ \c@pgf@countb=\c@pgf@countc\relax \fi %\edef\temp{rows: \the\c@pgf@counta, columns: \the\c@pgf@countb}\temp - % - % Now arrange the matrix - % + % + % Now arrange the matrix + % \csname pgf@dv@legend@init@\pgfoovalueof{strategy}\endcsname \expandafter\let\expandafter\pgf@dv@updater\csname pgf@dv@legend@update@\pgfoovalueof{strategy}\endcsname \pgfooget{entries}\pgf@temp \expandafter\pgf@dv@legend@arrange\pgf@temp\pgf@stop - % + % % Now assemble the matrix % \edef\pgf@dv@row@list{1,...,\the\c@pgf@counta} @@ -2806,24 +2807,24 @@ } \let#1\pgf@dv@matrix \global\let\pgf@dv@matrix\relax - }% - - \def\pgf@dv@first@mark{\pgf@dv@first@mark}% - + } + + \def\pgf@dv@first@mark{\pgf@dv@first@mark} + \def\pgf@dv@legend@arrange{% \pgfutil@ifnextchar\pgf@stop{\pgfutil@gobble}{\pgf@dv@legend@handle@entry} - }% + } \def\pgf@dv@legend@handle@entry#1{ \expandafter\def\csname pgf@dv@legend@entry@\the\c@pgf@countc @\the\c@pgf@countd\endcsname{#1}% \pgf@dv@updater% \pgf@dv@legend@arrange% - }% + } \expandafter\def\csname pgf@dv@legend@init@down then right\endcsname{% \c@pgf@countc=1\relax% \c@pgf@countd=1\relax% - }% + } \expandafter\def\csname pgf@dv@legend@update@down then right\endcsname{% \advance\c@pgf@countc by1\relax @@ -2831,25 +2832,25 @@ \c@pgf@countc=1\relax% \advance\c@pgf@countd by1\relax% \fi% - }% + } \expandafter\def\csname pgf@dv@legend@init@right then down\endcsname{% \c@pgf@countc=1\relax% \c@pgf@countd=1\relax% - }% - + } + \expandafter\def\csname pgf@dv@legend@update@right then down\endcsname{% \advance\c@pgf@countd by1\relax \ifnum\c@pgf@countd>\c@pgf@countb\relax% \c@pgf@countd=1\relax% \advance\c@pgf@countc by1\relax% \fi% - }% + } \expandafter\def\csname pgf@dv@legend@init@up then right\endcsname{% \c@pgf@countc=\c@pgf@counta\relax% \c@pgf@countd=1\relax% - }% + } \expandafter\def\csname pgf@dv@legend@update@up then right\endcsname{% \advance\c@pgf@countc by-1\relax @@ -2857,12 +2858,12 @@ \c@pgf@countc=\c@pgf@counta\relax% \advance\c@pgf@countd by1\relax% \fi% - }% - + } + \expandafter\def\csname pgf@dv@legend@init@right then up\endcsname{% \c@pgf@countc=\c@pgf@counta\relax% \c@pgf@countd=1\relax% - }% + } \expandafter\def\csname pgf@dv@legend@update@right then up\endcsname{% \advance\c@pgf@countd by1\relax @@ -2870,12 +2871,12 @@ \c@pgf@countd=1\relax% \advance\c@pgf@countc by-1\relax% \fi% - }% - + } + \expandafter\def\csname pgf@dv@legend@init@left then up\endcsname{% \c@pgf@countc=\c@pgf@counta\relax% \c@pgf@countd=\c@pgf@countb\relax% - }% + } \expandafter\def\csname pgf@dv@legend@update@left then up\endcsname{% \advance\c@pgf@countd by-1\relax @@ -2883,12 +2884,12 @@ \c@pgf@countd=\c@pgf@countb\relax% \advance\c@pgf@countc by-1\relax% \fi% - }% - + } + \expandafter\def\csname pgf@dv@legend@init@up then left\endcsname{% \c@pgf@countc=\c@pgf@counta\relax% \c@pgf@countd=\c@pgf@countb\relax% - }% + } \expandafter\def\csname pgf@dv@legend@update@up then left\endcsname{% \advance\c@pgf@countc by-1\relax @@ -2896,12 +2897,12 @@ \c@pgf@countc=\c@pgf@counta\relax% \advance\c@pgf@countd by-1\relax% \fi% - }% - + } + \expandafter\def\csname pgf@dv@legend@init@left then down\endcsname{% \c@pgf@countc=1\relax% \c@pgf@countd=\c@pgf@countb\relax% - }% + } \expandafter\def\csname pgf@dv@legend@update@left then down\endcsname{% \advance\c@pgf@countd by-1\relax @@ -2909,12 +2910,12 @@ \c@pgf@countd=\c@pgf@countb\relax% \advance\c@pgf@countc by1\relax% \fi% - }% - + } + \expandafter\def\csname pgf@dv@legend@init@down then left\endcsname{% \c@pgf@countc=1\relax% \c@pgf@countd=\c@pgf@countb\relax% - }% + } \expandafter\def\csname pgf@dv@legend@update@down then left\endcsname{% \advance\c@pgf@countc by1\relax @@ -2922,10 +2923,10 @@ \c@pgf@countc=1\relax% \advance\c@pgf@countd by-1\relax% \fi% - }% - - \def\pgf@dv@columnstext{columns}% -}% + } + + \def\pgf@dv@columnstext{columns} +} @@ -2934,17 +2935,17 @@ % \pgfooclass{interval} -{% +{ % Class interval % % Instances of this class store intervals. When either the min or % the max value is empty, this corresponds to "not yet set", (not to - % "infinity). + % "infinity). - \attribute min;% + \attribute min; % The minimum value of the interval - - \attribute max;% + + \attribute max; % The maximum value of the interval % Constructor @@ -2955,25 +2956,25 @@ \method interval(#1,#2) { \pgfooset{min}{#1} \pgfooset{max}{#2} - }% + } % Method \method default connects() { - }% + } % Sets the minimum/maximum to a new value \method set min(#1) { \pgfooset{min}{#1} - }% + } \method set max(#1) { \pgfooset{max}{#1} - }% + } \method let min(#1) { \pgfoolet{min}{#1} - }% + } \method let max(#1) { \pgfoolet{max}{#1} - }% + } % Getter % @@ -2982,9 +2983,9 @@ \method get min and max() { \pgfooget{min}\pgfdvmin \pgfooget{max}\pgfdvmax - }% + } - % Adjusts the minimum and maximum values + % Adjusts the mimum and maximum values % % #1 = some code. When this code is executed, the values of % \pgfdvmin and \pgfdvmax will be set to the current values of @@ -3001,13 +3002,13 @@ \pgfoolet{min}\pgfdvmin \pgfoolet{max}\pgfdvmax }% - }% -}% + } +} \pgfooclass{count} -{% +{ % Class count % % This class can be used to count the number of data points that are @@ -3017,70 +3018,70 @@ % the counter. You can specify that certain data points should % not have an effect on the counter. - - \attribute attribute;% + + \attribute attribute; % The attribute that will be set to the current value of the counter - - \attribute val=0;% + + \attribute val=0; % The current value of the counter - - \attribute max=0;% + + \attribute max=0; % The current value of the counter - - \attribute step=1;% + + \attribute step=1; % The stepping by which the counter is incremented for each % datapoint - - \attribute start val=0;% + + \attribute start val=0; % The start value of the counter - \attribute filter=;% + \attribute filter=; % This attribute stores some code that is executed for each % data point. If the data point sets the TeX-if ifpgfdvfilterpassed to % true, then the counter is not incremented. - + % Constructor % % #1 = The attribute in which the counter value is stored % \method count(#1) { \pgfooset{attribute}{#1} - }% + } % Method \method default connects() { \pgfoothis.get handle(\pgf@dv@me) \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,apply,prepare datapoint signal) \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,phase,phase signal) - }% + } % Getter \method get max(#1) { \pgfooget{max}{#1} - }% + } % Setter \method set value(#1) { \pgfooset{val}{#1} \pgfkeyssetvalue{/data point/\pgfoovalueof{attribute}}{#1}% - }% + } % Setter \method set start value(#1) { \pgfooset{start val}{#1} \pgfooset{max}{#1} - }% + } % Setter \method set filter(#1) { \pgfooset{filter}{#1} - }% + } % Setter \method set step(#1) { \pgfooset{step}{#1} - }% + } % Slot \method apply() { @@ -3096,17 +3097,17 @@ \pgfooget{max}\pgfmathresult% \pgfkeyslet{/data point/\pgfoovalueof{attribute}/max}\pgfmathresult% \fi% - }% + } - % Slot + % Slot \method phase(#1) { \ifx#1\pgfdvbeginsurvey \pgfooeset{val}{\pgfoovalueof{start val}} \else \ifx#1\pgfdvbeginvisualization \pgfooeset{val}{\pgfoovalueof{start val}} \fi\fi - }% -}% + } +} \newif\ifpgfdvfilterpassed @@ -3114,7 +3115,7 @@ \pgfooclass{accumulator} -{% +{ % Class accumulator % % This class is used to keep track of the sum of the values of some @@ -3123,12 +3124,12 @@ % all previous data points with respect to this % attribute. Furthermore, the subkey attribute/prev key will hold % the previous sum, which is sometimes also useful to have access - % to. + % to. - \attribute attribute;% + \attribute attribute; % The attribute to-be-accumulated - - \attribute sum;% + + \attribute sum; % The initial value of the sum % Constructor @@ -3137,19 +3138,19 @@ \method accumulator(#1) { \pgfooset{attribute}{#1} \pgfoothis.reset() - }% + } % Method \method default connects() { \pgfoothis.get handle(\pgf@dv@me) \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,apply,prepare datapoint signal) \pgfkeysvalueof{/pgf/data visualization/obj}.connect(\pgf@dv@me,phase,phase signal) - }% + } % Slot \method apply() {% % Save old sum - \pgfkeysgetvalue{/data point/\pgfoovalueof{attribute}/sum}\pgf@temp% + \pgfkeysgetvalue{/data point/\pgfoovalueof{attribute}/sum}\pgf@temp% \pgfkeyslet{/data point/\pgfoovalueof{attribute}/prev sum}\pgf@temp% % Add new attribute... \pgfkeysgetvalue{/data point/\pgfoovalueof{attribute}}{\pgf@temp@b}% @@ -3161,7 +3162,7 @@ % Record in attribute \pgfdvmathexitbyscientificformat{\pgf@dv@serial@sum}{\pgf@dv@sum} \pgfkeyslet{/data point/\pgfoovalueof{attribute}/sum}\pgf@dv@serial@sum - }% + } % Method % @@ -3173,7 +3174,7 @@ \pgfdvmathexitbyserializing{\pgf@dv@zero}{\pgf@dv@temp} \pgfkeyslet{/data point/\pgfoovalueof{attribute}/prev sum}{\pgf@dv@zero} \pgfkeyslet{/data point/\pgfoovalueof{attribute}/sum}{\pgf@dv@zero} - }% + } % Slot \method phase(#1) { @@ -3182,8 +3183,8 @@ \else \ifx#1\pgfdvbeginvisualization \pgfoothis.reset() \fi\fi - }% -}% + } +} @@ -3203,13 +3204,19 @@ /data point/always 0/.initial=0, /data point/always 1/.initial=1, /data point/always empty/.initial=, - /data point/always pgfusepath stroke/.initial=\pgfusepath{stroke}, -}% + /data point/always pgfusepath stroke/.initial=\pgfusepath{stroke} +} -\pgfdvmathenter{\pgfdvmathalwaysloge}{0.434294481903252}% -\pgfdvmathenter{\pgfdvmathalwayslnten}{2.302585092994046}% -\pgfdvmathenter{\pgfdvmathalwayszero}{0}% -\pgfdvmathenter{\pgfdvmathalwaysone}{1}% +\pgfdvmathenter{\pgfdvmathalwaysloge}{0.434294481903252} +\pgfdvmathenter{\pgfdvmathalwayslnten}{2.302585092994046} +\pgfdvmathenter{\pgfdvmathalwayszero}{0} +\pgfdvmathenter{\pgfdvmathalwaysone}{1} \endinput + + + + + + diff --git a/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduledecorations.code.tex b/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduledecorations.code.tex index 8c939d5cb41..500e0c7bad1 100644 --- a/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduledecorations.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduledecorations.code.tex @@ -19,8 +19,8 @@ % These should be moved. % -\def\pgfgetpath#1{\pgfsyssoftpath@getcurrentpath{#1}}% -\def\pgfsetpath#1{\pgfsyssoftpath@setcurrentpath{#1}}% +\def\pgfgetpath#1{\pgfsyssoftpath@getcurrentpath{#1}} +\def\pgfsetpath#1{\pgfsyssoftpath@setcurrentpath{#1}} % Required registers. @@ -40,10 +40,10 @@ \newdimen\pgfdecorationsegmentlength \pgfdecorationsegmentamplitude2.5pt \pgfdecorationsegmentlength10pt -\def\pgfdecorationsegmentangle{45}% -\def\pgfdecorationsegmentaspect{0.5}% -\def\pgfmetadecorationsegmentamplitude{2.5pt}% -\def\pgfmetadecorationsegmentlength{1cm}% +\def\pgfdecorationsegmentangle{45} +\def\pgfdecorationsegmentaspect{0.5} +\def\pgfmetadecorationsegmentamplitude{2.5pt} +\def\pgfmetadecorationsegmentlength{1cm} \pgfkeys{% /pgf/decoration/.code={\pgfkeys{/pgf/decoration/.cd,#1}}, @@ -58,8 +58,8 @@ end radius/.initial=2.5pt, radius/.style={start radius=#1,end radius=#1}, path has corners/.is if=pgfdecoratepathhascorners, - reverse path/.is if=pgf@decorate@inputsegmentobjects@reverse, -}% + reverse path/.is if=pgf@decorate@inputsegmentobjects@reverse +} \newif\ifpgfdecoratepathhascorners \newif\ifpgf@decorate@inputsegmentobjects@reverse @@ -105,14 +105,14 @@ #3% \let\state\pgf@orig@state% }% -}% +} -\def\pgf@decorate@state#1{\pgfutil@ifnextchar[{\pgf@decorate@@start#1}{\pgf@decorate@@start#1[]}}%}% +\def\pgf@decorate@state#1{\pgfutil@ifnextchar[{\pgf@decorate@@start#1}{\pgf@decorate@@start#1[]}}%} \def\pgf@decorate@@start#1[#2]#3{% \pgfutil@namedef{pgf@decorate@@\pgf@decorate@name @#1@options}{#2}% \pgfutil@namedef{pgf@decorate@@\pgf@decorate@name @#1@code}{#3}% -}% -\long\def\pgf@mod@dec@firstofone#1{#1}% +} +\long\def\pgf@mod@dec@firstofone#1{#1} % Test whether something is a decoration @@ -125,7 +125,7 @@ % % \pgfifdecoration{zigzag}{Exists}{Does not exist} -\def\pgfifdecoration#1#2#3{\pgfutil@ifundefined{pgf@decorate@@#1@initial}{#3}{#2}}% +\def\pgfifdecoration#1#2#3{\pgfutil@ifundefined{pgf@decorate@@#1@initial}{#3}{#2}} @@ -153,13 +153,13 @@ #3% \let\state\pgf@orig@state% }% -}% +} -\def\pgf@metadecoration@state#1{\pgfutil@ifnextchar[{\pgf@metadecoration@@state#1}{\pgf@metadecoration@@state#1[]}}%}% +\def\pgf@metadecoration@state#1{\pgfutil@ifnextchar[{\pgf@metadecoration@@state#1}{\pgf@metadecoration@@state#1[]}}%} \def\pgf@metadecoration@@state#1[#2]#3{% \pgfutil@namedef{pgf@metadecoration@@\pgf@metadecoration@name @#1@options}{#2}% \pgfutil@namedef{pgf@metadecoration@@\pgf@metadecoration@name @#1@code}{#3}% -}% +} % Test whether something is a meta-decoration @@ -172,7 +172,7 @@ % % \pgfifmetadecoration{zigzag}{Exists}{Does not exist} -\def\pgfifmetadecoration#1#2#3{\pgfutil@ifundefined{pgf@metadecoration@@#1@initial}{#3}{#2}}% +\def\pgfifmetadecoration#1#2#3{\pgfutil@ifundefined{pgf@metadecoration@@#1@initial}{#3}{#2}} @@ -185,9 +185,9 @@ % % Decorate a path. % -% \pgfdecoratebeforecode and \pgfdecorateaftercode can be used to +% \pgfdecoratebeforecode and \pgfdecorateaftercode can be used to % execute code before and after the decoration. -% +% % #1 - the name of the decoration. % #2 - a (non-empty) path specification. % @@ -211,8 +211,8 @@ % \pgfusepath{stroke,fill} % } % \state{final}{} -% } -% +% } +% % \pgfpicture % \pgfdecoratepath{circles} % { @@ -224,7 +224,7 @@ \long\def\pgfdecoratepath#1#2{% \pgfdecoration{{#1}{\pgfdecoratedpathlength}{\pgfdecoratebeforecode}{\pgfdecorateaftercode}}% #2% - \endpgfdecoration}% + \endpgfdecoration} @@ -232,8 +232,8 @@ % \pgfdecoratecurrentpath % % Decorate the current/existing path, but (unavoidably) destroys it. -% -% \pgfdecoratebeforecode and \pgfdecorateaftercode can be used to +% +% \pgfdecoratebeforecode and \pgfdecorateaftercode can be used to % execute code before and after the decoration. % % #1 - the name of the decoration. @@ -270,7 +270,7 @@ \pgfsetpath\pgfutil@empty% \pgfdecoration{{#1}{\pgfdecoratedpathlength}{\pgfdecoratebeforecode}{\pgfdecorateaftercode}}% \pgfsetpath\pgf@decorate@currentpath% - \endpgfdecoration}% + \endpgfdecoration} @@ -281,8 +281,8 @@ % % Definitions: % -% `existing path' -% - any unused path existing prior to the environment. +% `existing path' +% - any unsed path exsiting prior to the environment. % % `decorated path' % - the path that is being decorated. @@ -295,34 +295,34 @@ % 1. Any existing path is saved. % 2. Construction commands are executed forming the decorated path. % 3. If the first command in the decorated path is not a `move to', -% the last known position from the existing path is inserted. -% 4. The saved existing path is reinstalled. +% the last known position from the exisiting path is inserted. +% 4. The saved existing path is reinstalled. % 5. The decoration automaton is executed along the decorated path. -% +% % Parameters: % % #1 - a comma separated list of decoration specifications. -% +% % A decoration specification takes the format: % % {<name>}{<distance>}{<before code>}{<after code>} % % The decoration <name> is applied to a section of the decorated -% path from the last point on the decorated path the decoration +% path from the last point on the decorated path the decoration % automaton reached to <distance> from that point. -% -% When <distance>} is parsed, the dimension +% +% When <distance>} is parsed, the dimension % \pgfdecoratedreminingdistance holds the distance remaining on the % entire decorated path, and the macro \pgfdecoratedpathlength holds -% the total length of the entire decorated path. -% After <distance> is parsed, both are set to to the value of -% <distance> for the automaton to decorate current section of the +% the total length of the entire decorated path. +% After <distance> is parsed, both are set to to the value of +% <distance> for the automaton to decorate current section of the % decorated path. % % <before code> is executed just before the decoration automaton % starts and <after code> is executed just after the automaton stops. % If <before code> or <after code> are empty, they can be omitted. -% The macros \pgfdecoratedpathfirst and \pgfdecoratedpathlast +% The macros \pgfdecoratedpathfirst and \pgfdecoratedpathlast % will be set up as the first and last points on the current section % of the decorated path. % @@ -337,7 +337,7 @@ % \pgfdecorationpath % - any unused decoration path. % -% \pgfpointdecoratedpathlast +% \pgfpointdecoratedpathlast % - the last point on the decorated path. % % Examples (require pgfdecorations library): @@ -353,9 +353,9 @@ % \pgfpathcurveto{\pgfpoint{0cm}{4cm}}{\pgfpoint{5cm}{0cm}}{\pgfpoint{5cm}{4cm}} % \endpgfdecoration % \pgfusepath{stroke} -% \endpgfpicture -% -% +% \endpgfpicture +% +% % \pgfpicture % \pgfdecoration % { @@ -396,11 +396,11 @@ % \pgfpathmoveto{\pgfpointorigin} % \pgfpathcurveto{\pgfpoint{0cm}{4cm}}{\pgfpoint{5cm}{0cm}}{\pgfpoint{5cm}{4cm}} % \endpgfdecoration -% -% \endpgfpicture -% -% -% +% +% \endpgfpicture +% +% +% % \pgfdeclaredecoration{polygons}{move}{ % \state{move}[width=7.5pt, next state=polygon]{} % \state{polygon}[width=7.5pt, next state=move] @@ -415,23 +415,23 @@ % \pgfpathmoveto{\pgfpointdecoratedpathlast} % } % } -% +% % \pgfpicture % \pgfdecoration % { % {polygons}{45pt}, % {lineto}{30pt} % {\pgfpathmoveto{\pgfpointdecoratedpathfirst}} -% { +% { % \pgfsetstrokecolor{yellow!50!orange} -% \pgfusepath{stroke} +% \pgfusepath{stroke} % }, % {polygons}{45pt}, % {lineto}{30pt} % {\pgfpathmoveto{\pgfpointdecoratedpathfirst}} -% { +% { % \pgfsetstrokecolor{green!50!blue} -% \pgfusepath{stroke} +% \pgfusepath{stroke} % }, % {polygons}{\pgfdecoratedremainingdistance} % } @@ -439,15 +439,15 @@ % \pgfpathcurveto{\pgfpoint{0cm}{4cm}}{\pgfpoint{5cm}{0cm}}{\pgfpoint{5cm}{4cm}} % \endpgfdecoration % \endpgfpicture -% -% +% +% % \pgfpicture % \pgfpathmoveto{\pgfpointorigin} % \pgfpathcurveto{\pgfpoint{0cm}{4cm}}{\pgfpoint{5cm}{0cm}}{\pgfpoint{5cm}{4cm}} % \pgfgetpath\temppath % \pgfsetstrokecolor{red} % \pgfusepath{stroke} -% +% % \pgfset{decoration text={Here is some text all the way along this curve!}} % \pgfdecoration{{text}{\pgfdecoratedremainingdistance}} % \pgfsetpath\temppath @@ -457,16 +457,16 @@ \def\pgfdecoration#1{% \begingroup% \def\pgf@decorate@decorationlist{#1}% - \pgf@decoration@env% -}% + \pgf@decoration@env% +} \def\endpgfdecoration{% \pgf@decoration@endenv% \ifx\pgfdecoratedpath\pgfutil@empty% \else% - % + % % Perform the decoration(s). - % + % \pgf@decorate@for\pgf@temp:=\pgf@decorate@decorationlist\do{% \ifx\pgf@temp\pgfutil@empty% \else% @@ -475,24 +475,24 @@ }% \fi% \pgfgetpath\pgfdecorationpath% - % + % % Take stuff outside the group. - % + % \global\let\pgf@decorate@decorationpathtemp\pgfdecorationpath% \global\let\pgf@decorate@decoratedpathtemp\pgfdecoratedpath% \global\let\pgf@decorate@existingpathtemp\pgfdecorateexistingpath% \global\let\pgfpoint@decorated@pathlasttemp\pgfpoint@decorated@pathlast% \endgroup% - % + % % Are we in LaTeX? - % + % \pgfutil@ifnextchar\@checkend{\aftergroup\pgf@decorate@installmacrosatend}% {\pgf@decorate@installmacrosatend}% -}% +} -% Environment \pgfmetadecoration \endpgfmetadecoration +% Enviroment \pgfmetadecoration \endpgfmetadecoration % % Decorate a path with decoration automatons! % @@ -502,21 +502,21 @@ % \state{line to}[width=1cm, next state=zigzag] % { % \decoration{lineto} -% \beforedecoration{\pgfpathmoveto{\pgfpointdecoratedpathfirst}} +% \beforedecoration{\pgfpathmoveto{\pgfpointdecoratedpathfirst}} % \afterdecoration % { % \pgfsetstrokecolor{black} -% \pgfusepath{stroke} +% \pgfusepath{stroke} % } % } % \state{zigzag}[width=2cm, next state=line to] % { -% \decoration{zigzag} +% \decoration{zigzag} % \beforedecoration{\pgfpathmoveto{\pgfpointdecoratedpathfirst}} % \afterdecoration % { % \pgfsetstrokecolor{red} -% \pgfusepath{stroke} +% \pgfusepath{stroke} % } % } % \state{final} @@ -526,11 +526,11 @@ % \afterdecoration % { % \pgfsetstrokecolor{black} -% \pgfusepath{stroke} +% \pgfusepath{stroke} % } % } % } -% +% % \pgfpicture % \pgfmetadecoration{fancy line} % \pgfpathmoveto{\pgfpointorigin} @@ -541,13 +541,13 @@ % \endpgfpicture % \def\pgfmetadecoration#1{% - \begingroup% + \begingroup% \let\decoration\pgf@metadecoration@decoration% \let\beforedecoration\pgf@metadecoration@beforedecoration% \let\afterdecoration\pgf@metadecoration@afterdecoration% \def\pgf@metadecoration@name{#1}% \pgf@decoration@env% -}% +} \def\endpgfmetadecoration{% \pgf@decoration@endenv% @@ -575,7 +575,7 @@ \pgf@decorate@invoke{% {\pgf@decorate@tempname}{\pgfdecoratedremainingdistance}% {\pgf@decorate@tempbefore}{\pgf@decorate@tempafter}% - }% + }% \fi% \pgfgetpath\pgfdecorationpath% % @@ -588,17 +588,17 @@ \endgroup% % % Are we in LaTeX? - % + % \pgfutil@ifnextchar\@checkend{\aftergroup\pgf@decorate@installmacrosatend}% {\pgf@decorate@installmacrosatend}% -}% +} -% Internal macro for the decoration environment. +% Internal macro for the decoration enironment. % \def\pgf@decoration@env{% \pgfgetpath\pgfdecorateexistingpath% @@ -606,15 +606,15 @@ \let\pgfdecorationpath\pgfutil@empty% \let\pgfdecoratedpath\pgfutil@empty% \let\pgfpoint@decorated@pathlast\pgfpointorigin% - \edef\pgfpoint@decorate@existingpathlast{\pgf@x\the\pgf@path@lastx\pgf@y\the\pgf@path@lasty}% - % + \edef\pgfpoint@decorate@existingpathlast{\pgf@x\the\pgf@path@lastx\pgf@y\the\pgf@path@lasty}% + % % Begin a group so transformations don't mess things up. - % - \bgroup% -}% + % + \bgroup% +} \def\pgf@decorate@path@check@moveto#1{% - \expandafter\pgf@decorate@path@@check@moveto#1\pgf@decorate@stop\pgf@decorate@@stop}% + \expandafter\pgf@decorate@path@@check@moveto#1\pgf@decorate@stop\pgf@decorate@@stop} \def\pgf@decorate@token@stop{\pgf@decorate@stop}% \def\pgf@decorate@path@@check@moveto#1#2#3#4\pgf@decorate@@stop#5#6{% @@ -626,17 +626,17 @@ \else% #6% \fi% -}% +} \def\pgf@decoration@endenv{% - \egroup% + \egroup% \pgftransformreset% - % + % % Save the existing soft path and restore the existing path. - % + % \pgfgetpath\pgfdecoratedpath% \pgfsetpath\pgfdecorateexistingpath% - % + % \ifx\pgfdecoratedpath\pgfutil@empty% \pgferror{I cannot decorate an empty path}% \else% @@ -644,7 +644,7 @@ % If the path consists of a single moveto token, make it % a very small horizontal line. % - \pgf@decorate@path@check@moveto\pgfdecoratedpath{% + \pgf@decorate@path@check@moveto\pgfdecoratedpath{% \advance\pgf@x by0.0001pt\relax% \edef\pgfdecoratedpath{% \expandafter\noexpand\pgfdecoratedpath% @@ -652,13 +652,13 @@ }% }% {}% - % + % % Remove special round tokens and get points. - % + % \pgfprocessround{\pgfdecoratedpath}{\pgfdecoratedpath}% - % + % % Parse the soft path into a series of decorated input segment objects. - % + % \pgf@decorate@parsesoftpath{\pgfdecoratedpath}{\pgf@decorate@inputsegmentobjects}% % % Setup further options @@ -670,24 +670,24 @@ \ifpgf@decorate@inputsegmentobjects@reverse% \pgf@decorate@inputsegmentobjects@reverse{\pgf@decorate@inputsegmentobjects}{\pgf@decorate@inputsegmentobjects}% \fi% - % + % \let\pgf@decorated@remainingdistance\pgf@decorate@totalpathlength% - % + % \let\pgfpoint@decorated@totalpathfirst\pgfpoint@decorated@firstparsed% \let\pgfpoint@decorated@totalpathlast\pgfpoint@decorate@lastnonmovetoparsed% - % + % \let\pgfpoint@decorated@pathfirst\pgfpoint@decorated@totalpathfirst \let\pgfpoint@decorated@pathlast\pgfpoint@decorated@totalpathlast% - % + % % Set up the first input segment. - % + % \let\pgf@decorate@currentinputsegmentobjects\pgf@decorate@inputsegmentobjects% \let\pgf@decorate@transformtoinputsegment\pgfutil@empty% \pgf@decorate@getnextinputsegmentobject\pgf@decorate@nextinputsegmentobject% \pgf@decorate@processnextinputsegmentobject% \pgf@decorate@distancetomove0pt\relax% \fi% -}% +}% @@ -697,7 +697,7 @@ \let\pgfdecoratedpath\pgf@decorate@decoratedpathtemp% \let\pgfdecorateexistingpath\pgf@decorate@existingpathtemp% \let\pgfpoint@decorated@pathlast\pgfpoint@decorated@pathlasttemp% -}% +} \let\pgfdecorationpath\pgfutil@empty \let\pgfdecoratedpath\pgfutil@empty @@ -712,8 +712,8 @@ \def\pgf@decorate@for#1:=#2\do#3{% \def\pgf@decorate@for@var{#1}% \def\pgf@decorate@for@action{#3}% - \expandafter\pgf@decorate@@for#2,\pgf@stop,}% - + \expandafter\pgf@decorate@@for#2,\pgf@stop,} + \def\pgf@decorate@@for#1,{% \ifx#1\pgf@stop% \expandafter\let\pgf@decorate@for@var\pgfutil@empty% @@ -722,7 +722,7 @@ \pgf@decorate@for@action% \expandafter\pgf@decorate@@for% \fi% -}% +} % Invoke a decoration. @@ -730,8 +730,8 @@ % #1 - {<name>}{<distance>}{<before code>}{<after code>} % \def\pgf@decorate@invoke#1{% - \pgf@decorate@@invoke#1\pgf@decorate@invoke\pgf@decorate@invoke\pgf@decorate@invoke\pgf@stop}% - + \pgf@decorate@@invoke#1\pgf@decorate@invoke\pgf@decorate@invoke\pgf@decorate@invoke\pgf@stop} + \def\pgf@decorate@@invoke#1#2#3#4#5\pgf@stop{% \pgfutil@ifundefined{pgf@decorate@@#1@initial}% {% @@ -802,7 +802,7 @@ \global\pgf@y\pgf@y% }% \edef\pgfpoint@decorated@pathlast{\pgf@x\the\pgf@x\pgf@y\the\pgf@y}% - \fi% + \fi% {% \pgftransformreset% \pgf@decorate@transformtoinputsegment% @@ -813,7 +813,7 @@ % % Execute user-defined code after decoration. % - \pgf@decorate@aftercode% + \pgf@decorate@aftercode% % % Update the input segment objects. % @@ -821,7 +821,7 @@ \let\pgf@decorate@inputsegmentobjects\pgf@decorate@inputsegmentobjects@aftersplit% \let\pgfpoint@decorated@pathfirst\pgfpoint@decorated@pathlast% }% -}% +} @@ -855,7 +855,7 @@ % \pgfpointdecoratedinputsegmentfirst % -% The first point of the current sub-path. +% The first point of the current sub-path. % \def\pgfpointdecoratedinputsegmentfirst{% {% @@ -865,11 +865,11 @@ \global\pgf@x\pgf@x% \global\pgf@y\pgf@y% }% -}% +}% % \pgfpointdecoratedinputsegmentlast % -% The final point of the current sub-path. +% The final point of the current sub-path. % \def\pgfpointdecoratedinputsegmentlast{% {% @@ -882,7 +882,7 @@ }% -\def\pgf@final@text{final}% +\def\pgf@final@text{final} % Run a normal decoration. % @@ -891,8 +891,8 @@ \ifx\pgf@decorate@current@state\pgf@final@text% \let\pgf@decorate@next\relax% \fi% - \pgf@decorate@next% -}% + \pgf@decorate@next% +} \def\pgf@decorate@do@state{% \let\pgf@decorate@next\relax% @@ -908,9 +908,9 @@ \let\pgf@decorate@next\pgf@decorate@do@code% \fi% \pgf@decorate@next% -}% +} -\def\pgf@decorate@setter{\pgfqkeys{/pgf/decoration automaton}}% +\def\pgf@decorate@setter{\pgfqkeys{/pgf/decoration automaton}} \pgf@decorate@repeatstate-1\relax @@ -937,7 +937,7 @@ \let\pgf@decorate@current@state\pgf@decorate@next@state% \fi% \pgf@decorate@run% -}% +} \pgfkeys{ /pgf/decoration automaton/width/.code=\def\pgf@decorate@width{#1}\pgf@decorate@switch@if#1 to final\pgf@stop,% @@ -958,7 +958,7 @@ }, /pgf/decoration automaton/auto end on length/.code=\pgf@decorate@auto@end{#1}, /pgf/decoration automaton/auto corner on length/.code=\pgf@decorate@auto@corner{#1}, -}% +} \def\pgf@decorate@auto@end#1{% \ifx\pgf@decorate@next\relax% @@ -995,7 +995,7 @@ \fi% \fi% \fi% -}% +} \def\pgf@decorate@auto@corner#1{% \ifpgfdecoratepathhascorners% @@ -1015,7 +1015,7 @@ \fi% \fi% \fi% -}% +} \def\pgf@decorate@switch@if#1to #2\pgf@stop{% \ifx\pgf@decorate@next\relax% @@ -1032,7 +1032,7 @@ \fi% \fi% \fi% -}% +} \def\pgf@decorate@switch@ifinputsegment#1to #2\pgf@stop{% \ifx\pgf@decorate@next\relax% @@ -1043,7 +1043,7 @@ \let\pgf@decorate@next\pgf@decorate@run% \fi% \fi% -}% +} @@ -1056,7 +1056,7 @@ % % \pgfsetdecorationsegmenttransformation{\pgftransformyshift{5pt}} % -\def\pgfsetdecorationsegmenttransformation#1{\def\pgf@decorate@additionaltransform{#1}}% +\def\pgfsetdecorationsegmenttransformation#1{\def\pgf@decorate@additionaltransform{#1}} \let\pgf@decorate@additionaltransform\pgfutil@empty% @@ -1064,16 +1064,16 @@ \def\pgf@metadecoration@decoration#1{% \edef\pgf@decorate@tempname{#1}% -}% +} \def\pgf@metadecoration@beforedecoration#1{% \def\pgf@decorate@tempbefore{#1}% -}% +} \def\pgf@metadecoration@afterdecoration#1{% \def\pgf@decorate@tempafter{#1}% -}% +} -\def\pgf@final@text{final}% +\def\pgf@final@text{final} % Run a meta decoration. % @@ -1082,8 +1082,8 @@ \ifx\pgf@metadecoration@current@state\pgf@final@text% \let\pgf@metadecoration@next\relax% \fi% - \pgf@metadecoration@next% -}% + \pgf@metadecoration@next% +} \def\pgf@metadecoration@do@state{% \let\pgf@metadecoration@next\relax% @@ -1104,7 +1104,7 @@ \let\pgf@metadecoration@next\pgf@metadecoration@do@code% \fi% \pgf@metadecoration@next% -}% +} \def\pgf@metadecoration@do@code{% % @@ -1128,16 +1128,16 @@ % \let\pgf@metadecoration@current@state\pgf@metadecoration@next@state% \pgf@metadecoration@run% -}% +} -\def\pgf@metadecoration@setter{\pgfqkeys{/pgf/meta-decoration automaton}}% +\def\pgf@metadecoration@setter{\pgfqkeys{/pgf/meta-decoration automaton}} \pgfkeys{ /pgf/meta-decoration automaton/width/.code=\def\pgf@metadecoration@width{#1}\pgf@metadecoration@switch@if#1 to final\pgf@stop,% /pgf/meta-decoration automaton/switch if less than/.code=\pgf@metadecoration@switch@if#1\pgf@stop,% /pgf/meta-decoration automaton/switch if input segment less than/.code=\pgf@metadecoration@switch@ifinputsegment#1\pgf@stop,% /pgf/meta-decoration automaton/next state/.store in=\pgf@metadecoration@next@state,% -}% +} \def\pgf@metadecoration@switch@if#1to #2\pgf@stop{% \ifx\pgf@metadecoration@next\relax% @@ -1147,7 +1147,7 @@ \let\pgf@metadecoration@next\pgf@metadecoration@run% \fi% \fi% -}% +} \def\pgf@metadecoration@switch@ifinputsegment#1to #2\pgf@stop{% \ifx\pgf@metadecoration@next\relax% @@ -1157,7 +1157,7 @@ \let\pgf@metadecoration@next\pgf@metadecoration@run% \fi% \fi% -}% +} @@ -1168,7 +1168,7 @@ \advance\pgfdecoratedcompleteddistance\pgf@decorate@distancetomove% \advance\pgfdecoratedremainingdistance-\pgf@decorate@distancetomove% \pgf@decorate@@movealongpath% -}% +} \def\pgf@decorate@@movealongpath{% \advance\pgfdecoratedinputsegmentcompleteddistance\pgf@decorate@distancetomove% \advance\pgfdecoratedinputsegmentremainingdistance-\pgf@decorate@distancetomove% @@ -1185,7 +1185,7 @@ \fi% \fi% \pgf@next% -}% +} \def\pgf@decorate@@@movealongpath{% % @@ -1206,9 +1206,9 @@ \pgfdecoratedremainingdistance0pt\relax% \fi% \fi% -}% +} -% Return the next input segment object in a macro +% Return the next input segment object in a macro % \def\pgf@decorate@getnextinputsegmentobject#1{% \ifx\pgf@decorate@currentinputsegmentobjects\pgfutil@empty% @@ -1218,12 +1218,12 @@ \let\pgf@next\pgf@decorate@@getnextinputsegmentobject% \fi% \pgf@next% -}% +} \def\pgf@decorate@@getnextinputsegmentobject{% - \expandafter\pgf@decorate@@@getnextinputsegmentobject\pgf@decorate@currentinputsegmentobjects\pgf@stop}% + \expandafter\pgf@decorate@@@getnextinputsegmentobject\pgf@decorate@currentinputsegmentobjects\pgf@stop} \def\pgf@decorate@@@getnextinputsegmentobject#1#2\pgf@stop{% \expandafter\def\pgf@decorate@temp{#1}% - \def\pgf@decorate@currentinputsegmentobjects{#2}}% + \def\pgf@decorate@currentinputsegmentobjects{#2}} % Process the next input segment object. % @@ -1232,7 +1232,7 @@ \let\pgf@decorate@currentinputsegmentobject\pgf@decorate@nextinputsegmentobject% \pgf@decorate@getnextinputsegmentobject\pgf@decorate@nextinputsegmentobject% % - % If the current input segment object is a moveto, execute the + % If the current input segment object is a moveto, execute the % object macro and get the next input segment object. % \pgf@decorate@is@closepath@false% @@ -1289,7 +1289,7 @@ \pgfmath@smuggleone\pgfdecoratedangletonextinputsegment% \endgroup% \let\pgfdecorationnextinputsegmentobject\pgf@decorate@temp% -}% +} % @@ -1302,15 +1302,15 @@ % % These allow comparison with \ifx using % -% \pgfdecorationcurrentinputsegment +% \pgfdecorationcurrentinputsegment % \pgfdecorationnextinputsegment % \pgfdecorationcurrentprevioussegment % -\def\pgfdecorationinputsegmentmoveto{moveto}% -\def\pgfdecorationinputsegmentlineto{lineto}% -\def\pgfdecorationinputsegmentcurveto{curveto}% -\def\pgfdecorationinputsegmentclosepath{closepath}% -\def\pgfdecorationinputsegmentlast{last}% +\def\pgfdecorationinputsegmentmoveto{moveto} +\def\pgfdecorationinputsegmentlineto{lineto} +\def\pgfdecorationinputsegmentcurveto{curveto} +\def\pgfdecorationinputsegmentclosepath{closepath} +\def\pgfdecorationinputsegmentlast{last} % Input segment object moveto. % @@ -1322,7 +1322,7 @@ \edef\pgf@decorate@lastmoveto{#1}% \def\pgfdecoratedinputsegmentlength{0pt}% \let\pgfdecorationcurrentinputsegment\pgfdecorationinputsegmentmoveto% -}% +} % Input segment object lineto. % @@ -1331,8 +1331,8 @@ \def\pgf@decorate@inputsegment@first{#2}% \def\pgf@decorate@inputsegment@last{#3}% % - % Supports should be defined like this, so if treated as a curve, - % equal time steps will correspond to equal distances. + % Supports should be defined like this, so if treated as a curve, + % equal time steps will correspond to equal distances. % \pgfpointdiff{#2}{#3}% \pgf@xa\pgf@x% @@ -1346,11 +1346,11 @@ \pgf@process{#2}% \advance\pgf@x0.666666\pgf@xa% \advance\pgf@y0.666666\pgf@ya% - }% + }% \let\pgf@decorate@movealonginputsegment\pgf@decorate@movealonginputsegment@line% \let\pgf@decorate@transformtoinputsegment\pgf@decorate@transformtoinputsegment@line% \let\pgfdecorationcurrentinputsegment\pgfdecorationinputsegmentlineto% -}% +} % Input segment object curveto. % @@ -1359,12 +1359,12 @@ \def\pgf@decorate@inputsegment@first{#2}% \def\pgf@decorate@inputsegment@supporta{#3}% \def\pgf@decorate@inputsegment@supportb{#4}% - \def\pgf@decorate@inputsegment@last{#5}% + \def\pgf@decorate@inputsegment@last{#5}% % \let\pgf@decorate@movealonginputsegment\pgf@decorate@movealonginputsegment@curve% \let\pgf@decorate@transformtoinputsegment\pgf@decorate@transformtoinputsegment@curve% \let\pgfdecorationcurrentinputsegment\pgfdecorationinputsegmentcurveto% -}% +} % Input segment object closepath. % @@ -1376,7 +1376,7 @@ \def\pgfdecoratedinputsegmentlength{#1}% \def\pgf@decorate@inputsegment@first{#2}% \def\pgf@decorate@inputsegment@last{#3}% - % + % \pgfpointdiff{#2}{#3}% \pgf@xa\pgf@x% \pgf@ya\pgf@y% @@ -1389,19 +1389,19 @@ \pgf@process{#2}% \advance\pgf@x0.666666\pgf@xa% \advance\pgf@y0.666666\pgf@ya% - }% - % + }% + % \let\pgf@decorate@movealonginputsegment\pgf@decorate@movealonginputsegment@line% \let\pgf@decorate@transformtoinputsegment\pgf@decorate@transformtoinputsegment@line% \let\pgfdecorationcurrentinputsegment\pgfdecorationinputsegmentclosepath% -}% +} % Input segment object endofinputsegments. % \def\pgf@decorate@inputsegmentobject@endofinputsegments{% \let\pgfdecorationcurrentinputsegment\pgfdecorationinputsegmentlast% -}% +} @@ -1422,7 +1422,7 @@ \pgf@ya\pgf@y% \pgf@xb\pgf@decorate@inputsegmenttime pt\relax% % - % Reduce the initial time step, depending on the length + % Reduce the initial time step, depending on the length % of the path. To do: Optimise this step (should also depend on #1). % \ifdim\pgf@decorate@currentpathlength<128pt\relax% @@ -1445,7 +1445,7 @@ % % We would like to use \pgfpointcurveattime. However, we must not % overuse \pgf@process or \pgfmath stuff within this loop, - % otherwise we increase the chances of save stack overflow. + % otherwise we increase the chances of save stack overflow. % \edef\pgf@decorate@temp{% \pgf@xa\the\pgf@xa% @@ -1499,13 +1499,13 @@ \pgf@marshal% \let\pgfdecoratedangle\pgfmathresult% \fi% -}% +} % \pgfpoint@decorate@curveattime % % A `quick' version of \pgfpointcurveattime % -% No parsing and no use of \pgf@process. +% No parsing and no use of \pgf@process. % This prevents save stack build up when used inside a loop. % \def\pgfpoint@decorate@curveattime#1#2#3#4#5{% @@ -1541,7 +1541,7 @@ % Third iteration: \pgf@x=\pgf@time@t\pgf@x\advance\pgf@x by\pgf@time@s\pgf@xa% \pgf@y=\pgf@time@t\pgf@y\advance\pgf@y by\pgf@time@s\pgf@ya% -}% +} % Applies the necessary transform for a line sub-path. @@ -1551,7 +1551,7 @@ \pgfpointlineatdistance{\pgfdecoratedinputsegmentcompleteddistance}{\pgf@decorate@inputsegment@first}{\pgf@decorate@inputsegment@last} }% \pgftransformrotate{\pgfdecoratedangle}% -}% +} % Applies the necessary transform for a curve sub-path. % @@ -1561,47 +1561,47 @@ \pgftransformcurveattime{\pgf@decorate@inputsegmenttime}% {\pgf@decorate@inputsegment@first}{\pgf@decorate@inputsegment@supporta}% {\pgf@decorate@inputsegment@supportb}{\pgf@decorate@inputsegment@last}% -}% +} % \pgf@decorate@parsesoftpath -% +% % Parses an instance of a soft path into intermediate line and curve -% sub-path objects which the decoration automaton can use to traverse -% the decorated path. -% -% The soft path should be well formed and only contain `primative' -% soft path tokens, that is: moveto, lineto, curvetosupporta, +% sub-path objects which the decoration automaton can use to traverse +% the decorated path. +% +% The soft path should be well formed and only contain `primative' +% soft path tokens, that is: moveto, lineto, curvetosupporta, % curvetosupportb, curveto, rectcorner, rectsize, and closepath. -% (i.e., all specialround tokens should have removed using +% (i.e., all specialround tokens should have removed using % \pgfprocessround) -% +% % The overall length of the path is also calculated and returned -% in the macro \pgfdecoratedpathlength. -% +% in the macro \pgfdecoratedpathlength. +% % Parameters: -% +% % #1 - a macro containing a well formed soft path. % #2 - a macro to store the intermediate sub-path representations. % % Example: -% +% % \pgfpathmoveto{\pgfpointorigin} % \pgfpathlineto{\pgfpoint{0pt}{12pt}} % \pgfpathlineto{\pgfpoint{12pt}{0pt}} % \pgfgetpath\softpath -% +% % \pgf@decorate@parsesoftpath{\softpath}{\parsedsoftpath} -% +% % results in: -% +% % \parsedsoftpath -> % {\pgf@decorate@inputsegmentobject@lineto{12pt}{\pgf@x 0pt\pgf@y 0pt}{\pgf@x 0pt\pgf@y 12pt}} % {\pgf@decorate@inputsegmentobject@lineto{12pt}{\pgf@x 0pt\pgf@y 12pt}{\pgf@x 12pt\pgf@y 12pt}} -% +% % \pgfdecoratedpathlength -> % 24pt % @@ -1615,7 +1615,7 @@ \let\pgf@decorate@queueinputsegmentobject\pgfutil@empty% \let\pgfpoint@decorated@firstparsed\pgfutil@empty% \expandafter\pgf@decorate@@parsesoftpath#1\pgf@stop% -}% +} \def\pgf@decorate@@parsesoftpath#1{% \ifx#1\pgf@stop% @@ -1648,7 +1648,7 @@ \fi% \fi% \fi% - \pgf@next}% + \pgf@next} \def\pgf@decorate@addtoinputsegmentobjects#1{% @@ -1667,21 +1667,21 @@ \fi% \expandafter\def\expandafter\pgf@decorate@inputsegmentobjects\expandafter% {\pgf@decorate@inputsegmentobjects{#1}}% -}% +} % Convert \pgfsyssoftpath@movetotoken{<X>}{<Y>} into the following % representation: -% +% % \pgf@decorate@inputsegmentobject@moveto{\pgf@x X\pgf@y Y} % % The moveto input segment object is not added immediately, so that % only the last of multiple movetos is inserted. -% +% \def\pgf@decorate@parsemoveto#1#2{% \def\pgf@decorate@queueinputsegmentobject{\pgf@decorate@inputsegmentobject@moveto{\pgf@x#1\pgf@y#2}}% \def\pgfpoint@decorate@lastparsed{\pgf@x#1\pgf@y#2}% \pgf@decorate@@parsesoftpath% -}% +} % Convert \pgfsyssoftpath@linetotoken{<X>}{<Y>} into the following % representation: @@ -1698,8 +1698,8 @@ \let\pgfpoint@decorate@lastnonmovetoparsed\pgfpoint@decorate@lastparsed% \expandafter\pgf@decorate@addtoinputsegmentobjects\expandafter{\pgf@decorate@temp}% \pgf@decorate@@parsesoftpath% -}% - +} + % Convert \pgfsyssoftpath@curvetosupportatoken{<Xa>}{<Ya>}...etc % into the following representation: % @@ -1717,7 +1717,7 @@ \edef\pgfpoint@decorate@lastparsed{\pgf@x#5\pgf@y#6}% \let\pgfpoint@decorate@lastnonmovetoparsed\pgfpoint@decorate@lastparsed% \pgf@decorate@@parsesoftpath% -}% +} \def\pgf@decorate@parseclosepath#1#2{% @@ -1730,7 +1730,7 @@ \edef\pgfpoint@decorate@lastparsed{\pgf@x#1\pgf@y#2}% \let\pgfpoint@decorate@lastnonmovetoparsed\pgfpoint@decorate@lastparsed% \pgf@decorate@@parsesoftpath% -}% +} % Convert \pgfsyssoftpath@rectcornertoken{<X>}{<Y>}\pgfsyssoftpath@rectsizetoken{<Xa>}{<Ya>} % into either (clockwise) @@ -1762,7 +1762,7 @@ \pgf@decorate@parsemoveto{#1}{#2}% \pgf@xa#1\relax% \pgf@ya#2\relax% - \ifpgfdecoraterectangleclockwise% + \ifpgfdecoraterectangleclockwise% \advance\pgf@ya#4% \pgf@yb\pgf@ya% \edef\pgf@temp{{\the\pgf@xa}{\the\pgf@ya}}% @@ -1792,14 +1792,14 @@ \advance\pgf@ya-#4% \edef\pgf@temp{{\the\pgf@xa}{\the\pgf@ya}}% \expandafter\pgf@decorate@parseclosepath\pgf@temp% - \fi% + \fi% % % Restore the parsing. % \let\pgf@decorate@@parsesoftpath\pgf@decorate@orig@@parsesoftpath% \edef\pgf@marshal{\noexpand\pgf@decorate@parsemoveto{\the\pgf@xb}{\the\pgf@yb}}% \pgf@marshal% -}% +} @@ -1811,15 +1811,15 @@ \def\pgf@decorate@linelength#1#2{% \pgf@process{\pgfpointdiff{#1}{#2}}% \pgfmathveclen@{\pgfmath@tonumber{\pgf@x}}{\pgfmath@tonumber{\pgf@y}}% -}% +} % \pgf@decorate@curvelength % -% Define \pgfmathresult as the length (without units) of the cubic +% Define \pgfmathresult as the length (without units) of the cubic % bezier described by #1,#2,#3 and #4. % % To approximate the length of the curve P (sort of) use: -% +% % curveLength(P,q) % Q = subdivideLeft(P); % R = subdivideRight(P); @@ -1836,9 +1836,9 @@ % Q = subdivideLeft(P); % R = subdivideRight(P); % return curveLength'(Q,q) + curveLength'(R,q); -% +% % Where q is some small value (`tolerance'). -% +% \newif\ifpgf@decorate@subdivide \def\pgf@decorate@curvelength#1#2#3#4{% % @@ -1851,8 +1851,8 @@ \advance\pgfutil@tempdimb\pgfmathresult pt\relax% \pgfmath@returnone\pgfutil@tempdimb% \endgroup% -}% - +} + \def\pgf@decorate@@curvelength#1#2#3#4{% \begingroup% \pgf@decorate@curvecordlength{#1}{#2}{#3}{#4}% @@ -1866,12 +1866,12 @@ \expandafter\pgfmath@returnone\expandafter\pgfmathresult\expandafter p\expandafter t\expandafter% \fi% \endgroup% -}% +} -\def\pgf@decorate@curvelength@tolerance{1pt}% +\def\pgf@decorate@curvelength@tolerance{1pt} \def\pgf@decorate@curvecordlength#1#2#3#4{% - % + % % Calculate the curve cord vector. % #4\relax% @@ -1892,14 +1892,14 @@ \ifdim\pgf@ya<\pgf@decorate@curvelength@tolerance\relax% \pgfmathveclen@{\pgfmath@tonumber{\pgf@xa}}{\pgfmath@tonumber{\pgf@ya}}% \pgf@decorate@subdividefalse% - \fi% + \fi% \fi% -}% +} \def\pgf@decorate@recursive@subdividecurve@left#1#2#3#4{% {% % - % The left curve (from t=0 to t=.5) + % The left curve (from t=0 to t=.5) % #1\relax% \pgfutil@tempdima\pgf@x% @@ -1924,12 +1924,12 @@ }% }% \pgf@marshal% -}% +} \def\pgf@decorate@recursive@subdividecurve@right#1#2#3#4{% {% % - % The right curve (from t=0.5 to t=1) + % The right curve (from t=0.5 to t=1) % #1\relax% \pgfutil@tempdima.125\pgf@x\pgfutil@tempdimb.125\pgf@y% @@ -1953,7 +1953,7 @@ }% }% \pgf@marshal% -}% +} % Macro to reverse a set of input segment objects. @@ -1964,7 +1964,7 @@ \def\pgf@decorate@inputsegmentobjects@reverse#1#2{% \def\pgf@decorate@path@storein{#2}% \def\pgf@decorate@inputsegments@@temp{}% - \expandafter\pgf@decorate@inputsegments@@reverse@pass@first#1\pgf@stop}% + \expandafter\pgf@decorate@inputsegments@@reverse@pass@first#1\pgf@stop} \def\pgf@decorate@inputsegments@@reverse@pass@first#1#2\pgf@stop{% \def\pgf@decorate@temp{#1}% @@ -1980,7 +1980,7 @@ \def\pgf@decorate@next{\pgf@decorate@inputsegments@@reverse@pass@first#2\pgf@stop}% \fi% \pgf@decorate@next% -}% +} \def\pgf@decorate@inputsegmentobjects@reverse@pass@second#1#2#3\pgf@stop{% \def\pgf@decorate@inputsegments@temp{#3}% \def\pgf@decorate@inputsegments@@temp{}% @@ -2010,7 +2010,7 @@ \ifx#1\pgf@decorate@inputsegmentobject@curveto% \let\pgf@decorate@next=\pgf@decorate@inputsegmentobjects@reverse@curveto% \else% - \ifx#1\pgf@decorate@inputsegmentobject@closepath% + \ifx#1\pgf@decorate@inputsegmentobject@closepath% \let\pgf@decorate@next=\pgf@decorate@inputsegmentobjects@reverse@closepath% \else% \fi% @@ -2018,8 +2018,8 @@ \fi% \fi% \fi% - \pgf@decorate@next% -}% + \pgf@decorate@next% +} \newif\ifpgf@decorate@inputsegmentobjects@reverse@moveto@waiting @@ -2038,7 +2038,7 @@ \fi% \pgf@decorate@inputsegmentobjects@reverse@moveto@waitingtrue% \pgf@decorate@path@@@reverse@pass@second% -}% +} \newif\ifpgf@decorate@inputsegmentobjects@reverse@closepath@waiting @@ -2047,7 +2047,7 @@ \def\pgf@decorate@reverse@closepath@length{#1}% \def\pgf@decorate@current@inputsegmentobject{}% \pgf@decorate@inputsegmentobjects@reverse@lineto{#1}{#2}{#3}% -}% +} \def\pgf@decorate@inputsegmentobjects@reverse@lineto#1#2#3#4{% \ifpgf@decorate@inputsegmentobjects@reverse@moveto@waiting% @@ -2070,7 +2070,7 @@ {\expandafter\pgf@decorate@current@inputsegmentobject\pgf@decorate@append@inputsegmentobject} \def\pgf@decorate@last{#2}% \pgf@decorate@path@@@reverse@pass@second#4% -}% +} \def\pgf@decorate@inputsegmentobjects@reverse@curveto#1#2#3#4#5{% \ifpgf@decorate@inputsegmentobjects@reverse@moveto@waiting% @@ -2084,7 +2084,7 @@ \fi% \def\pgf@decorate@last{#2}% \pgf@decorate@path@@@reverse@pass@second% -}% +} \def\pgf@decorate@path@@@reverse@pass@second{% \ifx\pgf@decorate@current@inputsegmentobject\pgfutil@empty% @@ -2092,7 +2092,7 @@ \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter% \pgf@decorate@inputsegments@@temp\expandafter\expandafter\expandafter% {\expandafter\pgf@decorate@inputsegments@@temp\pgf@decorate@current@inputsegmentobject}% - \fi% + \fi% \pgf@decorate@path@@reverse@pass@second% }% @@ -2113,35 +2113,35 @@ % -% Simple decorations. +% Simple decorations. -\pgfdeclaredecoration{lineto}{initial}{% +\pgfdeclaredecoration{lineto}{initial}{ \state{initial}[switch if input segment less than=\pgfdecoratedremainingdistance to input segment, width=\pgfdecoratedremainingdistance] { - }% + } \state{input segment}[width=\pgfdecoratedinputsegmentlength,next state=initial] { \pgfpathlineto{\pgfpointdecoratedinputsegmentlast} - }% + } + + \state{final}{\pgfpathlineto{\pgfpointdecoratedpathlast}} +} - \state{final}{\pgfpathlineto{\pgfpointdecoratedpathlast}}% -}% - -\pgfdeclaredecoration{moveto}{initial}{% - \state{initial}[width=\pgfdecoratedremainingdistance]{}% - \state{final}{\pgfpathmoveto{\pgfpointdecoratedpathlast}}% -}% +\pgfdeclaredecoration{moveto}{initial}{ + \state{initial}[width=\pgfdecoratedremainingdistance]{} + \state{final}{\pgfpathmoveto{\pgfpointdecoratedpathlast}} +} % This decorations curves to the end along the line. -\pgfdeclaredecoration{curveto}{initial}{% +\pgfdeclaredecoration{curveto}{initial}{ \state{initial}[width=\pgfdecoratedinputsegmentlength/100] { \pgfpathlineto{\pgfpointorigin} - }% - \state{final}{\pgfpathlineto{\pgfpointdecoratedpathlast}}% -}% + } + \state{final}{\pgfpathlineto{\pgfpointdecoratedpathlast}} +} @@ -2150,7 +2150,7 @@ \let\pgfsnakeremainingdistance=\pgfdecoratedremainingdistance \let\pgfsnakecompleteddistance=\pgfdecoratedcompleteddistance -\def\pgfsnakeangle{\pgfdecoratedangle}% +\def\pgfsnakeangle{\pgfdecoratedangle} \let\pgfdeclaresnake=\pgfdeclaredecoration \let\pgfsetsnakesegmenttransformation=\pgfsetdecorationsegmenttransformation \def\pgfpathsnakesto#1#2{% @@ -2158,8 +2158,8 @@ \expandafter\pgfdecoration\expandafter{\pgf@temp}% \pgfpathlineto{#2}% \endpgfdecoration% -}% -\def\pgfpathsnaketo#1#2{\pgfpathsnakesto{{#1}{\pgfsnakeremainingdistance}}{#2}}% +} +\def\pgfpathsnaketo#1#2{\pgfpathsnakesto{{#1}{\pgfsnakeremainingdistance}}{#2}} \def\pgfpathsnakealongvector#1#2#3{% \pgf@process{#3}% \pgf@xa=\pgf@x% @@ -2171,20 +2171,20 @@ \advance\pgf@ya by\pgf@path@lasty% \edef\pgf@snake@lib@temp{\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}}% \pgfpathsnaketo{#1}{\pgf@snake@lib@temp}% -}% +} \let\pgfsnakesegmentamplitude=\pgfdecorationsegmentamplitude \let\pgfsnakesegmentlength=\pgfdecorationsegmentlength -\def\pgfsnakesegmentangle{\pgfdecorationsegmentangle}% -\def\pgfsnakesegmentobjectlength{\pgfkeysvalueof{/pgf/decoration/shape start width}}% -\def\pgfsnakesegmentaspect{\pgfdecorationsegmentaspect}% +\def\pgfsnakesegmentangle{\pgfdecorationsegmentangle} +\def\pgfsnakesegmentobjectlength{\pgfkeysvalueof{/pgf/decoration/shape start width}} +\def\pgfsnakesegmentaspect{\pgfdecorationsegmentaspect} \pgfset{% /pgf/segment amplitude/.style={/pgf/decoration={amplitude=#1,shape height=2*#1}}, /pgf/segment length/.style={/pgf/decoration={segment length=#1}}, /pgf/segment angle/.style={/pgf/decoration={angle=#1}}, /pgf/segment aspect/.style={/pgf/decoration={aspect=#1}}, - /pgf/segment object length/.style={/pgf/decoration={shape width=#1,radius=#1}}}% + /pgf/segment object length/.style={/pgf/decoration={shape width=#1,radius=#1}}} diff --git a/Master/texmf-dist/tex/generic/pgf/modules/pgfmodulematrix.code.tex b/Master/texmf-dist/tex/generic/pgf/modules/pgfmodulematrix.code.tex index 50c0e1e52f7..f3158456ebe 100644 --- a/Master/texmf-dist/tex/generic/pgf/modules/pgfmodulematrix.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/modules/pgfmodulematrix.code.tex @@ -9,7 +9,7 @@ \ProvidesFileRCS{pgfmodulematrix.code.tex} -\usepgfmodule{shapes}% +\usepgfmodule{shapes} \newif\ifpgfmatrix \newif\ifpgf@matrix@correct@call @@ -37,17 +37,17 @@ % % \pgfsetmatrixrowsep{5pt} -\def\pgfsetmatrixrowsep#1{\def\pgfmatrixrowsep{#1}}% -\def\pgfsetmatrixcolumnsep#1{\def\pgfmatrixcolumnsep{#1}}% +\def\pgfsetmatrixrowsep#1{\def\pgfmatrixrowsep{#1}} +\def\pgfsetmatrixcolumnsep#1{\def\pgfmatrixcolumnsep{#1}} -\def\pgfmatrixrowsep{0pt}% -\def\pgfmatrixcolumnsep{0pt}% +\def\pgfmatrixrowsep{0pt} +\def\pgfmatrixcolumnsep{0pt} % The pgfmatrix command creates a node that contains a matrix. Like % the \pgfnode command, it is to be used inside a pgfpicture -% environment. +% environment. % % #1 = shape type % #2 = anchor @@ -59,12 +59,12 @@ % % Description: % -% This command creates a node that contains a matrix. For +% This command creates a node that contains a matrix. For % each cell of the matrix, drawing commands may be given. These % commands will create a cell picture and a bounding box is computed % for each cell picture. The cell picture is then placed inside the % cell. The position inside the cell is computed according to the -% following rules: +% following rules: % % 1. In each column, the origins of the cell pictures are all on a % vertical line. @@ -79,7 +79,7 @@ % inside a node whose name is given as #3, whose shape is #1, and % whose anchor is #2. This means that the resulting node is shifted % such that the given anchor lies at the origin. Then, as for a normal -% node, the #4 path usage command is used for the node. +% node, the #4 path usage command is used for the node. % % The parameter #5 is an additional negative shift for the node. Normally, such % a shift could be given beforehand (that is, the shift could be @@ -90,7 +90,7 @@ % positions in the matrix box. The origin of this coordinate system is % at the left baseline end of the matrix box, which corresponds to the % text anchor. The position #5 is then interpreted inside this -% coordinate system and then used for shifting. +% coordinate system and then used for shifting. % % The idea behind using the parameter #5 is the following: If you % specify "text" as anchor #2 and specify \pgfpointanchor{inner @@ -113,15 +113,15 @@ % % Lines are ended using the command \pgfmatrixendrow. The command \\ % is \let to be the same, but \\ is sometimes overridden by, say, -% minipage, so it's good to have \pgfmatrixendrow as a "fallback". +% minipage, so it's good to have \pgfmatrixendrow as a "fallback". % % Inside the matrix, \\ must be used to end every line ***including % the last***. You can pass an optional parameter to \\ as in \\[2pt] % to give an additional space after this particular line. % -% The usage of \\ at the end of the matrix is important since this +% The usage of \\ at the end of the matrix is imporant since this % command is used to find the end of the matrix. What happens is that -% \\ followed by a closing brace ends the matrix. +% \\ followed by a closing brace ends the matrix. % % Inside the matrix, you must use \pgfmatrixnextcell to separate % columns. The reason is that two columns are used internally for @@ -158,7 +158,7 @@ \ifpgfmatrix% \pgferror{You cannot nest pgfmatrix environments, yet} \fi% - \bgroup% + \bgroup% \everycr{}% #6% \def\pgf@matrix@par@shape{#1}% @@ -180,12 +180,12 @@ \let\pgf@matrix@node@list=\pgfutil@empty% \expandafter\let\csname pgf@matrix@column@finish@1\endcsname=\pgfutil@empty% \let\pgf@matrix@row@finish=\pgfutil@empty% - % + % % Get rid of bgroup % \afterassignment\pgf@matrix@cont\let\pgf@next=% -}% -\def\pgf@matrix@cont{% +} +\def\pgf@matrix@cont{% \setbox\pgf@matrix@box=\hbox\bgroup\vbox\bgroup% \halign\bgroup% \pgf@matrix@init@row% @@ -205,7 +205,7 @@ }&% ##\pgf@matrix@padding% \cr% -}% +} \def\pgf@end@matrix{% \egroup\egroup% @@ -240,7 +240,7 @@ \pgf@matrix@shift@nodes@secondary{\pgf@matrix@offset}% }% \fi% -}% +} @@ -267,7 +267,7 @@ % beginning (macro expansion has stopped here since neither \omit % nor \span was found) \let\pgf@matrix@signal@cell@end=\pgf@matrix@signal@cell@end% - \pgfutil@ifnextchar[{\pgf@matrix@cell@cont}{\pgf@matrix@cell@cont[0pt]}}%}% + \pgfutil@ifnextchar[{\pgf@matrix@cell@cont}{\pgf@matrix@cell@cont[0pt]}}%} \def\pgf@matrix@cell@cont[#1]{% \xdef\pgf@matrix@last@nextcell@options{#1}% @@ -275,10 +275,10 @@ }% -\def\pgf@matrix@fixed@text{between origins}% -\def\pgf@matrix@natural@text{between borders}% +\def\pgf@matrix@fixed@text{between origins} +\def\pgf@matrix@natural@text{between borders} -\def\pgf@matrix@addtolength#1#2{\edef\pgf@temp{#2}\expandafter\pgf@matrix@addtolength@\expandafter#1#2,\pgf@stop}% +\def\pgf@matrix@addtolength#1#2{\edef\pgf@temp{#2}\expandafter\pgf@matrix@addtolength@\expandafter#1#2,\pgf@stop} \def\pgf@matrix@addtolength@#1#2,#3\pgf@stop{% \def\pgf@temp{#2}% \ifx\pgf@temp\pgfutil@empty% @@ -298,7 +298,7 @@ \else% \pgf@matrix@addtolength@#1#3\pgf@stop% \fi% -}% +} @@ -310,7 +310,7 @@ \global\pgfmatrixcurrentcolumn=0\relax% \expandafter\gdef\csname pgf@matrix@maxy\the\pgfmatrixcurrentrow\endcsname{0pt}% \expandafter\gdef\csname pgf@matrix@miny\the\pgfmatrixcurrentrow\endcsname{0pt}% -}% +} @@ -319,7 +319,7 @@ \def\pgf@matrix@step@column{% \relax% \global\advance\pgfmatrixcurrentcolumn by1\relax% -}% +} @@ -342,9 +342,9 @@ % Step 4: Collect everything in a cell box % \setbox\pgf@matrix@cell=\hbox\bgroup\bgroup% - % make sure that cell pictures are not affected if matrices have - % 'overlay' option on: - \pgf@relevantforpicturesizetrue + % make sure that cell pictures are not affected if matrizes have + % 'overlay' option on: + \pgf@relevantforpicturesizetrue \pgfsys@beginpicture% \normalbaselines% % Find out whether the cell is empty: @@ -356,9 +356,9 @@ \pgf@matrix@empty@cell@false% \pgfmatrixbegincode% }% -}% +} -\def\pgf@matrix@empty@check{\futurelet\pgf@matrix@check@token\pgf@matrix@empty@check@cont}% +\def\pgf@matrix@empty@check{\futurelet\pgf@matrix@check@token\pgf@matrix@empty@check@cont} \def\pgf@matrix@empty@check@cont{% \ifx\pgf@matrix@check@token\pgf@matrix@signal@cell@end% \pgf@matrix@empty@cell@true% @@ -373,7 +373,7 @@ \expandafter \let% reinserted \fi% -}% +} \newif\ifpgf@matrix@empty@cell@ @@ -407,7 +407,7 @@ \expandafter\global\expandafter\let\csname pgf@matrix@column@finish@\the\pgfmatrixcurrentcolumn\endcsname=\pgfutil@empty% \fi% }% - \fi\fi% + \fi\fi% % Special case of the empty picture \ifdim\pgf@picmaxx=-16000pt\relax% \global\pgf@picmaxx=0pt\relax% @@ -425,20 +425,20 @@ \pgf@y=\csname pgf@matrix@column@sep@\the\pgfmatrixcurrentcolumn\endcsname\relax% \advance\pgf@picminx by-\pgf@y% \fi% - % + % % Step 6: Protocol and adjust height and depth % % Step 6.1: Protocol... % \ifdim\pgf@picmaxy>\csname pgf@matrix@maxy\the\pgfmatrixcurrentrow\endcsname% \expandafter\xdef\csname pgf@matrix@maxy\the\pgfmatrixcurrentrow\endcsname{\the\pgf@picmaxy}% - \fi% + \fi% \ifdim\pgf@picminy<\csname pgf@matrix@miny\the\pgfmatrixcurrentrow\endcsname% \expandafter\xdef\csname pgf@matrix@miny\the\pgfmatrixcurrentrow\endcsname{\the\pgf@picminy}% - \fi% + \fi% % % Step 6.2: and setup. - % + % \ht\pgf@matrix@cell=\pgf@picmaxy% \dp\pgf@matrix@cell=-\pgf@picminy% % @@ -453,16 +453,16 @@ \else% \ifdim\pgf@picmaxx>\csname pgf@matrix@maxx\the\pgfmatrixcurrentcolumn\endcsname% \expandafter\xdef\csname pgf@matrix@maxx\the\pgfmatrixcurrentcolumn\endcsname{\the\pgf@picmaxx}% - \fi% + \fi% \ifdim\pgf@picminx<\csname pgf@matrix@minx\the\pgfmatrixcurrentcolumn\endcsname% \expandafter\xdef\csname pgf@matrix@minx\the\pgfmatrixcurrentcolumn\endcsname{\the\pgf@picminx}% - \fi% + \fi% \fi% % % Step 7.2: and setup. - % + % \xdef\pgf@matrix@paddingskip{\the\pgf@picmaxx}% - % + % % Step 8: Put in the box now % \hfil\hskip-\pgf@picminx% @@ -471,7 +471,7 @@ % % Step 9: End bounding box \endpgfinterruptboundingbox% -}% +} % Default code for the start and end code \let\pgfmatrixbegincode=\relax @@ -489,7 +489,7 @@ \xdef\pgf@matrix@node@list{\pgf@matrix@node@list,{#1}}% \expandafter\xdef\csname pgf@matrix@node@location@#1\endcsname{{\the\pgfmatrixcurrentrow}{\the\pgfmatrixcurrentcolumn}}% \fi% -}% +} @@ -501,7 +501,7 @@ \pgferror{Single ampersand used with wrong catcode}% \fi% \hskip\pgf@matrix@paddingskip\hfil% -}% +} % Compute the real positions of the origins @@ -509,7 +509,7 @@ % We must now compute the real positions of the origins of all the % small pictures. To this end, we need to compute prefix sums. After % the procedure is done, the minx and the maxy will contain the origin -% positions. +% positions. \def\pgf@matrix@compute@origin{% % @@ -550,7 +550,7 @@ \expandafter\xdef\csname pgf@matrix@minx\the\c@pgf@counta\endcsname{\the\pgf@x}% \repeat% }% -}% +} % Shift the nodes to their origins @@ -577,7 +577,7 @@ \fi% }% }% -}% +} % The second shifting, done in the following procedure, shifts all @@ -593,7 +593,7 @@ \fi% \fi% }% -}% +} % End of line @@ -603,22 +603,21 @@ % nor \span was found) \let\pgf@matrix@signal@cell@end=\pgf@matrix@signal@cell@end \pgf@matrix@last@cell@in@rowtrue% - \xdef\pgf@matrix@rowsep{\pgfmatrixrowsep}% &\pgf@matrix@correct@calltrue% \global\pgf@matrix@fixedfalse% \pgf@y=0pt% - \pgf@matrix@addtolength\pgf@y{\pgf@matrix@rowsep}% + \pgf@matrix@addtolength\pgf@y{\pgfmatrixrowsep}% \pgfutil@ifnextchar[{\pgfmatrixendrow@skip}{\pgf@matrix@finish@line}% -}% +} \newif\ifpgf@matrix@last@cell@in@row -\def\pgf@matrix@signal@cell@end{\pgf@matrix@signal@cell@end}% +\def\pgf@matrix@signal@cell@end{\pgf@matrix@signal@cell@end} % exact definition does not matter, only needs to be unique. \def\pgfmatrixendrow@skip[#1]{% \pgf@matrix@addtolength\pgf@y{#1}% \pgf@matrix@finish@line% -}% +} \def\pgf@matrix@finish@line{% \global\pgf@y=\pgf@y% @@ -626,12 +625,12 @@ \global\advance\pgf@ya by\csname pgf@matrix@miny\the\pgfmatrixcurrentrow\endcsname% \expandafter\xdef\csname pgf@matrix@miny\the\pgfmatrixcurrentrow\endcsname{\the\pgf@ya}% \pgfutil@ifnextchar\egroup{\cr\pgf@end@matrix}{\pgf@matrix@no@eom@found}% -}% +} \def\pgf@matrix@eom@found{% \cr% \pgf@end@matrix% -}% +} \def\pgf@matrix@no@eom@found{% \cr% @@ -646,7 +645,7 @@ \global\let\pgf@matrix@row@finish=\pgfutil@empty% \fi% }% -}% +} \endinput diff --git a/Master/texmf-dist/tex/generic/pgf/modules/pgfmodulenonlineartransformations.code.tex b/Master/texmf-dist/tex/generic/pgf/modules/pgfmodulenonlineartransformations.code.tex index 8e607b207d4..7ce4784110f 100644 --- a/Master/texmf-dist/tex/generic/pgf/modules/pgfmodulenonlineartransformations.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/modules/pgfmodulenonlineartransformations.code.tex @@ -25,7 +25,7 @@ % something nonlinear", it just provides a way of computing a % coordinate. In contrast, installing a polar transformation will % transform everything being drawn using the \pgfpath... commands an -% will even turn a straight line into a circle. +% will even turn a straight line into a circle. % % Since computing non-linear transformations is expensive, they are % only applied "if really necessary". @@ -48,7 +48,7 @@ \pgf@pos@transform@glob% \pgf@nlt@list% } -}% +} @@ -57,13 +57,13 @@ % % Description: % -% Does a "local synchronization" of the nonlinear transformation with +% Does a "local syncronization" of the nonlinear transformation with % the linear transformation regarding the translation part of the -% current nonlinear transformation. The *linear* transformation will be +% current nonlinear transformatoin. The *linear* transformation will be % updated so that it translates things to the point to which the % nonlinear transformation transforms the origin. The nonlinear % transformation will be reset. -% +% % The net effect is that you can now draw things near the origin as % before, but with just a linear transformation in force. Note that % the coordinate system will not be rotated, only a shift is done (use @@ -81,7 +81,7 @@ \let\pgf@nlt@curveto\pgf@lt@curveto% \let\pgf@nlt@closepath\pgf@lt@closepath% \fi% -}% +} @@ -89,14 +89,14 @@ % % Description: % -% Does a "complete local synchronization" of the nonlinear +% Does a "complete local syncronization" of the nonlinear % transformation with the linear transformation. The *linear* % transformation will be updated so that it transforms things to the % point to which the nonlinear transformation transforms the % origin. The nonlinear transformation will be reset. -% +% % The net effect is that you can now draw things near the origin as -% before, but with just a linear transformation in force. +% before, but with just a linear transformation in force. \def\pgfapproximatenonlineartransformation{% \ifx\pgf@nlt@list\pgfutil@empty% @@ -119,35 +119,35 @@ \let\pgf@nlt@curveto\pgf@lt@curveto% \let\pgf@nlt@closepath\pgf@lt@closepath% \fi% -}% +} % Adds a non-linear transformation to the current list of -% transformations. +% transformations. % % #1 = code % % Description: % -% When the code #1 is called, \pgf@x and \pgf@y will be set to some +% When the code #1 is called, \pgf@x and \pgf@y will be set to some % values, let us call this the point p. The nonlinear transformation % will now map this point to a new point f(p). The coordinates of this -% point should be returned in \pgf@x and \pgf@y. Furthermore, consider +% point shoudl be returned in \pgf@x and \pgf@y. Furthermore, consider % the two "unit tangents" (going in $x$-direction and in -% $y$-direction) at point p. The nonlinear transformation will map +% $y$-direction) at point p. The nonlinear transformaiton will map % these to new tangents, t_x and t_y. The (not necessarily normalized) % vectors t_x and t_y should be returned in pgf@xa and -ya and pgf@xb % and pgf@yb. The macro should not do any global assignments except to % \pgf@x and \pgf@y, but may do arbitrary local assignments. -% +% % The effect of installing a new transformation is the following: As % long as there is at least one nonlinear transformation installed, % whenever the path construction commands add a curve or line to the % softpath, the line or curve will be "bend" by applying all of the % nonlinear transformation installed. In particular, straight lines % will be replaced by curves. -% +% % Note that the normal linear transformation are always applied before % any nonlinear transformations are applied. @@ -157,7 +157,7 @@ \let\pgf@nlt@lineto\pgf@nlt@lineto@nlt \let\pgf@nlt@curveto\pgf@nlt@curveto@nlt \let\pgf@nlt@closepath\pgf@nlt@closepath@nlt -}% +} \def\pgf@nlt@moveto@nlt#1#2{% {% @@ -177,7 +177,7 @@ \global\let\pgf@nlt@last@coord@xaxis\pgf@nlt@last@moveto@xaxis% \global\let\pgf@nlt@last@coord@yaxis\pgf@nlt@last@moveto@yaxis% }% -}% +} \def\pgf@nlt@lineto@nlt#1#2{% @@ -213,11 +213,11 @@ \pgf@nlt@inner@curve% \fi% }% -}% +} \def\pgf@nlt@set@temps#1#2{% \pgfutil@tempdima#1\pgfutil@tempdimb#2% -}% +} \def\pgf@nlt@curveto@nlt#1#2#3#4#5#6{% {% @@ -225,11 +225,11 @@ \pgf@temp% \pgf@nlt@inner@curve% }% -}% +} \newdimen\pgftransformnonlinearflatness \pgftransformnonlinearflatness=5pt -\def\pgfsettransformnonlinearflatness#1{\pgfmathsetlength\pgftransformnonlinearflatness{#1}}% +\def\pgfsettransformnonlinearflatness#1{\pgfmathsetlength\pgftransformnonlinearflatness{#1}} @@ -246,9 +246,9 @@ \advance\pgf@ya by-\pgf@y% \advance\pgf@xb by-\pgf@xc% \advance\pgf@yb by-\pgf@yc% - % + % % Now, test whether the flatness is satisfied: - % + % \pgfutil@tempswafalse \ifdim\pgfutil@tempdima>\pgftransformnonlinearflatness\pgfutil@tempswatrue\fi% \ifdim\pgfutil@tempdima<-\pgftransformnonlinearflatness\pgfutil@tempswatrue\fi% @@ -263,7 +263,7 @@ \ifdim\pgf@yb>\pgftransformnonlinearflatness\pgfutil@tempswatrue\fi% \ifdim\pgf@yb<-\pgftransformnonlinearflatness\pgfutil@tempswatrue\fi% \ifpgfutil@tempswa% - \endgroup% Undo the adjustments... + \endgroup% Undo the adjustmenst... {% \edef\pgf@orig@xya{\pgf@xa\the\pgf@xa\pgf@ya\the\pgf@ya} \edef\pgf@orig@xyb{\pgf@xb\the\pgf@xb\pgf@yb\the\pgf@yb} @@ -305,7 +305,7 @@ \endgroup% Snap back... \pgf@nlt@do@inner@curve% \fi% -}% +} \def\pgf@nlt@do@inner@curve{% \pgf@process{\pgf@x\pgf@xa\pgf@y\pgf@ya\pgf@nlt@list}% @@ -320,7 +320,7 @@ \pgf@protocolsizes{\pgf@xb}{\pgf@yb}% \pgf@protocolsizes{\pgf@xc}{\pgf@yc}% \pgfsyssoftpath@curveto{\the\pgf@xa}{\the\pgf@ya}{\the\pgf@xb}{\the\pgf@yb}{\the\pgf@xc}{\the\pgf@yc}% -}% +} \def\pgf@nlt@closepath@nlt{% @@ -336,7 +336,7 @@ \fi% \pgfsyssoftpath@closepath% }% -}% +} \endinput diff --git a/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduleoo.code.tex b/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduleoo.code.tex index 38ceef34cdc..1cd938af521 100644 --- a/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduleoo.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduleoo.code.tex @@ -8,7 +8,7 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. % -% Based on pgfmoduleoo.code.tex v1.8 by Till Tantau. This version adds inheritance. +% Based on pgfmoduleoo.code.tex v1.8 by Till Tantau. This version adds inheritance. @@ -66,7 +66,7 @@ }{% \pgfooclass@() }% -}% +} \long\def\pgfooclass@(#1)#2#3{% \def\pgfoo@classname{#2}% \expandafter\ifx\csname pgfooY\pgfoo@classname.@pgfooinit\endcsname\relax\else @@ -95,9 +95,9 @@ % Cleanup \let\method=\pgfoo@origmethod% \let\attribute=\pgfoo@origattribute% -}% +} -\def\pgfoo@emptyinit(){}% +\def\pgfoo@emptyinit(){} \def\pgfoo@escapeif#1#2\fi{\fi#1}% a little helper @@ -122,13 +122,13 @@ \fi }% % The final sequence is a sequence of base classes, in the order as - % they were given. + % they were given. \ifx\relax#2\relax\else \edef\pgfoo@seq{\pgfoo@seq[#2,].}% \fi \edef\pgfoo@temp{()(\pgfoo@seq)}% \expandafter\pgfoo@ciii@merge\pgfoo@temp -}% +} % #1 = MRO so far % #2 = remaining sequences @@ -140,19 +140,19 @@ \else\pgfoo@escapeif{% split #2 \pgfoo@ciii@merge@A(#1)(#2)% }\fi% -}% +} % a splitter: to be only called from \pgfoo@ciii@merge \def\pgfoo@ciii@merge@A(#1)(#2.#3){% \ifx\relax#3\relax % if #3 is empty, we can take the shortcut \pgfoo@ciii@mergeA@done(#1)(#2)% - \else\pgfoo@escapeif{% + \else\pgfoo@escapeif{% \pgfoo@ciii@merge@checkHead(#1)()(#2)()(#3)% }\fi -}% +} \def\pgfoo@ciii@mergeA@done(#1)([#2]){% \pgfoo@ciii@done(#1#2)% -}% +} % #1 = MRO so far % #2 = sequences with bad heads (dot after each sequence) @@ -165,21 +165,21 @@ \def\pgfoo@ciii@merge@checkHead(#1)(#2)([#3,#4])(#5)(#6){% \pgfutil@in@{[#3,}{#2}% \ifpgfutil@in@\pgfoo@escapeif{% #3 is already blacklisted - \pgfoo@ciii@clean\pgfoo@ciii@merge@checkHead@P{(#1)(#2[#3,#4].)(#5#6)}% + \pgfoo@ciii@clean\pgfoo@ciii@merge@checkHead@P{(#1)(#2[#3,#4].)(#5#6)}% }\else\pgfoo@escapeif{% - \ifx\relax#6\relax\pgfoo@escapeif{% no more sequences to test the head against! + \ifx\relax#6\relax\pgfoo@escapeif{% no more sequences to test the head against! % so, #3 is a good head, and we can recurse \pgfoo@ciii@goodHeadFound(#1)(#3)(#2[#4].#5)% }\else\pgfoo@escapeif{% split #6 and get to work \pgfoo@ciii@merge@checkHead@A(#1)(#2)([#3,#4])(#5)(#6)% }\fi }\fi -}% +} % splitter: to be only called from \pgfoo@ciii@merge@checkHead % we will check if #3 occurs in the tail of #6 \def\pgfoo@ciii@merge@checkHead@A(#1)(#2)([#3,#4])(#5)(#6.#7){% \pgfoo@ciii@merge@checkHead@B(#1)(#2)([#3,#4])(#5)(#6)(#7)% -}% +} % splitter: to be only called from \pgfoo@ciii@merge@checkHead@A % &worker: we will check if #3 occurs in #7. If it does, #3 is a bad head. \def\pgfoo@ciii@merge@checkHead@B(#1)(#2)([#3,#4])(#5)([#6,#7])(#8){% @@ -201,7 +201,7 @@ }\fi }\fi % }\fi -}% +} % #1 = MRO % #2 = good head @@ -223,7 +223,7 @@ \pgfoo@ciii@clean\pgfoo@ciii@merge{(#1#2,)(#3)}% }\fi }\fi -}% +} % mediates between the bad head exit of \pgfoo@ciii@merge@checkHead@B % and \pgfoo@ciii@merge@checkHead; we need the mediator because #3 @@ -235,12 +235,12 @@ \else\pgfoo@escapeif{% \pgfoo@ciii@merge@checkHead@Q(#1)(#2)(#3)% }\fi -}% +} % splitter for \pgfoo@ciii@merge@checkHead@P % #3 = the sequence containing the newest good head candidate \def\pgfoo@ciii@merge@checkHead@Q(#1)(#2)(#3.#4){% \pgfoo@ciii@merge@checkHead(#1)(#2)(#3)()(#4)% -}% +} % cyclically removes all occurrences of "[]," and "[]." (i.e., empty % sequences) in #2. When done, calls #1 with whatever remains. @@ -251,14 +251,14 @@ }\else\pgfoo@escapeif{% #1#2% }\fi -}% +} \def\pgfoo@ciii@clean@dot#1#2[].#3\pgfoo@ciii@clean@END{% \pgfoo@ciii@clean#1{#2#3}% -}% +} \def\pgfoo@ciii@done(#1,){% \def\pgfoo@mro{#1}% -}% +} % end of C3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -305,12 +305,12 @@ \fi \expandafter\long\expandafter\def\csname pgfooY\pgfoo@classname.\pgfoo@method\endcsname(#2){#3}% \edef\pgfoo@methods{\pgfoo@methods,\pgfoo@method}% -}% +} \def\pgfoo@inherit@methods{% % for non-derived classes: \expandafter\ifx\expandafter\relax\pgfoo@temp@baseclasses\relax - % if init is not defined, define an empty one + % if init is not defined, define an empty one \expandafter\ifx\csname pgfooY\pgfoo@classname.init\endcsname\relax \expandafter\let\csname pgfooY\pgfoo@classname.init\endcsname\pgfoo@emptyinit% \edef\pgfoo@methods{,init\pgfoo@methods}% @@ -323,7 +323,7 @@ % remember the list of collected methods \expandafter\let\csname pgfooY\pgfoo@classname @pgfoo@methods\endcsname\pgfoo@methods % get MRO - \expandafter\let\expandafter\pgfoo@mro\csname pgfooY\pgfoo@classname @pgfoo@mro\endcsname + \expandafter\let\expandafter\pgfoo@mro\csname pgfooY\pgfoo@classname @pgfoo@mro\endcsname % loop throough base classes in MRO \pgfutil@for\pgfoo@baseclass:=\pgfoo@mro\do{% \ifx\pgfoo@baseclass\pgfoo@classname % skip self @@ -332,7 +332,7 @@ \expandafter\let\expandafter\pgfoo@methods\csname pgfooY\pgfoo@baseclass @pgfoo@methods\endcsname \pgfutil@for\pgfoo@method:=\pgfoo@methods\do{% for each method % check if it is already defined in our class - \expandafter\ifx\csname pgfooY\pgfoo@classname.\pgfoo@method\endcsname\relax + \expandafter\ifx\csname pgfooY\pgfoo@classname.\pgfoo@method\endcsname\relax % if not, link the method name from our class to base class \edef\pgfoo@temp{\noexpand\let \expandafter\noexpand\csname pgfooY\pgfoo@classname.\pgfoo@method\endcsname @@ -342,7 +342,7 @@ }% }\fi }% -}% +} \def\pgfoosuper(#1,#2).#3({% #2.get id(\pgfoo@temp@id)% @@ -352,14 +352,14 @@ }% \expandafter\let\expandafter\pgfoo@mro\csname pgfooY\pgfoo@classname @pgfoo@mro\endcsname \expandafter\pgfoo@super@A\expandafter,\pgfoo@mro,.#3(% -}% +} \def\pgfoo@super@B#1,#2.#3({% \expandafter\ifx\csname pgfooY#1.#3\endcsname\relax \pgfoo@escapeif{\pgfoo@super@B#2.#3(}% \else \pgfoo@escapeif{\expandafter\pgfoo@caller\pgfoo@temp@id.#1.#3(}% \fi -}% +} @@ -384,18 +384,18 @@ \pgfoo@declareunpack#1;% \else% \pgfoo@declareattribute@\let{#1}\pgfutil@empty - \fi% - \fi% -}% -\def\pgfoo@declareunpack#1=#2;{\pgfoo@declareattribute@\def{#1}{{#2}}}% -\def\pgfoo@declareunpackspace#1 =#2;{\pgfoo@declareattribute@\def{#1}{{#2}}}% + \fi% + \fi% +} +\def\pgfoo@declareunpack#1=#2;{\pgfoo@declareattribute@\def{#1}{{#2}}} +\def\pgfoo@declareunpackspace#1 =#2;{\pgfoo@declareattribute@\def{#1}{{#2}}} % put the initial value in the class's namespace % put the attr name in a list \def\pgfoo@declareattribute@#1#2#3{% \expandafter#1\csname pgfooY\pgfoo@classname @#2\endcsname#3% \expandafter\def\expandafter\pgfoo@attributes\expandafter{\pgfoo@attributes,#2}% -}% +} % for each base class: % for each attribute declared in that class: @@ -411,14 +411,14 @@ \fi \expandafter\let\csname pgfooY\pgfoo@classname.@pgfoo@attributes\endcsname\pgfoo@attributes% % get MRO - \expandafter\let\expandafter\pgfoo@mro\csname pgfooY\pgfoo@classname @pgfoo@mro\endcsname + \expandafter\let\expandafter\pgfoo@mro\csname pgfooY\pgfoo@classname @pgfoo@mro\endcsname \def\pgfoo@allattributes{}% here we will store the attrs declared in base classes \pgfutil@for\pgfoo@baseclass:=\pgfoo@mro\do{% for each base class in MRO order % the attributes declared in this base class \expandafter\let\expandafter\pgfoo@attributes\csname pgfooY\pgfoo@baseclass.@pgfoo@attributes\endcsname \pgfutil@for\pgfoo@attribute:=\pgfoo@attributes\do{% for each attribute % check if we have already found it in some previous base class - \edef\pgfoo@temp{{,\pgfoo@attribute=}{\pgfoo@allattributes,}}% + \edef\pgfoo@temp{{,\pgfoo@attribute=}{\pgfoo@allattributes,}} \expandafter\pgfutil@in@\pgfoo@temp \ifpgfutil@in@\else % don't overwrite % append to the list @@ -430,14 +430,14 @@ \edef\pgfoo@allattributes{\expandafter\pgfutil@gobble\pgfoo@allattributes}% gobble comma \fi % this macro will hold a list of attributes from all base classes - % we run this macro at init and gc - \def\pgfoo@process@attributes{}% + % we run this macro at init and gc + \def\pgfoo@process@attributes{} \pgfutil@for\pgfoo@attributeclass:=\pgfoo@allattributes\do{% for each (attribute, class) pair % append to the attribute processor \expandafter\pgfoo@inherit@attributes@appendattribute\pgfoo@attributeclass.% }% \expandafter\let\csname pgfooY\pgfoo@classname .@pgfoo@process@attributes\endcsname\pgfoo@process@attributes -}% +} % #1=attr, #2=class which the attr comes from @@ -449,10 +449,10 @@ % \def\pgfoo@process@attributes{\pgfoo@process@attributes\pgfoo@attribute@op{#1}% % \csname pgfooY#2@#1\endcsname} % with \pgfoo@process@attributes and \csname expanded exactly once: -}% +} -% \pgfoo@attribute@op for garbage collection -\def\pgfoo@gc@attribute#1#2{\pgfoolet{#1}\relax}% +% \pgfoo@attribute@op for garbace collection +\def\pgfoo@gc@attribute#1#2{\pgfoolet{#1}\relax} \newcount\pgfoo@objectcount @@ -467,7 +467,7 @@ \def\pgfoovalueof#1{% \csname pgfooX\the\pgfoothis@count @#1\endcsname% -}% +} % The attribute get method @@ -480,7 +480,7 @@ \def\pgfooget#1#2{% \expandafter\let\expandafter#2\csname pgfooX\the\pgfoothis@count @#1\endcsname% -}% +} % The attribute set method @@ -493,7 +493,7 @@ \long\def\pgfooset#1#2{% \expandafter\gdef\csname pgfooX\the\pgfoothis@count @#1\endcsname{#2}% -}% +} % The attribute set method (expanded version) @@ -506,7 +506,7 @@ \long\def\pgfooeset#1#2{% \expandafter\xdef\csname pgfooX\the\pgfoothis@count @#1\endcsname{#2}% -}% +} % The attribute let method @@ -519,7 +519,7 @@ \def\pgfoolet#1#2{% \expandafter\global\expandafter\let\csname pgfooX\the\pgfoothis@count @#1\endcsname#2% -}% +} % Add something to an attribute at the end @@ -533,7 +533,7 @@ \expandafter\expandafter\expandafter\def% \expandafter\expandafter\expandafter\pgf@oo@temp\expandafter\expandafter\expandafter{\csname pgfooX\the\pgfoothis@count @#1\endcsname#2}% \expandafter\global\expandafter\let\csname pgfooX\the\pgfoothis@count @#1\endcsname\pgf@oo@temp% -}% +} % Add something to an attribute at the beginning @@ -550,7 +550,7 @@ \expandafter\expandafter\expandafter\pgf@oo@temp% \expandafter\expandafter\expandafter{\expandafter\pgf@oo@@temp\pgf@oo@temp}% \pgfoolet{#1}\pgf@oo@temp% -}% +} @@ -559,14 +559,14 @@ \def\pgfoo@collect@args{% \pgfutil@ifnextchar\bgroup\pgfoo@collect@args@group\pgfoo@collect@args@nogroup% -}% +} \def\pgfoo@collect@args@nogroup#1){% \pgfoo@toks{#1}% \pgfoo@continue% -}% +} \def\pgfoo@collect@args@group#1{% \pgfutil@ifnextchar){\pgfoo@toks{{#1}}\expandafter\pgfoo@continue\pgfutil@gobble}{\pgfoo@collect@args@nogroup{#1}}% -}% +} % Instantiate an object @@ -594,11 +594,11 @@ \pgfoo@new% }% }% -}% +} \def\pgfoo@new#1={% \def\pgfutil@reserved@a{#1}% \let\pgfutil@next\pgfoo@@new - \futurelet\pgfutil@let@token\pgfutil@ignorespaces}% + \futurelet\pgfutil@let@token\pgfutil@ignorespaces} \def\pgfoo@@new new #1({% \expandafter\ifx\csname pgfooY#1.get id\endcsname\relax% \pgferror{Unknown class '#1'}% @@ -612,17 +612,17 @@ \let\pgfoo@continue=\pgf@oo@new@cont% \expandafter\pgfoo@collect@args% \fi% -}% +} \def\pgf@oo@new@cont{% \expandafter\pgfoolastobj\expandafter.\expandafter i\expandafter n\expandafter i\expandafter t\expandafter(\the\pgfoo@toks)% \aftergroup\pgfoogc% cleanup after group -}% +} \def\pgfoo@new@attribute#1={% \def\pgfutil@reserved@a{#1}% \let\pgfutil@next\pgfoo@@new@attribute - \futurelet\pgfutil@let@token\pgfutil@ignorespaces}% + \futurelet\pgfutil@let@token\pgfutil@ignorespaces} \def\pgfoo@@new@attribute new #1({% \expandafter\ifx\csname pgfooY#1.get id\endcsname\relax% \pgferror{Unknown class '#1'}% @@ -637,14 +637,14 @@ \let\pgfoo@continue=\pgf@oo@new@cont% \expandafter\pgfoo@collect@args% \fi% -}% +} \def\pgfoo@new@create#1#2{% \advance\pgfoo@objectcount by 1\relax% \edef\pgfoolastobj{\noexpand\pgfoo@caller{\the\pgfoo@objectcount}}% \expandafter\gdef\csname pgfooX\the\pgfoo@objectcount @class\endcsname{#2}% \let#1\pgfoolastobj% -}% +} \def\pgfoo@caller#1.#2({% \expandafter\let\expandafter\pgfoo@caller@temp\csname pgfooY\csname pgfooX#1@class\endcsname.#2\endcsname% @@ -654,20 +654,20 @@ \ifx\pgfoo@caller@temp\relax% \pgferror{Object #1 has no method '#2'}% \fi% - \fi% + \fi% \def\pgf@marshal{% \pgfoothis@count=#1\relax% }% \let\pgfoo@continue\pgfoo@caller@cont% \pgfoo@collect@args% -}% +} \def\pgfoo@caller@cont{% \edef\pgf@marshal{% \pgf@marshal% \noexpand\pgfoo@caller@temp(\the\pgfoo@toks)% }% \expandafter\pgf@marshal\expandafter\pgfoothis@count\the\pgfoothis@count\relax% -}% +} \let\pgfoo@orig@caller=\pgfoo@caller % The special "this" object @@ -680,10 +680,10 @@ \fi% \let\pgfoo@continue\pgfoothis@cont% \pgfoo@collect@args% -}% +} \def\pgfoothis@cont{% \expandafter\pgfoo@caller@temp\expandafter(\the\pgfoo@toks)% -}% +} @@ -699,7 +699,7 @@ \def\pgfoo@id(#1){% \edef#1{\the\pgfoothis@count}% -}% +} % Yields the object with the given id % @@ -712,7 +712,7 @@ \def\pgfooobj#1{% \pgfoo@caller{#1}% -}% +} % Get the object @@ -729,7 +729,7 @@ \def\pgfoo@obj(#1){% \edef#1{\noexpand\pgfoo@caller{\the\pgfoothis@count}}% -}% +} @@ -737,10 +737,10 @@ % % Description: % -% This method frees space occupied by unused objects. Garbage are +% This method frees space ocupied by unused objects. Garbage are % objects that have been destroyed because of the end of the scope in % which they were created. In this case, however, the memory used by -% this object is not immediately reused because the attributes of the +% this object is not immediately reused because the attributes of the % object are actually stored in global variables. When the garbage % collector is called, it will set all these global variables to % \relax, thereby ensuring that no memory is needed for them. @@ -752,7 +752,7 @@ \let\pgfoo@next=\pgfoo@dogc% \pgfoo@next% }% -}% +} \def\pgfoo@dogc{% \advance\pgfoothis@count by 1\relax% \expandafter\ifx\csname pgfooX\the\pgfoothis@count @class\endcsname\relax% @@ -765,8 +765,8 @@ \expandafter\global\expandafter\let\csname pgfooX\the\pgfoothis@count @class\endcsname\relax% \fi% \pgfoo@next% -}% - +} + % @@ -786,10 +786,10 @@ \expandafter\let\csname pgfooX\the\pgfoo@objectcount @##1\endcsname\pgfoo@attrvalue }% \let\pgfoo@attribute@op\pgfoo@copy@attributes - \csname pgfooY\pgfoo@temp@classname .@pgfoo@process@attributes\endcsname + \csname pgfooY\pgfoo@temp@classname .@pgfoo@process@attributes\endcsname \aftergroup\pgfoogc% cleanup after group - }% -}% + } +} % @@ -799,7 +799,7 @@ % \pgfooclass{signal} -{% +{ % % This class implements signals. % @@ -808,35 +808,35 @@ % called, all connected methods get called. % Attribute - \attribute emitter;% + \attribute emitter; % Collects the objects that should be called. - + % Constructor - \method signal() {}% + \method signal() {} % Connect a slot (method) #2 of object #1 \method connect(#1,#2) {% {% #1.get id(\pgf@tempid)% - % Save in emitter + % Save in emmiter \pgfooget{emitter}\pgf@temp% \let\pgfoo@signal@call=\relax% avoid expansion \edef\pgf@temp{\pgf@temp\pgfoo@signal@call{\pgf@tempid}{#2}}% \pgfoolet{emitter}\pgf@temp% }% - }% + } \def\pgfoo@signal@call#1#2{% \def\pgf@temp{\pgfooobj{#1}.#2}% \expandafter\pgf@temp\expandafter(\pgfoo@signal@args)% - }% - + } + % Emit a signal \method emit(#1) {% \def\pgfoo@signal@args{#1}% \pgfoovalueof{emitter} - }% -}% + } +} diff --git a/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduleparser.code.tex b/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduleparser.code.tex index 39f20dc74d3..5c248ad9f56 100644 --- a/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduleparser.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduleparser.code.tex @@ -31,10 +31,10 @@ \def\pgf@parser{#1}% \def\pgf@parser@state{initial}% \pgf@parser@parse% -}% +} \def\pgf@parser@parse{% \futurelet\pgf@parser@symbol\pgf@parser@cont% -}% +} \def\pgf@parser@cont{% % Ok, defined? \expandafter\let\expandafter\pgf@parser@action% @@ -52,9 +52,9 @@ \ifx\pgf@parser@symbol\pgfutil@sptoken% \expandafter\pgf@parser@rid@space% \else% - \expandafter\pgf@parser@rid@other% + \expandafter\pgf@parser@rid@other% \fi% -}% +} \def\pgf@parser@ridded{% \ifx\pgf@parser@state\pgf@parser@final@text% @@ -62,50 +62,50 @@ \else% \expandafter\pgf@parser@parse% \fi% -}% +} -\def\pgf@parser@final@text{final}% +\def\pgf@parser@final@text{final} {% - \def\:{\pgf@parser@rid@space} \expandafter\gdef\: {\futurelet\pgf@parser@ignore\pgf@parser@ridded}% - \gdef\pgf@parser@rid@other{\afterassignment\pgf@parser@ridded\let\pgf@parser@ignore=}% -}% + \def\:{\pgf@parser@rid@space} \expandafter\gdef\: {\futurelet\pgf@parser@ignore\pgf@parser@ridded} + \gdef\pgf@parser@rid@other{\afterassignment\pgf@parser@ridded\let\pgf@parser@ignore=} +} % Switches the state -% +% % #1 = new state -% +% % Description: -% +% % This command can be used inside a state action to switch to a % different state. -\def\pgfparserswitch#1{\def\pgf@parser@state{#1}}% +\def\pgfparserswitch#1{\def\pgf@parser@state{#1}} % Defines an action to be taken in a state for some symbol -% +% % #1 = parser % #2 = state % #3 = symbol text (result of saying \meaning on the symbol) % #4 = action -% +% % Description: -% +% % When the parser encounters #3 while being in state #2, then code #4 % is executed. -% +% % When #2 is set to the special text "all", then the symbol is handled % in all states by #4, except when a state defines something special % for this symbol \def\pgfparserdef#1#2#3#4{% \expandafter\def\csname pgf@parser@a@#1@#2@#3\endcsname{#4} -}% +} \endinput diff --git a/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduleplot.code.tex b/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduleplot.code.tex index 1a553f925c1..6c548160b26 100644 --- a/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduleplot.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduleplot.code.tex @@ -39,12 +39,12 @@ % default. Rather, to ``use'' such a stream, you must first install a % stream handler. For example, the ``lineto'' handler will simply % basically every \pgfplotstreampoint into a \pgfpathlineto. -% +% % One special things is the handling of "jumps" in a stream. For % instance, when a lineto handler encounters an "outlier" or a new % data set, the current line should end and a new subpath should start % (unless configured otherwise). For this, the special jump handler is -% important. +% important. % % Example: % @@ -62,17 +62,17 @@ % The stream commands actually call their ``internal'' versions, which % are set by the handlers: -\def\pgfplotstreamstart{\pgf@plotstreamstart}% -\def\pgfplotstreampoint#1{\gdef\pgfplotlastpoint{#1}\pgf@plotstreampoint{#1}}% -\def\pgfplotstreampointoutlier#1{\pgfplot@outliers{}{\pgf@plotstreamjump}{\pgfplotstreampoint{#1}}}% -\def\pgfplotstreampointundefined{\pgfplot@outliers{}{\pgf@plotstreamjump}{}}% -\def\pgfplotstreamnewdataset{\pgfplot@outliers{}{\pgf@plotstreamjump}{}}% -\def\pgfplotstreamspecial{\pgf@plotstreamspecial}% -\def\pgfplotstreamend{\pgf@plotstreamend}% - -\def\pgfplot@ignorer#1#2#3{#1}% -\def\pgfplot@jumper#1#2#3{#2}% -\def\pgfplot@plotter#1#2#3{#3}% +\def\pgfplotstreamstart{\pgf@plotstreamstart} +\def\pgfplotstreampoint#1{\gdef\pgfplotlastpoint{#1}\pgf@plotstreampoint{#1}} +\def\pgfplotstreampointoutlier#1{\pgfplot@outliers{}{\pgf@plotstreamjump}{\pgfplotstreampoint{#1}}}% +\def\pgfplotstreampointundefined{\pgfplot@outliers{}{\pgf@plotstreamjump}{}}% +\def\pgfplotstreamnewdataset{\pgfplot@outliers{}{\pgf@plotstreamjump}{}}% +\def\pgfplotstreamspecial{\pgf@plotstreamspecial} +\def\pgfplotstreamend{\pgf@plotstreamend} + +\def\pgfplot@ignorer#1#2#3{#1} +\def\pgfplot@jumper#1#2#3{#2} +\def\pgfplot@plotter#1#2#3{#3} \let\pgfplot@outliers\pgfplot@jumper \let\pgfplot@undefined\pgfplot@jumper @@ -89,7 +89,7 @@ handle new data sets in plots/.is choice, handle new data sets in plots/ignore/.code=\let\pgfplot@newdata\pgfplot@ignorer, handle new data sets in plots/jump/.code=\let\pgfplot@newdata\pgfplot@jumper, -}% +} % Declares a new plot handler @@ -99,11 +99,11 @@ % #3 = keys as described below % % Description: -% +% % When you declare a new plot handler, you provide, through keys, % different "actions" that should be taken when the different stream % commands are used: -% +% % start = some code to be executed when \pgfplotstreamstart is called % for this plothandler % end = same for the end of the stream @@ -118,7 +118,7 @@ % special macro = see above % % Example: -% +% % \pgfdeclareplothandler{\ultrasimplehandler}{}{ % point=\pgfpathlineto{##1} % } @@ -135,7 +135,7 @@ #3% }% }% -}% +} \pgfkeys{% /pgf/plots/@handler options/.cd, @@ -165,7 +165,7 @@ jump macro/.code=\global\let\pgf@plotstreamjump@init#1, special/.code=\gdef\pgf@plotstreamspecial@init##1{#1}, special macro/.code=\global\let\pgf@plotstreamspecial@init#1, -}% +} \newif\ifpgf@plot@started @@ -178,13 +178,13 @@ % % For certain handlers it makes sense either the start a plot by % moving to the first point of the plot or to do a lineto to that -% first point. Using this command this action can be set to a lineto. +% first point. Using this command this action can be set to a lineto. % % Example: % % \pgfsetlinetofirstplotpoint -\def\pgfsetlinetofirstplotpoint{\let\pgf@plot@first@action=\pgfpathlineto}% +\def\pgfsetlinetofirstplotpoint{\let\pgf@plot@first@action=\pgfpathlineto} % Sets the action taken for the first point of a plot to a moveto. @@ -193,7 +193,7 @@ % % \pgfsetmovetofirstplotpoint -\def\pgfsetmovetofirstplotpoint{\let\pgf@plot@first@action=\pgfpathmoveto}% +\def\pgfsetmovetofirstplotpoint{\let\pgf@plot@first@action=\pgfpathmoveto} \let\pgf@plot@first@action=\pgfpathmoveto @@ -208,7 +208,7 @@ % This handler converts each plot stream command into a lineto % command, except for the first, which is converted to the action that % has previously been specified using \pgfsetlinetofirstplotpoint or -% \pgfsetmovetofirstplotpoint. +% \pgfsetmovetofirstplotpoint. % % Example: % @@ -218,17 +218,17 @@ \pgfdeclareplothandler{\pgfplothandlerlineto}{}{ point macro=\pgf@plot@line@handler, jump=\global\let\pgf@plotstreampoint\pgf@plot@line@handler@move% -}% +} \def\pgf@plot@line@handler#1{% \pgf@plot@first@action{#1}% \global\let\pgf@plotstreampoint=\pgfpathlineto% -}% +} \def\pgf@plot@line@handler@move#1{% \pgfpathmoveto{#1}% \global\let\pgf@plotstreampoint=\pgfpathlineto% -}% +} @@ -252,21 +252,21 @@ \pgfpathmoveto{#1}% \global\pgf@plot@startedtrue% \global\let\pgf@plotstreampoint=\pgfpathlineto% -}% +} \def\pgf@plot@polygon@stop{% \ifpgf@plot@started% \pgfpathclose% \fi% \global\pgf@plot@startedfalse% -}% +} \def\pgf@plot@next@close@and@moveto{% \ifpgf@plot@started% \pgfpathclose% \fi% \global\let\pgf@plotstreampoint\pgf@plot@line@handler@close% -}% +} % More handlers are defined in pgflibraryplothandlers @@ -282,13 +282,13 @@ % \pgfplothandlerdiscard % \pgfplotxyfile{mytable} -\pgfdeclareplothandler{\pgfplothandlerdiscard}{}{}% +\pgfdeclareplothandler{\pgfplothandlerdiscard}{}{} % This handler records each plot stream command to a macro. This is % useful if plot commands are difficult to generate and need to be -% ``recycled'' later on. +% ``recylced'' later on. % % Example: % @@ -305,7 +305,7 @@ jump=\expandafter\gdef\expandafter#1\expandafter{#1\pgf@plotstreamjump}, special=\expandafter\gdef\expandafter#1\expandafter{#1\pgfplotstreamspecial{##1}}, end=\expandafter\gdef\expandafter#1\expandafter{#1\pgfplotstreamend}, -}% +} @@ -338,12 +338,12 @@ \catcode`\^^M=5 \pgf@readxyfile% \fi - \pgfplotstreamend% + \pgfplotstreamend% \endgroup% -}% +} -\let\pgf@savedpar=\par -\def\pgf@partext{\par}% +\let\pgf@savedpar=\par% +\def\pgf@partext{\par} \def\pgf@readxyfile{% \pgfutil@read\r@pgf@reada to \pgf@temp% \let\par=\pgf@savedpar% @@ -362,7 +362,7 @@ \expandafter\pgf@parsexyline\pgf@temp\pgf@stop% \fi\fi% \ifeof\r@pgf@reada\else\expandafter\pgf@readxyfile\fi% -}% +} \def\pgf@parsexyline#1 #2 #3\pgf@stop{% \def\b@pgfplotsxyfile@scanning@for@first{0}% @@ -374,7 +374,7 @@ \else% \pgfplotstreampoint{\pgfpointxy{#1}{#2}}% \fi\fi% -}% +} \edef\pgf@xyline@flag@out{o\space}% \edef\pgf@xyline@flag@undef{u\space}% @@ -389,7 +389,7 @@ % File format: % % Like xy, except that each line contains three numbers, which are -% converted to xyz coordinates. +% converted to xyz coordiantes. % % Example: % @@ -406,9 +406,9 @@ \catcode`\^^M=5 \pgf@readxyzfile% \fi - \pgfplotstreamend% + \pgfplotstreamend% \endgroup% -}% +} \def\pgf@readxyzfile{% \pgfutil@read\r@pgf@reada to \pgf@temp% @@ -426,7 +426,7 @@ \expandafter\pgf@parsexyzline\pgf@temp\pgf@stop% \fi\fi% \ifeof\r@pgf@reada\else\expandafter\pgf@readxyzfile\fi% -}% +} \def\pgf@parsexyzline#1 #2 #3 #4\pgf@stop{% \def\b@pgfplotsxyfile@scanning@for@first{0}% @@ -438,7 +438,7 @@ \else% \pgfplotstreampoint{\pgfpointxyz{#1}{#2}{#3}}% \fi\fi% -}% +} @@ -461,19 +461,19 @@ % \pgfplothandlerlineto % \pgfplotgnuplot[\jobname]{plot [x=0:5] x*sin(x)} -{% +{ \catcode`\%=12 \catcode`\"=12 \xdef\pgf@gnuplot@head{set table \noexpand\pgf@plottablefile@quoted; set format "%.5f"} -}% +} \let\pgf@plotwrite=\w@pgf@writea \newif\ifpgf@resample@plot \pgfkeys{% - /pgf/plot/gnuplot call/.initial={gnuplot}}% + /pgf/plot/gnuplot call/.initial={gnuplot}} -\def\pgfplotgnuplot{\pgfutil@ifnextchar[{\pgf@plotgnuplot}{\pgf@plotgnuplot[\jobname]}}%}% +\def\pgfplotgnuplot{\pgfutil@ifnextchar[{\pgf@plotgnuplot}{\pgf@plotgnuplot[\jobname]}}%} \def\pgf@plotgnuplot[#1]#2{% \pgf@resample@plottrue% \pgfutilpreparefilename{#1.gnuplot}% @@ -487,18 +487,18 @@ \else% \pgfutil@read\pgfutil@inputcheck to\pgf@temp% ignored \pgfutil@read\pgfutil@inputcheck to\pgf@plot@line% - \closein\pgfutil@inputcheck + \closein\pgfutil@inputcheck \edef\pgf@plot@code{#2\space}% \ifx\pgf@plot@code\pgf@plot@line% \openin\pgfutil@inputcheck=\pgfretval\relax \ifeof\pgfutil@inputcheck% \else% - \closein\pgfutil@inputcheck + \closein\pgfutil@inputcheck \pgf@resample@plotfalse% \fi% \fi% \fi - \ifpgf@resample@plot% + \ifpgf@resample@plot% \immediate\openout\pgf@plotwrite=\pgf@plotgnuplotfile\relax \immediate\pgfutil@write\pgf@plotwrite{\pgf@gnuplot@head}% \immediate\pgfutil@write\pgf@plotwrite{#2}% @@ -510,7 +510,7 @@ % \let\pgf@parsexyline=\pgf@parsegnuplotxyline% \pgfplotxyfile{\pgf@plottablefile}% % \let\pgf@parsexyline=\pgf@savedparsexyline% -}% +} % \def\pgf@parsegnuplotxyline#1 #2 #3\pgf@stop{% % \edef\pgf@xyline@flag@val{#3}% @@ -523,7 +523,7 @@ % \else% % \pgfplotstreampoint{\pgfpointxy{#1}{#2}}% % \fi\fi% -% }% +% } % This producer handler plots a function using pgf's mathematical engine. % @@ -553,7 +553,7 @@ \pgf@marshal% } \pgfplotstreamend% -}% +} diff --git a/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduleshapes.code.tex b/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduleshapes.code.tex index 5dcea56c02e..71a3876da32 100644 --- a/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduleshapes.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/modules/pgfmoduleshapes.code.tex @@ -57,7 +57,7 @@ \pgf@y=-\pgf@y% }% \expandafter\pgfsavepgf@process\csname pgf@sh@sa@#3\endcsname{% - \pgf@sh@reanchor{#1}{#2}% FIXME : this is double work! + \pgf@sh@reanchor{#1}{#2}% FIXME : this is double work! }% % Save the saved points and the transformation matrix \edef\pgf@node@name{#3}% @@ -114,7 +114,7 @@ \fi% }% }% -}% +} \let\pgf@outer@adjust@hook\relax \def\pgf@shapes@late@pos@begin{% @@ -127,8 +127,8 @@ \setbox\pgfpositionnodelaterbox=\hbox% \bgroup% \pgfsys@beginscope% -}% - +} + \def\pgf@shapes@late@pos@end{% \pgfsys@endscope% \egroup% Close box @@ -146,8 +146,8 @@ \let\pgfpositionnodelatername=\pgf@node@name% \pgf@positionnodelater@macro% \endpgfinterruptboundingbox% -}% - +} + \def\pgf@shift@node#1#2{% % This internal command shifts the recorded coordinates for node #1 % by the vector #2. It is used to @@ -161,7 +161,7 @@ \pgfgettransform{\pgf@temp}% \expandafter\xdef\csname pgf@sh@nt@#1\endcsname{\pgf@temp}% }% -}% +} @@ -195,7 +195,7 @@ }% \pgfmultipartnode{#1}{#2}{#4}{#5}% } -}% +} @@ -219,13 +219,13 @@ % is not relevant for the picture's bounding box, but a bounding box % for the node is computed and stored in the macros % \pgfpositionnodelaterboundboxminx to -% \pgfpositionnodelaterboundboxmaxy. Finally, the +% \pgfpositionnodelaterboundboxmaxy. Finally, the % macro #1 is called with the following macros setup: -% +% % \pgfpositionnodelaterbox % A box register (box 0 by default) that stores the node's paths and % texts. You should move the contents of this box to a box of your -% choice. +% choice. % % \pgfpositionnodelatername % The name of the just-created-node. This name will be the @@ -238,14 +238,14 @@ % \pgfpositionnodelatermaxy % These four macros store the bounding box as dimensions that are % guarenteed to end with "pt". -% +% % By setting #1 to \relax (which is the default), you can switch off % the whole mechanism -% +% % Once a late node has been created, you can add arbitrary code in the % same picture. Then, at some later point, you call % \pgfpositionnodenow to finally position the node at a given position. -% +% % When \pgfpositionnodenow is called, the macros mentioned above % should have the exact same values they had when #1 is called. @@ -256,10 +256,10 @@ \else% \pgflatenodepositioningtrue% \fi% -}% +} \newif\ifpgflatenodepositioning -\pgfpositionnodelater{\relax}% -\def\pgfpositionnodelaterbox{0}% +\pgfpositionnodelater{\relax} +\def\pgfpositionnodelaterbox{0} @@ -267,7 +267,7 @@ % Position a node that has been scheduled for later insertion % % #1 = position in the picture, where the original anchor should go, -% now +% now % % Description: % @@ -300,25 +300,25 @@ }% % Late setup% {% - \csname pgf@lns@\pgfpositionnodelatername\endcsname% - \expandafter\global\expandafter\let\csname pgf@lns@\pgfpositionnodelatername\endcsname\relax% + \csname pgf@lns@\pgfpositionnodelatername\endcsname% + \expandafter\global\expandafter\let\csname pgf@lns@\pgfpositionnodelatername\endcsname\relax% }% \endpgfinterruptpath% -}% +} \def\pgfpositionnodenow@rename not yet positionedPGFINTERNAL#1\relax{% \pgfnoderename{#1}{not yet positionedPGFINTERNAL#1} \pgf@nodecallback{#1}% -}% +} -% "Fake" a node -% +% "Fake" a node +% % #1 = node name -% +% % Description: -% +% % This command will setup things so that it "looks like" a node named % #1 has been created, but, in reality, no node is created. The idea % is that a node created in this way can be referenced by systems @@ -332,7 +332,7 @@ \expandafter\gdef\csname pgf@sh@nt@\pgf@temp\endcsname{{1}{0}{0}{1}{0pt}{0pt}}% \expandafter\global\expandafter\let\csname pgf@sh@ma@\pgf@temp\endcsname\pgfutil@empty% \expandafter\xdef\csname pgf@sh@pi@\pgf@temp\endcsname{\pgfpictureid}% -}% +} @@ -356,7 +356,7 @@ \expandafter\pgfutil@g@addto@macro\csname pgf@lns@not yet positionedPGFINTERNAL#1\endcsname{#2}% \fi% \fi% -}% +} @@ -382,19 +382,19 @@ \pgf@node@gnamelet{pgf@sh@pi@#1}{pgf@sh@pi@#2}% \pgf@node@gnamelet{pgf@sh@ma@#1}{pgf@sh@ma@#2}% \pgf@nodecallback{#1}% -}% +} \def\pgf@node@gnamelet#1#2{% \expandafter\let\expandafter\pgf@temp\csname #2\endcsname% \expandafter\global\expandafter\let\csname #1\endcsname=\pgf@temp% -}% +} % Rename a node -% +% % #1 = new name % #2 = old name -% +% % Description: -% +% % Renames a node. This is like an alias, only the memory used for the % old name is freed. @@ -405,7 +405,7 @@ \expandafter\global\expandafter\let\csname pgf@sh@nt@#2\endcsname\relax \expandafter\global\expandafter\let\csname pgf@sh@pi@#2\endcsname\relax \expandafter\global\expandafter\let\csname pgf@sh@ma@#2\endcsname\relax -}% +} @@ -440,7 +440,7 @@ \expandafter\xdef\csname pgf@sh@pi@#1\endcsname{\pgfpictureid}% \fi% \fi% -}% +} \def\pgf@sh@redeferredanchor#1#2{% CJ \expandafter\gdef\csname pgf@anchor@\pgf@sm@shape@name @#1\endcsname{#2}}% CJ @@ -457,7 +457,7 @@ \noexpand\def\noexpand#1{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% }}% \pgf@sh@marshal% -}% +} \def\pgf@sh@resaveddimen#1#2{% @@ -467,36 +467,36 @@ \noexpand\def\noexpand#1{\the\pgf@x}% }}% \pgf@sh@marshal% -}% +} \def\pgf@sh@resavedmacro#1#2{% - \let#1\pgfutil@empty% - \def\addtosavedmacro##1{% - \expandafter\def\expandafter\pgf@sh@addtomacro@temp\expandafter{#1\noexpand\def\noexpand##1{##1}}% - {\expandafter\pgfutil@toks@\expandafter{\pgf@sh@addtomacro@temp}\expandafter}% - \expandafter\def\expandafter#1\expandafter{\the\pgfutil@toks@}% - }% + \let#1\pgfutil@empty% + \def\addtosavedmacro##1{% + \expandafter\def\expandafter\pgf@sh@addtomacro@temp\expandafter{#1\noexpand\def\noexpand##1{##1}}% + {\expandafter\pgfutil@toks@\expandafter{\pgf@sh@addtomacro@temp}\expandafter}% + \expandafter\def\expandafter#1\expandafter{\the\pgfutil@toks@}% + }% #2\relax% \edef\pgf@sh@marshal{% \noexpand\pgfutil@g@addto@macro\noexpand\pgf@sh@savedmacros{% \noexpand\def\noexpand#1{#1}% }}% \pgf@sh@marshal% -}% +} % Invoke an anchor \def\pgf@sh@reanchor#1#2{% \pgfutil@ifundefined{pgf@anchor@#1@#2}% {% \pgfutil@ifundefined{pgf@anchor@generic@#2}{% - \pgfmathsetcounter{pgf@counta}{#2}% - \csname pgf@anchor@#1@border\endcsname{\pgfqpointpolar{\the\c@pgf@counta}{1pt}}% + \pgfmathsetcounter{pgf@counta}{#2}% + \csname pgf@anchor@#1@border\endcsname{\pgfqpointpolar{\the\c@pgf@counta}{1pt}}% }{% \csname pgf@anchor@generic@#2\endcsname{#1}% }% }% {\csname pgf@anchor@#1@#2\endcsname}% -}% +} % Defines a generic anchor, i.e. one which gets the associated shape % as first argument. @@ -556,7 +556,7 @@ \pgf@pos@transform@glob% }% }% -}% +} \def\pgf@shape@interpictureshift#1{% \expandafter\ifx\csname pgf@sh@pi@#1\endcsname\pgfpictureid% @@ -574,7 +574,7 @@ \pgf@x=\pgf@xa% \pgf@y=\pgf@ya% \fi% -}% +} @@ -631,7 +631,7 @@ \pgf@pos@transform@glob% }% }% -}% +} % Retrieve the list of node parts of a shape @@ -651,7 +651,7 @@ \def\pgfgetnodeparts#1#2{% \expandafter\let\expandafter#1\csname pgf@sh@boxes@#2\endcsname% -}% +} % Declares a shape type @@ -713,16 +713,16 @@ % will be placed at the anchor XYZ. % By default, \nodeparts is just {text}. Thus, there will be one % node part box named \pgfnodeparttextbox and this node will be -% placed at the anchor text. -% +% placed at the anchor text. +% % % Example: % % See the definition of rectangle, below. \long\def\pgfdeclareshape#1#2{% - {% - \def\pgf@sm@shape@name{#1}% + { + \def\pgf@sm@shape@name{#1} \let\savedanchor=\pgf@sh@savedanchor \let\saveddimen=\pgf@sh@saveddimen \let\savedmacro=\pgf@sh@savedmacro% MW @@ -750,96 +750,96 @@ \anchor{text}{\pgfpointorigin}% \nodeparts{text}% \expandafter\global\expandafter\let\csname pgf@sh@s@\pgf@sm@shape@name\endcsname=\pgfutil@empty% - #2% - }% -}% + #2 + } +} \def\pgf@sh@savedanchor#1#2{% - \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@\pgf@sm@shape@name\endcsname{\pgf@sh@resavedanchor{#1}{#2}}}% + \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@\pgf@sm@shape@name\endcsname{\pgf@sh@resavedanchor{#1}{#2}}} \def\pgf@sh@saveddimen#1#2{% - \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@\pgf@sm@shape@name\endcsname{\pgf@sh@resaveddimen{#1}{#2}}}% + \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@\pgf@sm@shape@name\endcsname{\pgf@sh@resaveddimen{#1}{#2}}} \def\pgf@sh@savedmacro#1#2{% MW \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@\pgf@sm@shape@name\endcsname{\pgf@sh@resavedmacro{#1}{#2}}}% MW -\def\pgf@sh@anchor#1#2{\expandafter\gdef\csname pgf@anchor@\pgf@sm@shape@name @#1\endcsname{#2}}% +\def\pgf@sh@anchor#1#2{\expandafter\gdef\csname pgf@anchor@\pgf@sm@shape@name @#1\endcsname{#2}} \def\pgf@sh@deferredanchor#1#2{% CJ \expandafter\pgfutil@g@addto@macro \csname pgf@sh@s@\pgf@sm@shape@name\endcsname{\pgf@sh@redeferredanchor{#1}{#2}}}% CJ -\def\pgf@sh@anchorborder#1{\expandafter\gdef\csname pgf@anchor@\pgf@sm@shape@name @border\endcsname##1{\pgf@process{##1}#1}}% -\long\def\pgf@sh@behindbgpath#1{\expandafter\gdef\csname pgf@sh@bbg@\pgf@sm@shape@name\endcsname{#1}}% -\long\def\pgf@sh@bgpath#1{\expandafter\gdef\csname pgf@sh@bg@\pgf@sm@shape@name\endcsname{#1}}% -\long\def\pgf@sh@beforebgpath#1{\expandafter\gdef\csname pgf@sh@fbg@\pgf@sm@shape@name\endcsname{#1}}% -\long\def\pgf@sh@behindfgpath#1{\expandafter\gdef\csname pgf@sh@bfg@\pgf@sm@shape@name\endcsname{#1}}% -\long\def\pgf@sh@fgpath#1{\expandafter\gdef\csname pgf@sh@fg@\pgf@sm@shape@name\endcsname{#1}}% -\long\def\pgf@sh@beforefgpath#1{\expandafter\gdef\csname pgf@sh@ffg@\pgf@sm@shape@name\endcsname{#1}}% -\def\pgf@sh@boxes#1{\expandafter\gdef\csname pgf@sh@boxes@\pgf@sm@shape@name\endcsname{#1}}% +\def\pgf@sh@anchorborder#1{\expandafter\gdef\csname pgf@anchor@\pgf@sm@shape@name @border\endcsname##1{\pgf@process{##1}#1}} +\long\def\pgf@sh@behindbgpath#1{\expandafter\gdef\csname pgf@sh@bbg@\pgf@sm@shape@name\endcsname{#1}} +\long\def\pgf@sh@bgpath#1{\expandafter\gdef\csname pgf@sh@bg@\pgf@sm@shape@name\endcsname{#1}} +\long\def\pgf@sh@beforebgpath#1{\expandafter\gdef\csname pgf@sh@fbg@\pgf@sm@shape@name\endcsname{#1}} +\long\def\pgf@sh@behindfgpath#1{\expandafter\gdef\csname pgf@sh@bfg@\pgf@sm@shape@name\endcsname{#1}} +\long\def\pgf@sh@fgpath#1{\expandafter\gdef\csname pgf@sh@fg@\pgf@sm@shape@name\endcsname{#1}} +\long\def\pgf@sh@beforefgpath#1{\expandafter\gdef\csname pgf@sh@ffg@\pgf@sm@shape@name\endcsname{#1}} +\def\pgf@sh@boxes#1{\expandafter\gdef\csname pgf@sh@boxes@\pgf@sm@shape@name\endcsname{#1}} \def\pgf@sh@inheritsavedanchors[from=#1]{% - \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@\pgf@sm@shape@name\endcsname{\csname pgf@sh@s@#1\endcsname}}% - -\def\pgf@sh@inheritanchor[from=#1]#2{% + \expandafter\pgfutil@g@addto@macro\csname pgf@sh@s@\pgf@sm@shape@name\endcsname{\csname pgf@sh@s@#1\endcsname}} + + \def\pgf@sh@inheritanchor[from=#1]#2{% \edef\pgf@marshal{\global\let\expandafter\noexpand\csname pgf@anchor@\pgf@sm@shape@name @#2\endcsname=\expandafter\noexpand\csname pgf@anchor@#1@#2\endcsname}% \pgf@marshal% -}% +} \def\pgf@sh@inheritanchorborder[from=#1]{% \edef\pgf@marshal{\global\let\expandafter\noexpand\csname pgf@anchor@\pgf@sm@shape@name @border\endcsname=\expandafter\noexpand\csname pgf@anchor@#1@border\endcsname}% \pgf@marshal% -}% +} \def\pgf@sh@inheritor#1#2{% \edef\pgf@marshal{\global\let\expandafter\noexpand\csname pgf@sh@#1@\pgf@sm@shape@name\endcsname=\expandafter\noexpand\csname pgf@sh@#1@#2\endcsname}% \pgf@marshal% -}% -\def\pgf@sh@inheritbehindbgpath[from=#1]{\pgf@sh@inheritor{bbg}{#1}}% -\def\pgf@sh@inheritbgpath[from=#1]{\pgf@sh@inheritor{bg}{#1}}% -\def\pgf@sh@inheritbeforebgpath[from=#1]{\pgf@sh@inheritor{fbg}{#1}}% -\def\pgf@sh@inheritbehindfgpath[from=#1]{\pgf@sh@inheritor{bfg}{#1}}% -\def\pgf@sh@inheritfgpath[from=#1]{\pgf@sh@inheritor{fg}{#1}}% -\def\pgf@sh@inheritbeforefgpath[from=#1]{\pgf@sh@inheritor{ffg}{#1}}% -\def\pgf@sh@inheritboxes[from=#1]{\pgf@sh@inheritor{boxes}{#1}}% +} +\def\pgf@sh@inheritbehindbgpath[from=#1]{\pgf@sh@inheritor{bbg}{#1}} +\def\pgf@sh@inheritbgpath[from=#1]{\pgf@sh@inheritor{bg}{#1}} +\def\pgf@sh@inheritbeforebgpath[from=#1]{\pgf@sh@inheritor{fbg}{#1}} +\def\pgf@sh@inheritbehindfgpath[from=#1]{\pgf@sh@inheritor{bfg}{#1}} +\def\pgf@sh@inheritfgpath[from=#1]{\pgf@sh@inheritor{fg}{#1}} +\def\pgf@sh@inheritbeforefgpath[from=#1]{\pgf@sh@inheritor{ffg}{#1}} +\def\pgf@sh@inheritboxes[from=#1]{\pgf@sh@inheritor{boxes}{#1}} -% +% % Coordinate. This shape is special: It is only used to reference a % point for later usage. Nothing is drawn, all anchors are identical -% to the center. +% to the center. % \pgfdeclareshape{coordinate} -{% +{ \savedanchor\centerpoint{% % x \pgf@x=.5\wd\pgfnodeparttextbox% % y \pgf@y=.5\ht\pgfnodeparttextbox% \advance\pgf@y by -.5\dp\pgfnodeparttextbox% - }% - - \anchor{center}{\centerpoint}% - \anchor{north}{\centerpoint}% - \anchor{north west}{\centerpoint}% - \anchor{north east}{\centerpoint}% - \anchor{center}{\centerpoint}% - \anchor{west}{\centerpoint}% - \anchor{east}{\centerpoint}% - \anchor{mid}{\centerpoint}% - \anchor{mid west}{\centerpoint}% - \anchor{mid east}{\centerpoint}% - \anchor{base}{\centerpoint}% - \anchor{base west}{\centerpoint}% - \anchor{base east}{\centerpoint}% - \anchor{south}{\centerpoint}% - \anchor{south west}{\centerpoint}% - \anchor{south east}{\centerpoint}% - \anchorborder{\centerpoint}% + } + + \anchor{center}{\centerpoint} + \anchor{north}{\centerpoint} + \anchor{north west}{\centerpoint} + \anchor{north east}{\centerpoint} + \anchor{center}{\centerpoint} + \anchor{west}{\centerpoint} + \anchor{east}{\centerpoint} + \anchor{mid}{\centerpoint} + \anchor{mid west}{\centerpoint} + \anchor{mid east}{\centerpoint} + \anchor{base}{\centerpoint} + \anchor{base west}{\centerpoint} + \anchor{base east}{\centerpoint} + \anchor{south}{\centerpoint} + \anchor{south west}{\centerpoint} + \anchor{south east}{\centerpoint} + \anchorborder{\centerpoint} \nodeparts{}% no text -}% +} % Value keys for shapes: @@ -861,7 +861,7 @@ minimum width/.initial =1pt, minimum height/.initial =1pt, minimum size/.style ={/pgf/minimum width=#1,/pgf/minimum height=#1}, -}% +} @@ -878,8 +878,8 @@ \pgfkeyssetvalue{/pgf/outer xsep}{#1}% \pgfkeyssetvalue{/pgf/outer ysep}{#1}% \fi% -}% -\def\pgf@auto@text{auto}% +} +\def\pgf@auto@text{auto} \let\pgf@outer@auto@adjust@hook\relax @@ -887,21 +887,21 @@ % Keys for rotating the shape border. % (may not be supported by all shapes) % -% /pgf/shape border uses incircle : Calculate the shape border using the incircle +% /pgf/shape border uses incircle : Calculate the shape border using the incircle % around the node contents (+inner sep). -% +% % /pgf/shape border rotate : Angle of independent border rotation. \newif\ifpgfshapeborderusesincircle -\pgfkeys{/pgf/shape border uses incircle/.is if=pgfshapeborderusesincircle}% -\pgfkeys{/pgf/shape border rotate/.initial=0}% +\pgfkeys{/pgf/shape border uses incircle/.is if=pgfshapeborderusesincircle} +\pgfkeys{/pgf/shape border rotate/.initial=0} -% +% % Rectangle % \pgfdeclareshape{rectangle} -{% +{ \savedanchor\northeast{% % Calculate x % @@ -937,8 +937,8 @@ \advance\pgf@y by.5\ht\pgfnodeparttextbox% \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}% \advance\pgf@y by\pgf@ya% - }% - + } + \savedanchor\southwest{% % Calculate x % @@ -974,11 +974,11 @@ \advance\pgf@y by.5\ht\pgfnodeparttextbox% \pgfmathsetlength\pgf@ya{\pgfkeysvalueof{/pgf/outer ysep}}% \advance\pgf@y by-\pgf@ya% - }% + } % % Anchors - % + % \anchor{center}{ \pgf@process{\northeast}% \pgf@xa=.5\pgf@x% @@ -988,54 +988,54 @@ \pgf@y=.5\pgf@y% \advance\pgf@x by \pgf@xa% \advance\pgf@y by \pgf@ya% - }% - \anchor{mid}{\pgf@anchor@rectangle@center\pgfmathsetlength\pgf@y{.5ex}}% - \anchor{base}{\pgf@anchor@rectangle@center\pgf@y=0pt}% + } + \anchor{mid}{\pgf@anchor@rectangle@center\pgfmathsetlength\pgf@y{.5ex}} + \anchor{base}{\pgf@anchor@rectangle@center\pgf@y=0pt} \anchor{north}{ \pgf@process{\southwest}% \pgf@xa=.5\pgf@x% \pgf@process{\northeast}% \pgf@x=.5\pgf@x% \advance\pgf@x by \pgf@xa% - }% + } \anchor{south}{ \pgf@process{\northeast}% \pgf@xa=.5\pgf@x% \pgf@process{\southwest}% \pgf@x=.5\pgf@x% \advance\pgf@x by \pgf@xa% - }% + } \anchor{west}{ \pgf@process{\northeast}% \pgf@ya=.5\pgf@y% \pgf@process{\southwest}% \pgf@y=.5\pgf@y% \advance\pgf@y by \pgf@ya% - }% - \anchor{mid west}{\southwest\pgfmathsetlength\pgf@y{.5ex}}% - \anchor{base west}{\southwest\pgf@y=0pt}% + } + \anchor{mid west}{\southwest\pgfmathsetlength\pgf@y{.5ex}} + \anchor{base west}{\southwest\pgf@y=0pt} \anchor{north west}{ \southwest \pgf@xa=\pgf@x \northeast - \pgf@x=\pgf@xa}% - \anchor{south west}{\southwest}% + \pgf@x=\pgf@xa} + \anchor{south west}{\southwest} \anchor{east}{% \pgf@process{\southwest}% \pgf@ya=.5\pgf@y% \pgf@process{\northeast}% \pgf@y=.5\pgf@y% \advance\pgf@y by \pgf@ya% - }% - \anchor{mid east}{\northeast\pgfmathsetlength\pgf@y{.5ex}}% - \anchor{base east}{\northeast\pgf@y=0pt}% - \anchor{north east}{\northeast}% + } + \anchor{mid east}{\northeast\pgfmathsetlength\pgf@y{.5ex}} + \anchor{base east}{\northeast\pgf@y=0pt} + \anchor{north east}{\northeast} \anchor{south east}{ \northeast \pgf@xa=\pgf@x \southwest \pgf@x=\pgf@xa - }% + } \anchorborder{% \pgf@xb=\pgf@x% xb/yb is target \pgf@yb=\pgf@y% @@ -1057,7 +1057,7 @@ \pgf@process{\pgf@marshal}% \advance\pgf@x by\pgf@xa% \advance\pgf@y by\pgf@ya% - }% + } % % Background path @@ -1066,48 +1066,48 @@ \pgfpathrectanglecorners {\pgfpointadd{\southwest}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}} {\pgfpointadd{\northeast}{\pgfpointscale{-1}{\pgfpoint{\pgfkeysvalueof{/pgf/outer xsep}}{\pgfkeysvalueof{/pgf/outer ysep}}}}} - }% -}% + } +} % Special current path start coordinate: -\expandafter\def\csname pgf@sh@ns@current subpath start\endcsname{coordinate}% +\expandafter\def\csname pgf@sh@ns@current subpath start\endcsname{coordinate} \expandafter\def\csname pgf@sh@np@current subpath start\endcsname{% \def\centerpoint{\expandafter\pgfqpoint\pgfsyssoftpath@lastmoveto}% -}% -\expandafter\def\csname pgf@sh@nt@current subpath start\endcsname{{1}{0}{0}{1}{0pt}{0pt}}% -\expandafter\def\csname pgf@sh@pi@current subpath start\endcsname{\pgfpictureid}% +} +\expandafter\def\csname pgf@sh@nt@current subpath start\endcsname{{1}{0}{0}{1}{0pt}{0pt}} +\expandafter\def\csname pgf@sh@pi@current subpath start\endcsname{\pgfpictureid} % Special current bounding box rectangle: -\expandafter\def\csname pgf@sh@ns@current bounding box\endcsname{rectangle}% +\expandafter\def\csname pgf@sh@ns@current bounding box\endcsname{rectangle} \expandafter\def\csname pgf@sh@np@current bounding box\endcsname{% \def\southwest{\pgfqpoint{\pgf@picminx}{\pgf@picminy}}% \def\northeast{\pgfqpoint{\pgf@picmaxx}{\pgf@picmaxy}}% -}% -\expandafter\def\csname pgf@sh@nt@current bounding box\endcsname{{1}{0}{0}{1}{0pt}{0pt}}% -\expandafter\def\csname pgf@sh@pi@current bounding box\endcsname{\pgfpictureid}% +} +\expandafter\def\csname pgf@sh@nt@current bounding box\endcsname{{1}{0}{0}{1}{0pt}{0pt}} +\expandafter\def\csname pgf@sh@pi@current bounding box\endcsname{\pgfpictureid} % Special current path bounding box rectangle: -\expandafter\def\csname pgf@sh@ns@current path bounding box\endcsname{rectangle}% +\expandafter\def\csname pgf@sh@ns@current path bounding box\endcsname{rectangle} \expandafter\def\csname pgf@sh@np@current path bounding box\endcsname{% \def\southwest{\pgfqpoint{\pgf@pathminx}{\pgf@pathminy}}% \def\northeast{\pgfqpoint{\pgf@pathmaxx}{\pgf@pathmaxy}}% -}% -\expandafter\def\csname pgf@sh@nt@current path bounding box\endcsname{{1}{0}{0}{1}{0pt}{0pt}}% -\expandafter\def\csname pgf@sh@pi@current path bounding box\endcsname{\pgfpictureid}% +} +\expandafter\def\csname pgf@sh@nt@current path bounding box\endcsname{{1}{0}{0}{1}{0pt}{0pt}} +\expandafter\def\csname pgf@sh@pi@current path bounding box\endcsname{\pgfpictureid} % Special current page bounding box rectangle: -\expandafter\def\csname pgf@sh@ns@current page\endcsname{rectangle}% +\expandafter\def\csname pgf@sh@ns@current page\endcsname{rectangle} \expandafter\def\csname pgf@sh@np@current page\endcsname{% \def\southwest{\pgfpointorigin}% \def\northeast{\pgfpoint{\pgfsys@thepagewidth}{\pgfsys@thepageheight}}% -}% -\expandafter\def\csname pgf@sh@nt@current page\endcsname{{1}{0}{0}{1}{0pt}{0pt}}% -\expandafter\def\csname pgf@sh@pi@current page\endcsname{pgfpageorigin}% +} +\expandafter\def\csname pgf@sh@nt@current page\endcsname{{1}{0}{0}{1}{0pt}{0pt}} +\expandafter\def\csname pgf@sh@pi@current page\endcsname{pgfpageorigin} % Special scope bounding box rectangle: @@ -1137,15 +1137,15 @@ \noexpand\def\noexpand\southwest{\noexpand\pgfqpoint{\the\pgf@xa}{\the\pgf@ya}}% \noexpand\def\noexpand\northeast{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}% }% - }% - }, -}% + }% + } +} \def\pgf@lbb@do#1{% \ifdim\pgf@size@hook@x<\csname pgf@lbb@minx@#1\endcsname\expandafter\xdef\csname pgf@lbb@minx@#1\endcsname{\the\pgf@size@hook@x}\fi% \ifdim\pgf@size@hook@x>\csname pgf@lbb@maxx@#1\endcsname\expandafter\xdef\csname pgf@lbb@maxx@#1\endcsname{\the\pgf@size@hook@x}\fi% \ifdim\pgf@size@hook@y<\csname pgf@lbb@miny@#1\endcsname\expandafter\xdef\csname pgf@lbb@miny@#1\endcsname{\the\pgf@size@hook@y}\fi% \ifdim\pgf@size@hook@y>\csname pgf@lbb@maxy@#1\endcsname\expandafter\xdef\csname pgf@lbb@maxy@#1\endcsname{\the\pgf@size@hook@y}\fi% -}% +} % % Circle @@ -1155,30 +1155,30 @@ % % Draws a circle around the text % -{% +{ \savedanchor\centerpoint{% \pgf@x=.5\wd\pgfnodeparttextbox% \pgf@y=.5\ht\pgfnodeparttextbox% \advance\pgf@y by-.5\dp\pgfnodeparttextbox% - }% - + } + \saveddimen\radius{% - % - % Calculate ``height radius'' - % + % + % Caculate ``height radius'' + % \pgf@ya=.5\ht\pgfnodeparttextbox% \advance\pgf@ya by.5\dp\pgfnodeparttextbox% \pgfmathsetlength\pgf@yb{\pgfkeysvalueof{/pgf/inner ysep}}% \advance\pgf@ya by\pgf@yb% - % - % Calculate ``width radius'' - % + % + % Caculate ``width radius'' + % \pgf@xa=.5\wd\pgfnodeparttextbox% \pgfmathsetlength\pgf@xb{\pgfkeysvalueof{/pgf/inner xsep}}% \advance\pgf@xa by\pgf@xb% - % + % % Calculate length of radius vector: - % + % \pgf@process{\pgfpointnormalised{\pgfqpoint{\pgf@xa}{\pgf@ya}}}% \ifdim\pgf@x>\pgf@y% \c@pgf@counta=\pgf@x% @@ -1200,68 +1200,68 @@ \fi% \fi% \pgf@x=\pgf@xa% - % + % % If necessary, adjust radius so that the size requirements are - % met: - % - \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/minimum width}}% - \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/minimum height}}% + % met: + % + \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/minimum width}}% + \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/minimum height}}% \ifdim\pgf@x<.5\pgf@xb% \pgf@x=.5\pgf@xb% \fi% \ifdim\pgf@x<.5\pgf@yb% \pgf@x=.5\pgf@yb% \fi% - % - % Now, add larger of outer separations. - % - \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}% - \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}% + % + % Now, add larger of outer sepearations. + % + \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}% + \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}% \ifdim\pgf@xb<\pgf@yb% \advance\pgf@x by\pgf@yb% \else% \advance\pgf@x by\pgf@xb% \fi% - }% + } % % Anchors - % - \anchor{center}{\centerpoint}% - \anchor{mid}{\centerpoint\pgfmathsetlength\pgf@y{.5ex}}% - \anchor{base}{\centerpoint\pgf@y=0pt}% - \anchor{north}{\centerpoint\advance\pgf@y by\radius}% - \anchor{south}{\centerpoint\advance\pgf@y by-\radius}% - \anchor{west}{\centerpoint\advance\pgf@x by-\radius}% - \anchor{east}{\centerpoint\advance\pgf@x by\radius}% - \anchor{mid west}{\centerpoint\advance\pgf@x by-\radius\pgfmathsetlength\pgf@y{.5ex}}% - \anchor{mid east}{\centerpoint\advance\pgf@x by\radius\pgfmathsetlength\pgf@y{.5ex}}% - \anchor{base west}{\centerpoint\advance\pgf@x by-\radius\pgf@y=0pt}% - \anchor{base east}{\centerpoint\advance\pgf@x by\radius\pgf@y=0pt}% + % + \anchor{center}{\centerpoint} + \anchor{mid}{\centerpoint\pgfmathsetlength\pgf@y{.5ex}} + \anchor{base}{\centerpoint\pgf@y=0pt} + \anchor{north}{\centerpoint\advance\pgf@y by\radius} + \anchor{south}{\centerpoint\advance\pgf@y by-\radius} + \anchor{west}{\centerpoint\advance\pgf@x by-\radius} + \anchor{east}{\centerpoint\advance\pgf@x by\radius} + \anchor{mid west}{\centerpoint\advance\pgf@x by-\radius\pgfmathsetlength\pgf@y{.5ex}} + \anchor{mid east}{\centerpoint\advance\pgf@x by\radius\pgfmathsetlength\pgf@y{.5ex}} + \anchor{base west}{\centerpoint\advance\pgf@x by-\radius\pgf@y=0pt} + \anchor{base east}{\centerpoint\advance\pgf@x by\radius\pgf@y=0pt} \anchor{north west}{ \centerpoint \pgf@xa=\radius \advance\pgf@x by-0.707107\pgf@xa \advance\pgf@y by0.707107\pgf@xa - }% + } \anchor{south west}{ \centerpoint \pgf@xa=\radius \advance\pgf@x by-0.707107\pgf@xa \advance\pgf@y by-0.707107\pgf@xa - }% + } \anchor{north east}{ \centerpoint \pgf@xa=\radius \advance\pgf@x by0.707107\pgf@xa \advance\pgf@y by0.707107\pgf@xa - }% + } \anchor{south east}{ \centerpoint \pgf@xa=\radius \advance\pgf@x by0.707107\pgf@xa \advance\pgf@y by-0.707107\pgf@xa - }% + } \anchorborder{ \pgf@xa=\pgf@x% \pgf@ya=\pgf@y% @@ -1276,23 +1276,23 @@ \centerpoint% \advance\pgf@x by\pgf@xa% \advance\pgf@y by\pgf@ya% - }% + } % % Background path % \backgroundpath{% \pgfutil@tempdima=\radius% - \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}% - \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}% + \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}% + \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}% \ifdim\pgf@xb<\pgf@yb% \advance\pgfutil@tempdima by-\pgf@yb% \else% \advance\pgfutil@tempdima by-\pgf@xb% \fi% \pgfpathcircle{\centerpoint}{\pgfutil@tempdima}% - }% -}% + } +} diff --git a/Master/texmf-dist/tex/generic/pgf/modules/pgfmodulesnakes.code.tex b/Master/texmf-dist/tex/generic/pgf/modules/pgfmodulesnakes.code.tex index 9df6d309801..f87a884b417 100644 --- a/Master/texmf-dist/tex/generic/pgf/modules/pgfmodulesnakes.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/modules/pgfmodulesnakes.code.tex @@ -11,7 +11,7 @@ \pgfwarning{Snakes have been superseded by decorations. Use the module decorations instead of snakes} -\usepgfmodule{decorations}% +\usepgfmodule{decorations} \endinput @@ -58,7 +58,7 @@ \let\state=\pgf@snake@state #3 \let\state=\pgf@orig@state% -}% +} % Sets the additional transformation applied to every segment of a snake @@ -69,8 +69,8 @@ % % \pgfsetsnakesegmenttransformation{\pgftransformyshift{5pt}} -\def\pgfsetsnakesegmenttransformation#1{\def\pgf@snakeadditionaltransform{#1}}% -\pgfsetsnakesegmenttransformation{}% +\def\pgfsetsnakesegmenttransformation#1{\def\pgf@snakeadditionaltransform{#1}} +\pgfsetsnakesegmenttransformation{} % Declares a new state @@ -96,11 +96,11 @@ % \pgfpathlineto{\pgfpoint{10pt}{0pt}} % } -\def\pgf@snake@state#1{\pgfutil@ifnextchar[{\pgf@@snake@start#1}{\pgf@@snake@start#1[]}}%}% +\def\pgf@snake@state#1{\pgfutil@ifnextchar[{\pgf@@snake@start#1}{\pgf@@snake@start#1[]}}%} \def\pgf@@snake@start#1[#2]#3{% \pgfutil@namedef{pgf@snake@@\pgf@snake@name @#1@options}{#2}% \pgfutil@namedef{pgf@snake@@\pgf@snake@name @#1@code}{#3}% -}% +} @@ -131,8 +131,8 @@ % MW: Calculate the angle of the snake. % \edef\pgf@marshal{% - \noexpand\pgfmathanglebetweenpoints{\noexpand\pgfpointorigin}{% - \noexpand\pgf@x\the\pgf@x\noexpand\pgf@y\the\pgf@y}% + \noexpand\pgfmathanglebetweenpoints{\noexpand\pgfpointorigin}{% + \noexpand\pgf@x\the\pgf@x\noexpand\pgf@y\the\pgf@y}% }% \pgf@marshal% \let\pgfsnakeangle\pgfmathresult% @@ -194,7 +194,7 @@ \fi% }% \endgroup% -}% +} \def\pgf@snake@invoke#1#2{% \pgfmathsetlength\pgf@xa{#2}% @@ -204,7 +204,7 @@ }% \advance\pgfsnakecompleteddistance by\pgf@xa% \advance\pgfsnakeremainingdistance by-\pgf@xa% -}% +} % Use a snake % @@ -212,13 +212,13 @@ % #2 = point to which the snake leads % % This operation mainly computes \pgfpathsnakealongvector for a vector -% appropriately chosen. See \pgfpathsnakealongvector for details. +% appropriately choosen. See \pgfpathsnakealongvector for details. % % Example: % % \pgfpathsnaketo{zig zag}{\pgfpoint{2cm}{3cm}} -\def\pgfpathsnaketo#1#2{\pgfpathsnakesto{{#1}{\pgfsnakeremainingdistance}}{#2}}% +\def\pgfpathsnaketo#1#2{\pgfpathsnakesto{{#1}{\pgfsnakeremainingdistance}}{#2}} @@ -240,7 +240,7 @@ % translated by the width of the path element as specified in the % width option of the path element. The dimensions % \pgfsnakeremainingdistance and \pgfsnakecompleteddistance are -% updated. +% updated. % % The process ends when the state `final' is entered. The code of the % final state is executed and the process stops. @@ -251,7 +251,7 @@ \def\pgfpathsnakealongvector#1#2#3{% \pgfutil@ifundefined{pgf@snake@@#1@initial}{\pgferror{Undefined snake ``#1''}} - { + { \begingroup% keep things local \pgftransformreset% \pgf@pt@x=\pgf@path@lastx% evil trickery to transform to the last point @@ -267,8 +267,8 @@ {\pgfpointorigin}% % Now, setup the automaton \expandafter\let\expandafter\pgf@snake@current@state\expandafter=\csname pgf@snake@@#1@initial\endcsname% - \def\pgf@snake@name{#1}% - \pgfsnakecompleteddistance=0pt% + \def\pgf@snake@name{#1}% + \pgfsnakecompleteddistance=0pt% \pgfmathsetlength\pgfsnakeremainingdistance{#2}% \pgf@snake@run% % Last step: @@ -279,17 +279,17 @@ }% \endgroup% }% -}% +} -\def\pgf@final@text{final}% +\def\pgf@final@text{final} \def\pgf@snake@run{% \let\pgf@snake@next=\pgf@snake@do@state% \ifx\pgf@snake@current@state\pgf@final@text% \let\pgf@snake@next=\relax% \fi% - \pgf@snake@next% -}% + \pgf@snake@next% +} \def\pgf@snake@do@state{% \let\pgf@snake@next=\relax% @@ -301,10 +301,10 @@ \let\pgf@snake@next=\pgf@snake@do@code% \fi% \pgf@snake@next% -}% +} \def\pgf@snakes@setter{% \pgfqkeys{/pgf/snakes}% -}% +} \def\pgf@snake@do@code{% % Ok, execute code: @@ -320,13 +320,13 @@ % Next iteration: \let\pgf@snake@current@state=\pgf@snake@next@state% \pgf@snake@run% -}% +} \pgfkeys{ /pgf/snakes/width/.code=\def\pgf@snake@width{#1}\pgf@snake@switch@if#1 to final\pgf@stop,% /pgf/snakes/switch if less than/.code=\pgf@snake@switch@if#1\pgf@stop,% /pgf/snakes/next state/.store in=\pgf@snake@next@state% -}% +} \def\pgf@snake@switch@if#1to #2\pgf@stop{% \ifx\pgf@snake@next\relax% @@ -336,7 +336,7 @@ \let\pgf@snake@next=\pgf@snake@run% \fi% \fi% -}% +} @@ -346,10 +346,10 @@ % in conjunction with other snakes. \pgfdeclaresnake{lineto}{final} -{% +{ \state{final} { \pgfpathlineto{\pgfqpoint{\pgfsnakeremainingdistance}{0pt}} } -}% +} @@ -359,10 +359,10 @@ % useful in conjunction with other snakes. \pgfdeclaresnake{moveto}{final} -{% +{ \state{final} { \pgfpathmoveto{\pgfqpoint{\pgfsnakeremainingdistance}{0pt}} } -}% +} diff --git a/Master/texmf-dist/tex/generic/pgf/modules/pgfmodulesorting.code.tex b/Master/texmf-dist/tex/generic/pgf/modules/pgfmodulesorting.code.tex index e22bdb09910..497ea8591e8 100644 --- a/Master/texmf-dist/tex/generic/pgf/modules/pgfmodulesorting.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/modules/pgfmodulesorting.code.tex @@ -39,18 +39,18 @@ \expandafter\global\expandafter\let\csname pgf@sort@\the\c@pgf@counta\endcsname\pgfutil@empty% \advance\c@pgf@counta by1\relax% \pgfutil@repeat -}% +} % Insert code into some bucket -% +% % #1 = the bucket % #2 = the code -% -\def\pgfsortinginsert#1#2{ +% +\def\pgfsortinginsert#1#1{ \expandafter\let\expandafter\pgf@temp\csname pgf@lib@sort@#1\endcsname% \expandafter\def\expandafter\pgf@temp\expandafter{\pgf@temp#2}% \expandafter\global\expandafter\let\csname pgf@lib@sort@\the\c@pgf@counta\endcsname\pgf@temp% -}% +} % After all code has been inserted into the buckets, you can call @@ -63,7 +63,7 @@ \csname pgf@lib@sort@\the\c@pgf@counta\endcsname% \advance\c@pgf@counta by1\relax% \pgfutil@repeat -}% +} \endinput diff --git a/Master/texmf-dist/tex/generic/pgf/pgf.revision.tex b/Master/texmf-dist/tex/generic/pgf/pgf.revision.tex index b5e4b45877d..2b61a8acd12 100644 --- a/Master/texmf-dist/tex/generic/pgf/pgf.revision.tex +++ b/Master/texmf-dist/tex/generic/pgf/pgf.revision.tex @@ -5,10 +5,10 @@ \catcode`\:=12 \catcode`\+=12 \catcode`\-=12 -\gdef\pgfrevision{3.1.2} -\gdef\pgfversion{3.1.2} -\gdef\pgfversiondatetime{2019-04-04 18:08:08 +0200} -\gdef\pgfrevisiondatetime{2019-04-04 18:08:08 +0200} +\gdef\pgfrevision{3.1.1} +\gdef\pgfversion{3.1.1} +\gdef\pgfversiondatetime{2019-02-02 11:36:49 +0100} +\gdef\pgfrevisiondatetime{2019-02-02 11:36:49 +0100} \gdef\pgf@glob@TMPa#1-#2-#3 #4\relax{#1/#2/#3} \xdef\pgfversiondate{\expandafter\pgf@glob@TMPa\pgfversiondatetime\relax} \xdef\pgfrevisiondate{\expandafter\pgf@glob@TMPa\pgfrevisiondatetime\relax} diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgf.cfg b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgf.cfg index 5f7a34c8372..01ae33272e7 100644 --- a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgf.cfg +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgf.cfg @@ -27,7 +27,7 @@ % Alternatively, use one of the above commands in your own files. \endinput - -%%% Local Variables: + +%%% Local Variables: %%% mode: latex -%%% End: +%%% End: diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-pdf-via-dvi.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-pdf-via-dvi.def index c1744bae02c..1ba7515684b 100644 --- a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-pdf-via-dvi.def +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-pdf-via-dvi.def @@ -34,10 +34,9 @@ /Extend [false false] >> >> >>}}}\@temp% << \pgfutil@insertatbegincurrentpage{\special{pdf: content /Sh sh}% \special{pdf: endxobj}}% - \xdef\pgfutil@tempa{% - \hbox to\the\pgf@max{\vbox to#2{\vfil\special{pdf: usexobj @pgfshade#1}}\hfil}}% + \expandafter\xdef\csname @pgfshading#1!\endcsname{% + \hbox to\the\pgf@max{\vbox to#2{\vfil\special{pdf: usexobj @pgfshade#1}}\hfil}}% }% - \expandafter\let\csname @pgfshading#1!\endcsname=\pgfutil@tempa } \def\pgfsys@vertshading#1#2#3{% {% @@ -53,10 +52,9 @@ /Extend [false false] >> >> >>}}}\@temp% << \pgfutil@insertatbegincurrentpage{\special{pdf: content /Sh sh}% \special{pdf: endxobj}}% - \xdef\pgfutil@tempa{% - \hbox to#2{\vbox to\the\pgf@max{\vfil\special{pdf: usexobj @pgfshade#1}}\hfil}}% + \expandafter\xdef\csname @pgfshading#1!\endcsname{% + \hbox to#2{\vbox to\the\pgf@max{\vfil\special{pdf: usexobj @pgfshade#1}}\hfil}}% }% - \expandafter\let\csname @pgfshading#1!\endcsname=\pgfutil@tempa } \def\pgfsys@radialshading#1#2#3{% {% @@ -82,10 +80,9 @@ /Extend [true false] >> >> >>}}}\@temp% << \pgfutil@insertatbegincurrentpage{\special{pdf: content /Sh sh}% \special{pdf: endxobj}}% - \xdef\pgfutil@tempa{% - \hbox to\the\pgfutil@tempdima{\vbox to\the\pgfutil@tempdima{\vfil\special{pdf: usexobj @pgfshade#1}}\hfil}}% + \expandafter\xdef\csname @pgfshading#1!\endcsname{% + \hbox to\the\pgfutil@tempdima{\vbox to\the\pgfutil@tempdima{\vfil\special{pdf: usexobj @pgfshade#1}}\hfil}}% }% - \expandafter\let\csname @pgfshading#1!\endcsname=\pgfutil@tempa }% \def\pgf@sys@pdf@dvi@tracker{ @@ -126,15 +123,15 @@ \pgf@sys@pdf@any@resourcesfalse% \ifpgf@sys@pdf@extgs@exists% \pgf@sys@pdf@any@resourcestrue% - \ifpgf@sys@pdf@extgs@created \else \special{pdf: obj @pgfextgs <<>>} \global\pgf@sys@pdf@extgs@createdtrue \fi% << + \ifpgf@sys@pdf@extgs@created \else \special{pdf: obj @pgfextgs <<>>} \global\pgf@sys@pdf@extgs@createdtrue \fi% << \fi% \ifpgf@sys@pdf@colorspaces@exists% \pgf@sys@pdf@any@resourcestrue% - \ifpgf@sys@pdf@colorspaces@created \else \special{pdf: obj @pgfcolorspaces <<>>} \global\pgf@sys@pdf@colorspaces@createdtrue \fi% << + \ifpgf@sys@pdf@colorspaces@created \else \special{pdf: obj @pgfcolorspaces <<>>} \global\pgf@sys@pdf@colorspaces@createdtrue \fi% << \fi% \ifpgf@sys@pdf@patterns@exists% \pgf@sys@pdf@any@resourcestrue% - \ifpgf@sys@pdf@patterns@created \else \special{pdf: obj @pgfpatterns <<>>} \global\pgf@sys@pdf@patterns@createdtrue \fi% << + \ifpgf@sys@pdf@patterns@created \else \special{pdf: obj @pgfpatterns <<>>} \global\pgf@sys@pdf@patterns@createdtrue \fi% << \fi% \ifpgf@sys@pdf@any@resources% \special{pdf: put @resources << @@ -162,6 +159,6 @@ \endinput -%%% Local Variables: +%%% Local Variables: %%% mode: latex -%%% End: +%%% End: diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-pdf.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-pdf.def index c70f3ef2b7f..ccac27335a3 100644 --- a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-pdf.def +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-pdf.def @@ -70,14 +70,14 @@ \expandafter\gdef\csname pgf@sys@pdf@so@#1\endcsname{/pgf@CA#1}% \pgfutil@addpdfresource@extgs{/pgf@CA#1 << /CA #1 >>}%<< \fi% - \pgfsysprotocol@literal{\csname pgf@sys@pdf@so@#1\endcsname\space gs}% + \pgfsysprotocol@literal{\csname pgf@sys@pdf@so@#1\endcsname\space gs}% } \def\pgfsys@fill@opacity#1{% \expandafter\ifx\csname pgf@sys@pdf@fo@#1\endcsname\relax% \expandafter\gdef\csname pgf@sys@pdf@fo@#1\endcsname{/pgf@ca#1}% \pgfutil@addpdfresource@extgs{/pgf@ca#1 << /ca #1 >>}%<< \fi% - \pgfsysprotocol@literal{\csname pgf@sys@pdf@fo@#1\endcsname\space gs}% + \pgfsysprotocol@literal{\csname pgf@sys@pdf@fo@#1\endcsname\space gs}% } % Blending @@ -92,7 +92,7 @@ \edef\pgf@temp{/pgf@bm\pgf@temp << /BM [ /\pgf@temp ] >>}%<< \expandafter\pgfutil@addpdfresource@extgs\expandafter{\pgf@temp}% \fi% - \pgfsysprotocol@literal{\csname pgf@sys@pdf@bm@#1\endcsname\space gs}% + \pgfsysprotocol@literal{\csname pgf@sys@pdf@bm@#1\endcsname\space gs}% } \expandafter\def\csname pgf@sys@pdf@blend@mode@map@normal\endcsname{Normal} \expandafter\def\csname pgf@sys@pdf@blend@mode@map@multiply\endcsname{Multiply} @@ -114,6 +114,6 @@ \endinput -%%% Local Variables: +%%% Local Variables: %%% mode: latex -%%% End: +%%% End: diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-postscript.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-postscript.def index 81d4527146d..0f8ce5d0157 100644 --- a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-postscript.def +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-postscript.def @@ -191,7 +191,7 @@ \pgf@sys@bp@correct{\pgf@x}% \pgf@y=\pgf@max% \pgf@sys@bp@correct{\pgf@y}% - \xdef\pgfutil@tempa{\hbox to \the\pgf@max{% + \expandafter\xdef\csname @pgfshading#1!\endcsname{\hbox to \the\pgf@max{% \noexpand\vrule width0pt height\the\pgf@xa% \noexpand\pgfsys@beginpurepicture% \noexpand\pgfsys@rect{0pt}{0pt}{\the\pgf@max}{\the\pgf@xa}% @@ -201,7 +201,6 @@ \hss% \noexpand\pgfsys@endpurepicture}}% }% - \expandafter\let\csname @pgfshading#1!\endcsname=\pgfutil@tempa } \def\pgfsys@vertshading#1#2#3{% {% @@ -211,7 +210,7 @@ \pgf@sys@bp@correct{\pgf@x}% \pgf@y=\pgf@max% \pgf@sys@bp@correct{\pgf@y}% - \xdef\pgfutil@tempa{\hbox to \the\pgf@max{% + \expandafter\xdef\csname @pgfshading#1!\endcsname{\hbox to\the\pgf@xa{% \noexpand\vrule width0pt height\the\pgf@max% \noexpand\pgfsys@beginpurepicture% \noexpand\pgfsys@rect{0pt}{0pt}{\the\pgf@xa}{\the\pgf@max}% @@ -221,7 +220,6 @@ \hss% \noexpand\pgfsys@endpurepicture}}% }% - \expandafter\let\csname @pgfshading#1!\endcsname=\pgfutil@tempa } \def\pgfsys@radialshading#1#2#3{% {% @@ -233,7 +231,7 @@ \pgf@sys@bp@correct{\pgf@max}% \advance\pgf@x by \pgf@max% \advance\pgf@y by \pgf@max% - \xdef\pgfutil@tempa{\hbox to \the\pgf@max{% + \expandafter\xdef\csname @pgfshading#1!\endcsname{\hbox to \the\pgf@xa{% \noexpand\vrule width0pt height\the\pgf@xa% \noexpand\pgfsys@beginpurepicture% \noexpand\pgfsys@invoke{% @@ -242,7 +240,6 @@ \hss% \noexpand\pgfsys@endpurepicture}}% }% - \expandafter\let\csname @pgfshading#1!\endcsname=\pgfutil@tempa } \def\pgfsys@functionalshading#1#2#3#4{% {% @@ -260,13 +257,13 @@ \pgf@sys@bp@correct{\pgf@yb}% \pgf@xc=-\pgf@xa% \pgf@yc=-\pgf@ya% - \xdef\pgfutil@tempa{% + \expandafter\xdef\csname @pgfshading#1!\endcsname{% \hbox to\the\pgf@x{\vbox to\the\pgf@y{\vfil \noexpand\pgfsys@beginpurepicture% \noexpand\pgfsys@invoke{% \pgf@sys@tonumber{\pgf@xc} \pgf@sys@tonumber{\pgf@yc} translate 1.1 setlinewidth [] 0 setdash 0 setlinecap - /pgfproc {#4} bind def + /pgfproc {#4} bind def \pgf@sys@tonumber{\pgf@ya} 1 \pgf@sys@tonumber{\pgf@yb} { \pgf@sys@tonumber{\pgf@xa} 1 \pgf@sys@tonumber{\pgf@xb} @@ -274,13 +271,12 @@ for pop } - for + for }% \noexpand\pgfsys@endpurepicture }\hfil}% }% }% - \expandafter\let\csname @pgfshading#1!\endcsname=\pgfutil@tempa } % @@ -291,7 +287,7 @@ \def\pgfsys@declarepattern#1#2#3#4#5#6#7#8#9{% % Start building the pattern dictionary: \pgf@xa=#2\relax% - \pgf@ya=#3\relax% + \pgf@ya=#3\relax% \pgf@xb=#4\relax% \pgf@yb=#5\relax% \pgf@xc=#6\relax% @@ -354,13 +350,13 @@ /pgfheight exch def 0.75 setlinewidth [] 0 setdash /pgfshade {pgfA} def /pgfdir { dup 0 moveto dup 5 index lineto } bind def} bind def}% - + % Parameters to vertical pre axishade: \pgf@domb x \pgf@sys@postscript@header{/pgfV{% /pgfheight exch def 0.75 setlinewidth [] 0 setdash /pgfshade {pgfA} def /pgfdir { dup 0 exch moveto dup 5 index exch lineto } bind def} bind def}% - + % Parameters to axishade: end x, start x, r-, g-, b- of first color, r-, g-, b- of second color % Stack afterwards: end x \pgf@sys@postscript@header{/pgfA{ @@ -377,7 +373,7 @@ 4 -1 roll 6 index add % green += incgreen 4 -1 roll 5 index add % blue += incblue 4 -1 roll .5 sub % x += 0.5 - } repeat + } repeat mark 15 1 roll cleartomark exch pop % leave only start x on stack }bind def } @@ -397,7 +393,7 @@ }bind def } % Parameters to radialshade post: \pgf@firstcolor \pgf@doma - \pgf@sys@postscript@header{/pgfR2{ + \pgf@sys@postscript@header{/pgfR2{ newpath 0.5 add pgfcircx pgfcircy 3 2 roll 0 360 arc setrgbcolor fill pop}bind def }% @@ -425,7 +421,7 @@ 4 -1 roll .25 sub % x += 0.25 /pgfcircx pgfcircx pgfxstep add def /pgfcircy pgfcircy pgfystep add def - } repeat + } repeat mark 14 1 roll cleartomark exch pop % leave only start x on stack }bind def} } @@ -433,6 +429,6 @@ \endinput -%%% Local Variables: +%%% Local Variables: %%% mode: latex -%%% End: +%%% End: diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-svg.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-svg.def index ec8a7c2b827..4986feaa46e 100644 --- a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-svg.def +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-common-svg.def @@ -81,7 +81,7 @@ \ifx\pgfsys@anim@ba@markerend\pgfutil@empty\else% marker-end="url(\#\pgfsys@anim@ba@markerend)" % \fi% - \fi% + \fi% #1/>\pgfsys@svg@newline }% \pgf@sys@svg@gs{clip-path="url(\#\pgfsys@if@fresh@currentid{\pgfsys@id@refcurrent}{pgfcp\the\pgf@sys@svg@objectcount}clip)"} \pgf@sys@svg@clipnextfalse% @@ -96,7 +96,7 @@ \ifx\pgfsys@anim@ba@markerend\pgfutil@empty\else% marker-end="url(\#\pgfsys@anim@ba@markerend)" % \fi% - \fi% + \fi% #1/>\pgfsys@svg@newline }% \fi% \pgfsys@invalidate@currentid% @@ -154,7 +154,7 @@ \else% \pgf@sys@svg@gs{transform="translate(\pgf@sys@tonumber{\pgf@x},\pgf@sys@tonumber{\pgf@y})"}% \fi% - \else% + \else% \pgf@sys@svg@gs{transform="matrix(#1,#2,#3,#4,\pgf@sys@tonumber{\pgf@x},\pgf@sys@tonumber{\pgf@y})"}% \fi}} \def\pgfsys@transformshift#1#2{% @@ -234,7 +234,7 @@ \advance\pgf@sys@svg@scopecount by-1\relax% \repeat% \endgroup% - \global\pgf@sys@svg@scopecount=\pgf@sys@svg@thescopecount\relax% + \global\pgf@sys@svg@scopecount=\pgf@sys@svg@thescopecount\relax% } \newif\ifpgfsys@svg@close@strokenone \def\pgfsys@begin@idscope{% @@ -284,7 +284,7 @@ \expandafter\xdef\csname pgf@sys@svg@lookup@#2\endcsname{t\the\pgf@sys@svg@type@count}% \expandafter\let\expandafter#1\csname pgf@sys@svg@lookup@#2\endcsname% \fi% -} +} @@ -329,11 +329,11 @@ % % Color management -% +% \def\pgf@sys@svg@rgb@to@hash#1#2#3{% {% - \pgf@sys@svg@do@color{#1}% + \pgf@sys@svg@do@color{#1}% \let\pgf@sys@svg@ra\pgf@sys@svg@hex@first% \let\pgf@sys@svg@rb\pgf@sys@svg@hex@second% \pgf@sys@svg@do@color{#2}% @@ -589,7 +589,7 @@ \pgf@sys@svg@shading@stops% \pgf@sys@svg@addtostops{</linearGradient>\noexpand\pgfsys@svg@newline}% \pgf@process{\pgfpoint{\pgf@sys@shading@end@pos}{#2}}% - \xdef\pgfutil@tempa{% + \expandafter\xdef\csname @pgfshading#1!\endcsname{% \def\noexpand\pgf@sys@svg@sh@defs{\noexpand\pgfsysprotocol@literal{\pgf@sys@svg@thestops}}% \def\noexpand\pgf@sys@svg@sh{\noexpand\pgfsysprotocol@literal{<rect width="\pgf@sys@tonumber{\pgf@x}" @@ -599,7 +599,6 @@ \def\noexpand\pgf@sys@svg@pos{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}% }% }% - \expandafter\let\csname @pgfshading#1!\endcsname=\pgfutil@tempa } \def\pgfsys@functionalshading#1#2#3#4{% @@ -621,7 +620,7 @@ \pgf@sys@svg@shading@stops% \pgf@sys@svg@addtostops{</linearGradient>\noexpand\pgfsys@svg@newline}% \pgf@process{\pgfpoint{\pgf@sys@shading@end@pos}{#2}}% - \xdef\pgfutil@tempa{% + \expandafter\xdef\csname @pgfshading#1!\endcsname{% \def\noexpand\pgf@sys@svg@sh@defs{\noexpand\pgfsysprotocol@literal{\pgf@sys@svg@thestops}}% \def\noexpand\pgf@sys@svg@sh{\noexpand\pgfsysprotocol@literal{<rect width="\pgf@sys@tonumber{\pgf@y}" @@ -631,7 +630,6 @@ \def\noexpand\pgf@sys@svg@pos{\noexpand\pgfpoint{\the\pgf@y}{\the\pgf@x}}% }% }% - \expandafter\let\csname @pgfshading#1!\endcsname=\pgfutil@tempa } \def\pgfsys@radialshading#1#2#3{% @@ -657,8 +655,8 @@ \pgf@sys@svg@shading@stops% \pgf@sys@svg@addtostops{</radialGradient>\noexpand\pgfsys@svg@newline}% \pgf@xa=\pgf@sys@shading@end@pos% - \pgf@xb=2\pgf@xa% - \xdef\pgfutil@tempa{% + \pgf@xb=2\pgf@xa% + \expandafter\xdef\csname @pgfshading#1!\endcsname{% \def\noexpand\pgf@sys@svg@sh@defs{\noexpand\pgfsysprotocol@literal{\pgf@sys@svg@thestops}}% \def\noexpand\pgf@sys@svg@sh{\noexpand\pgfsysprotocol@literal{<circle cx="\pgf@sys@tonumber{\pgf@xa}" @@ -669,7 +667,6 @@ \def\noexpand\pgf@sys@svg@pos{\noexpand\pgfpoint{\the\pgf@xb}{\the\pgf@xb}}% }% }% - \expandafter\let\csname @pgfshading#1!\endcsname=\pgfutil@tempa } @@ -678,7 +675,7 @@ \def\pgfsys@declarepattern#1#2#3#4#5#6#7#8#9{% % Start building the pattern dictionary: \pgf@xa=#2\relax% - \pgf@ya=#3\relax% + \pgf@ya=#3\relax% \pgf@xb=#4\relax% \pgf@yb=#5\relax% \pgf@xc=#6\relax% @@ -796,7 +793,7 @@ } \def\pgf@sys@svg@do@event#1#2#3#4{% \pgf@sys@at@least@one@eventtrue% - % + % {% \edef\pgf@temp{#1}% \ifx\pgf@temp\pgfutil@empty% @@ -819,7 +816,7 @@ \edef\pgf@@temp{ +\pgf@sys@tonumber\pgf@x s}% \fi% \xdef\pgf@svg@anim@temp{\pgf@temp#3\pgf@@temp}% - }% + }% \pgf@sys@svg@append{\pgf@sys@event@target}{\pgf@svg@anim@temp}% \global\let\pgf@svg@anim@temp\relax% \pgf@sys@svg@do@events@now% @@ -878,7 +875,7 @@ \let\pgf@sys@svg@add@code\pgfutil@empty% % % Setup markers: - % + % % Setup start \ifx\pgf@svg@anim@marker@start\pgfutil@empty% \let\pgf@sys@svg@marker@id@start\pgfutil@empty% @@ -948,7 +945,7 @@ \pgf@sys@svg@key{fill}% \pgf@sys@svg@key{begin}% \pgf@sys@svg@key{end}% - \pgf@sys@svg@key{xlink:href} + \pgf@sys@svg@key{xlink:href} from="\ifx\pgf@svg@anim@marker@start\pgfutil@empty none\else url(\#\pgf@sys@svg@marker@id@start)\fi" to="\ifx\pgf@svg@anim@marker@start\pgfutil@empty none\else url(\#\pgf@sys@svg@marker@id@start)\fi" />\pgfsys@svg@newline% @@ -960,7 +957,7 @@ \pgf@sys@svg@key{fill}% \pgf@sys@svg@key{begin}% \pgf@sys@svg@key{end}% - \pgf@sys@svg@key{xlink:href} + \pgf@sys@svg@key{xlink:href} from="\ifx\pgf@svg@anim@marker@end\pgfutil@empty none\else url(\#\pgf@sys@svg@marker@id@end)\fi" to="\ifx\pgf@svg@anim@marker@end\pgfutil@empty none\else url(\#\pgf@sys@svg@marker@id@end)\fi" />\pgfsys@svg@newline% @@ -1113,7 +1110,7 @@ \else% \edef\pgf@svg@anim@temp@{\pgf@svg@anim@temp@;#2}% \expandafter\let\csname pgfsys@anim@val@#1\endcsname\pgf@svg@anim@temp@% - \fi\fi% + \fi\fi% } % The actual animate command @@ -1315,7 +1312,7 @@ \expandafter\expandafter\expandafter\def% \expandafter\expandafter\expandafter\pgf@sys@svg@tl@entries% \expandafter\expandafter\expandafter{\expandafter\pgf@sys@svg@tl@entries\pgf@sys@svg@temp}% - \fi% + \fi% \let\pgf@sys@svg@tl@end\pgf@sys@svg@t% \edef\pgf@sys@svg@last@value{#1}% \fi% @@ -1508,7 +1505,7 @@ \pgfsysprotocol@literal{<marker id="\pgf@sys@svg@marker@id" markerUnits="userSpaceOnUse" orient="auto" overflow="visible"> <use xlink:href="\#pgfs#1"#2/> </marker>\pgfsys@svg@newline}% \edef#3{marker-#4="url(\#\pgf@sys@svg@marker@id)" }% -} +} % @@ -1601,6 +1598,6 @@ \endinput -%%% Local Variables: +%%% Local Variables: %%% mode: latex -%%% End: +%%% End: diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvi.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvi.def index a6397752ff4..20ba5f0fdc7 100644 --- a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvi.def +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvi.def @@ -94,7 +94,7 @@ \ifdim\pgfutil@tempdima<0pt% \pgfutil@tempdima=-\pgfutil@tempdima% \fi% - \ifdim\pgfutil@tempdima>\pgfutil@tempdimb% + \ifdim\pgfutil@tempdima>\pgfutil@tempdimb% \pgfutil@tempdimb=\pgfutil@tempdima% \fi% \pgfutil@tempdima=\pgf@xb% @@ -102,7 +102,7 @@ \ifdim\pgfutil@tempdima<0pt% \pgfutil@tempdima=-\pgfutil@tempdima% \fi% - \ifdim\pgfutil@tempdima>\pgfutil@tempdimb% + \ifdim\pgfutil@tempdima>\pgfutil@tempdimb% \pgfutil@tempdimb=\pgfutil@tempdima% \fi% \pgfutil@tempdima=\pgf@yb% @@ -110,7 +110,7 @@ \ifdim\pgfutil@tempdima<0pt% \pgfutil@tempdima=-\pgfutil@tempdima% \fi% - \ifdim\pgfutil@tempdima>\pgfutil@tempdimb% + \ifdim\pgfutil@tempdima>\pgfutil@tempdimb% \pgfutil@tempdimb=\pgfutil@tempdima% \fi% \pgfutil@tempdima=\pgf@x% @@ -118,7 +118,7 @@ \ifdim\pgfutil@tempdima<0pt% \pgfutil@tempdima=-\pgfutil@tempdima% \fi% - \ifdim\pgfutil@tempdima>\pgfutil@tempdimb% + \ifdim\pgfutil@tempdima>\pgfutil@tempdimb% \pgfutil@tempdimb=\pgfutil@tempdima% \fi% \pgfutil@tempdima=\pgf@y% @@ -126,20 +126,20 @@ \ifdim\pgfutil@tempdima<0pt% \pgfutil@tempdima=-\pgfutil@tempdima% \fi% - \ifdim\pgfutil@tempdima>\pgfutil@tempdimb% + \ifdim\pgfutil@tempdima>\pgfutil@tempdimb% \pgfutil@tempdimb=\pgfutil@tempdima% \fi% \pgfutil@tempcnta=\pgfutil@tempdimb% \ifdim\pgf@sys@dvi@linewidth>0.3pt% \pgfutil@tempdimb=0.15pt% \else% - \ifdim\pgf@sys@dvi@linewidth<0.05pt% + \ifdim\pgf@sys@dvi@linewidth<0.05pt% \pgfutil@tempdimb=.025pt% \else% \pgfutil@tempdimb=.5\pgf@sys@dvi@linewidth% \fi% \fi% - \pgfutil@tempcntb=\pgfutil@tempdimb% + \pgfutil@tempcntb=\pgfutil@tempdimb% \divide\pgfutil@tempcnta by\pgfutil@tempcntb\relax% \ifnum\pgfutil@tempcnta>0\relax% \pgfutil@tempcntb=0\relax% @@ -156,7 +156,7 @@ }% \advance\pgfutil@tempcntb by1\relax \ifnum\pgfutil@tempcntb<\pgfutil@tempcnta% - {\def\pgf@time@t{1}\def\pgf@time@s{0}\pgf@sys@dvi@bezier}% + {\def\pgf@time@t{1}\def\pgf@time@s{0}\pgf@sys@dvi@bezier}% \repeat% \fi% }% @@ -331,7 +331,7 @@ \advance\pgf@y by-0.5\pgf@sys@dvi@linewidth% \pgf@sys@dvi@drawrect{\pgf@x}{\pgf@y}{\pgf@xb}{\pgf@sys@dvi@linewidth}% \else% - \ifdim\pgf@x=\pgf@xa% + \ifdim\pgf@x=\pgf@xa% % Ok, also easy... \pgf@yb=\pgf@ya% \advance\pgf@yb by-\pgf@y% @@ -342,7 +342,7 @@ \pgf@marshal% \fi% \fi% - }% + }% % Remember: \pgf@xc=#1\relax% \pgf@yc=#2\relax% @@ -389,6 +389,6 @@ \endinput -%%% Local Variables: +%%% Local Variables: %%% mode: latex -%%% End: +%%% End: diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvipdfm.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvipdfm.def index 939595089ad..cb545f2b66f 100644 --- a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvipdfm.def +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvipdfm.def @@ -47,7 +47,7 @@ \pgf@pt@x=0pt% \pgf@pt@y=0pt% \special{pdf: content q}% - \pgflowlevelsynccm% + \pgflowlevelsynccm% \pgfsys@invoke{q -1 0 0 -1 0 0 cm}% \special{pdf: content -1 0 0 -1 0 0 cm q}% translate to original coordinate system \pgfsys@invoke{0 J [] 0 d}% reset line cap and dash @@ -105,6 +105,6 @@ \endinput -%%% Local Variables: +%%% Local Variables: %%% mode: latex -%%% End: +%%% End: diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvipdfmx.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvipdfmx.def index 2077a2707b9..beadfff3bf1 100644 --- a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvipdfmx.def +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvipdfmx.def @@ -94,7 +94,7 @@ \pgfsys@dvipdfmx@start@force@reset@color% \pgf@sys@bp@correct\pgf@pt@x% \pgf@sys@bp@correct\pgf@pt@y% - \special{pdf:btrans matrix \pgf@pt@aa\space \pgf@pt@ab\space \pgf@pt@ba\space \pgf@pt@bb\space + \special{pdf:btrans matrix \pgf@pt@aa\space \pgf@pt@ab\space \pgf@pt@ba\space \pgf@pt@bb\space \pgf@sys@tonumber{\pgf@pt@x} \pgf@sys@tonumber{\pgf@pt@y}}% \box#1% \special{pdf:etrans}% @@ -130,10 +130,9 @@ >>}% \pgfsys@invoke{/Sh sh}% \special{pdf:exobj}}}\@tempa% << - \xdef\pgfutil@tempa{% + \expandafter\xdef\csname @pgfshading#1!\endcsname{% \hbox to\the\pgf@max{\vbox to\pgfmathresult pt{\vfil\special{pdf:uxobj @pgfshade\the\pgfsys@objnum}}\hfil}}% }% - \expandafter\let\csname @pgfshading#1!\endcsname=\pgfutil@tempa \global\advance\pgfsys@objnum\@ne% } \def\pgfsys@vertshading#1#2#3{% @@ -154,10 +153,9 @@ >>}% \pgfsys@invoke{/Sh sh}% \special{pdf:exobj}}}\@tempa% << - \xdef\pgfutil@tempa{% - \hbox to\pgfmathresult pt{\vbox to\the\pgf@max{\vfil\special{pdf:uxobj @pgfshade\the\pgfsys@objnum}}\hfil}}% + \expandafter\xdef\csname @pgfshading#1!\endcsname{% + \hbox to\pgfmathresult pt{\vbox to\the\pgf@max{\vfil\special{pdf:uxobj @pgfshade\the\pgfsys@objnum}}\hfil}}% }% - \expandafter\let\csname @pgfshading#1!\endcsname=\pgfutil@tempa \global\advance\pgfsys@objnum\@ne% } \def\pgfsys@radialshading#1#2#3{% @@ -187,10 +185,9 @@ >>}% \pgfsys@invoke{/Sh sh}% \special{pdf:exobj}}}\@tempa% << - \xdef\pgfutil@tempa{% - \hbox to\the\pgfutil@tempdima{\vbox to\the\pgfutil@tempdima{\vfil\special{pdf:uxobj @pgfshade\the\pgfsys@objnum}}\hfil}}% + \expandafter\xdef\csname @pgfshading#1!\endcsname{% + \hbox to\the\pgfutil@tempdima{\vbox to\the\pgfutil@tempdima{\vfil\special{pdf:uxobj @pgfshade\the\pgfsys@objnum}}\hfil}}% }% - \expandafter\let\csname @pgfshading#1!\endcsname=\pgfutil@tempa \global\advance\pgfsys@objnum\@ne% } \def\pgfsys@functionalshading#1#2#3#4{% @@ -223,10 +220,9 @@ /Function @pgfstream\the\pgfsys@objnum>> >> >>}% \pgfsys@invoke{/Sh sh}% \special{pdf:exobj}}}\@tempa% << - \xdef\pgfutil@tempa{% - \leavevmode\hbox to\the\pgf@x{\vbox to\the\pgf@y{\vfil\special{pdf:uxobj @pgfshade\the\pgfsys@objnum}}\hfil}}% + \expandafter\xdef\csname @pgfshading#1!\endcsname{% + \leavevmode\hbox to\the\pgf@x{\vbox to\the\pgf@y{\vfil\special{pdf:uxobj @pgfshade\the\pgfsys@objnum}}\hfil}}% }% - \expandafter\let\csname @pgfshading#1!\endcsname=\pgfutil@tempa \global\advance\pgfsys@objnum\@ne% } @@ -351,23 +347,23 @@ \pgf@sys@bp@correct\pgf@yc% % Now create the pattern object: \pgfsys@dvipdfmx@patternobj{% - \pgfsys@dvipdfmx@stream{@pgfpatternobject#1}{#8}{% - /Type /Pattern - /PatternType 1 - /PaintType \ifnum#9=0 2 \else 1 \fi - /TilingType 1 - /BBox [\pgf@sys@tonumber\pgf@xa\space\pgf@sys@tonumber\pgf@ya\space\pgf@sys@tonumber\pgf@xb\space\pgf@sys@tonumber\pgf@yb] - /XStep \pgf@sys@tonumber\pgf@xc\space - /YStep \pgf@sys@tonumber\pgf@yc\space - /Resources << >> %<< - }% + \pgfsys@dvipdfmx@stream{@pgfpatternobject#1}{#8}{% + /Type /Pattern + /PatternType 1 + /PaintType \ifnum#9=0 2 \else 1 \fi + /TilingType 1 + /BBox [\pgf@sys@tonumber\pgf@xa\space\pgf@sys@tonumber\pgf@ya\space\pgf@sys@tonumber\pgf@xb\space\pgf@sys@tonumber\pgf@yb] + /XStep \pgf@sys@tonumber\pgf@xc\space + /YStep \pgf@sys@tonumber\pgf@yc\space + /Resources << >> %<< + }% }% \pgfutil@addpdfresource@patterns{/pgfpat#1\space @pgfpatternobject#1}% } % hook for xdvipdfmx: \def\pgfsys@dvipdfmx@patternobj#1{% - #1% + #1% }% % hook for xdvipdfmx: @@ -497,6 +493,6 @@ \endinput -%%% Local Variables: +%%% Local Variables: %%% mode: latex -%%% End: +%%% End: diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvips.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvips.def index 4cb4d51b8b0..b349b07e2f3 100644 --- a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvips.def +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvips.def @@ -70,8 +70,8 @@ /pgfeofill{eofill}bind def% /pgfe{a dup 0 rlineto exch 0 exch rlineto neg 0 rlineto closepath}bind def% rectangle /pgfw{setlinewidth}bind def% setlinewidth - /pgfs{save pgfpd 72 Resolution div 72 VResolution div neg scale - magscale{1 DVImag div dup scale}if + /pgfs{save pgfpd 72 Resolution div 72 VResolution div neg scale + magscale{1 DVImag div dup scale}if pgfx neg pgfy neg translate pgffoa .setopacityalpha}bind def% save /pgfr{pgfsd restore}bind def %restore userdict begin% @@ -79,7 +79,7 @@ /pgfc{newpath @endspecial pgfpd}bind def %close /pgfsd{globaldict /pgfdelta /delta where {pop delta} {0} ifelse put}bind def% save delta /pgfpd{/delta globaldict /pgfdelta get def}bind def % put delta - /.setopacityalpha where {pop} {/.setopacityalpha{pop}def} ifelse % install .setopacityalpha + /.setopacityalpha where {pop} {/.setopacityalpha{pop}def} ifelse % install .setopacityalpha /.pgfsetfillopacityalpha{/pgffoa exch def /pgffill{gsave pgffoa .setopacityalpha fill 1 .setopacityalpha newpath fill grestore newpath}bind def /pgfeofill{gsave pgffoa .setopacityalpha eofill 1 .setopacityalpha newpath eofill grestore newpath}bind def}bind def @@ -140,6 +140,6 @@ \endinput -%%% Local Variables: +%%% Local Variables: %%% mode: latex -%%% End: +%%% End: diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvisvgm.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvisvgm.def index f817f508740..3acef85b177 100644 --- a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvisvgm.def +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-dvisvgm.def @@ -73,7 +73,7 @@ \pgf@sys@svg@sh% \pgfsys@endscope% \pgfsys@endpicture% - \hss% + \hss% }% \pgf@process{\pgf@sys@svg@pos}% \pgf@picminx=0pt% @@ -212,6 +212,6 @@ \endinput -%%% Local Variables: +%%% Local Variables: %%% mode: latex -%%% End: +%%% End: diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-luatex.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-luatex.def index aa04c30f37f..24fad51a342 100644 --- a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-luatex.def +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-luatex.def @@ -10,9 +10,9 @@ \ProvidesFileRCS{pgfsys-luatex.def} \ifnum\luatexversion<95 - \immediate\write-1{luatex driver of PGF: detected lua version \the\luatexversion; falling back to old pdftex driver^^J}% - \input pgfsys-pdftex.def - \expandafter\endinput + \immediate\write-1{luatex driver of PGF: detected lua version \the\luatexversion; falling back to old pdftex driver^^J}% + \input pgfsys-pdftex.def + \expandafter\endinput \fi % Driver commands for pdf @@ -36,7 +36,7 @@ \raise\pgf@pt@y\hbox{% \pgf@pt@x=0pt% \pgf@pt@y=0pt% - \pgflowlevelsynccm% + \pgflowlevelsynccm% \pgfsys@hbox#1}% \hss% }% @@ -92,9 +92,8 @@ /Coords [\pgf@doma\space0 \pgf@domb\space0] /Function \pgf@pdfparsedfunction /Extend [false false] >> >>}\pgfutil@tempboxa% << - \xdef\pgfutil@tempa{\leavevmode\noexpand\useboxresource\the\lastsavedboxresourceindex}% + \expandafter\xdef\csname @pgfshading#1!\endcsname{\leavevmode\noexpand\useboxresource\the\lastsavedboxresourceindex}% }% - \expandafter\let\csname @pgfshading#1!\endcsname=\pgfutil@tempa } \def\pgfsys@vertshading#1#2#3{% {% @@ -109,9 +108,8 @@ /Coords [0 \pgf@doma\space0 \pgf@domb] /Function \pgf@pdfparsedfunction /Extend [false false] >> >>}\pgfutil@tempboxa% << - \xdef\pgfutil@tempa{\leavevmode\noexpand\useboxresource\the\lastsavedboxresourceindex}% + \expandafter\xdef\csname @pgfshading#1!\endcsname{\leavevmode\noexpand\useboxresource\the\lastsavedboxresourceindex}% }% - \expandafter\let\csname @pgfshading#1!\endcsname=\pgfutil@tempa } \def\pgfsys@radialshading#1#2#3{% {% @@ -134,9 +132,8 @@ /Coords [\pgf@sys@tonumber{\pgf@xa} \pgf@sys@tonumber{\pgf@ya} \pgf@doma\space \pgf@sys@tonumber{\pgf@x} \pgf@sys@tonumber{\pgf@y} \pgf@domb] /Function \pgf@pdfparsedfunction /Extend [true false] >> >>}\pgfutil@tempboxa% << - \xdef\pgfutil@tempa{\leavevmode\noexpand\useboxresource\the\lastsavedboxresourceindex}% + \expandafter\xdef\csname @pgfshading#1!\endcsname{\leavevmode\noexpand\useboxresource\the\lastsavedboxresourceindex}% }% - \expandafter\let\csname @pgfshading#1!\endcsname=\pgfutil@tempa }% \def\pgfsys@functionalshading#1#2#3#4{% {% @@ -156,7 +153,7 @@ \pgf@xc=-\pgf@xa% \pgf@yc=-\pgf@ya% % Now build the function - \pdfextension obj + \pdfextension obj stream attr { @@ -171,15 +168,14 @@ /ColorSpace /DeviceRGB /Matrix [1 0 0 1 \pgf@sys@tonumber{\pgf@xc}\space\pgf@sys@tonumber{\pgf@yc}] /Domain [\pgf@sys@tonumber{\pgf@xa}\space\pgf@sys@tonumber{\pgf@xb}\space\pgf@sys@tonumber{\pgf@ya}\space\pgf@sys@tonumber{\pgf@yb}] - /Function \pgf@temp@num\space 0 R + /Function \pgf@temp@num\space 0 R >> >>}\pgfutil@tempboxa% << - \xdef\pgfutil@tempa{% + \expandafter\xdef\csname @pgfshading#1!\endcsname{% \leavevmode% \noexpand\useboxresource\the\lastsavedboxresourceindex% \noexpand\pdfextension refobj \pgf@temp@num% }% }% - \expandafter\let\csname @pgfshading#1!\endcsname=\pgfutil@tempa } @@ -189,7 +185,7 @@ \def\pgfsys@declarepattern#1#2#3#4#5#6#7#8#9{% % Start building the pattern dictionary: \pgf@xa=#2\relax% - \pgf@ya=#3\relax% + \pgf@ya=#3\relax% \pgf@xb=#4\relax% \pgf@yb=#5\relax% \pgf@xc=#6\relax% @@ -213,7 +209,7 @@ /YStep \pgf@sys@tonumber\pgf@yc\space /Resources << >> %<< } - {#8}% + {#8}% \pgfutil@addpdfresource@patterns{/pgfpat#1\space \the\numexpr\pdffeedback lastobj\relax\space 0 R}% } @@ -237,7 +233,7 @@ \def\pgfsys@declarepattern@meta#1#2#3#4#5#6#7{% % Start building the pattern dictionary: \pgf@xa=#2\relax% - \pgf@ya=#3\relax% + \pgf@ya=#3\relax% \pgf@xb=#4\relax% \pgf@yb=#5\relax% \pgf@xc=#6\relax% @@ -269,7 +265,7 @@ /Matrix [#2\space#3\space#4\space#5\space\pgf@sys@tonumber\pgfutil@tempdima\space\pgf@sys@tonumber\pgfutil@tempdimb] /Resources << >> %<< } - {#8}% + {#8}% \pgfutil@addpdfresource@patterns{/pgfpat#1\space \the\numexpr\pdffeedback lastobj\relax\space 0 R}% } @@ -354,7 +350,7 @@ /CS /DeviceGray >> }% << - \pgfutil@tempboxa% + \pgfutil@tempboxa% \pgfutil@addpdfresource@extgs{% /pgfsmask\the\lastsavedboxresourceindex\space << @@ -429,12 +425,12 @@ \pgfutil@addpdfresource@colorspaces{ /pgfprgb [/Pattern /DeviceRGB] } \def\pgfsys@color@unstacked#1{% - \pdfextension literal{\csname\string\color@#1\endcsname}% + \pdfextension literal{\csname\string\color@#1\endcsname}% } \endinput -%%% Local Variables: +%%% Local Variables: %%% mode: latex -%%% End: +%%% End: diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-pdftex.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-pdftex.def index 1e8df9b6628..f6498264735 100644 --- a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-pdftex.def +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-pdftex.def @@ -32,7 +32,7 @@ \raise\pgf@pt@y\hbox{% \pgf@pt@x=0pt% \pgf@pt@y=0pt% - \pgflowlevelsynccm% + \pgflowlevelsynccm% \pgfsys@hbox#1}% \hss% }% @@ -89,9 +89,8 @@ /Coords [\pgf@doma\space0 \pgf@domb\space0] /Function \pgf@pdfparsedfunction /Extend [false false] >> >>}\pgfutil@tempboxa% << - \xdef\pgfutil@tempa{\leavevmode\noexpand\pdfrefxform\the\pdflastxform}% + \expandafter\xdef\csname @pgfshading#1!\endcsname{\leavevmode\noexpand\pdfrefxform\the\pdflastxform}% }% - \expandafter\let\csname @pgfshading#1!\endcsname=\pgfutil@tempa } \def\pgfsys@vertshading#1#2#3{% {% @@ -106,9 +105,8 @@ /Coords [0 \pgf@doma\space0 \pgf@domb] /Function \pgf@pdfparsedfunction /Extend [false false] >> >>}\pgfutil@tempboxa% << - \xdef\pgfutil@tempa{\leavevmode\noexpand\pdfrefxform\the\pdflastxform}% + \expandafter\xdef\csname @pgfshading#1!\endcsname{\leavevmode\noexpand\pdfrefxform\the\pdflastxform}% }% - \expandafter\let\csname @pgfshading#1!\endcsname=\pgfutil@tempa } \def\pgfsys@radialshading#1#2#3{% {% @@ -131,9 +129,8 @@ /Coords [\pgf@sys@tonumber{\pgf@xa} \pgf@sys@tonumber{\pgf@ya} \pgf@doma\space \pgf@sys@tonumber{\pgf@x} \pgf@sys@tonumber{\pgf@y} \pgf@domb] /Function \pgf@pdfparsedfunction /Extend [true false] >> >>}\pgfutil@tempboxa% << - \xdef\pgfutil@tempa{\leavevmode\noexpand\pdfrefxform\the\pdflastxform}% + \expandafter\xdef\csname @pgfshading#1!\endcsname{\leavevmode\noexpand\pdfrefxform\the\pdflastxform}% }% - \expandafter\let\csname @pgfshading#1!\endcsname=\pgfutil@tempa }% \def\pgfsys@functionalshading#1#2#3#4{% {% @@ -168,15 +165,14 @@ /ColorSpace /DeviceRGB /Matrix [1 0 0 1 \pgf@sys@tonumber{\pgf@xc}\space\pgf@sys@tonumber{\pgf@yc}] /Domain [\pgf@sys@tonumber{\pgf@xa}\space\pgf@sys@tonumber{\pgf@xb}\space\pgf@sys@tonumber{\pgf@ya}\space\pgf@sys@tonumber{\pgf@yb}] - /Function \pgf@temp@num\space 0 R + /Function \pgf@temp@num\space 0 R >> >>}\pgfutil@tempboxa% << - \xdef\pgfutil@tempa{% + \expandafter\xdef\csname @pgfshading#1!\endcsname{% \leavevmode% \noexpand\pdfrefxform\the\pdflastxform% \noexpand\pdfrefobj\pgf@temp@num% }% }% - \expandafter\let\csname @pgfshading#1!\endcsname=\pgfutil@tempa } @@ -186,7 +182,7 @@ \def\pgfsys@declarepattern#1#2#3#4#5#6#7#8#9{% % Start building the pattern dictionary: \pgf@xa=#2\relax% - \pgf@ya=#3\relax% + \pgf@ya=#3\relax% \pgf@xb=#4\relax% \pgf@yb=#5\relax% \pgf@xc=#6\relax% @@ -210,7 +206,7 @@ /YStep \pgf@sys@tonumber\pgf@yc\space /Resources << >> %<< } - {#8}% + {#8}% \pgfutil@addpdfresource@patterns{/pgfpat#1\space \the\pdflastobj\space 0 R}% } @@ -234,7 +230,7 @@ \def\pgfsys@declarepattern@meta#1#2#3#4#5#6#7{% % Start building the pattern dictionary: \pgf@xa=#2\relax% - \pgf@ya=#3\relax% + \pgf@ya=#3\relax% \pgf@xb=#4\relax% \pgf@yb=#5\relax% \pgf@xc=#6\relax% @@ -266,7 +262,7 @@ /Matrix [#2\space#3\space#4\space#5\space\pgf@sys@tonumber\pgfutil@tempdima\space\pgf@sys@tonumber\pgfutil@tempdimb] /Resources << >> %<< } - {#8}% + {#8}% \pgfutil@addpdfresource@patterns{/pgfpat#1\space \the\pdflastobj\space 0 R}% } @@ -351,7 +347,7 @@ /CS /DeviceGray >> }% << - \pgfutil@tempboxa% + \pgfutil@tempboxa% \pgfutil@addpdfresource@extgs{% /pgfsmask\the\pdflastxform\space << @@ -426,12 +422,12 @@ \pgfutil@addpdfresource@colorspaces{ /pgfprgb [/Pattern /DeviceRGB] } \def\pgfsys@color@unstacked#1{% - \pdfliteral{\csname\string\color@#1\endcsname}% + \pdfliteral{\csname\string\color@#1\endcsname}% } \endinput -%%% Local Variables: +%%% Local Variables: %%% mode: latex -%%% End: +%%% End: diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-tex4ht.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-tex4ht.def index 97fdf109746..751ab7e6fa7 100644 --- a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-tex4ht.def +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-tex4ht.def @@ -72,7 +72,7 @@ % \Configure{SUB}{\HCode{<tspan baseline-shift="sub">}}{\HCode{</tspan>}} % \Configure{SUP}{\HCode{<tspan baseline-shift="sub">}}{\HCode{</tspan>}} % \Configure{SUBSUP}{}{}{} -% \Configure{htf} +% \Configure{htf} % {0}{+}{<tspan font-family="} % {\%s}{" font-size="\%s}{}{} % {">}{</tspan>} @@ -90,12 +90,12 @@ % we don't want tex4ht putting <p> and </p> tags automatically in our svg code and causing invalid xhtml in our svg pictures \newif\ifpgfsys@CssIncluded@\pgfsys@CssIncluded@false -\def\pgfsys@beginpicture{% +\def\pgfsys@beginpicture{% \pgfsys@svg@boxmodefalse% \EndP\HtmlParOff% \pgfkeys{/pgf/tex4ht node/escape=false}% % text only nodes are the default. Advantage : pure svg pictures are - % the default, nicer for text only nodes. + % the default, nicer for text only nodes. % Disadvantages : this rendering methods produce more invalid or degraded svg pictures than with the foreignelement tag %% we use css to control the display of foreignelement rendered text nodes \ifpgfsys@CssIncluded@ @@ -105,14 +105,14 @@ line-height:100\%; font-size:120\%; % this is the trick....a font of size 100% in % a box scaled down to half size makes it a - % half size font. + % half size font. % you'll have to double the size of things % that you want to have a regular size in - % this half-scaled box though + % this half-scaled box though font-family:STIXgeneral,Times,Symbol,cmr10,CMSY10,CMEX10;% % can't wait for the stix font...the cmr10, etc font are % available from the mozilla site, times and symbols should be - % okey + % okey padding:0; margin:0; % background-color:\#12ff55; usefull for debugging positioning @@ -155,8 +155,8 @@ \ifdim\pgf@y<1pt% \pgf@y=1pt% \fi% - \pgf@xc=\pgf@x% - \pgf@yc=\pgf@y% + \pgf@xc=\pgf@x% + \pgf@yc=\pgf@y% \pgfsysprotocol@flushcurrentprotocol% \HCode{<object data="\jobname-\the\pgf@sys@svg@picnum.svg" width="}% % Calculate pixel coordinates (this does not really make sense, but @@ -178,7 +178,7 @@ /pgf/tex4ht node/css/.get=\pgfsys@foreignobject@css }% \pgfsys@invoke{<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>\Hnewline% added that - <?xml-stylesheet href="\pgfsys@foreignobject@css.css" type="text/css"?>\Hnewline}% added that + <?xml-stylesheet href="\pgfsys@foreignobject@css.css" type="text/css"?>\Hnewline}% added that %%%%%%%%%%%%%%% maybee I should add an option to change the css, for the whole picture \pgfsys@invoke{<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="\the\pgf@xc" @@ -247,17 +247,17 @@ {% grouping necessary cause we change the catcode of ":" \catcode`:=11\relax %%% this is necessary to calculate the size of text nodes with - %%% inline maths + %%% inline maths % (it is an improvement of tex4ht, got to ask eitan gurary if he - % could put it in the tex4ht code) + % could put it in the tex4ht code) \gdef\DviMathAlt{% \a:DviMath\leavevmode \MathClass \ht:special{t4ht@(}\hbox\bgroup{\expandafter\ifx\csname ht:everypar\endcsname\relax\expandafter\everypar\else - \expandafter\ht:everypar\fi{}\leavevmode\ht:special{t4ht@)}}\DviSend + \expandafter\ht:everypar\fi{}\leavevmode\ht:special{t4ht@)}}\DviSend }% % these are configures for the foreignelement rendering method of text nodes : we let tex4ht write xhtml and mathml in the svg picture - % + % \gdef\pgfsys@foreignobject@configure{% \Configure{$}{\Configure{@math}{%\a:mathml display="inline" }\DviMathAlt}{\EndDviMath}{}%%% we REALLY need to use \DviMathAlt here instead of \DviMath see above remark @@ -278,15 +278,15 @@ \global\let\pgfsys@foreignobject@par=\par % use this instead of \par % -- \Configure is no \long macro (at % least in one of the older - % versions). - + % versions). + % these are the configures for the mtext rendering method of text % nodes : we turn everything into regular character (don't want math - % modes or subsup) - % and we hope it works (it doesn't if the text nodes aren't simple) + % modes or subsup) + % and we hope it works (it doesn't if the text nodes aren't simple) \gdef\pgfsys@mtext@configure{% % no configures for \(\) and \[\] those might be needed for - % context or Latex. Let me know ! + % context or Latex. Let me know ! \Configure{$$}{}{}{}% no block maths \Configure{$}{}{}{}%$ no inline maths \Configure{SUB}{\HCode{<tspan baseline-shift="sub">}}{\HCode{</tspan>}}% @@ -302,21 +302,21 @@ % pgfutil@minipage % -% I had to change it to make it play nice with the way tex4ht puts <p> and <\p> tags +% I had to change it to make it play nice with the way tex4ht puts <p> and <\p> tags % \newif\ifpgfsys@textonly \def\pgfutil@minipage[#1]#2{% \hbox to#2\bgroup \hsize=#2\relax - \vbox\bgroup -% though it works, I'm desabling the above-mentioned hack to make tex4ht behave with <p> <\p>, because it blurps the positioning + \vbox\bgroup +% though it works, I'm desabling the above mentioned hack to make tex4ht behave with <p> <\p>, because it blurps the positioning % (I''l try to fix that later, it's a css thing) % % \ifpgfsys@textonly\else\HtmlParOn\fi % % \noindent is better as it doesn't produce indentation AND it makes you leave vertical mode - \noindent%\leavevmode + \noindent%\leavevmode }% \def\pgfutil@endminipage{% % same thing here @@ -330,14 +330,14 @@ \newbox\pgfsys@foreignobject@Box \newdimen\pgf@s \newdimen\pgf@t -% this is the alternate hbox routine that renders text nodes through the foreignobject tag +% this is the alternate hbox routine that renders text nodes through the foreignobject tag \def\pgfsys@foreignobject@hbox#1{% % Compute box y translation (x translation is correct). \pgf@y=-\ht#1\relax \HCode{<g transform="scale(1,-1) translate(0,\pgf@sys@tonumber{\pgf@y}) % got to translate in y scale(0.5,0.5)">\Hnewline}% scaling work around (damn dumb browsers !) % Compute box size (scaled 2 times) - % this is necessary to make the browser scale the font down 50% (the STUPID browsers won't make font-size:50% happen, + % this is necessary to make the browser scale the font down 50% (the STUPID browsers won't make font-size:50% happen, % so we have to work around this by making svg scale the things down 50%, doubling the size of the text node frame (i.e. no changement there) \pgf@x=2\wd#1\relax \pgf@y=2\ht#1\relax @@ -355,9 +355,9 @@ \pgf@t=0pt \else \advance \pgf@y by -2\pgf@s\relax - \pgf@t=2\pgf@t\relax + \pgf@t=2\pgf@t\relax \fi - % + % \HCode{<foreignObject x="0" y="\pgf@sys@tonumber{\pgf@t}" width="\pgf@sys@tonumber{\pgf@x}" height="\pgf@sys@tonumber{\pgf@y}">}% % this is to make use of the css, class and id options through which you can control the way things display @@ -372,8 +372,8 @@ % I'll have to look into this, perhaps there are better % doctype.... aren't recognised and produces invalid svg % pictures a workaround (not implemented yet) would be to make - % them into entities of the svg picture. - <body id="\pgfsys@foreignobject@id" class="\pgfsys@foreignobject@class" xmlns="http://www.w3.org/1999/xhtml" >\Hnewline + % them into entities of the svg picture. + <body id="\pgfsys@foreignobject@id" class="\pgfsys@foreignobject@class" xmlns="http://www.w3.org/1999/xhtml" >\Hnewline <div>\Hnewline }% \box#1% @@ -383,10 +383,10 @@ </foreignObject>\Hnewline }% % debug positioning not needed but it would be nice to let it there to control things later on - % \HCode{<rect x="0" y="0" width="\pgf@sys@tonumber{\pgf@x}" height="\pgf@sys@tonumber{\pgf@y}" + % \HCode{<rect x="0" y="0" width="\pgf@sys@tonumber{\pgf@x}" height="\pgf@sys@tonumber{\pgf@y}" % style="fill:yellow;stroke:red; fill-opacity:0.5;stroke-opacity:0.5"/>} \HCode{</g>\Hnewline}% - \global\advance\pgf@sys@svg@nodenum by 1\relax + \global\advance\pgf@sys@svg@nodenum by 1\relax }% % the options and the code that controls it all (switches between \pgfsys@mtext@hbox and \pgfsys@foreignelement@hbox) @@ -406,7 +406,7 @@ -% this might be needed +% this might be needed %\font\SvgText=cmr10\relax @@ -431,7 +431,7 @@ \pgf@sys@svg@sh% \pgfsys@endscope% \pgfsys@endpicture% - \hss% + \hss% }% \pgf@process{\pgf@sys@svg@pos}% \pgf@picminx=0pt% @@ -480,6 +480,6 @@ \endinput -%%% Local Variables: +%%% Local Variables: %%% mode: latex -%%% End: +%%% End: diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-textures.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-textures.def index 1a01a6f8f11..033d949baac 100644 --- a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-textures.def +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-textures.def @@ -69,9 +69,9 @@ end pop pop}def/eps{}def userdict begin}bind def /pgfbeginpicture{/pgfx pgfgx def /pgfy pgfgy def pgfx pgfy translate 1 1 72.27 72 div mul2 neg scale}bind def /pgfbeginhbox{1 1 72 72.27 div mul2 neg scale - pgfx neg pgfy neg translate + pgfx neg pgfy neg translate pgffoa .setopacityalpha}bind def% save - /.setopacityalpha where {pop} {/.setopacityalpha{pop}def} ifelse % install .setopacityalpha + /.setopacityalpha where {pop} {/.setopacityalpha{pop}def} ifelse % install .setopacityalpha /.pgfsetfillopacityalpha{/pgffoa exch def /pgffill{gsave pgffoa .setopacityalpha fill 1 .setopacityalpha newpath fill grestore newpath}bind def @@ -86,6 +86,6 @@ \endinput -%%% Local Variables: +%%% Local Variables: %%% mode: latex -%%% End: +%%% End: diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-vtex.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-vtex.def index cce6e4a3444..e5e9b1d5df9 100644 --- a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-vtex.def +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-vtex.def @@ -31,10 +31,10 @@ % Starting and ending a picture: -\def\pgfsys@beginpicture{\special{pS: - save - /pgfx currentpoint /pgfy exch def def - currentpoint translate +\def\pgfsys@beginpicture{\special{pS: + save + /pgfx currentpoint /pgfy exch def def + currentpoint translate gsave}% \let\set@color=\pgf@sys@vtex@set@color% \let\reset@color=\pgf@sys@vtex@reset@color% @@ -58,7 +58,7 @@ \def\pgfsys@endpicture{\special{pS: newpath grestore - newpath + newpath restore}} % Graphics: @@ -94,13 +94,13 @@ % vtex commands for changing the paper size \def\pgfsys@papersize#1#2{\mediawidth#1\mediaheight#2} - - + + \endinput -%%% Local Variables: +%%% Local Variables: %%% mode: latex -%%% End: +%%% End: diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-xetex.def b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-xetex.def index 5147214ef9b..a4a49c1faab 100644 --- a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-xetex.def +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys-xetex.def @@ -12,20 +12,20 @@ \input pgfsys-dvipdfmx.def \def\pgfsys@dvipdfmx@patternobj#1{% - % I have NO idea why this is necessary for xdvipdfmx - but without - % it, it crashes. - \pgfutil@insertatbegincurrentpagefrombox{#1}% + % I have NO idea why this is necessary for xdvipdfmx - but without + % it, it crashes. + \pgfutil@insertatbegincurrentpagefrombox{#1}% }% % XeTeX supports pdftex commands for paper size \def\pgfsys@papersize#1#2{% \pdfpageheight#2\relax% \pdfpagewidth#1\relax} - + \def\pgfsys@global@papersize#1#2{% \global\pdfpageheight#2\relax% \global\pdfpagewidth#1\relax} - + % Xetex does not support interpolate and not mask \def\pgfsys@defineimage{% width, height, page number @@ -43,7 +43,7 @@ \edef\pgf@image{\noexpand\includegraphics[\pgf@imageheight\pgf@imagewidth\pgf@imagepage]{\pgf@filename}}% \fi% } - + % XeTeX supports position tracking, now \def\pgfsys@markposition#1{% \pdfsavepos% diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys.code.tex b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys.code.tex index f25b11e5fec..393a7860608 100644 --- a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsys.code.tex @@ -24,7 +24,7 @@ % % The following conversion functions are used to convert from TeX % dimensions to postscript/pdf points. -% +% {\catcode`\p=12\catcode`\t=12\gdef\Pgf@geT#1pt{#1}} \def\pgf@sys@tonumber#1{\expandafter\Pgf@geT\the#1} @@ -64,7 +64,7 @@ \newread\r@pgf@reada \let\pgfutil@inputcheck=\r@pgf@reada -% internal counters that are always present when pgfsys is loaded +% internal counters that are alwyas present when pgfsys is loaded \newcount\c@pgf@counta \newcount\c@pgf@countb \newcount\c@pgf@countc @@ -103,7 +103,7 @@ % In some cases, some pgf system commands are just shorthands for a % series of more complicated commands. In this case, a default % implementation is given in this file, but a driver may choose to -% overwrite this default implementation with a more efficient +% overwrite this default implementation with a more effecient % version. For example, a closestroke is the same as a closepath % followed by a stroking, but in pdf there is a special shorthand for % this. So, the pdf driver overwrites \pgfsys@closestroke, while the @@ -132,8 +132,8 @@ % \pgfsys@xxxx commands will not directly call this command, but, % rather, use the protocolling mechanism to record their literal % text. It is then left to the discretion of the protocolling -% mechanism to insert the literal text at some appropriate, later -% time. +% mechansim to insert the literal text at some appropriate, later +% time. % % This command should only be called when \pgfsys@beginpicture has % been called previously and when the picture has not been suspended @@ -142,7 +142,7 @@ \def\pgfsys@outerinvoke{\pgfsys@invoke} % This command can be used to insert protocolled graphic commands % outside any picture. This is extremely dangerous, but sometimes -% useful. By default, this command does the same as inside pictures. +% useful. By default, this command does the same as inside pictures. @@ -156,7 +156,7 @@ % This command is used to start a path at a specific point (#1,#2) % or to move the current point of the current path to (#1,#2) % without drawing anything upon stroking (the current path is -% `interrupted'). +% `interrupted'). % % The arguments must be dimensions (like |10pt|). % @@ -172,7 +172,7 @@ % Continue the current path to (#1,#2) with a line. \def\pgfsys@curveto#1#2#3#4#5#6{\pgf@sys@fail{path constructions}} -% Continue the current path with a bezier curve to (#5,#6). The +% Continue the current path with a bezier curver to (#5,#6). The % control points of the curve are at (#1,#2) and (#3,#4). \def\pgfsys@rect#1#2#3#4{\pgf@sys@fail{path constructions}} @@ -188,7 +188,7 @@ % operation. Typically, this is preferable over using lineto to the % last point specified by a moveto, since the line starting at this % point and the line ending at this point will be smoothly joined by -% closepath. +% closepath. % % Example: % @@ -205,7 +205,7 @@ % \pgfsys@lineto{0}{10} % \pgfsys@lineto{0}{0} % \pgfsys@stroke -% +% % The difference between the above will be that in the second triangle % the corner at the origin will be wrong; it will just be the overlay % of two lines going in different directions, not a sharp pointed @@ -273,13 +273,13 @@ % consisting of multiple parts, the nonzero winding number rule is % used to determine whether a point is inside or outside the % path, except if \ifpgfsys@eorule holds -- in which case the even-odd -% rule should be used. (See the pdf or postscript manual for details.) +% rule should be used. (See the pdf or postscript manual for details.) % % The following graphic state parameters influence the filling: % % - fill color % If the fill color is not especially set, the current color is -% used. +% used. % % - clipping area % If a clipping area is established, only those parts of the filling @@ -314,7 +314,7 @@ % Normally, this command should `throw away' the current path. % However, after \pgfsys@clipnext has been called, the current path % should subsequently be used for clipping. See \pgfsys@clipnext for -% details. +% details. \def\pgfsys@closestroke{\pgfsys@closepath\pgfsys@stroke} % This command should have the same effect as first closing the path @@ -335,7 +335,7 @@ % \def\pgfsys@setlinewidth#1{\pgf@sys@fail{setting the line width}} % Sets the width of lines, when stroked, to #1, which must be a TeX -% dimension (as text). +% dimension (as text). \def\pgfsys@buttcap{\pgf@sys@fail{setting the line cap}} % Sets the cap to a butt cap. See \pgfsys@stroke. @@ -388,7 +388,7 @@ \def\pgfsys@color@rgb@stroke#1#2#3{\pgf@sys@fail{color}} % Sets the color used for stroking operations to the given rgb tuple -% (numbers between 0 and 1). +% (numbers between 0 and 1). % % Example: Make stroked text dark red: \pgfsys@color@rgb@stroke{0.5}{0}{0} % @@ -408,33 +408,33 @@ \def\pgfsys@color@cmyk@stroke#1#2#3#4{\pgf@sys@fail{color}} % Sets the color used for stroking operations to the given cymk tuple -% (numbers between 0 and 1). +% (numbers between 0 and 1). \def\pgfsys@color@cmyk@fill#1#2#3#4{\pgf@sys@fail{color}} % Sets the color used for filling operations to the given cymk tuple -% (numbers between 0 and 1). +% (numbers between 0 and 1). \def\pgfsys@color@cmyk#1#2#3#4{\pgfsys@color@cmyk@stroke{#1}{#2}{#3}{#4}\pgfsys@color@cmyk@fill{#1}{#2}{#3}{#4}} % Sets the color used for filling and stroking operations. \def\pgfsys@color@cmy@stroke#1#2#3{\pgf@sys@fail{color}} % Sets the color used for stroking operations to the given cym tuple -% (numbers between 0 and 1). +% (numbers between 0 and 1). \def\pgfsys@color@cmy@fill#1#2#3{\pgf@sys@fail{color}} % Sets the color used for filling operations to the given cym tuple -% (numbers between 0 and 1). +% (numbers between 0 and 1). \def\pgfsys@color@cmy#1#2#3{\pgfsys@color@cmy@stroke{#1}{#2}{#3}\pgfsys@color@cmy@fill{#1}{#2}{#3}} % Sets the color used for filling and stroking operations. \def\pgfsys@color@gray@stroke#1{\pgf@sys@fail{color}} -% Sets the color used for stroking operations to the given gray level -% (number between 0 and 1). +% Sets the color used for stroking operations to the given gray level +% (number between 0 and 1). \def\pgfsys@color@gray@fill#1{\pgf@sys@fail{color}} -% Sets the color used for filling operations to the given gray level -% (number between 0 and 1). +% Sets the color used for filling operations to the given gray level +% (number between 0 and 1). \def\pgfsys@color@gray#1{\pgfsys@color@gray@stroke{#1}\pgfsys@color@gray@fill{#1}} % Sets the color used for filling and stroking operations. @@ -460,7 +460,7 @@ \def\pgfsys@color@unstacked#1{} % This slightly obscure command causes the color stack to be % tricked. When called, this command should set the current color to -% #1 without causing any change in the color stack. +% #1 without causing any change in the color stack. \def\pgfsys@text@to@black@hook{} % Another slightly obscure command that allows tikz to hack into @@ -479,7 +479,7 @@ % Perform a concatenation of the low-level current transformation % matrix with the matrix given by the values #1 to #6. The % transformation matrix is a transformation on a homogeneous -% 2D-coordinate system. See the pdf or postscript manual for details. +% 2D-coordinate system. See the pdf or postscript manual for details. \def\pgfsys@transformshift#1#2{\pgfsys@transformcm{1}{0}{0}{1}{#1}{#2}} % This command will change the origin of the low-level coordinate @@ -530,7 +530,7 @@ \ifdim\aspectr pt#9\aspects pt% \pgfmathdivide@\pgf@xa\pgf@xc% \else% - \pgfmathdivide@\pgf@ya\pgf@yc% + \pgfmathdivide@\pgf@ya\pgf@yc% \fi% \advance\pgf@x by.5\pgf@xa% \advance\pgf@xb by.5\pgf@xc% @@ -560,7 +560,7 @@ % whether the current path is part of the graphic state or not. For % this reason, you should never use this command unless the path is % currently empty. For example, it might be a good idea to use -% discardpath prior to calling this command. +% discardpath prior to calling this command. \def\pgfsys@endscope{\pgf@sys@fail{scoping}} % Restores the last saved graphic state. @@ -667,7 +667,7 @@ \pgfsys@register@type\pgfsys@current@type% } \let\pgfsys@current@type\pgfutil@empty -% Sets the type to be used for the next graphic object. +% Sets the type to be used for the next graphic object. \def\pgfsys@append@type#1{% \ifx\pgfsys@current@type\pgfutil@empty% @@ -760,7 +760,7 @@ \fi% } % Checks whether a given id-type pair #1-#2 has not been used, yet. If -% so, #3 is executed, otherwise #4. +% so, #3 is executed, otherwise #4. \def\pgfsys@if@fresh@currentid#1#2{% \ifx\pgf@sys@id@current@id\pgfutil@empty% empty id always counts as "has been used" @@ -822,7 +822,7 @@ % are part of a transparency group, the overlap will get the same % color as the rest. % -% The following settings modify the behaviour of a transparency group: +% The following settings modify the bevahiour of a transparency group: \newif\ifpgfsys@transparency@group@isolated \newif\ifpgfsys@transparency@group@knockout @@ -853,7 +853,7 @@ \def\pgfsys@fadingfrombox#1#2{\pgf@sys@fail{fadings}} % Declares an fading named #1. The parameter #2 must be a % box. Its contents luminosity determines the opacity of the resulting -% mask. +% mask. \def\pgfsys@usefading#1#2#3#4#5#6#7{\pgf@sys@fail{fadings}} % Installs a previously declared fading #1 in the current graphics @@ -878,7 +878,7 @@ % macro name. #2 is the height of the shading and must be given as a % TeX dimension like `2cm' or `10pt'. #3 is a shading color % specification as specified in the pgfuserguide. The shading -% specification implicitly fixes the width of the shading. +% specification implicitly fixes the width of the shading. % % When `@pgfshading#1!' is invoked, it should insert a box of height % #2 and the width implicit in the shading declaration. @@ -890,7 +890,7 @@ \def\pgfsys@radialshading#1#2#3{\pgf@sys@fail{shadings}\pgf@sys@noshading{#1}} % Declares a radial shading. Like the previous macros, this command % should setup the macro `@pgfshading#1!', which upon invocation -% should insert a radial shading whose size is implicit in #3. +% should insert a radial shading whose size is implicit in #3. % % The parameter #2 is a pgf point specification if the starting point % of the shading. See the pgfuserguide for details. @@ -915,7 +915,7 @@ % green, and blue components of the color. % % A buggy #4 will result is *totally unpredictable chaos* during -% rendering. +% rendering. \def\pgf@sys@noshading#1{\expandafter\global\expandafter\let\csname @pgfshading#1!\endcsname=\pgfutil@empty} @@ -933,7 +933,7 @@ % patterns have no inherent color, the color is provided when they are % set. Colored patters have an inherent color. % #1 = name of the pattern (must be a plain suffix for use in -% postscript/pdf/etc.) +% postscript/pdf/etc.) % #2 to #5 = four coordinates describing the corners of a bounding box % of pattern cells % #6 = x-step @@ -956,7 +956,7 @@ % % Animations % -% +% \newif\ifpgfsysanimationsupported @@ -965,19 +965,19 @@ \def\pgfsys@animate#1{\pgf@sys@fail{animations}} -% Adds an animation of the attribute #1 to the current scope. +% Adds an animation of the attribute #1 to the current scope. % The configuration of the animation (like start times, etc.) is taken % from the current values of the animation keys, which are configured % using calls to \pgfsys@animation@..., which setup an animation % key for the local scope. This means that you typically setup these % keys in a scope and at the end of the scope call \pgfsys@animate. -% +% % Some keys accumulate (like begin or keytime), most do not. In those -% cases, the last call overrides the previous one. -% +% cases, the last call overrides the previous one. +% % Not all value types make sense or are allowed, it depends on the -% specific \pgfsys@animate call. -% +% specific \pgfsys@animate call. +% % Example: % % { @@ -993,11 +993,11 @@ % % When a driver does not support a specific attribute #1, it should % issue a \pgf@sys@fail. Typical attributes are things like "opacity" -% or "linewidth" or "dash". +% or "linewidth" or "dash". % % The following values are permissible for "#1": % -% "opacity" adds an animation of the opacity. +% "opacity" adds an animation of the opacity. % Type: scalar % % "fillopacity" adds an animation of the fill opacity. @@ -1006,7 +1006,7 @@ % "strokeopacity" adds an animation of the stroke opacity. % Type: scalar % -% "visibility" adds an animation of the visibility. +% "visibility" adds an animation of the visiblity. % Type: text ("visible" or "hidden") % % "linewidth" adds an animation of the line width. @@ -1043,35 +1043,35 @@ % Type: view box % % "path" adds an animation of the path to the path specified by -% \pgfsys@animation@whom +% \pgfsys@animation@whom % Type: path % % "syncbase" adds a sync base to the animation. A sync base does not animate % anything by itself, but other animations can begin and end relative % to it. % -% "none" suppresses the animation +% "none" supresses the animation % Type: any -% Animation timing : +% Animation timing : % % You specify an animation using a timeline. A timeline consists of a % sequence of times together with values for these times. The times % must be given in increasing order. You use the command % \pgfsys@animation@time to specify a time and % \pgfsys@animation@val@... to specify a value. The time must be -% specified first, the time--value is created when the value command is -% used. +% specfied first, the time--value is created when the value command is +% used. % -% Times are given in seconds (so 0.01 is one hundredth of a second). +% Times are given in seconds (so 0.01 is one hundreth of a second). % % The animation's timeline will start with the first time mentioned % (not necessarily zero and not necessarily a positive value) and ends % with the last value. The duration is the difference between these -% two values. +% two values. \def\pgfsys@animation@restart@always{} % Specifies that the animation can always restart @@ -1083,7 +1083,7 @@ % Specifies that the animation should only restart when it is not active \def\pgfsys@animation@repeat#1{} -% #1 must be a number +% #1 must be a number \def\pgfsys@animation@repeat@indefinite{} % Repeats forever @@ -1096,7 +1096,7 @@ % the end \def\pgfsys@animation@removeatend{} -% Specifies that the effect of the animation is removed at the end +% Specifies that the effect of the animation is removed at the end \def\pgfsys@animation@time#1#2#3#4#5{} % Specifies a time together with spline control points for the entry @@ -1106,7 +1106,7 @@ % while the values #4 and #5 specify the control point of the spline % *leaving* the time point. They are all dimensionless values between % 0 and 1. For a linear animation, set the first two to 1 and the last -% two to 0. +% two to 0. % % Example: % \pgfsys@animation@time{5}{1}{1}{0.25}{0.1} @@ -1124,7 +1124,7 @@ % For the key spline, note that the entry spline controls of the first % time and the exit spline controls of the last point are dropped. % -% +% % When the exit spline takes the special values #4="stay" and #5="0", % the attribute's value "stays" until the next value for the next time % (it "jumps" to the next value then). This corresponds, roughly, to @@ -1132,7 +1132,7 @@ % % Similarly, when the entry spline takes the special value #2="jump" % and #3="1", the value immediately jumps from the previous value to -% the next value when the previous value was "created". +% the next value when the previous value was "created". \def\pgfsys@stay@text{{stay}{0}} \def\pgfsys@jump@text{{jump}{1}} @@ -1160,7 +1160,7 @@ \def\pgfsys@animation@syncbegin#1#2#3#4{} % #1 is the id of a sync base (obtained by % \pgfsys@new@id), #2 is the id type (or empty), #3 is an optional -% offset, #4 is the target. +% offset, #4 is the target. \def\pgfsys@animation@syncend#1#2#3#4{} % Like the previous command. @@ -1168,14 +1168,14 @@ \def\pgfsys@animation@event#1#2#3#4#5{} % #1 is the optional id of another element (obtained by % \pgfsys@new@id), #2 is the optional type of the id, #3 is an event -% name, #4 is an optional offset, #5 is the target. +% name, #4 is an optional offset, #5 is the target. \def\pgfsys@animation@repeat@event#1#2#3#4#5{} % #1 is the optional id of another element, #2 is the type, #3 is a -% repeat count, and #4 is an optional offset, #5 is the target. +% repeat count, and #4 is an optional offset, #5 is the target. \def\pgfsys@animation@accesskey#1#2#3{} -% #1 is a character, #2 is an optional offset, #3 is the target. +% #1 is a character, #2 is an optional offset, #3 is the target. \def\pgf@sys@begin@text{begin} @@ -1202,14 +1202,14 @@ \def\pgfsys@animation@rotatealong{} % Applicable only to motion animations. Indicates that the % to-be-animated group should be rotated automatically so that it -% points along the path as time progresses. +% points along the path as time progresses. \def\pgfsys@animation@norotatealong{} % Corresponds to rotate="0" \def\pgfsys@animation@movealong#1{} % Applicable only to motion animations. #1 is a softpath along which -% the movement will be done. +% the movement will be done. \def\pgfsys@animation@tip@markers#1#2{} % Applicable only to path animations. #1 and #2 are markers (declared @@ -1219,14 +1219,14 @@ \def\pgfsys@animation@canvas@transform#1#2{} % #1 is some code that may call \pgfsys@transformcm at most once. It -% will be executed when a canvas transformation animation is +% will be executed when a canvas transformation animation is % installed for a scope id. #2 is some further codes that may also % call \pgfsys@transformcm at most once. It will be installed right % after the animation. % % Typically, #1 is some pgf coordinate shift followed by % {\pgflowlevelsynccm} and #2 is \pgftransforminvert followed by -% \pgflowlevelsynccm. +% \pgflowlevelsynccm. @@ -1244,7 +1244,7 @@ % #1 should be a single value. \def\pgfsys@animation@val@dimension#1{} -% #1 must be a dimension. +% #1 must be a dimension. \def\pgfsys@animation@val@color@rgb#1#2#3{} % #1,#2,#3 must be an rgb tuple @@ -1270,7 +1270,7 @@ \def\pgfsys@animation@val@viewbox#1#2#3#4{} % #1,#2 describe the lower left, #3,#4 the upper right corner of the -% view box. +% view box. \def\pgfsys@animation@val@dash#1#2{} % #1,#2 have the syntax of \pgfsys@setdash. @@ -1294,22 +1294,22 @@ \pgfsys@endscope% \xdef#1{\the\pgf@sys@id@count}% \expandafter\expandafter\expandafter\global\expandafter\pgfsysprotocol@getcurrentprotocol\csname pgf@sys@marker@prot@#1\endcsname% - \pgfsys@marker@declare@% curtesy hook + \pgfsys@marker@declare@% curtesy hook \pgfsysprotocol@setcurrentprotocol\pgfsys@marker@temp% \global\advance\pgf@sys@id@count by1\relax% }% } \let\pgfsys@marker@declare@\relax % Declares a new marker symbol whose code is in #2. #1 should be a -% macro name, which will be set to a unique +% macro name, which will be set to a unique % value by which the marker can be referenced later on. #2 should be -% code that, when executed, produces recordable code. +% code that, when executed, produces recordable code. \def\pgfsys@marker@use#1{% \pgfsysprotocol@literal{\csname pgf@sys@marker@prot@#1\endcsname}% } % Draws the marker symbol not at the end of a path, but simply with -% the current transformation matrix +% the current transformation matrix @@ -1325,24 +1325,24 @@ \def\pgfsys@rdf@about#1{\pgf@sys@fail{rdf}} % Adds the rdf attribute "about" with value #1 to the next % idscope. The RDF-spec says: "a SafeCURIEorCURIEorIRI, used for -% stating what the data is about (a 'subject' in RDF terminology);" +% stating what the data is about (a 'subject' in RDF terminology);" \def\pgfsys@rdf@content#1{\pgf@sys@fail{rdf}} % Adds the rdf attribute content with value #1 to the next % idscope. The RDF-spec says: "a CDATA string, for supplying % machine-readable content for a literal (a 'literal object', in RDF -% terminology);" +% terminology);" \def\pgfsys@rdf@datatype#1{\pgf@sys@fail{rdf}} % Adds the rdf attribute datatype with value #1 to the next % idscope. The RDF-spec says: "a TERMorCURIEorAbsIRI representing a -% datatype, to express the datatype of a literal;" +% datatype, to express the datatype of a literal;" \def\pgfsys@rdf@href#1{\pgf@sys@fail{rdf}} % Adds the rdf attribute href with value #1 to the next idscope % The RDF-spec says: "a traditionally navigable IRI for % expressing the partner resource of a relationship (a 'resource -% object', in RDF terminology);" +% object', in RDF terminology);" \def\pgfsys@rdf@inlist{\pgf@sys@fail{rdf}} % Adds the rdf attribute inlist to the next idscope. The @@ -1350,34 +1350,34 @@ % associated with a rel or property attribute on the same element is % to be added to the list for that predicate. The value of this % attribute must be ignored. Presence of this attribute causes a list -% to be created if it does not already exist." +% to be created if it does not already exist." \def\pgfsys@rdf@prefix#1{\pgf@sys@fail{rdf}} % Adds #1 to the list of the rdf prefix attribute to the next % idscope. Can be called several times, in which case all values of #1 % are concatenated with whitespaces. The RDF-spec says: "a white space % separated list of prefix-name IRI pairs of the form NCName ':' ' '+ -% xsd:anyURI" +% xsd:anyURI" \def\pgfsys@rdf@property#1{\pgf@sys@fail{rdf}} % Adds #1 to the list of the rdf property attribute to the next % idscope. Can be called repeatedly. The RDF-spec says: "a white space % separated list of TERMorCURIEorAbsIRIs, used for expressing % relationships between a subject and either a resource object if -% given or some literal text (also a 'predicate');" +% given or some literal text (also a 'predicate');" \def\pgfsys@rdf@rel#1{\pgf@sys@fail{rdf}} % Adds #1 to the list of the rdf rel attribute to the next % next idscope. Can be called repeatedly. The % RDF-spec says: "a white space separated list of % TERMorCURIEorAbsIRIs, used for expressing relationships between two -% resources ('predicates' in RDF terminology);" +% resources ('predicates' in RDF terminology);" \def\pgfsys@rdf@resource#1{\pgf@sys@fail{rdf}} % Adds the rdf attribute resource with value #1 to the next idscope. The % RDF-spec says: "a SafeCURIEorCURIEorIRI for expressing the partner % resource of a relationship that is not intended to be navigable -% (e.g., a 'clickable' link) (also an 'object');" +% (e.g., a 'clickable' link) (also an 'object');" \def\pgfsys@rdf@rev#1{\pgf@sys@fail{rdf}} % Adds #1 to the list of the rdf rev attribute to the next @@ -1390,19 +1390,19 @@ % Adds an rdf attribute src with value #1 to the next idscope. The % RDF-spec says: "an IRI for expressing the partner resource of a % relationship when the resource is embedded (also a 'resource -% object');" +% object');" \def\pgfsys@rdf@typeof#1{\pgf@sys@fail{rdf}} % Adds #1 to the list of the rdf typeof attribute to the next % idscope. Can be called repeatedly. The % RDF-spec says: "a white space separated list of TERMorCURIEorAbsIRIs -% that indicate the RDF type(s) to associate with a subject;" +% that indicate the RDF type(s) to associate with a subject;" \def\pgfsys@rdf@vocab#1{\pgf@sys@fail{rdf}} % Adds an rdf attribute vocab with value #1 to the next idscope. The % RDF-spec says: "an IRI that defines the mapping to use when a TERM % is referenced in an attribute value. See General Use of Terms in -% Attributes and the section on Vocabulary Expansion." +% Attributes and the section on Vocabulary Expansion." @@ -1420,13 +1420,13 @@ % shipped-out document and will ignore all other uses. In contrast, % pdftex will use the current value of the papersize for each page % and, additionally, setting the papersize is local to the current TeX -% group. +% group. % #1 = width % #2 = height \def\pgfsys@global@papersize#1#2{\pgfsys@papersize{#1}{#2}} % This command does the same as the papersize command, only for -% drivers that support this, \global is used to set the papersize. +% drivers that support this, \global is used to set the papersize. % #1 = width % #2 = height @@ -1472,10 +1472,10 @@ % to the position "pgfpageorigin" to make sure that the origin is at % the lower left corner. Typically, getting this position % requires two runs of TeX. On the first run, the macro will be set to -% \relax, indicating that the position is not available. +% \relax, indicating that the position is not available. % % If #1 is set to the special position "pgfpageorigin", the position -% of the the lower left page corner is returned. +% of the the lower left page corner is returned. \def\pgfsys@getposition#1#2{\let#2=\relax} @@ -1485,7 +1485,7 @@ % % Commands having a default implementation. These commands only need % not be implemented by drivers if this results in a better -% performance. +% preformance. % % @@ -1523,20 +1523,20 @@ \pgfsys@endscope% \pgfsys@end@idscope% } -% Called to insert a TeX hbox into a pgfpicture. +% Called to insert a TeX hbox into a pgfpicture. \def\pgfsys@hboxsynced#1{% \pgfsys@beginscope\pgflowlevelsynccm\pgfsys@hbox#1\pgfsys@endscope% }% % Called to insert box #1 into a pgfpicture, but with the current % coordinate transformation matrix synced with the canvas -% transformation matrix and surrounded by a scope. +% transformation matrix and surrounded by a scope. % % In essence, this command does the same as if you first said % \pgflowlevelsynccm and then \pgfsys@hbox#1. However, a % ``TeX-translation'' is used for the translation part of the % transformation cm. This will ensure that hyperlinks ``survive'' at -% least translations. +% least translations. \def\pgfsys@pictureboxsynced#1{% {% @@ -1556,7 +1556,7 @@ % Called at the beginning of a pgfpicture. Used to setup things. \def\pgfsys@endpicture{} -% Called at the end of a pgfpicture. +% Called at the end of a pgfpicture. \def\pgfsys@typesetpicturebox#1{% \pgf@ya=\pgf@shift@baseline\relax% @@ -1596,7 +1596,7 @@ \ifx\pgf@imagepage\pgfutil@empty\else\edef\pgf@imagepage{page=\pgf@imagepage,}\fi% \edef\pgf@image{\noexpand\includegraphics[\pgf@imageheight\pgf@imagewidth]{\pgf@filename}}% } -% Called, when an image should be defined. +% Called, when an image should be defined. % % This command does not take any parameters. Instead, certain macros % will be preinstalled with appropriate values when this command is @@ -1622,11 +1622,11 @@ % % % The following macros presumable mostly make sense for drivers that -% can handle pdf: +% can handle pdf: % % - \pgf@imagepage % The desired page number to be extracted from a multi-page -% `image'. +% `image'. % % - \pgf@imagemask % If set, it will be set to `/SMask x 0 R', where x is the pdf @@ -1635,7 +1635,7 @@ % - \pgf@imageinterpolate % If set, it will be set to `/Interpolate true' or `/Interpolate % false', indicating whether the image should be interpolated in -% pdf. +% pdf. % % % The command should now setup the macro \pgf@image such that calling @@ -1664,7 +1664,7 @@ % % The parameter #1 is the name for later use. #2 and #3 are pgf points % specifying a bounding box for the object. #4 is the code for the -% object. The code may only contain protocolable code. +% object. The code may only contain protocollable code. \def\pgfsys@useobject#1#2{% @@ -1679,9 +1679,9 @@ \pgfsysprotocol@setcurrentprotocol\pgfsys@temp% } % Renders a previously declared object. The first parameter is the -% name of the object. The second parameter is extra code that +% name of the the object. The second parameter is extra code that % should be executed right *before* the object is rendered. Typically, -% this will be some transformation code. +% this will be some transformation code. \def\pgfsys@begininvisible{\pgfsys@transformcm{1}{0}{0}{1}{2000bp}{2000bp}} @@ -1691,7 +1691,7 @@ % graphic scope. \def\pgfsys@endinvisible{\pgfsys@transformcm{1}{0}{0}{1}{-2000bp}{-2000bp}} -% Ends the invisibility section, unless invisibility blocks have been +% Ends the invisibilty section, unless invisibility blocks have been % nested. In this case, only the `last' one restores visibility. \def\pgfsys@begininvisiblescope{\pgfsys@beginscope\pgfsys@begininvisible} @@ -1727,7 +1727,7 @@ % This will insert always-present-specials at the beginning of the -% code. +% code. \AtBeginDocument{ \pgfsys@atbegindocument \let\pgfsys@atbegindocument=\pgfutil@empty diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsysanimations.code.tex b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsysanimations.code.tex index 06bd9934bff..12862bee9db 100644 --- a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsysanimations.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsysanimations.code.tex @@ -38,7 +38,7 @@ % Set the current time to a snapshot time % % #1 = a global snapshot time (a dimensionless number, measured in -% seconds). +% seconds). % % Description: % @@ -47,11 +47,11 @@ % of the animation at the given time. % % The value #1 can be thought of as the "global time", which can be -% thought of as the time that elapsed since the "onload" event. +% thought of as the time that elapsed since the "onload" event. % % The command \pgfsysanimsnapshotafter works the same way as % pgfsysanimsnapshot, only the time #1 is interpreted as "global time -% #1 + epsilon". This means that when two or more values are specified +% #1 + epsilon". This means that when two or mroe values are specified % for time #1, the last of them is used rather than the % first. Likewise, when a non-freezing timeline ends at time #1, % \pgfsysanimsnapshot will set the value to the last value in the @@ -65,10 +65,10 @@ % - Events and restarts are ignored. For the snapshot, all animations % start at global time 0, except if the command % \pgfsysanimkeysnapshotstart is used to specify a different -% start for a specific animation. +% start for a specific animation. % - The "current value" as starting value (pgf has no real chance of % determining the correct value of this). Using this with a snapshot -% will raise an error. +% will raise an errer. % % Example: % @@ -200,7 +200,7 @@ % Companions for \pgfsys@animation@freezeatend and -% \pgfsys@animation@removeatend +% \pgfsys@animation@removeatend % % Description: % @@ -226,7 +226,7 @@ \def\pgfsysanimkeytime#1#2#3#4#5{% % Setup animation \pgfsys@animation@time{#1}{#2}{#3}{#4}{#5}% - % and remember for snapshots + % and rember for snapshots \def\pgfsysanim@time{{#1}{#2}{#3}{#4}{#5}}% } @@ -267,7 +267,7 @@ % % Description: % -% Calls \pgfsys@animation@offset. +% Calls \pgfsys@animation@offset. \def\pgfsysanimkeyoffset#1#2{% \pgfsys@animation@offset{#1}{#2}% @@ -338,7 +338,7 @@ % Description: % % Calls \pgfsys@animaion@(no)accumulate and records the setting for -% snapshots. +% snapshots. \def\pgfsysanimkeyaccumulate{\pgfsys@animation@accumulate\pgfsysanim@accumulatetrue} \def\pgfsysanimkeynoaccumulate{\pgfsys@animation@noaccumulate\pgfsysanim@accumulatefalse} @@ -353,7 +353,7 @@ % % Description: % -% Calls \pgfsys@animation@whom and records the setting for snapshots. +% Calls \pgfsys@animation@whom and records the setting for snapshots. \def\pgfsysanimkeywhom#1#2{% \pgfsys@register@type{#2}% @@ -368,12 +368,12 @@ % Companions for \pgfsys@animation@rotatealong and -% \pgfsys@animation@norotatealong +% \pgfsys@animation@norotatealong % % Description: % % Calls the system layer command and records the setting for -% snapshots. +% snapshots. \def\pgfsysanimkeyrotatealong{\pgfsys@animation@rotatealong\pgfsysanim@rotatealongtrue} \def\pgfsysanimkeynorotatealong{\pgfsys@animation@norotatealong\pgfsysanim@rotatealongfalse} @@ -450,7 +450,7 @@ } -% Suppresses the animation value +% Supresses the animation value % % Description: % @@ -566,7 +566,7 @@ \pgfsys@animation@val@color@rgb{#1}{#2}{#3}% \ifpgfsysanim@is@snap% \pgfsysanim@esnap@record{{#1}{#2}{#3}}% - \fi% + \fi% } @@ -599,7 +599,7 @@ \edef\pgfsys@temp{{\pgf@sys@tonumber\pgf@xa}{\pgf@sys@tonumber\pgf@xb}{\pgf@sys@tonumber\pgf@xc}}% \expandafter}% \expandafter\pgfsysanim@esnap@record\expandafter{\pgfsys@temp}% - \fi% + \fi% } @@ -625,7 +625,7 @@ \edef\pgfsys@temp{{\pgf@sys@tonumber\pgf@xa}{\pgf@sys@tonumber\pgf@xb}{\pgf@sys@tonumber\pgf@xc}}% \expandafter}% \expandafter\pgfsysanim@esnap@record\expandafter{\pgfsys@temp}% - \fi% + \fi% } @@ -643,7 +643,7 @@ \pgfsys@animation@val@color@gray{#1}% \ifpgfsysanim@is@snap% \pgfsysanim@esnap@record{{#1}{#1}{#1}}% - \fi% + \fi% } @@ -661,7 +661,7 @@ \pgfsys@animation@val@path{#1}% \ifpgfsysanim@is@snap% \pgfsysanim@snap@record{#1}% - \fi% + \fi% } @@ -678,7 +678,7 @@ \pgfsys@animation@val@translate{#1}{#2}% \ifpgfsysanim@is@snap% \pgfsysanim@esnap@record{{#1}{#2}}% - \fi% + \fi% } @@ -696,7 +696,7 @@ \pgfsys@animation@val@scale{#1}{#2}% \ifpgfsysanim@is@snap% \pgfsysanim@esnap@record{{#1}{#2}}% - \fi% + \fi% } @@ -714,7 +714,7 @@ \pgfsys@animation@val@viewbox{#1}{#2}{#3}{#4}% \ifpgfsysanim@is@snap% \pgfsysanim@esnap@record{{#1}{#2}{#3}{#4}}% - \fi% + \fi% } @@ -733,7 +733,7 @@ \pgfsys@animation@val@dash{#1}{#2}% \ifpgfsysanim@is@snap% \pgfsysanim@esnap@record{{#1}{#2}}% - \fi% + \fi% } @@ -1005,7 +1005,7 @@ \fi% \pgf@x\pgfmathresult pt\relax% \expandafter\pgfsysanim@splitter\the\pgf@x% - % + % \pgf@xc=\pgfsysanim@repeat@frac\pgf@xa% \advance\pgf@xc by\pgf@xb% \pgfsysanim@compute@time% @@ -1027,7 +1027,7 @@ \expandafter\pgfsysanim@test@time\pgfsys@temp% \fi% \ifpgfsysanim@cont% - \advance\pgfutil@tempcnta by1\relax% + \advance\pgfutil@tempcnta by1\relax% \pgfutil@repeat% } @@ -1056,7 +1056,7 @@ % else, do nothing \fi \else% - % always overwrite: + % always overwrite: \def\pgfsysanim@prev@val{#6}% \def\pgfsysanim@prev@time{#1}% \def\pgfsysanim@prev@spline{{#2}{#3}{#4}{#5}}% @@ -1076,7 +1076,7 @@ \pgfsysanim@contfalse% \fi% \fi% - \fi% + \fi% } \let\pgfsysanim@prev@val\relax% @@ -1100,8 +1100,8 @@ \let\pgfsysanim@code@end\pgfsysanim@code@closer% \expandafter\global\expandafter\let\pgfsysanim@code@main\pgfutil@empty% \else% - \let\pgfsysanim@code@begin\relax% - \let\pgfsysanim@code@end\relax% + \let\pgfsysanim@code@begin\relax% + \let\pgfsysanim@code@end\relax% \fi% \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\def% \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\pgfsysanim@new@main% @@ -1159,7 +1159,7 @@ \fi% \pgfsysanim@add@trans@% \fi% -} +} \def\pgfsysanim@add@trans@{% \toks0\expandafter{\pgfsysanim@snap@canvas@transform@pre}% \toks1\expandafter{\pgfsysanim@code@begin}% @@ -1307,8 +1307,8 @@ \pgfsysanim@cap@scalar{\pgfsysanim@z@val}{0}{1}% \pgfsysanim@attach{strokecolor}{\noexpand\pgfsys@color@rgb@stroke{\pgfsysanim@x@val}{\pgfsysanim@y@val}{\pgfsysanim@z@val}}{}% \fi% -} - +} + \def\pgfsysanim@prep@attr@fillcolor{% \ifpgfsysanim@valid@snapshot@time% \pgfsysanim@comp@color% @@ -1440,26 +1440,26 @@ \def\pgfsysanim@prepare@start@of@path{% \ifx\pgfsysanim@snap@tip@start\pgfutil@empty\else - % + % % Step 1: Split - % + % \ifx\pgfprocessresultpathsuffix\relax% % Ok, still need to compute the split: \pgfprocesssplitpath{\pgf@arrowpath}% \fi% - % + % % Step 2: extract - % + % \expandafter\pgf@parse@start\pgfprocessresultpathsuffix\pgf@stop\pgf@stop\pgf@stop% - % + % % Step 3: prep - % + % \pgf@prep@start% \fi% } \def\pgfsysanim@add@marker@at@start{% \ifx\pgfsysanim@snap@tip@start\pgfutil@empty\else - % + % % Step 4: draw % {% @@ -1480,24 +1480,24 @@ \pgf@precise@shorteningfalse% \edef\pgf@path@shortening@distance{0pt}% \ifx\pgfsysanim@snap@tip@end\pgfutil@empty\else - % + % % Step 1: Split - % + % \pgfprocesssplitpath{\pgfsysanim@path@val}% \pgfprocesssplitsubpath{\pgfprocessresultpathsuffix}% - % + % % Step 2: extract - % + % \expandafter\pgf@parse@end\pgfprocessresultsubpathsuffix\pgf@stop\pgf@stop\pgf@stop% - % - % Step 3: prep - % + % + % Step 3: prep + % \pgf@prep@end% \fi% } \def\pgfsysanim@add@marker@at@end{% \ifx\pgfsysanim@snap@tip@end\pgfutil@empty\else - % + % % Step 4: draw % {% @@ -1663,7 +1663,7 @@ } -% Text interpolation +% Text interpolation \def\pgfsysanim@comp@text{% \let\pgfsysanim@text@val\pgfsysanim@prev@val% @@ -1853,11 +1853,11 @@ \else% \pgf@xa#3pt% \pgf@xb#5pt% - % #4 is val support a + % #4 is val supoort a % #6 is val support b % our first approximation - \let\pgfsysanim@t\pgfsysanim@frac@a% - \let\pgfsysanim@s\pgfsysanim@frac@b% + \let\pgfsysanim@t\pgfsysanim@frac@a% + \let\pgfsysanim@s\pgfsysanim@frac@b% \pgfsysanim@eval@spline% \edef\pgfsysanim@ft{\the\pgf@x}% \pgf@x\pgfsysanim@t pt% @@ -1870,7 +1870,7 @@ % Ok, now do Newton one step \advance\pgf@x by-\pgfsysanim@ft% \pgf@x256\pgf@x% - % \pgf@x is f'(t) + % \pgf@x is f'(t) % must compute t - (f(t)-frac@a)/f'(t) \pgf@ya\pgfsysanim@ft% \advance\pgf@ya by-\pgfsysanim@frac@a pt% @@ -1901,7 +1901,7 @@ % Ok, now do Newton one step2 \advance\pgf@x by-\pgfsysanim@ft% \pgf@x256\pgf@x% - % \pgf@x is f'(t) + % \pgf@x is f'(t) % must compute t - (f(t)-frac@a)/f'(t) \pgf@ya\pgfsysanim@ft% \advance\pgf@ya by-\pgfsysanim@frac@a pt% @@ -1920,7 +1920,7 @@ \advance\pgf@y by-\pgf@x% \edef\pgfsysanim@t{\pgf@sys@tonumber\pgf@x}% \edef\pgfsysanim@s{\pgf@sys@tonumber\pgf@y}% - % Third Newton: + % Third newton: \pgfsysanim@eval@spline% \edef\pgfsysanim@ft{\the\pgf@x}% \pgf@x\pgfsysanim@t pt% @@ -1933,7 +1933,7 @@ % Ok, now do Newton one step2 \advance\pgf@x by-\pgfsysanim@ft% \pgf@x256\pgf@x% - % \pgf@x is f'(t) + % \pgf@x is f'(t) % must compute t - (f(t)-frac@a)/f'(t) \pgf@ya\pgfsysanim@ft% \advance\pgf@ya by-\pgfsysanim@frac@a pt% @@ -1973,12 +1973,12 @@ \advance\pgf@yb by\pgfsysanim@s\pgf@xa% \pgf@yc\pgfsysanim@t pt% \advance\pgf@yc by\pgfsysanim@s\pgf@xb% - % Iteration two: (ya,yb,yc) reduced to (y,xc) + % Iteration two: (ya,yb,yc) recuded to (y,xc) \pgf@y\pgfsysanim@t\pgf@yb% \advance\pgf@y by\pgfsysanim@s\pgf@ya% \pgf@xc\pgfsysanim@t\pgf@yc% \advance\pgf@xc by\pgfsysanim@s\pgf@yb% - % Iteration three: (y,xc) reduced to (x) + % Iteration three: (y,xc) recuded to (x) \pgf@x\pgfsysanim@t\pgf@xc% \advance\pgf@x by\pgfsysanim@s\pgf@y% } diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsysprotocol.code.tex b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsysprotocol.code.tex index 3625abbb576..09e6eed0a84 100644 --- a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsysprotocol.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsysprotocol.code.tex @@ -11,7 +11,7 @@ -% This package provides the pgf system protocol layer. Protocolling is +% This package provides the pgf system protcol layer. Protocolling is % used to record a bunch of graphic operations so that they can be % reused quickly at a later point. % diff --git a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsyssoftpath.code.tex b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsyssoftpath.code.tex index d04eb022885..c52f4d49de8 100644 --- a/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsyssoftpath.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/systemlayer/pgfsyssoftpath.code.tex @@ -13,7 +13,7 @@ % This package provides the pgf system path abstraction layer. This % layer is used to construct paths first ``abstractly.'' These % abstract paths can still be modified, before they are ``made -% concrete.'' +% concrete.'' % % An abstract path consists of a sequence of basic building blocks, % each of which is a tuple consisting of two numbers (specifying a @@ -29,9 +29,9 @@ % 8. closepath % 9. specialround % -% A curveto must always be preceded by a curvetosupporta and a +% A curveto must always be preceeded by a curvetosupporta and a % curvetosupportb. A non-empty path must always begin with a -% moveto. The coordinates of a closepath are non-specified, currently, +% moveto. The coordinates of a closepath are non-specified, currently, % but they might be set to the coordinate of the path segment start, % in the future. @@ -166,7 +166,7 @@ } -% Add rectangle elements to the current path +% Add rectanlge elements to the current path \def\pgfsyssoftpath@rect#1#2#3#4{% \edef\pgfsyssoftpath@temp{{% \noexpand\pgfsyssoftpath@rectcornertoken{#1}{#2}% @@ -193,12 +193,12 @@ \def\pgfsyssoftpath@curvetosupportatoken#1#2#3#4#5#6#7#8{\pgfsys@curveto{#1}{#2}{#4}{#5}{#7}{#8}} \def\pgfsyssoftpath@closepathtoken#1#2{\pgfsys@closepath} \let\pgfsyssoftpath@specialroundtoken=\pgfutil@gobbletwo -\def\pgfsyssoftpath@curvetosupportbtoken#1#2{curvetotokenb} % make sure this \ifx-equal only to itself -\def\pgfsyssoftpath@curvetotoken#1#2{curvetotoken}% make sure this \ifx-equal only to itself +\def\pgfsyssoftpath@curvetosupportbtoken#1#2{curvetotokenb} % make sure this this \ifx-equal only to itself +\def\pgfsyssoftpath@curvetotoken#1#2{curvetotoken}% make sure this this \ifx-equal only to itself \endinput -%%% Local Variables: +%%% Local Variables: %%% mode: latex -%%% End: +%%% End: diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfcalendar.code.tex b/Master/texmf-dist/tex/generic/pgf/utilities/pgfcalendar.code.tex index f7d08391757..1e4960066ed 100644 --- a/Master/texmf-dist/tex/generic/pgf/utilities/pgfcalendar.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfcalendar.code.tex @@ -45,18 +45,18 @@ % is executed. When the code is called, lots of information about the % current date (like its day of week) is available. The job of % #4 is to render the date. Typically, this is done by placing nodes -% somewhere, but the function could do other things as well. +% somewhere, but the function could do other things as well. % It is also the job of #4 to position the calendar correctly. % % The different calls of #4 are not surrounded by TeX groups (though % you can do so yourself, of course). This means that settings can % accumulate between different calls, which is often desirable and -% useful. +% useful. % % Inside #4 code, different macros can be access: % % \pgfcalendarprefix -% The parameter #1. This prefix is recommended for nodes inside the +% The parameter #1. This prefix is recomended for nodes inside the % calendar, but you have to use it yourself explicitly. % % \pgfcalendarbeginiso @@ -81,10 +81,10 @@ % Year of day to be checked % % \pgfcalendarcurrentmonth -% Month of day to be checked +% Month of day to be chjeck % % \pgfcalendarcurrentday -% Day of month of day to be checked +% Day of monath of day to be checked % % % Inside the \pgfcalendar macro the macro \ifdate is available, which @@ -105,7 +105,7 @@ \begingroup% % Setup local \ifdate \let\ifdate=\pgfcalendar@local@ifdate% - % Let's start with computing start and end dates... + % Let's start with computing start and end dates... \def\pgfcalendarprefix{#1}% \pgfcalendardatetojulian{#2}{\pgfcalendarcurrentjulian}% \edef\pgfcalendarbeginjulian{\the\pgfcalendarcurrentjulian}% @@ -163,7 +163,7 @@ % When the key-value code is executed, the following macros will have % been setup: % -% \pgfcalendarifdatejulian +% \pgfcalendarifdatejulian % Julian day number of day to be checked % % \pgfcalendarifdateweekday @@ -173,13 +173,13 @@ % Year of day to be checked % % \pgfcalendarifdatemonth -% Month of day to be checked +% Month of day to be chjeck % % \pgfcalendarifdateday % Day of month of day to be checked % % The setting of these macros will persist after the call, so a -% side-effect of calling this macro is to setup these macros. +% sideeffect of callling this macro is to setup these macros. % % By setting \ifpgfcalendar@do@not@recompute to false, the computation % of the year, month etc. is suppressed. @@ -212,7 +212,7 @@ % % Set match to false \pgfcalendarmatchesfalse% - \pgfqkeys{/pgf/calendar}{#1}% + \pgfqkeys{/pgf/calendar}{#1}% \ifpgfcalendarmatches% #2% \else% @@ -290,7 +290,7 @@ \def\pgfcalendar@special@datetojulian#1{% \edef\pgf@temp{#1}% - \expandafter\pgfcalendar@special@split@test\pgf@temp-\relax{#1}% + \expandafter\pgfcalendar@special@split@test\pgf@temp-\relax{#1}% } \def\pgfcalendar@special@split@test#1-#2-#3\relax#4{% @@ -342,7 +342,7 @@ % % Description: % -% The conversion is taken from the Wikipedia entry on Julian days. +% The conversion is taken from the Wikipedia entry on Julian days. % % The date specification works as follows: % @@ -370,7 +370,7 @@ {% % % Store year, month and days. - % + % \count1=#1\relax% \count2=#2\relax% % If #3=="last", then calculate first day of next month @@ -447,18 +447,18 @@ \ifx\pgf@temp\pgfcalendar@last@text% \advance\count7by-1\relax% \fi% - % Add offset + % Add offset \advance\count7by\count8\relax% \expandafter% }% - \expandafter#5\the\count7\relax% + \expandafter#5\the\count7\relax% } \def\pgfcalendar@last@text{last} \def\pgfcalendar@unpack#1+{% \count8=#1\relax% } -% Convert Julian day number date. +% Convert Julian day number date. % % #1 = the number of Julian days % #2 = a macro in which the year should be stored. @@ -492,23 +492,23 @@ {% % 1) J = Julian day number \count1=#1\relax% - % 2) j = J + 32044 + % 2) j = J + 32044 \count2=\count1\relax% \advance\count2 by 32044\relax% - % 3) g = j div 146097 + % 3) g = j div 146097 \count3=\count2\relax% \divide\count3 by 146097\relax% - % 4) dg = j mod 146097 + % 4) dg = j mod 146097 \count4=\count3\relax% \multiply\count4 by-146097\relax% \advance\count4 by\count2\relax% - % 5) c = (dg div 36524 + 1) * 3 div 4 + % 5) c = (dg div 36524 + 1) * 3 div 4 \count5=\count4\relax% \divide\count5 by36524\relax% \advance\count5 by1\relax% \multiply\count5 by3\relax% \divide\count5 by4\relax% - % 6) dc = dg - c * 36524 + % 6) dc = dg - c * 36524 \count6=\count4\relax% \count0=\count5\relax% \multiply\count0 by-36524\relax% @@ -571,15 +571,15 @@ \advance\count15 by1\relax% % 16)D = d + 1 \count16=\count13% - \advance\count16by 1\relax% + \advance\count16by 1\relax% % \xdef\pgf@temp@year{\the\count14}% \xdef\pgf@temp@month{\ifnum\count15<10 0\fi\the\count15}% \xdef\pgf@temp@day{\ifnum\count16<10 0\fi\the\count16}% }% \let#2=\pgf@temp@year% - \let#3=\pgf@temp@month% - \let#4=\pgf@temp@day% + \let#3=\pgf@temp@month% + \let#4=\pgf@temp@day% } @@ -620,11 +620,11 @@ % October 1st, 2006 was a \pgfcalendarweekdayname{\myweekday} \def\pgfcalendarweekdayname#1{% - \pgfutil@translate{\ifcase#1Monday\or Tuesday\or Wednesday\or Thursday\or Friday\or Saturday\or Sunday\fi}% + \translate{\ifcase#1Monday\or Tuesday\or Wednesday\or Thursday\or Friday\or Saturday\or Sunday\fi}% } \def\pgfcalendarweekdayshortname#1{% - \pgfutil@translate{\ifcase#1Mon\or Tue\or Wed\or Thu\or Fri\or Sat\or Sun\fi}% + \translate{\ifcase#1Mon\or Tue\or Wed\or Thu\or Fri\or Sat\or Sun\fi}% } @@ -637,13 +637,13 @@ % \pgfcalendarmonthname \def\pgfcalendarmonthname#1{% - \pgfutil@translate{\ifcase#1\or January\or February\or March\or April\or + \translate{\ifcase#1\or January\or February\or March\or April\or May\or June\or July\or August\or September\or October\or November\or December\fi}% } \def\pgfcalendarmonthshortname#1{% - \pgfutil@translate{\ifcase#1\or Jan\or Feb\or Mar\or Apr\or + \translate{\ifcase#1\or Jan\or Feb\or Mar\or Apr\or May\or Jun\or Jul\or Aug\or Sep\or Oct\or Nov\or Dec\fi}% } @@ -678,7 +678,7 @@ % t = textual representation (allowed only for d, m, w) % . = abbreviated textual representation (allowed only for d, m, w) % -% It is advised that you say, for example, +% It is adivsed that you say, for example, % \let\%=\pgfcalendarshorthand. % % With this setting, you can typeset an ISO-date by saying \%y0-\%m0-\%d0. diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfexternal.tex b/Master/texmf-dist/tex/generic/pgf/utilities/pgfexternal.tex index 7be11f8f0e2..ff53e5e182f 100644 --- a/Master/texmf-dist/tex/generic/pgf/utilities/pgfexternal.tex +++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfexternal.tex @@ -14,7 +14,7 @@ % % This file is intended to be distributed or even inlined into a file % when a document needs to be typeset on a system that does not have -% pgf/TikZ installed. +% pgf/TikZ installed. % "environment" for reading an external graphic. Note that there are % no (!) braces around the "name" of the environment diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfexternalwithdepth.tex b/Master/texmf-dist/tex/generic/pgf/utilities/pgfexternalwithdepth.tex index f2b08b2a9e4..38eeb306855 100644 --- a/Master/texmf-dist/tex/generic/pgf/utilities/pgfexternalwithdepth.tex +++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfexternalwithdepth.tex @@ -14,7 +14,7 @@ % % This file is intended to be distributed or even inlined into a file % when a document needs to be typeset on a system that does not have -% pgf/TikZ installed. +% pgf/TikZ installed. % "environment" for reading an external graphic. Note that there are % no (!) braces around the "name" of the environment @@ -30,14 +30,14 @@ % \endpgfgraphicnamed \long\def\beginpgfgraphicnamed#1#2\endpgfgraphicnamed{% - \begingroup - \setbox1=\hbox{\includegraphics{#1}}% - \openin1=#1.dpth - \ifeof1 \box1 - \else - \read1 to\pgfincludeexternalgraphicsdp \closein1 - \dimen0=\pgfincludeexternalgraphicsdp\relax - \hbox{\lower\dimen0 \box1 }% - \fi - \endgroup + \begingroup + \setbox1=\hbox{\includegraphics{#1}}% + \openin1=#1.dpth + \ifeof1 \box1 + \else + \read1 to\pgfincludeexternalgraphicsdp \closein1 + \dimen0=\pgfincludeexternalgraphicsdp\relax + \hbox{\lower\dimen0 \box1 }% + \fi + \endgroup } diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex b/Master/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex index 5ff18417bc6..47969aaba48 100644 --- a/Master/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex @@ -31,10 +31,10 @@ \pgffor@stack={{}{}{}} \def\pgffor@stackpush#1{% - \def\pgffor@stacktemp{#1}% - \expandafter\expandafter\expandafter\pgffor@stack\expandafter\expandafter\expandafter=% - \expandafter\expandafter\expandafter{\expandafter\expandafter\expandafter% - {\expandafter\pgffor@stacktemp\expandafter}\the\pgffor@stack}% + \def\pgffor@stacktemp{#1}% + \expandafter\expandafter\expandafter\pgffor@stack\expandafter\expandafter\expandafter=% + \expandafter\expandafter\expandafter{\expandafter\expandafter\expandafter% + {\expandafter\pgffor@stacktemp\expandafter}\the\pgffor@stack}% } \def\pgffor@stackpop{\expandafter\pgffor@@stackpop\the\pgffor@stack\pgffor@stackstop} @@ -43,40 +43,40 @@ \def\pgffor@emptyvalues{, \pgffor@stop,}% \def\pgffor@foreach{% - \pgffor@atbeginforeach% - \let\pgffor@assign@before@code=\pgfutil@empty% - \let\pgffor@assign@after@code=\pgfutil@empty% - \let\pgffor@assign@once@code=\pgfutil@empty% - \let\pgffor@remember@code=\pgfutil@empty% - \let\pgffor@remember@once@code=\pgfutil@empty% - \pgffor@alphabeticsequencefalse% - \pgffor@contextfalse% - % - \let\pgffor@var=\pgfutil@empty - % - \pgffor@vars% -} - + \pgffor@atbeginforeach% + \let\pgffor@assign@before@code=\pgfutil@empty% + \let\pgffor@assign@after@code=\pgfutil@empty% + \let\pgffor@assign@once@code=\pgfutil@empty% + \let\pgffor@remember@code=\pgfutil@empty% + \let\pgffor@remember@once@code=\pgfutil@empty% + \pgffor@alphabeticsequencefalse% + \pgffor@contextfalse% + % + \let\pgffor@var=\pgfutil@empty + % + \pgffor@vars% +} + \let\foreach=\pgffor@foreach \def\pgffor@vars{% - \pgfutil@ifnextchar i{\pgffor@@vars@end}{% - \pgfutil@ifnextchar[{\pgffor@@vars@opt}{%] - \pgfutil@ifnextchar/{\pgffor@@vars@slash@gobble}{% - \pgffor@@vars}}}}% - + \pgfutil@ifnextchar i{\pgffor@@vars@end}{% + \pgfutil@ifnextchar[{\pgffor@@vars@opt}{%] + \pgfutil@ifnextchar/{\pgffor@@vars@slash@gobble}{% + \pgffor@@vars}}}}% + \def\pgffor@@vars@end in{\pgfutil@ifnextchar\bgroup{\pgffor@normal@list}{\pgffor@macro@list}} \def\pgffor@@vars@opt[#1]{\pgfkeys{/pgf/foreach/.cd,#1}\pgffor@vars} \def\pgffor@@vars#1{\pgffor@var@add#1\pgffor@stop\pgffor@vars} \def\pgffor@@vars@slash@gobble/{\pgffor@@vars} \def\pgffor@var@add#1#2\pgffor@stop{% - \ifx\pgffor@var\pgfutil@empty% - \def\pgffor@var{#1}% - \def\pgffor@mainvar{#1}% - \else% - \expandafter\def\expandafter\pgffor@var\expandafter{\pgffor@var/#1}% - \fi% + \ifx\pgffor@var\pgfutil@empty% + \def\pgffor@var{#1}% + \def\pgffor@mainvar{#1}% + \else% + \expandafter\def\expandafter\pgffor@var\expandafter{\pgffor@var/#1}% + \fi% } \def\pgffor@macro@list#1{% @@ -105,14 +105,14 @@ \pgffor@collectbody% } \long\def\pgffor@collectargument#1{% - \expandafter\pgfutil@in@\expandafter\foreach\expandafter{\pgffor@body}% - \ifpgfutil@in@% - \expandafter\long\expandafter\def\expandafter\pgffor@body\expandafter% - {\pgffor@body{#1}}% - \else% - \expandafter\long\expandafter\def\expandafter\pgffor@body\expandafter% - {\pgffor@body#1}% - \fi% + \expandafter\pgfutil@in@\expandafter\foreach\expandafter{\pgffor@body}% + \ifpgfutil@in@% + \expandafter\long\expandafter\def\expandafter\pgffor@body\expandafter% + {\pgffor@body{#1}}% + \else% + \expandafter\long\expandafter\def\expandafter\pgffor@body\expandafter% + {\pgffor@body#1}% + \fi% \pgffor@iterate% } @@ -131,12 +131,12 @@ { \catcode`\;=\active - + \gdef\pgffor@collectactivesemicolon#1;{% \expandafter\long\expandafter\def\expandafter\pgffor@body\expandafter{\pgffor@body#1;}% \pgffor@iterate% } -} +} \def\pgffor@iterate{% % Must do all of these in case the internal stack is used. @@ -145,7 +145,7 @@ \let\pgffor@dotsend=\pgfutil@empty% \let\pgffor@dots@pre=\pgfutil@empty% \let\pgffor@dots@post=\pgfutil@empty% - % + % \expandafter\pgffor@scan\pgffor@values} \def\pgffor@stop{\pgffor@stop}% @@ -159,11 +159,11 @@ % Check for dots. \newif\ifpgffor@dots@in@ \def\pgffor@dots@in@#1...#2#3\pgffor@stop{% - \ifx\pgffor@dots@@#2% - \pgffor@dots@in@false% - \else% - \pgffor@dots@in@true% - \fi% + \ifx\pgffor@dots@@#2% + \pgffor@dots@in@false% + \else% + \pgffor@dots@in@true% + \fi% } \def\pgffor@dots@@{\pgffor@dots@@} @@ -172,9 +172,9 @@ \ifx\pgffor@value\pgffor@stop% \let\pgffor@next=\pgffor@after% Done! \else% - % Check for dots. Quicker than \pgfutil@in@ and not suceptable - % to false-positives when a token sequence ends in a single full-stop. - \expandafter\pgffor@dots@in@\pgffor@value\pgffor@dots@...\pgffor@dots@@\pgffor@stop% + % Check for dots. Quicker than \pgfutil@in@ and not suceptable + % to false-positives when a token sequence ends in a single full-stop. + \expandafter\pgffor@dots@in@\pgffor@value\pgffor@dots@...\pgffor@dots@@\pgffor@stop% \ifpgffor@dots@in@% \let\pgffor@next=\pgffor@handledots% \else% @@ -192,17 +192,17 @@ \global\pgffor@continuetrue% \pgffor@atendforeach% \pgffor@afterhook} - + \def\pgffor@handlevalue{% - \let\pgffor@prevlast=\pgffor@last% + \let\pgffor@prevlast=\pgffor@last% \let\pgffor@last=\pgffor@value% \pgffor@invokebody% \pgffor@scan% } - + \def\pgffor@invokebody{% - \pgffor@begingroup% + \pgffor@begingroup% \expandafter\pgfutil@in@\expandafter/\expandafter{\pgffor@var}% \ifpgfutil@in@% \expandafter\def\expandafter\pgffor@valuerest\expandafter{\pgffor@value//\relax}% @@ -212,21 +212,21 @@ \fi% % Execute assign once code. \ifx\pgffor@assign@once@code\pgfutil@empty% - \else% - \pgffor@assign@once@code% - \fi% + \else% + \pgffor@assign@once@code% + \fi% % Execute assign before code. \ifx\pgffor@assign@before@code\pgfutil@empty% \else% - \pgffor@assign@before@code% - \fi% - % + \pgffor@assign@before@code% + \fi% + % \expandafter\expandafter\expandafter\pgffor@reset@hooks\expandafter\pgffor@beginhook\expandafter\pgffor@body\pgffor@endhook% % Execute assign after code. \ifx\pgffor@assign@after@code\pgfutil@empty% \else% - \pgffor@assign@after@code% - \fi% + \pgffor@assign@after@code% + \fi% % \pgffor@endgroup% } @@ -245,68 +245,66 @@ \def\pgffor@multiassignrest{\expandafter\pgffor@multiassignfinal\pgffor@valuerest} \def\pgffor@multiassignfinal#1/#2/\relax{% - \def\pgffor@temp{#1}% - \ifx\pgffor@currentvar\pgffor@mainvar% - \ifpgffor@alphabeticsequence% - \pgffor@makealphabetic\pgffor@temp% - \fi% + \def\pgffor@temp{#1}% + \ifx\pgffor@currentvar\pgffor@mainvar% + \ifpgffor@alphabeticsequence% + \pgffor@makealphabetic\pgffor@temp% + \fi% \fi% \def\pgffor@test{#2}% \ifx\pgffor@test\pgfutil@empty% - \expandafter\def\expandafter\pgffor@valuerest\expandafter{\pgffor@temp//\relax}% repeat + \expandafter\def\expandafter\pgffor@valuerest\expandafter{\pgffor@temp//\relax}% repeat \else% \def\pgffor@valuerest{#2/\relax}% \fi% \expandafter\expandafter\expandafter\def\expandafter\pgffor@currentvar\expandafter{\pgffor@temp}% - % + % \expandafter\pgffor@multiassign\pgffor@rest/\relax% -} +} \def\pgffor@gobblespaces#1{\pgfutil@ifnextchar x{#1}{#1}} \def\pgffor@handledots{% - \pgffor@gobblespaces{\expandafter\pgffor@@handledots\pgffor@value\pgffor@@stop}% + \pgffor@gobblespaces{\expandafter\pgffor@@handledots\pgffor@value\pgffor@@stop}% } \newif\ifpgffor@context \def\pgffor@@handledots#1...#2\pgffor@@stop{% - % Define the context if any. - \def\pgffor@dots@pre{#1}% - \def\pgffor@dots@post{#2}% - \def\pgffor@dots@stripcontext#1##1#2\pgffor@@stop{\def\pgffor@dotsvalue{##1}}% - \pgffor@contexttrue% - \ifx\pgffor@dots@pre\pgfutil@empty% - \ifx\pgffor@dots@post\pgfutil@empty% - \pgffor@contextfalse% - \def\pgffor@dots@stripcontext##1\pgffor@@stop{\def\pgffor@dotsvalue{##1}}% - \fi% - \fi% - \pgffor@gobblespaces{\pgffor@dotsscanend}% + % Define the context if any. + \def\pgffor@dots@pre{#1}% + \def\pgffor@dots@post{#2}% + \def\pgffor@dots@stripcontext#1##1#2\pgffor@@stop{\def\pgffor@dotsvalue{##1}}% + \pgffor@contexttrue% + \ifx\pgffor@dots@pre\pgfutil@empty% + \ifx\pgffor@dots@post\pgfutil@empty% + \pgffor@contextfalse% + \def\pgffor@dots@stripcontext##1\pgffor@@stop{\def\pgffor@dotsvalue{##1}}% + \fi% + \fi% + \pgffor@gobblespaces{\pgffor@dotsscanend}% } \def\pgffor@dots@value@process#1{% - \expandafter\pgffor@dots@stripcontext#1\pgffor@@stop% - \expandafter\pgffor@dots@charcheck\pgffor@dotsvalue\pgffor@@stop% + \expandafter\pgffor@dots@stripcontext#1\pgffor@@stop% + \expandafter\pgffor@dots@charcheck\pgffor@dotsvalue\pgffor@@stop% \ifpgffor@alphabeticsequence \else - \ifpgffor@assign@parse - \begingroup - \pgfkeys{/pgf/fpu/false/.try}% - \pgfmathparse{\pgffor@dotsvalue}% - \pgfmath@smuggleone\pgfmathresult - \endgroup - \let\pgffor@dotsvalue=\pgfmathresult - \fi + \begingroup + \pgfkeys{/pgf/fpu/false/.try}% + \pgfmathparse{\pgffor@dotsvalue}% + \pgfmath@smuggleone\pgfmathresult + \endgroup + \let\pgffor@dotsvalue=\pgfmathresult \fi - \let#1=\pgffor@dotsvalue% + \let#1=\pgffor@dotsvalue% } \def\pgffor@dotsscanend#1,{% - \pgffor@alphabeticsequencefalse% - % Strip context and check for a character sequence. - \def\pgffor@dotsend{#1}% - \pgffor@dots@value@process{\pgffor@dotsend}% + \pgffor@alphabeticsequencefalse% + % Strip context and check for a character sequence. + \def\pgffor@dotsend{#1}% + \pgffor@dots@value@process{\pgffor@dotsend}% % \pgffor@dots@value@process{\pgffor@last}% % @@ -318,7 +316,7 @@ \pgffor@skip=-1pt% \fi% \else% - \pgffor@dots@value@process{\pgffor@prevlast}% + \pgffor@dots@value@process{\pgffor@prevlast}% \pgffor@skip=\pgffor@last pt% \pgffor@iter=\pgffor@prevlast pt% \advance\pgffor@skip by-\pgffor@iter% @@ -348,8 +346,8 @@ } \def\pgffor@endloop{% - \pgffor@alphabeticsequencefalse% - \pgffor@scan% + \pgffor@alphabeticsequencefalse% + \pgffor@scan% } {\catcode`\p=12\catcode`\t=12\gdef\Pgffor@geT#1pt{#1}} @@ -367,168 +365,168 @@ \expandafter\def\expandafter\pgffor@valuerest\expandafter{\pgffor@temp//\relax}% \expandafter\pgffor@multiassign\pgffor@var/\pgffor@stop/\pgffor@stop/\relax% \else% - % Convert to alphabetic sequence, if necessary. - \ifpgffor@alphabeticsequence% - \pgffor@makealphabetic\pgffor@temp% - \expandafter\let\pgffor@var=\pgffor@temp% - \else% - \expandafter\expandafter\expandafter\def\expandafter\pgffor@var\expandafter{\pgffor@temp}% + % Convert to alphabetic sequence, if necessary. + \ifpgffor@alphabeticsequence% + \pgffor@makealphabetic\pgffor@temp% + \expandafter\let\pgffor@var=\pgffor@temp% + \else% + \expandafter\expandafter\expandafter\def\expandafter\pgffor@var\expandafter{\pgffor@temp}% \fi% \fi% % Insert any context, if any. \ifpgffor@context% \let\pgffor@temp=\pgffor@dots@pre% - \expandafter\pgfutil@append@macrotomacro\expandafter% - {\expandafter\pgffor@temp\expandafter}\expandafter{\pgffor@var}% - \expandafter\pgfutil@append@macrotomacro\expandafter% - {\expandafter\pgffor@temp\expandafter}\expandafter{\pgffor@dots@post}% - \expandafter\let\pgffor@var=\pgffor@temp% - \fi% - % Perform assignments before loop body. - \ifx\pgffor@assign@before@code\pgfutil@empty% + \expandafter\pgfutil@append@macrotomacro\expandafter% + {\expandafter\pgffor@temp\expandafter}\expandafter{\pgffor@var}% + \expandafter\pgfutil@append@macrotomacro\expandafter% + {\expandafter\pgffor@temp\expandafter}\expandafter{\pgffor@dots@post}% + \expandafter\let\pgffor@var=\pgffor@temp% + \fi% + % Perform assignments before loop body. + \ifx\pgffor@assign@before@code\pgfutil@empty% \else% - \pgffor@assign@before@code% - \fi% - % + \pgffor@assign@before@code% + \fi% + % \expandafter\expandafter\expandafter\pgffor@reset@hooks\expandafter\pgffor@beginhook\expandafter\pgffor@body\pgffor@endhook% % % Perform assignments after loop body. - \ifx\pgffor@assign@after@code\pgfutil@empty% + \ifx\pgffor@assign@after@code\pgfutil@empty% \else% - \pgffor@assign@after@code% - \fi% + \pgffor@assign@after@code% + \fi% \pgffor@endgroup% - \pgffor@loop% + \pgffor@loop% } \def\pgffor@strip#1.0{\def\pgffor@temp{#1}} \def\breakforeach{\global\pgffor@continuefalse} - + \def\pgffor@gobbletil@pgffor@@stop#1\pgffor@@stop{} \newif\ifpgffor@registeriscount \def\pgffor@ifcsregister#1{% - \expandafter\pgffor@@ifcsregister\meaning#1\pgffor@stop} + \expandafter\pgffor@@ifcsregister\meaning#1\pgffor@stop} \def\pgffor@@ifcsregister#1#2#3#4#5\pgffor@stop{% - \if#1m% It is an ordinary (m)acro. - \pgffor@registeriscountfalse% - \let\pgffor@csnext=\pgfutil@secondoftwo% - \else% - \if#1u% It is (u)ndefined. - \let\pgffor@csnext=\pgfutil@secondoftwo% - \pgffor@registeriscountfalse% - \else% - \let\pgffor@csnext=\pgfutil@firstoftwo% - \if#4u% It is a co(u)nt - \pgffor@registeriscounttrue% - \else% Assume it is a dimen or skip (bad assumption in the general case). - \pgffor@registeriscountfalse% - \let\pgffor@csnext=\pgfutil@firstoftwo% - \fi% - \fi% - \fi% - \pgffor@csnext} - + \if#1m% It is an ordinary (m)acro. + \pgffor@registeriscountfalse% + \let\pgffor@csnext=\pgfutil@secondoftwo% + \else% + \if#1u% It is (u)ndefined. + \let\pgffor@csnext=\pgfutil@secondoftwo% + \pgffor@registeriscountfalse% + \else% + \let\pgffor@csnext=\pgfutil@firstoftwo% + \if#4u% It is a co(u)nt + \pgffor@registeriscounttrue% + \else% Assume it is a dimen or skip (bad assumption in the general case). + \pgffor@registeriscountfalse% + \let\pgffor@csnext=\pgfutil@firstoftwo% + \fi% + \fi% + \fi% + \pgffor@csnext} + \newif\ifpgffor@alphabeticsequence -% +% \def\pgffor@dots@charcheck#1\pgffor@@stop{% \edef\pgffor@dots@charcheck@temp{#1}% \expandafter\expandafter\expandafter\pgffor@@dotscharcheck\expandafter\meaning\pgffor@dots@charcheck@temp\pgffor@@stop% } \def\pgffor@@dotscharcheck#1#2\pgffor@@stop{% - \if#1t% - \afterassignment\pgffor@gobbletil@pgffor@@stop% - \expandafter\chardef\expandafter\pgffor@char\expandafter=\expandafter`\pgffor@dots@charcheck@temp\relax\pgffor@@stop% - \edef\pgffor@char{\the\pgffor@char}% - \ifnum\pgffor@char>64\relax% From A-Z? - \ifnum\pgffor@char<91\relax% - \let\pgffor@dotsvalue=\pgffor@char% - \pgffor@alphabeticsequencetrue% - \else% - \ifnum\pgffor@char>96\relax% From a-z? - \ifnum\pgffor@char<123\relax% - \let\pgffor@dotsvalue=\pgffor@char% - \pgffor@alphabeticsequencetrue% - \fi% - \fi% - \fi% - \fi% - \fi% + \if#1t% + \afterassignment\pgffor@gobbletil@pgffor@@stop% + \expandafter\chardef\expandafter\pgffor@char\expandafter=\expandafter`\pgffor@dots@charcheck@temp\relax\pgffor@@stop% + \edef\pgffor@char{\the\pgffor@char}% + \ifnum\pgffor@char>64\relax% From A-Z? + \ifnum\pgffor@char<91\relax% + \let\pgffor@dotsvalue=\pgffor@char% + \pgffor@alphabeticsequencetrue% + \else% + \ifnum\pgffor@char>96\relax% From a-z? + \ifnum\pgffor@char<123\relax% + \let\pgffor@dotsvalue=\pgffor@char% + \pgffor@alphabeticsequencetrue% + \fi% + \fi% + \fi% + \fi% + \fi% } \def\pgffor@makealphabetic#1{% - % Convert the number in the macro passed as #1 to a-z or A-Z. - \pgfutil@tempcnta=#1\relax% - \ifnum\pgfutil@tempcnta>95\relax% - \advance\pgfutil@tempcnta by-96\relax% - \edef#1{\pgffor@alpha\pgfutil@tempcnta}% - \else% - \advance\pgfutil@tempcnta by-64 % - \edef#1{\pgffor@Alpha\pgfutil@tempcnta}% - \fi% + % Convert the number in the macro passed as #1 to a-z or A-Z. + \pgfutil@tempcnta=#1\relax% + \ifnum\pgfutil@tempcnta>95\relax% + \advance\pgfutil@tempcnta by-96\relax% + \edef#1{\pgffor@alpha\pgfutil@tempcnta}% + \else% + \advance\pgfutil@tempcnta by-64 % + \edef#1{\pgffor@Alpha\pgfutil@tempcnta}% + \fi% } \def\pgffor@Alpha#1{% - \ifcase#1\relax\or A\or B\or C\or D\or E\or F\or G\or H\or I\or J\or K\or L\or M% - \or N\or O\or P\or Q\or R\or S\or T\or U\or V\or W\or X\or Y\or Z\else?\fi% + \ifcase#1\relax\or A\or B\or C\or D\or E\or F\or G\or H\or I\or J\or K\or L\or M% + \or N\or O\or P\or Q\or R\or S\or T\or U\or V\or W\or X\or Y\or Z\else?\fi% } \def\pgffor@alpha#1{% - \ifcase#1\relax\or a\or b\or c\or d\or e\or f\or g\or h\or i\or j\or k\or l\or m% - \or n\or o\or p\or q\or r\or s\or t\or u\or v\or w\or x\or y\or z\else?\fi% + \ifcase#1\relax\or a\or b\or c\or d\or e\or f\or g\or h\or i\or j\or k\or l\or m% + \or n\or o\or p\or q\or r\or s\or t\or u\or v\or w\or x\or y\or z\else?\fi% } \newtoks\pgffor@toks \def\pgffor@addcstotoks#1{% - \expandafter\def\expandafter\pgffor@tokstemp\expandafter{\expandafter\def\expandafter#1\expandafter{#1}}% - \pgffor@@addcstotoks} + \expandafter\def\expandafter\pgffor@tokstemp\expandafter{\expandafter\def\expandafter#1\expandafter{#1}}% + \pgffor@@addcstotoks} \def\pgffor@addregtotoks#1{% - \expandafter\def\expandafter\pgffor@tokstemp\expandafter{\expandafter#1\expandafter=\the#1}% - \pgffor@@addcstotoks} + \expandafter\def\expandafter\pgffor@tokstemp\expandafter{\expandafter#1\expandafter=\the#1}% + \pgffor@@addcstotoks} \def\pgffor@addiftotoks#1{% - \begingroup% - \escapechar=-1\relax% - \expandafter\pgffor@@addiftotoks\string#1\pgffor@stop} + \begingroup% + \escapechar=-1\relax% + \expandafter\pgffor@@addiftotoks\string#1\pgffor@stop} \def\pgffor@@addiftotoks#1#2#3#4\pgffor@stop{% - \endgroup - \csname if#3#4\endcsname% - \expandafter\def\expandafter\pgffor@tokstemp\expandafter{\csname#3#4true\endcsname}% - \else% - \expandafter\def\expandafter\pgffor@tokstemp\expandafter{\csname#3#4false\endcsname}% - \fi% - \pgffor@@addcstotoks% + \endgroup + \csname if#3#4\endcsname% + \expandafter\def\expandafter\pgffor@tokstemp\expandafter{\csname#3#4true\endcsname}% + \else% + \expandafter\def\expandafter\pgffor@tokstemp\expandafter{\csname#3#4false\endcsname}% + \fi% + \pgffor@@addcstotoks% } \def\pgffor@@addcstotoks{% - \expandafter\expandafter\expandafter\pgffor@toks\expandafter\expandafter\expandafter=% - \expandafter\expandafter\expandafter{\expandafter\pgffor@tokstemp\the\pgffor@toks}% + \expandafter\expandafter\expandafter\pgffor@toks\expandafter\expandafter\expandafter=% + \expandafter\expandafter\expandafter{\expandafter\pgffor@tokstemp\the\pgffor@toks}% } % Set up the pgffor scopes. \def\pgffor@atbeginforeach{% - \begingroup% + \begingroup% } \def\pgffor@atendforeach{% - \global\edef\pgffor@remember@expanded{\pgffor@remember@code}% + \global\edef\pgffor@remember@expanded{\pgffor@remember@code}% \endgroup% \ifx\pgffor@remember@expanded\pgfutil@empty% \else% - \pgffor@remember@expanded% - \global\let\pgffor@remember@expanded=\pgfutil@empty% + \pgffor@remember@expanded% + \global\let\pgffor@remember@expanded=\pgfutil@empty% \fi% } \def\pgffor@default@begingroup{% - \begingroup% + \begingroup% } \let\pgffor@remember@once@expanded=\pgfutil@empty @@ -566,30 +564,30 @@ \let\pgffor@begingroup=\pgffor@default@begingroup \let\pgffor@endgroup=\pgffor@default@endgroup - + \def\pgffor@stack@begingroup{% - \pgffor@toks={}% - \pgffor@addcstotoks{\pgffor@mainvar}% - \pgffor@addcstotoks{\pgffor@var}% - \pgffor@addcstotoks{\pgffor@body}% - % - \pgffor@addcstotoks{\pgffor@last}% - \pgffor@addcstotoks{\pgffor@prevlast}% - \pgffor@addcstotoks{\pgffor@dotsend}% - % - \pgffor@addcstotoks{\pgffor@assign@before@code}% - \pgffor@addcstotoks{\pgffor@assign@after@code}% - \pgffor@addcstotoks{\pgffor@remember@code}% - \pgffor@addcstotoks{\pgffor@remember@once@code}% - \pgffor@addcstotoks{\pgffor@dots@pre}% - \pgffor@addcstotoks{\pgffor@dots@post}% - % - \pgffor@addregtotoks{\pgffor@iter}% - \pgffor@addregtotoks{\pgffor@skip}% - % - \pgffor@addiftotoks{\ifpgffor@alphabeticsequence}% - \pgffor@addiftotoks{\ifpgffor@context}% - \expandafter\pgffor@stackpush\expandafter{\the\pgffor@toks}% + \pgffor@toks={}% + \pgffor@addcstotoks{\pgffor@mainvar}% + \pgffor@addcstotoks{\pgffor@var}% + \pgffor@addcstotoks{\pgffor@body}% + % + \pgffor@addcstotoks{\pgffor@last}% + \pgffor@addcstotoks{\pgffor@prevlast}% + \pgffor@addcstotoks{\pgffor@dotsend}% + % + \pgffor@addcstotoks{\pgffor@assign@before@code}% + \pgffor@addcstotoks{\pgffor@assign@after@code}% + \pgffor@addcstotoks{\pgffor@remember@code}% + \pgffor@addcstotoks{\pgffor@remember@once@code}% + \pgffor@addcstotoks{\pgffor@dots@pre}% + \pgffor@addcstotoks{\pgffor@dots@post}% + % + \pgffor@addregtotoks{\pgffor@iter}% + \pgffor@addregtotoks{\pgffor@skip}% + % + \pgffor@addiftotoks{\ifpgffor@alphabeticsequence}% + \pgffor@addiftotoks{\ifpgffor@context}% + \expandafter\pgffor@stackpush\expandafter{\the\pgffor@toks}% } \def\pgffor@stack@endgroup{\pgffor@stackpop} @@ -598,166 +596,163 @@ \newif\ifpgffor@assign@evaluate \newif\ifpgffor@assign@once -\newif\ifpgffor@assign@parse \pgfkeys{/pgf/foreach/.cd, - var/.code=\pgffor@var@add#1\pgffor@stop, - scope iterations/.code={ - \csname if#1\endcsname% - \let\pgffor@begingroup=\pgffor@default@begingroup% - \let\pgffor@endgroup=\pgffor@default@endgroup% - \else% - \let\pgffor@begingroup=\pgffor@stack@begingroup% - \let\pgffor@endgroup=\pgffor@stack@endgroup% - \fi% - }, - evaluate/.code=\pgffor@assign@evaluatetrue\pgffor@assign@oncefalse\pgffor@assign@parse{#1},% - assign/.code=\pgffor@assign@evaluatefalse\pgffor@assign@oncefalse\pgffor@assign@parse{#1},% - evaluate once/.code=\pgffor@assign@evaluatetrue\pgffor@assign@oncetrue\pgffor@assign@parse{#1},% - assign once/.code=\pgffor@assign@evaluatefalse\pgffor@assign@oncetrue\pgffor@assign@parse{#1},% - remember/.code=\pgffor@remember@parse{#1},% - count/.code=\pgffor@count@parse#1\pgffor@stop, - parse/.is if=pgffor@assign@parse, - parse/.default=false, + var/.code=\pgffor@var@add#1\pgffor@stop, + scope iterations/.code={ + \csname if#1\endcsname% + \let\pgffor@begingroup=\pgffor@default@begingroup% + \let\pgffor@endgroup=\pgffor@default@endgroup% + \else% + \let\pgffor@begingroup=\pgffor@stack@begingroup% + \let\pgffor@endgroup=\pgffor@stack@endgroup% + \fi% + }, + evaluate/.code=\pgffor@assign@evaluatetrue\pgffor@assign@oncefalse\pgffor@assign@parse{#1},% + assign/.code=\pgffor@assign@evaluatefalse\pgffor@assign@oncefalse\pgffor@assign@parse{#1},% + evaluate once/.code=\pgffor@assign@evaluatetrue\pgffor@assign@oncetrue\pgffor@assign@parse{#1},% + assign once/.code=\pgffor@assign@evaluatefalse\pgffor@assign@oncetrue\pgffor@assign@parse{#1},% + remember/.code=\pgffor@remember@parse{#1},% + count/.code=\pgffor@count@parse#1\pgffor@stop } \def\pgffor@assign@parse#1{% - \pgfutil@in@;{#1}% - \ifpgfutil@in@% - \else% - \pgfutil@in@={#1}% - \fi% - \ifpgfutil@in@% - \pgffor@assign@@parse#1;\pgffor@stop;% - \else% - \pgffor@assign@parse@old#1\pgffor@stop%% - \fi% + \pgfutil@in@;{#1}% + \ifpgfutil@in@% + \else% + \pgfutil@in@={#1}% + \fi% + \ifpgfutil@in@% + \pgffor@assign@@parse#1;\pgffor@stop;% + \else% + \pgffor@assign@parse@old#1\pgffor@stop%% + \fi% } \def\pgffor@stop{\pgffor@stop} \def\pgffor@assign@@parse#1;{% - \def\pgffor@test{#1}% - \ifx\pgffor@test\pgffor@stop% - \let\pgffor@next=\relax% - \else% - \let\pgffor@next=\pgffor@assign@@parse% - \ifx\pgffor@test\pgfutil@empty% - \else% - \pgfutil@in@={#1}% - \ifpgfutil@in@% - \pgffor@assign@@@parse#1\pgffor@stop% - \else% - \pgffor@assign@@@parse#1=#1\pgffor@stop% - \fi% - \fi% - \fi% - \pgffor@next} - + \def\pgffor@test{#1}% + \ifx\pgffor@test\pgffor@stop% + \let\pgffor@next=\relax% + \else% + \let\pgffor@next=\pgffor@assign@@parse% + \ifx\pgffor@test\pgfutil@empty% + \else% + \pgfutil@in@={#1}% + \ifpgfutil@in@% + \pgffor@assign@@@parse#1\pgffor@stop% + \else% + \pgffor@assign@@@parse#1=#1\pgffor@stop% + \fi% + \fi% + \fi% + \pgffor@next} + \def\pgffor@assign@@@parse#1=#2\pgffor@stop{% - \ifpgffor@assign@evaluate% - \ifpgffor@assign@once% - \pgfutil@append@tomacro{\pgffor@assign@once@code}{\pgfmathparse{#2}\let#1=\pgfmathresult}% - \pgfutil@append@tomacro{\pgffor@remember@once@code}{\noexpand\def\noexpand#1{#2}}% - \else - \pgfutil@append@tomacro{\pgffor@assign@before@code}{\pgfmathparse{#2}\let#1=\pgfmathresult}% - \fi% - \else% - \ifpgffor@assign@once% - \pgfutil@append@tomacro{\pgffor@assign@once@code}{\def#1{#2}}% - \pgfutil@append@tomacro{\pgffor@remember@once@code}{\noexpand\def\noexpand#1{#2}}% - \else - \pgfutil@append@tomacro{\pgffor@assign@before@code}{\def#1{#2}}% - \fi% - \fi% + \ifpgffor@assign@evaluate% + \ifpgffor@assign@once% + \pgfutil@append@tomacro{\pgffor@assign@once@code}{\pgfmathparse{#2}\let#1=\pgfmathresult}% + \pgfutil@append@tomacro{\pgffor@remember@once@code}{\noexpand\def\noexpand#1{#2}}% + \else + \pgfutil@append@tomacro{\pgffor@assign@before@code}{\pgfmathparse{#2}\let#1=\pgfmathresult}% + \fi% + \else% + \ifpgffor@assign@once% + \pgfutil@append@tomacro{\pgffor@assign@once@code}{\def#1{#2}}% + \pgfutil@append@tomacro{\pgffor@remember@once@code}{\noexpand\def\noexpand#1{#2}}% + \else + \pgfutil@append@tomacro{\pgffor@assign@before@code}{\def#1{#2}}% + \fi% + \fi% } \def\pgffor@assign@parse@old#1#2\pgffor@stop{% - \pgffor@assign@@parse@old#2\pgffor@stop as#1using #1\pgffor@@stop} + \pgffor@assign@@parse@old#2\pgffor@stop as#1using #1\pgffor@@stop} \def\pgffor@assign@@parse@old#1as#2#3\pgffor@@stop{% - \pgffor@assign@@@parse@old{#2}#1#3\pgffor@stop\pgffor@@stop} + \pgffor@assign@@@parse@old{#2}#1#3\pgffor@stop\pgffor@@stop} \def\pgffor@assign@@@parse@old#1#2using #3\pgffor@stop#4\pgffor@@stop{% - \pgffor@assign@@@parse#1=#3\pgffor@stop} - + \pgffor@assign@@@parse#1=#3\pgffor@stop} + \def\pgffor@remember@parse#1{% - \pgfutil@in@ a{#1}% This matches the 'a' in 'as' or 'initially'. - \ifpgfutil@in@% - \pgffor@remember@parse@old#1\pgffor@stop% - \else% - \pgffor@remember@@parse#1;\pgffor@stop;% - \fi% + \pgfutil@in@ a{#1}% This matches the 'a' in 'as' or 'intially'. + \ifpgfutil@in@% + \pgffor@remember@parse@old#1\pgffor@stop% + \else% + \pgffor@remember@@parse#1;\pgffor@stop;% + \fi% } \def\pgffor@remember@@parse#1;{% - \def\pgffor@test{#1}% - \ifx\pgffor@test\pgffor@stop% - \let\pgffor@next=\relax% - \else% - \let\pgffor@next=\pgffor@remember@@parse% - \ifx\pgffor@test\pgfutil@empty% - \else% - \pgfutil@in@={#1}% - \ifpgfutil@in@% - \pgffor@remember@@@parse#1\pgffor@stop% - \else% - \pgffor@ifcsregister{#1}{% - \pgfutil@append@tomacro{\pgffor@remember@code}{\noexpand#1=\the#1\noexpand\relax}% - }% - {% - \pgfutil@append@tomacro{\pgffor@remember@code}{\noexpand\def\noexpand#1{#1}}% - }% - \fi% - \fi% - \fi% - \pgffor@next% + \def\pgffor@test{#1}% + \ifx\pgffor@test\pgffor@stop% + \let\pgffor@next=\relax% + \else% + \let\pgffor@next=\pgffor@remember@@parse% + \ifx\pgffor@test\pgfutil@empty% + \else% + \pgfutil@in@={#1}% + \ifpgfutil@in@% + \pgffor@remember@@@parse#1\pgffor@stop% + \else% + \pgffor@ifcsregister{#1}{% + \pgfutil@append@tomacro{\pgffor@remember@code}{\noexpand#1=\the#1\noexpand\relax}% + }% + {% + \pgfutil@append@tomacro{\pgffor@remember@code}{\noexpand\def\noexpand#1{#1}}% + }% + \fi% + \fi% + \fi% + \pgffor@next% } \def\pgffor@remember@@@parse#1=#2\pgffor@stop{% - \pgffor@ifcsregister{#2}{% - \pgfutil@append@tomacro{\pgffor@assign@after@code}{\expandafter\def\expandafter#1\expandafter{\the#2}}% - \pgfutil@append@tomacro{\pgffor@remember@code}{\noexpand\def\noexpand#1{#1}}% - }% - {% - \pgfutil@append@tomacro{\pgffor@assign@after@code}{\expandafter\def\expandafter#1\expandafter{#2}}% - \pgfutil@append@tomacro{\pgffor@remember@code}{\noexpand\def\noexpand#1{#1}}% - }% + \pgffor@ifcsregister{#2}{% + \pgfutil@append@tomacro{\pgffor@assign@after@code}{\expandafter\def\expandafter#1\expandafter{\the#2}}% + \pgfutil@append@tomacro{\pgffor@remember@code}{\noexpand\def\noexpand#1{#1}}% + }% + {% + \pgfutil@append@tomacro{\pgffor@assign@after@code}{\expandafter\def\expandafter#1\expandafter{#2}}% + \pgfutil@append@tomacro{\pgffor@remember@code}{\noexpand\def\noexpand#1{#1}}% + }% } \def\pgffor@remember@parse@old#1#2\pgffor@stop{% - \pgffor@remember@@parse@old#1#2\pgffor@stop as#1(initially )\pgffor@@stop} + \pgffor@remember@@parse@old#1#2\pgffor@stop as#1(initially )\pgffor@@stop} \def\pgffor@remember@@parse@old#1#2as#3#4\pgffor@@stop{% - \pgffor@remember@@@parse@old{#1}{#3}#2#4\pgffor@stop\pgffor@@stop} + \pgffor@remember@@@parse@old{#1}{#3}#2#4\pgffor@stop\pgffor@@stop} \def\pgffor@remember@@@parse@old#1#2#3(initially #4)#5\pgffor@stop#6\pgffor@@stop{% - \pgfutil@append@tomacro{\pgffor@assign@after@code}{\edef#2{#1}}% - \pgfutil@append@tomacro{\pgffor@remember@code}{\noexpand\def\noexpand#2{#2}}% - \def\pgffor@test{#4}% - \ifx\pgffor@test\pgfutil@empty% - \else% - \pgfutil@append@tomacro{\pgffor@assign@once@code}{\def#2{#4}}% - \fi% + \pgfutil@append@tomacro{\pgffor@assign@after@code}{\edef#2{#1}}% + \pgfutil@append@tomacro{\pgffor@remember@code}{\noexpand\def\noexpand#2{#2}}% + \def\pgffor@test{#4}% + \ifx\pgffor@test\pgfutil@empty% + \else% + \pgfutil@append@tomacro{\pgffor@assign@once@code}{\def#2{#4}}% + \fi% } \def\pgffor@count@parse#1#2\pgffor@stop{% - \pgffor@count@@parse#1#2\pgffor@stop from 1\pgffor@stop\pgffor@@stop} + \pgffor@count@@parse#1#2\pgffor@stop from 1\pgffor@stop\pgffor@@stop} \def\pgffor@count@@parse#1#2from#3\pgffor@stop#4\pgffor@@stop{% - \pgfutil@append@tomacro\pgffor@remember@code{\noexpand\def\noexpand#1{#1}}% - \pgfutil@append@tomacro\pgffor@assign@before@code{\pgfmathparse{int(#1+1)}\let#1=\pgfmathresult}% - \pgfmathparse{int(#3-1)}\let#1=\pgfmathresult% + \pgfutil@append@tomacro\pgffor@remember@code{\noexpand\def\noexpand#1{#1}}% + \pgfutil@append@tomacro\pgffor@assign@before@code{\pgfmathparse{int(#1+1)}\let#1=\pgfmathresult}% + \pgfmathparse{int(#3-1)}\let#1=\pgfmathresult% } \def\pgfutil@append@macrotomacro#1#2{% - \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter% - #1\expandafter\expandafter\expandafter{\expandafter#1#2}} + \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter% + #1\expandafter\expandafter\expandafter{\expandafter#1#2}} \def\pgfutil@append@tomacro#1#2{% - \expandafter\def\expandafter#1\expandafter{#1#2}} - + \expandafter\def\expandafter#1\expandafter{#1#2}} + \endinput diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex b/Master/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex index f89e43639f4..6d9f08fdcba 100644 --- a/Master/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex @@ -9,8 +9,8 @@ % The files pgfkeys.code.tex and pgfkeysfiltered.code.tex are -% perfectly self-contained, except that the catcode of @ -% should be made a letter. +% perfectly self-contained, except that the catcode of @ +% should be made a letter. % Guard against reading twice @@ -19,8 +19,8 @@ \else \expandafter\endinput \fi - -% The purpose of this file is to provide a general settings engine that + +% The purpose of this file is to provide a general settings engine that % works with all TeX formats and has no save-stack impact @@ -56,7 +56,7 @@ % Description: % % This command sets the key to the given tokens. The tokens are stored as -% is and can even contain things like #9. +% is and can even contain things like #9. % % Keys are organized hierarchically using something similar to Unix % paths. Thus, a typically key might be called "/tikz/length" or @@ -78,7 +78,7 @@ \long\def\pgfkeyssetevalue#1#2{% \pgfkeys@temptoks={#2}% - \pgfkeys@temptoks=\pgfutil@scantokens\expandafter{\expandafter{\the\pgfkeys@temptoks}}% + \pgfkeys@temptoks=\scantokens\expandafter{\expandafter{\the\pgfkeys@temptoks}}% \expandafter\edef\csname pgfk@#1\expandafter\endcsname\expandafter{\the\pgfkeys@temptoks}% } @@ -156,7 +156,7 @@ % Description: % % This command will expand to the value stored in the key. The key -% should previously have been set using \pgfkeyasetkey or \pgfkeyslet. +% should previously have been set using \pgfkeyasetkey or \pgfkeyslet. % % Example: % @@ -213,7 +213,7 @@ % specified, the value of the token register "\pgfkeypath" is used. If % "=value" is missing, the value of the setting "/path/key/.@def" is used % instead. If this key is set to "\pgfvaluerequired", the key -% "/errors/value required/.@cmd" is executed. This error handler, +% "/errors/value required/.@cmd" is executed. Theis error handler, % like all other error handlers, will get the current key as its first % parameter (unexpanded) and the current value as its second value % (also unexpanded). @@ -247,7 +247,7 @@ % 3) Otherwise, if the key /handlers/key/.@cmd is present, it is executed % with the same parameters as in 1). Additionally, the % token register \pgfcurrentkeypath will be set to "/path/" and the -% macro \pgfcurrentkeywithoutpath to "key". So, in the above +% macor \pgfcurrentkeywithoutpath to "key". So, in the above % example if neither "/stuff/height/.@cmd" nor % "/stuff/height" is present, but "/handlers/height" is, % then "/handlers/height" is executed with the parameters: @@ -326,7 +326,7 @@ \def\pgfkeys@cleanup\pgfkeys@mainstop{} \def\pgfkeys@mainstop{\pgfkeys@mainstop} % equals only itself -\def\pgfkeys@novalue{} +\def\pgfkeys@novalue{} \def\pgfkeysnovalue{\pgfkeys@novalue} % equals only itself \def\pgfkeysnovalue@text{\pgfkeysnovalue} \def\pgfkeysvaluerequired{\pgfkeysvaluerequired} % equals only itself @@ -400,7 +400,7 @@ % '/my search path' % % Idea: - % set + % set % - path := '/my search path' % - name := 'key/.code' % - key = '/my search path/key/.code' @@ -417,7 +417,7 @@ }% } -% this macro is to implement the |handle only existing| key in key filtering: +% this macro is to implement the |handly only existing| key in key filtering: % #1: the code to invoke IF the key handler shall be executed % #2: the code to invoke if it shall not run. \def\pgfkeys@ifexecutehandler#1#2{#1}% @@ -533,7 +533,7 @@ % #1 = default path % #2 = key-value pairs % -% Description: +% Desscription: % % This command starts the execution with the default path set to % #1. This command should only be used when speed is important (like @@ -553,7 +553,7 @@ % % #1 = key-value pairs % -% Description: +% Desscription: % % This code may only be called inside the code that is executed for a % key. The #1 should be a list of settings pairs. They will be executed @@ -572,7 +572,7 @@ % #1 = default path % #2 = key-value pairs % -% Description: +% Desscription: % % This command executes #2 with the default path set to #1. This % command will cause chaos if used incorrectly. The only safe @@ -588,7 +588,7 @@ -% Now setup the default handlers and keys: +% Now setup the default handelers and keys: % Define a key macro with one argument (\def or \edef) % @@ -616,7 +616,7 @@ } -% Define a key macro with multiple arguments (\def or \edef) +% Define a key macro with mutliple arguments (\def or \edef) % % #1 = key % #2 = argument pattern @@ -664,7 +664,7 @@ % {2} % } % ->defnargs: 1=`1', 2=`2' -% +% % defargs: % \pgfkeysdefargs{/b}{#1#2}{1=`#1', 2=`#2'} % \pgfkeys{ @@ -678,7 +678,7 @@ % \pgfkeysdefargs{/b}{#1#2}{1=`#1', 2=`#2'} % \pgfkeys{ % /b= -% {1}% +% {1}% % {2} % } % ->defargs: 1=`1', 2=`2' @@ -863,7 +863,7 @@ \edef\pgf@keys@list@path{\pgfkeyscurrentpath}% \expandafter\expandafter\expandafter\pgf@keys@do@list% \expandafter\expandafter\expandafter{\expandafter\pgf@keys@list@path\expandafter}\pgf@keys@temp\pgf@stop% - }% + }% } \def\pgf@keys@do@list#1{\pgf@keys@utilifnextchar\bgroup{\pgf@keys@do@list@item{#1}}\pgf@keys@gobble} \def\pgf@keys@do@list@item#1#2{\pgfkeysalso{#1={#2}}\pgf@keys@do@list{#1}} @@ -878,7 +878,7 @@ % Inspection handlers -\pgfkeys{/handlers/.show value/.code=\pgfkeysgetvalue{\pgfkeyscurrentpath}{\pgfkeysshower}\show\pgfkeysshower} % inspect the value +\pgfkeys{/handlers/.show value/.code=\pgfkeysgetvalue{\pgfkeyscurrentpath}{\pgfkeysshower}\show\pgfkeysshower} % inspect the value \pgfkeys{/handlers/.show code/.code=\pgfkeysgetvalue{\pgfkeyscurrentpath/.@cmd}{\pgfkeysshower}\show\pgfkeysshower} % inspect the body of the command @@ -988,7 +988,7 @@ {% \pgfkeys@split@path% \pgfkeysifdefined{/handlers/\pgfkeyscurrentname/.@cmd}{% - % in the standard configuration, this check here is redundant + % in the standard configuration, this check here is redundand % because pgfkeys@ifexecutehandler === true. % It is only interesting for 'handle only existing'. \pgfkeys@ifexecutehandler{% @@ -1055,7 +1055,7 @@ \def\pgf@temp{#2}% \pgfkeys@error{% I do not know the key '\the\toks1'\ifx\pgf@temp\pgfkeysnovalue@text\space\else, to which you passed - '\the\toks2', \fi and I am going to ignore it. Perhaps you + '\the\toks2', \fi and I am going to ignore it. Perhaps you misspelled it% } } diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.code.tex b/Master/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.code.tex index 7c6d6e49cef..1a413536783 100644 --- a/Master/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfkeysfiltered.code.tex @@ -6,13 +6,13 @@ % 2. under the GNU Public License. % % See the file doc/generic/pgf/licenses/LICENSE for more details. -% +% % This file contains additions to pgfkeys.code.tex (loaded % automatically at the end of pgfkeys.code.tex) % % Improvements: % -% - option filtering +% - option filtering % you provide % - a boolean predicate % - a "filter handler" which will be invoked for non-matching options, @@ -50,44 +50,44 @@ % Performs 'filtered' key settings. % -% For every option for which the path prefixing has already been done, +% For every option for which the path prefixing has already been done, % the current key filter predicate will be invoked. If the predicate % returns true, pgfkeys will process this key in the normal manner. % If not, a key filter handler will be invoked. % % The *predicate* and *handler* semantics are as follows: % PRECONDITION: -% 1. The variables -% \pgfkeyscurrentkey (full path including name) -% \pgfkeyscurrentkeyRAW (the current key as it has been -% found in the key=value list -% without path modification) -% \pgfkeyscurrentvalue -% are all set. If the current key is a handler variable, -% \pgfkeyscurrentname -% and -% \pgfkeyscurrentpath -% are also set. -% 2. The type of option has already been checked, that means -% case (1) whether '.@cmd' exists -% case (2) whether the key as such has its value -% case (3) it is a handler like '.code', '.cd' or whatever. -% case (0) it is unknown. -% The actual case number (0-3) will be provided as contents -% of the macro -% \pgfkeyscasenumber. -% It is always a one-character token, so it may be compared -% with both, \ifnum or \if. -% Please note that unknown options will be processed with -% the usual '.unknown' handlers unless the key filter takes -% control over unknown options as well. +% 1. The variables +% \pgfkeyscurrentkey (full path including name) +% \pgfkeyscurrentkeyRAW (the current key as it has been +% found in the key=value list +% without path modification) +% \pgfkeyscurrentvalue +% are all set. If the current key is a handler variable, +% \pgfkeyscurrentname +% and +% \pgfkeyscurrentpath +% are also set. +% 2. The type of option has already been checked, that means +% case (1) whether '.@cmd' exists +% case (2) whether the key as such has its value +% case (3) it is a handler like '.code', '.cd' or whatever. +% case (0) it is unknown. +% The actual case number (0-3) will be provided as contents +% of the macro +% \pgfkeyscasenumber. +% It is always a one-character token, so it may be compared +% with both, \ifnum or \if. +% Please note that unknown options will be processed with +% the usual '.unknown' handlers unless the key filter takes +% control over unknown options as well. % % POSTCONDITION: -% the predicate sets -% \pgfkeysfiltercontinuetrue -% or -% \pgfkeysfiltercontinuefalse -% (the boolean \ifpgfkeysfiltercontinue). +% the predicate sets +% \pgfkeysfiltercontinuetrue +% or +% \pgfkeysfiltercontinuefalse +% (the boolean \ifpgfkeysfiltercontinue). % Depending on this 'if', option processing will be continued or % skipped. % @@ -107,43 +107,43 @@ % invoke \pgfkeyssplitpath. In any other case, neither path nor name % are required for the options processing - if you need them for % predicates/handlers, you need to compute them by hand. -% +% % % Example: % \def\unmatched{} % \pgfkeys{/pgf/key filters/is descendant of/.install key filter=/my group} % \pgfkeys{/pgf/key filter handlers/append filtered to/.install key filter handler=\unmatched} % \pgfkeysfiltered% -% {/my group/option 1=value 1,/tikz/option 2=value 2} +% {/my group/option 1=value 1,/tikz/option 2=value 2} % -> % will set '/my group/option 1' as usual, but '/tikz/option 2' will not -% be set. Instead, it will be appended to '\unmatched' such that +% be set. Instead, it will be appended to '\unmatched' such that % \unmatched = {/tikz/option 2=value2} % after the operation. % % Arguments: % #1: key-value list. \def\pgfkeysfiltered{% - % produce - % '{<default path>}' - % each expanded exactly one time into the register: - \expandafter\pgfkeysfiltered@@install\expandafter{\pgfkeysdefaultpath}% + % produce + % '{<default path>}' + % each expanded exactly one time into the register: + \expandafter\pgfkeysfiltered@@install\expandafter{\pgfkeysdefaultpath}% } % #1: old value of default path. % #2: key-value-list. \long\def\pgfkeysfiltered@@install#1#2{% - \pgfkeys@install@filter@and@invoke{% - \let\pgfkeysdefaultpath\pgfkeys@root% - \pgfkeys@parse#2,\pgfkeys@mainstop% - \def\pgfkeysdefaultpath{#1}% - }% + \pgfkeys@install@filter@and@invoke{% + \let\pgfkeysdefaultpath\pgfkeys@root% + \pgfkeys@parse#2,\pgfkeys@mainstop% + \def\pgfkeysdefaultpath{#1}% + }% } % Assuming that macro #1 contains a key=value list, this command % performs an \pgfkeysalso command for the content of macro #1. % -% It can be used in conjunction with +% It can be used in conjunction with % - \pgfkeysfiltered and % - \pgfkeysappendfilterednamestomacro: % the first pass fill only process options matching the filter, then, @@ -153,17 +153,17 @@ % Example: % \pgfkeys{/my group/.cd,/utils/exec=\pgfkeysalsofrom\filtered} \long\def\pgfkeysalsofrom#1{% - \expandafter\pgfkeysalso\expandafter{#1}% + \expandafter\pgfkeysalso\expandafter{#1}% } % The same as \pgfkeysalsofrom, but it invokes \pgfkeysalsofiltered. \long\def\pgfkeysalsofilteredfrom#1{% - \expandafter\pgfkeysalsofiltered\expandafter{#1}% + \expandafter\pgfkeysalsofiltered\expandafter{#1}% } % #1 = options \long\def\pgfkeysalsofiltered#1{% - \pgfkeys@install@filter@and@invoke{\pgfkeysalso{#1}}% + \pgfkeys@install@filter@and@invoke{\pgfkeysalso{#1}}% }% % The same like \pgfkeysfiltered, but with quick search path setting. @@ -171,28 +171,28 @@ % #1: default path % #2: key-value-pairs \long\def\pgfqkeysfiltered#1{% - \expandafter\pgfqkeysfiltered@@install\expandafter{\pgfkeysdefaultpath}{#1}% + \expandafter\pgfqkeysfiltered@@install\expandafter{\pgfkeysdefaultpath}{#1}% } % #1: old value of default path. % #2: default path % #3: key-value-list. \long\def\pgfqkeysfiltered@@install#1#2#3{% - \pgfkeys@install@filter@and@invoke{% - \def\pgfkeysdefaultpath{#2/}\pgfkeys@parse#3,\pgfkeys@mainstop\def\pgfkeysdefaultpath{#1}% - }% + \pgfkeys@install@filter@and@invoke{% + \def\pgfkeysdefaultpath{#2/}\pgfkeys@parse#3,\pgfkeys@mainstop\def\pgfkeysdefaultpath{#1}% + }% } % Family management % % The family code provides the following features: % 1. every key can be associated with 0 or 1 'family'. -% 2. Families are a loose association which are independent of the key +% 2. Families are a loose association which are independend of the key % hierarchy. % For example, /my tree/key1 can belong to family /tikz. % % 3. It is possible to "activate" or "deactivate" single families. -% Furthermore, it is possible to set only keys which belong to +% Furthermore, it is possible to set only keys which belong to % active families (using \pgfkeysfiltered). % 4. Runtime complexities: % If you have N options and you only want to process K active @@ -206,10 +206,10 @@ % % #1 maybe a macro. \def\pgfkeysactivatefamily#1{% - \pgfkeysiffamilydefined - {#1}% - {\csname pgfk@#1/familyactivetrue\endcsname}% - {\pgfkeysvalueof{/errors/family unknown/.@cmd}{#1}\pgfeov}% + \pgfkeysiffamilydefined + {#1}% + {\csname pgfk@#1/familyactivetrue\endcsname}% + {\pgfkeysvalueof{/errors/family unknown/.@cmd}{#1}\pgfeov}% %\message{[ACTIVATING FAMILY #1]}% } @@ -217,10 +217,10 @@ % % #1 maybe a macro. \def\pgfkeysdeactivatefamily#1{% - \pgfkeysiffamilydefined - {#1}% - {\csname pgfk@#1/familyactivefalse\endcsname}% - {\pgfkeysvalueof{/errors/family unknown/.@cmd}{#1}\pgfeov}% + \pgfkeysiffamilydefined + {#1}% + {\csname pgfk@#1/familyactivefalse\endcsname}% + {\pgfkeysvalueof{/errors/family unknown/.@cmd}{#1}\pgfeov}% %\message{[DEACTIVATING FAMILY #1]}% } @@ -232,26 +232,26 @@ % #1: a comma-separated list of fully qualified family names. % #2: a command which will be filled with a deactivate-all command. \def\pgfkeysactivatefamilies#1#2{% - \pgfkeyssavekeyfilterstateto\pgfkeys@cur@state - \expandafter\pgfkeysactivatefamilies@impl\expandafter{\pgfkeys@cur@state}{#1}{#2}% + \pgfkeyssavekeyfilterstateto\pgfkeys@cur@state + \expandafter\pgfkeysactivatefamilies@impl\expandafter{\pgfkeys@cur@state}{#1}{#2}% } % #1: commands needed to restore the old filtering state % #2: family name list % #3: macro name for de-activate command \def\pgfkeysactivatefamilies@impl#1#2#3{% - \pgfkeysinstallkeyfilter{/pgf/key filters/false}{}% - \let#3=\pgfkeys@empty% - \def\pgfkeys@filtered@handler{\pgfkeys@family@activate@handler{#3}}% - \pgfkeysalsofiltered{#2}% - #1% + \pgfkeysinstallkeyfilter{/pgf/key filters/false}{}% + \let#3=\pgfkeys@empty% + \def\pgfkeys@filtered@handler{\pgfkeys@family@activate@handler{#3}}% + \pgfkeysalsofiltered{#2}% + #1% } \def\pgfkeys@family@activate@handler#1{% - \pgfkeysactivatefamily{\pgfkeyscurrentkey}% - % produce - % <old list> '\pgfkeysdeactivatefamily{' <current key> '}' - \pgfkeys@tmptoks=\expandafter\expandafter\expandafter{\expandafter#1\expandafter\pgfkeysdeactivatefamily\expandafter{\pgfkeyscurrentkey}}% - \edef#1{\the\pgfkeys@tmptoks}% + \pgfkeysactivatefamily{\pgfkeyscurrentkey}% + % produce + % <old list> '\pgfkeysdeactivatefamily{' <current key> '}' + \pgfkeys@tmptoks=\expandafter\expandafter\expandafter{\expandafter#1\expandafter\pgfkeysdeactivatefamily\expandafter{\pgfkeyscurrentkey}}% + \edef#1{\the\pgfkeys@tmptoks}% } % If for testing whether a family exists. @@ -266,18 +266,18 @@ % called. \long\def\pgfkeysiffamilydefined#1#2#3{\pgfkeys@ifcsname ifpgfk@#1/familyactive\endcsname#2\else#3\fi} -% Sets the TeX boolean +% Sets the TeX boolean % \ifpgfkeysfiltercontinue := ( family #1 is active ) -% +% % Argument: % #1 the family name. Maybe a macro. \def\pgfkeysisfamilyactive#1{% - \pgfkeysiffamilydefined{#1}{% - \expandafter\let\expandafter\ifpgfkeysfiltercontinue\csname ifpgfk@#1/familyactive\endcsname - }{% - \pgfkeysvalueof{/errors/family unknown/.@cmd}{#1}\pgfeov% - \expandafter\expandafter\expandafter\let\csname ifpgfkeysfiltercontinue\endcsname\csname iffalse\endcsname - }% + \pgfkeysiffamilydefined{#1}{% + \expandafter\let\expandafter\ifpgfkeysfiltercontinue\csname ifpgfk@#1/familyactive\endcsname + }{% + \pgfkeysvalueof{/errors/family unknown/.@cmd}{#1}\pgfeov% + \expandafter\expandafter\expandafter\let\csname ifpgfkeysfiltercontinue\endcsname\csname iffalse\endcsname + }% }% % Retrieve the family of full key #1 into macro #2. @@ -292,33 +292,33 @@ % macro. % #2: a macro name which will be filled with the result. \def\pgfkeysgetfamily#1#2{% - \pgfkeysifdefined{#1/family}{\pgfkeysgetvalue{#1/family}{#2}\pgfkeyssuccesstrue}{\pgfkeyssuccessfalse}% + \pgfkeysifdefined{#1/family}{\pgfkeysgetvalue{#1/family}{#2}\pgfkeyssuccesstrue}{\pgfkeyssuccessfalse}% } % Equivalent to \pgfkeys{#1/.belongs to family=#2} \def\pgfkeyssetfamily#1#2{% - \pgfkeysiffamilydefined{#2}{% - \pgfkeyssetvalue{#1/family}{#2}% - }{% - \pgfkeysalso{/errors/family unknown=#2}% - }% + \pgfkeysiffamilydefined{#2}{% + \pgfkeyssetvalue{#1/family}{#2}% + }{% + \pgfkeysalso{/errors/family unknown=#2}% + }% }% % Sets \ifpgfkeysfiltercontinue to true iff the current key belongs to % the /errors tree. \long\def\pgfkeys@cur@is@descendant@of@errors{% - \expandafter\pgfkeys@cur@is@descendant@of@errors@impl\pgfkeyscurrentkey/errors\pgf@@eov + \expandafter\pgfkeys@cur@is@descendant@of@errors@impl\pgfkeyscurrentkey/errors\pgf@@eov }% \long\def\pgfkeys@cur@is@descendant@of@errors@impl#1/errors#2\pgf@@eov{% - \def\pgfkeyspred@TMP{#1}% - \ifx\pgfkeyspred@TMP\pgfkeys@empty + \def\pgfkeyspred@TMP{#1}% + \ifx\pgfkeyspred@TMP\pgfkeys@empty %\message{[SPECIAL CHECK] '\pgfkeyscurrentkey' is descendant of '/errors': TRUE.}% - \pgfkeysfiltercontinuetrue - \else + \pgfkeysfiltercontinuetrue + \else %\message{[SPECIAL CHECK] '\pgfkeyscurrentkey' is descendant of '/errors': FALSE.}% - \pgfkeysfiltercontinuefalse - \fi + \pgfkeysfiltercontinuefalse + \fi }% % \pgfkeysinterruptkeyfilter @@ -333,19 +333,19 @@ % \pgfkeysinterruptkeyfilter...\endpgfkeysinterruptkeyfilter does NOT % introduce a \TeX-group. \def\pgfkeysinterruptkeyfilter{% - \ifpgfkeysfilteringisactive - \let\pgfkeys@case@one=\pgfkeys@orig@case@one - \let\pgfkeys@try=\pgfkeys@orig@try - \let\pgfkeys@unknown=\pgfkeys@orig@unknown - \fi + \ifpgfkeysfilteringisactive + \let\pgfkeys@case@one=\pgfkeys@orig@case@one + \let\pgfkeys@try=\pgfkeys@orig@try + \let\pgfkeys@unknown=\pgfkeys@orig@unknown + \fi } \def\endpgfkeysinterruptkeyfilter{% - \ifpgfkeysfilteringisactive - \let\pgfkeys@case@one=\pgfkeys@case@one@filtered - \let\pgfkeys@try=\pgfkeys@try@filtered - \let\pgfkeys@unknown=\pgfkeys@unknown@filtered - \fi + \ifpgfkeysfilteringisactive + \let\pgfkeys@case@one=\pgfkeys@case@one@filtered + \let\pgfkeys@try=\pgfkeys@try@filtered + \let\pgfkeys@unknown=\pgfkeys@unknown@filtered + \fi } % Activates families #1, calls \pgfkeysfiltered and deactivates the @@ -359,9 +359,9 @@ % % @see \pgfkeysactivatefamiliesandfilteroptions \def\pgfkeysactivatefamiliesandfilteroptions#1#2{% - \pgfkeysactivatefamilies{#1}{\pgfkeys@family@deactivation}% - \pgfkeysfiltered{#2}% - \pgfkeys@family@deactivation + \pgfkeysactivatefamilies{#1}{\pgfkeys@family@deactivation}% + \pgfkeysfiltered{#2}% + \pgfkeys@family@deactivation } % The "quick" variant of \pgfkeysactivatefamiliesandfilteroptions: it @@ -371,9 +371,9 @@ % #2: default path % #3: key-value pairs \def\pgfqkeysactivatefamiliesandfilteroptions#1#2#3{% - \pgfkeysactivatefamilies{#1}{\pgfkeys@family@deactivation}% - \pgfqkeysfiltered{#2}{#3}% - \pgfkeys@family@deactivation + \pgfkeysactivatefamilies{#1}{\pgfkeys@family@deactivation}% + \pgfqkeysfiltered{#2}{#3}% + \pgfkeys@family@deactivation } % Public version of split path: @@ -386,9 +386,9 @@ % #1: family (maybe a macro) % #2: key-value pairs \def\pgfkeysactivatesinglefamilyandfilteroptions#1#2{% - \pgfkeysactivatefamily{#1}% - \pgfkeysfiltered{#2}% - \pgfkeysdeactivatefamily{#1}% + \pgfkeysactivatefamily{#1}% + \pgfkeysfiltered{#2}% + \pgfkeysdeactivatefamily{#1}% } % The "quick" variant of \pgfkeysactivatesinglefamilyandfilteroptions @@ -397,9 +397,9 @@ % #2: default path % #3: key-value pairs \def\pgfqkeysactivatesinglefamilyandfilteroptions#1#2#3{% - \pgfkeysactivatefamily{#1}% - \pgfqkeysfiltered{#2}{#3}% - \pgfkeysdeactivatefamily{#1}% + \pgfkeysactivatefamily{#1}% + \pgfqkeysfiltered{#2}{#3}% + \pgfkeysdeactivatefamily{#1}% } % Installs the key filter '#1' with argument '#2'. @@ -416,20 +416,20 @@ % #2: optional arguments for the key. If the key expects more than one % argument, supply '{{first}{second}}' \def\pgfkeysinstallkeyfilter#1#2{% - \pgfkeysifdefined{#1/.@cmd}{% - \edef\pgfkeyscurrentkeyfilter{#1}% - \def\pgfkeyscurrentkeyfilterargs{#2}% - \pgfkeysgetvalue{#1/.@cmd}{\pgfkeys@key@predicate@}% - \def\pgfkeys@key@predicate{\pgfkeys@key@predicate@#2\pgfeov}% - }{% - \pgfkeysvalueof{/errors/no such key filter/.@cmd}{#1}{#2}\pgfeov% - }% + \pgfkeysifdefined{#1/.@cmd}{% + \edef\pgfkeyscurrentkeyfilter{#1}% + \def\pgfkeyscurrentkeyfilterargs{#2}% + \pgfkeysgetvalue{#1/.@cmd}{\pgfkeys@key@predicate@}% + \def\pgfkeys@key@predicate{\pgfkeys@key@predicate@#2\pgfeov}% + }{% + \pgfkeysvalueof{/errors/no such key filter/.@cmd}{#1}{#2}\pgfeov% + }% } % Installs the key filter handler '#1' with argument '#2'. % This is equivalent to % \pgfkeys{#1/.install key filter handler=#2} -% +% % The current values of the key filter handler is stored into the public % macros % \pgfkeyscurrentkeyfilterhandler @@ -440,333 +440,332 @@ % #2: optional arguments for the handler. If the handler expects more than one % argument, supply '{{first}{second}}' \def\pgfkeysinstallkeyfilterhandler#1#2{% - \pgfkeysifdefined{#1/.@cmd}{% - \edef\pgfkeyscurrentkeyfilterhandler{#1}% - \def\pgfkeyscurrentkeyfilterhandlerargs{#2}% - \pgfkeysgetvalue{#1/.@cmd}{\pgfkeys@filtered@handler@}% - \def\pgfkeys@filtered@handler{\pgfkeys@filtered@handler@#2\pgfeov}% - }{% - \pgfkeysvalueof{/errors/no such key filter handler/.@cmd}{#1}{#2}\pgfeov% - }% + \pgfkeysifdefined{#1/.@cmd}{% + \edef\pgfkeyscurrentkeyfilterhandler{#1}% + \def\pgfkeyscurrentkeyfilterhandlerargs{#2}% + \pgfkeysgetvalue{#1/.@cmd}{\pgfkeys@filtered@handler@}% + \def\pgfkeys@filtered@handler{\pgfkeys@filtered@handler@#2\pgfeov}% + }{% + \pgfkeysvalueof{/errors/no such key filter handler/.@cmd}{#1}{#2}\pgfeov% + }% } % Creates a macro which contains commands to re-activate the current % key filter and key filter handler. It can be used to temporarily % switch the key filter. \def\pgfkeyssavekeyfilterstateto#1{% - % produce the string - % \pgfkeysinstallkeyfilter{...}{...} - % \pgfkeysinstallkeyfilterhandler{...}{...} - % where each argument is expanded once - % FIXME: Do the same with less overhead! - \pgfkeys@tmptoks={\pgfkeysinstallkeyfilter}% - \pgfkeys@tmptoks=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfkeys@tmptoks\expandafter{\pgfkeyscurrentkeyfilter}}% - \pgfkeys@tmptoks=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfkeys@tmptoks\expandafter{\pgfkeyscurrentkeyfilterargs}\pgfkeysinstallkeyfilterhandler}% - \pgfkeys@tmptoks=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfkeys@tmptoks\expandafter{\pgfkeyscurrentkeyfilterhandler}}% - \pgfkeys@tmptoks=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfkeys@tmptoks\expandafter{\pgfkeyscurrentkeyfilterhandlerargs}}% - \edef#1{% - \the\pgfkeys@tmptoks - }% + % produce the string + % \pgfkeysinstallkeyfilter{...}{...} + % \pgfkeysinstallkeyfilterhandler{...}{...} + % where each argument is expanded once + % FIXME: Do the same with less overhead! + \pgfkeys@tmptoks={\pgfkeysinstallkeyfilter}% + \pgfkeys@tmptoks=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfkeys@tmptoks\expandafter{\pgfkeyscurrentkeyfilter}}% + \pgfkeys@tmptoks=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfkeys@tmptoks\expandafter{\pgfkeyscurrentkeyfilterargs}\pgfkeysinstallkeyfilterhandler}% + \pgfkeys@tmptoks=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfkeys@tmptoks\expandafter{\pgfkeyscurrentkeyfilterhandler}}% + \pgfkeys@tmptoks=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgfkeys@tmptoks\expandafter{\pgfkeyscurrentkeyfilterhandlerargs}}% + \edef#1{% + \the\pgfkeys@tmptoks + }% } \pgfkeys{% - /errors/family unknown/.code=\pgfkeys@error{% - Sorry, I do not know family '#1' and can't work with any assoicated family handling. Perhaps you misspelled it?}, - /errors/no such key filter/.code 2 args=\pgfkeys@error{Sorry, there is no such key filter '#1'.}, - /errors/no such key filter handler/.code 2 args=\pgfkeys@error{Sorry, there is no such key filter handler '#1'.}, - % HANDLERS: - % - % .is family should - % 1. '.cd' into the families' path, - % 2. define booleans to activate/deactive the family - % (see \pgfkeysisfamilyactive) - % 3. make sure that \pgfkeyshasactivefamily returns true for - % the family itself. - /handlers/.is family/.append code={% - %\newif is an \outer macro in plain tex, so this here is not portable: - %\expandafter\newif\csname if\pgfkeyscurrentpath/familyactive\endcsname - \edef\pgfkeyspred@TMP{pgfk@\pgfkeyscurrentpath/familyactive}% - \expandafter\pgfkeys@non@outer@newif\expandafter{\pgfkeyspred@TMP}% - \edef\pgfkeyspred@TMP{\pgfkeyscurrentpath/.belongs to family=\pgfkeyscurrentpath}% - \expandafter\pgfkeysalso\expandafter{\pgfkeyspred@TMP}% - },% - /handlers/.activate family/.code=\pgfkeysactivatefamily{\pgfkeyscurrentpath}, - /handlers/.deactivate family/.code=\pgfkeysdeactivatefamily{\pgfkeyscurrentpath}, - /handlers/.belongs to family/.code={\pgfkeyssetfamily{\pgfkeyscurrentpath}{#1}},% - % - % - % An addition to the '.try' and '.retry' handlers: - % - % It is the same as '.retry', but if the option is still unknown, the - % usual handlers for unknown keys will be invoked. - /handlers/.lastretry/.code={% - \ifpgfkeyssuccess\else - \pgfkeys@try - \ifpgfkeyssuccess\else - % discard the '.lastretry' suffix: - \edef\pgfkeyscurrentkey{\pgfkeyscurrentpath}% - \pgfkeys@split@path% - \pgfkeys@unknown - \fi - \fi - }, - % - % - /handlers/.install key filter/.code={% - \pgfkeysinstallkeyfilter{\pgfkeyscurrentpath}{#1}% - },% - /handlers/.install key filter handler/.code={% - \pgfkeysinstallkeyfilterhandler{\pgfkeyscurrentpath}{#1}% - },% - % - % - % KEY FILTER HANDLERS: - % - /pgf/key filter handlers/append filtered to/.code={% - % Produce - % <orig key> '={' <value> '}' - % where both, the key and the value are expanded just ONCE: - \pgfkeys@tmptoks=\expandafter\expandafter\expandafter{\expandafter\pgfkeyscurrentkeyRAW\expandafter=\expandafter{\pgfkeyscurrentvalue}}% - \ifx#1\pgfkeys@empty - \else - % Produce <old list> ',' <orig key> '={' <value> '}' - \pgfkeys@tmptoks=\expandafter\expandafter\expandafter{\expandafter#1\expandafter,\the\pgfkeys@tmptoks}% - \fi - \edef#1{\the\pgfkeys@tmptoks}% - },% - /pgf/key filter handlers/ignore/.code={}, - /pgf/key filter handlers/ignore/.install key filter handler, - /pgf/key filter handlers/log/.code={% - \pgf@typeout{LOG: the option '\pgfkeyscurrentkey' (was originally '\pgfkeyscurrentkeyRAW') (case \pgfkeyscasenumber) has not been processed due to pgfkeysfiltered.}% - }, - % - % - % KEY FILTER PREDICATES: - % - % Returns true if the currently processed key belongs to an active family. - % A family is active if it has been activated before. - /pgf/key filters/active families/.code={% - \if\pgfkeyscasenumber0% - % unknown options shall be processed with the - % unknown-handlers. - \pgfkeysfiltercontinuetrue - \else - \if\pgfkeyscasenumber3% - \pgfkeysgetfamily\pgfkeyscurrentpath\pgfkeyspred@TMP - \else - \pgfkeysgetfamily\pgfkeyscurrentkey\pgfkeyspred@TMP - \fi - \ifpgfkeyssuccess - \pgfkeysisfamilyactive{\pgfkeyspred@TMP}% - \else% Ok, it does not belong to any family. - \pgfkeysfiltercontinuefalse - \fi - \fi - },% - % - % - % - % This filter works as follows: - % 1. if the current key belongs to a family: - % return whether its family is active, - % 2. if the current key does NOT belong to a family: - % return the result of criterion '#1', - % 3. the current key is unknown: - % return the result of criterion '#2'. - % - % Arguments: - % #1: the predicate which will be invoked in case 2. - % It will be invoked with the current case number as argument. - % #2: the predicate which will be invoked in case 3 with - % the current case number as argument. - /pgf/key filters/active families or no family/.code 2 args={% - \if\pgfkeyscasenumber0% - \pgfkeysevalkeyfilterwith{#2}% - \else - \if\pgfkeyscasenumber3% - \pgfkeysgetfamily\pgfkeyscurrentpath\pgfkeyspred@TMP - \else - \pgfkeysgetfamily\pgfkeyscurrentkey\pgfkeyspred@TMP - \fi - \ifpgfkeyssuccess - \pgfkeysisfamilyactive{\pgfkeyspred@TMP}% - \else% Ok, it does not belong to any family. - \pgfkeysevalkeyfilterwith{#1}% - \fi - \fi - }, - /pgf/key filters/active families or no family DEBUG/.code 2 args={% - \if\pgfkeyscasenumber0% - \pgf@typeout{[pgfkeyshasactivefamilyornofamily(\pgfkeyscurrentkey, \pgfkeyscasenumber) invoking unknown handler '#2']}% - \pgfkeysevalkeyfilterwith{#2}% - \else - \if\pgfkeyscasenumber3% - \pgfkeysgetfamily\pgfkeyscurrentpath\pgfkeyspred@TMP - \else - \pgfkeysgetfamily\pgfkeyscurrentkey\pgfkeyspred@TMP - \fi - \ifpgfkeyssuccess - \pgfkeysisfamilyactive{\pgfkeyspred@TMP}% - \ifpgfkeysfiltercontinue - \pgf@typeout{[pgfkeyshasactivefamilyornofamily(\pgfkeyscurrentkey, \pgfkeyscasenumber) family is ACTIVE]}% - \else - \pgf@typeout{[pgfkeyshasactivefamilyornofamily(\pgfkeyscurrentkey, \pgfkeyscasenumber) family is NOT active.]}% - \fi - \else% Ok, it does not belong to any family. - \pgf@typeout{[pgfkeyshasactivefamilyornofamily(\pgfkeyscurrentkey, \pgfkeyscasenumber) invoking has-no-family-handler '#1']}% - \pgfkeysevalkeyfilterwith{#1}% - \fi - \fi - }, - % - % A (faster) shortcut for - % /pgf/key filters/active families or no family= - % {/pgf/keys filters/false} - % {/pgf/keys filters/false} - /pgf/key filters/active families and known/.code={% - \if\pgfkeyscasenumber0% - \pgfkeysfiltercontinuefalse - \else - \if\pgfkeyscasenumber3% - \pgfkeysgetfamily\pgfkeyscurrentpath\pgfkeyspred@TMP - \else - \pgfkeysgetfamily\pgfkeyscurrentkey\pgfkeyspred@TMP - \fi - \ifpgfkeyssuccess - \pgfkeysisfamilyactive{\pgfkeyspred@TMP}% - \else% Ok, it does not belong to any family. - \pgfkeysfiltercontinuefalse - \fi - \fi - }, - % A (faster) shortcut for - % /pgf/key filters/active families or no family= - % {/pgf/key filters/is descendant of=#1}% for keys without family - % {/pgf/keys filters/false} - /pgf/key filters/active families or descendants of/.code={% - \if\pgfkeyscasenumber0% - \pgfkeysfiltercontinuefalse - \else - \if\pgfkeyscasenumber3% - \pgfkeysgetfamily\pgfkeyscurrentpath\pgfkeyspred@TMP - \else - \pgfkeysgetfamily\pgfkeyscurrentkey\pgfkeyspred@TMP - \fi - \ifpgfkeyssuccess - \pgfkeysisfamilyactive{\pgfkeyspred@TMP}% - \else% Ok, it does not belong to any family. - % the 'is descendant of' implementation has been - % COPY PASTED here: - % - % string prefix comparison: - \def\pgfkeysisdescendantof@impl##1#1##2\pgf@@eov{% - \def\pgfkeyspred@TMP{##1}% - \ifx\pgfkeyspred@TMP\pgfkeys@empty - \pgfkeysfiltercontinuetrue - \else - \pgfkeysfiltercontinuefalse - \fi - }% - \expandafter\pgfkeysisdescendantof@impl\pgfkeyscurrentkey#1\pgf@@eov - \fi - \fi - }, - % - % Processes only options which are children of #1. - % Example: - % is descendant of/.install key filter=/foo - % will be true for - % /foo/bar/x=y - % /foo/.cd - % /foo/bar/.style=... - % but not for - % /bar/foo/... - /pgf/key filters/is descendant of/.code={% - \if\pgfkeyscasenumber0% + /errors/family unknown/.code=\pgfkeys@error{% + Sorry, I do not know family '#1' and can't work with any assoicated family handling. Perhaps you misspelled it?}, + /errors/no such key filter/.code 2 args=\pgfkeys@error{Sorry, there is no such key filter '#1'.}, + /errors/no such key filter handler/.code 2 args=\pgfkeys@error{Sorry, there is no such key filter handler '#1'.}, + % HANDLERS: + % + % .is family should + % 1. '.cd' into the families' path, + % 2. define booleans to activate/deactive the family + % (see \pgfkeysisfamilyactive) + % 3. make sure that \pgfkeyshasactivefamily returns true for + % the family itsself. + /handlers/.is family/.append code={% + %\newif is an \outer macro in plain tex, so this here is not portable: + %\expandafter\newif\csname if\pgfkeyscurrentpath/familyactive\endcsname + \edef\pgfkeyspred@TMP{pgfk@\pgfkeyscurrentpath/familyactive}% + \expandafter\pgfkeys@non@outer@newif\expandafter{\pgfkeyspred@TMP}% + \edef\pgfkeyspred@TMP{\pgfkeyscurrentpath/.belongs to family=\pgfkeyscurrentpath}% + \expandafter\pgfkeysalso\expandafter{\pgfkeyspred@TMP}% + },% + /handlers/.activate family/.code=\pgfkeysactivatefamily{\pgfkeyscurrentpath}, + /handlers/.deactivate family/.code=\pgfkeysdeactivatefamily{\pgfkeyscurrentpath}, + /handlers/.belongs to family/.code={\pgfkeyssetfamily{\pgfkeyscurrentpath}{#1}},% + % + % + % An addition to the '.try' and '.retry' handlers: + % + % It is the same as '.retry', but if the option is still unknown, the + % usual handlers for unknown keys will be invoked. + /handlers/.lastretry/.code={% + \ifpgfkeyssuccess\else + \pgfkeys@try + \ifpgfkeyssuccess\else + % discard the '.lastretry' suffix: + \edef\pgfkeyscurrentkey{\pgfkeyscurrentpath}% + \pgfkeys@split@path% + \pgfkeys@unknown + \fi + \fi + }, + % + % + /handlers/.install key filter/.code={% + \pgfkeysinstallkeyfilter{\pgfkeyscurrentpath}{#1}% + },% + /handlers/.install key filter handler/.code={% + \pgfkeysinstallkeyfilterhandler{\pgfkeyscurrentpath}{#1}% + },% + % + % + % KEY FILTER HANDLERS: + % + /pgf/key filter handlers/append filtered to/.code={% + % Produce + % <orig key> '={' <value> '}' + % where both, the key and the value are expanded just ONCE: + \pgfkeys@tmptoks=\expandafter\expandafter\expandafter{\expandafter\pgfkeyscurrentkeyRAW\expandafter=\expandafter{\pgfkeyscurrentvalue}}% + \ifx#1\pgfkeys@empty + \else + % Produce <old list> ',' <orig key> '={' <value> '}' + \pgfkeys@tmptoks=\expandafter\expandafter\expandafter{\expandafter#1\expandafter,\the\pgfkeys@tmptoks}% + \fi + \edef#1{\the\pgfkeys@tmptoks}% + },% + /pgf/key filter handlers/ignore/.code={}, + /pgf/key filter handlers/ignore/.install key filter handler, + /pgf/key filter handlers/log/.code={% + \pgf@typeout{LOG: the option '\pgfkeyscurrentkey' (was originally '\pgfkeyscurrentkeyRAW') (case \pgfkeyscasenumber) has not been processed due to pgfkeysfiltered.}% + }, + % + % + % KEY FILTER PREDICATES: + % + % Returns true iff the currently processed key belongs to an active family. + % A family is active if it has been activated before. + /pgf/key filters/active families/.code={% + \if\pgfkeyscasenumber0% + % unknown options shall be processed with the + % unknown-handlers. + \pgfkeysfiltercontinuetrue + \else + \if\pgfkeyscasenumber3% + \pgfkeysgetfamily\pgfkeyscurrentpath\pgfkeyspred@TMP + \else + \pgfkeysgetfamily\pgfkeyscurrentkey\pgfkeyspred@TMP + \fi + \ifpgfkeyssuccess + \pgfkeysisfamilyactive{\pgfkeyspred@TMP}% + \else% Ok, it does not belong to any family. + \pgfkeysfiltercontinuefalse + \fi + \fi + },% + % + % + % + % This filter works as follows: + % 1. if the current key belongs to a family: + % return whether its family is active, + % 2. if the current key does NOT belong to a family: + % return the result of criterion '#1', + % 3. the current key is unknown: + % return the result of criterion '#2'. + % + % Arguments: + % #1: the predicate which will be invoked in case 2. + % It will be invoked with the current case number as argument. + % #2: the predicate which will be invoked in case 3 with + % the current case number as argument. + /pgf/key filters/active families or no family/.code 2 args={% + \if\pgfkeyscasenumber0% + \pgfkeysevalkeyfilterwith{#2}% + \else + \if\pgfkeyscasenumber3% + \pgfkeysgetfamily\pgfkeyscurrentpath\pgfkeyspred@TMP + \else + \pgfkeysgetfamily\pgfkeyscurrentkey\pgfkeyspred@TMP + \fi + \ifpgfkeyssuccess + \pgfkeysisfamilyactive{\pgfkeyspred@TMP}% + \else% Ok, it does not belong to any family. + \pgfkeysevalkeyfilterwith{#1}% + \fi + \fi + }, + /pgf/key filters/active families or no family DEBUG/.code 2 args={% + \if\pgfkeyscasenumber0% + \pgf@typeout{[pgfkeyshasactivefamilyornofamily(\pgfkeyscurrentkey, \pgfkeyscasenumber) invoking unknown handler '#2']}% + \pgfkeysevalkeyfilterwith{#2}% + \else + \if\pgfkeyscasenumber3% + \pgfkeysgetfamily\pgfkeyscurrentpath\pgfkeyspred@TMP + \else + \pgfkeysgetfamily\pgfkeyscurrentkey\pgfkeyspred@TMP + \fi + \ifpgfkeyssuccess + \pgfkeysisfamilyactive{\pgfkeyspred@TMP}% + \ifpgfkeysfiltercontinue + \pgf@typeout{[pgfkeyshasactivefamilyornofamily(\pgfkeyscurrentkey, \pgfkeyscasenumber) family is ACTIVE]}% + \else + \pgf@typeout{[pgfkeyshasactivefamilyornofamily(\pgfkeyscurrentkey, \pgfkeyscasenumber) family is NOT active.]}% + \fi + \else% Ok, it does not belong to any family. + \pgf@typeout{[pgfkeyshasactivefamilyornofamily(\pgfkeyscurrentkey, \pgfkeyscasenumber) invoking has-no-family-handler '#1']}% + \pgfkeysevalkeyfilterwith{#1}% + \fi + \fi + }, + % + % A (faster) shortcut for + % /pgf/key filters/active families or no family= + % {/pgf/keys filters/false} + % {/pgf/keys filters/false} + /pgf/key filters/active families and known/.code={% + \if\pgfkeyscasenumber0% + \pgfkeysfiltercontinuefalse + \else + \if\pgfkeyscasenumber3% + \pgfkeysgetfamily\pgfkeyscurrentpath\pgfkeyspred@TMP + \else + \pgfkeysgetfamily\pgfkeyscurrentkey\pgfkeyspred@TMP + \fi + \ifpgfkeyssuccess + \pgfkeysisfamilyactive{\pgfkeyspred@TMP}% + \else% Ok, it does not belong to any family. + \pgfkeysfiltercontinuefalse + \fi + \fi + }, + % A (faster) shortcut for + % /pgf/key filters/active families or no family= + % {/pgf/key filters/is descendant of=#1}% for keys without family + % {/pgf/keys filters/false} + /pgf/key filters/active families or descendants of/.code={% + \if\pgfkeyscasenumber0% + \pgfkeysfiltercontinuefalse + \else + \if\pgfkeyscasenumber3% + \pgfkeysgetfamily\pgfkeyscurrentpath\pgfkeyspred@TMP + \else + \pgfkeysgetfamily\pgfkeyscurrentkey\pgfkeyspred@TMP + \fi + \ifpgfkeyssuccess + \pgfkeysisfamilyactive{\pgfkeyspred@TMP}% + \else% Ok, it does not belong to any family. + % the 'is descendendant of' implementation has been + % COPY PASTED here: + % + % string prefix comparison: + \def\pgfkeysisdescendantof@impl##1#1##2\pgf@@eov{% + \def\pgfkeyspred@TMP{##1}% + \ifx\pgfkeyspred@TMP\pgfkeys@empty + \pgfkeysfiltercontinuetrue + \else + \pgfkeysfiltercontinuefalse + \fi + }% + \expandafter\pgfkeysisdescendantof@impl\pgfkeyscurrentkey#1\pgf@@eov + \fi + \fi + }, + % + % Processes only options which are childs of #1. + % Example: + % is descendant of/.install key filter=/foo + % will be true for + % /foo/bar/x=y + % /foo/.cd + % /foo/bar/.style=... + % but not for + % /bar/foo/... + /pgf/key filters/is descendant of/.code={% + \if\pgfkeyscasenumber0% %\message{'\pgfkeyscurrentkey' (case \pgfkeyscasenumber) is UNKNOWN. Calling unknown handler.}% - % unknown options shall be processed with the - % unknown-handlers. - \pgfkeysfiltercontinuetrue - \else - % string prefix comparison: - % [ note : this has been COPY-PASTED to - % |active families or descendants of| ] - \def\pgfkeysisdescendantof@impl##1#1##2\pgf@@eov{% - \def\pgfkeyspred@TMP{##1}% - \ifx\pgfkeyspred@TMP\pgfkeys@empty + % unknown options shall be processed with the + % unknown-handlers. + \pgfkeysfiltercontinuetrue + \else + % string prefix comparison: + % [ note : this has been COPY-PASTED to + % |active families or descendants of| ] + \def\pgfkeysisdescendantof@impl##1#1##2\pgf@@eov{% + \def\pgfkeyspred@TMP{##1}% + \ifx\pgfkeyspred@TMP\pgfkeys@empty %\message{'\pgfkeyscurrentkey' (case \pgfkeyscasenumber) is descendant of '#1': TRUE.}% - \pgfkeysfiltercontinuetrue - \else + \pgfkeysfiltercontinuetrue + \else %\message{'\pgfkeyscurrentkey' (case \pgfkeyscasenumber) is descendant of '#1': FALSE.}% - \pgfkeysfiltercontinuefalse - \fi - }% - \expandafter\pgfkeysisdescendantof@impl\pgfkeyscurrentkey#1\pgf@@eov - \fi - },% - % - % - % - % Returns true if the currently processed full key equals #2. - /pgf/key filters/equals/.code={% - \if\pgfkeyscasenumber0% - % Unknown option: - \pgfkeysfiltercontinuetrue - \else - \def\pgfkeyspred@TMP{#1}% - \ifx\pgfkeyscurrentkey\pgfkeyspred@TMP - \pgfkeysfiltercontinuetrue - \else - \pgfkeysfiltercontinuefalse - \fi - \fi - },% - % - % - % Argument #1 can be any other (evaluated) filter predicate, its logical return - % value will be inverted. - % Example: - % not/.install key filter={is descendant of=/tikz} - % will install a key filter which evaluates 'is descendant of' with argument - % '/tikz' and returns the logical negation of the result. - % - /pgf/key filters/not/.code={% - \pgfkeysevalkeyfilterwith{#1}% - \ifpgfkeysfiltercontinue - \pgfkeysfiltercontinuefalse - \else - \pgfkeysfiltercontinuetrue - \fi - },% - /pgf/key filters/and/.code 2 args={% - \pgfkeysevalkeyfilterwith{#1}% - \ifpgfkeysfiltercontinue - \pgfkeysevalkeyfilterwith{#2}% - \fi - },% - /pgf/key filters/or/.code 2 args={% - \pgfkeysevalkeyfilterwith{#1}% - \ifpgfkeysfiltercontinue - \else - \pgfkeysevalkeyfilterwith{#2}% - \fi - },% - /pgf/key filters/true/.code={\pgfkeysfiltercontinuetrue},% - /pgf/key filters/true/.install key filter, - /pgf/key filters/false/.code={% - \pgfkeysfiltercontinuefalse - },% - % - % Returns false if the current key is unknown, which avoids calling - % the unknown handlers. - /pgf/key filters/defined/.code={% - \if\pgfkeyscasenumber0% - \pgfkeysfiltercontinuefalse - \else - \pgfkeysfiltercontinuetrue - \fi - }, + \pgfkeysfiltercontinuefalse + \fi + }% + \expandafter\pgfkeysisdescendantof@impl\pgfkeyscurrentkey#1\pgf@@eov + \fi + },% + % + % + % + % Returns true if the currently processed full key equals #2. + /pgf/key filters/equals/.code={% + \if\pgfkeyscasenumber0% + % Unknown option: + \pgfkeysfiltercontinuetrue + \else + \def\pgfkeyspred@TMP{#1}% + \ifx\pgfkeyscurrentkey\pgfkeyspred@TMP + \pgfkeysfiltercontinuetrue + \else + \pgfkeysfiltercontinuefalse + \fi + \fi + },% + % + % + % Argument #1 can be any other (evaluated) filter predicate, its logical return + % value will be inverted. + % Example: + % not/.install key filter={is descendend of=/tikz} + % will install a key filter which evaluates 'is descendant of' with argument '/tikz' and returns the logical negation of the result. + % + /pgf/key filters/not/.code={% + \pgfkeysevalkeyfilterwith{#1}% + \ifpgfkeysfiltercontinue + \pgfkeysfiltercontinuefalse + \else + \pgfkeysfiltercontinuetrue + \fi + },% + /pgf/key filters/and/.code 2 args={% + \pgfkeysevalkeyfilterwith{#1}% + \ifpgfkeysfiltercontinue + \pgfkeysevalkeyfilterwith{#2}% + \fi + },% + /pgf/key filters/or/.code 2 args={% + \pgfkeysevalkeyfilterwith{#1}% + \ifpgfkeysfiltercontinue + \else + \pgfkeysevalkeyfilterwith{#2}% + \fi + },% + /pgf/key filters/true/.code={\pgfkeysfiltercontinuetrue},% + /pgf/key filters/true/.install key filter, + /pgf/key filters/false/.code={% + \pgfkeysfiltercontinuefalse + },% + % + % Returns false if the current key is unknown, which avoids calling + % the unknown handlers. + /pgf/key filters/defined/.code={% + \if\pgfkeyscasenumber0% + \pgfkeysfiltercontinuefalse + \else + \pgfkeysfiltercontinuetrue + \fi + }, }% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -780,192 +779,192 @@ % but it applies filtering whenever it identified the type of an % option. \def\pgfkeys@case@one@filtered{% - \pgfkeys@cur@is@descendant@of@errors - \ifpgfkeysfiltercontinue - \pgfkeys@orig@case@one - \else - \pgfkeysfiltercontinuetrue - \pgfkeysifdefined{\pgfkeyscurrentkey/.@cmd}{% - % CASE ONE: a command option - \def\pgfkeyscasenumber{1}% - \pgfkeys@key@predicate% - \ifpgfkeysfiltercontinue + \pgfkeys@cur@is@descendant@of@errors + \ifpgfkeysfiltercontinue + \pgfkeys@orig@case@one + \else + \pgfkeysfiltercontinuetrue + \pgfkeysifdefined{\pgfkeyscurrentkey/.@cmd}{% + % CASE ONE: a command option + \def\pgfkeyscasenumber{1}% + \pgfkeys@key@predicate% + \ifpgfkeysfiltercontinue %\message{PROCESSING KEY \pgfkeyscurrentkey!}% - \pgfkeysgetvalue{\pgfkeyscurrentkey/.@cmd}{\pgfkeys@code}% - \expandafter\pgfkeys@code\pgfkeyscurrentvalue\pgfeov - \else + \pgfkeysgetvalue{\pgfkeyscurrentkey/.@cmd}{\pgfkeys@code}% + \expandafter\pgfkeys@code\pgfkeyscurrentvalue\pgfeov + \else %\message{FILTERED OUT KEY \pgfkeyscurrentkey!}% - \pgfkeys@filtered@handler% - \fi - }{% - % CASE TWO: a normal value option - \pgfkeysifdefined{\pgfkeyscurrentkey}{% - \def\pgfkeyscasenumber{2}% - \pgfkeys@key@predicate% - \ifpgfkeysfiltercontinue + \pgfkeys@filtered@handler% + \fi + }{% + % CASE TWO: a normal value option + \pgfkeysifdefined{\pgfkeyscurrentkey}{% + \def\pgfkeyscasenumber{2}% + \pgfkeys@key@predicate% + \ifpgfkeysfiltercontinue %\message{PROCESSING KEY \pgfkeyscurrentkey!}% - \pgfkeys@case@two@extern - \else -%\message{FILTERED OUT KEY \pgfkeyscurrentkey!}% - \pgfkeys@filtered@handler% - \fi - }{% - \pgfkeys@split@path - % CASE THREE: a handler - \pgfkeysifdefined{/handlers/\pgfkeyscurrentname/.@cmd}{% - \pgfkeys@ifexecutehandler{% - \def\pgfkeyscasenumber{3}% - \pgfkeys@key@predicate% - \ifpgfkeysfiltercontinue + \pgfkeys@case@two@extern + \else +%\message{FILTEReD OUT KEY \pgfkeyscurrentkey!}% + \pgfkeys@filtered@handler% + \fi + }{% + \pgfkeys@split@path + % CASE THREE: a handler + \pgfkeysifdefined{/handlers/\pgfkeyscurrentname/.@cmd}{% + \pgfkeys@ifexecutehandler{% + \def\pgfkeyscasenumber{3}% + \pgfkeys@key@predicate% + \ifpgfkeysfiltercontinue %\message{PROCESSING KEY \pgfkeyscurrentkey!}% - \pgfkeysgetvalue{/handlers/\pgfkeyscurrentname/.@cmd}{\pgfkeys@code}% - \expandafter\pgfkeys@code\pgfkeyscurrentvalue\pgfeov - \else + \pgfkeysgetvalue{/handlers/\pgfkeyscurrentname/.@cmd}{\pgfkeys@code}% + \expandafter\pgfkeys@code\pgfkeyscurrentvalue\pgfeov + \else %\message{FILTERED OUT KEY \pgfkeyscurrentkey!}% - \pgfkeys@filtered@handler% - \fi - }{% - \pgfkeys@unknown - }% - }{% - \pgfkeys@unknown - }% - }% - }% - \fi + \pgfkeys@filtered@handler% + \fi + }{% + \pgfkeys@unknown + }% + }{% + \pgfkeys@unknown + }% + }% + }% + \fi }% \def\pgfkeys@unknown@filtered{% - % CASE ZERO: an unknown option. - \def\pgfkeyscasenumber{0}% - \pgfkeys@key@predicate% - \ifpgfkeysfiltercontinue + % CASE ZERO: an unknown option. + \def\pgfkeyscasenumber{0}% + \pgfkeys@key@predicate% + \ifpgfkeysfiltercontinue %\message{PROCESSING KEY \pgfkeyscurrentkey!}% - % start normal 'unknown' handlers: - \pgfkeys@orig@unknown - \else -%\message{FILTERED OUT KEY \pgfkeyscurrentkey!}% - \pgfkeys@filtered@handler% - \fi + % start normal 'unknown' handlers: + \pgfkeys@orig@unknown + \else +%\message{FILTEReD OUT KEY \pgfkeyscurrentkey!}% + \pgfkeys@filtered@handler% + \fi } % Does the same as \pgfkeys@try, but it also invokes the key filters. \def\pgfkeys@try@filtered{% - \ifpgfkeysfiltercontinue - \pgfkeys@orig@try - \else - \pgfkeysfiltercontinuetrue - \edef\pgfkeyscurrentkey{\pgfkeyscurrentpath}% make sure that \pgfkeys@code doesn't know about 'try'. Important for .is choice - \ifx\pgfkeyscurrentvalue\pgfkeysnovalue@text% Hmm... no value - \pgfkeysifdefined{\pgfkeyscurrentpath/.@def}% - {\pgfkeysgetvalue{\pgfkeyscurrentpath/.@def}{\pgfkeyscurrentvalue}} - {}% no default, so leave it - \fi% - \pgfkeysifdefined{\pgfkeyscurrentpath/.@cmd}% - {% - % CASE ONE: a command option - \def\pgfkeyscasenumber{1}% - \pgfkeys@key@predicate% - \ifpgfkeysfiltercontinue - \pgfkeysgetvalue{\pgfkeyscurrentkey/.@cmd}{\pgfkeys@code}% - \expandafter\pgfkeys@code\pgfkeyscurrentvalue\pgfeov% - \else - \pgfkeys@filtered@handler% - \fi - \pgfkeyssuccesstrue% - }% - {% - \pgfkeysifdefined{\pgfkeyscurrentpath}% - {% CASE TWO: a normal value option - \def\pgfkeyscasenumber{2}% - \pgfkeys@key@predicate% - \ifpgfkeysfiltercontinue - \ifx\pgfkeyscurrentvalue\pgfkeysnovalue@text% - \pgfkeysvalueof{\pgfkeyscurrentpath}% - \else% - \pgfkeyslet{\pgfkeyscurrentpath}\pgfkeyscurrentvalue% - \fi% - \else - \pgfkeys@filtered@handler% - \fi - \pgfkeyssuccesstrue% - }% - {% - \pgfkeys@split@path% - \pgfkeysifdefined{/handlers/\pgfkeyscurrentname/.@cmd}{% - % CASE THREE: a handled key - % - % in the standard configuration, this check here is redundant - % because pgfkeys@ifexecutehandler === true. - % It is only interesting for 'handle only existing'. - \pgfkeys@ifexecutehandler{% - \def\pgfkeyscasenumber{3}% - \pgfkeys@key@predicate% - \ifpgfkeysfiltercontinue + \ifpgfkeysfiltercontinue + \pgfkeys@orig@try + \else + \pgfkeysfiltercontinuetrue + \edef\pgfkeyscurrentkey{\pgfkeyscurrentpath}% make sure that \pgfkeys@code doesn't know about 'try'. Important for .is choice + \ifx\pgfkeyscurrentvalue\pgfkeysnovalue@text% Hmm... no value + \pgfkeysifdefined{\pgfkeyscurrentpath/.@def}% + {\pgfkeysgetvalue{\pgfkeyscurrentpath/.@def}{\pgfkeyscurrentvalue}} + {}% no default, so leave it + \fi% + \pgfkeysifdefined{\pgfkeyscurrentpath/.@cmd}% + {% + % CASE ONE: a command option + \def\pgfkeyscasenumber{1}% + \pgfkeys@key@predicate% + \ifpgfkeysfiltercontinue + \pgfkeysgetvalue{\pgfkeyscurrentkey/.@cmd}{\pgfkeys@code}% + \expandafter\pgfkeys@code\pgfkeyscurrentvalue\pgfeov% + \else + \pgfkeys@filtered@handler% + \fi + \pgfkeyssuccesstrue% + }% + {% + \pgfkeysifdefined{\pgfkeyscurrentpath}% + {% CASE TWO: a normal value option + \def\pgfkeyscasenumber{2}% + \pgfkeys@key@predicate% + \ifpgfkeysfiltercontinue + \ifx\pgfkeyscurrentvalue\pgfkeysnovalue@text% + \pgfkeysvalueof{\pgfkeyscurrentpath}% + \else% + \pgfkeyslet{\pgfkeyscurrentpath}\pgfkeyscurrentvalue% + \fi% + \else + \pgfkeys@filtered@handler% + \fi + \pgfkeyssuccesstrue% + }% + {% + \pgfkeys@split@path% + \pgfkeysifdefined{/handlers/\pgfkeyscurrentname/.@cmd}{% + % CASE THREE: a handled key + % + % in the standard configuration, this check here is redundand + % because pgfkeys@ifexecutehandler === true. + % It is only interesting for 'handle only existing'. + \pgfkeys@ifexecutehandler{% + \def\pgfkeyscasenumber{3}% + \pgfkeys@key@predicate% + \ifpgfkeysfiltercontinue %\message{PROCESSING KEY \pgfkeyscurrentkey!}% - \pgfkeysgetvalue{/handlers/\pgfkeyscurrentname/.@cmd}{\pgfkeys@code}% - \expandafter\pgfkeys@code\pgfkeyscurrentvalue\pgfeov - \else + \pgfkeysgetvalue{/handlers/\pgfkeyscurrentname/.@cmd}{\pgfkeys@code}% + \expandafter\pgfkeys@code\pgfkeyscurrentvalue\pgfeov + \else %\message{FILTERED OUT KEY \pgfkeyscurrentkey!}% - \pgfkeys@filtered@handler% - \fi - \pgfkeyssuccesstrue% - }{% - \pgfkeyssuccessfalse - }% - }{% - \pgfkeyssuccessfalse - }% - }% - }% - \fi + \pgfkeys@filtered@handler% + \fi + \pgfkeyssuccesstrue% + }{% + \pgfkeyssuccessfalse + }% + }{% + \pgfkeyssuccessfalse + }% + }% + }% + \fi } % #1 the code to invoke after init and before cleanup \long\def\pgfkeys@install@filter@and@invoke#1{% - \ifpgfkeysfilteringisactive - \pgfkeys@error{Sorry, nested calls to key filtering routines are not allowed. (reason: It is not possible to properly restore the previous filtering state after returning from the nested call)}% - \fi - \pgfkeysfilteringisactivetrue - \let\pgfkeys@case@one=\pgfkeys@case@one@filtered - \let\pgfkeys@try=\pgfkeys@try@filtered - \let\pgfkeys@unknown=\pgfkeys@unknown@filtered - #1% - \let\pgfkeys@case@one=\pgfkeys@orig@case@one - \let\pgfkeys@try=\pgfkeys@orig@try - \let\pgfkeys@unknown=\pgfkeys@orig@unknown - \pgfkeysfilteringisactivefalse + \ifpgfkeysfilteringisactive + \pgfkeys@error{Sorry, nested calls to key filtering routines are not allowed. (reason: It is not possible to properly restore the previous filtering state after returning from the nested call)}% + \fi + \pgfkeysfilteringisactivetrue + \let\pgfkeys@case@one=\pgfkeys@case@one@filtered + \let\pgfkeys@try=\pgfkeys@try@filtered + \let\pgfkeys@unknown=\pgfkeys@unknown@filtered + #1% + \let\pgfkeys@case@one=\pgfkeys@orig@case@one + \let\pgfkeys@try=\pgfkeys@orig@try + \let\pgfkeys@unknown=\pgfkeys@orig@unknown + \pgfkeysfilteringisactivefalse } %-------------------------------------------------- % \def\pgfkeys@eval@key@filter@subroutine@case@one{% -% \pgfkeysifdefined{\pgfkeyscurrentkey/.@cmd}{% -% \pgfkeysgetvalue{\pgfkeyscurrentkey/.@cmd}{\pgfkeys@code}% -% \let\pgfkeyspred@TMP=\pgfkeyscurrentvalue -% \pgfkeys@eval@key@filter@subroutine@restorestate -% \expandafter\pgfkeys@code\pgfkeyspred@TMP\pgfeov -% }{% -% \pgfkeysvalueof{/errors/no such key filter/.@cmd}\pgfkeyscurrentkey\pgfkeyscurrentvalue\pgfeov% -% }% +% \pgfkeysifdefined{\pgfkeyscurrentkey/.@cmd}{% +% \pgfkeysgetvalue{\pgfkeyscurrentkey/.@cmd}{\pgfkeys@code}% +% \let\pgfkeyspred@TMP=\pgfkeyscurrentvalue +% \pgfkeys@eval@key@filter@subroutine@restorestate +% \expandafter\pgfkeys@code\pgfkeyspred@TMP\pgfeov +% }{% +% \pgfkeysvalueof{/errors/no such key filter/.@cmd}\pgfkeyscurrentkey\pgfkeyscurrentvalue\pgfeov% +% }% % } % % THIS VERSION IS TOO SLOW. See below. % \def\pgfkeysevalkeyfilterwith#1{% -% \edef\pgfkeys@eval@key@filter@subroutine@restorestate{% -% \noexpand\def\noexpand\pgfkeyscurrentkey{\pgfkeyscurrentkey}% -% \noexpand\def\noexpand\pgfkeyscurrentkeyRAW{\pgfkeyscurrentkeyRAW}% -% \noexpand\def\noexpand\pgfkeyscurrentname{\pgfkeyscurrentname}% -% \noexpand\def\noexpand\pgfkeyscurrentvalue{\pgfkeyscurrentvalue}% -% \noexpand\pgfkeys@pathtoks={\pgfkeyscurrentpath}% -% }% -% \pgfkeysinterruptkeyfilter -% \let\pgfkeys@case@one=\pgfkeys@eval@key@filter@subroutine@case@one -% \pgfkeysalso{#1}% -% \endpgfkeysinterruptkeyfilter% this here also restored \pgfkeys@case@one. -% \pgfkeys@eval@key@filter@subroutine@restorestate +% \edef\pgfkeys@eval@key@filter@subroutine@restorestate{% +% \noexpand\def\noexpand\pgfkeyscurrentkey{\pgfkeyscurrentkey}% +% \noexpand\def\noexpand\pgfkeyscurrentkeyRAW{\pgfkeyscurrentkeyRAW}% +% \noexpand\def\noexpand\pgfkeyscurrentname{\pgfkeyscurrentname}% +% \noexpand\def\noexpand\pgfkeyscurrentvalue{\pgfkeyscurrentvalue}% +% \noexpand\pgfkeys@pathtoks={\pgfkeyscurrentpath}% +% }% +% \pgfkeysinterruptkeyfilter +% \let\pgfkeys@case@one=\pgfkeys@eval@key@filter@subroutine@case@one +% \pgfkeysalso{#1}% +% \endpgfkeysinterruptkeyfilter% this here also restored \pgfkeys@case@one. +% \pgfkeys@eval@key@filter@subroutine@restorestate % }% -%-------------------------------------------------- +%-------------------------------------------------- % Evaluates a key filter '#1'. Example: @@ -978,40 +977,40 @@ % % The implementation employs a subset of the \pgfkeysalso code. \long\def\pgfkeysevalkeyfilterwith#1{% - \pgfkeys@eval@key@filter@subroutine@unpack#1=\pgfkeysnovalue=\pgfkeys@stop + \pgfkeys@eval@key@filter@subroutine@unpack#1=\pgfkeysnovalue=\pgfkeys@stop }% \long\def\pgfkeys@eval@key@filter@subroutine@unpack#1=#2=#3\pgfkeys@stop{% - \pgfkeys@spdef\pgfkeyspred@TMP{#1}% - \edef\pgfkeyspred@TMP{\pgfkeyspred@TMP}% - \pgfkeys@spdef\pgfkeyspred@TMPB{#2}% TMPB=value - \ifx\pgfkeyspred@TMPB\pgfkeysnovalue@text% Hmm... no value - \pgfkeysifdefined{\pgfkeyspred@TMP/.@def}% - {\pgfkeysgetvalue{\pgfkeyspred@TMP/.@def}{\pgfkeyspred@TMPB}} - {}% no default, so leave it - \fi% - \ifx\pgfkeyspred@TMPB\pgfkeysvaluerequired% - \pgfkeysvalueof{/errors/value required/.@cmd}\pgfkeyspred@TMP\pgfkeyspred@TMPB\pgfeov% - \else% - \pgfkeysifdefined{\pgfkeyspred@TMP/.@cmd}{% - \pgfkeysgetvalue{\pgfkeyspred@TMP/.@cmd}{\pgfkeys@code}% - \expandafter\pgfkeys@code\pgfkeyspred@TMPB\pgfeov - }{% - \pgfkeysvalueof{/errors/no such key filter/.@cmd}\pgfkeyspred@TMP\pgfkeyspred@TMPB\pgfeov% - }% - \fi% + \pgfkeys@spdef\pgfkeyspred@TMP{#1}% + \edef\pgfkeyspred@TMP{\pgfkeyspred@TMP}% + \pgfkeys@spdef\pgfkeyspred@TMPB{#2}% TMPB=value + \ifx\pgfkeyspred@TMPB\pgfkeysnovalue@text% Hmm... no value + \pgfkeysifdefined{\pgfkeyspred@TMP/.@def}% + {\pgfkeysgetvalue{\pgfkeyspred@TMP/.@def}{\pgfkeyspred@TMPB}} + {}% no default, so leave it + \fi% + \ifx\pgfkeyspred@TMPB\pgfkeysvaluerequired% + \pgfkeysvalueof{/errors/value required/.@cmd}\pgfkeyspred@TMP\pgfkeyspred@TMPB\pgfeov% + \else% + \pgfkeysifdefined{\pgfkeyspred@TMP/.@cmd}{% + \pgfkeysgetvalue{\pgfkeyspred@TMP/.@cmd}{\pgfkeys@code}% + \expandafter\pgfkeys@code\pgfkeyspred@TMPB\pgfeov + }{% + \pgfkeysvalueof{/errors/no such key filter/.@cmd}\pgfkeyspred@TMP\pgfkeyspred@TMPB\pgfeov% + }% + \fi% } \def\pgfkeys@non@outer@newif@#1#2{% - \expandafter\edef\csname #2true\endcsname{\noexpand\let\noexpand#1=\noexpand\iftrue}% - \expandafter\edef\csname #2false\endcsname{\noexpand\let\noexpand#1=\noexpand\iffalse}% - \csname #2false\endcsname + \expandafter\edef\csname #2true\endcsname{\noexpand\let\noexpand#1=\noexpand\iftrue}% + \expandafter\edef\csname #2false\endcsname{\noexpand\let\noexpand#1=\noexpand\iffalse}% + \csname #2false\endcsname }% % For latex and context, this here has the same effect as a \newif % applied to 'if#1'. For plain tex, it has also the same effect, but % it is not an \outer macro as the plain-tex \newif. \def\pgfkeys@non@outer@newif#1{% - \expandafter\pgfkeys@non@outer@newif@\csname if#1\endcsname{#1}% + \expandafter\pgfkeys@non@outer@newif@\csname if#1\endcsname{#1}% } \endinput diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex b/Master/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex index 456e3b0c2db..58fa5b0ef74 100644 --- a/Master/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex +++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex @@ -44,12 +44,9 @@ \edef\pgfrcsatcode{\the\catcode`\@} \catcode`\@=11 + % not used in PGF, deprecated -\def\ProvidesFileRCS{% - \let\pgfrcs@final=\ProvidesFileRCS@ - \pgfrcs@parseinput -} -\def\ProvidesFileRCS@#1{% +\def\ProvidesFileRCS#1{% \ProvidesFile{#1}[\pgfversiondate\space v\pgfversion\space(\pgfrevision)]% } @@ -57,74 +54,19 @@ \def\pgfretval{#1}% }% -\def\ProvidesPackageRCS{% - \let\pgfrcs@final=\ProvidesPackageRCS@ - \pgfrcs@parseinput -} -\def\ProvidesPackageRCS@#1{% +\def\ProvidesPackageRCS#1{% \pgf@remove@ext#1.\relax \edef\pgfrcs@marshal{{\pgfretval}[\pgfversiondate\space v\pgfversion\space(\pgfrevision)]}% \expandafter\ProvidesPackage\pgfrcs@marshal } % not used in PGF, deprecated -\def\ProvidesClassRCS{% - \let\pgfrcs@final=\ProvidesClassRCS@ - \pgfrcs@parseinput -} -\def\ProvidesClassRCS@#1{% +\def\ProvidesClassRCS#1{% \pgf@remove@ext#1.\relax \edef\pgfrcs@marshal{{\pgfretval}[\pgfversiondate\space v\pgfversion\space(\pgfrevision)]}% \expandafter\ProvidesClass\pgfrcs@marshal } -\def\pgfrcs@parseinput@bracket{[}% -\def\pgfrcs@parseinput@dollarsign{$}% - -\def\pgfrcs@parseinput#1{% - \def\pgfrcs@parseinput@{#1}% - \ifx\pgfrcs@parseinput@\pgfrcs@parseinput@bracket% - % still accept it if someone has written his own pgfrcs files with headers of sorts - % \ProvidesPackageRCS[v\pgfversion] $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcore.code.tex,v 1.7 2010/04/11 07:09:19 username Exp $ - \let\next=\pgfrcs@parseinput@opt - \else - \ifx\pgfrcs@parseinput@\pgfrcs@parseinput@dollarsign - % still accept it if someone has written his own pgfrcs files with headers of sorts - % \ProvidesPackageRCS $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcore.code.tex,v 1.7 2010/04/11 07:09:19 username Exp $ - \let\next\pgfrcs@parseinput@dollar - \else - % the new, normal pgf-way is \ProvidesPackageRCS{pgfcore.code.tex} - \def\next{\pgfrcs@final{#1}}% - \fi - \fi - \next -} -\def\pgfrcs@parseinput@opt#1] ${% - % just backwards compatibility -- ignore the information, but parse the input tokens: - \pgfrcs@parseinput@dollar -}% -\def\pgfrcs@parseinput@dollar#1${% - \pgf@parseid $#1$% - % we ignore pretty much everything except for the file name: - \edef\pgfrcs@parseinput@{\pgf@rcsfile.\pgf@rcssuffix}% - \expandafter\pgfrcs@final\expandafter{\pgfrcs@parseinput@}% -}% -% Get date and version from RCS Ids -\def\pgf@parseid $#1: #2.#3,v #4 #5/#6/#7 #8${% - \pgf@parsercsfile$#2/$ - \def\pgf@rcssuffix{#3} - \def\pgf@rcsrevision{#4} - \def\pgf@rcsdate{#5/#6/#7} -} -\def\pgf@parsercsfile$#1/#2${ - \def\pgf@temp{#2} - \ifx\pgf@temp\pgfutil@empty - \def\pgf@rcsfile{#1} - \else - \pgf@parsercsfile$#2$ - \fi} - - \ifx\ProvidesPackage\@undefined % plain tex \def\ProvidesPackage#1[#2]{\wlog{Loading package #1 version #2.}} diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-common-lists.tex b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-common-lists.tex index d3b817a00f1..26529cd5e37 100644 --- a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-common-lists.tex +++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-common-lists.tex @@ -13,147 +13,147 @@ % the PGF system layer. % It employs two collect-buffers to reduce the runtime. % -% - It has pre-asymptotical runtime O(N), but is O(N^2) asymptotically. +% - It has preasymptotical runtime O(N), but is O(N^2) asymptotically. % - It requires only 5 macros per list. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Usage: +% Usage: % \pgfapplistnewempty\macro \def\pgfapplistnewempty#1{% - \expandafter\let\csname pgfapp@#1\endcsname=\pgfutil@empty - \expandafter\let\csname pgfapp@#1@smallbuf\endcsname=\pgfutil@empty - \expandafter\let\csname pgfapp@#1@bigbuf\endcsname=\pgfutil@empty - \expandafter\def\csname pgfapp@#1@smallbuf@c\endcsname{0}% - \expandafter\def\csname pgfapp@#1@bigbuf@c\endcsname{0}% + \expandafter\let\csname pgfapp@#1\endcsname=\pgfutil@empty + \expandafter\let\csname pgfapp@#1@smallbuf\endcsname=\pgfutil@empty + \expandafter\let\csname pgfapp@#1@bigbuf\endcsname=\pgfutil@empty + \expandafter\def\csname pgfapp@#1@smallbuf@c\endcsname{0}% + \expandafter\def\csname pgfapp@#1@bigbuf@c\endcsname{0}% }% % #1: the item to append % #2: the list as macro name \long\def\pgfapplistpushback#1\to#2{% - \begingroup - \c@pgf@counta=\csname pgfapp@#2@smallbuf@c\endcsname\relax - \advance\c@pgf@counta by1 - \xdef\pgf@glob@TMPa{\the\c@pgf@counta}% - \endgroup - \expandafter\let\csname pgfapp@#2@smallbuf@c\endcsname=\pgf@glob@TMPa - \ifnum\csname pgfapp@#2@smallbuf@c\endcsname<40 - \t@pgf@toka=\expandafter\expandafter\expandafter{\csname pgfapp@#2@smallbuf\endcsname#1}% - \expandafter\edef\csname pgfapp@#2@smallbuf\endcsname{\the\t@pgf@toka}% - \else - \pgfapplistpushback@smallbufoverfl{#1}{#2}% - \fi + \begingroup + \c@pgf@counta=\csname pgfapp@#2@smallbuf@c\endcsname\relax + \advance\c@pgf@counta by1 + \xdef\pgf@glob@TMPa{\the\c@pgf@counta}% + \endgroup + \expandafter\let\csname pgfapp@#2@smallbuf@c\endcsname=\pgf@glob@TMPa + \ifnum\csname pgfapp@#2@smallbuf@c\endcsname<40 + \t@pgf@toka=\expandafter\expandafter\expandafter{\csname pgfapp@#2@smallbuf\endcsname#1}% + \expandafter\edef\csname pgfapp@#2@smallbuf\endcsname{\the\t@pgf@toka}% + \else + \pgfapplistpushback@smallbufoverfl{#1}{#2}% + \fi }% \long\def\pgfapplistpushback@smallbufoverfl#1#2{% - \begingroup - \c@pgf@counta=\csname pgfapp@#2@bigbuf@c\endcsname\relax - \advance\c@pgf@counta by1 - \xdef\pgf@glob@TMPa{\the\c@pgf@counta}% - \endgroup - \expandafter\let\csname pgfapp@#2@bigbuf@c\endcsname=\pgf@glob@TMPa - % - \ifnum\csname pgfapp@#2@bigbuf@c\endcsname<30 - \t@pgf@toka=\expandafter\expandafter\expandafter{\csname pgfapp@#2@bigbuf\endcsname}% - \t@pgf@tokb=\expandafter\expandafter\expandafter{\csname pgfapp@#2@smallbuf\endcsname#1}% - \expandafter\edef\csname pgfapp@#2@bigbuf\endcsname{\the\t@pgf@toka\the\t@pgf@tokb}% - \expandafter\let\csname pgfapp@#2@smallbuf\endcsname=\pgfutil@empty - \expandafter\def\csname pgfapp@#2@smallbuf@c\endcsname{0}% - \else% - \t@pgf@toka=\expandafter\expandafter\expandafter{\csname pgfapp@#2\endcsname}% - \t@pgf@tokb=\expandafter\expandafter\expandafter{\csname pgfapp@#2@bigbuf\endcsname}% - \t@pgf@tokc=\expandafter\expandafter\expandafter{\csname pgfapp@#2@smallbuf\endcsname#1}% - \expandafter\edef\csname pgfapp@#2\endcsname{\the\t@pgf@toka\the\t@pgf@tokb\the\t@pgf@tokc}% - \expandafter\let\csname pgfapp@#2@smallbuf\endcsname=\pgfutil@empty - \expandafter\def\csname pgfapp@#2@smallbuf@c\endcsname{0}% - \expandafter\let\csname pgfapp@#2@bigbuf\endcsname=\pgfutil@empty - \expandafter\def\csname pgfapp@#2@bigbuf@c\endcsname{0}% - \fi% + \begingroup + \c@pgf@counta=\csname pgfapp@#2@bigbuf@c\endcsname\relax + \advance\c@pgf@counta by1 + \xdef\pgf@glob@TMPa{\the\c@pgf@counta}% + \endgroup + \expandafter\let\csname pgfapp@#2@bigbuf@c\endcsname=\pgf@glob@TMPa + % + \ifnum\csname pgfapp@#2@bigbuf@c\endcsname<30 + \t@pgf@toka=\expandafter\expandafter\expandafter{\csname pgfapp@#2@bigbuf\endcsname}% + \t@pgf@tokb=\expandafter\expandafter\expandafter{\csname pgfapp@#2@smallbuf\endcsname#1}% + \expandafter\edef\csname pgfapp@#2@bigbuf\endcsname{\the\t@pgf@toka\the\t@pgf@tokb}% + \expandafter\let\csname pgfapp@#2@smallbuf\endcsname=\pgfutil@empty + \expandafter\def\csname pgfapp@#2@smallbuf@c\endcsname{0}% + \else% + \t@pgf@toka=\expandafter\expandafter\expandafter{\csname pgfapp@#2\endcsname}% + \t@pgf@tokb=\expandafter\expandafter\expandafter{\csname pgfapp@#2@bigbuf\endcsname}% + \t@pgf@tokc=\expandafter\expandafter\expandafter{\csname pgfapp@#2@smallbuf\endcsname#1}% + \expandafter\edef\csname pgfapp@#2\endcsname{\the\t@pgf@toka\the\t@pgf@tokb\the\t@pgf@tokc}% + \expandafter\let\csname pgfapp@#2@smallbuf\endcsname=\pgfutil@empty + \expandafter\def\csname pgfapp@#2@smallbuf@c\endcsname{0}% + \expandafter\let\csname pgfapp@#2@bigbuf\endcsname=\pgfutil@empty + \expandafter\def\csname pgfapp@#2@bigbuf@c\endcsname{0}% + \fi% }% \def\pgfapplist@flushbuffers#1{% - \t@pgf@toka=\expandafter\expandafter\expandafter{\csname pgfapp@#1\endcsname}% - \t@pgf@tokb=\expandafter\expandafter\expandafter{\csname pgfapp@#1@bigbuf\endcsname}% - \t@pgf@tokc=\expandafter\expandafter\expandafter{\csname pgfapp@#1@smallbuf\endcsname}% - \expandafter\edef\csname pgfapp@#1\endcsname{\the\t@pgf@toka\the\t@pgf@tokb\the\t@pgf@tokc}% - \expandafter\let\csname pgfapp@#1@smallbuf\endcsname=\pgfutil@empty - \expandafter\def\csname pgfapp@#1@smallbuf@c\endcsname{0}% - \expandafter\let\csname pgfapp@#1@bigbuf\endcsname=\pgfutil@empty - \expandafter\def\csname pgfapp@#1@bigbuf@c\endcsname{0}% + \t@pgf@toka=\expandafter\expandafter\expandafter{\csname pgfapp@#1\endcsname}% + \t@pgf@tokb=\expandafter\expandafter\expandafter{\csname pgfapp@#1@bigbuf\endcsname}% + \t@pgf@tokc=\expandafter\expandafter\expandafter{\csname pgfapp@#1@smallbuf\endcsname}% + \expandafter\edef\csname pgfapp@#1\endcsname{\the\t@pgf@toka\the\t@pgf@tokb\the\t@pgf@tokc}% + \expandafter\let\csname pgfapp@#1@smallbuf\endcsname=\pgfutil@empty + \expandafter\def\csname pgfapp@#1@smallbuf@c\endcsname{0}% + \expandafter\let\csname pgfapp@#1@bigbuf\endcsname=\pgfutil@empty + \expandafter\def\csname pgfapp@#1@bigbuf@c\endcsname{0}% }% \def\pgfapplistlet#1=#2{% - \pgfapplist@flushbuffers{#2}% - \expandafter\let\expandafter#1\csname pgfapp@#2\endcsname + \pgfapplist@flushbuffers{#2}% + \expandafter\let\expandafter#1\csname pgfapp@#2\endcsname }% - + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% +% % A variant of applist which has the same runtime requirements, but % does PUSH FRONT only. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Usage: +% Usage: % \pgfprependlistnewempty{list} \def\pgfprependlistnewempty#1{% - \expandafter\let\csname pgfpPRP@#1\endcsname=\pgfutil@empty - \expandafter\let\csname pgfpPRP@#1@smallbuf\endcsname=\pgfutil@empty - \expandafter\let\csname pgfpPRP@#1@bigbuf\endcsname=\pgfutil@empty - \expandafter\def\csname pgfpPRP@#1@smallbuf@c\endcsname{0}% - \expandafter\def\csname pgfpPRP@#1@bigbuf@c\endcsname{0}% + \expandafter\let\csname pgfpPRP@#1\endcsname=\pgfutil@empty + \expandafter\let\csname pgfpPRP@#1@smallbuf\endcsname=\pgfutil@empty + \expandafter\let\csname pgfpPRP@#1@bigbuf\endcsname=\pgfutil@empty + \expandafter\def\csname pgfpPRP@#1@smallbuf@c\endcsname{0}% + \expandafter\def\csname pgfpPRP@#1@bigbuf@c\endcsname{0}% }% % #1: the item to append % #2: the list as macro name \long\def\pgfprependlistpushfront#1\to#2{% - \begingroup - \c@pgf@counta=\csname pgfpPRP@#2@smallbuf@c\endcsname\relax - \advance\c@pgf@counta by1 - \xdef\pgf@glob@TMPa{\the\c@pgf@counta}% - \endgroup - \expandafter\let\csname pgfpPRP@#2@smallbuf@c\endcsname=\pgf@glob@TMPa - \ifnum\csname pgfpPRP@#2@smallbuf@c\endcsname<40 - \t@pgf@toka=\expandafter\expandafter\expandafter{\csname pgfpPRP@#2@smallbuf\endcsname}% - \t@pgf@tokb={#1}% - \expandafter\edef\csname pgfpPRP@#2@smallbuf\endcsname{\the\t@pgf@tokb\the\t@pgf@toka}% - \else - \pgfprependlistpushfront@smallbufoverfl{#1}{#2}% - \fi + \begingroup + \c@pgf@counta=\csname pgfpPRP@#2@smallbuf@c\endcsname\relax + \advance\c@pgf@counta by1 + \xdef\pgf@glob@TMPa{\the\c@pgf@counta}% + \endgroup + \expandafter\let\csname pgfpPRP@#2@smallbuf@c\endcsname=\pgf@glob@TMPa + \ifnum\csname pgfpPRP@#2@smallbuf@c\endcsname<40 + \t@pgf@toka=\expandafter\expandafter\expandafter{\csname pgfpPRP@#2@smallbuf\endcsname}% + \t@pgf@tokb={#1}% + \expandafter\edef\csname pgfpPRP@#2@smallbuf\endcsname{\the\t@pgf@tokb\the\t@pgf@toka}% + \else + \pgfprependlistpushfront@smallbufoverfl{#1}{#2}% + \fi }% \long\def\pgfprependlistpushfront@smallbufoverfl#1#2{% - \begingroup - \c@pgf@counta=\csname pgfpPRP@#2@bigbuf@c\endcsname\relax - \advance\c@pgf@counta by1 - \xdef\pgf@glob@TMPa{\the\c@pgf@counta}% - \endgroup - \expandafter\let\csname pgfpPRP@#2@bigbuf@c\endcsname=\pgf@glob@TMPa - % - \ifnum\csname pgfpPRP@#2@bigbuf@c\endcsname<30 - \t@pgf@toka=\expandafter\expandafter\expandafter{\csname pgfpPRP@#2@bigbuf\endcsname}% - \t@pgf@tokb=\expandafter\expandafter\expandafter{\csname pgfpPRP@#2@smallbuf\endcsname}% - \t@pgf@tokc={#1}% - \expandafter\edef\csname pgfpPRP@#2@bigbuf\endcsname{\the\t@pgf@tokc\the\t@pgf@tokb\the\t@pgf@toka}% - \expandafter\let\csname pgfpPRP@#2@smallbuf\endcsname=\pgfutil@empty - \expandafter\def\csname pgfpPRP@#2@smallbuf@c\endcsname{0}% - \else% - \pgfprependlist@flushbuffers{#2}% - \t@pgf@toka=\expandafter\expandafter\expandafter{\csname pgfpPRP@#2\endcsname}% - \t@pgf@tokb={#1}% - \expandafter\edef\csname pgfpPRP@#2\endcsname{\the\t@pgf@tokb\the\t@pgf@toka}% - \fi% + \begingroup + \c@pgf@counta=\csname pgfpPRP@#2@bigbuf@c\endcsname\relax + \advance\c@pgf@counta by1 + \xdef\pgf@glob@TMPa{\the\c@pgf@counta}% + \endgroup + \expandafter\let\csname pgfpPRP@#2@bigbuf@c\endcsname=\pgf@glob@TMPa + % + \ifnum\csname pgfpPRP@#2@bigbuf@c\endcsname<30 + \t@pgf@toka=\expandafter\expandafter\expandafter{\csname pgfpPRP@#2@bigbuf\endcsname}% + \t@pgf@tokb=\expandafter\expandafter\expandafter{\csname pgfpPRP@#2@smallbuf\endcsname}% + \t@pgf@tokc={#1}% + \expandafter\edef\csname pgfpPRP@#2@bigbuf\endcsname{\the\t@pgf@tokc\the\t@pgf@tokb\the\t@pgf@toka}% + \expandafter\let\csname pgfpPRP@#2@smallbuf\endcsname=\pgfutil@empty + \expandafter\def\csname pgfpPRP@#2@smallbuf@c\endcsname{0}% + \else% + \pgfprependlist@flushbuffers{#2}% + \t@pgf@toka=\expandafter\expandafter\expandafter{\csname pgfpPRP@#2\endcsname}% + \t@pgf@tokb={#1}% + \expandafter\edef\csname pgfpPRP@#2\endcsname{\the\t@pgf@tokb\the\t@pgf@toka}% + \fi% }% \def\pgfprependlist@flushbuffers#1{% - \t@pgf@toka=\expandafter\expandafter\expandafter{\csname pgfpPRP@#1\endcsname}% - \t@pgf@tokb=\expandafter\expandafter\expandafter{\csname pgfpPRP@#1@bigbuf\endcsname}% - \t@pgf@tokc=\expandafter\expandafter\expandafter{\csname pgfpPRP@#1@smallbuf\endcsname}% - \expandafter\edef\csname pgfpPRP@#1\endcsname{\the\t@pgf@tokc\the\t@pgf@tokb\the\t@pgf@toka}% - \expandafter\let\csname pgfpPRP@#1@smallbuf\endcsname=\pgfutil@empty - \expandafter\def\csname pgfpPRP@#1@smallbuf@c\endcsname{0}% - \expandafter\let\csname pgfpPRP@#1@bigbuf\endcsname=\pgfutil@empty - \expandafter\def\csname pgfpPRP@#1@bigbuf@c\endcsname{0}% + \t@pgf@toka=\expandafter\expandafter\expandafter{\csname pgfpPRP@#1\endcsname}% + \t@pgf@tokb=\expandafter\expandafter\expandafter{\csname pgfpPRP@#1@bigbuf\endcsname}% + \t@pgf@tokc=\expandafter\expandafter\expandafter{\csname pgfpPRP@#1@smallbuf\endcsname}% + \expandafter\edef\csname pgfpPRP@#1\endcsname{\the\t@pgf@tokc\the\t@pgf@tokb\the\t@pgf@toka}% + \expandafter\let\csname pgfpPRP@#1@smallbuf\endcsname=\pgfutil@empty + \expandafter\def\csname pgfpPRP@#1@smallbuf@c\endcsname{0}% + \expandafter\let\csname pgfpPRP@#1@bigbuf\endcsname=\pgfutil@empty + \expandafter\def\csname pgfpPRP@#1@bigbuf@c\endcsname{0}% }% \def\pgfprependlistlet#1=#2{% - \pgfprependlist@flushbuffers{#2}% - \expandafter\let\expandafter#1\csname pgfpPRP@#2\endcsname + \pgfprependlist@flushbuffers{#2}% + \expandafter\let\expandafter#1\csname pgfpPRP@#2\endcsname }% diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex index d3d8c59daa2..b2f55e82923 100644 --- a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex +++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex @@ -8,8 +8,8 @@ % See the file doc/generic/pgf/licenses/LICENSE for more details. -% -% This file provides utility commands that are used throughout pgf. +% +% This file provides utitiliy commands that are used throughout pgf. % % For most commands, the definition of these commands is just given % below. We cannot use the LaTeX definition of these commands since @@ -20,7 +20,7 @@ % context) is to be preferred over the generic definition below. In % this case, the definition of the format is installed when the file % pgfutil-XXXX.tex is read, where XXXX is the format name (latex, -% plain, or context). +% plain, or context). @@ -70,9 +70,6 @@ } \long\def\pgfutil@firstofone#1{#1} \long\def\pgfutil@firstoftwo#1#2{#1} -\long\def\pgfutil@letfirst#1#2{\pgfutil@letfirst@#1#2\pgfutil@letfirst@end} -\long\def\pgfutil@letfirst@#1#2#3\pgfutil@letfirst@end{\let#1=#2} -\def\pgfutil@letfirst@end{} \long\def\pgfutil@secondoftwo#1#2{#2} \def\pgfutil@empty{} \def\pgfutil@gobble@until@relax#1\relax{} @@ -241,12 +238,12 @@ % Include a library file. % % #1 = List of names of library file. -% +% % Description: % % This command includes a list of library files. For each file X in the % list, the file pgflibraryX.code.tex is included, provided this has -% not been done earlier. +% not been done earlier. % % For the convenience of Context users, both round and square brackets % are possible for the argument. @@ -276,7 +273,7 @@ \pgferror{I did not find the pgf library '\pgf@temp'. I looked for the file named pgflibrary\pgf@temp.code.tex, but could not find it in in - the current texmf trees.} + the current texmf trees.} }% \catcode`\@=\csname pgf@library@#1@atcode\endcsname \catcode`\|=\csname pgf@library@#1@barcode\endcsname @@ -290,12 +287,12 @@ % Include a module file. % % #1 = List of names of module files. -% +% % Description: % % This command includes a list of module files. For each file X in the % list, the file pgfmoduleX.code.tex is included, provided this has -% not been done earlier. +% not been done earlier. % % For the convenience of Context users, both round and square brackets % are possible for the argument. @@ -343,7 +340,7 @@ % If '#1' is a usual file name without anything fancy, \pgfretval % will simply contain it. However, if '#1' contains double colons % (introduces, for example, by pdftex because there are white - % spaces in '#1'), the routine + % spaces in '#1'), the routine % - removes the double colons, % - re-inserts them outside of the string. % @@ -437,7 +434,7 @@ \def\pgfretval{####1}% }% \pgfutil@tmp#2\pgf@EOI% - % + % % ... and execute the <true> code: #3\relax% \else @@ -478,7 +475,7 @@ % Solves a linear equation system of size 2x2 using gauss elimination. % % It employs TeX register arithmetics to do so. -% #1: should contain 4 sets of braces with matrix entries, +% #1: should contain 4 sets of braces with matrix entries, % {<a11>}{<a12>} % {<a21>}{<a22>} % where each entry should be a number without unit. @@ -541,7 +538,7 @@ {\csname m\Pa a\endcsname}% \let\pivot=\pgfmathresult % - % \factor := 1/aa * ba + % \factor := 1/aa * ba \csname \Pb a\endcsname=\pivot\csname \Pb a\endcsname \edef\factor{\expandafter\pgf@sys@tonumber\csname \Pb a\endcsname}% % @@ -661,7 +658,7 @@ \expandafter\pgfmathfloatreciprocal@\expandafter{\csname m\Pa a\endcsname}% \let\pivot=\pgfmathresult % - % \factor := 1/aa * ba + % \factor := 1/aa * ba \expandafter\pgfmathfloatmultiply@\expandafter{\csname m\Pb a\endcsname}{\pivot}% \let\factor=\pgfmathresult \expandafter\let\csname m\Pb a\endcsname=\factor @@ -749,7 +746,7 @@ % Used by latex for doing reruns % #1 = an internal label -% #2 = a to-be-tested text +% #2 = a to-be-tested text \def\pgfutil@check@rerun#1#2{} % new tempdims: @@ -800,18 +797,9 @@ % End of luatex stuff -% \pgfutil@scantokens -% -% This is either the \scantokens primitive or \relax -\pgfutil@IfUndefined{scantokens}{% - \long\def\pgfutil@scantokens#1{#1}% -}{% - \let\pgfutil@scantokens=\scantokens% -}% - % Advances a number stored in a macro and writes the result back into % the macro. -% #1 is a macro containing a number. +% #1 is a macro containing a number. \def\pgfutil@advancestringcounter#1{% \begingroup \c@pgf@counta=#1\relax diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-context.def b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-context.def index e78655e9d09..16ba0611783 100644 --- a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-context.def +++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-context.def @@ -292,48 +292,48 @@ \fi } - % The cmyk part is from Joseph Wright. - % See tex.stackexchange.com/questions/27952/cmyk-context-colors-in-tikz - \def\pgfutil@registercolor#1{% - \edef\pgf@temp{\PDFcolor{#1}}% - \edef\pgf@marshal{\noexpand\pgfutil@in@{rg}{\pgf@temp}}% - \pgf@marshal - \ifpgfutil@in@ - \expandafter\pgfutil@context@parse@rgb\pgf@temp\pgf@stop{#1}% - \else - \edef\pgf@marshal{\noexpand\pgfutil@in@{g}{\pgf@temp}}% - \pgf@marshal - \ifpgfutil@in@ - \expandafter\pgfutil@context@parse@gray\pgf@temp\pgf@stop{#1}% - \else - \edef\pgf@marshal{\noexpand\pgfutil@in@{k}{\pgf@temp}}% - \pgf@marshal - \ifpgfutil@in@ - \expandafter\pgfutil@context@parse@cmyk\pgf@temp\pgf@stop{#1}% - \else - \pgferror{Color #1 has an unsupported color model.}% - \pgfutil@definecolor{#1}{gray}{0}% - \fi - \fi - \fi - } - - \def\pgfutil@context@parse@gray#1 g#2\pgf@stop#3{% - \pgfutil@definecolor{#3}{gray}{#1} - } - - \def\pgfutil@context@parse@rgb#1 #2 #3 rg#4\pgf@stop#5{% - \pgfutil@definecolor{#5}{rgb}{#1,#2,#3} - } - - \def\pgfutil@context@parse@cmyk#1 #2 #3 #4k#5\pgf@stop #6{% - \pgfutil@definecolor{#6}{cmyk}{#1,#2,#3,#4}% - } - - \def\pgfutil@emu@cmyk#1#2,#3,#4,#5\@nil{% - \expandafter\def\csname\string\color@#1\endcsname - {\xcolor@{}{}{cmyk}{#2,#3,#4,#5}}% - } + % The cmyk part is from Joseph Wright. + % See tex.stackexchange.com/questions/27952/cmyk-context-colors-in-tikz + \def\pgfutil@registercolor#1{% + \edef\pgf@temp{\PDFcolor{#1}}% + \edef\pgf@marshal{\noexpand\pgfutil@in@{rg}{\pgf@temp}}% + \pgf@marshal + \ifpgfutil@in@ + \expandafter\pgfutil@context@parse@rgb\pgf@temp\pgf@stop{#1}% + \else + \edef\pgf@marshal{\noexpand\pgfutil@in@{g}{\pgf@temp}}% + \pgf@marshal + \ifpgfutil@in@ + \expandafter\pgfutil@context@parse@gray\pgf@temp\pgf@stop{#1}% + \else + \edef\pgf@marshal{\noexpand\pgfutil@in@{k}{\pgf@temp}}% + \pgf@marshal + \ifpgfutil@in@ + \expandafter\pgfutil@context@parse@cmyk\pgf@temp\pgf@stop{#1}% + \else + \pgferror{Color #1 has an unsupported color model.}% + \pgfutil@definecolor{#1}{gray}{0}% + \fi + \fi + \fi + } + + \def\pgfutil@context@parse@gray#1 g#2\pgf@stop#3{% + \pgfutil@definecolor{#3}{gray}{#1} + } + + \def\pgfutil@context@parse@rgb#1 #2 #3 rg#4\pgf@stop#5{% + \pgfutil@definecolor{#5}{rgb}{#1,#2,#3} + } + + \def\pgfutil@context@parse@cmyk#1 #2 #3 #4k#5\pgf@stop #6{% + \pgfutil@definecolor{#6}{cmyk}{#1,#2,#3,#4}% + } + + \def\pgfutil@emu@cmyk#1#2,#3,#4,#5\@nil{% + \expandafter\def\csname\string\color@#1\endcsname + {\xcolor@{}{}{cmyk}{#2,#3,#4,#5}}% + } \let\pgfutil@registerrgb \pgfutil@registercolor \let\pgfutil@registercmyk \pgfutil@registercolor @@ -355,8 +355,4 @@ \long\def\AtBeginDocument#1{#1}% -% pgfcalendar uses translations - -\def\pgfutil@translate#1{#1} % \translate works very different in ConTeXt - \endinput diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def index f4c3ea92d3f..aad781a60ef 100644 --- a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def +++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def @@ -54,7 +54,7 @@ \else \let\pgf@next=\pgfutil@firstoftwo% \fi% - \pgf@next{#2}{#3}% + \pgf@next{#2}{#3}% } \let\pgfutil@raggedleft\raggedleft @@ -90,23 +90,23 @@ \def\pgfutil@check@rerun#1#2{\@newl@bel{pgf@lab}{#1}{#2}} -\AtBeginDocument{\AtEndDocument{\clearpage\the\pgfutil@everybye}} +\AtBeginDocument{\AtEndDocument{\par\vfil\penalty-10000\relax\the\pgfutil@everybye}} \def\pgfutil@insertatbegincurrentpagefrombox#1{% \edef\pgf@temp{\the\wd\pgfutil@abb}% \global\setbox\pgfutil@abb\hbox{% - \unhbox\pgfutil@abb% - % - % the order in which \pgfutil@insertatbegincurrentpagefrombox - % matters unless we make the following -shift! - % To see this, consider writing two such statements. The second - % one will (naturally) be placed more to the right, although there - % is no apparent reason why it should. - % - % CF observed problems when placing patterns in XObjects without - % this skip (dvipdfmx driver for pgfplots shader=interp) - \hskip-\pgf@temp\relax% - #1% + \unhbox\pgfutil@abb% + % + % the order in which \pgfutil@insertatbegincurrentpagefrombox + % matters unless we make the following -shift! + % To see this, consider writing two such statements. The second + % one will (naturally) be placed more to the right, although there + % is no apparent reason why it should. + % + % CF observed problems when placing patterns in XObjects without + % this skip (dvipdfmx driver for pgfplots shader=interp) + \hskip-\pgf@temp\relax% + #1% }% } \newbox\pgfutil@abb% @@ -124,40 +124,40 @@ % Add at begin page stuff \setbox\@cclv=\vbox{% \setbox\z@=\hbox{% - % the boxes \pgfutil@abe ("every page") and \pgfutil@abb ("current page") - % are used to generate pdf objects / dictionaries which are - % required for the graphics which are somewhere in the "real" - % page content. - % BUT: these pdf objects MUST NOT be affected by text layout - % shifts! Consequently, we have to undo \hoffset and \voffset - % (which are h/v shifts to the page layout). - % - % Note that this of importance for shadings. To be more - % specific: try out shadings with standalone (which uses - % \hoffset) and with xdvipdfmx (which appears to be more - % fragile than pdflatex) - they break unless we undo \hoffset - % and \voffset. - \ifdim\hoffset=0pt \else \hskip-\hoffset\fi - \pgfutil@abe\unhbox\pgfutil@abb\pgfutil@abc\global\let\pgfutil@abc\pgfutil@empty - \ifdim\hoffset=0pt \else \hskip+\hoffset\fi - }% + % the boxes \pgfutil@abe ("every page") and \pgfutil@abb ("current page") + % are used to generate pdf objects / dictionaries which are + % required for the graphics which are somewhere in the "real" + % page content. + % BUT: these pdf objects MUST NOT be affected by text layout + % shifts! Consequently, we have to undo \hoffset and \voffset + % (which are h/v shifts to the page layout). + % + % Note that this of importance for shadings. To be more + % specific: try out shadings with standalone (which uses + % \hoffset) and with xdvipdfmx (which appears to be more + % fragile than pdflatex) - they break unless we undo \hoffset + % and \voffset. + \ifdim\hoffset=0pt \else \hskip-\hoffset\fi + \pgfutil@abe\unhbox\pgfutil@abb\pgfutil@abc\global\let\pgfutil@abc\pgfutil@empty + \ifdim\hoffset=0pt \else \hskip+\hoffset\fi + }% \wd\z@=\z@% \ht\z@=\z@% \dp\z@=\z@% - % ... see remark above regarding \hoffset/\voffset: - \ifdim\voffset=0pt \else \vskip-\voffset\fi + % ... see remark above regarding \hoffset/\voffset: + \ifdim\voffset=0pt \else \vskip-\voffset\fi \box\z@% - \ifdim\voffset=0pt \else \vskip+\voffset\fi - % - % if TeX changes into vertical mode, it inserts \parskip and - % \lineskip. Disable it here: + \ifdim\voffset=0pt \else \vskip+\voffset\fi + % + % if TeX changes into vertical mode, it inserts \parskip and + % \lineskip. Disable it here: \nointerlineskip% \ifvbox\@cclv \unvbox\@cclv \else\hsize=\wd\@cclv \noindent\unhbox\@cclv \fi% - %\box\@cclv - % using \box instead of \unhbox or \unvbox - % has the advantage that glue settings won't be - % altered (as for \unhbox/\unvbox). But \box breaks compatibility - % with the 'remember picture' feature. + %\box\@cclv + % using \box instead of \unhbox or \unvbox + % has the advantage that glue settings won't be + % altered (as for \unhbox/\unvbox). But \box breaks compatibility + % with the 'remember picture' feature. }% } @@ -175,23 +175,16 @@ \fi }{}% } - + % Guess the driver: \def\pgfutil@guessdriver{ - \ifx\HCode\@undefined% + \ifx\HCode\@undefined% \edef\pgfsysdriver{pgfsys-\Gin@driver}% should be right \else% \def\pgfsysdriver{pgfsys-tex4ht.def}% should be right \fi% } -% pgfcalendar uses translations - -\ifx\translate\@undefined % check if \translate is available - \def\pgfutil@translate#1{\translate{#1}} -\else - \def\pgfutil@translate#1{#1} -\fi \endinput diff --git a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-plain.def b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-plain.def index f8e1e327991..3d7573f7071 100644 --- a/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-plain.def +++ b/Master/texmf-dist/tex/generic/pgf/utilities/pgfutil-plain.def @@ -51,7 +51,7 @@ \expandafter\pgfsys@outerinvoke\expandafter{\pgfsysprotocol@currentprotocol}% }% \pgfsysprotocol@setcurrentprotocol\pgfutil@emu@temp% - \aftergroup\pgfutil@reset@color% + \aftergroup\pgfutil@reset@color% } \def\pgfutil@extractcolorspec#1#2{% @@ -69,7 +69,7 @@ \else \let\pgf@next=\pgfutil@firstoftwo% \fi% - \pgf@next{#2}{#3}% + \pgf@next{#2}{#3}% } @@ -100,7 +100,7 @@ \edef\pgf@marshal{\noexpand\let\expandafter\noexpand\csname\string\color@#1\endcsname=% \expandafter\noexpand\csname\string\color@#2\endcsname}% \pgf@marshal% - \fi% + \fi% } \def\pgfutil@emu@mix#1!#2!#3!#4\@nil{% \expandafter\expandafter\expandafter\pgfutil@emu@unpack\csname\string\color@#1\endcsname% @@ -161,7 +161,7 @@ \def\pgfutil@guessdriver{ \ifx\directlua\@undefined - \ifx\HCode\@undefined% + \ifx\HCode\@undefined% \ifcase\pdfoutput% \ifx\XeTeXversion\@undefined \def\pgfsysdriver{pgfsys-dvips.def}% hopefully @@ -179,7 +179,7 @@ \fi } - + % Global colors @@ -247,18 +247,18 @@ \def\pgfutil@insertatbegincurrentpagefrombox#1{% \edef\pgf@temp{\the\wd\pgfutil@abb}% \global\setbox\pgfutil@abb\hbox{% - \unhbox\pgfutil@abb - % - % the order in which \pgfutil@insertatbegincurrentpagefrombox - % matters unless we make the following -shift! - % To see this, consider writing two such statements. The second - % one will (naturally) be placed more to the right, although there - % is no apparent reason why it should. - % - % CF observed problems when placing patterns in XObjects without - % this skip (dvipdfmx driver for pgfplots shader=interp) - \hskip-\pgf@temp\relax - #1% + \unhbox\pgfutil@abb + % + % the order in which \pgfutil@insertatbegincurrentpagefrombox + % matters unless we make the following -shift! + % To see this, consider writing two such statements. The second + % one will (naturally) be placed more to the right, although there + % is no apparent reason why it should. + % + % CF observed problems when placing patterns in XObjects without + % this skip (dvipdfmx driver for pgfplots shader=interp) + \hskip-\pgf@temp\relax + #1% }% } \newbox\pgfutil@abb% @@ -272,55 +272,51 @@ \let\pgfutil@abe\pgfutil@empty% % Code by Heiko Oberdiek on ctt -\input atbegshi.sty\relax -\AtBeginShipout{% - \setbox\AtBeginShipoutBox=\vbox{% - \setbox0=\hbox{% - \begingroup - % the boxes \pgfutil@abe ("every page") and \pgfutil@abb ("current page") - % are used to generate pdf objects / dictionaries which are - % required for the graphics which are somewhere in the "real" - % page content. - % BUT: these pdf objects MUST NOT be affected by text layout - % shifts! Consequently, we have to undo \hoffset and \voffset - % (which are h/v shifts to the page layout). - % - % Note that this of importance for shadings. To be more - % specific: try out shadings with standalone (which uses - % \hoffset) and with xdvipdfmx (which appears to be more - % fragile than pdflatex) - they break unless we undo \hoffset - % and \voffset. - \ifdim\hoffset=0pt \else \hskip-\hoffset\fi - \pgfutil@abe - \unhbox\pgfutil@abb - \pgfutil@abc - \global\let\pgfutil@abc\pgfutil@empty - \ifdim\hoffset=0pt \else \hskip+\hoffset\fi - \endgroup - }% - \wd0=0pt\relax - \ht0=0pt\relax - \dp0=0pt\relax - % ... see remark above regarding \hoffset/\voffset: - \ifdim\voffset=0pt \else \vskip-\voffset\fi - \box0 % - \ifdim\voffset=0pt \else \vskip+\voffset\fi - \nointerlineskip - \box\AtBeginShipoutBox - }% -}% +\input atbegshi.sty\relax +\AtBeginShipout{% + \setbox\AtBeginShipoutBox=\vbox{% + \setbox0=\hbox{% + \begingroup + % the boxes \pgfutil@abe ("every page") and \pgfutil@abb ("current page") + % are used to generate pdf objects / dictionaries which are + % required for the graphics which are somewhere in the "real" + % page content. + % BUT: these pdf objects MUST NOT be affected by text layout + % shifts! Consequently, we have to undo \hoffset and \voffset + % (which are h/v shifts to the page layout). + % + % Note that this of importance for shadings. To be more + % specific: try out shadings with standalone (which uses + % \hoffset) and with xdvipdfmx (which appears to be more + % fragile than pdflatex) - they break unless we undo \hoffset + % and \voffset. + \ifdim\hoffset=0pt \else \hskip-\hoffset\fi + \pgfutil@abe + \unhbox\pgfutil@abb + \pgfutil@abc + \global\let\pgfutil@abc\pgfutil@empty + \ifdim\hoffset=0pt \else \hskip+\hoffset\fi + \endgroup + }% + \wd0=0pt\relax + \ht0=0pt\relax + \dp0=0pt\relax + % ... see remark above regarding \hoffset/\voffset: + \ifdim\voffset=0pt \else \vskip-\voffset\fi + \box0 % + \ifdim\voffset=0pt \else \vskip+\voffset\fi + \nointerlineskip + \box\AtBeginShipoutBox + }% +}% % End of HO code % The following is still messy and needs to be cleanup up (everything -% prefixed by pgfutil@): +% prefixed by pgfutil@): %\def\PackageInfo#1#2{} %\def\PackageWarning#1#2{\immediate\write17{Package #1: Warning! #2.}}% %\def\PackageError#1#2#3{\immediate\write17{Package #1: Error! #2.}}% \long\def\AtBeginDocument#1{#1}% -% pgfcalendar uses translations - -\def\pgfutil@translate#1{#1} % is there a translator package for plain? - \endinput diff --git a/Master/texmf-dist/tex/latex/pgf/doc/pgfmanual.code.tex b/Master/texmf-dist/tex/latex/pgf/doc/pgfmanual.code.tex index fca9c791b8d..5850362e9d5 100644 --- a/Master/texmf-dist/tex/latex/pgf/doc/pgfmanual.code.tex +++ b/Master/texmf-dist/tex/latex/pgf/doc/pgfmanual.code.tex @@ -11,7 +11,7 @@ \input pgfmanual.pdflinks.code.tex % TODO for auto xrefs: -% 1. check the already identified labels, preferably using +% 1. check the already identified labels, preferrably using % /pdflinks/show labels=true % and the image externalization debug mode (see pgfmanual-en-main.tex) % (to strip almost all images away) @@ -22,7 +22,7 @@ % % 2.1 perhaps insert \pgfmanualpdflabel{<label>}{} where needed. % -% 3. Verify that the |...| commands occurring in situations where catcodes can't +% 3. Verify that the |...| commands occuring in situations where catcodes can't % be changed (footnotes or macro arguments) work as expected. % % 4. Consider telling the pretty printer that several control sequences @@ -37,28 +37,29 @@ \pgfkeys{ - % set this to 'false' to disable auto reference generation. - % However, a little bit runtime overhead will still remain - % (and the \pgfmanualpdflabel commands will still be used) - /pdflinks/codeexample links=true, - % - /codeexample/prettyprint/cs arguments/tikzset/.initial=1, - /codeexample/prettyprint/cs/tikzset/.code 2 args={\pgfmanualpdfref{#1}{#1}\{\pgfmanualprettyprintpgfkeys{#2}\pgfmanualclosebrace}, - /codeexample/prettyprint/cs arguments/usetikzlibrary/.initial=1, - /codeexample/prettyprint/cs/usetikzlibrary/.code 2 args={\pgfmanualpdfref{#1}{#1}\{\pgfmanualpdfref{#2}{#2}\pgfmanualclosebrace}, - /codeexample/prettyprint/cs arguments/usepgflibrary/.initial=1, - /codeexample/prettyprint/cs/usepgflibrary/.code 2 args={\pgfmanualpdfref{#1}{#1}\{\pgfmanualpdfref{#2}{#2}\pgfmanualclosebrace}, - % - % - % - % whenever an unqualified key is found, the following key prefix - % list is tried to find a match. - /pdflinks/search key prefixes in={/tikz/,/pgf/}, - % - % the link prefix written to the pdf file: - /pdflinks/internal link prefix=pgf, - % - /pdflinks/warnings=false, - % for debugging: - /pdflinks/show labels=false, + % set this to 'false' to disable auto reference generation. + % However, a little bit runtime overhead will still remain + % (and the \pgfmanualpdflabel commands will still be used) + /pdflinks/codeexample links=true, + % + /codeexample/prettyprint/cs arguments/tikzset/.initial=1, + /codeexample/prettyprint/cs/tikzset/.code 2 args={\pgfmanualpdfref{#1}{#1}\{\pgfmanualprettyprintpgfkeys{#2}\pgfmanualclosebrace}, + /codeexample/prettyprint/cs arguments/usetikzlibrary/.initial=1, + /codeexample/prettyprint/cs/usetikzlibrary/.code 2 args={\pgfmanualpdfref{#1}{#1}\{\pgfmanualpdfref{#2}{#2}\pgfmanualclosebrace}, + /codeexample/prettyprint/cs arguments/usepgflibrary/.initial=1, + /codeexample/prettyprint/cs/usepgflibrary/.code 2 args={\pgfmanualpdfref{#1}{#1}\{\pgfmanualpdfref{#2}{#2}\pgfmanualclosebrace}, + % + % + % + % whenever an unqualified key is found, the following key prefix + % list is tried to find a match. + /pdflinks/search key prefixes in={/tikz/,/pgf/}, + % + % the link prefix written to the pdf file: + /pdflinks/internal link prefix=pgf, + % + /pdflinks/warnings=false, + % for debugging: + /pdflinks/show labels=false, }% + diff --git a/Master/texmf-dist/tex/latex/pgf/doc/pgfmanual.pdflinks.code.tex b/Master/texmf-dist/tex/latex/pgf/doc/pgfmanual.pdflinks.code.tex index a23b9ad6861..bdae790399e 100644 --- a/Master/texmf-dist/tex/latex/pgf/doc/pgfmanual.pdflinks.code.tex +++ b/Master/texmf-dist/tex/latex/pgf/doc/pgfmanual.pdflinks.code.tex @@ -4,7 +4,7 @@ % % Provides a user-friendly interface to create function plots (normal % plots, semi-logplots and double-logplots). -% +% % It is based on Till Tantau's PGF package. % % Copyright 2007/2008/2009 by Christian Feuersänger. @@ -13,19 +13,19 @@ % it under the terms of the GNU General Public License as published by % the Free Software Foundation, either version 3 of the License, or % (at your option) any later version. -% +% % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. -% +% % You should have received a copy of the GNU General Public License % along with this program. If not, see <http://www.gnu.org/licenses/>. % %-------------------------------------------- % This file provides an interface to the -% pgfmanual.prettyprint.code.tex thing -- it allows to +% pgfmanual.prettyprint.code.tex thing -- it allows to % *generate pdf crossrefs inside of codeexamples automatically* % without any user input. % @@ -61,245 +61,245 @@ \pgfutil@IfUndefined{cleanedhyperlink}{\let\cleanedhyperlink=\hyperlink}{} \pgfkeys{% - /codeexample/prettyprint/cs arguments/pgfkeys/.initial=1, - /codeexample/prettyprint/cs/pgfkeys/.code 2 args={\pgfmanualpdfref{#1}{#1}\{\pgfmanualprettyprintpgfkeys{#2}\pgfmanualclosebrace}, - % - /codeexample/prettyprint/autolinks/.style={% - /codeexample/prettyprint/key name/.code={\pgfmanualpdfref{##1}{##1}}, - /codeexample/prettyprint/key name with handler/.code 2 args={\pgfmanualpdfref{##1}{##1}/\pgfmanualpdfref{/handlers/##2}{##2}}, - /codeexample/prettyprint/key value display only/.code={\pgfmanualprettyprintcode{##1}}, - /codeexample/prettyprint/cs/.code={\pgfmanualpdfref{##1}{##1}}, - /codeexample/prettyprint/cs with args/.code 2 args={\pgfmanualpdfref{##1}{##1}\{\pgfmanualprettyprintcode{##2}\pgfmanualclosebrace}, - /codeexample/prettyprint/cs arguments/pgfkeys/.initial=1, - /codeexample/prettyprint/cs/pgfkeys/.code 2 args={\pgfmanualpdfref{##1}{##1}\{\pgfmanualprettyprintpgfkeys{##2}\pgfmanualclosebrace}, - /codeexample/prettyprint/cs arguments/begin/.initial=1, - /codeexample/prettyprint/cs/begin/.code 2 args={##1\{\pgfmanualpdfref{##2}{##2}\pgfmanualclosebrace}, - /codeexample/prettyprint/cs arguments/end/.initial=1, - /codeexample/prettyprint/cs/end/.code 2 args={##1\{\pgfmanualpdfref{##2}{##2}\pgfmanualclosebrace}, - /codeexample/prettyprint/word/.code={\begingroup\pgfkeyssetvalue{/pdflinks/search key prefixes in}{}\pgfmanualpdfref{##1}{##1}\endgroup}, - /codeexample/prettyprint/point/.code={##1},% - /codeexample/prettyprint/point with cs/.code 2 args={(\pgfmanualpdfref{##1}{##1}:##2},% - },% - /codeexample/prettyprint/autolinks, + /codeexample/prettyprint/cs arguments/pgfkeys/.initial=1, + /codeexample/prettyprint/cs/pgfkeys/.code 2 args={\pgfmanualpdfref{#1}{#1}\{\pgfmanualprettyprintpgfkeys{#2}\pgfmanualclosebrace}, + % + /codeexample/prettyprint/autolinks/.style={% + /codeexample/prettyprint/key name/.code={\pgfmanualpdfref{##1}{##1}}, + /codeexample/prettyprint/key name with handler/.code 2 args={\pgfmanualpdfref{##1}{##1}/\pgfmanualpdfref{/handlers/##2}{##2}}, + /codeexample/prettyprint/key value display only/.code={\pgfmanualprettyprintcode{##1}}, + /codeexample/prettyprint/cs/.code={\pgfmanualpdfref{##1}{##1}}, + /codeexample/prettyprint/cs with args/.code 2 args={\pgfmanualpdfref{##1}{##1}\{\pgfmanualprettyprintcode{##2}\pgfmanualclosebrace}, + /codeexample/prettyprint/cs arguments/pgfkeys/.initial=1, + /codeexample/prettyprint/cs/pgfkeys/.code 2 args={\pgfmanualpdfref{##1}{##1}\{\pgfmanualprettyprintpgfkeys{##2}\pgfmanualclosebrace}, + /codeexample/prettyprint/cs arguments/begin/.initial=1, + /codeexample/prettyprint/cs/begin/.code 2 args={##1\{\pgfmanualpdfref{##2}{##2}\pgfmanualclosebrace}, + /codeexample/prettyprint/cs arguments/end/.initial=1, + /codeexample/prettyprint/cs/end/.code 2 args={##1\{\pgfmanualpdfref{##2}{##2}\pgfmanualclosebrace}, + /codeexample/prettyprint/word/.code={\begingroup\pgfkeyssetvalue{/pdflinks/search key prefixes in}{}\pgfmanualpdfref{##1}{##1}\endgroup}, + /codeexample/prettyprint/point/.code={##1},% + /codeexample/prettyprint/point with cs/.code 2 args={(\pgfmanualpdfref{##1}{##1}:##2},% + },% + /codeexample/prettyprint/autolinks, }% \pgfkeys{ - % - % Enables or disables the parsing of codeexamples. - /pdflinks/codeexample links/.is if=pgfmanualprettyenabled, - /pdflinks/codeexample links/.default=true, - % - % How to render a hyperlink - /pdflinks/render hyperlink/.code=#1, - % - % whenever an unqualified key is found, the following key prefix - % list is tried to find a match. - /pdflinks/search key prefixes in/.initial={/tikz/,/pgf/}, - % - % Enables or disables warnings for failed auto links: - /pdflinks/warnings/.is if=pgfmanualpdfwarnings, - /pdflinks/warnings/.default=true, - % - % Shows the autogenerated labels. This is useful to check if the - % 'search key prefixes in' worked as it ought to. - /pdflinks/show labels/.is if=pgfmanualshowlabels, - /pdflinks/show labels/.default=true, - /pdflinks/show labels=false, - % will be invoked with '#1' set to the generated label. - /pdflinks/show labels code/.code={ - \hbox to 0pt{% - \vbox to 0pt{\hsize=0pt - \vskip-\baselineskip - \hbox to \hsize{% - \hss - {\footnotesize\ttfamily\textcolor{red}{#1}}% - \hss - }% - \vss - }% - \vbox to 0pt{\hsize=0pt - \vss - \hbox to \hsize{% - \hss - {\footnotesize\ttfamily\textcolor{red}{$\vert$}}% - \hss - }% - }% - \vsize=0pt - }% - }, - % - % the link prefix written to the pdf file: - /pdflinks/internal link prefix/.initial=pgf, + % + % Enables or disables the parsing of codeexamples. + /pdflinks/codeexample links/.is if=pgfmanualprettyenabled, + /pdflinks/codeexample links/.default=true, + % + % How to render a hyperlink + /pdflinks/render hyperlink/.code=#1, + % + % whenever an unqualified key is found, the following key prefix + % list is tried to find a match. + /pdflinks/search key prefixes in/.initial={/tikz/,/pgf/}, + % + % Enables or disables warnings for failed auto links: + /pdflinks/warnings/.is if=pgfmanualpdfwarnings, + /pdflinks/warnings/.default=true, + % + % Shows the autogenerated labels. This is useful to check if the + % 'search key prefixes in' worked as it ought to. + /pdflinks/show labels/.is if=pgfmanualshowlabels, + /pdflinks/show labels/.default=true, + /pdflinks/show labels=false, + % will be invoked with '#1' set to the generated label. + /pdflinks/show labels code/.code={ + \hbox to 0pt{% + \vbox to 0pt{\hsize=0pt + \vskip-\baselineskip + \hbox to \hsize{% + \hss + {\footnotesize\ttfamily\textcolor{red}{#1}}% + \hss + }% + \vss + }% + \vbox to 0pt{\hsize=0pt + \vss + \hbox to \hsize{% + \hss + {\footnotesize\ttfamily\textcolor{red}{$\vert$}}% + \hss + }% + }% + \vsize=0pt + }% + }, + % + % the link prefix written to the pdf file: + /pdflinks/internal link prefix/.initial=pgf, } \begingroup - \catcode`\_=12 - \gdef\pgfmanualpdf@underscore{_}% - \catcode`\ =13\relax\gdef\pgfmanualpdf@install@active@space{\def {\space}}% + \catcode`\_=12 + \gdef\pgfmanualpdf@underscore{_}% + \catcode`\ =13\relax\gdef\pgfmanualpdf@install@active@space{\def {\space}}% \endgroup \gdef\pgfmanualpdf@installreplacements{% - \def\marg##1{{##1}}% - \def\oarg##1{[##1]}% - \def\meta##1{meta(##1)}% - \def\x{x}% - \def\textbackslash{back/}% - \def\\{\textbackslash}% - \def\space{:}% - \edef\ {\space}% - \edef\SPACE{\` \relax}% - \ifnum\the\catcode`\ =13 % - \pgfmanualpdf@install@active@space - \fi - \edef\#{}% - \def\printanat{@}% - \def\protect{}% - \def\textasciicircum{o}% + \def\marg##1{{##1}}% + \def\oarg##1{[##1]}% + \def\meta##1{meta(##1)}% + \def\x{x}% + \def\textbackslash{back/}% + \def\\{\textbackslash}% + \def\space{:}% + \edef\ {\space}% + \edef\SPACE{\` \relax}% + \ifnum\the\catcode`\ =13 % + \pgfmanualpdf@install@active@space + \fi + \edef\#{}% + \def\printanat{@}% + \def\protect{}% + \def\textasciicircum{o}% \def\_{\pgfmanualpdf@underscore}% - \expandafter\edef\pgfmanual@verb@activebar{\pgfmanual@verb@bar}% + \expandafter\edef\pgfmanual@verb@activebar{\pgfmanual@verb@bar}% }% % Defines a new pdf cross ref label for use with \pgfmanualpdfref. % % Usage: -% \pgfmanualpdflabel{<label>}{<text>} +% \pgfmanualpdflabel{<label>}{<text>} % #1: the label. % The text #2 will be shown in the resulting pdf (if it is not empty). % % There is also support for catcode changes if <label> contains % something which shouldn't be written as-is into .aux files: -% \pgfmanualpdflabel[\catcode`\|=12 ]{|-}{} +% \pgfmanualpdflabel[\catcode`\|=12 ]{|-}{} % -> this will write -% \begingroup \catcode `\|=12 -% <code to deal with the label |- > -% \endgroup +% \begingroup \catcode `\|=12 +% <code to deal with the label |- > +% \endgroup % into the .aux file. % \def\pgfmanualpdflabel{\pgfutil@ifnextchar[{\pgfmanualpdflabel@opt}{\pgfmanualpdflabel@opt[]}}% \def\pgfmanualpdflabel@opt[#1]#2#3{% - \begingroup - % - \def\pgfmanualpdf@catcode{#1}% - \pgfmanualpdf@catcode - % - \pgfmanualpdflabel@generate{#2}{#3}% - % - % this is pgfplots-specific: pgfplots supports generic styles which - % contain '\x' where '\x' iterates through 'x,y,z'. - \pgfutil@in@\x{#2}% - \ifpgfutil@in@ - \def\x{y}% - \pgfmanualpdflabel@generate{#2}{#3}% - \def\x{z}% - \pgfmanualpdflabel@generate{#2}{#3}% - \fi - \endgroup + \begingroup + % + \def\pgfmanualpdf@catcode{#1}% + \pgfmanualpdf@catcode + % + \pgfmanualpdflabel@generate{#2}{#3}% + % + % this is pgfplots-specific: pgfplots supports generic styles which + % contain '\x' where '\x' iterates through 'x,y,z'. + \pgfutil@in@\x{#2}% + \ifpgfutil@in@ + \def\x{y}% + \pgfmanualpdflabel@generate{#2}{#3}% + \def\x{z}% + \pgfmanualpdflabel@generate{#2}{#3}% + \fi + \endgroup }% \def\pgfmanualpdflabel@generate#1#2{% - \pgfmanual@handlespeciallabeltokens@in{#1}% - % - \def\pgfmanualpdflabel@generateone{0}% - \pgfutil@ifundefined{pgfd@lbl@\pgfmanualpdflabel@@}{% - % ok, no such label is known. - \def\pgfmanualpdflabel@generateone{1}% - }{% - \if\csname pgfd@lbl@\pgfmanualpdflabel@@\endcsname a% "a"ux - % ah, it is "just" known from a previous run, but there is - % no code in the pdf! Write it! - \def\pgfmanualpdflabel@generateone{1}% - \else - % ok, we already wrote one before. Skip. - \fi - }% - \if\pgfmanualpdflabel@generateone1% - \ifpgfmanualshowlabels - \pgfkeysvalueof{/pdflinks/show labels code/.@cmd}{\pgfmanualpdflabel@@}\pgfeov - \fi - % - \if@filesw - \ifx\pgfmanualpdf@catcode\pgfutil@empty - \else - \toks0=\expandafter{\pgfmanualpdf@catcode}% - \immediate\write\@auxout{% - \noexpand\begingroup - \the\toks0 - }% - \fi - \immediate\write\@auxout{% - \noexpand\expandafter\noexpand\gdef - \noexpand\csname pgfd@lbl@\pgfmanualpdflabel@@\noexpand\endcsname{a}% a = known in "a"ux file - }% - \ifx\pgfmanualpdf@catcode\pgfutil@empty - \else - \immediate\write\@auxout{\noexpand\endgroup}% - \fi - \fi - \expandafter\gdef\csname pgfd@lbl@\pgfmanualpdflabel@@\endcsname{w}% 1. remember the label AND remember that we "w"rote it into the pdf. - \edef\pgfmanualpdflabel@@{\pgfkeysvalueof{/pdflinks/internal link prefix}.\pgfmanualpdflabel@@}% - \ifvmode% - \expandafter\cleanedhypertarget\expandafter{\pgfmanualpdflabel@@}{#2}% - \else% - {\setbox0=\hbox{\raise1em\hbox{\expandafter\cleanedhypertarget\expandafter{\pgfmanualpdflabel@@}{}}}\ht0=0pt\box0}#2% - \fi% - \else - #2% - \fi + \pgfmanual@handlespeciallabeltokens@in{#1}% + % + \def\pgfmanualpdflabel@generateone{0}% + \pgfutil@ifundefined{pgfd@lbl@\pgfmanualpdflabel@@}{% + % ok, no such label is known. + \def\pgfmanualpdflabel@generateone{1}% + }{% + \if\csname pgfd@lbl@\pgfmanualpdflabel@@\endcsname a% "a"ux + % ah, it is "just" known from a previous run, but there is + % no code in the pdf! Write it! + \def\pgfmanualpdflabel@generateone{1}% + \else + % ok, we already wrote one before. Skip. + \fi + }% + \if\pgfmanualpdflabel@generateone1% + \ifpgfmanualshowlabels + \pgfkeysvalueof{/pdflinks/show labels code/.@cmd}{\pgfmanualpdflabel@@}\pgfeov + \fi + % + \if@filesw + \ifx\pgfmanualpdf@catcode\pgfutil@empty + \else + \toks0=\expandafter{\pgfmanualpdf@catcode}% + \immediate\write\@auxout{% + \noexpand\begingroup + \the\toks0 + }% + \fi + \immediate\write\@auxout{% + \noexpand\expandafter\noexpand\gdef + \noexpand\csname pgfd@lbl@\pgfmanualpdflabel@@\noexpand\endcsname{a}% a = known in "a"ux file + }% + \ifx\pgfmanualpdf@catcode\pgfutil@empty + \else + \immediate\write\@auxout{\noexpand\endgroup}% + \fi + \fi + \expandafter\gdef\csname pgfd@lbl@\pgfmanualpdflabel@@\endcsname{w}% 1. remember the label AND remember that we "w"rote it into the pdf. + \edef\pgfmanualpdflabel@@{\pgfkeysvalueof{/pdflinks/internal link prefix}.\pgfmanualpdflabel@@}% + \ifvmode% + \expandafter\cleanedhypertarget\expandafter{\pgfmanualpdflabel@@}{#2}% + \else% + {\setbox0=\hbox{\raise1em\hbox{\expandafter\cleanedhypertarget\expandafter{\pgfmanualpdflabel@@}{}}}\ht0=0pt\box0}#2% + \fi% + \else + #2% + \fi }% % A pdf reference to label `#1' with (TeX) text `#2'. % @see also \verbpdfref. \def\pgfmanualpdfref#1#2{% - \begingroup - \pgfmanual@handlespeciallabeltokens@in{#1}% - % - \ifcsname pgfd@lbl@\pgfmanualpdflabel@@\endcsname - \else - \global\let\pgfmanual@glob=\pgfmanualpdflabel@@ - \def\pgfmanual@tempa{\foreach \prefix in }% - \pgfkeysgetvalue{/pdflinks/search key prefixes in}\pgfmanual@tempb - \expandafter\pgfmanual@tempa\expandafter{\pgfmanual@tempb}{% - \edef\pgfmanualpdflabel@@{\prefix\pgfmanualpdflabel@@}% - \expandafter\pgfmanual@handlespeciallabeltokens@in\expandafter{\pgfmanualpdflabel@@}% - \ifcsname pgfd@lbl@\pgfmanualpdflabel@@\endcsname - \xdef\pgfmanual@glob{\pgfmanualpdflabel@@}% - \breakforeach - \fi - }% - \let\pgfmanualpdflabel@@=\pgfmanual@glob - \ifcsname pgfd@lbl@\pgfmanualpdflabel@@\endcsname - \else - \ifpgfmanualpdfwarnings - \begingroup - \toks0={#1}% - \pgfmanual@warning{pgfmanualpdfref{\the\toks0 }: target label does not exist.}% - \endgroup - \fi - #2% - \let\pgfmanualpdflabel@@=\pgfutil@empty - \fi - \fi - \ifx\pgfmanualpdflabel@@\pgfutil@empty - \else - \expandafter\pgfmanualpdfref@\expandafter{\pgfmanualpdflabel@@}{#2}% - \fi - \endgroup + \begingroup + \pgfmanual@handlespeciallabeltokens@in{#1}% + % + \ifcsname pgfd@lbl@\pgfmanualpdflabel@@\endcsname + \else + \global\let\pgfmanual@glob=\pgfmanualpdflabel@@ + \def\pgfmanual@tempa{\foreach \prefix in }% + \pgfkeysgetvalue{/pdflinks/search key prefixes in}\pgfmanual@tempb + \expandafter\pgfmanual@tempa\expandafter{\pgfmanual@tempb}{% + \edef\pgfmanualpdflabel@@{\prefix\pgfmanualpdflabel@@}% + \expandafter\pgfmanual@handlespeciallabeltokens@in\expandafter{\pgfmanualpdflabel@@}% + \ifcsname pgfd@lbl@\pgfmanualpdflabel@@\endcsname + \xdef\pgfmanual@glob{\pgfmanualpdflabel@@}% + \breakforeach + \fi + }% + \let\pgfmanualpdflabel@@=\pgfmanual@glob + \ifcsname pgfd@lbl@\pgfmanualpdflabel@@\endcsname + \else + \ifpgfmanualpdfwarnings + \begingroup + \toks0={#1}% + \pgfmanual@warning{pgfmanualpdfref{\the\toks0 }: target label does not exist.}% + \endgroup + \fi + #2% + \let\pgfmanualpdflabel@@=\pgfutil@empty + \fi + \fi + \ifx\pgfmanualpdflabel@@\pgfutil@empty + \else + \expandafter\pgfmanualpdfref@\expandafter{\pgfmanualpdflabel@@}{#2}% + \fi + \endgroup }% \def\pgfmanualpdfref@#1#2{% - \pgfkeysgetvalue{/pdflinks/internal link prefix}\pgfmanual@temp - \expandafter\cleanedhyperlink\expandafter{\pgfmanual@temp.#1}{\pgfkeysvalueof{/pdflinks/render hyperlink/.@cmd}{#2}\pgfeov}% - \ifpgfmanualshowlabels - \pgfkeysvalueof{/pdflinks/show labels code/.@cmd}{#1}\pgfeov - \fi + \pgfkeysgetvalue{/pdflinks/internal link prefix}\pgfmanual@temp + \expandafter\cleanedhyperlink\expandafter{\pgfmanual@temp.#1}{\pgfkeysvalueof{/pdflinks/render hyperlink/.@cmd}{#2}\pgfeov}% + \ifpgfmanualshowlabels + \pgfkeysvalueof{/pdflinks/show labels code/.@cmd}{#1}\pgfeov + \fi }% % Handles special tokens in a pdf label which should be treated with % care. % -% For example, backslashes might produce problems. -% This occurs quite frequently with automatically generated hyperrefs -% inside of codeexamples where \pgfmanualpdfref will be invoked - -% there, we get the catcode 12 backslashes. +% For example, backslashes might produce problems. +% This occurs quite frequently with automatically generated hyperrefs +% inside of codeexamples where \pgfmanualpdfref will be invoked - +% there, we get the catcode 12 backslashes. % Check for them! % % #1: a token list which shall be used either as cross ref or as @@ -308,24 +308,24 @@ % On output, the macro \pgfmanualpdflabel@@ will be '\edef'ed to the % new, possibly modified value. \def\pgfmanual@handlespeciallabeltokens@in#1{% - \begingroup - \pgfmanualpdf@installreplacements - \expandafter\pgfutil@in@\pgfmanual@pretty@backslash{#1}% - \ifpgfutil@in@ - % assume the backslash is the first char and substitute it: - \pgfmanualpdfref@substitute@backslash#1\relax - \else - \edef\pgfmanualpdflabel@@{#1}% - \fi - \def\pgfmanual@tmp{\pgfutilstrreplace{ }{\space}}% - \expandafter\pgfmanual@tmp\expandafter{\pgfmanualpdflabel@@}% - \edef\pgfmanualpdflabel@@{\pgfretval}% - \pgfmath@smuggleone\pgfmanualpdflabel@@ - \endgroup + \begingroup + \pgfmanualpdf@installreplacements + \expandafter\pgfutil@in@\pgfmanual@pretty@backslash{#1}% + \ifpgfutil@in@ + % assume the backslash is the first char and substitute it: + \pgfmanualpdfref@substitute@backslash#1\relax + \else + \edef\pgfmanualpdflabel@@{#1}% + \fi + \def\pgfmanual@tmp{\pgfutilstrreplace{ }{\space}}% + \expandafter\pgfmanual@tmp\expandafter{\pgfmanualpdflabel@@}% + \edef\pgfmanualpdflabel@@{\pgfretval}% + \pgfmath@smuggleone\pgfmanualpdflabel@@ + \endgroup }% \expandafter\def\expandafter\pgfmanualpdfref@substitute@backslash\expandafter#\expandafter1\pgfmanual@pretty@backslash#2\relax{% - \edef\pgfmanualpdflabel@@{#1\textbackslash #2}% + \edef\pgfmanualpdflabel@@{#1\textbackslash #2}% }% % Typesets '#1' in red,\texttt like every declaration. It will also @@ -337,103 +337,103 @@ % % \declareandlabel{\controlsequence} can be used as |\controlsequence| \def\declareandlabel{% - \begingroup - \pgfmanual@verb@preparecatcodes@ - \def\pgfmanualprettyprinterhandlecollectedargs##1{% - \pgfmanualpdflabel##1{\texttt{\declare##1}}% mark: '##1' contains already braces. - \endgroup - }% - \pgfmanualprettyprintercollectargcount1{\relax}% + \begingroup + \pgfmanual@verb@preparecatcodes@ + \def\pgfmanualprettyprinterhandlecollectedargs##1{% + \pgfmanualpdflabel##1{\texttt{\declare##1}}% mark: '##1' contains already braces. + \endgroup + }% + \pgfmanualprettyprintercollectargcount1{\relax}% } -% +% % \verbpdfref{\controlsequence more stuff} % is the same as writing |\controlsequence more stuff|, but the % *complete* argument is supposed to be one label. -% +% % The difference to \pgfmanualpdfref{...}{} is that the argument is % supposed to be verbatim text. \def\verbpdfref{% - \begingroup - \pgfmanual@verb@preparecatcodes@ - \def\pgfmanualprettyprinterhandlecollectedargs##1{% - \pgfmanualpdfref##1{\texttt{##1}}% mark: '##1' contains already braces. - \endgroup - }% - \pgfmanualprettyprintercollectargcount1{\relax}% + \begingroup + \pgfmanual@verb@preparecatcodes@ + \def\pgfmanualprettyprinterhandlecollectedargs##1{% + \pgfmanualpdfref##1{\texttt{##1}}% mark: '##1' contains already braces. + \endgroup + }% + \pgfmanualprettyprintercollectargcount1{\relax}% } % Prepare active vertical bars, |....| for auto-pretty cross % referencing. % -% Example: +% Example: % |\pgfkeys| -> will generate a hyperref! { - \catcode`\|=12 - \gdef\pgfmanual@verb@bar{|}% -% \gdef\pgfmanual@verb@collect#1|{% -% % this command will also handle control sequences. -% \texttt{\pgfmanualprettyprintpgfkeys{#1}}% -% \endgroup -% }% - \catcode`\|=13 - \gdef\pgfmanual@verb@activebar{|}% + \catcode`\|=12 + \gdef\pgfmanual@verb@bar{|}% +% \gdef\pgfmanual@verb@collect#1|{% +% % this command will also handle control sequences. +% \texttt{\pgfmanualprettyprintpgfkeys{#1}}% +% \endgroup +% }% + \catcode`\|=13 + \gdef\pgfmanual@verb@activebar{|}% } \def\pgfmanual@verb{% - \begingroup - \pgfmanual@verb@preparecatcodes@ - \toksdef\t@pgfmanual@verb=0 - \t@pgfmanual@verb={}% - \pgfmanual@verb@collect + \begingroup + \pgfmanual@verb@preparecatcodes@ + \toksdef\t@pgfmanual@verb=0 + \t@pgfmanual@verb={}% + \pgfmanual@verb@collect } % this version of \pgfmanual@verb@collect is less efficient than the % one uncommented above. BUT: it can auto-detect the case when % |...| has been provided somewhere where I can't change catcodes! % The other one would simply fail to compile. \def\pgfmanual@verb@collect#1{% - \def\pgfmanual@temp{#1}% - \ifx\pgfmanual@temp\pgfmanual@verb@bar - % ok, finish: - \edef\pgfmanual@verb@collect@next{% - % this command will also handle control sequences. - \noexpand\endgroup - \noexpand\texttt{\noexpand\pgfmanualprettyprintpgfkeys{\the\t@pgfmanual@verb}}% - }% - \else - \ifx\pgfmanual@temp\pgfmanual@verb@activebar - % ohoh... that should not happen! It means someone invoked - % |...| within an argument; I couldn't change catcodes. - % Ok, resort to a simple fallback solution. - % FIXME : I have just realized that THIS DOESN'T PRESERVE SPACES - \edef\pgfmanual@verb@collect@next{% - \noexpand\endgroup - \noexpand\texttt{\the\t@pgfmanual@verb}% - }% - \else - \t@pgfmanual@verb=\expandafter{\the\t@pgfmanual@verb #1}% - \let\pgfmanual@verb@collect@next=\pgfmanual@verb@collect - \fi - \fi - \pgfmanual@verb@collect@next + \def\pgfmanual@temp{#1}% + \ifx\pgfmanual@temp\pgfmanual@verb@bar + % ok, finish: + \edef\pgfmanual@verb@collect@next{% + % this command will also handle control sequences. + \noexpand\endgroup + \noexpand\texttt{\noexpand\pgfmanualprettyprintpgfkeys{\the\t@pgfmanual@verb}}% + }% + \else + \ifx\pgfmanual@temp\pgfmanual@verb@activebar + % ohoh... that should not happen! It means someone invoked + % |...| within an argument; I couln't change catcodes. + % Ok, resort to a simple fallback solution. + % FIXME : I have just realized that THIS DOESN'T PRESERVE SPACES + \edef\pgfmanual@verb@collect@next{% + \noexpand\endgroup + \noexpand\texttt{\the\t@pgfmanual@verb}% + }% + \else + \t@pgfmanual@verb=\expandafter{\the\t@pgfmanual@verb #1}% + \let\pgfmanual@verb@collect@next=\pgfmanual@verb@collect + \fi + \fi + \pgfmanual@verb@collect@next }% \AtBeginDocument{% - \ifpgfmanualprettyenabled - \catcode`\|=13 - \expandafter\let\pgfmanual@verb@activebar=\pgfmanual@verb - \fi + \ifpgfmanualprettyenabled + \catcode`\|=13 + \expandafter\let\pgfmanual@verb@activebar=\pgfmanual@verb + \fi }% \def\pgfmanual@verb@preparecatcodes@{% - \let\do\@makeother% - \dospecials% - \catcode`\%=12 % THATS IMPORTANT! Do *not* handle comments! - % these catcodes are expected by the pretty printer... - %\catcode`\^^M=13 - \catcode`\ =13 - \catcode`\^^I=13 - \expandafter\def\pgfmanual@pretty@activespace{\space}% - \expandafter\def\pgfmanual@pretty@activetab{\space\space\space\space}% + \let\do\@makeother% + \dospecials% + \catcode`\%=12 % THATS IMPORTANT! Do *not* handle comments! + % these catcodes are expected by the pretty printer... + %\catcode`\^^M=13 + \catcode`\ =13 + \catcode`\^^I=13 + \expandafter\def\pgfmanual@pretty@activespace{\space}% + \expandafter\def\pgfmanual@pretty@activetab{\space\space\space\space}% }% \endinput % vi: ts=4 sw=4 diff --git a/Master/texmf-dist/tex/latex/pgf/doc/pgfmanual.prettyprinter.code.tex b/Master/texmf-dist/tex/latex/pgf/doc/pgfmanual.prettyprinter.code.tex index e8aa334224c..f01db1e2cee 100644 --- a/Master/texmf-dist/tex/latex/pgf/doc/pgfmanual.prettyprinter.code.tex +++ b/Master/texmf-dist/tex/latex/pgf/doc/pgfmanual.prettyprinter.code.tex @@ -4,7 +4,7 @@ % % Provides a user-friendly interface to create function plots (normal % plots, semi-logplots and double-logplots). -% +% % It is based on Till Tantau's PGF package. % % Copyright 2007/2008/2009 by Christian Feuersänger. @@ -13,12 +13,12 @@ % it under the terms of the GNU General Public License as published by % the Free Software Foundation, either version 3 of the License, or % (at your option) any later version. -% +% % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. -% +% % You should have received a copy of the GNU General Public License % along with this program. If not, see <http://www.gnu.org/licenses/>. % @@ -31,7 +31,7 @@ % right place. % % ATTENTION: -% this is NOT a sophisticated syntax highlighter like lstlistings! +% this is NOT a sophisticated syntax highlighter like lstlistings! % It has rather strict assumptions about how to use it (the input must % have been read verbatim, for example). @@ -40,197 +40,197 @@ % % USER INTERFACE \pgfkeys{% - % this is the public hook into - % \begin{codeexample}...\end{codeexample} which triggers pretty - % printing: - /codeexample/typeset listing/.code= {\pgfmanualprettyprintcode{#1}}, - % - % this key will be invoked whenever a key in key-value context has been identified. - % - % It won't be invoked for handled keys like |my style/.style=....|, see below. - % - % #1 will be the keys name. - /codeexample/prettyprint/key name/.code={#1}, - % - % A variant which will be used instead of |key name| if the key - % has a key handler. For example, when the pretty printer finds - % |my style/.style|, it will call - % |key name with handler={my style}{.style}. - /codeexample/prettyprint/key name with handler/.code 2 args={#1/#2}, - % - % Will be invoked whenever the value of a key has been found. - % It will be invoked AFTER 'key name' and not at all if there was - % no value. - % - % #1: the key's name - % #2: the key's value. - % - % The default implementation checks if there is a special handler - % for the key name '#1', in - % /codeexample/prettyprint/key value/#1. - % For example: - % /codeexample/prettyprint/key value/my key/.code 2 args={name=#1, value =#2} - % If such a key exists, it will be invoked with {#1}{#2} as - % arguments. Otherwise, the generic method - % /codeexample/prettyprint/key value with style detection={#1}{#2} - % will be invoked. - /codeexample/prettyprint/key value/.code 2 args={% - \pgfkeysifdefined{/codeexample/prettyprint/key value/#1}{% - \pgfkeysalso{/codeexample/prettyprint/key value/#1={#1}{#2}}% - }{% - \pgfkeysalso{/codeexample/prettyprint/key value with style detection={#1}{#2}}% - }% - }, - % A helper macro for the default 'key value' implementation. - /codeexample/prettyprint/key value with style detection/.code 2 args={% - \pgfutil@in@{style}{#1}% - \ifpgfutil@in@ - \pgfmanualprettyprintpgfkeys{#2}% - \else - \pgfkeysalso{/codeexample/prettyprint/key value display only={#2}}% - \fi - },% - % - % Will be invoked by the default 'key value' implementation to - % typeset the value as such. - /codeexample/prettyprint/key value display only/.code={#1}, - % - % Used to typeset a single word. A word is something which has not - % been identified in any other context; a maximal sequence of - % non-white-space tokens. - /codeexample/prettyprint/word/.code={#1}, - % - % A two-argument code key which invokes '#1' if spaces shall - % delimit words and '#2' if not. - % This may be useless. Handle with care! - /codeexample/prettyprint/if space is word delim/.code 2 args={% - #1% - },% - % - % A three-argument code key which should invoke '#2' if the single - % token '#1' is a word delimiter and '#3' if that is not the case. - % Note that '#1' doesn't have the usual catcodes (see the - % \pgfmanual@pretty@** macros)! - % Furthermore, white spaces are treated separately. - /codeexample/prettyprint/if is word delim/.code args={#1#2#3}{% - \edef\pgfmanual@check{,;().;\pgfmanual@pretty@lbrace\pgfmanual@pretty@rbrace}% - \def\pgfmanual@check@{\pgfutil@in@{#1}}% - \expandafter\pgfmanual@check@\expandafter{\pgfmanual@check}% - \ifpgfutil@in@ #2\else #3\fi - },% - % - % Used to typeset a single control sequence. - % #1 is the control sequence's name as a sequence of catcode 12 - % tokens. - /codeexample/prettyprint/cs/.code={#1}, - % - % Used to typeset a single control sequence together with one or - % more arguments. - % - % #1 is the control sequence's name (including the backslash as - % literal string) and - % #2,#3,...,#9 are the arguments. The number of arguments depends - % on the 'cs arguments/<CS NAME>' key; it contains the integer - % number. - % - % For example, if - % |cs arguments/pgfkeys/.initial=1|, - % the pretty printer invokes - % |cs with args={\pgfkeys}{<argument>}. - % - % If - % |cs arguments/mycommand/.initial=2|, - % the pretty printer invokes - % |cs with args={\pgfkeys}{<argument1>}{<argument2>}. - % In this case, 'cs with args' needs to be defined in a way which - % allows to deal with 3 arguments. - % - % Please note that the value do not contain braces! The braces - % need to be inserted manually. - % - % Special cases: - % 1. If end-of-input is encountered BEFORE the expected number of - % arguments has been found, the following happens: - % - if not even one (partial) argument has been found, the - % /codeexample/prettyprint/cs/.@cmd key will be used instead. - % - the \ifpgfmanualprettyprinterarghasunmatchedbraces boolean - % indicates if the trailing brace is missing. - /codeexample/prettyprint/cs with args/.code 2 args={#1\{#2\pgfmanualclosebrace}, - % - % For every identified control sequence, the key - % /codeexample/prettyprint/cs arguments/<CSNAME> - % will be checked. If it exists, it contains an integer with the - % number of arguments it takes. - % The <CSNAME> must not contain the '\'. - /codeexample/prettyprint/cs arguments/pgfkeys/.initial=1, - % - % For every identified control sequence, the key - % /codeexample/prettyprint/cs/<CSNAME>/.@cmd - % will be checked. If it exists, it will be used instead of - % 'cs with args' (with the same special case restrictions for - % early end-of-input). - % - % The <CSNAME> must not contain the '\'. - % - % This allows special treatment for special - % commands like \pgfkeys: - /codeexample/prettyprint/cs/pgfkeys/.code 2 args={#1\{\pgfmanualprettyprintpgfkeys{#2}\pgfmanualclosebrace}, - % - % recognise environments: - /codeexample/prettyprint/cs arguments/begin/.initial=1, - /codeexample/prettyprint/cs/begin/.code 2 args={#1\{#2\pgfmanualclosebrace}, - /codeexample/prettyprint/cs arguments/end/.initial=1, - /codeexample/prettyprint/cs/end/.code 2 args={#1\{#2\pgfmanualclosebrace}, - % - % a point coordinate (#1) - % Note that '#1' will contain the braces (if there was one), - /codeexample/prettyprint/point/.code={#1},% - % - % a point coordinate with explicit coordinate system: (#1:#2) - % Note that '#2' will contain the terminating brace (if there was one) - % #1: the coordinate system name (*without* the leading brace). - % The leading brace must be re-inserted by this style. - /codeexample/prettyprint/point with cs/.code 2 args={(#1:#2},% - % - % The font / color command to use for comments. Will be set at + % this is the public hook into + % \begin{codeexample}...\end{codeexample} which triggers pretty + % printing: + /codeexample/typeset listing/.code= {\pgfmanualprettyprintcode{#1}}, + % + % this key will be invoked whenever a key in key-value context has been identified. + % + % It won't be invoked for handled keys like |my style/.style=....|, see below. + % + % #1 will be the keys name. + /codeexample/prettyprint/key name/.code={#1}, + % + % A variant which will be used instead of |key name| if the key + % has a key handler. For example, when the pretty printer finds + % |my style/.style|, it will call + % |key name with handler={my style}{.style}. + /codeexample/prettyprint/key name with handler/.code 2 args={#1/#2}, + % + % Will be invoked whenever the value of a key has been found. + % It will be invoked AFTER 'key name' and not at all if there was + % no value. + % + % #1: the key's name + % #2: the key's value. + % + % The default implementation checks if there is a special handler + % for the key name '#1', in + % /codeexample/prettyprint/key value/#1. + % For example: + % /codeexample/prettyprint/key value/my key/.code 2 args={name=#1, value =#2} + % If such a key exists, it will be invoked with {#1}{#2} as + % arguments. Otherwise, the generic method + % /codeexample/prettyprint/key value with style detection={#1}{#2} + % will be invoked. + /codeexample/prettyprint/key value/.code 2 args={% + \pgfkeysifdefined{/codeexample/prettyprint/key value/#1}{% + \pgfkeysalso{/codeexample/prettyprint/key value/#1={#1}{#2}}% + }{% + \pgfkeysalso{/codeexample/prettyprint/key value with style detection={#1}{#2}}% + }% + }, + % A helper macro for the default 'key value' implementation. + /codeexample/prettyprint/key value with style detection/.code 2 args={% + \pgfutil@in@{style}{#1}% + \ifpgfutil@in@ + \pgfmanualprettyprintpgfkeys{#2}% + \else + \pgfkeysalso{/codeexample/prettyprint/key value display only={#2}}% + \fi + },% + % + % Will be invoked by the default 'key value' implementation to + % typeset the value as such. + /codeexample/prettyprint/key value display only/.code={#1}, + % + % Used to typeset a single word. A word is something which has not + % been identified in any other context; a maximal sequence of + % non-white-space tokens. + /codeexample/prettyprint/word/.code={#1}, + % + % A two-argument code key which invokes '#1' if spaces shall + % delimit words and '#2' if not. + % This may be useless. Handle with care! + /codeexample/prettyprint/if space is word delim/.code 2 args={% + #1% + },% + % + % A three-argument code key which should invoke '#2' if the single + % token '#1' is a word delimiter and '#3' if that is not the case. + % Note that '#1' doesn't have the usual catcodes (see the + % \pgfmanual@pretty@** macros)! + % Furthermore, white spaces are treated separately. + /codeexample/prettyprint/if is word delim/.code args={#1#2#3}{% + \edef\pgfmanual@check{,;().;\pgfmanual@pretty@lbrace\pgfmanual@pretty@rbrace}% + \def\pgfmanual@check@{\pgfutil@in@{#1}}% + \expandafter\pgfmanual@check@\expandafter{\pgfmanual@check}% + \ifpgfutil@in@ #2\else #3\fi + },% + % + % Used to typeset a single control sequence. + % #1 is the control sequence's name as a sequence of catcode 12 + % tokens. + /codeexample/prettyprint/cs/.code={#1}, + % + % Used to typeset a single control sequence together with one or + % more arguments. + % + % #1 is the control sequence's name (including the backslash as + % literal string) and + % #2,#3,...,#9 are the arguments. The number of arguments depends + % on the 'cs arguments/<CS NAME>' key; it contains the integer + % number. + % + % For example, if + % |cs arguments/pgfkeys/.initial=1|, + % the pretty printer invokes + % |cs with args={\pgfkeys}{<argument>}. + % + % If + % |cs arguments/mycommand/.initial=2|, + % the pretty printer invokes + % |cs with args={\pgfkeys}{<argument1>}{<argument2>}. + % In this case, 'cs with args' needs to be defined in a way which + % allows to deal with 3 arguments. + % + % Please note that the value do not contain braces! The braces + % need to be inserted manually. + % + % Special cases: + % 1. If end-of-input is encountered BEFORE the expected number of + % arguments has been found, the following happens: + % - if not even one (partial) argument has been found, the + % /codeexample/prettyprint/cs/.@cmd key will be used instead. + % - the \ifpgfmanualprettyprinterarghasunmatchedbraces boolean + % indicates if the trailing brace is missing. + /codeexample/prettyprint/cs with args/.code 2 args={#1\{#2\pgfmanualclosebrace}, + % + % For every identified control sequence, the key + % /codeexample/prettyprint/cs arguments/<CSNAME> + % will be checked. If it exists, it contains an integer with the + % number of arguments it takes. + % The <CSNAME> must not contain the '\'. + /codeexample/prettyprint/cs arguments/pgfkeys/.initial=1, + % + % For every identified control sequence, the key + % /codeexample/prettyprint/cs/<CSNAME>/.@cmd + % will be checked. If it exists, it will be used instead of + % 'cs with args' (with the same special case restrictions for + % early end-of-input). + % + % The <CSNAME> must not contain the '\'. + % + % This allows special treatment for special + % commands like \pgfkeys: + /codeexample/prettyprint/cs/pgfkeys/.code 2 args={#1\{\pgfmanualprettyprintpgfkeys{#2}\pgfmanualclosebrace}, + % + % recognise environments: + /codeexample/prettyprint/cs arguments/begin/.initial=1, + /codeexample/prettyprint/cs/begin/.code 2 args={#1\{#2\pgfmanualclosebrace}, + /codeexample/prettyprint/cs arguments/end/.initial=1, + /codeexample/prettyprint/cs/end/.code 2 args={#1\{#2\pgfmanualclosebrace}, + % + % a point coordinate (#1) + % Note that '#1' will contain the braces (if there was one), + /codeexample/prettyprint/point/.code={#1},% + % + % a point coordinate with explicit coordinate system: (#1:#2) + % Note that '#2' will contain the terminating brace (if there was one) + % #1: the coordinate system name (*without* the leading brace). + % The leading brace must be re-inserted by this style. + /codeexample/prettyprint/point with cs/.code 2 args={(#1:#2},% + % + % The font / color command to use for comments. Will be set at % the beginning of a comment - /codeexample/prettyprint/comment font/.initial=,% - % the same with specialised code: - %/codeexample/prettyprint/point with cs/<CS NAME>/.code 2 args={(#1:#2},% - % - % - % A predefined style which colors every identified token. It's - % purpose is only debugging. - /codeexample/prettyprint/colored/.style={% - /codeexample/prettyprint/key name/.code={\textcolor{red!75!black}{##1}}, - /codeexample/prettyprint/key name with handler/.code 2 args={\textcolor{red!75!black}{##1}/\textcolor{red!90!black}{##2}}, - /codeexample/prettyprint/key value display only/.code={\textcolor{yellow}{##1}}, - /codeexample/prettyprint/cs/.code={\textcolor{green}{##1}}, - /codeexample/prettyprint/cs with args/.code 2 args={\textcolor{green}{##1}\{\textcolor{orange}{##2}\pgfmanualclosebrace}, - /codeexample/prettyprint/cs arguments/pgfkeys/.initial=1, - /codeexample/prettyprint/cs/pgfkeys/.code 2 args={\textcolor{green}{##1}\{\pgfmanualprettyprintpgfkeys{##2}\pgfmanualclosebrace}, - /codeexample/prettyprint/cs arguments/begin/.initial=1, - /codeexample/prettyprint/cs/begin/.code 2 args={\textcolor{green}{##1}\{\textcolor{orange}{##2}\pgfmanualclosebrace}, - /codeexample/prettyprint/cs arguments/end/.initial=1, - /codeexample/prettyprint/cs/end/.code 2 args={\textcolor{green}{##1}\{\textcolor{orange}{##2}\pgfmanualclosebrace}, - /codeexample/prettyprint/word/.code={\textcolor{brown}{##1}}, - /codeexample/prettyprint/point/.code={\textcolor{red}{##1}},% - /codeexample/prettyprint/point with cs/.code 2 args={(\textcolor{green}{##1}:\textcolor{red}{##2}},% - },% - % A further debugging helper. - /codeexample/prettyprint/colored and verbose/.style={% - /codeexample/prettyprint/colored, - /codeexample/prettyprint/key name/.code={\message{[key name=##1]}\textcolor{red!75!black}{##1}}, - /codeexample/prettyprint/key name with handler/.code 2 args={\message{[key name with handler=##1/##2]}\textcolor{red!75!black}{##1}/\textcolor{red!90!black}{##2}}, - /codeexample/prettyprint/key value display only/.code={\def\temp{##1}\message{[key value=\meaning\temp]}\textcolor{yellow}{##1}}, - /codeexample/prettyprint/cs/.code={\message{[cs=##1]}\textcolor{green}{##1}}, - /codeexample/prettyprint/cs with args/.code 2 args={\def\temp{##2}\message{[cs with args={##1}{\meaning\temp}]}\textcolor{green}{##1}\{\textcolor{orange}{##2}\pgfmanualclosebrace}, - /codeexample/prettyprint/word/.code={\message{[word=##1]}\textcolor{brown}{##1}}, - /codeexample/prettyprint/point/.code={\message{[point=##1]}\textcolor{red}{##1}},% - /codeexample/prettyprint/point with cs/.code 2 args={\message{[point with cs={##1}{##2}]}(\textcolor{green}{##1}:\textcolor{red}{##2}},% - },% - %/codeexample/prettyprint/colored, - %/codeexample/prettyprint/colored and verbose, + /codeexample/prettyprint/comment font/.initial=,% + % the same with specialised code: + %/codeexample/prettyprint/point with cs/<CS NAME>/.code 2 args={(#1:#2},% + % + % + % A predefined style which colors every identified token. It's + % purpose is only debugging. + /codeexample/prettyprint/colored/.style={% + /codeexample/prettyprint/key name/.code={\textcolor{red!75!black}{##1}}, + /codeexample/prettyprint/key name with handler/.code 2 args={\textcolor{red!75!black}{##1}/\textcolor{red!90!black}{##2}}, + /codeexample/prettyprint/key value display only/.code={\textcolor{yellow}{##1}}, + /codeexample/prettyprint/cs/.code={\textcolor{green}{##1}}, + /codeexample/prettyprint/cs with args/.code 2 args={\textcolor{green}{##1}\{\textcolor{orange}{##2}\pgfmanualclosebrace}, + /codeexample/prettyprint/cs arguments/pgfkeys/.initial=1, + /codeexample/prettyprint/cs/pgfkeys/.code 2 args={\textcolor{green}{##1}\{\pgfmanualprettyprintpgfkeys{##2}\pgfmanualclosebrace}, + /codeexample/prettyprint/cs arguments/begin/.initial=1, + /codeexample/prettyprint/cs/begin/.code 2 args={\textcolor{green}{##1}\{\textcolor{orange}{##2}\pgfmanualclosebrace}, + /codeexample/prettyprint/cs arguments/end/.initial=1, + /codeexample/prettyprint/cs/end/.code 2 args={\textcolor{green}{##1}\{\textcolor{orange}{##2}\pgfmanualclosebrace}, + /codeexample/prettyprint/word/.code={\textcolor{brown}{##1}}, + /codeexample/prettyprint/point/.code={\textcolor{red}{##1}},% + /codeexample/prettyprint/point with cs/.code 2 args={(\textcolor{green}{##1}:\textcolor{red}{##2}},% + },% + % A further debuggin helper. + /codeexample/prettyprint/colored and verbose/.style={% + /codeexample/prettyprint/colored, + /codeexample/prettyprint/key name/.code={\message{[key name=##1]}\textcolor{red!75!black}{##1}}, + /codeexample/prettyprint/key name with handler/.code 2 args={\message{[key name with handler=##1/##2]}\textcolor{red!75!black}{##1}/\textcolor{red!90!black}{##2}}, + /codeexample/prettyprint/key value display only/.code={\def\temp{##1}\message{[key value=\meaning\temp]}\textcolor{yellow}{##1}}, + /codeexample/prettyprint/cs/.code={\message{[cs=##1]}\textcolor{green}{##1}}, + /codeexample/prettyprint/cs with args/.code 2 args={\def\temp{##2}\message{[cs with args={##1}{\meaning\temp}]}\textcolor{green}{##1}\{\textcolor{orange}{##2}\pgfmanualclosebrace}, + /codeexample/prettyprint/word/.code={\message{[word=##1]}\textcolor{brown}{##1}}, + /codeexample/prettyprint/point/.code={\message{[point=##1]}\textcolor{red}{##1}},% + /codeexample/prettyprint/point with cs/.code 2 args={\message{[point with cs={##1}{##2}]}(\textcolor{green}{##1}:\textcolor{red}{##2}},% + },% + %/codeexample/prettyprint/colored, + %/codeexample/prettyprint/colored and verbose, }% \newif\ifpgfmanualprettyenabled @@ -240,10 +240,10 @@ % % It expands to '\}' unless the preceding argument had unmatched braces. \def\pgfmanualclosebrace{% - \ifpgfmanualprettyprinterarghasunmatchedbraces - \else - \}% - \fi + \ifpgfmanualprettyprinterarghasunmatchedbraces + \else + \}% + \fi }% @@ -256,24 +256,24 @@ % @see \pgfmanualprettyprintpgfkeys \long\def\pgfmanualprettyprintcode#1{% %\def\temp{#1}\message{STARTING PRETTY PRINTING for \meaning\temp}% - \ifpgfmanualprettyenabled - \begingroup - \pgfmanualprettyprintstyles - \pgfmanual@pretty@mainloop#1\pgfmanual@EOI - \endgroup - \else - #1% - \fi + \ifpgfmanualprettyenabled + \begingroup + \pgfmanualprettyprintstyles + \pgfmanual@pretty@mainloop#1\pgfmanual@EOI + \endgroup + \else + #1% + \fi }% % DISABLE: %\long\def\pgfmanualprettyprintcode#1{#1}% \def\pgfmanualprettyprintstyles{% %\tracingmacros=2 \tracingcommands=2 \message{PRETTYPRINT INIT}% - \def\{{\pgfmanual@pretty@lbrace}% - \def\}{\pgfmanual@pretty@rbrace}% - \pgfmanual@pretty@installcommenthandler - \let\pgfmanualprettyprintstyles=\relax + \def\{{\pgfmanual@pretty@lbrace}% + \def\}{\pgfmanual@pretty@rbrace}% + \pgfmanual@pretty@installcommenthandler + \let\pgfmanualprettyprintstyles=\relax }% @@ -286,61 +286,61 @@ % % FIXME % THIS INTRODUCES A NEW GROUP! Does that hurt the pretty printer?? -% +% \def\pgfmanual@pretty@installcommenthandler{% - \expandafter\def\pgfmanual@pretty@activepercent{% - \begingroup% - \pgfmanualprettycommentactivetrue - \expandafter\let\pgfmanual@pretty@activenl=\pgfmanual@pretty@recoveraftercomment - \expandafter\def\pgfmanual@pretty@activepercent{\%}% - \pgfkeysvalueof{/codeexample/prettyprint/comment font}%\tt - \%% - }% + \expandafter\def\pgfmanual@pretty@activepercent{% + \begingroup% + \pgfmanualprettycommentactivetrue + \expandafter\let\pgfmanual@pretty@activenl=\pgfmanual@pretty@recoveraftercomment + \expandafter\def\pgfmanual@pretty@activepercent{\%}% + \pgfkeysvalueof{/codeexample/prettyprint/comment font}%\tt + \%% + }% }% \def\pgfmanual@pretty@recoveraftercomment{% - \endgroup - \pgfmanual@pretty@activenl + \endgroup + \pgfmanual@pretty@activenl }% \def\pgfmanual@EOI{\pgfmanual@EOI}% { - \catcode`\[=0 - \catcode`\\=12 - [gdef[pgfmanual@pretty@backslash{\}% + \catcode`\[=0 + \catcode`\\=12 + [gdef[pgfmanual@pretty@backslash{\}% } \begingroup - \catcode`\:=12 - \catcode`\(=12 - \catcode`\)=12 - \gdef\pgfmanual@pretty@colon{:}% - \gdef\pgfmanual@pretty@lroundbrace{(}% - \gdef\pgfmanual@pretty@rroundbrace{)}% - \catcode`\[=1 - \catcode`\]=2 - \catcode`\{=12 - \catcode`\}=12 - \gdef\pgfmanual@pretty@lbrace[{]% - \gdef\pgfmanual@pretty@rbrace[}]% - \catcode`\{=1 - \catcode`\}=2 - \catcode`\[=12 - \catcode`\]=12 - \catcode`\,=12 - \catcode`\ =10\relax\gdef\pgfmanual@pretty@space{ }% - \gdef\pgfmanual@pretty@lbracket{[}% - \gdef\pgfmanual@pretty@rbracket{]}% - \gdef\pgfmanual@pretty@comma{,}% - \catcode`\==12 - \gdef\pgfmanual@pretty@eq{=}% + \catcode`\:=12 + \catcode`\(=12 + \catcode`\)=12 + \gdef\pgfmanual@pretty@colon{:}% + \gdef\pgfmanual@pretty@lroundbrace{(}% + \gdef\pgfmanual@pretty@rroundbrace{)}% + \catcode`\[=1 + \catcode`\]=2 + \catcode`\{=12 + \catcode`\}=12 + \gdef\pgfmanual@pretty@lbrace[{]% + \gdef\pgfmanual@pretty@rbrace[}]% + \catcode`\{=1 + \catcode`\}=2 + \catcode`\[=12 + \catcode`\]=12 + \catcode`\,=12 + \catcode`\ =10\relax\gdef\pgfmanual@pretty@space{ }% + \gdef\pgfmanual@pretty@lbracket{[}% + \gdef\pgfmanual@pretty@rbracket{]}% + \gdef\pgfmanual@pretty@comma{,}% + \catcode`\==12 + \gdef\pgfmanual@pretty@eq{=}% \endgroup \begingroup - \catcode`\%=12 - \gdef\pgfmanual@pretty@percent{%} - \catcode`\%=13 - \gdef\pgfmanual@pretty@activepercent{%} - \catcode`\^^M=13 - \gdef\pgfmanual@pretty@activenl{^^M}\endgroup + \catcode`\%=12 + \gdef\pgfmanual@pretty@percent{%} + \catcode`\%=13 + \gdef\pgfmanual@pretty@activepercent{%} + \catcode`\^^M=13 + \gdef\pgfmanual@pretty@activenl{^^M}\endgroup \begingroup \catcode`\^^I=13\relax\gdef\pgfmanual@pretty@activetab{^^I}% \catcode`\ =13\relax\gdef\pgfmanual@pretty@activespace{ }\endgroup @@ -348,120 +348,120 @@ % loops through all tokens. % #1 is a single token. \def\pgfmanual@pretty@mainloop{% - \def\pgfmanual@pretty@mainloop@currentword{}% - \pgfmanual@pretty@mainloop@ + \def\pgfmanual@pretty@mainloop@currentword{}% + \pgfmanual@pretty@mainloop@ }% \long\def\pgfmanual@pretty@mainloop@#1{% - \def\pgfmanual@loc@TMPa{#1}% - \let\pgfmanual@pretty@mainloop@NEXT=\pgfmanual@pretty@mainloop@ - \ifx\pgfmanual@loc@TMPa\pgfmanual@EOI - % stop iteration. - \pgfmanual@pretty@mainloop@finishword - \let\pgfmanual@pretty@mainloop@NEXT=\relax - \else - \ifpgfmanualprettycommentactive - #1\kern0pt% - \else - \ifx\pgfmanual@loc@TMPa\pgfmanual@pretty@lbracket% - % we found the start of OPTIONS '[ ... ]'. - \pgfmanual@pretty@mainloop@finishword - % Attempt syntax highlighting for pgfkeys: - \let\pgfmanual@pretty@mainloop@NEXT=\pgfmanual@pretty@pgfkeys - \else - \ifx\pgfmanual@loc@TMPa\pgfmanual@pretty@backslash - % we found the start of a control sequence '\command' - \pgfmanual@pretty@mainloop@finishword - % - % collect the control sequence name into - % \pgfmanual@loc@TMPa, but without the backslash: - \let\pgfmanual@loc@TMPa=\pgfutil@empty - \let\pgfmanual@pretty@mainloop@NEXT=\pgfmanual@pretty@collectcs@loop - \else - \ifx\pgfmanual@loc@TMPa\pgfmanual@pretty@lroundbrace% - \pgfmanual@pretty@mainloop@finishword - \let\pgfmanual@pretty@mainloop@NEXT=\pgfmanual@pretty@collectpoint - \else - \def\pgfmanual@isspace{0}% - \ifnum13=\catcode`#1 - % we found a white space (space, TAB or NL) or comment - \def\pgfmanual@isspace{1}% - \else - \ifnum10=\catcode`#1 - \def\pgfmanual@isspace{1}% - \fi - \fi - \if\pgfmanual@isspace1% - \pgfkeysvalueof{/codeexample/prettyprint/if space is word delim/.@cmd}{% - \pgfmanual@pretty@mainloop@finishword - #1% ok, show it. - }{% - % collect the word. - \expandafter\def\expandafter\pgfmanual@pretty@mainloop@currentword\expandafter{\pgfmanual@pretty@mainloop@currentword #1}% - }% - \else - \pgfkeysvalueof{/codeexample/prettyprint/if is word delim/.@cmd}{#1}{% - \pgfmanual@pretty@mainloop@finishword - #1% ok, show the delimiter. - }{% - % collect the word. - \expandafter\def\expandafter\pgfmanual@pretty@mainloop@currentword\expandafter{\pgfmanual@pretty@mainloop@currentword #1}% - }\pgfeov% - \fi - \fi - \fi - \fi - \fi - \fi - \pgfmanual@pretty@mainloop@NEXT + \def\pgfmanual@loc@TMPa{#1}% + \let\pgfmanual@pretty@mainloop@NEXT=\pgfmanual@pretty@mainloop@ + \ifx\pgfmanual@loc@TMPa\pgfmanual@EOI + % stop iteration. + \pgfmanual@pretty@mainloop@finishword + \let\pgfmanual@pretty@mainloop@NEXT=\relax + \else + \ifpgfmanualprettycommentactive + #1\kern0pt% + \else + \ifx\pgfmanual@loc@TMPa\pgfmanual@pretty@lbracket% + % we found the start of OPTIONS '[ ... ]'. + \pgfmanual@pretty@mainloop@finishword + % Attempt syntax highlighting for pgfkeys: + \let\pgfmanual@pretty@mainloop@NEXT=\pgfmanual@pretty@pgfkeys + \else + \ifx\pgfmanual@loc@TMPa\pgfmanual@pretty@backslash + % we found the start of a control sequence '\command' + \pgfmanual@pretty@mainloop@finishword + % + % collect the control sequence name into + % \pgfmanual@loc@TMPa, but without the backslash: + \let\pgfmanual@loc@TMPa=\pgfutil@empty + \let\pgfmanual@pretty@mainloop@NEXT=\pgfmanual@pretty@collectcs@loop + \else + \ifx\pgfmanual@loc@TMPa\pgfmanual@pretty@lroundbrace% + \pgfmanual@pretty@mainloop@finishword + \let\pgfmanual@pretty@mainloop@NEXT=\pgfmanual@pretty@collectpoint + \else + \def\pgfmanual@isspace{0}% + \ifnum13=\catcode`#1 + % we found a white space (space, TAB or NL) or comment + \def\pgfmanual@isspace{1}% + \else + \ifnum10=\catcode`#1 + \def\pgfmanual@isspace{1}% + \fi + \fi + \if\pgfmanual@isspace1% + \pgfkeysvalueof{/codeexample/prettyprint/if space is word delim/.@cmd}{% + \pgfmanual@pretty@mainloop@finishword + #1% ok, show it. + }{% + % collect the word. + \expandafter\def\expandafter\pgfmanual@pretty@mainloop@currentword\expandafter{\pgfmanual@pretty@mainloop@currentword #1}% + }% + \else + \pgfkeysvalueof{/codeexample/prettyprint/if is word delim/.@cmd}{#1}{% + \pgfmanual@pretty@mainloop@finishword + #1% ok, show the delimiter. + }{% + % collect the word. + \expandafter\def\expandafter\pgfmanual@pretty@mainloop@currentword\expandafter{\pgfmanual@pretty@mainloop@currentword #1}% + }\pgfeov% + \fi + \fi + \fi + \fi + \fi + \fi + \pgfmanual@pretty@mainloop@NEXT }% \def\pgfmanual@pretty@mainloop@finishword{% - \ifx\pgfmanual@pretty@mainloop@currentword\pgfutil@empty - \else - \def\pgfmanual@loc@TMPa{\pgfkeysvalueof{/codeexample/prettyprint/word/.@cmd}}% - \expandafter\pgfmanual@loc@TMPa\pgfmanual@pretty@mainloop@currentword\pgfeov - \let\pgfmanual@pretty@mainloop@currentword=\pgfutil@empty - \fi + \ifx\pgfmanual@pretty@mainloop@currentword\pgfutil@empty + \else + \def\pgfmanual@loc@TMPa{\pgfkeysvalueof{/codeexample/prettyprint/word/.@cmd}}% + \expandafter\pgfmanual@loc@TMPa\pgfmanual@pretty@mainloop@currentword\pgfeov + \let\pgfmanual@pretty@mainloop@currentword=\pgfutil@empty + \fi }% \def\pgfmanual@pretty@collectpoint{% - \let\pgfmanualprettyprinterhandlecollectedargsVtwo=\pgfmanual@pretty@collectargs@finish@collectpoint - \expandafter\pgfmanualprettyprintercollectupto\pgfmanual@pretty@rroundbrace - {\afterpgfmanual@pretty@collectpoint}% + \let\pgfmanualprettyprinterhandlecollectedargsVtwo=\pgfmanual@pretty@collectargs@finish@collectpoint + \expandafter\pgfmanualprettyprintercollectupto\pgfmanual@pretty@rroundbrace + {\afterpgfmanual@pretty@collectpoint}% } { \catcode`\:=12 \gdef\pgfmanual@pretty@collectargs@finish@collectpoint#1#2{% - \expandafter\pgfutil@in@\pgfmanual@pretty@colon{#1}% - \ifpgfutil@in@ - \def\pgfmanual@pretty@collectpoint@getcoordsystem##1:##2\relax{% - \begingroup - \pgfmanual@pretty@restorespaces - % remove active spaces from ##1: - \xdef\pgfmanual@pretty@glob@TMPa{##1}% - \endgroup - \pgfkeysifdefined{/codeexample/prettyprint/point with cs/\pgfmanual@pretty@glob@TMPa/.@cmd}{% - \def\pgfmanual@loc@TMPb{\pgfkeysvalueof{/codeexample/prettyprint/point with cs/\pgfmanual@pretty@glob@TMPa/.@cmd}}% - }{% - \def\pgfmanual@loc@TMPb{\pgfkeysvalueof{/codeexample/prettyprint/point with cs/.@cmd}}% - }% - \expandafter\def\expandafter\pgfmanual@loc@TMPa\expandafter{\expandafter{\pgfmanual@pretty@glob@TMPa}{##2}}% - \expandafter\pgfmanual@loc@TMPb\pgfmanual@loc@TMPa\pgfeov - }% - \if1#2% - \pgfmanual@pretty@collectpoint@getcoordsystem#1)\relax - \else - \pgfmanual@pretty@collectpoint@getcoordsystem#1\relax - \fi - \else - \def\pgfmanual@loc@TMPb{\pgfkeysvalueof{/codeexample/prettyprint/point/.@cmd}}% - \if1#2% - \pgfmanual@loc@TMPb(#1)\pgfeov - \else - \pgfmanual@loc@TMPb(#1\pgfeov - \fi - \fi + \expandafter\pgfutil@in@\pgfmanual@pretty@colon{#1}% + \ifpgfutil@in@ + \def\pgfmanual@pretty@collectpoint@getcoordsystem##1:##2\relax{% + \begingroup + \pgfmanual@pretty@restorespaces + % remove active spaces from ##1: + \xdef\pgfmanual@pretty@glob@TMPa{##1}% + \endgroup + \pgfkeysifdefined{/codeexample/prettyprint/point with cs/\pgfmanual@pretty@glob@TMPa/.@cmd}{% + \def\pgfmanual@loc@TMPb{\pgfkeysvalueof{/codeexample/prettyprint/point with cs/\pgfmanual@pretty@glob@TMPa/.@cmd}}% + }{% + \def\pgfmanual@loc@TMPb{\pgfkeysvalueof{/codeexample/prettyprint/point with cs/.@cmd}}% + }% + \expandafter\def\expandafter\pgfmanual@loc@TMPa\expandafter{\expandafter{\pgfmanual@pretty@glob@TMPa}{##2}}% + \expandafter\pgfmanual@loc@TMPb\pgfmanual@loc@TMPa\pgfeov + }% + \if1#2% + \pgfmanual@pretty@collectpoint@getcoordsystem#1)\relax + \else + \pgfmanual@pretty@collectpoint@getcoordsystem#1\relax + \fi + \else + \def\pgfmanual@loc@TMPb{\pgfkeysvalueof{/codeexample/prettyprint/point/.@cmd}}% + \if1#2% + \pgfmanual@loc@TMPb(#1)\pgfeov + \else + \pgfmanual@loc@TMPb(#1\pgfeov + \fi + \fi }% } \def\afterpgfmanual@pretty@collectpoint{\pgfmanual@pretty@mainloop}% @@ -469,52 +469,52 @@ % loops through all tokens, assembling the cs name as it goes. % #1 is a single token. \def\pgfmanual@pretty@collectcs@loop#1{% - \let\pgfmanual@pretty@collectcs@loop@NEXT=\pgfmanual@pretty@collectcs@loop - \def\pgfmanual@loc@TMPb{#1}% - \ifx\pgfmanual@loc@TMPb\pgfmanual@EOI - \def\pgfmanual@pretty@collectcs@loop@NEXT{\pgfmanual@pretty@collectcs@loop@END #1}% - \else - % a csname may only use letters. And: only letters have a - % positive lcccode! - \ifnum\lccode`#1=0 - \ifx\pgfmanual@loc@TMPb\pgfmanual@attext% - % ok, we may also accept an `@': - \edef\pgfmanual@loc@TMPa{\pgfmanual@loc@TMPa #1}% - \else - % This here is the first non-letter. - \def\pgfmanual@pretty@collectcs@loop@NEXT{\pgfmanual@pretty@collectcs@loop@END #1}% - \fi - \else - % continue iterating and assemble the csname... - \edef\pgfmanual@loc@TMPa{\pgfmanual@loc@TMPa #1}% - \fi - \fi - \pgfmanual@pretty@collectcs@loop@NEXT + \let\pgfmanual@pretty@collectcs@loop@NEXT=\pgfmanual@pretty@collectcs@loop + \def\pgfmanual@loc@TMPb{#1}% + \ifx\pgfmanual@loc@TMPb\pgfmanual@EOI + \def\pgfmanual@pretty@collectcs@loop@NEXT{\pgfmanual@pretty@collectcs@loop@END #1}% + \else + % a csname may only use letters. And: only letters have a + % positive lcccode! + \ifnum\lccode`#1=0 + \ifx\pgfmanual@loc@TMPb\pgfmanual@attext% + % ok, we may also accept an `@': + \edef\pgfmanual@loc@TMPa{\pgfmanual@loc@TMPa #1}% + \else + % This here is the first non-letter. + \def\pgfmanual@pretty@collectcs@loop@NEXT{\pgfmanual@pretty@collectcs@loop@END #1}% + \fi + \else + % continue iterating and assemble the csname... + \edef\pgfmanual@loc@TMPa{\pgfmanual@loc@TMPa #1}% + \fi + \fi + \pgfmanual@pretty@collectcs@loop@NEXT }% \def\afterpgfmanual@pretty@cs{\pgfmanual@pretty@mainloop}% \def\pgfmanual@attext{@} \def\pgfmanual@pretty@collectcs@loop@END{% - \pgfkeysifdefined{/codeexample/prettyprint/cs arguments/\pgfmanual@loc@TMPa}{% - % oh. The collected control sequence expects arguments. That - % means a lot of work since there are no nestable braces in - % the token list! All of them have catcode 12... we need to do - % that manually. - \let\pgfmanualprettyprinterhandlecollectedargs=\pgfmanual@pretty@collectargs@finish@cs - \def\pgfmanual@pretty@collectcs@loop@END@next{% - \pgfmanualprettyprintercollectargcount - {\pgfkeysvalueof{/codeexample/prettyprint/cs arguments/\pgfmanual@loc@TMPa}}% - {\afterpgfmanual@pretty@cs}% - }% - }{% - % re-insert the backslash: - \edef\pgfmanual@loc@TMPa{\pgfmanual@pretty@backslash \pgfmanual@loc@TMPa}% - % ok, report the macro and continue with the main loop. - \def\pgfmanual@loc@TMPb{\pgfkeysvalueof{/codeexample/prettyprint/cs/.@cmd}}% - \expandafter\pgfmanual@loc@TMPb\pgfmanual@loc@TMPa\pgfeov - \let\pgfmanual@pretty@collectcs@loop@END@next=\afterpgfmanual@pretty@cs - }% - \pgfmanual@pretty@collectcs@loop@END@next + \pgfkeysifdefined{/codeexample/prettyprint/cs arguments/\pgfmanual@loc@TMPa}{% + % oh. The collected control sequence expects arguments. That + % means a lot of work since there are no nestable braces in + % the token list! All of them have catcode 12... we need to do + % that manually. + \let\pgfmanualprettyprinterhandlecollectedargs=\pgfmanual@pretty@collectargs@finish@cs + \def\pgfmanual@pretty@collectcs@loop@END@next{% + \pgfmanualprettyprintercollectargcount + {\pgfkeysvalueof{/codeexample/prettyprint/cs arguments/\pgfmanual@loc@TMPa}}% + {\afterpgfmanual@pretty@cs}% + }% + }{% + % re-insert the backslash: + \edef\pgfmanual@loc@TMPa{\pgfmanual@pretty@backslash \pgfmanual@loc@TMPa}% + % ok, report the macro and continue with the main loop. + \def\pgfmanual@loc@TMPb{\pgfkeysvalueof{/codeexample/prettyprint/cs/.@cmd}}% + \expandafter\pgfmanual@loc@TMPb\pgfmanual@loc@TMPa\pgfeov + \let\pgfmanual@pretty@collectcs@loop@END@next=\afterpgfmanual@pretty@cs + }% + \pgfmanual@pretty@collectcs@loop@END@next }% \newif\ifpgfmanualprettyprinterarghasunmatchedbraces @@ -528,47 +528,47 @@ % below). % % PRECONDITION: -% there is a large token list following -% \pgfmanualprettyprintercollectargcount with balanced braces. The braces -% have \catcode 12. +% there is a large token list following +% \pgfmanualprettyprintercollectargcount with balanced braces. The braces +% have \catcode 12. % POSTCONDITION: -% 1. the arguments will be collected as -% '<result> := {<first arg>}{<second arg>}', -% 2.1 the macro \pgfmanualprettyprinternumcollectedargs will contain -% the *actual* number of *completely* collected arguments, -% 2.2 the if \ifpgfmanualprettyprinterarghasunmatchedbraces will be -% set to \c true if the last found argument had an unmatched brace, -% 3. then, \pgfmanualprettyprinterhandlecollectedargs{<result>} will be -% invoked. Just define \pgfmanualprettyprinterhandlecollectedargs -% properly. -% Afterwards, #2 will be invoked to recover from the argument -% collection. -% +% 1. the arguments will be collected as +% '<result> := {<first arg>}{<second arg>}', +% 2.1 the macro \pgfmanualprettyprinternumcollectedargs will contain +% the *actual* number of *completely* collected arguments, +% 2.2 the if \ifpgfmanualprettyprinterarghasunmatchedbraces will be +% set to \c true if the last found argument had an unmatched brace, +% 3. then, \pgfmanualprettyprinterhandlecollectedargs{<result>} will be +% invoked. Just define \pgfmanualprettyprinterhandlecollectedargs +% properly. +% Afterwards, #2 will be invoked to recover from the argument +% collection. +% % % Example: -% \pgfmanualprettyprintercollectargcount{2}{\donnextstep} -% {_12 first argument }_12 {_12 second argument }_12 next tokens% -% -% will result in the expansion -% \pgfmanualprettyprinterhandlecollectedargs{{_1 first argument }_2 {_1 second argument }_2 } -% \donnextstep -% next tokens +% \pgfmanualprettyprintercollectargcount{2}{\donnextstep} +% {_12 first argument }_12 {_12 second argument }_12 next tokens% % +% will result in the expansion +% \pgfmanualprettyprinterhandlecollectedargs{{_1 first argument }_2 {_1 second argument }_2 } +% \donnextstep +% next tokens +% % % % ATTENTION: -% \pgfmanualprettyprinterhandlecollectedargs will be invoked with a SINGLE -% argument. The argument as such will contain extra braces, one pair -% of braces for each of the #1 arguments. These braces will have -% catcode 1 and 2, i.e. they can *really* be used in TeX. Thus, the -% finish routine will be invoked with -% \pgfmanualprettyprinterhandlecollectedargs{{<arg>}} -% for one argument and with -% \pgfmanualprettyprinterhandlecollectedargs{{<first arg>}{<second arg>}} +% \pgfmanualprettyprinterhandlecollectedargs will be invoked with a SINGLE +% argument. The argument as such will contain extra braces, one pair +% of braces for each of the #1 arguments. These braces will have +% catcode 1 and 2, i.e. they can *really* be used in TeX. Thus, the +% finish routine will be invoked with +% \pgfmanualprettyprinterhandlecollectedargs{{<arg>}} +% for one argument and with +% \pgfmanualprettyprinterhandlecollectedargs{{<first arg>}{<second arg>}} % for two and more arguments. Note the extra set of braces for one % arg. % It might happen that not all arguments have been found if -% end-of-input occurred before. The +% end-of-input occured before. The % \pgfmanualprettyprinterhandlecollectedargs routine has to check % this using the macro \pgfmanualprettyprinternumcollectedargs which % contains the actual number of collected args. @@ -583,268 +583,268 @@ % this case. You can also use \pgfutil@ifnextchar\pgfmanual@EOI{}{} in % following routines to check for \pgfmanual@EOI. \def\pgfmanualprettyprintercollectargcount#1#2{% - \pgfmanualprettyprinterarghasunmatchedbracesfalse - \begingroup - \edef\pgfmanual@loc@csargcount{#1}% - \toksdef\t@afterpgfmanualprettyprinterhandlecollected=10 - \t@afterpgfmanualprettyprinterhandlecollected={#2}% - \let\c@pgfmanual@pretty@openbracecount=\c@pgf@counta - \let\c@pgfmanual@pretty@curargcount=\c@pgf@countb - % I will track open braces and the number of completely - % collected arguments here: - \c@pgfmanual@pretty@openbracecount=0 - \c@pgfmanual@pretty@curargcount=0 - % - % and I will accumulate the argument token lists as such here: - \toksdef\t@pgfmanual@currentarg=0 - \toksdef\t@pgfmanual@allargs=1 - \t@pgfmanual@currentarg={}% - \t@pgfmanual@allargs={}% - % - \pgfmanual@pretty@collectargs@loop + \pgfmanualprettyprinterarghasunmatchedbracesfalse + \begingroup + \edef\pgfmanual@loc@csargcount{#1}% + \toksdef\t@afterpgfmanualprettyprinterhandlecollected=10 + \t@afterpgfmanualprettyprinterhandlecollected={#2}% + \let\c@pgfmanual@pretty@openbracecount=\c@pgf@counta + \let\c@pgfmanual@pretty@curargcount=\c@pgf@countb + % I will track open braces and the number of completely + % collected arguments here: + \c@pgfmanual@pretty@openbracecount=0 + \c@pgfmanual@pretty@curargcount=0 + % + % and I will accumulate the argument token lists as such here: + \toksdef\t@pgfmanual@currentarg=0 + \toksdef\t@pgfmanual@allargs=1 + \t@pgfmanual@currentarg={}% + \t@pgfmanual@allargs={}% + % + \pgfmanual@pretty@collectargs@loop }% % loops through all tokens, collecting the required number of % arguments. This involves to track nested braces manually. % #1 is a single token. \def\pgfmanual@pretty@collectargs@loop#1{% - \let\pgfmanual@pretty@collectargs@loop@NEXT=\pgfmanual@pretty@collectargs@loop - \def\pgfmanual@loc@TMPc{#1}% - \ifx\pgfmanual@loc@TMPc\pgfmanual@EOI - \ifnum\c@pgfmanual@pretty@openbracecount>0 - \ifpgfmanualpdfwarnings - \pgfplots@warning{The pretty printer did not found the closing curly brace!? This will potentially lead to display errors}% - \fi - \fi - \edef\pgfmanual@pretty@collectargs@loop@NEXT{% - \noexpand\endgroup - \ifnum\c@pgfmanual@pretty@openbracecount>0 - \noexpand\pgfmanualprettyprinterarghasunmatchedbracestrue - \fi - \noexpand\def\noexpand\pgfmanualprettyprinternumcollectedargs{\the\c@pgfmanual@pretty@curargcount}% - \noexpand\pgfmanualprettyprinterhandlecollectedargs{\the\t@pgfmanual@allargs\the\t@pgfmanual@currentarg}% - \the\t@afterpgfmanualprettyprinterhandlecollected - \noexpand\pgfmanual@EOI% <- put this token back into token list! - }% - \else - \ifpgfmanualprettycommentactive - \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}% - \ifx\pgfmanual@loc@TMPc\pgfmanual@pretty@activenl - \pgfmanualprettycommentactivefalse - \fi - \else - \ifx\pgfmanual@loc@TMPc\pgfmanual@pretty@activepercent - \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}% - \pgfmanualprettycommentactivetrue - \else - \ifx\pgfmanual@loc@TMPc\pgfmanual@pretty@lbrace - \advance\c@pgfmanual@pretty@openbracecount by1 - \ifnum\c@pgfmanual@pretty@openbracecount>1 - \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}% - \fi - \else - \ifx\pgfmanual@loc@TMPc\pgfmanual@pretty@rbrace - \advance\c@pgfmanual@pretty@openbracecount by-1 - \ifnum\c@pgfmanual@pretty@openbracecount=0 - % we have one complete argument ready! - % append it -- with REAL braces if needed: - \edef\pgfmanual@loc@TMPc{\the\t@pgfmanual@allargs{\the\t@pgfmanual@currentarg}}% - \t@pgfmanual@allargs=\expandafter{\pgfmanual@loc@TMPc}% - \t@pgfmanual@currentarg={}% - % - % check it we need more arguments: - \advance\c@pgfmanual@pretty@curargcount by1 - \ifnum\c@pgfmanual@pretty@curargcount=\pgfmanual@loc@csargcount\relax - \edef\pgfmanual@pretty@collectargs@loop@NEXT{% - \noexpand\endgroup - \noexpand\def\noexpand\pgfmanualprettyprinternumcollectedargs{\the\c@pgfmanual@pretty@curargcount}% - \noexpand\pgfmanualprettyprinterhandlecollectedargs{\the\t@pgfmanual@allargs}% - \the\t@afterpgfmanualprettyprinterhandlecollected - }% - \fi - \else - \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}% - \fi - \else - \ifnum13=\catcode`#1 - % we found a white space (space, TAB or NL) or comment - \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}% - \else - \ifnum10=\catcode`#1 - % we found a white space (space, TAB - % or NL) with unexpected catcode - \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}% - \else - \ifnum\c@pgfmanual@pretty@openbracecount=0 - \ifpgfmanualpdfwarnings - \begingroup - \toks4{#1}% - \pgfplots@warning{The pretty printer did not find the expected \pgfmanual@loc@csargcount\space arguments (only token \the\toks4 )}% - \endgroup - \fi - \edef\pgfmanual@pretty@collectargs@loop@NEXT{% - \noexpand\endgroup - \noexpand\def\noexpand\pgfmanualprettyprinternumcollectedargs{\the\c@pgfmanual@pretty@curargcount}% - \noexpand\pgfmanualprettyprinterhandlecollectedargs{\the\t@pgfmanual@allargs\the\t@pgfmanual@currentarg}% - \the\t@afterpgfmanualprettyprinterhandlecollected - \noexpand#1% <- put this token back into token list! - }% - \else - \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}% - \fi - \fi - \fi - \fi - \fi - \fi - \fi - \fi - \pgfmanual@pretty@collectargs@loop@NEXT + \let\pgfmanual@pretty@collectargs@loop@NEXT=\pgfmanual@pretty@collectargs@loop + \def\pgfmanual@loc@TMPc{#1}% + \ifx\pgfmanual@loc@TMPc\pgfmanual@EOI + \ifnum\c@pgfmanual@pretty@openbracecount>0 + \ifpgfmanualpdfwarnings + \pgfplots@warning{The pretty printer did not found the closing curly brace!? This will potentially lead to display errors}% + \fi + \fi + \edef\pgfmanual@pretty@collectargs@loop@NEXT{% + \noexpand\endgroup + \ifnum\c@pgfmanual@pretty@openbracecount>0 + \noexpand\pgfmanualprettyprinterarghasunmatchedbracestrue + \fi + \noexpand\def\noexpand\pgfmanualprettyprinternumcollectedargs{\the\c@pgfmanual@pretty@curargcount}% + \noexpand\pgfmanualprettyprinterhandlecollectedargs{\the\t@pgfmanual@allargs\the\t@pgfmanual@currentarg}% + \the\t@afterpgfmanualprettyprinterhandlecollected + \noexpand\pgfmanual@EOI% <- put this token back into token list! + }% + \else + \ifpgfmanualprettycommentactive + \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}% + \ifx\pgfmanual@loc@TMPc\pgfmanual@pretty@activenl + \pgfmanualprettycommentactivefalse + \fi + \else + \ifx\pgfmanual@loc@TMPc\pgfmanual@pretty@activepercent + \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}% + \pgfmanualprettycommentactivetrue + \else + \ifx\pgfmanual@loc@TMPc\pgfmanual@pretty@lbrace + \advance\c@pgfmanual@pretty@openbracecount by1 + \ifnum\c@pgfmanual@pretty@openbracecount>1 + \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}% + \fi + \else + \ifx\pgfmanual@loc@TMPc\pgfmanual@pretty@rbrace + \advance\c@pgfmanual@pretty@openbracecount by-1 + \ifnum\c@pgfmanual@pretty@openbracecount=0 + % we have one complete argument ready! + % append it -- with REAL braces if needed: + \edef\pgfmanual@loc@TMPc{\the\t@pgfmanual@allargs{\the\t@pgfmanual@currentarg}}% + \t@pgfmanual@allargs=\expandafter{\pgfmanual@loc@TMPc}% + \t@pgfmanual@currentarg={}% + % + % check it we need more arguments: + \advance\c@pgfmanual@pretty@curargcount by1 + \ifnum\c@pgfmanual@pretty@curargcount=\pgfmanual@loc@csargcount\relax + \edef\pgfmanual@pretty@collectargs@loop@NEXT{% + \noexpand\endgroup + \noexpand\def\noexpand\pgfmanualprettyprinternumcollectedargs{\the\c@pgfmanual@pretty@curargcount}% + \noexpand\pgfmanualprettyprinterhandlecollectedargs{\the\t@pgfmanual@allargs}% + \the\t@afterpgfmanualprettyprinterhandlecollected + }% + \fi + \else + \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}% + \fi + \else + \ifnum13=\catcode`#1 + % we found a white space (space, TAB or NL) or comment + \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}% + \else + \ifnum10=\catcode`#1 + % we found a white space (space, TAB + % or NL) with unexpected catcode + \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}% + \else + \ifnum\c@pgfmanual@pretty@openbracecount=0 + \ifpgfmanualpdfwarnings + \begingroup + \toks4{#1}% + \pgfplots@warning{The pretty printer did not find the expected \pgfmanual@loc@csargcount\space arguments (only token \the\toks4 )}% + \endgroup + \fi + \edef\pgfmanual@pretty@collectargs@loop@NEXT{% + \noexpand\endgroup + \noexpand\def\noexpand\pgfmanualprettyprinternumcollectedargs{\the\c@pgfmanual@pretty@curargcount}% + \noexpand\pgfmanualprettyprinterhandlecollectedargs{\the\t@pgfmanual@allargs\the\t@pgfmanual@currentarg}% + \the\t@afterpgfmanualprettyprinterhandlecollected + \noexpand#1% <- put this token back into token list! + }% + \else + \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}% + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \pgfmanual@pretty@collectargs@loop@NEXT }% \newif\ifpgfmanualprettyprinterfoundterminator \def\pgfmanualprettyprinterhandlecollectedargsVtwo@default#1#2{% - \if1#2% - \pgfmanualprettyprinterfoundterminatortrue - \else - \pgfmanualprettyprinterfoundterminatorfalse - \fi - \pgfmanualprettyprinterhandlecollectedargs{#1}% + \if1#2% + \pgfmanualprettyprinterfoundterminatortrue + \else + \pgfmanualprettyprinterfoundterminatorfalse + \fi + \pgfmanualprettyprinterhandlecollectedargs{#1}% }% \def\pgfmanualprettyprintercollectupto@restore@callback{% - \let\pgfmanualprettyprinterhandlecollectedargsVtwo=\pgfmanualprettyprinterhandlecollectedargsVtwo@default + \let\pgfmanualprettyprinterhandlecollectedargsVtwo=\pgfmanualprettyprinterhandlecollectedargsVtwo@default }% \pgfmanualprettyprintercollectupto@restore@callback % Collects tokens inside of a token list up to a single delimiting token, dealing with nested -% catcode-12-braces. +% catcode-12-braces. % % #1: is the end token, the delimiter. It won't be collected. % #2: is code to invoke after % \pgfmanualprettyprinterhandlecollectedargsVtwo has been invoked. % % PRECONDITION: -% there is a large token list following -% \pgfmanualprettyprintercollectargcount with balanced braces. The braces -% have \catcode 12. +% there is a large token list following +% \pgfmanualprettyprintercollectargcount with balanced braces. The braces +% have \catcode 12. % POSTCONDITION: -% - the arguments will be collected as -% '<result> := <token list>' -% and then, -% \pgfmanualprettyprinterhandlecollectedargsVtwo{<result>}{<found terminator>? 1 : 0} will be -% invoked. Just define -% \pgfmanualprettyprinterhandlecollectedargsVtwo -% properly. +% - the arguments will be collected as +% '<result> := <token list>' +% and then, +% \pgfmanualprettyprinterhandlecollectedargsVtwo{<result>}{<found terminator>? 1 : 0} will be +% invoked. Just define +% \pgfmanualprettyprinterhandlecollectedargsVtwo +% properly. % Then, #2 will be invoked. % % @see \pgfmanualprettyprintercollectargcount for more details. -% +% \def\pgfmanualprettyprintercollectupto#1#2{% - \pgfmanualprettyprinterarghasunmatchedbracesfalse - \begingroup - \def\pgfmanual@loc@delimittoken{#1}% - \toksdef\t@afterpgfmanualprettyprinterhandlecollected=10 - \t@afterpgfmanualprettyprinterhandlecollected={#2}% - % - \let\c@pgfmanual@pretty@openbracecount=\c@pgf@counta - % I will track open braces here: - \c@pgfmanual@pretty@openbracecount=0 - % - % and I will accumulate the argument token lists as such here: - \toksdef\t@pgfmanual@currentarg=0 - \t@pgfmanual@currentarg={}% - % - \pgfmanual@pretty@collectupto@loop + \pgfmanualprettyprinterarghasunmatchedbracesfalse + \begingroup + \def\pgfmanual@loc@delimittoken{#1}% + \toksdef\t@afterpgfmanualprettyprinterhandlecollected=10 + \t@afterpgfmanualprettyprinterhandlecollected={#2}% + % + \let\c@pgfmanual@pretty@openbracecount=\c@pgf@counta + % I will track open braces here: + \c@pgfmanual@pretty@openbracecount=0 + % + % and I will accumulate the argument token lists as such here: + \toksdef\t@pgfmanual@currentarg=0 + \t@pgfmanual@currentarg={}% + % + \pgfmanual@pretty@collectupto@loop }% % loops through all tokens, collecting the required number of % arguments. This involves to track nested braces manually. % #1 is a single token. \def\pgfmanual@pretty@collectupto@loop#1{% - \let\pgfmanual@pretty@collectupto@loop@NEXT=\pgfmanual@pretty@collectupto@loop - \def\pgfmanual@loc@TMPc{#1}% - \ifx\pgfmanual@loc@TMPc\pgfmanual@EOI - \edef\pgfmanual@pretty@collectupto@loop@NEXT{% - \noexpand\endgroup - \ifnum\c@pgfmanual@pretty@openbracecount>0 - \noexpand\pgfmanualprettyprinterarghasunmatchedbracestrue - \fi - \noexpand\pgfmanualprettyprinterhandlecollectedargsVtwo{\the\t@pgfmanual@currentarg}{0}% - \noexpand\pgfmanualprettyprintercollectupto@restore@callback - \the\t@afterpgfmanualprettyprinterhandlecollected - \noexpand\pgfmanual@EOI% <- put this token back into token list! - }% - \else - \ifpgfmanualprettycommentactive - \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}% - \ifx\pgfmanual@loc@TMPc\pgfmanual@pretty@activenl - \pgfmanualprettycommentactivefalse - \fi - \else - \ifx\pgfmanual@loc@TMPc\pgfmanual@pretty@activepercent - \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}% - \pgfmanualprettycommentactivetrue - \else - \ifx\pgfmanual@loc@TMPc\pgfmanual@pretty@lbrace - \advance\c@pgfmanual@pretty@openbracecount by1 - \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}% - \else - \ifx\pgfmanual@loc@TMPc\pgfmanual@pretty@rbrace - \advance\c@pgfmanual@pretty@openbracecount by-1 - \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}% - \else - \ifx\pgfmanual@loc@TMPc\pgfmanual@loc@delimittoken - \ifnum\c@pgfmanual@pretty@openbracecount=0 - % do NOT include the delimit token. - \edef\pgfmanual@pretty@collectupto@loop@NEXT{% - \noexpand\endgroup - \noexpand\pgfmanualprettyprinterhandlecollectedargsVtwo{\the\t@pgfmanual@currentarg}{1}% - \noexpand\pgfmanualprettyprintercollectupto@restore@callback - \the\t@afterpgfmanualprettyprinterhandlecollected - }% - \else - \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}% - \fi - \else - \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}% - \fi - \fi - \fi - \fi - \fi - \fi - \pgfmanual@pretty@collectupto@loop@NEXT + \let\pgfmanual@pretty@collectupto@loop@NEXT=\pgfmanual@pretty@collectupto@loop + \def\pgfmanual@loc@TMPc{#1}% + \ifx\pgfmanual@loc@TMPc\pgfmanual@EOI + \edef\pgfmanual@pretty@collectupto@loop@NEXT{% + \noexpand\endgroup + \ifnum\c@pgfmanual@pretty@openbracecount>0 + \noexpand\pgfmanualprettyprinterarghasunmatchedbracestrue + \fi + \noexpand\pgfmanualprettyprinterhandlecollectedargsVtwo{\the\t@pgfmanual@currentarg}{0}% + \noexpand\pgfmanualprettyprintercollectupto@restore@callback + \the\t@afterpgfmanualprettyprinterhandlecollected + \noexpand\pgfmanual@EOI% <- put this token back into token list! + }% + \else + \ifpgfmanualprettycommentactive + \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}% + \ifx\pgfmanual@loc@TMPc\pgfmanual@pretty@activenl + \pgfmanualprettycommentactivefalse + \fi + \else + \ifx\pgfmanual@loc@TMPc\pgfmanual@pretty@activepercent + \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}% + \pgfmanualprettycommentactivetrue + \else + \ifx\pgfmanual@loc@TMPc\pgfmanual@pretty@lbrace + \advance\c@pgfmanual@pretty@openbracecount by1 + \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}% + \else + \ifx\pgfmanual@loc@TMPc\pgfmanual@pretty@rbrace + \advance\c@pgfmanual@pretty@openbracecount by-1 + \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}% + \else + \ifx\pgfmanual@loc@TMPc\pgfmanual@loc@delimittoken + \ifnum\c@pgfmanual@pretty@openbracecount=0 + % do NOT include the delimit token. + \edef\pgfmanual@pretty@collectupto@loop@NEXT{% + \noexpand\endgroup + \noexpand\pgfmanualprettyprinterhandlecollectedargsVtwo{\the\t@pgfmanual@currentarg}{1}% + \noexpand\pgfmanualprettyprintercollectupto@restore@callback + \the\t@afterpgfmanualprettyprinterhandlecollected + }% + \else + \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}% + \fi + \else + \t@pgfmanual@currentarg=\expandafter{\the\t@pgfmanual@currentarg#1}% + \fi + \fi + \fi + \fi + \fi + \fi + \pgfmanual@pretty@collectupto@loop@NEXT }% \def\pgfmanual@pretty@collectargs@finish@cs#1{% - \def\pgfmanual@pretty@collectargs@finish@cs@hasargs{1}% - \ifnum\pgfmanualprettyprinternumcollectedargs=0 - \ifpgfmanualprettyprinterarghasunmatchedbraces - \else - \def\pgfmanual@pretty@collectargs@finish@cs@hasargs{0}% - \fi - \fi - \if\pgfmanual@pretty@collectargs@finish@cs@hasargs1% - % report the macro and its arguments: - \pgfkeysifdefined{/codeexample/prettyprint/cs/\pgfmanual@loc@TMPa/.@cmd}{% - % oh, we have a separate routine for this macro! Ok, use it: - \edef\pgfmanual@loc@TMPb{\noexpand\pgfkeysvalueof{/codeexample/prettyprint/cs/\pgfmanual@loc@TMPa/.@cmd}}% - }{% - % use the generic routine: - \edef\pgfmanual@loc@TMPb{\noexpand\pgfkeysvalueof{/codeexample/prettyprint/cs with args/.@cmd}}% - }% - % re-insert the backslash: - \edef\pgfmanual@loc@TMPa{{\pgfmanual@pretty@backslash\pgfmanual@loc@TMPa}}% - \expandafter\pgfmanual@loc@TMPb\pgfmanual@loc@TMPa #1\pgfeov - \else - % Oh. We probably got |\pgfkeys| instead of |\pgfkeys{arg}| - % re-insert the backslash: - \edef\pgfmanual@loc@TMPa{{\pgfmanual@pretty@backslash\pgfmanual@loc@TMPa}}% - \edef\pgfmanual@loc@TMPb{\noexpand\pgfkeysvalueof{/codeexample/prettyprint/cs/.@cmd}}% - \expandafter\pgfmanual@loc@TMPb\pgfmanual@loc@TMPa\pgfeov - #1\relax% simply typeset any encountered tokens after the control sequence. - \fi + \def\pgfmanual@pretty@collectargs@finish@cs@hasargs{1}% + \ifnum\pgfmanualprettyprinternumcollectedargs=0 + \ifpgfmanualprettyprinterarghasunmatchedbraces + \else + \def\pgfmanual@pretty@collectargs@finish@cs@hasargs{0}% + \fi + \fi + \if\pgfmanual@pretty@collectargs@finish@cs@hasargs1% + % report the macro and its arguments: + \pgfkeysifdefined{/codeexample/prettyprint/cs/\pgfmanual@loc@TMPa/.@cmd}{% + % oh, we have a separate routine for this macro! Ok, use it: + \edef\pgfmanual@loc@TMPb{\noexpand\pgfkeysvalueof{/codeexample/prettyprint/cs/\pgfmanual@loc@TMPa/.@cmd}}% + }{% + % use the generic routine: + \edef\pgfmanual@loc@TMPb{\noexpand\pgfkeysvalueof{/codeexample/prettyprint/cs with args/.@cmd}}% + }% + % re-insert the backslash: + \edef\pgfmanual@loc@TMPa{{\pgfmanual@pretty@backslash\pgfmanual@loc@TMPa}}% + \expandafter\pgfmanual@loc@TMPb\pgfmanual@loc@TMPa #1\pgfeov + \else + % Oh. We probably got |\pgfkeys| instead of |\pgfkeys{arg}| + % re-insert the backslash: + \edef\pgfmanual@loc@TMPa{{\pgfmanual@pretty@backslash\pgfmanual@loc@TMPa}}% + \edef\pgfmanual@loc@TMPb{\noexpand\pgfkeysvalueof{/codeexample/prettyprint/cs/.@cmd}}% + \expandafter\pgfmanual@loc@TMPb\pgfmanual@loc@TMPa\pgfeov + #1\relax% simply typeset any encountered tokens after the control sequence. + \fi }% % A user macro which pretty prints a set of keys. @@ -858,258 +858,259 @@ % However, '#1' should only have catcode 12 characters with the % exception of catcode 13 for newlines, spaces and comments. \long\def\pgfmanualprettyprintpgfkeys#1{% - \ifpgfmanualprettyenabled - \begingroup - \pgfmanualprettyprintstyles - \pgfmanual@pretty@pgfkeys@loop#1\pgfmanual@EOI - \endgroup - \else - #1% - \fi + \ifpgfmanualprettyenabled + \begingroup + \pgfmanualprettyprintstyles + \pgfmanual@pretty@pgfkeys@loop#1\pgfmanual@EOI + \endgroup + \else + #1% + \fi } \def\pgfmanual@pretty@pgfkeys{% - \let\pgfmanualprettyprinterhandlecollectedargsVtwo=\pgfmanual@pretty@pgfkeys@start - \pgfmanualprettyprintercollectupto]{\pgfmanual@pretty@mainloop}%% + \let\pgfmanualprettyprinterhandlecollectedargsVtwo=\pgfmanual@pretty@pgfkeys@start + \pgfmanualprettyprintercollectupto]{\pgfmanual@pretty@mainloop}%% }% \long\def\pgfmanual@pretty@pgfkeys@start#1#2{% - [% - \pgfmanual@pretty@pgfkeys@loop#1\pgfmanual@EOI - \if1#2% - ]% - \fi + [% + \pgfmanual@pretty@pgfkeys@loop#1\pgfmanual@EOI + \if1#2% + ]% + \fi }% % iterates through single tokens, detecting key names and values while % it goes. \long\def\pgfmanual@pretty@pgfkeys@loop#1{% - \def\pgfmanual@loc@TMPa{#1}% - \ifx\pgfmanual@loc@TMPa\pgfmanual@EOI - \def\pgfmanual@pretty@pgfkeys@loop@NEXT{\relax}% - \else - \def\pgfmanual@pretty@pgfkeys@loop@NEXT{\pgfmanual@pretty@pgfkeys@loop}% - \ifpgfmanualprettycommentactive - #1\kern0pt% - \else - \ifnum13=\catcode`#1 - % we found a white space (space, TAB or NL) or comment - #1% - \else - \ifx\pgfmanual@loc@TMPa\pgfmanual@pretty@comma% - %\let\pgfmanual@pretty@pgfkeys@loop@NEXT=\pgfmanual@pretty@pgfkeys@checkforEOI - ,% - \else - \ifnum10=\catcode`#1 - % another white space... I thought they'd have - % catcode 13. doesn't matter. - #1% - \else - \ifx\pgfmanual@loc@TMPa\pgfmanual@pretty@lbrace - % braces may not occur in the first place - - % but there are circumstances where it is - % convenient to deal with them here (when - % processing arguments of styles) - % Do it. - #1% - \else - \ifx\pgfmanual@loc@TMPa\pgfmanual@pretty@rbrace - #1% - \else - % found the beginning of a key! - % We will collect the key name into - % \toks0. - \toks0={}% - % - % Handle it: - % FIXME what if we found an opening brace!? - \def\pgfmanual@pretty@pgfkeys@loop@NEXT{\pgfmanual@pretty@pgfkeys@collectkey #1}% - \fi - \fi - \fi - \fi - \fi - \fi - \fi - \pgfmanual@pretty@pgfkeys@loop@NEXT + \def\pgfmanual@loc@TMPa{#1}% + \ifx\pgfmanual@loc@TMPa\pgfmanual@EOI + \def\pgfmanual@pretty@pgfkeys@loop@NEXT{\relax}% + \else + \def\pgfmanual@pretty@pgfkeys@loop@NEXT{\pgfmanual@pretty@pgfkeys@loop}% + \ifpgfmanualprettycommentactive + #1\kern0pt% + \else + \ifnum13=\catcode`#1 + % we found a white space (space, TAB or NL) or comment + #1% + \else + \ifx\pgfmanual@loc@TMPa\pgfmanual@pretty@comma% + %\let\pgfmanual@pretty@pgfkeys@loop@NEXT=\pgfmanual@pretty@pgfkeys@checkforEOI + ,% + \else + \ifnum10=\catcode`#1 + % another white space... I thought they'd have + % catcode 13. doesn't matter. + #1% + \else + \ifx\pgfmanual@loc@TMPa\pgfmanual@pretty@lbrace + % braces may not occur in the first place - + % but there are circumstances where it is + % convenient to deal with them here (when + % processing arguments of styles) + % Do it. + #1% + \else + \ifx\pgfmanual@loc@TMPa\pgfmanual@pretty@rbrace + #1% + \else + % found the beginning of a key! + % We will collect the key name into + % \toks0. + \toks0={}% + % + % Handle it: + % FIXME what if we found an opening brace!? + \def\pgfmanual@pretty@pgfkeys@loop@NEXT{\pgfmanual@pretty@pgfkeys@collectkey #1}% + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \pgfmanual@pretty@pgfkeys@loop@NEXT }% \def\pgfmanual@pretty@pgfkeys@collectkey#1{% - \def\pgfmanual@loc@TMPb{#1}% - \def\pgfmanual@pretty@pgfkeys@collectkey@next{\pgfmanual@pretty@pgfkeys@collectkey}% - \ifx\pgfmanual@loc@TMPb\pgfmanual@EOI - % finish key name. - \edef\pgfmanual@loc@TMPb{\the\toks0 }% - \ifx\pgfmanual@loc@TMPb\pgfutil@empty - \else - \expandafter\pgfmanual@pretty@pgfkeys@processkey\expandafter{\the\toks0 }% - \fi - \def\pgfmanual@pretty@pgfkeys@collectkey@next{\relax}% - \else - \ifx\pgfmanual@loc@TMPb\pgfmanual@pretty@eq - % finish key name. - \expandafter\pgfmanual@pretty@pgfkeys@processkey\expandafter{\the\toks0 }% - #1% - % now, we do the same with the value - we collect it into - % \toks0. - \toks0={}% - \def\pgfmanual@pretty@pgfkeys@collectvalue@hasconsumedspaces{0}% - \def\pgfmanual@pretty@pgfkeys@collectkey@next{\pgfmanual@pretty@pgfkeys@collectvalue}% - \else - \ifx\pgfmanual@loc@TMPb\pgfmanual@pretty@comma - % finish key name. - \expandafter\pgfmanual@pretty@pgfkeys@processkey\expandafter{\the\toks0 }% - #1% - \def\pgfmanual@pretty@pgfkeys@collectkey@next{\pgfmanual@pretty@pgfkeys@loop}% - \else - \ifx\pgfmanual@loc@TMPb\pgfmanual@pretty@activenl - % finish key name before newline. This is not - % necessarily as in TeX, but its simpler here - % because we don't need special cases for comments - % and we don't need to gobble following white - % spaces. - \expandafter\pgfmanual@pretty@pgfkeys@processkey\expandafter{\the\toks0 }% - #1% - \def\pgfmanual@pretty@pgfkeys@collectkey@next{\pgfmanual@pretty@pgfkeys@loop}% - \else - \ifx\pgfmanual@loc@TMPb\pgfmanual@pretty@backslash - % This is confusing. I simply try to invoke - % the control sequence code and recover as - % good as possible. Let's see if that's - % useful. - \edef\pgfmanual@loc@TMPb{\the\toks0 }% - \ifx\pgfmanual@loc@TMPb\pgfutil@empty - \else - \expandafter\pgfmanual@pretty@pgfkeys@processkey\expandafter{\the\toks0 }% - \fi - % - % we found the start of a control sequence '\command': - % - % collect the control sequence name into - % \pgfmanual@loc@TMPa, but without the backslash: - \begingroup - \let\pgfmanual@loc@TMPa=\pgfutil@empty - \def\afterpgfmanual@pretty@cs{% - \endgroup - \pgfmanual@pretty@pgfkeys@loop - }% - \def\pgfmanual@pretty@pgfkeys@collectkey@next{\pgfmanual@pretty@collectcs@loop}% - \else - \ifx\pgfmanual@loc@TMPb\pgfmanual@pretty@lbrace - % Braces in key names are allowed (if they - % are not the first character of a key - % name) - \def\pgfmanualprettyprinterhandlecollectedargs##1{% - \toks1={##1}% - \edef\pgfmanual@loc@TMPc{% - \the\toks0 \pgfmanual@pretty@lbrace \the\toks1 - \ifpgfmanualprettyprinterarghasunmatchedbraces - \else - \pgfmanual@pretty@rbrace - \fi - }% - \toks0=\expandafter{\pgfmanual@loc@TMPc}% - }% - \def\pgfmanual@pretty@pgfkeys@collectkey@next{% - \pgfmanualprettyprintercollectargcount{1}{\pgfmanual@pretty@pgfkeys@collectkey}% - #1% - }% - \else - \ifx\pgfmanual@loc@TMPb\pgfmanual@pretty@rbrace - \expandafter\pgfmanual@pretty@pgfkeys@processkey\expandafter{\the\toks0 }% - #1% - \def\pgfmanual@pretty@pgfkeys@collectkey@next{\pgfmanual@pretty@pgfkeys@loop}% - \else - \toks0=\expandafter{\the\toks0 #1}% - \fi - \fi - \fi - \fi - \fi - \fi - \fi - \pgfmanual@pretty@pgfkeys@collectkey@next + \def\pgfmanual@loc@TMPb{#1}% + \def\pgfmanual@pretty@pgfkeys@collectkey@next{\pgfmanual@pretty@pgfkeys@collectkey}% + \ifx\pgfmanual@loc@TMPb\pgfmanual@EOI + % finish key name. + \edef\pgfmanual@loc@TMPb{\the\toks0 }% + \ifx\pgfmanual@loc@TMPb\pgfutil@empty + \else + \expandafter\pgfmanual@pretty@pgfkeys@processkey\expandafter{\the\toks0 }% + \fi + \def\pgfmanual@pretty@pgfkeys@collectkey@next{\relax}% + \else + \ifx\pgfmanual@loc@TMPb\pgfmanual@pretty@eq + % finish key name. + \expandafter\pgfmanual@pretty@pgfkeys@processkey\expandafter{\the\toks0 }% + #1% + % now, we do the same with the value - we collect it into + % \toks0. + \toks0={}% + \def\pgfmanual@pretty@pgfkeys@collectvalue@hasconsumedspaces{0}% + \def\pgfmanual@pretty@pgfkeys@collectkey@next{\pgfmanual@pretty@pgfkeys@collectvalue}% + \else + \ifx\pgfmanual@loc@TMPb\pgfmanual@pretty@comma + % finish key name. + \expandafter\pgfmanual@pretty@pgfkeys@processkey\expandafter{\the\toks0 }% + #1% + \def\pgfmanual@pretty@pgfkeys@collectkey@next{\pgfmanual@pretty@pgfkeys@loop}% + \else + \ifx\pgfmanual@loc@TMPb\pgfmanual@pretty@activenl + % finish key name before newline. This is not + % necessarily as in TeX, but its simpler here + % because we don't need special cases for comments + % and we don't need to gobble following white + % spaces. + \expandafter\pgfmanual@pretty@pgfkeys@processkey\expandafter{\the\toks0 }% + #1% + \def\pgfmanual@pretty@pgfkeys@collectkey@next{\pgfmanual@pretty@pgfkeys@loop}% + \else + \ifx\pgfmanual@loc@TMPb\pgfmanual@pretty@backslash + % This is confusing. I simply try to invoke + % the control sequence code and recover as + % good as possible. Let's see if that's + % useful. + \edef\pgfmanual@loc@TMPb{\the\toks0 }% + \ifx\pgfmanual@loc@TMPb\pgfutil@empty + \else + \expandafter\pgfmanual@pretty@pgfkeys@processkey\expandafter{\the\toks0 }% + \fi + % + % we found the start of a control sequence '\command': + % + % collect the control sequence name into + % \pgfmanual@loc@TMPa, but without the backslash: + \begingroup + \let\pgfmanual@loc@TMPa=\pgfutil@empty + \def\afterpgfmanual@pretty@cs{% + \endgroup + \pgfmanual@pretty@pgfkeys@loop + }% + \def\pgfmanual@pretty@pgfkeys@collectkey@next{\pgfmanual@pretty@collectcs@loop}% + \else + \ifx\pgfmanual@loc@TMPb\pgfmanual@pretty@lbrace + % Braces in key names are allowed (if they + % are not the first character of a key + % name) + \def\pgfmanualprettyprinterhandlecollectedargs##1{% + \toks1={##1}% + \edef\pgfmanual@loc@TMPc{% + \the\toks0 \pgfmanual@pretty@lbrace \the\toks1 + \ifpgfmanualprettyprinterarghasunmatchedbraces + \else + \pgfmanual@pretty@rbrace + \fi + }% + \toks0=\expandafter{\pgfmanual@loc@TMPc}% + }% + \def\pgfmanual@pretty@pgfkeys@collectkey@next{% + \pgfmanualprettyprintercollectargcount{1}{\pgfmanual@pretty@pgfkeys@collectkey}% + #1% + }% + \else + \ifx\pgfmanual@loc@TMPb\pgfmanual@pretty@rbrace + \expandafter\pgfmanual@pretty@pgfkeys@processkey\expandafter{\the\toks0 }% + #1% + \def\pgfmanual@pretty@pgfkeys@collectkey@next{\pgfmanual@pretty@pgfkeys@loop}% + \else + \toks0=\expandafter{\the\toks0 #1}% + \fi + \fi + \fi + \fi + \fi + \fi + \fi + \pgfmanual@pretty@pgfkeys@collectkey@next }% \def\pgfmanual@pretty@pgfkeys@collectvalue#1{% - \def\pgfmanual@loc@TMPb{#1}% - \let\pgfmanual@pretty@pgfkeys@collectvalue@next=\pgfmanual@pretty@pgfkeys@collectvalue - \ifx\pgfmanual@loc@TMPb\pgfmanual@EOI - % the key value is empty. - %\expandafter\pgfmanual@pretty@pgfkeys@processvalue\expandafter{\the\toks0 }% - \let\pgfmanual@pretty@pgfkeys@collectvalue@next=\relax - \else - \def\pgfmanual@pretty@isconsumed{0}% - \if\pgfmanual@pretty@pgfkeys@collectvalue@hasconsumedspaces0% - \ifnum13=\catcode`#1 - % we found a white space (space, TAB or NL) - #1% - \def\pgfmanual@pretty@isconsumed{1}% - \else - \ifnum10=\catcode`#1 - % another white space... I thought they'd have - % catcode 13. doesn't matter. - \def\pgfmanual@pretty@isconsumed{1}% - #1% - \fi - \fi - \fi - \if\pgfmanual@pretty@isconsumed0% - \def\pgfmanualprettyprinterhandlecollectedargsVtwo##1##2{\pgfmanual@pretty@pgfkeys@processvalue{##1}}% the braces will be handled separately. - \def\pgfmanual@pretty@pgfkeys@collectvalue@next{% - \pgfmanualprettyprintercollectupto,{\afterpgfmanual@pretty@collectargs@finish@value}#1% - }% - \fi - \fi - \pgfmanual@pretty@pgfkeys@collectvalue@next + \def\pgfmanual@loc@TMPb{#1}% + \let\pgfmanual@pretty@pgfkeys@collectvalue@next=\pgfmanual@pretty@pgfkeys@collectvalue + \ifx\pgfmanual@loc@TMPb\pgfmanual@EOI + % the key value is empty. + %\expandafter\pgfmanual@pretty@pgfkeys@processvalue\expandafter{\the\toks0 }% + \let\pgfmanual@pretty@pgfkeys@collectvalue@next=\relax + \else + \def\pgfmanual@pretty@isconsumed{0}% + \if\pgfmanual@pretty@pgfkeys@collectvalue@hasconsumedspaces0% + \ifnum13=\catcode`#1 + % we found a white space (space, TAB or NL) + #1% + \def\pgfmanual@pretty@isconsumed{1}% + \else + \ifnum10=\catcode`#1 + % another white space... I thought they'd have + % catcode 13. doesn't matter. + \def\pgfmanual@pretty@isconsumed{1}% + #1% + \fi + \fi + \fi + \if\pgfmanual@pretty@isconsumed0% + \def\pgfmanualprettyprinterhandlecollectedargsVtwo##1##2{\pgfmanual@pretty@pgfkeys@processvalue{##1}}% the braces will be handled separately. + \def\pgfmanual@pretty@pgfkeys@collectvalue@next{% + \pgfmanualprettyprintercollectupto,{\afterpgfmanual@pretty@collectargs@finish@value}#1% + }% + \fi + \fi + \pgfmanual@pretty@pgfkeys@collectvalue@next }% \def\afterpgfmanual@pretty@collectargs@finish@value{% - \pgfutil@ifnextchar\pgfmanual@EOI{% - \pgfmanual@pretty@pgfkeys@loop - }{% - \pgfmanual@pretty@pgfkeys@loop,% re-insert the gobbled comma here! - }% + \pgfutil@ifnextchar\pgfmanual@EOI{% + \pgfmanual@pretty@pgfkeys@loop + }{% + \pgfmanual@pretty@pgfkeys@loop,% re-insert the gobbled comma here! + }% }% {\catcode`\^^M=13 \catcode`\ =13\relax\catcode`\%=13\relax\gdef\pgfmanual@pretty@restorespaces{\def%{\pgfmanual@pretty@percent}\def^^M{\pgfmanual@pretty@space}\def {\pgfmanual@pretty@space}}} % #1: the key's name \def\pgfmanual@pretty@pgfkeys@processkey#1{% - \begingroup - \pgfmanual@pretty@restorespaces - % remember this key name! It is used when we are dealing with - % its value later... (if it has a value) - \xdef\pgfmanual@pretty@pgfkeys@collectkey@keyname{#1}% - \endgroup - % - % check if it is a handled key. FIXME: this could be done in a - % rigorous way! This here assumes that all key handlers start with - % '.' and the '.' occurs never right after a '/' otherwise: - \def\pgfmanual@loc@TMPa{\pgfutil@in@{/.}}% - \expandafter\pgfmanual@loc@TMPa\expandafter{\pgfmanual@pretty@pgfkeys@collectkey@keyname}% - \ifpgfutil@in@ - % split into key name and handler name... - \def\pgfmanual@pretty@splitit##1/.##2\relax{% - \def\pgfmanual@loc@TMPb{{##1}{.##2}}% - }% - \expandafter\pgfmanual@pretty@splitit\pgfmanual@pretty@pgfkeys@collectkey@keyname\relax - % - % report key name AND handler: - \def\pgfmanual@loc@TMPa{\pgfkeysvalueof{/codeexample/prettyprint/key name with handler/.@cmd}}% - \expandafter\pgfmanual@loc@TMPa\pgfmanual@loc@TMPb\pgfeov - \else - % report key name ... - \def\pgfmanual@loc@TMPa{\pgfkeysvalueof{/codeexample/prettyprint/key name/.@cmd}}% - \expandafter\pgfmanual@loc@TMPa\pgfmanual@pretty@pgfkeys@collectkey@keyname\pgfeov - \fi + \begingroup + \pgfmanual@pretty@restorespaces + % remember this key name! It is used when we are dealing with + % its value later... (if it has a value) + \xdef\pgfmanual@pretty@pgfkeys@collectkey@keyname{#1}% + \endgroup + % + % check if it is a handled key. FIXME: this could be done in a + % rigorous way! This here assumes that all key handlers start with + % '.' and the '.' occurs never right after a '/' otherwise: + \def\pgfmanual@loc@TMPa{\pgfutil@in@{/.}}% + \expandafter\pgfmanual@loc@TMPa\expandafter{\pgfmanual@pretty@pgfkeys@collectkey@keyname}% + \ifpgfutil@in@ + % split into key name and handler name... + \def\pgfmanual@pretty@splitit##1/.##2\relax{% + \def\pgfmanual@loc@TMPb{{##1}{.##2}}% + }% + \expandafter\pgfmanual@pretty@splitit\pgfmanual@pretty@pgfkeys@collectkey@keyname\relax + % + % report key name AND handler: + \def\pgfmanual@loc@TMPa{\pgfkeysvalueof{/codeexample/prettyprint/key name with handler/.@cmd}}% + \expandafter\pgfmanual@loc@TMPa\pgfmanual@loc@TMPb\pgfeov + \else + % report key name ... + \def\pgfmanual@loc@TMPa{\pgfkeysvalueof{/codeexample/prettyprint/key name/.@cmd}}% + \expandafter\pgfmanual@loc@TMPa\pgfmanual@pretty@pgfkeys@collectkey@keyname\pgfeov + \fi } \def\pgfmanual@pretty@pgfkeys@processvalue#1{% - % report or process the value, depending on the keyname. - % After all, it *may* be a style which needs to be pretty printed - % as well. - \pgfkeysifdefined{/codeexample/prettyprint/key value/\pgfmanual@pretty@pgfkeys@collectkey@keyname/.@cmd}{% - % oh, we have a separate routine for this macro! Ok, use it: - \edef\pgfmanual@loc@TMPb{\noexpand\pgfkeysvalueof{/codeexample/prettyprint/key value/\pgfmanual@pretty@pgfkeys@collectkey@keyname/.@cmd}}% - }{% - % use the generic routine: - \edef\pgfmanual@loc@TMPb{\noexpand\pgfkeysvalueof{/codeexample/prettyprint/key value/.@cmd}}% - }% - \edef\pgfmanual@loc@TMPa{{\pgfmanual@pretty@pgfkeys@collectkey@keyname}}% - \expandafter\pgfmanual@loc@TMPb\pgfmanual@loc@TMPa{#1}\pgfeov + % report or process the value, depending on the keyname. + % After all, it *may* be a style which needs to be pretty printed + % as well. + \pgfkeysifdefined{/codeexample/prettyprint/key value/\pgfmanual@pretty@pgfkeys@collectkey@keyname/.@cmd}{% + % oh, we have a separate routine for this macro! Ok, use it: + \edef\pgfmanual@loc@TMPb{\noexpand\pgfkeysvalueof{/codeexample/prettyprint/key value/\pgfmanual@pretty@pgfkeys@collectkey@keyname/.@cmd}}% + }{% + % use the generic routine: + \edef\pgfmanual@loc@TMPb{\noexpand\pgfkeysvalueof{/codeexample/prettyprint/key value/.@cmd}}% + }% + \edef\pgfmanual@loc@TMPa{{\pgfmanual@pretty@pgfkeys@collectkey@keyname}}% + \expandafter\pgfmanual@loc@TMPb\pgfmanual@loc@TMPa{#1}\pgfeov } + diff --git a/Master/texmf-dist/tex/latex/pgf/frontendlayer/libraries/tikzlibraryexternal.code.tex b/Master/texmf-dist/tex/latex/pgf/frontendlayer/libraries/tikzlibraryexternal.code.tex index dc1fc05b936..67d199476ea 100644 --- a/Master/texmf-dist/tex/latex/pgf/frontendlayer/libraries/tikzlibraryexternal.code.tex +++ b/Master/texmf-dist/tex/latex/pgf/frontendlayer/libraries/tikzlibraryexternal.code.tex @@ -7,16 +7,16 @@ % % See the file doc/generic/pgf/licenses/LICENSE for more details. % -% +% % This file provides a high-level automatic export feature for tikz pictures. % It allows to export EACH SINGLE FIGURE into a separate PDF. % -% The simplest way is to use +% The simplest way is to use % % \tikzexternalize{myarticle} % % it simply converts every figure using the write18 method. If that is not possible, -% you need to reconfigure \tikzexternalize: it can generate a list of figure file names +% you need to reconfigure \tikzexternalize: it can generate a list of figure file names % and you need to generate these figures manually (or with a script). % % It replaces \tikzpicture/ \endtikzpicture and \tikz and invokes \beginpgfgraphicnamed ... \endpgfgraphicnamed @@ -30,16 +30,16 @@ % ... also used for \pdf@shellescape. \usepackage{pdftexcmds} \pgfutil@IfFileExists{atveryend.sty}{% - \usepackage{atveryend}% + \usepackage{atveryend}% }{% - \message{! Package tikz Warning: \string\usepackage{atveryend} impossible. Automatic resolving of references within external files impossible.}% + \message{! Package tikz Warning: \string\usepackage{atveryend} impossible. Automatic resolving of references within external files impossible.}% }% % source generic implementation: \input tikzexternalshared.code.tex \pgfutil@IfUndefined{pdf@mdfivesum}{}{% - \let\tikzexternal@mdfivesum=\pdf@mdfivesum + \let\tikzexternal@mdfivesum=\pdf@mdfivesum }% \def\tikzexternal@TEXDIALECT@begpicture{\begin{tikzpicture}} @@ -54,54 +54,55 @@ % % This does also work if <name> is NOT tikzpicture! \def\tikzexternal@TEXDIALECT@collectpicture#1{% - \begingroup - \t@tikzexternal@tmpa={}% - \tikzexternal@laTeX@collect@until@end@tikzpicture{#1}% + \begingroup + \t@tikzexternal@tmpa={}% + \tikzexternal@laTeX@collect@until@end@tikzpicture{#1}% } % Loop until we find '\end{tikzpicture}'. We have to make sure that % even strings like '#1' are allowed inside of the collected argument. \long\def\tikzexternal@laTeX@collect@until@end@tikzpicture#1#2\end#3{% - \def\tikzexternal@laTeX@collect@until@end@tikzpicture@{#3}% - \ifx\tikzexternal@laTeX@collect@until@end@tikzpicture@\tikzexternal@laTeX@collect@until@end@tikzpicturetikzpicturestring - \t@tikzexternal@tmpa=\expandafter{\the\t@tikzexternal@tmpa #2}% - \edef\tikzexternal@TEXDIALECT@collectpicture@next{% - \noexpand\endgroup - \noexpand#1{\the\t@tikzexternal@tmpa}% - }% - \t@tikzexternal@tmpa={}% release memory. - \else - \t@tikzexternal@tmpa=\expandafter{\the\t@tikzexternal@tmpa #2\end{#3}}% - \def\tikzexternal@TEXDIALECT@collectpicture@next{% - \tikzexternal@laTeX@collect@until@end@tikzpicture{#1}}% - \fi - \tikzexternal@TEXDIALECT@collectpicture@next + \def\tikzexternal@laTeX@collect@until@end@tikzpicture@{#3}% + \ifx\tikzexternal@laTeX@collect@until@end@tikzpicture@\tikzexternal@laTeX@collect@until@end@tikzpicturetikzpicturestring + \t@tikzexternal@tmpa=\expandafter{\the\t@tikzexternal@tmpa #2}% + \edef\tikzexternal@TEXDIALECT@collectpicture@next{% + \noexpand\endgroup + \noexpand#1{\the\t@tikzexternal@tmpa}% + }% + \t@tikzexternal@tmpa={}% release memory. + \else + \t@tikzexternal@tmpa=\expandafter{\the\t@tikzexternal@tmpa #2\end{#3}}% + \def\tikzexternal@TEXDIALECT@collectpicture@next{% + \tikzexternal@laTeX@collect@until@end@tikzpicture{#1}}% + \fi + \tikzexternal@TEXDIALECT@collectpicture@next }% \def\tikzexternal@laTeX@collect@until@end@tikzpicturetikzpicturestring{tikzpicture}% \def\tikzexternal@handle@landscape{% - \ltx@ifpackageloaded{pdflscape}{% - % Work around a bug in conjunction with pdflscape and - % external: without this optimize-away-instruction, the - % externalized image would be rotated - and it will be rotated - % once more again when it is included. - % - % if we "optimize it away", the landscape stuff will be - % omitted. I hope this is enough... might not be entirely - % fool-proof; perhaps we need to set it to \relax. For now, it - % will probably do the job - \tikzset{ - external/.cd, - optimize command away=\landscape, - optimize command away=\endlandscape - }% - }{% - }% + \ltx@ifpackageloaded{pdflscape}{% + % Work around a bug in conjunction with pdflscape and + % external: without this optimize-away-instruction, the + % externalized image would be rotated - and it will be rotated + % once more again when it is included. + % + % if we "optimize it away", the landscape stuff will be + % omitted. I hope this is enough... might not be entirely + % fool-proof; perhaps we need to set it to \relax. For now, it + % will probably do the job + \tikzset{ + external/.cd, + optimize command away=\landscape, + optimize command away=\endlandscape + }% + }{% + }% }% \AtBeginDocument{% - \pgfutil@ifundefined{tikzexternalrealjob}{% - \global\let\tikzexternalrealjob=\jobname - }{}% - \tikzexternal@handle@landscape + \pgfutil@ifundefined{tikzexternalrealjob}{% + \global\let\tikzexternalrealjob=\jobname + }{}% + \tikzexternal@handle@landscape }% + diff --git a/Master/texmf-dist/tex/latex/pgf/utilities/pgfcalendar.sty b/Master/texmf-dist/tex/latex/pgf/utilities/pgfcalendar.sty index c209bcdb7e3..d694a2d2324 100644 --- a/Master/texmf-dist/tex/latex/pgf/utilities/pgfcalendar.sty +++ b/Master/texmf-dist/tex/latex/pgf/utilities/pgfcalendar.sty @@ -8,7 +8,6 @@ % See the file doc/generic/pgf/licenses/LICENSE for more details. \RequirePackage{pgfrcs} -\RequirePackage{pgfkeys} \input{pgfcalendar.code.tex} diff --git a/Master/texmf-dist/tex/latex/pgf/utilities/tikzexternal.sty b/Master/texmf-dist/tex/latex/pgf/utilities/tikzexternal.sty index 4f9d31572f6..a6aacd5fd7c 100644 --- a/Master/texmf-dist/tex/latex/pgf/utilities/tikzexternal.sty +++ b/Master/texmf-dist/tex/latex/pgf/utilities/tikzexternal.sty @@ -14,7 +14,7 @@ % % This file is intended to be distributed or even inlined into a file % when a document needs to be typeset on a system that does not have -% pgf/TikZ installed. +% pgf/TikZ installed. % % It replaces \tikzpicture/ \endtikzpicture and \tikz and invokes the % \includegraphics with the correct file name instead. @@ -36,14 +36,14 @@ \tikzsetfigurename{\tikzexternal@realjob-figure}% \long\def\tikzpicture#1\end#2{% collect every thing up to \end{tikzpicture} - \def\tikzexternal@laTeX@collectpicture@@{#2}% - \ifx\tikzexternal@laTeX@collectpicture@@\tikzexternal@laTeX@tikzpicturestring - \tikzexternal@image - \end{tikzpicture}% - \else - \expandafter - \tikzpicture - \fi + \def\tikzexternal@laTeX@collectpicture@@{#2}% + \ifx\tikzexternal@laTeX@collectpicture@@\tikzexternal@laTeX@tikzpicturestring + \tikzexternal@image + \end{tikzpicture}% + \else + \expandafter + \tikzpicture + \fi }% \def\endtikzpicture{} \def\tikzexternal@laTeX@tikzpicturestring{tikzpicture}% @@ -63,81 +63,82 @@ { \catcode`\;=\active \gdef\tikz@collectactivesemicolon#1#2;{% - \tikz@opt@process{#1}{#2;}% + \tikz@opt@process{#1}{#2;}% } } \def\tikz@opt@process#1#2{\tikzexternal@image} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \def\tikzexternal@image{% - \leavevmode - \begingroup - \t@tikzexternal@tmpa=\expandafter{\tikzexternal@filenameprefix}% - \ifx\tikzexternal@nextfile\empty - \expandafter\ifx\csname c@tikzext@no@\tikzexternal@figurename\endcsname\relax - \expandafter\gdef\csname c@tikzext@no@\tikzexternal@figurename\endcsname{0}% - \fi - \t@tikzexternal@tmpb=\expandafter{\tikzexternal@figurename}% - \count0=\csname c@tikzext@no@\tikzexternal@figurename\endcsname - \xdef\tikzexternal@curfilename{\the\t@tikzexternal@tmpa\the\t@tikzexternal@tmpb\the\count0 }% - \advance\count0 by1\relax - \expandafter\xdef\csname c@tikzext@no@\tikzexternal@figurename\endcsname{\the\count0 }% - \else - \t@tikzexternal@tmpb=\expandafter{\tikzexternal@nextfile}% - \xdef\tikzexternal@curfilename{\the\t@tikzexternal@tmpa\the\t@tikzexternal@tmpb}% - \fi - \endgroup - \global\let\tikzexternal@nextfile=\empty - \pgfincludeexternalgraphics\tikzexternal@curfilename + \leavevmode + \begingroup + \t@tikzexternal@tmpa=\expandafter{\tikzexternal@filenameprefix}% + \ifx\tikzexternal@nextfile\empty + \expandafter\ifx\csname c@tikzext@no@\tikzexternal@figurename\endcsname\relax + \expandafter\gdef\csname c@tikzext@no@\tikzexternal@figurename\endcsname{0}% + \fi + \t@tikzexternal@tmpb=\expandafter{\tikzexternal@figurename}% + \count0=\csname c@tikzext@no@\tikzexternal@figurename\endcsname + \xdef\tikzexternal@curfilename{\the\t@tikzexternal@tmpa\the\t@tikzexternal@tmpb\the\count0 }% + \advance\count0 by1\relax + \expandafter\xdef\csname c@tikzext@no@\tikzexternal@figurename\endcsname{\the\count0 }% + \else + \t@tikzexternal@tmpb=\expandafter{\tikzexternal@nextfile}% + \xdef\tikzexternal@curfilename{\the\t@tikzexternal@tmpa\the\t@tikzexternal@tmpb}% + \fi + \endgroup + \global\let\tikzexternal@nextfile=\empty + \pgfincludeexternalgraphics\tikzexternal@curfilename }% \def\tikzset#1{}\def\pgfkeys#1{}\def\pgfqkeys#1#2{} \long\def\beginpgfgraphicnamed#1#2\endpgfgraphicnamed{\pgfincludeexternalgraphics{#1}} \def\tikzifinpicture#1#2{#2} \def\pgfincludeexternalgraphics#1{% - \begingroup - \pgfexternalreaddpth{#1}% - \setbox1=\hbox{\includegraphics{#1}}% - \ifdim\pgfretval=0pt - \box1 - \else - \dimen0=\pgfretval\relax - \hbox{\lower\dimen0 \box1 }% - \fi - \endgroup + \begingroup + \pgfexternalreaddpth{#1}% + \setbox1=\hbox{\includegraphics{#1}}% + \ifdim\pgfretval=0pt + \box1 + \else + \dimen0=\pgfretval\relax + \hbox{\lower\dimen0 \box1 }% + \fi + \endgroup } \newread\r@pgf@reada \def\pgfexternalreaddpth#1{% - \edef\pgfexternalreaddpth@restore{% - \noexpand\endlinechar=\the\endlinechar\space - \noexpand\catcode`\noexpand\@=\the\catcode`\@\space - }% - \def\pgfretval{0pt}% - \endlinechar=-1 % suppress white space at end - \catcode`\@=11 - \openin\r@pgf@reada=#1.dpth - \pgfincludeexternalgraphics@read@dpth - \pgfexternalreaddpth@restore + \edef\pgfexternalreaddpth@restore{% + \noexpand\endlinechar=\the\endlinechar\space + \noexpand\catcode`\noexpand\@=\the\catcode`\@\space + }% + \def\pgfretval{0pt}% + \endlinechar=-1 % suppress white space at end + \catcode`\@=11 + \openin\r@pgf@reada=#1.dpth + \pgfincludeexternalgraphics@read@dpth + \pgfexternalreaddpth@restore }% \def\pgfincludeexternalgraphics@read@dpth{% - \ifeof\r@pgf@reada - \closein\r@pgf@reada - \else - \read\r@pgf@reada to\pgfincludeexternalgraphics@auxline - \ifx\pgfincludeexternalgraphics@auxline\empty - \else - \expandafter\pgfincludeexternalgraphics@read@dpth@line\pgfincludeexternalgraphics@auxline\pgfincludeexternalgraphics@read@dpth@line@EOI - \fi - \expandafter\pgfincludeexternalgraphics@read@dpth - \fi + \ifeof\r@pgf@reada + \closein\r@pgf@reada + \else + \read\r@pgf@reada to\pgfincludeexternalgraphics@auxline + \ifx\pgfincludeexternalgraphics@auxline\empty + \else + \expandafter\pgfincludeexternalgraphics@read@dpth@line\pgfincludeexternalgraphics@auxline\pgfincludeexternalgraphics@read@dpth@line@EOI + \fi + \expandafter\pgfincludeexternalgraphics@read@dpth + \fi }% \long\def\pgfincludeexternalgraphics@read@dpth@line#1#2\pgfincludeexternalgraphics@read@dpth@line@EOI{% - \ifcat\noexpand#1\relax - \if@filesw - {\toks0={#1#2}% - \immediate\write\@auxout{\noexpand\def\noexpand\dpthimport{\the\toks0 }\noexpand\dpthimport }% - }% - \fi - \else% - \def\pgfretval{#1#2}% - \fi + \ifcat\noexpand#1\relax + \if@filesw + {\toks0={#1#2}% + \immediate\write\@auxout{\noexpand\def\noexpand\dpthimport{\the\toks0 }\noexpand\dpthimport }% + }% + \fi + \else% + \def\pgfretval{#1#2}% + \fi }% + |