| 1 |
% Copyright 2019 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 |
|
| 10 |
|
| 11 |
\catcode`\@=11\relax |
| 12 |
|
| 13 |
\pgfutil@format@is@latextrue |
| 14 |
|
| 15 |
\let\pgfutil@auxout=\@auxout |
| 16 |
\def\pgfutil@writetoaux#1{\if@filesw\write\pgfutil@auxout{#1}\fi} |
| 17 |
|
| 18 |
\let\pgfutil@tempcnta=\@tempcnta |
| 19 |
\let\pgfutil@tempcntb=\@tempcntb |
| 20 |
\let\pgfutil@voidb@x=\voidb@x |
| 21 |
\let\pgfutil@toks@=\toks@ |
| 22 |
|
| 23 |
\let\pgfutil@packageerror=\PackageError |
| 24 |
\let\pgfutil@packagewarning=\PackageWarning |
| 25 |
|
| 26 |
\def\pgfutil@protect{\protect} |
| 27 |
|
| 28 |
|
| 29 |
\def\pgfutil@definecolor{\definecolor} |
| 30 |
\def\pgfutil@color{\color} |
| 31 |
\def\pgfutil@colorlet#1#2{% |
| 32 |
% If the color is a defined named color, we have to use the [named] |
| 33 |
% option for colorlet to force xcolor to perform color model |
| 34 |
% conversion. |
| 35 |
\expandafter\ifx\csname\expandafter\string\csname color@#2\endcsname\endcsname\relax |
| 36 |
\colorlet{#1}{#2}% |
| 37 |
\else |
| 38 |
\colorlet[named]{#1}{#2}% |
| 39 |
\fi |
| 40 |
} |
| 41 |
|
| 42 |
\def\pgfutil@extractcolorspec{\extractcolorspec} |
| 43 |
\def\pgfutil@convertcolorspec{\convertcolorspec} |
| 44 |
|
| 45 |
\def\pgfutil@globalcolorsfalse{\let\ifglobalcolors\iffalse} |
| 46 |
\def\pgfutil@globalcolorstrue{\let\ifglobalcolors\iftrue} |
| 47 |
|
| 48 |
\let\pgfutil@minipage=\minipage |
| 49 |
\let\pgfutil@endminipage=\endminipage |
| 50 |
|
| 51 |
\def\pgfutil@doifcolorelse#1#2#3{% |
| 52 |
\expandafter\ifx\csname\string\color@#1\endcsname\relax% |
| 53 |
\let\pgf@next=\pgfutil@secondoftwo% |
| 54 |
\else |
| 55 |
\let\pgf@next=\pgfutil@firstoftwo% |
| 56 |
\fi% |
| 57 |
\pgf@next{#2}{#3}% |
| 58 |
} |
| 59 |
|
| 60 |
\let\pgfutil@raggedleft\raggedleft |
| 61 |
\let\pgfutil@raggedright\raggedright |
| 62 |
|
| 63 |
\let\pgfutil@flushglue=\@flushglue |
| 64 |
|
| 65 |
\def\pgfutil@font@tiny{\tiny} |
| 66 |
\def\pgfutil@font@scriptsize{\scriptsize} |
| 67 |
\def\pgfutil@font@footnotesize{\footnotesize} |
| 68 |
\def\pgfutil@font@small{\small} |
| 69 |
\def\pgfutil@font@normalsize{\normalsize} |
| 70 |
\def\pgfutil@font@large{\large} |
| 71 |
\def\pgfutil@font@Large{\Large} |
| 72 |
\def\pgfutil@font@huge{\huge} |
| 73 |
\def\pgfutil@font@Huge{\Huge} |
| 74 |
|
| 75 |
\def\pgfutil@font@itshape{\itshape} |
| 76 |
\def\pgfutil@font@bfseries{\bfseries} |
| 77 |
|
| 78 |
\def\pgfutil@font@normalfont{\normalfont} |
| 79 |
|
| 80 |
\def\pgfutil@usemodule#1{\usepackage{#1}} |
| 81 |
|
| 82 |
\let\pgfutil@selectfont=\selectfont |
| 83 |
|
| 84 |
\let\pgfutil@tempboxa=\@tempboxa |
| 85 |
|
| 86 |
\let\pgfmath@tempdima\pgfutil@tempdima |
| 87 |
\let\pgfmath@tempdima\pgfutil@tempdima |
| 88 |
\let\pgfmath@tempcnta\pgfutil@tempcnta |
| 89 |
\let\pgfmath@tempcntb\pgfutil@tempcntb |
| 90 |
|
| 91 |
\def\pgfutil@check@rerun#1#2{\@newl@bel{pgf@lab}{#1}{#2}} |
| 92 |
|
| 93 |
\AtBeginDocument{\AtEndDocument{% |
| 94 |
\if\relax\detokenize\expandafter{\the\pgfutil@everybye}\relax\else |
| 95 |
\expandafter\clearpage\expandafter\the\expandafter\pgfutil@everybye |
| 96 |
\fi}} |
| 97 |
|
| 98 |
% \@ifl@t@r is defined \@onlypremable so we have to save it here |
| 99 |
\let\pgfutil@ifl@t@r=\@ifl@t@r |
| 100 |
|
| 101 |
\def\pgfutil@insertatbegincurrentpagefrombox#1{% |
| 102 |
\edef\pgf@temp{\the\wd\pgfutil@abb}% |
| 103 |
\global\setbox\pgfutil@abb\hbox{% |
| 104 |
\unhbox\pgfutil@abb% |
| 105 |
% |
| 106 |
% the order in which \pgfutil@insertatbegincurrentpagefrombox |
| 107 |
% matters unless we make the following -shift! |
| 108 |
% To see this, consider writing two such statements. The second |
| 109 |
% one will (naturally) be placed more to the right, although there |
| 110 |
% is no apparent reason why it should. |
| 111 |
% |
| 112 |
% CF observed problems when placing patterns in XObjects without |
| 113 |
% this skip (dvipdfmx driver for pgfplots shader=interp) |
| 114 |
\hskip\dimexpr\pgfutil@ifl@t@r\fmtversion{2020/10/01}{2in-2\hoffset}{}-\pgf@temp\relax% |
| 115 |
#1% |
| 116 |
\pgfutil@ifl@t@r\fmtversion{2020/10/01}{\hskip\dimexpr-2in-2\hoffset\relax}{}% |
| 117 |
}% |
| 118 |
} |
| 119 |
\newbox\pgfutil@abb% |
| 120 |
\def\pgfutil@insertatbegincurrentpage#1{% |
| 121 |
\expandafter\gdef\expandafter\pgfutil@abc\expandafter{\pgfutil@abc#1}% |
| 122 |
} |
| 123 |
\let\pgfutil@abc\pgfutil@empty% |
| 124 |
\def\pgfutil@insertatbegineverypage#1{% |
| 125 |
\expandafter\gdef\expandafter\pgfutil@abe\expandafter{\pgfutil@abe#1}% |
| 126 |
} |
| 127 |
\let\pgfutil@abe\pgfutil@empty% |
| 128 |
|
| 129 |
\pgfutil@ifl@t@r\fmtversion{2020/10/01}{% |
| 130 |
\AddToHook{shipout/background}{% |
| 131 |
\put(\hoffset-1in,\voffset-1in){% |
| 132 |
\pgfutil@abe\unhbox\pgfutil@abb\pgfutil@abc\global\let\pgfutil@abc\pgfutil@empty |
| 133 |
}% |
| 134 |
}% |
| 135 |
}{% |
| 136 |
\RequirePackage{everyshi} |
| 137 |
\EveryShipout{% |
| 138 |
% Add at begin page stuff |
| 139 |
\setbox\@cclv=\vbox{% |
| 140 |
\setbox\z@=\hbox{% |
| 141 |
% the boxes \pgfutil@abe ("every page") and \pgfutil@abb ("current page") |
| 142 |
% are used to generate pdf objects / dictionaries which are |
| 143 |
% required for the graphics which are somewhere in the "real" |
| 144 |
% page content. |
| 145 |
% BUT: these pdf objects MUST NOT be affected by text layout |
| 146 |
% shifts! Consequently, we have to undo \hoffset and \voffset |
| 147 |
% (which are h/v shifts to the page layout). |
| 148 |
% |
| 149 |
% Note that this of importance for shadings. To be more |
| 150 |
% specific: try out shadings with standalone (which uses |
| 151 |
% \hoffset) and with xdvipdfmx (which appears to be more |
| 152 |
% fragile than pdflatex) - they break unless we undo \hoffset |
| 153 |
% and \voffset. |
| 154 |
\ifdim\hoffset=0pt \else \hskip-\hoffset\fi |
| 155 |
\pgfutil@abe\unhbox\pgfutil@abb\pgfutil@abc\global\let\pgfutil@abc\pgfutil@empty |
| 156 |
\ifdim\hoffset=0pt \else \hskip+\hoffset\fi |
| 157 |
}% |
| 158 |
\wd\z@=\z@% |
| 159 |
\ht\z@=\z@% |
| 160 |
\dp\z@=\z@% |
| 161 |
% ... see remark above regarding \hoffset/\voffset: |
| 162 |
\ifdim\voffset=0pt \else \vskip-\voffset\fi |
| 163 |
\box\z@% |
| 164 |
\ifdim\voffset=0pt \else \vskip+\voffset\fi |
| 165 |
% |
| 166 |
% if TeX changes into vertical mode, it inserts \parskip and |
| 167 |
% \lineskip. Disable it here: |
| 168 |
\nointerlineskip% |
| 169 |
\ifvbox\@cclv \unvbox\@cclv \else\hsize=\wd\@cclv \noindent\unhbox\@cclv \fi% |
| 170 |
%\box\@cclv |
| 171 |
% using \box instead of \unhbox or \unvbox |
| 172 |
% has the advantage that glue settings won't be |
| 173 |
% altered (as for \unhbox/\unvbox). But \box breaks compatibility |
| 174 |
% with the 'remember picture' feature. |
| 175 |
}% |
| 176 |
} |
| 177 |
|
| 178 |
% Preview hack: preview.sty hacks into \shipout (which is ok), but |
| 179 |
% does not honour everyshi.sty (which is not ok). This causes everyshi |
| 180 |
% material to get lost. |
| 181 |
\AtBeginDocument{ |
| 182 |
\@ifpackageloaded{preview}{% |
| 183 |
% Ok, package loaded. Swap definitions of everyshi.sty's shipout |
| 184 |
% and preview.sty's shipout: |
| 185 |
\ifPreview |
| 186 |
\let\shipout\@EveryShipout@Org@Shipout%This is the null version of \shipout, created by preview and saved by everyshi |
| 187 |
\let\@EveryShipout@Org@Shipout\pr@shipout% This is the original shipout |
| 188 |
\let\pr@shipout\@EveryShipout@Shipout% |
| 189 |
\fi |
| 190 |
}{}% |
| 191 |
} |
| 192 |
} |
| 193 |
|
| 194 |
% Guess the driver: |
| 195 |
|
| 196 |
\def\pgfutil@guessdriver{ |
| 197 |
\ifx\HCode\@undefined% |
| 198 |
\edef\pgfsysdriver{pgfsys-\Gin@driver}% should be right |
| 199 |
\else% |
| 200 |
\def\pgfsysdriver{pgfsys-tex4ht.def}% should be right |
| 201 |
\fi% |
| 202 |
} |
| 203 |
|
| 204 |
% pgfcalendar uses translations |
| 205 |
|
| 206 |
\ifx\translate\@undefined % check if \translate is available |
| 207 |
\def\pgfutil@translate#1{#1} |
| 208 |
\else |
| 209 |
\def\pgfutil@translate#1{\translate{#1}} |
| 210 |
\fi |
| 211 |
|
| 212 |
% e-TeX primitives and beyond |
| 213 |
|
| 214 |
\let\pgfutil@protected\protected |
| 215 |
\let\pgfutil@unexpanded\unexpanded |
| 216 |
% the check for the availability of \expanded primitive is done in pgfkeys |
| 217 |
\let\pgfutil@expanded\expanded |
| 218 |
|
| 219 |
\endinput |