random LaTeX stuff
This commit is contained in:
parent
091a95ef05
commit
29dbca65ee
129 changed files with 133210 additions and 0 deletions
1
texmf/tex/latex/pgfplots/INSTALL
Normal file
1
texmf/tex/latex/pgfplots/INSTALL
Normal file
|
@ -0,0 +1 @@
|
|||
Please search for pgfplots.tds.zip and install that one into a local texmf branch (which is typically simpler). This release is intended to satisfy CTAN package browsing policies.
|
267
texmf/tex/latex/pgfplots/README
Normal file
267
texmf/tex/latex/pgfplots/README
Normal file
|
@ -0,0 +1,267 @@
|
|||
pgfplots - Create normal/logarithmic plots in two and three dimensions for LaTeX/TeX/ConTeXt.
|
||||
|
||||
pgfplotstable - Loads, rounds, formats and postprocesses numerical tables.
|
||||
|
||||
PGFPlots draws high--quality function plots in normal or logarithmic scaling
|
||||
with a user-friendly interface directly in TeX. The user supplies axis labels,
|
||||
legend entries and the plot coordinates for one or more plots and PGFPlots
|
||||
applies axis scaling, computes any logarithms and axis ticks and draws the
|
||||
plots. It supports line plots, scatter plots, piecewise constant plots, bar
|
||||
plots, area plots, mesh-- and surface plots, patch plots, contour plots, quiver
|
||||
plots, histogram plots, polar axes, ternary diagrams, smith charts and some
|
||||
more.
|
||||
|
||||
Pgfplots is based on Till Tantau's package PGF/TikZ (pgf).
|
||||
|
||||
Pgfplotstable displays numerical tables rounded to desired precision in various
|
||||
display formats, for example scientific format, fixed point format or integer,
|
||||
using TeX's math facilities for pretty printing. Furthermore, it provides
|
||||
methods for table postprocessing.
|
||||
|
||||
Please take a look at
|
||||
doc/latex/pgfplots/pgfplots.pdf
|
||||
and
|
||||
doc/latex/pgfplots/pgfplotstable.pdf.
|
||||
|
||||
Copyright 2007-2014 by Christian Feuersaenger.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
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/>.
|
||||
|
||||
|
||||
HISTORY:
|
||||
1.11: usability + bug fixes.
|
||||
- new feature: "hide obscured x ticks=false" to disable the feature which hides ticks
|
||||
- simplified UI for symbolic coords: now, it accepts unexpandable
|
||||
dictionary entries including umlauts, undefined macros, math mode, ...
|
||||
- simplified UI for symbolic coords: added magic prefix
|
||||
[normalized]<number> to allow something like xmin={[normalized]0.7}
|
||||
- simplified UI for custom annotations: one does not need to say "axis cs" any longer;
|
||||
coordinates like (1,2) are now automatically interpreted as (axis cs:1,2)
|
||||
- new feature: 'type ticklabels with struts' improves baseline alignment of tick labels
|
||||
- new feature: 'trig format plots=rad' allows to use radians in trigonometric evaluations
|
||||
- simplified 'external lib': added driver auto-detection for pdflatex, lualatex, xelatex, dvips
|
||||
(\usepgfplotslibrary{external}, or, with the next PGF release, \usetikzlibrary{external})
|
||||
- simplified UI for \addplot coordinates: now, it expands macros as it goes.
|
||||
- new feature: 'intersection segments' now accepts negative indices to count from the last backwards
|
||||
- simplified UI: 'intersection segments' now accepts new syntax with 1-based indices (old 0-based are still supported)
|
||||
- fixed bug: fillbetween has had a problem with pins on input paths
|
||||
- fixed bug: now, 'stacked ignores zero' is no longer applied to error bars.
|
||||
- fixed bug: tick lines were drawn incorrectly for centered axis lines in 3d
|
||||
- fixed bug: variable=u failed to work in some contexts
|
||||
- fixed bug: fill between implicitly activated layers, but did not install the
|
||||
correct layers for grid lines etc.
|
||||
- fixed bug: z grid style was applied to y grid style
|
||||
- fixed bug: using 'x=1cm' failed to work in axis descriptions (legends)
|
||||
- fixed bug: mesh legend failed to work with 'shader=interp'
|
||||
- fixed bug: bounding box of shader=interp was wrong if there were transformations.
|
||||
- fixed bug: added support for \addplot graphics in ConTeXt
|
||||
- fixed bug: external lib failed to work with dvips (since PGF 3.0.0 I suppose); now it produces correct bounding boxes
|
||||
- fixed bug: \pgfplotstablenew can now overwrite existing tables.
|
||||
- fixed bug: extra ticks near intersections of axis lines were hidden
|
||||
- fixed bug: 'intersection segments' did not work with '--cycle'
|
||||
- fixed bug: 'intersection segments' did not update the last tikz point
|
||||
- fixed bug: tick lines/grid lines have been clipped when they were near the boundary
|
||||
- fixed bug: soft clip decoration failed to apply the transformation matrix
|
||||
- fixed bug: polar axes and units library resulted in broken bounding box
|
||||
- fixed bug: \addplot[stack plots=false] used to work up to 1.8, but failed until now. Fixed.
|
||||
- fixed bug: hist/density was broken since some time
|
||||
|
||||
|
||||
1.10:
|
||||
- new feature: fill between plots (library fillbetween)
|
||||
- new feature: concatenate intersection segments (library fillbetween)
|
||||
- fixed bug: xelatex failed to run contour external
|
||||
- fixed incompatibility with \label and \usepackage{mcaption}
|
||||
- fixed bug: histograms produced wrong point meta
|
||||
- fixed bug: histograms reported the wrong 'plot name' and confused shifts of bar plots
|
||||
|
||||
1.9:
|
||||
- new feature: asymmetric error bars
|
||||
- new feature: activated math parser for axis limit arguments, arguments in axis cs, and domain argument in log plots
|
||||
- new feature: stacked bar plots place their 'nodes near coords' correctly in the middle and print the increment (compat=1.9)
|
||||
- new feature: stacked bar plots suppress empty increments (compat=1.9).
|
||||
- new feature: 'scatter/position=relative|absolute' allow to position 'nodes near coords' absolutely.
|
||||
use-case: bar plots + nodes near coords which are at, say, y=0 rather than their y value
|
||||
- new feature: integration of smooth shadings & auto-CMYK conversion
|
||||
\usepackage[cmyk]{xcolor} or \selectcolormodel{cmyk} will reconfigure pgfplots to use CMYK (document-wide)
|
||||
- new feature (advanced audience only): programmatic access to data coordinates during the visualization phase
|
||||
-> allows much more customization for error bars, stacked plots, nodes near coords.
|
||||
- wrote beginner tutorials
|
||||
- fixed bug: error bars and point meta did not work together
|
||||
- fixed bug: stacked plots did not respect 'visualization depends on'
|
||||
- fixed bug: luatex 0.76 is not backwards compatible; added version switch
|
||||
- fixed bug: ternary library precision has been improved
|
||||
- fixed bug: problem with axis limits very close to 0
|
||||
- fixed bug: colormap specification limit case produced out of bounds exception
|
||||
|
||||
|
||||
1.8:
|
||||
- new feature: tight bounding box even if the axis is no box and bb excludes clip path
|
||||
- new feature: mesh/color input=explicit
|
||||
- new feature: shader=interp now has drivers for both dvipdfmx and xetex
|
||||
- new feature: support for more color spaces in colormap definitions
|
||||
- new feature: shader=interp and device-level gray colorspaces
|
||||
- new feature: 'contour/contour dir=[xyz]' to draw contours in different directions
|
||||
- new feature: statistics library with boxplot handler (both boxplot prepared and automatic computation)
|
||||
- fixed bug: 3d centered axis lines and label placement (requires compat=1.8 or higher)
|
||||
- fixed bug: axis lines and placement of labels, tick scale labels, and reversed axes
|
||||
(requires compat=1.8 or higher)
|
||||
- fixed bug: filtering out coords from a mesh plot failed
|
||||
- fixed bug: every legend image post was not respected inside of \ref{plotlabel}
|
||||
- fixed bug: high-order patches computed the shader=flat mean in a wrong way.
|
||||
- fixed bug: remember picture inside of pgfplots axes failed (due to cell picture)
|
||||
- fixed bug: now, the tick scale label will be omitted if there are no ticks
|
||||
- fixed bug: axis box path was not closed
|
||||
- fixed bug: the bounding box was non-empty even if the axis was hidden.
|
||||
- fixed bug: auto-alignment of nodes near coords failed for xbar plots
|
||||
- fixed bug: providing bar width / bar shift in terms of axis units did
|
||||
not work with [xy]bar and nodes near coords
|
||||
- fixed bug: transformation 'data cs=cart' -> polar is more robust now
|
||||
- fixed bug: code did not compile against pgf 2.00
|
||||
- fixed bug: patch plot lib and shader=interp,patch type=biquadratic
|
||||
- fixed bug: context path searching issue (pgfplots.lua)
|
||||
- fixed bug: shader=interp and dvips driver
|
||||
- fixed bug: error bars with explicit relative input failed
|
||||
|
||||
1.7
|
||||
- added feature: 'bar shift' and 'bar width' can now be expressed in terms of axis units (compat=1.7 or higher)
|
||||
- fixed incompatibility regression pgfplots 1.6.1 pgf 2.10: layers
|
||||
- fixed incompatibility pgfplots and imakeidx
|
||||
- added feature: 'enlargelimits={abs=1cm}', i.e. enlarge by dimension rather than unit
|
||||
- patchplots lib: added patch type=bicubic
|
||||
- patchplots lib: added support for global paths (fillable)
|
||||
- patchplots lib: added patch type sampling feature
|
||||
- patchplots lib: improved usability (documentation and improvements)
|
||||
- fixed path issues in context: moved lua input file to tex/generic
|
||||
- fixed bug: \ref{legendimage} inside of legend text was wrong.
|
||||
|
||||
1.6.1:
|
||||
- fixed incompatibility lualatex,shader=interp, and german package (introduced in 1.6)
|
||||
|
||||
1.6:
|
||||
- added support for layered graphics (main use case: multiple axes and layers)
|
||||
- added support for second colormap in mesh plots (mesh/interior colormap name)
|
||||
- added support for scopes inside of axes
|
||||
- contour plots: added ability to provide list of discrete labels (mesh/levels)
|
||||
- empty lines are interpreted as interruptions in data plots (was undocumented since 1.4)
|
||||
- added more scaling options to 'scale mode=scale uniformly' (affects axis equal in 3d
|
||||
and \addplot3 graphics)
|
||||
- fixed wrong implementation of 'axis equal' and 'unit vector ratio' in 3d
|
||||
(backwards compatible for 2d, but not for 3d - the 3d implementation was plain wrong)
|
||||
- fixed incompatibility of lualatex and shader=interp
|
||||
- fixed bugs/added features around \addplot3 graphics
|
||||
- fixed bug: colorbar did not support ymode=log
|
||||
- fixed a couple of minor bugs
|
||||
- fixed bounding box computation for clip=false,axis lines=none
|
||||
|
||||
1.5.1:
|
||||
- more operations for FPU library (==, !=,<=,>=,?)
|
||||
- fixed bug in usage of decorations in \addplot
|
||||
- bugfix for contour prepared format=matlab
|
||||
- added 'const plot mark mid' and 'jump mark mid' plot handlers
|
||||
- nodes on a plot (\addplot ... node[pos=<fraction>] {};)
|
||||
- 'trim axis group left' and 'trim axis group right'
|
||||
- bugfixes for polar axes and log+stacked plots
|
||||
- added style 'log ticks with fixed point'
|
||||
- introduced patched tikz paths to simplify circles and ellipses within an axis
|
||||
- patchplots lib: patch type=polygon
|
||||
- some more bugfixes
|
||||
|
||||
1.5:
|
||||
- Contour plots,
|
||||
- Histograms,
|
||||
- Quiver plots,
|
||||
- patch plots (library)
|
||||
- Triangle Meshes
|
||||
- Bilinear Elements
|
||||
- Quadratic Triangles
|
||||
- Biquadratic Quadrilaterals
|
||||
- Coons Patches
|
||||
- Discrete colorbars,
|
||||
- Table sorting,
|
||||
- Linear regression,
|
||||
- Ternary diagrams,
|
||||
- Tieline Plots
|
||||
- Smith Charts
|
||||
- Polar axes,
|
||||
- Empty lines in input files result in interrupted plots,
|
||||
- PDF user defined coordinate mouse popups
|
||||
- CMYK colormaps and shadings,
|
||||
- new markers and cycle lists
|
||||
- access to axis limits,
|
||||
- \addplot3 graphics: pgfplots draws an appropriate axis for a three-dimensional(!) external png graphics
|
||||
- 3D axes: support to provide explicit unit vectors:
|
||||
- explicit unit vectors
|
||||
- explicit unit vectors which are uniformly rescaled to match width/height
|
||||
- 3D axes: improved support for unit vector ratios
|
||||
- improvements of the groupplot styles
|
||||
- preliminary support for (2d) bar plots in 3d axes
|
||||
- new shader 'faceted interp'
|
||||
- table package:
|
||||
- 'every nth row' style
|
||||
- 'comment chars' key to define comment characters in input files
|
||||
- 'skip first n' style
|
||||
- lots of smaller bugfixes (see ChangeLog for details)
|
||||
|
||||
|
||||
1.4.1:
|
||||
- improved compatibility to gnuplot 4.4
|
||||
|
||||
1.4:
|
||||
Version 1.4 contains several new features, mostly work on details.
|
||||
It fixes many bugs and provides the following improvements:
|
||||
- detached legends
|
||||
- detached colorbars
|
||||
- ybar (and similar plots) can now be mixed with other plot types
|
||||
like line plots.
|
||||
- improved legend formatting
|
||||
- added 'restrict x to domain*' which cups coordinates outside of a specified domain (same for y and z)
|
||||
- Added support for linear regression
|
||||
- Inline tables,
|
||||
- Lots of bug fixes
|
||||
|
||||
The next version will make a greater step when it is stable.
|
||||
|
||||
|
||||
1.3.1:
|
||||
Version 1.3.1 is a bugfix release containing
|
||||
- improved parametric plots with gnuplot
|
||||
- improved normalsize, small and footnotesize scale styles and added tiny
|
||||
- a lot of bugfixes
|
||||
|
||||
1.3:
|
||||
- improvements for two dimensional visualization, among them
|
||||
- axis equal,
|
||||
- color bars,
|
||||
- nodes near coords,
|
||||
- jumps in plots,
|
||||
- improved description positioning,
|
||||
- reverseable axis directions,
|
||||
- simpler alignment of adjacent axes,
|
||||
- units and a simplified user interface,
|
||||
- new three dimensional line, scatter, mesh and surface plots,
|
||||
- a copy of the automatic pdf externalization library,
|
||||
- an improved manual enhanced with a lot of pdf cross references.
|
||||
|
||||
1.2.2:
|
||||
- fixed a problem with the samples key,
|
||||
- provides some smaller fixes and some manual improvements.
|
||||
- added plot graphics.
|
||||
|
||||
1.2:
|
||||
- completely rewritten math expression parser with extended data range,
|
||||
- colormaps for scatter plots
|
||||
- fine tuning for plot parameters.
|
||||
- table package has been extended and is now a fully featured table typesetting, computing and postprocessing tool.
|
||||
|
429
texmf/tex/latex/pgfplots/bugtracker.sty
Normal file
429
texmf/tex/latex/pgfplots/bugtracker.sty
Normal file
|
@ -0,0 +1,429 @@
|
|||
%--------------------------------------------------
|
||||
% Provides a simple, text-based bug tracker.
|
||||
%
|
||||
% Idea: simply write a text-todo list into a tex file, and write
|
||||
% trivial support macros which allow to provide priorities, status
|
||||
% flags and sorting capabilities. Sort key:
|
||||
% (section,isactive,priority). Can be processed with pgfplotstable.
|
||||
% Could also support the codeexample environment of pgfmanual.
|
||||
% -> Advantages:
|
||||
% - simple human readable text files (I like that!)
|
||||
% - independent of any tool
|
||||
% - can be sorted
|
||||
% UI:
|
||||
% \begin{feature}[<status>][prio=<num>]
|
||||
% <text>
|
||||
% \end{feature}
|
||||
%
|
||||
% \begin{bug}[<status>][prio=<num>]
|
||||
% <text>
|
||||
% \end{bug}
|
||||
% Idea: collect *all* entries in one huge array, then sort this array, then
|
||||
% typeset the result. Should work reasonably, I guess. If it is too slow,
|
||||
% typeset directly.
|
||||
%--------------------------------------------------
|
||||
%
|
||||
\ProvidesPackage{bugtracker}[2010/07/23 Version 0.1]
|
||||
|
||||
\RequirePackage{pgfplotstable}
|
||||
\RequirePackage{listings}
|
||||
\RequirePackage{hyperref}
|
||||
|
||||
\ifx\scantokens\@undefined
|
||||
\PackageError{pgfmanual-macros}{You need to use extended latex
|
||||
(elatex) or (pdfelatex) to process this document}{}
|
||||
\fi
|
||||
|
||||
\def\bugtracker@init@items{%
|
||||
}%
|
||||
|
||||
{
|
||||
\catcode`\[=1
|
||||
\catcode`\]=2
|
||||
\catcode`\{=12
|
||||
\catcode`\}=12
|
||||
\gdef\bugtracker@lbrace[{]
|
||||
\gdef\bugtracker@rbrace[}]
|
||||
]
|
||||
{
|
||||
\catcode`\|=0
|
||||
|catcode`\\=12
|
||||
|gdef|bugtracker@bslash{\}
|
||||
}
|
||||
|
||||
% #1: the environment (item) name
|
||||
% #2: the sort order (an integer)
|
||||
\def\declarebugtrackeritem#1#2{%
|
||||
\expandafter\def\expandafter\bugtracker@init@items\expandafter{%
|
||||
\bugtracker@init@items
|
||||
\expandafter\gdef\csname c@bugtracker@#1\endcsname{0}%
|
||||
}%
|
||||
\expandafter\edef\csname bugtracker@end@#1\endcsname{\bugtracker@bslash end\bugtracker@lbrace #1\bugtracker@rbrace}%
|
||||
\expandafter\def\csname #1\endcsname{\bugtracker@collect{#1}}%
|
||||
\expandafter\def\csname end#1\endcsname{\relax}%
|
||||
\pgfkeyssetvalue{/bugtracker/sort order/#1}{#2}%
|
||||
}%
|
||||
|
||||
\newif\ifbugtracker@sort
|
||||
|
||||
\newenvironment{bugtracker}{%
|
||||
\let\bugtracker@enqueue=\bugtracker@enqueue@ACTIVE
|
||||
\pgfplotsarraynewemptyglobal\bugtrackeritems
|
||||
}{%
|
||||
\ifbugtracker@sort
|
||||
\begingroup
|
||||
\pgfkeyslet{/pgfplots/iflessthan/.@cmd}\bugtracker@iflessthan
|
||||
\pgfkeysdef{/pgfplots/array/unscope pre}{\bugtracker@typeset}%
|
||||
\pgfkeysdef{/pgfplots/array/unscope post}{}%
|
||||
\pgfplotsarraysort\bugtrackeritems
|
||||
\endgroup
|
||||
\else
|
||||
\bugtracker@typeset
|
||||
\fi
|
||||
}%
|
||||
|
||||
\def\bugtrackerset{\pgfqkeys{/bugtracker}}%
|
||||
|
||||
|
||||
\def\bugtracker@collect#1{%
|
||||
\pgfutil@ifnextchar[{%
|
||||
\bugtracker@collect@status{#1}%
|
||||
}{%
|
||||
\bugtracker@collect@status{#1}[open]%
|
||||
}%
|
||||
}%
|
||||
\def\bugtracker@collect@status#1[#2]{%
|
||||
\pgfutil@ifnextchar[{%
|
||||
\bugtracker@collect@status@opt{#1}[#2]%
|
||||
}{%
|
||||
\bugtracker@collect@status@opt{#1}[#2][]%
|
||||
}%
|
||||
}%
|
||||
\def\bugtracker@collect@status@opt#1[#2][#3]{%
|
||||
\begingroup
|
||||
\bugtrackerset{#2,#3}%
|
||||
\expandafter\let\expandafter\bugtracker@temp\csname bugtracker@end@#1\endcsname
|
||||
\expandafter\long\expandafter\def\expandafter\bugtracker@collect@until\expandafter##\expandafter1\bugtracker@temp{\bugtracker@enqueue{#1}{##1}}%
|
||||
\bugtracker@prepare@collect
|
||||
\bugtracker@collect@until
|
||||
}%
|
||||
|
||||
|
||||
\def\bugtracker@prepare@collect{%
|
||||
\def\do##1{\catcode`##1=12 }\dospecials
|
||||
\catcode`\^^M=12
|
||||
\catcode`\^^J=12
|
||||
\catcode`\^^I=12
|
||||
}%
|
||||
|
||||
\def\bugtracker@restore@catcodes{%
|
||||
\catcode`\^^M=5
|
||||
\catcode`\^^J=10
|
||||
\catcode`\^^I=10
|
||||
% this is important to get \scantokens to work: otherwise, it will
|
||||
% eat up the ^^M chars:
|
||||
\endlinechar=`\^^M
|
||||
\newlinechar=\endlinechar
|
||||
}%
|
||||
|
||||
\long\def\bugtracker@enqueue#1#2{%
|
||||
\edef\bugtracker@status@order{\pgfkeysvalueof{/bugtracker/status order/\bugtracker@status}}%
|
||||
\ifx\bugtracker@status@order\pgfutil@empty
|
||||
% status order/<status name>={} --> do not display it!
|
||||
\else
|
||||
\toks0={#2}%
|
||||
% some of these values are used during the sort procedure; that's
|
||||
% why they are not simply a list of keys. Perhaps they should
|
||||
% still be a list of keys...
|
||||
\edef\bugtracker@entry{{#1}{\bugtracker@status}{\pgfkeysvalueof{/bugtracker/prio}}{\the\toks0}{\the\inputlineno}{\pgfkeysvalueof{/bugtracker/epic}}}%
|
||||
\expandafter\pgfplotsarraypushbackglobal\expandafter{\bugtracker@entry}\to\bugtrackeritems
|
||||
\fi
|
||||
\endgroup
|
||||
\end{#1}%
|
||||
}%
|
||||
\let\bugtracker@enqueue@ACTIVE=\bugtracker@enqueue
|
||||
\long\def\bugtracker@enqueue#1#2{%
|
||||
\PackageError{bugtracker}{Sorry, bug tracker elements can only be used inside of \string\begin{bugtracker} ... \string\end{bugtracker}. Discarding this element}{}%
|
||||
}%
|
||||
|
||||
\long\def\bugtracker@unpack#1#2#3#4#5#6{%
|
||||
\bugtrackerset{name={#1},status=#2,prio=#3,source line={#5},epic={#6}}%
|
||||
\def\bugtracker@content{#4}%
|
||||
}%
|
||||
|
||||
\long\def\bugtracker@unpack@sorting#1#2#3#4#5#6{%
|
||||
\edef\bugtracker@name {\pgfkeysvalueof{/bugtracker/sort order/#1}}%
|
||||
\edef\bugtracker@status{\pgfkeysvalueof{/bugtracker/status order/#2}}%
|
||||
\def\bugtracker@prio{#3}%
|
||||
\def\bugtracker@source{#5}%
|
||||
}%
|
||||
\def\bugtracker@iflessthan#1#2#3#4\pgfeov{%
|
||||
\expandafter\bugtracker@unpack@sorting#1%
|
||||
\let\bugtracker@nameA=\bugtracker@name
|
||||
\let\bugtracker@statusA=\bugtracker@status
|
||||
\let\bugtracker@prioA=\bugtracker@prio
|
||||
\let\bugtracker@sourceA=\bugtracker@source
|
||||
%
|
||||
\expandafter\bugtracker@unpack@sorting#2%
|
||||
%
|
||||
\def\bugtracker@lt{0}%
|
||||
\ifnum\bugtracker@nameA<\bugtracker@name
|
||||
\def\bugtracker@lt{1}%
|
||||
\else
|
||||
\ifnum\bugtracker@nameA=\bugtracker@name
|
||||
\ifnum\bugtracker@statusA<\bugtracker@status
|
||||
\def\bugtracker@lt{1}%
|
||||
\else
|
||||
\ifnum\bugtracker@statusA=\bugtracker@status
|
||||
\ifnum\bugtracker@prioA>\bugtracker@prio
|
||||
\def\bugtracker@lt{1}%
|
||||
\else
|
||||
\ifnum\bugtracker@prioA=\bugtracker@prio
|
||||
\ifnum\bugtracker@sourceA<\bugtracker@source
|
||||
\def\bugtracker@lt{1}%
|
||||
%\else
|
||||
%\ifnum\bugtracker@sourceA=\bugtracker@source
|
||||
%\fi
|
||||
\fi
|
||||
\fi
|
||||
\fi
|
||||
\fi
|
||||
\fi
|
||||
\fi
|
||||
\fi
|
||||
\if1\bugtracker@lt #3\else #4\fi
|
||||
}%
|
||||
|
||||
|
||||
\long\def\bugtracker@typeset@#1#2{%
|
||||
\pgfkeysvalueof{/bugtracker/typeset/.@cmd}{#1}{#2}\pgfeov
|
||||
}%
|
||||
|
||||
\def\bugtracker@typeset{%
|
||||
\let\minimal=\bugtracker@minimal@env
|
||||
\def\endminimal{\relax}%
|
||||
%
|
||||
\pgfkeysvalueof{/bugtracker/font}%
|
||||
\bugtracker@init@items
|
||||
\gdef\bugtracker@isfirst{1}%
|
||||
\pgfplotsarrayforeach\bugtrackeritems\as\entry{%
|
||||
\if1\bugtracker@isfirst
|
||||
\else
|
||||
\vskip\pgfkeysvalueof{/bugtracker/vskip}
|
||||
\fi
|
||||
\expandafter\bugtracker@unpack\entry
|
||||
%
|
||||
\edef\c@bugtracker{\csname c@bugtracker@\pgfkeysvalueof{/bugtracker/name}\endcsname}%
|
||||
\expandafter\pgfplotsutil@advancestringcounter@global\csname c@bugtracker@\pgfkeysvalueof{/bugtracker/name}\endcsname
|
||||
%
|
||||
\message{bugtracker: processing \jobname.tex:\pgfkeysvalueof{/bugtracker/source line}...^^J}%
|
||||
\begingroup
|
||||
\bugtracker@restore@catcodes
|
||||
\expandafter\bugtracker@typeset@\expandafter{\expandafter\scantokens\expandafter{\bugtracker@content}}{\c@bugtracker}%%
|
||||
\endgroup
|
||||
\gdef\bugtracker@isfirst{0}%
|
||||
}%
|
||||
}%
|
||||
|
||||
\bugtrackerset{
|
||||
sort/.is if=bugtracker@sort,
|
||||
sort=true,
|
||||
name/.initial=,
|
||||
typeset name/.code={%
|
||||
\pgfkeysifdefined{/bugtracker/name text/#1}{%
|
||||
\pgfkeysvalueof{/bugtracker/name text/#1}%
|
||||
}{%
|
||||
#1%
|
||||
}%
|
||||
},
|
||||
prio/.initial=5,
|
||||
epic/.initial=,
|
||||
source line/.initial=,
|
||||
status/.is choice,
|
||||
status/open/.code= {\def\bugtracker@status{open}},
|
||||
status/closed/.code= {\def\bugtracker@status{closed}},
|
||||
status/cancelled/.code= {\def\bugtracker@status{cancelled}},
|
||||
status/partially/.code= {\def\bugtracker@status{partially}},
|
||||
status/-/.style= {/bugtracker/status/open},
|
||||
status/+/.style= {/bugtracker/status/closed},
|
||||
status/X/.style= {/bugtracker/status/cancelled},
|
||||
status=open,
|
||||
% status order/<statusname>/.initial=int . Empty means:
|
||||
% do not display it at all.
|
||||
status order/open/.initial=0,
|
||||
status order/closed/.initial=,%10,
|
||||
status order/cancelled/.initial=7,
|
||||
status order/partially/.initial=1,
|
||||
shell escape/.initial=-shell-escape,
|
||||
prefix/.initial=\jobname-,
|
||||
file ext/.initial=pdf,
|
||||
system call/.initial={pdflatex \bugtracker@checkshellescape -halt-on-error -interaction=batchmode -jobname "\image" "\texsource"},
|
||||
vskip/.initial=\baselineskip,
|
||||
font/.initial={%
|
||||
\parindent=0pt
|
||||
\raggedright
|
||||
},
|
||||
% #1: a running index.
|
||||
typeset id/.code={%
|
||||
\begin{minipage}[t]{3cm}%
|
||||
\raggedleft
|
||||
%[\##1]\par
|
||||
{\ttfamily \jobname.tex:\pgfkeysvalueof{/bugtracker/source line}}
|
||||
\end{minipage}
|
||||
},
|
||||
typeset/.code 2 args={%
|
||||
\noindent
|
||||
\paragraph{%
|
||||
\protect\llap{\normalfont\scriptsize \protect\bugtrackerset{/bugtracker/typeset id=#2}\hspace{2em}}%
|
||||
\protect\bugtrackerset{/bugtracker/typeset name={\pgfkeysvalueof{/bugtracker/name}}}
|
||||
% \##2
|
||||
}
|
||||
[\bugtracker@status, Priority \pgfkeysvalueof{/bugtracker/prio}, Epic `\pgfkeysvalueof{/bugtracker/epic}']
|
||||
\vskip4pt
|
||||
{%
|
||||
\noindent
|
||||
\parskip=\baselineskip
|
||||
#1%
|
||||
\par
|
||||
}%
|
||||
%{\scriptsize Entry in {\ttfamily \jobname.tex:\pgfkeysvalueof{/bugtracker/source line}}}%
|
||||
},%
|
||||
typeset minimal/.code={%
|
||||
\ifvmode
|
||||
\noindent
|
||||
\fi
|
||||
\href{file:\bugtracker@minimal@filename@}{[\textcolor{blue}{see \texttt{\filename}}]}%
|
||||
\bugtracker@minimal@typeset@{#1}%
|
||||
},
|
||||
.unknown/.code={%
|
||||
\edef\bugtracker@tempkey{\noexpand\pgfkeysalso{/bugtracker/status=\pgfkeyscurrentname}}%
|
||||
\bugtracker@tempkey
|
||||
},
|
||||
}
|
||||
|
||||
\declarebugtrackeritem{feature}{10}
|
||||
\declarebugtrackeritem{bug}{5}
|
||||
\declarebugtrackeritem{doctodo}{0}
|
||||
|
||||
\bugtrackerset{
|
||||
name text/feature/.initial=Feature Proposal,
|
||||
name text/bug/.initial=Bug,
|
||||
name text/doctodo/.initial=Documentation Todo,
|
||||
}
|
||||
|
||||
|
||||
\lstdefinestyle{minimalexample}{
|
||||
basicstyle=\ttfamily\footnotesize,
|
||||
columns=fullflexible,
|
||||
}
|
||||
|
||||
|
||||
% a
|
||||
% \begin{minimal}
|
||||
% \end{minimal}
|
||||
% environment which is executed automatically :
|
||||
\newcount\c@bugtracker@minimal
|
||||
\c@bugtracker@minimal=0
|
||||
|
||||
\def\bugtracker@minimal@env{%
|
||||
\begingroup
|
||||
\bugtracker@prepare@collect
|
||||
\bugtracker@minimal@collect
|
||||
}%
|
||||
\expandafter\edef\csname bugtracker@temp\endcsname{\bugtracker@bslash end\bugtracker@lbrace minimal\bugtracker@rbrace}%
|
||||
\expandafter\long\expandafter\def\expandafter\bugtracker@minimal@collect\expandafter#\expandafter1\bugtracker@temp{%
|
||||
\endgroup
|
||||
\edef\bugtracker@minimal@filename{\pgfkeysvalueof{/bugtracker/prefix}\the\c@bugtracker@minimal}%
|
||||
\edef\bugtracker@minimal@filename@{\bugtracker@minimal@filename.\pgfkeysvalueof{/bugtracker/file ext}}%
|
||||
\global\advance\c@bugtracker@minimal by1
|
||||
%
|
||||
\IfFileExists{\bugtracker@minimal@filename@}{}{%
|
||||
\bugtracker@minimal@create{#1}%
|
||||
}%
|
||||
\bugtracker@minimal@typeset{#1}%
|
||||
\end{minimal}%
|
||||
}%
|
||||
\long\def\bugtracker@minimal@typeset#1{%
|
||||
\begingroup
|
||||
\pgfplotscommandtostring\bugtracker@minimal@filename@\filename
|
||||
\bugtracker@restore@catcodes
|
||||
\edef\bugtracker@temp##1{%
|
||||
\bugtracker@bslash begin{lstlisting}[style=minimalexample]%
|
||||
##1%
|
||||
\bugtracker@bslash end{lstlisting}%
|
||||
}%
|
||||
\def\bugtracker@temp@##1{\pgfkeysvalueof{/bugtracker/typeset minimal/.@cmd}{##1}\pgfeov}%
|
||||
\expandafter\bugtracker@temp@\expandafter{\bugtracker@temp{#1}}%
|
||||
\endgroup
|
||||
}%
|
||||
\long\def\bugtracker@minimal@typeset@#1{%
|
||||
\scantokens{#1}%
|
||||
}%
|
||||
\long\def\bugtracker@minimal@create#1{%
|
||||
%
|
||||
\immediate\openout\w@pgf@writea=\bugtracker@minimal@filename\relax
|
||||
\immediate\write\w@pgf@writea{#1}%
|
||||
\immediate\closeout\w@pgf@writea
|
||||
%
|
||||
\bugtracker@assemble@systemcall\bugtracker@minimal@filename\bugtracker@temp
|
||||
\message{Issuing system-call^^J$ \bugtracker@temp^^J}%
|
||||
\immediate\write18{\bugtracker@temp}%
|
||||
\IfFileExists{\bugtracker@minimal@filename@}{}{%
|
||||
\PackageError{bugtracker}{Sorry, the system call '\bugtracker@temp' did NOT result in a usable output file '\bugtracker@minimal@filename@' (adjust '/bugtracker/file ext' if needed). 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 '\bugtracker@minimal@filename.log'}{}%
|
||||
}%
|
||||
}
|
||||
|
||||
{
|
||||
\catcode`\"=12
|
||||
\catcode`\'=12
|
||||
\catcode`\;=12
|
||||
\catcode`\&=12
|
||||
\catcode`\-=12
|
||||
\xdef\bugtracker@normal@dq{"}
|
||||
\xdef\bugtracker@normal@sq{'}
|
||||
\xdef\bugtracker@normal@semic{;}
|
||||
\xdef\bugtracker@normal@and{&}
|
||||
\xdef\bugtracker@normal@dash{-}
|
||||
\catcode`\"=13
|
||||
\catcode`\'=13
|
||||
\catcode`\;=13
|
||||
\catcode`\&=13
|
||||
\catcode`\-=13
|
||||
\gdef\bugtracker@activate@normal@dq{\let"=\bugtracker@normal@dq}
|
||||
\gdef\bugtracker@activate@normal@sq{\let'=\bugtracker@normal@sq}
|
||||
\gdef\bugtracker@activate@normal@semic{\let;=\bugtracker@normal@semic}
|
||||
\gdef\bugtracker@activate@normal@and{\let&=\bugtracker@normal@and}
|
||||
\gdef\bugtracker@activate@normal@dash{\let-=\bugtracker@normal@dash}
|
||||
\catcode`\|=0
|
||||
\catcode`\\=12
|
||||
|xdef|bugtracker@normal@backslash{\}%
|
||||
}
|
||||
% Creates the '/bugtracker/system call' command as string and
|
||||
% returns it into the (global!) macro #2.
|
||||
% #1: the output file name
|
||||
% #2: the global return value macro
|
||||
%
|
||||
\def\bugtracker@assemble@systemcall#1#2{%
|
||||
\begingroup
|
||||
\def\image{#1}%
|
||||
\let\texsource=\image
|
||||
\ifnum\the\catcode`\"=13 \bugtracker@activate@normal@dq\fi
|
||||
\ifnum\the\catcode`\'=13 \bugtracker@activate@normal@sq\fi
|
||||
\ifnum\the\catcode`\;=13 \bugtracker@activate@normal@semic\fi
|
||||
\ifnum\the\catcode`\-=13 \bugtracker@activate@normal@dash\fi
|
||||
\let\\=\bugtracker@normal@backslash
|
||||
\xdef#2{\pgfkeysvalueof{/bugtracker/system call}}%
|
||||
\endgroup
|
||||
}%
|
||||
|
||||
\pgfutil@ifundefined{pdfshellescape}{%
|
||||
\def\bugtracker@checkshellescape{}%
|
||||
}{%
|
||||
\ifnum\pdfshellescape=1
|
||||
\def\bugtracker@checkshellescape{\pgfkeysvalueof{/bugtracker/shell escape}\space}%
|
||||
\else
|
||||
\def\bugtracker@checkshellescape{}%
|
||||
\fi
|
||||
}%
|
||||
|
||||
\endinput
|
BIN
texmf/tex/latex/pgfplots/doc/TeX-programming-notes.pdf
Normal file
BIN
texmf/tex/latex/pgfplots/doc/TeX-programming-notes.pdf
Normal file
Binary file not shown.
BIN
texmf/tex/latex/pgfplots/doc/pgfplots.doc.src.tar.bz2
Normal file
BIN
texmf/tex/latex/pgfplots/doc/pgfplots.doc.src.tar.bz2
Normal file
Binary file not shown.
BIN
texmf/tex/latex/pgfplots/doc/pgfplots.pdf
Normal file
BIN
texmf/tex/latex/pgfplots/doc/pgfplots.pdf
Normal file
Binary file not shown.
BIN
texmf/tex/latex/pgfplots/doc/pgfplotsexample-context.pdf
Normal file
BIN
texmf/tex/latex/pgfplots/doc/pgfplotsexample-context.pdf
Normal file
Binary file not shown.
48
texmf/tex/latex/pgfplots/doc/pgfplotsexample-context.tex
Normal file
48
texmf/tex/latex/pgfplots/doc/pgfplotsexample-context.tex
Normal file
|
@ -0,0 +1,48 @@
|
|||
%% ConTeXt file
|
||||
|
||||
\usemodule[pgfplots]
|
||||
\pgfplotsset{compat=1.8}% <-- moves axis labels near ticklabels (respects tick label widths)
|
||||
|
||||
\starttext
|
||||
Using Con{\TeX}t.
|
||||
|
||||
\starttikzpicture
|
||||
\startloglogaxis
|
||||
\addplot coordinates {
|
||||
(1,1)
|
||||
(16,16)
|
||||
(32,64)
|
||||
};
|
||||
\stoploglogaxis
|
||||
\stoptikzpicture
|
||||
|
||||
\starttikzpicture
|
||||
\startloglogaxis[
|
||||
xlabel=Cost,
|
||||
ylabel=Error]
|
||||
\addplot coordinates {
|
||||
(5, 8.31160034e-02)
|
||||
(17, 2.54685628e-02)
|
||||
(49, 7.40715288e-03)
|
||||
(129, 2.10192154e-03)
|
||||
(321, 5.87352989e-04)
|
||||
(769, 1.62269942e-04)
|
||||
(1793, 4.44248889e-05)
|
||||
(4097, 1.20714122e-05)
|
||||
(9217, 3.26101452e-06)
|
||||
};
|
||||
\addplot coordinates {
|
||||
(7, 8.47178381e-02)
|
||||
(31, 3.04409349e-02)
|
||||
(111, 1.02214539e-02)
|
||||
(351, 3.30346265e-03)
|
||||
(1023, 1.03886535e-03)
|
||||
(2815, 3.19646457e-04)
|
||||
(7423, 9.65789766e-05)
|
||||
(18943, 2.87339125e-05)
|
||||
(47103, 8.43749881e-06)
|
||||
};
|
||||
\legend{Case 1,Case 2}
|
||||
\stoploglogaxis
|
||||
\stoptikzpicture
|
||||
\stoptext
|
BIN
texmf/tex/latex/pgfplots/doc/pgfplotsexample-plain.pdf
Normal file
BIN
texmf/tex/latex/pgfplots/doc/pgfplotsexample-plain.pdf
Normal file
Binary file not shown.
49
texmf/tex/latex/pgfplots/doc/pgfplotsexample-plain.tex
Normal file
49
texmf/tex/latex/pgfplots/doc/pgfplotsexample-plain.tex
Normal file
|
@ -0,0 +1,49 @@
|
|||
%% plain tex file
|
||||
|
||||
\def\pgfsysdriver{pgfsys-pdftex.def}
|
||||
\input pgfplots.tex
|
||||
\pgfplotsset{compat=1.8}% <-- moves axis labels near ticklabels (respects tick label widths)
|
||||
|
||||
Using plain-\TeX.
|
||||
|
||||
\tikzpicture
|
||||
\loglogaxis
|
||||
\addplot coordinates {
|
||||
(1,1)
|
||||
(16,16)
|
||||
(32,64)
|
||||
};
|
||||
\endloglogaxis
|
||||
\endtikzpicture
|
||||
|
||||
\tikzpicture
|
||||
\loglogaxis[
|
||||
xlabel=Cost,
|
||||
ylabel=Error]
|
||||
\addplot coordinates {
|
||||
(5, 8.31160034e-02)
|
||||
(17, 2.54685628e-02)
|
||||
(49, 7.40715288e-03)
|
||||
(129, 2.10192154e-03)
|
||||
(321, 5.87352989e-04)
|
||||
(769, 1.62269942e-04)
|
||||
(1793, 4.44248889e-05)
|
||||
(4097, 1.20714122e-05)
|
||||
(9217, 3.26101452e-06)
|
||||
};
|
||||
\addplot coordinates {
|
||||
(7, 8.47178381e-02)
|
||||
(31, 3.04409349e-02)
|
||||
(111, 1.02214539e-02)
|
||||
(351, 3.30346265e-03)
|
||||
(1023, 1.03886535e-03)
|
||||
(2815, 3.19646457e-04)
|
||||
(7423, 9.65789766e-05)
|
||||
(18943, 2.87339125e-05)
|
||||
(47103, 8.43749881e-06)
|
||||
};
|
||||
\legend{Case 1,Case 2}
|
||||
\endloglogaxis
|
||||
\endtikzpicture
|
||||
|
||||
\bye
|
BIN
texmf/tex/latex/pgfplots/doc/pgfplotsexample.pdf
Normal file
BIN
texmf/tex/latex/pgfplots/doc/pgfplotsexample.pdf
Normal file
Binary file not shown.
57
texmf/tex/latex/pgfplots/doc/pgfplotsexample.tex
Normal file
57
texmf/tex/latex/pgfplots/doc/pgfplotsexample.tex
Normal file
|
@ -0,0 +1,57 @@
|
|||
\documentclass[a4paper]{article}
|
||||
|
||||
% for dvipdfm:
|
||||
%\def\pgfsysdriver{pgfsys-dvipdfm.def}
|
||||
\usepackage{pgfplots}
|
||||
\pgfplotsset{compat=1.8}% <-- moves axis labels near ticklabels (respects tick label widths)
|
||||
|
||||
\begin{document}
|
||||
\begin{figure}
|
||||
\centering
|
||||
\begin{tikzpicture}
|
||||
\begin{loglogaxis}
|
||||
\addplot coordinates {
|
||||
(1,1)
|
||||
(16,16)
|
||||
(32,64)
|
||||
};
|
||||
\end{loglogaxis}
|
||||
\end{tikzpicture}
|
||||
\caption{A small example}
|
||||
\end{figure}
|
||||
|
||||
\begin{figure}
|
||||
\centering
|
||||
\begin{tikzpicture}
|
||||
\begin{loglogaxis}[
|
||||
xlabel=Cost,
|
||||
ylabel=Error]
|
||||
\addplot coordinates {
|
||||
(5, 8.31160034e-02)
|
||||
(17, 2.54685628e-02)
|
||||
(49, 7.40715288e-03)
|
||||
(129, 2.10192154e-03)
|
||||
(321, 5.87352989e-04)
|
||||
(769, 1.62269942e-04)
|
||||
(1793, 4.44248889e-05)
|
||||
(4097, 1.20714122e-05)
|
||||
(9217, 3.26101452e-06)
|
||||
};
|
||||
\addplot coordinates {
|
||||
(7, 8.47178381e-02)
|
||||
(31, 3.04409349e-02)
|
||||
(111, 1.02214539e-02)
|
||||
(351, 3.30346265e-03)
|
||||
(1023, 1.03886535e-03)
|
||||
(2815, 3.19646457e-04)
|
||||
(7423, 9.65789766e-05)
|
||||
(18943, 2.87339125e-05)
|
||||
(47103, 8.43749881e-06)
|
||||
};
|
||||
\legend{Case 1,Case 2}
|
||||
\end{loglogaxis}
|
||||
\end{tikzpicture}
|
||||
\caption{A larger example}
|
||||
\end{figure}
|
||||
|
||||
\end{document}
|
BIN
texmf/tex/latex/pgfplots/doc/pgfplotstable.pdf
Normal file
BIN
texmf/tex/latex/pgfplots/doc/pgfplotstable.pdf
Normal file
Binary file not shown.
BIN
texmf/tex/latex/pgfplots/doc/pgfplotstodo.pdf
Normal file
BIN
texmf/tex/latex/pgfplots/doc/pgfplotstodo.pdf
Normal file
Binary file not shown.
1393
texmf/tex/latex/pgfplots/libs/tikzlibrarypgfplots.clickable.code.tex
Normal file
1393
texmf/tex/latex/pgfplots/libs/tikzlibrarypgfplots.clickable.code.tex
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,24 @@
|
|||
%--------------------------------------------
|
||||
%
|
||||
% Package pgfplots, library for dynamic content in PDF files
|
||||
% (clickable plots)
|
||||
%
|
||||
% Copyright 2007/2008 by Christian Feuersänger.
|
||||
%
|
||||
% This program is free software: you can redistribute it and/or modify
|
||||
% 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/>.
|
||||
%
|
||||
%--------------------------------------------
|
||||
|
||||
\usetikzlibrary{pgfplots.clickable}
|
||||
\endinput
|
11221
texmf/tex/latex/pgfplots/pgfplots.code.tex
Normal file
11221
texmf/tex/latex/pgfplots/pgfplots.code.tex
Normal file
File diff suppressed because it is too large
Load diff
106
texmf/tex/latex/pgfplots/pgfplots.sty
Normal file
106
texmf/tex/latex/pgfplots/pgfplots.sty
Normal file
|
@ -0,0 +1,106 @@
|
|||
%--------------------------------------------
|
||||
%
|
||||
% Package pgfplots.sty
|
||||
%
|
||||
% 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-2013 by Christian Feuersänger.
|
||||
%
|
||||
% This program is free software: you can redistribute it and/or modify
|
||||
% 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/>.
|
||||
%
|
||||
%--------------------------------------------
|
||||
\IfFileExists{pgfplots.revision.tex}{\input pgfplots.revision.tex } {%
|
||||
\def\pgfplotsrevision{0}%
|
||||
\def\pgfplotsversion{0.0}%
|
||||
\def\pgfplotsversiondatetime{2014-07-01 00:00:00 +100}%
|
||||
\def\pgfplotsrevisiondatetime{2014-07-01 00:00:00 +100}%
|
||||
\def\pgfplotsversiondate{2014/07/01}%
|
||||
\def\pgfplotsrevisiondate{2014/07/01}%
|
||||
}
|
||||
\ProvidesPackage{pgfplots}[\pgfplotsversiondate\space v\pgfplotsversion\space Data Visualization (\pgfplotsrevision)]
|
||||
|
||||
% ATTENTION:
|
||||
% you MAY need one of
|
||||
% \def\pgfsysdriver{pgfsys-dvipdfm.def}
|
||||
% \def\pgfsysdriver{pgfsys-pdftex.def}
|
||||
% \def\pgfsysdriver{pgfsys-dvips.def}
|
||||
%
|
||||
% BEFORE the first \usepackage{pgf}, \usepackage{tikz} or
|
||||
% \usepackage{pgfplots}.
|
||||
% Default is
|
||||
% 'dvips' for 'latex'
|
||||
% 'pdftex' for 'pdflatex'
|
||||
% -> dvipdfm needs special attention.
|
||||
|
||||
\RequirePackage{tikz}
|
||||
|
||||
\def\pgfplots@texdist@protect{\protect}%
|
||||
|
||||
\input pgfplots.code.tex
|
||||
|
||||
|
||||
% checks for xcolor configuration options and will override
|
||||
% mesh/colorspace explicit color output
|
||||
% and
|
||||
% colormap default colorspace
|
||||
% if needed.
|
||||
\def\pgfplots@check@global@colorspace@overrides{%
|
||||
% "bOverridesColorspace"
|
||||
\pgfplots@loc@tmpfalse
|
||||
\ifconvertcolorsD
|
||||
% xcolor converts at *definition* time:
|
||||
\pgfplots@loc@tmptrue
|
||||
\else
|
||||
\ifconvertcolorsU
|
||||
% xcolor converts at *usage* time:
|
||||
\pgfplots@loc@tmptrue
|
||||
\fi
|
||||
\fi
|
||||
%
|
||||
\ifpgfplots@loc@tmp
|
||||
\let\pgfplots@loc@TMPb=\pgfutil@empty%
|
||||
\ifx\XC@tgt@mod\pgfplots@XC@tgt@mod@rgb \def\pgfplots@loc@TMPb{rgb}\fi
|
||||
\ifx\XC@tgt@mod\pgfplots@XC@tgt@mod@RGB \def\pgfplots@loc@TMPb{rgb}\fi
|
||||
\ifx\XC@tgt@mod\pgfplots@XC@tgt@mod@cmyk\def\pgfplots@loc@TMPb{cmyk}\fi
|
||||
\ifx\XC@tgt@mod\pgfplots@XC@tgt@mod@cmy \def\pgfplots@loc@TMPb{cmyk}\fi
|
||||
\ifx\XC@tgt@mod\pgfplots@XC@tgt@mod@gray \def\pgfplots@loc@TMPb{gray}\fi
|
||||
\ifx\XC@tgt@mod\pgfplots@XC@tgt@mod@Gray \def\pgfplots@loc@TMPb{gray}\fi
|
||||
%
|
||||
\ifx\pgfplots@loc@TMPb\pgfutil@empty
|
||||
\else
|
||||
\edef\pgfplots@loc@TMPa{%
|
||||
mesh/colorspace explicit color output=\pgfplots@loc@TMPb,%
|
||||
colormap default colorspace=\pgfplots@loc@TMPb,%
|
||||
}%
|
||||
\pgfplots@log3{Overriding colorspace to \pgfplots@loc@TMPb\space due to xcolor configuration.}%
|
||||
\expandafter\pgfplotsset\expandafter{\pgfplots@loc@TMPa}%
|
||||
\fi
|
||||
\fi
|
||||
}%
|
||||
|
||||
\def\pgfplots@XC@tgt@mod@rgb#1{rgb}
|
||||
\def\pgfplots@XC@tgt@mod@RGB#1{rgb}
|
||||
\def\pgfplots@XC@tgt@mod@cmyk#1{cmyk}
|
||||
\def\pgfplots@XC@tgt@mod@cmy#1{cmy}
|
||||
\def\pgfplots@XC@tgt@mod@gray#1{gray}
|
||||
\def\pgfplots@XC@tgt@mod@Gray#1{gray}
|
||||
|
||||
\usetikzlibrary{plotmarks}
|
||||
|
||||
|
||||
|
||||
\endinput
|
327
texmf/tex/latex/pgfplots/pgfplotscore.code.tex
Normal file
327
texmf/tex/latex/pgfplots/pgfplotscore.code.tex
Normal file
|
@ -0,0 +1,327 @@
|
|||
%--------------------------------------------
|
||||
%
|
||||
% Package pgfplots
|
||||
%
|
||||
% 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 by Christian Feuersänger.
|
||||
%
|
||||
% This program is free software: you can redistribute it and/or modify
|
||||
% 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/>.
|
||||
%
|
||||
%--------------------------------------------
|
||||
|
||||
\def\pgfplotsset#{\pgfqkeys{/pgfplots}}
|
||||
|
||||
% This is *identical* to \pgfutil@IfUndefined . I copied it here
|
||||
% because pgf up to and including version 2.10 does not contain it.
|
||||
\def\pgfplotsutil@IfUndefined#1{%
|
||||
\begingroup\expandafter\expandafter\expandafter\endgroup
|
||||
\expandafter\ifx\csname#1\endcsname\relax
|
||||
\expandafter\pgfutil@firstoftwo
|
||||
\else
|
||||
\expandafter\pgfutil@secondoftwo
|
||||
\fi
|
||||
}
|
||||
\pgfplotsutil@IfUndefined{pgfutil@IfUndefined}{\let\pgfutil@IfUndefined=\pgfplotsutil@IfUndefined}{}
|
||||
|
||||
|
||||
\def\pgfplots@log#1#2{\immediate\write-1{Package pgfplots info: #2}}%
|
||||
\def\pgfplots@error#1{\PackageError{pgfplots}{#1}{}}%
|
||||
\def\pgfplotstable@error@pkg#1{\PackageError{pgfplotstable}{#1}{}}%
|
||||
% DO NOT USE THIS METHOD DIRECTLY: use \pgfplotswarning{<warning name>}<args>\pgfeov
|
||||
\pgfplotsutil@IfUndefined{PackageWarning}{%
|
||||
\def\pgfplots@warning#1{\pgfplots@message{! Package pgfplots Warning:
|
||||
#1}}%
|
||||
}{%
|
||||
\def\pgfplots@warning#1{\PackageWarning{pgfplots}{#1}{}}%
|
||||
}%
|
||||
|
||||
\def\pgfplots@message#1{%
|
||||
\immediate\write16{#1}%
|
||||
}%
|
||||
|
||||
\pgfutil@IfUndefined{pgfkeys}{%
|
||||
\pgfplots@error{It seems your version of PGF/Tikz is older than 2.00. Unfortunately, pgfplots requires at least version 2.00 ... you may need to update your TeX-Distribution or install PGF manually, sorry}%
|
||||
}{\relax}
|
||||
|
||||
% Throws exception `#1' with arguments `#2'.
|
||||
%
|
||||
% #1 : the exception name
|
||||
% #2: all what comes after the exception name is considered to be argument
|
||||
% (or arguments) for the exception '#1'.
|
||||
% the \pgfeov is IMPORTANT as it delimits the argument.
|
||||
%
|
||||
% Note that all standard pgfplots exceptions provide a feature to
|
||||
% exchange the error message text: define \pgfplotsexceptionmsg
|
||||
% set a replacement.
|
||||
\def\pgfplotsthrow#1#2\pgfeov{%
|
||||
\def\pgfkeyscurrentkey{/pgfplots/exception/#1}%
|
||||
\pgfkeysvalueof{/pgfplots/exception/#1/.@cmd}#2\pgfeov
|
||||
}%
|
||||
\let\pgfplotsthrow@orig=\pgfplotsthrow
|
||||
|
||||
% Generates warning `#1' with argument(s) `#2'.
|
||||
%
|
||||
% It works in exactly the same way as \pgfplotsthrow.
|
||||
\def\pgfplotswarning#1#2\pgfeov{%
|
||||
\def\pgfkeyscurrentkey{/pgfplots/warning/#1}%
|
||||
\pgfkeysvalueof{/pgfplots/warning/#1/.@cmd}#2\pgfeov
|
||||
}%
|
||||
|
||||
\def\pgfplotsthrow@warning#1{%
|
||||
\pgfplots@warning{#1}%
|
||||
\immediate\write-1{ [warning \pgfkeyscurrentkey]}%
|
||||
}%
|
||||
|
||||
\def\pgfplots@assert@not@zero#1#2{%
|
||||
\ifdim#1=0sp %
|
||||
\pgfplotsthrow{invalid argument}{\pgfplots@loc@TMPa}{#2}\pgfeov
|
||||
\fi
|
||||
}%
|
||||
|
||||
% A primitive try #1 catch #2 end block.
|
||||
%
|
||||
% It tries code #1. If any exception occurs within, it suppresses the
|
||||
% exception and tries to continue. It then invokes #2 as soon as it
|
||||
% can.
|
||||
%
|
||||
% You can use \pgfplotsrethrow in #2.
|
||||
%
|
||||
% ATTENTION: this is a simple attempt to simulate error control. Don't
|
||||
% rely on it too heavily! In the moment, I am not even sure if it can
|
||||
% be nested (perhaps you need to introduce extra scopes since
|
||||
% \pgfplotstry doesn't).
|
||||
\long\def\pgfplotstry#1\catch#2\endpgfplotstry{%
|
||||
\global\let\pgfplotstry@exception\pgfutil@empty
|
||||
\def\pgfplotsthrow##1##2\pgfeov{\gdef\pgfplotstry@exception{{##1}{##2}}}%
|
||||
#1\relax%
|
||||
\let\pgfplotsthrow=\pgfplotsthrow@orig
|
||||
\ifx\pgfplotstry@exception\pgfutil@empty
|
||||
\else
|
||||
#2%
|
||||
\fi
|
||||
\global\let\pgfplotstry@exception\pgfutil@empty
|
||||
}%
|
||||
\def\pgfplotsrethrow{\expandafter\pgfplotsthrow\pgfplotstry@exception\pgfeov}%
|
||||
|
||||
\pgfkeys{
|
||||
% #1: the argument which should have been assigned.
|
||||
% #2: an error message.
|
||||
/pgfplots/exception/invalid argument/.code 2 args={%
|
||||
\ifx\pgfplotsexceptionmsg\relax
|
||||
\pgfplots@error{#2}%
|
||||
\else
|
||||
\pgfplots@error{\pgfplotsexceptionmsg}%
|
||||
\fi
|
||||
\let#1=\pgfutil@empty
|
||||
},%
|
||||
% #1 : the layer name
|
||||
% #2 : additional context information (message)
|
||||
/pgfplots/exception/inactive layer/.code 2 args={%
|
||||
\ifx\pgfplotsexceptionmsg\relax
|
||||
\pgfplots@error{Sorry, the layer '#1' has not been activated but it is referenced in #2. Perhaps you misspelled it? Each referenced layer must be activated (expect for layer 'discard').}%
|
||||
\else
|
||||
\pgfplots@error{\pgfplotsexceptionmsg}%
|
||||
\fi
|
||||
},%
|
||||
% #1: the argument which should have been assigned.
|
||||
% #2: an error message.
|
||||
/pgfplots/exception/no such element/.code 2 args={%
|
||||
\ifx\pgfplotsexceptionmsg\relax
|
||||
\pgfplots@error{#2}%
|
||||
\else
|
||||
\pgfplots@error{\pgfplotsexceptionmsg}%
|
||||
\fi
|
||||
\let#1=\pgfutil@empty
|
||||
},%
|
||||
/pgfplots/exception/invalid color component/.code 2 args={%
|
||||
\ifx\pgfplotsexceptionmsg\relax
|
||||
\pgfplots@error{#2}%
|
||||
\else
|
||||
\pgfplots@error{\pgfplotsexceptionmsg}%
|
||||
\fi
|
||||
\let#1=\pgfutil@empty
|
||||
},%
|
||||
% #1: an error message
|
||||
/pgfplots/exception/unsupported operation/.code={%
|
||||
\ifx\pgfplotsexceptionmsg\relax
|
||||
\pgfplots@error{#1}%
|
||||
\else
|
||||
\pgfplots@error{\pgfplotsexceptionmsg}%
|
||||
\fi
|
||||
},%
|
||||
% #1: the argument which should have been assigned.
|
||||
% #2: the file name
|
||||
% #3: the error message
|
||||
/pgfplots/exception/no such table file/.code args={#1#2#3}{%
|
||||
\ifx\pgfplotsexceptionmsg\relax
|
||||
\pgfplots@error{#3}%
|
||||
\else
|
||||
\pgfplots@error{\pgfplotsexceptionmsg}%
|
||||
\fi
|
||||
\let#1=\relax
|
||||
},
|
||||
%
|
||||
%
|
||||
%
|
||||
%
|
||||
% Generated if you say 'ymin=0' in a log axis.
|
||||
% #1: the user argument ('ymin')
|
||||
% #2: the offending value.
|
||||
/pgfplots/warning/illegal user argument in log axis/.code args={#1#2}{%
|
||||
\pgfplotsthrow@warning{Ignoring illegal input argument #1=#2: cannot apply log.}%
|
||||
},
|
||||
/pgfplots/warning/plot without coordinates/.code={%
|
||||
\pgfplotsthrow@warning{the current plot has no coordinates (or all have been filtered away)}%
|
||||
},
|
||||
/pgfplots/warning/log basis required/.code 2 args={%
|
||||
\pgfplotsthrow@warning{Some input argument (#2) explicitly relies on the log basis of #1 (which is e). Please verify that this is intended and set 'log basis #1=10' otherwise. This warning will be shown only once per document.}%
|
||||
},
|
||||
/pgfplots/warning/no such legend to name/.code={%
|
||||
\pgfplotsthrow@warning{There is no `legend to name=#1', sorry. I am skipping it}%
|
||||
},
|
||||
/pgfplots/warning/no such colorbar to name/.code={%
|
||||
\pgfplotsthrow@warning{There is no `colorbar to name=#1', sorry. I am skipping it}%
|
||||
},
|
||||
/pgfplots/warning/no such addplot label/.code={%
|
||||
\pgfplotsthrow@warning{There is no \string\addplot\space label `#1', sorry. I am skipping it}%
|
||||
},
|
||||
/pgfplots/warning/enlargelimits respects figure size failed/.code={%
|
||||
\pgfplotsthrow@warning{enlargelimits respects figure size=true: could not respect the prescribed width/height (\pgfplotsretval). The size and/or aspect ratio of your image will be different than expected. You can try to modify BOTH width and height.}%
|
||||
},
|
||||
% #1: the axis
|
||||
/pgfplots/warning/empty range cleared axis/.code={%
|
||||
\pgfplotsthrow@warning{You have an axis with empty range (in direction #1). Replacing it with a default range and clearing all plots.}%
|
||||
},
|
||||
/pgfplots/warning/approx empty range enlarged/.code args={#1#2#3}{%
|
||||
\pgfplotsthrow@warning{Axis range for axis #1 is approximately empty; enlarging it (it is [#2:#3])}%
|
||||
},
|
||||
/pgfplots/warning/lossy colormap rgb conversion/.code 2 args={%
|
||||
\pgfplotsthrow@warning{I am about to convert colormap '#1' from #2\space to rgb (which might be lossy). Perhaps the choice 'colorbar sampled={surf,shader=interp}' yields better results since it supports #2.}%
|
||||
},
|
||||
/pgfplots/warning/colorbar uninitialised/.code={%
|
||||
\pgfplotsthrow@warning{Sorry, the colorbar is uninitialised - your axis has no color data. Consider using 'point meta=f(x)' or something like that. I am using a color range of [0,1] for the colorbar.}%
|
||||
},
|
||||
/pgfplots/warning/colorbar CMYK unsupported/.code={%
|
||||
\pgfplotsthrow@warning{colorbar remark: The colormap '#1' has a CMYK colorspace which is not (yet) supported by PGF. I switched colorbar styles automatically to the visually equivalent 'colorbar sampled={surf,shader=interp}' to generate a proper CMYK colorbar. This has less support in some previewers. Use \string\pgfplotscolorbarCMYKworkaroundfalse\space to disable this improvement. [This message won't be replicated for '#1']}%
|
||||
},
|
||||
/pgfplots/warning/ticklabel anchor undetermined/.code args={#1#2#3#4}{%
|
||||
\pgfplotsthrow@warning{the ticklabel anchor cannot be determined, the normal vector -(#2) and the unit #1 vector (#3) are almost parallel (abs(cos(angle)) = #4)!}%
|
||||
},
|
||||
/pgfplots/warning/point meta unbounded/.code 2 args={%
|
||||
\pgfplotsthrow@warning{The per point meta data `#1' (#2) (and probably others as well) is unbounded - using the minimum value instead.}%
|
||||
},
|
||||
/pgfplots/warning/gnuplot -V impossible/.code={%
|
||||
\pgfplotsthrow@warning{Sorry, I could not determine 'gnuplot -V' to check whether gnuplot and logscale writes results in log() or not. Please set `/pgfplots/gnuplot writes logscale=true|false' manually.}%
|
||||
},
|
||||
/pgfplots/warning/gnuplot -V format unknown/.code={%
|
||||
\pgfplotsthrow@warning{Sorry, I can't reliably check which version of gnuplot is available. I guess it is gnuplot < 4.4. Please set `/pgfplots/gnuplot writes logscale=true|false' manually if anything fails.}%
|
||||
},
|
||||
/pgfplots/warning/plot3 graphics compatibility mode/.code={%
|
||||
\pgfplotsthrow@warning{plot3 graphics is running in backwards compatibility mode. %
|
||||
Use \string\pgfplotsset{compat=1.6} or higher to benefit from upgraded scaling capabilites.}%
|
||||
},
|
||||
/pgfplots/warning/plot3 graphics too few inner anchors/.code={%
|
||||
\pgfplotsthrow@warning{plot graphics in 3D axis has just two inner anchors (those with '(x,y,z)=>(imgx,imgy)'). You should provide a third one such that I can check for correct scaling.}%
|
||||
},
|
||||
/pgfplots/warning/scatter classes no such class/.code={%
|
||||
\pgfplotsthrow@warning{scatter/classes: can't find class for '#1'!? Please make sure you have specified 'scatter src=explicit symbolic'. Ignoring class '#1' (this message will not come again).}%
|
||||
},
|
||||
/pgfplots/warning/interior colormap inefficient/.code={%
|
||||
\pgfplotsthrow@warning{the combination 'shader=interp,interior colormap name' is inefficient (it uses 'shader=faceted interp,faceted color=none') and may slow down the *display* of your document}%
|
||||
},
|
||||
/pgfplots/warning/matrix delinearize uses sqrt/.code args={#1#2#3#4}{%
|
||||
\pgfplotsthrow@warning{%
|
||||
mesh processing did not find '[mesh/rows=<N>]' or '[mesh/cols=<N>]'.
|
||||
Assuming [mesh/rows=#1,mesh/cols=#2]
|
||||
as sqrt(num points) = sqrt(#3) [ = #4].}%
|
||||
},
|
||||
/pgfplots/warning/matrix check/.code args={#1#2#3#4#5}{%
|
||||
#1{the arguments of [mesh/rows=#2,mesh/cols=#3] assume #5\space points, but I got actually N = #4\space points! The data matrix appears to be incomplete or overcomplete!? [Use mesh/check=false to disable this message]}%
|
||||
},
|
||||
/pgfplots/warning/tick computation failed/.code 2 args={%
|
||||
\pgfplotsthrow@warning{Tick computation for direction #1 failed; there are always too few tick labels (try min ticks has already been advanced to #2)}%
|
||||
},
|
||||
/pgfplots/warning/scale uniformly unsupported/.code={%
|
||||
\pgfplotsthrow@warning{Sorry, 'scale uniformly' failed because its actual implementation works only if y_x = 0 and x_y = 0 (for 2d axes) or if z_x = 0 (for 3d axes). The result will not fill the prescribed dimensions. Falling back to 'scale uniformly strategy=units only. (use scale uniformly warning=false to disable this warning)}%
|
||||
},
|
||||
/pgfplots/warning/axis equal incompatible change/.code={%
|
||||
\pgfplotsthrow@warning{the content of your 3d axis has changed compared to previous versions of pgfplots. please review it. ^^J %
|
||||
[continued] explanation: you have a 3d axis with 'axis equal' and/or 'unit vector ratio' which has (probably) been optimized for an older version of pgfplots. any version older than 1.6 produced wrong output.^^J %
|
||||
[continued] to remove this warning, write \string\pgfplotsset{compat=1.6} (or newer) in your preamble (may change all figures in your document) or by adding that to the affected axis.}%
|
||||
},
|
||||
/pgfplots/warning/unit vector ratio axis undetermined/.code={%
|
||||
\pgfplotsthrow@warning{The algorithm to implement 'unit vector ratio' failed! It could not determine the axis which shall be scaled and decided to use 'unit vector ratio axis=#1'.}%
|
||||
},
|
||||
/pgfplots/warning/linear system singular/.code={%
|
||||
\pgfplotsthrow@warning{Linear system is singular up to machine precision! Continuing with small threshold.}%
|
||||
},
|
||||
/pgfplots/warning/center lines upgrade required/.code={%
|
||||
\pgfplotsthrow@warning{Please use '\string\pgfplotsset{compat=1.8}' to enable correct label placement for 3d axes (at least compat/labels=1.8).}%
|
||||
},
|
||||
/pgfplots/warning/empty column name/.code 2 args={%
|
||||
\pgfplotsthrow@warning{Table '#1' has an empty column name; replacing it by '#2'}%
|
||||
},
|
||||
}
|
||||
\let\pgfplotsexceptionmsg=\relax
|
||||
|
||||
\def\pgfplots@EOI{\pgfplots@EOI}%
|
||||
|
||||
\newif\ifpgfplots@loc@tmp
|
||||
\newtoks\t@pgfplots@toka
|
||||
\newtoks\t@pgfplots@tokb
|
||||
\newtoks\t@pgfplots@tokc
|
||||
\newdimen\pgfplots@tmpa
|
||||
\newcount\c@pgfplots@coordindex
|
||||
\newcount\c@pgfplots@scanlineindex
|
||||
\pgfutil@IfUndefined{r@pgf@reada}{%
|
||||
\csname newread\endcsname\r@pgfplots@reada
|
||||
}{%
|
||||
\let\r@pgfplots@reada=\r@pgf@reada
|
||||
}
|
||||
|
||||
% use these macros for GLOBAL temporary assignments.
|
||||
% you can NEVER rely on their values unless you know exactly what you are doing.
|
||||
\gdef\pgfplots@glob@TMPa{}%
|
||||
\gdef\pgfplots@glob@TMPb{}%
|
||||
\gdef\pgfplots@glob@TMPc{}%
|
||||
|
||||
% use these macros for LOCAL temporary assigments.
|
||||
% you can NEVER rely on their values unless you know exactly what you are doing.
|
||||
\def\pgfplots@loc@TMPa{}%
|
||||
\def\pgfplots@loc@TMPb{}%
|
||||
\def\pgfplots@loc@TMPc{}%
|
||||
|
||||
|
||||
% Invokes code #2 if file '#1' exists and #3 if not.
|
||||
\long\def\pgfplots@iffileexists#1#2#3{%
|
||||
\openin\r@pgfplots@reada=#1
|
||||
\ifeof\r@pgfplots@reada
|
||||
#3\relax
|
||||
\else
|
||||
\closein\r@pgfplots@reada
|
||||
#2\relax
|
||||
\fi
|
||||
}
|
||||
\let\pgfplotsiffileexists=\pgfplots@iffileexists
|
||||
|
||||
\pgfutil@ifundefined{pgfplots@texdist@protect}{%
|
||||
\def\pgfplots@texdist@protect{}%
|
||||
}{}
|
||||
|
||||
\input pgfplotssysgeneric.code.tex
|
||||
\endinput
|
39
texmf/tex/latex/pgfplots/pgfplotstable.sty
Normal file
39
texmf/tex/latex/pgfplots/pgfplotstable.sty
Normal file
|
@ -0,0 +1,39 @@
|
|||
%--------------------------------------------
|
||||
%
|
||||
% Package pgfplotstable.sty
|
||||
%
|
||||
% Copyright 2007-2011 by Christian Feuersänger.
|
||||
%
|
||||
% This program is free software: you can redistribute it and/or modify
|
||||
% 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/>.
|
||||
%
|
||||
%--------------------------------------------
|
||||
\IfFileExists{pgfplots.revision.tex}{\input pgfplots.revision.tex } {%
|
||||
\def\pgfplotsrevision{0}%
|
||||
\def\pgfplotsversion{0.0}%
|
||||
\def\pgfplotsversiondatetime{2014-07-01 00:00:00 +100}%
|
||||
\def\pgfplotsrevisiondatetime{2014-07-01 00:00:00 +100}%
|
||||
\def\pgfplotsversiondate{2014/07/01}%
|
||||
\def\pgfplotsrevisiondate{2014/07/01}%
|
||||
}
|
||||
\ProvidesPackage{pgfplotstable}[\pgfplotsversiondate\space v\pgfplotsversion\space Table typesetting and Pretty-printing (\pgfplotsrevision)]
|
||||
|
||||
\RequirePackage{pgfplots}
|
||||
|
||||
\def\pgfplots@texdist@protect{\protect}%
|
||||
|
||||
\input pgfplotstable.code.tex
|
||||
|
||||
\RequirePackage{array} % for |dec sep align|
|
||||
|
||||
\endinput
|
159
texmf/tex/latex/pgfplots/pgfregressiontest.sty
Normal file
159
texmf/tex/latex/pgfplots/pgfregressiontest.sty
Normal file
|
@ -0,0 +1,159 @@
|
|||
%--------------------------------------------------
|
||||
% Provides a feature for fully automated regression testing of PGF or derived works.
|
||||
%
|
||||
% DEPRECATED.
|
||||
% The idea might be interesting, but it is simply did not work and is
|
||||
% too complicated. Don't use it.
|
||||
%
|
||||
% Idea:
|
||||
% - it is based on the 'external' lib of pgf (which automatically exports each tikzpicture to pdf).
|
||||
% - modification: in addition to the pdf export, call imagemagick's convert
|
||||
% tool to export to png as well and compare the png to a reference image.
|
||||
% - pgfregressiontest.sty provides two modes:
|
||||
% 1) the REFERENCE GENERATION mode
|
||||
% - each image knows a reference revision tag (or the system default)
|
||||
% - the 'system call' makes a "checkout" of the desired revision,
|
||||
% generates the image and returns to the original revision
|
||||
% - the images are stored with a unique prefix.
|
||||
% 2) the COMPARISON mode
|
||||
% - each tikzpicture is compared to its reference image. If there
|
||||
% is none, it should be generated.
|
||||
% - if the comparison fails, a protocol is generated and the user
|
||||
% is alerted.
|
||||
|
||||
%--------------------------------------------------
|
||||
%
|
||||
\ProvidesPackage{pgfregressiontest}[2010/10/31 Version 0.1]
|
||||
|
||||
\RequirePackage{tikz}
|
||||
\usetikzlibrary{external}
|
||||
|
||||
\def\pgfregression@invokecmdkey#1#2{%
|
||||
\pgfkeysvalueof{/pgf/regression/#1/.@cmd}#2\pgfeov
|
||||
}%
|
||||
|
||||
\newif\ifpgfregressionpreamble
|
||||
\pgfregressionpreambletrue
|
||||
|
||||
\def\pgfregressiontestset{\pgfqkeys{/pgf/regression}}%
|
||||
|
||||
\pgfqkeys{/pgf/regression}{%
|
||||
% will be set in \begin{document}
|
||||
system call original/.initial=<not yet set>,
|
||||
%
|
||||
% 'rev checkout' can be used to manually change the environment
|
||||
% state before actually generating the image.
|
||||
% Example:
|
||||
% 'rev checkout=cd ~/code/tex/pgfplots ; git checkout 1.3'
|
||||
% or something like this.
|
||||
%
|
||||
% Use 'rev restore' to immediately undo the effects. All that
|
||||
% stuff is executed in one shell environment, i.e. you can define
|
||||
% and use shell variables.
|
||||
rev checkout/.code=\def\pgfregression@revcheckout{#1},
|
||||
rev checkout={},
|
||||
rev restore/.code=\def\pgfregression@revrestore{#1},
|
||||
rev restore={},
|
||||
reference prefix/.initial=reference_images/,
|
||||
protocol file/.initial=\jobname.protocol.sh,
|
||||
convert to png/.initial={convert "\image.pdf" "\image.png"},%
|
||||
reference mode/.code={
|
||||
\def\pgfregr@replacement@syscall{%
|
||||
\ifx\pgfregression@revcheckout\pgfutil@empty
|
||||
\else
|
||||
\pgfregression@revcheckout;^^J%
|
||||
@echo "'rev checkout' was successful, generating pdf...";^^J%
|
||||
\fi
|
||||
mkdir -p \pgfkeysvalueof{/pgf/regression/reference prefix};^^J%
|
||||
\pgfkeysvalueof{/pgf/regression/system call original}; EXITCODE=$$?; \\^^J%
|
||||
\ifx\pgfregression@revrestore\pgfutil@empty
|
||||
\else
|
||||
\pgfregression@revrestore; \\^^J%
|
||||
echo "'rev restore' was successful.";^^J%
|
||||
\fi
|
||||
@if [ "$$EXITCODE" != "0" ]; then echo "pdf generation failed; Abort"; false; fi;^^J%
|
||||
\pgfkeysvalueof{/pgf/regression/convert to png};^^J%
|
||||
}%
|
||||
\def\pgfregr@style{%
|
||||
\message{^^Jpgfregressiontest: Running in REFERENCE GENERATION mode.^^J}%
|
||||
\pgfqkeys{/pgf/regression}{%
|
||||
/tikz/external/prefix=\pgfkeysvalueof{/pgf/regression/reference prefix},
|
||||
}%
|
||||
}%
|
||||
\ifpgfregressionpreamble
|
||||
\else
|
||||
\pgfkeyslet{/tikz/external/system call}\pgfregr@replacement@syscall
|
||||
\pgfregr@style
|
||||
\fi
|
||||
},
|
||||
comparison mode/.code={
|
||||
\def\pgfregr@replacement@syscall{%
|
||||
\pgfkeysvalueof{/pgf/regression/system call original};^^J%
|
||||
\pgfkeysvalueof{/pgf/regression/convert to png};^^J%
|
||||
diff "\image.png" "\expandafter\expandafter\expandafter\pgfregr@get@reference@image@for\image\relax.png";^^J%
|
||||
if [ ! $? -eq 0 ]; then ^^J
|
||||
echo 'echo "file \image.pdf differs from \expandafter\expandafter\expandafter\pgfregr@get@reference@image@for\image\relax.pdf (displaying differences now)".' >> \pgfkeysvalueof{/pgf/regression/protocol file};^^J
|
||||
echo 'convert "\image.png" "\expandafter\expandafter\expandafter\pgfregr@get@reference@image@for\image\relax.png" -compose difference -composite -colorspace gray miff:- | display' >>\pgfkeysvalueof{/pgf/regression/protocol file};^^J%
|
||||
else^^J
|
||||
rm -f "\image.png";^^J%
|
||||
fi;^^J%
|
||||
}%
|
||||
\def\pgfregr@style{%
|
||||
\message{^^Jpgfregressiontest: Running in COMPARISON mode.^^J}%
|
||||
\expandafter\def\expandafter\pgfregr@get@reference@image@for\tikzexternal@filenameprefix####1\relax{%
|
||||
\pgfkeysvalueof{/pgf/regression/reference prefix}####1%
|
||||
}%
|
||||
}%
|
||||
\ifpgfregressionpreamble
|
||||
\else
|
||||
\pgfkeyslet{/tikz/external/system call}\pgfregr@replacement@syscall
|
||||
\pgfregr@style
|
||||
\fi
|
||||
},
|
||||
comparison mode,
|
||||
}
|
||||
|
||||
% Check for "command line arguments".
|
||||
% if 'pdflatex '\def\referencemode{1}\input{filename}' has been used,
|
||||
% the 'reference mode' will be enabled. Otherwise we are in
|
||||
% 'comparison mode'.
|
||||
\expandafter\ifx\csname referencemode\endcsname\relax
|
||||
\pgfregressiontestset{comparison mode}%
|
||||
\message{^^Jpgfregressiontest: use pdflatex '\string\def\string\referencemode{1}\string\input{\jobname}' to enable reference generation.^^J}%
|
||||
\else
|
||||
\pgfregressiontestset{reference mode}%
|
||||
\fi
|
||||
|
||||
|
||||
\AtBeginDocument{%
|
||||
\tikzifexternalizehasbeencalled{}{%
|
||||
\PackageError{pgfregressiontest}{%
|
||||
Please call \string\tikzexternalize\space somewhere in your preamble. I can only perform my tests together with image externalization}{}%
|
||||
}%
|
||||
\pgfkeysgetvalue{/tikz/external/system call}\pgfregression@temp
|
||||
\pgfkeyslet{/pgf/regression/system call original}\pgfregression@temp
|
||||
%
|
||||
\pgfkeyslet{/tikz/external/system call}\pgfregr@replacement@syscall
|
||||
\pgfregr@style
|
||||
%
|
||||
\immediate\openout\w@pgf@writea=\pgfkeysvalueof{/pgf/regression/protocol file} %
|
||||
\immediate\closeout\w@pgf@writea
|
||||
%
|
||||
\global\pgfregressionpreamblefalse
|
||||
}
|
||||
|
||||
\AtEndDocument{%
|
||||
\openin\r@pgf@reada=\pgfkeysvalueof{/pgf/regression/protocol file} %
|
||||
\ifeof\r@pgf@reada
|
||||
\else
|
||||
\message{
|
||||
^^J%
|
||||
======================================^^J%
|
||||
There have been regression errors.^^J%
|
||||
Use^^J%
|
||||
>> bash \pgfkeysvalueof{/pgf/regression/protocol file}^^J%
|
||||
to visualize them.^^J%
|
||||
======================================^^J%
|
||||
}%
|
||||
\fi
|
||||
}%
|
343
texmf/tex/latex/pgfplots/scripts/matlab2pgfplots.m
Normal file
343
texmf/tex/latex/pgfplots/scripts/matlab2pgfplots.m
Normal file
|
@ -0,0 +1,343 @@
|
|||
function matlab2pgfplots(varargin )
|
||||
% matlab2pgfplots(outfile )
|
||||
% matlab2pgfplots( outfile, OPTIONS )
|
||||
%
|
||||
% Generate LaTeX code for use in package pgfplots to
|
||||
% draw line plots.
|
||||
%
|
||||
% It will use every (2d) line plot in the figure specified by handler fighandle.
|
||||
%
|
||||
% It understands
|
||||
% - axis labels,
|
||||
% - legends,
|
||||
% - any 2d line plots,
|
||||
% - line styles/markers (in case of styles=1),
|
||||
% - tick positions, labels and axis limits (in case of axes=1).
|
||||
%
|
||||
% Linestyles and markers will follow as an option. However, pgfplots has its
|
||||
% own line styles which may be appropriate.
|
||||
%
|
||||
% Although pgfplots can also handle bar and area plots, this script is not yet
|
||||
% capable of converting them. Feel free to modify it and send the final version
|
||||
% to me!
|
||||
%
|
||||
% OPTIONS are key value pairs. Known options are
|
||||
% - 'fig',HANDLE
|
||||
% a figure handle (default is 'gcf').
|
||||
% - 'styles',0|1
|
||||
% a boolean indicating whether line styles, markers and colors shall be exported (default 1).
|
||||
% - 'axes',0|1
|
||||
% a boolean indicating whether axis ticks, tick labels and limits shall be exported (default 0).
|
||||
% - 'maxpoints',100000
|
||||
% an integer denoting the maximum number of points exported to tex. If the actual number is larger,
|
||||
% the data will be interpolated to 'maxpoints'. The interpolation assumes
|
||||
% parametric plots if x and y are not monotonically increasing.
|
||||
%
|
||||
% See
|
||||
% http://tug.ctan.org/tex-archive/graphics/pgf/contrib/pgfplots/
|
||||
% for details about pgfplots.
|
||||
%
|
||||
%
|
||||
%
|
||||
% Copyright Christian Feuersaenger 2008
|
||||
%
|
||||
% This script requires Matlab version 7.4 (or above).
|
||||
parser = inputParser;
|
||||
|
||||
parser.addRequired( 'outfile', @(x) ischar(x) );
|
||||
parser.addParamValue( 'fig', gcf, @(x) ishandle(x) );
|
||||
parser.addParamValue( 'styles', 1, @(x) x==0 || x==1 );
|
||||
parser.addParamValue( 'axes' , 0, @(x) x==0 || x==1 );
|
||||
parser.addParamValue( 'maxpoints', 100000, @(x) isnumeric(x) );
|
||||
|
||||
parser.parse( varargin{:} );
|
||||
|
||||
|
||||
fighandle = parser.Results.fig;
|
||||
|
||||
lineobjs = findobj(fighandle, 'Type', 'line' );
|
||||
axesobj = findobj( fighandle, 'Type', 'axes' );
|
||||
|
||||
% As far as I know, 'scatter' and 'scatter3' produce groups of this class:
|
||||
scatterobjs = findobj(fighandle, 'Type', 'hggroup' );
|
||||
lineobjs = [ lineobjs scatterobjs ];
|
||||
|
||||
legendobj = findobj( fighandle, 'tag', 'legend' );
|
||||
if length(legendobj) > 0
|
||||
allchildsoflegend = [ findobj( legendobj ) ];
|
||||
lineobjs = setdiff( lineobjs, allchildsoflegend );
|
||||
axesobj = setdiff( axesobj, allchildsoflegend );
|
||||
end
|
||||
|
||||
FID=fopen( parser.Results.outfile, 'w' );
|
||||
assert( FID >= 0, [ 'could not open file ' parser.Results.outfile ' for writing' ] );
|
||||
|
||||
ENDL=sprintf('\n');
|
||||
TAB=sprintf('\t');
|
||||
fwrite( FID, [ ...
|
||||
'\begin{tikzpicture}%' ENDL ...
|
||||
'\begin{axis}'] );
|
||||
|
||||
xislog = 0;
|
||||
yislog = 0;
|
||||
|
||||
if length(axesobj) > 0
|
||||
axis = axesobj(1);
|
||||
xlabel = get( get(axis, 'XLabel'), 'String');
|
||||
ylabel = get( get(axis, 'YLabel'), 'String');
|
||||
zlabel = get( get(axis, 'ZLabel'), 'String');
|
||||
xscale = get(axis,'XScale');
|
||||
yscale = get(axis,'YScale');
|
||||
|
||||
axisoptions = {};
|
||||
if length(xlabel) > 0
|
||||
axisoptions = [ axisoptions [ 'xlabel={' xlabel '}'] ];
|
||||
end
|
||||
if length(ylabel) > 0
|
||||
axisoptions = [ axisoptions ['ylabel={' ylabel '}'] ];
|
||||
end
|
||||
if strcmp(xscale,'log')
|
||||
xislog=1;
|
||||
axisoptions = [ axisoptions ['xmode=log'] ];
|
||||
end
|
||||
if strcmp(yscale,'log')
|
||||
yislog = 1;
|
||||
axisoptions = [ axisoptions ['ymode=log'] ];
|
||||
end
|
||||
if parser.Results.axes
|
||||
for k = 'xy'
|
||||
L = get(gca, [ k 'Lim'] );
|
||||
axisoptions = [ axisoptions [ k 'min=' num2str(L(1)) ] ];
|
||||
axisoptions = [ axisoptions [ k 'max=' num2str(L(2)) ] ];
|
||||
end
|
||||
|
||||
for k = 'xy'
|
||||
L = get(gca, [ k 'Tick'] );
|
||||
opt = [ k 'tick={' ];
|
||||
for q=1:length(L)
|
||||
if q>1
|
||||
opt = [opt ',' ];
|
||||
end
|
||||
opt = [opt num2str(L(q)) ];
|
||||
end
|
||||
opt = [ opt '}' ];
|
||||
axisoptions = [axisoptions opt ];
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
axisoptstr = [];
|
||||
for i = 1:length(axisoptions)
|
||||
if i>1
|
||||
axisoptstr = [axisoptstr ',' ENDL TAB];
|
||||
end
|
||||
axisoptstr = [axisoptstr axisoptions{i}];
|
||||
end
|
||||
if length( axisoptstr )
|
||||
fwrite( FID, [ '[' ENDL TAB axisoptstr ']' ENDL ] );
|
||||
end
|
||||
end
|
||||
fwrite( FID, ENDL );
|
||||
|
||||
if length(legendobj) > 0
|
||||
legentries = get(legendobj, 'String');
|
||||
if length(legentries) > 0
|
||||
legstr = ['\legend{%' ENDL TAB ];
|
||||
for i = 1:length(legentries)
|
||||
legstr = [ legstr legentries{i} '\\%' ENDL ];
|
||||
if i ~= length(legentries)
|
||||
legstr = [ legstr TAB ];
|
||||
end
|
||||
end
|
||||
legstr = [ legstr '}%' ENDL ];
|
||||
fwrite( FID, legstr );
|
||||
end
|
||||
end
|
||||
|
||||
xpointformat = '%f';
|
||||
ypointformat = '%f';
|
||||
if xislog
|
||||
xpointformat = '%e';
|
||||
end
|
||||
if yislog
|
||||
ypointformat = '%e';
|
||||
end
|
||||
|
||||
for i = 1:length(lineobjs)
|
||||
|
||||
x = get(lineobjs(i), 'XData');
|
||||
y = get(lineobjs(i), 'YData');
|
||||
z = get(lineobjs(i), 'ZData');
|
||||
|
||||
if size(x,1) > 1
|
||||
disp( ['line element ' num2str(i) ' skipped: size ' num2str(size(x)) ' not supported']);
|
||||
end
|
||||
if abs(max(z) > 0)
|
||||
disp( ['line element ' num2str(i) ' skipped: only 2d-plots supported up to now']);
|
||||
end
|
||||
|
||||
if size(x,2) > parser.Results.maxpoints
|
||||
% we need to re-interpolate the data!
|
||||
q = find( diff(x) < 0 );
|
||||
if length(q)
|
||||
% parametric plot x(t), y(t), z(t).
|
||||
% we assume t = 1:size(x,2)
|
||||
X = 1:parser.Results.maxpoints;
|
||||
x = interp1( 1:size(x,2),x, X);
|
||||
y = interp1( 1:size(y,2),y, X);
|
||||
z = interp1( 1:size(z,2),z, X);
|
||||
|
||||
else
|
||||
% a normal plot y(x):
|
||||
X = linspace( min(x), max(x), parser.Results.maxpoints );
|
||||
y = interp1( x,y, X );
|
||||
x = X;
|
||||
end
|
||||
end
|
||||
|
||||
coordstr = [];
|
||||
for j = 1:size(x,2)
|
||||
coordstr = [coordstr sprintf(['\t(' xpointformat ',\t' ypointformat ')\n'], x(j), y(j)) ];
|
||||
end
|
||||
|
||||
addplotoptstr = [];
|
||||
if parser.Results.styles
|
||||
markOpts = {};
|
||||
mark = [];
|
||||
linestyle = [];
|
||||
color = [];
|
||||
|
||||
C = matlabColorToPGFColor( get(lineobjs(i), 'Color') );
|
||||
if length(C)
|
||||
color = [ 'color=' C ];
|
||||
end
|
||||
|
||||
L = get(lineobjs(i), 'LineStyle' );
|
||||
switch L
|
||||
case 'none'
|
||||
linestyle = 'only marks';
|
||||
case '-'
|
||||
linestyle = [];
|
||||
case ':'
|
||||
linestyle = 'densely dotted';
|
||||
case '-:'
|
||||
linestyle = 'dash pattern={on 2pt off 3pt on 1pt off 3pt}';
|
||||
case '--'
|
||||
linestyle = 'densely dashed';
|
||||
end
|
||||
|
||||
M = get(lineobjs(i), 'Marker');
|
||||
switch M
|
||||
case '.'
|
||||
mark = '*';
|
||||
markOpts = [ markOpts 'scale=0.1' ];
|
||||
case 'o'
|
||||
mark = '*';
|
||||
case 'x'
|
||||
mark = 'x';
|
||||
case '+'
|
||||
mark = '+';
|
||||
case '*'
|
||||
mark = 'asterisk';
|
||||
case 'square'
|
||||
mark = 'square*';
|
||||
case 'diamond'
|
||||
mark = 'diamond*';
|
||||
case '^'
|
||||
mark = 'triangle*';
|
||||
case 'v'
|
||||
mark = 'triangle*';
|
||||
markOpts = [ markOpts 'rotate=180' ];
|
||||
case '<'
|
||||
mark = 'triangle*';
|
||||
markOpts = [ markOpts 'rotate=90' ];
|
||||
case '>'
|
||||
mark = 'triangle*';
|
||||
markOpts = [ markOpts 'rotate=270' ];
|
||||
case 'pentagramm'
|
||||
mark = 'pentagon*';
|
||||
case 'hexagram'
|
||||
mark = 'oplus*';
|
||||
end
|
||||
|
||||
M = matlabColorToPGFColor( get(lineobjs(i), 'MarkerFaceColor') );
|
||||
if length(M)
|
||||
markOpts = [ markOpts ['fill=' M] ];
|
||||
end
|
||||
|
||||
M = matlabColorToPGFColor( get(lineobjs(i), 'MarkerEdgeColor') );
|
||||
if length(M)
|
||||
markOpts = [ markOpts ['draw=' M] ];
|
||||
end
|
||||
|
||||
if length(color)
|
||||
if length(addplotoptstr)
|
||||
addplotoptstr = [addplotoptstr ',' ];
|
||||
end
|
||||
addplotoptstr = [ addplotoptstr color ];
|
||||
end
|
||||
|
||||
if length(linestyle)
|
||||
if length(addplotoptstr)
|
||||
addplotoptstr = [addplotoptstr ',' ];
|
||||
end
|
||||
addplotoptstr = [ addplotoptstr linestyle ];
|
||||
end
|
||||
|
||||
if length(mark)
|
||||
if length(addplotoptstr)
|
||||
addplotoptstr = [addplotoptstr ',' ];
|
||||
end
|
||||
addplotoptstr = [ addplotoptstr [ 'mark=' mark ] ];
|
||||
|
||||
if length(markOpts)
|
||||
markOptsStr = 'mark options={';
|
||||
for q = 1:length(markOpts)
|
||||
if q > 1
|
||||
markOptsStr = [markOptsStr ',' ];
|
||||
end
|
||||
markOptsStr = [ markOptsStr markOpts{q} ];
|
||||
end
|
||||
markOptsStr = [ markOptsStr '}' ];
|
||||
|
||||
addplotoptstr = [ addplotoptstr ',' markOptsStr ];
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if length(addplotoptstr)
|
||||
addplotoptstr = [ '[' addplotoptstr ']' ];
|
||||
end
|
||||
|
||||
end
|
||||
fwrite( FID, [ ...
|
||||
'\addplot' addplotoptstr ' plot coordinates {' ENDL coordstr '};' ENDL ] );
|
||||
|
||||
end
|
||||
|
||||
|
||||
fwrite( FID, [ ...
|
||||
'\end{axis}' ENDL ...
|
||||
'\end{tikzpicture}%' ENDL ] );
|
||||
fclose(FID);
|
||||
|
||||
end
|
||||
|
||||
function cstr = matlabColorToPGFColor( C )
|
||||
|
||||
if length(C) ~= 3 | ischar(C) & strcmp(C,'none'), cstr = [];
|
||||
elseif norm( C - [0 0 1 ], 'inf' ) < 1e-10, cstr = 'blue';
|
||||
elseif norm( C - [0 1 0 ], 'inf' ) < 1e-10, cstr = 'green';
|
||||
elseif norm( C - [1 0 0 ], 'inf' ) < 1e-10, cstr = 'red';
|
||||
elseif norm( C - [0 1 1 ], 'inf' ) < 1e-10, cstr = 'cyan';
|
||||
elseif norm( C - [1 0 1 ], 'inf' ) < 1e-10, cstr = 'magenta';
|
||||
elseif norm( C - [1 1 0 ], 'inf' ) < 1e-10, cstr = 'yellow';
|
||||
elseif norm( C - [0 0 0 ], 'inf' ) < 1e-10, cstr = 'black';
|
||||
elseif norm( C - [1 1 1 ], 'inf' ) < 1e-10, cstr = 'white';
|
||||
else
|
||||
cstr= 'blue'; % FIXME
|
||||
% cstr = [ '{rgb:red,' num2str( floor( C(1)*100) ) ';green,' num2str(floor(C(2)*100)) ';blue,' num2str(floor(C(3)*100)) '}' ];
|
||||
end
|
||||
|
||||
end
|
79
texmf/tex/latex/pgfplots/scripts/matlab2pgfplots.sh
Executable file
79
texmf/tex/latex/pgfplots/scripts/matlab2pgfplots.sh
Executable file
|
@ -0,0 +1,79 @@
|
|||
#!/bin/sh
|
||||
|
||||
|
||||
CONVERT_STYLES=1
|
||||
CONVERT_AXES=1
|
||||
OUTFILE=""
|
||||
MAXPOINTS=100000
|
||||
|
||||
echoHelp()
|
||||
{
|
||||
echo "matlab2pgfplots.sh [--maxpoints N] [--styles [0|1] ] [ --axes [0|1] ] [ -o OUTFILE ] INFILE ..."
|
||||
echo "converts Matlab figures (.fig-files) to pgfplots-files (.pgf-files)."
|
||||
echo "This script is a front-end for matlab2pgfplots.m (which needs to be in matlab's search path)"
|
||||
echo "type"
|
||||
echo " >> help matlab2pgfplots"
|
||||
echo "at your matlab prompt for more information."
|
||||
exit 0
|
||||
}
|
||||
|
||||
LONGOPTS="styles:,axes:,help,maxpoints:"
|
||||
SHORTOPTS="o:"
|
||||
ARGS=`getopt -l "$LONGOPTS" "$SHORTOPTS" "$@"`
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "`basename $0`: Could not process command line arguments. Use the '--help' option for documentation."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
eval set -- "$ARGS"
|
||||
while [ $# -gt 0 ]; do
|
||||
ARG=$1
|
||||
# echo "PROCESSING OPTION '$ARG' (next = $@)"
|
||||
case "$ARG" in
|
||||
--maxpoints) shift; MAXPOINTS=$1; shift;;
|
||||
--styles) shift; CONVERT_STYLES="$1"; shift;;
|
||||
--axes) shift; CONVERT_AXES="$1"; shift;;
|
||||
-o) shift; OUTFILE="$1"; shift;;
|
||||
--help) shift; echoHelp;;
|
||||
--) shift; break;;
|
||||
*) break;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "No input files specified."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
HAS_OUTFILE=0
|
||||
if [ $# -gt 1 -a -n "$OUTFILE" ]; then
|
||||
HAS_OUTFILE=1
|
||||
fi
|
||||
|
||||
for A; do
|
||||
INFILE="$A"
|
||||
if [ $HAS_OUTFILE -eq 0 ]; then
|
||||
OUTFILE="${INFILE%%.*}.pgf"
|
||||
fi
|
||||
echo "$INFILE -> $OUTFILE ... "
|
||||
|
||||
M_LOGFILE=`mktemp`
|
||||
matlab -nojvm -nodesktop -nosplash 1>/dev/null 2>&1 -logfile $M_LOGFILE <<-EOF
|
||||
f=hgload( '$INFILE' );
|
||||
matlab2pgfplots( '$OUTFILE', 'fig', f, 'styles', $CONVERT_STYLES, 'axes', $CONVERT_AXES, 'maxpoints', $MAXPOINTS );
|
||||
exit
|
||||
EOF
|
||||
grep -q "Error" $M_LOGFILE
|
||||
CODE=$?
|
||||
if [ $CODE -eq 0 ]; then
|
||||
echo "Matlab output:" 1>&2
|
||||
cat $M_LOGFILE 1>&2
|
||||
CODE=1
|
||||
else
|
||||
CODE=0
|
||||
fi
|
||||
rm -f $M_LOGFILE
|
||||
if [ $CODE -ne 0 ]; then
|
||||
exit $CODE
|
||||
fi
|
||||
done
|
287
texmf/tex/latex/pgfplots/scripts/pgf2pdf.sh
Executable file
287
texmf/tex/latex/pgfplots/scripts/pgf2pdf.sh
Executable file
|
@ -0,0 +1,287 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# ATTENTION: this file is more or less deprecated.
|
||||
# Please take a look at the 'external' library which has been added to pgf.
|
||||
# At the time of this writing, this library is only available for pgf cvs (newer than 2.00).
|
||||
|
||||
TEX_FILE=""
|
||||
TEX_LOG_FILE=""
|
||||
|
||||
TEX_DEFINES=""
|
||||
|
||||
OLD_DIR=`pwd`
|
||||
|
||||
DRIVER="pdftex"
|
||||
|
||||
ALSO_EPS_OUTPUT=0
|
||||
WARN_ONLY_IF_TEXFILE_DOESNOT_INCLUDE_TARGET=0
|
||||
VERBOSE_LEVEL=0
|
||||
|
||||
function dumpHelp() {
|
||||
echo -e \
|
||||
"`basename $0` [OPTIONS] [--texdefs <defsfile> | --mainfile <latexmainfile>.tex ] [plot1.pgf plot2.pgf .... plotn.pgf]\n"\
|
||||
"converts each plot*.pgf to plot*.pdf.\n"\
|
||||
"This is done by running \n"\
|
||||
" latex --jobname plot1 latexmainfile\n"\
|
||||
"for each single plot. See the pgfmanual section \"Externalizing graphics\".\n"\
|
||||
"Options:\n"\
|
||||
"--eps\n"\
|
||||
" will also produce eps output files.\n"\
|
||||
"--driver D\n"\
|
||||
" will use either \"dvipdfm\", \"dvips\" or \"pdflatex\"\n"\
|
||||
" please note that only pdflatex works without additional\n"\
|
||||
" work.\n"\
|
||||
"--mainfile FILE\n"\
|
||||
" A tex-file which has been configured for externalized graphics.\n"\
|
||||
" Two conditions must be met to perform the conversion of\n"\
|
||||
" \"plot.pgf\" -> \"plot.pdf\":\n"\
|
||||
" 1. FILE needs the command\n"\
|
||||
" \pgfrealjobname{FILE}\n"\
|
||||
" (see the pgf manual for details)\n"\
|
||||
" 2. It needs to include \"plot.pgf\" somewhere (using \input{plot.pgf})\n"\
|
||||
"\n"\
|
||||
"--warnonly\n"\
|
||||
" Use this flag if the argument of --mainfile does not contain\n"\
|
||||
" \input{TARGET.pgf},\n"\
|
||||
" i.e. if (2.) is not fulfilled. In this case, the conversion for this\n"\
|
||||
" input file will be skipped.\n"\
|
||||
"\n"\
|
||||
"--texdefs FILE\n"\
|
||||
" Generates a temporary tex-file\n"\
|
||||
" \documentclass{article}\n"\
|
||||
" \input{FILE}\n"\
|
||||
" \begin{document}\n"\
|
||||
" \input{plot1.pgf}\n"\
|
||||
" \end{document}\n"\
|
||||
" and converts this one to pdf.\n"\
|
||||
" If FILE is '-', the input step is omitted.\n"
|
||||
"-v\n"\
|
||||
" each -v option increases the verbosity.\n"\
|
||||
""
|
||||
exit 0;
|
||||
}
|
||||
|
||||
|
||||
LONGOPTS="mainfile:,eps,driver:,texdefs:,warnonly,help"
|
||||
SHORTOPTS="f:t:v"
|
||||
ARGS=`getopt -l "$LONGOPTS" "$SHORTOPTS" "$@"`
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "`basename $0`: Could not process command line arguments. Use the '--help' option for documentation."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
eval set -- "$ARGS"
|
||||
while [ $# -gt 0 ]; do
|
||||
ARG=$1
|
||||
# echo "PROCESSING OPTION '$ARG' (next = $@)"
|
||||
case "$ARG" in
|
||||
--texdefs|-t) shift; TEX_DEFINES="$1"; shift;;
|
||||
--driver) shift; DRIVER="$1"; shift;;
|
||||
--mainfile|-f) shift; TEX_FILE="$1"; TEX_LOG_FILE="${1%%.tex}.log"; shift;;
|
||||
--eps) shift; ALSO_EPS_OUTPUT=1;;
|
||||
--warnonly) shift; WARN_ONLY_IF_TEXFILE_DOESNOT_INCLUDE_TARGET=1;;
|
||||
-v) shift; VERBOSE_LEVEL=$((VERBOSE_LEVEL+1));;
|
||||
--) shift; break;;
|
||||
--help) dumpHelp();;
|
||||
*) break;
|
||||
esac
|
||||
done
|
||||
if [ -n "${TEX_DEFINES}" ]; then
|
||||
if [ "${TEX_DEFINES:0:1}" != "/" ]; then
|
||||
TEX_DEFINES=`pwd`/${TEX_DEFINES}
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if [ $# -ne 0 ]; then
|
||||
PGF_FILES=("$@")
|
||||
elif [ -n "${TEX_LOG_FILE}" ]; then
|
||||
# search for lines with
|
||||
# (XXXX.pgf
|
||||
PGF_FILES=(`sed -n '{s/.*(\([a-zA-Z0-9._-+^~]\+\.pgf\).*/\1/g;T ende;p};: ende' < $TEX_LOG_FILE`)
|
||||
#PGF_FILES=(./errplot_L2.pgf)
|
||||
else
|
||||
echo "No input files." 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for A in "${PGF_FILES[@]}"; do
|
||||
if [ ! -f "$A" ]; then
|
||||
echo "$A not found: no such file" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CONTINUE_ON_ERROR=0
|
||||
|
||||
TARGET_FILE=$(sed -n '{s/.*\\beginpgfgraphicnamed{\(.*\)}.*/\1/g;T ende;p};: ende' < "$A")
|
||||
if [ $? -ne 0 -o -z "$TARGET_FILE" ]; then
|
||||
echo "There is no valid \\beginpgfgraphicnamed{TARGET}...\\endpgfgraphicnamed command in $A. Can't be exported to pdf. Please see the PGF manual for details." 1>&2
|
||||
exit 1
|
||||
fi
|
||||
echo "processing \"$A\"" 1>&2
|
||||
|
||||
CMD="latex"
|
||||
case $DRIVER in
|
||||
pdftex|pdflatex)
|
||||
CMD="pdflatex"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z "${TEX_DEFINES}" ]; then
|
||||
# LaTeX cannot write into a \jobname in another directory.
|
||||
# But the TEX_FILE and $A may not necessarily be in the same directory!
|
||||
#
|
||||
# So, we have to build a work-around which simulates a \jobname in the directory of TEX_FILE
|
||||
# which does not fool \beginpgfgraphicnamed
|
||||
|
||||
# modify the input file A:
|
||||
ORIGINAL_FILE="$A.orig"
|
||||
mv "$A" "$ORIGINAL_FILE" || exit 1
|
||||
cat - "$ORIGINAL_FILE" >"$A" <<-EOF
|
||||
\let\tmpXXXXXZEUGoldjobname=\jobname
|
||||
\def\jobname{${TARGET_FILE}}%
|
||||
\message{PGF2PDF: TEX HAS ENTERED THE TARGET FILE...}%
|
||||
EOF
|
||||
cat >> "$A" <<-EOF
|
||||
\let\jobname=\tmpXXXXXZEUGoldjobname
|
||||
EOF
|
||||
|
||||
cd `dirname "${TEX_FILE}"`
|
||||
|
||||
# generate a temp \jobname in the current directory:
|
||||
TMP_JOB_FILE=`mktemp ./tmppgf2pdfXXXXXX`
|
||||
if [ $? -ne 0 ]; then exit 1; fi
|
||||
rm -f "$TMP_JOB_FILE"
|
||||
|
||||
$CMD --interaction nonstopmode --jobname "$TMP_JOB_FILE" "${TEX_FILE}" 1>/dev/null
|
||||
CODE=$?
|
||||
|
||||
INTERM_EXTENSION="dvi"
|
||||
case $DRIVER in
|
||||
pdftex|pdflatex)
|
||||
INTERM_EXTENSION="pdf"
|
||||
;;
|
||||
dvipdfm)
|
||||
INTERM_EXTENSION="dvi"
|
||||
;;
|
||||
dvips)
|
||||
INTERM_EXTENSION="dvi"
|
||||
;;
|
||||
esac
|
||||
if [ ! -s "$TMP_JOB_FILE.$INTERM_EXTENSION" ]; then
|
||||
if [ $VERBOSE_LEVEL -ge 1 ]; then
|
||||
if [ $WARN_ONLY_IF_TEXFILE_DOESNOT_INCLUDE_TARGET -eq 1 ]; then
|
||||
echo -n "WARNING: ";
|
||||
else
|
||||
echo -n "ERROR: ";
|
||||
fi
|
||||
echo -e "running\n"\
|
||||
" '$CMD --jobname $TMP_JOB_FILE $TEX_FILE'\n"\
|
||||
"resulted in a zero-size file \"$TMP_JOB_FILE.$INTERM_EXTENSION\"!\n"\
|
||||
"Please check\n"\
|
||||
"- if $TEX_FILE contains\n"\
|
||||
" \pgfrealjobname{`basename ${TEX_FILE%%.tex}`}\n"\
|
||||
"- if $TEX_FILE contains\n"\
|
||||
" \input{$A}\n"\
|
||||
"\n"\
|
||||
"You may take a look at\n\t$TARGET_FILE.log\n for more information.\n"\
|
||||
"Maybe `basename $0` --texdefs is more appropriate for this application?\n"\
|
||||
"It doesn't need \input{}...\n"\
|
||||
1>&2
|
||||
fi
|
||||
|
||||
CODE=1
|
||||
if [ $WARN_ONLY_IF_TEXFILE_DOESNOT_INCLUDE_TARGET -eq 1 ]; then
|
||||
CONTINUE_ON_ERROR=1
|
||||
fi
|
||||
rm -f $TMP_JOB_FILE.{$INTERM_EXTENSION,pdf}
|
||||
fi
|
||||
|
||||
|
||||
# FIXME: this here may clash if A and TARGET_FILE have inconsistent paths!
|
||||
mv "$ORIGINAL_FILE" "$A" || exit 1
|
||||
for QQ in $TMP_JOB_FILE.*; do
|
||||
if [ "$TARGET_FILE.${QQ##*.}" != "$A" ]; then
|
||||
mv "$QQ" "$TARGET_FILE.${QQ##*.}" || exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
cd "$OLD_DIR"
|
||||
else
|
||||
# Die Idee hier ist wie folgt:
|
||||
# - Erstelle ein fast leeres Tex-File
|
||||
# - darin steht NUR
|
||||
# \input $TEX_DEFINES
|
||||
# und
|
||||
# \input $A
|
||||
# - das TeX-file wird mit pgflatex uebersetzt
|
||||
# - die ausgabe wird nach $TARGET_FILE geschrieben
|
||||
# - fertig.
|
||||
#
|
||||
# BUGS:
|
||||
# - TARGET_FILE != A wird nicht funktionieren (nur die endungen natuerlich)
|
||||
DRIVER="pdftex"
|
||||
cd `dirname "$A"`
|
||||
BASE=`basename $TARGET_FILE`
|
||||
TMP_TEX_FILE=`mktemp tmp_${BASE}_XXXXXX`
|
||||
mv "$TMP_TEX_FILE" "${TMP_TEX_FILE}.tex"
|
||||
TMP_TEX_FILE="$TMP_TEX_FILE.tex"
|
||||
rm -f "${BASE}.pdf"
|
||||
|
||||
cat >"$TMP_TEX_FILE" <<-EOF
|
||||
\documentclass{report}
|
||||
|
||||
\input{${TEX_DEFINES}}
|
||||
|
||||
%\def\pgfsysdriver{pgfsys-dvipdfm.def}
|
||||
%\def\pgfsysdriver{pgfsys-pdftex.def}
|
||||
\usepackage{tikz}
|
||||
\pgfrealjobname{${TMP_TEX_FILE%%.tex}}
|
||||
\begin{document}
|
||||
\let\oldjobname=\jobname%
|
||||
% make sure that PGF recognises that jobname==target file name
|
||||
% even if --jobname has a different path.
|
||||
\def\jobname{${TARGET_FILE}}%
|
||||
\input{`basename $A`}%
|
||||
\let\jobname=\oldjobname
|
||||
\end{document}
|
||||
EOF
|
||||
$CMD --interaction nonstopmode --jobname "$BASE" "${TMP_TEX_FILE}" 1>/dev/null
|
||||
CODE=$?
|
||||
if [ $CODE -eq 0 ]; then
|
||||
rm -f "$TMP_TEX_FILE"
|
||||
fi
|
||||
cd $OLD_DIR
|
||||
fi
|
||||
|
||||
if [ $CODE -ne 0 ]; then
|
||||
rm -f "${TARGET_FILE}.pdf"
|
||||
if [ $CONTINUE_ON_ERROR -eq 1 ]; then
|
||||
echo "WARNING: $A SKIPPED [use -v for messages]." 1>&2
|
||||
CODE=0
|
||||
continue
|
||||
else
|
||||
echo -e "FAILED: could not convert\n\t$A\n->\t$TARGET_FILE.pdf" 1>&2;
|
||||
exit 1;
|
||||
fi
|
||||
fi
|
||||
CMD=""
|
||||
case $DRIVER in
|
||||
dvipdfm)
|
||||
dvipdfm -o ${TARGET_FILE}.pdf "${TARGET_FILE}.dvi" || exit 1
|
||||
pdfcrop "${TARGET_FILE}.pdf" "${TARGET_FILE}.pdf" || exit 1
|
||||
;;
|
||||
dvips)
|
||||
dvipdfm -o ${TARGET_FILE}.ps "${TARGET_FILE}.dvi" || exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ $ALSO_EPS_OUTPUT -eq 1 ]; then
|
||||
pdftops -f 1 -l 1 -eps "${TARGET_FILE}.pdf" "${TARGET_FILE}.eps"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Conversion pdf -> eps FAILED!" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
cd $OLD_DIR
|
95
texmf/tex/latex/pgfplots/scripts/pgfplots.py
Normal file
95
texmf/tex/latex/pgfplots/scripts/pgfplots.py
Normal file
|
@ -0,0 +1,95 @@
|
|||
"""Module to plot using Pgfplots.
|
||||
|
||||
This module provides a means to create and display a graph very quickly.
|
||||
|
||||
In this code, the program used to display the created PDF is 'xpdf'. Change
|
||||
it to your favorite PDF reader, such as Acrobat Reader (called acroread or
|
||||
something similar)
|
||||
|
||||
The code used to generate the graph is printed in the command line. Edit
|
||||
your graph iteratively, and when you are satisfied with the graph, copy and
|
||||
paste the relevant part to your TEX file.
|
||||
|
||||
This module requires the numpy module.
|
||||
|
||||
For example of usage, see the executable part at the bottom.
|
||||
|
||||
|
||||
ATTENTION: this file has been provided by 3rd party users in the hope that it
|
||||
may be useful. However, it is not maintained by the pgfplots team as such. Use at your own risk.
|
||||
|
||||
See also a related (improved) pgfplots code generation for python on https://github.com/olivierverdier/pygfplots
|
||||
|
||||
"""
|
||||
import numpy as np
|
||||
import subprocess
|
||||
import os
|
||||
GRAPH_N = 0
|
||||
|
||||
class Pgf:
|
||||
def __init__(z, xlabel='', ylabel=''):
|
||||
"""Initialize and provide axis labels."""
|
||||
z.buf = []
|
||||
z.options = []
|
||||
z.opt('xlabel={{{0}}}'.format(xlabel))
|
||||
z.opt('ylabel={{{0}}}'.format(ylabel))
|
||||
z.legend = []
|
||||
def opt(z, *args):
|
||||
"""Write arguments to the AXIS environment."""
|
||||
for arg in args:
|
||||
z.options.append(arg)
|
||||
def plot(z, x, y, legend=None, *args):
|
||||
"""Plot the data contained in the vectors x and y.
|
||||
|
||||
Options to the \addplot command can be provided in *args.
|
||||
"""
|
||||
coor = ''.join(['({0}, {1})'. format(u, v) for u, v in zip(x,y)])
|
||||
z.buf.append('\\addplot{0} coordinates {{{1}}};\n'.format(
|
||||
('[' + ', '.join(args) + ']') if len(args) else '' ,coor))
|
||||
if legend is not None:
|
||||
z.legend.append(legend)
|
||||
def save(z, graph_n=None):
|
||||
"""Generate graph.
|
||||
|
||||
If graph_n is None or a number, the graph in a file beginning with
|
||||
zzz. This file is meant to be temporary. If graph_n is a string,
|
||||
that string is used as the file name.
|
||||
"""
|
||||
if type(graph_n) is str:
|
||||
file_name = graph_n
|
||||
else:
|
||||
if graph_n is None:
|
||||
global GRAPH_N
|
||||
graph_n = GRAPH_N
|
||||
GRAPH_N += 1
|
||||
elif type(graph_n) is not int:
|
||||
raise Error('graph_n should be a string or an integer')
|
||||
file_name = 'zzz{0}'.format(graph_n)
|
||||
with open(file_name + '.tex', 'w') as f:
|
||||
b = []
|
||||
b.append('\\documentclass{article}\n')
|
||||
b.append('\\usepackage{pgfplots}\n')
|
||||
b.append('\\begin{document}\n')
|
||||
b.append('\\begin{tikzpicture}')
|
||||
b.append('\\begin{axis}[\n')
|
||||
b.append('{0}]'.format(',\n'.join(z.options)))
|
||||
b.extend(z.buf)
|
||||
if z.legend:
|
||||
b.append('\\legend{{' + '}, {'.join(z.legend) + '}}\n')
|
||||
b.append('\\end{axis}\n')
|
||||
b.append('\\end{tikzpicture}\n')
|
||||
b.append('\\end{document}')
|
||||
f.writelines(b)
|
||||
print(''.join(b))
|
||||
os.system('pdflatex {0}.tex'.format(file_name))
|
||||
os.remove(file_name + '.aux')
|
||||
os.remove(file_name + '.log')
|
||||
subprocess.Popen(['xpdf', '{0}.pdf'.format(file_name)])
|
||||
if __name__ == '__main__':
|
||||
"""Example of usage."""
|
||||
x = np.linspace(0, 2*np.pi)
|
||||
p = Pgf('time', 'Voltage')
|
||||
p.opt('ybar')
|
||||
p.plot(x, np.sin(x), 'sin')
|
||||
p.plot(x, np.cos(x), 'cos')
|
||||
p.save()#'graph_test_pgf_1')
|
BIN
texmf/tex/latex/pgfplots/source/pgfplotstests.context.tar.bz2
Normal file
BIN
texmf/tex/latex/pgfplots/source/pgfplotstests.context.tar.bz2
Normal file
Binary file not shown.
BIN
texmf/tex/latex/pgfplots/source/pgfplotstests.tar.bz2
Normal file
BIN
texmf/tex/latex/pgfplots/source/pgfplotstests.tar.bz2
Normal file
Binary file not shown.
429
texmf/tex/latex/pgfplots/tex/bugtracker.sty
Normal file
429
texmf/tex/latex/pgfplots/tex/bugtracker.sty
Normal file
|
@ -0,0 +1,429 @@
|
|||
%--------------------------------------------------
|
||||
% Provides a simple, text-based bug tracker.
|
||||
%
|
||||
% Idea: simply write a text-todo list into a tex file, and write
|
||||
% trivial support macros which allow to provide priorities, status
|
||||
% flags and sorting capabilities. Sort key:
|
||||
% (section,isactive,priority). Can be processed with pgfplotstable.
|
||||
% Could also support the codeexample environment of pgfmanual.
|
||||
% -> Advantages:
|
||||
% - simple human readable text files (I like that!)
|
||||
% - independent of any tool
|
||||
% - can be sorted
|
||||
% UI:
|
||||
% \begin{feature}[<status>][prio=<num>]
|
||||
% <text>
|
||||
% \end{feature}
|
||||
%
|
||||
% \begin{bug}[<status>][prio=<num>]
|
||||
% <text>
|
||||
% \end{bug}
|
||||
% Idea: collect *all* entries in one huge array, then sort this array, then
|
||||
% typeset the result. Should work reasonably, I guess. If it is too slow,
|
||||
% typeset directly.
|
||||
%--------------------------------------------------
|
||||
%
|
||||
\ProvidesPackage{bugtracker}[2010/07/23 Version 0.1]
|
||||
|
||||
\RequirePackage{pgfplotstable}
|
||||
\RequirePackage{listings}
|
||||
\RequirePackage{hyperref}
|
||||
|
||||
\ifx\scantokens\@undefined
|
||||
\PackageError{pgfmanual-macros}{You need to use extended latex
|
||||
(elatex) or (pdfelatex) to process this document}{}
|
||||
\fi
|
||||
|
||||
\def\bugtracker@init@items{%
|
||||
}%
|
||||
|
||||
{
|
||||
\catcode`\[=1
|
||||
\catcode`\]=2
|
||||
\catcode`\{=12
|
||||
\catcode`\}=12
|
||||
\gdef\bugtracker@lbrace[{]
|
||||
\gdef\bugtracker@rbrace[}]
|
||||
]
|
||||
{
|
||||
\catcode`\|=0
|
||||
|catcode`\\=12
|
||||
|gdef|bugtracker@bslash{\}
|
||||
}
|
||||
|
||||
% #1: the environment (item) name
|
||||
% #2: the sort order (an integer)
|
||||
\def\declarebugtrackeritem#1#2{%
|
||||
\expandafter\def\expandafter\bugtracker@init@items\expandafter{%
|
||||
\bugtracker@init@items
|
||||
\expandafter\gdef\csname c@bugtracker@#1\endcsname{0}%
|
||||
}%
|
||||
\expandafter\edef\csname bugtracker@end@#1\endcsname{\bugtracker@bslash end\bugtracker@lbrace #1\bugtracker@rbrace}%
|
||||
\expandafter\def\csname #1\endcsname{\bugtracker@collect{#1}}%
|
||||
\expandafter\def\csname end#1\endcsname{\relax}%
|
||||
\pgfkeyssetvalue{/bugtracker/sort order/#1}{#2}%
|
||||
}%
|
||||
|
||||
\newif\ifbugtracker@sort
|
||||
|
||||
\newenvironment{bugtracker}{%
|
||||
\let\bugtracker@enqueue=\bugtracker@enqueue@ACTIVE
|
||||
\pgfplotsarraynewemptyglobal\bugtrackeritems
|
||||
}{%
|
||||
\ifbugtracker@sort
|
||||
\begingroup
|
||||
\pgfkeyslet{/pgfplots/iflessthan/.@cmd}\bugtracker@iflessthan
|
||||
\pgfkeysdef{/pgfplots/array/unscope pre}{\bugtracker@typeset}%
|
||||
\pgfkeysdef{/pgfplots/array/unscope post}{}%
|
||||
\pgfplotsarraysort\bugtrackeritems
|
||||
\endgroup
|
||||
\else
|
||||
\bugtracker@typeset
|
||||
\fi
|
||||
}%
|
||||
|
||||
\def\bugtrackerset{\pgfqkeys{/bugtracker}}%
|
||||
|
||||
|
||||
\def\bugtracker@collect#1{%
|
||||
\pgfutil@ifnextchar[{%
|
||||
\bugtracker@collect@status{#1}%
|
||||
}{%
|
||||
\bugtracker@collect@status{#1}[open]%
|
||||
}%
|
||||
}%
|
||||
\def\bugtracker@collect@status#1[#2]{%
|
||||
\pgfutil@ifnextchar[{%
|
||||
\bugtracker@collect@status@opt{#1}[#2]%
|
||||
}{%
|
||||
\bugtracker@collect@status@opt{#1}[#2][]%
|
||||
}%
|
||||
}%
|
||||
\def\bugtracker@collect@status@opt#1[#2][#3]{%
|
||||
\begingroup
|
||||
\bugtrackerset{#2,#3}%
|
||||
\expandafter\let\expandafter\bugtracker@temp\csname bugtracker@end@#1\endcsname
|
||||
\expandafter\long\expandafter\def\expandafter\bugtracker@collect@until\expandafter##\expandafter1\bugtracker@temp{\bugtracker@enqueue{#1}{##1}}%
|
||||
\bugtracker@prepare@collect
|
||||
\bugtracker@collect@until
|
||||
}%
|
||||
|
||||
|
||||
\def\bugtracker@prepare@collect{%
|
||||
\def\do##1{\catcode`##1=12 }\dospecials
|
||||
\catcode`\^^M=12
|
||||
\catcode`\^^J=12
|
||||
\catcode`\^^I=12
|
||||
}%
|
||||
|
||||
\def\bugtracker@restore@catcodes{%
|
||||
\catcode`\^^M=5
|
||||
\catcode`\^^J=10
|
||||
\catcode`\^^I=10
|
||||
% this is important to get \scantokens to work: otherwise, it will
|
||||
% eat up the ^^M chars:
|
||||
\endlinechar=`\^^M
|
||||
\newlinechar=\endlinechar
|
||||
}%
|
||||
|
||||
\long\def\bugtracker@enqueue#1#2{%
|
||||
\edef\bugtracker@status@order{\pgfkeysvalueof{/bugtracker/status order/\bugtracker@status}}%
|
||||
\ifx\bugtracker@status@order\pgfutil@empty
|
||||
% status order/<status name>={} --> do not display it!
|
||||
\else
|
||||
\toks0={#2}%
|
||||
% some of these values are used during the sort procedure; that's
|
||||
% why they are not simply a list of keys. Perhaps they should
|
||||
% still be a list of keys...
|
||||
\edef\bugtracker@entry{{#1}{\bugtracker@status}{\pgfkeysvalueof{/bugtracker/prio}}{\the\toks0}{\the\inputlineno}{\pgfkeysvalueof{/bugtracker/epic}}}%
|
||||
\expandafter\pgfplotsarraypushbackglobal\expandafter{\bugtracker@entry}\to\bugtrackeritems
|
||||
\fi
|
||||
\endgroup
|
||||
\end{#1}%
|
||||
}%
|
||||
\let\bugtracker@enqueue@ACTIVE=\bugtracker@enqueue
|
||||
\long\def\bugtracker@enqueue#1#2{%
|
||||
\PackageError{bugtracker}{Sorry, bug tracker elements can only be used inside of \string\begin{bugtracker} ... \string\end{bugtracker}. Discarding this element}{}%
|
||||
}%
|
||||
|
||||
\long\def\bugtracker@unpack#1#2#3#4#5#6{%
|
||||
\bugtrackerset{name={#1},status=#2,prio=#3,source line={#5},epic={#6}}%
|
||||
\def\bugtracker@content{#4}%
|
||||
}%
|
||||
|
||||
\long\def\bugtracker@unpack@sorting#1#2#3#4#5#6{%
|
||||
\edef\bugtracker@name {\pgfkeysvalueof{/bugtracker/sort order/#1}}%
|
||||
\edef\bugtracker@status{\pgfkeysvalueof{/bugtracker/status order/#2}}%
|
||||
\def\bugtracker@prio{#3}%
|
||||
\def\bugtracker@source{#5}%
|
||||
}%
|
||||
\def\bugtracker@iflessthan#1#2#3#4\pgfeov{%
|
||||
\expandafter\bugtracker@unpack@sorting#1%
|
||||
\let\bugtracker@nameA=\bugtracker@name
|
||||
\let\bugtracker@statusA=\bugtracker@status
|
||||
\let\bugtracker@prioA=\bugtracker@prio
|
||||
\let\bugtracker@sourceA=\bugtracker@source
|
||||
%
|
||||
\expandafter\bugtracker@unpack@sorting#2%
|
||||
%
|
||||
\def\bugtracker@lt{0}%
|
||||
\ifnum\bugtracker@nameA<\bugtracker@name
|
||||
\def\bugtracker@lt{1}%
|
||||
\else
|
||||
\ifnum\bugtracker@nameA=\bugtracker@name
|
||||
\ifnum\bugtracker@statusA<\bugtracker@status
|
||||
\def\bugtracker@lt{1}%
|
||||
\else
|
||||
\ifnum\bugtracker@statusA=\bugtracker@status
|
||||
\ifnum\bugtracker@prioA>\bugtracker@prio
|
||||
\def\bugtracker@lt{1}%
|
||||
\else
|
||||
\ifnum\bugtracker@prioA=\bugtracker@prio
|
||||
\ifnum\bugtracker@sourceA<\bugtracker@source
|
||||
\def\bugtracker@lt{1}%
|
||||
%\else
|
||||
%\ifnum\bugtracker@sourceA=\bugtracker@source
|
||||
%\fi
|
||||
\fi
|
||||
\fi
|
||||
\fi
|
||||
\fi
|
||||
\fi
|
||||
\fi
|
||||
\fi
|
||||
\if1\bugtracker@lt #3\else #4\fi
|
||||
}%
|
||||
|
||||
|
||||
\long\def\bugtracker@typeset@#1#2{%
|
||||
\pgfkeysvalueof{/bugtracker/typeset/.@cmd}{#1}{#2}\pgfeov
|
||||
}%
|
||||
|
||||
\def\bugtracker@typeset{%
|
||||
\let\minimal=\bugtracker@minimal@env
|
||||
\def\endminimal{\relax}%
|
||||
%
|
||||
\pgfkeysvalueof{/bugtracker/font}%
|
||||
\bugtracker@init@items
|
||||
\gdef\bugtracker@isfirst{1}%
|
||||
\pgfplotsarrayforeach\bugtrackeritems\as\entry{%
|
||||
\if1\bugtracker@isfirst
|
||||
\else
|
||||
\vskip\pgfkeysvalueof{/bugtracker/vskip}
|
||||
\fi
|
||||
\expandafter\bugtracker@unpack\entry
|
||||
%
|
||||
\edef\c@bugtracker{\csname c@bugtracker@\pgfkeysvalueof{/bugtracker/name}\endcsname}%
|
||||
\expandafter\pgfplotsutil@advancestringcounter@global\csname c@bugtracker@\pgfkeysvalueof{/bugtracker/name}\endcsname
|
||||
%
|
||||
\message{bugtracker: processing \jobname.tex:\pgfkeysvalueof{/bugtracker/source line}...^^J}%
|
||||
\begingroup
|
||||
\bugtracker@restore@catcodes
|
||||
\expandafter\bugtracker@typeset@\expandafter{\expandafter\scantokens\expandafter{\bugtracker@content}}{\c@bugtracker}%%
|
||||
\endgroup
|
||||
\gdef\bugtracker@isfirst{0}%
|
||||
}%
|
||||
}%
|
||||
|
||||
\bugtrackerset{
|
||||
sort/.is if=bugtracker@sort,
|
||||
sort=true,
|
||||
name/.initial=,
|
||||
typeset name/.code={%
|
||||
\pgfkeysifdefined{/bugtracker/name text/#1}{%
|
||||
\pgfkeysvalueof{/bugtracker/name text/#1}%
|
||||
}{%
|
||||
#1%
|
||||
}%
|
||||
},
|
||||
prio/.initial=5,
|
||||
epic/.initial=,
|
||||
source line/.initial=,
|
||||
status/.is choice,
|
||||
status/open/.code= {\def\bugtracker@status{open}},
|
||||
status/closed/.code= {\def\bugtracker@status{closed}},
|
||||
status/cancelled/.code= {\def\bugtracker@status{cancelled}},
|
||||
status/partially/.code= {\def\bugtracker@status{partially}},
|
||||
status/-/.style= {/bugtracker/status/open},
|
||||
status/+/.style= {/bugtracker/status/closed},
|
||||
status/X/.style= {/bugtracker/status/cancelled},
|
||||
status=open,
|
||||
% status order/<statusname>/.initial=int . Empty means:
|
||||
% do not display it at all.
|
||||
status order/open/.initial=0,
|
||||
status order/closed/.initial=,%10,
|
||||
status order/cancelled/.initial=7,
|
||||
status order/partially/.initial=1,
|
||||
shell escape/.initial=-shell-escape,
|
||||
prefix/.initial=\jobname-,
|
||||
file ext/.initial=pdf,
|
||||
system call/.initial={pdflatex \bugtracker@checkshellescape -halt-on-error -interaction=batchmode -jobname "\image" "\texsource"},
|
||||
vskip/.initial=\baselineskip,
|
||||
font/.initial={%
|
||||
\parindent=0pt
|
||||
\raggedright
|
||||
},
|
||||
% #1: a running index.
|
||||
typeset id/.code={%
|
||||
\begin{minipage}[t]{3cm}%
|
||||
\raggedleft
|
||||
%[\##1]\par
|
||||
{\ttfamily \jobname.tex:\pgfkeysvalueof{/bugtracker/source line}}
|
||||
\end{minipage}
|
||||
},
|
||||
typeset/.code 2 args={%
|
||||
\noindent
|
||||
\paragraph{%
|
||||
\protect\llap{\normalfont\scriptsize \protect\bugtrackerset{/bugtracker/typeset id=#2}\hspace{2em}}%
|
||||
\protect\bugtrackerset{/bugtracker/typeset name={\pgfkeysvalueof{/bugtracker/name}}}
|
||||
% \##2
|
||||
}
|
||||
[\bugtracker@status, Priority \pgfkeysvalueof{/bugtracker/prio}, Epic `\pgfkeysvalueof{/bugtracker/epic}']
|
||||
\vskip4pt
|
||||
{%
|
||||
\noindent
|
||||
\parskip=\baselineskip
|
||||
#1%
|
||||
\par
|
||||
}%
|
||||
%{\scriptsize Entry in {\ttfamily \jobname.tex:\pgfkeysvalueof{/bugtracker/source line}}}%
|
||||
},%
|
||||
typeset minimal/.code={%
|
||||
\ifvmode
|
||||
\noindent
|
||||
\fi
|
||||
\href{file:\bugtracker@minimal@filename@}{[\textcolor{blue}{see \texttt{\filename}}]}%
|
||||
\bugtracker@minimal@typeset@{#1}%
|
||||
},
|
||||
.unknown/.code={%
|
||||
\edef\bugtracker@tempkey{\noexpand\pgfkeysalso{/bugtracker/status=\pgfkeyscurrentname}}%
|
||||
\bugtracker@tempkey
|
||||
},
|
||||
}
|
||||
|
||||
\declarebugtrackeritem{feature}{10}
|
||||
\declarebugtrackeritem{bug}{5}
|
||||
\declarebugtrackeritem{doctodo}{0}
|
||||
|
||||
\bugtrackerset{
|
||||
name text/feature/.initial=Feature Proposal,
|
||||
name text/bug/.initial=Bug,
|
||||
name text/doctodo/.initial=Documentation Todo,
|
||||
}
|
||||
|
||||
|
||||
\lstdefinestyle{minimalexample}{
|
||||
basicstyle=\ttfamily\footnotesize,
|
||||
columns=fullflexible,
|
||||
}
|
||||
|
||||
|
||||
% a
|
||||
% \begin{minimal}
|
||||
% \end{minimal}
|
||||
% environment which is executed automatically :
|
||||
\newcount\c@bugtracker@minimal
|
||||
\c@bugtracker@minimal=0
|
||||
|
||||
\def\bugtracker@minimal@env{%
|
||||
\begingroup
|
||||
\bugtracker@prepare@collect
|
||||
\bugtracker@minimal@collect
|
||||
}%
|
||||
\expandafter\edef\csname bugtracker@temp\endcsname{\bugtracker@bslash end\bugtracker@lbrace minimal\bugtracker@rbrace}%
|
||||
\expandafter\long\expandafter\def\expandafter\bugtracker@minimal@collect\expandafter#\expandafter1\bugtracker@temp{%
|
||||
\endgroup
|
||||
\edef\bugtracker@minimal@filename{\pgfkeysvalueof{/bugtracker/prefix}\the\c@bugtracker@minimal}%
|
||||
\edef\bugtracker@minimal@filename@{\bugtracker@minimal@filename.\pgfkeysvalueof{/bugtracker/file ext}}%
|
||||
\global\advance\c@bugtracker@minimal by1
|
||||
%
|
||||
\IfFileExists{\bugtracker@minimal@filename@}{}{%
|
||||
\bugtracker@minimal@create{#1}%
|
||||
}%
|
||||
\bugtracker@minimal@typeset{#1}%
|
||||
\end{minimal}%
|
||||
}%
|
||||
\long\def\bugtracker@minimal@typeset#1{%
|
||||
\begingroup
|
||||
\pgfplotscommandtostring\bugtracker@minimal@filename@\filename
|
||||
\bugtracker@restore@catcodes
|
||||
\edef\bugtracker@temp##1{%
|
||||
\bugtracker@bslash begin{lstlisting}[style=minimalexample]%
|
||||
##1%
|
||||
\bugtracker@bslash end{lstlisting}%
|
||||
}%
|
||||
\def\bugtracker@temp@##1{\pgfkeysvalueof{/bugtracker/typeset minimal/.@cmd}{##1}\pgfeov}%
|
||||
\expandafter\bugtracker@temp@\expandafter{\bugtracker@temp{#1}}%
|
||||
\endgroup
|
||||
}%
|
||||
\long\def\bugtracker@minimal@typeset@#1{%
|
||||
\scantokens{#1}%
|
||||
}%
|
||||
\long\def\bugtracker@minimal@create#1{%
|
||||
%
|
||||
\immediate\openout\w@pgf@writea=\bugtracker@minimal@filename\relax
|
||||
\immediate\write\w@pgf@writea{#1}%
|
||||
\immediate\closeout\w@pgf@writea
|
||||
%
|
||||
\bugtracker@assemble@systemcall\bugtracker@minimal@filename\bugtracker@temp
|
||||
\message{Issuing system-call^^J$ \bugtracker@temp^^J}%
|
||||
\immediate\write18{\bugtracker@temp}%
|
||||
\IfFileExists{\bugtracker@minimal@filename@}{}{%
|
||||
\PackageError{bugtracker}{Sorry, the system call '\bugtracker@temp' did NOT result in a usable output file '\bugtracker@minimal@filename@' (adjust '/bugtracker/file ext' if needed). 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 '\bugtracker@minimal@filename.log'}{}%
|
||||
}%
|
||||
}
|
||||
|
||||
{
|
||||
\catcode`\"=12
|
||||
\catcode`\'=12
|
||||
\catcode`\;=12
|
||||
\catcode`\&=12
|
||||
\catcode`\-=12
|
||||
\xdef\bugtracker@normal@dq{"}
|
||||
\xdef\bugtracker@normal@sq{'}
|
||||
\xdef\bugtracker@normal@semic{;}
|
||||
\xdef\bugtracker@normal@and{&}
|
||||
\xdef\bugtracker@normal@dash{-}
|
||||
\catcode`\"=13
|
||||
\catcode`\'=13
|
||||
\catcode`\;=13
|
||||
\catcode`\&=13
|
||||
\catcode`\-=13
|
||||
\gdef\bugtracker@activate@normal@dq{\let"=\bugtracker@normal@dq}
|
||||
\gdef\bugtracker@activate@normal@sq{\let'=\bugtracker@normal@sq}
|
||||
\gdef\bugtracker@activate@normal@semic{\let;=\bugtracker@normal@semic}
|
||||
\gdef\bugtracker@activate@normal@and{\let&=\bugtracker@normal@and}
|
||||
\gdef\bugtracker@activate@normal@dash{\let-=\bugtracker@normal@dash}
|
||||
\catcode`\|=0
|
||||
\catcode`\\=12
|
||||
|xdef|bugtracker@normal@backslash{\}%
|
||||
}
|
||||
% Creates the '/bugtracker/system call' command as string and
|
||||
% returns it into the (global!) macro #2.
|
||||
% #1: the output file name
|
||||
% #2: the global return value macro
|
||||
%
|
||||
\def\bugtracker@assemble@systemcall#1#2{%
|
||||
\begingroup
|
||||
\def\image{#1}%
|
||||
\let\texsource=\image
|
||||
\ifnum\the\catcode`\"=13 \bugtracker@activate@normal@dq\fi
|
||||
\ifnum\the\catcode`\'=13 \bugtracker@activate@normal@sq\fi
|
||||
\ifnum\the\catcode`\;=13 \bugtracker@activate@normal@semic\fi
|
||||
\ifnum\the\catcode`\-=13 \bugtracker@activate@normal@dash\fi
|
||||
\let\\=\bugtracker@normal@backslash
|
||||
\xdef#2{\pgfkeysvalueof{/bugtracker/system call}}%
|
||||
\endgroup
|
||||
}%
|
||||
|
||||
\pgfutil@ifundefined{pdfshellescape}{%
|
||||
\def\bugtracker@checkshellescape{}%
|
||||
}{%
|
||||
\ifnum\pdfshellescape=1
|
||||
\def\bugtracker@checkshellescape{\pgfkeysvalueof{/bugtracker/shell escape}\space}%
|
||||
\else
|
||||
\def\bugtracker@checkshellescape{}%
|
||||
\fi
|
||||
}%
|
||||
|
||||
\endinput
|
1157
texmf/tex/latex/pgfplots/tex/pgflibraryfillbetween.code.tex
Normal file
1157
texmf/tex/latex/pgfplots/tex/pgflibraryfillbetween.code.tex
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,631 @@
|
|||
%--------------------------------------------
|
||||
%
|
||||
% Package pgfplots
|
||||
%
|
||||
% 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-2012 by Christian Feuersänger.
|
||||
%
|
||||
% This program is free software: you can redistribute it and/or modify
|
||||
% 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/>.
|
||||
%
|
||||
%--------------------------------------------
|
||||
|
||||
%--------------------------------------------------
|
||||
% \pgfqkeys{/pgfplots/surf shading}{
|
||||
% cols=3,
|
||||
% % test colormap 1,
|
||||
% }
|
||||
% \pgfplotslibrarysurfstreamstart
|
||||
% \pgfplotslibrarysurfstreamcoord{\pgfqpoint{0pt}{10pt}}{0}
|
||||
% \pgfplotslibrarysurfstreamcoord{\pgfqpoint{100pt}{10pt}}{100}
|
||||
% \pgfplotslibrarysurfstreamcoord{\pgfqpoint{180pt}{10pt}}{30}
|
||||
% %
|
||||
% \pgfplotslibrarysurfstreamcoord{\pgfqpoint{0pt}{100pt}}{300}
|
||||
% \pgfplotslibrarysurfstreamcoord{\pgfqpoint{110pt}{90pt}}{1000}
|
||||
% \pgfplotslibrarysurfstreamcoord{\pgfqpoint{190pt}{110pt}}{600}
|
||||
% %
|
||||
% \pgfplotslibrarysurfstreamcoord{\pgfqpoint{0pt}{200pt}}{0}
|
||||
% \pgfplotslibrarysurfstreamcoord{\pgfqpoint{110pt}{200pt}}{100}
|
||||
% \pgfplotslibrarysurfstreamcoord{\pgfqpoint{190pt}{200pt}}{60}
|
||||
% \pgfplotslibrarysurfstreamend
|
||||
% \fbox{%
|
||||
% \pgfplotslibrarysurfdraw
|
||||
% }%
|
||||
%--------------------------------------------------
|
||||
|
||||
|
||||
\newif\ifpgfplotslibrarysurf@updatebb
|
||||
\newif\ifpgfplotslibrarysurf@usecolormap
|
||||
\pgfplotslibrarysurf@updatebbtrue
|
||||
|
||||
\pgfkeys{%
|
||||
/pgfplots/surf shading/anchor/.initial=\pgfpointorigin,%
|
||||
/pgfplots/surf shading/shading type/.initial=5,% triangles in form of lattice
|
||||
%
|
||||
% If this is true, the embedding picture's bounding box will be updated using
|
||||
% the shading's bounding box.
|
||||
% This bounding box may be (highly!) inaccurate for coons shadings and tensor product shadings.
|
||||
% The 'patch' plot handler disables it and takes control over it explicitly (using interpolation
|
||||
% points rather than bezier control points).
|
||||
/pgfplots/surf shading/update BB/.is if=pgfplotslibrarysurf@updatebb,
|
||||
%
|
||||
% can only have values '' (empty) for binary encoding or
|
||||
% ASCIIHexEncode for base 16 encoding. Use this if some driver
|
||||
% cannot produce binary encoding. This is undocumented; for use in
|
||||
% emergency only.
|
||||
/pgfplots/surf shading/pdf stream filter/.initial=,%
|
||||
%
|
||||
/pgfplots/surf shading/precision/.is choice,
|
||||
/pgfplots/surf shading/precision/pdf/.code={%
|
||||
% Lossless coordinate output.
|
||||
\def\pgfplotslibrarysurf@bitspercoordinate{32}%
|
||||
\def\pgfplotslibrarysurf@bytespercoordinate{4}%
|
||||
\def\pgfplotslibrarysurf@filter@encode{}% raw binary.
|
||||
\def\pgfplotslibrarysurf@filter@decode{}%
|
||||
},%
|
||||
/pgfplots/surf shading/precision/ps/.code={%
|
||||
% quantized coordinate output (introduces quantization error).
|
||||
\def\pgfplotslibrarysurf@bitspercoordinate{24}%
|
||||
\def\pgfplotslibrarysurf@bytespercoordinate{3}%
|
||||
% doesn't improve behavior of pdf2ps:
|
||||
%\def\pgfplotslibrarysurf@filter@encode{ASCIIHexEncode}%
|
||||
%\def\pgfplotslibrarysurf@filter@decode{ASCIIHexDecode}%
|
||||
\def\pgfplotslibrarysurf@filter@encode{}% raw binary.
|
||||
\def\pgfplotslibrarysurf@filter@decode{}%
|
||||
},%
|
||||
/pgfplots/surf shading/precision/postscript/.style={%
|
||||
/pgfplots/surf shading/precision/ps},%
|
||||
/pgfplots/surf shading/precision/ps,%
|
||||
% columns:
|
||||
/pgfplots/surf shading/cols/.initial=,%
|
||||
/pgfplots/surf shading/colorspace/.initial=rgb,% rgb or cmyk or gray
|
||||
%
|
||||
% the colormap. If this key is empty, we assume that individual
|
||||
% color components are provided for EVERY vertex for which cdata
|
||||
% is expected.
|
||||
/pgfplots/surf shading/colormap/.initial={%
|
||||
<<
|
||||
/FunctionType 2
|
||||
/Domain [0 1]
|
||||
/C0 [0 0 1] /C1 [1 0 0] /N 1
|
||||
>>
|
||||
},%
|
||||
/pgfplots/surf shading/test colormap 1/.style={%
|
||||
/pgfplots/surf shading/colormap={
|
||||
<<
|
||||
/FunctionType 3
|
||||
/Domain [0 1]
|
||||
/Functions [
|
||||
<<
|
||||
/FunctionType 2
|
||||
/Domain [0 1]
|
||||
/C0 [0 0 1] /C1 [1 1 0] /N 1
|
||||
>>
|
||||
<<
|
||||
/FunctionType 2
|
||||
/Domain [0 1]
|
||||
/C0 [1 1 0] /C1 [1 0.5 0] /N 1
|
||||
>>
|
||||
<<
|
||||
/FunctionType 2
|
||||
/Domain [0 1]
|
||||
/C0 [1 0.5 0] /C1 [1 0 0] /N 1
|
||||
>>
|
||||
]
|
||||
/Bounds [ 0.3 0.6 ]
|
||||
/Encode [0 1 0 1 0 1]
|
||||
%/Range [0 1 0 1 0 1] INCOMPATIBLE WITH ACROBAT 6.0
|
||||
>>
|
||||
}%
|
||||
},%
|
||||
/pgfplots/surf shading/debug text/.initial=\the\c@pgfplotslibrarysurf@no,
|
||||
/pgfplots/surf shading/every debug coord/.style={
|
||||
circle,
|
||||
draw,
|
||||
fill=yellow,
|
||||
},
|
||||
/pgfplots/surf shading/debug/.is choice,
|
||||
/pgfplots/surf shading/debug/false/.code={%
|
||||
\let\pgfplotslibrarysurfprocesscoordinate=\pgfplotslibrarysurfprocesscoordinate@orig
|
||||
\let\pgfplotslibrarysurfusepath=\pgfplotslibrarysurfusepath@orig
|
||||
},
|
||||
/pgfplots/surf shading/debug/true/.code={%
|
||||
\let\pgfplotslibrarysurfprocesscoordinate=\pgfplotslibrarysurfprocesscoordinate@debug
|
||||
\def\pgfplotslibrarysurfusepath{\pgfusepath{stroke,fill}}
|
||||
},
|
||||
/pgfplots/surf shading/debug/.default=true,
|
||||
}%
|
||||
|
||||
\def\pgfplotslibrarysurf@corner@sw{\pgfplots@error{This is unavailable until \string\pgfplotslibrarysurfstreamend}}
|
||||
\let\pgfplotslibrarysurf@corner@ne\pgfplotslibrarysurf@corner@sw
|
||||
|
||||
% parametric colors (colormap) are always in [0,1000]. I
|
||||
% 2 bytes suffice for that range.
|
||||
\def\pgfplotslibrarysurf@bytespercomponent{2}%
|
||||
\def\pgfplotslibrarysurf@bitspercomponent{16}%
|
||||
|
||||
\def\pgfplotslibrarysurf@decode{%
|
||||
-16383.999992 16384 % see the docs of \pgfplotsbinaryencodedimenmaplinearly
|
||||
-16383.999992 16384 %
|
||||
\pgfplotslibrarysurf@decode@colors
|
||||
}%
|
||||
\def\pgfplotslibrarysurf@decode@colors@colormap{%
|
||||
0 \pgfplotscolormappdfmax % map [0,2^BitsPerComponent-1] linearly to [0 1] for parametric color data
|
||||
}%
|
||||
\def\pgfplotslibrarysurf@decode@colors@explicit@one@component{%
|
||||
% this is just one component for explicit color data.
|
||||
% it will be replicated for every color component.
|
||||
0 1 % the target value for color component values.
|
||||
}%
|
||||
|
||||
\def\pgfplotslibrarysurf@count{0}%
|
||||
\newcount\c@pgfplotslibrarysurf@no
|
||||
|
||||
% driver specific:
|
||||
\def\pgfplotslibrarysurf@initstream{%
|
||||
\edef\pgfplots@loc@TMPa{\pgfkeysvalueof{/pgfplots/surf shading/pdf stream filter}}%
|
||||
\ifx\pgfplots@loc@TMPa\pgfutil@empty
|
||||
\else
|
||||
\let\pgfplotslibrarysurf@filter@encode=\pgfplots@loc@TMPa
|
||||
\let\pgfplotslibrarysurf@filter@decode=\pgfplotslibrarysurf@filter@encode
|
||||
\fi
|
||||
}
|
||||
|
||||
\def\pgfplotslibrarysurf@advancestreamlen#1{}%
|
||||
|
||||
\def\pgfplotslibrarysurfstreamstart{%
|
||||
\pgfplotslibrarysurfstreamstart@init@colors
|
||||
\pgfkeysgetvalue{/pgfplots/surf shading/shading type}\pgfplotslibrarysurf@type
|
||||
\pgfplotsapplistXglobalnewempty\pgfplotslibrarysurf@binarystream@accum
|
||||
\pgfplotslibrarysurf@initstream
|
||||
\ifx\pgfplotslibrarysurf@filter@encode\pgfutil@empty
|
||||
\def\pgfplotslibrarysurf@filter@encode{binary encoding}%
|
||||
\fi
|
||||
\pgfkeysalso{/pgfplots/bin/\pgfplotslibrarysurf@filter@encode}%
|
||||
%
|
||||
\pgfplotsbinarysetbytes1%
|
||||
\pgfplotsbinaryencodeunsigned{0}% use this method - it respects any special encodings.
|
||||
\let\pgfplots@loc@TMPa=\pgfplotsbinaryresult
|
||||
\ifcase\pgfplotslibrarysurf@type\relax
|
||||
% 0
|
||||
\pgfplotslibrarysurf@initstream@wrongtype
|
||||
\or% 1
|
||||
\pgfplotslibrarysurf@initstream@wrongtype
|
||||
\or% 2
|
||||
\pgfplotslibrarysurf@initstream@wrongtype
|
||||
\or% 3
|
||||
\or% 4
|
||||
% ok, triangle meshes.
|
||||
\let\pgfplotslibrarysurf@edgeflag=\pgfplots@loc@TMPa
|
||||
\or% 5 triangles in lattice form. disable edge flag:
|
||||
\let\pgfplotslibrarysurf@edgeflag=\pgfutil@empty
|
||||
\or% 6 coons patches:
|
||||
\global\let\pgfplotslibrarysurf@cubicpatch@cdata=\pgfutil@empty
|
||||
\global\c@pgfplotslibrarysurf@no=0
|
||||
\def\pgfplotslibrarysurf@cubicpatch@numverts{12}%
|
||||
\let\pgfplotslibrarysurfstreamcoord=\pgfplotslibrarysurfstreamcoord@cubicpatch
|
||||
\let\pgfplotslibrarysurf@edgeflag=\pgfplots@loc@TMPa
|
||||
\or% 7 full tensor product cubic bezier patches:
|
||||
\global\let\pgfplotslibrarysurf@cubicpatch@cdata=\pgfutil@empty
|
||||
\global\c@pgfplotslibrarysurf@no=0
|
||||
\def\pgfplotslibrarysurf@cubicpatch@numverts{16}%
|
||||
\let\pgfplotslibrarysurfstreamcoord=\pgfplotslibrarysurfstreamcoord@cubicpatch
|
||||
\let\pgfplotslibrarysurf@edgeflag=\pgfplots@loc@TMPa
|
||||
\else
|
||||
\pgfplotslibrarysurf@initstream@wrongtype
|
||||
\fi
|
||||
%
|
||||
%
|
||||
% we want to establish a bounding box for THIS shading only! Otherwise the pdf XFORM might have a larger bounding box than we want. Is that ok here? Or does it hurt somewhere?
|
||||
\pgf@getpathsizes{\pgfplots@loc@TMPa}%
|
||||
\global\let\pgfplotslibrarysurf@pathsizes@before=\pgfplots@loc@TMPa
|
||||
}%
|
||||
|
||||
|
||||
\def\pgfplotslibrarysurfstreamstart@init@colors{%
|
||||
%
|
||||
\pgfkeysgetvalue{/pgfplots/surf shading/colormap}\pgfplots@loc@TMPa
|
||||
\ifx\pgfplots@loc@TMPa\pgfutil@empty
|
||||
\pgfplotslibrarysurf@usecolormapfalse
|
||||
\else
|
||||
\pgfplotslibrarysurf@usecolormaptrue
|
||||
\fi
|
||||
%
|
||||
\ifpgfplotslibrarysurf@usecolormap
|
||||
\let\pgfplotslibrarysurf@decode@colors=\pgfplotslibrarysurf@decode@colors@colormap
|
||||
\else
|
||||
\pgfplotscolorspacegetcomponents{\pgfkeysvalueof{/pgfplots/surf shading/colorspace}}%
|
||||
\c@pgf@counta=0 %
|
||||
\c@pgf@countb=\pgfplotsretval\relax
|
||||
%
|
||||
\def\pgfplotslibrarysurf@decode@colors{}%
|
||||
\pgfplotslibrarysurf@decode@colors@loop
|
||||
\fi
|
||||
%
|
||||
\pgfplotslibrarysurf@translate@colorspace
|
||||
\let\pgfplotslibrarysurf@colorspace=\pgfplotsretval
|
||||
}%
|
||||
|
||||
\def\pgfplotslibrarysurf@decode@colors@loop{%
|
||||
\ifnum\c@pgf@counta<\c@pgf@countb
|
||||
%
|
||||
\edef\pgfplotslibrarysurf@decode@colors{%
|
||||
\pgfplotslibrarysurf@decode@colors
|
||||
\pgfplotslibrarysurf@decode@colors@explicit@one@component
|
||||
}%
|
||||
\advance\c@pgf@counta by1 %
|
||||
%
|
||||
\expandafter\pgfplotslibrarysurf@decode@colors@loop
|
||||
\fi
|
||||
}%
|
||||
|
||||
\def\pgfplotslibrarysurf@initstream@wrongtype{%
|
||||
\pgfplots@error{CRITICAL: shader=interp: got unsupported pdf shading type '\pgfplotslibrarysurf@type'. This may corrupt your pdf!}%
|
||||
}%
|
||||
\def\pgfplotslibrarysurfstreamend{%
|
||||
\pgfplotsapplistXgloballet\pgfplotslibrarysurf@binarystream=\pgfplotslibrarysurf@binarystream@accum
|
||||
\pgfplotsapplistXglobalnewempty\pgfplotslibrarysurf@binarystream@accum
|
||||
%
|
||||
\pgfplotslibrarysurfstreamend@set@BB
|
||||
}
|
||||
|
||||
\def\pgfplotslibrarysurfstreamend@set@BB{%
|
||||
\xdef\pgfplotslibrarysurf@corner@sw{%
|
||||
\global\pgf@x=\the\pgf@pathminx\space
|
||||
\global\pgf@y=\the\pgf@pathminy\space
|
||||
}%
|
||||
\xdef\pgfplotslibrarysurf@corner@ne{%
|
||||
\global\pgf@x=\the\pgf@pathmaxx\space
|
||||
\global\pgf@y=\the\pgf@pathmaxy\space
|
||||
}%
|
||||
\pgf@setpathsizes\pgfplotslibrarysurf@pathsizes@before
|
||||
}%
|
||||
|
||||
% ATTENTION: see also \pgfplotslibrarysurfstreamcoord@cubicpatch
|
||||
% #1: a pgf point.
|
||||
% #2: a color coordinate in the range [0,1000]
|
||||
\def\pgfplotslibrarysurfstreamcoord#1#2{%
|
||||
\pgfplotsbinarysetbytes\pgfplotslibrarysurf@bytespercoordinate%
|
||||
\pgfplotslibrarysurf@advancestreamlen{\pgfplotslibrarysurf@bytespercoordinate}%
|
||||
\pgfplotslibrarysurf@advancestreamlen{\pgfplotslibrarysurf@bytespercoordinate}%
|
||||
%\pgf@process{#1}% this here causes `{retaining \pgf@x}' messages and pollutes the save stack! Avoid it. See \tracingrestores=2
|
||||
\pgfplotslibrarysurfprocesscoordinate{#1}%
|
||||
% The idea is to map
|
||||
% the low-level point coordinates LINEARLY into [0,2^{8*<bytes>}].
|
||||
%
|
||||
% This is what the pdf standard expects for surface shadings.
|
||||
%
|
||||
% To do that, we simply map
|
||||
% [-16384,16384] linearly into [0,2^{32}]
|
||||
% and write the resulting integer in big endian binary format to
|
||||
% the pdf low level stream.
|
||||
%
|
||||
% The decode procedure tells the pdf viewer how to invert that
|
||||
% stuff.
|
||||
%
|
||||
\pgf@xa=\pgf@x
|
||||
\pgf@sys@bp@correct\pgf@xa%
|
||||
\pgfplotsbinaryencodedimenmaplinearly\pgf@xa
|
||||
%\message{POINT \the\c@pgfplots@scanlineindex: ENCODING(x=\the\pgf@x)=\pgfplotsbinaryresult.}\advance\c@pgfplots@scanlineindex by1
|
||||
\t@pgfplots@toka=\expandafter{\pgfplotsbinaryresult}%
|
||||
\pgf@ya=\pgf@y
|
||||
\pgf@sys@bp@correct\pgf@ya%
|
||||
\pgfplotsbinaryencodedimenmaplinearly\pgf@ya
|
||||
%\message{ENCODING(y=\the\pgf@y)=\pgfplotsbinaryresult.}%
|
||||
\t@pgfplots@tokb=\expandafter{\pgfplotsbinaryresult}%
|
||||
%
|
||||
\pgfplotslibrarysurf@encode@cdata{#2}%
|
||||
%\message{\pgfplotsbinaryresult.}%
|
||||
\t@pgfplots@tokc=\expandafter{\pgfplotsbinaryresult}%
|
||||
\ifx\pgfplotslibrarysurf@edgeflag\pgfutil@empty
|
||||
\else
|
||||
% for shading type 4, the edge flag is given for EVERY
|
||||
% coordinate (unlike all other shading types).
|
||||
\pgfplotslibrarysurf@advancestreamlen{1}%
|
||||
\fi
|
||||
\edef\pgfplots@loc@TMPa{\pgfplotslibrarysurf@edgeflag\the\t@pgfplots@toka\the\t@pgfplots@tokb\the\t@pgfplots@tokc}%
|
||||
\expandafter\pgfplotsapplistXglobalpushback\pgfplots@loc@TMPa\to\pgfplotslibrarysurf@binarystream@accum
|
||||
}
|
||||
|
||||
% defines \pgfplotsbinaryresult to contain the result of a CDATA
|
||||
% entry and advances the stream counters.
|
||||
\def\pgfplotslibrarysurf@encode@cdata#1{%
|
||||
\ifpgfplotslibrarysurf@usecolormap
|
||||
\pgfplotslibrarysurf@map@to@FFF@colormap{#1}%
|
||||
\else
|
||||
% oh. No cdata. Ok, then encode stuff individually!
|
||||
% We expect data of the form
|
||||
% {<comma-separated-components>}
|
||||
\edef\pgfplots@loc@TMPa{#1}%
|
||||
\def\pgfplotsretval{}%
|
||||
\expandafter\pgfplotslibrarysurf@encode@cdata@loop\pgfplots@loc@TMPa,,%
|
||||
\let\pgfplotsbinaryresult=\pgfplotsretval
|
||||
\fi
|
||||
}
|
||||
|
||||
\def\pgfplotslibrarysurf@encode@cdata@loop#1,{%
|
||||
\def\pgfplots@loc@TMPa{#1}%
|
||||
\ifx\pgfplots@loc@TMPa\pgfutil@empty
|
||||
\else
|
||||
%
|
||||
%
|
||||
\pgfplotslibrarysurf@map@to@FFF@component{#1}%
|
||||
\edef\pgfplotsretval{\pgfplotsretval\pgfplotsbinaryresult}%
|
||||
%
|
||||
%
|
||||
% continue loop:
|
||||
\expandafter\pgfplotslibrarysurf@encode@cdata@loop
|
||||
\fi
|
||||
}%
|
||||
|
||||
% Defines \pgfplotsbinaryresult
|
||||
\def\pgfplotslibrarysurf@map@to@FFF@colormap#1{%
|
||||
\begingroup
|
||||
% read fixed point input (in the range [0,1000]).
|
||||
\pgf@xa=#1pt %
|
||||
% convert to integer (= *65536):
|
||||
\c@pgf@counta=\pgf@xa
|
||||
% provide map [0,1000] -> [0,2^16-1]
|
||||
\divide\c@pgf@counta by1000
|
||||
% now, we have \c@pgf@counta in [0,2^16]. Simply strip it into
|
||||
% the required range, that's ok.
|
||||
\ifnum\c@pgf@counta<0
|
||||
\c@pgf@counta=0
|
||||
\else
|
||||
\ifnum\c@pgf@counta>65535
|
||||
\c@pgf@counta=65535
|
||||
\fi
|
||||
\fi
|
||||
% Now, we have CDATA in the range [0,65535]
|
||||
\xdef\pgfplots@glob@TMPa{\the\c@pgf@counta}%
|
||||
%\message{ENCODING(C=\pgfplots@glob@TMPa\space for \the\pgf@xa)=}%
|
||||
\endgroup
|
||||
\pgfplotsbinarysetbytes\pgfplotslibrarysurf@bytespercomponent%
|
||||
\pgfplotsbinaryencodeunsigned\pgfplots@glob@TMPa
|
||||
\pgfplotslibrarysurf@advancestreamlen{\pgfplotslibrarysurf@bytespercomponent}%
|
||||
}
|
||||
|
||||
% Defines \pgfplotsbinaryresult
|
||||
\def\pgfplotslibrarysurf@map@to@FFF@component#1{%
|
||||
\begingroup
|
||||
% read fixed point input (in the range [0,1]).
|
||||
\pgf@xa=#1pt %
|
||||
% convert to integer (= *65536):
|
||||
\c@pgf@counta=\pgf@xa
|
||||
% provide map [0,1] -> [0,2^16-1]
|
||||
% well, there is nothing to do! it was in [0,1], we multiplied by 65536 implicitly... that's it.
|
||||
%
|
||||
% now, we have \c@pgf@counta in [0,2^16]. Simply strip it into
|
||||
% the required range, that's ok.
|
||||
\ifnum\c@pgf@counta<0
|
||||
\c@pgf@counta=0
|
||||
\else
|
||||
\ifnum\c@pgf@counta>65535
|
||||
\c@pgf@counta=65535
|
||||
\fi
|
||||
\fi
|
||||
% Now, we have CDATA in the range [0,65535]
|
||||
\xdef\pgfplots@glob@TMPa{\the\c@pgf@counta}%
|
||||
%\message{ENCODING(C=\pgfplots@glob@TMPa\space for \the\pgf@xa)=}%
|
||||
\endgroup
|
||||
\pgfplotsbinarysetbytes\pgfplotslibrarysurf@bytespercomponent%
|
||||
\pgfplotsbinaryencodeunsigned\pgfplots@glob@TMPa
|
||||
\pgfplotslibrarysurf@advancestreamlen{\pgfplotslibrarysurf@bytespercomponent}%
|
||||
}
|
||||
|
||||
\def\pgfplotslibrarysurf@translate@colorspace{%
|
||||
\pgfkeysgetvalue{/pgfplots/surf shading/colorspace}\pgfplots@loc@TMPd
|
||||
\edef\pgfplots@loc@TMPd{\pgfplots@loc@TMPd}%
|
||||
\def\pgfplots@loc@TMPa{rgb}%
|
||||
\ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPd
|
||||
\def\pgfplotsretval{RGB}%
|
||||
\else
|
||||
\def\pgfplots@loc@TMPa{cmyk}%
|
||||
\ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPd
|
||||
\def\pgfplotsretval{CMYK}%
|
||||
\else
|
||||
\def\pgfplots@loc@TMPa{cmy}%
|
||||
\ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPd
|
||||
\def\pgfplotsretval{CMY}%
|
||||
\else
|
||||
\def\pgfplots@loc@TMPa{gray}%
|
||||
\ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPd
|
||||
\def\pgfplotsretval{Gray}%
|
||||
\else
|
||||
\pgfplots@error{Sorry, the 'surfshading' lib failed to recognise the choice '/pgfplots/surf shading/colorspace=\pgfplots@loc@TMPd'... maybe you misspelled it?}%
|
||||
\def\pgfplotsretval{RGB}%
|
||||
\fi
|
||||
\fi
|
||||
\fi
|
||||
\fi
|
||||
}%
|
||||
|
||||
\def\pgfplotslibrarysurfusepath{\pgfusepath{fill}}
|
||||
\let\pgfplotslibrarysurfusepath@orig=\pgfplotslibrarysurfusepath
|
||||
|
||||
% We DO want to protocol the size of the shading. In fact, we NEED a
|
||||
% bounding box which contains the whole shading, otherwise it will be
|
||||
% clipped. More precisely, it will be packed into a pdf XForm object
|
||||
% and that appears to need a correct bounding box.
|
||||
%
|
||||
% But we do NOT want to update the picture's bounding box, only that
|
||||
% of the pdf XForm. The picture's bounding box will be updated as soon
|
||||
% as we *use* the shading anyway (in
|
||||
% \pgfplotslibrarysurfdrawinpicture). This here takes care of that detail:
|
||||
\def\pgfplotslibrarysurf@protocolsizes@#1#2{%
|
||||
\ifpgf@relevantforpicturesize
|
||||
\pgfplots@loc@tmptrue
|
||||
\else
|
||||
\pgfplots@loc@tmpfalse
|
||||
\fi
|
||||
\pgf@relevantforpicturesizefalse
|
||||
\pgf@protocolsizes{#1}{#2}%
|
||||
\ifpgfplots@loc@tmp
|
||||
\pgf@relevantforpicturesizetrue
|
||||
\fi
|
||||
}%
|
||||
|
||||
\def\pgfplotslibrarysurfprocesscoordinate#1{%
|
||||
#1\relax%
|
||||
\pgfplotslibrarysurf@protocolsizes@{\pgf@x}{\pgf@y}%
|
||||
}%
|
||||
\let\pgfplotslibrarysurfprocesscoordinate@orig=\pgfplotslibrarysurfprocesscoordinate%
|
||||
|
||||
\def\pgfplotslibrarysurfprocesscoordinate@debug#1{%
|
||||
\pgfinterruptpath
|
||||
\scope
|
||||
\pgftransformshift{#1}%
|
||||
\node[/pgfplots/surf shading/every debug coord] at (0pt,0pt) {\pgfkeysvalueof{/pgfplots/surf shading/debug text}};%
|
||||
\endscope
|
||||
\endpgfinterruptpath
|
||||
#1\relax%
|
||||
\pgfplotslibrarysurf@protocolsizes@{\pgf@x}{\pgf@y}%
|
||||
}%
|
||||
|
||||
% ATTENTION: see also \pgfplotslibrarysurfstreamcoord
|
||||
% special routine for coons type patches and cubic tensor product type
|
||||
% patches. It has FIRST all vertices,
|
||||
% THEN the cdata. Furthermore, it only has 4 CDATA points, but a total
|
||||
% of 12 vertices.
|
||||
%
|
||||
% #1: a pgf point.
|
||||
% #2: a color coordinate in the range [0,1000]
|
||||
\def\pgfplotslibrarysurfstreamcoord@cubicpatch#1#2{%
|
||||
\pgfplotsbinarysetbytes\pgfplotslibrarysurf@bytespercoordinate%
|
||||
\pgfplotslibrarysurf@advancestreamlen{\pgfplotslibrarysurf@bytespercoordinate}%
|
||||
\pgfplotslibrarysurf@advancestreamlen{\pgfplotslibrarysurf@bytespercoordinate}%
|
||||
%\pgf@process{#1}% this here causes `{retaining \pgf@x}' messages and pollutes the save stack! Avoid it. See \tracingrestores=2
|
||||
\pgfplotslibrarysurfprocesscoordinate{#1}%
|
||||
% The idea is to map
|
||||
% the low-level point coordinates LINEARLY into [0,2^{8*<bytes>}].
|
||||
%
|
||||
% This is what the pdf standard expects for surface shadings.
|
||||
%
|
||||
% To do that, we simply map
|
||||
% [-16384,16384] linearly into [0,2^{32}]
|
||||
% and write the resulting integer in big endian binary format to
|
||||
% the pdf low level stream.
|
||||
%
|
||||
% The decode procedure tells the pdf viewer how to invert that
|
||||
% stuff.
|
||||
%
|
||||
\pgf@xa=\pgf@x
|
||||
\pgf@sys@bp@correct\pgf@xa%
|
||||
\pgfplotsbinaryencodedimenmaplinearly\pgf@xa
|
||||
%\message{POINT \the\c@pgfplots@scanlineindex: ENCODING(x=\the\pgf@x)=\pgfplotsbinaryresult.}\advance\c@pgfplots@scanlineindex by1
|
||||
\t@pgfplots@toka=\expandafter{\pgfplotsbinaryresult}%
|
||||
\pgf@ya=\pgf@y
|
||||
\pgf@sys@bp@correct\pgf@ya%
|
||||
\pgfplotsbinaryencodedimenmaplinearly\pgf@ya
|
||||
%\message{ENCODING(y=\the\pgf@y)=\pgfplotsbinaryresult.}%
|
||||
\t@pgfplots@tokb=\expandafter{\pgfplotsbinaryresult}%
|
||||
\def\pgfplotslibrarysurf@cubicpatch@hascdata{0}%
|
||||
\ifnum\c@pgfplotslibrarysurf@no=0
|
||||
\def\pgfplotslibrarysurf@cubicpatch@hascdata{1}%
|
||||
% prepend edge flag. it is a new patch.
|
||||
\t@pgfplots@toka=\expandafter{\expandafter\pgfplotslibrarysurf@edgeflag\the\t@pgfplots@toka}%
|
||||
\pgfplotslibrarysurf@advancestreamlen{1}%
|
||||
\else
|
||||
\ifnum\c@pgfplotslibrarysurf@no=3
|
||||
\def\pgfplotslibrarysurf@cubicpatch@hascdata{1}%
|
||||
\else
|
||||
\ifnum\c@pgfplotslibrarysurf@no=6
|
||||
\def\pgfplotslibrarysurf@cubicpatch@hascdata{1}%
|
||||
\else
|
||||
\ifnum\c@pgfplotslibrarysurf@no=9
|
||||
\def\pgfplotslibrarysurf@cubicpatch@hascdata{1}%
|
||||
\fi
|
||||
\fi
|
||||
\fi
|
||||
\fi
|
||||
\if1\pgfplotslibrarysurf@cubicpatch@hascdata
|
||||
%
|
||||
\pgfplotslibrarysurf@encode@cdata{#2}%
|
||||
%\message{\pgfplotsbinaryresult.}%
|
||||
\t@pgfplots@tokc=\expandafter{\pgfplotslibrarysurf@cubicpatch@cdata}%
|
||||
\xdef\pgfplotslibrarysurf@cubicpatch@cdata{%
|
||||
\the\t@pgfplots@tokc
|
||||
\pgfplotsbinaryresult
|
||||
}%
|
||||
\fi
|
||||
\global\advance\c@pgfplotslibrarysurf@no by1
|
||||
%
|
||||
\ifnum\pgfplotslibrarysurf@cubicpatch@numverts=\c@pgfplotslibrarysurf@no %finalize patch.
|
||||
\t@pgfplots@tokc=\expandafter{\pgfplotslibrarysurf@cubicpatch@cdata}%
|
||||
\global\let\pgfplotslibrarysurf@cubicpatch@cdata=\pgfutil@empty
|
||||
\global\c@pgfplotslibrarysurf@no=0
|
||||
\else
|
||||
\t@pgfplots@tokc={}%
|
||||
\fi
|
||||
% edge flag is already in \t@pgfplots@toka (if this is the first
|
||||
% vertex)
|
||||
\edef\pgfplots@loc@TMPa{\the\t@pgfplots@toka\the\t@pgfplots@tokb\the\t@pgfplots@tokc}%
|
||||
\expandafter\pgfplotsapplistXglobalpushback\pgfplots@loc@TMPa\to\pgfplotslibrarysurf@binarystream@accum
|
||||
}
|
||||
|
||||
\def\pgfplotslibrarysurfactivateshadefill{%
|
||||
\pgfplotssys@do@surfshading@fillpaths\pgfplots@loc@TMPa%
|
||||
\expandafter\pgfutil@addpdfresource@patterns\expandafter{\pgfplots@loc@TMPa}%%
|
||||
}
|
||||
|
||||
%--------------------------------------------------
|
||||
% \def\pgfplotslibrarysurfdraw{%
|
||||
% % \pgftext[at=\pgfqpoint{0pt}{0pt}]%
|
||||
% {\pgfplotssys@do@surfshading}%
|
||||
% }%
|
||||
%--------------------------------------------------
|
||||
|
||||
\def\pgfplotslibrarysurfdrawinpicture{%
|
||||
\begingroup
|
||||
% this statement will modify both the picture's BB and the path's BB
|
||||
% unless we take control.
|
||||
%
|
||||
% Note that the path's BB will eventually be updated into the
|
||||
% picture's BB as well (meaning that 'overlay' is of no use inside
|
||||
% of this group).
|
||||
%
|
||||
% Implement the 'surf shading/update BB' functionality here:
|
||||
\let\pgfplots@@protocolsizes=\pgf@protocolsizes
|
||||
\ifpgfplotslibrarysurf@updatebb
|
||||
\else
|
||||
% NO update to any BB. this implies 'overlay'
|
||||
% *and* disables updates to the path's BB.
|
||||
\def\pgf@protocolsizes##1##2{\relax}%
|
||||
\fi
|
||||
\pgftext[at=\pgfplotslibrarysurf@corner@sw,left,bottom] {%
|
||||
\begingroup
|
||||
% inside of this box, we *always* need bounding boxes.
|
||||
% restore functionality.
|
||||
\let\pgf@protocolsizes=\pgfplots@@protocolsizes
|
||||
\pgfplotslibrarysurfdraw
|
||||
\endgroup
|
||||
% this does NOT work because I can't undo the box' shift:
|
||||
%\pgfplotssys@do@surfshading
|
||||
}%
|
||||
\endgroup
|
||||
}
|
||||
|
||||
\pgfplotsiffileexists{pgflibrarypgfplots.surfshading.\pgfsysdriver}{%
|
||||
\input pgflibrarypgfplots.surfshading.\pgfsysdriver\relax
|
||||
\def\pgflibrarysurfshadingifactive#1#2{#1}%
|
||||
}{%
|
||||
\def\pgfplotslibrarysurfdraw{%
|
||||
\pgfplots@error{Sorry, surfshading (shader=interp) is NOT available for the selected driver `\pgfsysdriver'.}%
|
||||
}%
|
||||
\def\pgflibrarysurfshadingifactive#1#2{#2}%
|
||||
}
|
||||
\endinput
|
|
@ -0,0 +1,179 @@
|
|||
%--------------------------------------------
|
||||
%
|
||||
% Package pgfplots
|
||||
%
|
||||
% 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-2012 by Christian Feuersänger.
|
||||
%
|
||||
% This program is free software: you can redistribute it and/or modify
|
||||
% 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/>.
|
||||
%
|
||||
%--------------------------------------------
|
||||
|
||||
\newcount\c@pgfplotslibrarysurf@streamlen
|
||||
|
||||
\def\pgfplotslibrarysurf@initstream{%
|
||||
% binary doesn't work due to limitations of DVI.
|
||||
% We NEED an ASCII encoding.
|
||||
%
|
||||
\def\pgfplotslibrarysurf@filter@encode{ASCIIHexEncode}%
|
||||
\def\pgfplotslibrarysurf@filter@decode{ASCIIHexDecode}%
|
||||
\global\c@pgfplotslibrarysurf@streamlen=0 %
|
||||
}%
|
||||
|
||||
\def\pgfplotslibrarysurf@advancestreamlen#1{%
|
||||
\global\advance\c@pgfplotslibrarysurf@streamlen by#1\relax
|
||||
}%
|
||||
|
||||
% The lowlevel call for surface shadings. It uses a pattern type 2
|
||||
% dictionary as fill color and has thus several things to do. This is
|
||||
% a little bit more complicated than using the '/sh' operator (as
|
||||
% other pgf shadings do): the surface shading must be positioned
|
||||
% exactly at the requested coordinates, otherwise it is quite useless.
|
||||
%
|
||||
% Since shadings are *not* affected by changes in the canvas
|
||||
% transformation matrix (shifts, rotations etc), it is necessary to
|
||||
% pack the shading into a separate xform object which is then rotated
|
||||
% and translated correctly.
|
||||
%
|
||||
% There is just one more transformation necessary: the shift inside of
|
||||
% the xform. This shift is done using changes in the canvas
|
||||
% transformation matrix and it is UNDONE in the /Matrix argument of
|
||||
% the pattern dictionary. This last step can't be done with the /sh
|
||||
% operator which is why I am using pattern dictionaries.
|
||||
\def\pgfplotslibrarysurfdraw{%
|
||||
\begingroup
|
||||
\setbox\pgfutil@tempboxa=\hbox
|
||||
{%
|
||||
\pgfpicture
|
||||
\pgfplotssys@do@surfshading@fillpaths\pgfplots@loc@TMPa%
|
||||
\global\let\pgfplots@glob@TMPa=\pgfplots@loc@TMPa
|
||||
\pgfpathrectanglecorners
|
||||
{\pgfplotslibrarysurf@corner@sw}
|
||||
{\pgfplotslibrarysurf@corner@ne}%
|
||||
\pgfplotslibrarysurfusepath
|
||||
\endpgfpicture
|
||||
}%
|
||||
%
|
||||
% NOTE : this code was broken due to some driver in pgf. I fixed
|
||||
% that and brought the fix with pgfplots.
|
||||
%
|
||||
% for some reason, dvipdfmx requires to move the XObject
|
||||
% declaration out of the current stream.
|
||||
% Perhaps I should rephrase and say that for some reason, this appears to be
|
||||
% unnecessary for pdftex.
|
||||
%
|
||||
% FIXME : this might have N^2 time due to "box-append"!
|
||||
\pgfutil@insertatbegincurrentpagefrombox
|
||||
{%
|
||||
\special{pdf: bxobj @pgfplotsX\pgfplotslibrarysurf@count\space
|
||||
width \the\wd\pgfutil@tempboxa\space height \the\ht\pgfutil@tempboxa}%
|
||||
\special{pdf: put @resources
|
||||
% write the pattern resource dictionary of the XObject
|
||||
% (only!):
|
||||
<< /Pattern << \pgfplots@glob@TMPa >> >>
|
||||
}%
|
||||
%
|
||||
% no need to add the pattern to the page's resource list!
|
||||
% we do not need this:
|
||||
%\pgfutil@addpdfresource@patterns{\pgfplots@glob@TMPa}%
|
||||
\leavevmode
|
||||
\box\pgfutil@tempboxa
|
||||
\special{pdf: exobj}%
|
||||
}%
|
||||
\endgroup
|
||||
\special{pdf: uxobj @pgfplotsX\pgfplotslibrarysurf@count\space}%
|
||||
\pgfplotsutil@advancestringcounter@global\pgfplotslibrarysurf@count
|
||||
}
|
||||
|
||||
% To be used inside of a pgfpicture.
|
||||
%
|
||||
% #1: a macro name. The contents of this macro needs to be written
|
||||
% into the pdf pattern dictionary contained in the pdf resources of
|
||||
% the current context. The current context is either the current page
|
||||
% or an xform object.
|
||||
%
|
||||
%
|
||||
\def\pgfplotssys@do@surfshading@fillpaths#1{%
|
||||
% it contain the BINARY bytes. But it is ASCII encoded, see docs of ASCIIHexEncode.
|
||||
\global\multiply\c@pgfplotslibrarysurf@streamlen by2 %
|
||||
%
|
||||
\def\pgfplots@loc@TMPa{%
|
||||
% stream length will be computed automatically
|
||||
/ShadingType \pgfplotslibrarysurf@type\space
|
||||
/BitsPerCoordinate \pgfplotslibrarysurf@bitspercoordinate\space
|
||||
/BitsPerComponent \pgfplotslibrarysurf@bitspercomponent\space
|
||||
\if5\pgfplotslibrarysurf@type
|
||||
/VerticesPerRow \pgfkeysvalueof{/pgfplots/surf shading/cols}
|
||||
\else
|
||||
/BitsPerFlag 8
|
||||
\fi
|
||||
/ColorSpace /Device\pgfplotslibrarysurf@colorspace
|
||||
/Decode [\pgfplotslibrarysurf@decode]
|
||||
\ifpgfplotslibrarysurf@usecolormap
|
||||
/Function \pgfkeysvalueof{/pgfplots/surf shading/colormap}
|
||||
\fi
|
||||
\ifx\pgfplotslibrarysurf@filter@decode\pgfutil@empty
|
||||
\else
|
||||
/Filter /\pgfplotslibrarysurf@filter@decode\space
|
||||
\fi
|
||||
/Length \the\c@pgfplotslibrarysurf@streamlen
|
||||
}%
|
||||
%
|
||||
\pgf@process{\pgfpointdiff{\pgfplotslibrarysurf@corner@sw}{\pgfkeysvalueof{/pgfplots/surf shading/anchor}}}%
|
||||
\pgf@sys@bp@correct\pgf@x%
|
||||
\pgf@sys@bp@correct\pgf@y%
|
||||
%
|
||||
%\noexpand\pgfutil@insertatbegincurrentpagefrombox
|
||||
{%
|
||||
\special{pdf: object @pgfplotsShading\pgfplotslibrarysurf@count\space << \pgfplots@loc@TMPa >>
|
||||
stream^^J%
|
||||
\pgfplotslibrarysurf@binarystream
|
||||
endstream
|
||||
}%
|
||||
\special{pdf: close @pgfplotsShading\pgfplotslibrarysurf@count\space }%
|
||||
\special{pdf: object @pgfplotsPattern\pgfplotslibrarysurf@count\space <<
|
||||
/Type /Pattern
|
||||
/PatternType 2
|
||||
% /Matrix [\pgf@pt@aa\space\pgf@pt@ab\space\pgf@pt@ba\space\pgf@pt@bb\space\pgf@sys@tonumber\pgf@pt@x\space\pgf@sys@tonumber\pgf@pt@y]
|
||||
% FIXME: INCORPORATE TIKZ CM
|
||||
/Matrix [1 0 0 1 \pgf@sys@tonumber\pgf@x\space \pgf@sys@tonumber\pgf@y] %226.533 518.141]
|
||||
%--------------------------------------------------
|
||||
% /ExtGState
|
||||
% <<
|
||||
% /LW 2
|
||||
% /OP true
|
||||
% /OPM 1
|
||||
% >>
|
||||
%--------------------------------------------------
|
||||
/Shading @pgfplotsShading\pgfplotslibrarysurf@count
|
||||
>>
|
||||
}%
|
||||
\special{pdf: close @pgfplotsPattern\pgfplotslibrarysurf@count\space }%
|
||||
}%
|
||||
\edef#1{%
|
||||
/pgfplotsSurface\pgfplotslibrarysurf@count\space @pgfplotsPattern\pgfplotslibrarysurf@count
|
||||
}%
|
||||
%
|
||||
% I inlined \pgfsys@setpatterncolored here because it appears to be
|
||||
% natural - and in order to bring this driver to PGF 2.00 (which
|
||||
% would fail otherwise)
|
||||
\pgfsysprotocol@literal{/Pattern cs /pgfplotsSurface\pgfplotslibrarysurf@count\space scn}%
|
||||
}
|
||||
|
||||
\endinput
|
||||
% vi: ft=tex
|
|
@ -0,0 +1,114 @@
|
|||
%--------------------------------------------
|
||||
%
|
||||
% Package pgfplots
|
||||
%
|
||||
% 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 by Christian Feuersänger.
|
||||
%
|
||||
% This program is free software: you can redistribute it and/or modify
|
||||
% 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/>.
|
||||
%
|
||||
%--------------------------------------------
|
||||
|
||||
|
||||
\def\pgfplotslibrarysurf@initstream{%
|
||||
\if\pgfplotslibrarysurf@bytespercoordinate4%
|
||||
\pgfplots@warning{************** The generated postscript file may not be compatible with all viewers. Consider using \string\pgfplotsset{surf shading/precision=postscript} for improved compatibility. Or: convert it to pdf, that will work correctly. **************}%
|
||||
\fi
|
||||
% binary doesn't work due to limitations of DVI.
|
||||
% We NEED an ASCII encoding.
|
||||
%
|
||||
\def\pgfplotslibrarysurf@filter@encode{ASCIIHexEncode}%
|
||||
\def\pgfplotslibrarysurf@filter@decode{ASCIIHexDecode}%
|
||||
}%
|
||||
|
||||
% The lowlevel call for surface shadings. It uses a pattern type 2
|
||||
% dictionary as fill color and has thus several things to do.
|
||||
%
|
||||
% It appears the dvips implementation is simpler than the pdftex
|
||||
% implementation - I did not need to adjust the matrix (don't know
|
||||
% why).
|
||||
\def\pgfplotslibrarysurfdraw{%
|
||||
\pgfpicture
|
||||
\pgfplotssys@do@surfshading@fillpaths\pgfplots@loc@TMPa%
|
||||
\global\let\pgfplots@glob@TMPa=\pgfplots@loc@TMPa
|
||||
\pgfpathrectanglecorners
|
||||
{\pgfplotslibrarysurf@corner@sw}
|
||||
{\pgfplotslibrarysurf@corner@ne}%
|
||||
\pgfplotslibrarysurfusepath
|
||||
\endpgfpicture
|
||||
\leavevmode% ??
|
||||
}
|
||||
|
||||
% To be used inside of a pgfpicture.
|
||||
%
|
||||
% #1: a macro name. The contents of this macro needs to be written
|
||||
% into the pdf pattern dictionary contained in the pdf resources of
|
||||
% the current context. The current context is either the current page
|
||||
% or an xform object.
|
||||
%
|
||||
%
|
||||
\def\pgfplotssys@do@surfshading@fillpaths#1{%
|
||||
%http://www.ghostscript.com/pipermail/gs-devel/2002-September/005763.html
|
||||
%http://www.tek-tips.com/viewthread.cfm?qid=1183719&page=4
|
||||
% \pgf@process{\pgfpointdiff{\pgfplotslibrarysurf@corner@sw}{\pgfkeysvalueof{/pgfplots/surf shading/anchor}}}%
|
||||
% \pgf@sys@bp@correct\pgf@x%
|
||||
% \pgf@sys@bp@correct\pgf@y%
|
||||
\pgfsys@invoke{%
|
||||
<<
|
||||
%/Type /Pattern
|
||||
/PatternType 2
|
||||
/Shading
|
||||
<<
|
||||
/ShadingType \pgfplotslibrarysurf@type\space
|
||||
/BitsPerCoordinate \pgfplotslibrarysurf@bitspercoordinate\space
|
||||
/BitsPerComponent \pgfplotslibrarysurf@bitspercomponent\space % Note: this here is the reason why I can't use ASCII85Decode
|
||||
\if5\pgfplotslibrarysurf@type
|
||||
/VerticesPerRow \pgfkeysvalueof{/pgfplots/surf shading/cols}
|
||||
\else
|
||||
/BitsPerFlag 8
|
||||
\fi
|
||||
/ColorSpace /Device\pgfplotslibrarysurf@colorspace
|
||||
/Decode [\pgfplotslibrarysurf@decode]
|
||||
\ifpgfplotslibrarysurf@usecolormap
|
||||
/Function \pgfkeysvalueof{/pgfplots/surf shading/colormap}
|
||||
\fi
|
||||
/DataSource
|
||||
currentfile
|
||||
% direct binary output not possible: DVI
|
||||
% doesn't support it (?)
|
||||
%<< /EODCount \pgfplotslibrarysurf@binarystream@len\space /EODString () >> /SubFileDecode filter
|
||||
% not completely implemented :
|
||||
%/ASCII85Decode filter
|
||||
% works:
|
||||
/ASCIIHexDecode filter
|
||||
/ReusableStreamDecode filter
|
||||
\pgfplotslibrarysurf@binarystream
|
||||
%\csname pgfp@bin@126\endcsname% tilde ~> is end-of-input indicator for ASCII85Decode
|
||||
> % end-of-input indicator for ASCIIHexDecode
|
||||
>>
|
||||
>> [ 1 0 0 1 0 0 ] makepattern setpattern
|
||||
% I don't know why I don't need the shifts here !? But it
|
||||
% appears to work, so never mind.
|
||||
% >> [ 1 0 0 1 \pgf@sys@tonumber\pgf@x\space \pgf@sys@tonumber\pgf@y ] makepattern setpattern
|
||||
% 'setpattern' is a shortcut for changing the colorspace and
|
||||
% the color to pattern.
|
||||
}%
|
||||
}
|
||||
|
||||
\endinput
|
||||
% vi: ft=tex
|
|
@ -0,0 +1,161 @@
|
|||
%--------------------------------------------
|
||||
% $Header: /cvsroot/pgfplots/pgfplots/generic/pgfplots/sys/pgflibrarysurfshading.pgfsys-pdftex.def,v 1.1 2009/06/11 07:14:52 ludewich Exp $
|
||||
%
|
||||
% Package pgfplots
|
||||
%
|
||||
% 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 by Christian Feuersänger.
|
||||
%
|
||||
% This program is free software: you can redistribute it and/or modify
|
||||
% 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/>.
|
||||
%
|
||||
%--------------------------------------------
|
||||
|
||||
% The lowlevel call for surface shadings. It uses a pattern type 2
|
||||
% dictionary as fill color and has thus several things to do. This is
|
||||
% a little bit more complicated than using the '/sh' operator (as
|
||||
% other pgf shadings do): the surface shading must be positioned
|
||||
% exactly at the requested coordinates, otherwise it is quite useless.
|
||||
%
|
||||
% Since shadings are *not* affected by changes in the canvas
|
||||
% transformation matrix (shifts, rotations etc), it is necessary to
|
||||
% pack the shading into a separate xform object which is then rotated
|
||||
% and translated correctly.
|
||||
%
|
||||
% There is just one more transformation necessary: the shift inside of
|
||||
% the xform. This shift is done using changes in the canvas
|
||||
% transformation matrix and it is UNDONE in the /Matrix argument of
|
||||
% the pattern dictionary. This last step can't be done with the /sh
|
||||
% operator which is why I am using pattern dictionaries.
|
||||
\def\pgfplotslibrarysurfdraw{%
|
||||
\begingroup
|
||||
%\pgfinterruptpicture% needed?
|
||||
\setbox\pgfutil@tempboxa=\hbox{%
|
||||
\pgfpicture
|
||||
\pgfplotssys@do@surfshading@fillpaths\pgfplots@loc@TMPa%
|
||||
\global\let\pgfplots@glob@TMPa=\pgfplots@loc@TMPa
|
||||
\pgfpathrectanglecorners
|
||||
{\pgfplotslibrarysurf@corner@sw}
|
||||
{\pgfplotslibrarysurf@corner@ne}%
|
||||
\pgfplotslibrarysurfusepath
|
||||
\endpgfpicture
|
||||
}%
|
||||
\immediate\pdfxform resources{
|
||||
/Pattern << \pgfplots@glob@TMPa >> % write the pattern resource dictionary
|
||||
}\pgfutil@tempboxa
|
||||
\leavevmode
|
||||
\pdfrefxform\pdflastxform
|
||||
%\endpgfinterruptpicture
|
||||
\endgroup
|
||||
}
|
||||
|
||||
% To be used inside of a pgfpicture.
|
||||
%
|
||||
% #1: a macro name. The contents of this macro needs to be written
|
||||
% into the pdf pattern dictionary contained in the pdf resources of
|
||||
% the current context. The current context is either the current page
|
||||
% or an xform object.
|
||||
%
|
||||
%
|
||||
\def\pgfplotssys@do@surfshading@fillpaths#1{%
|
||||
\ifx\pgfplotslibrarysurf@filter@decode\pgfutil@empty
|
||||
\else
|
||||
% Unfortunately, there is a bug in pdftex/luatex: if we
|
||||
% provide a /Filter as attr, and pdftex compresses the stream,
|
||||
% it overwrites the /Filter argument -- and the viewer cannot
|
||||
% decode the stream. We have to deactivate compression here:
|
||||
\pdfcompresslevel=0
|
||||
\fi
|
||||
\def\pgfplots@loc@TMPa{%
|
||||
% stream length will be computed automatically
|
||||
/ShadingType \pgfplotslibrarysurf@type\space
|
||||
/BitsPerCoordinate \pgfplotslibrarysurf@bitspercoordinate\space
|
||||
/BitsPerComponent \pgfplotslibrarysurf@bitspercomponent\space
|
||||
\if5\pgfplotslibrarysurf@type
|
||||
/VerticesPerRow \pgfkeysvalueof{/pgfplots/surf shading/cols}
|
||||
\else
|
||||
/BitsPerFlag 8
|
||||
\fi
|
||||
/ColorSpace /Device\pgfplotslibrarysurf@colorspace
|
||||
/Decode [\pgfplotslibrarysurf@decode]
|
||||
\ifpgfplotslibrarysurf@usecolormap
|
||||
/Function \pgfkeysvalueof{/pgfplots/surf shading/colormap}
|
||||
\fi
|
||||
\ifx\pgfplotslibrarysurf@filter@decode\pgfutil@empty
|
||||
\else
|
||||
/Filter /\pgfplotslibrarysurf@filter@decode\space
|
||||
\fi
|
||||
}%
|
||||
%
|
||||
% \pgfplots@loc@TMPb := final boolean luaBinaryEncoding;
|
||||
\pgfutil@IfUndefined{directlua}{%
|
||||
\def\pgfplots@loc@TMPb{0}%
|
||||
}{%
|
||||
\ifx\pgfplotslibrarysurf@filter@decode\pgfutil@empty
|
||||
% ah - we have binary encoding (the standard).
|
||||
\def\pgfplots@loc@TMPb{1}%
|
||||
\else
|
||||
% ah - base 16 ASCII encoding:
|
||||
\def\pgfplots@loc@TMPb{0}%
|
||||
\fi
|
||||
}%
|
||||
\if0\pgfplots@loc@TMPb
|
||||
% no lua binary encoding. Use standard pdftex operations:
|
||||
\immediate\pdfobj stream attr {%
|
||||
\pgfplots@loc@TMPa
|
||||
} {%
|
||||
\pgfplotslibrarysurf@binarystream
|
||||
}%
|
||||
\edef\pgfplots@loc@TMPa{\the\pdflastobj}%
|
||||
\else
|
||||
% special handling for luatex binary encoding (see docs for \pgfplotsbinarytoluabinary):
|
||||
\pgfplotsbinarytoluabinary{\pgfplotslibrarysurf@binarystream}%
|
||||
\edef\pgfplots@loc@TMPa{%
|
||||
\directlua{%
|
||||
tex.print(pdf.immediateobj(\pgfplotsDQ stream\pgfplotsDQ , pgfplotsretval, \pgfplotsDQ \pgfplots@loc@TMPa\pgfplotsDQ ));
|
||||
pgfplotsretval=nil;
|
||||
}%
|
||||
}%
|
||||
\fi
|
||||
\pgf@process{\pgfpointdiff{\pgfplotslibrarysurf@corner@sw}{\pgfkeysvalueof{/pgfplots/surf shading/anchor}}}%
|
||||
\pgf@sys@bp@correct\pgf@x%
|
||||
\pgf@sys@bp@correct\pgf@y%
|
||||
\immediate\pdfobj {<<
|
||||
/Type /Pattern
|
||||
/PatternType 2
|
||||
% /Matrix [\pgf@pt@aa\space\pgf@pt@ab\space\pgf@pt@ba\space\pgf@pt@bb\space\pgf@sys@tonumber\pgf@pt@x\space\pgf@sys@tonumber\pgf@pt@y]
|
||||
% FIXME: INCORPORATE TIKZ CM
|
||||
/Matrix [1 0 0 1 \pgf@sys@tonumber\pgf@x\space \pgf@sys@tonumber\pgf@y] %226.533 518.141]
|
||||
%--------------------------------------------------
|
||||
% /ExtGState
|
||||
% <<
|
||||
% /LW 2
|
||||
% /OP true
|
||||
% /OPM 1
|
||||
% >>
|
||||
%--------------------------------------------------
|
||||
/Shading \pgfplots@loc@TMPa\space 0 R
|
||||
>>}%
|
||||
\edef#1{%
|
||||
/pgfpatPlotsurface\pgfplotslibrarysurf@count\space \the\pdflastobj\space 0 R
|
||||
}%
|
||||
\pgfsys@setpatterncolored{Plotsurface\pgfplotslibrarysurf@count}%
|
||||
\pgfplotsutil@advancestringcounter@global\pgfplotslibrarysurf@count
|
||||
}
|
||||
|
||||
\endinput
|
||||
% vi: ft=tex
|
|
@ -0,0 +1,30 @@
|
|||
%--------------------------------------------
|
||||
%
|
||||
% Package pgfplots
|
||||
%
|
||||
% 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-2012 by Christian Feuersänger.
|
||||
%
|
||||
% This program is free software: you can redistribute it and/or modify
|
||||
% 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/>.
|
||||
%
|
||||
%--------------------------------------------
|
||||
|
||||
\input pgflibrarypgfplots.surfshading.pgfsys-dvipdfmx.def
|
||||
|
||||
\endinput
|
||||
% vi: ft=tex
|
50
texmf/tex/latex/pgfplots/tex/pgfplots.assert.code.tex
Normal file
50
texmf/tex/latex/pgfplots/tex/pgfplots.assert.code.tex
Normal file
|
@ -0,0 +1,50 @@
|
|||
|
||||
% Token-wise equals; will expand arguments with \edef
|
||||
% #1: expected
|
||||
% #2: actual
|
||||
% #3: message
|
||||
\def\pgfplotsassertequalstok#1#2#3{%
|
||||
\edef\pgfplots@assert@a{#1}%
|
||||
\edef\pgfplots@assert@b{#2}%
|
||||
\pgfplotscommandtostring\pgfplots@assert@a\pgfplots@assert@a
|
||||
\pgfplotscommandtostring\pgfplots@assert@b\pgfplots@assert@b
|
||||
\ifx\pgfplots@assert@a\pgfplots@assert@b
|
||||
\else
|
||||
\pgfplotsassertfail{#3 ^^Jexpected '#1'^^J but was '#2'}%
|
||||
\fi
|
||||
}%
|
||||
|
||||
% Token-wise equals of two MACROS; no expansion
|
||||
% #1: expected
|
||||
% #2: actual
|
||||
% #3: message
|
||||
\def\pgfplotsassertequalstoknoexpand#1#2#3{%
|
||||
\ifx#1#2%
|
||||
\else
|
||||
\pgfplotsassertfail{#3 expected '\meaning#1' but was '\meaning#2'}%
|
||||
\fi
|
||||
}%
|
||||
|
||||
\def\pgfplotsassertfail#1{%
|
||||
\pgfplots@error{Assertion failed: #1}%
|
||||
}%
|
||||
|
||||
% Float-equals
|
||||
% #1: expected
|
||||
% #2: actual
|
||||
% #3: message
|
||||
\def\pgfplotsassertequalsfloat#1#2#3{%
|
||||
\edef\pgfplots@assert@a{#1}%
|
||||
\edef\pgfplots@assert@b{#2}%
|
||||
%
|
||||
\pgfmathfloatparsenumber{\pgfplots@assert@a}%
|
||||
\let\pgfplots@assert@a\pgfmathresult
|
||||
%
|
||||
\pgfmathfloatparsenumber{\pgfplots@assert@b}%
|
||||
\let\pgfplots@assert@b\pgfmathresult
|
||||
%
|
||||
\pgfmathfloatifapproxequalrel{\pgfplots@assert@a}{\pgfplots@assert@b}{%
|
||||
}{%
|
||||
\pgfplotsassertfail{#3 ^^Jexpected '#1'^^J but was '#2'}%
|
||||
}%
|
||||
}%
|
2
texmf/tex/latex/pgfplots/tex/pgfplots.assert.sty
Normal file
2
texmf/tex/latex/pgfplots/tex/pgfplots.assert.sty
Normal file
|
@ -0,0 +1,2 @@
|
|||
|
||||
\input pgfplots.assert.code.tex
|
11221
texmf/tex/latex/pgfplots/tex/pgfplots.code.tex
Normal file
11221
texmf/tex/latex/pgfplots/tex/pgfplots.code.tex
Normal file
File diff suppressed because it is too large
Load diff
599
texmf/tex/latex/pgfplots/tex/pgfplots.errorbars.code.tex
Normal file
599
texmf/tex/latex/pgfplots/tex/pgfplots.errorbars.code.tex
Normal file
|
@ -0,0 +1,599 @@
|
|||
%--------------------------------------------
|
||||
%
|
||||
% Package pgfplots
|
||||
%
|
||||
% 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-2013 by Christian Feuersänger.
|
||||
%
|
||||
% This program is free software: you can redistribute it and/or modify
|
||||
% 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/>.
|
||||
%
|
||||
%--------------------------------------------
|
||||
|
||||
|
||||
% the \addplot commands assign
|
||||
% \pgfplots@current@point@error@x@plus
|
||||
% \pgfplots@current@point@error@x@minus
|
||||
% \pgfplots@current@point@error@y@plus
|
||||
% \pgfplots@current@point@error@y@minus
|
||||
% \pgfplots@current@point@error@z@plus
|
||||
% \pgfplots@current@point@error@z@minus
|
||||
%
|
||||
% the error bar processing takes these values as input, adds them to
|
||||
% the current coordinates where applicable and according the the error
|
||||
% bar configuration and overwrites these macros.
|
||||
%
|
||||
% Then, these values are registered as "visualization depends on",
|
||||
% i.e. they will be available for every visualization phase.
|
||||
%
|
||||
% The visualization phase, in turn, expects these values. More
|
||||
% precisely, a separate visualization phase called
|
||||
% \pgfplotsaxis@visphase@name@errorbars is started. This installs the
|
||||
% plot handler \pgfplots@errorbars@plot@handler and does the same job
|
||||
% as it would for normal plot handlers.
|
||||
%
|
||||
\def\pgfplots@errorbars@survey@begin{%
|
||||
%
|
||||
\pgfplots@errorbars@prepare@value@serialization
|
||||
%
|
||||
% Now, prepare the coordinate processing for errorbars:
|
||||
\pgfplots@PREPARE@errorbar@processing@in@dir x%
|
||||
\pgfplots@PREPARE@errorbar@processing@in@dir y%
|
||||
\ifpgfplots@curplot@threedim
|
||||
\pgfplots@PREPARE@errorbar@processing@in@dir z%
|
||||
\else
|
||||
\let\pgfplots@PREPARE@errorbar@process@z=\relax
|
||||
\fi
|
||||
}
|
||||
|
||||
\def\pgfplots@errorbars@survey@end{%
|
||||
\pgfplots@streamerrorbarend
|
||||
}%
|
||||
|
||||
\def\pgfplots@errorbars@survey@point{%
|
||||
% This thing gets the 'current@point@...' context,
|
||||
% that means
|
||||
% \pgfplots@current@point@[xy]
|
||||
% \pgfplots@current@point@[xy]@error
|
||||
% \pgfplots@current@point@[xy]@unfiltered
|
||||
\pgfplots@PREPARE@errorbar@process@x%
|
||||
\pgfplots@PREPARE@errorbar@process@y%
|
||||
\pgfplots@PREPARE@errorbar@process@z%
|
||||
}
|
||||
|
||||
\def\pgfplots@errorbars@visphase@begin{%
|
||||
\pgfplots@errorbars@prepare@value@serialization
|
||||
}
|
||||
|
||||
\def\pgfplots@errorbars@visphase@end{%
|
||||
}%
|
||||
|
||||
\def\pgfplots@errorbars@visphase@point{%
|
||||
}%
|
||||
|
||||
\def\pgfplots@errorbars@prepare@value@serialization{%
|
||||
\if0\pgfplots@errorbars@xdirection
|
||||
\else
|
||||
\pgfplotsset{%
|
||||
visualization depends on=value \pgfplots@current@point@error@x@plus\as\pgfplots@current@point@error@x@plus,
|
||||
visualization depends on=value \pgfplots@current@point@error@x@minus\as\pgfplots@current@point@error@x@minus,
|
||||
}%
|
||||
\fi
|
||||
\if0\pgfplots@errorbars@ydirection
|
||||
\else
|
||||
\pgfplotsset{%
|
||||
visualization depends on=value \pgfplots@current@point@error@y@plus\as\pgfplots@current@point@error@y@plus,
|
||||
visualization depends on=value \pgfplots@current@point@error@y@minus\as\pgfplots@current@point@error@y@minus,
|
||||
}%
|
||||
\fi
|
||||
\ifpgfplots@curplot@threedim
|
||||
\if0\pgfplots@errorbars@zdirection
|
||||
\else
|
||||
\pgfplotsset{%
|
||||
visualization depends on=value \pgfplots@current@point@error@z@plus\as\pgfplots@current@point@error@z@plus,
|
||||
visualization depends on=value \pgfplots@current@point@error@z@minus\as\pgfplots@current@point@error@z@minus,
|
||||
}%
|
||||
\fi
|
||||
\fi
|
||||
}%
|
||||
|
||||
% Prepares a macro \pgfplots@PREPARE@process@errorbar@for@dir##1
|
||||
% which can then be used to process error bars. The macro will be
|
||||
% \relax if error bars are disabled for #1.
|
||||
%
|
||||
% #1: either x, y or z.
|
||||
%
|
||||
% POSTCONDITION:
|
||||
% the macro \pgfplots@PREPARE@errorbar@process@#1 will be defined.
|
||||
% It is supposed to be used inside of the pgfplots streaming methods
|
||||
% and depends on the arguments
|
||||
% \pgfplots@current@point@[xyz]
|
||||
% \pgfplots@current@point@[xyz]@unfiltered
|
||||
% \pgfplots@current@point@[xyz]@error
|
||||
% The '@unfilterered' arguments are needed for log plots. I do not
|
||||
% want to compute exp(current@point@[xyz]) again.
|
||||
\def\pgfplots@PREPARE@errorbar@processing@in@dir#1{%
|
||||
\pgfplots@PREPARE@errorbar@processing@in@dir@reset#1%
|
||||
%
|
||||
\if0\csname pgfplots@errorbars@#1direction\endcsname
|
||||
% no error bars. Ok. Do nothing here.
|
||||
\expandafter\let\csname pgfplots@PREPARE@errorbar@process@#1\endcsname=\relax
|
||||
\else
|
||||
%
|
||||
% The routine which is invoked for every reported input
|
||||
% coordinate is \pgfplots@process@errorbar@for.
|
||||
%
|
||||
% This here prepares its helper macros for direction '#1':
|
||||
%
|
||||
% More precisely, it prepared
|
||||
%
|
||||
% ##1 is either '+' or '-':
|
||||
% \pgfplots@PREPARE@errorbar@process@x@##1
|
||||
% \pgfplots@PREPARE@errorbar@process@y@##1
|
||||
% \pgfplots@PREPARE@errorbar@process@z@##1
|
||||
%
|
||||
\pgfplots@if{pgfplots@#1islinear}{%
|
||||
\ifcase\csname pgfplots@errorbars@#1mode\endcsname\relax
|
||||
% fixed absolute error.
|
||||
\pgfplotscoordmath{#1}{parsenumber}{\csname pgfplots@errorbars@#1fixed\endcsname}%
|
||||
\expandafter\let\csname pgfplots@error@coord@#1\endcsname=\pgfmathresult
|
||||
\expandafter\def\csname pgfplots@PREPARE@errorbar@process@#1@\endcsname##1{%
|
||||
\if +##1%
|
||||
\def\pgfplots@loc@TMPb{add}%
|
||||
\else
|
||||
\def\pgfplots@loc@TMPb{subtract}%
|
||||
\fi
|
||||
\pgfplotscoordmath{#1}{op}{\pgfplots@loc@TMPb}{%
|
||||
{\csname pgfplots@current@point@#1\endcsname}%
|
||||
{\csname pgfplots@error@coord@#1\endcsname}%
|
||||
}%
|
||||
\let\pgfplots@error@coord=\pgfmathresult
|
||||
\pgfplots@PREPARE@errorbar@stream@it@#1##1%
|
||||
}%
|
||||
\or% fixed relative error:
|
||||
\pgfplotscoordmath{#1}{parsenumber}{\csname pgfplots@errorbars@#1rel\endcsname}%
|
||||
\let\pgfplots@loc@TMPb=\pgfmathresult
|
||||
%
|
||||
% +1:
|
||||
\pgfplotscoordmath{#1}{parsenumber}{1}%
|
||||
\let\pgfplots@loc@TMPa=\pgfmathresult
|
||||
%
|
||||
% Prepare '1 + err':
|
||||
\pgfplotscoordmath{#1}{op}{add}{%
|
||||
{\pgfplots@loc@TMPa}%
|
||||
{\pgfplots@loc@TMPb}%
|
||||
}%
|
||||
\expandafter\let\csname pgfplots@error@coord@#1@+\endcsname=\pgfmathresult
|
||||
%
|
||||
% Prepare '1 - err':
|
||||
\pgfplotscoordmath{#1}{op}{subtract}{%
|
||||
{\pgfplots@loc@TMPa}%
|
||||
{\pgfplots@loc@TMPb}%
|
||||
}%
|
||||
\expandafter\let\csname pgfplots@error@coord@#1@-\endcsname=\pgfmathresult
|
||||
%
|
||||
\expandafter\def\csname pgfplots@PREPARE@errorbar@process@#1@\endcsname##1{%
|
||||
\pgfplotscoordmath{#1}{op}{multiply}{%
|
||||
{\csname pgfplots@current@point@#1\endcsname}
|
||||
{\csname pgfplots@error@coord@#1@##1\endcsname}%
|
||||
}%
|
||||
\let\pgfplots@error@coord=\pgfmathresult
|
||||
\pgfplots@PREPARE@errorbar@stream@it@#1##1%
|
||||
}%
|
||||
\or% explicit absolute:
|
||||
\expandafter\def\csname pgfplots@PREPARE@errorbar@process@#1@\endcsname##1{%
|
||||
\edef\pgfplots@error@coord{\csname pgfplots@current@point@error@#1@\pgfplots@errorbars@plusminus##1\endcsname}%
|
||||
\ifx\pgfplots@error@coord\pgfutil@empty
|
||||
\pgfplots@PREPARE@errorbar@stream@it@empty#1##1%
|
||||
\else
|
||||
\pgfplotscoordmath{#1}{parsenumber}{\pgfplots@error@coord}%
|
||||
\pgfplotscoordmath{#1}{if is bounded}{\pgfmathresult}{%
|
||||
\let\pgfplots@error@coord=\pgfmathresult
|
||||
% remember result here - will be used in case
|
||||
% of '+' AND '-' error bars:
|
||||
%\expandafter\let\csname pgfplots@current@point@error@#1@\pgfplots@errorbars@plusminus##1\endcsname=\pgfmathresult
|
||||
\if +##1%
|
||||
\def\pgfplots@loc@TMPb{add}%
|
||||
\else
|
||||
\def\pgfplots@loc@TMPb{subtract}%
|
||||
\fi
|
||||
\pgfplotscoordmath{#1}{op}{\pgfplots@loc@TMPb}{%
|
||||
{\csname pgfplots@current@point@#1\endcsname}%
|
||||
{\pgfplots@error@coord}%
|
||||
}%
|
||||
\let\pgfplots@error@coord=\pgfmathresult
|
||||
\pgfplots@PREPARE@errorbar@stream@it@#1##1%
|
||||
}{%
|
||||
% input is unbounded. Skip it.
|
||||
\pgfplots@PREPARE@errorbar@stream@it@empty#1##1%
|
||||
}%
|
||||
\fi
|
||||
}%
|
||||
\or% explicit relative:
|
||||
\expandafter\def\csname pgfplots@PREPARE@errorbar@process@#1@\endcsname##1{%
|
||||
\edef\pgfplots@error@coord{\csname pgfplots@current@point@error@#1@\pgfplots@errorbars@plusminus##1\endcsname}%
|
||||
\ifx\pgfplots@error@coord\pgfutil@empty
|
||||
\pgfplots@PREPARE@errorbar@stream@it@empty#1##1%
|
||||
\else
|
||||
\pgfplotscoordmath{#1}{parsenumber}{\pgfplots@error@coord}%
|
||||
\pgfplotscoordmath{#1}{if is bounded}{\pgfmathresult}{%
|
||||
\let\pgfplots@error@coord=\pgfmathresult
|
||||
% compute ' 1 + value' or '1-value':
|
||||
\pgfplotscoordmath{#1}{one}%
|
||||
\if +##1%
|
||||
\def\pgfplots@loc@TMPb{add}%
|
||||
\else
|
||||
\def\pgfplots@loc@TMPb{subtract}%
|
||||
\fi
|
||||
\pgfplotscoordmath{#1}{op}{\pgfplots@loc@TMPb}{%
|
||||
{\pgfmathresult}%
|
||||
{\pgfplots@error@coord}%
|
||||
}%
|
||||
\let\pgfplots@error@coord=\pgfmathresult
|
||||
\pgfplotscoordmath{#1}{op}{multiply}{%
|
||||
{\csname pgfplots@current@point@#1\endcsname}
|
||||
{\pgfplots@error@coord}%
|
||||
}%
|
||||
\let\pgfplots@error@coord=\pgfmathresult
|
||||
\pgfplots@PREPARE@errorbar@stream@it@#1##1%
|
||||
}{%
|
||||
% input is unbounded. Skip it.
|
||||
\pgfplots@PREPARE@errorbar@stream@it@empty#1##1%
|
||||
}%
|
||||
\fi
|
||||
}%
|
||||
\fi
|
||||
}{%
|
||||
% LOGARITHMIC scaling. All errors are interpreted as
|
||||
% log(x +- e_x)
|
||||
% or
|
||||
% log( x*(1+-e_x) )
|
||||
%
|
||||
% That means any input argument is
|
||||
% given in log base e and in fixed point.
|
||||
% Furthermore, we expect the '@unfiltered' keys to be
|
||||
% present (I don't want to apply 'exp' again!).
|
||||
%
|
||||
\ifcase\csname pgfplots@errorbars@#1mode\endcsname
|
||||
% fixed absolute, log( x +- e_x )
|
||||
%
|
||||
\pgfplotscoordmath{default}{parsenumber}{\csname pgfplots@errorbars@#1fixed\endcsname}%
|
||||
\expandafter\let\csname pgfplots@error@coord@#1\endcsname=\pgfmathresult
|
||||
\expandafter\def\csname pgfplots@PREPARE@errorbar@process@#1@\endcsname##1{%
|
||||
\pgfplotscoordmath{default}{parsenumber}{\csname pgfplots@current@point@#1@unfiltered\endcsname}%
|
||||
\let\pgfplots@loc@TMPa=\pgfmathresult
|
||||
\if +##1%
|
||||
\def\pgfplots@loc@op{add}%
|
||||
\else
|
||||
\def\pgfplots@loc@op{subtract}%
|
||||
\fi
|
||||
\pgfplotscoordmath{default}{op}{\pgfplots@loc@op}{%
|
||||
{\pgfplots@loc@TMPa}%
|
||||
{\csname pgfplots@error@coord@#1\endcsname}%
|
||||
}%
|
||||
\pgfplotscoordmath{default}{tostring}{\pgfmathresult}%
|
||||
\pgfplotscoordmath{#1}{log}{\pgfmathresult}%
|
||||
\let\pgfplots@error@coord=\pgfmathresult
|
||||
\pgfplots@PREPARE@errorbar@stream@it@#1##1%
|
||||
}%
|
||||
\or% fixed relative, log( x ( 1+-e_x ) ) = log(x) + log(1+-e_x)
|
||||
\pgfplotscoordmath{default}{parsenumber}{\csname pgfplots@errorbars@#1rel\endcsname}%
|
||||
\let\pgfplots@loc@TMPb=\pgfmathresult
|
||||
%
|
||||
% +1:
|
||||
\pgfplotscoordmath{default}{one}%
|
||||
\let\pgfplots@loc@TMPa=\pgfmathresult
|
||||
%
|
||||
% Prepare '1 + err':
|
||||
\pgfplotscoordmath{default}{op}{add}{{\pgfplots@loc@TMPa}{\pgfplots@loc@TMPb}}%
|
||||
\pgfplotscoordmath{default}{tostring}{\pgfmathresult}%
|
||||
\pgfplotscoordmath{#1}{log}{\pgfmathresult}%
|
||||
\pgfplotscoordmath{#1}{if is bounded}{\pgfmathresult}{%
|
||||
}{%
|
||||
% 1 + err <= 0 and log(1+err) is undefined:
|
||||
\pgfplotscoordmath{default}{tostring}{\pgfplots@loc@TMPb}%
|
||||
\pgfplots@error{Sorry, log(1 + \pgfmathresult) is undefined. Please provide a different argument for '/pgfplots/error bar/#1 fixed relative'.}%
|
||||
\let\pgfmathresult=\pgfutil@empty
|
||||
}%
|
||||
\expandafter\let\csname pgfplots@error@coord@#1@+\endcsname=\pgfmathresult
|
||||
%
|
||||
% Prepare '1 - err':
|
||||
\pgfplotscoordmath{default}{op}{subtract}{{\pgfplots@loc@TMPa}{\pgfplots@loc@TMPb}}%
|
||||
\pgfplotscoordmath{default}{tostring}{\pgfmathresult}%
|
||||
\pgfplotscoordmath{#1}{log}{\pgfmathresult}%
|
||||
\pgfplotscoordmath{#1}{if is bounded}{\pgfmathresult}{%
|
||||
}{%
|
||||
% 1 - err <= 0 and log(1+err) is undefined:
|
||||
\pgfplotscoordmath{default}{tostring}{\pgfplots@loc@TMPb}%
|
||||
\pgfplots@error{Sorry, log(1 - \pgfmathresult) (\pgfplots@loc@TMPa - \pgfplots@loc@TMPb) is undefined. Please provide a different argument for '/pgfplots/error bar/#1 fixed relative'.}%
|
||||
\let\pgfmathresult=\pgfutil@empty
|
||||
}%
|
||||
\expandafter\let\csname pgfplots@error@coord@#1@-\endcsname=\pgfmathresult
|
||||
%
|
||||
\expandafter\def\csname pgfplots@PREPARE@errorbar@process@#1@\endcsname##1{%
|
||||
\expandafter\ifx\csname pgfplots@current@point@#1@##1\endcsname\pgfutil@empty
|
||||
\pgfplots@PREPARE@errorbar@stream@it@empty#1##1%
|
||||
\else
|
||||
\pgfmath@basic@add@
|
||||
{\csname pgfplots@current@point@#1\endcsname}
|
||||
{\csname pgfplots@error@coord@#1@##1\endcsname}%
|
||||
\let\pgfplots@error@coord=\pgfmathresult
|
||||
\pgfplots@PREPARE@errorbar@stream@it@#1##1%
|
||||
\fi
|
||||
}%
|
||||
\or% explicit absolute
|
||||
% log( x +- e_x )
|
||||
\expandafter\def\csname pgfplots@PREPARE@errorbar@process@#1@\endcsname##1{%
|
||||
\edef\pgfplots@error@coord{\csname pgfplots@current@point@error@#1@\pgfplots@errorbars@plusminus##1\endcsname}%
|
||||
\ifx\pgfplots@error@coord\pgfutil@empty
|
||||
\pgfplots@PREPARE@errorbar@stream@it@empty#1##1%
|
||||
\else
|
||||
\pgfplotscoordmath{default}{parsenumber}{\pgfplots@error@coord}%
|
||||
\pgfplotscoordmath{default}{if is bounded}{\pgfmathresult}{%
|
||||
\let\pgfplots@error@coord=\pgfmathresult
|
||||
% remember result here - will be used in case
|
||||
% of '+' AND '-' error bars:
|
||||
%\expandafter\let\csname pgfplots@current@point@error@#1@\pgfplots@errorbars@plusminus##1\endcsname=\pgfmathresult
|
||||
\pgfplotscoordmath{default}{parsenumber}{\csname pgfplots@current@point@#1@unfiltered\endcsname}%
|
||||
\let\pgfplots@loc@TMPa=\pgfmathresult
|
||||
\if +##1%
|
||||
\def\pgfplots@loc@op{add}%
|
||||
\else
|
||||
\def\pgfplots@loc@op{subtract}%
|
||||
\fi
|
||||
\pgfplotscoordmath{default}{op}{\pgfplots@loc@op}{%
|
||||
{\pgfplots@loc@TMPa}%
|
||||
{\pgfplots@error@coord}%
|
||||
}%
|
||||
\pgfplotscoordmath{default}{tostring}{\pgfmathresult}%
|
||||
\pgfplotscoordmath{#1}{log}{\pgfmathresult}%
|
||||
\let\pgfplots@error@coord=\pgfmathresult
|
||||
\pgfplots@PREPARE@errorbar@stream@it@#1##1%
|
||||
}{%
|
||||
% input is unbounded. Skip it.
|
||||
\pgfplots@PREPARE@errorbar@stream@it@empty#1##1%
|
||||
}%
|
||||
\fi
|
||||
}%
|
||||
%
|
||||
\or% explicit relative:
|
||||
% log( x ( 1+-e_x ) ) = log(x) + log(1+-e_x)
|
||||
\expandafter\def\csname pgfplots@PREPARE@errorbar@process@#1@\endcsname##1{%
|
||||
\edef\pgfplots@error@coord{\csname pgfplots@current@point@error@#1@\pgfplots@errorbars@plusminus##1\endcsname}%
|
||||
\ifx\pgfplots@error@coord\pgfutil@empty
|
||||
\pgfplots@PREPARE@errorbar@stream@it@empty#1##1%
|
||||
\else
|
||||
\pgfplotscoordmath{default}{parsenumber}{\pgfplots@error@coord}%
|
||||
\pgfplotscoordmath{default}{if is bounded}{\pgfmathresult}{%
|
||||
\let\pgfplots@error@coord=\pgfmathresult
|
||||
% remember result here - will be used in case
|
||||
% of '+' AND '-' error bars:
|
||||
%\expandafter\let\csname pgfplots@current@point@error@#1@\pgfplots@errorbars@plusminus##1\endcsname=\pgfmathresult
|
||||
%
|
||||
\pgfplotscoordmath{default}{one}%
|
||||
\let\pgfplots@loc@TMPa=\pgfmathresult
|
||||
\if +##1%
|
||||
\def\pgfplots@loc@op{add}%
|
||||
\else
|
||||
\def\pgfplots@loc@op{subtract}%
|
||||
\fi
|
||||
\pgfplotscoordmath{default}{op}{\pgfplots@loc@op}{%
|
||||
{\pgfplots@loc@TMPa}%
|
||||
{\pgfplots@error@coord}%
|
||||
}%
|
||||
\pgfplotscoordmath{default}{tostring}{\pgfmathresult}%
|
||||
\pgfplotscoordmath{#1}{log}{\pgfmathresult}%
|
||||
\let\pgfplots@error@coord=\pgfmathresult
|
||||
\pgfplotscoordmath{#1}{if is bounded}{\pgfmathresult}{%
|
||||
\pgfplotscoordmath{#1}{op}{add}{%
|
||||
{\csname pgfplots@current@point@#1\endcsname}
|
||||
{\pgfplots@error@coord}%
|
||||
}%
|
||||
\let\pgfplots@error@coord=\pgfmathresult
|
||||
\pgfplots@PREPARE@errorbar@stream@it@#1##1%
|
||||
}{%
|
||||
% -> log( <= 0 ) -> do nothing.
|
||||
\pgfplots@PREPARE@errorbar@stream@it@empty#1##1%
|
||||
}%
|
||||
}{%
|
||||
% input is unbounded - do nothing.
|
||||
\pgfplots@PREPARE@errorbar@stream@it@empty#1##1%
|
||||
}%
|
||||
\fi
|
||||
}%
|
||||
%
|
||||
\fi
|
||||
}%
|
||||
\ifcase\csname pgfplots@errorbars@#1direction\endcsname
|
||||
% none
|
||||
\or
|
||||
% plus
|
||||
\expandafter\edef\csname pgfplots@PREPARE@errorbar@process@#1\endcsname{%
|
||||
\expandafter\noexpand\csname pgfplots@PREPARE@errorbar@process@#1@\endcsname+%
|
||||
}%
|
||||
\or
|
||||
% minus
|
||||
\expandafter\edef\csname pgfplots@PREPARE@errorbar@process@#1\endcsname{%
|
||||
\expandafter\noexpand\csname pgfplots@PREPARE@errorbar@process@#1@\endcsname-%
|
||||
}%
|
||||
\or
|
||||
% both
|
||||
\expandafter\edef\csname pgfplots@PREPARE@errorbar@process@#1\endcsname{%
|
||||
\expandafter\noexpand\csname pgfplots@PREPARE@errorbar@process@#1@\endcsname+%
|
||||
\expandafter\noexpand\csname pgfplots@PREPARE@errorbar@process@#1@\endcsname-%
|
||||
}%
|
||||
\fi
|
||||
\fi
|
||||
}
|
||||
|
||||
\def\pgfplots@PREPARE@errorbar@processing@in@dir@reset#1{%
|
||||
\expandafter\let\csname pgfplots@current@point@error@#1@plus\endcsname=\pgfutil@empty
|
||||
\expandafter\let\csname pgfplots@current@point@error@#1@minus\endcsname=\pgfutil@empty
|
||||
}%
|
||||
|
||||
% #1: one of x,y, or z
|
||||
% #2: either '+' or '-', denotes the direction of the error
|
||||
% bar
|
||||
%
|
||||
% PRECONDITION: \pgfplots@error@coord contains the value which is to
|
||||
% be stored as \pgfplots@current@point@error@#1@plus or
|
||||
% \pgfplots@current@point@error@#1@minus
|
||||
%
|
||||
% POSTCONDITION: limits updated and
|
||||
% \pgfplots@current@point@error@#1@plus or
|
||||
% \pgfplots@current@point@error@#1@minus
|
||||
% is defined.
|
||||
\def\pgfplots@PREPARE@errorbar@stream@it@#1#2{%
|
||||
\ifx\pgfplots@error@coord\pgfutil@empty
|
||||
\else
|
||||
\expandafter\let\expandafter\pgfplots@current@point@@old\csname pgfplots@current@point@#1\endcsname
|
||||
\expandafter\let\csname pgfplots@current@point@#1\endcsname=\pgfplots@error@coord
|
||||
\pgfplotsaxisupdatelimitsforcoordinate\pgfplots@current@point@x\pgfplots@current@point@y\pgfplots@current@point@z
|
||||
\expandafter\let\csname pgfplots@current@point@#1\endcsname=\pgfplots@current@point@@old
|
||||
\fi
|
||||
%
|
||||
% ... and remember what we need! This value will be stored as
|
||||
% "visualization depends on"
|
||||
\expandafter\let\csname pgfplots@current@point@error@#1@\pgfplots@errorbars@plusminus#2\endcsname=\pgfplots@error@coord
|
||||
}%
|
||||
|
||||
\def\pgfplots@PREPARE@errorbar@stream@it@empty#1#2{%
|
||||
% ... and remember what we need! This value will be stored as
|
||||
% "visualization depends on"
|
||||
\expandafter\let\csname pgfplots@current@point@error@#1@\pgfplots@errorbars@plusminus#2\endcsname=\pgfutil@empty
|
||||
}
|
||||
|
||||
\def\pgfplots@errorbars@plusminus#1{%
|
||||
\if#1+%
|
||||
plus%
|
||||
\else
|
||||
minus%
|
||||
\fi
|
||||
}%
|
||||
|
||||
% A dummy plot handler which is used in a special visualization phase
|
||||
% for error bars.
|
||||
\def\pgfplots@errorbars@plot@handler{%
|
||||
\gdef\pgf@plotstreamstart{%
|
||||
\pgfplots@streamerrorbar@directdraw
|
||||
\global\let\pgf@plotstreampoint=\pgfplots@errorbars@plot@handler@point
|
||||
\global\let\pgf@plotstreamspecial=\relax
|
||||
\global\let\pgf@plotstreamend=\pgfplots@streamerrorbarend
|
||||
\pgfplots@streamerrorbarstart
|
||||
}%
|
||||
}%
|
||||
|
||||
\def\pgfplots@errorbars@plot@handler@point#1{%
|
||||
\pgf@process{#1}%
|
||||
\edef\pgfplots@errorbars@src{(\the\pgf@x,\the\pgf@y)}%
|
||||
%
|
||||
% we want to allow scatter plots to vary depending on 'point
|
||||
% meta'. This here does not hurt:
|
||||
\pgfplotsaxisvisphasetransformpointmetaifany
|
||||
%
|
||||
\pgfplots@errorbars@plot@handler@point@dir x%
|
||||
\pgfplots@errorbars@plot@handler@point@dir y%
|
||||
\ifpgfplots@curplot@threedim
|
||||
\pgfplots@errorbars@plot@handler@point@dir z%
|
||||
\fi
|
||||
}
|
||||
|
||||
% #1: one of x,y, or z
|
||||
% #2: the error bar value in dir #1
|
||||
% output: \pgfplots@errorbars@trg in the form (<x>,<y>,<z>)
|
||||
\def\pgfplots@errorbars@to@pt#1#2{%
|
||||
\begingroup
|
||||
\expandafter\let\csname pgfplots@current@point@#1\endcsname=#2%
|
||||
\ifpgfplots@curplot@threedim
|
||||
\edef\pgfplotsretval{(\pgfplots@current@point@x,\pgfplots@current@point@y,\pgfplots@current@point@z)}%
|
||||
\else
|
||||
\edef\pgfplotsretval{(\pgfplots@current@point@x,\pgfplots@current@point@y)}%
|
||||
\fi
|
||||
\global\let\pgfplots@errorbars@trg=\pgfplotsretval
|
||||
\endgroup
|
||||
}%
|
||||
|
||||
% #1: a <\macro> containing the value
|
||||
% #2: either x,y, or z
|
||||
\def\pgfplots@errorbars@plot@handler@point@dir@@#1#2{%
|
||||
\ifx#1\pgfutil@empty
|
||||
\else
|
||||
\pgfplotsaxisvisphasetransformcoordinateentry{#2}{#1}%
|
||||
\pgfplots@errorbars@to@pt{#2}{\pgfmathresult}%
|
||||
\pgfplots@streamerrorbarcoords{\pgfplots@errorbars@src}{\pgfplots@errorbars@trg}%
|
||||
\fi
|
||||
}%
|
||||
|
||||
\def\pgfplots@errorbars@plot@handler@point@dir#1{%
|
||||
\ifcase\csname pgfplots@errorbars@#1direction\endcsname
|
||||
% none
|
||||
\or
|
||||
% plus
|
||||
\expandafter\pgfplots@errorbars@plot@handler@point@dir@@\csname pgfplots@current@point@error@#1@plus\endcsname#1%
|
||||
\or
|
||||
% minus
|
||||
\expandafter\pgfplots@errorbars@plot@handler@point@dir@@\csname pgfplots@current@point@error@#1@minus\endcsname#1%
|
||||
\or
|
||||
% both
|
||||
\expandafter\pgfplots@errorbars@plot@handler@point@dir@@\csname pgfplots@current@point@error@#1@plus\endcsname#1%
|
||||
\expandafter\pgfplots@errorbars@plot@handler@point@dir@@\csname pgfplots@current@point@error@#1@minus\endcsname#1%
|
||||
\fi
|
||||
}%
|
||||
|
||||
\def\pgfplots@streamerrorbarstart{%
|
||||
}%
|
||||
\def\pgfplots@streamerrorbarend{%
|
||||
}%
|
||||
\def\pgfplots@streamerrorbarcoords#1#2{%
|
||||
}%
|
||||
|
||||
\def\pgfplots@streamerrorbar@directdraw{%
|
||||
\def\pgfplots@streamerrorbarstart{}%
|
||||
\def\pgfplots@streamerrorbarend{}%
|
||||
\def\pgfplots@streamerrorbarcoords##1##2{%
|
||||
\pgfplots@errorbar@draw{##1}{##2}%
|
||||
}%
|
||||
}
|
||||
|
||||
% This thing here shall draw all error bar commands listed in '#2'.
|
||||
%
|
||||
% It will be invoked when any plotting commands take effect (that
|
||||
% means all limits are computed; the axis has been drawn,
|
||||
% transformations are set up...)
|
||||
\def\pgfplots@errorbars@finishwithstyleoptions[#1]#2{%
|
||||
\scope[/pgfplots/.cd,#1,/pgfplots/every error bar]% it uses the /pgfplots/.unknown handler
|
||||
#2%
|
||||
\endscope
|
||||
}
|
||||
|
||||
\def\pgfplots@errorbar@draw#1#2{%
|
||||
\begingroup
|
||||
\pgfplots@restorepgfpoint
|
||||
\pgfkeysvalueof{/pgfplots/error bars/draw error bar/.@cmd}{#1}{#2}\pgfeov%
|
||||
\endgroup
|
||||
}%
|
||||
|
||||
\def\pgfplotsaxis@visphase@name@errorbars{errorbars}
|
||||
|
||||
\expandafter\def\csname pgfplots@visphase@\pgfplotsaxis@visphase@name@errorbars\endcsname{%
|
||||
\pgfplots@errorbars@finishwithstyleoptions[]{%
|
||||
\let\tikz@plot@handler=\pgfplots@errorbars@plot@handler
|
||||
\expandafter\pgfplots@coord@stream@finalize@storedcoords@START\pgfplots@stored@current@data\pgfplots@EOI
|
||||
}%
|
||||
}%
|
||||
|
||||
\endinput
|
37
texmf/tex/latex/pgfplots/tex/pgfplots.lua
Normal file
37
texmf/tex/latex/pgfplots/tex/pgfplots.lua
Normal file
|
@ -0,0 +1,37 @@
|
|||
|
||||
pgfplotsGetLuaBinaryStringFromCharIndicesChunkSize = 7000;
|
||||
|
||||
if unpack == nil then
|
||||
-- LUA 0.76 renamed unpack to table.unpack
|
||||
pgfplotsUnpack = table.unpack;
|
||||
else
|
||||
pgfplotsUnpack = unpack;
|
||||
end
|
||||
|
||||
-- Takes a table containing an arbitrary number of integers in the range 0..255 and converts it
|
||||
-- into a binary stream of the corresponding binary chars.
|
||||
--
|
||||
-- @param charIndices a table containing 0...N arguments; each in the range 0..255
|
||||
--
|
||||
-- @return a string containing binary content, one byte for each input integer.
|
||||
function pgfplotsGetLuaBinaryStringFromCharIndices(charIndices)
|
||||
-- unpack extracts only the indices (we can't provide a table to string.char).
|
||||
-- note that pdf.immediateobj has been designed to avoid sanity checking for invalid UTF strings -
|
||||
-- in other words: it accepts binary strings.
|
||||
--
|
||||
-- unfortunately, this here fails for huge input tables:
|
||||
-- pgfplotsretval=string.char(unpack(charIndices));
|
||||
-- we have to create it incrementally using chunks:
|
||||
local len = #charIndices;
|
||||
local chunkSize = pgfplotsGetLuaBinaryStringFromCharIndicesChunkSize;
|
||||
local buf = {};
|
||||
-- ok, append all full chunks of chunkSize first:
|
||||
local numFullChunks = math.floor(len/chunkSize);
|
||||
for i = 0, numFullChunks-1, 1 do
|
||||
table.insert(buf, string.char(pgfplotsUnpack(charIndices, 1+i*chunkSize, (i+1)*chunkSize)));
|
||||
end
|
||||
-- append the rest:
|
||||
table.insert(buf, string.char(pgfplotsUnpack(charIndices, 1+numFullChunks*chunkSize)));
|
||||
return table.concat(buf);
|
||||
end
|
||||
|
361
texmf/tex/latex/pgfplots/tex/pgfplots.markers.code.tex
Normal file
361
texmf/tex/latex/pgfplots/tex/pgfplots.markers.code.tex
Normal file
|
@ -0,0 +1,361 @@
|
|||
%--------------------------------------------
|
||||
%
|
||||
% Package pgfplots
|
||||
%
|
||||
% 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-2013 by Christian Feuersänger.
|
||||
%
|
||||
% This program is free software: you can redistribute it and/or modify
|
||||
% 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/>.
|
||||
%
|
||||
%--------------------------------------------
|
||||
|
||||
\def\pgfplots@markers@visphase@name@none{none}%
|
||||
\def\pgfplots@markers@visphase@name@afterpath@clipped{afterpath@clipped}%
|
||||
\def\pgfplots@markers@visphase@name@afterpath@unclipped{afterpath@unclipped}%
|
||||
\def\pgfplots@markers@visphase@name@endaxis@unclipped{endaxis@unclipped}%
|
||||
|
||||
% defines \pgfplotsretval to contain the visualization phase used by
|
||||
% the current plot.
|
||||
\def\pgfplots@markers@survey@set@visphasename{%
|
||||
\begingroup
|
||||
%
|
||||
% this validates+normalizes \tikz@plot@mark:
|
||||
\pgfplots@markers@check@for@default@plot@mark
|
||||
\ifx\tikz@plot@mark\pgfutil@empty
|
||||
\ifpgfplots@scatterplotenabled
|
||||
\def\b@pgfplots@has@plot@mark{1}%
|
||||
\else
|
||||
\def\b@pgfplots@has@plot@mark{0}%
|
||||
\fi
|
||||
\else
|
||||
\def\b@pgfplots@has@plot@mark{1}%
|
||||
\fi
|
||||
%
|
||||
% this sets \ifpgfplots@clip@marker@paths:
|
||||
\pgfplots@markers@prepare@layered@graphics@marks
|
||||
%
|
||||
\if0\b@pgfplots@has@plot@mark
|
||||
% no markers. Ok, we do not need a visualization phase for
|
||||
% markers.
|
||||
\let\pgfplotsretval=\pgfplots@markers@visphase@name@none
|
||||
\else
|
||||
\ifpgfplots@clip@marker@paths
|
||||
\let\pgfplotsretval=\pgfplots@markers@visphase@name@afterpath@clipped
|
||||
\else
|
||||
\if2\pgfplots@clipmode
|
||||
% clip mode=individual:
|
||||
\let\pgfplotsretval=\pgfplots@markers@visphase@name@afterpath@unclipped
|
||||
\else
|
||||
% clip mode=global
|
||||
\let\pgfplotsretval=\pgfplots@markers@visphase@name@endaxis@unclipped
|
||||
\fi
|
||||
\fi
|
||||
\fi
|
||||
%
|
||||
\pgfmath@smuggleone\pgfplotsretval
|
||||
\endgroup
|
||||
}%
|
||||
|
||||
\def\pgfplots@markers@visphase@after@axis@prepare{%
|
||||
\global\pgfplotslistnewempty\pgfplots@stored@markerlist
|
||||
}
|
||||
|
||||
% Draw any markers for which drawing has been postponed.
|
||||
%
|
||||
% The motivation here is that markers should be drawn on top of
|
||||
% their plots, and AFTER the clip path.
|
||||
%
|
||||
\def\pgfplots@markers@visphase@after@axis{%
|
||||
\begingroup
|
||||
\pgfplotslistforeach\pgfplots@stored@plotlist\as\pgfplots@loc@TMPa{%
|
||||
\expandafter\pgfplots@stored@plotlist@EXTRACTENTRY\pgfplots@loc@TMPa
|
||||
%\message{^^JProcessing stored plot with precommand '\meaning\pgfplots@stored@current@precmd';^^J pgfplots@plotcmd '\meaning\pgfplots@stored@current@cmd'^^J postcommand '\meaning\pgfplots@stored@current@postcmd'^^J}%
|
||||
%\message{DATA: '\meaning\pgfplots@stored@current@data';^^J}%
|
||||
% The precmd sets all required variables needed to
|
||||
% finalize a plot.
|
||||
% @see the stream preparation routines.
|
||||
\pgfplots@stored@current@precmd
|
||||
\ifx\pgfplots@markers@visphase@name\pgfplots@markers@visphase@name@endaxis@unclipped
|
||||
\ifx\pgfplots@stored@current@cmd\pgfutil@empty
|
||||
% Ah: some \pgfplotsextra command like \draw,\path,
|
||||
% \node or even \scope or \endscope.
|
||||
% Has been done earlier.
|
||||
\else
|
||||
\begingroup
|
||||
% reconfigure...
|
||||
\pgfkeyssetvalue{/pgfplots/on layer}{\pgfkeysvalueof{/pgfplots/mark layer}}%
|
||||
%
|
||||
% choose the one that is necessary for us here:
|
||||
\let\pgfplots@markers@visphase@name=\pgfplots@markers@visphase@name@afterpath@unclipped
|
||||
%
|
||||
% provide an empty list of phase names here in order
|
||||
% to turn off standard visualization phases: they
|
||||
% have been applied already.
|
||||
\pgfplots@stored@plotlist@visualize@selected@phases{}%
|
||||
\endgroup
|
||||
\fi
|
||||
\pgfplots@stored@current@postcmd
|
||||
\fi
|
||||
}%
|
||||
\endgroup
|
||||
}
|
||||
|
||||
\def\pgfplots@execute@at@begin@plot@visualization@internal{%
|
||||
\global\let\pgfplots@stored@markerlist@last=\relax
|
||||
}%
|
||||
|
||||
\def\pgfplots@markers@install@plotmark@handler{%
|
||||
% note: I can't check on tikz@transform because it can be '\relax'.
|
||||
\pgfplots@gettikzinternal@keyval{mark indices}{tikz@mark@list}{}%
|
||||
\pgfplots@gettikzinternal@keyval{mark}{tikz@plot@mark}{}%
|
||||
%
|
||||
%
|
||||
% do not reset \tikz@options: draw color may be acquired
|
||||
% from 'current plot style'
|
||||
%\let\tikz@options=\pgfutil@empty%
|
||||
\let\tikz@transform=\pgfutil@empty%
|
||||
\tikzset{every plot/.try,every mark}%
|
||||
%
|
||||
% This sets colors:
|
||||
\tikz@options
|
||||
%
|
||||
% This sets the \iftikz@mode@draw etc:
|
||||
%\tikz@mode
|
||||
% FIXME: using 'color=blue' will NOT activate filltrue!
|
||||
% So: if 'tikz@mode' *contains* 'fillfalse', I know what to do...
|
||||
% but all other cases are not clear
|
||||
%--------------------------------------------------
|
||||
% \iftikz@mode@draw
|
||||
% \else
|
||||
% % Override the marker codes: force 'draw=none'
|
||||
% % even if the markers likes to be stroked:
|
||||
% \let\pgfusepathqfillstroke=\pgfusepathqfill
|
||||
% \fi
|
||||
% \iftikz@mode@fill
|
||||
% \else
|
||||
% % Override the marker codes: force 'fill=none'
|
||||
% % even if the markers likes to be filled:
|
||||
% \let\pgfusepathqfillstroke=\pgfusepathqstroke
|
||||
% \fi
|
||||
%--------------------------------------------------
|
||||
%
|
||||
% this here is the MAIN marker code.
|
||||
% It may be modified if scatter plot is enabled, see below.
|
||||
\def\pgfplots@loc@TMPa{%
|
||||
% the transformation has been reset before processing plot
|
||||
% marks.
|
||||
% Consequently, it applies only transformation options in "every mark".
|
||||
\tikz@transform
|
||||
\pgfuseplotmark{\tikz@plot@mark}%
|
||||
}%
|
||||
\ifpgfplots@scatterplotenabled
|
||||
% Scatter plots work like this:
|
||||
%
|
||||
% <compute per-point meta info>
|
||||
% /pgfplots/scatter/@pre marker code
|
||||
% <marker code, lowlevel>
|
||||
% /pgfplots/scatter/@post marker code
|
||||
%
|
||||
% -> that's all. The Rest is configurable with style which
|
||||
% (re)define '@pre marker code' and '@post marker code' (see
|
||||
% the docs for details).
|
||||
%
|
||||
% Prepare arguments for '@pre/@post' macros:
|
||||
\t@pgfplots@toka={%
|
||||
\begingroup
|
||||
% prepare programmatic access to '/data point/x' etc:
|
||||
\pgfplotspointgetcoordinates
|
||||
\pgfplotsaxisvisphasetransformpointmeta
|
||||
\pgfkeysvalueof{/pgfplots/scatter/@pre marker code/.@cmd}\pgfeov
|
||||
}%
|
||||
\t@pgfplots@tokb=\expandafter{\pgfplots@loc@TMPa}%
|
||||
\t@pgfplots@tokc={%
|
||||
\pgfkeysvalueof{/pgfplots/scatter/@post marker code/.@cmd}\pgfeov
|
||||
\endgroup
|
||||
}%
|
||||
\edef\pgfplots@loc@TMPa{%
|
||||
\the\t@pgfplots@toka
|
||||
\the\t@pgfplots@tokb
|
||||
\the\t@pgfplots@tokc
|
||||
}%
|
||||
\if r\pgfplots@scatter@position
|
||||
% scatter/position=relative
|
||||
%
|
||||
% tikz transforms the coordinate system such that "(0,0)"
|
||||
% is the point where the mark should be placed.
|
||||
\else
|
||||
% scatter/position=absolute
|
||||
%
|
||||
% ah - we do not want tikz's transformation.
|
||||
%
|
||||
% Disable it by means of \aftergroup hackery:
|
||||
\t@pgfplots@tokc=\expandafter{\pgfplots@loc@TMPa}%
|
||||
\xdef\pgfplots@scatter@plot@mark{%
|
||||
\noexpand\begingroup
|
||||
\the\t@pgfplots@tokc
|
||||
\noexpand\endgroup
|
||||
}%
|
||||
\def\pgfplots@loc@TMPa{\aftergroup\pgfplots@scatter@plot@mark}%
|
||||
\fi
|
||||
\fi
|
||||
\def\pgfplots@loc@TMPb##1{%
|
||||
\ifx\tikz@mark@list\pgfutil@empty%
|
||||
\pgfplothandlermark{##1}%
|
||||
\else
|
||||
\pgfplothandlermarklisted{##1}{\tikz@mark@list}%
|
||||
\fi
|
||||
}%
|
||||
\t@pgfplots@tokc=\expandafter\expandafter\expandafter{\expandafter\pgfplots@loc@TMPb\expandafter{\pgfplots@loc@TMPa}}%
|
||||
\edef\pgfplots@basiclevel@plothandler{\the\t@pgfplots@tokc}%
|
||||
\expandafter\def\expandafter\pgfplots@basiclevel@plothandler\expandafter{%
|
||||
\pgfplots@basiclevel@plothandler
|
||||
\global\let\pgfplots@markers@plotstreamstart=\pgf@plotstreamstart
|
||||
\def\pgf@plotstreamstart{%
|
||||
\pgfplots@markers@plotstreamstart
|
||||
\global\let\pgfplots@markers@mark@handler@@=\pgf@plotstreampoint
|
||||
\global\let\pgf@plotstreampoint=\pgfplots@markers@mark@handler
|
||||
}%
|
||||
}%
|
||||
\let\tikz@plot@handler=\pgfplots@basiclevel@plothandler
|
||||
%
|
||||
\pgfplots@basiclevel@plothandler
|
||||
%
|
||||
}%
|
||||
|
||||
\def\pgfplots@markers@mark@handler#1{%
|
||||
\ifpgfplots@clip
|
||||
% check for clip marker paths:
|
||||
\pgfplotsaxisifcontainspoint{\pgfplots@markers@mark@handler@@{#1}}{}%
|
||||
\else
|
||||
\pgfplots@markers@mark@handler@@{#1}
|
||||
\fi
|
||||
}%
|
||||
|
||||
|
||||
\def\pgfplots@markers@check@for@default@plot@mark{%
|
||||
% make sure there is a mark set!
|
||||
\pgfplots@gettikzinternal@keyval{mark}{tikz@plot@mark}{}%
|
||||
\def\pgfplots@loc@TMPa{none}%
|
||||
\ifx\tikz@plot@mark\pgfplots@loc@TMPa
|
||||
% this here happens only in older versions of pgf.
|
||||
\let\tikz@plot@mark\pgfutil@empty
|
||||
\fi
|
||||
\ifx\tikz@plot@mark\pgfutil@empty
|
||||
\pgfplots@getcurrent@plothandler\pgfplots@basiclevel@plothandler
|
||||
\ifx\pgfplots@basiclevel@plothandler\pgfplothandlerdiscard
|
||||
% oh, the "only marks" plot handler-- and no plot mark!?
|
||||
% what's that!?
|
||||
\ifpgfplots@scatterplotenabled
|
||||
% scatter handles this in /pgfplots/scatter/true
|
||||
% automatically.
|
||||
\else
|
||||
% that appears to be nonsense...
|
||||
\def\tikz@plot@mark{*}%
|
||||
\fi
|
||||
\fi
|
||||
\fi
|
||||
}%
|
||||
|
||||
|
||||
% Used inside of /pgfplots/scatter/classes :
|
||||
\def\pgfplots@scatter@classes@pre@marker@code{%
|
||||
\pgfutil@ifundefined{pgfp@scatter@class@\pgfplotspointmeta}{%
|
||||
\let\pgfplots@loc@TMPa=\pgfplotspointmeta
|
||||
%
|
||||
% ups - no styles available? Maybe something went
|
||||
% wrong with the 'scatter src' key. Check whether it
|
||||
% was accidentally a numerical style:
|
||||
\if1\csname pgfpmeta@\pgfplotspointmetainputhandler @issymbolic\endcsname
|
||||
\else
|
||||
% ok, be fault tolerant and round to an integer:
|
||||
\pgfplotscoordmath{meta}{tofixed}{\pgfplotspointmeta}%
|
||||
\begingroup
|
||||
\pgfkeys{/pgf/number format/precision=0}%
|
||||
\expandafter\pgfmathroundto\expandafter{\pgfmathresult}%
|
||||
\pgfmath@smuggleone\pgfmathresult
|
||||
\endgroup
|
||||
\let\pgfplotspointmeta=\pgfmathresult
|
||||
\fi
|
||||
% now, check again:
|
||||
\pgfutil@ifundefined{pgfp@scatter@class@\pgfplotspointmeta}{%
|
||||
% still not possible? Then, try truncating the
|
||||
% number to an integer.
|
||||
\expandafter\pgfutil@in@\expandafter.\expandafter{\pgfplotspointmeta}%
|
||||
\ifpgfutil@in@
|
||||
\def\pgfplots@loc@TMPb##1.##2\relax{\def\pgfplotspointmeta{##1}}%
|
||||
\expandafter\pgfplots@loc@TMPb\pgfplots@loc@TMPa\relax
|
||||
\fi
|
||||
% now, check again:
|
||||
\pgfutil@ifundefined{pgfp@scatter@class@\pgfplotspointmeta}{%
|
||||
\pgfutil@ifundefined{pgfp@scatter@WARNING@\pgfplotspointmeta}{%
|
||||
\pgfplotswarning{scatter classes no such class}\pgfplotspointmeta\pgfeov%
|
||||
\expandafter\gdef\csname pgfp@scatter@WARNING@\pgfplotspointmeta\endcsname{ALREADY CHECKED}%
|
||||
}{}%
|
||||
\def\pgfplots@loc@TMPa{}%
|
||||
}{%
|
||||
\expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfp@scatter@class@\pgfplotspointmeta\endcsname
|
||||
}%
|
||||
}{%
|
||||
\expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfp@scatter@class@\pgfplotspointmeta\endcsname
|
||||
}%
|
||||
}{%
|
||||
\expandafter\let\expandafter\pgfplots@loc@TMPa\csname pgfp@scatter@class@\pgfplotspointmeta\endcsname
|
||||
}%
|
||||
\expandafter\scope\expandafter[\pgfplots@loc@TMPa]%
|
||||
}%
|
||||
|
||||
% validates 'mark layer' such that it can be queried afterwards.
|
||||
\def\pgfplots@markers@prepare@layered@graphics@marks{%
|
||||
\ifpgfplots@layered@graphics
|
||||
\pgfkeysgetvalue{/pgfplots/mark layer}\pgfplots@loc@TMPa
|
||||
\edef\pgfplots@loc@TMPa{\pgfplots@loc@TMPa}%
|
||||
\ifx\pgfplots@loc@TMPa\pgfutil@empty
|
||||
\def\pgfplots@loc@TMPa{auto}%
|
||||
\fi
|
||||
\def\pgfplots@loc@TMPb{auto}%
|
||||
\ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
|
||||
% COMBINATION: 'activate layers,mark layer=auto' --> keep
|
||||
% backwards compatibility with 'clip marker paths'
|
||||
% -> nothing to do.
|
||||
\pgfkeyslet{/pgfplots/mark layer}\pgfutil@empty%
|
||||
\else
|
||||
% mark layer=like plot
|
||||
\def\pgfplots@loc@TMPb{like plot}%
|
||||
\ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
|
||||
% draw markers together with their plot (no matter
|
||||
% on which layer):
|
||||
\pgfplots@clip@marker@pathstrue
|
||||
\pgfkeyslet{/pgfplots/mark layer}\pgfutil@empty%
|
||||
\else
|
||||
\edef\pgfplots@loc@TMPb{\pgfkeysvalueof{/pgfplots/on layer}}%
|
||||
\ifx\pgfplots@loc@TMPa\pgfplots@loc@TMPb
|
||||
% nothing to do; they are on the same layer
|
||||
% anyway: (this is the same as 'like plot'
|
||||
\pgfplots@clip@marker@pathstrue
|
||||
\pgfkeyslet{/pgfplots/mark layer}\pgfutil@empty%
|
||||
\else
|
||||
% OK, marks will be plotted on their own layer.
|
||||
\fi
|
||||
\fi
|
||||
\fi
|
||||
\else
|
||||
% reset its value:
|
||||
\pgfkeyslet{/pgfplots/mark layer}\pgfutil@empty%
|
||||
\fi
|
||||
}%
|
||||
|
71
texmf/tex/latex/pgfplots/tex/pgfplots.paths.code.tex
Normal file
71
texmf/tex/latex/pgfplots/tex/pgfplots.paths.code.tex
Normal file
|
@ -0,0 +1,71 @@
|
|||
%--------------------------------------------
|
||||
%
|
||||
% Package pgfplots
|
||||
%
|
||||
% 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-2012 by Christian Feuersänger.
|
||||
%
|
||||
% This program is free software: you can redistribute it and/or modify
|
||||
% 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/>.
|
||||
%
|
||||
%--------------------------------------------
|
||||
%
|
||||
|
||||
\newif\ifpgfplots@path@replace@ellipse
|
||||
|
||||
\def\pgfplots@install@path@replacements{%
|
||||
\ifpgfplots@path@replace@ellipse
|
||||
\let\tikz@do@circle=\pgfplots@path@@tikz@do@circle
|
||||
\expandafter\def\expandafter\pgfinterruptpicture\expandafter{\pgfinterruptpicture
|
||||
\let\tikz@do@circle=\pgfplots@path@@tikz@do@circle@orig
|
||||
}%
|
||||
\fi
|
||||
}%
|
||||
|
||||
\let\pgfplots@path@@tikz@do@circle@orig=\tikz@do@circle
|
||||
|
||||
% This is a replacement for \tikz@do@circle which replaces the "xy"
|
||||
% coordinate system by one which is compatible with pgfplots.
|
||||
\def\pgfplots@path@@tikz@do@circle#1#2{%
|
||||
\begingroup
|
||||
\ifpgfplots@usefpu
|
||||
\pgfkeys{/pgf/fpu,/pgf/fpu/output format=fixed}%
|
||||
\fi
|
||||
\pgfmathparse{#1}%
|
||||
\let\tikz@ellipse@x=\pgfmathresult%
|
||||
\ifpgfmathunitsdeclared%
|
||||
\pgfmathparse{#2}%
|
||||
\let\tikz@ellipse@y=\pgfmathresult%
|
||||
\ifpgfmathunitsdeclared%
|
||||
\pgfpathellipse{\pgfpointorigin}{%
|
||||
\pgfqpoint{\tikz@ellipse@x pt}{0pt}}{\pgfpoint{0pt}{\tikz@ellipse@y pt}}%
|
||||
\else%
|
||||
\PackageError{tikz}{You cannot mix dimensions and dimensionless values in an ellipse}{}%
|
||||
\fi%
|
||||
\else%
|
||||
\pgfmathparse{#2}%
|
||||
\let\tikz@ellipse@y=\pgfmathresult%
|
||||
\ifpgfmathunitsdeclared%
|
||||
\PackageError{tikz}{You cannot mix dimensions and dimensionless values in an ellipse}{}%
|
||||
\else%
|
||||
\pgfpathellipse{\pgfpointorigin}
|
||||
{\pgfplotspointaxisdirectionxy{\tikz@ellipse@x}{0}}
|
||||
{\pgfplotspointaxisdirectionxy{0}{\tikz@ellipse@y}}%
|
||||
\fi%
|
||||
\fi%
|
||||
\endgroup
|
||||
}
|
15
texmf/tex/latex/pgfplots/tex/pgfplots.revision.tex
Normal file
15
texmf/tex/latex/pgfplots/tex/pgfplots.revision.tex
Normal file
|
@ -0,0 +1,15 @@
|
|||
\begingroup
|
||||
\catcode`\-=12
|
||||
\catcode`\/=12
|
||||
\catcode`\.=12
|
||||
\catcode`\:=12
|
||||
\catcode`\+=12
|
||||
\catcode`\-=12
|
||||
\gdef\pgfplotsrevision{1.11-3-g4c99d7a}
|
||||
\gdef\pgfplotsversion{1.11}
|
||||
\gdef\pgfplotsversiondatetime{2014-08-04 12:47:48 +0200}
|
||||
\gdef\pgfplotsrevisiondatetime{2014-08-06 16:56:04 +0200}
|
||||
\gdef\pgfplots@glob@TMPa#1-#2-#3 #4\relax{#1/#2/#3}
|
||||
\xdef\pgfplotsversiondate{\expandafter\pgfplots@glob@TMPa\pgfplotsversiondatetime\relax}
|
||||
\xdef\pgfplotsrevisiondate{\expandafter\pgfplots@glob@TMPa\pgfplotsrevisiondatetime\relax}
|
||||
\endgroup
|
3389
texmf/tex/latex/pgfplots/tex/pgfplots.scaling.code.tex
Normal file
3389
texmf/tex/latex/pgfplots/tex/pgfplots.scaling.code.tex
Normal file
File diff suppressed because it is too large
Load diff
106
texmf/tex/latex/pgfplots/tex/pgfplots.sty
Normal file
106
texmf/tex/latex/pgfplots/tex/pgfplots.sty
Normal file
|
@ -0,0 +1,106 @@
|
|||
%--------------------------------------------
|
||||
%
|
||||
% Package pgfplots.sty
|
||||
%
|
||||
% 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-2013 by Christian Feuersänger.
|
||||
%
|
||||
% This program is free software: you can redistribute it and/or modify
|
||||
% 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/>.
|
||||
%
|
||||
%--------------------------------------------
|
||||
\IfFileExists{pgfplots.revision.tex}{\input pgfplots.revision.tex } {%
|
||||
\def\pgfplotsrevision{0}%
|
||||
\def\pgfplotsversion{0.0}%
|
||||
\def\pgfplotsversiondatetime{2014-07-01 00:00:00 +100}%
|
||||
\def\pgfplotsrevisiondatetime{2014-07-01 00:00:00 +100}%
|
||||
\def\pgfplotsversiondate{2014/07/01}%
|
||||
\def\pgfplotsrevisiondate{2014/07/01}%
|
||||
}
|
||||
\ProvidesPackage{pgfplots}[\pgfplotsversiondate\space v\pgfplotsversion\space Data Visualization (\pgfplotsrevision)]
|
||||
|
||||
% ATTENTION:
|
||||
% you MAY need one of
|
||||
% \def\pgfsysdriver{pgfsys-dvipdfm.def}
|
||||
% \def\pgfsysdriver{pgfsys-pdftex.def}
|
||||
% \def\pgfsysdriver{pgfsys-dvips.def}
|
||||
%
|
||||
% BEFORE the first \usepackage{pgf}, \usepackage{tikz} or
|
||||
% \usepackage{pgfplots}.
|
||||
% Default is
|
||||
% 'dvips' for 'latex'
|
||||
% 'pdftex' for 'pdflatex'
|
||||
% -> dvipdfm needs special attention.
|
||||
|
||||
\RequirePackage{tikz}
|
||||
|
||||
\def\pgfplots@texdist@protect{\protect}%
|
||||
|
||||
\input pgfplots.code.tex
|
||||
|
||||
|
||||
% checks for xcolor configuration options and will override
|
||||
% mesh/colorspace explicit color output
|
||||
% and
|
||||
% colormap default colorspace
|
||||
% if needed.
|
||||
\def\pgfplots@check@global@colorspace@overrides{%
|
||||
% "bOverridesColorspace"
|
||||
\pgfplots@loc@tmpfalse
|
||||
\ifconvertcolorsD
|
||||
% xcolor converts at *definition* time:
|
||||
\pgfplots@loc@tmptrue
|
||||
\else
|
||||
\ifconvertcolorsU
|
||||
% xcolor converts at *usage* time:
|
||||
\pgfplots@loc@tmptrue
|
||||
\fi
|
||||
\fi
|
||||
%
|
||||
\ifpgfplots@loc@tmp
|
||||
\let\pgfplots@loc@TMPb=\pgfutil@empty%
|
||||
\ifx\XC@tgt@mod\pgfplots@XC@tgt@mod@rgb \def\pgfplots@loc@TMPb{rgb}\fi
|
||||
\ifx\XC@tgt@mod\pgfplots@XC@tgt@mod@RGB \def\pgfplots@loc@TMPb{rgb}\fi
|
||||
\ifx\XC@tgt@mod\pgfplots@XC@tgt@mod@cmyk\def\pgfplots@loc@TMPb{cmyk}\fi
|
||||
\ifx\XC@tgt@mod\pgfplots@XC@tgt@mod@cmy \def\pgfplots@loc@TMPb{cmyk}\fi
|
||||
\ifx\XC@tgt@mod\pgfplots@XC@tgt@mod@gray \def\pgfplots@loc@TMPb{gray}\fi
|
||||
\ifx\XC@tgt@mod\pgfplots@XC@tgt@mod@Gray \def\pgfplots@loc@TMPb{gray}\fi
|
||||
%
|
||||
\ifx\pgfplots@loc@TMPb\pgfutil@empty
|
||||
\else
|
||||
\edef\pgfplots@loc@TMPa{%
|
||||
mesh/colorspace explicit color output=\pgfplots@loc@TMPb,%
|
||||
colormap default colorspace=\pgfplots@loc@TMPb,%
|
||||
}%
|
||||
\pgfplots@log3{Overriding colorspace to \pgfplots@loc@TMPb\space due to xcolor configuration.}%
|
||||
\expandafter\pgfplotsset\expandafter{\pgfplots@loc@TMPa}%
|
||||
\fi
|
||||
\fi
|
||||
}%
|
||||
|
||||
\def\pgfplots@XC@tgt@mod@rgb#1{rgb}
|
||||
\def\pgfplots@XC@tgt@mod@RGB#1{rgb}
|
||||
\def\pgfplots@XC@tgt@mod@cmyk#1{cmyk}
|
||||
\def\pgfplots@XC@tgt@mod@cmy#1{cmy}
|
||||
\def\pgfplots@XC@tgt@mod@gray#1{gray}
|
||||
\def\pgfplots@XC@tgt@mod@Gray#1{gray}
|
||||
|
||||
\usetikzlibrary{plotmarks}
|
||||
|
||||
|
||||
|
||||
\endinput
|
49
texmf/tex/latex/pgfplots/tex/pgfplots.tex
Normal file
49
texmf/tex/latex/pgfplots/tex/pgfplots.tex
Normal file
|
@ -0,0 +1,49 @@
|
|||
%--------------------------------------------
|
||||
%
|
||||
% Package pgfplots
|
||||
%
|
||||
% 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 by Christian Feuersänger.
|
||||
%
|
||||
% This program is free software: you can redistribute it and/or modify
|
||||
% 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/>.
|
||||
%
|
||||
%--------------------------------------------
|
||||
% ATTENTION:
|
||||
% you MAY need one of
|
||||
% \def\pgfsysdriver{pgfsys-dvipdfm.def}
|
||||
% \def\pgfsysdriver{pgfsys-pdftex.def}
|
||||
% \def\pgfsysdriver{pgfsys-dvips.def}
|
||||
%
|
||||
% BEFORE the first \input pgf.tex, \input tikz.tex or
|
||||
% \input pgfplots.tex
|
||||
% Default is
|
||||
% 'dvips' for 'tex'
|
||||
% 'pdftex' for 'pdftex'
|
||||
% -> dvipdfm needs special attention.
|
||||
%
|
||||
\input tikz.tex%
|
||||
%
|
||||
\edef\pgfplotscatcode{\the\catcode`\@}%
|
||||
\catcode`\@=11
|
||||
%
|
||||
\input pgfplots.code.tex%
|
||||
\usetikzlibrary{plotmarks}%
|
||||
%
|
||||
\catcode`\@=\pgfplotscatcode
|
||||
%
|
||||
\endinput
|
669
texmf/tex/latex/pgfplots/tex/pgfplotsarray.code.tex
Normal file
669
texmf/tex/latex/pgfplots/tex/pgfplotsarray.code.tex
Normal file
|
@ -0,0 +1,669 @@
|
|||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%
|
||||
% This is a helper package with an elementary array datastructure,
|
||||
% featuring O(1) index access and O(N) creation, deletion, copy.
|
||||
%
|
||||
% The following macros are supplied:
|
||||
%
|
||||
% \pgfplotsarraynewempty
|
||||
% \pgfplotsarraynew
|
||||
% \pgfplotsarrayresize
|
||||
% \pgfplotsarraycopy
|
||||
% \pgfplotsarraypushback
|
||||
% \pgfplotsarraysize
|
||||
% \pgfplotsarrayselect
|
||||
% \pgfplotsarrayset
|
||||
% \pgfplotsarrayletentry
|
||||
% \pgfplotsarraycheckempty
|
||||
% \pgfplotsarrayforeach
|
||||
% \pgfplotsarraysort
|
||||
%
|
||||
% and a subset also for global arrays:
|
||||
% \pgfplotsarraynewemptyglobal
|
||||
% \pgfplotsarrayresizeglobal
|
||||
% \pgfplotsarraysetglobal
|
||||
% \pgfplotsarrayletentryglobal
|
||||
%
|
||||
% Copyright 2007/2008 by Christian Feuersänger.
|
||||
%
|
||||
% This program is free software: you can redistribute it and/or modify
|
||||
% 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/>.
|
||||
%
|
||||
%
|
||||
%
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
\newcount\c@pgfplotsarray@tmp
|
||||
\newif\ifpgfplotsarrayempty
|
||||
|
||||
% Creates a new, empty array.
|
||||
\def\pgfplotsarraynewempty#1{%
|
||||
\pgfplotsarray@@def{#1@size}{0}%
|
||||
}
|
||||
\def\pgfplotsarraynewemptyglobal#1{%
|
||||
\expandafter\gdef\csname\string#1@size\endcsname{0}%
|
||||
}
|
||||
|
||||
% resizes (truncates) array #1 to size #2
|
||||
%
|
||||
% the elements won't be initialised. Use 'set' for each element.
|
||||
\def\pgfplotsarrayresize#1#2{%
|
||||
\c@pgfplotsarray@tmp=#2
|
||||
\pgfplotsarray@@edef{#1@size}{\the\c@pgfplotsarray@tmp}%
|
||||
}
|
||||
\def\pgfplotsarrayresizeglobal#1#2{%
|
||||
\c@pgfplotsarray@tmp=#2
|
||||
\expandafter\xdef\csname\string#1@size\endcsname{\the\c@pgfplotsarray@tmp}%
|
||||
}
|
||||
|
||||
% Invokes code '#2' if the array named '#1' exists and '#3' if it does
|
||||
% not exist.
|
||||
\def\pgfplotsarrayifdefined#1#2#3{%
|
||||
\pgfutil@ifundefined{#1@size}{#3}{#2}%
|
||||
}%
|
||||
|
||||
% Creates a new array with an abirtrary number of elements.
|
||||
% Arguments:
|
||||
% #1: the array's name (a macro name)
|
||||
% #2: the elements in one of the following forms
|
||||
% a) a '\\' terminated list:
|
||||
% first\\second\\third\\ ...\\
|
||||
% like in tabular with one column. The final '\\' necessary!
|
||||
% b) a comma-separated list:
|
||||
% first,second,third,5,10,last
|
||||
% ATTENTION: arrays do not support the '...' syntax of tikz!
|
||||
%
|
||||
% Example:
|
||||
% \pgfplotsarraynew\fooarray{First Element\\Second Element\\Third Element\\}
|
||||
% \pgfplotsarraynew\fooarray{First Element,Second Element,Third Element}
|
||||
% \pgfplotsarraynew\fooarray{0,1,2,...,10}
|
||||
%
|
||||
%
|
||||
\long\def\pgfplotsarraynew#1#2{%
|
||||
\pgfplots@check@backwards@compatible@list@format #2\\\pgfplots@EOI
|
||||
\ifpgfplots@is@old@list@format
|
||||
\pgfplotsarraynew@backslash{#1}{#2}%
|
||||
\else
|
||||
\pgfplotsarraynew@commasep{#1}{#2}%
|
||||
\fi
|
||||
}
|
||||
|
||||
% #1 the array's name (a macro name
|
||||
% #2 a list created by \pgfplotslistnew
|
||||
\def\pgfplotsarrayfrompgfplotslist#1#2{%
|
||||
\pgfplotsarraynewempty#1%
|
||||
\pgfplotslistforeachungrouped#2\as\pgfplotsarray@TMPa{%
|
||||
\expandafter\pgfplotsarraypushback\expandafter{\pgfplotsarray@TMPa}\to#1%
|
||||
}%
|
||||
}%
|
||||
|
||||
\def\pgfplotsarraynew@backslash#1#2{%
|
||||
\pgfplotsarraynewempty{#1}%
|
||||
\long\def\pgfplotsarraynew@impl@rest{#2}%
|
||||
\pgfutil@loop
|
||||
\ifx\pgfplotsarraynew@impl@rest\pgfutil@empty
|
||||
\pgfplots@loop@CONTINUEfalse
|
||||
\else
|
||||
\pgfplots@loop@CONTINUEtrue
|
||||
\fi
|
||||
\ifpgfplots@loop@CONTINUE
|
||||
\expandafter\pgfplotsarraynew@impl\pgfplotsarraynew@impl@rest\toarray#1\relax
|
||||
\pgfutil@repeat
|
||||
}%
|
||||
|
||||
% converts a comma-separated list (PGF foreach) to my internal list
|
||||
% structure.
|
||||
\long\def\pgfplotsarraynew@commasep#1#2{%
|
||||
\pgfplotsarraynewempty{#1}%
|
||||
\pgfplotsutilforeachcommasep{#2}\as\pgfplotsarraynew@elem{%
|
||||
\expandafter\pgfplotsarraypushback\expandafter{\pgfplotsarraynew@elem}\to#1%
|
||||
}%
|
||||
}
|
||||
% helper macro for \pgfplotsarraynew
|
||||
\long\def\pgfplotsarraynew@impl#1\\#2\toarray#3{%
|
||||
\pgfplotsarraypushback#1\to#3\relax%
|
||||
\def\pgfplotsarraynew@impl@rest{#2}%
|
||||
}
|
||||
|
||||
|
||||
\def\pgfplotsarray@@let#1=#2{%
|
||||
\def\pgfplotsarray@TMP@@{\expandafter\let\csname\string#1\endcsname}%
|
||||
\expandafter\pgfplotsarray@TMP@@\csname\string#2\endcsname
|
||||
}%
|
||||
|
||||
\def\pgfplotsarray@@#1#2{%
|
||||
\expandafter#1\csname\string#2\endcsname
|
||||
}%
|
||||
\def\pgfplotsarray@@def#1{%
|
||||
\expandafter\def\csname\string#1\endcsname
|
||||
}%
|
||||
\def\pgfplotsarray@@edef#1{%
|
||||
\expandafter\edef\csname\string#1\endcsname
|
||||
}%
|
||||
|
||||
\def\pgfplotsarray@@getsizeto#1#2{%
|
||||
\pgfplotsarraysize{#1}\to\c@pgfplotsarray@tmp
|
||||
\edef#2{\the\c@pgfplotsarray@tmp}%
|
||||
}%
|
||||
|
||||
% Copies array #1 to array #2.
|
||||
\def\pgfplotsarraycopy#1\to#2{%
|
||||
\pgfplotsarray@@let{#2@size}={#1@size}%
|
||||
\pgfplotsarray@@getsizeto{#1}{\pgfplotsarray@TMP}%
|
||||
\c@pgfplotsarray@tmp=0
|
||||
\pgfutil@loop
|
||||
\ifnum\c@pgfplotsarray@tmp<\pgfplotsarray@TMP
|
||||
\pgfplotsarray@@let{#2@\the\c@pgfplotsarray@tmp}={#1@\the\c@pgfplotsarray@tmp}%
|
||||
\advance\c@pgfplotsarray@tmp by1
|
||||
\pgfutil@repeat
|
||||
}
|
||||
|
||||
|
||||
|
||||
% #1: the item to append
|
||||
% #2: the array as macro name
|
||||
% Example:
|
||||
% \pgfplotsarraypushback Next last element\to\fooarray
|
||||
\long\def\pgfplotsarraypushback#1\to#2{%
|
||||
\pgfplotsarraysize{#2}\to\c@pgfplotsarray@tmp
|
||||
\pgfplotsarray@@def{#2@\the\c@pgfplotsarray@tmp}{#1}%
|
||||
\advance\c@pgfplotsarray@tmp by1
|
||||
\pgfplotsarray@@edef{#2@size}{\the\c@pgfplotsarray@tmp}%
|
||||
}
|
||||
\long\def\pgfplotsarraypushbackglobal#1\to#2{%
|
||||
\pgfplotsarraysize{#2}\to\c@pgfplotsarray@tmp
|
||||
\pgfplotsarray@@\gdef{#2@\the\c@pgfplotsarray@tmp}{#1}%
|
||||
\advance\c@pgfplotsarray@tmp by1
|
||||
\pgfplotsarray@@\xdef{#2@size}{\the\c@pgfplotsarray@tmp}%
|
||||
}
|
||||
|
||||
\long\def\pgfplotsarraypushbackglobal#1\to#2{%
|
||||
\pgfplotsarraysize{#2}\to\c@pgfplotsarray@tmp
|
||||
\pgfplotsarray@@\gdef{#2@\the\c@pgfplotsarray@tmp}{#1}%
|
||||
\advance\c@pgfplotsarray@tmp by1
|
||||
\pgfplotsarray@@\xdef{#2@size}{\the\c@pgfplotsarray@tmp}%
|
||||
}
|
||||
|
||||
% Counts the number of elements in array #1, storing it into the count
|
||||
% register #2.
|
||||
% Example:
|
||||
% \pgfplotsarraysize\foo\to{\count0}%
|
||||
% \the\count0
|
||||
\long\def\pgfplotsarraysize#1\to#2{%
|
||||
#2=\csname\string#1@size\endcsname\relax
|
||||
}
|
||||
\long\def\pgfplotsarraysizetomacro#1\to#2{%
|
||||
\expandafter\let\expandafter#2\csname\string#1@size\endcsname
|
||||
}
|
||||
|
||||
% expands to the size of array #1.
|
||||
\def\pgfplotsarraysizeof#1{\csname\string#1@size\endcsname}%
|
||||
|
||||
|
||||
% Returns the #1th element of array #2 into macro #3
|
||||
% Arguments:
|
||||
% #1: a count 0,...,N-1 where N is the array size.
|
||||
% You may specify a number of a count.
|
||||
% #2: a array
|
||||
% #3: a macro name
|
||||
% Example:
|
||||
% Element 0:
|
||||
% \pgfplotsarrayselect0\of\foo\to\elem
|
||||
% \elem
|
||||
% Element \count1:
|
||||
% \pgfplotsarrayselect\count1\of\foo\to\elem
|
||||
\def\pgfplotsarrayselect#1\of#2\to#3{%
|
||||
\c@pgfplotsarray@tmp=#1\relax
|
||||
\expandafter\let\expandafter#3\csname\string#2@\the\c@pgfplotsarray@tmp\endcsname%
|
||||
\ifx#3\relax
|
||||
\pgfplotsthrow{no such element}{#1}{No such element: \string\pgfplotsarrayselect\the\c@pgfplotsarray@tmp\string\of{\string#2}}\pgfeov%
|
||||
\fi
|
||||
}
|
||||
|
||||
% Expands to the value at index #1 of array #2.
|
||||
% #1: a number (not a register)
|
||||
% #2: an array
|
||||
\def\pgfplotsarrayvalueofelem#1\of#2{\csname\string#2@#1\endcsname}%
|
||||
|
||||
% Sets element '#1' of array '#2' to '#3'.
|
||||
\def\pgfplotsarrayset#1\of#2\to#3{%
|
||||
\c@pgfplotsarray@tmp=#1\relax
|
||||
\pgfutil@namedef{\string#2@\the\c@pgfplotsarray@tmp}{#3}%
|
||||
}
|
||||
\def\pgfplotsarraysetglobal#1\of#2\to#3{%
|
||||
\c@pgfplotsarray@tmp=#1\relax
|
||||
\expandafter\gdef\csname\string#2@\the\c@pgfplotsarray@tmp\endcsname{#3}%
|
||||
}
|
||||
\long\def\pgfplotsarrayletentry#1\of#2=#3{%
|
||||
\c@pgfplotsarray@tmp=#1\relax
|
||||
\expandafter\let\csname\string#2@\the\c@pgfplotsarray@tmp\endcsname=#3\relax
|
||||
}
|
||||
\long\def\pgfplotsarrayletentryglobal#1\of#2=#3{%
|
||||
\c@pgfplotsarray@tmp=#1\relax
|
||||
\expandafter\global\expandafter\let\csname\string#2@\the\c@pgfplotsarray@tmp\endcsname=#3\relax
|
||||
}
|
||||
|
||||
% Defines \pgfplotsretval to be a text-representation of the array.
|
||||
% It will contain \t to separate cells.
|
||||
%
|
||||
\def\pgfplotsarraytotext#1{%
|
||||
\begingroup
|
||||
\pgfplotsapplistXnewempty\pgfplotsretval@
|
||||
\pgfplotsarrayforeachungrouped#1\as\entry{%
|
||||
\pgfmathfloatparsenumber\entry
|
||||
\pgfmathfloattosci\pgfmathresult
|
||||
\edef\entry{\pgfmathresult\noexpand\t}%
|
||||
\expandafter\pgfplotsapplistXpushback\entry\to\pgfplotsretval@
|
||||
}%
|
||||
\pgfplotsapplistXlet\pgfplotsretval=\pgfplotsretval@
|
||||
\pgfmath@smuggleone\pgfplotsretval
|
||||
\endgroup
|
||||
}
|
||||
|
||||
% Sets the boolean \ifpgfplotsarrayempty depending on whether array #1 is empty
|
||||
% or not.
|
||||
% Example:
|
||||
%
|
||||
% \pgfplotsarraycheckempty\fooarray
|
||||
% \ifpgfplotsarrayempty
|
||||
% List fooarray is empty!
|
||||
% \else
|
||||
% List is not empty.
|
||||
% \fi
|
||||
\def\pgfplotsarraycheckempty#1{%
|
||||
\ifnum\csname\string#1@size\endcsname=0
|
||||
\pgfplotsarrayemptytrue
|
||||
\else
|
||||
\pgfplotsarrayemptyfalse
|
||||
\fi
|
||||
}
|
||||
|
||||
|
||||
% Iterates through each array element, names it #2 and calls code #3.
|
||||
% Example:
|
||||
% \pgfplotsarraynew\fooarray{Eins\\Zwei\\Drei\\}%
|
||||
% \pgfplotsarrayforeach\fooarray\as\foo{Element \foo\par}%
|
||||
% results in
|
||||
% Element Eins
|
||||
% Element Zwei
|
||||
% Element Drei
|
||||
% Each single element will be grouped with TeX groups.
|
||||
%
|
||||
% During the loop, \pgfplotsarrayforeachindex expands to the current index.
|
||||
\long\def\pgfplotsarrayforeach#1\as#2#3{%
|
||||
\pgfplotsarray@@getsizeto{#1}{\pgfplotsarray@TMP}%
|
||||
\c@pgfplotsarray@tmp=0\relax
|
||||
\def\pgfplotsarrayforeachindex{\the\c@pgfplotsarray@tmp}%
|
||||
\long\def\pgfplotsarray@TMPb{#3}%
|
||||
\pgfutil@loop
|
||||
\ifnum\c@pgfplotsarray@tmp<\pgfplotsarray@TMP\relax
|
||||
\begingroup
|
||||
\expandafter\let\expandafter#2\expandafter=\csname\string#1@\the\c@pgfplotsarray@tmp\endcsname%
|
||||
\pgfplotsarray@TMPb
|
||||
\endgroup
|
||||
\advance\c@pgfplotsarray@tmp by1
|
||||
\pgfutil@repeat
|
||||
\let\pgfplotsarrayforeachindex=\relax%
|
||||
}
|
||||
|
||||
% The same but without groups around #3.
|
||||
\long\def\pgfplotsarrayforeachungrouped#1\as#2#3{%
|
||||
\pgfplotsarray@@getsizeto{#1}{\pgfplotsarray@TMP}%
|
||||
\c@pgfplotsarray@tmp=0\relax
|
||||
\def\pgfplotsarrayforeachindex{\the\c@pgfplotsarray@tmp}%
|
||||
\pgfutil@loop
|
||||
\ifnum\c@pgfplotsarray@tmp<\pgfplotsarray@TMP\relax
|
||||
\expandafter\let\expandafter#2\expandafter=\csname\string#1@\the\c@pgfplotsarray@tmp\endcsname%
|
||||
\begingroup
|
||||
\toks0={#3}%
|
||||
\xdef\pgfplotsarray@glob@TMP{%
|
||||
\the\toks0 %
|
||||
% restore loop state:
|
||||
\c@pgfplotsarray@tmp=\the\c@pgfplotsarray@tmp\space
|
||||
\noexpand\def\noexpand\pgfplotsarray@TMP{\pgfplotsarray@TMP}%
|
||||
}%
|
||||
\endgroup
|
||||
\pgfplotsarray@glob@TMP
|
||||
\advance\c@pgfplotsarray@tmp by1
|
||||
\pgfutil@repeat
|
||||
\let\pgfplotsarrayforeachindex=\relax%
|
||||
}
|
||||
|
||||
\long\def\pgfplotsarrayforeachreversed#1\as#2#3{%
|
||||
\pgfplotsarray@@getsizeto{#1}{\pgfplotsarray@TMP}%
|
||||
\c@pgfplotsarray@tmp=\pgfplotsarray@TMP\relax
|
||||
\def\pgfplotsarrayforeachindex{\the\c@pgfplotsarray@tmp}%
|
||||
\long\def\pgfplotsarray@TMPb{#3}%
|
||||
\pgfutil@loop
|
||||
\ifnum\c@pgfplotsarray@tmp>0 %
|
||||
\advance\c@pgfplotsarray@tmp by-1
|
||||
\begingroup
|
||||
\expandafter\let\expandafter#2\expandafter=\csname\string#1@\the\c@pgfplotsarray@tmp\endcsname%
|
||||
\pgfplotsarray@TMPb
|
||||
\endgroup
|
||||
\pgfutil@repeat
|
||||
\let\pgfplotsarrayforeachindex=\relax%
|
||||
}
|
||||
|
||||
\long\def\pgfplotsarrayforeachreversedungrouped#1\as#2#3{%
|
||||
\pgfplotsarray@@getsizeto{#1}{\pgfplotsarray@TMP}%
|
||||
\c@pgfplotsarray@tmp=\pgfplotsarray@TMP\relax
|
||||
\def\pgfplotsarrayforeachindex{\the\c@pgfplotsarray@tmp}%
|
||||
\long\def\pgfplotsarray@TMPb{#3}%
|
||||
\pgfutil@loop
|
||||
\ifnum\c@pgfplotsarray@tmp>0 %
|
||||
\advance\c@pgfplotsarray@tmp by-1
|
||||
\expandafter\let\expandafter#2\expandafter=\csname\string#1@\the\c@pgfplotsarray@tmp\endcsname%
|
||||
\pgfplotsarray@TMPb
|
||||
\pgfutil@repeat
|
||||
\let\pgfplotsarrayforeachindex=\relax%
|
||||
}
|
||||
|
||||
\pgfkeys{%
|
||||
/pgfplots/array/unscope pre/.code={%
|
||||
% That's more or less efficient (although some runtime factors
|
||||
% could be saved).
|
||||
\c@pgfplotsarraysort@i=0
|
||||
\c@pgfplotsarray@tmp=\pgfplotsarraysizeof{#1}\relax
|
||||
\pgfutil@loop
|
||||
\ifnum\c@pgfplotsarraysort@i<\c@pgfplotsarray@tmp
|
||||
\pgfplotsarrayselect{\c@pgfplotsarraysort@i}\of{#1}\to\pgfplots@loc@TMPa
|
||||
\pgfplotsarrayletentryglobal\c@pgfplotsarraysort@i\of{pgfparraytmp}=\pgfplots@loc@TMPa
|
||||
\advance\c@pgfplotsarraysort@i by1
|
||||
\pgfutil@repeat
|
||||
},%
|
||||
/pgfplots/array/unscope post/.code={%
|
||||
% copy from global temp -> #1
|
||||
\c@pgfplotsarray@tmp=0
|
||||
\pgfplotsarraysizetomacro{#1}\to\pgfplots@loc@TMPb
|
||||
\pgfutil@loop
|
||||
\ifnum\c@pgfplotsarray@tmp<\pgfplots@loc@TMPb
|
||||
\pgfplotsarrayselect{\c@pgfplotsarray@tmp}\of{pgfparraytmp}\to\pgfplots@loc@TMPa
|
||||
\pgfplotsarrayletentry\c@pgfplotsarray@tmp\of{#1}=\pgfplots@loc@TMPa
|
||||
\advance\c@pgfplotsarray@tmp by1
|
||||
\pgfutil@repeat
|
||||
},%
|
||||
}%
|
||||
|
||||
% Sorts array '#1' using N log N time.
|
||||
%
|
||||
% The sort key is provided as argument in
|
||||
% /pgfplots/iflessthan/.code args={#1#2#3#4}, see docs in
|
||||
% pgfplotsutil.code.tex.
|
||||
%
|
||||
% Remarks:
|
||||
% - the sorting algorithm is a sub-optimal mergesort currently -
|
||||
% but it has runtime N log N.
|
||||
% - As usual, it is very difficult to move the final result out of the
|
||||
% current scope. The initial configuration allocates a *global* copy of #1
|
||||
% to carry results out of one TeX group. This means that memory will NEVER be freed.
|
||||
% I don't see a general N log N alternative for doing so (short of discarding
|
||||
% the scopes for local groups).
|
||||
% BUT:
|
||||
% you can redefine the code key pair
|
||||
% |/pgfplots/array/unscope pre|
|
||||
% and
|
||||
% |/pgfplots/array/unscope post|
|
||||
% to define your own routine which may benefit from special needs of
|
||||
% your application. The |... pre| command is invoked JUST before the
|
||||
% \endgroup and the |... post| JUST after the |\endgroup|.
|
||||
%
|
||||
%
|
||||
% EXAMPLE:
|
||||
%--------------------------------------------------
|
||||
% \pgfplotsarraynewempty\testarray
|
||||
% \pgfplotsarraypushback503\to\testarray
|
||||
% \pgfplotsarraypushback087\to\testarray
|
||||
% \pgfplotsarraypushback512\to\testarray
|
||||
% \pgfplotsarraypushback061\to\testarray
|
||||
% \pgfplotsarraypushback908\to\testarray
|
||||
% \pgfplotsarraypushback170\to\testarray
|
||||
% \pgfplotsarraypushback897\to\testarray
|
||||
% \pgfplotsarraypushback275\to\testarray
|
||||
% \pgfplotsarraypushback653\to\testarray
|
||||
% \pgfplotsarraypushback426\to\testarray
|
||||
% \pgfplotsarraypushback154\to\testarray
|
||||
% \pgfplotsarraypushback509\to\testarray
|
||||
% \pgfplotsarraypushback612\to\testarray
|
||||
% \pgfplotsarraypushback677\to\testarray
|
||||
% \pgfplotsarraypushback765\to\testarray
|
||||
% \pgfplotsarraypushback703\to\testarray
|
||||
%
|
||||
% Unsorted:
|
||||
%
|
||||
% [\pgfplotsarrayforeach\testarray\as\elem{\elem\space}]
|
||||
%
|
||||
% \pgfplotsarraysort\testarray
|
||||
%
|
||||
% sorted:
|
||||
%
|
||||
% [\pgfplotsarrayforeach\testarray\as\elem{\elem\space}]
|
||||
%
|
||||
%--------------------------------------------------
|
||||
%
|
||||
% @see \pgfplotsutilsortthree
|
||||
% @see \pgfplotsutilsortfour
|
||||
\def\pgfplotsarraysort{%
|
||||
\pgfutil@ifnextchar[{\pgfplotsarraysort@opt}{\pgfplotsarraysort@opt[]}%
|
||||
}%
|
||||
\def\pgfplotsarraysort@opt[#1]#2{%
|
||||
% I admit, the implementation is more-or less copy-paste of an
|
||||
% experiment I had done at university. It does its job, but it is
|
||||
% certainly not optimal (that means: it is slow).
|
||||
\begingroup
|
||||
\pgfqkeys{/pgfplots/array}{#1}%
|
||||
\pgfkeysifdefined{/pgfplots/array/iflessthan/.@cmd}{%
|
||||
\pgfplots@warning{Warning: /pgfplots/array/iflessthan/.@cmd is deprecated. Please use /pgfplots/iflessthan/.@cmd instead.}%
|
||||
\pgfkeysgetvalue{/pgfplots/array/iflessthan/.@cmd}\pgfplotsarraysort@iflt
|
||||
}{%
|
||||
\pgfkeysgetvalue{/pgfplots/iflessthan/.@cmd}\pgfplotsarraysort@iflt
|
||||
}%
|
||||
\pgfplotsarraysize{#2}\to\c@pgfplotsarray@tmp
|
||||
\pgfplotsarrayresizeglobal{pgfparraytmp}{\the\c@pgfplotsarray@tmp}%
|
||||
\countdef\c@pgfplotsarraysort@m=0
|
||||
\countdef\c@pgfplotsarraysort@k=1
|
||||
\countdef\c@pgfplotsarraysort@i=2
|
||||
\countdef\c@pgfplotsarraysort@l=3
|
||||
\countdef\c@pgfplotsarraysort@j=4
|
||||
\countdef\c@pgfplotsarraysort@q=5
|
||||
\def\pgfplotsarray@mergesort@{\pgfplotsarray@mergesort{#2}}%
|
||||
\def\pgfplotsarray@mergesort@recurse@{\pgfplotsarray@mergesort@recurse{#2}}%
|
||||
\edef\pgfplotsarray@mergesort@@{{0}{\the\c@pgfplotsarray@tmp}}%
|
||||
\expandafter\pgfplotsarray@mergesort@\pgfplotsarray@mergesort@@
|
||||
%
|
||||
% copy the complete, sorted result outside of the current scope.
|
||||
\pgfkeysvalueof{/pgfplots/array/unscope pre/.@cmd}#2\pgfeov
|
||||
\endgroup
|
||||
\pgfkeysvalueof{/pgfplots/array/unscope post/.@cmd}#2\pgfeov
|
||||
}%
|
||||
|
||||
% #1: array name,
|
||||
% #2: start offset (as string number)
|
||||
% #3: number of elems (as string number)
|
||||
\def\pgfplotsarray@mergesort#1#2#3{%
|
||||
\ifnum#3<2
|
||||
% ready!
|
||||
\else
|
||||
\c@pgfplotsarraysort@m=#3\relax
|
||||
\divide\c@pgfplotsarraysort@m by2
|
||||
\c@pgfplotsarraysort@q=#3\relax
|
||||
\advance\c@pgfplotsarraysort@q by-\c@pgfplotsarraysort@m
|
||||
\c@pgfplotsarraysort@i=\c@pgfplotsarraysort@m
|
||||
\advance\c@pgfplotsarraysort@i by#2\relax
|
||||
\edef\pgfplotsarray@mergesort@@{%
|
||||
{#2}{\the\c@pgfplotsarraysort@m}% start1, N_1
|
||||
{\the\c@pgfplotsarraysort@i}{\the\c@pgfplotsarraysort@q}% start2, N_2
|
||||
}%
|
||||
\expandafter\pgfplotsarray@mergesort@recurse@\pgfplotsarray@mergesort@@
|
||||
%
|
||||
% Merge:
|
||||
% restore 'm':
|
||||
\c@pgfplotsarraysort@m=#3\relax
|
||||
\divide\c@pgfplotsarraysort@m by2
|
||||
\c@pgfplotsarraysort@q=#3
|
||||
\advance\c@pgfplotsarraysort@q by-\c@pgfplotsarraysort@m
|
||||
\c@pgfplotsarraysort@k=0
|
||||
\c@pgfplotsarraysort@l=0
|
||||
\c@pgfplotsarraysort@i=0
|
||||
%
|
||||
% direct comparisons for merge:
|
||||
\pgfutil@loop
|
||||
\pgfplots@loop@CONTINUEtrue
|
||||
\ifnum\c@pgfplotsarraysort@k<\c@pgfplotsarraysort@m
|
||||
\ifnum\c@pgfplotsarraysort@l<\c@pgfplotsarraysort@q
|
||||
\else
|
||||
\pgfplots@loop@CONTINUEfalse
|
||||
\fi
|
||||
\else
|
||||
\pgfplots@loop@CONTINUEfalse
|
||||
\fi
|
||||
\ifpgfplots@loop@CONTINUE
|
||||
\c@pgfplotsarraysort@j=\c@pgfplotsarraysort@m
|
||||
\advance\c@pgfplotsarraysort@j by\c@pgfplotsarraysort@l
|
||||
\advance\c@pgfplotsarraysort@j by#2
|
||||
\pgfplotsarrayselect{\c@pgfplotsarraysort@j}\of{#1}\to\pgfplotsarray@x@mpl
|
||||
\c@pgfplotsarraysort@j=\c@pgfplotsarraysort@k
|
||||
\advance\c@pgfplotsarraysort@j by#2
|
||||
\pgfplotsarrayselect{\c@pgfplotsarraysort@j}\of{#1}\to\pgfplotsarray@x@k
|
||||
\begingroup
|
||||
\pgfplotsarraysort@iflt
|
||||
{\pgfplotsarray@x@mpl}%
|
||||
{\pgfplotsarray@x@k}%
|
||||
{% x[m+l] < x[k]
|
||||
\aftergroup\pgfplots@loc@tmptrue
|
||||
}%
|
||||
{% x[k] <= x[m+l]
|
||||
\aftergroup\pgfplots@loc@tmpfalse
|
||||
}%
|
||||
\pgfeov
|
||||
\endgroup
|
||||
\ifpgfplots@loc@tmp
|
||||
\pgfplotsarrayletentryglobal\c@pgfplotsarraysort@i\of{pgfparraytmp}=\pgfplotsarray@x@mpl
|
||||
\advance\c@pgfplotsarraysort@i by1
|
||||
\advance\c@pgfplotsarraysort@l by1
|
||||
\else
|
||||
\pgfplotsarrayletentryglobal\c@pgfplotsarraysort@i\of{pgfparraytmp}=\pgfplotsarray@x@k
|
||||
\advance\c@pgfplotsarraysort@i by1
|
||||
\advance\c@pgfplotsarraysort@k by1
|
||||
\fi
|
||||
\pgfutil@repeat
|
||||
%
|
||||
% append:
|
||||
\pgfutil@loop
|
||||
\ifnum\c@pgfplotsarraysort@k<\c@pgfplotsarraysort@m
|
||||
\c@pgfplotsarraysort@j=\c@pgfplotsarraysort@k
|
||||
\advance\c@pgfplotsarraysort@j by#2
|
||||
\pgfplotsarrayselect{\c@pgfplotsarraysort@j}\of{#1}\to\pgfplots@loc@TMPa
|
||||
\pgfplotsarrayletentryglobal\c@pgfplotsarraysort@i\of{pgfparraytmp}=\pgfplots@loc@TMPa
|
||||
\advance\c@pgfplotsarraysort@i by1
|
||||
\advance\c@pgfplotsarraysort@k by1
|
||||
\pgfutil@repeat
|
||||
\pgfutil@loop
|
||||
\ifnum\c@pgfplotsarraysort@l<\c@pgfplotsarraysort@q
|
||||
\c@pgfplotsarraysort@j=\c@pgfplotsarraysort@m
|
||||
\advance\c@pgfplotsarraysort@j by\c@pgfplotsarraysort@l
|
||||
\advance\c@pgfplotsarraysort@j by#2
|
||||
\pgfplotsarrayselect{\c@pgfplotsarraysort@j}\of{#1}\to\pgfplots@loc@TMPa
|
||||
\pgfplotsarrayletentryglobal\c@pgfplotsarraysort@i\of{pgfparraytmp}=\pgfplots@loc@TMPa
|
||||
\advance\c@pgfplotsarraysort@i by1
|
||||
\advance\c@pgfplotsarraysort@l by1
|
||||
\pgfutil@repeat
|
||||
%
|
||||
% copy back from temporary to '#1'
|
||||
\c@pgfplotsarraysort@i=0
|
||||
\c@pgfplotsarraysort@k=#3
|
||||
\pgfutil@loop
|
||||
\ifnum\c@pgfplotsarraysort@i<\c@pgfplotsarraysort@k
|
||||
\c@pgfplotsarraysort@j=\c@pgfplotsarraysort@i
|
||||
\advance\c@pgfplotsarraysort@j by#2
|
||||
\pgfplotsarrayselect{\c@pgfplotsarraysort@i}\of{pgfparraytmp}\to\pgfplots@loc@TMPa
|
||||
\pgfplotsarrayletentry\c@pgfplotsarraysort@j\of{#1}=\pgfplots@loc@TMPa
|
||||
\advance\c@pgfplotsarraysort@i by1
|
||||
\pgfutil@repeat
|
||||
%\pgfplotsarraysort@DEBUGTEST{#1}{after mergesort(start=#2,n=#3):}%
|
||||
\fi
|
||||
}%
|
||||
\long\def\pgfplotsarraysort@DEBUGTEST#1#2{%
|
||||
\par#2\par
|
||||
[\pgfplotsarrayforeach{#1}\as\elem{\elem\space}]\par%
|
||||
}
|
||||
% #1: array name
|
||||
% #2: start1
|
||||
% #3: N1
|
||||
% #4: start2
|
||||
% #5: N2
|
||||
\def\pgfplotsarray@mergesort@recurse#1#2#3#4#5{%
|
||||
\pgfplotsarray@mergesort{#1}{#2}{#3}%
|
||||
\pgfplotsarray@mergesort{#1}{#4}{#5}%
|
||||
}
|
||||
|
||||
|
||||
% A simple, ungrouped insert sort algorithm for small arrays.
|
||||
%
|
||||
% for i := 1; i < N; ++i do
|
||||
% begin
|
||||
% value := A[i];
|
||||
% j := i - 1;
|
||||
% done := false;
|
||||
% repeat
|
||||
% if A[j] > value then
|
||||
% begin
|
||||
% A[j + 1] := A[j];
|
||||
% j := j - 1;
|
||||
% if j < 0 then
|
||||
% done := true;
|
||||
% end
|
||||
% else
|
||||
% done := true;
|
||||
% until done;
|
||||
% A[j + 1] := value;
|
||||
% end;
|
||||
\def\pgfplotsarrayinsertionsort#1{%
|
||||
\pgfkeysgetvalue{/pgfplots/iflessthan/.@cmd}\pgfplotsarraysort@iflt
|
||||
\pgfplotsarraysizetomacro#1\to\pgfplotsarrayinsertionsort@N
|
||||
\c@pgf@countd=1
|
||||
\pgfplotsarrayinsertionsort@{#1}%
|
||||
}%
|
||||
\def\pgfplotsarrayinsertionsort@#1{%
|
||||
\ifnum\c@pgf@countd<\pgfplotsarrayinsertionsort@N\relax
|
||||
\pgfplotsarrayselect\c@pgf@countd\of#1\to\pgfplotsarrayinsertionsort@v
|
||||
%
|
||||
\c@pgf@countb=\c@pgf@countd
|
||||
\advance\c@pgf@countb by-1
|
||||
%
|
||||
\pgfplotsarrayinsertionsort@@{#1}%
|
||||
\advance\c@pgf@countb by1
|
||||
\pgfplotsarrayletentry\c@pgf@countb\of#1=\pgfplotsarrayinsertionsort@v
|
||||
%
|
||||
\advance\c@pgf@countd by1
|
||||
\expandafter\pgfplotsarrayinsertionsort@\expandafter#1%
|
||||
\fi
|
||||
}
|
||||
\def\pgfplotsarrayinsertionsort@@#1{%
|
||||
\pgfplotsarrayselect\c@pgf@countb\of#1\to\pgfplotsarrayinsertionsort@j
|
||||
\pgfplotsarraysort@iflt{\pgfplotsarrayinsertionsort@v}{\pgfplotsarrayinsertionsort@j}
|
||||
{%
|
||||
\advance\c@pgf@countb by1
|
||||
\pgfplotsarrayletentry\c@pgf@countb\of#1=\pgfplotsarrayinsertionsort@j
|
||||
\advance\c@pgf@countb by-2
|
||||
\ifnum\c@pgf@countb<0
|
||||
\let\pgfplotsarrayinsertionsort@@next\relax%
|
||||
\else
|
||||
\def\pgfplotsarrayinsertionsort@@next{\pgfplotsarrayinsertionsort@@#1}%
|
||||
\fi
|
||||
}{%
|
||||
\let\pgfplotsarrayinsertionsort@@next\relax%
|
||||
}\pgfeov%
|
||||
\pgfplotsarrayinsertionsort@@next
|
||||
}%
|
||||
|
603
texmf/tex/latex/pgfplots/tex/pgfplotsbinary.code.tex
Normal file
603
texmf/tex/latex/pgfplots/tex/pgfplotsbinary.code.tex
Normal file
|
@ -0,0 +1,603 @@
|
|||
%--------------------------------------------
|
||||
% $Header: /cvsroot/pgfplots/pgfplots/generic/pgfplots/util/pgfplotsbinary.code.tex,v 1.13 2009/07/21 18:18:48 ludewich Exp $
|
||||
%
|
||||
% Package pgfplots
|
||||
%
|
||||
% 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 by Christian Feuersänger.
|
||||
%
|
||||
% This program is free software: you can redistribute it and/or modify
|
||||
% 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 a self-contained package which does only need
|
||||
% pgfkeys.
|
||||
%
|
||||
% It provides a method to convert TeX numbers (integers and
|
||||
% dimensions) into binary format (macros with catcode 11 or 12).
|
||||
%
|
||||
|
||||
\edef\pgfplotsbinaryatcode{\the\catcode`\@ }
|
||||
\catcode`\@=11
|
||||
|
||||
|
||||
% Returns a single character, which has the
|
||||
% binary ASCII code '#1', with catcode 11.
|
||||
%
|
||||
% #1 (expands to) a number between 0 and 255 (inclusive).
|
||||
%
|
||||
% @see \pgfplotsgetchar Note that \pgfplotsgetchar is more powerful,
|
||||
% but can't be used inside of \edef (it is not expandable) whereas
|
||||
% \pgfplotscharno is.
|
||||
\def\pgfplotscharno#1{\csname pgfp@bin@#1\endcsname}%
|
||||
\let\pgfplotscharno@bincatcode=\pgfplotscharno
|
||||
|
||||
\def\pgfplotscharno@lualatex#1{#1,}
|
||||
|
||||
\input pgfplotsbinary.data.code.tex
|
||||
|
||||
% Defines the LUA (!) value pgfplotsretval to be a binary string
|
||||
% containing the pgfplots binary value #1.
|
||||
%
|
||||
% #1 a pgfplots binary value collected with \pgfplotscharno.
|
||||
% More precisely, it should be a comma-separated sequence of numbers
|
||||
% of the form '0,255,2,128,' (can be terminated by comma). It will be
|
||||
% converted to the respective binary numbers 0x0, 0xff, 0x02,..
|
||||
%
|
||||
% example:
|
||||
% \pgfplotsbinarytoluabinary{0, 255,2,128}
|
||||
% \directlua{
|
||||
% pdf.immediateobj{"stream", pgfplotsretval,"/DataWithBinaryStream"}
|
||||
% }
|
||||
\def\pgfplotsbinarytoluabinary#1{%
|
||||
% lualatex does not support binary chars as pdftex does - so we have to resort to LUA
|
||||
% methods. The idea is to use
|
||||
% string.char(1,2,3) which results in a binary string with chars 0x01, 0x02, 0x03 etc.
|
||||
% I only need to get the integer numbers. To this end, I patch \pgfplotscharno
|
||||
% and create the binary string here:
|
||||
\directlua{%
|
||||
pgfplotsretval = pgfplotsGetLuaBinaryStringFromCharIndices({#1});
|
||||
}%
|
||||
}%
|
||||
|
||||
% Defines \pgfplotsretval to be the ASCII character for #1, with
|
||||
% catcode 11.
|
||||
%
|
||||
% #1: either a number between 0 and 255 (inclusive) or a description
|
||||
% of the character.
|
||||
%
|
||||
% Examples:
|
||||
% \pgfplotsgetchar{35}
|
||||
% \pgfplotsgetchar{`\#} % code for '#'
|
||||
% \pgfplotsgetchar{`\^^M} % Newline
|
||||
% \pgfplotsgetchar{`\^^ff}% 255
|
||||
%
|
||||
% @see \pgfplotscharno
|
||||
\def\pgfplotsgetchar#1{%
|
||||
\begingroup
|
||||
\count0=#1\relax
|
||||
\edef\pgfplotsretval{\pgfplotscharno{\the\count0 }}%
|
||||
\pgfmath@smuggleone\pgfplotsretval
|
||||
\endgroup
|
||||
}%
|
||||
|
||||
\def\pgfplotsbinary@apphighorderbytes@BIGENDIAN#1{\xdef\pgfplotsbinaryresult{#1\pgfplotsbinaryresult}}%
|
||||
\def\pgfplotsbinary@apphighorderbytes@LITTLEENDIAN#1{\xdef\pgfplotsbinaryresult{\pgfplotsbinaryresult#1}}%
|
||||
|
||||
\def\pgfplotsbinaryencode@badic@unsigned@PAD@LITTLEENDIAN{%
|
||||
% pad with zeros:
|
||||
\ifcase\c@pgfplotsbin@byteno
|
||||
% ok.
|
||||
\or
|
||||
% one byte missing.
|
||||
\pgfplotsbinary@apphighorderbytes{\pgfplotsbinary@ZERO@HIGHEST}%
|
||||
\or
|
||||
% two bytes missing.
|
||||
\pgfplotsbinary@apphighorderbytes{\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO@HIGHEST}%
|
||||
\or
|
||||
\pgfplotsbinary@apphighorderbytes{\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO@HIGHEST}%
|
||||
\or
|
||||
\pgfplotsbinary@apphighorderbytes{\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO@HIGHEST}%
|
||||
\or
|
||||
\pgfplotsbinary@apphighorderbytes{\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO@HIGHEST}%
|
||||
\or
|
||||
\pgfplotsbinary@apphighorderbytes{\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO@HIGHEST}%
|
||||
\or
|
||||
\pgfplotsbinary@apphighorderbytes{\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO@HIGHEST}%
|
||||
\or
|
||||
\pgfplotsbinary@apphighorderbytes{\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO@HIGHEST}%
|
||||
\else
|
||||
\pgfplots@error{Sorry, I can't process byte no \the\c@pgfplotsbin@byteno... you may need to change bytes=\pgfplotsbinary@bytes.}%
|
||||
\fi
|
||||
}%
|
||||
\def\pgfplotsbinaryencode@badic@unsigned@PAD@BIGENDIAN{%
|
||||
% pad with zeros:
|
||||
\ifcase\c@pgfplotsbin@byteno
|
||||
% ok.
|
||||
\or
|
||||
% one byte missing.
|
||||
\pgfplotsbinary@apphighorderbytes{\pgfplotsbinary@ZERO@HIGHEST}%
|
||||
\or
|
||||
% two bytes missing.
|
||||
\pgfplotsbinary@apphighorderbytes{\pgfplotsbinary@ZERO@HIGHEST\pgfplotsbinary@ZERO}%
|
||||
\or
|
||||
\pgfplotsbinary@apphighorderbytes{\pgfplotsbinary@ZERO@HIGHEST\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO}%
|
||||
\or
|
||||
\pgfplotsbinary@apphighorderbytes{\pgfplotsbinary@ZERO@HIGHEST\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO}%
|
||||
\or
|
||||
\pgfplotsbinary@apphighorderbytes{\pgfplotsbinary@ZERO@HIGHEST\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO}%
|
||||
\or
|
||||
\pgfplotsbinary@apphighorderbytes{\pgfplotsbinary@ZERO@HIGHEST\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO}%
|
||||
\or
|
||||
\pgfplotsbinary@apphighorderbytes{\pgfplotsbinary@ZERO@HIGHEST\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO}%
|
||||
\or
|
||||
\pgfplotsbinary@apphighorderbytes{\pgfplotsbinary@ZERO@HIGHEST\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO}%
|
||||
\else
|
||||
\pgfplots@error{Sorry, I can't process byte no \the\c@pgfplotsbin@byteno... you may need to change bytes=\pgfplotsbinary@bytes.}%
|
||||
\fi
|
||||
}%
|
||||
|
||||
\expandafter\def\csname pgfplotsbinarysetbytes@1\endcsname{%
|
||||
\def\pgfplotsbinary@add@signed@largest@absolute{\advance\c@pgfplotsbin@input by 127 }%
|
||||
\def\pgfplotsbinaryencodesignedmaplinearly@prepare{%
|
||||
% warning: \pgfplotsbinary@bytes is NOT necessarily 1 (ASCII
|
||||
% encoding features)
|
||||
\c@pgfplotsbin@byteno=\pgfplotsbinary@bytes\relax
|
||||
\c@pgfplotsbin@basis=\pgfplotsbinary@basis\relax
|
||||
\divide\c@pgfplotsbin@input by16909320 % ~= (2^31-1) / (2^(8*1-1) -1)
|
||||
}%
|
||||
}%
|
||||
\expandafter\def\csname pgfplotsbinarysetbytes@2\endcsname{%
|
||||
\def\pgfplotsbinary@add@signed@largest@absolute{\advance\c@pgfplotsbin@input by 32767 }%
|
||||
\def\pgfplotsbinaryencodesignedmaplinearly@prepare{%
|
||||
\c@pgfplotsbin@byteno=\pgfplotsbinary@bytes\relax
|
||||
\c@pgfplotsbin@basis=\pgfplotsbinary@basis\relax
|
||||
\divide\c@pgfplotsbin@input by65538 % ~= (2^31-1) / (2^(8*2-1) -1)
|
||||
}%
|
||||
}%
|
||||
\expandafter\def\csname pgfplotsbinarysetbytes@3\endcsname{%
|
||||
\def\pgfplotsbinary@add@signed@largest@absolute{\advance\c@pgfplotsbin@input by 8388607 }%
|
||||
\def\pgfplotsbinaryencodesignedmaplinearly@prepare{%
|
||||
\c@pgfplotsbin@byteno=\pgfplotsbinary@bytes\relax
|
||||
\c@pgfplotsbin@basis=\pgfplotsbinary@basis\relax
|
||||
\divide\c@pgfplotsbin@input by256 % ~= (2^31-1) / (2^(8*3-1) -1)
|
||||
}%
|
||||
}%
|
||||
\expandafter\def\csname pgfplotsbinarysetbytes@4\endcsname{%
|
||||
\def\pgfplotsbinary@add@signed@largest@absolute{%
|
||||
\advance\c@pgfplotsbin@input by 2147483647 % this is the *absolute* largest int that TeX can handle.
|
||||
}%
|
||||
\def\pgfplotsbinaryencodesignedmaplinearly@prepare{%
|
||||
\c@pgfplotsbin@byteno=\pgfplotsbinary@bytes\relax
|
||||
\c@pgfplotsbin@basis=\pgfplotsbinary@basis\relax
|
||||
}%
|
||||
}%
|
||||
\def\pgfplotsbinarysetbytes@@{%
|
||||
\def\pgfplotsbinaryencodesignedmaplinearly@prepare{%
|
||||
\c@pgfplotsbin@byteno=\pgfplotsbinary@bytes\relax
|
||||
\c@pgfplotsbin@basis=\pgfplotsbinary@basis\relax
|
||||
\pgfplots@error{Sorry, but I can't perform \string\pgfplotsbinaryencodesignedmaplinearly\space for bytes=\pgfplotsbinary@bytes\space yet... bytes=4 is the maximum.}%
|
||||
}%
|
||||
\def\pgfplotsbinary@add@signed@largest@absolute{
|
||||
\advance\c@pgfplotsbin@input by 2147483647
|
||||
}%
|
||||
}%
|
||||
\expandafter\let\csname pgfplotsbinary@bytes@5\endcsname=\pgfplotsbinarysetbytes@@
|
||||
\expandafter\let\csname pgfplotsbinary@bytes@6\endcsname=\pgfplotsbinarysetbytes@@
|
||||
\expandafter\let\csname pgfplotsbinary@bytes@7\endcsname=\pgfplotsbinarysetbytes@@
|
||||
\expandafter\let\csname pgfplotsbinary@bytes@8\endcsname=\pgfplotsbinarysetbytes@@
|
||||
|
||||
\pgfqkeys{/pgfplots/bin}{%
|
||||
% ordering not yet implemented; uses always BIG ENDIAN.
|
||||
ordering/.is choice,%
|
||||
ordering/big endian/.code={%
|
||||
\def\pgfplotsbinary@byteorder{0}%
|
||||
\let\pgfplotsbinary@apphighorderbytes=\pgfplotsbinary@apphighorderbytes@BIGENDIAN
|
||||
\let\pgfplotsbinaryencode@badic@unsigned@PAD=\pgfplotsbinaryencode@badic@unsigned@PAD@BIGENDIAN
|
||||
},%
|
||||
ordering/net/.style={/pgfplots/bin/ordering/big endian},%
|
||||
ordering/little endian/.code={%
|
||||
\def\pgfplotsbinary@byteorder{1}%
|
||||
\let\pgfplotsbinary@apphighorderbytes=\pgfplotsbinary@apphighorderbytes@LITTLEENDIAN
|
||||
\let\pgfplotsbinaryencode@badic@unsigned@PAD=\pgfplotsbinaryencode@badic@unsigned@PAD@LITTLEENDIAN
|
||||
},
|
||||
ordering/big endian,%
|
||||
%
|
||||
% The standard method - it results in binary encoded numbers.
|
||||
binary encoding/.code={%
|
||||
\pgfutil@IfUndefined{directlua}{%
|
||||
\let\pgfplotscharno=\pgfplotscharno@bincatcode
|
||||
}{%
|
||||
% Ah - we use LuaTeX!
|
||||
% At the time of this writing, LUA does not allow binary output which has been
|
||||
% created by means of catcode modifications & TeX string concatenation.
|
||||
% binary output in LUA needs to be (re)implemented in LUA (see inline code
|
||||
% comments below).
|
||||
%
|
||||
% There are two possible work-arounds:
|
||||
% (a) Base64 encoding
|
||||
% (b) binary encoding using special LUA handling.
|
||||
% This is what I do. Set the 'encode filter' such that it reinitializes the encoder:
|
||||
% we patch \pgfplotscharno with a special routine which collects
|
||||
% only the integer indices:
|
||||
\let\pgfplotscharno=\pgfplotscharno@lualatex
|
||||
% later, the user has to convert this list into a binary lua
|
||||
% string before he can use it. See \pgfplotsbinarytoluabinary
|
||||
}%
|
||||
\edef\pgfplotsbinary@ZERO{\pgfplotscharno0}%
|
||||
\edef\pgfplotsbinary@ZERO@LINEARMAP{\pgfplotscharno{128}}%
|
||||
\let\pgfplotsbinary@ZERO@HIGHEST=\pgfplotsbinary@ZERO
|
||||
\def\pgfplotsbinary@basis{256}%
|
||||
\let\pgfplotsbinary@hook=\relax
|
||||
\def\pgfplotsbinary@hook@signed@linearmap{%
|
||||
\ifnum\c@pgfplotsbin@byteno=0
|
||||
\advance\c@pgfplotsbin@input by128
|
||||
\ifnum\c@pgfplotsbin@input>255
|
||||
\pgfplotsbinary@hook@signed@linearmap@error
|
||||
\fi
|
||||
\fi
|
||||
}%
|
||||
\def\pgfplotsbinarysetbytes##1{%
|
||||
\pgfutil@ifundefined{pgfplotsbinarysetbytes@##1}{%
|
||||
\pgfplots@error{Sorry, I can't write binary output with '##1' bytes yet...}%
|
||||
}{%
|
||||
\edef\pgfplotsbinary@bytes{##1}%
|
||||
\csname pgfplotsbinarysetbytes@##1\endcsname
|
||||
}%
|
||||
}%
|
||||
},%
|
||||
%
|
||||
% This applies 'binary encoding' and encodes the resulting bytes
|
||||
% in Hex. It corresponds to the ASCIIHexEncode in postscript or
|
||||
% pdf.
|
||||
% Please note that 'bytes' sets the number of binary bytes - the
|
||||
% actual encoding length is exactly twice as large.
|
||||
ASCIIHexEncode/.code={%
|
||||
\let\pgfplotscharno=\pgfplotscharno@bincatcode
|
||||
\edef\pgfplotsbinary@ZERO{\pgfplotscharno{48}}%
|
||||
\edef\pgfplotsbinary@ZERO@LINEARMAP{\pgfplotscharno{56}}%
|
||||
\let\pgfplotsbinary@ZERO@HIGHEST=\pgfplotsbinary@ZERO
|
||||
\pgfkeysalso{/pgfplots/bin/ordering/big endian}%
|
||||
\def\pgfplotsbinary@basis{16}%
|
||||
\def\pgfplotsbinary@hook@hex{%
|
||||
\ifnum\c@pgfplotsbin@input<10
|
||||
\advance\c@pgfplotsbin@input by48
|
||||
\else
|
||||
\advance\c@pgfplotsbin@input by55
|
||||
\fi
|
||||
}%
|
||||
\let\pgfplotsbinary@hook=\pgfplotsbinary@hook@hex
|
||||
\def\pgfplotsbinary@hook@signed@linearmap{%
|
||||
\ifnum\c@pgfplotsbin@byteno=0
|
||||
\advance\c@pgfplotsbin@input by8
|
||||
\ifnum\c@pgfplotsbin@input>16
|
||||
\pgfplotsbinary@hook@signed@linearmap@error
|
||||
\fi
|
||||
\fi
|
||||
\pgfplotsbinary@hook@hex
|
||||
}%
|
||||
\def\pgfplotsbinarysetbytes##1{%
|
||||
\pgfutil@ifundefined{pgfplotsbinarysetbytes@##1}{%
|
||||
\pgfplots@error{Sorry, I can't write binary output with '##1' bytes yet...}%
|
||||
}{%
|
||||
\csname pgfplotsbinarysetbytes@##1\endcsname
|
||||
\begingroup
|
||||
\count0=##1\relax
|
||||
\multiply\count0 by2
|
||||
\xdef\pgfplotsbinary@glob@TMP{\the\count0 }%
|
||||
\endgroup
|
||||
\let\pgfplotsbinary@bytes=\pgfplotsbinary@glob@TMP
|
||||
}%
|
||||
}%
|
||||
},%
|
||||
%
|
||||
%
|
||||
% This applies 'binary encoding' and encodes the resulting bytes
|
||||
% using a base 85 encoding. It corresponds to the ASCII85Encode in postscript or
|
||||
% pdf.
|
||||
% Handle this method with care - it works just for ONE number, not for a stream of
|
||||
% numbers as in pdf. Therefore, it might not be useful at all.
|
||||
% Please note that 'bytes' will be ignored; ASCII85Encode assumes
|
||||
% 4 binary bytes and uses 5 bytes to encode them.
|
||||
%
|
||||
% @ATTENTION bytes is ALWAYS 4, regardless of the setting of
|
||||
% 'bytes'!
|
||||
ASCII85Encode/.code={%
|
||||
\let\pgfplotscharno=\pgfplotscharno@bincatcode
|
||||
\edef\pgfplotsbinary@ZERO{\pgfplotscharno{33}}%
|
||||
\edef\pgfplotsbinary@ZERO@LINEARMAP{\pgfplotscharno{42}}%
|
||||
\let\pgfplotsbinary@ZERO@HIGHEST=\pgfplotsbinary@ZERO
|
||||
\pgfkeysalso{/pgfplots/bin/ordering/big endian}%
|
||||
\edef\pgfplotsbinary@ASCII@specialzero{\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO\pgfplotsbinary@ZERO}%
|
||||
\expandafter\def\expandafter\pgfplotsbinaryencode@badic@unsigned@PAD\expandafter{%
|
||||
\pgfplotsbinaryencode@badic@unsigned@PAD
|
||||
\ifx\pgfplotsbinaryresult\pgfplotsbinary@ASCII@specialzero
|
||||
% PDF standard: 0 is encoded as 'z':
|
||||
\gdef\pgfplotsbinaryresult{z}%
|
||||
\fi
|
||||
}%
|
||||
\def\pgfplotsbinary@basis{85}%
|
||||
\def\pgfplotsbinary@hook{%
|
||||
\advance\c@pgfplotsbin@input by33
|
||||
}%
|
||||
\def\pgfplotsbinary@hook@signed@linearmap{%
|
||||
\advance\c@pgfplotsbin@input by33
|
||||
\ifnum\c@pgfplotsbin@byteno=0
|
||||
\advance\c@pgfplotsbin@input by42
|
||||
\ifnum\c@pgfplotsbin@input>85
|
||||
\pgfplotsbinary@hook@signed@linearmap@error
|
||||
\fi
|
||||
\fi
|
||||
}%
|
||||
% I know, that does only work efficiently if bytes=4 for every
|
||||
% encoded number.
|
||||
\def\pgfplotsbinarysetbytes##1{%
|
||||
\def\pgfplotsbinary@bytes{5}%
|
||||
\csname pgfplotsbinarysetbytes@4\endcsname
|
||||
}%
|
||||
\pgfplotsbinarysetbytes4%
|
||||
},%
|
||||
binary encoding,%
|
||||
%
|
||||
bytes/.code={\pgfplotsbinarysetbytes{#1}},%
|
||||
bytes=4,
|
||||
%
|
||||
% Irreversibly change to VERBATIM output for debugging:
|
||||
debug mode/.code={%
|
||||
\let\pgfplotsbinary@apphighorderbytes@ORIG=\pgfplotsbinary@apphighorderbytes
|
||||
\def\pgfplotsbinary@ZERO{[Pad-0]}%
|
||||
\let\pgfplotsbinary@ZERO@HIGHEST=\pgfplotsbinary@ZERO
|
||||
\def\pgfplotsbinary@ZERO@LINEARMAP{[Pad-128]}%
|
||||
\def\pgfplotsbinary@apphighorderbytes##1{%
|
||||
\pgfutil@ifnextchar\pgfplotscharno{%
|
||||
\pgfplotsbinary@apphighorderbytes@DEBUG@csname
|
||||
}{%
|
||||
\pgfplotsbinary@apphighorderbytes@DEBUG@normal
|
||||
}%
|
||||
##1\relax
|
||||
}%
|
||||
},%
|
||||
% Write pdf objects in binary form. This does only work with
|
||||
% pdftex, and its output is only useful in conjunction with
|
||||
% \pdfcompresslevel=0
|
||||
% and a text editor.
|
||||
% Usage:
|
||||
% \pgfkeys{/pgfplots/bin/debug to pdf={\pgfplotsbinaryencodeunsigned}{1,2,3,...,16}}
|
||||
%
|
||||
% works only with pdftex
|
||||
debug to pdf/.code 2 args={%
|
||||
\foreach \num in {#2} {%
|
||||
#1{\num}%
|
||||
\immediate \pdfobj stream attr {
|
||||
/Decimal \num\space
|
||||
/Routine (\string#1)
|
||||
} {%
|
||||
\pgfplotsbinaryresult
|
||||
}%
|
||||
}%
|
||||
},%
|
||||
}
|
||||
|
||||
|
||||
\def\pgfplotsbinary@hook@signed@linearmap@error{%
|
||||
\pgfplots@error{Sorry, there are not enough bytes to store the current number. I tried to write \the\c@pgfplotsbin@input...}%
|
||||
}%
|
||||
|
||||
\def\pgfplotsbinary@apphighorderbytes@DEBUG@csname\pgfplotscharno#1\relax{%
|
||||
\pgfplotsbinary@apphighorderbytes@ORIG{[#1]}%
|
||||
}%
|
||||
\def\pgfplotsbinary@apphighorderbytes@DEBUG@normal#1\relax{%
|
||||
\pgfplotsbinary@apphighorderbytes@ORIG{#1}%
|
||||
}%
|
||||
|
||||
%\pgfkeys{/pgfplots/bin/debug mode}
|
||||
|
||||
|
||||
\countdef\c@pgfplotsbin@input=0
|
||||
\countdef\c@pgfplotsbin@tmpa=1
|
||||
\countdef\c@pgfplotsbin@tmpb=2
|
||||
\countdef\c@pgfplotsbin@byteno=3
|
||||
\countdef\c@pgfplotsbin@basis=4
|
||||
\def\pgfplotsbinaryempty{}
|
||||
|
||||
%--------------------------------------------------
|
||||
% input: unsigned int x, b, n;
|
||||
% output: unsigned int y[n];
|
||||
% for (i=0; i<n; i++) y[i] = 0;
|
||||
% i=0;
|
||||
% while (x > 0)
|
||||
% { y[i] = x % b; /* entspricht x mod b */
|
||||
% x = x / b; /* ganzzahlige Division */
|
||||
% i++;
|
||||
% }
|
||||
%--------------------------------------------------
|
||||
% with x = #1
|
||||
% b = basis
|
||||
% will store stuff into \pgfplotsbinaryresult in binary format
|
||||
%
|
||||
% PRECONDITION:
|
||||
% - \pgfplotsbinaryresult= empty!
|
||||
% - \c@pgfplotsbin@byteno=\pgfplotsbinary@bytes
|
||||
\def\pgfplotsbinaryencode@badic@unsigned@{%
|
||||
\ifnum\c@pgfplotsbin@input>0
|
||||
\c@pgfplotsbin@tmpa=\c@pgfplotsbin@input
|
||||
\divide\c@pgfplotsbin@tmpa by\c@pgfplotsbin@basis\relax
|
||||
\c@pgfplotsbin@tmpb=\c@pgfplotsbin@tmpa\relax
|
||||
\multiply\c@pgfplotsbin@tmpa by\c@pgfplotsbin@basis\relax
|
||||
\advance\c@pgfplotsbin@input by -\c@pgfplotsbin@tmpa\relax
|
||||
\advance\c@pgfplotsbin@byteno by-1
|
||||
\pgfplotsbinary@hook% hooks for modifications.
|
||||
\pgfplotsbinary@apphighorderbytes{\pgfplotscharno{\the\c@pgfplotsbin@input}}%
|
||||
\c@pgfplotsbin@input=\c@pgfplotsbin@tmpb
|
||||
%\message{RESULT SO FAR byte no \the\c@pgfplotsbin@byteno: \pgfplotsbinaryresult}%
|
||||
\expandafter\pgfplotsbinaryencode@badic@unsigned@
|
||||
\else
|
||||
\pgfplotsbinaryencode@badic@unsigned@PAD
|
||||
%\message{RESULT SO FAR byte no \the\c@pgfplotsbin@byteno: \pgfplotsbinaryresult}%
|
||||
\fi
|
||||
}%
|
||||
|
||||
|
||||
% Defines \pgfplotsbinaryresult to be the binary representation of an
|
||||
% unsigned integer.
|
||||
%
|
||||
% The representation will use unsigned dual number representation.
|
||||
%
|
||||
% The assignment to \pgfplotsbinaryresult will be globally.
|
||||
% #1: an unsigned integer. It won't be transformed in any way, so make
|
||||
% sure it fits into the configured number of bytes. It is an error if
|
||||
% the number is too large or too small. Please note that only unsigned
|
||||
% numbers are supported with this method.
|
||||
%
|
||||
% FIXME : fix > 2^30
|
||||
\def\pgfplotsbinaryencodeunsigned#1{%
|
||||
\begingroup
|
||||
\global\let\pgfplotsbinaryresult=\pgfplotsbinaryempty
|
||||
\c@pgfplotsbin@input=#1 %
|
||||
\c@pgfplotsbin@byteno=\pgfplotsbinary@bytes\relax
|
||||
\c@pgfplotsbin@basis=\pgfplotsbinary@basis\relax
|
||||
\pgfplotsbinaryencode@badic@unsigned@%
|
||||
\endgroup
|
||||
}%
|
||||
|
||||
% An implementation for signed integers which maps the signed integer linearly into
|
||||
% the unsigned data range before it proceeds.
|
||||
%
|
||||
% The idea is thus, to first introduce a linear mapping
|
||||
%
|
||||
% phi : [- smallest_possible, +largest_possible ] -> [0, 256^bytes-1 ]
|
||||
%
|
||||
% A signed integer in TeX is in [ - (2^31-1), 2^31-1 ].
|
||||
% Thus, we should map
|
||||
%
|
||||
% phi : [ -(2^31-1), 2^31-1 ] -> [ 0, 2^32-1 ].
|
||||
%
|
||||
% A simpler case is to employ the symmetry in TeX's registers and
|
||||
% leave one out, i.e. to map to 2^32-2:
|
||||
%
|
||||
% phi : [ -(2^31-1), 2^31-1 ] -> [ 0, 2^32-2 ].
|
||||
%
|
||||
% Then,
|
||||
%
|
||||
% phi(x) = ( x + 2^31 -1 ) / (2^31-1 + 2^31-1) * (2^32-2) = x+ 2^31-1.
|
||||
%
|
||||
% The same map phi(x) = x + 2^31 -1 with target space [0, 2^32-1 ]
|
||||
% could be realized with the input space [- (2^31-1), 2^31 ].
|
||||
%
|
||||
% I am using this encoding procedure, phi(x) = x + 2^31 -1.
|
||||
%
|
||||
% As a consequence, the binary pattern FF FF FF FF does never occur as
|
||||
% result of the mapping.
|
||||
%
|
||||
% To invert the mapping (i.e. to decode the result), set up the unique
|
||||
% linear map
|
||||
%
|
||||
% psi : [ 0, 2^32-1 ] -> [ -(2^31-1), 2^31 ].
|
||||
%
|
||||
% Then, psi( phi(x) ) = x and the decoding procedure is correct.
|
||||
%
|
||||
% This doesn't need TeX register arithmetics on the whole range.
|
||||
%
|
||||
% REMARK: the whole operation does also work if bytes<4 (i.e. we have
|
||||
% less than 32 bits in the target range). In this case, the mapping is
|
||||
% phi : [ -(2^31-1), 2^31-1 ] -> [ 0, 2^{8*bytes}-1 ]
|
||||
% and a further, *lossy* quantization still will be applied. The
|
||||
% quantization step is an integer division performed in signed number
|
||||
% arithmetics (i.e. it is symmetric around 0).
|
||||
\def\pgfplotsbinaryencodesignedmaplinearly#1{%
|
||||
\begingroup
|
||||
\global\let\pgfplotsbinaryresult=\pgfplotsbinaryempty
|
||||
\c@pgfplotsbin@input=#1\relax%
|
||||
\pgfplotsbinaryencodesignedmaplinearly@prepare
|
||||
\ifnum\c@pgfplotsbin@input<0 %
|
||||
% compute + 2^31 - 1
|
||||
\pgfplotsbinary@add@signed@largest@absolute
|
||||
\else
|
||||
% change zero padding such that positive numbers
|
||||
% get the EFFECT of + 2^31.
|
||||
\let\pgfplotsbinary@ZERO@HIGHEST=\pgfplotsbinary@ZERO@LINEARMAP
|
||||
\let\pgfplotsbinary@hook=\pgfplotsbinary@hook@signed@linearmap
|
||||
% and compute the -1 explicitly here:
|
||||
\advance\c@pgfplotsbin@input by-1 %
|
||||
\fi
|
||||
\pgfplotsbinaryencode@badic@unsigned@%
|
||||
\endgroup
|
||||
}%
|
||||
|
||||
% Encodes a dimen (like 1pt or \dimen0) in binary form.
|
||||
%
|
||||
% The encoding works by mapping #1 linearly into the allowed integer
|
||||
% range using a quantization technique to respect the (possibly)
|
||||
% restricted number of bytes.
|
||||
%
|
||||
% The implementation is fast and uses only integer arithmetics.
|
||||
% It relies on \pgfplotsbinaryencodesignedmaplinearly and a scale.
|
||||
%
|
||||
% So, what we do is to setup a linear map into binary range with k
|
||||
% bytes. The range of a TeX dimen is precisely (in units of pt)
|
||||
% [ -(2^30-1) / 2^16, (2^30 -1) / 2^16 ] = [-16383.99998, 16383.99998]
|
||||
%
|
||||
% Thus, for an input dimen x, we set up the mapping
|
||||
% phi(x) = 2^16 * x * 2
|
||||
% which maps
|
||||
% phi: [ -(2^30-1) / 2^16, (2^30-1) / 2^16 ] -> [-(2^31 -2), 2^31-2].
|
||||
%
|
||||
% I simply use the \pgfplotsbinaryencodesignedmaplinearly to process
|
||||
% this further. To simplify the computation, I simply compute
|
||||
% phi_signed( phi(x) ),
|
||||
% where phi_signed denotes an application of
|
||||
% \pgfplotsbinaryencodesignedmaplinearly:
|
||||
% phi_signed( y ) = y +2^31 -1,
|
||||
% phi_signed( phi(x) ) = 2^16 * 2 * x + 2^31 - 1.
|
||||
% This is NOT a linear map to [0,2^32-1] as promised.
|
||||
% But, we can setup an inverse transformation PHI (which is linear) anyway
|
||||
% such that
|
||||
% PHI( phi_signed(phi(x)) ) = x
|
||||
% and that's all I want. Do do that, we use the unique linear decoder map
|
||||
% PHI : [ 0,2^32-1 ] -> [ -16383.999992, 16384 ].
|
||||
%
|
||||
% This is not exacty the input range of before, but using it results
|
||||
% in a proper decoder. The difference is due to the non-unique zero
|
||||
% representation in TeX's arithmetics.
|
||||
%
|
||||
%
|
||||
% REMARK: the whole operation does also work if bytes<4 (i.e. we have
|
||||
% less than 32 bits in the target range). In this case, a further
|
||||
% *lossy* quantization step is applied in phi_signed. The inverse
|
||||
% transformations are the same, however. See
|
||||
% \pgfplotsbinaryencodesignedmaplinearly for details about the
|
||||
% quantization step (or try it out).
|
||||
%
|
||||
%
|
||||
%% DEBUG NOTE: This mapping appears to work correctly according to
|
||||
%% my tests.
|
||||
%% For bc -l test codes:
|
||||
%% ibase=16;
|
||||
%% -4000 + 809658FA. / (2^20) * 8000
|
||||
\def\pgfplotsbinaryencodedimenmaplinearly#1{%
|
||||
\begingroup
|
||||
\dimen0=#1\relax
|
||||
\c@pgfplotsbin@input=\dimen0
|
||||
\multiply\c@pgfplotsbin@input by2
|
||||
%\message{LOWLEVEL ENCODING '\the\c@pgfplotsbin@input' with linear map}%
|
||||
\pgfplotsbinaryencodesignedmaplinearly\c@pgfplotsbin@input
|
||||
\endgroup
|
||||
}%
|
||||
|
||||
\catcode`\@=\pgfplotsbinaryatcode
|
||||
\endinput
|
291
texmf/tex/latex/pgfplots/tex/pgfplotsbinary.data.code.tex
Normal file
291
texmf/tex/latex/pgfplots/tex/pgfplotsbinary.data.code.tex
Normal file
|
@ -0,0 +1,291 @@
|
|||
\begingroup
|
||||
% prepare ONE-BYTE conversion [0-255] -> binary character:
|
||||
\count0=0
|
||||
\countdef\counter=0
|
||||
\catcode`\^^00=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^00}\advance\counter by1
|
||||
\catcode`\^^01=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^01}\advance\counter by1
|
||||
\catcode`\^^02=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^02}\advance\counter by1
|
||||
\catcode`\^^03=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^03}\advance\counter by1
|
||||
\catcode`\^^04=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^04}\advance\counter by1
|
||||
\catcode`\^^05=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^05}\advance\counter by1
|
||||
\catcode`\^^06=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^06}\advance\counter by1
|
||||
\catcode`\^^07=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^07}\advance\counter by1
|
||||
\catcode`\^^08=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^08}\advance\counter by1
|
||||
\begingroup
|
||||
\catcode`\^^09=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^09}\endgroup\advance\counter by1
|
||||
\begingroup
|
||||
\catcode`\^^0a=11\expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^0a}\endgroup\advance\counter by1
|
||||
\begingroup
|
||||
\catcode`\^^0b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^0b}\endgroup\advance\counter by1
|
||||
\catcode`\^^0c=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^0c}\advance\counter by1
|
||||
\begingroup
|
||||
\catcode`\^^0d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^0d}\endgroup\advance\counter by1
|
||||
\catcode`\^^0e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^0e}\advance\counter by1
|
||||
\catcode`\^^0f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^0f}\advance\counter by1
|
||||
\catcode`\^^10=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^10}\advance\counter by1
|
||||
\catcode`\^^11=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^11}\advance\counter by1
|
||||
\catcode`\^^12=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^12}\advance\counter by1
|
||||
\catcode`\^^13=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^13}\advance\counter by1
|
||||
\catcode`\^^14=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^14}\advance\counter by1
|
||||
\catcode`\^^15=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^15}\advance\counter by1
|
||||
\catcode`\^^16=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^16}\advance\counter by1
|
||||
\catcode`\^^17=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^17}\advance\counter by1
|
||||
\catcode`\^^18=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^18}\advance\counter by1
|
||||
\catcode`\^^19=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^19}\advance\counter by1
|
||||
\catcode`\^^1a=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^1a}\advance\counter by1
|
||||
\catcode`\^^1b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^1b}\advance\counter by1
|
||||
\catcode`\^^1c=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^1c}\advance\counter by1
|
||||
\catcode`\^^1d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^1d}\advance\counter by1
|
||||
\catcode`\^^1e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^1e}\advance\counter by1
|
||||
\catcode`\^^1f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^1f}\advance\counter by1
|
||||
\begingroup
|
||||
\catcode`\^^20=11^^I\expandafter\xdef\csname^^Ipgfp@bin@\the\counter^^I\endcsname{^^20}\endgroup\advance\counter by1
|
||||
\catcode`\^^21=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^21}\advance\counter by1
|
||||
\catcode`\^^22=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^22}\advance\counter by1
|
||||
\catcode`\^^23=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^23}\advance\counter by1
|
||||
\catcode`\^^24=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^24}\advance\counter by1
|
||||
\catcode`\^^25=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^25}\advance\counter by1
|
||||
\catcode`\^^26=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^26}\advance\counter by1
|
||||
\catcode`\^^27=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^27}\advance\counter by1
|
||||
\catcode`\^^28=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^28}\advance\counter by1
|
||||
\catcode`\^^29=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^29}\advance\counter by1
|
||||
\catcode`\^^2a=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^2a}\advance\counter by1
|
||||
\catcode`\^^2b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^2b}\advance\counter by1
|
||||
\catcode`\^^2c=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^2c}\advance\counter by1
|
||||
\catcode`\^^2d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^2d}\advance\counter by1
|
||||
\catcode`\^^2e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^2e}\advance\counter by1
|
||||
\catcode`\^^2f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^2f}\advance\counter by1
|
||||
\begingroup
|
||||
\catcode`\^^30=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^30}\endgroup\advance\counter by1
|
||||
\begingroup
|
||||
\catcode`\^^31=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^31}\endgroup\advance\counter by1
|
||||
\begingroup
|
||||
\catcode`\^^32=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^32}\endgroup\advance\counter by1
|
||||
\begingroup
|
||||
\catcode`\^^33=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^33}\endgroup\advance\counter by1
|
||||
\begingroup
|
||||
\catcode`\^^34=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^34}\endgroup\advance\counter by1
|
||||
\begingroup
|
||||
\catcode`\^^35=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^35}\endgroup\advance\counter by1
|
||||
\begingroup
|
||||
\catcode`\^^36=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^36}\endgroup\advance\counter by1
|
||||
\begingroup
|
||||
\catcode`\^^37=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^37}\endgroup\advance\counter by1
|
||||
\begingroup
|
||||
\catcode`\^^38=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^38}\endgroup\advance\counter by1
|
||||
\begingroup
|
||||
\catcode`\^^39=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^39}\endgroup\advance\counter by1
|
||||
\catcode`\^^3a=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^3a}\advance\counter by1
|
||||
\catcode`\^^3b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^3b}\advance\counter by1
|
||||
\catcode`\^^3c=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^3c}\advance\counter by1
|
||||
\begingroup
|
||||
\catcode`\^^3d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^3d}\endgroup\advance\counter by1
|
||||
\catcode`\^^3e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^3e}\advance\counter by1
|
||||
\catcode`\^^3f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^3f}\advance\counter by1
|
||||
\catcode`\^^40=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^40}\advance\counter by1
|
||||
\catcode`\^^41=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^41}\advance\counter by1
|
||||
\catcode`\^^42=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^42}\advance\counter by1
|
||||
\catcode`\^^43=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^43}\advance\counter by1
|
||||
\catcode`\^^44=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^44}\advance\counter by1
|
||||
\catcode`\^^45=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^45}\advance\counter by1
|
||||
\catcode`\^^46=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^46}\advance\counter by1
|
||||
\catcode`\^^47=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^47}\advance\counter by1
|
||||
\catcode`\^^48=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^48}\advance\counter by1
|
||||
\catcode`\^^49=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^49}\advance\counter by1
|
||||
\catcode`\^^4a=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^4a}\advance\counter by1
|
||||
\catcode`\^^4b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^4b}\advance\counter by1
|
||||
\catcode`\^^4c=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^4c}\advance\counter by1
|
||||
\catcode`\^^4d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^4d}\advance\counter by1
|
||||
\catcode`\^^4e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^4e}\advance\counter by1
|
||||
\catcode`\^^4f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^4f}\advance\counter by1
|
||||
\catcode`\^^50=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^50}\advance\counter by1
|
||||
\catcode`\^^51=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^51}\advance\counter by1
|
||||
\catcode`\^^52=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^52}\advance\counter by1
|
||||
\catcode`\^^53=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^53}\advance\counter by1
|
||||
\catcode`\^^54=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^54}\advance\counter by1
|
||||
\catcode`\^^55=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^55}\advance\counter by1
|
||||
\catcode`\^^56=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^56}\advance\counter by1
|
||||
\catcode`\^^57=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^57}\advance\counter by1
|
||||
\catcode`\^^58=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^58}\advance\counter by1
|
||||
\catcode`\^^59=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^59}\advance\counter by1
|
||||
\catcode`\^^5a=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^5a}\advance\counter by1
|
||||
\catcode`\^^5b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^5b}\advance\counter by1
|
||||
\begingroup
|
||||
\catcode`\|=0
|
||||
\catcode`\\=11 |expandafter|xdef|csname pgfp@bin@|the|counter|endcsname{^^5c}|endgroup \advance\counter by1
|
||||
\catcode`\^^5d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^5d}\advance\counter by1
|
||||
\begingroup
|
||||
\catcode`\^^5e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^}\endgroup\advance\counter by1
|
||||
\catcode`\^^5f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^5f}\advance\counter by1
|
||||
\begingroup
|
||||
\catcode`\^^60=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^60}\endgroup\advance\counter by1
|
||||
\catcode`\^^61=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^61}\advance\counter by1
|
||||
\catcode`\^^62=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^62}\advance\counter by1
|
||||
\catcode`\^^63=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^63}\advance\counter by1
|
||||
\catcode`\^^64=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^64}\advance\counter by1
|
||||
\catcode`\^^65=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^65}\advance\counter by1
|
||||
\catcode`\^^66=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^66}\advance\counter by1
|
||||
\catcode`\^^67=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^67}\advance\counter by1
|
||||
\catcode`\^^68=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^68}\advance\counter by1
|
||||
\catcode`\^^69=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^69}\advance\counter by1
|
||||
\catcode`\^^6a=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^6a}\advance\counter by1
|
||||
\catcode`\^^6b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^6b}\advance\counter by1
|
||||
\catcode`\^^6c=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^6c}\advance\counter by1
|
||||
\catcode`\^^6d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^6d}\advance\counter by1
|
||||
\catcode`\^^6e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^6e}\advance\counter by1
|
||||
\catcode`\^^6f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^6f}\advance\counter by1
|
||||
\catcode`\^^70=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^70}\advance\counter by1
|
||||
\catcode`\^^71=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^71}\advance\counter by1
|
||||
\catcode`\^^72=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^72}\advance\counter by1
|
||||
\catcode`\^^73=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^73}\advance\counter by1
|
||||
\catcode`\^^74=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^74}\advance\counter by1
|
||||
\catcode`\^^75=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^75}\advance\counter by1
|
||||
\catcode`\^^76=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^76}\advance\counter by1
|
||||
\catcode`\^^77=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^77}\advance\counter by1
|
||||
\catcode`\^^78=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^78}\advance\counter by1
|
||||
\catcode`\^^79=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^79}\advance\counter by1
|
||||
\catcode`\^^7a=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^7a}\advance\counter by1
|
||||
\begingroup
|
||||
\catcode`\q=1
|
||||
\catcode`\^^7b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname q^^7b}\endgroup\advance\counter by1
|
||||
\catcode`\^^7c=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^7c}\advance\counter by1
|
||||
\begingroup
|
||||
\catcode`\q=2
|
||||
\catcode`\^^7d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^7dq\endgroup\advance\counter by1
|
||||
\catcode`\^^7e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^7e}\advance\counter by1
|
||||
\catcode`\^^7f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^7f}\advance\counter by1
|
||||
\catcode`\^^80=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^80}\advance\counter by1
|
||||
\catcode`\^^81=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^81}\advance\counter by1
|
||||
\catcode`\^^82=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^82}\advance\counter by1
|
||||
\catcode`\^^83=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^83}\advance\counter by1
|
||||
\catcode`\^^84=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^84}\advance\counter by1
|
||||
\catcode`\^^85=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^85}\advance\counter by1
|
||||
\catcode`\^^86=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^86}\advance\counter by1
|
||||
\catcode`\^^87=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^87}\advance\counter by1
|
||||
\catcode`\^^88=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^88}\advance\counter by1
|
||||
\catcode`\^^89=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^89}\advance\counter by1
|
||||
\catcode`\^^8a=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^8a}\advance\counter by1
|
||||
\catcode`\^^8b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^8b}\advance\counter by1
|
||||
\catcode`\^^8c=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^8c}\advance\counter by1
|
||||
\catcode`\^^8d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^8d}\advance\counter by1
|
||||
\catcode`\^^8e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^8e}\advance\counter by1
|
||||
\catcode`\^^8f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^8f}\advance\counter by1
|
||||
\catcode`\^^90=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^90}\advance\counter by1
|
||||
\catcode`\^^91=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^91}\advance\counter by1
|
||||
\catcode`\^^92=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^92}\advance\counter by1
|
||||
\catcode`\^^93=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^93}\advance\counter by1
|
||||
\catcode`\^^94=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^94}\advance\counter by1
|
||||
\catcode`\^^95=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^95}\advance\counter by1
|
||||
\catcode`\^^96=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^96}\advance\counter by1
|
||||
\catcode`\^^97=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^97}\advance\counter by1
|
||||
\catcode`\^^98=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^98}\advance\counter by1
|
||||
\catcode`\^^99=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^99}\advance\counter by1
|
||||
\catcode`\^^9a=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^9a}\advance\counter by1
|
||||
\catcode`\^^9b=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^9b}\advance\counter by1
|
||||
\catcode`\^^9c=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^9c}\advance\counter by1
|
||||
\catcode`\^^9d=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^9d}\advance\counter by1
|
||||
\catcode`\^^9e=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^9e}\advance\counter by1
|
||||
\catcode`\^^9f=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^9f}\advance\counter by1
|
||||
\catcode`\^^a0=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a0}\advance\counter by1
|
||||
\catcode`\^^a1=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a1}\advance\counter by1
|
||||
\catcode`\^^a2=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a2}\advance\counter by1
|
||||
\catcode`\^^a3=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a3}\advance\counter by1
|
||||
\catcode`\^^a4=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a4}\advance\counter by1
|
||||
\catcode`\^^a5=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a5}\advance\counter by1
|
||||
\catcode`\^^a6=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a6}\advance\counter by1
|
||||
\catcode`\^^a7=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a7}\advance\counter by1
|
||||
\catcode`\^^a8=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a8}\advance\counter by1
|
||||
\catcode`\^^a9=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^a9}\advance\counter by1
|
||||
\catcode`\^^aa=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^aa}\advance\counter by1
|
||||
\catcode`\^^ab=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ab}\advance\counter by1
|
||||
\catcode`\^^ac=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ac}\advance\counter by1
|
||||
\catcode`\^^ad=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ad}\advance\counter by1
|
||||
\catcode`\^^ae=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ae}\advance\counter by1
|
||||
\catcode`\^^af=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^af}\advance\counter by1
|
||||
\catcode`\^^b0=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b0}\advance\counter by1
|
||||
\catcode`\^^b1=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b1}\advance\counter by1
|
||||
\catcode`\^^b2=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b2}\advance\counter by1
|
||||
\catcode`\^^b3=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b3}\advance\counter by1
|
||||
\catcode`\^^b4=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b4}\advance\counter by1
|
||||
\catcode`\^^b5=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b5}\advance\counter by1
|
||||
\catcode`\^^b6=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b6}\advance\counter by1
|
||||
\catcode`\^^b7=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b7}\advance\counter by1
|
||||
\catcode`\^^b8=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b8}\advance\counter by1
|
||||
\catcode`\^^b9=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^b9}\advance\counter by1
|
||||
\catcode`\^^ba=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ba}\advance\counter by1
|
||||
\catcode`\^^bb=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^bb}\advance\counter by1
|
||||
\catcode`\^^bc=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^bc}\advance\counter by1
|
||||
\catcode`\^^bd=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^bd}\advance\counter by1
|
||||
\catcode`\^^be=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^be}\advance\counter by1
|
||||
\catcode`\^^bf=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^bf}\advance\counter by1
|
||||
\catcode`\^^c0=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c0}\advance\counter by1
|
||||
\catcode`\^^c1=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c1}\advance\counter by1
|
||||
\catcode`\^^c2=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c2}\advance\counter by1
|
||||
\catcode`\^^c3=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c3}\advance\counter by1
|
||||
\catcode`\^^c4=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c4}\advance\counter by1
|
||||
\catcode`\^^c5=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c5}\advance\counter by1
|
||||
\catcode`\^^c6=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c6}\advance\counter by1
|
||||
\catcode`\^^c7=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c7}\advance\counter by1
|
||||
\catcode`\^^c8=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c8}\advance\counter by1
|
||||
\catcode`\^^c9=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^c9}\advance\counter by1
|
||||
\catcode`\^^ca=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ca}\advance\counter by1
|
||||
\catcode`\^^cb=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^cb}\advance\counter by1
|
||||
\catcode`\^^cc=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^cc}\advance\counter by1
|
||||
\catcode`\^^cd=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^cd}\advance\counter by1
|
||||
\catcode`\^^ce=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ce}\advance\counter by1
|
||||
\catcode`\^^cf=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^cf}\advance\counter by1
|
||||
\catcode`\^^d0=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d0}\advance\counter by1
|
||||
\catcode`\^^d1=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d1}\advance\counter by1
|
||||
\catcode`\^^d2=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d2}\advance\counter by1
|
||||
\catcode`\^^d3=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d3}\advance\counter by1
|
||||
\catcode`\^^d4=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d4}\advance\counter by1
|
||||
\catcode`\^^d5=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d5}\advance\counter by1
|
||||
\catcode`\^^d6=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d6}\advance\counter by1
|
||||
\catcode`\^^d7=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d7}\advance\counter by1
|
||||
\catcode`\^^d8=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d8}\advance\counter by1
|
||||
\catcode`\^^d9=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^d9}\advance\counter by1
|
||||
\catcode`\^^da=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^da}\advance\counter by1
|
||||
\catcode`\^^db=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^db}\advance\counter by1
|
||||
\catcode`\^^dc=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^dc}\advance\counter by1
|
||||
\catcode`\^^dd=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^dd}\advance\counter by1
|
||||
\catcode`\^^de=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^de}\advance\counter by1
|
||||
\catcode`\^^df=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^df}\advance\counter by1
|
||||
\catcode`\^^e0=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e0}\advance\counter by1
|
||||
\catcode`\^^e1=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e1}\advance\counter by1
|
||||
\catcode`\^^e2=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e2}\advance\counter by1
|
||||
\catcode`\^^e3=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e3}\advance\counter by1
|
||||
\catcode`\^^e4=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e4}\advance\counter by1
|
||||
\catcode`\^^e5=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e5}\advance\counter by1
|
||||
\catcode`\^^e6=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e6}\advance\counter by1
|
||||
\catcode`\^^e7=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e7}\advance\counter by1
|
||||
\catcode`\^^e8=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e8}\advance\counter by1
|
||||
\catcode`\^^e9=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^e9}\advance\counter by1
|
||||
\catcode`\^^ea=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ea}\advance\counter by1
|
||||
\catcode`\^^eb=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^eb}\advance\counter by1
|
||||
\catcode`\^^ec=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ec}\advance\counter by1
|
||||
\catcode`\^^ed=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ed}\advance\counter by1
|
||||
\catcode`\^^ee=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ee}\advance\counter by1
|
||||
\catcode`\^^ef=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ef}\advance\counter by1
|
||||
\catcode`\^^f0=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f0}\advance\counter by1
|
||||
\catcode`\^^f1=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f1}\advance\counter by1
|
||||
\catcode`\^^f2=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f2}\advance\counter by1
|
||||
\catcode`\^^f3=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f3}\advance\counter by1
|
||||
\catcode`\^^f4=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f4}\advance\counter by1
|
||||
\catcode`\^^f5=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f5}\advance\counter by1
|
||||
\catcode`\^^f6=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f6}\advance\counter by1
|
||||
\catcode`\^^f7=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f7}\advance\counter by1
|
||||
\catcode`\^^f8=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f8}\advance\counter by1
|
||||
\catcode`\^^f9=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^f9}\advance\counter by1
|
||||
\catcode`\^^fa=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^fa}\advance\counter by1
|
||||
\catcode`\^^fb=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^fb}\advance\counter by1
|
||||
\catcode`\^^fc=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^fc}\advance\counter by1
|
||||
\catcode`\^^fd=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^fd}\advance\counter by1
|
||||
\catcode`\^^fe=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^fe}\advance\counter by1
|
||||
\catcode`\^^ff=11 \expandafter\xdef\csname pgfp@bin@\the\counter \endcsname{^^ff}\advance\counter by1
|
||||
\ifnum\counter=256
|
||||
\else
|
||||
\pgfplots@error{Internal logic Error: initialisation failed. I have only \the\counter\space bytes initialised.}
|
||||
\fi
|
||||
\endgroup
|
||||
|
||||
\endinput
|
630
texmf/tex/latex/pgfplots/tex/pgfplotscolor.code.tex
Normal file
630
texmf/tex/latex/pgfplots/tex/pgfplotscolor.code.tex
Normal file
|
@ -0,0 +1,630 @@
|
|||
%--------------------------------------------
|
||||
%
|
||||
% Package pgfplots
|
||||
%
|
||||
% 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-2013 by Christian Feuersänger.
|
||||
%
|
||||
% This program is free software: you can redistribute it and/or modify
|
||||
% 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/>.
|
||||
%
|
||||
%--------------------------------------------
|
||||
|
||||
\pgfkeys{
|
||||
/pgfplots/color sequence/reset/.style={
|
||||
/pgfplots/color sequence/colorspace,
|
||||
/pgfplots/color sequence/default input colorspace,
|
||||
/pgfplots/color sequence/every input component/.code=,
|
||||
/pgfplots/color sequence/context message,
|
||||
},
|
||||
/pgfplots/color sequence/colorspace/.initial=auto,
|
||||
/pgfplots/color sequence/colorspace/.default=auto,
|
||||
/pgfplots/color sequence/default input colorspace/.initial=,
|
||||
/pgfplots/color sequence/default input colorspace/.default=\pgfkeysvalueof{/pgfplots/color sequence/colorspace},
|
||||
% applied to every INPUT component, i.e. before transforming it to some target color space.
|
||||
/pgfplots/color sequence/every input component/.code=,
|
||||
/pgfplots/color sequence/context message/.code={\def\pgfplotscolornormalizesequence@context@message{#1}},
|
||||
/pgfplots/color sequence/context message/.default=\pgfplotscolornormalizesequence@context@message@default,
|
||||
/pgfplots/color sequence/reset,
|
||||
}
|
||||
|
||||
\newif\ifpgfplotscolor@colorspaceknown
|
||||
|
||||
% the beginning of a normalized color sequence.
|
||||
%
|
||||
% It is to be used like
|
||||
% \pgfplotscolornormalizesequence[colorspace=rgb]
|
||||
%
|
||||
% \pgfplotscolornormalizesequencenext{1,1,1}
|
||||
% -> \pgfplotsretval = {1,1,1} % uses default colorspace
|
||||
% \pgfplotscolornormalizesequencenext{color=red}
|
||||
% -> \pgfplotsretval = {1,0,0}
|
||||
% \pgfplotscolornormalizesequencenext{color=blue}
|
||||
% -> \pgfplotsretval = {0,0,1}
|
||||
% \pgfplotscolornormalizesequencenext{rgb=1,0,0}
|
||||
% -> \pgfplotsretval = {1,0,0}
|
||||
% \pgfplotscolornormalizesequencenext{cmyk=1,0,0,1}
|
||||
% -> \pgfplotsretval = {<converted value>}
|
||||
%
|
||||
% \endpgfplotscolornormalizesequence
|
||||
%
|
||||
% Every color provided in the sequence will be normalized by
|
||||
% transforming it to the common color space and by computing the
|
||||
% separate components representing the color in that space.
|
||||
%
|
||||
% These components are available for use in interpolation routines.
|
||||
%
|
||||
% #1 : keys in the /pgfplots/color sequence path
|
||||
\def\pgfplotscolornormalizesequence[#1]{%
|
||||
\pgfqkeys{/pgfplots/color sequence}{%
|
||||
#1,%
|
||||
}%
|
||||
\pgfkeysgetvalue{/pgfplots/color sequence/colorspace}\pgfplots@loc@TMPa
|
||||
\pgfkeysgetvalue{/pgfplots/color sequence/default input colorspace}\pgfplotscolornormalizesequence@colspace@input
|
||||
\edef\pgfplotscolornormalizesequence@colspace@input{\pgfplotscolornormalizesequence@colspace@input}%
|
||||
\pgfkeysgetvalue{/pgfplots/color sequence/every input component/.@cmd}\pgfplotscolornormalizesequencenext@every@component
|
||||
\edef\pgfplots@loc@TMPa{\pgfplots@loc@TMPa}%
|
||||
\def\pgfplots@loc@TMPb{auto}%
|
||||
\ifx\pgfplots@loc@TMPb\pgfplots@loc@TMPa
|
||||
% colorspace=auto: same as empty.
|
||||
\let\pgfplots@loc@TMPa=\pgfutil@empty
|
||||
\fi
|
||||
\ifx\pgfplots@loc@TMPa\pgfutil@empty
|
||||
% colorspace=auto:
|
||||
\def\pgfplotscolornormalizesequence@colspace{}%
|
||||
\else
|
||||
\def\pgfplots@loc@TMPb{rgb}%
|
||||
\ifx\pgfplots@loc@TMPb\pgfplots@loc@TMPa
|
||||
% colorspace=rgb:
|
||||
\def\pgfplotscolornormalizesequence@colspace{rgb}%
|
||||
\else
|
||||
\def\pgfplots@loc@TMPb{cmyk}%
|
||||
\ifx\pgfplots@loc@TMPb\pgfplots@loc@TMPa
|
||||
% colorspace=cmyk:
|
||||
\def\pgfplotscolornormalizesequence@colspace{cmyk}%
|
||||
\else
|
||||
\def\pgfplots@loc@TMPb{gray}%
|
||||
\ifx\pgfplots@loc@TMPb\pgfplots@loc@TMPa
|
||||
% colorspace=gray:
|
||||
\def\pgfplotscolornormalizesequence@colspace{gray}%
|
||||
\else
|
||||
\pgfplots@error{Sorry, the choice colorspace=\pgfplots@loc@TMPa\space is unsupported as interpolation colorspace in pgfplots, please use one of 'auto,rgb,cmyk,gray'}%
|
||||
\fi
|
||||
\fi
|
||||
\fi
|
||||
\fi
|
||||
}%
|
||||
|
||||
% ends a normalized color sequence and returns the final colorspace
|
||||
% and its number of components into \pgfplotsretval and
|
||||
% \pgfplotsretvalb, respectively
|
||||
\def\endpgfplotscolornormalizesequence{%
|
||||
\let\pgfplotsretval=\pgfplotscolornormalizesequence@colspace
|
||||
\pgfplotscolor@get@num@components{\pgfplotsretval}{\pgfplotsretvalb}%
|
||||
\pgfqkeys{/pgfplots/color sequence}{reset}%
|
||||
}%
|
||||
|
||||
% accepts the next color in a sequence of colors. The color will be
|
||||
% normalized and the normalized result written to \pgfplotsretval.
|
||||
%
|
||||
% SEE \pgfplotscolornormalizesequencenext -- it is MUCH more powerful!
|
||||
%
|
||||
% #1 the color space of the color.
|
||||
% #2 the components of the color, separated by comma.
|
||||
%
|
||||
% POSTCONDITION:
|
||||
% \pgfplotsretval contains '{<color space>}{<comma-separated-components>}'
|
||||
% -> including the curly braces.
|
||||
%
|
||||
% \pgfplotsretvalb contains the number of input components in
|
||||
% \pgfplotsretval
|
||||
\def\pgfplotscolornormalizesequencenextbycomponents#1#2{%
|
||||
\edef\pgfplotscolornormalizesequence@cur@colspace{#1}%
|
||||
\pgfplotscolornormalizesequencenextbycomponents@normalize@components{#2}%
|
||||
%
|
||||
\ifx\pgfplotscolornormalizesequence@cur@colspace\pgfplotscolornormalizesequence@colspace
|
||||
\else
|
||||
\ifx\pgfplotscolornormalizesequence@colspace\pgfutil@empty
|
||||
\pgfplotscolornormalizesequencenextbycomponents@assign@auto@colspace
|
||||
\fi
|
||||
%
|
||||
\ifx\pgfplotscolornormalizesequence@colspace\pgfplotscolornormalizesequence@cur@colspace
|
||||
% Ah, ok - the colorspace is NOW the correct one (because
|
||||
% we chose it as the colorspace for this complete color
|
||||
% sequence.
|
||||
\else
|
||||
% Oh. We need to convert the color space!
|
||||
\edef\pgfplots@loc@TMPa{{\pgfplotscolornormalizesequence@cur@colspace}{\pgfplotsretval}}%
|
||||
\expandafter\pgfutil@convertcolorspec\pgfplots@loc@TMPa
|
||||
{\pgfplotscolornormalizesequence@colspace}% target color spaces
|
||||
{\pgfplotsretval}% target macro
|
||||
\fi
|
||||
\fi
|
||||
\edef\pgfplotsretval{\pgfplotsretval}%
|
||||
\pgfplotscolor@get@num@components{\pgfplotscolornormalizesequence@colspace}{\pgfplotsretvalb}%
|
||||
}
|
||||
|
||||
\def\pgfplotscolornormalizesequencenextbycomponents@assign@auto@colspace{%
|
||||
% Ah; we have '/pgfplots/color sequence/colorspace=auto'.
|
||||
% Well, check if the current colorspace (stored in
|
||||
% \pgfplotscolornormalizesequence@cur@colspace) is suitable.
|
||||
%
|
||||
% It is suitable if it is rgb or cmyk. In all other cases,
|
||||
% we choose either rgb or cmyk. More precisely. 'cmy' is
|
||||
% mapped to cmyk. All other cases are treated as rgb.
|
||||
%
|
||||
\def\pgfplots@loc@TMPa{cmyk}%
|
||||
\ifx\pgfplotscolornormalizesequence@cur@colspace\pgfplots@loc@TMPa
|
||||
\let\pgfplotscolornormalizesequence@colspace=\pgfplotscolornormalizesequence@cur@colspace
|
||||
\else
|
||||
\def\pgfplots@loc@TMPa{cmy}%
|
||||
\ifx\pgfplotscolornormalizesequence@cur@colspace\pgfplots@loc@TMPa
|
||||
\def\pgfplotscolornormalizesequence@colspace{cmyk}%
|
||||
\else
|
||||
% rgb appears to be the best choice: (1) it is backwards
|
||||
% compatible and (2) gray or something like that might fit
|
||||
% badly to any other colors in the sequence.
|
||||
\def\pgfplotscolornormalizesequence@colspace{rgb}%
|
||||
\fi
|
||||
\fi
|
||||
}
|
||||
|
||||
% #1: color components
|
||||
%
|
||||
% PRECONDITION: \pgfplotscolornormalizesequence@cur@colspace is the
|
||||
% current color space
|
||||
%
|
||||
% POSTCONDITION: \pgfplotsretval contains the normalized color
|
||||
% components
|
||||
\def\pgfplotscolornormalizesequencenextbycomponents@normalize@components#1{%
|
||||
\pgfutil@ifundefined{pgfplots@colspace@name@\pgfplotscolornormalizesequence@cur@colspace}{%
|
||||
\pgfplotscolor@colorspaceknownfalse
|
||||
}{%
|
||||
\pgfplotscolor@colorspaceknowntrue
|
||||
}%
|
||||
\edef\pgfplots@loc@TMPb{#1}%
|
||||
\def\pgfplotsretval{}%
|
||||
\c@pgf@counta=0 %
|
||||
\expandafter\pgfplotscolornormalizesequencenext@prepare@loop\pgfplots@loc@TMPb,\pgfplots@EOI,%
|
||||
}%
|
||||
|
||||
% assigns the number of color components for the given colorspace to
|
||||
% \pgfplotsretval
|
||||
\def\pgfplotscolorspacegetcomponents#1{%
|
||||
\pgfplotscolor@get@num@components{#1}{\pgfplotsretval}%
|
||||
}%
|
||||
|
||||
% Defines \pgfplotsretval to contain the number of components in the
|
||||
% color space.
|
||||
\def\pgfplotscolornormalizesequencegetnumcomponents{%
|
||||
\ifx\pgfplotscolornormalizesequence@colspace\pgfutil@empty
|
||||
\pgfplotsthrow{invalid argument}{\pgfplots@loc@TMPa}{Cannot create color with zero components: no colorspace set for the normalized color sequence.}\pgfeov%
|
||||
\fi
|
||||
\pgfplotscolorspacegetcomponents{\pgfplotscolornormalizesequence@colspace}%
|
||||
}%
|
||||
|
||||
\def\pgfplotscolor@get@num@components#1#2{%
|
||||
\pgfutil@ifundefined{pgfplots@colspace@numcomp@#1}{%
|
||||
\pgfplotsthrow{invalid argument}{\pgfplots@loc@TMPa}{The input color has an unsupported color space '#1'}\pgfeov%
|
||||
}{%
|
||||
\edef#2{\csname pgfplots@colspace@numcomp@#1\endcsname}%
|
||||
}%
|
||||
}%
|
||||
|
||||
|
||||
\def\pgfplots@colspace@numcomp@gray{1}%
|
||||
\def\pgfplots@colspace@name@gray{gray}%
|
||||
|
||||
\def\pgfplots@colspace@numcomp@rgb{3}%
|
||||
\def\pgfplots@colspace@name@rgb{rgb}%
|
||||
|
||||
\def\pgfplots@colspace@numcomp@cmyk{4}%
|
||||
\def\pgfplots@colspace@name@cmyk{cmyk}%
|
||||
|
||||
\def\pgfplots@colspace@numcomp@cmy{3}%
|
||||
\def\pgfplots@colspace@name@cmy{cmy}%
|
||||
|
||||
\def\pgfplots@colspace@numcomp@wave{1}%
|
||||
\def\pgfplots@colspace@name@wave{wave}%
|
||||
\pgfutil@namedef{pgfplots@colspace@minaccept@wave@0}{362.998}%
|
||||
\pgfutil@namedef{pgfplots@colspace@min@wave@0}{363}%
|
||||
\pgfutil@namedef{pgfplots@colspace@maxaccept@wave@0}{814.001}%
|
||||
\pgfutil@namedef{pgfplots@colspace@max@wave@0}{814}%
|
||||
|
||||
\def\pgfplots@colspace@numcomp@Hsb{3}%
|
||||
\def\pgfplots@colspace@name@Hsb{Hsb}%
|
||||
\pgfutil@namedef{pgfplots@colspace@minaccept@Hsb@0}{-0.001}%
|
||||
\pgfutil@namedef{pgfplots@colspace@min@Hsb@0}{0}%
|
||||
\pgfutil@namedef{pgfplots@colspace@maxaccept@Hsb@0}{\rangeHsb}%
|
||||
\pgfutil@namedef{pgfplots@colspace@max@Hsb@0}{\rangeHsb}%
|
||||
|
||||
\def\pgfplotscolornormalizesequencenext@prepare@loop#1,{%
|
||||
\def\pgfmathresult{#1}%
|
||||
\ifx\pgfmathresult\pgfplots@EOI
|
||||
\else
|
||||
\begingroup
|
||||
\pgfkeyslet{/pgf/fpu/handlers/invalid number/.@cmd}\pgfplotscolornormalizesequencenextbycomponents@parsenumber@error
|
||||
\expandafter\pgfplotscolornormalizesequencenext@every@component\expandafter{\pgfmathresult}\pgfeov%
|
||||
\ifpgfplotscolor@colorspaceknown
|
||||
\expandafter\pgfplotscolornormalizesequencenextbycomponents@parsenumber\expandafter{\pgfmathresult}%
|
||||
\fi
|
||||
\pgfmath@smuggleone\pgfmathresult
|
||||
\endgroup
|
||||
\ifpgfplotscolor@colorspaceknown
|
||||
\expandafter\pgfplotscolornormalizesequencenextbycomponents@sanitize\expandafter{\pgfmathresult}%
|
||||
\fi
|
||||
\ifx\pgfplotsretval\pgfutil@empty
|
||||
\edef\pgfplotsretval{\pgfmathresult}%
|
||||
\else
|
||||
\edef\pgfplotsretval{\pgfplotsretval,\pgfmathresult}%
|
||||
\fi
|
||||
\advance\c@pgf@counta by1 %
|
||||
\expandafter\pgfplotscolornormalizesequencenext@prepare@loop
|
||||
\fi
|
||||
}
|
||||
|
||||
\def\pgfplotscolornormalizesequencenextbycomponents@parsenumber#1{%
|
||||
\pgfmathfloatparsenumber{#1}%
|
||||
\pgfmathfloattofixed\pgfmathresult
|
||||
}
|
||||
|
||||
\def\pgfplotscolornormalizesequencenextbycomponents@parsenumber@error#1#2\pgfeov{%
|
||||
\pgfplotsthrow{invalid color component}{\pgfmathresult}{Sorry, the color component value '#1' is no number. Did you mean 'color=#1'? The error occured near `\pgfplotscolornormalizesequence@context@message'}\pgfeov%
|
||||
\pgfmathfloatcreate{0}{0.0}{0}%
|
||||
}%
|
||||
|
||||
% #1 the color component value
|
||||
\def\pgfplotscolornormalizesequencenextbycomponents@sanitize#1{%
|
||||
\pgf@xa=#1pt %
|
||||
%
|
||||
% check if we have something like
|
||||
% \csname pgfplots@colspace@minaccept@<colorspace name>@2\endcsname where 2 is component index:
|
||||
\edef\pgfplots@loc@TMPc{@\pgfplotscolornormalizesequence@cur@colspace @\the\c@pgf@counta}%
|
||||
\pgfutil@ifundefined{pgfplots@colspace@minaccept\pgfplots@loc@TMPc}{%
|
||||
% NO - implicitly defined to [0,1]
|
||||
\def\pgfplots@colspace@minaccept@@{-0.001}%
|
||||
\def\pgfplots@colspace@min@@{-0.001}%
|
||||
\def\pgfplots@colspace@maxaccept@@{1.001}%
|
||||
\def\pgfplots@colspace@max@@{1}%
|
||||
}{%
|
||||
% YES - expect all four values:
|
||||
\edef\pgfplots@colspace@minaccept@@{\csname pgfplots@colspace@minaccept\pgfplots@loc@TMPc\endcsname}%
|
||||
\edef\pgfplots@colspace@min@@{\csname pgfplots@colspace@min\pgfplots@loc@TMPc\endcsname}%
|
||||
\edef\pgfplots@colspace@maxaccept@@{\csname pgfplots@colspace@maxaccept\pgfplots@loc@TMPc\endcsname}%
|
||||
\edef\pgfplots@colspace@max@@{\csname pgfplots@colspace@max\pgfplots@loc@TMPc\endcsname}%
|
||||
}%
|
||||
\ifdim\pgf@xa<\pgfplots@colspace@minaccept@@ pt %
|
||||
\edef\pgfmathresult{\pgfplots@colspace@min@@}%
|
||||
\pgfplotscolor@rangeexception{#1}%
|
||||
\else
|
||||
\ifdim\pgf@xa>\pgfplots@colspace@maxaccept@@ pt %
|
||||
\edef\pgfmathresult{\pgfplots@colspace@max@@}%
|
||||
\pgfplotscolor@rangeexception{#1}%
|
||||
\else
|
||||
% Ah - the common case!
|
||||
\edef\pgfmathresult{\pgf@sys@tonumber\pgf@xa}% normalize number (strip trailing zeros etc).
|
||||
\fi
|
||||
\fi
|
||||
}
|
||||
|
||||
\def\pgfplotscolor@rangeexception#1{%
|
||||
\pgfplotsthrow{invalid color component}{\pgfmathresult}{Sorry, the color component value #1 (no. \the\c@pgf@counta) is out of range. The allowed range is 0 <= value <= 1. The error occured near `\pgfplotscolornormalizesequence@context@message'}\pgfeov%
|
||||
}
|
||||
|
||||
|
||||
% Same as \pgfplotscolornormalizesequencenextbycomponents but with
|
||||
% more freedom in the input.
|
||||
%
|
||||
% #1 some color.
|
||||
% Accepted formats:
|
||||
% 'color=<xcolor value>'
|
||||
% <xcolor value> is any valid expression of the xcolor package.
|
||||
%
|
||||
% 'rgb=R,G,B'
|
||||
% R,G,B are numbers in [0,1]
|
||||
%
|
||||
% 'rgb255=R,G,B'
|
||||
% R,G,B are numbers in [0,255]
|
||||
%
|
||||
% 'cmyk=C,M,Y,K'
|
||||
% C, M, Y, and K are numbers in [0,1]
|
||||
%
|
||||
% 'cmyk255=C,M,Y,K'
|
||||
% C, M, Y, and K are numbers in [0,255]
|
||||
%
|
||||
% 'gray=G'
|
||||
% G is a gray scale number in [0,1]
|
||||
%
|
||||
% 'C1,C2,C3'
|
||||
% any number of Ci can folow, each is interpreted in the default
|
||||
% colorspace (i.e. the one set before at the beginning of the
|
||||
% sequence)
|
||||
%
|
||||
%
|
||||
% Example:
|
||||
% \pgfplotscolornormalizesequencenext{color=blue}
|
||||
% \pgfplotscolornormalizesequencenext{rgb=1,0,0}
|
||||
% \pgfplotscolornormalizesequencenext{cmyk=1,0,0,1}
|
||||
% \pgfplotscolornormalizesequencenext{1,0,0} (interpreted in the
|
||||
% colorspace set at \pgfplotscolornormalizesequence)
|
||||
%
|
||||
% POSTCONDITION: see \pgfplotscolornormalizesequencenextbycomponents
|
||||
\def\pgfplotscolornormalizesequencenext#1{%
|
||||
\edef\pgfplotscolornormalizesequence@context@message@default{#1}%
|
||||
\expandafter\pgfplotscolornormalizesequencenext@\pgfplotscolornormalizesequence@context@message@default\pgfplots@EOI
|
||||
}
|
||||
\def\pgfplotscolornormalizesequencenext@{%
|
||||
\pgfutil@ifnextchar c{%
|
||||
\pgfplotscolornormalizesequencenext@c
|
||||
}{%
|
||||
\pgfutil@ifnextchar r{%
|
||||
\pgfplotscolornormalizesequencenext@rgb
|
||||
}{%
|
||||
\pgfutil@ifnextchar g{%
|
||||
\pgfplotscolornormalizesequencenext@gray
|
||||
}{%
|
||||
\pgfplotscolornormalizesequencenext@defaultcolspace
|
||||
}%
|
||||
}%
|
||||
}%
|
||||
}
|
||||
|
||||
\def\pgfplotscolornormalizesequencenext@gray gray=#1\pgfplots@EOI{%
|
||||
% FIXME : we might be better off with real support for a gray
|
||||
% colorspace!
|
||||
\pgfplotscolornormalizesequencenextbycomponents{rgb}{#1,#1,#1}%
|
||||
}
|
||||
|
||||
\def\pgfplotscolornormalizesequencenext@defaultcolspace#1\pgfplots@EOI{%
|
||||
\edef\pgfplotsretval{#1}%
|
||||
\ifx\pgfplotsretval\pgfutil@empty
|
||||
% hm. Ok, simply return the empty input.
|
||||
%
|
||||
% ... and the number of components.
|
||||
\pgfplotscolor@get@num@components{\pgfplotscolornormalizesequence@colspace}{\pgfplotsretvalb}%
|
||||
%
|
||||
\else
|
||||
\expandafter\pgfutil@in@\expandafter=\expandafter{\pgfplotsretval}%
|
||||
\ifpgfutil@in@
|
||||
\expandafter\pgfplotscolornormalizesequencenext@unknown@colspace\pgfplotsretval\pgfplots@EOI
|
||||
\else
|
||||
\ifx\pgfplotscolornormalizesequence@colspace@input\pgfutil@empty
|
||||
\pgfplotsthrow{invalid argument}{\pgfplots@loc@TMPa}{The input color #1 cannot be interpreted; please assign a default color space first}\pgfeov%
|
||||
\fi
|
||||
\pgfplotscolornormalizesequencenextbycomponents{\pgfplotscolornormalizesequence@colspace@input}{#1}%
|
||||
\fi
|
||||
\fi
|
||||
}
|
||||
|
||||
\def\pgfplotscolornormalizesequencenext@unknown@colspace#1=#2\pgfplots@EOI{%
|
||||
\pgfplotscolornormalizesequencenextbycomponents{#1}{#2}%
|
||||
}
|
||||
|
||||
\def\pgfplotscolornormalizesequencenext@rgb rgb{%
|
||||
\pgfutil@ifnextchar2{%
|
||||
\pgfplotscolornormalizesequencenext@rgb@two@five@five
|
||||
}{%
|
||||
\pgfplotscolornormalizesequencenext@rgb@plain
|
||||
}%
|
||||
}
|
||||
\def\pgfplotscolornormalizesequencenext@rgb@plain=#1\pgfplots@EOI{%
|
||||
\pgfplotscolornormalizesequencenextbycomponents{rgb}{#1}%
|
||||
}
|
||||
|
||||
\def\pgfplotscolorsequence@two@five@five@rescale#1{%
|
||||
\pgfmath@basic@multiply@{0.003921568}{#1}%
|
||||
}%
|
||||
\def\pgfplotscolornormalizesequencenext@rgb@two@five@five255=#1,#2,#3\pgfplots@EOI{%
|
||||
\pgfplotscolorsequence@two@five@five@rescale{#1}%
|
||||
\let\pgfplots@loc@TMPa=\pgfmathresult
|
||||
\pgfplotscolorsequence@two@five@five@rescale{#2}%
|
||||
\let\pgfplots@loc@TMPb=\pgfmathresult
|
||||
\pgfplotscolorsequence@two@five@five@rescale{#3}%
|
||||
\edef\pgfplots@loc@TMPc{{rgb}{\pgfplots@loc@TMPa,\pgfplots@loc@TMPb,\pgfmathresult}}%
|
||||
\expandafter\pgfplotscolornormalizesequencenextbycomponents\pgfplots@loc@TMPc%
|
||||
}
|
||||
|
||||
\def\pgfplotscolornormalizesequencenext@c c{%
|
||||
\pgfutil@ifnextchar m{%
|
||||
\pgfplotscolornormalizesequencenext@cmyk
|
||||
}{%
|
||||
\pgfplotscolornormalizesequencenext@color
|
||||
}%
|
||||
}%
|
||||
|
||||
\def\pgfplotscolornormalizesequencenext@cmyk myk{%
|
||||
\pgfutil@ifnextchar2{%
|
||||
\pgfplotscolornormalizesequencenext@cmyk@two@five@five
|
||||
}{%
|
||||
\pgfplotscolornormalizesequencenext@cmyk@plain
|
||||
}%
|
||||
}%
|
||||
|
||||
\def\pgfplotscolornormalizesequencenext@cmyk@plain=#1\pgfplots@EOI{%
|
||||
\pgfplotscolornormalizesequencenextbycomponents{cmyk}{#1}%
|
||||
}%
|
||||
\def\pgfplotscolornormalizesequencenext@cmyk@two@five@five255=#1,#2,#3,#4\pgfplots@EOI{%
|
||||
\pgfplotscolorsequence@two@five@five@rescale{#1}%
|
||||
\let\pgfplots@loc@TMPa=\pgfmathresult
|
||||
\pgfplotscolorsequence@two@five@five@rescale{#2}%
|
||||
\let\pgfplots@loc@TMPb=\pgfmathresult
|
||||
\pgfplotscolorsequence@two@five@five@rescale{#3}%
|
||||
\let\pgfplots@loc@TMPc=\pgfmathresult
|
||||
\pgfplotscolorsequence@two@five@five@rescale{#4}%
|
||||
\edef\pgfplots@loc@TMPc{{cmyk}{\pgfplots@loc@TMPa,\pgfplots@loc@TMPb,\pgfplots@loc@TMPc,\pgfmathresult}}%
|
||||
\expandafter\pgfplotscolornormalizesequencenextbycomponents\pgfplots@loc@TMPc%
|
||||
}
|
||||
|
||||
% The implementation of \pgfutil@extractcolorspec for plain tex and
|
||||
% context is ... strange. I prefer one which does the same as the
|
||||
% xcolor version (which is also what pgf does for latex):
|
||||
\def\pgfplotsutil@extractcolorspec@xcolor@substitute#1#2{%
|
||||
\begingroup
|
||||
% this here relies on PGF's emulation of color in plain tex and
|
||||
% context. Let's hope it works in the future...
|
||||
\def\xcolor@##1##2##3##4{%
|
||||
\edef#2{{##3}{##4}}%
|
||||
}%
|
||||
\csname\string\color@#1\endcsname
|
||||
\global\let\pgfutil@extractcolorspec@@temp=#2%
|
||||
\endgroup
|
||||
\let#2=\pgfutil@extractcolorspec@@temp
|
||||
}%
|
||||
|
||||
\def\pgfplots@glob@TMPa#1#2{%
|
||||
\def#2{{#1}}%
|
||||
}%
|
||||
|
||||
\pgfutil@IfUndefined{extractcolorspec}{%
|
||||
% Ah. We do not have a suitable implementation of
|
||||
% \extractcolorspec -- \pgfutil@extractcolorspec does not yield
|
||||
% the colorspec on context and plain tex.
|
||||
\def\pgfplotsutil@extractcolorspec{\pgfplotsutil@extractcolorspec@xcolor@substitute}%
|
||||
}{%
|
||||
\ifx\extractcolorspec\pgfplots@glob@TMPa
|
||||
% Same problem as above: pgfutil-plain.def says
|
||||
% \let\extractcolorspec=\pgfutil@extractcolorspec and that one
|
||||
% is broken.
|
||||
% Use my substitute:
|
||||
\def\pgfplotsutil@extractcolorspec{\pgfplotsutil@extractcolorspec@xcolor@substitute}%
|
||||
\else
|
||||
\def\pgfplotsutil@extractcolorspec{\extractcolorspec}%
|
||||
\fi
|
||||
}%
|
||||
|
||||
\def\pgfplotscolornormalizesequencenext@color olor=#1\pgfplots@EOI{%
|
||||
\pgfutil@colorlet{pgf@tempcol}{#1}%
|
||||
\pgfplotsutil@extractcolorspec{pgf@tempcol}{\pgf@tempcolor}%
|
||||
\edef\pgfplots@loc@TMPa{\expandafter\pgfutil@firstoftwo\pgf@tempcolor}%
|
||||
\edef\pgfplots@loc@TMPb{\expandafter\pgfutil@secondoftwo\pgf@tempcolor}%
|
||||
%
|
||||
% I expect that \pgf@tempcolor is of the form
|
||||
% {<colorspace>}{<comma-separated components>}
|
||||
%
|
||||
% unfortunately, the <colorspace> has strange catcodes such that
|
||||
% we cannot easily compare it by means of \ifx. I normalize it
|
||||
% here:
|
||||
\pgfutil@ifundefined{pgfplots@colspace@name@\pgfplots@loc@TMPa}{%
|
||||
% ohoh. we cannot normalize the name. Let's hope that works out.
|
||||
% note that we cannot throw an exception here as we might very well be able
|
||||
% to convert the color to some suitable color space!
|
||||
}{%
|
||||
\edef\pgfplots@loc@TMPa{%
|
||||
\csname pgfplots@colspace@name@\pgfplots@loc@TMPa\endcsname%
|
||||
}%
|
||||
}%
|
||||
\edef\pgf@tempcolor{%
|
||||
{\pgfplots@loc@TMPa}%
|
||||
{\pgfplots@loc@TMPb}%
|
||||
}%
|
||||
\expandafter\pgfplotscolornormalizesequencenextbycomponents\pgf@tempcolor%
|
||||
%
|
||||
}%
|
||||
|
||||
% Defines \pgfplotsretval to be a "neutral" color, i.e. one in which
|
||||
% all components are zero.
|
||||
% @see \pgfplotscolorzero
|
||||
% @see \pgfplotscoloraddweighted
|
||||
\def\pgfplotscolornormalizesequencezero{%
|
||||
\pgfplotscolornormalizesequencegetnumcomponents
|
||||
\pgfplotscolorzero{\pgfplotsretval}%
|
||||
}
|
||||
|
||||
% Defines \pgfplotsretval to be a "neutral" color, i.e. one in which
|
||||
% all components are zero.
|
||||
%
|
||||
% #1: the number of color components to be used (like 3 for rgb)
|
||||
% @see \pgfplotscoloraddweighted
|
||||
\def\pgfplotscolorzero#1{%
|
||||
\csname pgfplotscolorzero@num@#1\endcsname
|
||||
}%
|
||||
|
||||
\expandafter\def\csname pgfplotscolorzero@num@1\endcsname{\def\pgfplotsretval{0}}
|
||||
\expandafter\def\csname pgfplotscolorzero@num@2\endcsname{\def\pgfplotsretval{0,0}}
|
||||
\expandafter\def\csname pgfplotscolorzero@num@3\endcsname{\def\pgfplotsretval{0,0,0}}
|
||||
\expandafter\def\csname pgfplotscolorzero@num@4\endcsname{\def\pgfplotsretval{0,0,0,0}}
|
||||
|
||||
% Defines \pgfplotsretval to be the interpolated color #1 + #2*#3.
|
||||
% #1 the first color (like 0,0,0)
|
||||
% #2 a scaling factor (like 4)
|
||||
% #3 the second color (like 1,0,0.5)
|
||||
%
|
||||
% POSTCONDITION: \pgfplotsretval contains the result
|
||||
%
|
||||
% @see \pgfplotscolorzero
|
||||
% @see \pgfplotscoloraddweighted
|
||||
\def\pgfplotscolornormalizesequenceaddweighted#1#2#3{%
|
||||
\begingroup
|
||||
\pgfplotscolornormalizesequencegetnumcomponents
|
||||
\global\let\pgfplots@glob@TMPd\pgfplotsretval
|
||||
\endgroup
|
||||
\pgfplotscoloraddweighted{\pgfplots@glob@TMPd}{#1}{#2}{#3}%
|
||||
}
|
||||
|
||||
% Defines \pgfplotsretval to be the interpolated color #2 + #3*#4.
|
||||
% #1 the number of color components to be used (3 for rgb)
|
||||
% #2 the first color (like 0,0,0)
|
||||
% #3 a scaling factor (like 4)
|
||||
% #4 the second color (like 1,0,0.5)
|
||||
%
|
||||
% POSTCONDITION: \pgfplotsretval contains the result
|
||||
%
|
||||
% @see \pgfplotscolorzero
|
||||
\def\pgfplotscoloraddweighted#1#2#3#4{%
|
||||
\pgfplots@ifempty{#4}{%
|
||||
\pgfplots@error{Illegal input argument encountered while computing colors:
|
||||
one color argument is missing (was empty). Please ensure that you have explicit color values in your input}%
|
||||
}{%
|
||||
\expandafter\let
|
||||
\expandafter\pgfplots@loc@TMPb\csname pgfplotscolornormalizesequencegetnumcomponents@#1\endcsname
|
||||
\edef\pgfplots@loc@TMPa{#2:#4\noexpand\relax{#3}}%
|
||||
\expandafter\pgfplots@loc@TMPb\pgfplots@loc@TMPa%
|
||||
}%
|
||||
}%
|
||||
|
||||
\def\pgfplotscolornormalizesequenceaddweighted@single#1#2#3{%
|
||||
\pgf@xa=#1pt %
|
||||
\pgf@xb=#3pt %
|
||||
\advance\pgf@xa by#2\pgf@xb
|
||||
\edef\pgfplotsretval{\pgf@sys@tonumber\pgf@xa}%
|
||||
}%
|
||||
|
||||
\expandafter\def\csname pgfplotscolornormalizesequencegetnumcomponents@1\endcsname#1:#2\relax#3{%
|
||||
\pgfplotscolornormalizesequenceaddweighted@single{#1}{#3}{#2}%
|
||||
}%
|
||||
\expandafter\def\csname pgfplotscolornormalizesequencegetnumcomponents@3\endcsname#1,#2,#3:#4,#5,#6\relax#7{%
|
||||
\pgfplotscolornormalizesequenceaddweighted@single{#1}{#7}{#4}%
|
||||
\let\pgfplots@loc@TMPa=\pgfplotsretval
|
||||
\pgfplotscolornormalizesequenceaddweighted@single{#2}{#7}{#5}%
|
||||
\let\pgfplots@loc@TMPb=\pgfplotsretval
|
||||
\pgfplotscolornormalizesequenceaddweighted@single{#3}{#7}{#6}%
|
||||
\let\pgfplots@loc@TMPc=\pgfplotsretval
|
||||
\edef\pgfplotsretval{\pgfplots@loc@TMPa,\pgfplots@loc@TMPb,\pgfplots@loc@TMPc}%
|
||||
}%
|
||||
\expandafter\def\csname pgfplotscolornormalizesequencegetnumcomponents@4\endcsname#1,#2,#3,#4:#5,#6,#7,#8\relax#9{%
|
||||
\pgfplotscolornormalizesequenceaddweighted@single{#1}{#9}{#5}%
|
||||
\let\pgfplots@loc@TMPa=\pgfplotsretval
|
||||
\pgfplotscolornormalizesequenceaddweighted@single{#2}{#9}{#6}%
|
||||
\let\pgfplots@loc@TMPb=\pgfplotsretval
|
||||
\pgfplotscolornormalizesequenceaddweighted@single{#3}{#9}{#7}%
|
||||
\let\pgfplots@loc@TMPc=\pgfplotsretval
|
||||
\pgfplotscolornormalizesequenceaddweighted@single{#4}{#9}{#8}%
|
||||
\let\pgfplots@loc@TMPd=\pgfplotsretval
|
||||
\edef\pgfplotsretval{\pgfplots@loc@TMPa,\pgfplots@loc@TMPb,\pgfplots@loc@TMPc,\pgfplots@loc@TMPd}%
|
||||
}%
|
||||
|
||||
\endinput
|
759
texmf/tex/latex/pgfplots/tex/pgfplotscolormap.code.tex
Normal file
759
texmf/tex/latex/pgfplots/tex/pgfplotscolormap.code.tex
Normal file
|
@ -0,0 +1,759 @@
|
|||
%--------------------------------------------
|
||||
% $Header: /cvsroot/pgfplots/pgfplots/generic/pgfplots/util/pgfplotscolormap.code.tex,v 1.15 2009/07/21 18:18:48 ludewich Exp $
|
||||
%
|
||||
% Package pgfplots
|
||||
%
|
||||
% 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-2013 by Christian Feuersänger.
|
||||
%
|
||||
% This program is free software: you can redistribute it and/or modify
|
||||
% 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/>.
|
||||
%
|
||||
%--------------------------------------------
|
||||
|
||||
\input pgfplotscolor.code.tex
|
||||
|
||||
\pgfkeyssetvalue{/pgfplots/colormap default colorspace}{auto}
|
||||
|
||||
% This package relies on pgfplots temporary registers and its array
|
||||
% data structure.
|
||||
|
||||
% Internal structure:
|
||||
% the colormap data structure consists of
|
||||
% - an array 'pgfpl@cm@#1' of RGB color triples,
|
||||
% - numbers 'pgfpl@cm@#1@h' and 'pgfpl@cm@#1@invh' for the mesh width
|
||||
% and inverse mesh width.
|
||||
|
||||
% Creates a new colormap.
|
||||
%
|
||||
% #1 : the name of the color map as string (not as macro).
|
||||
% #2 : a <color specification> as is expected for a shading spec of
|
||||
% pgf. However, the format allows a little bit more freedom:
|
||||
% - it supports 'rgb255' in addition to pgf,
|
||||
% - the length is not required (defaults to 1cm for the first and to
|
||||
% the last length+h for all others).
|
||||
% - the semicolons can be omitted.
|
||||
%
|
||||
% Example:
|
||||
% \pgfplotscreatecolormap{my map}{rgb(0cm)=(1,0,0); rgb(1cm)=(0,1,0); rgb255(1.5cm)=(128,5,255); rgb(2cm)=(0,0,1); gray(3cm)=(3); color(4cm)=(green); }
|
||||
% \pgfplotscreatecolormap{my map}{color=(green); color=(red); color=(blue); color=(yellow)}
|
||||
\def\pgfplotscreatecolormap#{\pgfplots@createcolormap}%
|
||||
\def\pgfplots@createcolormap#1#2{%
|
||||
\edef\pgfplots@createcolormap@name{pgfpl@cm@#1}%
|
||||
\expandafter\pgfplotsarraynewempty\expandafter{\pgfplots@createcolormap@name}%
|
||||
\def\pgfplots@createcolormap@MIN{0}% NORMALIZATION: assume that lower-end is 0pt.
|
||||
\def\pgfplots@createcolormap@MAX{0}% To be computed.
|
||||
\pgfplots@createcolormap@initcolorspace
|
||||
\let\pgfplots@createcolormap@LAST=\pgfplots@createcolormap@MIN
|
||||
% PARSE IT:
|
||||
\edef\pgfplots@loc@TMPa{#2}%
|
||||
\let\pgfplots@createcolormap@context=\pgfutil@empty
|
||||
% this does also init @H:
|
||||
\expandafter\pgfplots@createcolormap@startloop\pgfplots@loc@TMPa\pgfplots@EOI
|
||||
\expandafter\pgfplotsarraycheckempty\expandafter{\pgfplots@createcolormap@name}%
|
||||
% sanity checking:
|
||||
\expandafter\pgfplotsarraysizetomacro\expandafter{\pgfplots@createcolormap@name}\to\pgfplots@loc@TMPa
|
||||
\ifcase\pgfplots@loc@TMPa\relax
|
||||
\pgfplots@error{Sorry, you need to provide at least two points of a colormap.}%
|
||||
\or
|
||||
\pgfplots@error{Sorry, you need to provide at least two points of a colormap.}%
|
||||
\fi
|
||||
% Map the input range [0pt,MAX] linearly to [0,1000]
|
||||
\pgfmathdivide@{\pgfplotscolormaprange}{\pgfplots@createcolormap@MAX}%
|
||||
\let\pgfplots@loc@TMPb=\pgfmathresult
|
||||
\pgfmathmultiply@{\pgfplots@loc@TMPb}{\pgfplots@createcolormap@H}%
|
||||
\let\pgfplots@createcolormap@H=\pgfmathresult
|
||||
\expandafter\let\csname\pgfplots@createcolormap@name @h\endcsname=\pgfplots@createcolormap@H
|
||||
\pgfmathreciprocal@{\pgfplots@createcolormap@H}%
|
||||
\expandafter\let\csname\pgfplots@createcolormap@name @invh\endcsname=\pgfmathresult
|
||||
%
|
||||
\endpgfplotscolornormalizesequence%
|
||||
\expandafter\let\csname\pgfplots@createcolormap@name @colspace\endcsname=\pgfplotsretval
|
||||
\expandafter\let\csname\pgfplots@createcolormap@name @col@comps\endcsname=\pgfplotsretvalb
|
||||
%\pgfplots@colormap@showdebuginfofor{#1}%
|
||||
}
|
||||
|
||||
|
||||
\def\pgfplots@createcolormap@initcolorspace{%
|
||||
\pgfplotscolornormalizesequence[
|
||||
colorspace=\pgfkeysvalueof{/pgfplots/colormap default colorspace},
|
||||
context message=\pgfplots@createcolormap@context,
|
||||
]%
|
||||
}%
|
||||
\def\pgfplots@createcolormap@seth[#1]{%
|
||||
\def\pgfplots@createcolormap@context{[#1]}%
|
||||
\pgfmathparse{#1}%
|
||||
\let\pgfplots@createcolormap@H=\pgfmathresult
|
||||
\pgfplots@createcolormap@
|
||||
}%
|
||||
|
||||
\def\pgfplots@createcolormap@startloop{%
|
||||
\pgfutil@ifnextchar[%
|
||||
{\pgfplots@createcolormap@seth}%
|
||||
{%
|
||||
\let\pgfplots@createcolormap@H=\pgfutil@empty
|
||||
\pgfplots@createcolormap@
|
||||
}%
|
||||
}%
|
||||
\def\pgfplots@createcolormap@{%
|
||||
\pgfutil@ifnextchar\pgfplots@EOI{\pgfutil@gobble}%done!
|
||||
{%
|
||||
\pgfutil@ifnextchar;{\pgfplots@createcolormap@grabsemicolon}%
|
||||
{%
|
||||
\expandafter\pgfutil@ifnextchar\pgfplots@activesemicolon{\pgfplots@createcolormap@grabsemicolon@active}%
|
||||
{%
|
||||
\pgfplots@createcolormap@grabnext
|
||||
}%
|
||||
}%
|
||||
}%
|
||||
}
|
||||
\def\pgfplots@createcolormap@error#1#2\pgfplots@EOI{%
|
||||
{%
|
||||
\t@pgfplots@toka={#1#2}%
|
||||
\t@pgfplots@tokb={#1}%
|
||||
\pgfplots@error{Illformed colormap specification: I could not read the substring `\the\t@pgfplots@toka' starting at `\the\t@pgfplots@tokb'}%
|
||||
}%
|
||||
}%
|
||||
|
||||
\def\pgfplots@createcolormap@grabnext#1({%
|
||||
\pgfplots@createcolormap@grabnext@{#1}%
|
||||
}
|
||||
\def\pgfplots@createcolormap@grabnext@#1#2){%
|
||||
\pgfutil@in@={#1}%
|
||||
\ifpgfutil@in@
|
||||
% Ah. we do not have a position, i.e. we have
|
||||
% color=(green)
|
||||
% or something like this.
|
||||
%
|
||||
% this here defines \pgfplots@loc@TMPa to contain the
|
||||
% colorspace:
|
||||
\pgfplots@createcolormap@grabnext@remove@equal@sign#1\pgfplots@EOI
|
||||
%
|
||||
\pgfplots@createcolormap@grabnext@computenextposition
|
||||
\let\pgfplots@loc@TMPb=\pgfmathresult% posisiton
|
||||
\def\pgfplots@loc@TMPc{#2}% color data
|
||||
\let\pgfplots@loc@TMPd=\pgfplots@createcolormap@grabnext@complete
|
||||
\else
|
||||
% Ah. We have something like 'color(1cm)' and we did not see
|
||||
% the equal sign so far.
|
||||
\def\pgfplots@loc@TMPa{#1}% colorspace
|
||||
\def\pgfplots@loc@TMPb{#2}% position
|
||||
%
|
||||
% and collect the color data:
|
||||
\def\pgfplots@loc@TMPd{%
|
||||
\pgfutil@ifnextchar={%
|
||||
\pgfplots@createcolormap@grabnext@@
|
||||
}{%
|
||||
\pgfplots@createcolormap@error#1(#2)%
|
||||
}%
|
||||
}%
|
||||
\fi
|
||||
\pgfplots@loc@TMPd
|
||||
}%
|
||||
|
||||
\def\pgfplots@createcolormap@grabnext@remove@equal@sign#1=#2\pgfplots@EOI{%
|
||||
\def\pgfplots@loc@TMPa{#1}%
|
||||
%
|
||||
% FIXME : what if #2 is not empty!?
|
||||
}%
|
||||
|
||||
\def\pgfplots@createcolormap@grabnext@@={%
|
||||
\pgfutil@ifnextchar({%
|
||||
\pgfplots@createcolormap@grabnext@@@
|
||||
}{%
|
||||
\pgfplots@createcolormap@error=%
|
||||
}%
|
||||
}%
|
||||
\def\pgfplots@createcolormap@grabnext@@@(#1){%
|
||||
\def\pgfplots@loc@TMPc{#1}%
|
||||
\pgfplots@createcolormap@grabnext@complete
|
||||
}%
|
||||
|
||||
\def\pgfplots@createcolormap@grabnext@complete{%
|
||||
\edef\pgfplots@loc@TMPa{%
|
||||
{\pgfplots@loc@TMPb}% position
|
||||
{%
|
||||
\pgfplots@loc@TMPa% colorspace
|
||||
=\pgfplots@loc@TMPc% color data
|
||||
}%
|
||||
}%
|
||||
\expandafter\pgfplots@createcolormap@nextcolor\pgfplots@loc@TMPa
|
||||
%
|
||||
% continue loop:
|
||||
\pgfplots@createcolormap@
|
||||
}%
|
||||
|
||||
\def\pgfplots@createcolormap@grabnext@computenextposition{%
|
||||
% determine next step size automatically:
|
||||
\expandafter\pgfplotsarraycheckempty\expandafter{\pgfplots@createcolormap@name}%
|
||||
\ifpgfplotsarrayempty
|
||||
% first: must be at 0.
|
||||
\def\pgfmathresult{0sp}%
|
||||
\else
|
||||
% not first:
|
||||
\ifx\pgfplots@createcolormap@H\pgfutil@empty
|
||||
% ah; we really have to deduce something. We are at the
|
||||
% second node:
|
||||
\def\pgfmathresult{1cm}%
|
||||
\else
|
||||
\pgfmathadd@\pgfplots@createcolormap@LAST\pgfplots@createcolormap@H
|
||||
\fi
|
||||
\fi
|
||||
}%
|
||||
|
||||
\def\pgfplots@createcolormap@grabsemicolon;{\pgfplots@createcolormap@}%
|
||||
|
||||
{
|
||||
\catcode`\;=13
|
||||
\gdef\pgfplots@createcolormap@grabsemicolon@active;{\pgfplots@createcolormap@}%
|
||||
}
|
||||
|
||||
\def\pgfplots@createcolormap@nextcolor@tostring#1=#2\pgfplots@EOI#3{%
|
||||
#1(#3)=(#2)%
|
||||
}%
|
||||
|
||||
% #1: h
|
||||
% #2: a compound element of the form
|
||||
% '<colorspace>=<comma-separated-color-components>'
|
||||
% The format is chosen such that it can be forwarded directly to
|
||||
% \pgfplotscolornormalizesequencenext
|
||||
%
|
||||
% see \pgfplotscolornormalizesequencenext for details
|
||||
\def\pgfplots@createcolormap@nextcolor#1#2{%
|
||||
\def\pgfplots@createcolormap@context{\pgfplots@createcolormap@nextcolor@tostring#2\pgfplots@EOI{#1}}%
|
||||
%
|
||||
\pgfplotscolornormalizesequencenext{#2}%
|
||||
\let\pgfplots@createcolormap@col@comps=\pgfplotsretvalb
|
||||
%
|
||||
\edef\pgfplots@loc@TMPa{{#1}{\pgfplotsretval}}%
|
||||
\expandafter\pgfplots@createcolormap@nextcolor@\pgfplots@loc@TMPa%
|
||||
}%
|
||||
\def\pgfplots@createcolormap@nextcolor@#1#2{%
|
||||
%\message{processing color #1=(#2)^^J}%
|
||||
% compute 'h':
|
||||
\pgfmathparse{#1}%
|
||||
\let\pgfplots@createcolormap@MAX=\pgfmathresult
|
||||
\expandafter\pgfmathsubtract@\expandafter{\pgfmathresult}{\pgfplots@createcolormap@LAST}%
|
||||
\let\pgfplots@createcolormap@H@cur=\pgfmathresult
|
||||
%\message{found current diff = \pgfplots@createcolormap@H@cur\ ( from \pgfplots@createcolormap@MAX pt - \pgfplots@createcolormap@LAST pt)^^J}%
|
||||
\let\pgfplots@createcolormap@LAST=\pgfplots@createcolormap@MAX
|
||||
\ifx\pgfplots@createcolormap@H\pgfutil@empty
|
||||
\expandafter\pgfplotsarraycheckempty\expandafter{\pgfplots@createcolormap@name}%
|
||||
\ifpgfplotsarrayempty
|
||||
\ifdim\pgfplots@createcolormap@MAX pt=0pt
|
||||
\else
|
||||
\pgfplots@error{Sorry, the left end of a colormap (at 0pt) must be provided explicitly. You cannot start with \pgfplots@createcolormap@MAX pt. The error occured near `\pgfplots@createcolormap@context'}%
|
||||
\def\pgfplots@createcolormap@MAX{0}%
|
||||
\fi
|
||||
\else
|
||||
\let\pgfplots@createcolormap@H=\pgfplots@createcolormap@H@cur
|
||||
%\message{H := \pgfplots@createcolormap@H( from #1).}%
|
||||
\fi
|
||||
\else
|
||||
\pgfmathapproxequalto@{\pgfplots@createcolormap@H}{\pgfplots@createcolormap@H@cur}%
|
||||
\ifpgfmathcomparison
|
||||
\else
|
||||
\pgfmathdivide@{\pgfplots@createcolormap@H@cur}{\pgfplots@createcolormap@H}%
|
||||
% after this group, \pgfmathresult is
|
||||
% - empty if no reinterpolation is possible,
|
||||
% - non-empty if reinterpolation IS possible. In this
|
||||
% case, it contains the integer multiple of H.
|
||||
\begingroup
|
||||
\afterassignment\pgfplots@createcolormap@nextRGB@consider@reinterpolation
|
||||
\c@pgf@counta=\pgfmathresult\relax
|
||||
\pgfmath@smuggleone\pgfmathresult
|
||||
\endgroup
|
||||
\ifx\pgfmathresult\pgfutil@empty
|
||||
% I can't do that yet.
|
||||
\else
|
||||
\let\pgfplots@createcolormap@loop@end=\pgfmathresult
|
||||
% interpolate missing values using the already fixed H.
|
||||
% This interpolation procedure is stupid because it works
|
||||
% only in forward direction - but it works at least.
|
||||
% For the backwards direction, you can provide the
|
||||
% meshwidth explicitly at
|
||||
% \pgfplotscreatecolormap{}{[1pt]}
|
||||
\pgfplotsforeachungrouped \c@pgfplots@createcolormap in {1,2,...,\pgfplots@createcolormap@loop@end} {%
|
||||
\ifdim\c@pgfplots@createcolormap pt=\pgfplots@createcolormap@loop@end pt %
|
||||
% omit the last.
|
||||
\else
|
||||
\pgfmathparse{\c@pgfplots@createcolormap/\pgfplots@createcolormap@loop@end}%
|
||||
\let\pgfplots@createcolormap@scale@current=\pgfmathresult
|
||||
\pgfmathparse{1-\pgfplots@createcolormap@scale@current}%
|
||||
\let\pgfplots@createcolormap@scale@last=\pgfmathresult
|
||||
%
|
||||
\pgfplotscolornormalizesequencezero
|
||||
\pgfplotscolornormalizesequenceaddweighted
|
||||
{\pgfplotsretval}
|
||||
{\pgfplots@createcolormap@scale@current}
|
||||
{#2}%
|
||||
\pgfplotscolornormalizesequenceaddweighted
|
||||
{\pgfplotsretval}
|
||||
{\pgfplots@createcolormap@scale@last}
|
||||
{\pgfplots@createcolormap@last}%
|
||||
%
|
||||
%\message{interpolation step \c@pgfplots@createcolormap = \pgfplotsretval^^J}%
|
||||
\edef\pgfplots@loc@TMPa{%
|
||||
\noexpand\pgfplotsarraypushback{\pgfplotsretval}%
|
||||
\noexpand\to}%
|
||||
\expandafter\pgfplots@loc@TMPa\expandafter{\pgfplots@createcolormap@name}%
|
||||
\fi
|
||||
}%
|
||||
\fi
|
||||
\fi
|
||||
\fi
|
||||
\edef\pgfplots@loc@TMPa{\noexpand\pgfplotsarraypushback{#2}\noexpand\to}%
|
||||
\expandafter\pgfplots@loc@TMPa\expandafter{\pgfplots@createcolormap@name}%
|
||||
\edef\pgfplots@createcolormap@last{#2}%
|
||||
}%
|
||||
\def\pgfplots@createcolormap@nextRGB@consider@reinterpolation#1\relax{%
|
||||
\pgf@xa=#1pt
|
||||
\ifdim\pgf@xa>0.5pt % we have something like 99.995 or so.
|
||||
% round up and compute 1 - #1:
|
||||
\advance\c@pgf@counta by1
|
||||
\pgf@xa=1pt \advance\pgf@xa by-#1pt
|
||||
\fi
|
||||
%
|
||||
% compute relative error:
|
||||
\pgf@xb=\the\c@pgf@counta pt
|
||||
\divide\pgf@xb by10000
|
||||
%\message{Checking H/h = \pgfplots@createcolormap@H@cur pt/\pgfplots@createcolormap@H pt = \the\c@pgf@counta+-\pgf@sys@tonumber\pgf@xa\space: \the\pgf@xa > \the\pgf@xb\space (relative to \the\c@pgf@counta)?}%
|
||||
%
|
||||
\ifdim\pgf@xa>\pgf@xb
|
||||
\pgfplots@error{Sorry, non-uniform colormaps are only partially implemented, yet: the provided points must be multiples of the mesh width h=\pgfplots@createcolormap@H pt (but I found one with H/h = \pgfplots@createcolormap@H@cur pt/\pgfplots@createcolormap@H pt = \the\c@pgf@counta+-\pgf@sys@tonumber\pgf@xa\space which is no integer). Perhaps it helps to provide the mesh widths as argument as in {<name>}{[1cm] <color arguments>}? The error occured near `\pgfplots@createcolormap@context'}%
|
||||
\let\pgfmathresult=\pgfutil@empty
|
||||
\else
|
||||
\ifnum\c@pgf@counta=0
|
||||
\let\pgfmathresult=\pgfutil@empty
|
||||
\else
|
||||
\edef\pgfmathresult{\the\c@pgf@counta}%
|
||||
\fi
|
||||
\fi
|
||||
}%
|
||||
|
||||
% Shows debug info about colormap #1 into the console.
|
||||
\def\pgfplots@colormap@showdebuginfofor#1{%
|
||||
\message{Debug info for color map '#1':^^J}%
|
||||
\message{(Transformed) Range: [0:\pgfplotscolormaprange]; ^^J}%
|
||||
\message{H: \csname pgfpl@cm@#1@h\endcsname; ^^J}%
|
||||
\message{H:^{-1}: \csname pgfpl@cm@#1@invh\endcsname; ^^J}%
|
||||
\pgfplotsarraysizetomacro{pgfpl@cm@#1}\to\pgfplots@loc@TMPa
|
||||
\message{Size: \pgfplots@loc@TMPa; ^^J}%
|
||||
\message{Colorspace: \csname pgfpl@cm@#1@colspace\endcsname^^JValues (\csname pgfpl@cm@#1@col@comps\endcsname\space components each): ^^J}%
|
||||
\begingroup
|
||||
\c@pgf@counta=0
|
||||
\pgfplotsarrayforeachungrouped{pgfpl@cm@#1}\as\elem{%
|
||||
\message{\#\the\c@pgf@counta: \elem; }%
|
||||
\advance\c@pgf@counta by1
|
||||
}%
|
||||
\message{^^J}%
|
||||
\endgroup
|
||||
}
|
||||
|
||||
% Defines \pgfplotsretval to contain the mesh width of colormap #1
|
||||
\def\pgfplotscolormapgetmeshwidth#1{%
|
||||
\expandafter\let\expandafter\pgfplotsretval\csname pgfpl@cm@#1@h\endcsname%
|
||||
}%
|
||||
|
||||
% defines macro #2 to contain a serialized variant of the color
|
||||
% components (only the color components!)
|
||||
\def\pgfplotscolormapserializecomponentstomacro#1#2{%
|
||||
\pgfplotsapplistXnewempty\pgfplots@serialize@list@
|
||||
\pgfplotsarrayforeachungrouped{pgfpl@cm@#1}\as\elem{%
|
||||
\expandafter\pgfplotsapplistXpushback\expandafter{\elem},\to\pgfplots@serialize@list@
|
||||
}%
|
||||
\pgfplotsapplistXlet#2=\pgfplots@serialize@list@
|
||||
}%
|
||||
|
||||
% Copies the contents of the colormap named '#1' into a macro '#2'.
|
||||
% Invocation of the macro will then re-create the colormap.
|
||||
%
|
||||
% #1: color map name
|
||||
% #2: a macro name
|
||||
\def\pgfplotscolormapserializetomacro#1#2{%
|
||||
\begingroup
|
||||
\pgfplotscolormapserializecomponentstomacro{#1}\pgfplots@serialize@list
|
||||
\toks0={\expandafter\def\csname pgfpl@cm@#1@h\endcsname}%
|
||||
\toks1={\expandafter\def\csname pgfpl@cm@#1@invh\endcsname}%
|
||||
\toks2={%
|
||||
\pgfplotsarraynewempty{pgfpl@cm@#1}%
|
||||
\expandafter\pgfplotsutilforeachcommasep\pgfplots@loc@TMPa\as\pgfplots@loc@TMPb{%
|
||||
\ifx\pgfplots@loc@TMPb\pgfutil@empty
|
||||
\else
|
||||
\expandafter\pgfplotsarraypushback\pgfplots@loc@TMPb\to{pgfpl@cm@#1}%
|
||||
\fi
|
||||
}%
|
||||
}%
|
||||
\toks3=\expandafter{\pgfplots@serialize@list}%
|
||||
\toks4=\expandafter{\expandafter\def\csname pgfpl@cm@#1@colspace\endcsname}%
|
||||
\toks5=\expandafter{\expandafter\def\csname pgfpl@cm@#1@col@comps\endcsname}%
|
||||
\xdef\pgfplots@glob@TMPa{%
|
||||
\the\toks0 {\csname pgfpl@cm@#1@h\endcsname}%
|
||||
\the\toks1 {\csname pgfpl@cm@#1@invh\endcsname}%
|
||||
\noexpand\def\noexpand\pgfplots@loc@TMPa{\the\toks3 }%
|
||||
\the\toks2
|
||||
\the\toks4 {\csname pgfpl@cm@#1@colspace\endcsname}%
|
||||
\the\toks5 {\csname pgfpl@cm@#1@col@comps\endcsname}%
|
||||
}%
|
||||
\endgroup
|
||||
\let#2=\pgfplots@glob@TMPa
|
||||
}%
|
||||
|
||||
% this is a CONSTANT! Do NOT change it!
|
||||
% Just read it -- just in case \pgfplotscolormaptopdffunction will use
|
||||
% a different upper bound in the future.
|
||||
\def\pgfplotscolormappdfmax{1}%
|
||||
|
||||
% Writes a PDF function of /FunctionType 3 to \pgfplotsretval
|
||||
%
|
||||
% The /Domain argument will be set to [ 0 \pgfplotscolormappdfmax ] and bounds will be
|
||||
% computed accordingly.
|
||||
%
|
||||
% #1: the colormap
|
||||
\def\pgfplotscolormaptopdffunction#1{%
|
||||
\begingroup
|
||||
\gdef\pgfplotsretval{%
|
||||
<<
|
||||
/FunctionType 3
|
||||
/Domain [0 \pgfplotscolormappdfmax]
|
||||
% /Range [0 1 0 1 0 1] % INCOMPATIBLE WITH ACROBAT 6.0 !
|
||||
/Functions [
|
||||
}%
|
||||
\c@pgf@counta=0
|
||||
\c@pgf@countb=\pgfplotsarraysizeof{pgfpl@cm@#1} %
|
||||
\advance\c@pgf@countb by-1
|
||||
\def\pgfplots@loc@TMPa{}%
|
||||
\def\pgfplots@loc@TMPb{}%
|
||||
\def\pgfplots@loc@TMPc{}%
|
||||
\ifnum\csname pgfpl@cm@#1@col@comps\endcsname>4
|
||||
\pgfplots@error{Sorry, processing more than 4 color components (as required for color map #1) is unsupported in this context}%
|
||||
\fi
|
||||
\pgfplotsarrayforeachungrouped{pgfpl@cm@#1}\as\cdata{%
|
||||
\edef\cdata{%
|
||||
\expandafter
|
||||
\expandafter
|
||||
\csname pgfplotscolormaptopdffunction@convertcdata@\csname pgfpl@cm@#1@col@comps\endcsname\endcsname
|
||||
\cdata\relax
|
||||
}%
|
||||
\ifnum\c@pgf@counta>0
|
||||
\t@pgfplots@toka=\expandafter{\pgfplotsretval}%
|
||||
\xdef\pgfplotsretval{%
|
||||
\the\t@pgfplots@toka
|
||||
<<
|
||||
/FunctionType 2
|
||||
/Domain [0 \pgfplotscolormappdfmax]
|
||||
/C0 [\pgfplots@loc@TMPa] /C1 [\cdata] /N 1
|
||||
>>
|
||||
}%
|
||||
\ifnum\c@pgf@counta<\c@pgf@countb\relax
|
||||
\pgf@xa=\csname pgfpl@cm@#1@h\endcsname pt
|
||||
\multiply\pgf@xa by\c@pgf@counta\relax
|
||||
\divide\pgf@xa by1000 % we want [ 0 1 ] not [0 1000] as domain
|
||||
\edef\pgfplots@loc@TMPb{\pgfplots@loc@TMPb\space \pgf@sys@tonumber\pgf@xa}%
|
||||
\fi
|
||||
\edef\pgfplots@loc@TMPc{\pgfplots@loc@TMPc\space 0 1}%
|
||||
\fi
|
||||
\let\pgfplots@loc@TMPa=\cdata
|
||||
\advance\c@pgf@counta by1
|
||||
}%
|
||||
\t@pgfplots@toka=\expandafter{\pgfplotsretval}%
|
||||
\xdef\pgfplotsretval{%
|
||||
\the\t@pgfplots@toka
|
||||
]
|
||||
/Bounds [\pgfplots@loc@TMPb]
|
||||
/Encode [\pgfplots@loc@TMPc]
|
||||
>>
|
||||
}%
|
||||
\endgroup
|
||||
}%
|
||||
\expandafter\def\csname pgfplotscolormaptopdffunction@convertcdata@1\endcsname#1\relax{#1}%
|
||||
\expandafter\def\csname pgfplotscolormaptopdffunction@convertcdata@2\endcsname#1,#2\relax{#1 #2}%
|
||||
\expandafter\def\csname pgfplotscolormaptopdffunction@convertcdata@3\endcsname#1,#2,#3\relax{#1 #2 #3}%
|
||||
\expandafter\def\csname pgfplotscolormaptopdffunction@convertcdata@4\endcsname#1,#2,#3,#4\relax{#1 #2 #3 #4}%
|
||||
|
||||
% Invokes '#2' if a color map named '#1' exists and '#3' if no such color map exists.
|
||||
\def\pgfplotscolormapifdefined#1#2#3{\pgfplotsarrayifdefined{pgfpl@cm@#1}{#2}{#3}}%
|
||||
|
||||
\def\pgfplotscolormapassertexists#1{%
|
||||
\pgfplotscolormapifdefined{#1}{}{%
|
||||
\pgfutil@ifundefined{pgfplotscolormap@errorissued@#1}{%
|
||||
\pgfplots@error{The colormap `#1' is undefined! Maybe you misspelled it?}%
|
||||
}{}%
|
||||
\expandafter\gdef\csname pgfplotscolormap@errorissued@#1\endcsname{1}%
|
||||
\pgfplotscreatecolormap{#1}{color(0cm)=(blue); color(1cm)=(yellow)}%
|
||||
}%
|
||||
}
|
||||
|
||||
% Convert a colormap into a PGF shading's color specification for use
|
||||
% in \pgfdeclare*shading.
|
||||
%
|
||||
% #1: the colormap's name.
|
||||
% #2: the PGF "size" of the shading. It is used to set the right end
|
||||
% of the color specification.
|
||||
% #3: a macro which will be filled with the result.
|
||||
%
|
||||
% Example:
|
||||
% \pgfplotscolormaptoshadingspec{my colormap}{4cm}{\output}
|
||||
% \def\tempb{\pgfdeclarehorizontalshading{myshadingA}{1cm}}
|
||||
% \expandafter\tempb\expandafter{\temp}
|
||||
%
|
||||
% \pgfuseshading{myshadingA}
|
||||
\def\pgfplotscolormaptoshadingspec#1#2#3{%
|
||||
\pgfplotscolormapassertexists{#1}%
|
||||
\begingroup
|
||||
\def\pgfplots@rgb{rgb}%
|
||||
\pgfmathparse{#2}%
|
||||
\expandafter\pgfmathdivide@\expandafter{\pgfmathresult}{\pgfplotscolormaprange}%
|
||||
\let\pgfplots@loc@TMPb=\pgfmathresult
|
||||
\pgfmathmultiply@{\csname pgfpl@cm@#1@h\endcsname}{\pgfplots@loc@TMPb}%
|
||||
\pgf@ya=\pgfmathresult pt
|
||||
\c@pgf@counta=0
|
||||
\let#3=\pgfutil@empty
|
||||
\pgfplotsarrayforeachungrouped{pgfpl@cm@#1}\as\pgfplotscolormaptoshadingspec@TMP{%
|
||||
\pgf@yb=\c@pgf@counta\pgf@ya
|
||||
\edef\pgfplots@colspace{\csname pgfpl@cm@#1@colspace\endcsname}%
|
||||
% FIXME : PGF shadings accept only RGB!
|
||||
\if1\pgfplotscolormaptoshadingspectorgb
|
||||
\ifx\pgfplots@colspace\pgfplots@rgb
|
||||
\else
|
||||
\pgfutil@ifundefined{pgfpl@cm@#1@warned}{%
|
||||
\expandafter\gdef\csname pgfpl@cm@#1@warned\endcsname{1}%
|
||||
\pgfplotswarning{lossy colormap rgb conversion}{#1}{\pgfplots@colspace}\pgfeov%
|
||||
}{%
|
||||
}%
|
||||
\edef\pgf@tempcolor{{\pgfplots@colspace}{\pgfplotscolormaptoshadingspec@TMP}}%
|
||||
\expandafter\pgfutil@convertcolorspec\pgf@tempcolor{rgb}{\pgfplotscolormaptoshadingspec@TMP}%
|
||||
\def\pgfplots@colspace{rgb}%
|
||||
\fi
|
||||
\fi
|
||||
\edef\pgfplots@loc@TMPc{\pgfplots@colspace(\the\pgf@yb)=(\pgfplotscolormaptoshadingspec@TMP)}%
|
||||
\ifx#3\pgfutil@empty
|
||||
\t@pgfplots@toka={}%
|
||||
\else
|
||||
\t@pgfplots@toka=\expandafter{#3; }%
|
||||
\fi
|
||||
\t@pgfplots@tokb=\expandafter{\pgfplots@loc@TMPc}%
|
||||
\edef#3{\the\t@pgfplots@toka \the\t@pgfplots@tokb }%
|
||||
\advance\c@pgf@counta by1
|
||||
}%
|
||||
\pgfmath@smuggleone#3%
|
||||
\endgroup
|
||||
}%
|
||||
\def\pgfplotscolormaptoshadingspectorgb{1}%
|
||||
|
||||
% The same as \pgfplotscolormaptoshadingspec, but this here yields the
|
||||
% *reversed* sequence.
|
||||
\def\pgfplotscolormapreversedtoshadingspec#1#2#3{%
|
||||
\begingroup
|
||||
\let\pgfplotsarrayforeachungrouped=\pgfplotsarrayforeachreversedungrouped
|
||||
\pgfplotscolormaptoshadingspec{#1}{#2}{#3}%
|
||||
\pgfmath@smuggleone#3%
|
||||
\endgroup
|
||||
}%
|
||||
|
||||
|
||||
% Expands to the transformed range's right end of every colormap. The left
|
||||
% end is fixed to '0'.
|
||||
\def\pgfplotscolormaprange{1000}
|
||||
|
||||
\def\pgfplotscolormapgetcolorspace#1{%
|
||||
\edef\pgfplotsretval{\csname pgfpl@cm@#1@colspace\endcsname}%
|
||||
}%
|
||||
\def\pgfplotscolormapgetcolorcomps#1{%
|
||||
\edef\pgfplotsretval{\csname pgfpl@cm@#1@col@comps\endcsname}%
|
||||
}%
|
||||
|
||||
|
||||
% Linearly maps the number #4 into the colormap #5 and returns the
|
||||
% interpolated colors into \pgfmathresult. The result will be a triple
|
||||
% for an RGB colormap and it will contain four numbers for CMYK. The
|
||||
% components of the result will be in the range [0:1].
|
||||
%
|
||||
% [#1:#2] the number range of the data source (i.e. of #4). This is required to
|
||||
% map into the colormap.
|
||||
% [#3] (optional) the quantity
|
||||
% s := \pgfplotscolormaprange / (#2-#1).
|
||||
% Precomputing this quantity may save a lot of time because
|
||||
% divisions are expensive in TeX. You can omit [#3] or
|
||||
% provide an empty string here.
|
||||
% #4 the number to map.
|
||||
% #5 the colormap's name. Must be defined with
|
||||
% \pgfplotscreatecolormap before.
|
||||
%
|
||||
% Example:
|
||||
% \pgfplotscolormapfind[-1:1]{0.2}{my colormap}
|
||||
\def\pgfplotscolormapfind[#1:#2]{%
|
||||
\pgfutil@ifnextchar[{%
|
||||
\pgfplotscolormapfind@precomputed[#1:#2]%
|
||||
}{%
|
||||
\pgfplotscolormapfind@precomputed[#1:#2][]%
|
||||
}%
|
||||
}%
|
||||
\def\pgfplotscolormapfind@precomputed[#1:#2][#3]#4#5{%
|
||||
\pgfplotscolormapassertexists{#5}%
|
||||
\begingroup
|
||||
% Step 0: compute #3 if it is missing and write it into
|
||||
% \pgfplots@loc@TMPa.
|
||||
\def\pgfplots@loc@TMPa{#3}%
|
||||
\ifx\pgfplots@loc@TMPa\pgfutil@empty
|
||||
\pgfmathsubtract@{#2}{#1}%
|
||||
\let\pgfplots@loc@TMPb=\pgfmathresult
|
||||
\pgfmathdivide@{\pgfplotscolormaprange}{\pgfplots@loc@TMPb}%
|
||||
\let\pgfplots@loc@TMPa=\pgfmathresult
|
||||
\fi
|
||||
%\message{mapping '#4' into colormap '#5' ... ^^J}%
|
||||
\def\pgfplots@loc@samerange{0:1000}%
|
||||
\ifx\pgfplots@loc@TMPa\pgfplots@loc@samerange
|
||||
% we have phi(#4) = #4 because #4 in [0:1000].
|
||||
\def\pgfmathresult{#4}%
|
||||
\else
|
||||
% Step 1: perform lookup. Map #4 into the colormap's range
|
||||
% using the linear trafo
|
||||
% phi(#4) = ( #4 - #1 ) / (#2-#1) * colormaprange(#5).
|
||||
% This, determine the INTERVAL number into which #4 falls.
|
||||
\pgfmathsubtract@{#4}{#1}%
|
||||
\expandafter\pgfmathmultiply@\expandafter{\pgfmathresult}{\pgfplots@loc@TMPa}%
|
||||
\fi
|
||||
\ifdim\pgfmathresult pt<0pt
|
||||
\def\pgfmathresult{0}%
|
||||
\else
|
||||
\ifdim\pgfmathresult pt>1000pt
|
||||
\def\pgfmathresult{1000}%
|
||||
\fi
|
||||
\fi
|
||||
\let\pgfplotscolormapfind@transformedx=\pgfmathresult
|
||||
\expandafter\pgfmathmultiply@\expandafter{\pgfmathresult}{\csname pgfpl@cm@#5@invh\endcsname}%
|
||||
\let\pgfplotscolormapfind@transformedx@divh=\pgfmathresult
|
||||
\expandafter\pgfmathfloor@\expandafter{\pgfmathresult}%
|
||||
% assign \pgfplotscolormapfind@intervalno := \pgfmathresult
|
||||
% without '.0' suffix:
|
||||
\def\pgfplots@discardperiod##1.##2\relax{\def\pgfplotscolormapfind@intervalno{##1}}%
|
||||
\expandafter\pgfplots@discardperiod\pgfmathresult\relax
|
||||
\pgfmathsubtract@{\pgfplotscolormapfind@transformedx@divh}{\pgfplotscolormapfind@intervalno}%
|
||||
\let\pgfplots@loc@factor=\pgfmathresult
|
||||
\pgfmathsubtract@{1}{\pgfplots@loc@factor}%
|
||||
\let\pgfplots@loc@factor@two=\pgfmathresult
|
||||
% Step 2: interpolate the desired RGB value using vector valued
|
||||
% interpolation on the identified interval.
|
||||
\c@pgf@counta=\pgfplotscolormapfind@intervalno\relax
|
||||
%\message{mapping [#1,#2] -> [0,\pgfplotscolormaprange] yielded phi(#4) = \pgfplotscolormapfind@transformedx, situated in interval no \the\c@pgf@counta.^^J}%
|
||||
\pgfplotsarrayselect\c@pgf@counta\of{pgfpl@cm@#5}\to\pgfplotscolormapfind@rgb@LEFT
|
||||
%
|
||||
\pgfplotsarraysize{pgfpl@cm@#5}\to\c@pgf@countb
|
||||
\advance\c@pgf@countb-1 %
|
||||
\ifnum\c@pgf@counta<\c@pgf@countb
|
||||
% Ah: (selected index < length-1) . That means: we have an interval.
|
||||
\advance\c@pgf@counta by1
|
||||
\pgfplotsarrayselect\c@pgf@counta\of{pgfpl@cm@#5}\to\pgfplotscolormapfind@rgb@RIGHT
|
||||
%\message{After lookup: the corresponding RGB interval boundaries are [\pgfplotscolormapfind@rgb@LEFT: \pgfplotscolormapfind@rgb@RIGHT].^^J}%
|
||||
%
|
||||
%
|
||||
% color^m(x) = ( x/h - i ) * ( c_{i+1}^m - c_{i}^m ) + c_i^m
|
||||
% = s * c_{i+1}^m + S * c_i^m
|
||||
%
|
||||
% s= x_h / h -i
|
||||
% S = 1 - s
|
||||
\pgfplotscolorzero{\csname pgfpl@cm@#5@col@comps\endcsname}%
|
||||
\pgfplotscoloraddweighted
|
||||
{\csname pgfpl@cm@#5@col@comps\endcsname}
|
||||
{\pgfplotsretval}%
|
||||
{\pgfplots@loc@factor@two}%
|
||||
{\pgfplotscolormapfind@rgb@LEFT}%
|
||||
\pgfplotscoloraddweighted
|
||||
{\csname pgfpl@cm@#5@col@comps\endcsname}
|
||||
{\pgfplotsretval}%
|
||||
{\pgfplots@loc@factor}%
|
||||
{\pgfplotscolormapfind@rgb@RIGHT}%
|
||||
\let\pgfmathresult=\pgfplotsretval
|
||||
\else
|
||||
% Ah: selected index = last index. Use the rightmost color!
|
||||
\let\pgfmathresult=\pgfplotscolormapfind@rgb@LEFT
|
||||
\fi
|
||||
\pgfmath@smuggleone\pgfmathresult
|
||||
\endgroup
|
||||
%\message{-> got finally mapping(#4, #5) = RGB'\pgfmathresult'.}%
|
||||
}%
|
||||
|
||||
|
||||
% Performs a direct color access into color map '#2' using an index
|
||||
% '#1'.
|
||||
%
|
||||
% #1: an index in the range 0 ... len(#2)-1.
|
||||
% If it does not match, it will be pruned. If #1 is a real number, it
|
||||
% will be truncated.
|
||||
% #2: a color map name.
|
||||
%
|
||||
% The resulting RGB value will be written to \pgfmathresult.
|
||||
\def\pgfplotscolormapgetindex#1#2{%
|
||||
\pgfplotscolormapassertexists{#2}%
|
||||
\begingroup
|
||||
\afterassignment\pgfplots@gobble@until@relax
|
||||
\c@pgf@counta=#1\relax
|
||||
\ifnum\c@pgf@counta<0
|
||||
\c@pgf@counta=0
|
||||
\else
|
||||
\pgfplotsarraysizetomacro{pgfpl@cm@#2}\to\pgfplotscolormapgetindex@
|
||||
\ifnum\c@pgf@counta<\pgfplotscolormapgetindex@\relax
|
||||
\else
|
||||
\c@pgf@counta=\pgfplotscolormapgetindex@\relax
|
||||
\advance\c@pgf@counta by-1
|
||||
\fi
|
||||
\fi
|
||||
\pgfplotsarrayselect\c@pgf@counta\of{pgfpl@cm@#2}\to\pgfmathresult
|
||||
\pgfmath@smuggleone\pgfmathresult
|
||||
\endgroup
|
||||
}
|
||||
|
||||
% Invokes either \pgfplotscolormapfind or \pgfplotscolormapgetindex,
|
||||
% depending on the value of '/pgfplots/colormap access'.
|
||||
\def\pgfplotscolormapaccess[#1:#2]{%
|
||||
\pgfutil@ifnextchar[{%
|
||||
\pgfplotscolormapaccess@precomputed[#1:#2]%
|
||||
}{%
|
||||
\pgfplotscolormapaccess@precomputed[#1:#2][]%
|
||||
}%
|
||||
}
|
||||
\def\pgfplotscolormapaccess@precomputed[#1:#2][#3]#4#5{%
|
||||
\if m\pgfplots@colormap@access
|
||||
\pgfplotscolormapfind@precomputed[#1:#2][#3]{#4}{#5}%
|
||||
\else
|
||||
\pgfplotscolormapgetindex{#4}{#5}%
|
||||
\fi
|
||||
}%
|
||||
|
||||
|
||||
\pgfutil@definecolor{mapped color}{rgb}{0,0,0}% make sure this color exists. It will be overwritten if needed.
|
||||
% ATTENTION: replicated in pgfplots.code.tex :
|
||||
\pgfplotscreatecolormap{hot}{color(0cm)=(blue); color(1cm)=(yellow); color(2cm)=(orange); color(3cm)=(red)}
|
||||
|
||||
\def\pgfplotspointmetatransformedrange{0:1000}
|
||||
|
||||
% Defines the 'mapped color' on the basis of
|
||||
% the current color map.
|
||||
%
|
||||
% #1: is the value which should be mapped into the color map; it
|
||||
% is expected in the range [0,1000] (like point meta).
|
||||
\def\pgfplotscolormapdefinemappedcolor#1{%
|
||||
\expandafter\pgfplotscolormapaccess\expandafter[\pgfplotspointmetatransformedrange]
|
||||
[1.0]
|
||||
{#1}
|
||||
{\pgfkeysvalueof{/pgfplots/colormap name}}
|
||||
%\message{Color for current point is RGB '\pgfmathresult' (determined using meta 'phi(\pgfplotspointmeta) = \pgfplotspointmetatransformed')^^J}%
|
||||
\def\pgfplots@loc@TMPb{\pgfutil@definecolor{mapped color}{\csname pgfpl@cm@\pgfkeysvalueof{/pgfplots/colormap name}@colspace\endcsname}}%
|
||||
\expandafter\pgfplots@loc@TMPb\expandafter{\pgfmathresult}%
|
||||
}%
|
||||
|
8642
texmf/tex/latex/pgfplots/tex/pgfplotscoordprocessing.code.tex
Normal file
8642
texmf/tex/latex/pgfplots/tex/pgfplotscoordprocessing.code.tex
Normal file
File diff suppressed because it is too large
Load diff
327
texmf/tex/latex/pgfplots/tex/pgfplotscore.code.tex
Normal file
327
texmf/tex/latex/pgfplots/tex/pgfplotscore.code.tex
Normal file
|
@ -0,0 +1,327 @@
|
|||
%--------------------------------------------
|
||||
%
|
||||
% Package pgfplots
|
||||
%
|
||||
% 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 by Christian Feuersänger.
|
||||
%
|
||||
% This program is free software: you can redistribute it and/or modify
|
||||
% 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/>.
|
||||
%
|
||||
%--------------------------------------------
|
||||
|
||||
\def\pgfplotsset#{\pgfqkeys{/pgfplots}}
|
||||
|
||||
% This is *identical* to \pgfutil@IfUndefined . I copied it here
|
||||
% because pgf up to and including version 2.10 does not contain it.
|
||||
\def\pgfplotsutil@IfUndefined#1{%
|
||||
\begingroup\expandafter\expandafter\expandafter\endgroup
|
||||
\expandafter\ifx\csname#1\endcsname\relax
|
||||
\expandafter\pgfutil@firstoftwo
|
||||
\else
|
||||
\expandafter\pgfutil@secondoftwo
|
||||
\fi
|
||||
}
|
||||
\pgfplotsutil@IfUndefined{pgfutil@IfUndefined}{\let\pgfutil@IfUndefined=\pgfplotsutil@IfUndefined}{}
|
||||
|
||||
|
||||
\def\pgfplots@log#1#2{\immediate\write-1{Package pgfplots info: #2}}%
|
||||
\def\pgfplots@error#1{\PackageError{pgfplots}{#1}{}}%
|
||||
\def\pgfplotstable@error@pkg#1{\PackageError{pgfplotstable}{#1}{}}%
|
||||
% DO NOT USE THIS METHOD DIRECTLY: use \pgfplotswarning{<warning name>}<args>\pgfeov
|
||||
\pgfplotsutil@IfUndefined{PackageWarning}{%
|
||||
\def\pgfplots@warning#1{\pgfplots@message{! Package pgfplots Warning:
|
||||
#1}}%
|
||||
}{%
|
||||
\def\pgfplots@warning#1{\PackageWarning{pgfplots}{#1}{}}%
|
||||
}%
|
||||
|
||||
\def\pgfplots@message#1{%
|
||||
\immediate\write16{#1}%
|
||||
}%
|
||||
|
||||
\pgfutil@IfUndefined{pgfkeys}{%
|
||||
\pgfplots@error{It seems your version of PGF/Tikz is older than 2.00. Unfortunately, pgfplots requires at least version 2.00 ... you may need to update your TeX-Distribution or install PGF manually, sorry}%
|
||||
}{\relax}
|
||||
|
||||
% Throws exception `#1' with arguments `#2'.
|
||||
%
|
||||
% #1 : the exception name
|
||||
% #2: all what comes after the exception name is considered to be argument
|
||||
% (or arguments) for the exception '#1'.
|
||||
% the \pgfeov is IMPORTANT as it delimits the argument.
|
||||
%
|
||||
% Note that all standard pgfplots exceptions provide a feature to
|
||||
% exchange the error message text: define \pgfplotsexceptionmsg
|
||||
% set a replacement.
|
||||
\def\pgfplotsthrow#1#2\pgfeov{%
|
||||
\def\pgfkeyscurrentkey{/pgfplots/exception/#1}%
|
||||
\pgfkeysvalueof{/pgfplots/exception/#1/.@cmd}#2\pgfeov
|
||||
}%
|
||||
\let\pgfplotsthrow@orig=\pgfplotsthrow
|
||||
|
||||
% Generates warning `#1' with argument(s) `#2'.
|
||||
%
|
||||
% It works in exactly the same way as \pgfplotsthrow.
|
||||
\def\pgfplotswarning#1#2\pgfeov{%
|
||||
\def\pgfkeyscurrentkey{/pgfplots/warning/#1}%
|
||||
\pgfkeysvalueof{/pgfplots/warning/#1/.@cmd}#2\pgfeov
|
||||
}%
|
||||
|
||||
\def\pgfplotsthrow@warning#1{%
|
||||
\pgfplots@warning{#1}%
|
||||
\immediate\write-1{ [warning \pgfkeyscurrentkey]}%
|
||||
}%
|
||||
|
||||
\def\pgfplots@assert@not@zero#1#2{%
|
||||
\ifdim#1=0sp %
|
||||
\pgfplotsthrow{invalid argument}{\pgfplots@loc@TMPa}{#2}\pgfeov
|
||||
\fi
|
||||
}%
|
||||
|
||||
% A primitive try #1 catch #2 end block.
|
||||
%
|
||||
% It tries code #1. If any exception occurs within, it suppresses the
|
||||
% exception and tries to continue. It then invokes #2 as soon as it
|
||||
% can.
|
||||
%
|
||||
% You can use \pgfplotsrethrow in #2.
|
||||
%
|
||||
% ATTENTION: this is a simple attempt to simulate error control. Don't
|
||||
% rely on it too heavily! In the moment, I am not even sure if it can
|
||||
% be nested (perhaps you need to introduce extra scopes since
|
||||
% \pgfplotstry doesn't).
|
||||
\long\def\pgfplotstry#1\catch#2\endpgfplotstry{%
|
||||
\global\let\pgfplotstry@exception\pgfutil@empty
|
||||
\def\pgfplotsthrow##1##2\pgfeov{\gdef\pgfplotstry@exception{{##1}{##2}}}%
|
||||
#1\relax%
|
||||
\let\pgfplotsthrow=\pgfplotsthrow@orig
|
||||
\ifx\pgfplotstry@exception\pgfutil@empty
|
||||
\else
|
||||
#2%
|
||||
\fi
|
||||
\global\let\pgfplotstry@exception\pgfutil@empty
|
||||
}%
|
||||
\def\pgfplotsrethrow{\expandafter\pgfplotsthrow\pgfplotstry@exception\pgfeov}%
|
||||
|
||||
\pgfkeys{
|
||||
% #1: the argument which should have been assigned.
|
||||
% #2: an error message.
|
||||
/pgfplots/exception/invalid argument/.code 2 args={%
|
||||
\ifx\pgfplotsexceptionmsg\relax
|
||||
\pgfplots@error{#2}%
|
||||
\else
|
||||
\pgfplots@error{\pgfplotsexceptionmsg}%
|
||||
\fi
|
||||
\let#1=\pgfutil@empty
|
||||
},%
|
||||
% #1 : the layer name
|
||||
% #2 : additional context information (message)
|
||||
/pgfplots/exception/inactive layer/.code 2 args={%
|
||||
\ifx\pgfplotsexceptionmsg\relax
|
||||
\pgfplots@error{Sorry, the layer '#1' has not been activated but it is referenced in #2. Perhaps you misspelled it? Each referenced layer must be activated (expect for layer 'discard').}%
|
||||
\else
|
||||
\pgfplots@error{\pgfplotsexceptionmsg}%
|
||||
\fi
|
||||
},%
|
||||
% #1: the argument which should have been assigned.
|
||||
% #2: an error message.
|
||||
/pgfplots/exception/no such element/.code 2 args={%
|
||||
\ifx\pgfplotsexceptionmsg\relax
|
||||
\pgfplots@error{#2}%
|
||||
\else
|
||||
\pgfplots@error{\pgfplotsexceptionmsg}%
|
||||
\fi
|
||||
\let#1=\pgfutil@empty
|
||||
},%
|
||||
/pgfplots/exception/invalid color component/.code 2 args={%
|
||||
\ifx\pgfplotsexceptionmsg\relax
|
||||
\pgfplots@error{#2}%
|
||||
\else
|
||||
\pgfplots@error{\pgfplotsexceptionmsg}%
|
||||
\fi
|
||||
\let#1=\pgfutil@empty
|
||||
},%
|
||||
% #1: an error message
|
||||
/pgfplots/exception/unsupported operation/.code={%
|
||||
\ifx\pgfplotsexceptionmsg\relax
|
||||
\pgfplots@error{#1}%
|
||||
\else
|
||||
\pgfplots@error{\pgfplotsexceptionmsg}%
|
||||
\fi
|
||||
},%
|
||||
% #1: the argument which should have been assigned.
|
||||
% #2: the file name
|
||||
% #3: the error message
|
||||
/pgfplots/exception/no such table file/.code args={#1#2#3}{%
|
||||
\ifx\pgfplotsexceptionmsg\relax
|
||||
\pgfplots@error{#3}%
|
||||
\else
|
||||
\pgfplots@error{\pgfplotsexceptionmsg}%
|
||||
\fi
|
||||
\let#1=\relax
|
||||
},
|
||||
%
|
||||
%
|
||||
%
|
||||
%
|
||||
% Generated if you say 'ymin=0' in a log axis.
|
||||
% #1: the user argument ('ymin')
|
||||
% #2: the offending value.
|
||||
/pgfplots/warning/illegal user argument in log axis/.code args={#1#2}{%
|
||||
\pgfplotsthrow@warning{Ignoring illegal input argument #1=#2: cannot apply log.}%
|
||||
},
|
||||
/pgfplots/warning/plot without coordinates/.code={%
|
||||
\pgfplotsthrow@warning{the current plot has no coordinates (or all have been filtered away)}%
|
||||
},
|
||||
/pgfplots/warning/log basis required/.code 2 args={%
|
||||
\pgfplotsthrow@warning{Some input argument (#2) explicitly relies on the log basis of #1 (which is e). Please verify that this is intended and set 'log basis #1=10' otherwise. This warning will be shown only once per document.}%
|
||||
},
|
||||
/pgfplots/warning/no such legend to name/.code={%
|
||||
\pgfplotsthrow@warning{There is no `legend to name=#1', sorry. I am skipping it}%
|
||||
},
|
||||
/pgfplots/warning/no such colorbar to name/.code={%
|
||||
\pgfplotsthrow@warning{There is no `colorbar to name=#1', sorry. I am skipping it}%
|
||||
},
|
||||
/pgfplots/warning/no such addplot label/.code={%
|
||||
\pgfplotsthrow@warning{There is no \string\addplot\space label `#1', sorry. I am skipping it}%
|
||||
},
|
||||
/pgfplots/warning/enlargelimits respects figure size failed/.code={%
|
||||
\pgfplotsthrow@warning{enlargelimits respects figure size=true: could not respect the prescribed width/height (\pgfplotsretval). The size and/or aspect ratio of your image will be different than expected. You can try to modify BOTH width and height.}%
|
||||
},
|
||||
% #1: the axis
|
||||
/pgfplots/warning/empty range cleared axis/.code={%
|
||||
\pgfplotsthrow@warning{You have an axis with empty range (in direction #1). Replacing it with a default range and clearing all plots.}%
|
||||
},
|
||||
/pgfplots/warning/approx empty range enlarged/.code args={#1#2#3}{%
|
||||
\pgfplotsthrow@warning{Axis range for axis #1 is approximately empty; enlarging it (it is [#2:#3])}%
|
||||
},
|
||||
/pgfplots/warning/lossy colormap rgb conversion/.code 2 args={%
|
||||
\pgfplotsthrow@warning{I am about to convert colormap '#1' from #2\space to rgb (which might be lossy). Perhaps the choice 'colorbar sampled={surf,shader=interp}' yields better results since it supports #2.}%
|
||||
},
|
||||
/pgfplots/warning/colorbar uninitialised/.code={%
|
||||
\pgfplotsthrow@warning{Sorry, the colorbar is uninitialised - your axis has no color data. Consider using 'point meta=f(x)' or something like that. I am using a color range of [0,1] for the colorbar.}%
|
||||
},
|
||||
/pgfplots/warning/colorbar CMYK unsupported/.code={%
|
||||
\pgfplotsthrow@warning{colorbar remark: The colormap '#1' has a CMYK colorspace which is not (yet) supported by PGF. I switched colorbar styles automatically to the visually equivalent 'colorbar sampled={surf,shader=interp}' to generate a proper CMYK colorbar. This has less support in some previewers. Use \string\pgfplotscolorbarCMYKworkaroundfalse\space to disable this improvement. [This message won't be replicated for '#1']}%
|
||||
},
|
||||
/pgfplots/warning/ticklabel anchor undetermined/.code args={#1#2#3#4}{%
|
||||
\pgfplotsthrow@warning{the ticklabel anchor cannot be determined, the normal vector -(#2) and the unit #1 vector (#3) are almost parallel (abs(cos(angle)) = #4)!}%
|
||||
},
|
||||
/pgfplots/warning/point meta unbounded/.code 2 args={%
|
||||
\pgfplotsthrow@warning{The per point meta data `#1' (#2) (and probably others as well) is unbounded - using the minimum value instead.}%
|
||||
},
|
||||
/pgfplots/warning/gnuplot -V impossible/.code={%
|
||||
\pgfplotsthrow@warning{Sorry, I could not determine 'gnuplot -V' to check whether gnuplot and logscale writes results in log() or not. Please set `/pgfplots/gnuplot writes logscale=true|false' manually.}%
|
||||
},
|
||||
/pgfplots/warning/gnuplot -V format unknown/.code={%
|
||||
\pgfplotsthrow@warning{Sorry, I can't reliably check which version of gnuplot is available. I guess it is gnuplot < 4.4. Please set `/pgfplots/gnuplot writes logscale=true|false' manually if anything fails.}%
|
||||
},
|
||||
/pgfplots/warning/plot3 graphics compatibility mode/.code={%
|
||||
\pgfplotsthrow@warning{plot3 graphics is running in backwards compatibility mode. %
|
||||
Use \string\pgfplotsset{compat=1.6} or higher to benefit from upgraded scaling capabilites.}%
|
||||
},
|
||||
/pgfplots/warning/plot3 graphics too few inner anchors/.code={%
|
||||
\pgfplotsthrow@warning{plot graphics in 3D axis has just two inner anchors (those with '(x,y,z)=>(imgx,imgy)'). You should provide a third one such that I can check for correct scaling.}%
|
||||
},
|
||||
/pgfplots/warning/scatter classes no such class/.code={%
|
||||
\pgfplotsthrow@warning{scatter/classes: can't find class for '#1'!? Please make sure you have specified 'scatter src=explicit symbolic'. Ignoring class '#1' (this message will not come again).}%
|
||||
},
|
||||
/pgfplots/warning/interior colormap inefficient/.code={%
|
||||
\pgfplotsthrow@warning{the combination 'shader=interp,interior colormap name' is inefficient (it uses 'shader=faceted interp,faceted color=none') and may slow down the *display* of your document}%
|
||||
},
|
||||
/pgfplots/warning/matrix delinearize uses sqrt/.code args={#1#2#3#4}{%
|
||||
\pgfplotsthrow@warning{%
|
||||
mesh processing did not find '[mesh/rows=<N>]' or '[mesh/cols=<N>]'.
|
||||
Assuming [mesh/rows=#1,mesh/cols=#2]
|
||||
as sqrt(num points) = sqrt(#3) [ = #4].}%
|
||||
},
|
||||
/pgfplots/warning/matrix check/.code args={#1#2#3#4#5}{%
|
||||
#1{the arguments of [mesh/rows=#2,mesh/cols=#3] assume #5\space points, but I got actually N = #4\space points! The data matrix appears to be incomplete or overcomplete!? [Use mesh/check=false to disable this message]}%
|
||||
},
|
||||
/pgfplots/warning/tick computation failed/.code 2 args={%
|
||||
\pgfplotsthrow@warning{Tick computation for direction #1 failed; there are always too few tick labels (try min ticks has already been advanced to #2)}%
|
||||
},
|
||||
/pgfplots/warning/scale uniformly unsupported/.code={%
|
||||
\pgfplotsthrow@warning{Sorry, 'scale uniformly' failed because its actual implementation works only if y_x = 0 and x_y = 0 (for 2d axes) or if z_x = 0 (for 3d axes). The result will not fill the prescribed dimensions. Falling back to 'scale uniformly strategy=units only. (use scale uniformly warning=false to disable this warning)}%
|
||||
},
|
||||
/pgfplots/warning/axis equal incompatible change/.code={%
|
||||
\pgfplotsthrow@warning{the content of your 3d axis has changed compared to previous versions of pgfplots. please review it. ^^J %
|
||||
[continued] explanation: you have a 3d axis with 'axis equal' and/or 'unit vector ratio' which has (probably) been optimized for an older version of pgfplots. any version older than 1.6 produced wrong output.^^J %
|
||||
[continued] to remove this warning, write \string\pgfplotsset{compat=1.6} (or newer) in your preamble (may change all figures in your document) or by adding that to the affected axis.}%
|
||||
},
|
||||
/pgfplots/warning/unit vector ratio axis undetermined/.code={%
|
||||
\pgfplotsthrow@warning{The algorithm to implement 'unit vector ratio' failed! It could not determine the axis which shall be scaled and decided to use 'unit vector ratio axis=#1'.}%
|
||||
},
|
||||
/pgfplots/warning/linear system singular/.code={%
|
||||
\pgfplotsthrow@warning{Linear system is singular up to machine precision! Continuing with small threshold.}%
|
||||
},
|
||||
/pgfplots/warning/center lines upgrade required/.code={%
|
||||
\pgfplotsthrow@warning{Please use '\string\pgfplotsset{compat=1.8}' to enable correct label placement for 3d axes (at least compat/labels=1.8).}%
|
||||
},
|
||||
/pgfplots/warning/empty column name/.code 2 args={%
|
||||
\pgfplotsthrow@warning{Table '#1' has an empty column name; replacing it by '#2'}%
|
||||
},
|
||||
}
|
||||
\let\pgfplotsexceptionmsg=\relax
|
||||
|
||||
\def\pgfplots@EOI{\pgfplots@EOI}%
|
||||
|
||||
\newif\ifpgfplots@loc@tmp
|
||||
\newtoks\t@pgfplots@toka
|
||||
\newtoks\t@pgfplots@tokb
|
||||
\newtoks\t@pgfplots@tokc
|
||||
\newdimen\pgfplots@tmpa
|
||||
\newcount\c@pgfplots@coordindex
|
||||
\newcount\c@pgfplots@scanlineindex
|
||||
\pgfutil@IfUndefined{r@pgf@reada}{%
|
||||
\csname newread\endcsname\r@pgfplots@reada
|
||||
}{%
|
||||
\let\r@pgfplots@reada=\r@pgf@reada
|
||||
}
|
||||
|
||||
% use these macros for GLOBAL temporary assignments.
|
||||
% you can NEVER rely on their values unless you know exactly what you are doing.
|
||||
\gdef\pgfplots@glob@TMPa{}%
|
||||
\gdef\pgfplots@glob@TMPb{}%
|
||||
\gdef\pgfplots@glob@TMPc{}%
|
||||
|
||||
% use these macros for LOCAL temporary assigments.
|
||||
% you can NEVER rely on their values unless you know exactly what you are doing.
|
||||
\def\pgfplots@loc@TMPa{}%
|
||||
\def\pgfplots@loc@TMPb{}%
|
||||
\def\pgfplots@loc@TMPc{}%
|
||||
|
||||
|
||||
% Invokes code #2 if file '#1' exists and #3 if not.
|
||||
\long\def\pgfplots@iffileexists#1#2#3{%
|
||||
\openin\r@pgfplots@reada=#1
|
||||
\ifeof\r@pgfplots@reada
|
||||
#3\relax
|
||||
\else
|
||||
\closein\r@pgfplots@reada
|
||||
#2\relax
|
||||
\fi
|
||||
}
|
||||
\let\pgfplotsiffileexists=\pgfplots@iffileexists
|
||||
|
||||
\pgfutil@ifundefined{pgfplots@texdist@protect}{%
|
||||
\def\pgfplots@texdist@protect{}%
|
||||
}{}
|
||||
|
||||
\input pgfplotssysgeneric.code.tex
|
||||
\endinput
|
125
texmf/tex/latex/pgfplots/tex/pgfplotsdeque.code.tex
Normal file
125
texmf/tex/latex/pgfplots/tex/pgfplotsdeque.code.tex
Normal file
|
@ -0,0 +1,125 @@
|
|||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%
|
||||
% This is a helper package with an elementary double-ended-queue
|
||||
% (deque) datastructure,
|
||||
% featuring O(1) index access and O(N) creation, deletion, copy.
|
||||
%
|
||||
% The following macros are supplied:
|
||||
%
|
||||
% \pgfplotsdequenewempty
|
||||
% \pgfplotsdequecopy
|
||||
% \pgfplotsdequepushback
|
||||
% \pgfplotsdequepopfront
|
||||
% \pgfplotsdequecheckempty
|
||||
% \pgfplotsdequeforeach
|
||||
%
|
||||
% Copyright 2007/2008 by Christian Feuersänger.
|
||||
%
|
||||
% This program is free software: you can redistribute it and/or modify
|
||||
% 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/>.
|
||||
%
|
||||
%
|
||||
%
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
% IMPLEMENTATION NOTES:
|
||||
% I allocate an array which provides storage capacity and two pointers
|
||||
% (indices) into that array.
|
||||
%
|
||||
% The deque is stored as
|
||||
% - an array: \csname pgfpldq@<name>\endcsname
|
||||
% - the pointers:
|
||||
% \csname pgfpldq@<name>@beg\endcsname
|
||||
% \csname pgfpldq@<name>@end\endcsname (one after the end)
|
||||
%
|
||||
% ATTENTION: <name> may NOT be a control sequence!
|
||||
% this is in contrast to my other container structures.
|
||||
|
||||
|
||||
% Allocates a new, empty deque #1.
|
||||
%
|
||||
% #1 the name of a deque (NO control sequence!)
|
||||
% #2 is an integer denoting the maximum capacity. For now, this
|
||||
% capacity is fixed afterwards and denotes the maximum number of
|
||||
% entries.
|
||||
\def\pgfplotsdequenewempty#1{%
|
||||
\pgfutil@ifnextchar\capacity{%
|
||||
\pgfplotsdequenewempty@{#1}%
|
||||
}{%
|
||||
\pgfplots@error{Expected \string\capacity\{the capacity\} after \string\pgfplotsdequenewempty...}%
|
||||
\pgfplotsdequenewempty@{#1}\capacity{100}%
|
||||
}%
|
||||
}%
|
||||
\def\pgfplotsdequenewempty@#1\capacity#2{%
|
||||
\pgfplotsarrayresize{pgfpldq@#1}{#2}%
|
||||
\pgfutil@namedef{pgfpldq@#1@beg}{0}%
|
||||
\pgfutil@namedef{pgfpldq@#1@end}{0}%
|
||||
}%
|
||||
|
||||
\def\pgfplotsdequecopy#1\to#2{%
|
||||
\pgfutil@namelet{pgfpldq@#1@beg}{pgfpldq@#2@beg}%
|
||||
\pgfutil@namelet{pgfpldq@#1@end}{pgfpldq@#2@end}%
|
||||
\pgfplotsarraycopy{pgfpldq@#1}\to{pgfpldq@#2}%
|
||||
}%
|
||||
|
||||
\def\pgfplotsdequepushback#1\to#2{%
|
||||
\pgfplotsarrayset{\csname pgfpldq@#2@end\endcsname}\of{pgfpldq@#2}\to{#1}%
|
||||
\c@pgfplotsarray@tmp=\csname pgfpldq@#2@end\endcsname
|
||||
\advance\c@pgfplotsarray@tmp by1
|
||||
\ifnum\c@pgfplotsarray@tmp=\pgfplotsarraysizeof{pgfpldq@#2}
|
||||
\c@pgfplotsarray@tmp=0
|
||||
\fi
|
||||
\expandafter\edef\csname pgfpldq@#2@end\endcsname{\the\c@pgfplotsarray@tmp}%
|
||||
\pgfplotsdequeifempty{#2}{\pgfplots@error{Error: \string\pgfplotsdeque\space capacity has been reached - it was too small. Sorry, I didn't write auto-enlargement...}}{}%
|
||||
}%
|
||||
|
||||
\def\pgfplotsdequepopfront#1\to#2{%
|
||||
\pgfplotsarrayselect{\csname pgfpldq@#1@beg\endcsname}\of{pgfpldq@#1}\to{#2}%
|
||||
\c@pgfplotsarray@tmp=\csname pgfpldq@#1@beg\endcsname
|
||||
\advance\c@pgfplotsarray@tmp by1
|
||||
\ifnum\c@pgfplotsarray@tmp=\pgfplotsarraysizeof{pgfpldq@#1}
|
||||
\c@pgfplotsarray@tmp=0
|
||||
\fi
|
||||
\expandafter\edef\csname pgfpldq@#1@beg\endcsname{\the\c@pgfplotsarray@tmp}%
|
||||
}%
|
||||
|
||||
% invokes #2 if deque '#1' is empty and '#3' if it is not empty.
|
||||
\def\pgfplotsdequeifempty#1#2#3{%
|
||||
\ifnum\csname pgfpldq@#1@beg\endcsname=\csname pgfpldq@#1@end\endcsname\relax
|
||||
#2%
|
||||
\else
|
||||
#3%
|
||||
\fi
|
||||
}%
|
||||
|
||||
|
||||
\long\def\pgfplotsdequeforeach#1\as#2#3{%
|
||||
\c@pgfplotsarray@tmp=\csname pgfpldq@#1@beg\endcsname
|
||||
\long\def\pgfplotsdequeforeach@next{\pgfplotsdequeforeach@iter{#1}{#2}{#3}}%
|
||||
\pgfplotsdequeforeach@next
|
||||
}%
|
||||
\long\def\pgfplotsdequeforeach@iter#1#2#3{%
|
||||
\ifnum\c@pgfplotsarray@tmp=\csname pgfpldq@#1@end\endcsname
|
||||
\def\pgfplotsdequeforeach@next{}%
|
||||
\else
|
||||
\pgfplotsarrayselect\c@pgfplotsarray@tmp\of pgfpldq@#1\to#2%
|
||||
\edef\pgfplotsdequeforeach@{\the\c@pgfplotsarray@tmp}%
|
||||
#3\relax
|
||||
\c@pgfplotsarray@tmp=\pgfplotsdequeforeach@
|
||||
\advance\c@pgfplotsarray@tmp by1
|
||||
\ifnum\c@pgfplotsarray@tmp=\pgfplotsarraysizeof{pgfpldq@#1}
|
||||
\c@pgfplotsarray@tmp=0
|
||||
\fi
|
||||
\fi
|
||||
\pgfplotsdequeforeach@next
|
||||
}%
|
60
texmf/tex/latex/pgfplots/tex/pgfplotslibrary.code.tex
Normal file
60
texmf/tex/latex/pgfplots/tex/pgfplotslibrary.code.tex
Normal file
|
@ -0,0 +1,60 @@
|
|||
% Copyright 2006 by Till Tantau
|
||||
%
|
||||
% 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.
|
||||
% Comment: This file has been modified to utilize libraries in the pgfplots package.
|
||||
% Edited by Nick Papior Andersen
|
||||
|
||||
|
||||
|
||||
% Loading further libraries
|
||||
|
||||
% Include a library file.
|
||||
%
|
||||
% #1 = List of names of library file.
|
||||
%
|
||||
% Description:
|
||||
%
|
||||
% This command includes a list of pgfplots library files. For each file X in the
|
||||
% list, the file tikzlibrarypgfplots.X.code.tex is included, provided this has
|
||||
% not been done earlier.
|
||||
%
|
||||
% For the convenience of Context users, both round and square brackets
|
||||
% are possible for the argument.
|
||||
%
|
||||
% Example:
|
||||
%
|
||||
% \usepgfplotslibrary{units}
|
||||
% \usepgfplotslibrary[units,dateplot]
|
||||
|
||||
\def\usepgfplotslibrary{\pgfutil@ifnextchar[{\use@pgfplotslibrary}{\use@@pgfplotslibrary}}%}
|
||||
\def\use@pgfplotslibrary[#1]{\use@@pgfplotslibrary{#1}}
|
||||
\def\use@@pgfplotslibrary#1{%
|
||||
\edef\pgf@list{#1}%
|
||||
\pgfutil@for\pgf@temp:=\pgf@list\do{%
|
||||
\expandafter\pgfkeys@spdef\expandafter\pgf@temp\expandafter{\pgf@temp}%
|
||||
\ifx\pgf@temp\pgfutil@empty
|
||||
\else
|
||||
\expandafter\ifx\csname pgfp@library@\pgf@temp @loaded\endcsname\relax%
|
||||
\expandafter\global\expandafter\let\csname pgfp@library@\pgf@temp @loaded\endcsname=\pgfutil@empty%
|
||||
\expandafter\edef\csname tikz@library@#1@atcode\endcsname{\the\catcode`\@}
|
||||
\expandafter\edef\csname tikz@library@#1@barcode\endcsname{\the\catcode`\|}
|
||||
\catcode`\@=11
|
||||
\catcode`\|=12
|
||||
\pgfplots@iffileexists{tikzlibrarypgfplots.\pgf@temp.code.tex}{%
|
||||
\input tikzlibrarypgfplots.\pgf@temp.code.tex}{%
|
||||
\input pgflibrarypgfplots.\pgf@temp.code.tex}%
|
||||
\catcode`\@=\csname tikz@library@#1@atcode\endcsname
|
||||
\catcode`\|=\csname tikz@library@#1@barcode\endcsname
|
||||
\fi%
|
||||
\fi
|
||||
}%
|
||||
}
|
||||
|
||||
|
||||
% Default loaded libraries:
|
||||
% Currently none
|
435
texmf/tex/latex/pgfplots/tex/pgfplotsliststructure.code.tex
Normal file
435
texmf/tex/latex/pgfplots/tex/pgfplotsliststructure.code.tex
Normal file
|
@ -0,0 +1,435 @@
|
|||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%
|
||||
% This is a helper package with an elementary list datastructure.
|
||||
%
|
||||
% Its implementation is based on Knuth's list macros in "The TeXbook".
|
||||
%
|
||||
% It features a convenient set of list macros, but it is not fast.
|
||||
% In fact, every elementary operation requires time O(N), so working
|
||||
% with this list easily leads to O(N^2) runtime.
|
||||
%
|
||||
% The following macros are supplied:
|
||||
%
|
||||
% \pgfplotslistnewempty
|
||||
% \pgfplotslistnew
|
||||
% \pgfplotslistcopy
|
||||
% \pgfplotslistpopfront
|
||||
% \pgfplotslistfront
|
||||
% \pgfplotslistpushback
|
||||
% \pgfplotslistpushfront
|
||||
% \pgfplotslistsize
|
||||
% \pgfplotslistselect
|
||||
% \pgfplotslistset
|
||||
% \pgfplotslistcheckempty
|
||||
% \pgfplotslistforeach
|
||||
%
|
||||
% @see \pgfplotsapplist a "real" list with O(1) pushback, but limited application.
|
||||
% @see \pgfplotsapplistX a preasymptotical fast list to accumulate elements.
|
||||
% @see \pgfplotsapplistXX an optimized version of \pgfplotsapplistX.
|
||||
%
|
||||
% Copyright 2007/2008 by Christian Feuersänger.
|
||||
%
|
||||
% This program is free software: you can redistribute it and/or modify
|
||||
% 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/>.
|
||||
%
|
||||
%
|
||||
%
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
\newif\ifpgfplotslistempty
|
||||
|
||||
% Low-level IMPLEMENTATION NOTE
|
||||
% the list is stored in the form
|
||||
% '\pgfpl@@{<first>}\pgfpl@@{<second>}\pgfpl@@{<third>}....\pgfpl@@{<last>}'
|
||||
|
||||
\newif\ifpgfplots@loop@CONTINUE
|
||||
\newif\ifpgfplotslist@is@backslash@terminated
|
||||
|
||||
% Creates a new, empty list.
|
||||
\long\def\pgfplotslistnewempty#1{\let#1=\pgfutil@empty}
|
||||
|
||||
% Creates a new list with an abirtrary number of elements.
|
||||
% Arguments:
|
||||
% #1: the list's name (a macro name)
|
||||
% #2: the elements in the form
|
||||
% first\\second\\third\\ ...\\
|
||||
% like in tabular with one column.
|
||||
% You can also use comma-separated lists
|
||||
% first,second,third
|
||||
%
|
||||
% Example:
|
||||
% 1.
|
||||
% \pgfplotslistnew\foolist{First Element\\Second Element\\Third Element\\}
|
||||
% WARNING: do NOT forget the final '\\'!
|
||||
%
|
||||
% 2.
|
||||
% \pgfplotslistnew\foolist{First Element,Second Element,Third Element}
|
||||
%
|
||||
% Use braces '{}' to use '\\' or ',' as arguments.
|
||||
%
|
||||
\long\def\pgfplotslistnew#1#2{%
|
||||
\pgfplotslist@check@backslash@list #2\\\pgfplotslist@EOI
|
||||
\ifpgfplotslist@is@backslash@terminated
|
||||
\pgfplotslistnew@backslash@{#1}{#2}%
|
||||
\else
|
||||
\pgfplots@foreach@to@list{#2}\to#1%
|
||||
\fi
|
||||
}
|
||||
% Is this here *ever* used!? I guess not.
|
||||
\long\def\pgfplotslistnew@backslash#1#2{%
|
||||
\pgfplotslistnewempty{#1}%
|
||||
\pgfplotslist@check@backslash@list #2\\\pgfplotslist@EOI
|
||||
\ifpgfplotslist@is@backslash@terminated
|
||||
\long\def\pgfplotslistnew@impl@rest{#2\pgfplotslist@EOI\\}%
|
||||
\def\pgfplotslistnew@backslash@loop{\pgfplotslistnew@impl{#1}}%
|
||||
\else
|
||||
\def\pgfplotslistnew@backslash@loop{\pgfplotslistnew@impl@comma{#1}}%
|
||||
\long\def\pgfplotslistnew@impl@rest{#2\pgfplotslist@EOI,}%
|
||||
\fi
|
||||
\expandafter\pgfplotslistnew@backslash@loop\pgfplotslistnew@impl@rest
|
||||
}%
|
||||
\long\def\pgfplotslistnew@backslash@#1#2{%
|
||||
\pgfplotslistnewempty{#1}%
|
||||
\def\pgfplotslistnew@backslash@loop{\pgfplotslistnew@impl{#1}}%
|
||||
\pgfplotslistnew@backslash@loop#2\pgfplotslist@EOI\\%
|
||||
}%
|
||||
|
||||
% helper macro for \pgfplotslistnew
|
||||
\long\def\pgfplotslistnew@impl#1#2\\{%
|
||||
\def\pgfplotslist@loc@TMPa{#2}%
|
||||
\ifx\pgfplotslist@loc@TMPa\pgfplotslist@EOI
|
||||
\else
|
||||
\pgfplotslistpushback{#2}\to#1\relax%
|
||||
\expandafter\pgfplotslistnew@backslash@loop
|
||||
\fi
|
||||
}
|
||||
\long\def\pgfplotslistnew@impl@comma#1#2,{%
|
||||
\def\pgfplotslist@loc@TMPa{#2}%
|
||||
\ifx\pgfplotslist@loc@TMPa\pgfplotslist@EOI
|
||||
\else
|
||||
\pgfplotslistpushback{#2}\to#1\relax%
|
||||
\expandafter\pgfplotslistnew@backslash@loop
|
||||
\fi
|
||||
}
|
||||
\def\pgfplotslist@EOI{\pgfplotslist@EOI}
|
||||
\def\pgfplotslist@backslashsep{\\}
|
||||
|
||||
\long\def\pgfplotslist@check@backslash@list#1\\#2\pgfplotslist@EOI{%
|
||||
\def\pgfplotslist@loc@TMPx{#2}%
|
||||
\ifx\pgfplotslist@loc@TMPx\pgfutil@empty
|
||||
\pgfplotslist@is@backslash@terminatedfalse
|
||||
\let\pgfplotslist@check@backslash@list@next=\relax
|
||||
\else
|
||||
\def\pgfplotslist@loc@TMPy{ }%
|
||||
\ifx\pgfplotslist@loc@TMPx\pgfplotslist@loc@TMPy
|
||||
\pgfplotslist@is@backslash@terminatedfalse
|
||||
\let\pgfplotslist@check@backslash@list@next=\relax
|
||||
\else
|
||||
\ifx\pgfplotslist@loc@TMPx\pgfplotslist@backslashsep
|
||||
% ok. The list is something like 'a\\b\\' so the
|
||||
% complete input is
|
||||
% 'a\\b\\ \\ \EOI'
|
||||
% we have iterated long enough to find only the '\\'
|
||||
% right before the \EOI. It is thus backslash
|
||||
% terminated.
|
||||
\pgfplotslist@is@backslash@terminatedtrue
|
||||
\let\pgfplotslist@check@backslash@list@next=\relax
|
||||
\else
|
||||
% Iterate. We want to check the last list element.
|
||||
\long\def\pgfplotslist@check@backslash@list@next{\pgfplotslist@check@backslash@list#2\pgfplotslist@EOI}%
|
||||
\fi
|
||||
\fi
|
||||
\fi
|
||||
\pgfplotslist@check@backslash@list@next
|
||||
}%
|
||||
|
||||
% Copies list #1 to list #2.
|
||||
\def\pgfplotslistcopy#1\to#2{\let#2=#1}
|
||||
|
||||
|
||||
|
||||
|
||||
% #1: the item to prepend
|
||||
% #2: the list as macro name
|
||||
% Example:
|
||||
% \pgfplotslistpushfront Next first Element\to\foolist
|
||||
\long\def\pgfplotslistpushfront#1\to#2{%
|
||||
\t@pgfplots@toka={\pgfpl@@{#1}}%
|
||||
\t@pgfplots@tokb=\expandafter{#2}%
|
||||
\edef#2{\the\t@pgfplots@toka\the\t@pgfplots@tokb}%
|
||||
}
|
||||
\long\def\pgfplotslistpushfrontglobal#1\to#2{%
|
||||
\t@pgfplots@toka={\pgfpl@@{#1}}%
|
||||
\t@pgfplots@tokb=\expandafter{#2}%
|
||||
\xdef#2{\the\t@pgfplots@toka\the\t@pgfplots@tokb}%
|
||||
}
|
||||
|
||||
% Assembles a low-level list item representation into the token
|
||||
% register #2.
|
||||
\long\def\pgfplotslist@assembleentry#1\into#2{%
|
||||
#2={\pgfpl@@{#1}}%
|
||||
}
|
||||
|
||||
% #1: the item to append
|
||||
% #2: the list as macro name
|
||||
% Example:
|
||||
% \pgfplotslistpushback Next last element\to\foolist
|
||||
\long\def\pgfplotslistpushback#1\to#2{%
|
||||
\t@pgfplots@toka={\pgfpl@@{#1}}%
|
||||
\ifx#2\pgfutil@empty
|
||||
\t@pgfplots@tokb={}%
|
||||
\else
|
||||
\t@pgfplots@tokb=\expandafter{#2}%
|
||||
\fi
|
||||
\edef#2{\the\t@pgfplots@tokb\the\t@pgfplots@toka}%
|
||||
}
|
||||
% Adds '#1' to the GLOBAL list '#2'.
|
||||
\long\def\pgfplotslistpushbackglobal#1\to#2{%
|
||||
\t@pgfplots@toka={\pgfpl@@{#1}}%
|
||||
\ifx#2\pgfutil@empty
|
||||
\t@pgfplots@tokb={}%
|
||||
\else
|
||||
\t@pgfplots@tokb=\expandafter{#2}%
|
||||
\fi
|
||||
\xdef#2{\the\t@pgfplots@tokb\the\t@pgfplots@toka}%
|
||||
}
|
||||
|
||||
% Concatenates two lists #2 and #3 into #1
|
||||
% Example:
|
||||
% \pgfplotslistconcat\result=\foolist&\bar
|
||||
\long\def\pgfplotslistconcat#1=#2{%
|
||||
\t@pgfplots@toka=\expandafter{#2}%
|
||||
\t@pgfplots@tokb=\expandafter{#3}%
|
||||
\edef#1{\the\t@pgfplots@toka\the\t@pgfplots@tokb}%
|
||||
}
|
||||
|
||||
% implements #2 := pop_front(#1)
|
||||
% Example:
|
||||
% \pgfplotslistpopfront\foolist\to\poppedfirstelem
|
||||
\long\def\pgfplotslistpopfront#1\to#2{%
|
||||
\pgfplotslistcheckempty#1\relax
|
||||
\ifpgfplotslistempty
|
||||
\pgfplotsthrow{no such element}{#1}{\string\pgfplotslistpopfront\ from \string#1\ although list is EMPTY}\pgfeov%
|
||||
\else
|
||||
\expandafter\pgfplotslistpopfront@impl#1\pgfplotslistpopfront@macronames#1#2%
|
||||
\fi
|
||||
}
|
||||
\long\def\pgfplotslistfront#1\to#2{%
|
||||
\pgfplotslistcheckempty#1\relax
|
||||
\ifpgfplotslistempty
|
||||
\pgfplotsthrow{no such element}{#2}{\string\pgfplotslistfront\ from \string#1\ although list is EMPTY}\pgfeov%
|
||||
\else
|
||||
\expandafter\pgfplotslistfront@impl#1\pgfplotslistpopfront@macronames#2%
|
||||
\fi
|
||||
}
|
||||
|
||||
% implementation helper for listpopfront
|
||||
\long\def\pgfplotslistpopfront@impl\pgfpl@@#1#2\pgfplotslistpopfront@macronames#3#4{%
|
||||
\def#4{#1}%
|
||||
\def#3{#2}%
|
||||
}
|
||||
\long\def\pgfplotslistfront@impl\pgfpl@@#1#2\pgfplotslistpopfront@macronames#3{%
|
||||
\def#3{#1}%
|
||||
}
|
||||
|
||||
% Counts the number of elements in list #1, storing it into the count
|
||||
% register #2.
|
||||
% Example:
|
||||
% \pgfplotslistsize\foo\to{\count0}%
|
||||
% \the\count0
|
||||
\long\def\pgfplotslistsize#1\to#2{%
|
||||
#2=0%
|
||||
\long\def\pgfpl@@##1{\advance#2 by 1 }%
|
||||
#1%
|
||||
}
|
||||
|
||||
% Returns the #1th element of list #2 into macro #3
|
||||
% Arguments:
|
||||
% #1: a count 0,...,N-1 where N is the list size.
|
||||
% You may specify a number of a count.
|
||||
% #2: a list
|
||||
% #3: a macro name
|
||||
% Example:
|
||||
% Element 0:
|
||||
% \pgfplotslistselect0\of\foo\to\elem
|
||||
% \elem
|
||||
% Element \count1:
|
||||
% \pgfplotslistselect\count1\of\foo\to\elem
|
||||
\long\def\pgfplotslistselect#1\of#2\to#3{%
|
||||
\global\def\pgfplotslistselect@tmp{\pgfplotsthrow{no such element}{#3}{The requested list entry with index #1 of \string#2 is too large; this list has not enough elements.}\pgfeov}%
|
||||
\pgfplotslistselect@{#1}\of{#2}\to{#3}%
|
||||
}
|
||||
\long\def\pgfplotslistselect@#1\of#2\to#3{%
|
||||
\begingroup
|
||||
\count0=#1\relax
|
||||
\long\def\pgfpl@@##1{%
|
||||
\advance\count0 by-1\relax
|
||||
\ifnum\count0=-1\relax
|
||||
\global\def\pgfplotslistselect@tmp{\def#3{##1}}%
|
||||
\fi%
|
||||
}%
|
||||
#2%
|
||||
\endgroup
|
||||
\pgfplotslistselect@tmp
|
||||
}
|
||||
|
||||
% Selects a list entry. If it does not exist, '#' will be empty.
|
||||
\long\def\pgfplotslistselectorempty#1\of#2\to#3{%
|
||||
\global\def\pgfplotslistselect@tmp{\def#3{}}%
|
||||
\pgfplotslistselect@{#1}\of{#2}\to{#3}%
|
||||
}
|
||||
|
||||
% Changes the element at index '#1' of list '#2' to the content '#3'.
|
||||
%
|
||||
% This operation has quadratic (!) time in the worst case.
|
||||
\long\def\pgfplotslistset#1\of#2\to#3{%
|
||||
\ifcase#1\relax
|
||||
% change first:
|
||||
\def\pgfplotslistset@\pgfpl@@##1##2\relax{\def#2{\pgfpl@@{#3}##2}}%
|
||||
\expandafter\pgfplotslistset@#2\relax
|
||||
\or
|
||||
% change second:
|
||||
\def\pgfplotslistset@\pgfpl@@##1\pgfpl@@##2##3\relax{\def#2{\pgfpl@@{##1}\pgfpl@@{#3}##2}}%
|
||||
\expandafter\pgfplotslistset@#2\relax
|
||||
\or
|
||||
\def\pgfplotslistset@\pgfpl@@##1\pgfpl@@##2\pgfpl@@##3##4\relax{\def#2{\pgfpl@@{##1}\pgfpl@@{##2}\pgfpl@@{#3}##3}}%
|
||||
\expandafter\pgfplotslistset@#2\relax
|
||||
\or
|
||||
\def\pgfplotslistset@\pgfpl@@##1\pgfpl@@##2\pgfpl@@##3\pgfpl@@##4##5\relax{\def#2{\pgfpl@@{##1}\pgfpl@@{##2}\pgfpl@@{##3}\pgfpl@@{#3}##4}}%
|
||||
\expandafter\pgfplotslistset@#2\relax
|
||||
\else
|
||||
\begingroup
|
||||
\global\pgfplotslistnewempty\pgfplotslistnewempty\pgfplotslist@glob@TMPa
|
||||
\let\pgfpl@@=\pgfutil@empty % make sure it is not \relax.
|
||||
\count0=#1\relax
|
||||
\count1=0
|
||||
\def\pgfplotslistset@newelem{#3}%
|
||||
\expandafter\pgfplotslistset@loop#2\relax
|
||||
\ifnum\count1 =\count0
|
||||
\else
|
||||
\pgfplotsthrow{no such element}{\pgfplots@loc@TMPa}{\string\pgfplotslistset{\the\count0} failed because there are only \the\count1\space elements in the list. Use pushback to resize it.}\pgfeov%
|
||||
\global\let\pgfplotslist@glob@TMPa=\pgfplots@loc@TMPa
|
||||
\fi
|
||||
\endgroup
|
||||
\let#3=\pgfplotslist@glob@TMPa
|
||||
\global\let\pgfplotslist@glob@TMPa=\relax
|
||||
\fi
|
||||
}%
|
||||
|
||||
\def\pgfplotslistset@loop{%
|
||||
\pgfutil@ifnextchar\relax{%
|
||||
\pgfplotslistset@loop@break
|
||||
}{%
|
||||
\pgfplotslistset@loop@next
|
||||
}%
|
||||
}
|
||||
\def\pgfplotslistset@loop@break#1\relax{%
|
||||
% re-append remaining elements:
|
||||
\expandafter\gdef\expandafter\pgfplotslist@glob@TMPa\expandafter{\pgfplotslist@glob@TMPa#1}
|
||||
}%
|
||||
\def\pgfplotslistset@loop@next\pgfpl@@#1{%
|
||||
\ifnum\count1 =\count0
|
||||
% Ah - we found the element to replace!
|
||||
\expandafter\pgfplotslistpushbackglobal\expandafter{\pgfplotslistset@newelem}\to\pgfplotslist@glob@TMPa
|
||||
\expandafter\pgfplotslistset@loop@break
|
||||
\else
|
||||
\pgfplotslistpushbackglobal{#1}\to\pgfplotslist@glob@TMPa
|
||||
\advance\count1 by1
|
||||
\expandafter\pgfplotslistset@loop
|
||||
\fi
|
||||
}%
|
||||
|
||||
% Sets the boolean \ifpgfplotslistempty depending on whether list #1 is empty
|
||||
% or not.
|
||||
% Example:
|
||||
%
|
||||
% \pgfplotslistcheckempty\foolist
|
||||
% \ifpgfplotslistempty
|
||||
% List foolist is empty!
|
||||
% \else
|
||||
% List is not empty.
|
||||
% \fi
|
||||
\def\pgfplotslistcheckempty#1{%
|
||||
\ifx#1\pgfutil@empty
|
||||
\pgfplotslistemptytrue
|
||||
\else
|
||||
\ifx#1\relax
|
||||
\pgfplots@warning{WARNING: possible logic error in script code: the command \string\pgfplotslistcheckempty{\string#1} encountered an undefined argument.}%
|
||||
\pgfplotslistemptytrue
|
||||
\else
|
||||
\pgfplotslistemptyfalse
|
||||
\fi
|
||||
\fi
|
||||
}
|
||||
|
||||
|
||||
% Iterates through each list element, names it #2 and calls code #3.
|
||||
% Example:
|
||||
% \pgfplotslistnew\foolist{Eins\\Zwei\\Drei\\}%
|
||||
% \pgfplotslistforeach\foolist\as\foo{Element \foo\par}%
|
||||
% results in
|
||||
% Element Eins
|
||||
% Element Zwei
|
||||
% Element Drei
|
||||
% Each single element will be grouped with TeX groups.
|
||||
\long\def\pgfplotslistforeach#1\as#2#3{%
|
||||
\begingroup
|
||||
\long\def\pgfpl@@##1{%
|
||||
\t@pgfplots@tokc={##1}% this allows '#' inside of '##1'
|
||||
\edef#2{\the\t@pgfplots@tokc}%
|
||||
\begingroup #3\endgroup}%
|
||||
#1\relax
|
||||
\endgroup
|
||||
}
|
||||
|
||||
% The same but without groups around #3.
|
||||
%
|
||||
% The list can be nested.
|
||||
\long\def\pgfplotslistforeachungrouped#1\as#2#3{%
|
||||
\t@pgfplots@tokb={{#2}{#3}}%
|
||||
\t@pgfplots@tokc=\expandafter{#1}%
|
||||
\edef\pgfplotslist@loc@TMPa{%
|
||||
\noexpand\pgfplotslistforeachungrouped@
|
||||
\the\t@pgfplots@tokb%
|
||||
\the\t@pgfplots@tokc
|
||||
\noexpand\pgfpl@@\noexpand\pgfplotslistforeachungrouped@EOI
|
||||
}%
|
||||
\pgfplotslist@loc@TMPa
|
||||
}%
|
||||
|
||||
% Technical helper method which performs the loop.
|
||||
% ASSUMPTION:
|
||||
% \pgfplotslistforeachungrouped@
|
||||
% {<macro name>}
|
||||
% {<code to execute>}
|
||||
% \pgfpl@@{<list elem>}\pgfpl@@{<list elem>}\pgfpl@@{<list elem>}\pgfpl@@\pgfplotslistforeachungrouped@EOI
|
||||
%
|
||||
% -> iterate through argument until \pgfplotslistforeachungrouped@EOI
|
||||
% comes.
|
||||
\long\def\pgfplotslistforeachungrouped@#1#2\pgfpl@@#3{%
|
||||
\t@pgfplots@tokc={#3}% this allows '#' inside of '#3'
|
||||
\edef\pgfplotslist@loc@TMPa{\the\t@pgfplots@tokc}%
|
||||
\ifx\pgfplotslist@loc@TMPa\pgfplotslistforeachungrouped@EOI
|
||||
% ok, terminate loop.
|
||||
\let\pgfplotslistforeachungrouped@next=\relax
|
||||
\else
|
||||
% perform loop iteration ...
|
||||
\let#1=\pgfplotslist@loc@TMPa
|
||||
#2\relax
|
||||
% and continue iterating.
|
||||
\def\pgfplotslistforeachungrouped@next{\pgfplotslistforeachungrouped@{#1}{#2}}%
|
||||
\fi
|
||||
\pgfplotslistforeachungrouped@next
|
||||
}%
|
||||
\def\pgfplotslistforeachungrouped@EOI{\pgfplotslistforeachungrouped@EOI}% equals only itself in \ifx
|
||||
|
615
texmf/tex/latex/pgfplots/tex/pgfplotsliststructureext.code.tex
Normal file
615
texmf/tex/latex/pgfplots/tex/pgfplotsliststructureext.code.tex
Normal file
|
@ -0,0 +1,615 @@
|
|||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%
|
||||
% This is a helper package with an elementary list datastructure.
|
||||
% In contrast to \pgfplotslist, this one features fast append and fast
|
||||
% copy-to-macro.
|
||||
%
|
||||
% The 'pgfplotsapplist' is a list which has ONLY the features
|
||||
%
|
||||
% \pgfplotsapplistnewempty
|
||||
% \pgfplotsapplistpushback O(1)
|
||||
% \pgfplotsapplistedefcontenttomacro (N)
|
||||
% \pgfplotsapplistxdefcontenttomacro (N)
|
||||
%
|
||||
% It has been designed to accumulate macro content in O(N) (in
|
||||
% contrast to TeX's macro append routines which lead to O(N^2)
|
||||
% runtime).
|
||||
%
|
||||
% Furthermore, there is the
|
||||
%
|
||||
% \pgfplotsapplistXnewempty
|
||||
% \pgfplotsapplistXpushback
|
||||
% \pgfplotsapplistXedefcontenttomacro (N)
|
||||
% \pgfplotsapplistXxdefcontenttomacro (N)
|
||||
% \pgfplotsapplistXlet (N)
|
||||
%
|
||||
% structure which features **preasymptotical** constant runtime for
|
||||
% pushback. That means, as long as N < 80000, the runtime is linear.
|
||||
% It is only slightly slower than \pgfplotsapplist, and that only due
|
||||
% to its generality. It could easily be adopted to be FASTER than
|
||||
% \pgfplotsapplist.
|
||||
%
|
||||
% Credits for \pgfplotsapplist go to Till Tantau: he developped it for
|
||||
% the PGF kernel.
|
||||
%
|
||||
%
|
||||
% Copyright 2007/2008 by Christian Feuersänger.
|
||||
%
|
||||
% This program is free software: you can redistribute it and/or modify
|
||||
% 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/>.
|
||||
%
|
||||
%
|
||||
%
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
|
||||
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% the applist defines one macro for each element, like
|
||||
%
|
||||
% \def\element<i>{<content>\element<i+1>}
|
||||
% \def\element<i+1>{<content>\element<i+2>}
|
||||
% \def\element<i+2>{}
|
||||
%
|
||||
% The '<i>' value belongs to the private interface and is part of the
|
||||
% macro name.
|
||||
%
|
||||
% It features:
|
||||
% - real O(1) pushback
|
||||
% - O(N) edef to macro
|
||||
% - O(N) execute
|
||||
% - it requires O(N) different macros.
|
||||
% - it ***can't*** be copied outside of the current TeX group!
|
||||
%
|
||||
% I have never used it (besides early tests)
|
||||
%
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
|
||||
% Time: O(1), number of macros: 3
|
||||
\def\pgfplotsapplistnewempty#1{%
|
||||
\expandafter\def\csname\string#1@endno\endcsname{0}%
|
||||
\edef#1{\expandafter\noexpand\csname\string#1@0\endcsname}%
|
||||
\expandafter\def\csname\string#1@0\endcsname{}%
|
||||
}%
|
||||
|
||||
% Time: O(1), number of macros per list: about N
|
||||
% #1: the item to append
|
||||
% #2: the list as macro name
|
||||
\long\def\pgfplotsapplistpushback#1\to#2{%
|
||||
\expandafter\let\expandafter\pgfplots@loc@TMPa\csname\string#2@endno\endcsname
|
||||
\begingroup
|
||||
\c@pgf@counta=\pgfplots@loc@TMPa\relax
|
||||
\advance\c@pgf@counta by1
|
||||
\xdef\pgfplots@glob@TMPa{\the\c@pgf@counta}%
|
||||
\endgroup
|
||||
\expandafter\let\csname\string#2@endno\endcsname=\pgfplots@glob@TMPa%
|
||||
\t@pgfplots@toka={#1}%
|
||||
\t@pgfplots@tokb=\expandafter{\csname\string#2@\pgfplots@glob@TMPa\endcsname}%
|
||||
\expandafter\edef\csname\string#2@\pgfplots@loc@TMPa\endcsname{\the\t@pgfplots@toka\the\t@pgfplots@tokb}%
|
||||
\expandafter\let\the\t@pgfplots@tokb=\pgfutil@empty
|
||||
}%
|
||||
|
||||
% time O(N)
|
||||
% Expands the complete content of list #1 as-is into the macro #2.
|
||||
\def\pgfplotsapplistedefcontenttomacro#1\to#2{\edef#2{#1}}
|
||||
\def\pgfplotsapplistxdefcontenttomacro#1\to#2{\xdef#2{#1}}
|
||||
|
||||
% Foreach list element, the stored value will simply be processed by
|
||||
% TeX. Characters will be printed and commands will be executed.
|
||||
% time O(N)
|
||||
\def\pgfplotsapplistexecute#1{#1}%
|
||||
|
||||
|
||||
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
|
||||
%
|
||||
% This list here is a general re-implementation of the list used in
|
||||
% the PGF system layer.
|
||||
% It employs two collect-buffers to reduce the runtime.
|
||||
%
|
||||
% - It has preasymptotical runtime O(N), but is O(N^2) asymptotically.
|
||||
% - It requires only 5 macros per list.
|
||||
%
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
% Usage:
|
||||
% \pgfplotsapplistXnewempty\macro
|
||||
% \pgfplotsapplistXnewempty[to global]\macro
|
||||
%
|
||||
% The 'to global' flag will configure the list such that all
|
||||
% assignments to \macro are global. The list accumulation is
|
||||
% LOCAL, however: 'to global' is to be used inside of a local
|
||||
% group such that the final result, when all buffers are flushed,
|
||||
% is assigned globally.
|
||||
%
|
||||
% ATTENTION: maybe that [to global] thing is useless.
|
||||
% Consider using the \pgfplotsapplistXglobal list (see below)
|
||||
\def\pgfplotsapplistXnewempty{%
|
||||
\pgfutil@ifnextchar[{%
|
||||
\pgfplotsapplistXnewempty@opt
|
||||
}{%
|
||||
\pgfplotsapplistXnewempty@opt[]%
|
||||
}%
|
||||
}
|
||||
|
||||
\def\pgfplotsapplistXnewempty@opt@TOGLOBAL{to global}
|
||||
|
||||
\def\pgfplotsapplistXnewempty@opt[#1]#2{%
|
||||
\def\pgfplots@loc@TMPa{#1}%
|
||||
\ifx\pgfplots@loc@TMPa\pgfutil@empty
|
||||
\expandafter\let\csname\string#2@let\endcsname=\let%
|
||||
\expandafter\let\csname\string#2@edef\endcsname=\edef
|
||||
\else
|
||||
\ifx\pgfplots@loc@TMPa\pgfplotsapplistXnewempty@opt@TOGLOBAL
|
||||
\expandafter\def\csname\string#2@let\endcsname{\global\let}%
|
||||
\expandafter\let\csname\string#2@edef\endcsname=\xdef
|
||||
\else
|
||||
\pgfplots@error{Sorry, the argument '#1' to \string\pgfplotsapplistXnewempty\ is unknown. Accepted is 'to global' or empty.}%
|
||||
\fi
|
||||
\fi
|
||||
\pgfplotsapplistXnewempty@{#2}%
|
||||
}%
|
||||
|
||||
\def\pgfplotsapplistXnewempty@#1{%
|
||||
\csname\string#1@let\endcsname#1=\pgfutil@empty
|
||||
\expandafter\let\csname\string#1@smallbuf\endcsname=\pgfutil@empty
|
||||
\expandafter\let\csname\string#1@bigbuf\endcsname=\pgfutil@empty
|
||||
\expandafter\def\csname\string#1@smallbuf@c\endcsname{0}%
|
||||
\expandafter\def\csname\string#1@bigbuf@c\endcsname{0}%
|
||||
}%
|
||||
|
||||
% #1: the item to append
|
||||
% #2: the list as macro name
|
||||
\long\def\pgfplotsapplistXpushback#1\to#2{%
|
||||
\begingroup
|
||||
\c@pgf@counta=\csname\string#2@smallbuf@c\endcsname\relax
|
||||
\advance\c@pgf@counta by1
|
||||
\xdef\pgfplots@glob@TMPa{\the\c@pgf@counta}%
|
||||
\endgroup
|
||||
\expandafter\let\csname\string#2@smallbuf@c\endcsname=\pgfplots@glob@TMPa
|
||||
\ifnum\csname\string#2@smallbuf@c\endcsname<40
|
||||
\t@pgfplots@toka=\expandafter\expandafter\expandafter{\csname\string#2@smallbuf\endcsname#1}%
|
||||
\expandafter\edef\csname\string#2@smallbuf\endcsname{\the\t@pgfplots@toka}%
|
||||
\else
|
||||
\pgfplotsapplistXpushback@smallbufoverfl{#1}{#2}%
|
||||
\fi
|
||||
}%
|
||||
\long\def\pgfplotsapplistXpushback@smallbufoverfl#1#2{%
|
||||
\begingroup
|
||||
\c@pgf@counta=\csname\string#2@bigbuf@c\endcsname\relax
|
||||
\advance\c@pgf@counta by1
|
||||
\xdef\pgfplots@glob@TMPa{\the\c@pgf@counta}%
|
||||
\endgroup
|
||||
\expandafter\let\csname\string#2@bigbuf@c\endcsname=\pgfplots@glob@TMPa
|
||||
%
|
||||
\ifnum\csname\string#2@bigbuf@c\endcsname<30
|
||||
\t@pgfplots@toka=\expandafter\expandafter\expandafter{\csname\string#2@bigbuf\endcsname}%
|
||||
\t@pgfplots@tokb=\expandafter\expandafter\expandafter{\csname\string#2@smallbuf\endcsname#1}%
|
||||
\expandafter\edef\csname\string#2@bigbuf\endcsname{\the\t@pgfplots@toka\the\t@pgfplots@tokb}%
|
||||
\expandafter\let\csname\string#2@smallbuf\endcsname=\pgfutil@empty
|
||||
\expandafter\def\csname\string#2@smallbuf@c\endcsname{0}%
|
||||
\else%
|
||||
\t@pgfplots@toka=\expandafter{#2}%
|
||||
\t@pgfplots@tokb=\expandafter\expandafter\expandafter{\csname\string#2@bigbuf\endcsname}%
|
||||
\t@pgfplots@tokc=\expandafter\expandafter\expandafter{\csname\string#2@smallbuf\endcsname#1}%
|
||||
\csname\string#2@edef\endcsname#2{\the\t@pgfplots@toka\the\t@pgfplots@tokb\the\t@pgfplots@tokc}%
|
||||
\expandafter\let\csname\string#2@smallbuf\endcsname=\pgfutil@empty
|
||||
\expandafter\def\csname\string#2@smallbuf@c\endcsname{0}%
|
||||
\expandafter\let\csname\string#2@bigbuf\endcsname=\pgfutil@empty
|
||||
\expandafter\def\csname\string#2@bigbuf@c\endcsname{0}%
|
||||
\fi%
|
||||
}%
|
||||
\def\pgfplotsapplistXflushbuffers#1{%
|
||||
\t@pgfplots@toka=\expandafter{#1}%
|
||||
\t@pgfplots@tokb=\expandafter\expandafter\expandafter{\csname\string#1@bigbuf\endcsname}%
|
||||
\t@pgfplots@tokc=\expandafter\expandafter\expandafter{\csname\string#1@smallbuf\endcsname}%
|
||||
\csname\string#1@edef\endcsname#1{\the\t@pgfplots@toka\the\t@pgfplots@tokb\the\t@pgfplots@tokc}%
|
||||
\expandafter\let\csname\string#1@smallbuf\endcsname=\pgfutil@empty
|
||||
\expandafter\def\csname\string#1@smallbuf@c\endcsname{0}%
|
||||
\expandafter\let\csname\string#1@bigbuf\endcsname=\pgfutil@empty
|
||||
\expandafter\def\csname\string#1@bigbuf@c\endcsname{0}%
|
||||
}%
|
||||
|
||||
|
||||
% Expands the complete content of list #1 as-is into the macro #2.
|
||||
\def\pgfplotsapplistXedefcontenttomacro#1\to#2{%
|
||||
\pgfplotsapplistXflushbuffers#1%
|
||||
\edef#2{#1}}
|
||||
\def\pgfplotsapplistXxdefcontenttomacro#1\to#2{%
|
||||
\pgfplotsapplistXflushbuffers#1%
|
||||
\xdef#2{#1}}
|
||||
\def\pgfplotsapplistXlet#1=#2{%
|
||||
\pgfplotsapplistXflushbuffers#2%
|
||||
\let#1=#2}
|
||||
|
||||
% Foreach list element, the stored value will simply be processed by
|
||||
% TeX. Characters will be printed and commands will be executed.
|
||||
\def\pgfplotsapplistXexecute#1{%
|
||||
\pgfplotsapplistXflushbuffers#1%
|
||||
#1}%
|
||||
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%
|
||||
% A variant of applist which has the same runtime requirements, but
|
||||
% does PUSH FRONT only.
|
||||
%
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
|
||||
% Usage:
|
||||
% \pgfplotsprependlistXnewempty{liste}
|
||||
\def\pgfplotsprependlistXnewempty#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}%
|
||||
}%
|
||||
|
||||
% #1: the item to append
|
||||
% #2: the list as macro name
|
||||
\long\def\pgfplotsprependlistXpushfront#1\to#2{%
|
||||
\begingroup
|
||||
\c@pgf@counta=\csname pgfpPRP@#2@smallbuf@c\endcsname\relax
|
||||
\advance\c@pgf@counta by1
|
||||
\xdef\pgfplots@glob@TMPa{\the\c@pgf@counta}%
|
||||
\endgroup
|
||||
\expandafter\let\csname pgfpPRP@#2@smallbuf@c\endcsname=\pgfplots@glob@TMPa
|
||||
\ifnum\csname pgfpPRP@#2@smallbuf@c\endcsname<40
|
||||
\t@pgfplots@toka=\expandafter\expandafter\expandafter{\csname pgfpPRP@#2@smallbuf\endcsname}%
|
||||
\t@pgfplots@tokb={#1}%
|
||||
\expandafter\edef\csname pgfpPRP@#2@smallbuf\endcsname{\the\t@pgfplots@tokb\the\t@pgfplots@toka}%
|
||||
\else
|
||||
\pgfplotsprependlistXpushfront@smallbufoverfl{#1}{#2}%
|
||||
\fi
|
||||
}%
|
||||
\long\def\pgfplotsprependlistXpushfront@smallbufoverfl#1#2{%
|
||||
\begingroup
|
||||
\c@pgf@counta=\csname pgfpPRP@#2@bigbuf@c\endcsname\relax
|
||||
\advance\c@pgf@counta by1
|
||||
\xdef\pgfplots@glob@TMPa{\the\c@pgf@counta}%
|
||||
\endgroup
|
||||
\expandafter\let\csname pgfpPRP@#2@bigbuf@c\endcsname=\pgfplots@glob@TMPa
|
||||
%
|
||||
\ifnum\csname pgfpPRP@#2@bigbuf@c\endcsname<30
|
||||
\t@pgfplots@toka=\expandafter\expandafter\expandafter{\csname pgfpPRP@#2@bigbuf\endcsname}%
|
||||
\t@pgfplots@tokb=\expandafter\expandafter\expandafter{\csname pgfpPRP@#2@smallbuf\endcsname}%
|
||||
\t@pgfplots@tokc={#1}%
|
||||
\expandafter\edef\csname pgfpPRP@#2@bigbuf\endcsname{\the\t@pgfplots@tokc\the\t@pgfplots@tokb\the\t@pgfplots@toka}%
|
||||
\expandafter\let\csname pgfpPRP@#2@smallbuf\endcsname=\pgfutil@empty
|
||||
\expandafter\def\csname pgfpPRP@#2@smallbuf@c\endcsname{0}%
|
||||
\else%
|
||||
\pgfplotsprependlistXflushbuffers{#2}%
|
||||
\t@pgfplots@toka=\expandafter\expandafter\expandafter{\csname pgfpPRP@#2\endcsname}%
|
||||
\t@pgfplots@tokb={#1}%
|
||||
\expandafter\edef\csname pgfpPRP@#2\endcsname{\the\t@pgfplots@tokb\the\t@pgfplots@toka}%
|
||||
\fi%
|
||||
}%
|
||||
\def\pgfplotsprependlistXflushbuffers#1{%
|
||||
\t@pgfplots@toka=\expandafter\expandafter\expandafter{\csname pgfpPRP@#1\endcsname}%
|
||||
\t@pgfplots@tokb=\expandafter\expandafter\expandafter{\csname pgfpPRP@#1@bigbuf\endcsname}%
|
||||
\t@pgfplots@tokc=\expandafter\expandafter\expandafter{\csname pgfpPRP@#1@smallbuf\endcsname}%
|
||||
\expandafter\edef\csname pgfpPRP@#1\endcsname{\the\t@pgfplots@tokc\the\t@pgfplots@tokb\the\t@pgfplots@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\pgfplotsprependlistXlet#1=#2{%
|
||||
\pgfplotsprependlistXflushbuffers{#2}%
|
||||
\expandafter\let\expandafter#1\csname pgfpPRP@#2\endcsname}
|
||||
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
|
||||
%
|
||||
% This list \pgfplotsapplistXX here is essentially the SAME as \pgfplotslistX.
|
||||
%
|
||||
% But there can only be one such list at a time, so it is faster than
|
||||
% \pgfplotslistX.
|
||||
%
|
||||
% This here is probably the fastest list.
|
||||
%
|
||||
% It is nothing else but a copy of Till Tantau's pgf kernel list.
|
||||
%
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
|
||||
|
||||
|
||||
|
||||
% WARNING: call \pgfplotsapplistclear if there is another list active.
|
||||
\def\pgfplotsapplistXXnewempty{%
|
||||
\pgfutil@ifundefined{pgfplotsapplistXX}{}{%
|
||||
\ifx\pgfplotsapplistXX\pgfutil@empty
|
||||
\else
|
||||
\pgfplots@error{\string\pgfplotsapplistXXnewempty: there is already another list which is *not* empty. It currently contains '\meaning\pgfplotsapplistXX'. Please call '\string\pgfplotsapplistXXclear' before using a new list to ensure clean separations.}%
|
||||
\fi
|
||||
}%
|
||||
\let\pgfplotsapplistXX=\pgfutil@empty
|
||||
\let\pgfplotsapplistXX@smallbuf=\pgfutil@empty
|
||||
\let\pgfplotsapplistXX@bigbuf=\pgfutil@empty
|
||||
\def\pgfplotsapplistXX@smallbuf@c{0}%
|
||||
\def\pgfplotsapplistXX@bigbuf@c{0}%
|
||||
}%
|
||||
|
||||
|
||||
\def\pgfplotsapplistXXclear{%
|
||||
\pgfutil@ifundefined{pgfplotsapplistXX}{}{%
|
||||
\let\pgfplotsapplistXX=\pgfutil@empty
|
||||
\let\pgfplotsapplistXX@smallbuf=\pgfutil@empty
|
||||
\let\pgfplotsapplistXX@bigbuf=\pgfutil@empty
|
||||
\def\pgfplotsapplistXX@smallbuf@c{0}%
|
||||
\def\pgfplotsapplistXX@bigbuf@c{0}%
|
||||
}%
|
||||
}%
|
||||
|
||||
% #1: the item to append
|
||||
% #2: the list as macro name
|
||||
\long\def\pgfplotsapplistXXpushback#1{%
|
||||
\begingroup
|
||||
\c@pgf@counta=\pgfplotsapplistXX@smallbuf@c\relax
|
||||
\advance\c@pgf@counta by1
|
||||
\xdef\pgfplots@glob@TMPa{\the\c@pgf@counta}%
|
||||
\endgroup
|
||||
\let\pgfplotsapplistXX@smallbuf@c=\pgfplots@glob@TMPa
|
||||
\ifnum\pgfplotsapplistXX@smallbuf@c<40
|
||||
\t@pgfplots@toka=\expandafter{\pgfplotsapplistXX@smallbuf#1}%
|
||||
\edef\pgfplotsapplistXX@smallbuf{\the\t@pgfplots@toka}%
|
||||
\else
|
||||
\pgfplotsapplistXXpushback@smallbufoverfl{#1}%
|
||||
\fi
|
||||
}%
|
||||
\long\def\pgfplotsapplistXXpushback@smallbufoverfl#1{%
|
||||
\begingroup
|
||||
\c@pgf@counta=\pgfplotsapplistXX@bigbuf@c\relax
|
||||
\advance\c@pgf@counta by1
|
||||
\xdef\pgfplots@glob@TMPa{\the\c@pgf@counta}%
|
||||
\endgroup
|
||||
\let\pgfplotsapplistXX@bigbuf@c=\pgfplots@glob@TMPa
|
||||
%
|
||||
\ifnum\pgfplotsapplistXX@bigbuf@c<30
|
||||
\t@pgfplots@toka=\expandafter{\pgfplotsapplistXX@bigbuf}%
|
||||
\t@pgfplots@tokb=\expandafter{\pgfplotsapplistXX@smallbuf#1}%
|
||||
\edef\pgfplotsapplistXX@bigbuf{\the\t@pgfplots@toka\the\t@pgfplots@tokb}%
|
||||
\let\pgfplotsapplistXX@smallbuf=\pgfutil@empty
|
||||
\def\pgfplotsapplistXX@smallbuf@c{0}%
|
||||
\else%
|
||||
\t@pgfplots@toka=\expandafter{\pgfplotsapplistXX}%
|
||||
\t@pgfplots@tokb=\expandafter{\pgfplotsapplistXX@bigbuf}%
|
||||
\t@pgfplots@tokc=\expandafter{\pgfplotsapplistXX@smallbuf#1}%
|
||||
\edef\pgfplotsapplistXX{\the\t@pgfplots@toka\the\t@pgfplots@tokb\the\t@pgfplots@tokc}%
|
||||
\let\pgfplotsapplistXX@smallbuf=\pgfutil@empty
|
||||
\def\pgfplotsapplistXX@smallbuf@c{0}%
|
||||
\let\pgfplotsapplistXX@bigbuf=\pgfutil@empty
|
||||
\def\pgfplotsapplistXX@bigbuf@c{0}%
|
||||
\fi%
|
||||
}%
|
||||
\def\pgfplotsapplistXXflushbuffers{%
|
||||
\t@pgfplots@toka=\expandafter{\pgfplotsapplistXX}%
|
||||
\t@pgfplots@tokb=\expandafter{\pgfplotsapplistXX@bigbuf}%
|
||||
\t@pgfplots@tokc=\expandafter{\pgfplotsapplistXX@smallbuf}%
|
||||
\edef\pgfplotsapplistXX{\the\t@pgfplots@toka\the\t@pgfplots@tokb\the\t@pgfplots@tokc}%
|
||||
\let\pgfplotsapplistXX@smallbuf=\pgfutil@empty
|
||||
\def\pgfplotsapplistXX@smallbuf@c{0}%
|
||||
\let\pgfplotsapplistXX@bigbuf=\pgfutil@empty
|
||||
\def\pgfplotsapplistXX@bigbuf@c{0}%
|
||||
}%
|
||||
|
||||
|
||||
% Expands the complete content of list #1 as-is into the macro #2.
|
||||
\def\pgfplotsapplistXXedefcontenttomacro#1{%
|
||||
\pgfplotsapplistXXflushbuffers
|
||||
\edef#1{\pgfplotsapplistXX}}
|
||||
\def\pgfplotsapplistXXxdefcontenttomacro#1{%
|
||||
\pgfplotsapplistXXflushbuffers%
|
||||
\xdef#1{\pgfplotsapplistXX}}
|
||||
\def\pgfplotsapplistXXlet#1{%
|
||||
\pgfplotsapplistXXflushbuffers%
|
||||
\let#1=\pgfplotsapplistXX}
|
||||
|
||||
% Foreach list element, the stored value will simply be processed by
|
||||
% TeX. Characters will be printed and commands will be executed.
|
||||
\def\pgfplotsapplistXXexecute#1{%
|
||||
\pgfplotsapplistXXflushbuffers
|
||||
#1}%
|
||||
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
|
||||
%
|
||||
% \pgfplotslistXXglobal assigns to a global list.
|
||||
%
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
|
||||
\def\pgfplotsapplistXXglobalnewempty{%
|
||||
\pgfutil@ifundefined{pgfplotsapplistXXglobal}{}{%
|
||||
\ifx\pgfplotsapplistXXglobal\pgfutil@empty
|
||||
\else
|
||||
\pgfplots@error{\string\pgfplotsapplistXXglobalnewempty: there is already another list which is *not* empty. It currently contains '\meaning\pgfplotsapplistXXglobal'. Please call '\string\pgfplotsapplistXXglobalclear' before using a new list to ensure clean separations.}%
|
||||
\fi
|
||||
}%
|
||||
\global\let\pgfplotsapplistXXglobal=\pgfutil@empty
|
||||
\global\let\pgfplotsapplistXXglobal@smallbuf=\pgfutil@empty
|
||||
\global\let\pgfplotsapplistXXglobal@bigbuf=\pgfutil@empty
|
||||
\gdef\pgfplotsapplistXXglobal@smallbuf@c{0}%
|
||||
\gdef\pgfplotsapplistXXglobal@bigbuf@c{0}%
|
||||
}%
|
||||
|
||||
|
||||
\def\pgfplotsapplistXXglobalclear{%
|
||||
\pgfutil@ifundefined{pgfplotsapplistXXglobal}{}{%
|
||||
\global\let\pgfplotsapplistXXglobal=\pgfutil@empty
|
||||
\global\let\pgfplotsapplistXXglobal@smallbuf=\pgfutil@empty
|
||||
\global\let\pgfplotsapplistXXglobal@bigbuf=\pgfutil@empty
|
||||
\gdef\pgfplotsapplistXXglobal@smallbuf@c{0}%
|
||||
\gdef\pgfplotsapplistXXglobal@bigbuf@c{0}%
|
||||
}%
|
||||
}%
|
||||
|
||||
% #1: the item to append
|
||||
% #2: the list as macro name
|
||||
\long\def\pgfplotsapplistXXglobalpushback#1{%
|
||||
\begingroup
|
||||
\c@pgf@counta=\pgfplotsapplistXXglobal@smallbuf@c\relax
|
||||
\advance\c@pgf@counta by1
|
||||
\xdef\pgfplots@glob@TMPa{\the\c@pgf@counta}%
|
||||
\endgroup
|
||||
\global\let\pgfplotsapplistXXglobal@smallbuf@c=\pgfplots@glob@TMPa
|
||||
\ifnum\pgfplotsapplistXXglobal@smallbuf@c<40
|
||||
\t@pgfplots@toka=\expandafter{\pgfplotsapplistXXglobal@smallbuf#1}%
|
||||
\xdef\pgfplotsapplistXXglobal@smallbuf{\the\t@pgfplots@toka}%
|
||||
\else
|
||||
\pgfplotsapplistXXglobalpushback@smallbufoverfl{#1}%
|
||||
\fi
|
||||
}%
|
||||
\long\def\pgfplotsapplistXXglobalpushback@smallbufoverfl#1{%
|
||||
\begingroup
|
||||
\c@pgf@counta=\pgfplotsapplistXXglobal@bigbuf@c\relax
|
||||
\advance\c@pgf@counta by1
|
||||
\xdef\pgfplots@glob@TMPa{\the\c@pgf@counta}%
|
||||
\endgroup
|
||||
\global\let\pgfplotsapplistXXglobal@bigbuf@c=\pgfplots@glob@TMPa
|
||||
%
|
||||
\ifnum\pgfplotsapplistXXglobal@bigbuf@c<30
|
||||
\t@pgfplots@toka=\expandafter{\pgfplotsapplistXXglobal@bigbuf}%
|
||||
\t@pgfplots@tokb=\expandafter{\pgfplotsapplistXXglobal@smallbuf#1}%
|
||||
\xdef\pgfplotsapplistXXglobal@bigbuf{\the\t@pgfplots@toka\the\t@pgfplots@tokb}%
|
||||
\global\let\pgfplotsapplistXXglobal@smallbuf=\pgfutil@empty
|
||||
\gdef\pgfplotsapplistXXglobal@smallbuf@c{0}%
|
||||
\else%
|
||||
\t@pgfplots@toka=\expandafter{\pgfplotsapplistXXglobal}%
|
||||
\t@pgfplots@tokb=\expandafter{\pgfplotsapplistXXglobal@bigbuf}%
|
||||
\t@pgfplots@tokc=\expandafter{\pgfplotsapplistXXglobal@smallbuf#1}%
|
||||
\xdef\pgfplotsapplistXXglobal{\the\t@pgfplots@toka\the\t@pgfplots@tokb\the\t@pgfplots@tokc}%
|
||||
\global\let\pgfplotsapplistXXglobal@smallbuf=\pgfutil@empty
|
||||
\gdef\pgfplotsapplistXXglobal@smallbuf@c{0}%
|
||||
\global\let\pgfplotsapplistXXglobal@bigbuf=\pgfutil@empty
|
||||
\gdef\pgfplotsapplistXXglobal@bigbuf@c{0}%
|
||||
\fi%
|
||||
}%
|
||||
\def\pgfplotsapplistXXglobalflushbuffers{%
|
||||
\t@pgfplots@toka=\expandafter{\pgfplotsapplistXXglobal}%
|
||||
\t@pgfplots@tokb=\expandafter{\pgfplotsapplistXXglobal@bigbuf}%
|
||||
\t@pgfplots@tokc=\expandafter{\pgfplotsapplistXXglobal@smallbuf}%
|
||||
\xdef\pgfplotsapplistXXglobal{\the\t@pgfplots@toka\the\t@pgfplots@tokb\the\t@pgfplots@tokc}%
|
||||
\global\let\pgfplotsapplistXXglobal@smallbuf=\pgfutil@empty
|
||||
\gdef\pgfplotsapplistXXglobal@smallbuf@c{0}%
|
||||
\global\let\pgfplotsapplistXXglobal@bigbuf=\pgfutil@empty
|
||||
\gdef\pgfplotsapplistXXglobal@bigbuf@c{0}%
|
||||
}%
|
||||
|
||||
|
||||
% Expands the complete content of list #1 as-is into the macro #2.
|
||||
%
|
||||
% this assigns locally into #1.
|
||||
\def\pgfplotsapplistXXglobaledefcontenttomacro#1{%
|
||||
\pgfplotsapplistXXglobalflushbuffers
|
||||
\edef#1{\pgfplotsapplistXXglobal}}
|
||||
% this assigns locally into #1.
|
||||
\def\pgfplotsapplistXXglobalxdefcontenttomacro#1{%
|
||||
\pgfplotsapplistXXglobalflushbuffers%
|
||||
\xdef#1{\pgfplotsapplistXXglobal}}
|
||||
% this assigns locally into #1.
|
||||
\def\pgfplotsapplistXXgloballet#1{%
|
||||
\pgfplotsapplistXXglobalflushbuffers%
|
||||
\let#1=\pgfplotsapplistXXglobal}
|
||||
|
||||
% Foreach list element, the stored value will simply be processed by
|
||||
% TeX. Characters will be printed and commands will be executed.
|
||||
% this assigns locally into #1.
|
||||
\def\pgfplotsapplistXXglobalexecute#1{%
|
||||
\pgfplotsapplistXXglobalflushbuffers
|
||||
#1}%
|
||||
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%
|
||||
% \pgfplotsapplistXglobalnewempty --> same as \pgfplotsapplistX, but
|
||||
% it always assigns everything *globally*.
|
||||
%
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
\def\pgfplotsgloballet{\global\let}%
|
||||
|
||||
% Usage:
|
||||
% \pgfplotsapplistXglobalnewempty\macro
|
||||
% \pgfplotsapplistXglobalnewempty[to global]\macro
|
||||
%
|
||||
% The 'to global' flag will configure the list such that all
|
||||
% assignments to \macro are global. The list accumulation is
|
||||
% LOCAL, however: 'to global' is to be used inside of a local
|
||||
% group such that the final result, when all buffers are flushed,
|
||||
% is assigned globally.
|
||||
\def\pgfplotsapplistXglobalnewempty#1{%
|
||||
\pgfplotsgloballet#1=\pgfutil@empty
|
||||
\expandafter\pgfplotsgloballet\csname\string#1@smallbuf\endcsname=\pgfutil@empty
|
||||
\expandafter\pgfplotsgloballet\csname\string#1@bigbuf\endcsname=\pgfutil@empty
|
||||
\expandafter\gdef\csname\string#1@smallbuf@c\endcsname{0}%
|
||||
\expandafter\gdef\csname\string#1@bigbuf@c\endcsname{0}%
|
||||
}%
|
||||
|
||||
% #1: the item to append
|
||||
% #2: the list as macro name
|
||||
\long\def\pgfplotsapplistXglobalpushback#1\to#2{%
|
||||
\begingroup
|
||||
\c@pgf@counta=\csname\string#2@smallbuf@c\endcsname\relax
|
||||
\advance\c@pgf@counta by1
|
||||
\expandafter\xdef\csname\string#2@smallbuf@c\endcsname{\the\c@pgf@counta}%
|
||||
\endgroup
|
||||
\ifnum\csname\string#2@smallbuf@c\endcsname<40
|
||||
\t@pgfplots@toka=\expandafter\expandafter\expandafter{\csname\string#2@smallbuf\endcsname#1}%
|
||||
\expandafter\xdef\csname\string#2@smallbuf\endcsname{\the\t@pgfplots@toka}%
|
||||
\else
|
||||
\pgfplotsapplistXglobalpushback@smallbufoverfl{#1}{#2}%
|
||||
\fi
|
||||
}%
|
||||
\long\def\pgfplotsapplistXglobalpushback@smallbufoverfl#1#2{%
|
||||
\begingroup
|
||||
\c@pgf@counta=\csname\string#2@bigbuf@c\endcsname\relax
|
||||
\advance\c@pgf@counta by1
|
||||
\expandafter\xdef\csname\string#2@bigbuf@c\endcsname{\the\c@pgf@counta}%
|
||||
\endgroup
|
||||
%
|
||||
\ifnum\csname\string#2@bigbuf@c\endcsname<30
|
||||
\t@pgfplots@toka=\expandafter\expandafter\expandafter{\csname\string#2@bigbuf\endcsname}%
|
||||
\t@pgfplots@tokb=\expandafter\expandafter\expandafter{\csname\string#2@smallbuf\endcsname#1}%
|
||||
\expandafter\xdef\csname\string#2@bigbuf\endcsname{\the\t@pgfplots@toka\the\t@pgfplots@tokb}%
|
||||
\expandafter\pgfplotsgloballet\csname\string#2@smallbuf\endcsname=\pgfutil@empty
|
||||
\expandafter\gdef\csname\string#2@smallbuf@c\endcsname{0}%
|
||||
\else%
|
||||
\t@pgfplots@toka=\expandafter{#2}%
|
||||
\t@pgfplots@tokb=\expandafter\expandafter\expandafter{\csname\string#2@bigbuf\endcsname}%
|
||||
\t@pgfplots@tokc=\expandafter\expandafter\expandafter{\csname\string#2@smallbuf\endcsname#1}%
|
||||
\xdef#2{\the\t@pgfplots@toka\the\t@pgfplots@tokb\the\t@pgfplots@tokc}%
|
||||
\expandafter\pgfplotsgloballet\csname\string#2@smallbuf\endcsname=\pgfutil@empty
|
||||
\expandafter\gdef\csname\string#2@smallbuf@c\endcsname{0}%
|
||||
\expandafter\pgfplotsgloballet\csname\string#2@bigbuf\endcsname=\pgfutil@empty
|
||||
\expandafter\gdef\csname\string#2@bigbuf@c\endcsname{0}%
|
||||
\fi%
|
||||
}%
|
||||
\def\pgfplotsapplistXglobalflushbuffers#1{%
|
||||
\t@pgfplots@toka=\expandafter{#1}%
|
||||
\t@pgfplots@tokb=\expandafter\expandafter\expandafter{\csname\string#1@bigbuf\endcsname}%
|
||||
\t@pgfplots@tokc=\expandafter\expandafter\expandafter{\csname\string#1@smallbuf\endcsname}%
|
||||
\xdef#1{\the\t@pgfplots@toka\the\t@pgfplots@tokb\the\t@pgfplots@tokc}%
|
||||
\expandafter\pgfplotsgloballet\csname\string#1@smallbuf\endcsname=\pgfutil@empty
|
||||
\expandafter\gdef\csname\string#1@smallbuf@c\endcsname{0}%
|
||||
\expandafter\pgfplotsgloballet\csname\string#1@bigbuf\endcsname=\pgfutil@empty
|
||||
\expandafter\gdef\csname\string#1@bigbuf@c\endcsname{0}%
|
||||
}%
|
||||
|
||||
|
||||
\def\pgfplotsapplistXgloballet#1=#2{%
|
||||
\pgfplotsapplistXglobalflushbuffers#2%
|
||||
\let#1=#2}
|
544
texmf/tex/latex/pgfplots/tex/pgfplotsmatrix.code.tex
Normal file
544
texmf/tex/latex/pgfplots/tex/pgfplotsmatrix.code.tex
Normal file
|
@ -0,0 +1,544 @@
|
|||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%
|
||||
% This is a helper package with an elementary (full) matrix datastructure,
|
||||
% featuring O(1) index access and O(N) creation, deletion, copy.
|
||||
%
|
||||
% The following macros are supplied:
|
||||
%
|
||||
% \pgfplotsmatrixnewempty
|
||||
% \pgfplotsmatrixresize
|
||||
% \pgfplotsmatrixsize
|
||||
% \pgfplotsmatrixselect
|
||||
% \pgfplotsmatrixset
|
||||
% \pgfplotsmatrixletentry
|
||||
% \pgfplotsmatrixforeach
|
||||
% \pgfplotsmatrixLUdecomp
|
||||
% \pgfplotsmatrixLUsolve
|
||||
%
|
||||
%
|
||||
% Copyright 2007/2008 by Christian Feuersänger.
|
||||
%
|
||||
% This program is free software: you can redistribute it and/or modify
|
||||
% 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/>.
|
||||
%
|
||||
%
|
||||
%
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
% Creates a new, empty matrix.
|
||||
\def\pgfplotsmatrixnewempty#1{%
|
||||
\pgfplotsarray@@def{#1@rows}{0}%
|
||||
\pgfplotsarray@@def{#1@cols}{1}%
|
||||
}
|
||||
|
||||
% resizes (truncates) matrix #1 to #2 rows and #3 cols.
|
||||
%
|
||||
% the elements won't be initialised. Use 'set' for each element.
|
||||
\def\pgfplotsmatrixresize#1#2#3{%
|
||||
\pgfplotsarray@@edef{#1@rows}{#2}%
|
||||
\pgfplotsarray@@edef{#1@cols}{#3}%
|
||||
}
|
||||
|
||||
% Invokes code '#2' if the matrix named '#1' exists and '#3' if it does
|
||||
% not exist.
|
||||
\def\pgfplotsmatrixifdefined#1#2#3{%
|
||||
\pgfutil@ifundefined{#1@rows}{#3}{#2}%
|
||||
}%
|
||||
|
||||
|
||||
|
||||
% Counts the number of rows/cols in matrix #1, storing it into the count
|
||||
% registers #2, #3.
|
||||
% Example:
|
||||
% \pgfplotsmatrixsize\foo\to{\count0}{\count1}%
|
||||
% \the\count0, \the\count1
|
||||
\long\def\pgfplotsmatrixsize#1\to#2#3{%
|
||||
#2=\csname\string#1@rows\endcsname\relax
|
||||
#3=\csname\string#1@cols\endcsname\relax
|
||||
}
|
||||
|
||||
\long\def\pgfplotsmatrixsizetomacro#1\to#2#3{%
|
||||
\expandafter\let\expandafter#2\csname\string#1@rows\endcsname
|
||||
\expandafter\let\expandafter#3\csname\string#1@cols\endcsname
|
||||
}
|
||||
|
||||
|
||||
% Returns the (#1,#2) element of matrix #3 into macro #4
|
||||
% Arguments:
|
||||
% #1: a row index 0,...,N-1 where N is rowcount.
|
||||
% #1 must expand to an integer.
|
||||
% #2: a col index 0,...,N-1 where N is colcount.
|
||||
% #2 must expand to an integer.
|
||||
% #3: a matrix
|
||||
% #4: a macro name
|
||||
% Example:
|
||||
% Element 0:
|
||||
% \pgfplotsmatrixselect0,1\of\foo\to\elem
|
||||
% \elem
|
||||
% Element \count1:
|
||||
% \pgfplotsmatrixselect\count1,2\of\foo\to\elem
|
||||
\def\pgfplotsmatrixselect#1,#2\of#3\to#4{%
|
||||
\expandafter\let\expandafter#4\csname\string#3@#1,#2\endcsname%
|
||||
\ifx#4\relax
|
||||
\pgfplotsthrow{no such element}{#1,#2}{No such element: \string\pgfplotsmatrixselect#1,#2\string\of{\string#3}}\pgfeov%
|
||||
\fi
|
||||
}
|
||||
|
||||
% Expands to the value (#1,#2) of matrix #3.
|
||||
% #1: a row index (not a register)
|
||||
% #2: a col index
|
||||
% #3: a matrix
|
||||
\def\pgfplotsmatrixvalueofelem#1,#2\of#3{\csname\string#3@#1,#2\endcsname}%
|
||||
|
||||
% Sets element '#1,#2' of matrix '#3' to '#4'.
|
||||
\def\pgfplotsmatrixset#1,#2\of#3\to#4{%
|
||||
\pgfutil@namedef{\string#3@#1,#2}{#4}%
|
||||
}
|
||||
\long\def\pgfplotsmatrixletentry#1,#2\of#3=#4{%
|
||||
\expandafter\let\csname\string#3@#1,#2\endcsname=#4\relax
|
||||
}
|
||||
|
||||
% During the loop, \pgfplotsmatrixforeachrowindex expands to the
|
||||
% current row index and \pgfplotsmatrixforeachcolindex to the actual
|
||||
% col index. It invokes \pgfplotsmatrixforeachrowend after each
|
||||
% complete row.
|
||||
%
|
||||
% This macro uses
|
||||
% \c@pgf@counta,\c@pgf@countb,\c@pgf@countc,\c@pgf@countd
|
||||
\long\def\pgfplotsmatrixforeach#1\as#2#3{%
|
||||
\pgfplotsmatrixsize#1\to\c@pgf@countc\c@pgf@countd
|
||||
\long\def\pgfplotsmatrixforeach@{#3}%
|
||||
\def\pgfplotsmatrixforeach@assign##1{\def#2{##1}}%
|
||||
\def\pgfplotsmat@select##1,##2\to{\pgfplotsmatrixselect##1,##2\of#1\to}%
|
||||
\def\pgfplotsmatrixforeachrowindex{\the\c@pgf@counta}%
|
||||
\def\pgfplotsmatrixforeachcolindex{\the\c@pgf@countb}%
|
||||
\c@pgf@counta=0
|
||||
\pgfplotsmatrixforeach@loop
|
||||
\let\pgfplotsmatrixforeachcolindex\relax
|
||||
\let\pgfplotsmatrixforeachrowindex\relax%
|
||||
}%
|
||||
\let\pgfplotsmatrixforeachrowend=\relax
|
||||
\def\pgfplotsmatrixforeach@loop{%
|
||||
\ifnum\c@pgf@counta<\c@pgf@countc
|
||||
\c@pgf@countb=0
|
||||
\pgfplotsmatrixforeach@loop@
|
||||
%
|
||||
\pgfplotsmatrixforeachrowend
|
||||
%
|
||||
\advance\c@pgf@counta by1
|
||||
\expandafter\pgfplotsmatrixforeach@loop
|
||||
\fi
|
||||
}%
|
||||
\def\pgfplotsmatrixforeach@loop@{%
|
||||
\ifnum\c@pgf@countb<\c@pgf@countd
|
||||
\pgfplotsmat@select\the\c@pgf@counta,\the\c@pgf@countb\to\pgfplotsmat@Aij
|
||||
\expandafter\pgfplotsmatrixforeach@assign\expandafter{\pgfplotsmat@Aij}%
|
||||
\pgfplotsmatrixforeach@
|
||||
%
|
||||
\advance\c@pgf@countb by1
|
||||
\expandafter\pgfplotsmatrixforeach@loop@
|
||||
\fi
|
||||
}%
|
||||
|
||||
% Defines \pgfplotsretval to be a text-representation of the matrix.
|
||||
% It will contain '\n' as newline macro and \t to separate cells.
|
||||
%
|
||||
\def\pgfplotsmatrixtotext#1{%
|
||||
\begingroup
|
||||
\pgfplotsapplistXnewempty\pgfplotsretval@
|
||||
\def\pgfplotsmatrixforeachrowend{%
|
||||
\pgfplotsapplistXpushback\n\to\pgfplotsretval@
|
||||
}%
|
||||
\pgfplotsmatrixforeach#1\as\entry{%
|
||||
\pgfmathfloatparsenumber\entry
|
||||
\pgfmathfloattosci\pgfmathresult
|
||||
\edef\entry{\pgfmathresult\noexpand\t}%
|
||||
\expandafter\pgfplotsapplistXpushback\entry\to\pgfplotsretval@
|
||||
}%
|
||||
\pgfplotsapplistXlet\pgfplotsretval=\pgfplotsretval@
|
||||
\pgfmath@smuggleone\pgfplotsretval
|
||||
\endgroup
|
||||
}
|
||||
|
||||
% Takes a matrix #1 and replaces it by its LU decomposition.
|
||||
% The LU decomposition uses implicit pivoting; the pivoting
|
||||
% information is stored in a permutation array #2 and a sign macro #3.
|
||||
%
|
||||
% It is to be used together with \pgfplotsmatrixsolveLEQS.
|
||||
%
|
||||
% #1: the input matrix (square size)
|
||||
% #2: a macro name; will be used to store the permutation array for
|
||||
% the pivoting.
|
||||
% #3: a macro name, will contain the sign of the permutation (either
|
||||
% +1 or -1).
|
||||
%
|
||||
% The algorithm has been converted from Numerical Recipes in C (I did
|
||||
% not copy the comments, though). You find the complete reference in
|
||||
% Chapter 2 of Numerical Recipes.
|
||||
%
|
||||
% If the matrix is singular, an exception will be raised.
|
||||
% If the matrix is singular up to working precision,
|
||||
% \pgfplotsmatrixLUdecompwarnsingular will be invoked and the
|
||||
% algorithm continues with a small threshold.
|
||||
%
|
||||
% All arithmetics is computed with \pgfplotscoordmath{default} (which
|
||||
% is float in the initial configuration). Use
|
||||
% \pgfplotssetcoordmathfor{default}{pgfbasic} to switch it to standard
|
||||
% pgf arithmetics.
|
||||
%
|
||||
% ATTENTION. This routine re-uses the four counters
|
||||
% \c@pgf@counta,...\c@pgf@countd.
|
||||
% Furthermore, it does not free any memory.
|
||||
% Make sure you use it inside of local scopes.
|
||||
\def\pgfplotsmatrixLUdecomp#1\perm#2\sign#3{%
|
||||
\let\pgfplotsmat@i=\c@pgf@counta
|
||||
\let\pgfplotsmat@imax=\c@pgf@countb
|
||||
\let\pgfplotsmat@j=\c@pgf@countc
|
||||
\let\pgfplotsmat@k=\c@pgf@countd
|
||||
\countdef\pgfplotsmat@n=0
|
||||
\let\pgfplotsmat@big=\pgfutil@empty
|
||||
\let\pgfplotsmat@dum=\pgfutil@empty
|
||||
\let\pgfplotsmat@sum=\pgfutil@empty
|
||||
\let\pgfplotsmat@temp=\pgfutil@empty
|
||||
\pgfplotsmatrixsize#1\to\pgfplotsmat@n\c@pgf@countd
|
||||
\ifnum\c@pgf@countd=\pgfplotsmat@n
|
||||
\else
|
||||
\pgfplots@error{Sorry, \string\pgfplotsmatrixLUdecomp\space expected an n x n matrix, but got \the\pgfplotsmat@n\space x \the\c@pgf@countd.}%
|
||||
\fi
|
||||
\pgfplotsarraynewempty\pgfplotsmat@vv
|
||||
\pgfplotsarrayresize\pgfplotsmat@vv\pgfplotsmat@n
|
||||
\pgfplotsarrayresize#2\pgfplotsmat@n
|
||||
\def\pgfplotsmat@parity{1}%
|
||||
\def\pgfplotsmat@select##1,##2\to{\pgfplotsmatrixselect##1,##2\of#1\to}%
|
||||
\def\pgfplotsmat@letentry##1,##2={\pgfplotsmatrixletentry##1,##2\of#1=}%
|
||||
\def\pgfplotsmat@letpermentry##1={\pgfplotsarrayletentry##1\of#2=}%
|
||||
%
|
||||
\pgfplotsmat@i=0
|
||||
\pgfplotsmatrixLUdecomp@scalingloop
|
||||
%
|
||||
\ifnum\pgfplotsmat@n>0 % this is used for error recovery.
|
||||
%
|
||||
\pgfplotsmat@j=0
|
||||
\pgfplotsmatrixLUdecomp@mainloop@j
|
||||
%
|
||||
\let#3=\pgfplotsmat@parity
|
||||
\fi
|
||||
}%
|
||||
\def\pgfplotsmatrixLUdecomp@scalingloop{%
|
||||
\ifnum\pgfplotsmat@i<\pgfplotsmat@n
|
||||
\pgfplotscoordmath{default}{zero}%
|
||||
\let\pgfplotsmat@big=\pgfmathresult
|
||||
%
|
||||
\pgfplotsmat@j=0
|
||||
\pgfplotsmatrixLUdecomp@scalingloop@
|
||||
%
|
||||
\pgfplotscoordmath{default}{if is}{\pgfplotsmat@big}{0}{%
|
||||
\pgfplotsthrow{invalid argument}{\pgfplots@loc@TMPa}{Singular matrix in \string\pgfplotsmatrixLUdecomp}\pgfeov%
|
||||
\pgfplotsmat@n=-1
|
||||
}{%
|
||||
\pgfplotscoordmath{default}{op}{reciprocal}{{\pgfplotsmat@big}}%
|
||||
\pgfplotsarrayletentry\pgfplotsmat@i\of\pgfplotsmat@vv=\pgfmathresult
|
||||
}%
|
||||
%
|
||||
\advance\pgfplotsmat@i by1
|
||||
\expandafter\pgfplotsmatrixLUdecomp@scalingloop
|
||||
\fi
|
||||
}%
|
||||
\def\pgfplotsmatrixLUdecomp@scalingloop@{%
|
||||
\ifnum\pgfplotsmat@j<\pgfplotsmat@n
|
||||
%
|
||||
\pgfplotsmat@select\the\pgfplotsmat@i,\the\pgfplotsmat@j\to\pgfplotsmat@Aij
|
||||
\pgfplotscoordmath{default}{parsenumber}{\pgfplotsmat@Aij}%
|
||||
\let\pgfplotsmat@Aij=\pgfmathresult
|
||||
\pgfplotsmat@letentry\the\pgfplotsmat@i,\the\pgfplotsmat@j=\pgfplotsmat@Aij
|
||||
%
|
||||
\pgfplotscoordmath{default}{op}{abs}{{\pgfplotsmat@Aij}}%
|
||||
\let\pgfplotsmat@temp=\pgfmathresult
|
||||
\pgfplotscoordmath{default}{max}{\pgfplotsmat@temp}{\pgfplotsmat@big}%
|
||||
\let\pgfplotsmat@big=\pgfmathresult
|
||||
%
|
||||
\advance\pgfplotsmat@j by1
|
||||
\expandafter\pgfplotsmatrixLUdecomp@scalingloop@
|
||||
\fi
|
||||
}%
|
||||
|
||||
\def\pgfplotsmatrixLUdecomp@mainloop@j{%
|
||||
\ifnum\pgfplotsmat@j<\pgfplotsmat@n
|
||||
%
|
||||
\pgfplotsmat@i=0
|
||||
\pgfplotsmatrixLUdecomp@mainloop@j@i
|
||||
%
|
||||
\pgfplotscoordmath{default}{zero}%
|
||||
\let\pgfplotsmat@big=\pgfmathresult
|
||||
%
|
||||
\pgfplotsmat@i=\pgfplotsmat@j
|
||||
\pgfplotsmatrixLUdecomp@mainloop@j@i@second
|
||||
%
|
||||
\ifnum\pgfplotsmat@j=\pgfplotsmat@imax
|
||||
\else
|
||||
% interchange rows...
|
||||
\pgfplotsmat@k=0
|
||||
\pgfplotsmatrixLUdecomp@mainloop@j@k
|
||||
%
|
||||
\c@pgfplotsarray@tmp=-\pgfplotsmat@parity\relax%
|
||||
\edef\pgfplotsmat@parity{\the\c@pgfplotsarray@tmp}%
|
||||
%
|
||||
% FIXME : this here is DIFFERENT. Seems there is something
|
||||
% missing in Numerical Recipes book
|
||||
\pgfplotsarrayselect\pgfplotsmat@j\of\pgfplotsmat@vv\to\pgfplotsmat@dum
|
||||
%\pgfplotsarrayselect\pgfplotsmat@imax\of\pgfplotsmat@vv\to\pgfplotsmat@temp
|
||||
%\pgfplotsarrayletentry\pgfplotsmat@j\of\pgfplotsmat@vv=\pgfplotsmat@temp
|
||||
\pgfplotsarrayletentry\pgfplotsmat@imax\of\pgfplotsmat@vv=\pgfplotsmat@dum
|
||||
\fi
|
||||
%
|
||||
\edef\pgfplotsmat@dum{\the\pgfplotsmat@imax}%
|
||||
\pgfplotsmat@letpermentry\pgfplotsmat@j=\pgfplotsmat@dum
|
||||
%
|
||||
\pgfplotsmat@select\the\pgfplotsmat@j,\the\pgfplotsmat@j\to\pgfplotsmat@Ajj
|
||||
\pgfplotscoordmath{default}{if is}{\pgfplotsmat@Ajj}{0}{%
|
||||
\pgfplotscoordmath{default}{parsenumber}{1e-15}%
|
||||
\pgfplotsmatrixLUdecompwarnsingular
|
||||
\pgfplotsmat@letentry\the\pgfplotsmat@j,\the\pgfplotsmat@j=\pgfmathresult
|
||||
}{%
|
||||
}%
|
||||
%
|
||||
%
|
||||
\advance\pgfplotsmat@j by1
|
||||
\ifnum\pgfplotsmat@j=\pgfplotsmat@n
|
||||
\advance\pgfplotsmat@j by-1
|
||||
\else
|
||||
\advance\pgfplotsmat@j by-1
|
||||
\pgfplotsmat@select\the\pgfplotsmat@j,\the\pgfplotsmat@j\to\pgfplotsmat@Ajj
|
||||
\pgfplotscoordmath{default}{op}{reciprocal}{{\pgfplotsmat@Ajj}}%
|
||||
\let\pgfplotsmat@dum=\pgfmathresult
|
||||
\pgfplotsmat@i=\pgfplotsmat@j
|
||||
\advance\pgfplotsmat@i by1
|
||||
\pgfplotsmatrixLUdecomp@mainloop@j@i@final
|
||||
\fi
|
||||
\advance\pgfplotsmat@j by1
|
||||
\expandafter\pgfplotsmatrixLUdecomp@mainloop@j
|
||||
\fi
|
||||
}%
|
||||
\def\pgfplotsmatrixLUdecompwarnsingular{%
|
||||
\pgfplotswarning{linear system singular}\pgfeov%
|
||||
}%
|
||||
\def\pgfplotsmatrixLUdecomp@mainloop@j@i{%
|
||||
\ifnum\pgfplotsmat@i<\pgfplotsmat@j
|
||||
%
|
||||
\pgfplotsmat@select\the\pgfplotsmat@i,\the\pgfplotsmat@j\to\pgfplotsmat@sum
|
||||
\pgfplotsmat@k=0
|
||||
\pgfplotsmatrixLUdecomp@mainloop@j@i@k
|
||||
\pgfplotsmat@letentry\the\pgfplotsmat@i,\the\pgfplotsmat@j=\pgfplotsmat@sum
|
||||
%
|
||||
\advance\pgfplotsmat@i by1
|
||||
\expandafter\pgfplotsmatrixLUdecomp@mainloop@j@i
|
||||
\fi
|
||||
}%
|
||||
\def\pgfplotsmatrixLUdecomp@mainloop@j@i@k{%
|
||||
\ifnum\pgfplotsmat@k<\pgfplotsmat@i
|
||||
%
|
||||
\pgfplotsmat@select\the\pgfplotsmat@i,\the\pgfplotsmat@k\to\pgfplotsmat@Aik
|
||||
\pgfplotsmat@select\the\pgfplotsmat@k,\the\pgfplotsmat@j\to\pgfplotsmat@Akj
|
||||
\pgfplotscoordmath{default}{op}{multiply}{{\pgfplotsmat@Aik}{\pgfplotsmat@Akj}}%
|
||||
\pgfplotscoordmath{default}{op}{subtract}{{\pgfplotsmat@sum}{\pgfmathresult}}%
|
||||
\let\pgfplotsmat@sum=\pgfmathresult
|
||||
%
|
||||
\advance\pgfplotsmat@k by1
|
||||
\expandafter\pgfplotsmatrixLUdecomp@mainloop@j@i@k
|
||||
\fi
|
||||
}
|
||||
\def\pgfplotsmatrixLUdecomp@mainloop@j@i@second{%
|
||||
\ifnum\pgfplotsmat@i<\pgfplotsmat@n
|
||||
%
|
||||
\pgfplotsmat@select\the\pgfplotsmat@i,\the\pgfplotsmat@j\to\pgfplotsmat@sum
|
||||
%
|
||||
\pgfplotsmat@k=0
|
||||
\pgfplotsmatrixLUdecomp@mainloop@j@i@second@k
|
||||
\pgfplotsmat@letentry\the\pgfplotsmat@i,\the\pgfplotsmat@j=\pgfplotsmat@sum
|
||||
%
|
||||
\pgfplotscoordmath{default}{op}{abs}{{\pgfplotsmat@sum}}%
|
||||
\pgfplotscoordmath{default}{op}{multiply}{{\pgfmathresult}{\pgfplotsarrayvalueofelem\the\pgfplotsmat@i\of\pgfplotsmat@vv}}%
|
||||
\let\pgfplotsmat@dum=\pgfmathresult
|
||||
\pgfplotscoordmath{default}{if less than}{\pgfplotsmat@dum}{\pgfplotsmat@big}{%
|
||||
}{%
|
||||
\let\pgfplotsmat@big=\pgfplotsmat@dum
|
||||
\pgfplotsmat@imax=\pgfplotsmat@i
|
||||
}%
|
||||
%
|
||||
\advance\pgfplotsmat@i by1
|
||||
\expandafter\pgfplotsmatrixLUdecomp@mainloop@j@i@second
|
||||
\fi
|
||||
}%
|
||||
\def\pgfplotsmatrixLUdecomp@mainloop@j@i@second@k{%
|
||||
\ifnum\pgfplotsmat@k<\pgfplotsmat@j
|
||||
%
|
||||
\pgfplotsmat@select\the\pgfplotsmat@i,\the\pgfplotsmat@k\to\pgfplotsmat@Aik
|
||||
\pgfplotsmat@select\the\pgfplotsmat@k,\the\pgfplotsmat@j\to\pgfplotsmat@Akj
|
||||
\pgfplotscoordmath{default}{op}{multiply}{{\pgfplotsmat@Aik}{\pgfplotsmat@Akj}}%
|
||||
\pgfplotscoordmath{default}{op}{subtract}{{\pgfplotsmat@sum}{\pgfmathresult}}%
|
||||
\let\pgfplotsmat@sum=\pgfmathresult
|
||||
%
|
||||
\advance\pgfplotsmat@k by1
|
||||
\expandafter\pgfplotsmatrixLUdecomp@mainloop@j@i@second@k
|
||||
\fi
|
||||
}%
|
||||
|
||||
\def\pgfplotsmatrixLUdecomp@mainloop@j@k{%
|
||||
\ifnum\pgfplotsmat@k<\pgfplotsmat@n
|
||||
%
|
||||
\pgfplotsmat@select\the\pgfplotsmat@imax,\the\pgfplotsmat@k\to\pgfplotsmat@dum
|
||||
\pgfplotsmat@select\the\pgfplotsmat@j,\the\pgfplotsmat@k\to\pgfplotsmat@Ajk
|
||||
\pgfplotsmat@letentry\the\pgfplotsmat@imax,\the\pgfplotsmat@k=\pgfplotsmat@Ajk
|
||||
\pgfplotsmat@letentry\the\pgfplotsmat@j,\the\pgfplotsmat@k=\pgfplotsmat@dum
|
||||
%
|
||||
\advance\pgfplotsmat@k by1
|
||||
\expandafter\pgfplotsmatrixLUdecomp@mainloop@j@k
|
||||
\fi
|
||||
}
|
||||
\def\pgfplotsmatrixLUdecomp@mainloop@j@i@final{%
|
||||
\ifnum\pgfplotsmat@i<\pgfplotsmat@n
|
||||
%
|
||||
\pgfplotsmat@select\the\pgfplotsmat@i,\the\pgfplotsmat@j\to\pgfplotsmat@Aij
|
||||
\pgfplotscoordmath{default}{op}{multiply}{{\pgfplotsmat@Aij}{\pgfplotsmat@dum}}%
|
||||
\pgfplotsmat@letentry\the\pgfplotsmat@i,\the\pgfplotsmat@j=\pgfmathresult
|
||||
%
|
||||
\advance\pgfplotsmat@i by1
|
||||
\expandafter\pgfplotsmatrixLUdecomp@mainloop@j@i@final
|
||||
\fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
% Solves the set of n linear equations Ax = b where A = LU is given in
|
||||
% (#1,#2) and b = #3.
|
||||
%
|
||||
% #1: is a result of \pgfplotsmatrixLUdecomp
|
||||
% #2: is the permutation vector returned by \pgfplotsmatrixLUdecomp
|
||||
% #3: the right hand side. On output, it will be *overwritten* with
|
||||
% the solution.
|
||||
%
|
||||
% The algorithm has been converted from Numerical Recipes in C (I did
|
||||
% not copy the comments, though). You find the complete reference in
|
||||
% Chapter 2 of Numerical Recipes.
|
||||
\def\pgfplotsmatrixLUbacksubst#1\perm#2\inout#3{%
|
||||
\let\pgfplotsmat@i=\c@pgf@counta
|
||||
\let\pgfplotsmat@ii=\c@pgf@countb
|
||||
\let\pgfplotsmat@j=\c@pgf@countc
|
||||
\let\pgfplotsmat@n=\c@pgf@countd
|
||||
\let\pgfplotsmat@sum=\pgfutil@empty
|
||||
\pgfplotsmatrixsize#1\to\pgfplotsmat@n\c@pgf@counta
|
||||
\pgfplotsarraysize#3\to\c@pgf@counta
|
||||
\ifnum\c@pgf@counta=\pgfplotsmat@n
|
||||
\def\pgfplotsmat@select##1,##2\to{\pgfplotsmatrixselect##1,##2\of#1\to}%
|
||||
\def\pgfplotsmat@selectperm##1\to{\pgfplotsarrayselect##1\of#2\to}%
|
||||
\def\pgfplotsmat@selectb##1\to{\pgfplotsarrayselect##1\of#3\to}%
|
||||
\def\pgfplotsmat@letresult##1={\pgfplotsarrayletentry##1\of#3=}%
|
||||
%
|
||||
\pgfplotsmat@ii=-1
|
||||
\pgfplotsmat@i=0
|
||||
\pgfplotsmatrixLUbacksubst@loop@i
|
||||
%
|
||||
\pgfplotsmat@i=\pgfplotsmat@n
|
||||
\advance\pgfplotsmat@i by-1
|
||||
\pgfplotsmatrixLUbacksubst@loop@i@backw
|
||||
\else
|
||||
\pgfplots@error{Sorry, \string\pgfplotsmatrixLUbacksubst\space expected a vector of length \the\pgfplotsmat@n\space, not \the\c@pgf@counta}%
|
||||
\fi
|
||||
}%
|
||||
\def\pgfplotsmatrixLUbacksubst@loop@i{%
|
||||
\ifnum\pgfplotsmat@i<\pgfplotsmat@n
|
||||
%
|
||||
\pgfplotsmat@selectperm\pgfplotsmat@i\to\pgfplotsmat@ip
|
||||
\pgfplotsmat@selectb\pgfplotsmat@ip\to\pgfplotsmat@sum
|
||||
\pgfplotsmat@selectb\pgfplotsmat@i\to\pgfplotsmat@temp
|
||||
%
|
||||
\pgfplotscoordmath{default}{parsenumber}{\pgfplotsmat@sum}%
|
||||
\let\pgfplotsmat@sum=\pgfmathresult
|
||||
\pgfplotscoordmath{default}{parsenumber}{\pgfplotsmat@temp}%
|
||||
\let\pgfplotsmat@temp=\pgfmathresult
|
||||
%
|
||||
\pgfplotsmat@letresult\pgfplotsmat@ip=\pgfplotsmat@temp
|
||||
%
|
||||
\ifnum\pgfplotsmat@ii<0
|
||||
\pgfplotscoordmath{default}{if is}{\pgfplotsmat@sum}{0}{%
|
||||
}{%
|
||||
\pgfplotsmat@ii=\pgfplotsmat@i
|
||||
}%
|
||||
\else
|
||||
\pgfplotsmat@j=\pgfplotsmat@ii
|
||||
\pgfplotsmatrixLUbacksubst@loop@i@j
|
||||
\fi
|
||||
\pgfplotsmat@letresult\pgfplotsmat@i=\pgfplotsmat@sum
|
||||
%
|
||||
\advance\pgfplotsmat@i by1
|
||||
\expandafter\pgfplotsmatrixLUbacksubst@loop@i
|
||||
\fi
|
||||
}%
|
||||
\def\pgfplotsmatrixLUbacksubst@loop@i@j{%
|
||||
\ifnum\pgfplotsmat@j<\pgfplotsmat@i
|
||||
%
|
||||
\pgfplotsmat@select\the\pgfplotsmat@i,\the\pgfplotsmat@j\to\pgfplotsmat@Aij
|
||||
\pgfplotsmat@selectb\pgfplotsmat@j\to\pgfplotsmat@temp
|
||||
\pgfplotscoordmath{default}{op}{multiply}{{\pgfplotsmat@temp}{\pgfplotsmat@Aij}}%
|
||||
\pgfplotscoordmath{default}{op}{subtract}{{\pgfplotsmat@sum}{\pgfmathresult}}%
|
||||
\let\pgfplotsmat@sum=\pgfmathresult
|
||||
%
|
||||
\advance\pgfplotsmat@j by1
|
||||
\expandafter\pgfplotsmatrixLUbacksubst@loop@i@j
|
||||
\fi
|
||||
}%
|
||||
|
||||
\def\pgfplotsmatrixLUbacksubst@loop@i@backw{%
|
||||
\ifnum\pgfplotsmat@i<0
|
||||
\else
|
||||
%
|
||||
\pgfplotsmat@selectb\pgfplotsmat@i\to\pgfplotsmat@sum
|
||||
\pgfplotsmat@j=\pgfplotsmat@i
|
||||
\advance\pgfplotsmat@j by1
|
||||
\pgfplotsmatrixLUbacksubst@loop@i@backw@j
|
||||
%
|
||||
\pgfplotsmat@select\the\pgfplotsmat@i,\the\pgfplotsmat@i\to\pgfplotsmat@Aii
|
||||
\pgfplotscoordmath{default}{op}{divide}{{\pgfplotsmat@sum}{\pgfplotsmat@Aii}}%
|
||||
\pgfplotsmat@letresult\pgfplotsmat@i=\pgfmathresult
|
||||
%
|
||||
\advance\pgfplotsmat@i by-1
|
||||
\expandafter\pgfplotsmatrixLUbacksubst@loop@i@backw
|
||||
\fi
|
||||
}%
|
||||
\def\pgfplotsmatrixLUbacksubst@loop@i@backw@j{%
|
||||
\ifnum\pgfplotsmat@j<\pgfplotsmat@n
|
||||
%
|
||||
\pgfplotsmat@select\the\pgfplotsmat@i,\the\pgfplotsmat@j\to\pgfplotsmat@Aij
|
||||
\pgfplotsmat@selectb\pgfplotsmat@j\to\pgfplotsmat@temp
|
||||
\pgfplotscoordmath{default}{op}{multiply}{{\pgfplotsmat@temp}{\pgfplotsmat@Aij}}%
|
||||
\pgfplotscoordmath{default}{op}{subtract}{{\pgfplotsmat@sum}{\pgfmathresult}}%
|
||||
\let\pgfplotsmat@sum=\pgfmathresult
|
||||
%
|
||||
\advance\pgfplotsmat@j by1
|
||||
\expandafter\pgfplotsmatrixLUbacksubst@loop@i@backw@j
|
||||
\fi
|
||||
}%
|
||||
|
||||
% Solves the linear equation system Ax = b.
|
||||
% #1: the matrix A
|
||||
% #2: the right-hand-side b. On output, #2 will contain the solution
|
||||
% and A will be overwritten.
|
||||
%
|
||||
% ATTENTION. This routine re-uses the four counters
|
||||
% \c@pgf@counta,...\c@pgf@countd.
|
||||
% Furthermore, it does not free any memory.
|
||||
% Make sure you use it inside of local scopes.
|
||||
\def\pgfplotsmatrixsolveLEQS#1=#2{%
|
||||
\pgfplotsmatrixLUdecomp#1\perm\pgfplotsmatrix@perm\sign\pgfplotsmatrix@sign
|
||||
\pgfplotsmatrixLUbacksubst#1\perm\pgfplotsmatrix@perm\inout#2%
|
||||
}%
|
2900
texmf/tex/latex/pgfplots/tex/pgfplotsmeshplothandler.code.tex
Normal file
2900
texmf/tex/latex/pgfplots/tex/pgfplotsmeshplothandler.code.tex
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,92 @@
|
|||
|
||||
%\input pgfplotsoldpgfsupp_pgfmathparse.opt.code.tex
|
||||
%\beginpgfmathparsecheckfornumber
|
||||
|
||||
\pgfutil@ifundefined{pgfmathlessthan@}{%
|
||||
\let\pgfmathlessthan@=\pgfmathless@
|
||||
\let\pgfmathgreaterthan@=\pgfmathgreater@
|
||||
}{}%
|
||||
|
||||
|
||||
\def\pgfplotsusecompatibilityfile#1{%
|
||||
\pgfutil@IfUndefined{pgfplotsusecompatibilityfile@loaded@#1}{%
|
||||
\expandafter\gdef\csname pgfplotsusecompatibilityfile@loaded@#1\endcsname{1}%
|
||||
\input pgfplotsoldpgfsupp_#1
|
||||
}{%
|
||||
% already loaded.
|
||||
}%
|
||||
}%
|
||||
|
||||
\def\pgfmathfloatrounddisplaystyle@shared@impl@WRONG#1#2{%
|
||||
{\toks0={#1}%
|
||||
\toks1=\expandafter{\pgfmathfloatrounddisplaystyle@e@mark #2}%
|
||||
\xdef\pgfmathfloat@glob@TMP{\the\toks0 \the\toks1 }%
|
||||
}%
|
||||
\let\pgfmathresult=\pgfmathfloat@glob@TMP
|
||||
}%
|
||||
|
||||
% check whether we need to load supplementary code.
|
||||
% The development of pgfplots and pgf is intermingled, so pgfplots
|
||||
% always uses up-to-date pgf CVS versions - the relevant complements between
|
||||
% PGF 2.10 and PGF CVS are loaded here:
|
||||
%
|
||||
% #1: for backwards compatibility
|
||||
% #2: for normal processing.
|
||||
\def\pgfplots@ifneedspgfcompabitibilitycode@has@pgf@one@zero@zero#1#2{%
|
||||
%\pgfkeysifdefined{/pgf/number format/sci precision/.@cmd}{#2}{#1}%
|
||||
\pgfutil@ifundefined{pgfmathprintnumber@RELATIVE@choice@roundtofixed}{#1}{#2}%
|
||||
}%
|
||||
|
||||
\let\pgfplots@ifneedspgfcompabitibilitycode=\pgfplots@ifneedspgfcompabitibilitycode@has@pgf@one@zero@zero
|
||||
|
||||
\pgfplots@ifneedspgfcompabitibilitycode
|
||||
{%
|
||||
\immediate\write16{Package pgfplots: loading complementary code for your PGF version...}
|
||||
\input pgfplotsoldpgfsupp_misc.code.tex
|
||||
\let\pgfkeysloaded=\undefined
|
||||
\input pgfplotsoldpgfsupp_pgfkeys.code.tex
|
||||
\input pgfplotsoldpgfsupp_pgfmathfloat.code.tex
|
||||
\input pgfplotsoldpgfsupp_pgflibraryplothandlers.code.tex
|
||||
\input pgfplotsoldpgfsupp_pgflibraryfpu.code.tex
|
||||
\input pgfplotsoldpgfsupp_pgfcorescopes.code.tex
|
||||
\input pgfplotsoldpgfsupp_pgfcorelayers.code.tex
|
||||
}%
|
||||
{%
|
||||
\pgfplots@iffileexists{pgflibraryfpu.code.tex}{%
|
||||
\usepgflibrary{fpu}%
|
||||
}{%
|
||||
\immediate\write16{Package pgfplots: loading FPU library which doesn't appear to exist in your PGF version...}
|
||||
\input pgfplotsoldpgfsupp_pgflibraryfpu.code.tex
|
||||
}%
|
||||
}%
|
||||
|
||||
\pgfutil@ifundefined{pgfmathdeclarepseudoconstant}{
|
||||
\immediate\write16{Package pgfplots: loading complementary arithmetics for your pgf version...}
|
||||
\input pgfplotsoldpgfsupp_pgflibraryfpu.code.tex
|
||||
}
|
||||
{}%
|
||||
|
||||
\pgfutil@IfUndefined{pgfmathdeclarefunction}{
|
||||
\pgfplots@warning{Parts of pgfplots require PGF 2.10; you have PGF 2.00 . Consider upgrading if you experience problems.}%
|
||||
}{%
|
||||
}%
|
||||
|
||||
\pgfutil@IfUndefined{pgfapplistnewempty}{%
|
||||
\immediate\write16{Package pgfplots: loading complementary utilities for your pgf version...}
|
||||
\csname newtoks\endcsname\t@pgf@toka
|
||||
\csname newtoks\endcsname\t@pgf@tokb
|
||||
\csname newtoks\endcsname\t@pgf@tokc
|
||||
\gdef\pgfutil@advancestringcounter{\pgfplotsutil@advancestringcounter}%
|
||||
\input pgfplotsoldpgfsupp_pgfutil-common-lists.tex
|
||||
}{}%
|
||||
|
||||
\pgfutil@IfUndefined{pgfmathiftrigonometricusesdeg}{%
|
||||
\pgfutil@ifundefined{pgfmathdeclarefunction}{%
|
||||
% PGF 2.00 !? Well, trig format won't work here.
|
||||
}{%
|
||||
\input pgfplotsoldpgfsupp_trig_format.code.tex
|
||||
}%
|
||||
}{}%
|
||||
|
||||
|
||||
\endinput
|
885
texmf/tex/latex/pgfplots/tex/pgfplotsoldpgfsupp_misc.code.tex
Normal file
885
texmf/tex/latex/pgfplots/tex/pgfplotsoldpgfsupp_misc.code.tex
Normal file
|
@ -0,0 +1,885 @@
|
|||
% ======================================================
|
||||
% compatibility with PGF 2.10
|
||||
% ======================================================
|
||||
%
|
||||
%%% This file is a copy of some part of PGF/Tikz.
|
||||
%%% It has been copied here to provide :
|
||||
%%% - compatibility with older PGF versions
|
||||
%%% - availability of PGF contributions by Christian Feuersaenger
|
||||
%%% which are necessary or helpful for pgfplots.
|
||||
%%%
|
||||
%%% It contains a couple of patches such that selected changes which
|
||||
%%% are also part of PGF/TikZ (and can be found in the development
|
||||
%%% version of PGF/TikZ) are available within pgfplots.
|
||||
%%%
|
||||
%%% Typically, these modifications have been done by the pgfplots team
|
||||
%%% as contribution to PGf/TIKZ
|
||||
%
|
||||
% Support for the contents of this file will NOT be done by the PGF/TikZ team.
|
||||
% Please contact the author and/or maintainer of pgfplots (Christian Feuersaenger) if you need assistance in conjunction
|
||||
% with the deployment of this patch or partial content of PGF. Note that the author and/or maintainer of pgfplots has no obligation to fix anything:
|
||||
% This file comes without any warranty as the rest of pgfplots; there is no obligation for help.
|
||||
\def\pgfdeclarelayer#1{%
|
||||
\pgfutil@ifundefined{pgf@layerbox@#1}{%
|
||||
\expandafter\expandafter\csname pgf@newbox\endcsname\csname pgf@layerbox@#1\endcsname%
|
||||
\expandafter\expandafter\csname pgf@newbox\endcsname\csname pgf@layerboxsaved@#1\endcsname%
|
||||
}{}%
|
||||
}
|
||||
|
||||
\def\tikz@key@name@path@wrong#1#2{%
|
||||
\tikz@addmode{%
|
||||
\pgfsyssoftpath@getcurrentpath\tikz@intersect@temppath@round%
|
||||
\pgfprocessround\tikz@intersect@temppath@round\tikz@intersect@temppath%
|
||||
\ifx\tikz@intersect@namedpaths\pgfutil@empty%
|
||||
\else%
|
||||
\tikz@intersect@namedpaths%
|
||||
\pgfutil@ifundefined{tikz@intersect@path@name@#1}{}%
|
||||
{%
|
||||
\expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter\tikz@intersect@@temppath%
|
||||
\expandafter\expandafter\expandafter{\csname tikz@intersect@path@name@#1\endcsname}%
|
||||
\expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter\tikz@intersect@temppath%
|
||||
\expandafter\expandafter\expandafter{\expandafter\tikz@intersect@temppath\tikz@intersect@temppath}%
|
||||
}%
|
||||
\fi%
|
||||
\tikz@intersect@addto@path@names{#1}{#2}%
|
||||
}%
|
||||
}%
|
||||
|
||||
\def\tikz@key@name@path@new#1#2{%
|
||||
\tikz@addmode{%
|
||||
\pgfsyssoftpath@getcurrentpath\tikz@intersect@temppath@round%
|
||||
\pgfprocessround\tikz@intersect@temppath@round\tikz@intersect@temppath%
|
||||
\ifx\tikz@intersect@namedpaths\pgfutil@empty%
|
||||
\else%
|
||||
\tikz@intersect@namedpaths%
|
||||
\fi%
|
||||
\tikz@intersect@addto@path@names{#1}{#2}%
|
||||
}%
|
||||
}%
|
||||
|
||||
\ifx\tikz@key@name@path@wrong\tikz@key@name@path
|
||||
\let\tikz@key@name@path=\tikz@key@name@path@new
|
||||
\fi
|
||||
|
||||
\def\pgfutil@insertatbegincurrentpagefrombox@WRONG#1{%
|
||||
\global\setbox\pgfutil@abb\hbox{\unhbox\pgfutil@abb#1}%
|
||||
}
|
||||
|
||||
% needed for dvipdfmx and shader=interp
|
||||
\def\pgfutil@insertatbegincurrentpagefrombox@FIXED#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%
|
||||
}%
|
||||
}
|
||||
\expandafter\ifx\csname pgfutil@insertatbegincurrentpagefrombox\endcsname\pgfutil@insertatbegincurrentpagefrombox@WRONG
|
||||
\let\pgfutil@insertatbegincurrentpagefrombox=\pgfutil@insertatbegincurrentpagefrombox@FIXED
|
||||
\fi
|
||||
|
||||
% check if \endtikzpicture deals with layerlist:
|
||||
\expandafter\pgfutil@in@\expandafter\pgf@remember@layerlist@globally\expandafter{\endtikzpicture}%
|
||||
\ifpgfutil@in@
|
||||
\else
|
||||
\def\endtikzpicture{%
|
||||
\tikz@atend@picture%
|
||||
\global\let\pgf@shift@baseline@smuggle=\pgf@baseline%
|
||||
\global\let\pgf@trimleft@final@smuggle=\pgf@trimleft%
|
||||
\global\let\pgf@trimright@final@smuggle=\pgf@trimright%
|
||||
\global\let\pgf@remember@smuggle=\ifpgfrememberpicturepositiononpage%
|
||||
\pgf@remember@layerlist@globally
|
||||
\endscope%
|
||||
\let\pgf@baseline=\pgf@shift@baseline@smuggle%
|
||||
\let\pgf@trimleft=\pgf@trimleft@final@smuggle%
|
||||
\let\pgf@trimright=\pgf@trimright@final@smuggle%
|
||||
\let\ifpgfrememberpicturepositiononpage=\pgf@remember@smuggle%
|
||||
\pgf@restore@layerlist@from@global
|
||||
\endpgfpicture}
|
||||
\fi
|
||||
|
||||
% ======================================================
|
||||
% compatibility with PGF 2.0
|
||||
% ======================================================
|
||||
\def\pgfutil@gobble@until@relax#1\relax{}
|
||||
|
||||
\expandafter\ifx\csname w@pgf@writea\endcsname\relax
|
||||
\csname newwrite\endcsname\w@pgf@writea
|
||||
\fi
|
||||
|
||||
\expandafter\ifx\csname r@pgf@reada\endcsname\relax
|
||||
\csname newread\endcsname\r@pgf@reada
|
||||
\fi
|
||||
\let\pgfutil@inputcheck=\r@pgf@reada
|
||||
|
||||
\pgfutil@ifundefined{pgf@texdist@protect}{%
|
||||
\def\pgf@texdist@protect{}%
|
||||
}{}
|
||||
|
||||
% from pgfutil-common.tex:
|
||||
|
||||
% Usage:
|
||||
% \pgfutilstrreplace{<token>}{<replacement>}{<string>}
|
||||
%
|
||||
% -> will assign the modified string into \pgfretval.
|
||||
%
|
||||
% #1: the string to search (one or more tokens)
|
||||
% #2: zero, one or more tokens which will be inserted instead of '#1'.
|
||||
% #3: the string to search in
|
||||
\long\def\pgfutilstrreplace#1#2#3{%
|
||||
\def\pgfretval{}%
|
||||
\long\def\pgfutil@search@and@replace@@##1#1##2\pgf@EOI{%
|
||||
\expandafter\def\expandafter\pgfretval\expandafter{\pgfretval ##1#2}%
|
||||
\pgfutil@search@and@replace@loop{#1}{##2}%
|
||||
}%
|
||||
\pgfutil@search@and@replace@loop{#1}{#3}%
|
||||
}
|
||||
\long\def\pgfutil@search@and@replace@loop#1#2{%
|
||||
\pgfutil@in@{#1}{#2}%
|
||||
\ifpgfutil@in@
|
||||
\def\pgf@loc@TMPa{\pgfutil@search@and@replace@@ #2\pgf@EOI}%
|
||||
\else
|
||||
\expandafter\def\expandafter\pgfretval\expandafter{\pgfretval #2}%
|
||||
\let\pgf@loc@TMPa=\relax
|
||||
\fi
|
||||
\pgf@loc@TMPa
|
||||
}%
|
||||
% 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,
|
||||
% {<a11>}{<a12>}
|
||||
% {<a21>}{<a22>}
|
||||
% where each entry should be a number without unit.
|
||||
% #2: should contain 2 sets of braces with the right-hand-side,
|
||||
% {<r1>}{<r2>}
|
||||
% where each entry should be a number without unit.
|
||||
%
|
||||
% It will assign \pgfmathresult to contain two sets of braces with the
|
||||
% result.
|
||||
%
|
||||
% Example:
|
||||
% \pgfutilsolvetwotwoleq{
|
||||
% {0.24}{1}
|
||||
% {-0.97}{0}
|
||||
% }{
|
||||
% {-7}
|
||||
% {18}
|
||||
% }
|
||||
% -> yields \pgfmathresult={−18.55618}{−2.54642}
|
||||
%
|
||||
% The algorithm employs column pivotisation.
|
||||
\def\pgfutilsolvetwotwoleq#1#2{%
|
||||
\begingroup
|
||||
\dimendef\aa=0
|
||||
\dimendef\ab=1
|
||||
\dimendef\ba=2
|
||||
\dimendef\bb=3
|
||||
\dimendef\ra=4
|
||||
\dimendef\rb=5
|
||||
\dimendef\tmpa=6
|
||||
\dimendef\tmpb=7
|
||||
\edef\pgf@temp{#1}%
|
||||
\expandafter\pgfutilsolvetwotwoleq@A\pgf@temp
|
||||
\edef\pgf@temp{#2}%
|
||||
\expandafter\pgfutilsolvetwotwoleq@r\pgf@temp
|
||||
%
|
||||
\pgfutilsolvetwotwoleq@ifislarger\aa\ba{%
|
||||
% identity "permutation":
|
||||
\def\Pa{a}%
|
||||
\def\Pb{b}%
|
||||
}{%
|
||||
% permutation matrix: switch rows!
|
||||
\def\Pa{b}%
|
||||
\def\Pb{a}%
|
||||
}%
|
||||
% \pivot := 1/aa
|
||||
\pgfmathreciprocal@
|
||||
{\csname m\Pa a\endcsname}%
|
||||
\let\pivot=\pgfmathresult
|
||||
%
|
||||
% \factor := 1/aa * ba
|
||||
\csname \Pb a\endcsname=\pivot\csname \Pb a\endcsname
|
||||
\edef\factor{\expandafter\pgf@sys@tonumber\csname \Pb a\endcsname}%
|
||||
%
|
||||
% bb -= ba/aa * ab
|
||||
\tmpa=-\factor\csname \Pa b\endcsname
|
||||
\advance\csname \Pb b\endcsname by\tmpa
|
||||
%
|
||||
% rb -= ba/aa * ra
|
||||
\tmpa=-\factor\csname r\Pa\endcsname
|
||||
\advance\csname r\Pb\endcsname by\tmpa
|
||||
%
|
||||
% xb := rb / bb (the modified rb and modified bb!)
|
||||
\pgfmathdivide@
|
||||
{\expandafter\pgf@sys@tonumber\csname r\Pb\endcsname}
|
||||
{\expandafter\pgf@sys@tonumber\csname \Pb b\endcsname}%
|
||||
\expandafter\let\csname pgfmathresult\Pb\endcsname=\pgfmathresult
|
||||
%
|
||||
% ra -= xb * ab
|
||||
\tmpa=\csname pgfmathresult\Pb\endcsname\csname \Pa b\endcsname
|
||||
\advance\csname r\Pa\endcsname by-\tmpa
|
||||
%
|
||||
% xa := 1/aa * ra (the modified ra!)
|
||||
\tmpa=\pivot\csname r\Pa\endcsname
|
||||
\expandafter\edef\csname pgfmathresult\Pa\endcsname{\pgf@sys@tonumber\tmpa}%
|
||||
%
|
||||
\edef\pgfmathresult{%
|
||||
{\csname pgfmathresult\Pa\endcsname}%
|
||||
{\csname pgfmathresult\Pb\endcsname}%
|
||||
}%
|
||||
\pgfmath@smuggleone\pgfmathresult
|
||||
\endgroup
|
||||
}%
|
||||
\def\pgfutilsolvetwotwoleq@ifislarger#1#2#3#4{%
|
||||
\tmpa=#1
|
||||
\ifdim\tmpa<0pt
|
||||
\multiply\tmpa by-1
|
||||
\fi
|
||||
\tmpb=#2
|
||||
\ifdim\tmpb<0pt
|
||||
\multiply\tmpb by-1
|
||||
\fi
|
||||
\ifdim\tmpa>\tmpb
|
||||
#3%
|
||||
\else
|
||||
#4%
|
||||
\fi
|
||||
}%
|
||||
\def\pgfutilsolvetwotwoleq@A#1#2#3#4{%
|
||||
\def\maa{#1}\def\mab{#2}%
|
||||
\def\mba{#3}\def\mbb{#3}%
|
||||
\aa=#1pt \ab=#2pt
|
||||
\ba=#3pt \bb=#4pt
|
||||
}
|
||||
\def\pgfutilsolvetwotwoleq@r#1#2{%
|
||||
\ra=#1pt \rb=#2pt
|
||||
}%
|
||||
|
||||
|
||||
%%%%%%%
|
||||
%%%%%%%
|
||||
|
||||
% from pgfmoduleshapes.code.tex:
|
||||
% 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{\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.
|
||||
%
|
||||
% #1: the anchor name.
|
||||
% #2: the code of the anchor. It may depend upon '##1', the shape's
|
||||
% name.
|
||||
%
|
||||
% The anchor will be defined locally in the current TeX scope.
|
||||
\def\pgfdeclaregenericanchor#1#2{%
|
||||
\expandafter\def\csname pgf@anchor@generic@#1\endcsname##1{#2}%
|
||||
}%
|
||||
|
||||
% from pgfcoretransformations.code.tex :
|
||||
\def\pgfgettransformentries#1#2#3#4#5#6{%
|
||||
\edef#1{\pgf@pt@aa}%
|
||||
\edef#2{\pgf@pt@ab}%
|
||||
\edef#3{\pgf@pt@ba}%
|
||||
\edef#4{\pgf@pt@bb}%
|
||||
\edef#5{\the\pgf@pt@x}%
|
||||
\edef#6{\the\pgf@pt@y}%
|
||||
}%
|
||||
\def\pgfsettransformentries#1#2#3#4#5#6{%
|
||||
\pgfsettransform{{#1}{#2}{#3}{#4}{#5}{#6}}%
|
||||
}%
|
||||
|
||||
% pgfutil@loop (from plain.tex)
|
||||
|
||||
\def\pgfutil@loop#1\pgfutil@repeat{\def\pgfutil@body{#1}\pgfutil@iterate}
|
||||
\def\pgfutil@iterate{\pgfutil@body \let\pgfutil@next\pgfutil@iterate \else\let\pgfutil@next\relax\fi \pgfutil@next}
|
||||
\let\pgfutil@repeat=\fi % this makes \loop...\if...\repeat skippable
|
||||
|
||||
\def\pgfqpointxy#1#2{%
|
||||
\pgf@x=#1\pgf@xx%
|
||||
\advance\pgf@x by #2\pgf@yx%
|
||||
\pgf@y=#1\pgf@xy%
|
||||
\advance\pgf@y by #2\pgf@yy}
|
||||
\def\pgfqpointxyz#1#2#3{%
|
||||
\pgf@x=#1\pgf@xx%
|
||||
\advance\pgf@x by #2\pgf@yx%
|
||||
\advance\pgf@x by #3\pgf@zx%
|
||||
\pgf@y=#1\pgf@xy%
|
||||
\advance\pgf@y by #2\pgf@yy%
|
||||
\advance\pgf@y by #3\pgf@zy}
|
||||
\def\pgfcoordinate#1#2{%
|
||||
\edef\pgf@temp{#1}%
|
||||
\ifx\pgf@temp\pgfutil@empty% do nothing
|
||||
\else%
|
||||
\pgf@process{\pgfpointtransformed{#2}}%
|
||||
\expandafter\gdef\csname pgf@sh@ns@#1\endcsname{coordinate}%
|
||||
\expandafter\xdef\csname pgf@sh@np@#1\endcsname{%
|
||||
\noexpand\def\noexpand\centerpoint{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}%
|
||||
}
|
||||
\expandafter\gdef\csname pgf@sh@nt@#1\endcsname{{1}{0}{0}{1}{0pt}{0pt}}%
|
||||
\expandafter\global\expandafter\let\csname pgf@sh@ma@#1\endcsname\pgfutil@empty%
|
||||
\expandafter\gdef\csname pgf@sh@pi@#1\endcsname{\pgfpictureid}%
|
||||
\fi%
|
||||
}
|
||||
% A "quick" variant of \pgfpointscale which doesn't invoke the math parser for '#1'.
|
||||
% #1 must be a number without units, no registers are accepted.
|
||||
\def\pgfqpointscale#1#2{%
|
||||
\pgf@process{#2}%
|
||||
\pgf@x=#1\pgf@x%
|
||||
\pgf@y=#1\pgf@y%
|
||||
}
|
||||
% ======================================================
|
||||
|
||||
\def\pgfutilensuremath#1{%
|
||||
\ifmmode#1\else$#1$\fi
|
||||
}
|
||||
\def\tikzifinpicture#1#2{%
|
||||
\pgfutil@ifundefined{filldraw}{#2}{#1}%
|
||||
}%
|
||||
|
||||
\def\tikz@fig@scan@name(#1){%
|
||||
\pgfkeysvalueof{/tikz/name/.@cmd}#1\pgfeov% CF : this is now ALWAYS consistent with 'name=' option; allows overrides.
|
||||
\tikz@@scan@fig}%
|
||||
|
||||
\tikzoption{ybar}[]{\let\tikz@plot@handler=\pgfplothandlerybar}
|
||||
\tikzoption{xbar}[]{\let\tikz@plot@handler=\pgfplothandlerxbar}
|
||||
\tikzoption{ybar interval}[]{\let\tikz@plot@handler=\pgfplothandlerybarinterval}
|
||||
\tikzoption{xbar interval}[]{\let\tikz@plot@handler=\pgfplothandlerxbarinterval}
|
||||
\tikzoption{const plot}[]{\let\tikz@plot@handler=\pgfplothandlerconstantlineto}
|
||||
\tikzoption{const plot mark left}[]{\let\tikz@plot@handler=\pgfplothandlerconstantlineto}
|
||||
\tikzoption{const plot mark right}[]{\let\tikz@plot@handler=\pgfplothandlerconstantlinetomarkright}
|
||||
\tikzoption{const plot mark mid}[]{\let\tikz@plot@handler=\pgfplothandlerconstantlinetomarkmid}
|
||||
\tikzoption{jump mark right}[]{\let\tikz@plot@handler=\pgfplothandlerjumpmarkright}
|
||||
\tikzoption{jump mark left}[]{\let\tikz@plot@handler=\pgfplothandlerjumpmarkleft}
|
||||
\tikzoption{jump mark mid}[]{\let\tikz@plot@handler=\pgfplothandlerjumpmarkmid}
|
||||
|
||||
\def\tikz@plot@samples{25}
|
||||
\def\tikz@plot@domain{-5:5}
|
||||
\def\tikz@plot@var{\x}
|
||||
\def\tikz@plot@samplesat{-5,-4.5833333,...,5}
|
||||
|
||||
\tikzoption{mark}{
|
||||
\def\tikz@plot@mark{#1}%
|
||||
\def\tikz@temp{none}% this check is relatively new
|
||||
\ifx\tikz@temp\tikz@plot@mark
|
||||
\let\tikz@plot@mark=\pgfutil@empty
|
||||
\fi
|
||||
}
|
||||
|
||||
% the 'pt' suffix is new:
|
||||
\pgfdeclareplotmark{ball}
|
||||
{%
|
||||
\def\tikz@shading{ball}%
|
||||
\shade (0pt,0pt) circle (\pgfplotmarksize);%
|
||||
}
|
||||
|
||||
% the 'every mark' style is new:
|
||||
\tikzset{
|
||||
no marks/.style={mark=none},%
|
||||
every mark/.style={},
|
||||
mark options/.style={%
|
||||
every mark/.style={#1}%
|
||||
}}
|
||||
\def\tikz@@@plot{%
|
||||
\def\pgfplotlastpoint{\pgfpointorigin}%
|
||||
\tikz@plot@handler%
|
||||
\tikz@plot@data%
|
||||
\global\let\tikz@@@temp=\pgfplotlastpoint%
|
||||
\ifx\tikz@plot@mark\pgfutil@empty%
|
||||
\else%
|
||||
% Marks are drawn after the path.
|
||||
\setbox\tikz@figbox=\hbox{%
|
||||
\unhbox\tikz@figbox%
|
||||
\hbox{{%
|
||||
\pgfinterruptpath%
|
||||
\pgfscope%
|
||||
\let\tikz@options=\pgfutil@empty%
|
||||
\let\tikz@transform=\pgfutil@empty%
|
||||
\tikzset{every mark}%
|
||||
\tikz@options%
|
||||
\ifx\tikz@mark@list\pgfutil@empty%
|
||||
\pgfplothandlermark{\tikz@transform\pgfuseplotmark{\tikz@plot@mark}}%
|
||||
\else
|
||||
\pgfplothandlermarklisted{\tikz@transform\pgfuseplotmark{\tikz@plot@mark}}{\tikz@mark@list}%
|
||||
\fi
|
||||
\tikz@plot@data%
|
||||
\endpgfscope
|
||||
\endpgfinterruptpath%
|
||||
}}%
|
||||
}%
|
||||
\fi%
|
||||
\global\setbox\tikz@tempbox=\copy\tikz@figbox%
|
||||
%\global\let\tikz@after@path@smuggle=\tikz@after@path
|
||||
\endgroup%
|
||||
\setbox\tikz@figbox=\box\tikz@tempbox%
|
||||
\tikz@make@last@position{\tikz@@@temp}%
|
||||
%\expandafter\tikz@scan@next@command\tikz@after@path@smuggle%
|
||||
\tikz@scan@next@command%
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
% ======================================================
|
||||
|
||||
|
||||
\newif\ifpgfmathcomparison
|
||||
|
||||
% Assigns \pgfmathresult to 1.0 if #1 ~= #1.
|
||||
%
|
||||
% It will also set the boolean \ifpgfmathcomparison accordingly
|
||||
% (globally).
|
||||
\def\pgfmathapproxequalto#1#2{%
|
||||
\edef\pgfmath@marshal{%
|
||||
\noexpand\pgfmathparse{#2}
|
||||
\noexpand\let\noexpand\pgfmath@arg\noexpand\pgfmathresult%
|
||||
\noexpand\pgfmathparse{#1}%
|
||||
}%
|
||||
\pgfmath@marshal%
|
||||
\pgfmathapproxequalto@{\pgfmathresult}{\pgfmath@arg}}
|
||||
\def\pgfmathapproxequalto@#1#2{%
|
||||
\begingroup%
|
||||
\pgfmath@x#1pt%
|
||||
\pgfmath@y#2pt%
|
||||
\advance\pgfmath@x-\pgfmath@y%
|
||||
\ifdim\pgfmath@x<0pt
|
||||
\multiply\pgfmath@x by-1
|
||||
\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%
|
||||
}
|
||||
|
||||
\newif\ifpgfmarktext@usetikznode
|
||||
\pgfkeys{
|
||||
/pgf/text mark/.initial=p,
|
||||
/pgf/text mark style/.initial=,
|
||||
/pgf/text mark as node/.is if=pgfmarktext@usetikznode,
|
||||
/pgf/text mark as node/.default=true,
|
||||
%
|
||||
% backw. compat: the extra search path confuses the '.unknown'
|
||||
% handlers, so this here is deprecated:
|
||||
/pgf/text mark/style/.style={/pgf/text mark style={#1}},%
|
||||
/pgf/text mark/as node/.style={/pgf/text mark as node=#1},%
|
||||
}%
|
||||
|
||||
\pgfdeclareplotmark{text}
|
||||
{
|
||||
\pgfkeysgetvalue{/pgf/text mark style}\pgfmarktext@style
|
||||
\pgfkeysgetvalue{/pgf/text mark}\pgfmarktext@
|
||||
\ifpgfmarktext@usetikznode
|
||||
\expandafter\node\expandafter[\pgfmarktext@style]{\pgfmarktext@};
|
||||
\else
|
||||
\expandafter\pgftext\expandafter[\pgfmarktext@style]{\pgfmarktext@}%
|
||||
\fi
|
||||
}
|
||||
|
||||
% A fix for the overlay option and matrices:
|
||||
\def\pgf@matrix@startcell{%
|
||||
%
|
||||
% Step 1: Init the list of nodes for this cell
|
||||
%
|
||||
\let\pgf@nodecallback=\pgf@matrix@nodecallback%
|
||||
%
|
||||
% Step 2: Setup the bounding box
|
||||
%
|
||||
\pgfinterruptboundingbox%
|
||||
%
|
||||
% Step 3: Reset the transformation matrix
|
||||
%
|
||||
\pgftransformreset%
|
||||
%
|
||||
% Step 4: Collect everything in a cell box
|
||||
%
|
||||
\setbox\pgf@matrix@cell=\hbox\bgroup\bgroup%
|
||||
% 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:
|
||||
\pgfutil@ifnextchar\let%
|
||||
{% ok, candidate, check following symbol
|
||||
\afterassignment\pgf@matrix@empty@check\let\pgf@matrix@temp=% get rid of \let
|
||||
}%
|
||||
{% no, not empty
|
||||
\pgf@matrix@empty@cell@false%
|
||||
\pgfmatrixbegincode%
|
||||
}%
|
||||
}
|
||||
|
||||
% From pgfmoduleplot.code.tex:
|
||||
{
|
||||
\catcode`\%=12
|
||||
\catcode`\"=12
|
||||
\xdef\pgf@gnuplot@head@pgf@two@oo#1{set terminal table; set output "#1.table"; set format "%.5f"}
|
||||
\ifx\pgf@gnuplot@head\pgf@gnuplot@head@pgf@two@oo
|
||||
\xdef\pgf@gnuplot@head#1{set table "#1.table"; set format "%.5f"}
|
||||
\else
|
||||
\xdef\pgf@gnuplot@head{set table \noexpand\pgf@plottablefile@quoted; set format "%.5f"}
|
||||
\fi
|
||||
}
|
||||
|
||||
% From pgfcorescopes.code.tex:
|
||||
\def\pgfresetboundingbox{%
|
||||
\global\pgf@picmaxx=-16000pt\relax%
|
||||
\global\pgf@picminx=16000pt\relax%
|
||||
\global\pgf@picmaxy=-16000pt\relax%
|
||||
\global\pgf@picminy=16000pt\relax%
|
||||
}%
|
||||
|
||||
% from pgfcorepathconstruct.code.tex:
|
||||
|
||||
|
||||
\def\pgfpatharctomaxstepsize{45}
|
||||
|
||||
% A specialized arc operation for an arc on an (axis--parallel) ellipse.
|
||||
%
|
||||
% In contrast to \pgfpatharc, it explicitly interpolates start- and end points.
|
||||
%
|
||||
% In contrast to \pgfpatharcto, this routine is numerically stable and
|
||||
% quite fast since it relies on a lot of precomputed information.
|
||||
%
|
||||
% #1 center of ellipse
|
||||
% #2 angle of last path position inside of the ellipse
|
||||
% #3 end angle
|
||||
% #4 end point (a \pgfpoint)
|
||||
% #5 xradius
|
||||
% #6 yradius
|
||||
% #7 the ratio xradius/yradius of the ellipse
|
||||
% #8 the ratio yradius/xradius of the ellipse
|
||||
% Example:
|
||||
% \def\cx{1cm}% center x
|
||||
% \def\cy{1cm}% center y
|
||||
% \def\startangle{0}%
|
||||
% \def\endangle{45}%
|
||||
% \def\a{5cm}% xradius
|
||||
% \def\b{10cm}% yradius
|
||||
% \pgfmathparse{\a/\b}\let\abratio=\pgfmathresult
|
||||
% \pgfmathparse{\b/\a}\let\baratio=\pgfmathresult
|
||||
%
|
||||
% \pgfpathmoveto{\pgfpoint{\cx+\a*cos(\startangle)}{\cy+\b*sin(\startangle)}}%
|
||||
% \pgfpatharctoprecomputed
|
||||
% {\pgfpoint{\cx}{\cy}}
|
||||
% {\startangle}
|
||||
% {\endangle}
|
||||
% {\pgfpoint{\cx+\a*cos(\endangle)}{\cy+\b*sin(\endangle)}}%
|
||||
% {\a}
|
||||
% {\b}
|
||||
% {\abratio}
|
||||
% {\baratio}
|
||||
%
|
||||
\def\pgfpatharctoprecomputed#1#2#3#4#5#6#7#8{%
|
||||
\begingroup
|
||||
% Implementation idea:
|
||||
%
|
||||
% let
|
||||
% m = center (#1)
|
||||
% \gamma_0 = start angle
|
||||
% \gamma_1 = end angle
|
||||
% a = x radius
|
||||
% b = y radius
|
||||
%
|
||||
% an axis parallel ellipse is parameterized by
|
||||
% C(\gamma) = m + ( a cos(\gamma), b sin(\gamma) ), \gamma in [0,360].
|
||||
%
|
||||
% Now, consider the segment \gamma(t),
|
||||
% \gamma:[0,1] -> [\gamma_0,\gamma_1],
|
||||
% t -> \gamma_0 + t(\gamma_1 - \gamma_0)
|
||||
% and
|
||||
% C(\gamma(t)) which is defined on [0,1].
|
||||
%
|
||||
% I'd like to approximate the arc by one or more cubic bezier
|
||||
% splines which interpolate through the last and first provided
|
||||
% points.
|
||||
%
|
||||
% In general, a Bezier spline C:[0,1] -> \R of order n fulfills
|
||||
% C'(0) = n ( P_1 - P_0 ),
|
||||
% C'(1) = n ( P_n - P_{n-1} ).
|
||||
% For n=3 and given P_0 and P_3, I can directly compute P_1 and P_2 once I know
|
||||
% the derivatives at t=0 and t=1.
|
||||
%
|
||||
% The derivatives in our case are
|
||||
% ( C \circ \gamma )'(t) = C'[\gamma(t)] * \gamma'(t)
|
||||
% = ( -a pi/180 sin(\gamma(t)), b pi/180 cos(\gamma(t)) ) * (\gamma_1 - \gamma_0).
|
||||
% The pi/180 comes into play since we are working with degrees.
|
||||
%
|
||||
% Expression (C\circ\gamma)'(0) using P_0 and (C \circ \gamma)'(1)
|
||||
% using P_3 yields the expressions
|
||||
% (C \circ \gamma)'(0) =
|
||||
% pi/180 * (\gamma_1 - \gamma_0)* [ - a/b(P_0^y - my), b/a (P_0^x - mx) ]
|
||||
% (C \circ \gamma)'(1) =
|
||||
% pi/180 * (\gamma_1 - \gamma_0)* [ - a/b(P_3^y - my), b/a (P_3^x - mx) ]
|
||||
%
|
||||
% defining
|
||||
% scaleA = a/b * pi / (3*180) * (\gamma_1 - \gamma_0)
|
||||
% and
|
||||
% scaleB = b/a * pi / (3*180) * (\gamma_1 - \gamma_0)
|
||||
% yields the direct expressions for the intermediate bezier
|
||||
% control points
|
||||
%
|
||||
% P_1 = [
|
||||
% P_0^x - scaleA* ( P_0^y -my),
|
||||
% P_0^y + scaleB* ( P_0^x -mx) ]
|
||||
% and
|
||||
% P_2 = [
|
||||
% P_3^x + scaleA* ( P_3^y -my),
|
||||
% P_3^y - scaleB* ( P_3^x -mx) ].
|
||||
%
|
||||
% This works fast, with few operations, if
|
||||
% - a/b and b/a are known in advance
|
||||
% - P_0 and P_3 are known in advance
|
||||
% - \gamma_0 and \gamma_1 are known.
|
||||
%
|
||||
% It is also reliable if (\gamma_1 - \gamma_0) is small
|
||||
%
|
||||
\pgf@process{#1}%
|
||||
\edef\pgfpath@center@x{\the\pgf@x}%
|
||||
\edef\pgfpath@center@y{\the\pgf@y}%
|
||||
\def\pgfpath@completearcend{#4}%
|
||||
% compute scale (#3-#2) * pi/(3*180) = (#3 - #2) * pi/27 * 1/20
|
||||
% splitting pi/(3*180) into two scales has higher TeX accuracy
|
||||
\pgf@xa=#2pt
|
||||
\pgf@xb=#3pt
|
||||
\edef\pgfpath@startangle{#2pt}%
|
||||
\edef\pgfpath@endangle{\pgf@sys@tonumber\pgf@xb}%
|
||||
%
|
||||
\pgf@ya=\pgf@xb
|
||||
\advance\pgf@ya by-\pgf@xa
|
||||
%
|
||||
\ifx\pgfpatharctomaxstepsize\pgfutil@empty
|
||||
\def\pgfpath@N{1}%
|
||||
\pgf@xc=\pgf@ya
|
||||
\else
|
||||
\pgf@xc=\pgf@ya% compute N = floor((gamma_1 - gamma_0) / max) +1
|
||||
\ifdim\pgf@xc<0pt
|
||||
\multiply\pgf@xc by-1
|
||||
\fi
|
||||
\divide\pgf@xc by\pgfpatharctomaxstepsize\relax
|
||||
\afterassignment\pgfutil@gobble@until@relax
|
||||
\c@pgf@counta=\the\pgf@xc\relax
|
||||
\advance\c@pgf@counta by1
|
||||
\edef\pgfpath@N{\the\c@pgf@counta}%
|
||||
%
|
||||
\pgf@xc=\pgf@ya
|
||||
\divide\pgf@xc by\c@pgf@counta
|
||||
\fi
|
||||
%
|
||||
\edef\pgfpath@h{\pgf@sys@tonumber\pgf@xc}%
|
||||
%
|
||||
%\message{pgfpathellipse: using N =\pgfpath@N\space spline points y0 = \pgfpath@startangle, y0+i*h, yN=\pgfpath@endangle, i=1,...,(\pgfpath@N-1), with h=\pgfpath@h\space mesh width (total arc angle \pgf@sys@tonumber\pgf@ya).}%
|
||||
%
|
||||
%
|
||||
\pgf@xc=0.116355283466289\pgf@xc % pi/27
|
||||
\divide\pgf@xc by20
|
||||
\pgf@xa=#7\pgf@xc
|
||||
\edef\pgfpath@scale@A{\pgf@sys@tonumber\pgf@xa}%
|
||||
\pgf@xa=#8\pgf@xc
|
||||
\edef\pgfpath@scale@B{\pgf@sys@tonumber\pgf@xa}%
|
||||
%
|
||||
% compute intermediate spline segments for
|
||||
% i = 1,...,N-1
|
||||
% this is a no-op for N=1.
|
||||
\c@pgf@countd=1
|
||||
\pgfutil@loop
|
||||
\ifnum\c@pgf@countd<\pgfpath@N\relax
|
||||
%
|
||||
\pgf@xa=\pgfpath@startangle % compute \pgf@xa = y_0 + i*h
|
||||
\pgf@xb=\pgfpath@h pt
|
||||
\multiply\pgf@xb by\c@pgf@countd
|
||||
\advance\pgf@xa by\pgf@xb
|
||||
\edef\pgfpath@angle@i{\pgf@sys@tonumber\pgf@xa}%
|
||||
%\message{angle \the\c@pgf@countd: \pgfpath@angle@i...}%
|
||||
%
|
||||
\pgfpatharcofellipse@{%
|
||||
\pgfpoint
|
||||
{\pgfpath@center@x + #5*cos(\pgfpath@angle@i)}
|
||||
{\pgfpath@center@y + #6*sin(\pgfpath@angle@i)}
|
||||
}%
|
||||
%
|
||||
\advance\c@pgf@countd by1
|
||||
\pgfutil@repeat
|
||||
%
|
||||
% compute final spline segment. It only differs insofar as the
|
||||
% final point is already known explicitly and should be
|
||||
% interpolated without additional math error.
|
||||
%\message{angle \pgfpath@N: \pgfpath@endangle...}%
|
||||
\pgfpatharcofellipse@{\pgfpath@completearcend}%
|
||||
\endgroup
|
||||
}%
|
||||
\def\pgfpatharcofellipse@#1{%
|
||||
\begingroup
|
||||
\pgf@process{#1}%
|
||||
\edef\pgfpath@endpt{\global\pgf@x=\the\pgf@x\space\global\pgf@y=\the\pgf@y\space}%
|
||||
%
|
||||
\pgfpathcurveto{
|
||||
\begingroup
|
||||
\global\pgf@x=\pgf@path@lastx
|
||||
\global\pgf@y=\pgf@path@lasty
|
||||
\pgf@xa=\pgf@x \advance\pgf@xa by-\pgfpath@center@x
|
||||
\pgf@ya=\pgf@y \advance\pgf@ya by-\pgfpath@center@y
|
||||
\global\advance\pgf@x by-\pgfpath@scale@A\pgf@ya
|
||||
\global\advance\pgf@y by \pgfpath@scale@B\pgf@xa
|
||||
\endgroup
|
||||
}{%
|
||||
\begingroup
|
||||
\pgfpath@endpt
|
||||
\pgf@xa=\pgf@x \advance\pgf@xa by-\pgfpath@center@x
|
||||
\pgf@ya=\pgf@y \advance\pgf@ya by-\pgfpath@center@y
|
||||
\global\advance\pgf@x by \pgfpath@scale@A\pgf@ya
|
||||
\global\advance\pgf@y by-\pgfpath@scale@B\pgf@xa
|
||||
\endgroup
|
||||
}{%
|
||||
\pgfpath@endpt
|
||||
}%
|
||||
\endgroup
|
||||
}
|
||||
|
||||
% bugfix for pgf 2.10, pgfmathfunctions.basic.code.tex :
|
||||
%
|
||||
\newif\ifpgfmath@divide@period
|
||||
\def\pgfmathdivide@#1#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%
|
||||
}
|
||||
\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%
|
||||
}
|
||||
|
||||
% 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}%
|
||||
}%
|
||||
|
||||
{
|
||||
\catcode`\p=12
|
||||
\catcode`\t=12
|
||||
\gdef\Pgf@geT@NO@TRAILING@ZERO#1.#2pt{%
|
||||
#1.%
|
||||
\ifnum#2=0 \else #2\fi
|
||||
}
|
||||
}
|
||||
\def\pgfmath@tonumber@notrailingzero#1{\expandafter\Pgf@geT@NO@TRAILING@ZERO\the#1}
|
|
@ -0,0 +1,18 @@
|
|||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%%% This file contains patches on top of PGF/Tikz.
|
||||
%%%
|
||||
%%% It has been copied here to provide :
|
||||
%%% - compatibility with older PGF versions
|
||||
%%% - availability of PGF contributions by Christian Feuersaenger
|
||||
%%% which are necessary or helpful for pgfplots.
|
||||
%%%
|
||||
%%% For reasons of simplicity, I have copied the whole file, including own contributions AND
|
||||
%%% PGF parts. The copyrights are as they appear in PGF.
|
||||
%%%
|
||||
%%% Note that pgfplots has compatible licenses.
|
||||
%%%
|
||||
%%% This copy has been modified in the following ways:
|
||||
%%% - nested \input commands have been updated
|
||||
%%%
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
|
@ -0,0 +1,562 @@
|
|||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%%% This file is a copy of some part of PGF/Tikz.
|
||||
%%% It has been copied here to provide :
|
||||
%%% - compatibility with older PGF versions
|
||||
%%% - availability of PGF contributions by Christian Feuersaenger
|
||||
%%% which are necessary or helpful for pgfplots.
|
||||
%%%
|
||||
%%% For reasons of simplicity, I have copied the whole file, including own contributions AND
|
||||
%%% PGF parts. The copyrights are as they appear in PGF.
|
||||
%%%
|
||||
%%% Note that pgfplots has compatible licenses.
|
||||
%%%
|
||||
%%% This copy has been modified in the following ways:
|
||||
%%% - nested \input commands have been updated
|
||||
%%%
|
||||
%
|
||||
% Support for the contents of this file will NOT be done by the PGF/TikZ team.
|
||||
% Please contact the author and/or maintainer of pgfplots (Christian Feuersaenger) if you need assistance in conjunction
|
||||
% with the deployment of this patch or partial content of PGF. Note that the author and/or maintainer of pgfplots has no obligation to fix anything:
|
||||
% This file comes without any warranty as the rest of pgfplots; there is no obligation for help.
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%%% Date of this copy: Mi 9. Jul 15:41:39 CEST 2014 %%%
|
||||
|
||||
|
||||
|
||||
% Copyright 2006 by Till Tantau
|
||||
%
|
||||
% 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 $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcoreexternal.code.tex,v 1.20 2013/07/15 12:05:31 tantau Exp $
|
||||
|
||||
|
||||
|
||||
\newif\ifpgfexternal@aux@in@dpth
|
||||
\newif\ifpgfexternal@info
|
||||
|
||||
\pgfkeys{
|
||||
/pgf/images/include external/.code={\pgfimage{#1}},
|
||||
/pgf/images/aux in dpth/.is if=pgfexternal@aux@in@dpth,
|
||||
/pgf/images/aux in dpth/.default=true,
|
||||
/pgf/images/trim external/.code n args={4}{%
|
||||
\def\pgf@external@kern@left{#1}%
|
||||
\def\pgf@external@kern@bottom{#2}%
|
||||
\def\pgf@external@kern@right{#3}%
|
||||
\def\pgf@external@kern@top{#4}%
|
||||
\ifx\pgf@external@kern@left\pgfutil@empty\def\pgf@external@kern@left{0sp}\fi%
|
||||
\ifx\pgf@external@kern@bottom\pgfutil@empty\def\pgf@external@kern@bottom{0sp}\fi%
|
||||
\ifx\pgf@external@kern@right\pgfutil@empty\def\pgf@external@kern@right{0sp}\fi%
|
||||
\ifx\pgf@external@kern@top\pgfutil@empty\def\pgf@external@kern@top{0sp}\fi%
|
||||
},
|
||||
/pgf/images/trim external={1truein}{1truein}{1truein}{1truein},
|
||||
/pgf/images/external info/.is if=pgfexternal@info,
|
||||
/pgf/images/external info/.default=true,
|
||||
}
|
||||
|
||||
% The external read/write mechanism is used as follows:
|
||||
%
|
||||
% In your document, you put a number or all of your pgfpicture (or
|
||||
% tikzpicture) environments inside a pair of \beginpgfexternal and
|
||||
% \endpgfexternal. The \beginpgfexternal gets one parameter called the
|
||||
% graphics name.
|
||||
%
|
||||
% Once this is done, the next step is to declare the names of your
|
||||
% graphics in the document at the beginning using the
|
||||
% \pgfdeclaregraphicname command.
|
||||
%
|
||||
% Now, when you typeset your document, each time a \beginpgfexternal
|
||||
% command is encountered, it will be checked whether the corresponding
|
||||
% graphics file exists. If this is the case, it will be included and
|
||||
% the code between \beginpgfexternal and \endpgfexternal is
|
||||
% ignored. Otherwise, the code is executed normally.
|
||||
%
|
||||
% Things change when you run tex on your file with the \jobname set to
|
||||
% the name of a decalred graphics name. In this case, only your
|
||||
% graphic will be typeset, the rest of the document will be "thrown away".
|
||||
% To be more precise, everything is gobbled up to the beginning
|
||||
% of the first \beginpgfexternal with the given graphics name. Then,
|
||||
% the content of the "environment" is put in a box (this "environment"
|
||||
% need not contain a graphics, it may contain anything that can be put
|
||||
% in a box). Then a single page is output whose size is exactly the
|
||||
% size of the picture.
|
||||
%
|
||||
% So, once you have run tex repeatedly, each time with the jobname set
|
||||
% to each of the graphics, you can then run tex on the whole document
|
||||
% and this will cause all graphics to be included rather than begin
|
||||
% typeset.
|
||||
%
|
||||
% Finally, once all the graphics have been created, you can also say
|
||||
% \input pgfexternal.tex instead of including pgf/TikZ.
|
||||
|
||||
|
||||
\newif\ifpgfexternalreadmainaux
|
||||
\pgfexternalreadmainauxtrue
|
||||
|
||||
% Tells pgf which jobname is the name of the real file
|
||||
%
|
||||
% #1 = name
|
||||
%
|
||||
% Description:
|
||||
%
|
||||
% This command is used to tell pgf that the file named #1 should be
|
||||
% typeset normally. If \jobname is not equal to #1, only
|
||||
% the graphic called \jobname will be typeset.
|
||||
%
|
||||
% Example:
|
||||
%
|
||||
% \pgfrealjobname{survey}
|
||||
%
|
||||
% Note that afterwards, \jobname will be set to the argument. In our
|
||||
% example, \jobname will be 'survey'. This is to accomplish
|
||||
% compatibility with aux-file generation.
|
||||
|
||||
\def\pgfrealjobname#1{%
|
||||
\global\let\pgfactualjobname=\jobname
|
||||
\edef\pgf@tempa{\expandafter\string\csname #1\endcsname}%
|
||||
\edef\pgf@tempb{\expandafter\string\csname\jobname\endcsname}%
|
||||
\ifx\pgf@tempa\pgf@tempb%
|
||||
\else%
|
||||
\pgf@external@grabshipouttrue%
|
||||
\pgfexternal@nofiles% see also \pgf@external@init@aux@in@dpth
|
||||
\ifpgfexternalreadmainaux
|
||||
% and reset the jobname. This should allow to handle any
|
||||
% \label/\ref constructions which are stored in \jobname.aux (and
|
||||
% which won't be found otherwise)
|
||||
\gdef\jobname{#1}%
|
||||
\fi
|
||||
\ifpgfexternal@aux@in@dpth
|
||||
\csname newwrite\endcsname\w@pgfexternal@auxout
|
||||
\fi
|
||||
\pgfexternal@geometry@compatibility
|
||||
\fi%
|
||||
\gdef\pgfrealjobname##1{}% avoid multiple calls.
|
||||
}
|
||||
|
||||
\def\pgfexternal@geometry@compatibility{%
|
||||
% check if \usepackage{geometry} is loaded:
|
||||
\pgfutil@ifundefined{geometry}{%
|
||||
}{%
|
||||
% The geometry package hooks into \begin{document}, evaluates
|
||||
% its driver -- and generates \special instructions to set the
|
||||
% paper size.
|
||||
%
|
||||
% Unfortunately, this confuses dvips utterly - and perhaps
|
||||
% other drivers as well.
|
||||
%
|
||||
% Thus, if we currently about to generate some external
|
||||
% graphics, we WANT to disable geometry (it has no purpose in
|
||||
% this context anyway).
|
||||
%
|
||||
% This here works well:
|
||||
\immediate\write16{Package TikZ externalization: calling \string\geometry{driver=none} during externalization.^^J}%
|
||||
\geometry{driver=none}%
|
||||
}%
|
||||
}%
|
||||
|
||||
\def\pgfexternal@nofiles{%
|
||||
% replace \relax. The \nofiles macros does
|
||||
% \let\makeglossary=\relax
|
||||
% but the glossary.sty calls \renewcommand\makeglossary (which
|
||||
% will fail if \makeglossary=\relax). Stupid, but it works.
|
||||
\let\pgfexternal@nofiles@=\relax
|
||||
\def\relax{\relax}%
|
||||
%
|
||||
% suppress generation of LaTeX .aux, .toc etc files.
|
||||
% generation of these files is not thread-safe.
|
||||
% the \csname \endcsname yields \relax if \nofiles doesn't exist.
|
||||
\csname nofiles\endcsname
|
||||
%
|
||||
\let\relax=\pgfexternal@nofiles@
|
||||
}%
|
||||
|
||||
\newif\ifpgf@external@grabshipout
|
||||
\newbox\pgfexternal@startupbox
|
||||
|
||||
\pgfutil@ifundefined{AtBeginDocument}{}{%
|
||||
\AtBeginDocument{%
|
||||
\ifpgf@external@grabshipout%
|
||||
\global\let\pgfexternal@originalshipout=\shipout%
|
||||
\global\def\shipout{\setbox\pgfpic=}%
|
||||
\maxdeadcycles=10000%
|
||||
% Ok, gather everything we have seen up to now in a box. This box
|
||||
% will contain any specials that have been used.
|
||||
{%
|
||||
\output{\global\setbox\pgfexternal@startupbox=\vbox{\csname @begindvi\endcsname\unvbox255}}%
|
||||
\hbox{}\eject%
|
||||
}%
|
||||
\fi%
|
||||
}
|
||||
}%
|
||||
|
||||
\pgfutil@ifundefined{AtEndDocument}{}{%
|
||||
\AtEndDocument{%
|
||||
\ifpgf@external@grabshipout
|
||||
\pgfutil@ifundefined{pgfexternal@did@a@shipout}{%
|
||||
\pgfexternal@error@no@shipout
|
||||
}{}%
|
||||
\fi
|
||||
}%
|
||||
}
|
||||
|
||||
% This will be overwritten by the tikz external lib if it is loaded.
|
||||
\def\pgfexternal@error@no@shipout{%
|
||||
\pgferror{Sorry, image externalization failed: the resulting image was EMPTY. I tried to externalize '\pgfactualjobname'. Perhaps there was a typo somewhere? Please check that your document contains '\string\beginpgfgraphicnamed{\pgfactualjobname} ... \string\endpgfgraphicnamed'}%
|
||||
}%
|
||||
|
||||
|
||||
% "Environment" for an external graphic.
|
||||
%
|
||||
% #1 = graphic name
|
||||
%
|
||||
% Example:
|
||||
%
|
||||
% \beginpgfgraphicnamed{main-graphic2}
|
||||
% \begin{tikzpicture}
|
||||
% ...
|
||||
% \end{tikzpicture}
|
||||
% \endpgfgraphicnamed
|
||||
|
||||
\def\pgf@externalbegin#1{%
|
||||
% First, check whether we wish to grab this graphic:
|
||||
\let\pgf@next=\pgf@external@normal%
|
||||
\ifpgf@external@grabshipout%
|
||||
\edef\pgf@tempa{\expandafter\string\csname #1\endcsname}%
|
||||
\edef\pgf@tempb{\expandafter\string\csname\pgfactualjobname\endcsname}%
|
||||
\ifx\pgf@tempa\pgf@tempb%
|
||||
\let\pgf@next=\pgf@external@grab%
|
||||
\fi%
|
||||
\fi%
|
||||
\pgf@next{#1}%
|
||||
}
|
||||
|
||||
|
||||
\AtBeginDocument{
|
||||
\let\beginpgfgraphicnamed=\pgf@externalbegin% overwrite definition of pgfexternal.tex if necessary
|
||||
\let\endpgfgraphicnamed=\unskip
|
||||
}
|
||||
|
||||
|
||||
% Normal operation: Include an external graphic instead of the
|
||||
% picture, if such an external picture exists.
|
||||
\def\pgf@external@normal#1{%
|
||||
\let\pgf@filename=\pgfutil@empty%
|
||||
\expandafter\pgf@findfile\pgfsys@imagesuffixlist:+{#1}%
|
||||
\ifx\pgf@filename\pgfutil@empty%
|
||||
% Ok, no such image... Just typeset the picture normally.
|
||||
\let\pgf@next=\relax%
|
||||
\else%
|
||||
\let\pgf@next=\pgf@replacepicturebygraphic%
|
||||
\fi%
|
||||
\pgf@next%
|
||||
}
|
||||
|
||||
\long\def\pgf@replacepicturebygraphic#1\endpgfgraphicnamed{%
|
||||
\expandafter\pgfincludeexternalgraphics\expandafter{\pgf@filename}\unskip
|
||||
}
|
||||
|
||||
% This is almost the same as \includegraphics{#1}, but it checks
|
||||
% whether '#1.dpth' exists. In such case, it restores the boxes depth
|
||||
% stored in #1.dpth.
|
||||
%
|
||||
% Furthermore, the .dpth file may contain .aux related information
|
||||
% collected for the external graphics (references). They start after
|
||||
% the first line (if any).
|
||||
\def\pgfincludeexternalgraphics#1{%
|
||||
\begingroup
|
||||
\pgfexternalreaddpth{#1}%
|
||||
\pgfkeysifdefined{/pgf/images/include external/#1/.@cmd}{%
|
||||
\pgfkeysgetvalue{/pgf/images/include external/#1/.@cmd}\pgf@tempa
|
||||
\pgfkeyslet{/pgf/images/include external/.@cmd}\pgf@tempa
|
||||
}{}%
|
||||
\setbox1=\hbox{\pgfkeysvalueof{/pgf/images/include external/.@cmd}{#1}\pgfeov}%
|
||||
\ifdim\pgfexternaltrimleft=0sp \else \kern\pgfexternaltrimleft\relax \fi
|
||||
\ifdim\pgfexternaldepth=0pt
|
||||
\box1
|
||||
\else
|
||||
\dimen0=\pgfexternaldepth\relax
|
||||
\hbox{\lower\dimen0 \box1 }%
|
||||
\fi
|
||||
\ifdim\pgfexternaltrimright=0sp \else \kern\pgfexternaltrimright\relax \fi
|
||||
\endgroup
|
||||
}
|
||||
|
||||
% Reads the .dpth file which contains meta data of the external
|
||||
% picture.
|
||||
%
|
||||
% This command handles the following stuff:
|
||||
% - it defines \pgfexternaldepth . The macro contains the contents of
|
||||
% a line which does not start with a control sequence (for example a
|
||||
% line containing '50pt')
|
||||
% - it defines \pgfexternaltrimleft and \pgfexternaltrimright
|
||||
% - it checks if the .dpth file contains content stored by means of
|
||||
% \pgfexternalstorecommand. If so, the argument of
|
||||
% \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).
|
||||
%
|
||||
%
|
||||
% #1: the image file name (such that #1.dpth exists)
|
||||
\def\pgfexternalreaddpth#1{%
|
||||
% no \begingroup. Handle that manually:
|
||||
\edef\pgfexternalreaddpth@restore{%
|
||||
\noexpand\endlinechar=\the\endlinechar\space
|
||||
\noexpand\catcode`\noexpand\@=\the\catcode`\@\space
|
||||
}%
|
||||
%
|
||||
\def\pgfexternaldepth{0sp}%
|
||||
\def\pgfexternaltrimleft{0sp}%
|
||||
\def\pgfexternaltrimright{0sp}%
|
||||
\endlinechar=-1 % suppress white space at end
|
||||
\catcode`\@=11
|
||||
\openin\r@pgf@reada=#1.dpth
|
||||
\pgfincludeexternalgraphics@read@dpth
|
||||
%
|
||||
\pgfexternalreaddpth@restore
|
||||
}%
|
||||
%
|
||||
% The .dpth consists of 0-N lines, where each is either a single
|
||||
% dimension (the box' depth) or something which belongs to the .aux
|
||||
% file (such lines will always start with a macro).
|
||||
\def\pgfincludeexternalgraphics@read@dpth{%
|
||||
\ifeof\r@pgf@reada
|
||||
\closein\r@pgf@reada
|
||||
\else
|
||||
\read\r@pgf@reada to\pgfincludeexternalgraphics@auxline
|
||||
\ifx\pgfincludeexternalgraphics@auxline\pgfutil@empty
|
||||
\else
|
||||
\expandafter\pgfincludeexternalgraphics@read@dpth@line\pgfincludeexternalgraphics@auxline\pgfincludeexternalgraphics@read@dpth@line@EOI
|
||||
\fi
|
||||
\expandafter\pgfincludeexternalgraphics@read@dpth
|
||||
\fi
|
||||
}%
|
||||
|
||||
\def\pgfexternal@restore#1{#1}%
|
||||
|
||||
\long\def\pgfincludeexternalgraphics@read@dpth@line@getfirst#1#2\pgfincludeexternalgraphics@read@dpth@line@EOI{%
|
||||
\def\pgf@first{#1}%
|
||||
}%
|
||||
\long\def\pgfincludeexternalgraphics@read@dpth@line#1\pgfincludeexternalgraphics@read@dpth@line@EOI{%
|
||||
\pgfincludeexternalgraphics@read@dpth@line@getfirst#1\pgfincludeexternalgraphics@read@dpth@line@EOI
|
||||
\expandafter\ifcat\expandafter\noexpand\pgf@first\relax
|
||||
% Ah -- the first token is a control sequence. It belongs to
|
||||
% the .aux file.
|
||||
%
|
||||
\expandafter\ifx\pgf@first\pgfexternal@restore
|
||||
% if the first line in the .dpth file starts with the
|
||||
% magic string \pgfexternal@restore, the complete line
|
||||
% will be executed as-is. Example:
|
||||
% \pgfexternal@restore{\def\somevalue{1}}
|
||||
#1%
|
||||
\else
|
||||
% do NOT execute #1! many LaTeX commands don't support it (\label for example)
|
||||
\pgfutil@ifundefined{if@filesw}{%
|
||||
% sorry, .aux file support only for latex
|
||||
}{%
|
||||
% append to main .aux file (for forward references)
|
||||
\if@filesw
|
||||
{%
|
||||
\toks0={#1}%
|
||||
% believe it or not, but the
|
||||
% \def\dpthimport{...}\dpthimport *makes* a
|
||||
% difference! In ensures any occuring `##' characters are properly expanded to `#'.
|
||||
\immediate\write\@auxout{%
|
||||
\noexpand\def\noexpand\dpthimport{\the\toks0}\noexpand\dpthimport}%
|
||||
}%
|
||||
\fi
|
||||
}%
|
||||
\fi
|
||||
\else% it is the depth (which is simply a number for backwards compatibility)
|
||||
\def\pgfexternaldepth{#1}%
|
||||
\fi
|
||||
}%
|
||||
|
||||
% Stores '#1' (expanded!) into the .dpth file of the currently
|
||||
% exported image.
|
||||
%
|
||||
% This command has only an effect if an image is being exported.
|
||||
%
|
||||
% The stored contents will be read in the context where
|
||||
% /pgf/images/include external is active (i.e. by
|
||||
% \pgfexternalreaddpth).
|
||||
%
|
||||
\def\pgfexternalstorecommand#1{%
|
||||
}%
|
||||
\def\pgfexternalstorecommand@isexporting#1{%
|
||||
\immediate\write\w@pgfexternal@auxout{\noexpand\pgfexternal@restore{#1}}%
|
||||
}%
|
||||
|
||||
|
||||
|
||||
% Grab operation: If jobname matches the graphic name, typeset this
|
||||
% picture normall.
|
||||
% REMARK:
|
||||
% this method is also invoked from within the tikz external library.
|
||||
\def\pgf@external@grab#1{%
|
||||
\def\pgf@filename{#1}%
|
||||
\ifpgfexternal@aux@in@dpth
|
||||
\begingroup
|
||||
\pgf@external@init@aux@in@dpth
|
||||
\let\G@refundefinedtrue=\pgf@external@grab@refundefinedtrue
|
||||
\fi
|
||||
\gdef\pgf@trimleft@final{0sp}%
|
||||
\gdef\pgf@trimright@final{0sp}%
|
||||
\setbox\pgfpic=\hbox\bgroup\bgroup%
|
||||
\let\endpgfgraphicnamed=\pgf@externalend%
|
||||
}
|
||||
|
||||
{\catcode`\^=12 \gdef\pgfexternal@hat{^}}
|
||||
|
||||
\expandafter\let\expandafter\pgf@external@grab@refundefinedtrue@orig\csname G@refundefinedtrue\endcsname
|
||||
|
||||
\def\pgf@external@grab@refundefinedtrue{%
|
||||
\pgf@external@grab@refundefinedtrue@orig
|
||||
\begingroup
|
||||
\def\n{\pgfexternal@hat\pgfexternal@hat J}%
|
||||
\pgfexternalstorecommand{%
|
||||
\noexpand\immediate\noexpand\write16{\pgf@external@grab@refundefinedtrue@warning}%
|
||||
\noexpand\G@refundefinedtrue
|
||||
}%
|
||||
\endgroup
|
||||
}%
|
||||
\def\pgf@external@grab@refundefinedtrue@warning{%
|
||||
LaTeX Warning: External picture `\pgfactualjobname' contains undefined references\noexpand\on@line.\n
|
||||
}%
|
||||
|
||||
\let\pgf@external@@protected@write@orig=\protected@write
|
||||
\long\def\pgf@external@@protected@write@immediate#1#2#3{%
|
||||
\begingroup
|
||||
\let\pgf@write@=\write
|
||||
\def\write{\noexpand\immediate\pgf@write@}%
|
||||
\pgf@external@@protected@write@orig{#1}{#2}{#3}%
|
||||
\endgroup
|
||||
}%
|
||||
|
||||
\def\pgf@external@init@aux@in@dpth{%
|
||||
\let\pgfexternalstorecommand=\pgfexternalstorecommand@isexporting
|
||||
%
|
||||
% tell LaTeX to write aux files...
|
||||
\csname @fileswtrue\endcsname
|
||||
% ... but redirect output to the .dpth file!
|
||||
\immediate\openout\w@pgfexternal@auxout=\pgf@filename.dpth
|
||||
\let\@auxout=\w@pgfexternal@auxout
|
||||
% ... and disable the correct page numbers. I can't get that
|
||||
% (because the correct page number is only available in the
|
||||
% shipout routine). Use immediate output:
|
||||
\let\protected@write=\pgf@external@@protected@write@immediate
|
||||
}%
|
||||
|
||||
\def\pgf@externalend@storeshifts#1{%
|
||||
\immediate\write#1{\the\dp\pgfpic}% store the depth simply as number for backw. compat.
|
||||
\ifx\pgf@trimleft@final\pgfutil@empty\else
|
||||
\immediate\write#1{\noexpand\pgfexternal@restore{\noexpand\def\noexpand\pgfexternaltrimleft{\pgf@trimleft@final}}}%
|
||||
\fi
|
||||
\ifx\pgf@trimright@final\pgfutil@empty\else
|
||||
\immediate\write#1{\noexpand\pgfexternal@restore{\noexpand\def\noexpand\pgfexternaltrimright{\pgf@trimright@final}}}%
|
||||
\fi
|
||||
\ifpgfexternal@info
|
||||
\immediate\write#1{\noexpand\pgfexternal@restore{\noexpand\def\noexpand\pgfexternalwidth{\the\wd\pgfpic}}}%
|
||||
\immediate\write#1{\noexpand\pgfexternal@restore{\noexpand\def\noexpand\pgfexternalheight{\the\dimen0}}}%
|
||||
\fi
|
||||
}
|
||||
% REMARK:
|
||||
% this method is also invoked from within the tikz external library.
|
||||
\def\pgf@externalend{%
|
||||
\unskip\egroup\egroup%
|
||||
{%
|
||||
\def\pgf@external@trim{0}%
|
||||
\def\pgf@external@store@dpth{0}%
|
||||
%
|
||||
\ifpgf@trim@lowlevel
|
||||
\gdef\pgf@trimleft@final{}%
|
||||
\gdef\pgf@trimright@final{}%
|
||||
\else
|
||||
\ifdim\pgf@trimleft@final=0sp \gdef\pgf@trimleft@final{} \else\def\pgf@external@trim{1}\fi
|
||||
\ifdim\pgf@trimright@final=0sp \gdef\pgf@trimright@final{} \else\def\pgf@external@trim{1}\fi
|
||||
\if1\pgf@external@trim
|
||||
% UNDO the trimming! export to pdf doesn't supported trimmed
|
||||
% bounding boxes (has to do with the mediabox/trimbox etc).
|
||||
% I'll keep the bounding box intact and store the trim information
|
||||
% into the .dpth file.
|
||||
\setbox\pgfpic=\hbox{%
|
||||
\ifx\pgf@trimleft@final\pgfutil@empty\else\kern-\pgf@trimleft@final\fi
|
||||
\box\pgfpic
|
||||
\ifx\pgf@trimright@final\pgfutil@empty\else\kern-\pgf@trimright@final\fi
|
||||
}%
|
||||
\def\pgf@external@store@dpth{1}%
|
||||
\fi
|
||||
\fi
|
||||
%
|
||||
\parindent0pt % leave the space
|
||||
% \leftmargin0pt%
|
||||
% \rightmargin0pt%
|
||||
\hoffset=0pt % reset to default
|
||||
\voffset=0pt
|
||||
\dimen0\ht\pgfpic%
|
||||
\advance\dimen0\dp\pgfpic%
|
||||
\ifdim\dp\pgfpic=0pt\relax
|
||||
\else% store the picture's depth. Otherwise, it would be lost.
|
||||
\def\pgf@external@store@dpth{1}%
|
||||
\fi
|
||||
\ifpgfexternal@info
|
||||
\def\pgf@external@store@dpth{1}%
|
||||
\fi
|
||||
%
|
||||
\if1\pgf@external@store@dpth
|
||||
\ifpgfexternal@aux@in@dpth
|
||||
\pgf@externalend@storeshifts\@auxout
|
||||
\immediate\closeout\@auxout
|
||||
\else
|
||||
\immediate\openout\pgf@plotwrite=\pgf@filename.dpth
|
||||
\pgf@externalend@storeshifts\pgf@plotwrite
|
||||
\immediate\closeout\pgf@plotwrite
|
||||
\fi
|
||||
\fi
|
||||
\pgfsys@prepare@papersize{\the\wd\pgfpic}{\the\dimen0}%
|
||||
%
|
||||
\setbox0=\vbox{%
|
||||
% I admit that I don't know why there is this kerning:
|
||||
\kern -\pgf@external@kern@top\relax%
|
||||
\hbox{%
|
||||
\kern -\pgf@external@kern@left\relax%
|
||||
\hbox to0pt{%
|
||||
\wd\pgfexternal@startupbox=0pt %
|
||||
\ht\pgfexternal@startupbox=0pt %
|
||||
\dp\pgfexternal@startupbox=0pt %
|
||||
\box\pgfexternal@startupbox%
|
||||
\pgfsys@atbegindocument\hss}%
|
||||
\box\pgfpic%
|
||||
\kern\pgf@external@kern@right\relax%
|
||||
}%
|
||||
\kern\pgf@external@kern@bottom\relax%
|
||||
}%
|
||||
%
|
||||
% compatibility with eso-pic package: \nointerlineskip is not
|
||||
% allowed here, but the eso-pic package uses \nointerlineskip in
|
||||
% its shipout routine.
|
||||
\let\pgfexternal@nointerlineskip@orig=\nointerlineskip
|
||||
\let\nointerlineskip=\pgfexternal@nointerlineskip
|
||||
%
|
||||
\pgfexternal@originalshipout\box0 %
|
||||
\gdef\pgfexternal@did@a@shipout{1}%
|
||||
}%
|
||||
\ifpgfexternal@aux@in@dpth
|
||||
\endgroup
|
||||
\fi
|
||||
}
|
||||
|
||||
\def\pgfexternal@nointerlineskip{%
|
||||
\ifvmode
|
||||
\pgfexternal@nointerlineskip@orig
|
||||
\else
|
||||
\relax% \nointerlineskip in horizontal mode not allowed. Silently ignore the error message.
|
||||
\fi
|
||||
}%
|
||||
|
||||
\endinput
|
||||
% vi: tabstop=4 shiftwidth=2 expandtab
|
|
@ -0,0 +1,585 @@
|
|||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%%% This file is a copy of some part of PGF/Tikz.
|
||||
%%% It has been copied here to provide :
|
||||
%%% - compatibility with older PGF versions
|
||||
%%% - availability of PGF contributions by Christian Feuersaenger
|
||||
%%% which are necessary or helpful for pgfplots.
|
||||
%%%
|
||||
%%% For reasons of simplicity, I have copied the whole file, including own contributions AND
|
||||
%%% PGF parts. The copyrights are as they appear in PGF.
|
||||
%%%
|
||||
%%% Note that pgfplots has compatible licenses.
|
||||
%%%
|
||||
%%% This copy has been modified in the following ways:
|
||||
%%% - nested \input commands have been updated
|
||||
%%%
|
||||
%
|
||||
% Support for the contents of this file will NOT be done by the PGF/TikZ team.
|
||||
% Please contact the author and/or maintainer of pgfplots (Christian Feuersaenger) if you need assistance in conjunction
|
||||
% with the deployment of this patch or partial content of PGF. Note that the author and/or maintainer of pgfplots has no obligation to fix anything:
|
||||
% This file comes without any warranty as the rest of pgfplots; there is no obligation for help.
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%%% Date of this copy: Mon Mar 22 16:42:03 CET 2010 %%%
|
||||
|
||||
|
||||
|
||||
% Copyright 2006 by Till Tantau
|
||||
%
|
||||
% 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 $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcoreimage.code.tex,v 1.14 2010/03/19 09:50:32 ludewich Exp $
|
||||
|
||||
|
||||
|
||||
% Declare an image
|
||||
%
|
||||
% #1 = optional argument: width, height, page specification
|
||||
% #2 = name of the image for later use
|
||||
% #4 = filename without extension, automatic extensions are .pdf,
|
||||
% .jpg, and .png for PDF and .ps, .eps, .epsi for postscript.
|
||||
%
|
||||
% Description:
|
||||
%
|
||||
% This command declares an image file for later use. Even if the image
|
||||
% is used several times in the document, in PDF it will only be stored
|
||||
% once.
|
||||
%
|
||||
% Example:
|
||||
%
|
||||
% \pgfdeclareimage[width=2cm,page=2]{myimage}{imagefilename}
|
||||
|
||||
\def\pgfdeclareimage{\pgfutil@ifnextchar[{\pgf@declareimage}{\pgf@declareimage[]}}
|
||||
\def\pgf@declareimage[#1]#2#3{%
|
||||
\pgfqkeys{/pgf/images}{height=,width=,page=,interpolate=false,mask=,#1}%
|
||||
% Try to find the file
|
||||
\gdef\pgf@filename{}%
|
||||
% If page= parameter is not empty, try that file first:
|
||||
\ifx\pgf@imagepage\pgfutil@empty%
|
||||
\else%
|
||||
\expandafter\pgf@findfile\pgfsys@imagesuffixlist:+{#3.page\pgf@imagepage}%
|
||||
\fi%
|
||||
\ifx\pgf@filename\pgfutil@empty%
|
||||
\expandafter\pgf@findfile\pgfsys@imagesuffixlist:+{#3}%
|
||||
\else%
|
||||
\pgfkeys{/pgf/images/page=}% make page empty
|
||||
\fi%
|
||||
\ifx\pgf@filename\pgfutil@empty%
|
||||
\PackageWarning{pgf}%
|
||||
{File "#3" not found when defining image "#2".\MessageBreak
|
||||
Tried all extensions in "\pgfsys@imagesuffixlist"}%
|
||||
\pgf@declaredraftimage{#2}{#3}%
|
||||
\else%
|
||||
\ifpgf@draftmode%
|
||||
\pgf@declaredraftimage{#2}{#3}%
|
||||
\else%
|
||||
\pgfsys@defineimage%
|
||||
\fi%
|
||||
\fi%
|
||||
\expandafter\global\expandafter\let\csname pgf@image@#2!\endcsname=\pgf@image%
|
||||
}
|
||||
|
||||
\newif\ifpgfexternal@allow@aux
|
||||
|
||||
\pgfkeys{
|
||||
/pgf/images/include external/.code={\pgfimage{#1}},
|
||||
/pgf/images/aux in dpth/.is if=pgfexternal@allow@aux,
|
||||
/pgf/images/aux in dpth/.default=true,
|
||||
/pgf/images/draft/.is if=pgf@draftmode,
|
||||
/pgf/images/draft/.default=true}
|
||||
\pgfkeys{/pgf/images/width/.estore in=\pgf@imagewidth}
|
||||
\pgfkeys{/pgf/images/height/.estore in=\pgf@imageheight}
|
||||
\pgfkeys{/pgf/images/page/.estore in=\pgf@imagepage}
|
||||
\pgfkeys{/pgf/images/interpolate/.cd,.code=\edef\pgf@imageinterpolate{#1},.default=true}
|
||||
\pgfkeys{/pgf/images/mask/.code=%
|
||||
{%
|
||||
\edef\pgf@imagemask{#1}%
|
||||
\ifx\pgf@imagemask\pgfutil@empty%
|
||||
\else%
|
||||
\pgfutil@ifundefined{pgf@mask@#1}%
|
||||
{\PackageError{pgf}{Undefined mask "#1".}{}%
|
||||
\edef\pgf@imagemask{}}%
|
||||
{\edef\pgf@imagemask{\csname pgf@mask@#1\endcsname}%
|
||||
}%
|
||||
\fi%
|
||||
}}
|
||||
|
||||
|
||||
\def\pgf@findfile#1:#2+#3{%
|
||||
\pgfutil@IfFileExists{#3#1}%
|
||||
{\xdef\pgf@filename{#3#1}}%
|
||||
{\def\pgf@mightbeempty{#2}%
|
||||
\ifx\pgf@mightbeempty\pgfutil@empty\else%
|
||||
\pgf@findfile#2+{#3}%
|
||||
\fi}}
|
||||
|
||||
% #1: image name
|
||||
% #2: file name
|
||||
\def\pgf@declaredraftimage#1#2{%
|
||||
\ifx\pgf@imagewidth\pgfutil@empty%
|
||||
\PackageWarning{pgf}{Missing width for image "#1" ("#2") in draft mode.\MessageBreak Using 1cm instead}%
|
||||
\edef\pgf@imagewidth{1cm}%
|
||||
\fi%
|
||||
\ifx\pgf@imageheight\pgfutil@empty%
|
||||
\PackageWarning{pgf}{Missing height for image "#1" ("#2") in draft mode.\MessageBreak Using 1cm instead}%
|
||||
\edef\pgf@imageheight{1cm}%
|
||||
\fi%
|
||||
\ifx\pgf@imagepage\pgfutil@empty\else\edef\pgf@imagepagetext{ page \pgf@imagepage}\fi%
|
||||
\edef\pgf@image{%
|
||||
\hbox to \pgf@imagewidth{%
|
||||
\vrule\kern-0.4pt%
|
||||
\vbox to \pgf@imageheight{%
|
||||
\hrule\vfil%
|
||||
\hbox to \pgf@imagewidth{\hskip-10cm\hfil\noexpand\tiny#2\pgf@imagepage\hfil\hskip-10cm}%
|
||||
\vfil\hrule}%
|
||||
\kern-0.4pt\vrule}%
|
||||
}%
|
||||
}
|
||||
|
||||
|
||||
|
||||
% Declare a soft mask
|
||||
%
|
||||
% #1 = optional argument: matte specification. default matte is
|
||||
% white.
|
||||
% #2 = name of the mask for later use
|
||||
% #3 = filename without extension, automatic extensions are .pdf,
|
||||
% .jpg, and .png for PDF. Postscript is not supported.
|
||||
%
|
||||
% Description:
|
||||
%
|
||||
% This command declares a soft mask for later masking an image. The
|
||||
% declared mask should be used together with an image of exactly the
|
||||
% same height/width if matte is defined. Matte should be the
|
||||
% preblended background color (see pdf spec for details).
|
||||
%
|
||||
% Example:
|
||||
%
|
||||
% \pgfdeclaremask[matte=white]{maskname}{maskfilename}
|
||||
% \pgfdeclareimage[mask=maskname]{image}{imagefilename}
|
||||
|
||||
\def\pgfdeclaremask{\pgfutil@ifnextchar[\pgf@declaremask{\pgf@declaremask[]}}
|
||||
\def\pgf@declaremask[#1]#2#3{%
|
||||
\pgfqkeys{/pgf/images/mask}{matte={1 1 1},#1}% defaults
|
||||
\def\pgf@mask{}%
|
||||
% Try to find the file
|
||||
\gdef\pgf@filename{}%
|
||||
\expandafter\pgf@findfile\pgfsys@imagesuffixlist:+{#3}%
|
||||
\ifx\pgf@filename\pgfutil@empty%
|
||||
\PackageWarning{pgf}%
|
||||
{File "#3" not found when defining mask "#2".\MessageBreak
|
||||
Tried all extensions in "\pgfsys@imagesuffixlist"}%
|
||||
\else%
|
||||
\pgfsys@definemask{#2}%
|
||||
\fi%
|
||||
\expandafter\global\expandafter\let\csname pgf@mask@#2\endcsname=\pgf@mask%
|
||||
}
|
||||
|
||||
\pgfkeys{/pgf/images/mask/matte/.cd,.estore in=\pgf@maskmatte,.value required}
|
||||
|
||||
|
||||
|
||||
% Create an alias name for an image
|
||||
%
|
||||
% #1 = name of the alias
|
||||
% #2 = name of the original
|
||||
%
|
||||
% Example:
|
||||
%
|
||||
% \pgfdeclareimage{image}{1cm}{1cm}{filename
|
||||
% \pgfaliasimage{alias}{image}
|
||||
% \pgfuseimage{alias}
|
||||
|
||||
\def\pgfaliasimage#1#2{%
|
||||
\expandafter\global\expandafter\let\expandafter\pgf@temp\expandafter=\csname pgf@image@#2!\endcsname%
|
||||
\expandafter\global\expandafter\let\csname pgf@image@#1!\endcsname=\pgf@temp%
|
||||
}
|
||||
|
||||
|
||||
% Use an image
|
||||
%
|
||||
% #1 = name of a previously declared image
|
||||
%
|
||||
% Example:
|
||||
%
|
||||
% \pgfputat{\pgforigin}{\pgfbox[left,base]{\pgfuseimage{myimage}}}
|
||||
|
||||
\def\pgfuseimage#1{%
|
||||
\def\pgf@imagename{pgf@image@#1}%
|
||||
\pgf@tryextensions{\pgf@imagename}{\pgfalternateextension}%
|
||||
\expandafter\pgfutil@ifundefined\expandafter{\pgf@imagename}%
|
||||
{\PackageError{pgf}{Undefined image "#1"}{}}%
|
||||
{{\leavevmode\csname\pgf@imagename\endcsname}}}
|
||||
|
||||
\def\pgf@tryextensions#1#2{%
|
||||
\edef\pgf@args{[#2!]}\expandafter\pgf@@tryextensions\pgf@args{#1}}
|
||||
\def\pgf@@tryextensions[#1!#2]#3{%
|
||||
\expandafter\pgfutil@ifundefined\expandafter{#3#1!#2}%
|
||||
{\def\pgf@temp{#2}%
|
||||
\ifx\pgf@temp\pgfutil@empty%
|
||||
\edef#3{#3!}%
|
||||
\else%
|
||||
\pgf@@tryextensions[#2]{#3}%
|
||||
\fi}%
|
||||
{\edef#3{#3#1!#2}}}
|
||||
|
||||
|
||||
% Alternate image
|
||||
%
|
||||
% Description:
|
||||
%
|
||||
% When an image is used, pgf first attempts to use the image with the
|
||||
% alternate extension added. If this fails, the original image is
|
||||
% used. If the alternate extension contains ``!'', then the text up to
|
||||
% the ! is successively removed and the remainder is tried as an
|
||||
% alternate extension.
|
||||
%
|
||||
% Example:
|
||||
%
|
||||
% \def\pgfalternateextension{20!white}
|
||||
|
||||
\def\pgfalternateextension{}
|
||||
|
||||
|
||||
|
||||
% Directly insert an image
|
||||
%
|
||||
% #1 = optional argument: width, height, page specification
|
||||
% #2 = file name
|
||||
%
|
||||
% Description:
|
||||
%
|
||||
% Directly inserts an image without declaration. You can, however,
|
||||
% still access this image using the name pgflastimage. By using
|
||||
% pgfaliasimage, you can also save this image for later.
|
||||
%
|
||||
% Example:
|
||||
%
|
||||
% \pgfimage[height=2cm]{filename}
|
||||
|
||||
\def\pgfimage{\pgfutil@ifnextchar[\pgf@imagecom{\pgf@imagecom[]}}
|
||||
\def\pgf@imagecom[#1]#2{%
|
||||
\pgfdeclareimage[#1]{pgflastimage}{#2}%
|
||||
\pgfuseimage{pgflastimage}}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
% The external read/write mechanism is used as follows:
|
||||
%
|
||||
% In your document, you put a number or all of your pgfpicture (or
|
||||
% tikzpicture) environments inside a pair of \beginpgfexternal and
|
||||
% \endpgfexternal. The \beginpgfexternal gets one parameter called the
|
||||
% graphics name.
|
||||
%
|
||||
% Once this is done, the next step is to declare the names of your
|
||||
% graphics in the document at the beginning using the
|
||||
% \pgfdeclaregraphicname command.
|
||||
%
|
||||
% Now, when you typeset your document, each time a \beginpgfexternal
|
||||
% command is encountered, it will be checked whether the corresponding
|
||||
% graphics file exists. If this is the case, it will be included and
|
||||
% the code between \beginpgfexternal and \endpgfexternal is
|
||||
% ignored. Otherwise, the code is executed normally.
|
||||
%
|
||||
% Things change when you run tex on your file with the \jobname set to
|
||||
% the name of a decalred graphics name. In this case, only your
|
||||
% graphic will be typeset, the rest of the document will be "thrown away".
|
||||
% To be more precise, everything is gobbled up to the beginning
|
||||
% of the first \beginpgfexternal with the given graphics name. Then,
|
||||
% the content of the "environment" is put in a box (this "environment"
|
||||
% need not contain a graphics, it may contain anything that can be put
|
||||
% in a box). Then a single page is output whose size is exactly the
|
||||
% size of the picture.
|
||||
%
|
||||
% So, once you have run tex repeatedly, each time with the jobname set
|
||||
% to each of the graphics, you can then run tex on the whole document
|
||||
% and this will cause all graphics to be included rather than begin
|
||||
% typeset.
|
||||
%
|
||||
% Finally, once all the graphics have been created, you can also say
|
||||
% \input pgfexternal.tex instead of including pgf/TikZ.
|
||||
|
||||
|
||||
\newif\ifpgfexternalreadmainaux
|
||||
\pgfexternalreadmainauxtrue
|
||||
|
||||
% Tells pgf which jobname is the name of the real file
|
||||
%
|
||||
% #1 = name
|
||||
%
|
||||
% Description:
|
||||
%
|
||||
% This command is used to tell pgf that the file named #1 should be
|
||||
% typeset normally. If \jobname is not equal to #1, only
|
||||
% the graphic called \jobname will be typeset.
|
||||
%
|
||||
% Example:
|
||||
%
|
||||
% \pgfrealjobname{survey}
|
||||
%
|
||||
% Note that afterwards, \jobname will be set to the argument. In our
|
||||
% example, \jobname will be 'survey'. This is to accomplish
|
||||
% compatibility with aux-file generation.
|
||||
|
||||
\def\pgfrealjobname#1{%
|
||||
\global\let\pgfactualjobname=\jobname
|
||||
\edef\pgf@tempa{\expandafter\string\csname #1\endcsname}%
|
||||
\edef\pgf@tempb{\expandafter\string\csname\jobname\endcsname}%
|
||||
\ifx\pgf@tempa\pgf@tempb%
|
||||
\else%
|
||||
\pgf@external@grabshipouttrue%
|
||||
\pgfexternal@nofiles
|
||||
\ifpgfexternalreadmainaux
|
||||
% and reset the jobname. This should allow to handle any
|
||||
% \label/\ref constructions which are stored in \jobname.aux (and
|
||||
% which won't be found otherwise)
|
||||
\gdef\jobname{#1}%
|
||||
\fi
|
||||
\ifpgfexternal@allow@aux
|
||||
\csname newwrite\endcsname\w@pgfexternal@auxout
|
||||
\fi
|
||||
\fi%
|
||||
\gdef\pgfrealjobname##1{}% avoid multiple calls.
|
||||
}
|
||||
|
||||
\def\pgfexternal@nofiles{%
|
||||
% replace \relax. The \nofiles macros does
|
||||
% \let\makeglossary=\relax
|
||||
% but the glossary.sty calls \renewcommand\makeglossary (which
|
||||
% will fail if \makeglossary=\relax). Stupid, but it works.
|
||||
\let\pgfexternal@nofiles@=\relax
|
||||
\def\relax{\relax}%
|
||||
%
|
||||
% suppress generation of LaTeX .aux, .toc etc files.
|
||||
% generation of these files is not thread-safe.
|
||||
% the \csname \endcsname yields \relax if \nofiles doesn't exist.
|
||||
\csname nofiles\endcsname
|
||||
%
|
||||
\let\relax=\pgfexternal@nofiles@
|
||||
}%
|
||||
|
||||
\newif\ifpgf@external@grabshipout
|
||||
\newbox\pgfexternal@startupbox
|
||||
|
||||
\AtBeginDocument{%
|
||||
\ifpgf@external@grabshipout%
|
||||
\global\let\pgfexternal@originalshipout=\shipout%
|
||||
\global\def\shipout{\setbox\pgfpic=}%
|
||||
\maxdeadcycles=10000%
|
||||
% Ok, gather everything we have seen up to now in a box. This box
|
||||
% will contain any specials that have been used.
|
||||
{%
|
||||
\output{\global\setbox\pgfexternal@startupbox=\vbox{\csname @begindvi\endcsname\unvbox255}}%
|
||||
\hbox{}\eject%
|
||||
}%
|
||||
\fi%
|
||||
}
|
||||
|
||||
|
||||
% "Environment" for an external graphic.
|
||||
%
|
||||
% #1 = graphic name
|
||||
%
|
||||
% Example:
|
||||
%
|
||||
% \beginpgfgraphicnamed{main-graphic2}
|
||||
% \begin{tikzpicture}
|
||||
% ...
|
||||
% \end{tikzpicture}
|
||||
% \endpgfgraphicnamed
|
||||
|
||||
\def\pgf@externalbegin#1{%
|
||||
% First, check whether we wish to grab this graphic:
|
||||
\let\pgf@next=\pgf@external@normal%
|
||||
\ifpgf@external@grabshipout%
|
||||
\edef\pgf@tempa{\expandafter\string\csname #1\endcsname}%
|
||||
\edef\pgf@tempb{\expandafter\string\csname\pgfactualjobname\endcsname}%
|
||||
\ifx\pgf@tempa\pgf@tempb%
|
||||
\let\pgf@next=\pgf@external@grab%
|
||||
\fi%
|
||||
\fi%
|
||||
\pgf@next{#1}%
|
||||
}
|
||||
|
||||
|
||||
\AtBeginDocument{
|
||||
\let\beginpgfgraphicnamed=\pgf@externalbegin% overwrite definition of pgfexternal.tex if necessary
|
||||
\let\endpgfgraphicnamed=\unskip
|
||||
}
|
||||
|
||||
|
||||
% Normal operation: Include an external graphic instead of the
|
||||
% picture, if such an external picture exists.
|
||||
\def\pgf@external@normal#1{%
|
||||
\let\pgf@filename=\pgfutil@empty%
|
||||
\expandafter\pgf@findfile\pgfsys@imagesuffixlist:+{#1}%
|
||||
\ifx\pgf@filename\pgfutil@empty%
|
||||
% Ok, no such image... Just typeset the picture normally.
|
||||
\let\pgf@next=\relax%
|
||||
\else%
|
||||
\let\pgf@next=\pgf@replacepicturebygraphic%
|
||||
\fi%
|
||||
\pgf@next%
|
||||
}
|
||||
|
||||
\long\def\pgf@replacepicturebygraphic#1\endpgfgraphicnamed{%
|
||||
\expandafter\pgfincludeexternalgraphics\expandafter{\pgf@filename}\unskip
|
||||
}
|
||||
|
||||
% This is almost the same as \includegraphics{#1}, but it checks
|
||||
% whether '#1.dpth' exists. In such case, it restores the boxes depth
|
||||
% stored in #1.dpth.
|
||||
%
|
||||
% Furthermore, the .dpth file may contain .aux related information
|
||||
% collected for the external graphics (references). They start after
|
||||
% the first line (if any).
|
||||
\def\pgfincludeexternalgraphics#1{%
|
||||
\begingroup
|
||||
\setbox1=\hbox{\pgfkeysvalueof{/pgf/images/include external/.@cmd}{#1}\pgfeov}%
|
||||
%
|
||||
\let\pgfincludeexternalgraphics@dp=\pgfutil@empty
|
||||
\endlinechar=-1 % suppress white space at end
|
||||
\catcode`\@=11
|
||||
\openin\r@pgf@reada=#1.dpth
|
||||
\pgfincludeexternalgraphics@read@dpth
|
||||
\ifx\pgfincludeexternalgraphics@dp\pgfutil@empty
|
||||
\box1
|
||||
\else
|
||||
\dimen0=\pgfincludeexternalgraphics@dp\relax
|
||||
\hbox{\lower\dimen0 \box1 }%
|
||||
\fi
|
||||
\endgroup
|
||||
}
|
||||
%
|
||||
% The .dpth consists of 0-N lines, where each is either a single
|
||||
% dimension (the box' depth) or something which belongs to the .aux
|
||||
% file (such lines will always start with a macro).
|
||||
\def\pgfincludeexternalgraphics@read@dpth{%
|
||||
\ifeof\r@pgf@reada
|
||||
\closein\r@pgf@reada
|
||||
\else
|
||||
\read\r@pgf@reada to\pgfincludeexternalgraphics@auxline
|
||||
\ifx\pgfincludeexternalgraphics@auxline\pgfutil@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
|
||||
% Ah -- the first token is a control sequence. It belongs to
|
||||
% the .aux file.
|
||||
%
|
||||
% #1#2\relax% do NOT set the information! many LaTeX commands don't support it (\label for example)
|
||||
\pgfutil@ifundefined{if@filesw}{%
|
||||
% sorry, .aux file support only for latex
|
||||
}{%
|
||||
% append to main .aux file (for forward references)
|
||||
\if@filesw
|
||||
{%
|
||||
\toks0={#1#2}%
|
||||
% believe it or not, but the
|
||||
% \def\dpthimport{...}\dpthimport *makes* a
|
||||
% difference! In ensures any occuring `##' characters
|
||||
% are properly expanded to `#'.
|
||||
\immediate\write\@auxout{\noexpand\def\noexpand\dpthimport{\the\toks0 }\noexpand\dpthimport }%
|
||||
}%
|
||||
\fi
|
||||
}%
|
||||
\else
|
||||
\def\pgfincludeexternalgraphics@dp{#1#2}%
|
||||
\fi
|
||||
}%
|
||||
|
||||
|
||||
|
||||
% Grab operation: If jobname matches the graphic name, typeset this
|
||||
% picture normall.
|
||||
% REMARK:
|
||||
% this method is also invoked from within the tikz external library.
|
||||
\def\pgf@external@grab#1{%
|
||||
\def\pgf@filename{#1}%
|
||||
\ifpgfexternal@allow@aux
|
||||
\begingroup
|
||||
\pgf@external@init@aux@in@dpth
|
||||
\fi
|
||||
\setbox\pgfpic=\hbox\bgroup\bgroup%
|
||||
\let\endpgfgraphicnamed=\pgf@externalend%
|
||||
}
|
||||
|
||||
\let\pgf@external@@protected@write@orig=\protected@write
|
||||
\long\def\pgf@external@@protected@write@immediate#1#2#3{%
|
||||
\begingroup
|
||||
\let\pgf@write@=\write
|
||||
\def\write{\noexpand\immediate\pgf@write@}%
|
||||
\pgf@external@@protected@write@orig{#1}{#2}{#3}%
|
||||
\endgroup
|
||||
}%
|
||||
|
||||
\def\pgf@external@init@aux@in@dpth{%
|
||||
% tell LaTeX to write aux files...
|
||||
\csname @fileswtrue\endcsname
|
||||
% ... but redirect output to the .dpth file!
|
||||
\immediate\openout\w@pgfexternal@auxout=\pgf@filename.dpth
|
||||
\let\@auxout=\w@pgfexternal@auxout
|
||||
% ... and disable the correct page numbers. I can't get that
|
||||
% (because the correct page number is only available in the
|
||||
% shipout routine). Use immediate output:
|
||||
\let\protected@write=\pgf@external@@protected@write@immediate
|
||||
}%
|
||||
|
||||
% REMARK:
|
||||
% this method is also invoked from within the tikz external library.
|
||||
\def\pgf@externalend{%
|
||||
\unskip\egroup\egroup%
|
||||
{%
|
||||
\parindent0pt % leave the space
|
||||
% \leftmargin0pt%
|
||||
% \rightmargin0pt%
|
||||
\dimen0\ht\pgfpic%
|
||||
\advance\dimen0\dp\pgfpic%
|
||||
\ifdim\dp\pgfpic=0pt\relax
|
||||
\else% store the picture's depth. Otherwise, it would be lost.
|
||||
\ifpgfexternal@allow@aux
|
||||
\immediate\write\@auxout{\the\dp\pgfpic}%
|
||||
\immediate\closeout\@auxout
|
||||
\else
|
||||
\immediate\openout\pgf@plotwrite=\pgf@filename.dpth
|
||||
\immediate\write\pgf@plotwrite{\the\dp\pgfpic}%
|
||||
\immediate\closeout\pgf@plotwrite
|
||||
\fi
|
||||
\fi
|
||||
\pgfsys@papersize{\the\wd\pgfpic}{\the\dimen0}%
|
||||
\setbox0=\vbox{%
|
||||
\kern -1truein %
|
||||
\hbox{%
|
||||
\kern -1truein %
|
||||
\hbox to0pt{%
|
||||
\wd\pgfexternal@startupbox=0pt %
|
||||
\ht\pgfexternal@startupbox=0pt %
|
||||
\dp\pgfexternal@startupbox=0pt %
|
||||
\box\pgfexternal@startupbox%
|
||||
\pgfsys@atbegindocument\hss}%
|
||||
\box\pgfpic%
|
||||
\kern 1truein }%
|
||||
\kern1truein }%
|
||||
\pgfexternal@originalshipout\box0 %
|
||||
}%
|
||||
\ifpgfexternal@allow@aux
|
||||
\endgroup
|
||||
\fi
|
||||
}
|
||||
|
||||
|
||||
\endinput
|
||||
|
|
@ -0,0 +1,217 @@
|
|||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%%% This file is a copy of some part of PGF/Tikz.
|
||||
%%% It has been copied here to provide :
|
||||
%%% - compatibility with older PGF versions
|
||||
%%% - availability of PGF contributions by Christian Feuersaenger
|
||||
%%% which are necessary or helpful for pgfplots.
|
||||
%%%
|
||||
%%% For reasons of simplicity, I have copied the whole file, including own contributions AND
|
||||
%%% PGF parts. The copyrights are as they appear in PGF.
|
||||
%%%
|
||||
%%% Note that pgfplots has compatible licenses.
|
||||
%%%
|
||||
%%% This copy has been modified in the following ways:
|
||||
%%% - nested \input commands have been updated
|
||||
%%%
|
||||
%
|
||||
% Support for the contents of this file will NOT be done by the PGF/TikZ team.
|
||||
% Please contact the author and/or maintainer of pgfplots (Christian Feuersaenger) if you need assistance in conjunction
|
||||
% with the deployment of this patch or partial content of PGF. Note that the author and/or maintainer of pgfplots has no obligation to fix anything:
|
||||
% This file comes without any warranty as the rest of pgfplots; there is no obligation for help.
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%%% Date of this copy: Di 25. Dez 18:14:20 CET 2012 %%%
|
||||
|
||||
|
||||
|
||||
% Copyright 2006 by Till Tantau
|
||||
%
|
||||
% 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 $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorelayers.code.tex,v 1.5 2012/11/07 19:23:16 ludewich Exp $
|
||||
|
||||
|
||||
% Creates a new pgf layer
|
||||
%
|
||||
% #1 = layer name
|
||||
%
|
||||
% Declares a new layer for pgf.
|
||||
%
|
||||
% Example:
|
||||
%
|
||||
% \pgfdeclarelayer{background}
|
||||
|
||||
\def\pgfdeclarelayer#1{%
|
||||
\pgfutil@ifundefined{pgf@layerbox@#1}{%
|
||||
\expandafter\expandafter\csname pgf@newbox\endcsname\csname pgf@layerbox@#1\endcsname%
|
||||
\expandafter\expandafter\csname pgf@newbox\endcsname\csname pgf@layerboxsaved@#1\endcsname%
|
||||
}{}%
|
||||
}
|
||||
\let\pgf@newbox=\newbox % avoid plain TeX outer problem
|
||||
|
||||
% Sets the layers that compose the picture
|
||||
%
|
||||
% #1 = List of layers
|
||||
%
|
||||
% Description:
|
||||
%
|
||||
% Sets the list of layers that make up the picture. The layers will be
|
||||
% put on top of each other in the order given.
|
||||
%
|
||||
% This command can also be given inside of a picture in which case it
|
||||
% applies only to that very picture.
|
||||
%
|
||||
% Example:
|
||||
%
|
||||
% \pgfsetlayers{background,main}
|
||||
|
||||
\def\pgfsetlayers#1{\edef\pgf@layerlist{#1}}
|
||||
\pgfsetlayers{main}
|
||||
|
||||
% Adds code to a layer
|
||||
%
|
||||
% #1 = layer name
|
||||
%
|
||||
% Note:
|
||||
%
|
||||
% You cannot add anything to the ``main'' layer using this command.
|
||||
%
|
||||
% Example:
|
||||
%
|
||||
% \begin{pgfonlayer}{background}
|
||||
% \fill[red] (0,0) -- (1,1);
|
||||
% \end{pgfonlayer}
|
||||
|
||||
\def\pgfonlayer@name{main}
|
||||
|
||||
\def\pgfonlayer#1{%
|
||||
\pgfutil@ifundefined{pgf@layerbox@#1}{%
|
||||
\PackageError{pgf}{Sorry, the requested layer '#1' could not be found. Maybe you misspelled it?}{}%
|
||||
\bgroup
|
||||
\begingroup
|
||||
}{%
|
||||
\begingroup
|
||||
\edef\pgf@temp{#1}%
|
||||
\ifx\pgf@temp\pgfonlayer@name
|
||||
% we are already on this layer.
|
||||
\def\pgf@temp{%
|
||||
\bgroup
|
||||
\begingroup
|
||||
}%
|
||||
\else
|
||||
\let\pgfonlayer@name=\pgf@temp
|
||||
\pgfonlayer@assert@is@active
|
||||
\def\pgf@temp{%
|
||||
\expandafter\global\expandafter%
|
||||
\setbox\csname pgf@layerbox@#1\endcsname=\hbox to 0pt%
|
||||
\bgroup%
|
||||
\expandafter\box\csname pgf@layerbox@#1\endcsname%
|
||||
\begingroup%
|
||||
}%
|
||||
\fi
|
||||
\pgf@temp
|
||||
}%
|
||||
}
|
||||
\def\endpgfonlayer{%
|
||||
\endgroup%
|
||||
\hss
|
||||
\egroup%
|
||||
\endgroup
|
||||
}
|
||||
|
||||
\let\startpgfonlayer=\pgfonlayer
|
||||
\let\stoppgfonlayer=\endpgfonlayer
|
||||
|
||||
\def\pgfdiscardlayername{discard}
|
||||
|
||||
\def\pgfonlayer@assert@is@active{%
|
||||
\ifx\pgfonlayer@name\pgfdiscardlayername
|
||||
% this special layer name can be used as /dev/null without
|
||||
% warning.
|
||||
\else
|
||||
\begingroup
|
||||
\def\pgfonlayer@isactive{0}%
|
||||
\expandafter\pgf@assert@layer@is@active@loop\pgf@layerlist,,\relax%
|
||||
\if0\pgfonlayer@isactive
|
||||
\pgfonlayer@assert@fail
|
||||
\fi
|
||||
\endgroup
|
||||
\fi
|
||||
}%
|
||||
\def\pgfonlayer@assert@fail{%
|
||||
\PackageError{pgf}{Sorry, the requested layer '\pgfonlayer@name' is not
|
||||
part of the layer list. Please verify that you provided
|
||||
\string\pgfsetlayers\space and that '\pgfonlayer@name' is part of this list}{}%
|
||||
}%
|
||||
\def\pgf@assert@layer@is@active@loop#1,#2,\relax{%
|
||||
\edef\pgf@test{#1}%
|
||||
\ifx\pgf@test\pgfonlayer@name
|
||||
\def\pgfonlayer@isactive{1}%
|
||||
\else
|
||||
\def\pgf@test{#2}%
|
||||
\ifx\pgf@test\pgfutil@empty%
|
||||
\else%
|
||||
\pgf@assert@layer@is@active@loop#2,\relax%
|
||||
\fi%
|
||||
\fi
|
||||
}
|
||||
|
||||
% Hooks into the scoping:
|
||||
|
||||
\def\pgf@insertlayers{%
|
||||
\expandafter\pgf@dolayer\pgf@layerlist,,\relax%
|
||||
}
|
||||
\def\pgf@maintext{main}%
|
||||
\def\pgf@dolayer#1,#2,\relax{%
|
||||
\def\pgf@test{#1}%
|
||||
\ifx\pgf@test\pgf@maintext%
|
||||
\box\pgf@layerbox@main%
|
||||
\else%
|
||||
\pgfsys@beginscope%
|
||||
\expandafter\box\csname pgf@layerbox@#1\endcsname%
|
||||
\pgfsys@endscope%
|
||||
\fi%
|
||||
\def\pgf@test{#2}%
|
||||
\ifx\pgf@test\pgfutil@empty%
|
||||
\else%
|
||||
\pgf@dolayer#2,\relax%
|
||||
\fi%
|
||||
}
|
||||
|
||||
\def\pgf@savelayers{%
|
||||
\expandafter\pgf@dosavelayer\pgf@layerlist,,\relax%
|
||||
}
|
||||
\def\pgf@dosavelayer#1,#2,\relax{%
|
||||
\def\pgf@test{#1}%
|
||||
\ifx\pgf@test\pgf@maintext%
|
||||
\else%
|
||||
\setbox\csname pgf@layerboxsaved@#1\endcsname=\box\csname pgf@layerbox@#1\endcsname%
|
||||
\fi%
|
||||
\def\pgf@test{#2}%
|
||||
\ifx\pgf@test\pgfutil@empty%
|
||||
\else%
|
||||
\pgf@dosavelayer#2,\relax%
|
||||
\fi%
|
||||
}
|
||||
|
||||
\def\pgf@restorelayers{%
|
||||
\expandafter\pgf@dorestorelayer\pgf@layerlist,,\relax%
|
||||
}
|
||||
\def\pgf@dorestorelayer#1,#2,\relax{%
|
||||
\def\pgf@test{#1}%
|
||||
\ifx\pgf@test\pgf@maintext%
|
||||
\else%
|
||||
\global\setbox\csname pgf@layerbox@#1\endcsname=\box\csname pgf@layerboxsaved@#1\endcsname%
|
||||
\fi%
|
||||
\def\pgf@test{#2}%
|
||||
\ifx\pgf@test\pgfutil@empty%
|
||||
\else%
|
||||
\pgf@dorestorelayer#2,\relax%
|
||||
\fi%
|
||||
}
|
||||
|
||||
\endinput
|
|
@ -0,0 +1,607 @@
|
|||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%%% This file is a copy of some part of PGF/Tikz.
|
||||
%%% It has been copied here to provide :
|
||||
%%% - compatibility with older PGF versions
|
||||
%%% - availability of PGF contributions by Christian Feuersaenger
|
||||
%%% which are necessary or helpful for pgfplots.
|
||||
%%%
|
||||
%%% For reasons of simplicity, I have copied the whole file, including own contributions AND
|
||||
%%% PGF parts. The copyrights are as they appear in PGF.
|
||||
%%%
|
||||
%%% Note that pgfplots has compatible licenses.
|
||||
%%%
|
||||
%%% This copy has been modified in the following ways:
|
||||
%%% - nested \input commands have been updated
|
||||
%%%
|
||||
%
|
||||
% Support for the contents of this file will NOT be done by the PGF/TikZ team.
|
||||
% Please contact the author and/or maintainer of pgfplots (Christian Feuersaenger) if you need assistance in conjunction
|
||||
% with the deployment of this patch or partial content of PGF. Note that the author and/or maintainer of pgfplots has no obligation to fix anything:
|
||||
% This file comes without any warranty as the rest of pgfplots; there is no obligation for help.
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%%% Date of this copy: Di 25. Dez 18:14:20 CET 2012 %%%
|
||||
|
||||
|
||||
|
||||
% Copyright 2006 by Till Tantau
|
||||
%
|
||||
% 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 $Header: /cvsroot/pgf/pgf/generic/pgf/basiclayer/pgfcorescopes.code.tex,v 1.38 2012/11/30 12:00:51 tantau Exp $
|
||||
|
||||
% Globals
|
||||
|
||||
\newbox\pgfpic
|
||||
\newbox\pgf@hbox
|
||||
|
||||
\newbox\pgf@layerbox@main
|
||||
|
||||
\newcount\pgf@picture@serial@count
|
||||
|
||||
|
||||
|
||||
% This if decides whether the position of pictures on the page is
|
||||
% protocolled or not. Normally,
|
||||
% this is switched off as it works only with certain drivers and it
|
||||
% causes external files to be written. When switched on, the position
|
||||
% of pgfpictures are protocolled and can be referenced using
|
||||
% \pgfsys@getposition{XXX} where XXX is the value of \pgfpictureid
|
||||
% inside the picture.
|
||||
\newif\ifpgfrememberpicturepositiononpage
|
||||
|
||||
|
||||
|
||||
|
||||
% Scopes
|
||||
|
||||
|
||||
% Pgf scope environment. All changes of the graphic state are local to
|
||||
% the scope.
|
||||
%
|
||||
% Example:
|
||||
%
|
||||
% \begin{pgfscope}
|
||||
% \pgfsetlinewidth{3pt}
|
||||
% \pgfline{\pgfxy(0,0)}{\pgfxy(3,3)}
|
||||
% \end{pgfscope}
|
||||
|
||||
\def\pgfscope{%
|
||||
\pgfsyssoftpath@setcurrentpath\pgfutil@empty%
|
||||
\pgfsys@beginscope%
|
||||
\pgf@resetpathsizes%
|
||||
\edef\pgfscope@linewidth{\the\pgflinewidth}%
|
||||
\begingroup}
|
||||
\def\endpgfscope{%
|
||||
\endgroup%
|
||||
\global\pgflinewidth=\pgfscope@linewidth%
|
||||
\pgfsys@endscope}
|
||||
|
||||
|
||||
|
||||
|
||||
% Quickly insert a box can contain normal TeX text at the origin.
|
||||
%
|
||||
% #1 = box of width/height and depth 0pt
|
||||
%
|
||||
% Example:
|
||||
%
|
||||
% \pgfqbox{\mybox}
|
||||
|
||||
\def\pgfqbox#1{%
|
||||
\pgfsys@hbox#1%
|
||||
}
|
||||
|
||||
|
||||
% Insert a box that can contain normal TeX text at the origin, but
|
||||
% with the current coordinate transformation matrix synced with the
|
||||
% low-level transformation matrix.
|
||||
%
|
||||
% #1 = box of width/height and depth 0pt
|
||||
%
|
||||
% In essence, this command does the same as if you first said
|
||||
% \pgflowlevelsynccm and then \pgfqbox. However, pgf will use a
|
||||
% ``TeX-translation'' for the translation part of the transformation
|
||||
% cm. This will ensure that hyperlinks ``survive'' at least
|
||||
% translations.
|
||||
%
|
||||
% Example:
|
||||
%
|
||||
% \pgfqboxsynced{\mybox}
|
||||
|
||||
\def\pgfqboxsynced#1{%
|
||||
\pgfsys@hboxsynced#1%
|
||||
}
|
||||
|
||||
|
||||
% Puts some text in a box and inserts it with the current
|
||||
% transformations applied.
|
||||
%
|
||||
% #1 = List of optional positioning. Possible values are ``left'', ``right'',
|
||||
% ``top'', ``bottom'' and ``base''.
|
||||
% #2 = TeX text. May contain verbatims.
|
||||
%
|
||||
% Example:
|
||||
%
|
||||
% \pgftransformshift{\pgfpoint{1cm}{0cm}}
|
||||
% \pgftext{Hello World!}
|
||||
|
||||
\def\pgftext{\pgfutil@ifnextchar[\pgf@text{\pgf@text[]}}%
|
||||
\def\pgf@text[#1]{%
|
||||
\def\pgf@text@options{#1}%
|
||||
\pgf@maketext\pgf@after@text}
|
||||
\def\pgf@after@text{%
|
||||
{%
|
||||
\def\pgf@text@hshift{center}%
|
||||
\def\pgf@text@vshift{center}%
|
||||
\expandafter\pgf@text@setkeys\expandafter{\pgf@text@options}%
|
||||
\csname pgf@halign\pgf@text@hshift\endcsname%
|
||||
\csname pgf@valign\pgf@text@vshift\endcsname%
|
||||
% Protocol sizes:
|
||||
\pgf@process{\pgfpointtransformed{\pgfqpoint{0pt}{\dp\pgf@hbox}}}%
|
||||
\pgf@protocolsizes{\pgf@x}{\pgf@y}%
|
||||
\pgf@process{\pgfpointtransformed{\pgfqpoint{\wd\pgf@hbox}{\dp\pgf@hbox}}}%
|
||||
\pgf@protocolsizes{\pgf@x}{\pgf@y}%
|
||||
\pgf@process{\pgfpointtransformed{\pgfqpoint{0pt}{\ht\pgf@hbox}}}%
|
||||
\pgf@protocolsizes{\pgf@x}{\pgf@y}%
|
||||
\pgf@process{\pgfpointtransformed{\pgfqpoint{\wd\pgf@hbox}{\ht\pgf@hbox}}}%
|
||||
\pgf@protocolsizes{\pgf@x}{\pgf@y}%
|
||||
\pgfqboxsynced{\pgf@hbox}%
|
||||
}%
|
||||
}
|
||||
\def\pgf@text@setkeys{\pgfqkeys{/pgf/text}}%
|
||||
|
||||
\pgfkeys{/pgf/text/left/.code=\def\pgf@text@hshift{left}}
|
||||
\pgfkeys{/pgf/text/center/.code=}
|
||||
\pgfkeys{/pgf/text/right/.code=\def\pgf@text@hshift{right}}
|
||||
\pgfkeys{/pgf/text/top/.code=\def\pgf@text@vshift{top}}
|
||||
\pgfkeys{/pgf/text/bottom/.code=\def\pgf@text@vshift{bottom}}
|
||||
\pgfkeys{/pgf/text/base/.code=\def\pgf@text@vshift{base}}
|
||||
\pgfkeys{/pgf/text/at/.cd,.code=\pgftransformshift{#1},.value required}
|
||||
\pgfkeys{/pgf/text/x/.cd,.code=\pgftransformxshift{#1},.value required}
|
||||
\pgfkeys{/pgf/text/y/.cd,.code=\pgftransformyshift{#1},.value required}
|
||||
\pgfkeys{/pgf/text/rotate/.cd,.code=\pgftransformrotate{#1},.value required}
|
||||
|
||||
\def\pgf@halignleft{}% do nothing
|
||||
\def\pgf@haligncenter{\pgftransformxshift{+-.5\wd\pgf@hbox}}
|
||||
\def\pgf@halignright{\pgftransformxshift{+-\wd\pgf@hbox}}%
|
||||
\def\pgf@valignbase{}% do nothing
|
||||
\def\pgf@valignbottom{\pgftransformyshift{+\dp\pgf@hbox}}%
|
||||
\def\pgf@valigncenter{\pgftransformyshift{+.5\dp\pgf@hbox}\pgftransformyshift{+-.5\ht\pgf@hbox}}%
|
||||
\def\pgf@valigntop{\pgftransformyshift{+-\ht\pgf@hbox}}%
|
||||
|
||||
|
||||
% Internal function for creating a hbox.
|
||||
\def\pgf@maketext#1{%
|
||||
\def\pgf@@maketextafter{#1}%
|
||||
\setbox\pgf@hbox=\hbox\bgroup%
|
||||
\pgfinterruptpicture%
|
||||
\bgroup%
|
||||
\aftergroup\pgf@collectresetcolor%
|
||||
\let\next=%
|
||||
}
|
||||
\def\pgf@collectresetcolor{%
|
||||
\pgfutil@ifnextchar\reset@color%
|
||||
{\reset@color\afterassignment\pgf@collectresetcolor\let\pgf@temp=}%
|
||||
{\pgf@textdone}%
|
||||
}
|
||||
\def\pgf@textdone{%
|
||||
\endpgfinterruptpicture%
|
||||
\egroup%
|
||||
\pgf@@maketextafter%
|
||||
}
|
||||
|
||||
\long\def\pgf@makehbox#1{%
|
||||
\setbox\pgf@hbox=\hbox{{%
|
||||
\pgfinterruptpicture%
|
||||
#1%
|
||||
\endpgfinterruptpicture%
|
||||
}}}
|
||||
|
||||
|
||||
|
||||
% Picture environment
|
||||
%
|
||||
% Example:
|
||||
%
|
||||
% \begin{pgfpicture}
|
||||
% \pgfsetendarrow{\pgfarrowto}
|
||||
% \pgfpathmoveto{\pgfpointxy{-0.9}{0.2}}
|
||||
% \pgfpathlineto{\pgfpointxy{0.9}{0.4}}
|
||||
% \pgfusepath{stroke}
|
||||
% \end{pgfpicture}
|
||||
|
||||
\newif\ifpgfpicture
|
||||
|
||||
\def\pgfresetboundingbox{%
|
||||
\global\pgf@picmaxx=-16000pt\relax%
|
||||
\global\pgf@picminx=16000pt\relax%
|
||||
\global\pgf@picmaxy=-16000pt\relax%
|
||||
\global\pgf@picminy=16000pt\relax%
|
||||
}%
|
||||
|
||||
\def\pgfpicture{%
|
||||
\begingroup%
|
||||
\pgfpicturetrue%
|
||||
\global\advance\pgf@picture@serial@count by1\relax%
|
||||
\edef\pgfpictureid{pgfid\the\pgf@picture@serial@count}%
|
||||
\let\pgf@nodecallback=\pgfutil@gobble%
|
||||
\pgf@picmaxx=-16000pt\relax%
|
||||
\pgf@picminx=16000pt\relax%
|
||||
\pgf@picmaxy=-16000pt\relax%
|
||||
\pgf@picminy=16000pt\relax%
|
||||
\pgf@relevantforpicturesizetrue%
|
||||
\pgf@resetpathsizes%
|
||||
\pgfutil@ifnextchar\bgroup\pgf@oldpicture\pgf@picture}
|
||||
\def\pgf@oldpicture#1#2#3#4{%
|
||||
\pgfmathsetlength\pgf@picminx{#1}%
|
||||
\pgfmathsetlength\pgf@picminy{#2}%
|
||||
\pgfmathsetlength\pgf@picmaxx{#3}%
|
||||
\pgfmathsetlength\pgf@picmaxy{#4}%
|
||||
\pgf@relevantforpicturesizefalse%
|
||||
\pgf@picture}
|
||||
|
||||
\def\pgf@picture{%
|
||||
\setbox\pgfpic\hbox to0pt\bgroup%
|
||||
\begingroup%
|
||||
\pgfsys@beginpicture%
|
||||
\pgfsys@beginscope%
|
||||
\begingroup%
|
||||
\pgfsetcolor{.}%
|
||||
\pgfsetlinewidth{0.4pt}%
|
||||
\pgftransformreset%
|
||||
\pgfsyssoftpath@setcurrentpath\pgfutil@empty%
|
||||
\begingroup%
|
||||
\let\pgf@setlengthorig=\setlength%
|
||||
\let\pgf@addtolengthorig=\addtolength%
|
||||
\let\pgf@selectfontorig=\selectfont%
|
||||
\let\setlength=\pgf@setlength%
|
||||
\let\addtolength=\pgf@addtolength%
|
||||
\let\selectfont=\pgf@selectfont%
|
||||
\nullfont\spaceskip0pt\xspaceskip0pt%
|
||||
\setbox\pgf@layerbox@main\hbox to0pt\bgroup%
|
||||
\begingroup%
|
||||
}
|
||||
\def\endpgfpicture{%
|
||||
\ifpgfrememberpicturepositiononpage%
|
||||
\hbox to0pt{\pgfsys@markposition{\pgfpictureid}}%
|
||||
\fi%
|
||||
% ok, now let's position the box
|
||||
\ifdim\pgf@picmaxx=-16000pt\relax%
|
||||
% empty picture. make size 0.
|
||||
\global\pgf@picmaxx=0pt\relax%
|
||||
\global\pgf@picminx=0pt\relax%
|
||||
\global\pgf@picmaxy=0pt\relax%
|
||||
\global\pgf@picminy=0pt\relax%
|
||||
\fi%
|
||||
% Shift baseline outside:
|
||||
\pgf@relevantforpicturesizefalse%
|
||||
\pgf@process{\pgf@baseline}%
|
||||
\xdef\pgf@shift@baseline{\the\pgf@y}%
|
||||
%
|
||||
\pgf@process{\pgf@trimleft}%
|
||||
\global\advance\pgf@x by-\pgf@picminx
|
||||
% prepare \hskip\pgf@trimleft@final.
|
||||
% note that \pgf@trimleft@final is also queried
|
||||
% by the pgf image externalization.
|
||||
\xdef\pgf@trimleft@final{-\the\pgf@x}%
|
||||
%
|
||||
\pgf@process{\pgf@trimright}%
|
||||
\global\advance\pgf@x by-\pgf@picmaxx
|
||||
% prepare \hskip\pgf@trimright@final.
|
||||
% note that \pgf@trimright@final is also queried
|
||||
% by the pgf image externalization.
|
||||
\xdef\pgf@trimright@final{\the\pgf@x}%
|
||||
%
|
||||
\pgf@remember@layerlist@globally
|
||||
\endgroup%
|
||||
\hss%
|
||||
\egroup%
|
||||
\pgf@restore@layerlist@from@global
|
||||
\pgf@insertlayers%
|
||||
\endgroup%
|
||||
\pgfsys@discardpath%
|
||||
\endgroup%
|
||||
\pgfsys@endscope%
|
||||
\pgfsys@endpicture%
|
||||
\endgroup%
|
||||
\hss
|
||||
\egroup%
|
||||
\pgfsys@typesetpicturebox\pgfpic%
|
||||
\endgroup%
|
||||
}
|
||||
|
||||
\def\pgf@remember@layerlist@globally{%
|
||||
\global\let\pgf@layerlist@=\pgf@layerlist
|
||||
}%
|
||||
\def\pgf@restore@layerlist@from@global{%
|
||||
\let\pgf@layerlist=\pgf@layerlist@
|
||||
}%
|
||||
\def\pgf@insertlayers{%
|
||||
\box\pgf@layerbox@main%
|
||||
}
|
||||
|
||||
\def\pgf@selectfont{\pgf@selectfontorig\nullfont}
|
||||
|
||||
\def\pgf@setlength#1#2{% these will be used only when \nullfont is active
|
||||
\begingroup% keep font setting local
|
||||
\pgfutil@selectfont% restore font
|
||||
\pgf@setlengthorig#1{#2}% calculate dimension (possibly using calc)
|
||||
\expandafter%
|
||||
\endgroup%
|
||||
\expandafter#1\expandafter=\the#1\relax}
|
||||
\def\pgf@addtolength#1#2{%
|
||||
\begingroup% keep font setting local
|
||||
\pgfutil@selectfont% restore font
|
||||
\pgf@addtolengthorig#1{#2}% calculate dimension (possibly using calc)
|
||||
\expandafter%
|
||||
\endgroup%
|
||||
\expandafter#1\expandafter=\the#1\relax}
|
||||
|
||||
|
||||
% Sets the baseline at the y-coordinate of a given point
|
||||
%
|
||||
% #1 = point
|
||||
%
|
||||
% Sets the baseline of the picture to the y-coordinate of a given
|
||||
% point. However, the point will be evaluated *at the end of the
|
||||
% picture*.
|
||||
%
|
||||
% Example:
|
||||
%
|
||||
% \pgfsetbaselinepointlater{\pgfpointanchor{mynode}{base}}
|
||||
|
||||
\def\pgfsetbaselinepointlater#1{\def\pgf@baseline{#1}}
|
||||
|
||||
|
||||
% Sets the baseline at the y-coordinate of a given point, now
|
||||
%
|
||||
% #1 = point
|
||||
%
|
||||
% Sets the baseline of the picture to the y-coordinate of a given
|
||||
% point.
|
||||
%
|
||||
% Example:
|
||||
%
|
||||
% \pgfsetbaselinepointnow{\pgfpoint{1cm}{2pt}}
|
||||
|
||||
\def\pgfsetbaselinepointnow#1{%
|
||||
\pgf@process{#1}%
|
||||
\edef\pgf@setter@baseline{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}%
|
||||
\pgfsetbaselinepointlater{\pgf@setter@baseline}%
|
||||
}
|
||||
|
||||
\def\pgf@default@text{default}%
|
||||
|
||||
% Sets the baseline
|
||||
%
|
||||
% #1 = baseline
|
||||
%
|
||||
% Sets the baseline of the picture. Default is the lower border, which
|
||||
% is the same as \pgf@picminy
|
||||
%
|
||||
% Example:
|
||||
%
|
||||
% \pgfsetbaseline{1cm+2pt}
|
||||
% \pgfsetbaseline{default}% resets to default value
|
||||
|
||||
\def\pgfsetbaseline#1{%
|
||||
\def\pgf@temp{#1}%
|
||||
\ifx\pgf@temp\pgf@default@text
|
||||
\pgfsetbaseline{\pgf@picminy}%
|
||||
\else
|
||||
\pgfsetbaselinepointlater{\pgfpoint{0pt}{#1}}%
|
||||
\fi
|
||||
}
|
||||
\pgfsetbaseline{\pgf@picminy}
|
||||
|
||||
% controls how the image externalization implements trim:
|
||||
\newif\ifpgf@trim@lowlevel
|
||||
\pgfkeys{
|
||||
/pgf/trim lowlevel/.is if=pgf@trim@lowlevel,
|
||||
/pgf/trim lowlevel/.default=true,
|
||||
}
|
||||
|
||||
% Same as the y-baseline for horizontal alignment.
|
||||
% The effect is different, though: it is some kind of trimming which
|
||||
% leaves the bounding box intact.
|
||||
\def\pgfsettrimleftpointlater#1{\def\pgf@trimleft{#1}}
|
||||
\def\pgfsettrimleftpointnow#1{%
|
||||
\pgf@process{#1}%
|
||||
\edef\pgf@setter@baseline{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}%
|
||||
\pgfsettrimleftpointlater{\pgf@setter@baseline}%
|
||||
}
|
||||
% \pgfsettrimleft{<x coord>}
|
||||
% or
|
||||
% \pgfsettrimleft{default}
|
||||
\def\pgfsettrimleft#1{%
|
||||
\def\pgf@temp{#1}%
|
||||
\ifx\pgf@temp\pgf@default@text
|
||||
\pgfsettrimleft{\pgf@picminx}
|
||||
\else
|
||||
\pgfsettrimleftpointlater{\pgfpoint{#1}{0pt}}%
|
||||
\fi
|
||||
}
|
||||
\pgfsettrimleft{\pgf@picminx}
|
||||
|
||||
\def\pgfsettrimrightpointlater#1{\def\pgf@trimright{#1}}
|
||||
\def\pgfsettrimrightpointnow#1{%
|
||||
\pgf@process{#1}%
|
||||
\edef\pgf@setter@baseline{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}%
|
||||
\pgfsettrimrightpointlater{\pgf@setter@baseline}%
|
||||
}
|
||||
% \pgfsettrimright{<x coord>}
|
||||
% or
|
||||
% \pgfsettrimright{default}
|
||||
\def\pgfsettrimright#1{%
|
||||
\def\pgf@temp{#1}%
|
||||
\ifx\pgf@temp\pgf@default@text
|
||||
\pgfsettrimright{\pgf@picmaxx}%
|
||||
\else
|
||||
\pgfsettrimrightpointlater{\pgfpoint{#1}{0pt}}%
|
||||
\fi
|
||||
}
|
||||
\pgfsettrimright{\pgf@picmaxx}
|
||||
|
||||
|
||||
% Interrupt path
|
||||
%
|
||||
% Description:
|
||||
%
|
||||
% The environment can be used to insert some drawing commands while
|
||||
% constructing a path. The drawing commands inside the environment
|
||||
% will not interfere with the path being constructed ``outside.''
|
||||
% However, you must ward against graphic state changes using a scope.
|
||||
%
|
||||
% Example: Draw two parallel lines
|
||||
%
|
||||
% \pgfmoveto{\pgfpoint{0cm}{0cm}}
|
||||
% \begin{pgfinterruptpath}
|
||||
% \pgfmoveto{\pgfpoint{1cm}{0cm}}
|
||||
% \pgfmoveto{\pgfpoint{1cm}{1cm}}
|
||||
% \pgfusepath{stroke}
|
||||
% \end{pgfinterruptpath}
|
||||
% \pgflineto{\pgfpoint{0cm}{1cm}}
|
||||
% \pgfusepath{stroke}
|
||||
|
||||
\def\pgfinterruptpath
|
||||
{%
|
||||
\begingroup%
|
||||
% save all sorts of things...
|
||||
\edef\pgf@interrupt@savex{\the\pgf@path@lastx}%
|
||||
\edef\pgf@interrupt@savey{\the\pgf@path@lasty}%
|
||||
\pgf@getpathsizes\pgf@interrupt@pathsizes%
|
||||
\pgfsyssoftpath@getcurrentpath\pgf@interrupt@path%
|
||||
\pgfsyssoftpath@setcurrentpath\pgfutil@empty%
|
||||
\edef\pgfscope@linewidth{\the\pgflinewidth}%
|
||||
\let\pgf@interrupt@lastmoveto=\pgfsyssoftpath@lastmoveto%
|
||||
\begingroup%
|
||||
}
|
||||
\def\endpgfinterruptpath
|
||||
{%
|
||||
\endgroup%
|
||||
\global\pgflinewidth=\pgfscope@linewidth%
|
||||
\pgfsyssoftpath@setcurrentpath\pgf@interrupt@path%
|
||||
\pgf@setpathsizes\pgf@interrupt@pathsizes%
|
||||
\global\pgf@path@lastx=\pgf@interrupt@savex%
|
||||
\global\pgf@path@lasty=\pgf@interrupt@savey%
|
||||
\global\let\pgfsyssoftpath@lastmoveto=\pgf@interrupt@lastmoveto%
|
||||
\endgroup%
|
||||
}
|
||||
|
||||
|
||||
|
||||
% Interrupt bounding box
|
||||
%
|
||||
% Description:
|
||||
%
|
||||
% The environment can be used to temporarily setup a new bounding box
|
||||
% computation. The bounding box will be made empty at the beginning of
|
||||
% the environment and will be reset to its old value after the
|
||||
% environment.
|
||||
%
|
||||
% Example:
|
||||
%
|
||||
% \begin{pgfinterruptboundinbox}
|
||||
% \pgfmoveto{\pgfpoint{1cm}{0cm}}
|
||||
% \pgfmoveto{\pgfpoint{1cm}{1cm}}
|
||||
% \pgfusepath{stroke}
|
||||
% \end{pgfinterruptboundinbox}
|
||||
|
||||
\def\pgfinterruptboundingbox
|
||||
{%
|
||||
\begingroup%
|
||||
\edef\pgf@interrupt@savemaxx{\the\pgf@picmaxx}%
|
||||
\edef\pgf@interrupt@saveminx{\the\pgf@picminx}%
|
||||
\edef\pgf@interrupt@savemaxy{\the\pgf@picmaxy}%
|
||||
\edef\pgf@interrupt@saveminy{\the\pgf@picminy}%
|
||||
\pgf@picmaxx=-16000pt\relax%
|
||||
\pgf@picminx=16000pt\relax%
|
||||
\pgf@picmaxy=-16000pt\relax%
|
||||
\pgf@picminy=16000pt\relax%
|
||||
\pgf@size@hookedfalse%
|
||||
\let\pgf@path@size@hook=\pgfutil@empty%
|
||||
}
|
||||
\def\endpgfinterruptboundingbox
|
||||
{%
|
||||
\global\pgf@picmaxx=\pgf@interrupt@savemaxx%
|
||||
\global\pgf@picmaxy=\pgf@interrupt@savemaxy%
|
||||
\global\pgf@picminx=\pgf@interrupt@saveminx%
|
||||
\global\pgf@picminy=\pgf@interrupt@saveminy%
|
||||
\endgroup%
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
% Interrupts a picture
|
||||
%
|
||||
% Description:
|
||||
%
|
||||
% This environment interrupts a picture and temporarily returns to
|
||||
% normal TeX mode. All sorts of things are saved and restored by this
|
||||
% environment.
|
||||
%
|
||||
% WARNING: Using this environment in conjuction with low level
|
||||
% transformations can *strongly* upset the typesetting. Typically, the
|
||||
% contents of this environment should have size/height/depth 0pt in
|
||||
% the end.
|
||||
%
|
||||
% WARNING: This environment should only be used inside typesetting a
|
||||
% box and this box must in turn be inserted using \pgfqbox.
|
||||
%
|
||||
% Example: Draw two parallel lines
|
||||
%
|
||||
% \pgfmoveto{\pgfpoint{0cm}{0cm}}
|
||||
% \setbox\mybox=\hbox{
|
||||
% \begin{pgfinterruptpicture}
|
||||
% This is normal text.
|
||||
% \begin{pgfpicture} % a subpicture
|
||||
% \pgfmoveto{\pgfpoint{1cm}{0cm}}
|
||||
% \pgfmoveto{\pgfpoint{1cm}{1cm}}
|
||||
% \pgfusepath{stroke}
|
||||
% \end{pgfpicture}
|
||||
% More text.
|
||||
% \end{pgfinterruptpicture}
|
||||
% }
|
||||
% \ht\mybox=0pt
|
||||
% \wd\mybox=0pt
|
||||
% \dp\mybox=0pt
|
||||
% \pgfqbox{\mybox}%
|
||||
% \pgfpathlineto{\pgfpoint{0cm}{1cm}}
|
||||
% \pgfusepath{stroke}
|
||||
|
||||
\def\pgfinterruptpicture
|
||||
{%
|
||||
\begingroup%
|
||||
\pgfinterruptboundingbox%
|
||||
\pgftransformreset%
|
||||
\pgfinterruptpath%
|
||||
\ifx\pgf@selectfontorig\@undefined%
|
||||
\else%
|
||||
\let\setlength\pgf@setlengthorig%
|
||||
\let\addtolength\pgf@addtolengthorig%
|
||||
\let\selectfont\pgf@selectfontorig%
|
||||
\fi%
|
||||
\pgfutil@selectfont%
|
||||
\pgfpicturefalse%
|
||||
\let\pgf@positionnodelater@macro\relax%
|
||||
\pgf@savelayers%
|
||||
}
|
||||
\def\endpgfinterruptpicture
|
||||
{%
|
||||
\pgf@restorelayers%
|
||||
\endpgfinterruptpath%
|
||||
\endpgfinterruptboundingbox%
|
||||
\endgroup%
|
||||
}
|
||||
|
||||
\let\pgf@savelayers=\relax
|
||||
\let\pgf@restorelayers=\relax
|
||||
|
||||
\endinput
|
1067
texmf/tex/latex/pgfplots/tex/pgfplotsoldpgfsupp_pgfkeys.code.tex
Normal file
1067
texmf/tex/latex/pgfplots/tex/pgfplotsoldpgfsupp_pgfkeys.code.tex
Normal file
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,90 @@
|
|||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%%% This file is a copy of some part of PGF/Tikz.
|
||||
%%% It has been copied here to provide :
|
||||
%%% - compatibility with older PGF versions
|
||||
%%% - availability of PGF contributions by Christian Feuersaenger
|
||||
%%% which are necessary or helpful for pgfplots.
|
||||
%%%
|
||||
%%% For reasons of simplicity, I have copied the whole file, including own contributions AND
|
||||
%%% PGF parts. The copyrights are as they appear in PGF.
|
||||
%%%
|
||||
%%% Note that pgfplots has compatible licenses.
|
||||
%%%
|
||||
%%% This copy has been modified in the following ways:
|
||||
%%% - nested \input commands have been updated
|
||||
%%%
|
||||
%
|
||||
% Support for the contents of this file will NOT be done by the PGF/TikZ team.
|
||||
% Please contact the author and/or maintainer of pgfplots (Christian Feuersaenger) if you need assistance in conjunction
|
||||
% with the deployment of this patch or partial content of PGF. Note that the author and/or maintainer of pgfplots has no obligation to fix anything:
|
||||
% This file comes without any warranty as the rest of pgfplots; there is no obligation for help.
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%%% Date of this copy: Sa 7. Dez 20:58:23 CET 2013 %%%
|
||||
|
||||
|
||||
|
||||
% Copyright 2009 by Till Tantau and Christian Feuersänger
|
||||
%
|
||||
% 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.
|
||||
|
||||
\input pgfplotsoldpgfsupp_pgfmanual.prettyprinter.code.tex
|
||||
\input pgfplotsoldpgfsupp_pgfmanual.pdflinks.code.tex
|
||||
|
||||
% TODO for auto xrefs:
|
||||
% 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)
|
||||
%
|
||||
% 2. Insert '\declareandlabel' in the document whenever something has been
|
||||
% defined in the text, so it should get a pdf anchor (see
|
||||
% pgfmanual.pdflinks.code.tex )
|
||||
%
|
||||
% 2.1 perhaps insert \pgfmanualpdflabel{<label>}{} where needed.
|
||||
%
|
||||
% 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
|
||||
% have arguments which are options (see below for the predefined list).
|
||||
% This may apply to \pgfpageslogicalpageoptions or so.
|
||||
%
|
||||
% 5. @Christian: consider extensions of the parser such that it identifies path commands (at least partially)
|
||||
%
|
||||
%
|
||||
|
||||
\def\pgfmanual@warning#1{\immediate\write16{! Package pgfmanual Warning: #1}}%
|
||||
|
||||
|
||||
\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,
|
||||
}%
|
||||
|
|
@ -0,0 +1,450 @@
|
|||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%%% This file is a copy of some part of PGF/Tikz.
|
||||
%%% It has been copied here to provide :
|
||||
%%% - compatibility with older PGF versions
|
||||
%%% - availability of PGF contributions by Christian Feuersaenger
|
||||
%%% which are necessary or helpful for pgfplots.
|
||||
%%%
|
||||
%%% For reasons of simplicity, I have copied the whole file, including own contributions AND
|
||||
%%% PGF parts. The copyrights are as they appear in PGF.
|
||||
%%%
|
||||
%%% Note that pgfplots has compatible licenses.
|
||||
%%%
|
||||
%%% This copy has been modified in the following ways:
|
||||
%%% - nested \input commands have been updated
|
||||
%%%
|
||||
%
|
||||
% Support for the contents of this file will NOT be done by the PGF/TikZ team.
|
||||
% Please contact the author and/or maintainer of pgfplots (Christian Feuersaenger) if you need assistance in conjunction
|
||||
% with the deployment of this patch or partial content of PGF. Note that the author and/or maintainer of pgfplots has no obligation to fix anything:
|
||||
% This file comes without any warranty as the rest of pgfplots; there is no obligation for help.
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%%% Date of this copy: Sa 7. Dez 20:58:23 CET 2013 %%%
|
||||
|
||||
|
||||
|
||||
%--------------------------------------------
|
||||
%
|
||||
% Package pgfplots
|
||||
%
|
||||
% 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.
|
||||
%
|
||||
% This program is free software: you can redistribute it and/or modify
|
||||
% 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
|
||||
% *generate pdf crossrefs inside of codeexamples automatically*
|
||||
% without any user input.
|
||||
%
|
||||
% Thus, you write
|
||||
% \begin{codeexample}[]
|
||||
% \begin{tikzpicture}[options]
|
||||
% \end{tikzpicture}
|
||||
% \end{codeexample}
|
||||
% and pdf cross references to the definitions of 'tikzpicture'
|
||||
% and any options will be generated automatically.
|
||||
%
|
||||
% Furthermore, pdf cross references will be generated for everything
|
||||
% within vertical bars, |....|.
|
||||
%
|
||||
%
|
||||
%
|
||||
%
|
||||
%
|
||||
% The only necessary thing is that \pgfmanualpdflabel has been called
|
||||
% for every (fully qualified) key, control sequence, environment or
|
||||
% whatever.
|
||||
|
||||
\newif\ifpgfmanualpdfwarnings
|
||||
\pgfmanualpdfwarningstrue
|
||||
|
||||
\newif\ifpgfmanualshowlabels
|
||||
|
||||
\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,
|
||||
}%
|
||||
|
||||
\pgfkeys{
|
||||
%
|
||||
% Enables or disables the parsing of codeexamples.
|
||||
/pdflinks/codeexample links/.is if=pgfmanualprettyenabled,
|
||||
/pdflinks/codeexample links/.default=true,
|
||||
%
|
||||
% 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}}%
|
||||
\endgroup
|
||||
|
||||
\gdef\pgfmanualpdf@installreplacements{%
|
||||
\def\marg##1{{##1}}%
|
||||
\def\oarg##1{[##1]}%
|
||||
\def\meta##1{<##1>}%
|
||||
\def\x{x}%
|
||||
\def\textbackslash{<CS>}%
|
||||
\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}%
|
||||
}%
|
||||
|
||||
% Defines a new pdf cross ref label for use with \pgfmanualpdfref.
|
||||
%
|
||||
% Usage:
|
||||
% \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 ]{|-}{}
|
||||
% -> this will write
|
||||
% \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
|
||||
}%
|
||||
\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@@}%
|
||||
\expandafter\hypertarget\expandafter{\pgfmanualpdflabel@@}{#2}%
|
||||
\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
|
||||
}%
|
||||
\def\pgfmanualpdfref@#1#2{%
|
||||
\pgfkeysgetvalue{/pdflinks/internal link prefix}\pgfmanual@temp
|
||||
\expandafter\hyperlink\expandafter{\pgfmanual@temp.#1}{#2}%
|
||||
\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.
|
||||
% Check for them!
|
||||
%
|
||||
% #1: a token list which shall be used either as cross ref or as
|
||||
% label.
|
||||
%
|
||||
% 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
|
||||
}%
|
||||
|
||||
\expandafter\def\expandafter\pgfmanualpdfref@substitute@backslash\expandafter#\expandafter1\pgfmanual@pretty@backslash#2\relax{%
|
||||
\edef\pgfmanualpdflabel@@{#1\textbackslash #2}%
|
||||
}%
|
||||
|
||||
% Typesets '#1' in red,\texttt like every declaration. It will also
|
||||
% generate a pdf cross ref anchor for #1.
|
||||
%
|
||||
% WARNING: this changes catcodes! In case this is not acceptable in
|
||||
% your context, you will need to generate a \pgfmanualpdflabel
|
||||
% manually.
|
||||
%
|
||||
% \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}%
|
||||
}
|
||||
|
||||
%
|
||||
% \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}%
|
||||
}
|
||||
|
||||
% Prepare active vertical bars, |....| for auto-pretty cross
|
||||
% referencing.
|
||||
%
|
||||
% 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{|}%
|
||||
}
|
||||
\def\pgfmanual@verb{%
|
||||
\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 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
|
||||
}%
|
||||
|
||||
\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}%
|
||||
}%
|
||||
\endinput
|
||||
% vi: ts=4 sw=4
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,184 @@
|
|||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%%% This file is a copy of some part of PGF/Tikz.
|
||||
%%% It has been copied here to provide :
|
||||
%%% - compatibility with older PGF versions
|
||||
%%% - availability of PGF contributions by Christian Feuersaenger
|
||||
%%% which are necessary or helpful for pgfplots.
|
||||
%%%
|
||||
%%% For reasons of simplicity, I have copied the whole file, including own contributions AND
|
||||
%%% PGF parts. The copyrights are as they appear in PGF.
|
||||
%%%
|
||||
%%% Note that pgfplots has compatible licenses.
|
||||
%%%
|
||||
%%% This copy has been modified in the following ways:
|
||||
%%% - nested \input commands have been updated
|
||||
%%%
|
||||
%
|
||||
% Support for the contents of this file will NOT be done by the PGF/TikZ team.
|
||||
% Please contact the author and/or maintainer of pgfplots (Christian Feuersaenger) if you need assistance in conjunction
|
||||
% with the deployment of this patch or partial content of PGF. Note that the author and/or maintainer of pgfplots has no obligation to fix anything:
|
||||
% This file comes without any warranty as the rest of pgfplots; there is no obligation for help.
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%%% Date of this copy: Sa 7. Dez 20:58:23 CET 2013 %%%
|
||||
|
||||
|
||||
|
||||
% Copyright 2013 by Christian Feuersaenger
|
||||
%
|
||||
% 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.
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
|
||||
%
|
||||
% This list here is a general re-implementation of the list used in
|
||||
% the PGF system layer.
|
||||
% It employs two collect-buffers to reduce the runtime.
|
||||
%
|
||||
% - It has preasymptotical runtime O(N), but is O(N^2) asymptotically.
|
||||
% - It requires only 5 macros per list.
|
||||
%
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
% 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}%
|
||||
}%
|
||||
|
||||
% #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
|
||||
}%
|
||||
\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%
|
||||
}%
|
||||
\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}%
|
||||
}%
|
||||
|
||||
\def\pgfapplistlet#1=#2{%
|
||||
\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:
|
||||
% \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}%
|
||||
}%
|
||||
|
||||
% #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
|
||||
}%
|
||||
\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%
|
||||
}%
|
||||
\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}%
|
||||
}%
|
||||
\def\pgfprependlistlet#1=#2{%
|
||||
\pgfprependlist@flushbuffers{#2}%
|
||||
\expandafter\let\expandafter#1\csname pgfpPRP@#2\endcsname
|
||||
}%
|
164
texmf/tex/latex/pgfplots/tex/pgfplotsoldpgfsupp_tikzexternal.sty
Normal file
164
texmf/tex/latex/pgfplots/tex/pgfplotsoldpgfsupp_tikzexternal.sty
Normal file
|
@ -0,0 +1,164 @@
|
|||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%%% This file is a copy of some part of PGF/Tikz.
|
||||
%%% It has been copied here to provide :
|
||||
%%% - compatibility with older PGF versions
|
||||
%%% - availability of PGF contributions by Christian Feuersaenger
|
||||
%%% which are necessary or helpful for pgfplots.
|
||||
%%%
|
||||
%%% For reasons of simplicity, I have copied the whole file, including own contributions AND
|
||||
%%% PGF parts. The copyrights are as they appear in PGF.
|
||||
%%%
|
||||
%%% Note that pgfplots has compatible licenses.
|
||||
%%%
|
||||
%%% This copy has been modified in the following ways:
|
||||
%%% - nested \input commands have been updated
|
||||
%%%
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%%% Date of this copy: Di 25. Dez 18:14:20 CET 2012 %%%
|
||||
|
||||
|
||||
|
||||
% Copyright 2008 by Christian Feuersaenger
|
||||
%
|
||||
% 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.
|
||||
%
|
||||
% In addition to the above licenses, this particular file may also be
|
||||
% directly inlined into other documents and this copyright notice may
|
||||
% be removed. Additionally, when you inline this file, you may modify
|
||||
% it as needed and you may remove comments.
|
||||
%
|
||||
% 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.
|
||||
%
|
||||
% It replaces \tikzpicture/ \endtikzpicture and \tikz and invokes the
|
||||
% \includegraphics with the correct file name instead.
|
||||
|
||||
\RequirePackage{graphicx}
|
||||
|
||||
\toksdef\t@tikzexternal@tmpa=0
|
||||
\toksdef\t@tikzexternal@tmpb=1
|
||||
|
||||
\def\tikzexternalize{\@ifnextchar[{\tikzexternalize@opt}{\tikzexternalize@opt[]}}%
|
||||
\def\tikzexternalize@opt[#1]{\@ifnextchar\bgroup{\def\tikzexternal@realjob}{\let\tikzexternal@realjob=\jobname}}%
|
||||
|
||||
\def\tikzsetnextfilename#1{\gdef\tikzexternal@nextfile{#1}}
|
||||
\def\tikzsetexternalprefix#1{\def\tikzexternal@filenameprefix{#1}}
|
||||
\def\tikzsetfigurename#1{\def\tikzexternal@figurename{#1}}%
|
||||
\def\tikzappendtofigurename#1{\expandafter\def\expandafter\tikzexternal@figurename\expandafter{\tikzexternal@figurename #1}}%
|
||||
\tikzsetnextfilename{}
|
||||
\tikzsetexternalprefix{}
|
||||
\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\endtikzpicture{}
|
||||
\def\tikzexternal@laTeX@tikzpicturestring{tikzpicture}%
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% Replacement for \tikz short command:
|
||||
\def\tikz{\@ifnextchar[{\tikz@opt}{\tikz@opt[]}}
|
||||
\def\tikz@opt[#1]{\@ifnextchar\bgroup{\tikz@opt@{#1}}{\tikz@opt@@{#1}}}
|
||||
\def\tikz@opt@#1#2{\tikz@opt@process{#1}{#2}}
|
||||
\def\tikz@opt@@#1{%
|
||||
\def\tikz@next{\tikz@collectnormalsemicolon{#1}}%
|
||||
\ifnum\the\catcode`\;=\active\relax%
|
||||
\def\tikz@next{\tikz@collectactivesemicolon{#1}}%
|
||||
\fi%
|
||||
\tikz@next}
|
||||
\def\tikz@collectnormalsemicolon#1#2;{\tikz@opt@process{#1}{#2;}}
|
||||
{
|
||||
\catcode`\;=\active
|
||||
\gdef\tikz@collectactivesemicolon#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
|
||||
}%
|
||||
\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
|
||||
}
|
||||
\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
|
||||
}%
|
||||
\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
|
||||
}%
|
||||
\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
|
||||
}%
|
||||
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,93 @@
|
|||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%%% This file is a copy of some part of PGF/Tikz.
|
||||
%%% It has been copied here to provide :
|
||||
%%% - compatibility with older PGF versions
|
||||
%%% - availability of PGF contributions by Christian Feuersaenger
|
||||
%%% which are necessary or helpful for pgfplots.
|
||||
%%%
|
||||
%%% For reasons of simplicity, I have copied the whole file, including own contributions AND
|
||||
%%% PGF parts. The copyrights are as they appear in PGF.
|
||||
%%%
|
||||
%%% Note that pgfplots has compatible licenses.
|
||||
%%%
|
||||
%%% This copy has been modified in the following ways:
|
||||
%%% - nested \input commands have been updated
|
||||
%%%
|
||||
%
|
||||
% Support for the contents of this file will NOT be done by the PGF/TikZ team.
|
||||
% Please contact the author and/or maintainer of pgfplots (Christian Feuersaenger) if you need assistance in conjunction
|
||||
% with the deployment of this patch or partial content of PGF. Note that the author and/or maintainer of pgfplots has no obligation to fix anything:
|
||||
% This file comes without any warranty as the rest of pgfplots; there is no obligation for help.
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%%% Date of this copy: Di 25. Dez 18:14:20 CET 2012 %%%
|
||||
|
||||
|
||||
|
||||
% Copyright 2008 by Christian Feuersaenger
|
||||
%
|
||||
% 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.
|
||||
%
|
||||
%
|
||||
% 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
|
||||
%
|
||||
% \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
|
||||
% and you need to generate these figures manually (or with a script).
|
||||
%
|
||||
% It replaces \tikzpicture/ \endtikzpicture and \tikz and invokes \beginpgfgraphicnamed ... \endpgfgraphicnamed
|
||||
% commands if necessary.
|
||||
|
||||
% source generic implementation:
|
||||
\input pgfplotsoldpgfsupp_tikzexternalshared.code.tex
|
||||
|
||||
\def\tikzexternal@TEXDIALECT@begpicture{\begin{tikzpicture}}
|
||||
\def\tikzexternal@TEXDIALECT@endpicture{\end{tikzpicture}}%
|
||||
|
||||
% this latex specific this assumes it starts at the beginning of an
|
||||
% environment. The environment is named
|
||||
% '\tikzexternal@laTeX@collect@until@end@tikzpicturetikzpicturestring'.
|
||||
%
|
||||
% Everything up to \end{<name>} will be collected and passed as
|
||||
% argument to the macro '#1'.
|
||||
%
|
||||
% 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}%
|
||||
}
|
||||
|
||||
% 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}%
|
||||
}%
|
||||
\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}%
|
||||
|
||||
\AtBeginDocument{%
|
||||
\pgfutil@ifundefined{tikzexternalrealjob}{%
|
||||
\global\let\tikzexternalrealjob=\jobname
|
||||
}{}%
|
||||
}%
|
|
@ -0,0 +1,343 @@
|
|||
% This file contains patches to support 'trig format'
|
||||
%
|
||||
%%% This file is a copy of some part of PGF/Tikz.
|
||||
%%% It has been copied here to provide :
|
||||
%%% - compatibility with older PGF versions
|
||||
%%% - availability of PGF contributions by Christian Feuersaenger
|
||||
%%% which are necessary or helpful for pgfplots.
|
||||
%%%
|
||||
%%% This file contains just the functionality for trig format (written by Christian Feuersaenger).
|
||||
%%%
|
||||
% Support for the contents of this file will NOT be done by the PGF/TikZ team.
|
||||
% Please contact the author and/or maintainer of pgfplots (Christian Feuersaenger) if you need assistance in conjunction
|
||||
% with the deployment of this patch or partial content of PGF. Note that the author and/or maintainer of pgfplots has no obligation to fix anything:
|
||||
% This file comes without any warranty as the rest of pgfplots; there is no obligation for help.
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
\pgfkeys{
|
||||
/pgf/trig format/.is choice,
|
||||
/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
|
||||
}%
|
||||
|
||||
\def\pgfmath@scale@rad@to@deg#1{%
|
||||
#1=57.29577#1\relax% 57.29577 = 360/(2*pi)
|
||||
}%
|
||||
\def\pgfmath@scale@deg@to@rad#1{%
|
||||
#1=3.14159#1%
|
||||
\divide#1180\relax%
|
||||
}%
|
||||
|
||||
\def\pgfmathsin@#1{%
|
||||
% Let #1 = a.b
|
||||
% Then sin(#1) \approx (1-b)*sin(a) + b*sin(a+1)
|
||||
%
|
||||
\begingroup%
|
||||
\expandafter\pgfmath@x#1pt\relax%
|
||||
\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@
|
||||
\divide\c@pgfmath@counta360\relax%
|
||||
\multiply\c@pgfmath@counta-360\relax%
|
||||
\advance\pgfmath@x\c@pgfmath@counta pt\relax%
|
||||
\ifdim\pgfmath@x<0pt\relax\pgfmath@x-\pgfmath@x\fi%
|
||||
\ifdim\pgfmath@x<180pt\relax%
|
||||
\else
|
||||
\pgfmath@x-\pgfmath@x%
|
||||
\advance\pgfmath@x360pt\relax%
|
||||
\fi%
|
||||
% Now 0 <= x < 179. So split x into integer and decimal...
|
||||
%
|
||||
\afterassignment\pgfmath@xa%
|
||||
\expandafter\c@pgfmath@counta\the\pgfmath@x\relax%
|
||||
%
|
||||
% ...if #1 is an integer, don't do anything fancy.
|
||||
\ifdim\pgfmath@xa=0pt%
|
||||
\expandafter\pgfmath@x\csname pgfmath@cos@\the\c@pgfmath@counta\endcsname pt\relax%
|
||||
\else%
|
||||
\pgfmath@x-\pgfmath@xa%
|
||||
\advance\pgfmath@x1pt\relax%
|
||||
\expandafter\pgfmath@x\csname pgfmath@cos@\the\c@pgfmath@counta\endcsname\pgfmath@x%
|
||||
\advance\c@pgfmath@counta1\relax%
|
||||
\ifnum\c@pgfmath@counta=181\relax\c@pgfmath@counta179\relax\fi%
|
||||
\expandafter\advance\expandafter\pgfmath@x\csname pgfmath@cos@\the\c@pgfmath@counta\endcsname\pgfmath@xa%
|
||||
\fi%
|
||||
\pgfmath@returnone\pgfmath@x%
|
||||
\endgroup
|
||||
}
|
||||
|
||||
% \pgfmathcos
|
||||
%
|
||||
% Calculate the cosine of #1 (in degrees).
|
||||
%
|
||||
\def\pgfmathcos@#1{%
|
||||
% Let x = a.b
|
||||
% Then cos(x) \approx (1-b)*cos(a) + b*cos(a+1)
|
||||
%
|
||||
\begingroup%
|
||||
\expandafter\pgfmath@x#1pt\relax%
|
||||
\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@%
|
||||
\divide\c@pgfmath@counta360\relax%
|
||||
\multiply\c@pgfmath@counta-360\relax%
|
||||
\advance\pgfmath@x\c@pgfmath@counta pt\relax%
|
||||
\ifdim\pgfmath@x<0pt\relax\pgfmath@x-\pgfmath@x\fi%
|
||||
\ifdim\pgfmath@x<180pt\relax%
|
||||
\else%
|
||||
\pgfmath@x-\pgfmath@x%
|
||||
\advance\pgfmath@x360pt\relax%
|
||||
\fi%
|
||||
% Now 0 <= x < 179. So split x into integer and decimal...
|
||||
%
|
||||
\afterassignment\pgfmath@xa%
|
||||
\expandafter\c@pgfmath@counta\the\pgfmath@x\relax%
|
||||
%
|
||||
% ...if #1 is an integer, don't do anything fancy.
|
||||
\ifdim\pgfmath@xa=0pt%
|
||||
\expandafter\pgfmath@x\csname pgfmath@cos@\the\c@pgfmath@counta\endcsname pt%
|
||||
\else%
|
||||
\pgfmath@x-\pgfmath@xa%
|
||||
\advance\pgfmath@x1pt\relax%
|
||||
\expandafter\pgfmath@x\csname pgfmath@cos@\the\c@pgfmath@counta\endcsname\pgfmath@x%
|
||||
\advance\c@pgfmath@counta1\relax%
|
||||
\ifnum\c@pgfmath@counta=181\relax\c@pgfmath@counta179\relax\fi%
|
||||
\expandafter\advance\expandafter\pgfmath@x\csname pgfmath@cos@\the\c@pgfmath@counta\endcsname\pgfmath@xa%
|
||||
\fi%
|
||||
\pgfmath@returnone\pgfmath@x%
|
||||
\endgroup%
|
||||
}
|
||||
|
||||
\def\pgfmathasin@#1{%
|
||||
\begingroup%
|
||||
\pgfmath@x=#1pt %
|
||||
\pgfmath@xa\pgfmath@x%
|
||||
\edef\pgf@temp{\pgf@sys@tonumber\pgfmath@x}%
|
||||
% compute lossless '*1000' operation:
|
||||
\expandafter\pgfmath@multiply@thousand\pgf@temp 000\relax
|
||||
\pgfmath@x=\pgfmathresult pt %
|
||||
\ifdim\pgfmath@x<0pt\relax%
|
||||
\pgfmath@x-\pgfmath@x%
|
||||
\fi%
|
||||
\pgfmath@table@lookup{\pgfmath@x}{pgfmath@acos@}{1001}%
|
||||
\pgfmath@x=-\pgfmath@x
|
||||
\advance\pgfmath@x90pt\relax%
|
||||
\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
|
||||
\pgfmath@returnone\pgfmath@x%
|
||||
\endgroup%
|
||||
}
|
||||
\def\pgfmathacos@#1{%
|
||||
\begingroup%
|
||||
\pgfmath@x#1pt\relax%
|
||||
\pgfmath@xa\pgfmath@x%
|
||||
\edef\pgf@temp{\pgf@sys@tonumber\pgfmath@x}%
|
||||
% compute lossless '*1000' operation:
|
||||
\expandafter\pgfmath@multiply@thousand\pgf@temp 000\relax
|
||||
\pgfmath@x=\pgfmathresult pt %
|
||||
\ifdim\pgfmath@x<0pt\relax%
|
||||
\pgfmath@x-\pgfmath@x%
|
||||
\fi%
|
||||
\pgfmath@table@lookup{\pgfmath@x}{pgfmath@acos@}{1001}%
|
||||
\ifdim\pgfmath@xa<0pt\relax%
|
||||
\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
|
||||
\pgfmath@returnone\pgfmath@x%
|
||||
\endgroup%
|
||||
}
|
||||
|
||||
\def\pgfmathatan@#1{%
|
||||
\begingroup%
|
||||
\expandafter\pgfmath@x#1pt\relax%
|
||||
\pgfmath@xa\pgfmath@x%
|
||||
\ifdim\pgfmath@x<0pt\relax%
|
||||
\pgfmath@x-\pgfmath@x%
|
||||
\fi%
|
||||
\pgfmath@xb\pgfmath@x%
|
||||
\ifdim\pgfmath@x>1pt\relax%
|
||||
\edef\pgfmath@temp{\pgfmath@tonumber{\pgfmath@x}}%
|
||||
\pgfmathreciprocal@{\pgfmath@temp}%
|
||||
\pgfmath@x\pgfmathresult pt\relax%
|
||||
\fi%
|
||||
% compute lossless '*1000' operation:
|
||||
\edef\pgf@temp{\pgf@sys@tonumber\pgfmath@x}%
|
||||
\expandafter\pgfmath@multiply@thousand\pgf@temp 000\relax
|
||||
\pgfmath@x=\pgfmathresult pt %
|
||||
\pgfmath@table@lookup{\pgfmath@x}{pgfmath@atan@}{1001}%xxx
|
||||
\ifdim\pgfmath@xb>1pt\relax%
|
||||
\pgfmath@x=-\pgfmath@x%
|
||||
\advance\pgfmath@x90pt%
|
||||
\fi%
|
||||
\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
|
||||
\pgfmath@returnone\pgfmath@x%
|
||||
\endgroup%
|
||||
}
|
||||
|
||||
\expandafter\def\csname pgfmathatan2@\endcsname#1#2{%
|
||||
% Note: first parameter is y (!), second is x (!)
|
||||
\begingroup%
|
||||
\pgfmath@y=#1pt\relax%
|
||||
\ifdim\pgfmath@y<0pt\relax%
|
||||
\pgfmath@y=-\pgfmath@y%
|
||||
\fi%
|
||||
\ifdim\pgfmath@y<0.001pt\relax%
|
||||
\ifdim#2pt<0pt\relax%
|
||||
\pgfmath@x=-180pt\relax%
|
||||
\else%
|
||||
\ifdim#2pt>0pt\relax%
|
||||
\pgfmath@x=0pt\relax%
|
||||
\else%
|
||||
\ifdim#1pt<0pt%
|
||||
\pgfmath@x=-90pt\relax%
|
||||
\else%
|
||||
\pgfmath@x=90pt\relax%
|
||||
\fi%
|
||||
\fi%
|
||||
\fi%
|
||||
\else%
|
||||
\pgfmathabs@{#1}\let\pgfmath@tempa\pgfmathresult%
|
||||
\pgfmathabs@{#2}\let\pgfmath@tempb\pgfmathresult%
|
||||
\ifdim\pgfmath@tempa pt>\pgfmath@tempb pt%
|
||||
\pgfmathdivide@{#2}{\pgfmath@tempa}%
|
||||
\expandafter\pgfmathatan@\expandafter{\pgfmathresult}%
|
||||
\pgfmath@x=90pt%
|
||||
\advance\pgfmath@x by-\pgfmathresult pt\relax%
|
||||
\else%
|
||||
\pgfmathdivide@{\pgfmath@tempa}{#2}%
|
||||
\expandafter\pgfmathatan@\expandafter{\pgfmathresult}%
|
||||
\pgfmath@x=\pgfmathresult pt\relax%
|
||||
\ifdim#2pt<0pt%
|
||||
\advance\pgfmath@x by180pt\relax%
|
||||
\fi%
|
||||
\fi%
|
||||
\ifdim#1pt<0pt\relax%
|
||||
\pgfmath@x=-\pgfmath@x%
|
||||
\fi%
|
||||
\fi%
|
||||
\if1\pgfmath@trig@format@choice
|
||||
% trig format=rad
|
||||
\pgfmath@scale@deg@to@rad\pgfmath@x
|
||||
\fi
|
||||
\pgfmath@returnone\pgfmath@x%
|
||||
\endgroup%
|
||||
}
|
||||
|
||||
% FPU:
|
||||
|
||||
|
||||
\let\pgfmath@basic@sin@=\pgfmathsin@
|
||||
\let\pgfmath@basic@cos@=\pgfmathcos@
|
||||
\let\pgfmath@basic@tan@=\pgfmathtan@
|
||||
\let\pgfmath@basic@atan@=\pgfmathatan@
|
||||
\let\pgfmath@basic@asin@=\pgfmathasin@
|
||||
\let\pgfmath@basic@acos@=\pgfmathacos@
|
||||
\let\pgfmath@basic@cot@=\pgfmathcot@
|
||||
\let\pgfmath@basic@sec@=\pgfmathsec@
|
||||
\let\pgfmath@basic@cosec@=\pgfmathcosec@
|
||||
|
||||
% Computes #1(#2) where #1 is a trigonometric function, i.e.
|
||||
% #1(#2) = #1( #2 + r*360 )
|
||||
%
|
||||
% #1 is a one-argument macro which assigns \pgfmathresult.
|
||||
\def\pgfmathfloatTRIG@#1#2{%
|
||||
\if0\pgfmath@trig@format@choice
|
||||
% trig format=deg
|
||||
\expandafter\ifx\csname pgfmathfloatTRIG@NUM\endcsname\relax%
|
||||
% Lazy evaluation:
|
||||
\pgfmathfloatcreate{1}{3.6}{2}%
|
||||
\global\let\pgfmathfloatTRIG@NUM=\pgfmathresult
|
||||
\pgfmathfloatcreate{1}{2.77777777777778}{-3}%
|
||||
\global\let\pgfmathfloatTRIG@NUM@INV=\pgfmathresult
|
||||
\fi
|
||||
\pgfmathfloatmodknowsinverse@{#2}{\pgfmathfloatTRIG@NUM}{\pgfmathfloatTRIG@NUM@INV}%
|
||||
\else
|
||||
% trig format=rad
|
||||
\expandafter\ifx\csname pgfmathfloatTRIG@rad@NUM\endcsname\relax%
|
||||
% Lazy evaluation:
|
||||
\pgfmathfloatcreate{1}{6.28318530717959}{0}%
|
||||
\global\let\pgfmathfloatTRIG@rad@NUM=\pgfmathresult
|
||||
\pgfmathfloatcreate{1}{1.59154943091895}{-1}%
|
||||
\global\let\pgfmathfloatTRIG@rad@NUM@INV=\pgfmathresult
|
||||
\fi
|
||||
\pgfmathfloatmodknowsinverse@{#2}{\pgfmathfloatTRIG@rad@NUM}{\pgfmathfloatTRIG@rad@NUM@INV}%
|
||||
\fi
|
||||
\pgfmathfloattofixed@{\pgfmathresult}%
|
||||
\expandafter#1\expandafter{\pgfmathresult}%
|
||||
\pgfmathfloatparsenumber{\pgfmathresult}%
|
||||
}%
|
||||
|
||||
\def\pgfmathfloatsin@#1{\pgfmathfloatTRIG@\pgfmath@basic@sin@{#1}}
|
||||
\let\pgfmathfloatsin=\pgfmathfloatsin@
|
||||
\def\pgfmathfloatcos@#1{\pgfmathfloatTRIG@\pgfmath@basic@cos@{#1}}
|
||||
\let\pgfmathfloatcos=\pgfmathfloatcos@
|
||||
\def\pgfmathfloatsec@#1{\pgfmathfloatTRIG@\pgfmath@basic@cos@{#1}\pgfmathfloatreciprocal@{\pgfmathresult}}
|
||||
\let\pgfmathfloatsec=\pgfmathfloatsec@
|
||||
\def\pgfmathfloatcosec@#1{\pgfmathfloatTRIG@\pgfmath@basic@sin@{#1}\pgfmathfloatreciprocal@{\pgfmathresult}}
|
||||
\let\pgfmathfloatcosec=\pgfmathfloatcosec@
|
||||
|
||||
\def\pgfmathfloatatan@#1{%
|
||||
\begingroup
|
||||
\expandafter\ifx\csname pgfmathfloatatan@TMP\endcsname\relax%
|
||||
\pgfmathfloatcreate{1}{1.6}{4}%
|
||||
\global\let\pgfmathfloatatan@TMP=\pgfmathresult
|
||||
\pgfmathfloatcreate{2}{1.6}{4}%
|
||||
\global\let\pgfmathfloatatan@TMPB=\pgfmathresult
|
||||
\fi
|
||||
\pgfmathfloatgreaterthan@{#1}{\pgfmathfloatatan@TMP}%
|
||||
\ifpgfmathfloatcomparison
|
||||
\pgfmathiftrigonometricusesdeg{%
|
||||
\pgfmathfloatcreate{1}{9.0}{1}%
|
||||
}{%
|
||||
\pgfmathfloatcreate{1}{1.570796326794}{0}%
|
||||
}%
|
||||
\else
|
||||
\pgfmathfloatlessthan{#1}{\pgfmathfloatatan@TMPB}%
|
||||
\ifpgfmathfloatcomparison
|
||||
\pgfmathiftrigonometricusesdeg{%
|
||||
\pgfmathfloatcreate{2}{9.0}{1}%
|
||||
}{%
|
||||
\pgfmathfloatcreate{2}{1.570796326794}{0}%
|
||||
}%
|
||||
\else
|
||||
\pgfmathfloattofixed@{#1}%
|
||||
\expandafter\pgfmath@basic@atan@\expandafter{\pgfmathresult}%
|
||||
\pgfmathfloatparsenumber{\pgfmathresult}%
|
||||
\fi
|
||||
\fi
|
||||
\pgfmath@smuggleone\pgfmathresult
|
||||
\endgroup
|
||||
}%
|
||||
\endinput
|
2892
texmf/tex/latex/pgfplots/tex/pgfplotsplothandlers.code.tex
Normal file
2892
texmf/tex/latex/pgfplots/tex/pgfplotsplothandlers.code.tex
Normal file
File diff suppressed because it is too large
Load diff
574
texmf/tex/latex/pgfplots/tex/pgfplotsstackedplots.code.tex
Normal file
574
texmf/tex/latex/pgfplots/tex/pgfplotsstackedplots.code.tex
Normal file
|
@ -0,0 +1,574 @@
|
|||
%--------------------------------------------
|
||||
%
|
||||
% Package pgfplots
|
||||
%
|
||||
% 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-2013 by Christian Feuersänger.
|
||||
%
|
||||
% This program is free software: you can redistribute it and/or modify
|
||||
% 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 contains the implementation for stacked plots.
|
||||
%
|
||||
% Stacked plots always keep record of the last plotted coordinates.
|
||||
% Any new plot will be ADDED on top of the last plotted coordinates.
|
||||
%
|
||||
% Terminology: "last plotted coordinates" are called "zero levels"
|
||||
% because they actually work like shifts.
|
||||
%
|
||||
% Programming Structure:
|
||||
%
|
||||
% 1. We keep TWO lists of coordinates: a list of CURRENT zero level
|
||||
% coordinates and a list of NEXT zero level coordinates.
|
||||
%
|
||||
% The first one will be queried whenever a zero level coordinate is
|
||||
% requested.
|
||||
%
|
||||
% The second one will be used to form zero levels for the next plot.
|
||||
%
|
||||
% 2. At the beginning and end of the survey phase of each plot, the lists in 1.) are
|
||||
% initialised properly.
|
||||
%
|
||||
% 3.1 While plot coordinates are processed during the survey phase, the following methods
|
||||
% interact with the stacked API:
|
||||
% \pgfplots@stacked@preparepoint@inmacro
|
||||
% -> compute the 'stacked' sum.
|
||||
% This may need to be done with floating point arithmetics because
|
||||
% the data scaling trafo is not yet initialised
|
||||
% \pgfplots@stacked@rememberzerolevelpoint@for@next@plot
|
||||
% \pgfplots@stacked@getnextzerolevelpoint
|
||||
%
|
||||
%
|
||||
% 3.2 during the final visualization phase, we have
|
||||
% \pgfplots@stacked@visphasepreparedatapoint
|
||||
% -> takes coordinates as they will be given to Tikz. This method is
|
||||
% used to
|
||||
% - communicate zero level coordinates to Tikz
|
||||
% - implement the 'closed paths' option (allows filled stacked plots).
|
||||
%
|
||||
% 4. Zero levels are communicated to Tikz by
|
||||
% \pgfplots@stacked@initzerolevelhandler. This routine initialises an
|
||||
% input stream for Tikz plot handlers which produces a sequence of
|
||||
% zero levels. It is used by [xy]comb and [xy]bar.
|
||||
%
|
||||
%
|
||||
|
||||
\let\pgfplots@stacked@zerolevelpoint@x=\pgfutil@empty
|
||||
\let\pgfplots@stacked@zerolevelpoint@y=\pgfutil@empty
|
||||
|
||||
% this value is populated during the survey phase. It will be copied
|
||||
% to the visualization phase, i.e. it will be serialized along with
|
||||
% the survey'ed state:
|
||||
\newif\ifpgfplots@stacked@isfirstplot
|
||||
\newif\ifpgfplots@stacked@isinitialised
|
||||
|
||||
% Pre-initialisation.
|
||||
% Needs to be called before the first call to
|
||||
% \pgfplots@stacked@beginplot.
|
||||
\def\pgfplots@stacked@initialise{%
|
||||
\gdef\pgfplots@stacked@coordcount{-1}%
|
||||
\pgfplots@stacked@isfirstplottrue
|
||||
\pgfplots@stacked@isinitialisedtrue
|
||||
}%
|
||||
|
||||
% Cleanup method. Truncates any global variables to reduce string
|
||||
% space.
|
||||
\def\pgfplots@stacked@finalize{%
|
||||
\global\pgfplotslistnewempty\pgfplots@stacked@zerolevellist
|
||||
\global\pgfplotslistnewempty\pgfplots@stacked@nextzerolevellist
|
||||
\pgfplots@stacked@isinitialisedfalse
|
||||
}%
|
||||
|
||||
% (Re)defines the macro \pgfplots@stacked@getnextzerolevelpoint
|
||||
% at the beginning of each plot.
|
||||
%
|
||||
% The macro \pgfplots@stacked@getnextzerolevelpoint fills
|
||||
% \pgfplots@stacked@zerolevelpoint@[xy].
|
||||
%
|
||||
% ATTENTION: call \pgfplots@stacked@initialise before the first call
|
||||
% of beginplot!
|
||||
%
|
||||
% ATTENTION: install this before 'visualization depends on' - it
|
||||
% modifies \pgfplotsaxisserializedatapoint@private
|
||||
\def\pgfplots@stacked@beginplot{%
|
||||
%\message{pgfplots@stacked@beginplot: PLOT STARTED.}%
|
||||
\ifpgfplots@stacked@isinitialised
|
||||
\else
|
||||
\pgfplots@error{LOGIC ERROR: please call \string\pgfplots@stacked@initialise.}%
|
||||
\fi
|
||||
\def\pgfplots@stacked@zerolevel@current{}%
|
||||
\pgfplots@stacked@prepare@value@serialization
|
||||
% accumulate this command here for \closedcycle:
|
||||
\ifpgfplots@stacked@isfirstplot
|
||||
\global\pgfplotslistnewempty\pgfplots@stacked@zerolevellist
|
||||
% only work with float if its really necessary - for
|
||||
% example if the scaling trafo which maps to pgfmath is
|
||||
% not yet initialised.
|
||||
\ifpgfplots@datascaletrafo@initialised % FIXME : should be '!ifsurvey'
|
||||
\def\pgfplots@stacked@zerolevelpoint@x{0}%
|
||||
\def\pgfplots@stacked@zerolevelpoint@y{0}%
|
||||
\def\pgfplots@stacked@zerolevelpoint@z{0}%
|
||||
\else
|
||||
% note that log plots are special: their "stacked zero" is
|
||||
% computed with \pgfplotscoordmath{default}
|
||||
%
|
||||
\pgfplots@if{pgfplots@xislinear}{\pgfplotscoordmath{x}{zero}}{\pgfplotscoordmath{default}{zero}}%
|
||||
\let\pgfplots@stacked@zerolevelpoint@x=\pgfmathresult
|
||||
%
|
||||
\pgfplots@if{pgfplots@yislinear}{\pgfplotscoordmath{y}{zero}}{\pgfplotscoordmath{default}{zero}}%
|
||||
\let\pgfplots@stacked@zerolevelpoint@y=\pgfmathresult
|
||||
%
|
||||
\pgfplots@if{pgfplots@xislinear}{\pgfplotscoordmath{z}{zero}}{\pgfplotscoordmath{default}{zero}}%
|
||||
\let\pgfplots@stacked@zerolevelpoint@z=\pgfmathresult
|
||||
\fi
|
||||
%
|
||||
\def\pgfplots@stacked@getnextzerolevelpoint{}% will remain constant anyway.
|
||||
\else
|
||||
{\globaldefs=1
|
||||
\pgfplotslistcopy\pgfplots@stacked@nextzerolevellist\to\pgfplots@stacked@zerolevellist
|
||||
}%
|
||||
\def\pgfplots@stacked@getnextzerolevelpoint{%
|
||||
\pgfplotslistcheckempty\pgfplots@stacked@zerolevellist
|
||||
\ifpgfplotslistempty
|
||||
\pgfplots@stacked@wrong@count@error
|
||||
\else
|
||||
{\globaldefs=1
|
||||
\pgfplotslistpopfront\pgfplots@stacked@zerolevellist\to\pgfmathresult
|
||||
}%
|
||||
\expandafter\pgfplots@stacked@parsezerolevelpoint\expandafter{\pgfmathresult}%
|
||||
\fi
|
||||
}%
|
||||
\fi
|
||||
\global\pgfplotslistnewempty\pgfplots@stacked@nextzerolevellist
|
||||
}%
|
||||
|
||||
% ATTENTION: install this before 'visualization depends on' - it
|
||||
% modifies \pgfplotsaxisserializedatapoint@private
|
||||
\def\pgfplots@stacked@visphase@beginplot{%
|
||||
%\message{pgfplots@stacked@beginplot: VISUALIZATION OF PLOT STARTED (phase = \pgfplots@visphase@name).^^J}%
|
||||
\let\pgfplots@stacked@closedcycle@impl=\pgfutil@empty
|
||||
\pgfplots@stacked@prepare@value@serialization
|
||||
}%
|
||||
|
||||
\def\pgfplots@stacked@prepare@value@serialization{%
|
||||
% This here is SIMILAR to 'visualization depends on'.
|
||||
%
|
||||
% The only difference is that 'visualization depends on' expands
|
||||
% its arguments whereas this one here does not.
|
||||
%
|
||||
\pgfplotsset{%
|
||||
visualization depends on=value \pgfplots@stacked@diff\as\pgfplots@stacked@diff
|
||||
}%
|
||||
%
|
||||
%
|
||||
% Modify the axis private parts such that a data point is
|
||||
% serialized to the form
|
||||
% {Z{<stacked zerolevel value>}{<point meta>};<x coordinate>,<y coordinate>,<z coordinate>}
|
||||
%
|
||||
% for example, a 2d data pont (0,1) without point meta is serialized to
|
||||
% {Z{}{};0Y0.0e0],1Y1.0e0],}
|
||||
%
|
||||
% The deserialization looks for the magic token 'Z'. The next
|
||||
% parameter is the zero level of the data point, the following one
|
||||
% the "old" private serialization stuff (typically just point
|
||||
% meta).
|
||||
%
|
||||
% Note that the zero level of a data point might have its own zero
|
||||
% level (grand father) ... this would be part here as well, even
|
||||
% if it is useless (?). This causes recursive references to all
|
||||
% zero levels... and more memory for stacked plots.
|
||||
%
|
||||
% The zero'th level has an empty zero level point.
|
||||
\expandafter\def\expandafter\pgfplotsaxisserializedatapoint@private\expandafter{%
|
||||
\pgfplotsaxisserializedatapoint@private
|
||||
\t@pgfplots@toka=\expandafter{\pgfplots@stacked@zerolevel@current}%
|
||||
\t@pgfplots@tokb=\expandafter{\pgfplotsretval}%
|
||||
\edef\pgfplotsretval{%
|
||||
Z{\the\t@pgfplots@toka}%
|
||||
{\the\t@pgfplots@tokb}%
|
||||
}%
|
||||
}%
|
||||
%
|
||||
\pgfutil@ifundefined{pgfplotsaxisdeserializedatapointfrom@private@backup@}{}{%
|
||||
\pgfplots@error{Illegal internal state encountered: the stacked plots serialization preparation has been invoked twice}%
|
||||
}%
|
||||
\let\pgfplotsaxisdeserializedatapointfrom@private@backup@=\pgfplotsaxisdeserializedatapointfrom@private
|
||||
\def\pgfplotsaxisdeserializedatapointfrom@private##1{%
|
||||
\pgfplotsaxisdeserializedatapointfrom@private@stacked@##1%
|
||||
}%
|
||||
}%
|
||||
|
||||
\def\pgfplotsaxisdeserializedatapointfrom@private@stacked@ Z#1#2{%
|
||||
\def\pgfplots@stacked@zerolevel{#1}%
|
||||
\pgfplotsaxisdeserializedatapointfrom@private@backup@{#2}%
|
||||
}%
|
||||
|
||||
\def\pgfplots@stacked@parsezerolevelpoint#1{%
|
||||
\begingroup
|
||||
\pgfplotsaxisdeserializedatapointfrom#1% no braces here!
|
||||
% \pgfplotsplothandlerdeserializepointfrom{#1}%
|
||||
\pgfplots@stacked@smuggle
|
||||
\endgroup
|
||||
% the value of \pgfplots@stacked@zerolevel@current will be configured as
|
||||
% "visualization depends on".
|
||||
% In other words: it is available later-on.
|
||||
\def\pgfplots@stacked@zerolevel@current{#1}%
|
||||
}
|
||||
|
||||
\def\pgfplots@stacked@smuggle\endgroup{%
|
||||
\xdef\pgfplots@glob@TMPb{%
|
||||
\noexpand\def\noexpand\pgfplots@stacked@zerolevelpoint@x{\pgfplots@current@point@x}%
|
||||
\noexpand\def\noexpand\pgfplots@stacked@zerolevelpoint@y{\pgfplots@current@point@y}%
|
||||
\noexpand\def\noexpand\pgfplots@stacked@zerolevelpoint@z{\pgfplots@current@point@z}%
|
||||
}%
|
||||
\endgroup
|
||||
\pgfplots@glob@TMPb
|
||||
}%
|
||||
|
||||
\def\pgfplots@stacked@wrong@count@error{%
|
||||
\pgfplots@error{Sorry, pgfplots expects stacked plots to have exactly the same number of coordinates. Unfortunately, I encountered at plot with DIFFERENT NUMBERS OF COORDINATES. Please verify that 1. no point has been dropped by coordinate filters (for example log(0) or so) and 2. all plots have the same number of coordinates.}%
|
||||
}%
|
||||
|
||||
\def\pgfplots@stacked@survey@endplot{%
|
||||
%\message{Stacked plot survey phase end: isfirst = \ifpgfplots@stacked@isfirstplot true \else false\fi^^J}%
|
||||
\ifpgfplots@stacked@isfirstplot
|
||||
\pgfplotslistcheckempty\pgfplots@stacked@zerolevellist
|
||||
\ifpgfplotslistempty
|
||||
\else
|
||||
\pgfplots@stacked@wrong@count@error
|
||||
\fi
|
||||
\fi
|
||||
\ifpgfplots@stacked@isfirstplot
|
||||
\def\pgfplots@stacked@serialized@commands{\noexpand\pgfplots@stacked@isfirstplottrue}%
|
||||
\else
|
||||
\def\pgfplots@stacked@serialized@commands{\noexpand\pgfplots@stacked@isfirstplotfalse}%
|
||||
\fi
|
||||
\global\pgfplots@stacked@isfirstplotfalse
|
||||
}%
|
||||
|
||||
\def\pgfplots@stacked@visphase@endplot{%
|
||||
%\message{Stacked plot vis phase end: isfirst = \ifpgfplots@stacked@isfirstplot true \else false\fi^^J}%
|
||||
\ifpgfplots@stacked@isfirstplot
|
||||
\let\pgfplots@stacked@closedcycle@impl=\pgfplots@path@closed@cycle@std
|
||||
\else
|
||||
\t@pgfplots@tokc=\expandafter{\pgfplots@stacked@closedcycle@impl}%
|
||||
\edef\pgfplots@stacked@closedcycle@impl{%
|
||||
[mark=none,/utils/exec=\noexpand\pgfplots@try@mirror@plot@handler]
|
||||
--plot coordinates{\the\t@pgfplots@tokc}
|
||||
--cycle
|
||||
}%
|
||||
\fi
|
||||
\global\pgfplots@stacked@isfirstplotfalse
|
||||
}%
|
||||
|
||||
% WARNING: when this method is called, NEITHER
|
||||
% \ifpgfplots@stacked@isfirstplot NOR the zero level lists are
|
||||
% initialised!
|
||||
\def\pgfplots@stacked@initzerolevelhandler{%
|
||||
\if\pgfplots@stacked@dir x
|
||||
\pgfplotxzerolevelstream@@list
|
||||
\pgfplotyzerolevelstreamconstant{\pgfplots@ZERO@y}%
|
||||
\else
|
||||
\pgfplotxzerolevelstreamconstant{\pgfplots@ZERO@x}%
|
||||
\pgfplotyzerolevelstream@@list
|
||||
\fi
|
||||
}%
|
||||
|
||||
% #1: a point as (x,y) (or (x,y,z) )
|
||||
\def\pgfplots@stacked@rememberzerolevelpoint@for@next@plot#1{%
|
||||
\expandafter\pgfplotslistpushbackglobal\expandafter{#1}\to\pgfplots@stacked@nextzerolevellist
|
||||
}
|
||||
|
||||
% Provides public access to zero levels into some key-value pairs.
|
||||
% Returns the values into a set of keys in the /data point/ prefix.
|
||||
%
|
||||
% The values can be used in 'axis cs'.
|
||||
\def\pgfplotspointgetzerolevelcoordinates{%
|
||||
\pgfplotspointgetnormalizedzerolevelcoordinates
|
||||
\pgfplotspointgetcoordinatesfromnormalized[path=/data point/zero]%
|
||||
\pgfplotspointgetcoordinatesfromnormalized[path=/data point/diff]%
|
||||
}
|
||||
|
||||
% Same as \pgfplotsgetzerolevelcoordinates, but the resulting values
|
||||
% are for use in 'normalized axis cs'.
|
||||
%
|
||||
% This works for both stacked plots and normal plots.
|
||||
\def\pgfplotspointgetnormalizedzerolevelcoordinates{%
|
||||
\begingroup
|
||||
\ifpgfplots@stackedmode
|
||||
\ifx\pgfplots@stacked@zerolevel\pgfutil@empty
|
||||
\pgfplotspointgetnormalizedcoordinates%
|
||||
\pgfplotsutilforeachcommasep{x,y,z}\as\pgfplots@loc@TMPa{%
|
||||
\pgfkeysgetvalue{/data point/\pgfplots@loc@TMPa}\pgfplots@loc@TMPb
|
||||
\expandafter\let\csname pgfplots@current@point@\pgfplots@loc@TMPa\endcsname=\pgfplots@loc@TMPb
|
||||
}%
|
||||
\pgfplotscoordmath{\pgfplots@stacked@dir}{zero}%
|
||||
\expandafter\let\csname pgfplots@current@point@\pgfplots@stacked@dir\endcsname\pgfmathresult%
|
||||
%
|
||||
\let\pgfplots@current@point@meta=\pgfutil@empty
|
||||
\pgfkeyssetvalue{/data point/zero/auto}{1}%
|
||||
\else
|
||||
%
|
||||
\expandafter\pgfplotsaxisdeserializedatapointfrom\pgfplots@stacked@zerolevel%
|
||||
\pgfkeyssetvalue{/data point/zero/auto}{0}%
|
||||
\fi
|
||||
%
|
||||
\pgfplotscoordmath{x}{zero}\let\pgfplots@stacked@diff@x=\pgfmathresult%
|
||||
\pgfplotscoordmath{y}{zero}\let\pgfplots@stacked@diff@y=\pgfmathresult%
|
||||
\pgfplotscoordmath{z}{zero}\let\pgfplots@stacked@diff@z=\pgfmathresult%
|
||||
\pgfutil@namelet{pgfplots@stacked@diff@\pgfplots@stacked@dir}{pgfplots@stacked@diff}%
|
||||
\else
|
||||
% Ah - no stacked plot!? Well, than do "something useful":
|
||||
\pgfplotscoordmath{x}{zero}\let\pgfplots@current@point@x=\pgfmathresult%
|
||||
\pgfplotscoordmath{y}{zero}\let\pgfplots@current@point@y=\pgfmathresult%
|
||||
\pgfplotscoordmath{z}{zero}\let\pgfplots@current@point@z=\pgfmathresult%
|
||||
%
|
||||
\pgfplotspointgetnormalizedcoordinates%
|
||||
\pgfplotsutilforeachcommasep{x,y,z}\as\pgfplots@loc@TMPa{%
|
||||
\pgfkeysgetvalue{/data point/\pgfplots@loc@TMPa}\pgfplots@loc@TMPb
|
||||
\expandafter\let\csname pgfplots@stacked@diff@\pgfplots@loc@TMPa\endcsname=\pgfplots@loc@TMPb
|
||||
}%
|
||||
\pgfkeyssetvalue{/data point/zero/auto}{1}%
|
||||
\fi
|
||||
%
|
||||
\xdef\pgfplots@glob@TMPd{%
|
||||
\noexpand\pgfkeyssetvalue{/data point/zero/x}{\pgfplots@current@point@x}%
|
||||
\noexpand\pgfkeyssetvalue{/data point/zero/y}{\pgfplots@current@point@y}%
|
||||
\noexpand\pgfkeyssetvalue{/data point/zero/z}{\pgfplots@current@point@z}%
|
||||
\noexpand\pgfkeyssetvalue{/data point/zero/meta}{\pgfplots@current@point@meta}%
|
||||
\noexpand\pgfkeyssetvalue{/data point/zero/auto}{\pgfkeysvalueof{/data point/zero/auto}}%
|
||||
\noexpand\pgfkeyssetvalue{/data point/diff/x}{\pgfplots@stacked@diff@x}%
|
||||
\noexpand\pgfkeyssetvalue{/data point/diff/y}{\pgfplots@stacked@diff@y}%
|
||||
\noexpand\pgfkeyssetvalue{/data point/diff/z}{\pgfplots@stacked@diff@z}%
|
||||
}%
|
||||
\endgroup
|
||||
\pgfplots@glob@TMPd
|
||||
%
|
||||
%\message{pgfplotsgetzerolevelcoordinates returned x=\pgfkeysvalueof{/data point/zero/x}, y=\pgfkeysvalueof{/data point/zero/y}, diffx=\pgfkeysvalueof{/data point/diff/x}; diffy=\pgfkeysvalueof{/data point/diff/y}, diff=\pgfkeysvalueof{/data point/diff}^^J}%
|
||||
}%
|
||||
|
||||
% PRECONDITION:
|
||||
% Is in invoked inside of a coord preparation routine, that means
|
||||
% - \pgfplots@current@point@[xyz]
|
||||
% - \ifpgfplots@curplot@threedim
|
||||
% are all set properly.
|
||||
\def\pgfplots@stacked@visphasepreparedatapoint{%
|
||||
\ifx\pgfplots@stacked@zerolevel\pgfutil@empty
|
||||
% this here is the case if we have the first encountered plot,
|
||||
% i.e. the one on which others are stacked.
|
||||
%
|
||||
% Note that it is not necessarily the first one which is
|
||||
% processed (compare reverse stacked plots).
|
||||
\if\pgfplots@stacked@dir x
|
||||
\edef\pgfplots@loc@TMPa{\pgfplots@logical@ZERO@x pt}%
|
||||
\else
|
||||
\edef\pgfplots@loc@TMPa{\pgfplots@logical@ZERO@y pt}%
|
||||
\fi
|
||||
\let\pgfplots@stacked@PGF@zerolevel\pgfplots@loc@TMPa
|
||||
%
|
||||
\else
|
||||
\begingroup
|
||||
%\expandafter\pgfplotsplothandlerdeserializepointfrom\expandafter{\pgfplots@stacked@zerolevel}%
|
||||
\expandafter\pgfplotsaxisdeserializedatapointfrom\pgfplots@stacked@zerolevel%
|
||||
%
|
||||
\pgfplots@stacked@logarithm@if@needed
|
||||
%
|
||||
% avoid endless recursion:
|
||||
\let\pgfplots@stacked@visphasepreparedatapoint=\relax
|
||||
\pgfplotsaxisvisphasegetpoint
|
||||
\edef\pgfplots@current@point@x{\the\pgf@x}%
|
||||
\edef\pgfplots@current@point@y{\the\pgf@y}%
|
||||
\pgfplots@stacked@smuggle
|
||||
\endgroup
|
||||
%
|
||||
\if\pgfplots@stacked@dir x
|
||||
\let\pgfplots@stacked@PGF@zerolevel=\pgfplots@stacked@zerolevelpoint@x%
|
||||
\else
|
||||
\let\pgfplots@stacked@PGF@zerolevel=\pgfplots@stacked@zerolevelpoint@y%
|
||||
\fi
|
||||
\t@pgfplots@toka=\expandafter{\pgfplots@stacked@closedcycle@impl}%
|
||||
\edef\pgfplots@stacked@closedcycle@impl{%
|
||||
(\pgfplots@stacked@zerolevelpoint@x,\pgfplots@stacked@zerolevelpoint@y)%
|
||||
\the\t@pgfplots@toka}%
|
||||
\fi
|
||||
}%
|
||||
|
||||
% A special hook which is executed early in the visualization phase.
|
||||
% It will be invoked *before*
|
||||
% \pgfplots@stacked@visphasepreparedatapoint!
|
||||
%
|
||||
% Its purpose is to clear the data if necessary, i.e. it implements
|
||||
% /pgfplots/stacked ignores zero
|
||||
\def\pgfplots@stacked@visphase@stream@coord@{%
|
||||
\ifpgfplots@stacked@ignores@zero
|
||||
\edef\pgfplots@loc@TMPa{\pgfkeysvalueof{/pgfplots/stacked ignores zero/\pgfplots@visphase@name}}%
|
||||
\def\pgfplots@loc@TMPb{true}%
|
||||
% apply this feature only if it is active for the current
|
||||
% visualization phase:
|
||||
\ifx\pgfplots@loc@TMPb\pgfplots@loc@TMPa
|
||||
\ifx\pgfplots@current@point@x\pgfutil@empty% this implements `unbounded coords=jump', for example
|
||||
\else
|
||||
\pgfplotscoordmath{\pgfplots@stacked@dir}{if is}{\pgfplots@stacked@diff}{0}{%
|
||||
\let\pgfplots@current@point@x=\pgfutil@empty
|
||||
\let\pgfplots@current@point@y=\pgfutil@empty
|
||||
\let\pgfplots@current@point@z=\pgfutil@empty
|
||||
}{%
|
||||
}%
|
||||
\fi
|
||||
\fi
|
||||
\fi
|
||||
}%
|
||||
|
||||
% PRECONDITION:
|
||||
% Is in invoked inside of a coord preparation routine, that means
|
||||
% - \pgfplots@current@point@[xyz]
|
||||
% - \ifpgfplots@curplot@threedim
|
||||
% are all set properly.
|
||||
%
|
||||
% POSTCONDITION:
|
||||
% - \pgfplots@current@point@[xyz] are adjusted.
|
||||
\def\pgfplots@stacked@preparepoint@inmacro{%
|
||||
\pgfplots@stacked@getnextzerolevelpoint
|
||||
%
|
||||
\ifpgfplots@stacked@plus
|
||||
\def\pgfplots@stacked@op{add}%
|
||||
\else
|
||||
\def\pgfplots@stacked@op{subtract}%
|
||||
\fi
|
||||
%
|
||||
\pgfutil@namelet{pgfplots@stacked@diff}{pgfplots@current@point@\pgfplots@stacked@dir}%
|
||||
%
|
||||
\pgfplots@if{pgfplots@\pgfplots@stacked@dir islinear}{%
|
||||
\pgfplotscoordmath{\pgfplots@stacked@dir}{op}{\pgfplots@stacked@op}{%
|
||||
{\csname pgfplots@stacked@zerolevelpoint@\pgfplots@stacked@dir\endcsname}%
|
||||
{\csname pgfplots@current@point@\pgfplots@stacked@dir\endcsname}}%
|
||||
}{%
|
||||
% LOG. we need to compute log(zerolevel + current):
|
||||
% FIXME : this might work, but is is hackery - because the
|
||||
% coordmath framework handles log bases in a very stupid way.
|
||||
% improve it somehow!
|
||||
\edef\pgfmathresult{\csname pgfplots@current@point@\pgfplots@stacked@dir\endcsname}%
|
||||
\pgfplotscoordmath{\pgfplots@stacked@dir}{exp}{\pgfmathresult}%
|
||||
\pgfplotscoordmath{default}{parsenumber}{\pgfmathresult}%
|
||||
\expandafter\let\csname pgfplots@current@point@\pgfplots@stacked@dir\endcsname=\pgfmathresult
|
||||
\pgfplotscoordmath{default}{op}{\pgfplots@stacked@op}{%
|
||||
{\csname pgfplots@stacked@zerolevelpoint@\pgfplots@stacked@dir\endcsname}%
|
||||
{\csname pgfplots@current@point@\pgfplots@stacked@dir\endcsname}%
|
||||
}%
|
||||
}%
|
||||
%
|
||||
% for logs, I remember just zerolevel+current; not its log.
|
||||
\expandafter\let\csname pgfplots@current@point@\pgfplots@stacked@dir\endcsname=\pgfmathresult
|
||||
%
|
||||
% this here would also be ok, but it would only store the coords
|
||||
% of the zero level...
|
||||
%\pgfplotsplothandlerserializepointto\pgfplotsretval
|
||||
%\message{serializing current value current value to \meaning\pgfplotsretval^^J}%
|
||||
%
|
||||
\begingroup
|
||||
%
|
||||
% without this line, the "zerolevel" would also know all its zero
|
||||
% levels recursively:
|
||||
\pgfplots@stacked@strip@parents@zerolevel
|
||||
%
|
||||
\pgfplotsaxisserializedatapointtostring
|
||||
\pgfplots@stacked@rememberzerolevelpoint@for@next@plot{\pgfplotsretval}%
|
||||
\endgroup
|
||||
%
|
||||
%
|
||||
%
|
||||
\pgfplots@stacked@logarithm@if@needed
|
||||
}
|
||||
|
||||
%
|
||||
% We store the normal values for zero levels. Consequently, we may
|
||||
% need to (re)apply the log if we have a log axis.
|
||||
%
|
||||
% I am unsure of whether log+stacked is useful at all.
|
||||
\def\pgfplots@stacked@logarithm@if@needed{%
|
||||
\pgfplots@if{pgfplots@\pgfplots@stacked@dir islinear}{%
|
||||
}{%
|
||||
\pgfplotscoordmath{\pgfplots@stacked@dir}{log}{\csname pgfplots@current@point@\pgfplots@stacked@dir\endcsname}%
|
||||
\expandafter\let\csname pgfplots@current@point@\pgfplots@stacked@dir\endcsname=\pgfmathresult
|
||||
}%
|
||||
}%
|
||||
|
||||
% you can \let this here to \relax if you want to gain access to all
|
||||
% zero levels recursively:
|
||||
\def\pgfplots@stacked@strip@parents@zerolevel{%
|
||||
\def\pgfplots@stacked@zerolevel@current{}%
|
||||
}
|
||||
|
||||
% This here is a re-implementation of the stored plot processing.
|
||||
%
|
||||
% The idea is simple, although it requires quite some work:
|
||||
%
|
||||
% If we stack plots on top of each other, early drawing commands
|
||||
% (early plots) will be OVERDRAWN by later drawing commands (later
|
||||
% plots). This is especially unfortunate if we use filled bar plots
|
||||
% or comb plots.
|
||||
%
|
||||
% IDEA: draw plots in REVERSE order. The positioning, styles and
|
||||
% whatever must not be affected, only the sequence of drawing commands
|
||||
% shall change.
|
||||
%
|
||||
% So, this command here reverses the list.
|
||||
\def\pgfplots@stacked@finalize@stored@plots{%
|
||||
\pgfplotslistnewempty\pgfplots@stored@plotlist@reversed
|
||||
\begingroup
|
||||
\pgfplotslistforeachungrouped\pgfplots@stored@plotlist\as\pgfplots@loc@TMPa{%
|
||||
% Reverse sequence:
|
||||
\expandafter\pgfplotslistpushfront\pgfplots@loc@TMPa\to\pgfplots@stored@plotlist@reversed
|
||||
}%
|
||||
% Now, overwrite the original list:
|
||||
\global\let\pgfplots@stored@plotlist=\pgfplots@stored@plotlist@reversed
|
||||
\global\let\pgfplots@stored@plotlist@reversed=\relax
|
||||
\endgroup
|
||||
}%
|
||||
|
||||
\def\pgfplots@stacked@path@closed@cycle{%
|
||||
\pgfplots@stacked@closedcycle@impl
|
||||
}
|
||||
|
||||
% PGF interfaces:
|
||||
%
|
||||
% these are relatively simple right now: assuming that the zero-level
|
||||
% streams are advanced if and only if the coordinate streams are
|
||||
% advanced, we can simply inject the *currect* zero level rather than
|
||||
% providing all at once.
|
||||
\def\pgfplotxzerolevelstream@@list{%
|
||||
\def\pgf@plotxzerolevelstreamstart{%
|
||||
\gdef\pgf@plotxzerolevelstreamnext{%
|
||||
\global\pgf@x=\pgfplots@stacked@PGF@zerolevel\relax
|
||||
}%
|
||||
}%
|
||||
\def\pgf@plotxzerolevelstreamend{%
|
||||
}%
|
||||
}%
|
||||
|
||||
\def\pgfplotyzerolevelstream@@list{%
|
||||
\def\pgf@plotyzerolevelstreamstart{%
|
||||
\gdef\pgf@plotyzerolevelstreamnext{%
|
||||
\global\pgf@x=\pgfplots@stacked@PGF@zerolevel\relax
|
||||
}%
|
||||
}%
|
||||
\def\pgf@plotyzerolevelstreamend{%
|
||||
}%
|
||||
}%
|
84
texmf/tex/latex/pgfplots/tex/pgfplotssysgeneric.code.tex
Normal file
84
texmf/tex/latex/pgfplots/tex/pgfplotssysgeneric.code.tex
Normal file
|
@ -0,0 +1,84 @@
|
|||
%--------------------------------------------
|
||||
% Package pgfplots
|
||||
%
|
||||
% 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 by Christian Feuersänger.
|
||||
%
|
||||
% This program is free software: you can redistribute it and/or modify
|
||||
% 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/>.
|
||||
%
|
||||
%--------------------------------------------
|
||||
|
||||
% NOTE: tex4ht support is lousy. For example, \tikz \node {$10^{-6}$};
|
||||
% will already break -- because SVG does not support the html tag
|
||||
% − produced by tex4ht (and TikZ apparently does not know how to
|
||||
% escape it somehow).
|
||||
\def\pgfplots@sys@beforenode{%
|
||||
\pgfkeysifdefined{/tikz/tex4ht node/escape/.@cmd}{%
|
||||
\ifpgfplots@has@cell@picture
|
||||
\tikzset{tex4ht node/escape=true}%
|
||||
\pgfplots@warning{ATTENTION: you may want to use '\string\pgfplotsset{cell picture=false}' in your preamble. Otherwise, tex4ht will produce TWO SVG files per plot.^^J}%
|
||||
\fi
|
||||
}{}%
|
||||
}%
|
||||
|
||||
% see compat/show suggested version
|
||||
\newif\ifpgfplots@show@suggested@version
|
||||
\pgfplots@show@suggested@versiontrue
|
||||
|
||||
\def\pgfplots@show@suggested@compat@value{%
|
||||
\ifpgfplots@show@suggested@version
|
||||
\begingroup
|
||||
\pgfkeysgetvalue{/pgfplots/compat/current}\current
|
||||
\pgfkeysgetvalue{/pgfplots/compat/mostrecent}\mostrecent
|
||||
%
|
||||
\def\b@isnewest{0}%
|
||||
\def\b@shouldupgrade{0}%
|
||||
\ifx\current\mostrecent
|
||||
\def\b@isnewest{1}%
|
||||
\else
|
||||
\def\pgfplots@loc@TMPa{newest}%
|
||||
\ifx\current\pgfplots@loc@TMPa
|
||||
\def\b@isnewest{1}%
|
||||
\else
|
||||
\expandafter\pgfplotsutilifstringequal\expandafter{\current}{pre 1.3}{%
|
||||
\def\b@shouldupgrade{1}%
|
||||
}{}%
|
||||
\expandafter\pgfplotsutilifstringequal\expandafter{\current}{default}{%
|
||||
\def\b@shouldupgrade{1}%
|
||||
}{}%
|
||||
\fi
|
||||
\fi
|
||||
\if1\b@isnewest
|
||||
\pgfplots@message{Package pgfplots notification 'compat/show suggested version=true': document has been generated with the most recent feature set (\string\pgfplotsset{compat=\mostrecent}).^^J}%
|
||||
\else
|
||||
\if1\b@shouldupgrade
|
||||
\pgfplots@warning{running in backwards compatibility mode (unsuitable tick labels; missing features). Consider writing \string\pgfplotsset{compat=\mostrecent} into your preamble.^^J}%
|
||||
\else
|
||||
\pgfplots@message{Package pgfplots notification 'compat/show suggested version=true': you might benefit from \string\pgfplotsset{compat=\mostrecent} (current compat level: \current).^^J}%
|
||||
\fi
|
||||
\fi
|
||||
\endgroup
|
||||
\fi
|
||||
}
|
||||
|
||||
\pgfutil@IfUndefined{AtBeginDocument}{%
|
||||
}{%
|
||||
\AtBeginDocument{%
|
||||
\pgfplots@show@suggested@compat@value
|
||||
}%
|
||||
}%
|
2998
texmf/tex/latex/pgfplots/tex/pgfplotstable.code.tex
Normal file
2998
texmf/tex/latex/pgfplots/tex/pgfplotstable.code.tex
Normal file
File diff suppressed because it is too large
Load diff
93
texmf/tex/latex/pgfplots/tex/pgfplotstable.coltype.code.tex
Normal file
93
texmf/tex/latex/pgfplots/tex/pgfplotstable.coltype.code.tex
Normal file
|
@ -0,0 +1,93 @@
|
|||
%--------------------------------------------
|
||||
%
|
||||
% Package numtable.
|
||||
%
|
||||
% This file provides support for column types in LaTeX tabular
|
||||
% environments, i.e.
|
||||
%
|
||||
%\begin{tabular}{>{\pgfplotstablecoltype}c<{\endpgfplotstablecoltype}}
|
||||
% 1 \\
|
||||
% 2 \\
|
||||
% 3 \\
|
||||
%\end{tabular}
|
||||
%
|
||||
%
|
||||
%
|
||||
% Copyright 2007/2008 by Christian Feuersänger.
|
||||
%
|
||||
% This program is free software: you can redistribute it and/or modify
|
||||
% 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/>.
|
||||
%
|
||||
%--------------------------------------------
|
||||
|
||||
|
||||
|
||||
% If I did not get it wrong, the tabular package, initialised with a
|
||||
% column type like
|
||||
% >{\pgfplotstablecoltype}c<{\endpgfplotstablecoltype}
|
||||
% yields
|
||||
%
|
||||
% \pgfplotstablecoltype \ignorespaces <content> \unskip \endpgfplotstablecoltype
|
||||
% OR
|
||||
% \pgfplotstablecoltype \ignorespaces <content> \\ \endpgfplotstablecoltype
|
||||
%
|
||||
% So, I define \pgfplotstablecoltype to skip \ignorespaces and \unskip and simply
|
||||
% get <content>.
|
||||
\def\pgfplotstablecoltype{%
|
||||
\begingroup
|
||||
\let\pgfplotstablecoltype@content=\empty
|
||||
\pgfutil@ifnextchar[{%
|
||||
\pgfplotstablecoltype@
|
||||
}{%
|
||||
\pgfplotstablecoltype@until@end@start
|
||||
}%
|
||||
}%
|
||||
\def\pgfplotstablecoltype@[#1]{%
|
||||
\pgfqkeys{/pgf/number format}{#1}%
|
||||
\pgfplotstablecoltype@until@end@start
|
||||
}%
|
||||
|
||||
\def\pgfplotstablecoltype@until@end@start\ignorespaces{%
|
||||
\pgfplotstablecoltype@until@end
|
||||
}%
|
||||
\def\pgfplotstablecoltype@until@end{%
|
||||
\pgfutil@ifnextchar\\{%
|
||||
\pgfplotstablecoltype@finish%
|
||||
}{%
|
||||
\pgfutil@ifnextchar{\unskip}{%
|
||||
\pgfplotstablecoltype@finish%
|
||||
}{%
|
||||
\pgfplotstablecoltype@next
|
||||
}%
|
||||
}%
|
||||
}
|
||||
\def\pgfplotstablecoltype@next#1{%
|
||||
\expandafter\def\expandafter\pgfplotstablecoltype@content\expandafter{\pgfplotstablecoltype@content#1}%
|
||||
\pgfplotstablecoltype@until@end
|
||||
}
|
||||
\def\pgfplotstablecoltype@finish{%
|
||||
%\message{COLLECTED \meaning\pgfplotstablecoltype@content}%
|
||||
\edef\pgfplotstablecoltype@content{\pgfplotstablecoltype@content}%
|
||||
%
|
||||
% trim white space:
|
||||
\expandafter\pgfkeys@spdef\expandafter\pgfplotstablecoltype@content\expandafter{\pgfplotstablecoltype@content}%
|
||||
%
|
||||
\ifx\pgfplotstablecoltype@content\pgfutil@empty
|
||||
\else
|
||||
\pgfmathprintnumber{\pgfplotstablecoltype@content}%
|
||||
\fi
|
||||
\endgroup
|
||||
}%
|
||||
|
||||
%\def\pgfplotstablecoltype{\message{COLLECT}}%
|
||||
\def\endpgfplotstablecoltype{}%
|
39
texmf/tex/latex/pgfplots/tex/pgfplotstable.sty
Normal file
39
texmf/tex/latex/pgfplots/tex/pgfplotstable.sty
Normal file
|
@ -0,0 +1,39 @@
|
|||
%--------------------------------------------
|
||||
%
|
||||
% Package pgfplotstable.sty
|
||||
%
|
||||
% Copyright 2007-2011 by Christian Feuersänger.
|
||||
%
|
||||
% This program is free software: you can redistribute it and/or modify
|
||||
% 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/>.
|
||||
%
|
||||
%--------------------------------------------
|
||||
\IfFileExists{pgfplots.revision.tex}{\input pgfplots.revision.tex } {%
|
||||
\def\pgfplotsrevision{0}%
|
||||
\def\pgfplotsversion{0.0}%
|
||||
\def\pgfplotsversiondatetime{2014-07-01 00:00:00 +100}%
|
||||
\def\pgfplotsrevisiondatetime{2014-07-01 00:00:00 +100}%
|
||||
\def\pgfplotsversiondate{2014/07/01}%
|
||||
\def\pgfplotsrevisiondate{2014/07/01}%
|
||||
}
|
||||
\ProvidesPackage{pgfplotstable}[\pgfplotsversiondate\space v\pgfplotsversion\space Table typesetting and Pretty-printing (\pgfplotsrevision)]
|
||||
|
||||
\RequirePackage{pgfplots}
|
||||
|
||||
\def\pgfplots@texdist@protect{\protect}%
|
||||
|
||||
\input pgfplotstable.code.tex
|
||||
|
||||
\RequirePackage{array} % for |dec sep align|
|
||||
|
||||
\endinput
|
38
texmf/tex/latex/pgfplots/tex/pgfplotstable.tex
Normal file
38
texmf/tex/latex/pgfplots/tex/pgfplotstable.tex
Normal file
|
@ -0,0 +1,38 @@
|
|||
%--------------------------------------------
|
||||
%
|
||||
% Package pgfplots
|
||||
%
|
||||
% It is based on Till Tantau's PGF package.
|
||||
%
|
||||
% Copyright 2007/2008 by Christian Feuersänger.
|
||||
%
|
||||
% This program is free software: you can redistribute it and/or modify
|
||||
% 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/>.
|
||||
%
|
||||
%--------------------------------------------
|
||||
% ATTENTION:
|
||||
% you MAY need one of
|
||||
% \def\pgfsysdriver{pgfsys-dvipdfm.def}
|
||||
% \def\pgfsysdriver{pgfsys-pdftex.def}
|
||||
% \def\pgfsysdriver{pgfsys-dvips.def}
|
||||
%
|
||||
% BEFORE the first \input pgf.tex, \input tikz.tex or
|
||||
% \input pgfplots.tex
|
||||
% Default is
|
||||
% 'dvips' for 'tex'
|
||||
% 'pdftex' for 'pdftex'
|
||||
% -> dvipdfm needs special attention.
|
||||
%
|
||||
\input pgfplots.tex%
|
||||
%
|
||||
\endinput
|
1977
texmf/tex/latex/pgfplots/tex/pgfplotstableshared.code.tex
Normal file
1977
texmf/tex/latex/pgfplots/tex/pgfplotstableshared.code.tex
Normal file
File diff suppressed because it is too large
Load diff
2305
texmf/tex/latex/pgfplots/tex/pgfplotsticks.code.tex
Normal file
2305
texmf/tex/latex/pgfplots/tex/pgfplotsticks.code.tex
Normal file
File diff suppressed because it is too large
Load diff
2040
texmf/tex/latex/pgfplots/tex/pgfplotsutil.code.tex
Normal file
2040
texmf/tex/latex/pgfplots/tex/pgfplotsutil.code.tex
Normal file
File diff suppressed because it is too large
Load diff
97
texmf/tex/latex/pgfplots/tex/pgfplotsutil.verb.code.tex
Normal file
97
texmf/tex/latex/pgfplots/tex/pgfplotsutil.verb.code.tex
Normal file
|
@ -0,0 +1,97 @@
|
|||
%--------------------------------------------
|
||||
%
|
||||
% Package pgfplots
|
||||
%
|
||||
% Copyright 2007-2011 by Christian Feuersänger.
|
||||
%
|
||||
% This program is free software: you can redistribute it and/or modify
|
||||
% 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 source file contains helper utilities for verbatim character
|
||||
% processing.
|
||||
|
||||
|
||||
%
|
||||
% USAGE:
|
||||
% \beginpgfplotsverbatim[result/.code={\message{I read #1}}]
|
||||
% <verbatim code>
|
||||
% \endpgfplotsverbatim
|
||||
%
|
||||
% The verbatim code MUST start at the line after the ']' (or after
|
||||
% \beginpgfplotsverbatim if there is no ']')
|
||||
\def\beginpgfplotsverbatim{\pgfutil@ifnextchar[{\beginpgfplotsverbatim@}{\beginpgfplotsverbatim@[]}}
|
||||
\def\beginpgfplotsverbatim@[#1]{%
|
||||
\begingroup
|
||||
\pgfqkeys{/pgfplots/verb}{#1}%
|
||||
\pgfplots@verbatim@prepare@collect
|
||||
\beginpgfplotsverbatim@gobbleuntileol
|
||||
}
|
||||
|
||||
\begingroup
|
||||
\catcode`\|=0
|
||||
\catcode`\\=12
|
||||
|gdef|endpgfplotsverbatim{\endpgfplotsverbatim}%
|
||||
|endgroup
|
||||
|
||||
\expandafter\long\expandafter\def\expandafter\pgfplots@verbatim@collect@until\expandafter#\expandafter1\endpgfplotsverbatim{%
|
||||
\begingroup
|
||||
\pgfplots@verbatim@newline@handler
|
||||
\xdef\pgfplots@glob@TMPa{#1}%
|
||||
\endgroup
|
||||
\pgfkeysgetvalue{/pgfplots/verb/result/.@cmd}\pgfplots@loc@TMPb
|
||||
\global\let\pgfplots@glob@TMPb=\pgfplots@loc@TMPb
|
||||
\endgroup% restore old catcodes etc.
|
||||
\expandafter\pgfplots@glob@TMPb\expandafter{\pgfplots@glob@TMPa}\pgfeov%
|
||||
}%
|
||||
|
||||
\begingroup
|
||||
\long\def\pgfplots@loc@TMPa{
|
||||
}%^^M}%
|
||||
\catcode`\^^M=13 %
|
||||
\gdef\beginpgfplotsverbatim@gobbleuntileol^^M{\pgfplots@verbatim@collect@until}%
|
||||
\gdef\pgfplots@verbatim@newline@toHATHATJ{\def^^M{^^J}}%
|
||||
\xdef\pgfplots@verbatim@newline@IDENTITY{\noexpand\long\noexpand\def\noexpand^^M{\pgfplots@loc@TMPa}}%
|
||||
\endgroup
|
||||
|
||||
\pgfkeys{
|
||||
/pgfplots/verb/result/.code={%
|
||||
\pgfplots@error{Please use \string\beginpgfplotsverbatim[result/.code=....] to configure what to do with the content of \string\beginpgfplotsverbatim...\endpgfplotsverbatim\space (or use \string\pgfplotsset{verb/.cd,result/.code=....} in your preamble)}%
|
||||
},
|
||||
/pgfplots/verb/newline handler/.is choice,
|
||||
/pgfplots/verb/newline handler/to outfile/.code=
|
||||
{\let\pgfplots@verbatim@newline@handler=\pgfplots@verbatim@newline@toHATHATJ},
|
||||
/pgfplots/verb/newline handler/identity/.code=
|
||||
{\let\pgfplots@verbatim@newline@handler=\pgfplots@verbatim@newline@IDENTITY},
|
||||
/pgfplots/verb/newline handler/identity,
|
||||
}
|
||||
|
||||
\def\pgfplots@verbatim@prepare@collect{%
|
||||
\def\do##1{\catcode`##1=12 }\dospecials
|
||||
\catcode`\^^M=13
|
||||
\catcode`\^^J=12
|
||||
\catcode`\^^I=12
|
||||
}%
|
||||
|
||||
\def\pgfplots@verbatim@restore@catcodes{%
|
||||
\catcode`\^^M=5
|
||||
\catcode`\^^J=10
|
||||
\catcode`\^^I=10
|
||||
% this is important to get \scantokens to work: otherwise, it will
|
||||
% eat up the ^^M chars:
|
||||
\endlinechar=`\^^M
|
||||
\newlinechar=\endlinechar
|
||||
}%
|
||||
|
||||
\endinput
|
159
texmf/tex/latex/pgfplots/tex/pgfregressiontest.sty
Normal file
159
texmf/tex/latex/pgfplots/tex/pgfregressiontest.sty
Normal file
|
@ -0,0 +1,159 @@
|
|||
%--------------------------------------------------
|
||||
% Provides a feature for fully automated regression testing of PGF or derived works.
|
||||
%
|
||||
% DEPRECATED.
|
||||
% The idea might be interesting, but it is simply did not work and is
|
||||
% too complicated. Don't use it.
|
||||
%
|
||||
% Idea:
|
||||
% - it is based on the 'external' lib of pgf (which automatically exports each tikzpicture to pdf).
|
||||
% - modification: in addition to the pdf export, call imagemagick's convert
|
||||
% tool to export to png as well and compare the png to a reference image.
|
||||
% - pgfregressiontest.sty provides two modes:
|
||||
% 1) the REFERENCE GENERATION mode
|
||||
% - each image knows a reference revision tag (or the system default)
|
||||
% - the 'system call' makes a "checkout" of the desired revision,
|
||||
% generates the image and returns to the original revision
|
||||
% - the images are stored with a unique prefix.
|
||||
% 2) the COMPARISON mode
|
||||
% - each tikzpicture is compared to its reference image. If there
|
||||
% is none, it should be generated.
|
||||
% - if the comparison fails, a protocol is generated and the user
|
||||
% is alerted.
|
||||
|
||||
%--------------------------------------------------
|
||||
%
|
||||
\ProvidesPackage{pgfregressiontest}[2010/10/31 Version 0.1]
|
||||
|
||||
\RequirePackage{tikz}
|
||||
\usetikzlibrary{external}
|
||||
|
||||
\def\pgfregression@invokecmdkey#1#2{%
|
||||
\pgfkeysvalueof{/pgf/regression/#1/.@cmd}#2\pgfeov
|
||||
}%
|
||||
|
||||
\newif\ifpgfregressionpreamble
|
||||
\pgfregressionpreambletrue
|
||||
|
||||
\def\pgfregressiontestset{\pgfqkeys{/pgf/regression}}%
|
||||
|
||||
\pgfqkeys{/pgf/regression}{%
|
||||
% will be set in \begin{document}
|
||||
system call original/.initial=<not yet set>,
|
||||
%
|
||||
% 'rev checkout' can be used to manually change the environment
|
||||
% state before actually generating the image.
|
||||
% Example:
|
||||
% 'rev checkout=cd ~/code/tex/pgfplots ; git checkout 1.3'
|
||||
% or something like this.
|
||||
%
|
||||
% Use 'rev restore' to immediately undo the effects. All that
|
||||
% stuff is executed in one shell environment, i.e. you can define
|
||||
% and use shell variables.
|
||||
rev checkout/.code=\def\pgfregression@revcheckout{#1},
|
||||
rev checkout={},
|
||||
rev restore/.code=\def\pgfregression@revrestore{#1},
|
||||
rev restore={},
|
||||
reference prefix/.initial=reference_images/,
|
||||
protocol file/.initial=\jobname.protocol.sh,
|
||||
convert to png/.initial={convert "\image.pdf" "\image.png"},%
|
||||
reference mode/.code={
|
||||
\def\pgfregr@replacement@syscall{%
|
||||
\ifx\pgfregression@revcheckout\pgfutil@empty
|
||||
\else
|
||||
\pgfregression@revcheckout;^^J%
|
||||
@echo "'rev checkout' was successful, generating pdf...";^^J%
|
||||
\fi
|
||||
mkdir -p \pgfkeysvalueof{/pgf/regression/reference prefix};^^J%
|
||||
\pgfkeysvalueof{/pgf/regression/system call original}; EXITCODE=$$?; \\^^J%
|
||||
\ifx\pgfregression@revrestore\pgfutil@empty
|
||||
\else
|
||||
\pgfregression@revrestore; \\^^J%
|
||||
echo "'rev restore' was successful.";^^J%
|
||||
\fi
|
||||
@if [ "$$EXITCODE" != "0" ]; then echo "pdf generation failed; Abort"; false; fi;^^J%
|
||||
\pgfkeysvalueof{/pgf/regression/convert to png};^^J%
|
||||
}%
|
||||
\def\pgfregr@style{%
|
||||
\message{^^Jpgfregressiontest: Running in REFERENCE GENERATION mode.^^J}%
|
||||
\pgfqkeys{/pgf/regression}{%
|
||||
/tikz/external/prefix=\pgfkeysvalueof{/pgf/regression/reference prefix},
|
||||
}%
|
||||
}%
|
||||
\ifpgfregressionpreamble
|
||||
\else
|
||||
\pgfkeyslet{/tikz/external/system call}\pgfregr@replacement@syscall
|
||||
\pgfregr@style
|
||||
\fi
|
||||
},
|
||||
comparison mode/.code={
|
||||
\def\pgfregr@replacement@syscall{%
|
||||
\pgfkeysvalueof{/pgf/regression/system call original};^^J%
|
||||
\pgfkeysvalueof{/pgf/regression/convert to png};^^J%
|
||||
diff "\image.png" "\expandafter\expandafter\expandafter\pgfregr@get@reference@image@for\image\relax.png";^^J%
|
||||
if [ ! $? -eq 0 ]; then ^^J
|
||||
echo 'echo "file \image.pdf differs from \expandafter\expandafter\expandafter\pgfregr@get@reference@image@for\image\relax.pdf (displaying differences now)".' >> \pgfkeysvalueof{/pgf/regression/protocol file};^^J
|
||||
echo 'convert "\image.png" "\expandafter\expandafter\expandafter\pgfregr@get@reference@image@for\image\relax.png" -compose difference -composite -colorspace gray miff:- | display' >>\pgfkeysvalueof{/pgf/regression/protocol file};^^J%
|
||||
else^^J
|
||||
rm -f "\image.png";^^J%
|
||||
fi;^^J%
|
||||
}%
|
||||
\def\pgfregr@style{%
|
||||
\message{^^Jpgfregressiontest: Running in COMPARISON mode.^^J}%
|
||||
\expandafter\def\expandafter\pgfregr@get@reference@image@for\tikzexternal@filenameprefix####1\relax{%
|
||||
\pgfkeysvalueof{/pgf/regression/reference prefix}####1%
|
||||
}%
|
||||
}%
|
||||
\ifpgfregressionpreamble
|
||||
\else
|
||||
\pgfkeyslet{/tikz/external/system call}\pgfregr@replacement@syscall
|
||||
\pgfregr@style
|
||||
\fi
|
||||
},
|
||||
comparison mode,
|
||||
}
|
||||
|
||||
% Check for "command line arguments".
|
||||
% if 'pdflatex '\def\referencemode{1}\input{filename}' has been used,
|
||||
% the 'reference mode' will be enabled. Otherwise we are in
|
||||
% 'comparison mode'.
|
||||
\expandafter\ifx\csname referencemode\endcsname\relax
|
||||
\pgfregressiontestset{comparison mode}%
|
||||
\message{^^Jpgfregressiontest: use pdflatex '\string\def\string\referencemode{1}\string\input{\jobname}' to enable reference generation.^^J}%
|
||||
\else
|
||||
\pgfregressiontestset{reference mode}%
|
||||
\fi
|
||||
|
||||
|
||||
\AtBeginDocument{%
|
||||
\tikzifexternalizehasbeencalled{}{%
|
||||
\PackageError{pgfregressiontest}{%
|
||||
Please call \string\tikzexternalize\space somewhere in your preamble. I can only perform my tests together with image externalization}{}%
|
||||
}%
|
||||
\pgfkeysgetvalue{/tikz/external/system call}\pgfregression@temp
|
||||
\pgfkeyslet{/pgf/regression/system call original}\pgfregression@temp
|
||||
%
|
||||
\pgfkeyslet{/tikz/external/system call}\pgfregr@replacement@syscall
|
||||
\pgfregr@style
|
||||
%
|
||||
\immediate\openout\w@pgf@writea=\pgfkeysvalueof{/pgf/regression/protocol file} %
|
||||
\immediate\closeout\w@pgf@writea
|
||||
%
|
||||
\global\pgfregressionpreamblefalse
|
||||
}
|
||||
|
||||
\AtEndDocument{%
|
||||
\openin\r@pgf@reada=\pgfkeysvalueof{/pgf/regression/protocol file} %
|
||||
\ifeof\r@pgf@reada
|
||||
\else
|
||||
\message{
|
||||
^^J%
|
||||
======================================^^J%
|
||||
There have been regression errors.^^J%
|
||||
Use^^J%
|
||||
>> bash \pgfkeysvalueof{/pgf/regression/protocol file}^^J%
|
||||
to visualize them.^^J%
|
||||
======================================^^J%
|
||||
}%
|
||||
\fi
|
||||
}%
|
79
texmf/tex/latex/pgfplots/tex/t-pgfplots.tex
Normal file
79
texmf/tex/latex/pgfplots/tex/t-pgfplots.tex
Normal file
|
@ -0,0 +1,79 @@
|
|||
%--------------------------------------------
|
||||
%
|
||||
% Package pgfplots
|
||||
%
|
||||
% 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 by Christian Feuersänger.
|
||||
%
|
||||
% This program is free software: you can redistribute it and/or modify
|
||||
% 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/>.
|
||||
%
|
||||
%--------------------------------------------
|
||||
|
||||
\writestatus{loading}{ConTeXt User Module / Pgfplots}
|
||||
|
||||
\unprotect
|
||||
|
||||
\startmodule [pgfplots]
|
||||
|
||||
\usemodule[tikz]
|
||||
\usetikzlibrary[plotmarks]
|
||||
|
||||
\edef\tikzatcode{\the\catcode`\@}
|
||||
\edef\tikzbarcode{\the\catcode`\|}
|
||||
\edef\tikzexclaimcode{\the\catcode`\!}
|
||||
\catcode`\@=11
|
||||
\catcode`\|=12
|
||||
\catcode`\!=12
|
||||
|
||||
|
||||
|
||||
\input pgfplots.code.tex
|
||||
|
||||
\def\pgfplotsincludegraphics[#1]#2{\externalfigure[#2][#1]}
|
||||
\pgfkeys{/pgfplots/plot graphics/includegraphics cmd=\pgfplotsincludegraphics}
|
||||
|
||||
|
||||
\let\pgfplots@ORIG@tikz@installcommands@before@context=\tikz@installcommands
|
||||
|
||||
\def\tikz@installcommands{%
|
||||
\pgfplots@ORIG@tikz@installcommands@before@context
|
||||
%
|
||||
\let\startaxis=\pgfplots@environment@axis
|
||||
\let\stopaxis=\endpgfplots@environment@axis
|
||||
%
|
||||
\let\startsemilogxaxis=\pgfplots@environment@semilogxaxis
|
||||
\let\stopsemilogxaxis=\endpgfplots@environment@semilogxaxis
|
||||
%
|
||||
\let\startsemilogyaxis=\pgfplots@environment@semilogyaxis
|
||||
\let\stopsemilogyaxis=\endpgfplots@environment@semilogyaxis
|
||||
%
|
||||
\let\startloglogaxis=\pgfplots@environment@loglogaxis
|
||||
\let\stoploglogaxis=\endpgfplots@environment@loglogaxis
|
||||
%
|
||||
\def\startpgfplotsinterruptdatabb{\pgfplotsinterruptdatabb}%
|
||||
\def\stoppgfplotsinterruptdatabb{\endpgfplotsinterruptdatabb}%
|
||||
}%
|
||||
|
||||
\catcode`\@=\tikzatcode
|
||||
\catcode`\|=\tikzbarcode
|
||||
\catcode`\!=\tikzexclaimcode
|
||||
|
||||
\stopmodule
|
||||
|
||||
\protect
|
||||
\endinput
|
41
texmf/tex/latex/pgfplots/tex/t-pgfplotstable.tex
Normal file
41
texmf/tex/latex/pgfplots/tex/t-pgfplotstable.tex
Normal file
|
@ -0,0 +1,41 @@
|
|||
%--------------------------------------------
|
||||
%
|
||||
% Package pgfplotstable
|
||||
%
|
||||
% It is based on Till Tantau's PGF package.
|
||||
%
|
||||
% Copyright 2007/2008 by Christian Feuersänger.
|
||||
%
|
||||
% This program is free software: you can redistribute it and/or modify
|
||||
% 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/>.
|
||||
%
|
||||
%--------------------------------------------
|
||||
|
||||
\writestatus{loading}{ConTeXt User Module / Pgfplotstable}
|
||||
|
||||
\unprotect
|
||||
|
||||
\startmodule [pgfplotstable]
|
||||
|
||||
\usemodule[pgfplots]
|
||||
|
||||
% FIXME :
|
||||
%\def\pgfplots@texdist@protect{\protect}%
|
||||
|
||||
\input pgfplotstable.code.tex
|
||||
|
||||
|
||||
\stopmodule
|
||||
|
||||
\protect
|
||||
\endinput
|
24
texmf/tex/latex/pgfplots/tex/tikzlibrarydateplot.code.tex
Normal file
24
texmf/tex/latex/pgfplots/tex/tikzlibrarydateplot.code.tex
Normal file
|
@ -0,0 +1,24 @@
|
|||
%--------------------------------------------
|
||||
%
|
||||
% Package pgfplots, library for high-level coordinates.
|
||||
%
|
||||
% Copyright 2007/2008 by Christian Feuersänger.
|
||||
%
|
||||
% This program is free software: you can redistribute it and/or modify
|
||||
% 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/>.
|
||||
%
|
||||
%--------------------------------------------
|
||||
|
||||
\usepgfplotslibrary{dateplot}
|
||||
|
||||
\endinput
|
|
@ -0,0 +1,517 @@
|
|||
%--------------------------------------------
|
||||
%
|
||||
% Package pgfplots
|
||||
%
|
||||
% 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 2013 by Christian Feuersaenger
|
||||
%
|
||||
% This program is free software: you can redistribute it and/or modify
|
||||
% 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 library adds support for a "soft clip" decoration. It applies
|
||||
% clipping to an input path, but rather than simply instructing the
|
||||
% display driver to clip the path, it computes a new clip path from
|
||||
% the input.
|
||||
%
|
||||
% This library is (currently) on top of tikz.
|
||||
|
||||
\pgfutil@IfUndefined{pgfplotsset}{%
|
||||
\pgferror{Please load pgfplots before pgfplots.fillbetween.}%
|
||||
\endinput
|
||||
}{}%
|
||||
|
||||
\usetikzlibrary{intersections}
|
||||
|
||||
\pgfplots@iffileexists{pgflibraryfillbetween.code.tex}{%
|
||||
\usepgflibrary{fillbetween}
|
||||
}{%
|
||||
\pgfplotsusecompatibilityfile{pgflibraryfillbetween.code.tex}%
|
||||
}%
|
||||
|
||||
\pgfutil@IfUndefined{pgfintersectiongetsolutiontimes}{%
|
||||
\pgfplotsusecompatibilityfile{pgflibraryintersections.code.tex}%
|
||||
}{}%
|
||||
|
||||
|
||||
\pgfkeys{
|
||||
% soft clip={(axis cs:0,0) rectangle (axis cs:1,1)}
|
||||
% or
|
||||
% soft clip={A}
|
||||
% where 'A' is defined using 'name path=A' somewhere
|
||||
/pgf/decoration/soft clip path/.code={%
|
||||
% FIXME : I would rather NOT evaluate path arguments in this
|
||||
% context! Who knows how people set keys!? But alas, we cannot
|
||||
% evaluate late because the CM is reset while working on
|
||||
% decorations ... (see below)
|
||||
\tikzlibsoftclip@setkey{\tikzlibsoftclip@setkey@assign}#1\pgf@stop
|
||||
},
|
||||
/pgf/decoration/every soft clipped path/.style={},%
|
||||
}
|
||||
|
||||
% #1 a macro containing a soft path
|
||||
\def\tikzlibsoftclip@setkey@assign#1{%
|
||||
\let\pgf@decoration@soft@clip=#1%
|
||||
}%
|
||||
|
||||
\tikzlibsoftclip@setkey@assign{\pgfutil@empty}%
|
||||
|
||||
\pgfdeclaredecoration{soft clip}{replace}{
|
||||
|
||||
\state{replace}[width=\pgfdecoratedpathlength,
|
||||
persistent precomputation={%
|
||||
% This here is an earlier draft... but alas, the
|
||||
% transformation matrix has been reset in this context,
|
||||
% and we cannot define the clip path dynamically here.
|
||||
% I left it to document that.
|
||||
%
|
||||
%\pgfkeysgetvalue{/pgf/decoration/soft clip path}\pgf@temp
|
||||
%\def\tikz@marshal{\tikzlibsoftclip@setkey{\tikzlibsoftclip@setkey@assign}}%
|
||||
%\expandafter\tikz@marshal\pgf@temp\pgf@stop
|
||||
}
|
||||
]{%
|
||||
\ifx\pgf@decoration@soft@clip\pgfutil@empty
|
||||
\pgfplotsthrow{invalid argument}
|
||||
{\pgf@decoration@soft@clip}%
|
||||
{The mandatory argument 'soft clip path=(A) rectangle (B)' has not been set}%
|
||||
\pgfeov
|
||||
\else
|
||||
\tikzset{/pgf/decoration/every soft clipped path}%
|
||||
\pgfpathcomputesoftclippath{\pgfdecoratedpath}{\pgf@decoration@soft@clip}%
|
||||
\pgfsetpathandBB{\pgfretval}%
|
||||
\fi
|
||||
}
|
||||
}
|
||||
|
||||
% ---------------------------------------------------------------------------------
|
||||
%
|
||||
% SOFT-CLIPPING.
|
||||
%
|
||||
% "softclip" means to get rid of those parts of a path which are
|
||||
% outside of a clip path.
|
||||
%
|
||||
% An example is to trim at the beginning and/or end of a
|
||||
% path as part of fill-between ("poor-mans-clipping").
|
||||
%
|
||||
% The difference to "real" clipping is that it is applied to the
|
||||
% path, not to the viewer -- the path can still be drawn with any
|
||||
% decorations, line widths, etc.
|
||||
%
|
||||
% Another difference is that this feature is (considerably) less sophisticated.
|
||||
%
|
||||
% #1: the input path
|
||||
% #2: the clip path (if it is empty, no clipping will be applied)
|
||||
% OUTPUT:
|
||||
% \pgfretval is #1 with modifications
|
||||
\def\pgfpathcomputesoftclippath#1#2{%
|
||||
\ifx#2\pgfutil@empty
|
||||
\let\pgfretval=#1%
|
||||
\else
|
||||
\ifx#1\pgfutil@empty
|
||||
\let\pgfretval=#1%
|
||||
\else
|
||||
\pgfpathcomputesoftclippath@{#1}{#2}%
|
||||
\fi
|
||||
\fi
|
||||
}
|
||||
|
||||
\def\pgfpathcomputesoftclippath@#1#2{%
|
||||
\begingroup
|
||||
\pgfprocessround{#1}{#1}%
|
||||
\pgfprocessround{#2}{#2}%
|
||||
%
|
||||
%
|
||||
\pgfpathcomputesoftclippath@is@first@outside@of@path{#1}{#2}%
|
||||
\let\b@pgffill@is@outside@clip=\pgfretval
|
||||
%
|
||||
%\message{computing soft clip path for ^^J\meaning#1 and ^^J\meaning#2^^J first point of input is outside of clip path=\b@pgffill@is@outside@clip^^J}%
|
||||
%
|
||||
% FIXME : it might be that I need to sort them ... !? but
|
||||
% other tests indicate that I should not!?
|
||||
%\pgfintersectionsortbyfirstpath
|
||||
\pgf@intersect@sortfalse
|
||||
\pgfintersectionofpaths%
|
||||
{%
|
||||
\pgfsetpath#1%
|
||||
}%
|
||||
{%
|
||||
\pgfsetpath#2%
|
||||
}%
|
||||
%
|
||||
%\message{... num intersections = \pgfintersectionsolutions^^J}%
|
||||
%
|
||||
\ifnum\pgfintersectionsolutions=0 %
|
||||
\if1\b@pgffill@is@outside@clip
|
||||
% entire path is outside of the clipped area.
|
||||
\let\pgfretval=\pgfutil@empty
|
||||
\else
|
||||
\let\pgfretval=#1%
|
||||
\fi
|
||||
\else
|
||||
% split the first involved path into the
|
||||
% segments induced by the intersection points:
|
||||
\pgfcomputeintersectionsegments{1}%
|
||||
\let\pgfpathfilled@a@segments=\pgfretval
|
||||
%
|
||||
% Now, create a new path which contains only those
|
||||
% segments which are INSIDE of the clip path.
|
||||
%
|
||||
% I assume that I can rely on "even/odd" matching: if the
|
||||
% first is inside, the second is outside, the third
|
||||
% inside, etc.
|
||||
\pgfapplistnewempty{pgfretval@tmp}%
|
||||
\def\c@pgfpathfilled@counter{0}%
|
||||
\pgfmathloop
|
||||
\ifnum\c@pgfpathfilled@counter<\pgfpathfilled@a@segments\relax
|
||||
\if0\b@pgffill@is@outside@clip
|
||||
\expandafter\let\expandafter\pgf@loc@path@a\csname pgf@intersect@path@split@a@\c@pgfpathfilled@counter\endcsname
|
||||
\expandafter\pgfapplistpushback\pgf@loc@path@a\to{pgfretval@tmp}%
|
||||
\fi
|
||||
\pgfpathfillbetween@negate\b@pgffill@is@outside@clip
|
||||
%
|
||||
\pgfutil@advancestringcounter\c@pgfpathfilled@counter
|
||||
\repeatpgfmathloop
|
||||
\pgfapplistlet\pgfretval={pgfretval@tmp}%
|
||||
\fi
|
||||
%
|
||||
\global\let\pgf@glob@TMPa=\pgfretval%
|
||||
\endgroup
|
||||
\let\pgfretval=\pgf@glob@TMPa
|
||||
}
|
||||
|
||||
% #1: input path (non-empty)
|
||||
% #2: soft clip path
|
||||
% Defines "\def\pgfretval{1}" if (the first point of #1 is outside or on the path #2)
|
||||
% Defines "\def\pgfretval{0}" if (the first point of #1 is inside of the path #2)
|
||||
\def\pgfpathcomputesoftclippath@is@first@outside@of@path#1#2{%
|
||||
% APPROACH: shoot a line starting at the first coordinate of the
|
||||
% first path through "the middle of #2". Then make an even/odd
|
||||
% check on the number of intersections.
|
||||
%
|
||||
% FIXME : for now, I only support (x,y) rectangle (X,Y) anyway --
|
||||
% optimize for that case!? This here might be too complex...
|
||||
\begingroup
|
||||
\expandafter\pgfpathfillbetween@get@first@coord#1\pgf@stop
|
||||
\let\pgfpathfilled@a@firstcoord=\pgfretval%
|
||||
%
|
||||
% Get some point "in the middle of #2":
|
||||
\pgfpathcomputesoftclippath@accum@pseudo@mean#2%
|
||||
\edef\pgfpathfilled@b@center{\noexpand\pgfqpoint\pgfretval}%
|
||||
%
|
||||
% We have to shoot *through* #2, not just into the middle of #2.
|
||||
% Consequently, we need to know how big #2 is:
|
||||
\pgfpathcomputesoftclippath@is@first@outside@of@path@getBB#2%
|
||||
\let\pgf@size@hint=\pgfretval
|
||||
%
|
||||
% Now, compute a target point such that our shot goes through it:
|
||||
\pgfqpointscale{%
|
||||
\pgf@size@hint
|
||||
}{%
|
||||
\pgfpointnormalised{%
|
||||
\pgfpointdiff%
|
||||
{\expandafter\pgfqpoint\pgfpathfilled@a@firstcoord}%
|
||||
{\pgfpathfilled@b@center}%
|
||||
}%
|
||||
}%
|
||||
% collect intermediate results as \pgf@xa/\pgf@ya are overwritten:
|
||||
\edef\pgf@direction@vector{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}%
|
||||
\pgfpointadd{\pgfpathfilled@b@center}{\pgf@direction@vector}%
|
||||
\edef\pgfpathfilled@shoot@line@trg{{\the\pgf@x}{\the\pgf@y}}%
|
||||
%
|
||||
% this here is our path!
|
||||
\edef\pgf@direction@path{%
|
||||
\noexpand\pgfsyssoftpath@movetotoken\pgfpathfilled@a@firstcoord
|
||||
\noexpand\pgfsyssoftpath@linetotoken\pgfpathfilled@shoot@line@trg
|
||||
}%
|
||||
%
|
||||
% ... ok, compute intersections. This should be fairly fast as
|
||||
% our second path has just 1 segment, i.e. it will be O(N) where N
|
||||
% is the number of segments in #2.
|
||||
\pgf@intersect@sortfalse
|
||||
\pgfintersectionofpaths%
|
||||
{%
|
||||
\pgfsetpath#2%
|
||||
}%
|
||||
{%
|
||||
\pgfsetpath\pgf@direction@path%
|
||||
}%
|
||||
%
|
||||
\ifnum\pgfintersectionsolutions=0 %
|
||||
% this must not happen! We have taken great care such that we
|
||||
% *have* at least 1 intersection points!
|
||||
\pgferror{Illegal state encountered: the computation of a softpath failed. The failure occurred while computing whether the first input coordinate is inside of the clip path (found no intersections)}%
|
||||
\fi
|
||||
%
|
||||
\pgfpathcomputesoftclippath@if@is@first@on@boundary{%
|
||||
% AH! The first point is ON the boundary of the clip path.
|
||||
% This is equivalent to the condition that the first
|
||||
% intersection point equals the first point.
|
||||
%
|
||||
% In this case, we say that it is OUTSIDE of the clip path!
|
||||
%
|
||||
% This is actually related to
|
||||
% 1. the fact that the input path is splitted into segments
|
||||
% induced by the intersection points in order to apply
|
||||
% soft-clipping.
|
||||
% 2. the fact that the clipping is based on an even/odd
|
||||
% matching (in/out).
|
||||
%
|
||||
% In that setup, we want to skip the segment until the first
|
||||
% intersection point - after all, it is "empty" anyway.
|
||||
%
|
||||
% To this end, we have to say that this first (empty) segment
|
||||
% is OUTSIDE:
|
||||
\def\pgfretval{1}%
|
||||
}{%
|
||||
\ifodd\pgfintersectionsolutions\relax%
|
||||
\def\pgfretval{0}%
|
||||
\else
|
||||
\def\pgfretval{1}%
|
||||
\fi
|
||||
}%
|
||||
\pgfmath@smuggleone\pgfretval
|
||||
\endgroup
|
||||
}
|
||||
|
||||
\def\pgfpathcomputesoftclippath@if@is@first@on@boundary#1#2{%
|
||||
\pgfpathcomputesoftclippath@compute@infty@norm{%
|
||||
\pgfpointdiff%
|
||||
{\expandafter\pgfqpoint\pgfpathfilled@a@firstcoord}%
|
||||
{\pgfpointintersectionsolution{1}}%
|
||||
}%
|
||||
\ifdim\pgf@x<\pgfintersectiontolerance\relax
|
||||
% YES: the first point IS on the boundary: the first
|
||||
% intersection solution == first point.
|
||||
#1%
|
||||
\else
|
||||
% No, it is NOT equal to the first intersection solution - and
|
||||
% thus NOT on the boundary.
|
||||
#2%
|
||||
\fi
|
||||
}%
|
||||
|
||||
% Defines \pgf@x to be the infty norm of vector #1
|
||||
\def\pgfpathcomputesoftclippath@compute@infty@norm#1{%
|
||||
\pgf@process{#1}%
|
||||
\ifdim\pgf@x<0sp \global\pgf@x=-\pgf@x\fi
|
||||
\ifdim\pgf@y<0sp \global\pgf@y=-\pgf@y\fi
|
||||
\ifdim\pgf@x<\pgf@y
|
||||
\global\pgf@x=\pgf@y
|
||||
\fi
|
||||
}
|
||||
|
||||
% Defines \pgfretval to be a *scalar* "size indicator" (1-norm) of the bounding
|
||||
% box of #1.
|
||||
%
|
||||
% #1: a macro containing a softpath.
|
||||
\def\pgfpathcomputesoftclippath@is@first@outside@of@path@getBB#1{%
|
||||
\begingroup
|
||||
\pgf@getpathsizes\pgf@interrupt@pathsizes
|
||||
% we only need the path size here:
|
||||
\pgf@relevantforpicturesizefalse
|
||||
%
|
||||
% FIXME : CODE CLEANUP NEEDED
|
||||
\def\pgfsetpathBB@protocol@lastmoveto##1##2{}%
|
||||
\expandafter\pgfsetpath@loop#1\pgf@stop
|
||||
\pgfpointdiff
|
||||
{\pgfqpoint\pgf@pathminx\pgf@pathminy}%
|
||||
{\pgfqpoint\pgf@pathmaxx\pgf@pathmaxy}%
|
||||
% compute |v|_1 = x + y (both components are non-negative anyway):
|
||||
\pgf@xa=\pgf@x
|
||||
\advance\pgf@xa by\pgf@y
|
||||
\xdef\pgf@glob@TMPa{\pgf@sys@tonumber\pgf@xa}%
|
||||
\pgf@setpathsizes\pgf@interrupt@pathsizes
|
||||
\endgroup
|
||||
\let\pgfretval=\pgf@glob@TMPa
|
||||
}%
|
||||
|
||||
% Defines \pgfretval to be of a "pseudo" mean of path #1.
|
||||
%
|
||||
% Here, "pseudo" refers to the fact that the mean will only be
|
||||
% accumulated over the "first couple of coordinates" to avoid numeric
|
||||
% overflows in TeX's math engine.
|
||||
\def\pgfpathcomputesoftclippath@accum@pseudo@mean#1{%
|
||||
\begingroup
|
||||
\let\pgfsyssoftpath@movetotoken\pgfpathcomputesoftclippath@accum@pseudo@mean@
|
||||
\let\pgfsyssoftpath@linetotoken\pgfpathcomputesoftclippath@accum@pseudo@mean@
|
||||
\let\pgfsyssoftpath@closepathtoken\pgfpathcomputesoftclippath@accum@pseudo@mean@
|
||||
\let\pgfsyssoftpath@curvetotoken\pgfpathcomputesoftclippath@accum@pseudo@mean@
|
||||
\let\pgfsyssoftpath@curvetosupportatoken\pgfpathcomputesoftclippath@accum@pseudo@mean@relax
|
||||
\let\pgfsyssoftpath@curvetosupportbtoken\pgfpathcomputesoftclippath@accum@pseudo@mean@relax
|
||||
\c@pgf@countc=0 %
|
||||
\pgf@xa=0pt %
|
||||
\pgf@ya=0pt %
|
||||
#1%
|
||||
\divide\pgf@xa by\c@pgf@countc
|
||||
\divide\pgf@ya by\c@pgf@countc
|
||||
\edef\pgfretval{{\the\pgf@xa}{\the\pgf@ya}}%
|
||||
\pgfmath@smuggleone\pgfretval
|
||||
\endgroup
|
||||
}%
|
||||
\def\pgfpathcomputesoftclippath@accum@pseudo@mean@relax#1#2{}
|
||||
\def\pgfpathcomputesoftclippath@accum@pseudo@mean@#1#2{%
|
||||
\ifnum\c@pgf@countc<4
|
||||
% avoid overflows. 4 must be sufficient for now.
|
||||
\advance\pgf@xa by#1\relax
|
||||
\advance\pgf@ya by#2\relax
|
||||
\advance\c@pgf@countc by1 %
|
||||
\fi
|
||||
}
|
||||
|
||||
|
||||
% #1: of the form '{<x>}{<y>}'
|
||||
% #2: of the form '{<x>}{<y>}'
|
||||
\def\pgfpathfillbetween@check@x@less@than#1#2{%
|
||||
\edef\pgf@temp{#1#2}%
|
||||
\expandafter\pgfpathfillbetween@check@x@less@than@\pgf@temp
|
||||
}%
|
||||
|
||||
% #1: x1
|
||||
% #2: y1
|
||||
% #3: x2
|
||||
% #4: y2
|
||||
\def\pgfpathfillbetween@check@x@less@than@#1#2#3#4{%
|
||||
\ifdim#1>#3\relax
|
||||
% <=
|
||||
\def\pgfretval{0}%
|
||||
\else
|
||||
\def\pgfretval{1}%
|
||||
\fi
|
||||
}%
|
||||
|
||||
\def\pgfpathfillbetween@negate#1{%
|
||||
\if0#1%
|
||||
\def#1{1}%
|
||||
\else
|
||||
\def#1{0}%
|
||||
\fi
|
||||
}
|
||||
|
||||
\pgfkeys{
|
||||
/tikz/soft clip assign/name/.code={\tikzgetnamedpath{#1}},
|
||||
/tikz/soft clip assign/path/.code={\tikzlibsoftclip@setkey@@#1\pgf@stop},
|
||||
}
|
||||
|
||||
%
|
||||
% \tikzlibsoftclip@setkey{<\macro>} <path name>\pgf@stop
|
||||
%
|
||||
% OR
|
||||
%
|
||||
% \tikzlibsoftclip@setkey{<\macro>} (<A>) rectangle (<B>)\pgf@stop
|
||||
%
|
||||
% #1: a macro which is called with the resulting clip path as argument #1.
|
||||
\def\tikzlibsoftclip@setkey#1#2\pgf@stop{%
|
||||
\pgfutil@in@{=}{#2}%
|
||||
\ifpgfutil@in@
|
||||
\pgfqkeys{/tikz/soft clip assign}{#2}%
|
||||
\else
|
||||
\def\pgf@temp{#2}%
|
||||
\pgfplots@command@to@string\pgf@temp\pgf@temp
|
||||
%
|
||||
\tikzifisnamedpath{\pgf@temp}{%
|
||||
\pgfkeysalso{/tikz/soft clip assign/name={#2}}%
|
||||
}{%
|
||||
\pgfkeysalso{/tikz/soft clip assign/path={#2}}%
|
||||
}%
|
||||
\fi
|
||||
#1{\pgfretval}%
|
||||
}
|
||||
|
||||
\def\tikzlibsoftclip@setkey@@{%
|
||||
%
|
||||
\tikz@scan@one@point\tikzlibsoftclip@setkey@bb@scan@a
|
||||
}%
|
||||
|
||||
\def\tikzlibsoftclip@setkey@bb@scan@a#1{%
|
||||
\def\tikzlibsoftclip@setkey@bb@a{#1}%
|
||||
\pgfutil@ifnextchar r{%
|
||||
\tikzlibsoftclip@setkey@bb@scan@rectangle
|
||||
}{%
|
||||
\tikzlibsoftclip@setkey@@error
|
||||
}%
|
||||
}%
|
||||
|
||||
\def\tikzlibsoftclip@setkey@bb@scan@rectangle rectangle{%
|
||||
\tikz@scan@one@point\tikzlibsoftclip@setkey@bb@scan@b
|
||||
}%
|
||||
|
||||
\def\tikz@gobble@until@stop#1\pgf@stop{}%
|
||||
|
||||
\def\tikzlibsoftclip@setkey@bb@scan@b#1{%
|
||||
\def\tikzlibsoftclip@setkey@bb@b{#1}%
|
||||
\pgfutil@ifnextchar \pgf@stop{%
|
||||
\tikzlibsoftclip@setkey@@activate
|
||||
\tikz@gobble@until@stop
|
||||
}{%
|
||||
\tikzlibsoftclip@setkey@@error
|
||||
}%
|
||||
}%
|
||||
|
||||
\def\tikzlibsoftclip@setkey@@error#1\pgf@stop{%
|
||||
\def\pgfplots@loc@TMPa{#1}%
|
||||
\pgfplots@command@to@string\pgfplots@loc@TMPa\pgfplots@loc@TMPb
|
||||
\pgfplotsthrow{invalid argument}
|
||||
{\pgfplots@loc@TMPa}%
|
||||
{fill between: the argument of 'soft clip' has an unexpected format near '\pgfplots@loc@TMPb'; expected '(<pt>) rectangle (<pt>)'}%
|
||||
\pgfeov
|
||||
}%
|
||||
|
||||
% INPUT:
|
||||
% - two PGF points \tikzlibsoftclip@setkey@bb@a and \tikzlibsoftclip@setkey@bb@b.
|
||||
%
|
||||
% POSTCONDITION: \pgfretval contains the resulting path.
|
||||
\def\tikzlibsoftclip@setkey@@activate{%
|
||||
% Expand points to {<x>}{<y>} ...
|
||||
\pgf@process{\tikzlibsoftclip@setkey@bb@a}%
|
||||
\edef\tikzlibsoftclip@setkey@bb@a{{\the\pgf@x}{\the\pgf@y}}%
|
||||
\pgf@process{\tikzlibsoftclip@setkey@bb@b}%
|
||||
\edef\tikzlibsoftclip@setkey@bb@b{{\the\pgf@x}{\the\pgf@y}}%
|
||||
%
|
||||
\pgfinterruptpath
|
||||
\pgf@relevantforpicturesizefalse%
|
||||
\expandafter\pgfqpoint\tikzlibsoftclip@setkey@bb@a
|
||||
\pgf@xa=\pgf@x
|
||||
\pgf@ya=\pgf@y
|
||||
\expandafter\pgfqpoint\tikzlibsoftclip@setkey@bb@b
|
||||
\pgf@xb=\pgf@x
|
||||
\pgf@yb=\pgf@y
|
||||
%
|
||||
\pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@ya}}%
|
||||
\pgfpathlineto{\pgfqpoint{\pgf@xa}{\pgf@yb}}%
|
||||
\pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yb}}%
|
||||
\pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@ya}}%
|
||||
\pgfpathclose
|
||||
\pgfgetpath\pgfplots@loc@TMPa
|
||||
\global\let\pgfplots@glob@TMPa=\pgfplots@loc@TMPa
|
||||
\endpgfinterruptpath
|
||||
%
|
||||
\let\pgfretval=\pgfplots@glob@TMPa
|
||||
}%
|
||||
% ---------------------------------------------------------------------------------
|
||||
|
||||
% Executes #2 if #1 is a named path and #3 otherwise.
|
||||
\def\tikzifisnamedpath#1#2#3{%
|
||||
\pgfutil@IfUndefined{tikz@intersect@path@name@#1}{%
|
||||
\def\tikz@next{#3}%
|
||||
}{%
|
||||
\def\tikz@next{#2}%
|
||||
}%
|
||||
\tikz@next
|
||||
}%
|
||||
|
||||
|
577
texmf/tex/latex/pgfplots/tex/tikzlibraryfillbetween.code.tex
Normal file
577
texmf/tex/latex/pgfplots/tex/tikzlibraryfillbetween.code.tex
Normal file
|
@ -0,0 +1,577 @@
|
|||
%--------------------------------------------
|
||||
%
|
||||
% Package pgfplots
|
||||
%
|
||||
% 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 2013 by Christian Feuersaenger
|
||||
%
|
||||
% This program is free software: you can redistribute it and/or modify
|
||||
% 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 library adds support for high-level instructions for "fill area
|
||||
% between two arbitrary plots of functions".
|
||||
%
|
||||
% It activates the syntax \pgfpathfillbetween
|
||||
% where A and B are two plots named by 'name path='.
|
||||
%
|
||||
% In fact, this here is not much more than a low-level invocation of
|
||||
% \pgfpathfillbetween
|
||||
% and a couple of styles. It could become a TikZ library because it
|
||||
% actually works on any two named paths, but it has its restrictions
|
||||
% regarding the supported input paths: both need to be plots of
|
||||
% functions (non-intersecting, should have at most one function value
|
||||
% for each canvas X coord)
|
||||
|
||||
\pgfutil@IfUndefined{pgfplotsset}{%
|
||||
\pgferror{Please load pgfplots before pgfplots.fillbetween.}%
|
||||
\endinput
|
||||
}{}%
|
||||
|
||||
\usetikzlibrary{intersections}
|
||||
\usetikzlibrary{decorations.softclip}
|
||||
|
||||
% COMPATIBILITY WITH PGF RELEASE:
|
||||
\pgfutil@IfUndefined{pgfintersectiongetsolutiontimes}{%
|
||||
\pgfplotsusecompatibilityfile{pgflibraryintersections.code.tex}%
|
||||
}{}%
|
||||
\def\tikz@key@name@path@wrong#1#2{%
|
||||
\tikz@addmode{%
|
||||
\pgfsyssoftpath@getcurrentpath\tikz@intersect@temppath@round%
|
||||
\pgfprocessround\tikz@intersect@temppath@round\tikz@intersect@temppath%
|
||||
\ifx\tikz@intersect@namedpaths\pgfutil@empty%
|
||||
\else%
|
||||
\tikz@intersect@namedpaths%
|
||||
\pgfutil@ifundefined{tikz@intersect@path@name@#1}{}%
|
||||
{%
|
||||
\expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter\tikz@intersect@@temppath%
|
||||
\expandafter\expandafter\expandafter{\csname tikz@intersect@path@name@#1\endcsname}%
|
||||
\expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter\tikz@intersect@temppath%
|
||||
\expandafter\expandafter\expandafter{\expandafter\tikz@intersect@temppath\tikz@intersect@temppath}%
|
||||
}%
|
||||
\fi%
|
||||
\tikz@intersect@addto@path@names{#1}{#2}%
|
||||
}%
|
||||
}%
|
||||
|
||||
\def\tikz@key@name@path@new#1#2{%
|
||||
\tikz@addmode{%
|
||||
\pgfsyssoftpath@getcurrentpath\tikz@intersect@temppath@round%
|
||||
\pgfprocessround\tikz@intersect@temppath@round\tikz@intersect@temppath%
|
||||
\ifx\tikz@intersect@namedpaths\pgfutil@empty%
|
||||
\else%
|
||||
\tikz@intersect@namedpaths%
|
||||
\fi%
|
||||
\tikz@intersect@addto@path@names{#1}{#2}%
|
||||
}%
|
||||
}%
|
||||
|
||||
\ifx\tikz@key@name@path@wrong\tikz@key@name@path
|
||||
\immediate\write16{Package pgfplots: loading complementary 'name path' implementation for your pgf version...}
|
||||
\let\tikz@key@name@path=\tikz@key@name@path@new
|
||||
\fi
|
||||
|
||||
% ------------------------------------------------------------
|
||||
|
||||
\newif\iftikzfillbetween@optimize@name@intersections
|
||||
|
||||
\pgfkeys{%
|
||||
/tikz/fill between/of/.code=\tikzlibraryfillbetween@parse#1\pgf@stop,
|
||||
%
|
||||
/tikz/fill between/on layer/.initial=pre main,
|
||||
/tikz/fill between/every segment/.style={},
|
||||
/tikz/fill between/every odd segment/.style={},
|
||||
/tikz/fill between/every even segment/.style={},
|
||||
/tikz/fill between/every last segment/.style={},
|
||||
%
|
||||
% Allows to add path instructions *after* the segment.
|
||||
% If you want to add some *before* the segment, you can rely on
|
||||
% 'every segment no 0/.style={ ... suitable tikz options ... }'
|
||||
/tikz/fill between/path after segment/.initial={},
|
||||
%
|
||||
% soft clip={(axis cs:0,0) rectangle (axis cs:1,1)}
|
||||
/tikz/fill between/soft clip/.style={
|
||||
/tikz/fill between/soft clip first={#1},%
|
||||
/tikz/fill between/soft clip second={#1},%
|
||||
},%
|
||||
/tikz/fill between/soft clip first/.initial=,%
|
||||
/tikz/fill between/soft clip second/.initial=,
|
||||
%
|
||||
% #1: drawing options.
|
||||
/tikz/fill between/@draw style/.style={
|
||||
/pgf/fill between/result stream/begin/.code={%
|
||||
\gdef\tikzsegmentindex{0}%
|
||||
\xdef\tikzsegmentindices{##1}%
|
||||
\c@pgf@countc=##1 %
|
||||
\advance\c@pgf@countc by-1 %
|
||||
\xdef\tikzsegmentlastindex{\the\c@pgf@countc}%
|
||||
},%
|
||||
/pgf/fill between/result stream/next ready/.code={%
|
||||
\let\pgflibraryfill@path=\pgfretval
|
||||
\def\pgfplots@loc@TMPa{%
|
||||
/tikz/fill between/every segment,
|
||||
#1,%
|
||||
/tikz/fill between/every segment no \tikzsegmentindex/.try,
|
||||
}%
|
||||
\ifodd\tikzsegmentindex\relax
|
||||
\expandafter\def\expandafter\pgfplots@loc@TMPa\expandafter{\pgfplots@loc@TMPa
|
||||
/tikz/fill between/every odd segment,
|
||||
}%
|
||||
\else
|
||||
\expandafter\def\expandafter\pgfplots@loc@TMPa\expandafter{\pgfplots@loc@TMPa
|
||||
/tikz/fill between/every even segment,
|
||||
}%
|
||||
\fi
|
||||
%
|
||||
\ifnum\tikzsegmentindex=\tikzsegmentlastindex\relax
|
||||
\expandafter\def\expandafter\pgfplots@loc@TMPa\expandafter{\pgfplots@loc@TMPa
|
||||
/tikz/fill between/every last segment,
|
||||
}%
|
||||
\fi
|
||||
%
|
||||
\expandafter\fill\expandafter[\pgfplots@loc@TMPa]
|
||||
\pgfextra
|
||||
\pgfsetpathandBB{\pgflibraryfill@path}%
|
||||
\pgfkeysgetvalue{/tikz/fill between/path after segment}\tikz@fillbetween@post@segment
|
||||
\expandafter
|
||||
\endpgfextra
|
||||
\tikz@fillbetween@post@segment
|
||||
;%
|
||||
\pgfplotsutil@advancestringcounter@global\tikzsegmentindex
|
||||
},%
|
||||
/pgf/fill between/result stream/end/.code=,%
|
||||
},
|
||||
/tikz/fill between/.search also={/pgf/fill between,/pgfplots},
|
||||
/tikz/fill between/optimize name intersections/.is if=tikzfillbetween@optimize@name@intersections,
|
||||
%
|
||||
% FIXME : this optimization needs much more work... I believe it
|
||||
% would be stable enough, but it covers too few cases.
|
||||
%/tikz/fill between/optimize name intersections=true,
|
||||
%
|
||||
%
|
||||
%
|
||||
%--------------------------------------------------
|
||||
% /pgfplots/execute at begin axis@@/.add={%
|
||||
% \def\b@pgfplotslibraryfill@added
|
||||
% }{%
|
||||
%
|
||||
% },%
|
||||
%--------------------------------------------------
|
||||
}
|
||||
|
||||
\def\tikzlibraryfillbetween@parse#1 and #2\pgf@stop{%
|
||||
\def\tikz@fillbetween@a{#1}%
|
||||
\def\tikz@fillbetween@b{#2}%
|
||||
}%
|
||||
|
||||
% \tikzfillbetween[<options>]{<draw style>}
|
||||
%
|
||||
% <options> must contain 'of=<A> and <B>' and may configure how the
|
||||
% area is computed.
|
||||
%
|
||||
% <draw style> affects every drawn region.
|
||||
%
|
||||
\def\tikzfillbetween{\pgfutil@ifnextchar[{\tikzfillbetween@opt}{\tikzfillbetween@opt[]}}
|
||||
\def\tikzfillbetween@opt[#1]#2{%
|
||||
\begingroup
|
||||
\pgfqkeys{/tikz/fill between}{%
|
||||
% prepare the low-level path generation instruction(s):
|
||||
/tikz/fill between/@draw style={#2},%
|
||||
%
|
||||
% set up input options:
|
||||
#1,%
|
||||
}%
|
||||
% automagically try to use the correct layer:
|
||||
\pgfkeysgetvalue{/tikz/fill between/on layer}\tikzlibraryfillbetween@path@layer@name
|
||||
\tikzlibraryfillbetween@determine@layer
|
||||
%
|
||||
\ifx\tikzlibraryfillbetween@path@layer@name\pgfutil@empty \else
|
||||
\pgfonlayer{\tikzlibraryfillbetween@path@layer@name}%
|
||||
\fi
|
||||
%
|
||||
\tikzlibraryfillbetween@path@generatepath
|
||||
%
|
||||
\ifx\tikzlibraryfillbetween@path@layer@name\pgfutil@empty \else
|
||||
\endpgfonlayer%
|
||||
\fi
|
||||
%
|
||||
\endgroup
|
||||
}%
|
||||
|
||||
% Defines \tikzlibraryfillbetween@path@layer@name
|
||||
\def\tikzlibraryfillbetween@determine@layer{%
|
||||
\ifx\tikzlibraryfillbetween@path@layer@name\pgfutil@empty
|
||||
\else
|
||||
\pgfutil@IfUndefined{pgf@layerlist}{%
|
||||
% hm. No layers active!? A pity...
|
||||
\tikzlibraryfillbetween@path@warn@layer
|
||||
\let\tikzlibraryfillbetween@path@layer@name\pgfutil@empty%
|
||||
}{%
|
||||
\edef\pgfplots@loc@TMPa{\noexpand\pgfutil@in@{\tikzlibraryfillbetween@path@layer@name}}%
|
||||
\expandafter\pgfplots@loc@TMPa\expandafter{\pgf@layerlist}%
|
||||
\ifpgfutil@in@
|
||||
\else
|
||||
\tikzlibraryfillbetween@path@warn@layer
|
||||
\let\tikzlibraryfillbetween@path@layer@name\pgfutil@empty%
|
||||
\fi
|
||||
}%
|
||||
\fi
|
||||
}%
|
||||
|
||||
\def\tikzlibraryfillbetween@path@warn@layer{%
|
||||
\pgfplots@warning{'fill between': Could not activate graphics layer '\tikzlibraryfillbetween@path@layer@name'. Filled path will be on top of the other ones. Please ensure that '\tikzlibraryfillbetween@path@layer@name' is somewhere in the layer list (or set '/tikz/fill between/on layer=').}%
|
||||
}%
|
||||
|
||||
\def\tikzlibraryfillbetween@parse@softclip{%
|
||||
\pgfkeysgetvalue{/tikz/fill between/soft clip first}\pgf@temp
|
||||
\pgfkeysgetvalue{/tikz/fill between/soft clip second}\pgf@tempb
|
||||
\ifx\pgf@temp\pgf@tempb
|
||||
% Ah - both have the same value!
|
||||
\ifx\pgf@temp\pgfutil@empty
|
||||
% ... and both are empty.
|
||||
\pgffillbetweensetsoftclippath{\pgfutil@empty}%
|
||||
\else
|
||||
% ... and both contain some path! Process it (once):
|
||||
\def\tikz@marshal{\tikzlibsoftclip@setkey{\pgffillbetweensetsoftclippath}}%
|
||||
\expandafter\tikz@marshal\pgf@temp\pgf@stop
|
||||
\fi
|
||||
\else
|
||||
% handle 'soft clip first':
|
||||
\ifx\pgf@temp\pgfutil@empty
|
||||
\pgffillbetweensetsoftclippathfirst{\pgfutil@empty}%
|
||||
\else
|
||||
\def\tikz@marshal{\tikzlibsoftclip@setkey{\pgffillbetweensetsoftclippathfirst}}%
|
||||
\expandafter\tikz@marshal\pgf@temp\pgf@stop
|
||||
\fi
|
||||
%
|
||||
% handle 'soft clip second':
|
||||
\pgfkeysgetvalue{/tikz/fill between/soft clip second}\pgf@tempb
|
||||
\ifx\pgf@tempb\pgfutil@empty
|
||||
\pgffillbetweensetsoftclippathsecond{\pgfutil@empty}%
|
||||
\else
|
||||
\def\tikz@marshal{\tikzlibsoftclip@setkey{\pgffillbetweensetsoftclippathsecond}}%
|
||||
\expandafter\tikz@marshal\pgf@tempb\pgf@stop
|
||||
\fi
|
||||
\fi
|
||||
}%
|
||||
|
||||
\def\tikzlibraryfillbetween@path@generatepath{%
|
||||
%
|
||||
\tikzlibraryfillbetween@parse@softclip
|
||||
%
|
||||
\tikzlibraryfillbetween@path@check
|
||||
\expandafter\let\expandafter\tikz@fillbetween@a@path
|
||||
\csname tikz@intersect@path@name@\tikz@fillbetween@a\endcsname
|
||||
\expandafter\let\expandafter\tikz@fillbetween@b@path
|
||||
\csname tikz@intersect@path@name@\tikz@fillbetween@b\endcsname
|
||||
%
|
||||
\iftikzfillbetween@optimize@name@intersections
|
||||
\ifpgfpathfillbetween@split
|
||||
\tikzfillbetween@optimize@name@intersections\tikz@fillbetween@a\tikz@fillbetween@b
|
||||
\fi
|
||||
\fi
|
||||
%
|
||||
\pgfpathfillbetween{\tikz@fillbetween@a@path}{\tikz@fillbetween@b@path}%
|
||||
}%
|
||||
|
||||
\def\tikzlibraryfillbetween@path@check{%
|
||||
\pgfutil@IfUndefined{tikz@intersect@path@name@\tikz@fillbetween@a}{%
|
||||
\pgferror
|
||||
{fill between: the mandatory argument 'of=<name path A> and <name path B> is missing or has empty arguments. Please ensure that the option has been set and that both path names have been assigned (perhaps you need 'name path global=\tikz@fillbetween@a' somewhere?)}%
|
||||
}{}%
|
||||
\pgfutil@IfUndefined{tikz@intersect@path@name@\tikz@fillbetween@b}{%
|
||||
\pgferror
|
||||
{fill between: the mandatory argument 'of=<name path A> and <name path B> is missing or has empty arguments. Please ensure that the option has been set and that both path names have been assigned (perhaps you need 'name path global=\tikz@fillbetween@b' somewhere?)}%
|
||||
}{}%
|
||||
}
|
||||
|
||||
|
||||
%-----------------------------------------
|
||||
%
|
||||
% Utilities to work with path segments
|
||||
%
|
||||
%-----------------------------------------
|
||||
|
||||
% Defines \pgfretval such that it contains the named path '#1'
|
||||
\def\tikzgetnamedpath#1{%
|
||||
\pgfutil@IfUndefined{tikz@intersect@path@name@#1}{%
|
||||
\pgferror{There is no named path called '#1'. Perhaps you misspelled it?}%
|
||||
}{%
|
||||
\expandafter\let\expandafter\pgfretval
|
||||
\csname tikz@intersect@path@name@#1\endcsname
|
||||
}%
|
||||
}%
|
||||
|
||||
\def\tikznamecurrentpath#1{%
|
||||
\pgfgetpath\pgf@temp
|
||||
\pgfprocessround\pgf@temp\pgf@tempb%
|
||||
\expandafter\global\expandafter\let\csname tikz@intersect@path@name@#1\endcsname=\pgf@tempb
|
||||
}%
|
||||
|
||||
% ---------------------------------------------------------------------------------------
|
||||
|
||||
\newif\iftikzpathsegments@reverse
|
||||
\def\tikzlibrarysegments@parse#1 and #2\pgf@stop{%
|
||||
\def\tikz@path@segments@a{#1}%
|
||||
\def\tikz@path@segments@b{#2}%
|
||||
}%
|
||||
|
||||
|
||||
\pgfkeys{
|
||||
% allows to append intersection segments to the current path by
|
||||
% writing
|
||||
% \path[intersection segments={of=first and second, sequence=A0 -- B1 -- B3 A3[reverse] -- A1}];
|
||||
/tikz/intersection segments/.code={%
|
||||
\tikzpathintersectionsegments[#1]%
|
||||
},
|
||||
/tikz/segments/of/.code=\tikzlibrarysegments@parse#1\pgf@stop,
|
||||
/tikz/segments/of={} and {},
|
||||
/tikz/segments/sequence/.initial=A0 -- B1,
|
||||
/tikz/segments/reverse/.is if=tikzpathsegments@reverse,
|
||||
/tikz/segments/reverse/.default=true,
|
||||
}
|
||||
|
||||
% Programmatic method to do the same as 'intersection
|
||||
% segments={<options>}
|
||||
%
|
||||
% #1: <options>
|
||||
\def\tikzpathintersectionsegments[#1]{%
|
||||
\begingroup
|
||||
\pgfqkeys{/tikz/segments}{#1}%
|
||||
\tikzgetnamedpath{\tikz@path@segments@a}%
|
||||
\let\tikz@path@segments@A=\pgfretval
|
||||
\tikzgetnamedpath{\tikz@path@segments@b}%
|
||||
\let\tikz@path@segments@B=\pgfretval
|
||||
%
|
||||
% this macro will be called whenever we need an intersection
|
||||
% segment. Perhaps we do not need it at all
|
||||
\def\tikz@ensurehascomputedintersection{%
|
||||
% compute intersections using the PGF intersection lib...
|
||||
\pgfintersectionofpaths{\pgfsetpath\tikz@path@segments@A}{\pgfsetpath\tikz@path@segments@B}%
|
||||
%
|
||||
\ifnum\pgfintersectionsolutions=0 %
|
||||
\pgferror{The argument of 'sequence' requests an intersection segment -- but the two input paths do not intersect. Please use A* or B* to select the whole path}%
|
||||
\def\b@tikz@select@all{1}%
|
||||
\else
|
||||
%
|
||||
% ... and compute the intersection *segments* for both input
|
||||
% paths...
|
||||
\pgfcomputeintersectionsegments1%
|
||||
\pgfcomputeintersectionsegments2%
|
||||
\fi
|
||||
\let\tikz@ensurehascomputedintersection=\relax
|
||||
}%
|
||||
%
|
||||
\pgfkeysgetvalue{/tikz/segments/sequence}\tikz@sequence
|
||||
%
|
||||
\def\b@tikz@isect@nextismoveto{1}%
|
||||
\let\pgfpointlastofsetpath=\pgfutil@empty
|
||||
\expandafter\tikzpathintersectionsegments@parse@loop\tikz@sequence\pgf@stop
|
||||
\pgfmath@smuggleone\pgfpointlastofsetpath
|
||||
\endgroup
|
||||
\tikz@make@last@position{\pgfpointlastofsetpath}%
|
||||
}%
|
||||
|
||||
\def\tikzpathintersectionsegments@parse@loop{%
|
||||
\pgfutil@ifnextchar-{%
|
||||
\tikz@isect@p@lineto
|
||||
}{%
|
||||
\pgfutil@ifnextchar A{%
|
||||
\tikz@isect@p@next
|
||||
}{%
|
||||
\pgfutil@ifnextchar B{%
|
||||
\tikz@isect@p@next
|
||||
}{%
|
||||
\pgfutil@ifnextchar L{%
|
||||
\tikz@isect@p@next
|
||||
}{%
|
||||
\pgfutil@ifnextchar R{%
|
||||
\tikz@isect@p@next
|
||||
}{%
|
||||
\pgfutil@ifnextchar\pgf@stop{%
|
||||
\tikz@isect@finish
|
||||
}{%
|
||||
\tikz@isect@p@error
|
||||
}%
|
||||
}%
|
||||
}%
|
||||
}%
|
||||
}%
|
||||
}%
|
||||
}%
|
||||
|
||||
\def\tikz@isect@finish\pgf@stop{}%
|
||||
|
||||
\def\tikz@isect@p@lineto--{%
|
||||
\def\b@tikz@isect@nextismoveto{0}%
|
||||
\tikzpathintersectionsegments@parse@loop
|
||||
}%
|
||||
|
||||
\def\tikz@isect@p@error#1\pgf@stop{%
|
||||
\pgferror{The argument of 'sequence' has an unexpected format near '#1'. Please write something like A0 -- B1 -- A1}%
|
||||
}
|
||||
|
||||
\def\tikz@isect@p@next#1#2{%
|
||||
\def\tikz@temp{#2}%
|
||||
\def\tikz@@temp{-}%
|
||||
\ifx\tikz@@temp\tikz@temp
|
||||
% also accept minus signs without curly braces, i.e.
|
||||
% L-2 instead of L{-2}
|
||||
\def\tikz@next{\tikz@isect@p@next@{#1}{#2}}%
|
||||
\else
|
||||
\def\tikz@next{\tikz@isect@p@next@{#1}{#2}{}}%
|
||||
\fi
|
||||
\tikz@next
|
||||
}%
|
||||
\def\tikz@isect@p@next@#1#2#3{%
|
||||
\pgfutil@ifnextchar[{%
|
||||
\tikz@isect@p@next@opt{#1}{#2#3}%
|
||||
}{%
|
||||
\tikz@isect@p@next@opt{#1}{#2#3}[]%
|
||||
}%
|
||||
}%
|
||||
|
||||
\def\tikz@isect@p@next@opt#1#2[#3]{%
|
||||
\begingroup
|
||||
%
|
||||
% set keys (if any):
|
||||
\def\tikz@temp{#3}%
|
||||
\ifx\tikz@temp\pgfutil@empty
|
||||
\else
|
||||
\pgfqkeys{/tikz/segments}{#3}%
|
||||
\fi
|
||||
%
|
||||
\def\tikz@indexshift{}%
|
||||
\if A#1%
|
||||
% FIRST function (0-based index)
|
||||
\def\tikz@path{1}%
|
||||
\def\tikz@path@ab{A}%
|
||||
\else
|
||||
\if B#1%
|
||||
% SECOND function (0-based index)
|
||||
\def\tikz@path{2}%
|
||||
\def\tikz@path@ab{B}%
|
||||
\else
|
||||
\if L#1%
|
||||
% FIRST function (1-based index)
|
||||
\def\tikz@path{1}%
|
||||
\def\tikz@indexshift{-1}%
|
||||
\def\tikz@path@ab{A}%
|
||||
\else
|
||||
\if R#1%
|
||||
% SECOND function (1-based index)
|
||||
\def\tikz@path{2}%
|
||||
\def\tikz@indexshift{-1}%
|
||||
\def\tikz@path@ab{B}%
|
||||
\else
|
||||
\def\tikz@path{}%
|
||||
\pgferror{The argument of 'sequence' has an unexpected format near '#1#2': expected L#2 or R#2}%
|
||||
\fi
|
||||
\fi
|
||||
\fi
|
||||
\fi
|
||||
%
|
||||
% parse arguments:
|
||||
\def\pgfmathresult{#2}%
|
||||
\def\tikz@temp{*}%
|
||||
\ifx\pgfmathresult\tikz@temp
|
||||
\def\b@tikz@select@all{1}%
|
||||
\else
|
||||
\def\b@tikz@select@all{0}%
|
||||
\tikz@ensurehascomputedintersection
|
||||
\pgfmathparse{round(#2)}%
|
||||
\let\tikz@index=\pgfmathresult
|
||||
\ifx\tikz@indexshift\pgfutil@empty
|
||||
\else
|
||||
\afterassignment\pgfutil@gobble@until@relax
|
||||
\c@pgf@countc=\tikz@index\relax
|
||||
\ifnum\c@pgf@countc<0 \else
|
||||
% the index shift is ONLY for positive numbers: we
|
||||
% want to start indexing at 1, not at 0 -- and the
|
||||
% negative ones start at -1 anyway.
|
||||
\advance\c@pgf@countc by\tikz@indexshift\relax
|
||||
\edef\tikz@index{\the\c@pgf@countc}%
|
||||
\fi
|
||||
\fi
|
||||
\fi
|
||||
%
|
||||
%
|
||||
% PROCESS IT:
|
||||
\ifx\tikz@path\pgfutil@empty
|
||||
\let\pgfpointlastofsetpath=\pgfutil@empty
|
||||
\else
|
||||
\if1\b@tikz@select@all%
|
||||
% ok... select the *entire* path.
|
||||
% #1 = A|B :
|
||||
\expandafter\let\expandafter\pgfretval\csname tikz@path@segments@\tikz@path@ab\endcsname
|
||||
\else
|
||||
\pgfgetintersectionsegmentpath{\tikz@path}{\tikz@index}%
|
||||
\fi
|
||||
\iftikzpathsegments@reverse
|
||||
\pgf@reverse@path\pgfretval
|
||||
\fi
|
||||
\if0\b@tikz@isect@nextismoveto
|
||||
\pgfpathreplacefirstmoveto\pgfretval
|
||||
\fi
|
||||
\pgfaddpathandBB\pgfretval
|
||||
\fi
|
||||
\pgfmath@smuggleone\pgfpointlastofsetpath
|
||||
\endgroup
|
||||
\def\b@tikz@isect@nextismoveto{1}%
|
||||
\tikzpathintersectionsegments@parse@loop
|
||||
}%
|
||||
|
||||
\def\tikzfillbetween@optimize@name@intersections#1#2{%
|
||||
\edef\tikzfillbetween@precached@intersectionofpaths@A{#1}%
|
||||
\edef\tikzfillbetween@precached@intersectionofpaths@B{#2}%
|
||||
\pgfkeys{%
|
||||
/tikz/name intersections/.add code={%
|
||||
\let\pgfintersectionofpaths=\tikzfillbetween@precached@intersectionofpaths
|
||||
}{%
|
||||
\let\pgfintersectionofpaths=\pgfintersectionofpaths@orig
|
||||
}
|
||||
}%
|
||||
}%
|
||||
|
||||
\let\pgfintersectionofpaths@orig=\pgfintersectionofpaths
|
||||
|
||||
\def\tikzfillbetween@precached@intersectionofpaths@log{%
|
||||
\immediate\write-1{fill between: outcome of 'name intersections={of=\tikz@intersect@path@a\space and \tikz@intersect@path@b}' has been computed from available information of fill between}%
|
||||
}
|
||||
\def\tikzfillbetween@precached@intersectionofpaths#1#2{%
|
||||
\def\pgf@loc@TMPa{0}%
|
||||
\ifx\tikz@intersect@path@a\tikzfillbetween@precached@intersectionofpaths@A
|
||||
\ifx\tikz@intersect@path@b\tikzfillbetween@precached@intersectionofpaths@B
|
||||
\def\pgf@loc@TMPa{1}%
|
||||
\fi
|
||||
\fi
|
||||
\ifx\tikz@intersect@path@b\tikzfillbetween@precached@intersectionofpaths@A
|
||||
\ifx\tikz@intersect@path@a\tikzfillbetween@precached@intersectionofpaths@B
|
||||
\def\pgf@loc@TMPa{1}%
|
||||
\fi
|
||||
\fi
|
||||
%
|
||||
\if1\pgf@loc@TMPa
|
||||
\tikzfillbetween@precached@intersectionofpaths@log
|
||||
\relax
|
||||
\else
|
||||
\pgfintersectionofpaths@orig{#1}{#2}%
|
||||
\fi
|
||||
}%
|
||||
\endinput
|
1393
texmf/tex/latex/pgfplots/tex/tikzlibrarypgfplots.clickable.code.tex
Normal file
1393
texmf/tex/latex/pgfplots/tex/tikzlibrarypgfplots.clickable.code.tex
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,99 @@
|
|||
%--------------------------------------------
|
||||
%
|
||||
% Package pgfplots, library for additional colormaps, especially those
|
||||
% related to matlab (tm).
|
||||
%
|
||||
% Copyright 2011 by Christian Feuersänger and Patrick Häcker.
|
||||
%
|
||||
% This program is free software: you can redistribute it and/or modify
|
||||
% 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/>.
|
||||
%
|
||||
%
|
||||
|
||||
\pgfplotsset{
|
||||
/pgfplots/colormap/autumn/.style={
|
||||
/pgfplots/colormap={autumn}{rgb255=(255,0,0) rgb255=(255,255,0)}
|
||||
},
|
||||
/pgfplots/colormap/bled/.style={
|
||||
/pgfplots/colormap={bled}{rgb255=(0,0,0) rgb255=(43,43,0) rgb255=(0,85,0) rgb255=(0,128,128) rgb255=(0,0,170) rgb255=(213,0,213) rgb255=(255,0,0)}
|
||||
},
|
||||
/pgfplots/colormap/bright/.style={
|
||||
/pgfplots/colormap={bright}{rgb255=(0,0,0) rgb255=(78,3,100) rgb255=(2,74,255) rgb255=(255,21,181) rgb255=(255,113,26) rgb255=(147,213,114) rgb255=(230,255,0) rgb255=(255,255,255)}
|
||||
},
|
||||
/pgfplots/colormap/cold/.style={
|
||||
/pgfplots/colormap={cold}{rgb255=(0,0,0) rgb255=(0,0,255) rgb255=(0,255,255) rgb255=(255,255,255)}
|
||||
},
|
||||
/pgfplots/colormap/copper/.style={
|
||||
/pgfplots/colormap={copper}{[1cm]rgb255(0cm)=(0,0,0) rgb255(4cm)=(255,159,101) rgb255(5cm)=(255,199,127)}
|
||||
},
|
||||
/pgfplots/colormap/copper2/.style={
|
||||
/pgfplots/colormap={copper2}{rgb255=(0,0,0) rgb255=(68,62,63) rgb255=(170,112,95) rgb255=(207,194,138) rgb255=(255,255,255)}
|
||||
},
|
||||
/pgfplots/colormap/earth/.style={
|
||||
/pgfplots/colormap={earth}{rgb255=(0,0,0) rgb255=(0,28,15) rgb255=(42,39,6) rgb255=(28,73,33) rgb255=(67,85,24) rgb255=(68,112,46) rgb255=(81,129,83) rgb255=(124,137,87) rgb255=(153,147,122) rgb255=(145,173,164) rgb255=(144,202,180) rgb255=(171,220,177) rgb255=(218,229,168) rgb255=(255,235,199) rgb255=(255,255,255)}
|
||||
},
|
||||
/pgfplots/colormap/gray/.style={
|
||||
/pgfplots/colormap={gray}{rgb255=(0,0,0) rgb255=(255,255,255)}
|
||||
},
|
||||
/pgfplots/colormap/hsv/.style={
|
||||
/pgfplots/colormap={hsv}{rgb255=(255,0,0) rgb255=(255,255,0) rgb255=(0,255,0) rgb255=(0,255,255) rgb255=(0,0,255) rgb255=(255,0,255) rgb255=(255,0,0)}
|
||||
},
|
||||
/pgfplots/colormap/hsv2/.style={
|
||||
/pgfplots/colormap={hsv2}{rgb255=(0,0,0) rgb255=(128,0,128) rgb255=(0,0,230) rgb255=(0,255,255) rgb255=(0,255,0) rgb255=(255,255,0) rgb255=(255,0,0)}
|
||||
},
|
||||
/pgfplots/colormap/pastel/.style={
|
||||
/pgfplots/colormap={pastel}{rgb255=(0,0,0) rgb255=(120,0,5) rgb255=(0,91,172) rgb255=(215,35,217) rgb255=(120,172,78) rgb255=(255,176,24) rgb255=(230,255,0) rgb255=(255,255,255)}
|
||||
},
|
||||
/pgfplots/colormap/pink/.style={
|
||||
/pgfplots/colormap={pink}{rgb255=(0,0,0) rgb255=(12,16,46) rgb255=(62,22,43) rgb255=(53,53,65) rgb255=(79,72,58) rgb255=(122,80,67) rgb255=(147,91,102) rgb255=(147,115,140) rgb255=(144,145,154) rgb255=(173,163,146) rgb255=(216,171,149) rgb255=(250,179,179) rgb255=(255,198,227) rgb255=(246,229,255) rgb255=(255,255,255)}
|
||||
},
|
||||
/pgfplots/colormap/sepia/.style={
|
||||
/pgfplots/colormap={sepia}{rgb255(0cm)=(0,0,0) rgb255(1cm)=(26,13,0) rgb255(18cm)=(255,230,204) rgb255(20cm)=(255,255,255)}
|
||||
},
|
||||
/pgfplots/colormap/bone/.style={
|
||||
/pgfplots/colormap={bone}{[1cm]rgb255(0cm)=(0,0,0) rgb255(3cm)=(84,84,116) rgb255(6cm)=(167,199,199) rgb255(8cm)=(255,255,255)}
|
||||
},
|
||||
%--------------------------------------------------
|
||||
% % mesh width is too fine for these:
|
||||
% /pgfplots/colormap/dusk/.style={
|
||||
% /pgfplots/colormap={dusk}{
|
||||
% [1cm]rgb255(0cm)=(0,0,0)
|
||||
% rgb255(114cm)=(0,0,128) rgb255(701cm)=(0,128,128)
|
||||
% rgb255(1000cm)=(128,128,128) rgb255(1299cm)=(255,128,128)
|
||||
% rgb255(1886cm)=(255,255,128) rgb255(2000cm)=(255,255,255)}
|
||||
% },
|
||||
% /pgfplots/colormap/hicontrast/.style={
|
||||
% /pgfplots/colormap={hicontrast}{
|
||||
% [1cm]rgb255(0cm)=(0,0,0) rgb255(114cm)=(0,0,255) rgb255(299cm)=(255,0,0) rgb255(413cm)=(255,0,255)
|
||||
% rgb255(587cm)=(0,255,0) rgb255(701cm)=(0,255,255) rgb255(886cm)=(255,255,0)
|
||||
% rgb255(1000cm)=(255,255,255)}
|
||||
% },
|
||||
%--------------------------------------------------
|
||||
/pgfplots/colormap/spring/.style={
|
||||
/pgfplots/colormap={spring}{rgb255=(255,0,255) rgb255=(255,255,0)}
|
||||
},
|
||||
/pgfplots/colormap/summer/.style={
|
||||
/pgfplots/colormap={summer}{rgb255=(0,128,102) rgb255=(255,255,102)}
|
||||
},
|
||||
/pgfplots/colormap/temp/.style={
|
||||
/pgfplots/colormap={temp}{rgb255=(36,0,217) rgb255=(25,29,247) rgb255=(41,87,255) rgb255=(61,135,255) rgb255=(87,176,255) rgb255=(117,211,255) rgb255=(153,235,255) rgb255=(189,249,255) rgb255=(235,255,255) rgb255=(255,255,235) rgb255=(255,242,189) rgb255=(255,214,153) rgb255=(255,172,117) rgb255=(255,120,87) rgb255=(255,61,61) rgb255=(247,40,54) rgb255=(217,22,48) rgb255=(166,0,33)}
|
||||
},
|
||||
/pgfplots/colormap/thermal/.style={
|
||||
/pgfplots/colormap={thermal}{rgb255=(0,0,0) rgb255=(77,0,179) rgb255=(255,51,0) rgb255=(255,255,0) rgb255=(255,255,255)}
|
||||
},
|
||||
/pgfplots/colormap/winter/.style={
|
||||
/pgfplots/colormap={winter}{rgb255=(0,0,255) rgb255=(0,255,128)}
|
||||
},
|
||||
}
|
||||
|
||||
\endinput
|
|
@ -0,0 +1,201 @@
|
|||
%--------------------------------------------
|
||||
%
|
||||
% Package pgfplots, library for high-level coordinates.
|
||||
%
|
||||
% Copyright 2007/2008/2009 by Christian Feuersänger.
|
||||
%
|
||||
% This program is free software: you can redistribute it and/or modify
|
||||
% 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/>.
|
||||
%
|
||||
%--------------------------------------------
|
||||
|
||||
\pgfutil@usemodule{pgfcalendar}
|
||||
|
||||
% Idea: allow
|
||||
%--------------------------------------------------
|
||||
% \begin{tikzpicture}
|
||||
% \begin{axis}[
|
||||
% date coordinates in=x,
|
||||
% xticklabel={\day.\month.},
|
||||
% ]
|
||||
% \addplot coordinates {
|
||||
% (2008-01-5, 5)
|
||||
% (2008-01-12, 10)
|
||||
% (2008-01-16, 20)
|
||||
% };
|
||||
% \end{axis}
|
||||
% \end{tikzpicture}
|
||||
%--------------------------------------------------
|
||||
|
||||
\def\pgfplotslibdateplot@number@to@julian@and@time#1.#2\julianto#3\hourto#4\minuteto#5{%
|
||||
#3=#1
|
||||
\pgf@xa=0.#2pt
|
||||
\multiply\pgf@xa by24
|
||||
\afterassignment\pgfplots@gobble@until@relax
|
||||
\c@pgf@countb=\the\pgf@xa\relax
|
||||
\edef#4{\the\c@pgf@countb}%
|
||||
\advance\pgf@xa by-#4pt
|
||||
\multiply\pgf@xa by60
|
||||
\afterassignment\pgfplots@gobble@until@relax
|
||||
\c@pgf@countb=\the\pgf@xa\relax
|
||||
% round minutes (we may loose precision here)
|
||||
\advance\pgf@xa by-\the\c@pgf@countb pt
|
||||
\ifdim\pgf@xa>0.5pt
|
||||
\advance\c@pgf@countb by1
|
||||
\ifnum\c@pgf@countb=60
|
||||
\c@pgf@countb=#4 %
|
||||
\advance\c@pgf@countb by1
|
||||
\edef#4{\the\c@pgf@countb}%
|
||||
\c@pgf@countb=0
|
||||
\fi
|
||||
\fi
|
||||
\edef#5{\the\c@pgf@countb}%
|
||||
}
|
||||
|
||||
% #1 the date
|
||||
% #2 the hours
|
||||
% #3 the minutes
|
||||
% #4 is either empty or is the seconds.
|
||||
% #5 a macro which will be filled with the date part.
|
||||
% #6 the macro which will contain a number in the range [0,1]
|
||||
% representing hours and minutes.
|
||||
%
|
||||
% If you don't have seconds, you have to provide the second ':' sign
|
||||
% as dummy! In that case #4 will be empty.
|
||||
\def\pgfplotslibdateplot@map@time#1 #2:#3:#4\dateto#5\timeto#6{%
|
||||
\pgf@xa=#2pt
|
||||
\divide\pgf@xa by24
|
||||
\pgf@xb=#3pt
|
||||
\divide\pgf@xb by1440
|
||||
\advance\pgf@xa by\pgf@xb
|
||||
\ifdim\pgf@xa<0pt
|
||||
\pgf@xa=0pt
|
||||
\else
|
||||
\ifdim\pgf@xa>1pt
|
||||
\pgf@xa=1pt
|
||||
\fi
|
||||
\fi
|
||||
\def#5{#1}%
|
||||
\edef#6{\pgf@sys@tonumber\pgf@xa}%
|
||||
}%
|
||||
\def\pgfplotslibdateplot@discard@zero@dot 0.#1\to#2{\def#2{#1}}%
|
||||
|
||||
\pgfplotsset{
|
||||
/pgfplots/date ZERO/.code={%
|
||||
\begingroup
|
||||
\pgfcalendardatetojulian{#1}\c@pgf@counta
|
||||
\edef\pgfmathresult{\the\c@pgf@counta}%
|
||||
\pgfmath@smuggleone\pgfmathresult
|
||||
\endgroup
|
||||
\let\pgfplots@calender@ZEROSHIFT=\pgfmathresult
|
||||
},
|
||||
date ZERO=2006-01-01,
|
||||
/pgfplots/date coordinates in/.code={%
|
||||
\pgfkeysdef{/pgfplots/#1 coord trafo}{%
|
||||
\begingroup
|
||||
\edef\pgfplotstempjuliandate{##1}%
|
||||
% check if we also have a TIME like '2006-01-01 11:21'
|
||||
\expandafter\pgfutil@in@\expandafter:\expandafter{\pgfplotstempjuliandate}%
|
||||
\ifpgfutil@in@
|
||||
% we have a TIME!
|
||||
\expandafter\pgfplotslibdateplot@map@time\pgfplotstempjuliandate:\dateto\pgfplotstempjuliandate\timeto\pgfplotstemptime
|
||||
\else
|
||||
\let\pgfplotstemptime=\pgfutil@empty
|
||||
\fi
|
||||
\expandafter\pgfcalendardatetojulian\expandafter{\pgfplotstempjuliandate}\c@pgf@counta
|
||||
\advance\c@pgf@counta by-\pgfplots@calender@ZEROSHIFT\relax
|
||||
\ifx\pgfplotstemptime\pgfutil@empty
|
||||
% no time:
|
||||
\edef\pgfmathresult{\the\c@pgf@counta}%
|
||||
\else
|
||||
% add time fraction (which should be in the range
|
||||
% [0,1]).
|
||||
\ifdim\pgfplotstemptime pt<1pt
|
||||
% discard prefix '0.':
|
||||
\expandafter\pgfplotslibdateplot@discard@zero@dot\pgfplotstemptime\to\pgfplotstemptime
|
||||
\edef\pgfmathresult{\the\c@pgf@counta.\pgfplotstemptime}%
|
||||
\else
|
||||
% assume \pgfplotstemptime=1pt :
|
||||
\advance\c@pgf@counta by1
|
||||
\edef\pgfmathresult{\the\c@pgf@counta}%
|
||||
\fi
|
||||
\fi
|
||||
\pgfmath@smuggleone\pgfmathresult
|
||||
\endgroup
|
||||
}%
|
||||
\pgfkeysdef{/pgfplots/#1 coord inv trafo}{%
|
||||
\edef\pgfplotstempjuliandatenumeric{##1}%
|
||||
\begingroup
|
||||
\expandafter\pgfplotslibdateplot@number@to@julian@and@time\pgfplotstempjuliandatenumeric\julianto{\c@pgf@counta}\hourto\Hour\minuteto\Minute%
|
||||
\advance\c@pgf@counta by\pgfplots@calender@ZEROSHIFT\relax
|
||||
\expandafter\pgfcalendarjuliantodate\expandafter{\the\c@pgf@counta}\year\month\day
|
||||
\xdef\pgfplotslibdateplot@TMP{%
|
||||
\noexpand\def\noexpand\year{\year}%
|
||||
\noexpand\def\noexpand\month{\month}%
|
||||
\noexpand\def\noexpand\day{\day}%
|
||||
\noexpand\def\noexpand\Hour{\Hour}%
|
||||
\noexpand\def\noexpand\Minute{\Minute}%
|
||||
}%
|
||||
\endgroup
|
||||
\pgfplotslibdateplot@TMP
|
||||
\let\hour=\Hour
|
||||
\let\minute=\Minute
|
||||
\ifnum\hour<10
|
||||
\edef\hour{0\hour}%
|
||||
\fi
|
||||
\ifnum\minute<10
|
||||
\edef\minute{0\minute}%
|
||||
\fi
|
||||
\def\Second{0}%
|
||||
\def\second{00}%
|
||||
\edef\lowlevel{##1}%
|
||||
\pgfkeysifdefined{/pgfplots/date default inv/#1}{%
|
||||
\edef\pgfmathresult{\pgfkeysvalueof{/pgfplots/date default inv/#1}}%
|
||||
}{%
|
||||
\edef\pgfmathresult{\year-\month-\day\space\hour:\minute:\second}%
|
||||
}%
|
||||
}%
|
||||
\pgfkeysifdefined{/pgfplots/#1ticklabel/.@cmd}{%
|
||||
\pgfkeysalso{%
|
||||
/pgfplots/#1ticklabel={\tick},%
|
||||
/pgfplots/scaled #1 ticks=false,%
|
||||
/pgfplots/plot coordinates/math parser=false,%
|
||||
}%
|
||||
}{%
|
||||
% OK. The style can be used for other coordinates as well
|
||||
% (like hist/data)
|
||||
}%
|
||||
%
|
||||
\pgfkeysifdefined{/pgfplots/#1 is expr}{%
|
||||
\pgfkeyssetvalue{/pgfplots/#1 is expr}{0}%
|
||||
}{}%
|
||||
%
|
||||
% Allow a callback (optional)
|
||||
\pgfkeysifdefined{/pgfplots/#1/@execute on coord trafo changed/.@cmd}{%
|
||||
\pgfkeysalso {/pgfplots/#1/@execute on coord trafo changed}%
|
||||
}{}%
|
||||
},
|
||||
/pgfplots/date coordinates in/.value required,
|
||||
%
|
||||
% #1: the argument for 'data coordinates in={#1}
|
||||
% #2: the default for the inverse transformation. If there is
|
||||
% none, a default will be chosen automatically (with full
|
||||
% information)
|
||||
/pgfplots/date coordinates default inverse/.style 2 args={%
|
||||
/pgfplots/date default inv/#1/.initial=#2,
|
||||
},
|
||||
/pgfplots/date coordinates default inverse={x}{\year-\month-\day},
|
||||
/pgfplots/date coordinates default inverse={y}{\year-\month-\day},
|
||||
/pgfplots/date coordinates default inverse={z}{\year-\month-\day},
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
%--------------------------------------------
|
||||
%
|
||||
% Package pgfplots
|
||||
%
|
||||
% 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 2013 by Christian Feuersaenger
|
||||
%
|
||||
% This program is free software: you can redistribute it and/or modify
|
||||
% 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 library adds support for a "soft clip" decoration. It applies
|
||||
% clipping to an input path, but rather than simply instructing the
|
||||
% display driver to clip the path, it computes a new clip path from
|
||||
% the input.
|
||||
%
|
||||
% This library is (currently) on top of tikz.
|
||||
|
||||
\usetikzlibrary{decorations.softclip}
|
||||
|
||||
\endinput
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue