% ================================================================== % callouts.sty % ================================================================== % (c) 2017 Markus Stuetz, markus.stuetz@gmail.com % This program can be redistributed and/or modified under the terms % of the LaTeX Project Public License Distributed from CTAN % archives in directory macros/latex/base/lppl.txt; either % version 1 of the License, or any later version. % ================================================================== \ProvidesPackage{callouts}[2017/07/27 Callouts] \NeedsTeXFormat{LaTeX2e} \RequirePackage{tikz} \usetikzlibrary{calc} \RequirePackage{xifthen} \newcommand*{\focol}{black} \newcommand*{\bgcol}{none} \newcommand*{\arcol}{black} \RequirePackage{kvoptions} \SetupKeyvalOptions {family = callouts,prefix = callouts@}% \DeclareDefaultOption{\ClassWarning{callouts}{Unknown color option '\CurrentOptionKey=\CurrentOptionValue'}}% \DeclareVoidOption{bwr}{% \renewcommand*{\bgcol}{white}% \renewcommand*{\arcol}{red}% } \DeclareVoidOption{wby}{% \renewcommand*{\focol}{white}% \renewcommand*{\bgcol}{black}% \renewcommand*{\arcol}{yellow}% } \DeclareVoidOption{bww}{% \renewcommand*{\focol}{black}% \renewcommand*{\bgcol}{white}% \renewcommand*{\arcol}{white}% } \define@key{callouts}{text}{% \renewcommand*{\focol}{#1}% } \define@key{callouts}{background}{% \renewcommand*{\bgcol}{#1}% } \define@key{callouts}{arrow}{% \renewcommand*{\arcol}{#1}% } \ProcessKeyvalOptions* % terminate option processing % ================================================================== \newenvironment{annotate}[2]%[num]% { \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}[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}; \draw [\arcol,thick,->] (text) -- (#3); } \newcommand{\note}[2]{% \node [fill=\bgcol] at (#1) {\scriptsize\color{\focol} #2}; } \newcommand{\arrow}[2]{% \draw [\arcol,thick,->] (#1) -- (#2); } \endinput % === EOF ================================================