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/source/latex/hf-tikz/hf-tikz.dtx | |
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/source/latex/hf-tikz/hf-tikz.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/hf-tikz/hf-tikz.dtx | 373 |
1 files changed, 221 insertions, 152 deletions
diff --git a/Master/texmf-dist/source/latex/hf-tikz/hf-tikz.dtx b/Master/texmf-dist/source/latex/hf-tikz/hf-tikz.dtx index a6248ad3db7..cf5517b1981 100644 --- a/Master/texmf-dist/source/latex/hf-tikz/hf-tikz.dtx +++ b/Master/texmf-dist/source/latex/hf-tikz/hf-tikz.dtx @@ -1,5 +1,23 @@ % \iffalse meta-comment %<*internal> +\iffalse +%</internal> +%<*readme> +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +* 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 +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + +The package provides a way to highlight formulas and formula parts +in both documents and presentations thanks to TikZ. +%</readme> +%<*internal> +\fi \def\nameofplainTeX{plain} \ifx\fmtname\nameofplainTeX\else \expandafter\begingroup @@ -10,31 +28,53 @@ \keepsilent \askforoverwritefalse \preamble -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 +* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + +\endpreamble +\postamble -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: +Copyright (C) 2012 by Claudio Fiandrino <claudio.fiandrino@gmail.com> - http://www.latex-project.org/lppl.txt +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: -and version 1.3 or later is part of all distributions of LaTeX -version 2005/12/01 or later. +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.pdf and +and the derived files hf-tikz.ins and + hf-tikz.pdf hf-tikz.sty. -\endpreamble -\generate{\file{\jobname.sty}{\from{\jobname.dtx}{package}}} + +\endpostamble +\usedir{tex/latex/hf-tikz} +\generate{ + \file{\jobname.sty}{\from{\jobname.dtx}{package}} +} %</install> %<install>\endbatchfile %<*internal> +\usedir{source/latex/hf-tikz} +\generate{ + \file{\jobname.ins}{\from{\jobname.dtx}{install}} +} +\nopreamble\nopostamble +\usedir{doc/latex/demopkg} +\generate{ + \file{README.txt}{\from{\jobname.dtx}{readme}} +} \ifx\fmtname\nameofplainTeX \expandafter\endbatchfile \else @@ -42,9 +82,8 @@ and the derived files hf-tikz.pdf and \fi %</internal> %<*package> -%<hf-tikz>\NeedsTeXFormat{LaTeX2e} -%<hf-tikz>\ProvidesPackage{hf-tikz} -%<hf-tikz> [2012/08/17 v0.1 A simple way to highlight formulas and formula parts.] +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{hf-tikz}[2012/12/18 v0.1a A simple way to highlight formulas and formula parts.] %</package> %<*driver> \documentclass{ltxdoc} @@ -52,6 +91,7 @@ and the derived files hf-tikz.pdf and \usepackage{csquotes} \usepackage{lmodern} \usepackage{amsmath,amssymb} +\usepackage{charter,pxfonts} \usepackage[customcolors,shade]{\jobname} \usetikzlibrary{calc} \usepackage{hypdoc} @@ -63,6 +103,26 @@ and the derived files hf-tikz.pdf and \end{document} %</driver> % \fi +% +% \CheckSum{271} +% +% \CharacterTable +% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +% Digits \0\1\2\3\4\5\6\7\8\9 +% Exclamation \! Double quote \" Hash (number) \# +% Dollar \$ Percent \% Ampersand \& +% Acute accent \' Left paren \( Right paren \) +% Asterisk \* Plus \+ Comma \, +% Minus \- Point \. Solidus \/ +% Colon \: Semicolon \; Less than \< +% Equals \= Greater than \> Question mark \? +% Commercial at \@ Left bracket \[ Backslash \\ +% Right bracket \] Circumflex \^ Underscore \_ +% Grave accent \` Left brace \{ Vertical bar \| +% Right brace \} Tilde \~} +% +% % \GetFileInfo{hf-tikz.sty} % % \title{The \textsf{hf-tikz} package\thanks{This document @@ -80,12 +140,12 @@ and the derived files hf-tikz.pdf and % \tableofcontents % % \section{Introduction and requirements} -% The aim of the package is to provide a simple way to highlight formulas. This is not the first package that tries to accomplish this task, but, rather than \href{http://www.ctan.org/pkg/empheq}{empheq}, \textsf{hf-tikz} provides also a way to highlight formulas overlay-aware inside a presentation, not only in standard documents. Moreover, in contrast with \href{http://www.ctan.org/pkg/empheq}{empheq}, \textsf{hf-tikz} even allows to highlight just a part of an equation. +% The aim of the package is to provide a simple way to highlight formulas. This is not the first package that tries to accomplish this task, but, rather than \href{http://www.ctan.org/pkg/empheq}{empheq}, \mbox{\textsf{hf-tikz}} provides also a way to highlight formulas overlay-aware inside a presentation, not only in standard documents. Moreover, in contrast with \href{http://www.ctan.org/pkg/empheq}{empheq}, \textsf{hf-tikz} even allows to highlight just a part of an equation. % % The package uses Ti\emph{k}Z and it is based on the \texttt{tikzmark} macro from \href{http://tex.stackexchange.com/users/86/andrew-stacey}{Andrew Stacey} and %\href{http://tex.stackexchange.com/users/4301/peter-grill}{Peter Grill} (see as reference \href{http://tex.stackexchange.com/questions/51582/background-coloring-with-overlay-specification-in-algorithm2e-beamer-package}{this answer} and \href{http://tex.stackexchange.com/questions/50015/tikzmark-to-have-different-behaviour-if-first-run-and-mark-locations-not-yet-av}{this question}): among the numerous versions present on \href{http://tex.stackexchange.com}{TeX.SX}, the reference one implemented is taken from \href{http://tex.stackexchange.com/questions/57537/issues-and-potentiality-of-the-tikzmark-macro-dynamic-box-adaptation#57655}{this answer}. Indeed, as explained later, the concept of \emph{extendible markers} helps in customizing the box dimension. % -% \textsf{hf-tikz} loads: +% The packages loaded by \textsf{hf-tikz} are: % \begin{itemize} % \item Ti\emph{k}Z and the library \texttt{shadings}; % \item \textsf{xparse}; @@ -220,6 +280,12 @@ and the derived files hf-tikz.pdf and % >= 30\tikzmarkend{c} % \end{align} % \end{verbatim} +% Examples in which the overlay specifications could be introduced are: +% \begin{itemize} +% \item a single number: \texttt{<1>}; +% \item multiple numbers separated by commas and delimited by braces: \texttt{<\{1,2,3\}>}; +% \item a single number followed by a dash: \texttt{<1->}. +% \end{itemize} % % \subsection{Customize colors}\label{subsec:customcolors} % \DescribeMacro{customcolors}^^A @@ -292,13 +358,14 @@ and the derived files hf-tikz.pdf and % When the option is active, you can not change this behaviour inside the document. Another option to remove the background color, is to set the fill color by means of \cs{hfsetfillcolor} with the same color of the page. % % \StopEventually{\PrintChanges} +% \iffalse +%<*package> +% \fi % \section{Implementation} % \iffalse % <*hf-tikz> % \fi % \begin{macrocode} -\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} @@ -343,91 +410,91 @@ and the derived files hf-tikz.pdf and %% Settings \ifbool{beamer}{%true - \newcounter{jumping} - \resetcounteronoverlays{jumping} + \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}}% - } + \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}% + \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{% @@ -444,7 +511,7 @@ and the derived files hf-tikz.pdf and \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 @@ -464,62 +531,62 @@ and the derived files hf-tikz.pdf and % In this subsection the definition of the highlighing commands in \texttt{beamer} mode and not are shown. % \begin{macrocode} \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][]{% @@ -527,7 +594,9 @@ and the derived files hf-tikz.pdf and % \end{macrocode} % % \iffalse -% </hf-tikz> +%</package> % \fi -%\Finale +% +% \Finale + \endinput |