1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
|
%%
%% This is file `tikzlibrarytikzmark.code.tex',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% tikzmark.dtx (with options: `tikzlibrary')
%% ----------------------------------------------------------------
%% tikzmark --- remembering absolute positioning with TikZ.
%% E-mail: stacey@math.ntnu.no
%% Released under the LaTeX Project Public License v1.3c or later
%% See http://www.latex-project.org/lppl.txt
%% ----------------------------------------------------------------
%%
\tikzset{%
remember picture with id/.style={%
remember picture,
overlay,
save picture id=#1,
},
every picture/.append style={%
execute at end picture={%
\ifpgfrememberpicturepositiononpage%
\edef\pgf@temp{%
\noexpand\write\noexpand\pgfutil@auxout{%
\string\savepicturepage{\pgfpictureid}{\noexpand\thepage}}}%
\pgf@temp
\fi%
},
},
save picture id/.code={%
\immediate\write\pgfutil@auxout{%
\string\savepointas{#1}{\pgfpictureid}}%
},
if picture id/.code args={#1#2#3}{%
\@ifundefined{save@pt@#1}{%
\pgfkeysalso{#3}%
}{
\pgfkeysalso{#2}%
}
},
next page/.is choice,
next page vector/.initial={\pgfqpoint{0pt}{0pt}},
next page/below/.style={%
next page vector={\pgfqpoint{0pt}{-\the\paperheight}}%
},
next page/above/.style={%
next page vector={\pgfqpoint{0pt}{\the\paperheight}}%
},
next page/left/.style={%
next page vector={\pgfqpoint{-\the\paperwidth}{0pt}}%
},
next page/right/.style={%
next page vector={\pgfqpoint{\the\paperwidth}{0pt}}%
},
next page/ignore/.style={%
next page vector={\pgfqpoint{0pt}{0pt}}%
},
}
\def\savepointas#1#2{%
\expandafter\gdef\csname save@pt@#1\endcsname{#2}%
}
\def\savepicturepage#1#2{%
\expandafter\gdef\csname save@pg@#1\endcsname{#2}%
}
\def\tmk@labeldef#1,#2\@nil{%
\def\tmk@label{#1}%
\def\tmk@def{#2}%
}
\tikzdeclarecoordinatesystem{pic}{%
\pgfutil@in@,{#1}%
\ifpgfutil@in@%
\tmk@labeldef#1\@nil
\else
\tmk@labeldef#1,(0pt,0pt)\@nil
\fi
\@ifundefined{save@pt@\tmk@label}{%
\tikz@scan@one@point\pgfutil@firstofone\tmk@def
}{%
\pgfsys@getposition{\csname save@pt@\tmk@label\endcsname}\save@orig@pic%
\pgfsys@getposition{\pgfpictureid}\save@this@pic%
\pgf@process{\pgfpointorigin\save@this@pic}%
\pgf@xa=\pgf@x
\pgf@ya=\pgf@y
\pgf@process{\pgfpointorigin\save@orig@pic}%
\advance\pgf@x by -\pgf@xa
\advance\pgf@y by -\pgf@ya
\pgf@xa=\pgf@x
\pgf@ya=\pgf@y
\@ifundefined{save@pg@\csname save@pt@\tmk@label\endcsname}{}{%
\@ifundefined{save@pg@\pgfpictureid}{}{%
\pgfkeysvalueof{/tikz/next page vector}%
\advance \pgf@xa by \csname save@pg@\csname save@pt@\tmk@label\endcsname\endcsname\pgf@x\relax
\advance \pgf@ya by \csname save@pg@\csname save@pt@\tmk@label\endcsname\endcsname\pgf@y\relax
\advance \pgf@xa by -\csname save@pg@\pgfpictureid\endcsname\pgf@x\relax
\advance \pgf@ya by -\csname save@pg@\pgfpictureid\endcsname\pgf@y\relax
}%
}%
\pgf@x=\pgf@xa
\pgf@y=\pgf@ya
}%
}
\newcommand\tikzmark[2][]{%
\tikz[remember picture with id=#2] #1;}
\newcommand\pgfmark[1]{%
\bgroup
\global\advance\pgf@picture@serial@count by1\relax%
\edef\pgfpictureid{pgfid\the\pgf@picture@serial@count}%
\pgfsys@markposition{\pgfpictureid}%
\edef\pgf@temp{%
\noexpand\write\noexpand\pgfutil@auxout{%
\string\savepicturepage{\pgfpictureid}{\noexpand\thepage}}}%
\pgf@temp
\immediate\write\pgfutil@auxout{%
\string\savepointas{#1}{\pgfpictureid}}%
\egroup
}
\newcommand\iftikzmark[3]{%
\@ifundefined{save@pt@#1}{%
#3%
}{%
#2%
}%
}%
\newcommand\subnode[3][]{%
\begingroup
\pgfmark{#2}%
\setbox\pgfnodeparttextbox=\hbox\bgroup #3\egroup
\def\tikz@shape{rectangle}%
\def\tikz@anchor{center}%
\def\tikz@fig@name{#2}%
\tikzset{every subnode/.try,#1}%
\pgfpointorigin
\tikz@scan@one@point\pgfutil@firstofone(pic cs:#2)\relax
\advance\pgf@x by .5\wd\pgfnodeparttextbox
\advance\pgf@y by .5\ht\pgfnodeparttextbox
\advance\pgf@y by -.5\dp\pgfnodeparttextbox
\pgftransformshift{}%
\setbox\@tempboxa=\hbox\bgroup
\pgfutil@ifundefined{pgf@sh@s@\tikz@shape}%
{\PackageError{pgf}{Unknown shape ``\tikz@shape''}{}}%
{%
{%
\let\pgf@sh@savedmacros=\pgfutil@empty% MW
\let\pgf@sh@savedpoints=\pgfutil@empty%
\def\pgf@sm@shape@name{\tikz@shape}% CJ % TT added prefix!
\csname pgf@sh@s@\tikz@shape\endcsname%
\pgf@sh@savedpoints%
\pgf@sh@savedmacros% MW
\pgftransformshift{%
\pgf@sh@reanchor{\tikz@shape}{\tikz@anchor}%
\pgf@x=-\pgf@x%
\pgf@y=-\pgf@y%
}%
\expandafter\pgfsavepgf@process\csname pgf@sh@sa@\tikz@fig@name\endcsname{%
\pgf@sh@reanchor{\tikz@shape}{\tikz@anchor}% FIXME : this is double work!
}%
% Save the saved points and the transformation matrix
\edef\pgf@node@name{\tikz@fig@name}%
\ifx\pgf@node@name\pgfutil@empty%
\else%
\expandafter\xdef\csname pgf@sh@ns@\pgf@node@name\endcsname{\tikz@shape}%
\edef\pgf@sh@@temp{\noexpand\gdef\expandafter\noexpand\csname pgf@sh@np@\pgf@node@name\endcsname}%
\expandafter\pgf@sh@@temp\expandafter{\pgf@sh@savedpoints}%
\edef\pgf@sh@@temp{\noexpand\gdef\expandafter\noexpand\csname pgf@sh@ma@\pgf@node@name\endcsname}% MW
\expandafter\pgf@sh@@temp\expandafter{\pgf@sh@savedmacros}% MW
\pgfgettransform\pgf@temp
\expandafter\xdef\csname pgf@sh@nt@\pgf@node@name\endcsname{\pgf@temp}%
\expandafter\xdef\csname pgf@sh@pi@\pgf@node@name\endcsname{\pgfpictureid}%
\fi%
}%
}%
\egroup
\box\pgfnodeparttextbox
\endgroup
}
\def\usetikzmarklibrary{\pgfutil@ifnextchar[{\use@tikzmarklibrary}{\use@@tikzmarklibrary}}%}
\def\use@tikzmarklibrary[#1]{\use@@tikzmarklibrary{#1}}
\def\use@@tikzmarklibrary#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 tikzmark@library@\pgf@temp @loaded\endcsname\relax%
\expandafter\global\expandafter\let\csname tikzmark@library@\pgf@temp @loaded\endcsname=\pgfutil@empty%
\expandafter\edef\csname tikzmark@library@#1@atcode\endcsname{\the\catcode`\@}
\expandafter\edef\csname tikzmark@library@#1@barcode\endcsname{\the\catcode`\|}
\catcode`\@=11
\catcode`\|=12
\pgfutil@InputIfFileExists{tikzmarklibrary\pgf@temp.code.tex}{}{
\PackageError{tikzmark}{I did not find the tikzmark extras library '\pgf@temp'.}{}
}%
\catcode`\@=\csname tikzmark@library@#1@atcode\endcsname
\catcode`\|=\csname tikzmark@library@#1@barcode\endcsname
\fi%
\fi
}%
}
%%
%% Copyright (C) 2011 by Andrew Stacey <stacey@math.ntnu.no>
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License (LPPL), either
%% version 1.3c of this license or (at your option) any later
%% version. The latest version of this license is in the file:
%%
%% http://www.latex-project.org/lppl.txt
%%
%% This work is "maintained" (as per LPPL maintenance status) by
%% Andrew Stacey.
%%
%% This work consists of the file tikzmark.dtx
%% and the derived files tikzmark.ins,
%% tikzmark.pdf,
%% tikzlibrarytikzmark.code.tex, and
%% tikzmarklibrarylistings.code.tex
%% tikzmarklibraryhighlight.code.tex
%%
%%
%% End of file `tikzlibrarytikzmark.code.tex'.
|