summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/hf-tikz
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-08-19 22:13:22 +0000
committerKarl Berry <karl@freefriends.org>2012-08-19 22:13:22 +0000
commit8b4d54cc2c179123fa8a2ccab740bbca2da70b7f (patch)
treec7deed6c2500d724fe424d98700ca4a326f41e40 /Master/texmf-dist/tex/latex/hf-tikz
parent56a82d54edccc5e5305f9b8c246b92a4ac0e86b4 (diff)
new tikz package hf-tikz (19aug12)
git-svn-id: svn://tug.org/texlive/trunk@27457 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/hf-tikz')
-rw-r--r--Master/texmf-dist/tex/latex/hf-tikz/hf-tikz.sty245
1 files changed, 245 insertions, 0 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
new file mode 100644
index 00000000000..bd0e703e83b
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/hf-tikz/hf-tikz.sty
@@ -0,0 +1,245 @@
+%%
+%% This is file `hf-tikz.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% hf-tikz.dtx (with options: `package')
+%% Copyright (C) 2012 by Claudio Fiandrino
+%% -------------------------------------------
+%%
+%% 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.]
+\RequirePackage{tikz}
+\usetikzlibrary{shadings}
+\RequirePackage{xparse}
+\RequirePackage{etoolbox}
+%% Colors
+
+\definecolor{fancybrown}{RGB}{255,216,197}
+\definecolor{fancyviolet}{RGB}{197,122,197}
+
+\newcommand{\fcol}{fancybrown}
+\newcommand{\bcol}{fancyviolet}
+
+%% Package option
+
+\newbool{fill}
+\booltrue{fill}
+\DeclareOption{nofill}{\boolfalse{fill}}
+
+\DeclareOption{customcolors}{
+\def\hfsetfillcolor#1{\renewcommand{\fcol}{#1}}
+\def\hfsetbordercolor#1{\renewcommand{\bcol}{#1}}
+}
+
+\newbool{shade}
+\boolfalse{shade}
+\DeclareOption{shade}{\booltrue{shade}}
+
+\newbool{beamer}
+\boolfalse{beamer}
+\DeclareOption{beamer}{\booltrue{beamer}}
+
+\ProcessOptions
+%% 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}}%
+ }
+ }
+
+ \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\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}%
+ }
+ }
+ }
+}
+
+\def\savepointas#1#2{%
+ \expandafter\gdef\csname save@pt@#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,\pgfpointorigin\@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
+ }%
+}
+\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}}{%
+ \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}}{%
+ \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
+%%
+%% End of file `hf-tikz.sty'.