Debian Codegraph @

texmf-dist/tex/generic/pgfplots/libs/pgfplotslibrary.code.tex

raw
1 % Copyright 2006 by Till Tantau
2 %
3 % This file may be distributed and/or modified
4 %
5 % 1. under the LaTeX Project Public License and/or
6 % 2. under the GNU Public License.
7 %
8 % See the file doc/generic/pgf/licenses/LICENSE for more details.
9 % Comment: This file has been modified to utilize libraries in the pgfplots package.
10 % Edited by Nick Papior Andersen
11
12
13
14 % Loading further libraries
15
16 % Include a library file.
17 %
18 % #1 = List of names of library file.
19 %
20 % Description:
21 %
22 % This command includes a list of pgfplots library files. For each file X in the
23 % list, the file tikzlibrarypgfplots.X.code.tex is included, provided this has
24 % not been done earlier.
25 %
26 % For the convenience of Context users, both round and square brackets
27 % are possible for the argument.
28 %
29 % Example:
30 %
31 % \usepgfplotslibrary{units}
32 % \usepgfplotslibrary[units,dateplot]
33
34 \def\usepgfplotslibrary{\pgfutil@ifnextchar[{\use@pgfplotslibrary}{\use@@pgfplotslibrary}}%}
35 \def\use@pgfplotslibrary[#1]{\use@@pgfplotslibrary{#1}}
36 \def\use@@pgfplotslibrary#1{%
37 \edef\pgf@list{#1}%
38 \pgfutil@for\pgf@temp:=\pgf@list\do{%
39 \expandafter\pgfkeys@spdef\expandafter\pgf@temp\expandafter{\pgf@temp}%
40 \ifx\pgf@temp\pgfutil@empty
41 \else
42 \pgfplotsiflibraryloaded{\pgf@temp}{}{%
43 \expandafter\global\expandafter\let\csname pgfp@library@\pgf@temp @loaded\endcsname=\pgfutil@empty%
44 \expandafter\edef\csname pgfplots@library@#1@atcode\endcsname{\the\catcode`\@}
45 \expandafter\edef\csname pgfplots@library@#1@barcode\endcsname{\the\catcode`\|}
46 \catcode`\@=11
47 \catcode`\|=12
48 \pgfplots@iffileexists{tikzlibrarypgfplots.\[email protected]}{%
49 \input tikzlibrarypgfplots.\[email protected]}{%
50 \input pgflibrarypgfplots.\[email protected]}%
51 \catcode`\@=\csname pgfplots@library@#1@atcode\endcsname
52 \catcode`\|=\csname pgfplots@library@#1@barcode\endcsname
53 \expandafter\ifx\csname pgfp@library@#1@loadoptions\endcsname\relax
54 \else
55 \expandafter\let\expandafter\pgfplots@glob@TMPa\csname pgfp@library@\pgf@temp @loadoptions\endcsname
56 \expandafter\pgfplotsset\expandafter{\pgfplots@glob@TMPa}%
57 \fi
58 }%
59 \fi
60 }%
61 }
62
63 \pgfkeys{
64 % #1: library name
65 % #2: compatibility presets which are controlled by the
66 % compatibility system but which belong to the library.
67 %
68 % FIXME : now as I wrote it, it might have been better to reverse
69 % the dependency... !?
70 /pgfplots/compat/library hook/.code 2 args={%
71 \pgfplotsiflibraryloaded{#1}{%
72 \pgfkeysalso{#2}%
73 }{%
74 \expandafter\ifx\csname pgfp@library@#1@loadoptions\endcsname\relax
75 \expandafter\def\csname pgfp@library@#1@loadoptions\endcsname{#2}%
76 \else
77 \t@pgfplots@toka=\expandafter\expandafter\expandafter{\csname pgfp@library@#1@loadoptions\endcsname}%
78 \t@pgfplots@tokb={#2}%
79 \expandafter\edef\csname pgfp@library@#1@loadoptions\endcsname{\the\t@pgfplots@toka,\the\t@pgfplots@tokb}%
80 \fi
81 }%
82 },
83 }
84
85 \def\pgfplotsiflibraryloaded#1#2#3{%
86 \expandafter\ifx\csname pgfp@library@#1@loaded\endcsname\relax%
87 #3\relax
88 \else
89 #2\relax
90 \fi%
91 }%
92
93 % Default loaded libraries:
94 % Currently none