Debian Codegraph @

texmf-dist/tex/generic/pgfplots/oldpgfcompatib/pgfplotsoldpgfsupp_tikzlibraryexternal.code.tex

raw
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 %%% This file is a copy of some part of PGF/Tikz.
3 %%% It has been copied here to provide :
4 %%% - compatibility with older PGF versions
5 %%% - availability of PGF contributions by Christian Feuersaenger
6 %%% which are necessary or helpful for pgfplots.
7 %%%
8 %%% For reasons of simplicity, I have copied the whole file, including own contributions AND
9 %%% PGF parts. The copyrights are as they appear in PGF.
10 %%%
11 %%% Note that pgfplots has compatible licenses.
12 %%%
13 %%% This copy has been modified in the following ways:
14 %%% - nested \input commands have been updated
15 %%%
16 %
17 % Support for the contents of this file will NOT be done by the PGF/TikZ team.
18 % Please contact the author and/or maintainer of pgfplots (Christian Feuersaenger) if you need assistance in conjunction
19 % 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:
20 % This file comes without any warranty as the rest of pgfplots; there is no obligation for help.
21 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
22 %%% Date of this copy: Do 31. Dez 19:01:21 CET 2015 %%%
23
24
25
26 % Copyright 2008 by Christian Feuersaenger
27 %
28 % This file may be distributed and/or modified
29 %
30 % 1. under the LaTeX Project Public License and/or
31 % 2. under the GNU Public License.
32 %
33 % See the file doc/generic/pgf/licenses/LICENSE for more details.
34 %
35 %
36 % This file provides a high-level automatic export feature for tikz pictures.
37 % It allows to export EACH SINGLE FIGURE into a separate PDF.
38 %
39 % The simplest way is to use
40 %
41 % \tikzexternalize{myarticle}
42 %
43 % it simply converts every figure using the write18 method. If that is not possible,
44 % you need to reconfigure \tikzexternalize: it can generate a list of figure file names
45 % and you need to generate these figures manually (or with a script).
46 %
47 % It replaces \tikzpicture/ \endtikzpicture and \tikz and invokes \beginpgfgraphicnamed ... \endpgfgraphicnamed
48 % commands if necessary.
49
50 % load this package in order to get \pdf@mdfivesum .
51 % \pdf@mdfivesum is available for pdftex and lualatex and computes the
52 % md5 sum. Note that pdftex has \pdfmdfivesum, but lualatex does not
53 % have it.
54 %
55 % ... also used for \pdf@shellescape.
56 \usepackage{pdftexcmds}
57 \pgfutil@IfFileExists{atveryend.sty}{%
58 \usepackage{atveryend}%
59 }{%
60 \message{! Package tikz Warning: \string\usepackage{atveryend} impossible. Automatic resolving of references within external files impossible.}%
61 }%
62
63 % source generic implementation:
64 \input pgfplotsoldpgfsupp_tikzexternalshared.code.tex
65
66 \pgfutil@IfUndefined{pdf@mdfivesum}{}{%
67 \let\tikzexternal@mdfivesum=\pdf@mdfivesum
68 }%
69
70 \def\tikzexternal@TEXDIALECT@begpicture{\begin{tikzpicture}}
71 \def\tikzexternal@TEXDIALECT@endpicture{\end{tikzpicture}}%
72
73 % this latex specific this assumes it starts at the beginning of an
74 % environment. The environment is named
75 % '\tikzexternal@laTeX@collect@until@end@tikzpicturetikzpicturestring'.
76 %
77 % Everything up to \end{<name>} will be collected and passed as
78 % argument to the macro '#1'.
79 %
80 % This does also work if <name> is NOT tikzpicture!
81 \def\tikzexternal@TEXDIALECT@collectpicture#1{%
82 \begingroup
83 \t@tikzexternal@tmpa={}%
84 \tikzexternal@laTeX@collect@until@end@tikzpicture{#1}%
85 }
86
87 % Loop until we find '\end{tikzpicture}'. We have to make sure that
88 % even strings like '#1' are allowed inside of the collected argument.
89 \long\def\tikzexternal@laTeX@collect@until@end@tikzpicture#1#2\end#3{%
90 \def\tikzexternal@laTeX@collect@until@end@tikzpicture@{#3}%
91 \ifx\tikzexternal@laTeX@collect@until@end@tikzpicture@\tikzexternal@laTeX@collect@until@end@tikzpicturetikzpicturestring
92 \t@tikzexternal@tmpa=\expandafter{\the\t@tikzexternal@tmpa #2}%
93 \edef\tikzexternal@TEXDIALECT@collectpicture@next{%
94 \noexpand\endgroup
95 \noexpand#1{\the\t@tikzexternal@tmpa}%
96 }%
97 \t@tikzexternal@tmpa={}% release memory.
98 \else
99 \t@tikzexternal@tmpa=\expandafter{\the\t@tikzexternal@tmpa #2\end{#3}}%
100 \def\tikzexternal@TEXDIALECT@collectpicture@next{%
101 \tikzexternal@laTeX@collect@until@end@tikzpicture{#1}}%
102 \fi
103 \tikzexternal@TEXDIALECT@collectpicture@next
104 }%
105 \def\tikzexternal@laTeX@collect@until@end@tikzpicturetikzpicturestring{tikzpicture}%
106
107 \def\tikzexternal@handle@landscape{%
108 \ltx@ifpackageloaded{pdflscape}{%
109 % Work around a bug in conjunction with pdflscape and
110 % external: without this optimize-away-instruction, the
111 % externalized image would be rotated - and it will be rotated
112 % once more again when it is included.
113 %
114 % if we "optimize it away", the landscape stuff will be
115 % omitted. I hope this is enough... might not be entirely
116 % fool-proof; perhaps we need to set it to \relax. For now, it
117 % will probably do the job
118 \tikzset{
119 external/.cd,
120 optimize command away=\landscape,
121 optimize command away=\endlandscape
122 }%
123 }{%
124 }%
125 }%
126
127 \AtBeginDocument{%
128 \pgfutil@ifundefined{tikzexternalrealjob}{%
129 \global\let\tikzexternalrealjob=\jobname
130 }{}%
131 \tikzexternal@handle@landscape
132 }%
133