diff options
author | Karl Berry <karl@freefriends.org> | 2012-12-18 23:30:56 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-12-18 23:30:56 +0000 |
commit | c91e3655599727bf81bc5a8cc8238ddedfe5c689 (patch) | |
tree | a3e62d1ccbe8e36b3b4482f82bff346a68225ec3 /Master/texmf-dist/tex/latex/hf-tikz/hf-tikz.sty | |
parent | fcce22577fd96970b6e25ce53ccad5ebaba7d7c4 (diff) |
hf-tikz (18dec12)
git-svn-id: svn://tug.org/texlive/trunk@28573 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/hf-tikz/hf-tikz.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/hf-tikz/hf-tikz.sty | 314 |
1 files changed, 161 insertions, 153 deletions
diff --git a/Master/texmf-dist/tex/latex/hf-tikz/hf-tikz.sty b/Master/texmf-dist/tex/latex/hf-tikz/hf-tikz.sty index bd0e703e83b..ac3e67aaef4 100644 --- a/Master/texmf-dist/tex/latex/hf-tikz/hf-tikz.sty +++ b/Master/texmf-dist/tex/latex/hf-tikz/hf-tikz.sty @@ -5,29 +5,19 @@ %% The original source files were: %% %% hf-tikz.dtx (with options: `package') -%% Copyright (C) 2012 by Claudio Fiandrino -%% ------------------------------------------- +%% * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +%% * hf-tikz --- A simple way to highlight formulas and formula parts. +%% * +%% * E-mail: claudio dot fiandrino at gmail dot com +%% * +%% * Released under the LaTeX Project Public License v1.3c or later +%% * +%% * See http://www.latex-project.org/lppl.txt +%% * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * %% -%% This file may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3 -%% of this license or (at -%% your option) any later version. -%% The latest version of this license is in: -%% -%% http://www.latex-project.org/lppl.txt -%% -%% and version 1.3 or later is part of all distributions of LaTeX -%% version 2005/12/01 or later. -%% -%% This work is "maintained" (as per LPPL maintenance status) by -%% Claudio Fiandrino. -%% -%% This work consists of the file hf-tikz.dtx -%% and the derived files hf-tikz.pdf and -%% hf-tikz.sty. - \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{hf-tikz}[2012/08/17 v0.1 A simple way to highlight formulas and formula parts.] +\ProvidesPackage{hf-tikz}[2012/12/18 v0.1a A simple way to highlight formulas and formula parts.] + \RequirePackage{tikz} \usetikzlibrary{shadings} \RequirePackage{xparse} @@ -63,91 +53,91 @@ %% Settings \ifbool{beamer}{%true - \newcounter{jumping} - \resetcounteronoverlays{jumping} - - \def\jump@setbb#1#2#3{% - \@ifundefined{jump@#1@maxbb}{% - \expandafter\gdef\csname jump@#1@maxbb\endcsname{#3}% - }{% - \csname jump@#1@maxbb\endcsname - \pgf@xa=\pgf@x - \pgf@ya=\pgf@y - #3 - \pgfmathsetlength\pgf@x{max(\pgf@x,\pgf@xa)}% - \pgfmathsetlength\pgf@y{max(\pgf@y,\pgf@ya)}% - \expandafter\xdef\csname jump@#1@maxbb\endcsname{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}% - } - \@ifundefined{jump@#1@minbb}{% - \expandafter\gdef\csname jump@#1@minbb\endcsname{#2}% - }{% - \csname jump@#1@minbb\endcsname - \pgf@xa=\pgf@x - \pgf@ya=\pgf@y - #2 - \pgfmathsetlength\pgf@x{min(\pgf@x,\pgf@xa)}% - \pgfmathsetlength\pgf@y{min(\pgf@y,\pgf@ya)}% - \expandafter\xdef\csname jump@#1@minbb\endcsname{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}% - } + \newcounter{jumping} + \resetcounteronoverlays{jumping} + + \def\jump@setbb#1#2#3{% + \@ifundefined{jump@#1@maxbb}{% + \expandafter\gdef\csname jump@#1@maxbb\endcsname{#3}% + }{% + \csname jump@#1@maxbb\endcsname + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + #3 + \pgfmathsetlength\pgf@x{max(\pgf@x,\pgf@xa)}% + \pgfmathsetlength\pgf@y{max(\pgf@y,\pgf@ya)}% + \expandafter\xdef\csname jump@#1@maxbb\endcsname{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}% } - - \tikzset{% - remember picture with id/.style={% - remember picture, - overlay, - save picture id=#1, - }, - save picture id/.code={% - \edef\pgf@temp{#1}% + \@ifundefined{jump@#1@minbb}{% + \expandafter\gdef\csname jump@#1@minbb\endcsname{#2}% + }{% + \csname jump@#1@minbb\endcsname + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + #2 + \pgfmathsetlength\pgf@x{min(\pgf@x,\pgf@xa)}% + \pgfmathsetlength\pgf@y{min(\pgf@y,\pgf@ya)}% + \expandafter\xdef\csname jump@#1@minbb\endcsname{\noexpand\pgfpoint{\the\pgf@x}{\the\pgf@y}}% + } + } + + \tikzset{% + remember picture with id/.style={% + remember picture, + overlay, + save picture id=#1, + }, + save picture id/.code={% + \edef\pgf@temp{#1}% + \immediate\write\pgfutil@auxout{% + \noexpand\savepointas{\pgf@temp}{\pgfpictureid}}% + }, + if picture id/.code args={#1#2#3}{% + \@ifundefined{save@pt@#1}{% + \pgfkeysalso{#3}% + }{ + \pgfkeysalso{#2}% + } + }, + onslide/.code args={<#1>#2}{% + \only<#1>{\pgfkeysalso{#2}}% + }, + alt/.code args={<#1>#2#3}{% + \alt<#1>{\pgfkeysalso{#2}}{\pgfkeysalso{#3}}% + }, + stop jumping/.style={ + execute at end picture={% + \stepcounter{jumping}% \immediate\write\pgfutil@auxout{% - \noexpand\savepointas{\pgf@temp}{\pgfpictureid}}% - }, - if picture id/.code args={#1#2#3}{% - \@ifundefined{save@pt@#1}{% - \pgfkeysalso{#3}% - }{ - \pgfkeysalso{#2}% - } - }, - onslide/.code args={<#1>#2}{% - \only<#1>{\pgfkeysalso{#2}}% - }, - alt/.code args={<#1>#2#3}{% - \alt<#1>{\pgfkeysalso{#2}}{\pgfkeysalso{#3}}% - }, - stop jumping/.style={ - execute at end picture={% - \stepcounter{jumping}% - \immediate\write\pgfutil@auxout{% - \noexpand\jump@setbb{\the\value{jumping}}{\noexpand\pgfpoint{\the\pgf@picminx}{\the\pgf@picminy}}{\noexpand\pgfpoint{\the\pgf@picmaxx}{\the\pgf@picmaxy}} - }, - \csname jump@\the\value{jumping}@maxbb\endcsname - \path (\the\pgf@x,\the\pgf@y); - \csname jump@\the\value{jumping}@minbb\endcsname - \path (\the\pgf@x,\the\pgf@y); + \noexpand\jump@setbb{\the\value{jumping}}{\noexpand\pgfpoint{\the\pgf@picminx}{\the\pgf@picminy}}{\noexpand\pgfpoint{\the\pgf@picmaxx}{\the\pgf@picmaxy}} }, - } + \csname jump@\the\value{jumping}@maxbb\endcsname + \path (\the\pgf@x,\the\pgf@y); + \csname jump@\the\value{jumping}@minbb\endcsname + \path (\the\pgf@x,\the\pgf@y); + }, } + } }{% false - \tikzset{% - remember picture with id/.style={% - remember picture, - overlay, - save picture id=#1, - }, - save picture id/.code={% - \edef\pgf@temp{#1}% - \immediate\write\pgfutil@auxout{% - \noexpand\savepointas{\pgf@temp}{\pgfpictureid}}% - }, - if picture id/.code args={#1#2#3}{% - \@ifundefined{save@pt@#1}{% - \pgfkeysalso{#3}% - }{ - \pgfkeysalso{#2}% - } + \tikzset{% + remember picture with id/.style={% + remember picture, + overlay, + save picture id=#1, + }, + save picture id/.code={% + \edef\pgf@temp{#1}% + \immediate\write\pgfutil@auxout{% + \noexpand\savepointas{\pgf@temp}{\pgfpictureid}}% + }, + if picture id/.code args={#1#2#3}{% + \@ifundefined{save@pt@#1}{% + \pgfkeysalso{#3}% + }{ + \pgfkeysalso{#2}% } } + } } \def\savepointas#1#2{% @@ -164,7 +154,7 @@ \ifpgfutil@in@% \tmk@labeldef#1\@nil \else - \tmk@labeldef#1,\pgfpointorigin\@nil + \tmk@labeldef#1,(0pt,0pt)\@nil \fi \@ifundefined{save@pt@\tmk@label}{% \tikz@scan@one@point\pgfutil@firstofone\tmk@def @@ -180,66 +170,84 @@ }% } \ifbool{beamer}{%true - \ifbool{fill}{%true-fill - \ifbool{shade}{%true-shade - \NewDocumentCommand{\tikzmarkin}{r<> d[] m D(){0.1,-0.18} D(){-0.1,0.35}}{% - \IfNoValueTF{#2}{%true-val - \only<#1>{\tikz[remember picture,overlay] - \draw[line width=1pt,rectangle,rounded corners,fill=\fcol,draw=\bcol] - (pic cs:#3) ++(#4) rectangle (#5) node [anchor=base] (#3){} - ;} - }{%false-val - \only<#1>{\tikz[remember picture,overlay] - \draw[line width=1pt,rectangle,rounded corners,fill=\fcol,#2,draw=\bcol] - (pic cs:#3) ++(#4) rectangle (#5) node [anchor=base] (#3){} - ;}} - } - }{%false-shade - \NewDocumentCommand{\tikzmarkin}{r<> m D(){0.1,-0.18} D(){-0.1,0.35}}{% - \only<#1>{\tikz[remember picture,overlay] - \draw[line width=1pt,rectangle,rounded corners,fill=\fcol,draw=\bcol] - (pic cs:#2) ++(#3) rectangle (#4) node [anchor=base] (#2){} - ;}} - } - }{%false-fill - \NewDocumentCommand{\tikzmarkin}{r<> m D(){0.075,-0.18} D(){-0.075,0.35}}{% + \ifbool{fill}{%true-fill + \ifbool{shade}{%true-shade + \NewDocumentCommand{\tikzmarkin}{r<> d[] m D(){0.1,-0.18} D(){-0.1,0.35}}{% + \IfNoValueTF{#2}{%true-val \only<#1>{\tikz[remember picture,overlay] - \draw[line width=1pt,rectangle,rounded corners,draw=\bcol] - (pic cs:#2) ++(#3) rectangle (#4) node [anchor=base] (#2){} + \draw[line width=1pt,rectangle,rounded corners,fill=\fcol,draw=\bcol] + (pic cs:#3) ++(#4) rectangle (#5) node [anchor=base] (#3){} + ;} + }{%false-val + \only<#1>{\tikz[remember picture,overlay] + \draw[line width=1pt,rectangle,rounded corners,fill=\fcol,#2,draw=\bcol] + (pic cs:#3) ++(#4) rectangle (#5) node [anchor=base] (#3){} ;}} - } + } + }{%false-shade + \NewDocumentCommand{\tikzmarkin}{r<> m D(){0.1,-0.18} D(){-0.1,0.35}}{% + \only<#1>{\tikz[remember picture,overlay] + \draw[line width=1pt,rectangle,rounded corners,fill=\fcol,draw=\bcol] + (pic cs:#2) ++(#3) rectangle (#4) node [anchor=base] (#2){} + ;}} + } + }{%false-fill + \NewDocumentCommand{\tikzmarkin}{r<> m D(){0.075,-0.18} D(){-0.075,0.35}}{% + \only<#1>{\tikz[remember picture,overlay] + \draw[line width=1pt,rectangle,rounded corners,draw=\bcol] + (pic cs:#2) ++(#3) rectangle (#4) node [anchor=base] (#2){} + ;}} + } }{%false-beamer - \ifbool{fill}{%true-fill - \ifbool{shade}{%true-shade - \NewDocumentCommand{\tikzmarkin}{d[] m D(){0.1,-0.18} D(){-0.1,0.35}}{% - \IfNoValueTF{#1}{%true-val - \tikz[remember picture,overlay] - \draw[line width=1pt,rectangle,rounded corners,fill=\fcol,draw=\bcol] - (pic cs:#2) ++(#3) rectangle (#4) node [anchor=base] (#2){} - ; - }{%false-val - \tikz[remember picture,overlay] - \draw[line width=1pt,rectangle,rounded corners,fill=\fcol,#1,draw=\bcol] - (pic cs:#2) ++(#3) rectangle (#4) node [anchor=base] (#2){} - ;}} - }{%false-shade - \NewDocumentCommand{\tikzmarkin}{m D(){0.1,-0.18} D(){-0.1,0.35}}{% - \tikz[remember picture,overlay] - \draw[line width=1pt,rectangle,rounded corners,fill=\fcol,draw=\bcol] - (pic cs:#1) ++(#2) rectangle (#3) node [anchor=base] (#1){} - ;} - } - }{%false-fill - \NewDocumentCommand{\tikzmarkin}{m D(){0.075,-0.18} D(){-0.075,0.35}}{% + \ifbool{fill}{%true-fill + \ifbool{shade}{%true-shade + \NewDocumentCommand{\tikzmarkin}{d[] m D(){0.1,-0.18} D(){-0.1,0.35}}{% + \IfNoValueTF{#1}{%true-val \tikz[remember picture,overlay] - \draw[line width=1pt,rectangle,rounded corners,draw=\bcol] - (pic cs:#1) ++(#2) rectangle (#3) node [anchor=base] (#1){} - ;} - } + \draw[line width=1pt,rectangle,rounded corners,fill=\fcol,draw=\bcol] + (pic cs:#2) ++(#3) rectangle (#4) node [anchor=base] (#2){} + ; + }{%false-val + \tikz[remember picture,overlay] + \draw[line width=1pt,rectangle,rounded corners,fill=\fcol,#1,draw=\bcol] + (pic cs:#2) ++(#3) rectangle (#4) node [anchor=base] (#2){} + ;}} + }{%false-shade + \NewDocumentCommand{\tikzmarkin}{m D(){0.1,-0.18} D(){-0.1,0.35}}{% + \tikz[remember picture,overlay] + \draw[line width=1pt,rectangle,rounded corners,fill=\fcol,draw=\bcol] + (pic cs:#1) ++(#2) rectangle (#3) node [anchor=base] (#1){} + ;} + } + }{%false-fill + \NewDocumentCommand{\tikzmarkin}{m D(){0.075,-0.18} D(){-0.075,0.35}}{% + \tikz[remember picture,overlay] + \draw[line width=1pt,rectangle,rounded corners,draw=\bcol] + (pic cs:#1) ++(#2) rectangle (#3) node [anchor=base] (#1){} + ;} + } } \newcommand\tikzmarkend[2][]{% \tikz[remember picture with id=#2] #1;} -\endinput + +%% +%% Copyright (C) 2012 by Claudio Fiandrino <claudio.fiandrino@gmail.com> +%% +%% 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 +%% Claudio Fiandrino. +%% +%% This work consists of the file hf-tikz.dtx +%% and the derived files hf-tikz.ins and +%% hf-tikz.pdf +%% hf-tikz.sty. +%% %% %% End of file `hf-tikz.sty'. |