From 27cb2152643fd03927bf08cec8dbfdab067e4728 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 3 Mar 2013 23:36:35 +0000 Subject: hf-tikz (3mar13) git-svn-id: svn://tug.org/texlive/trunk@29278 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/hf-tikz/hf-tikz.sty | 237 +++++++++++++++++++----- 1 file changed, 187 insertions(+), 50 deletions(-) (limited to 'Master/texmf-dist/tex/latex/hf-tikz') 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 1e35ed19aa5..53e81c3b007 100644 --- a/Master/texmf-dist/tex/latex/hf-tikz/hf-tikz.sty +++ b/Master/texmf-dist/tex/latex/hf-tikz/hf-tikz.sty @@ -14,9 +14,10 @@ %% * %% * See http://www.latex-project.org/lppl.txt %% * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -%% \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{hf-tikz}[2013/01/13 v0.2 A simple way to highlight formulas and formula parts.] +\ProvidesPackage{hf-tikz}[2013/01/13 v0.3 A simple way to highlight formulas and formula parts.] + + \RequirePackage{tikz} \usetikzlibrary{shadings} @@ -51,6 +52,10 @@ \DeclareOption{customcolors}{ \def\hfsetfillcolor#1{\renewcommand{\fcol}{#1}} \def\hfsetbordercolor#1{\renewcommand{\bcol}{#1}} +\pgfkeys{/tikz/.cd, + set fill color/.code={\renewcommand{\fcol}{#1}}, + set border color/.code={\renewcommand{\bcol}{#1}} + } } \newbool{shade} @@ -65,6 +70,10 @@ \boolfalse{norndcorners} \DeclareOption{norndcorners}{\booltrue{norndcorners}} +\newbool{markings} +\boolfalse{markings} +\DeclareOption{markings}{\booltrue{markings}} + \ProcessOptions \pgfkeys{/tikz/.cd,% not use rounded corners/.is choice,% @@ -76,6 +85,83 @@ not use rounded corners=#1,% },% disable rounded corners/.default=false,% +}% + + +\ifbool{fill}{% + \pgfkeys{/tikz/.cd,% + left offset/.initial=-0.1, + right offset/.initial=0.1, + above offset/.initial=0.35, + below offset/.initial=-0.18, + } +}{ + \pgfkeys{/tikz/.cd,% + left offset/.initial=-0.075, + right offset/.initial=0.075, + above offset/.initial=0.35, + below offset/.initial=-0.18, + } +} + +\pgfkeys{/tikz/.cd,% + left offset/.get=\leftoff, + left offset/.store in=\leftoff, + right offset/.get=\rightoff, + right offset/.store in=\rightoff, + above offset/.get=\aboveoff, + above offset/.store in=\aboveoff, + below offset/.get=\belowoff, + below offset/.store in=\belowoff, + below right offset/.initial={\rightoff,\belowoff}, + below right offset/.get=\belowrightoff, + below right offset/.store in=\belowrightoff, + above left offset/.initial={\leftoff,\aboveoff}, + above left offset/.get=\aboveleftoff, + above left offset/.store in=\aboveleftoff, +}% +\ifbool{markings}{ + \usetikzlibrary{decorations.markings} + \newif\ifshowmarkers + \pgfkeys{/tikz/show markers/.is if=showmarkers} + \pgfkeys{/tikz/show markers=false} + + \pgfkeys{/tikz/.cd,% + marker color/.initial=blue, + marker color/.get=\colmarker, + marker color/.store in=\colmarker, + marker size/.initial=1pt, + marker size/.get=\sizemarker, + marker size/.store in=\sizemarker, + } + + \tikzset{ + mark at/.style={ + decoration={ + markings, + mark= + at position #1 + with + { + \coordinate (marker point-\pgfkeysvalueof{/pgf/decoration/mark info/sequence number}) at (0pt,0pt); + \coordinate (marker unit vector-\pgfkeysvalueof{/pgf/decoration/mark info/sequence number}) at (1,0pt); + \coordinate (marker orthogonal unit vector-\pgfkeysvalueof{/pgf/decoration/mark info/sequence number}) at (0pt,1); + \ifshowmarkers% conditional to make them appear just when invoked + \draw[draw=none,fill=\colmarker,radius=\sizemarker] (0,0) circle ; + \else + \relax + \fi + } + }, + postaction=decorate + }, + use marker id/.style={ + shift=(marker point-#1), + x=(marker unit vector-#1), + y=(marker orthogonal unit vector-#1) + }, + use marker id/.default=1, + } } %% Settings @@ -200,7 +286,7 @@ \ifbool{beamer}{%true-beamer \ifbool{fill}{%true-fill \ifbool{shade}{%true-shade - \NewDocumentCommand{\tikzmarkin}{r<> d[] m D(){0.1,-0.18} D(){-0.1,0.35}}{% + \NewDocumentCommand{\tikzmarkin}{r<> o m D(){\belowrightoff} D(){\aboveleftoff}}{% \IfNoValueTF{#2}{%true-val \only<#1>{\tikz[remember picture,overlay] \draw[line width=1pt,rectangle,fill=\fcol,draw=\bcol] @@ -208,28 +294,42 @@ ;} }{%false-val \only<#1>{\tikz[remember picture,overlay] - \draw[line width=1pt,rectangle,fill=\fcol,#2,draw=\bcol] + \draw[line width=1pt,rectangle,fill=\fcol,draw=\bcol,#2] (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,fill=\fcol,draw=\bcol] - (pic cs:#2) ++(#3) rectangle (#4) node [anchor=base] (#2){} - ;}} + \NewDocumentCommand{\tikzmarkin}{r<> o m D(){\belowrightoff} D(){\aboveleftoff}}{% + \IfNoValueTF{#2}{%true-val + \only<#1>{\tikz[remember picture,overlay] + \draw[line width=1pt,rectangle,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,fill=\fcol,draw=\bcol,#2] + (pic cs:#3) ++(#4) rectangle (#5) node [anchor=base] (#3){} + ;}} + } } }{%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,draw=\bcol] - (pic cs:#2) ++(#3) rectangle (#4) node [anchor=base] (#2){} - ;}} - } + \NewDocumentCommand{\tikzmarkin}{r<> o m D(){\belowrightoff} D(){\aboveleftoff}}{% + \IfNoValueTF{#2}{%true-val + \only<#1>{\tikz[remember picture,overlay] + \draw[line width=1pt,rectangle,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,draw=\bcol,#2] + (pic cs:#3) ++(#4) rectangle (#5) node [anchor=base] (#3){} + ;}} + } + } }{%false-beamer \ifbool{fill}{%true-fill \ifbool{shade}{%true-shade - \NewDocumentCommand{\tikzmarkin}{d[] m D(){0.1,-0.18} D(){-0.1,0.35}}{% + \NewDocumentCommand{\tikzmarkin}{o m D(){\belowrightoff} D(){\aboveleftoff}}{% \IfNoValueTF{#1}{%true-val \tikz[remember picture,overlay] \draw[line width=1pt,rectangle,fill=\fcol,draw=\bcol] @@ -237,29 +337,41 @@ ; }{%false-val \tikz[remember picture,overlay] - \draw[line width=1pt,rectangle,fill=\fcol,#1,draw=\bcol] + \draw[line width=1pt,rectangle,fill=\fcol,draw=\bcol,#1] (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}}{% + \NewDocumentCommand{\tikzmarkin}{o m D(){\belowrightoff} D(){\aboveleftoff}}{% + \IfNoValueTF{#1}{%true-val + \tikz[remember picture,overlay] + \draw[line width=1pt,rectangle,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,fill=\fcol,draw=\bcol] - (pic cs:#1) ++(#2) rectangle (#3) node [anchor=base] (#1){} - ;} + \draw[line width=1pt,rectangle,fill=\fcol,draw=\bcol,#1] + (pic cs:#2) ++(#3) rectangle (#4) node [anchor=base] (#2){} + ;}} } }{%false-fill - \NewDocumentCommand{\tikzmarkin}{m D(){0.075,-0.18} D(){-0.075,0.35}}{% - \tikz[remember picture,overlay] - \draw[line width=1pt,rectangle,draw=\bcol] - (pic cs:#1) ++(#2) rectangle (#3) node [anchor=base] (#1){} - ;} + \NewDocumentCommand{\tikzmarkin}{o m D(){\belowrightoff} D(){\aboveleftoff}}{% + \IfNoValueTF{#1}{%true-val + \tikz[remember picture,overlay] + \draw[line width=1pt,rectangle,draw=\bcol] + (pic cs:#2) ++(#3) rectangle (#4) node [anchor=base] (#2){} + ; + }{%false-val + \tikz[remember picture,overlay] + \draw[line width=1pt,rectangle,draw=\bcol,#1] + (pic cs:#2) ++(#3) rectangle (#4) node [anchor=base] (#2){} + ;}} } } }{%false-norndcorners \ifbool{beamer}{%true-beamer \ifbool{fill}{%true-fill \ifbool{shade}{%true-shade - \NewDocumentCommand{\tikzmarkin}{r<> d[] m D(){0.1,-0.18} D(){-0.1,0.35}}{% + \NewDocumentCommand{\tikzmarkin}{r<> o m D(){\belowrightoff} D(){\aboveleftoff}}{% \IfNoValueTF{#2}{%true-val \only<#1>{\tikz[remember picture,overlay] \draw[line width=1pt,rectangle,disable rounded corners,fill=\fcol,draw=\bcol] @@ -267,28 +379,42 @@ ;} }{%false-val \only<#1>{\tikz[remember picture,overlay] - \draw[line width=1pt,rectangle,disable rounded corners,fill=\fcol,#2,draw=\bcol] + \draw[line width=1pt,rectangle,disable rounded corners,fill=\fcol,draw=\bcol,#2] (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,disable rounded corners,fill=\fcol,draw=\bcol] - (pic cs:#2) ++(#3) rectangle (#4) node [anchor=base] (#2){} - ;}} + \NewDocumentCommand{\tikzmarkin}{r<> o m D(){\belowrightoff} D(){\aboveleftoff}}{% + \IfNoValueTF{#2}{%true-val + \only<#1>{\tikz[remember picture,overlay] + \draw[line width=1pt,rectangle,disable 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,disable rounded corners,fill=\fcol,draw=\bcol,#2] + (pic cs:#3) ++(#4) rectangle (#5) node [anchor=base] (#3){} + ;}} + } } }{%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,disable rounded corners,draw=\bcol] -(pic cs:#2) ++(#3) rectangle (#4) node [anchor=base] (#2){} -;}} +\NewDocumentCommand{\tikzmarkin}{r<> o m D(){\belowrightoff} D(){\aboveleftoff}}{% + \IfNoValueTF{#2}{%true-val + \only<#1>{\tikz[remember picture,overlay] + \draw[line width=1pt,rectangle,disable rounded corners,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,disable rounded corners,draw=\bcol,#2] + (pic cs:#3) ++(#4) rectangle (#5) node [anchor=base] (#3){} + ;}} + } } }{%false-beamer \ifbool{fill}{%true-fill \ifbool{shade}{%true-shade - \NewDocumentCommand{\tikzmarkin}{d[] m D(){0.1,-0.18} D(){-0.1,0.35}}{% + \NewDocumentCommand{\tikzmarkin}{o m D(){\belowrightoff} D(){\aboveleftoff}}{% \IfNoValueTF{#1}{%true-val \tikz[remember picture,overlay] \draw[line width=1pt,rectangle,disable rounded corners,fill=\fcol,draw=\bcol] @@ -296,22 +422,34 @@ ; }{%false-val \tikz[remember picture,overlay] - \draw[line width=1pt,rectangle,disable rounded corners,fill=\fcol,#1,draw=\bcol] + \draw[line width=1pt,rectangle,disable rounded corners,fill=\fcol,draw=\bcol,#1] (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}}{% + \NewDocumentCommand{\tikzmarkin}{o m D(){\belowrightoff} D(){\aboveleftoff}}{% + \IfNoValueTF{#1}{%true-val + \tikz[remember picture,overlay] + \draw[line width=1pt,rectangle,disable 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,disable rounded corners,fill=\fcol,draw=\bcol] - (pic cs:#1) ++(#2) rectangle (#3) node [anchor=base] (#1){} - ;} + \draw[line width=1pt,rectangle,disable rounded corners,fill=\fcol,draw=\bcol,#1] + (pic cs:#2) ++(#3) rectangle (#4) node [anchor=base] (#2){} + ;}} } }{%false-fill -\NewDocumentCommand{\tikzmarkin}{m D(){0.075,-0.18} D(){-0.075,0.35}}{% -\tikz[remember picture,overlay] -\draw[line width=1pt,rectangle,disable rounded corners,draw=\bcol] -(pic cs:#1) ++(#2) rectangle (#3) node [anchor=base] (#1){} -;} +\NewDocumentCommand{\tikzmarkin}{o m D(){\belowrightoff} D(){\aboveleftoff}}{% + \IfNoValueTF{#1}{%true-val + \tikz[remember picture,overlay] + \draw[line width=1pt,rectangle,disable rounded corners,draw=\bcol] + (pic cs:#2) ++(#3) rectangle (#4) node [anchor=base] (#2){} + ; + }{%false-val + \tikz[remember picture,overlay] + \draw[line width=1pt,rectangle,disable rounded corners,draw=\bcol,#1] + (pic cs:#2) ++(#3) rectangle (#4) node [anchor=base] (#2){} + ;}} } } } @@ -335,6 +473,5 @@ %% and the derived files hf-tikz.ins and %% hf-tikz.pdf %% hf-tikz.sty. -%% %% %% End of file `hf-tikz.sty'. -- cgit v1.2.3