summaryrefslogtreecommitdiff
path: root/graphics/pgf/contrib/pgfplots/tex/pgfplotslibrary.code.tex
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /graphics/pgf/contrib/pgfplots/tex/pgfplotslibrary.code.tex
Initial commit
Diffstat (limited to 'graphics/pgf/contrib/pgfplots/tex/pgfplotslibrary.code.tex')
-rw-r--r--graphics/pgf/contrib/pgfplots/tex/pgfplotslibrary.code.tex94
1 files changed, 94 insertions, 0 deletions
diff --git a/graphics/pgf/contrib/pgfplots/tex/pgfplotslibrary.code.tex b/graphics/pgf/contrib/pgfplots/tex/pgfplotslibrary.code.tex
new file mode 100644
index 0000000000..7ab01a3b03
--- /dev/null
+++ b/graphics/pgf/contrib/pgfplots/tex/pgfplotslibrary.code.tex
@@ -0,0 +1,94 @@
+% 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
+ \pgfplotsiflibraryloaded{\pgf@temp}{}{%
+ \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
+ \expandafter\ifx\csname pgfp@library@#1@loadoptions\endcsname\relax
+ \else
+ \expandafter\let\expandafter\pgfplots@glob@TMPa\csname pgfp@library@\pgf@temp @loadoptions\endcsname
+ \expandafter\pgfplotsset\expandafter{\pgfplots@glob@TMPa}%
+ \fi
+ }%
+ \fi
+ }%
+}
+
+\pgfkeys{
+ % #1: library name
+ % #2: compatiblity presets which are controlled by the
+ % compatibility system but which belong to the library.
+ %
+ % FIXME : now as I wrote it, it might have been better to reverse
+ % the dependency... !?
+ /pgfplots/compat/library hook/.code 2 args={%
+ \pgfplotsiflibraryloaded{#1}{%
+ \pgfkeysalso{#2}%
+ }{%
+ \expandafter\ifx\csname pgfp@library@#1@loadoptions\endcsname\relax
+ \expandafter\def\csname pgfp@library@#1@loadoptions\endcsname{#2}%
+ \else
+ \t@pgfplots@toka=\expandafter\expandafter\expandafter{\csname pgfp@library@#1@loadoptions\endcsname}%
+ \t@pgfplots@tokb={#2}%
+ \expandafter\edef\csname pgfp@library@#1@loadoptions\endcsname{\the\t@pgfplots@toka,\the\t@pgfplots@tokb}%
+ \fi
+ }%
+ },
+}
+
+\def\pgfplotsiflibraryloaded#1#2#3{%
+ \expandafter\ifx\csname pgfp@library@#1@loaded\endcsname\relax%
+ #3\relax
+ \else
+ #2\relax
+ \fi%
+}%
+
+% Default loaded libraries:
+% Currently none