diff options
author | Karl Berry <karl@freefriends.org> | 2017-07-27 21:26:08 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-07-27 21:26:08 +0000 |
commit | 654d2d2ad9ef4fc4de9cfd3b3d6038ef14ad4161 (patch) | |
tree | 6b9c27c2711e7103946c29f046dffafcfb7cb020 /Master/texmf-dist/tex/latex | |
parent | 1eaf921900a3d76fd3daf0e53dc8cf23de15cb72 (diff) |
callouts (27jul17)
git-svn-id: svn://tug.org/texlive/trunk@44899 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r-- | Master/texmf-dist/tex/latex/callouts/callouts.sty | 80 |
1 files changed, 47 insertions, 33 deletions
diff --git a/Master/texmf-dist/tex/latex/callouts/callouts.sty b/Master/texmf-dist/tex/latex/callouts/callouts.sty index 878c9940511..27575c60531 100644 --- a/Master/texmf-dist/tex/latex/callouts/callouts.sty +++ b/Master/texmf-dist/tex/latex/callouts/callouts.sty @@ -8,48 +8,50 @@ % version 1 of the License, or any later version. % ================================================================== -\ProvidesPackage{callouts}[2017/03/16 Callouts] +\ProvidesPackage{callouts}[2017/07/27 Callouts] \NeedsTeXFormat{LaTeX2e} \RequirePackage{tikz} -% \RequirePackage{kvoptions} -% -% \tikzset{every picture/.style={font issue=\footnotesize}, -% font issue/.style={execute at begin picture={#1\selectfont}} -% } -% \DeclareStringOption[red]{color}[black]{ -% \@arrowcolor -% } +\usetikzlibrary{calc} +\RequirePackage{xifthen} -\DeclareOption{plain}{% -\newcommand{\focol}{black} -\newcommand{\bgcol}{none} -\newcommand{\arcol}{black} -} +\newcommand*{\focol}{black} +\newcommand*{\bgcol}{none} +\newcommand*{\arcol}{black} -\DeclareOption{bwr}{% -\newcommand{\focol}{black} -\newcommand{\bgcol}{white} -\newcommand{\arcol}{red} -} +\RequirePackage{kvoptions} +\SetupKeyvalOptions {family = callouts,prefix = callouts@}% -\DeclareOption{wby}{% -\newcommand{\focol}{white} -\newcommand{\bgcol}{black} -\newcommand{\arcol}{yellow} +\DeclareDefaultOption{\ClassWarning{callouts}{Unknown color option '\CurrentOptionKey=\CurrentOptionValue'}}% + +\DeclareVoidOption{bwr}{% +\renewcommand*{\bgcol}{white}% +\renewcommand*{\arcol}{red}% } -\DeclareOption{bww}{% -\newcommand{\focol}{black} -\newcommand{\bgcol}{white} -\newcommand{\arcol}{white} +\DeclareVoidOption{wby}{% +\renewcommand*{\focol}{white}% +\renewcommand*{\bgcol}{black}% +\renewcommand*{\arcol}{yellow}% } -\DeclareOption*{\ClassWarning{annotations}{Unknown color option '\CurrentOption'}\ExecuteOptions{none}} +\DeclareVoidOption{bww}{% +\renewcommand*{\focol}{black}% +\renewcommand*{\bgcol}{white}% +\renewcommand*{\arcol}{white}% +} -\newcommand{\hecol}{black} +\define@key{callouts}{text}{% +\renewcommand*{\focol}{#1}% +} +\define@key{callouts}{background}{% +\renewcommand*{\bgcol}{#1}% +} +\define@key{callouts}{arrow}{% +\renewcommand*{\arcol}{#1}% +} -\ProcessOptions\relax % terminate option processing +\ProcessKeyvalOptions* % terminate option processing % ================================================================== @@ -57,13 +59,25 @@ { \begin{tikzpicture}[scale=#2]% }% % Annotate \node (pic) at (0,0) {#1};% +\newdimen\xtic +\newdimen\ytic +\pgfextractx\xtic{\pgfpointanchor{pic}{east}} +\pgfmathparse{int(\xtic/1cm)} +\pgfmathsetmacro\xtic{\pgfmathresult} +\pgfextracty\ytic{\pgfpointanchor{pic}{north}} +\pgfmathparse{int(\ytic/1cm)} +\pgfmathsetmacro\ytic{\pgfmathresult} }% { \end{tikzpicture} } % ================================================================== -\newcommand{\helpgrid}{% -\draw[help lines, \hecol] (pic.south west) grid (pic.north east); \fill[\hecol] (0,0) circle (5pt);% +\newcommand{\helpgrid}[1][\bgcol]{% +\draw[help lines, color=#1] (pic.south west) grid (pic.north east); \fill[#1] (0,0) circle (3pt);% + \foreach \i in {-\xtic,...,\xtic} {% + \node at (\i+0.2,0.2) {\color{#1} \tiny \i};} + \foreach \i in {-\ytic,...,\ytic} {% + \node at (0.2,\i+0.2) {\color{#1} \tiny \i};} } \newcommand{\callout}[3]{% \node [fill=\bgcol] (text) at (#1) {\scriptsize\color{\focol} #2}; @@ -76,4 +90,4 @@ \draw [\arcol,thick,->] (#1) -- (#2); } -\endinput % === EOF ================================================
\ No newline at end of file +\endinput % === EOF ================================================ |