%% %% 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: loopspace@mathforge.org %% Released under the LaTeX Project Public License v1.3c or later %% See http://www.latex-project.org/lppl.txt %% ---------------------------------------------------------------- %% \ProvidesFile{tikzlibrarytikzmark.code.tex}[% 2021/02/16 v1.10 TikZ library for marking positions in a document] \RequirePackage{expl3, l3keys2e, xparse} \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\arabic{page}}% }% }% \pgf@temp \fi% }, }, check picture id/.code={ \ifpgfrememberpicturepositiononpage \@ifundefined{pgf@sys@pdf@mark@pos@\pgfpictureid}{% \tikzset{% name prefix/.get=\tzmk@name@prefix, name prefix/.prefix=discard-, execute at end picture={% \tikzset{name prefix/.expand once=\tzmk@name@prefix}% }, }% }{}% \fi }, maybe define node/.style={% execute at end picture={% \ifpgfrememberpicturepositiononpage \@ifundefined{pgf@sh@pi@\tikz@pp@name{#1}}{% \pgfnodealias{\tikz@pp@name{#1}}{discard-\tikz@pp@name{#1}}% }{}% \fi }% }, save picture id/.code={% \protected@write\pgfutil@auxout{}{% \string\savepointas% {\tikzmark@pp@name{#1}}{\pgfpictureid}{0pt}{0pt}}% }, if picture id/.code args={#1#2#3}{% \@ifundefined{save@pt@\tikzmark@pp@name{#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}}% }, if tikzmark on current page/.code n args={3}{% \@ifundefined{save@pt@\tikzmark@pp@name{#1}}{% \pgfkeysalso{#3}% }{% \@ifundefined{% save@pg@\csname save@pt@\tikzmark@pp@name{#1}\endcsname }{% \pgfkeysalso{#3}% }{% \ifnum\csname save@pg@% \csname save@pt@\tikzmark@pp@name{#1}\endcsname% \endcsname=\the\value{page}\relax% \pgfkeysalso{#2}% \else \pgfkeysalso{#3}% \fi }% }% }, if tikzmark on page/.code n args={4}{% \@ifundefined{save@pt@\tikzmark@pp@name{#1}}{% \pgfkeysalso{#4}% }{% \@ifundefined{% save@pg@\csname save@pt@\tikzmark@pp@name{#1}@label\endcsname% }{% \pgfkeysalso{#4}% }{% \ifnum\csname save@pg@% \csname save@pt@\tikzmark@pp@name{#1}\endcsname% \endcsname=#2\relax% \pgfkeysalso{#3}% \else \pgfkeysalso{#4}% \fi }% }% }, tikzmark prefix/.initial=,% tikzmark suffix/.initial=,% } \def\tikzmark@pp@name#1{% \csname pgfk@/tikz/tikzmark prefix\endcsname% #1% \csname pgfk@/tikz/tikzmark suffix\endcsname% }% \def\savepointas#1#2#3#4{% \expandafter\gdef\csname save@pt@#1\endcsname{#2}% \expandafter\gdef\csname save@pt@#1@offset\endcsname% {\pgfqpoint{#3}{#4}}% } \def\savepicturepage#1#2{% \expandafter\gdef\csname save@pg@#1\endcsname{#2}% } \def\tikzmarkalias#1#2{% \pgf@node@gnamelet{save@pt@#1}{save@pt@#2}% \pgf@node@gnamelet{save@pt@#1@offset}{save@pt@#2@offset}% } \def\tmk@labeldef#1,#2\@nil{% \edef\tmk@label{\tikzmark@pp@name{#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 \pgf@process% {\pgfpointorigin\csname save@pt@\tmk@label @offset\endcsname}% \advance\pgf@xa by \pgf@x \advance\pgf@ya by \pgf@y \@ifundefined{save@pg@\csname save@pt@\tmk@label\endcsname}{}{% \@ifundefined{save@pg@\pgfpictureid}{}{% \pgfkeysvalueof{/tikz/next page vector}% \edef\tmk@pg{% \the\numexpr \csname save@pg@% \csname save@pt@\tmk@label\endcsname\endcsname% - \csname save@pg@\pgfpictureid\endcsname\relax% }% \ifnum \tmk@pg > 0 \relax \advance \pgf@xa by \pgf@x\relax \advance \pgf@ya by \pgf@y\relax \fi \ifnum \tmk@pg < 0 \relax \advance \pgf@xa by -\pgf@x\relax \advance \pgf@ya by -\pgf@y\relax \fi }% }% \pgf@x=\pgf@xa \pgf@y=\pgf@ya \pgftransforminvert \pgf@pos@transform{\pgf@x}{\pgf@y}% }% } \newcommand\tikzmark@outside[2][]{% \tikzset{external/export next/.try=false}% \tikz[remember picture with id=#2]{#1}% } \def\tikzmark@inside#1#2{% \tikzset{remember picture}% \tikz@scan@one@point\pgfutil@firstofone#2\relax \protected@write\pgfutil@auxout{}{% \string\savepointas% {\tikzmark@pp@name{#1}}{\pgfpictureid}{\the\pgf@x}{\the\pgf@y}}% } \def\tikzmark{% \ifx\pgfpictureid\@undefined \let\tikzmark@next=\tikzmark@outside \else \relax \ifx\scope\tikz@origscope\relax \let\tikzmark@next=\tikzmark@outside \else \let\tikzmark@next=\tikzmark@inside \fi \fi \tikzmark@next% } \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\arabic{page}}}}% \pgf@temp \protected@write\pgfutil@auxout{}{% \string\savepointas{\tikzmark@pp@name{#1}}{\pgfpictureid}{0pt}{0pt}}% \egroup } \@ifclassloaded{beamer}{ \renewcommand<>{\tikzmark@outside}[2][]{% \only#3{\beameroriginal{\tikzmark@outside}[{#1}]{#2}}% } \renewcommand<>{\tikzmark@inside}[2]{% \only#3{\beameroriginal{\tikzmark@inside}{#1}{#2}}% } }{} \@ifclassloaded{beamer}{ \renewcommand<>{\pgfmark}[1]{\only#2{\beameroriginal{\pgfmark}{#1}}} }{} \@ifclassloaded{beamer}{ \tikzset{ tikzmark suffix=-\the\beamer@slideinframe } }{} \newif\iftikzmark@ \newcommand\iftikzmark[3]{% \@ifundefined{save@pt@\tikzmark@pp@name{#1}}{% #3% }{% #2% }% }% \newcommand\iftikzmarkexists[1]{% \@ifundefined{save@pt@\tikzmark@pp@name{#1}}{% \tikzmark@false% }{% \tikzmark@true% }% \iftikzmark@ }% \newcommand\iftikzmarkonpage[2]{% \@ifundefined{save@pt@\tikzmark@pp@name{#1}}{% \tikzmark@false }{% \@ifundefined{save@pg@\csname save@pt@\tikzmark@pp@name{#1}\endcsname}{% \tikzmark@false }{% \ifnum\csname save@pg@% \csname save@pt@\tikzmark@pp@name{#1}\endcsname% \endcsname=#2\relax% \tikzmark@true \else \tikzmark@false \fi }% }% \iftikzmark@ } \newcommand\iftikzmarkoncurrentpage[1]{% \@ifundefined{save@pt@\tikzmark@pp@name{#1}}{% \tikzmark@false }{% \@ifundefined{save@pg@\csname save@pt@\tikzmark@pp@name{#1}\endcsname}{% \tikzmark@false }{% \ifnum\csname save@pg@% \csname save@pt@\tikzmark@pp@name{#1}\endcsname% \endcsname=\the\value{page}\relax% \tikzmark@true \else \tikzmark@false \fi }% }% \iftikzmark@ } \def\subnode@#1#2#3{% \begingroup \pgfmark{#2}% \setbox\pgfnodeparttextbox=\hbox\bgroup #3\egroup \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 {% \let\pgf@sh@savedmacros=\pgfutil@empty% MW \let\pgf@sh@savedpoints=\pgfutil@empty% \def\pgf@sm@shape@name{rectangle}% CJ % TT added prefix! \pgf@sh@s@rectangle% \pgf@sh@savedpoints% \pgf@sh@savedmacros% MW \pgftransformshift{% \pgf@sh@reanchor{rectangle}{center}% \pgf@x=-\pgf@x% \pgf@y=-\pgf@y% }% \expandafter\pgfsavepgf@process\csname pgf@sh@sa@\tikz@fig@name\endcsname{% \pgf@sh@reanchor{rectangle}{center}% 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{rectangle}% \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 } \newcommand\subnode[3][]{% \ifmmode \mathchoice{% \subnode@{#1}{#2-d}{\(\displaystyle #3\)}% }{% \subnode@{#1}{#2-t}{\(\textstyle #3\)}% }{% \subnode@{#1}{#2-s}{\(\scriptstyle #3\)}% }{% \subnode@{#1}{#2-ss}{\(\scriptscriptstyle #3\)}% }% \let\pgf@nodecallback\pgfutil@gobble \def\tzmk@prfx{pgf@sys@pdf@mark@pos@pgfid}% \edef\tzmk@pic{\tzmk@prfx\the\pgf@picture@serial@count} \expandafter\ifx\csname\tzmk@pic\endcsname\relax \edef\tzmk@pic{\tzmk@prfx\the\numexpr\the\pgf@picture@serial@count-1\relax}% \expandafter\ifx\csname\tzmk@pic\endcsname\relax \edef\tzmk@pic{\tzmk@prfx\the\numexpr\the\pgf@picture@serial@count-2\relax}% \expandafter\ifx\csname\tzmk@pic\endcsname\relax \edef\tzmk@pic{\tzmk@prfx\the\numexpr\the\pgf@picture@serial@count-3\relax}% \expandafter\ifx\csname\tzmk@pic\endcsname\relax \pgfutil@ifundefined{pgf@sh@ns@#2}{% \pgfnodealias{#2}{#2-t}% \tikzmarkalias{#2}{#2-t}% }{}% \else \pgfnodealias{#2}{#2-d}% \tikzmarkalias{#2}{#2-d}% \fi \else \pgfnodealias{#2}{#2-t}% \tikzmarkalias{#2}{#2-t}% \fi \else \pgfnodealias{#2}{#2-s}% \tikzmarkalias{#2}{#2-s}% \fi \else \pgfnodealias{#2}{#2-ss}% \tikzmarkalias{#2}{#2-ss}% \fi \else \subnode@{#1}{#2}{#3}% \fi } \def\tikzmarknode@#1#2#3{% \tikzset{external/export next/.try=false}% \tikz[% remember picture, save picture id={#2}, check picture id, maybe define node={#2}, baseline=(#2.base), every tikzmarknode picture/.try ] { \node[ anchor=base, inner sep=0pt, minimum width=0pt, name={#2}, node contents={#3}, every tikzmarknode/.try, #1 ]}% } \newcommand\tikzmarknode[3][]{% \ifmmode \mathchoice{% \tikzmarknode@{#1}{#2-d}{\(\displaystyle #3\)}% }{% \tikzmarknode@{#1}{#2-t}{\(\textstyle #3\)}% }{% \tikzmarknode@{#1}{#2-s}{\(\scriptstyle #3\)}% }{% \tikzmarknode@{#1}{#2-ss}{\(\scriptscriptstyle #3\)}% }% \let\pgf@nodecallback\pgfutil@gobble \def\tzmk@prfx{pgf@sys@pdf@mark@pos@pgfid}% \edef\tzmk@pic{\tzmk@prfx\the\pgf@picture@serial@count}% \expandafter\ifx\csname\tzmk@pic\endcsname\relax \edef\tzmk@pic{\tzmk@prfx\the\numexpr\the\pgf@picture@serial@count-1\relax}% \expandafter\ifx\csname\tzmk@pic\endcsname\relax \edef\tzmk@pic{\tzmk@prfx\the\numexpr\the\pgf@picture@serial@count-2\relax}% \expandafter\ifx\csname\tzmk@pic\endcsname\relax \edef\tzmk@pic{\tzmk@prfx\the\numexpr\the\pgf@picture@serial@count-3\relax}% \expandafter\ifx\csname\tzmk@pic\endcsname\relax \pgfutil@ifundefined{pgf@sh@ns@\tikz@pp@name{#2}}{% \pgfnodealias{\tikz@pp@name{#2}}{\tikz@pp@name{#2-t}}% \tikzmarkalias{\tikzmark@pp@name{#2}}{\tikzmark@pp@name{#2-t}}% }{}% \else \pgfnodealias{\tikz@pp@name{#2}}{\tikz@pp@name{#2-d}}% \tikzmarkalias{\tikzmark@pp@name{#2}}{\tikzmark@pp@name{#2-d}}% \fi \else \pgfnodealias{\tikz@pp@name{#2}}{\tikz@pp@name{#2-t}}% \tikzmarkalias{\tikzmark@pp@name{#2}}{\tikzmark@pp@name{#2-t}}% \fi \else \pgfnodealias{\tikz@pp@name{#2}}{\tikz@pp@name{#2-s}}% \tikzmarkalias{\tikzmark@pp@name{#2}}{\tikzmark@pp@name{#2-s}}% \fi \else \pgfnodealias{\tikz@pp@name{#2}}{\tikz@pp@name{#2-ss}}% \tikzmarkalias{\tikzmark@pp@name{#2}}{\tikzmark@pp@name{#2-ss}}% \fi \else \tikzmarknode@{#1}{#2}{#3}% \fi } \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 }% } \ExplSyntaxOn \prop_new:N \g__sn_prop \tl_new:N \l__sn_tmpa_tl \tl_new:N \l__sn_tmpb_tl \tl_new:N \l__open_bracket_tl \tl_set:Nn \l__open_bracket_tl {[} %] \tl_new:N \l__sn_group_tl \clist_new:N \l__sn_nodes_clist \bool_new:N \l__sn_file_bool \bool_new:N \g__sn_preamble_bool \bool_set_true:N \g__sn_preamble_bool \msg_new:nnn {tikzmark} {no file} {File~ "#1"~ doesn't~ exist.} \msg_new:nnn {tikzmark} {loading nodes} {Loading~ nodes~ from~ "#1".} \dim_new:N \l__sn_x_dim \dim_new:N \l__sn_y_dim \dim_new:N \l__sn_xa_dim \dim_new:N \l__sn_ya_dim \tl_new:N \l__sn_centre_tl \tl_new:N \l__sn_transformation_tl \tl_set:Nn \l__sn_transformation_tl {{1}{0}{0}{1}{0pt}{0pt}} \iow_new:N \g__sn_stream \bool_new:N \g__sn_stream_bool \tl_new:N \g__sn_filename_tl \tl_gset:Nx \g__sn_filename_tl {\c_sys_jobname_str} \cs_new_nopar:Npn \sn_open_stream: { \bool_if:NF \g__sn_stream_bool { \iow_open:Nn \g__sn_stream {\tl_use:N \g__sn_filename_tl .nodes} \bool_gset_true:N \g__sn_stream_bool } } \AtEndDocument { \ExplSyntaxOn \bool_if:NT \g__sn_stream_bool { \iow_close:N \g__sn_stream } \ExplSyntaxOff } \makeatletter \cs_set_eq:NN \tikz_set_node_name:n \tikz@pp@name \cs_set_eq:NN \tikz_fig_must_be_named: \tikz@fig@mustbenamed \cs_new_nopar:Npn \tikz_scan_point:n #1 { \tikz@scan@one@point\pgfutil@firstofone#1\relax } \cs_new_nopar:Npn \tikz_scan_point:NNn #1#2#3 { \tikz@scan@one@point\pgfutil@firstofone#3\relax \dim_set_eq:NN #1 \pgf@x \dim_set_eq:NN #2 \pgf@y } \makeatother \cs_generate_variant:Nn \tikz_scan_point:n {V} \cs_generate_variant:Nn \tikz_scan_point:NNn {NNV} \cs_new_nopar:Npn \save_nodes:Nn #1#2 { \tl_clear:N \l__sn_tmpa_tl \tikz_scan_point:NNn \l__sn_x_dim \l__sn_y_dim {(current~ bounding~ box.center)} \dim_set:Nn \l__sn_x_dim {-\l__sn_x_dim} \dim_set:Nn \l__sn_y_dim {-\l__sn_y_dim} \tl_set:Nx \l__sn_centre_tl { {1}{0}{0}{1}{\dim_use:N \l__sn_x_dim}{\dim_use:N \l__sn_y_dim} } \clist_map_inline:nn {#2} { \tl_if_exist:cT {pgf@sh@ns@##1} { \clist_map_inline:nn {ns,np,ma,pi} { \tl_put_right:Nn \l__sn_tmpa_tl { \tl_gset:cn {pgf@sh@####1@ \tikz_set_node_name:n{##1} } } \tl_if_exist:cTF {pgf@sh@####1@##1} { \tl_put_right:Nx \l__sn_tmpa_tl { {\exp_not:v {pgf@sh@####1@ \tikz_set_node_name:n {##1}}} } } { \tl_put_right:Nx \l__sn_tmpa_tl {{}} } } \tl_put_right:Nn \l__sn_tmpa_tl { \tl_gset:cn {pgf@sh@nt@ \tikz_set_node_name:n{##1} } } \compose_transformations:NVv \l__sn_tmpb_tl \l__sn_centre_tl {pgf@sh@nt@##1} \tl_put_right:Nx \l__sn_tmpa_tl {{\exp_not:V \l__sn_tmpb_tl}} \tl_put_right:Nn \l__sn_tmpa_tl { \transform_node:Nn \l__sn_transformation_tl { \tikz_set_node_name:n{##1} } } } } \tl_set_eq:NN #1 \l__sn_tmpa_tl } \cs_new_nopar:Npn \save_nodes_to_list:nn #1#2 { \save_nodes:Nn \l__sn_tmpa_tl {#2} \prop_gput:NnV \g__sn_prop {#1} \l__sn_tmpa_tl } \cs_new_nopar:Npn \save_nodes_to_file:n #1 { \save_nodes:Nn \l__sn_tmpa_tl {#1} \sn_open_stream: \iow_now:Nx \g__sn_stream { \iow_newline: \exp_not:V \l__sn_tmpa_tl \iow_newline: } } \cs_generate_variant:Nn \save_nodes_to_list:nn {VV} \cs_generate_variant:Nn \save_nodes_to_file:n {V} \cs_new_nopar:Npn \restore_nodes_from_list:n #1 { \prop_get:NnNT \g__sn_prop {#1} \l__sn_tmpa_tl { \tl_use:N \l__sn_tmpa_tl } } \cs_new_nopar:Npn \restore_nodes_from_file:n #1 { \file_if_exist:nTF {#1.nodes} { \msg_log:nnn {tikzmark} {loading nodes} {#1} \ExplSyntaxOn \file_input:n {#1.nodes} \ExplSyntaxOff } { \msg_warning:nnn {tikzmark} {no file} {#1} } } \AtBeginDocument{\bool_gset_false:N \g__sn_preamble_bool} \cs_new_nopar:Npn \compose_transformations:Nnn #1#2#3 { \tl_gset:Nx #1 { {\fp_eval:n { \tl_item:nn {#2} {1} * \tl_item:nn {#3} {1} + \tl_item:nn {#2} {3} * \tl_item:nn {#3} {2} } } {\fp_eval:n { \tl_item:nn {#2} {2} * \tl_item:nn {#3} {1} + \tl_item:nn {#2} {4} * \tl_item:nn {#3} {2} } } {\fp_eval:n { \tl_item:nn {#2} {1} * \tl_item:nn {#3} {3} + \tl_item:nn {#2} {3} * \tl_item:nn {#3} {4} } } {\fp_eval:n { \tl_item:nn {#2} {2} * \tl_item:nn {#3} {3} + \tl_item:nn {#2} {4} * \tl_item:nn {#3} {4} } } {\fp_to_dim:n { \tl_item:nn {#2} {1} * \tl_item:nn {#3} {5} + \tl_item:nn {#2} {3} * \tl_item:nn {#3} {6} + \tl_item:nn {#2} {5} } } {\fp_to_dim:n { \tl_item:nn {#2} {2} * \tl_item:nn {#3} {5} + \tl_item:nn {#2} {4} * \tl_item:nn {#3} {6} + \tl_item:nn {#2} {6} } } } } \cs_generate_variant:Nn \compose_transformations:Nnn {cVv,NVv,NVn,NvV,NnV} \cs_new_nopar:Npn \transform_node:Nn #1#2 { \compose_transformations:cVv {pgf@sh@nt@#2} #1 {pgf@sh@nt@#2} } \cs_new_nopar:Npn \set_transform_from_node:n #1 { \tl_set_eq:Nc \l__sn_transformation_tl {pgf@sh@nt@#1} \tikz_scan_point:NNn \l__sn_x_dim \l__sn_y_dim {(#1.center)} \dim_set:Nn \l__sn_x_dim {\l__sn_x_dim - \tl_item:cn {pgf@sh@nt@#1}{5}} \dim_set:Nn \l__sn_y_dim {\l__sn_y_dim - \tl_item:cn {pgf@sh@nt@#1}{6}} \compose_transformations:NnV \l__sn_transformation_tl { {1}{0}{0}{1}{\dim_use:N \l__sn_x_dim}{\dim_use:N \l__sn_y_dim} } \l__sn_transformation_tl } \cs_generate_variant:Nn \set_transform_from_node:n {v} \tikzset{ set~ saved~ nodes~ file~ name/.code={ \tl_gset:Nx \g__sn_filename_tl {#1} }, transform~ saved~ nodes/.code={ \set_transform_from_node:v {tikz@last@fig@name} }, set~ node~ group/.code={ \tl_set:Nn \l__sn_group_tl {#1} \pgfkeysalso{ execute~ at~ end~ scope={ \maybe_save_nodes: } } }, save~ nodes~ to~ file/.code={ \tl_if_eq:nnTF {#1}{false} { \bool_set_false:N \l__sn_file_bool } { \bool_set_true:N \l__sn_file_bool } \pgfkeysalso{ execute~ at~ end~ scope={ \maybe_save_nodes: } } }, save~ node/.code={ \tikz_fig_must_be_named: \pgfkeysalso{append~ after~ command={ \pgfextra{ \clist_gput_right:Nv \l__sn_nodes_clist {tikz@last@fig@name} } } } }, restore~ nodes~ from~ file/.code={ \bool_if:NTF \g__sn_preamble_bool { \restore_nodes_from_file:n {#1} } { \tikz_fig_must_be_named: \pgfkeysalso{append~ after~ command={ \pgfextra{ \scope \split_argument:NNn \tikzset \restore_nodes_from_file:n {#1} \endscope } } } } }, restore~ nodes~ from~ file/.default = \g__sn_filename_tl, restore~ nodes~ from~ list/.code={ \tikz_fig_must_be_named: \pgfkeysalso{append~ after~ command={ \pgfextra{ \scope \split_argument:NNn \tikzset \restore_nodes_from_list:n {#1} \endscope } } } } } \cs_generate_variant:Nn \clist_gput_right:Nn {Nv} \cs_new_nopar:Npn \split_argument:NNn #1#2#3 { \tl_set:Nx \l__sn_tmpa_tl {\tl_head:n {#3}} \tl_if_eq:NNTF \l__sn_tmpa_tl \l__open_bracket_tl { \split_argument_aux:NNp #1#2#3 } { #2 {#3} } } \cs_new_nopar:Npn \split_argument_aux:NNp #1#2[#3]#4 { #1 {#3} #2 {#4} } \cs_new_nopar:Npn \maybe_save_nodes: { \clist_if_empty:NF \l__sn_nodes_clist { \bool_if:NTF \l__sn_file_bool { \save_nodes_to_file:V \l__sn_nodes_clist } { \tl_if_empty:NF \l__sn_group_tl { \save_nodes_to_list:VV \l__sn_group_tl \l__sn_nodes_clist } } \clist_gclear:N \l__sn_nodes_clist } } \ExplSyntaxOff %% %% Copyright (C) 2011-2021 by Andrew Stacey %% %% 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 %% %% %% End of file `tikzlibrarytikzmark.code.tex'.