diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/tikzmark')
4 files changed, 961 insertions, 108 deletions
diff --git a/Master/texmf-dist/tex/latex/tikzmark/tikzlibrarytikzmark.code.tex b/Master/texmf-dist/tex/latex/tikzmark/tikzlibrarytikzmark.code.tex index 8db5f2e37b3..92f8b76435d 100644 --- a/Master/texmf-dist/tex/latex/tikzmark/tikzlibrarytikzmark.code.tex +++ b/Master/texmf-dist/tex/latex/tikzmark/tikzlibrarytikzmark.code.tex @@ -12,9 +12,10 @@ %% See http://www.latex-project.org/lppl.txt %% ---------------------------------------------------------------- %% + \ProvidesFile{tikzlibrarytikzmark.code.tex}[% - 2021/02/16 - v1.10 + 2022/08/24 + v1.15 TikZ library for marking positions in a document] \RequirePackage{expl3, l3keys2e, xparse} \tikzset{% @@ -127,6 +128,61 @@ }, tikzmark prefix/.initial=,% tikzmark suffix/.initial=,% + tikzmark clear ixes/.style={ + tikzmark prefix={}, + tikzmark suffix={} + }, + scope anchor location/.initial={(0,0)}, + scope anchor location/.default=@auto, + pic anchor/.style={ + scope anchor location={#1}, + next pic/.append style={ + adjust scope position, + } + }, + scope anchor/.style={ + scope anchor location={#1}, + adjust scope position, + }, + adjust scope position/.code={% + \pgfutil@ifundefined{tikz@fig@name}% + {\let\tikz@fig@name=\pgfutil@empty}{}% + \tikz@resetexpandcount% + \tikz@fig@mustbenamed + \pgfkeysgetvalue{/tikz/scope anchor location}\tkzmk@anchor + \ifx\tkzmk@anchor\tikz@auto@text + \tikzset{local bounding box/.expanded=\tikz@fig@name}% + \def\tkzmk@anchor{(\tikz@fig@name.\tikz@anchor)}% + \fi + \tikz@scan@one@point + \pgfutil@firstofone(pic cs:\tikz@fig@name-origin)\relax + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \tikz@scan@one@point + \pgfutil@firstofone(pic cs:\tikz@fig@name-anchor)\relax + \advance\pgf@xa by -\pgf@x + \advance\pgf@ya by -\pgf@y + \tikzset{ + shift={(\the\pgf@xa,\the\pgf@ya)}, + execute at end scope={% + \tikzmark{\tikz@fig@name-origin}{(0,0)}% + \tikzmark{\tikz@fig@name-anchor}{\tkzmk@anchor}% + } + } + }, + every pic/.append style={ + next pic/.try, + next pic/.style={} + }, + save pic bounding box/.code={ + \tikz@fig@mustbenamed + \tikzset{local bounding box/.expanded=\tikz@fig@name} + }, + surround pic/.style={ + next pic/.append style={ + save pic bounding box + } + }, } \def\tikzmark@pp@name#1{% \csname pgfk@/tikz/tikzmark prefix\endcsname% @@ -141,9 +197,20 @@ \def\savepicturepage#1#2{% \expandafter\gdef\csname save@pg@#1\endcsname{#2}% } +\def\@tikzmarkalias#1#2{% + \@ifundefined{save@pt@#2}{}{% + \pgf@node@gnamelet{save@pt@#1}{save@pt@#2}% + \pgf@node@gnamelet{save@pt@#1@offset}{save@pt@#2@offset}% + \protected@write\pgfutil@auxout{}{% + \string\savepointas% + {#1}{\csname save@pt@#2\endcsname}% + \expandafter\expandafter\expandafter + \@gobble\csname save@pt@#2@offset\endcsname + }% + }% +} \def\tikzmarkalias#1#2{% - \pgf@node@gnamelet{save@pt@#1}{save@pt@#2}% - \pgf@node@gnamelet{save@pt@#1@offset}{save@pt@#2@offset}% + \@tikzmarkalias{\tikzmark@pp@name{#1}}{\tikzmark@pp@name{#2}}% } \def\tmk@labeldef#1,#2\@nil{% \edef\tmk@label{\tikzmark@pp@name{#1}}% @@ -157,7 +224,8 @@ \tmk@labeldef#1,(0pt,0pt)\@nil \fi \@ifundefined{save@pt@\tmk@label}{% - \tikz@scan@one@point\pgfutil@firstofone\tmk@def + \expandafter\tikz@scan@one@point + \expandafter\pgfutil@firstofone\tmk@def\relax }{% \pgfsys@getposition{\csname save@pt@\tmk@label\endcsname}% \save@orig@pic% @@ -205,7 +273,9 @@ } \def\tikzmark@inside#1#2{% \tikzset{remember picture}% + \tikz@resetexpandcount% \tikz@scan@one@point\pgfutil@firstofone#2\relax + \pgf@pos@transform{\pgf@x}{\pgf@y}% \protected@write\pgfutil@auxout{}{% \string\savepointas% {\tikzmark@pp@name{#1}}{\pgfpictureid}{\the\pgf@x}{\the\pgf@y}}% @@ -224,18 +294,22 @@ \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 - } + \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}}% @@ -272,7 +346,9 @@ \@ifundefined{save@pt@\tikzmark@pp@name{#1}}{% \tikzmark@false }{% - \@ifundefined{save@pg@\csname save@pt@\tikzmark@pp@name{#1}\endcsname}{% + \@ifundefined{save@pg@% + \csname save@pt@\tikzmark@pp@name{#1}\endcsname% + }{% \tikzmark@false }{% \ifnum\csname save@pg@% @@ -290,7 +366,9 @@ \@ifundefined{save@pt@\tikzmark@pp@name{#1}}{% \tikzmark@false }{% - \@ifundefined{save@pg@\csname save@pt@\tikzmark@pp@name{#1}\endcsname}{% + \@ifundefined{save@pg@% + \csname save@pt@\tikzmark@pp@name{#1}\endcsname% + }{% \tikzmark@false }{% \ifnum\csname save@pg@% @@ -308,8 +386,7 @@ \begingroup \pgfmark{#2}% \setbox\pgfnodeparttextbox=\hbox\bgroup #3\egroup - \def\tikz@fig@name{#2}% - \tikzset{every subnode/.try,#1}% + \tikzset{every subnode/.try,#1,name=#2}% \pgfpointorigin \tikz@scan@one@point\pgfutil@firstofone(pic cs:#2)\relax \advance\pgf@x by .5\wd\pgfnodeparttextbox @@ -329,24 +406,30 @@ \pgf@x=-\pgf@x% \pgf@y=-\pgf@y% }% - \expandafter\pgfsavepgf@process\csname pgf@sh@sa@\tikz@fig@name\endcsname{% + \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}% + \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}% + \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 + \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}% + \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 @@ -369,31 +452,34 @@ \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}% + \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}% + \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}% + \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}% + \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{#2}{#2-d}% - \tikzmarkalias{#2}{#2-d}% + \pgfnodealias{\tikz@pp@name{#2}}{\tikz@pp@name{#2-d}}% + \@tikzmarkalias{\tikzmark@pp@name{#2}}{\tikzmark@pp@name{#2-d}}% \fi \else - \pgfnodealias{#2}{#2-t}% - \tikzmarkalias{#2}{#2-t}% + \pgfnodealias{\tikz@pp@name{#2}}{\tikz@pp@name{#2-t}}% + \@tikzmarkalias{\tikzmark@pp@name{#2}}{\tikzmark@pp@name{#2-t}}% \fi \else - \pgfnodealias{#2}{#2-s}% - \tikzmarkalias{#2}{#2-s}% + \pgfnodealias{\tikz@pp@name{#2}}{\tikz@pp@name{#2-s}}% + \@tikzmarkalias{\tikzmark@pp@name{#2}}{\tikzmark@pp@name{#2-s}}% \fi \else - \pgfnodealias{#2}{#2-ss}% - \tikzmarkalias{#2}{#2-ss}% + \pgfnodealias{\tikz@pp@name{#2}}{\tikz@pp@name{#2-ss}}% + \@tikzmarkalias{\tikzmark@pp@name{#2}}{\tikzmark@pp@name{#2-ss}}% \fi \else \subnode@{#1}{#2}{#3}% @@ -436,74 +522,153 @@ \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}% + \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}% + \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}% + \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}}% + \@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}}% + \@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}}% + \@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}}% + \@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}}% + \@tikzmarkalias{\tikzmark@pp@name{#2}}{\tikzmark@pp@name{#2-ss}}% \fi \else \tikzmarknode@{#1}{#2}{#3}% \fi } +\def\tikzmark@box#1#2{% + \begingroup + \pgfmark{#1}% + \let\pgfnodeparttextbox=#2% + \edef\pgfpictureid{pgfid\the\pgf@picture@serial@count}% + \def\tikz@fig@name{#1}% + \pgfpointorigin + \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 + {% + \tikzset{ + inner sep=0pt, + minimum size=0pt, + outer sep=0pt, + anchor=base + }% + \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 + \endgroup + \box#2% +} \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}% + \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\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`\|} + \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'.}{} - }% + \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 +\cs_new_protected:Nn \tikzmark_tl_put_right_braced:Nn + { + \tl_put_right:Nn #1 { { #2 } } + } +\cs_generate_variant:Nn \tikzmark_tl_put_right_braced:Nn { NV, cV, cv, Nx, cx } +\tl_new:N \g__sn_output_tl \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 +\clist_new:N \g__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 +\bool_gset_true:N \g__sn_preamble_bool +\keys_define:nn {tikzmark / save nodes} +{ + file .bool_set:N = \l__sn_file_bool, + group .tl_set:N = \l__sn_group_tl, +} \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 @@ -556,67 +721,88 @@ \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 +\cs_new_nopar:Npn \__sn_process_node:n #1 { + \group_begin: \tl_clear:N \l__sn_tmpa_tl - \tikz_scan_point:NNn \l__sn_x_dim \l__sn_y_dim {(current~ bounding~ box.center)} + \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} { - \tl_if_exist:cT {pgf@sh@ns@##1} + \clist_map_inline:nn {ns,np,ma,pi} { - \clist_map_inline:nn {ns,np,ma,pi} + \tl_put_right:Nn \l__sn_tmpa_tl { - \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_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:Nn \l__sn_tmpa_tl { - \tl_gset:cn {pgf@sh@nt@ \tikz_set_node_name:n{##1} } + \tl_put_right:Nx \l__sn_tmpa_tl {{}} } - \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_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 + \tl_gset_eq:NN \g__sn_output_tl \l__sn_tmpa_tl + \group_end: +} +\cs_new_protected_nopar:Npn \process_node:Nn #1#2 +{ + \__sn_process_node:n {#2} + \tl_set_eq:NN #1 \g__sn_output_tl + \tl_gclear:N \g__sn_output_tl +} +\cs_new_protected_nopar:Npn \process_gnode:Nn #1#2 +{ + \__sn_process_node:n {#2} + \tl_gset_eq:NN #1 \g__sn_output_tl + \tl_gclear:N \g__sn_output_tl } \cs_new_nopar:Npn \save_nodes_to_list:nn #1#2 { - \save_nodes:Nn \l__sn_tmpa_tl {#2} + \tl_clear:N \l__sn_tmpa_tl + \clist_map_inline:nn {#2} + { + \process_node:Nn \l__sn_tmpb_tl {##1} + \tl_put_right:NV \l__sn_tmpa_tl \l__sn_tmpb_tl + } \prop_gput:NnV \g__sn_prop {#1} \l__sn_tmpa_tl } +\cs_generate_variant:Nn \iow_now:Nn {NV} \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 + \clist_map_inline:nn {#1} { - \iow_newline: - \exp_not:V \l__sn_tmpa_tl - \iow_newline: + \process_node:Nn \l__sn_tmpa_tl {##1} + \iow_now:Nx \g__sn_stream + { + \iow_newline: + \exp_not:V \l__sn_tmpa_tl + } } } -\cs_generate_variant:Nn \save_nodes_to_list:nn {VV} +\cs_generate_variant:Nn \save_nodes_to_list:nn {VV, Vn} \cs_generate_variant:Nn \save_nodes_to_file:n {V} \cs_new_nopar:Npn \restore_nodes_from_list:n #1 { @@ -638,6 +824,7 @@ \msg_warning:nnn {tikzmark} {no file} {#1} } } +\cs_generate_variant:Nn \restore_nodes_from_file:n {x} \AtBeginDocument{\bool_gset_false:N \g__sn_preamble_bool} \cs_new_nopar:Npn \compose_transformations:Nnn #1#2#3 @@ -698,7 +885,8 @@ } } } -\cs_generate_variant:Nn \compose_transformations:Nnn {cVv,NVv,NVn,NvV,NnV} +\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} @@ -708,8 +896,12 @@ \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}} + \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} @@ -746,25 +938,32 @@ } }, 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} + \tl_if_eq:nnTF {#1} {\pgfkeysnovalue} + { + \tikz_fig_must_be_named: + \pgfkeysalso{ + append~ after~ command={ + \pgfextra{ + \clist_gput_right:Nv \g__sn_nodes_clist {tikz@last@fig@name} + } } } } + { + \clist_gput_right:Nn \g__sn_nodes_clist {#1} + } }, restore~ nodes~ from~ file/.code={ \bool_if:NTF \g__sn_preamble_bool { - \restore_nodes_from_file:n {#1} + \restore_nodes_from_file:x {#1} } { \tikz_fig_must_be_named: \pgfkeysalso{append~ after~ command={ \pgfextra{ \scope - \split_argument:NNn \tikzset \restore_nodes_from_file:n {#1} + \split_argument:NNn \tikzset \restore_nodes_from_file:x {#1} \endscope } } @@ -803,20 +1002,43 @@ } \cs_new_nopar:Npn \maybe_save_nodes: { - \clist_if_empty:NF \l__sn_nodes_clist + \clist_if_empty:NF \g__sn_nodes_clist { \bool_if:NTF \l__sn_file_bool { - \save_nodes_to_file:V \l__sn_nodes_clist + \save_nodes_to_file:V \g__sn_nodes_clist } { \tl_if_empty:NF \l__sn_group_tl { - \save_nodes_to_list:VV \l__sn_group_tl \l__sn_nodes_clist + \save_nodes_to_list:VV \l__sn_group_tl \g__sn_nodes_clist } } - \clist_gclear:N \l__sn_nodes_clist + \clist_gclear:N \g__sn_nodes_clist + } +} +\DeclareDocumentCommand \SaveNode { o m } +{ + \group_begin: + \IfNoValueF {#1} + { + \keys_set:nn {tikzmark / save nodes} + { + file=false, + group=#1 + } + } + \bool_if:NTF \l__sn_file_bool + { + \save_nodes_to_file:n {#2} + } + { + \tl_if_empty:NF \l__sn_group_tl + { + \save_nodes_to_list:Vn \l__sn_group_tl {#2} + } } + \group_end: } \ExplSyntaxOff %% @@ -837,6 +1059,8 @@ %% tikzmark.pdf, %% tikzlibrarytikzmark.code.tex, and %% tikzmarklibrarylistings.code.tex +%% tikzmarklibraryhighlighting.code.tex +%% tikzmarklibraryams.code.tex %% %% %% End of file `tikzlibrarytikzmark.code.tex'. diff --git a/Master/texmf-dist/tex/latex/tikzmark/tikzmarklibraryams.code.tex b/Master/texmf-dist/tex/latex/tikzmark/tikzmarklibraryams.code.tex new file mode 100644 index 00000000000..247b5797b0a --- /dev/null +++ b/Master/texmf-dist/tex/latex/tikzmark/tikzmarklibraryams.code.tex @@ -0,0 +1,67 @@ +%% +%% This is file `tikzmarklibraryams.code.tex', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% tikzmark.dtx (with options: `ams') +%% ---------------------------------------------------------------- +%% 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 +%% ---------------------------------------------------------------- +%% + +\@ifpackageloaded{amsmath}{% + \let\tikzmark@ams@boxz@=\boxz@ + \newcounter{tikzmarkequation} + \def\tikzmark@ams@name{equation} + \def\tikzmark@boxz@{% + \ifmeasuring@ + \tikzmark@ams@boxz@ + \else + \stepcounter{tikzmarkequation}% + \tikzmark@box{\tikzmark@ams@name-\thetikzmarkequation}{\z@}% + \fi + } + \newenvironment{tikzmarkmath}[1][equation]{% + \def\tikzmark@ams@name{#1}% + \setcounter{tikzmarkequation}{0}% + \let\boxz@=\tikzmark@boxz@ + }{% + \let\boxz@=\tikzmark@ams@boxz@ + \message{% + Tikzmark math environment + \tikzmark@ams@name\space had + \the\value{tikzmarkequation} nodes in it + }% + } +}{% + \PackageError{tikzmark AMS}% + {The amsmath package has not been loaded.}% + {} +} +%% +%% Copyright (C) 2011-2021 by Andrew Stacey <loopspace@mathforge.org> +%% +%% 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 +%% tikzmarklibraryhighlighting.code.tex +%% tikzmarklibraryams.code.tex +%% +%% +%% End of file `tikzmarklibraryams.code.tex'. diff --git a/Master/texmf-dist/tex/latex/tikzmark/tikzmarklibraryhighlighting.code.tex b/Master/texmf-dist/tex/latex/tikzmark/tikzmarklibraryhighlighting.code.tex new file mode 100644 index 00000000000..c7759160e77 --- /dev/null +++ b/Master/texmf-dist/tex/latex/tikzmark/tikzmarklibraryhighlighting.code.tex @@ -0,0 +1,558 @@ +%% +%% This is file `tikzmarklibraryhighlighting.code.tex', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% tikzmark.dtx (with options: `highlighting') +%% ---------------------------------------------------------------- +%% 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 +%% ---------------------------------------------------------------- +%% + +\ExplSyntaxOn +\cs_new_protected_nopar:Npn \tikzmark_fix_name:Nn #1#2 +{ + \tl_set:Nx #1 {\tikzmark@pp@name{#2}} +} +\tl_new:N \g__tikzmark_highlighter_tl +\tl_set:Nn \g__tikzmark_highlighter_tl {tikzmark~ highlighter~} +\int_new:N \g__tikzmark_highlighter_int +\tl_new:N \l__tikzmark_start_tl +\tl_new:N \l__tikzmark_end_tl +\tl_new:N \l__tikzmark_highlighter_name_tl +\tl_new:N \l__tikzmark_tmpa_tl +\tl_new:N \l__tikzmark_tmpb_tl +\tl_new:N \l__tikzmark_tmpc_tl + +\cs_new_protected_nopar:Npn \tikzmark_bake_highlighter:N #1 +{ + \tl_clear:N #1 + \clist_map_inline:nn {direction,layer} + { + \tl_put_right:Nx #1 { + /tikz/highlighter/##1=\pgfkeysvalueof{/tikz/highlighter/##1}, + } + } + \clist_map_inline:nn { + initial~ height, + initial~ depth, + initial~ offset, + final~ height, + final~ depth, + final~ offset, + left~ margin, + right~ margin, + top~ margin, + bottom~ margin, + } + { + \tl_put_right:Nx #1 { + /tikz/highlighter/##1=\dim_eval:n {\pgfkeysvalueof{/tikz/highlighter/##1}}, + } + } +} + +\cs_new_protected_nopar:Npn \tikzmark_start_highlighting:n #1 +{ + \int_gincr:N \g__tikzmark_highlighter_int + \tl_set:Nx \l__tikzmark_highlighter_name_tl + { + \tl_use:N \g__tikzmark_highlighter_tl + \int_use:N \g__tikzmark_highlighter_int + } + \tl_set:Nn \l__tikzmark_tmpb_tl + { + every~ highlighter/.try, + } + \tikzmark_bake_highlighter:N \l__tikzmark_tmpc_tl + \tl_put_right:NV \l__tikzmark_tmpb_tl \l__tikzmark_tmpc_tl + \tl_put_right:Nn \l__tikzmark_tmpb_tl {#1} + \tikzmark_process_highlighting:VV + \l__tikzmark_tmpb_tl + \l__tikzmark_highlighter_name_tl + \tikzmark{highlight-start-\tl_use:N \l__tikzmark_highlighter_name_tl} +} +\cs_new_protected_nopar:Npn \tikzmark_end_highlighting: +{ + \tl_set:Nx \l__tikzmark_highlighter_name_tl + { + \tl_use:N \g__tikzmark_highlighter_tl + \int_use:N \g__tikzmark_highlighter_int + } + \tikzmark{highlight-end-\tl_use:N \l__tikzmark_highlighter_name_tl} +} + +\NewDocumentCommand \StartHighlighting {O{}} +{% + \tikzmark_start_highlighting:n {#1} +} +\NewDocumentCommand \StopHighlighting {} +{% + \tikzmark_end_highlighting: +} +\NewDocumentCommand \Highlight {O{} m} +{% + \tikzmark_start_highlighting:n {#1} + #2 + \tikzmark_end_highlighting: +} +\tl_const:Nx \c__tikzmark_colon_tl +{ + \char_generate:nn {`:} {12} +} + +\cs_generate_variant:Nn \hook_gput_next_code:nn {nV} +\cs_new_protected_nopar:Npn \tikzmark_highlight_or_shunt:nnnn #1#2#3#4 +{ + \bool_lazy_all:nT + { + {\tl_if_exist_p:c {save@pt@\tikzmark@pp@name{#2}}} + {\tl_if_exist_p:c {save@pg@\tl_use:c{save@pt@\tikzmark@pp@name{#2}}}} + {\tl_if_exist_p:c {save@pt@\tikzmark@pp@name{#3}}} + {\tl_if_exist_p:c {save@pg@\tl_use:c{save@pt@\tikzmark@pp@name{#3}}}} + } + { + \int_compare:nTF + { + \tl_use:c {save@pg@\tl_use:c{save@pt@\tikzmark@pp@name{#2}}} + > + \the\value{page} + } + { + \hook_gput_next_code:nn {#1} { + \tikzmark_highlight_or_shunt:nnnn {#1}{#2}{#3}{#4} + } + } + { + \tl_set:Nn \l__tikzmark_tmpa_tl {#4} + \int_compare:nTF + { + \tl_use:c {save@pg@\tl_use:c{save@pt@\tikzmark@pp@name{#2}}} + = + \the\value{page} + } + { + \tl_put_right:Nx \l__tikzmark_tmpa_tl + { + { + pic~ cs + \tl_use:N \c__tikzmark_colon_tl + #2 + } + } + } + { + \tl_put_right:Nn \l__tikzmark_tmpa_tl + { + { + page.north~ west + } + } + } + \int_compare:nTF + { + \tl_use:c {save@pg@\tl_use:c{save@pt@\tikzmark@pp@name{#3}}} + = + \the\value{page} + } + { + \tl_put_right:Nx \l__tikzmark_tmpa_tl + { + { + pic~ cs + \tl_use:N \c__tikzmark_colon_tl + #3 + } + } + } + { + \tl_put_right:Nn \l__tikzmark_tmpa_tl + { + { + page.south~ east + } + } + \hook_gput_next_code:nn {#1} { + \tikzmark_highlight_or_shunt:nnnn {#1}{#2}{#3}{#4} + } + } + \tl_use:N \l__tikzmark_tmpa_tl + } + } +} +\cs_new_protected_nopar:Npn \tikzmark_process_highlighting:nn #1#2 +{ + \pgfkeys{/tikz/highlighter/configuration/.activate~ family} + \pgfkeysfiltered{/tikz/.cd,highlighter/direction,highlighter/layer,#1} + + \tikzmark_fix_name:Nn \l__tikzmark_start_tl {highlight-start-#2} + \tikzmark_fix_name:Nn \l__tikzmark_end_tl {highlight-end-#2} + \tl_set:Nx \l__tikzmark_tmpa_tl {\pgfkeysvalueof{/tikz/highlighter/direction}} + \tl_clear:N \l__tikzmark_tmpb_tl + \tl_clear:N \l__tikzmark_tmpc_tl + \tl_if_eq:NnTF \l__tikzmark_tmpa_tl {vertical} + { + \tl_put_right:Nn \l__tikzmark_tmpb_tl + { + \vl@draw + } + } + { + \tl_if_eq:NnTF \l__tikzmark_tmpa_tl {box} + { + \tl_put_right:Nn \l__tikzmark_tmpb_tl + { + \box@draw + } + } + { + \tl_put_right:Nn \l__tikzmark_tmpb_tl + { + \hl@draw + } + } + } + + \tl_put_right:Nn \l__tikzmark_tmpb_tl + { + {tikzmark~ clear~ ixes,#1} + } + + \tl_set:Nx \l__tikzmark_tmpa_tl {\pgfkeysvalueof{/tikz/highlighter/layer}} + \tl_set:Nn \l__tikzmark_tmpc_tl + { + \tikzmark_highlight_or_shunt:nnnn + } + \tl_if_eq:NnTF \l__tikzmark_tmpa_tl {foreground} + { + \tl_put_right:Nn \l__tikzmark_tmpc_tl {{shipout/foreground}} + } + { + \tl_put_right:Nn \l__tikzmark_tmpc_tl {{shipout/background}} + } + + \tikzmark_tl_put_right_braced:NV \l__tikzmark_tmpc_tl \l__tikzmark_start_tl + \tikzmark_tl_put_right_braced:NV \l__tikzmark_tmpc_tl \l__tikzmark_end_tl + \tikzmark_tl_put_right_braced:NV \l__tikzmark_tmpc_tl \l__tikzmark_tmpb_tl + + \tl_if_eq:NnTF \l__tikzmark_tmpa_tl {foreground} + { + \hook_gput_next_code:nV {shipout/foreground} \l__tikzmark_tmpc_tl + } + { + \hook_gput_next_code:nV {shipout/background} \l__tikzmark_tmpc_tl + } +} +\cs_generate_variant:Nn \tikzmark_process_highlighting:nn {nV,VV} +\ExplSyntaxOff +\def\hl@draw#1#2#3{% + \pgfkeys{/tikz/highlighter/configuration/.activate family} + \pgfkeysfiltered{/tikz/.cd,highlighter/direction,highlighter/layer,#1} + \begin{tikzpicture}[ + remember picture, + overlay, + highlight picture action, + #1, + ]% + \page@node + \tikz@scan@one@point\pgfutil@firstofone(#2)\relax + \pgf@ya=\pgf@y + \tikz@scan@one@point\pgfutil@firstofone(#3)\relax + \pgf@yb=\pgf@y + \ifdim\pgf@ya=\pgf@yb + \path (#2) + ++(-1*\pgfkeysvalueof{/tikz/highlighter/initial offset}, + \pgfkeysvalueof{/tikz/highlighter/initial height}) + coordinate (start); + \path (#3) + ++(\pgfkeysvalueof{/tikz/highlighter/final offset}, + -1*\pgfkeysvalueof{/tikz/highlighter/final depth}) + coordinate (end); + \path[ + highlight action, + #1 + ] (start) rectangle (end); + \else + \path (page.east) + ++(\pgfkeysvalueof{/tikz/highlighter/right margin},0pt) + coordinate (east); + \path (page.west) + ++(-1*\pgfkeysvalueof{/tikz/highlighter/left margin},0pt) + coordinate (west); + \pgfmathsetlength\pgf@x{% + \pgfkeysvalueof{/tikz/highlighter/initial height}% + }% + \advance\pgf@yb by \pgf@x\relax + \pgfmathsetlength\pgf@x{% + -1*\pgfkeysvalueof{/tikz/highlighter/final depth}% + }% + \advance\pgf@ya by \pgf@x\relax + \ifdim\pgf@yb>\pgf@ya + \path (#2) + ++(-1*\pgfkeysvalueof{/tikz/highlighter/initial offset}, + \pgfkeysvalueof{/tikz/highlighter/initial height}) + coordinate (start); + \path (#2) + ++(0pt,-1*\pgfkeysvalueof{/tikz/highlighter/final depth}) + coordinate (end); + \path[ + highlight action, + #1 + ] (start) rectangle (end -| east); + \path (#3) + ++(0pt,\pgfkeysvalueof{/tikz/highlighter/initial height}) + coordinate (start); + \path (#3) + ++(\pgfkeysvalueof{/tikz/highlighter/final offset}, + -1*\pgfkeysvalueof{/tikz/highlighter/final depth}) + coordinate (end); + \path[ + highlight action, + #1 + ] (start -| west) rectangle (end); + \else + \path (#2) + ++(-1*\pgfkeysvalueof{/tikz/highlighter/initial offset}, + \pgfkeysvalueof{/tikz/highlighter/initial height}) + coordinate (tl); + \path (#2) + ++(-1*\pgfkeysvalueof{/tikz/highlighter/initial offset}, + -1*\pgfkeysvalueof{/tikz/highlighter/initial depth}) + coordinate (start); + \path (#3) + ++(\pgfkeysvalueof{/tikz/highlighter/final offset}, + -1*\pgfkeysvalueof{/tikz/highlighter/final depth}) + coordinate (end); + \path (#3) + ++(\pgfkeysvalueof{/tikz/highlighter/final offset}, + \pgfkeysvalueof{/tikz/highlighter/final height}) + coordinate (mr); + \path[ + highlight action, + #1 + ] (start) -- (tl) -- (tl -| east) -- (mr -| east) -- (mr) -- + (end) -- (end -| west) -- (start -| west) -- cycle; + \fi + \fi + \end{tikzpicture}% +} +\def\box@draw#1#2#3{% + \pgfkeys{/tikz/highlighter/configuration/.activate family} + \pgfkeysfiltered{/tikz/.cd,highlighter/direction,highlighter/layer,#1} + \begin{tikzpicture}[ + remember picture, + overlay, + highlight picture action, + #1, + ]% + \tikz@scan@one@point\pgfutil@firstofone(#2)\relax + \pgf@xa=\pgf@x + \tikz@scan@one@point\pgfutil@firstofone(#3)\relax + \pgf@xb=\pgf@x + \def\tkmk@high@bscale{1}% + \ifdim\pgf@xa>\pgf@xb + \def\tkmk@high@bscale{-1}% + \fi + \path (#2) + ++({\tkmk@high@bscale*(-1)*\pgfkeysvalueof{/tikz/highlighter/initial offset}}, + \pgfkeysvalueof{/tikz/highlighter/initial height}) + coordinate (start); + \path (#3) + ++(\tkmk@high@bscale*\pgfkeysvalueof{/tikz/highlighter/final offset}, + -1*\pgfkeysvalueof{/tikz/highlighter/final depth}) + coordinate (end); + \path[ + highlight action, + #1 + ] (start) rectangle (end); + \end{tikzpicture}% +} +\def\vl@draw#1#2#3{% + \pgfkeys{/tikz/highlighter/configuration/.activate family} + \pgfkeysfiltered{/tikz/.cd,highlighter/direction,highlighter/layer,#1} + \begin{tikzpicture}[ + remember picture, + overlay, + highlight picture action, + #1, + ]% + \tikz@scan@one@point\pgfutil@firstofone(#2)\relax + \pgf@ya=\pgf@y + \pgf@xa=\pgf@x + \tikz@scan@one@point\pgfutil@firstofone(#3)\relax + \pgf@yb=\pgf@y + \pgf@xb=\pgf@x + \pgfmathsetlength\pgf@y{% + \pgfkeysvalueof{/tikz/highlighter/initial offset}% + }% + \advance\pgf@yb by \pgf@y + \pgfmathsetlength\pgf@y{% + -1*\pgfkeysvalueof{/tikz/highlighter/final offset}% + }% + \advance\pgf@ya by \pgf@y + \ifdim\pgf@yb>\pgf@ya + \ifdim\pgf@xa>\pgf@xb + \path (#2) + ++(\pgfkeysvalueof{/tikz/highlighter/initial height}, + \pgfkeysvalueof{/tikz/highlighter/initial offset}) + coordinate (start); + \path (#3) + ++(-1*\pgfkeysvalueof{/tikz/highlighter/final depth}, + -1*\pgfkeysvalueof{/tikz/highlighter/final offset}) + coordinate (end); + \else + \path (#2) + ++(-1*\pgfkeysvalueof{/tikz/highlighter/initial depth}, + \pgfkeysvalueof{/tikz/highlighter/initial offset}) + coordinate (start); + \path (#3) + ++(\pgfkeysvalueof{/tikz/highlighter/final height}, + -1*\pgfkeysvalueof{/tikz/highlighter/final offset}) + coordinate (end); + \fi + \path[ + highlight action, + #1 + ] (start) rectangle (end); + \else + \path (#2) + ++(\pgfkeysvalueof{/tikz/highlighter/initial height},0) + coordinate (tr); + \path (#2) + ++(0,\pgfkeysvalueof{/tikz/highlighter/initial offset}) + coordinate (start); + \path (#2) + ++(-1*\pgfkeysvalueof{/tikz/highlighter/initial depth},0) + coordinate (tl); + \path (#3) + ++(\pgfkeysvalueof{/tikz/highlighter/final height},0) + coordinate (br); + \path (#3) + ++(0,-1*\pgfkeysvalueof{/tikz/highlighter/final offset}) + coordinate (end); + \path (#3) + ++(-1*\pgfkeysvalueof{/tikz/highlighter/final depth},0) + coordinate (bl); + \tikz@scan@one@point\pgfutil@firstofone(#2)\relax + \pgf@xa=\pgf@x + \tikz@scan@one@point\pgfutil@firstofone(#3)\relax + \pgf@xb=\pgf@x + \ifdim\pgf@xa<\pgf@xb + \path[ + highlight action, + #1 + ] (tl) |- (start) -| (tr) -| (br) |- (end) -| (bl) -| cycle; + \else + \path[ + highlight action, + #1 + ] (tl) |- (start) -| (tr) |- (br) |- (end) -| (bl) |- cycle; + \fi + \fi + \end{tikzpicture} +} +\tikzset{% + /tikz/highlighter/.is family, + /tikz/highlighter/.unknown/.code={% + \let\tk@searchname=\pgfkeyscurrentname% + \pgfkeysalso{% + /tikz/\tk@searchname=#1 + } + }, + every highlight path/.style={ + fill=yellow!50, + rounded corners, + }, + every foreground highlight path/.style={ + fill opacity=.5, + }, + highlight picture action/.style={ + every highlight picture/.try, + every \pgfkeysvalueof{/tikz/highlighter/direction} highlight picture/.try, + every \pgfkeysvalueof{/tikz/highlighter/layer} highlight picture/.try, + }, + highlight action/.style={ + every highlight path/.try, + every \pgfkeysvalueof{/tikz/highlighter/direction} highlight path/.try, + every \pgfkeysvalueof{/tikz/highlighter/layer} highlight path/.try, + highlight path/.try, + \pgfkeysvalueof{/tikz/highlighter/direction} highlight path/.try, + \pgfkeysvalueof{/tikz/highlighter/layer} highlight path/.try, + }, + /tikz/highlighter/.cd, + direction/.initial=horizontal, + layer/.initial=background, + direction/.default=horizontal, + layer/.default=background, + initial height/.initial=\baselineskip, + initial depth/.initial=.5ex, + initial offset/.initial=.5\baselineskip, + final height/.initial=\baselineskip, + final depth/.initial=.5ex, + final offset/.initial=.5\baselineskip, + left margin/.initial=.5\baselineskip, + right margin/.initial=.5\baselineskip, + top margin/.initial=.5\baselineskip, + bottom margin/.initial=-.5\baselineskip, + height/.style={ + initial height=#1, + final height=#1 + }, + depth/.style={ + initial depth=#1, + final depth=#1 + }, + offset/.style={ + initial offset=#1, + final offset=#1 + }, + margin/.style={ + left margin=#1, + right margin=#1, + top margin=#1, + bottom margin=#1, + }, + /tikz/highlighter/configuration/.is family, + /tikz/highlighter/direction/.belongs to family=/tikz/highlighter/configuration, + /tikz/highlighter/layer/.belongs to family=/tikz/highlighter/configuration, +} +\def\page@node{ + \path (current page.north west) + ++(\hoffset + 1in + \oddsidemargin + \leftskip, + -\voffset - 1in - \topmargin - \headheight - \headsep) + node[ + minimum width=\textwidth - \leftskip - \rightskip, + minimum height=\textheight, + anchor=north west, + line width=0mm, + inner sep=0pt, + outer sep=0pt, + ] (page) {}; +} +%% +%% Copyright (C) 2011-2021 by Andrew Stacey <loopspace@mathforge.org> +%% +%% 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 +%% tikzmarklibraryhighlighting.code.tex +%% tikzmarklibraryams.code.tex +%% +%% +%% End of file `tikzmarklibraryhighlighting.code.tex'. diff --git a/Master/texmf-dist/tex/latex/tikzmark/tikzmarklibrarylistings.code.tex b/Master/texmf-dist/tex/latex/tikzmark/tikzmarklibrarylistings.code.tex index 2692b3fa8f6..60c68f306a6 100644 --- a/Master/texmf-dist/tex/latex/tikzmark/tikzmarklibrarylistings.code.tex +++ b/Master/texmf-dist/tex/latex/tikzmark/tikzmarklibrarylistings.code.tex @@ -12,6 +12,7 @@ %% See http://www.latex-project.org/lppl.txt %% ---------------------------------------------------------------- %% + \@ifpackageloaded{listings}{% \newif\iflst@linemark \lst@linemarktrue @@ -45,7 +46,8 @@ \pgfmark{line-\lst@name-\tkzmk@lst@start-start}% } }{% - \PackageError{tikzmark listings}{The listings package has not been loaded.}{} + \PackageError{tikzmark listings}% + {The listings package has not been loaded.}{} } %% %% Copyright (C) 2011-2021 by Andrew Stacey <loopspace@mathforge.org> @@ -65,6 +67,8 @@ %% tikzmark.pdf, %% tikzlibrarytikzmark.code.tex, and %% tikzmarklibrarylistings.code.tex +%% tikzmarklibraryhighlighting.code.tex +%% tikzmarklibraryams.code.tex %% %% %% End of file `tikzmarklibrarylistings.code.tex'. |