%% %% 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 %% %% 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'.