texlive[44899] Master/texmf-dist: callouts (27jul17)

commits+karl at tug.org commits+karl at tug.org
Thu Jul 27 23:26:08 CEST 2017


Revision: 44899
          http://tug.org/svn/texlive?view=revision&revision=44899
Author:   karl
Date:     2017-07-27 23:26:08 +0200 (Thu, 27 Jul 2017)
Log Message:
-----------
callouts (27jul17)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/callouts/README.md
    trunk/Master/texmf-dist/doc/latex/callouts/callouts.pdf
    trunk/Master/texmf-dist/doc/latex/callouts/callouts.tex
    trunk/Master/texmf-dist/tex/latex/callouts/callouts.sty

Modified: trunk/Master/texmf-dist/doc/latex/callouts/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/callouts/README.md	2017-07-27 20:38:00 UTC (rev 44898)
+++ trunk/Master/texmf-dist/doc/latex/callouts/README.md	2017-07-27 21:26:08 UTC (rev 44899)
@@ -15,4 +15,4 @@
 Best regards,
 _Markus Stuetz_
 
-Graz, Austria on March 17, 2017
+Graz, Austria on July 27, 2017

Modified: trunk/Master/texmf-dist/doc/latex/callouts/callouts.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/callouts/callouts.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/callouts/callouts.tex	2017-07-27 20:38:00 UTC (rev 44898)
+++ trunk/Master/texmf-dist/doc/latex/callouts/callouts.tex	2017-07-27 21:26:08 UTC (rev 44899)
@@ -26,10 +26,10 @@
 
 \section{Using the package}
 
-The package is included in the preamble as follows, with currently four color options, listed in table \ref{tab:colors}. If no or a wrong option is specified, the package will use \texttt{plain}.
+The package is included in the preamble as follows, with currently four pre-defined color options, listed in table \ref{tab:colors}. If no or a wrong option is specified, the package will use the default color scheme.
 
 \begin{lstlisting}
- \includepackage{callouts}[option] 
+ \usepackage[option]{callouts}
 \end{lstlisting}
 
 \begin{table}[htb]
@@ -39,7 +39,7 @@
  \toprule
   option & text & background & arrow \\
   \midrule
-  \texttt{plain}& black & black & none \\
+  -& black & none & black \\
   \texttt{bwr}	& black & white & red \\
   \texttt{wby}	& white & black & yellow \\
   \texttt{bww}	& black & white & white\\
@@ -47,10 +47,17 @@
  \end{tabular}
 \end{table}
 
-The environment itself is called \texttt{annotate} and may be put inside a \texttt{figure}-float. The environment requires two variables: The image path including a width option and the annotation scale. Make sure to put the same number in the \texttt{width}-option and the coordinate scale. If you decide to change the scale later on, change both numbers equally, then the relative position of the annotations will remain.
+Moreover, the colors for text, background, and arrow can be set directly by using the respective option keys, for instance:
+
 \begin{lstlisting}
+ \usepackage[background=gray,arrow=red]{callouts}
+\end{lstlisting}
+
+The environment itself is called \texttt{annotate} and may be put inside a \texttt{figure}-float. The environment requires two variables: The image path including a size option and the annotation scale. Make sure to put the same number in the size (e.g. \texttt{width}) option and the coordinate scale. If you decide to change the scale later on, change both numbers equally, then the relative position of the annotations will remain.
+
+\begin{lstlisting}
  \begin{annotate}
- {\includegraphics[0.5\textwidth]{<picture file name>} {0.5}
+ {\includegraphics[width=0.5\textwidth]{<file path>}}{0.5}
  \end{annotate}
 \end{lstlisting}
 
@@ -58,7 +65,7 @@
 There are currently four commands included which may follow the first two variables of the package.
 
 \subsection{Helpgrid}
-First of all, you may want to use a help grid to place your annotations. With \texttt{\textbackslash helpgrid}, a grid is drawn. The grid's coodinate origin is indicated by the large dot in the center. The grid lines display integers, coordinates are given in positive and negative decimal numbers.
+First of all, you may want to use a help grid to place your annotations. With \texttt{\textbackslash helpgrid}, a grid is drawn. The grid's coordinate origin is indicated by the dot in the center. The grid lines represent integers, coordinates are given in positive and negative decimal numbers. The default color is the background color, you may alter the color of the help grid by adding an option like so: \texttt{\textbackslash helpgrid[gray]}
 
 \subsection{Callouts, notes, arrows }
 A callout is a note, indicating to a point with an arrow. The syntax for this object is
@@ -91,7 +98,7 @@
 \begin{figure}[htb]
   \centering
   \begin{annotate}{\includegraphics[width=0.7\textwidth]{A319neo.jpg}}{0.7}
-    % \helpgrid
+%     \helpgrid
     \callout{5,-3}{Engine}{1.6,-2}
     \arrow{-3,-2.4}{-4.5,-3}
     \arrow{-4.7,-3.2}{-5.5,-2.4}

Modified: trunk/Master/texmf-dist/tex/latex/callouts/callouts.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/callouts/callouts.sty	2017-07-27 20:38:00 UTC (rev 44898)
+++ trunk/Master/texmf-dist/tex/latex/callouts/callouts.sty	2017-07-27 21:26:08 UTC (rev 44899)
@@ -8,49 +8,51 @@
 % 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}
+
+\RequirePackage{kvoptions}
+\SetupKeyvalOptions {family = callouts,prefix = callouts@}%
+
+\DeclareDefaultOption{\ClassWarning{callouts}{Unknown color option '\CurrentOptionKey=\CurrentOptionValue'}}%
+
+\DeclareVoidOption{bwr}{%
+\renewcommand*{\bgcol}{white}%
+\renewcommand*{\arcol}{red}%
 }
 
-\DeclareOption{bwr}{%
-\newcommand{\focol}{black}
-\newcommand{\bgcol}{white}
-\newcommand{\arcol}{red}
+\DeclareVoidOption{wby}{%
+\renewcommand*{\focol}{white}%
+\renewcommand*{\bgcol}{black}%
+\renewcommand*{\arcol}{yellow}%
 }
 
-\DeclareOption{wby}{%
-\newcommand{\focol}{white}
-\newcommand{\bgcol}{black}
-\newcommand{\arcol}{yellow}
+\DeclareVoidOption{bww}{%
+\renewcommand*{\focol}{black}%
+\renewcommand*{\bgcol}{white}%
+\renewcommand*{\arcol}{white}%
 }
 
-\DeclareOption{bww}{%
-\newcommand{\focol}{black}
-\newcommand{\bgcol}{white}
-\newcommand{\arcol}{white}
+\define at key{callouts}{text}{%
+\renewcommand*{\focol}{#1}%
 }
+\define at key{callouts}{background}{%
+\renewcommand*{\bgcol}{#1}%
+}
+\define at key{callouts}{arrow}{%
+\renewcommand*{\arcol}{#1}%
+}
 
-\DeclareOption*{\ClassWarning{annotations}{Unknown color option '\CurrentOption'}\ExecuteOptions{none}}
+\ProcessKeyvalOptions*	% terminate option processing
 
-\newcommand{\hecol}{black}
-
-\ProcessOptions\relax	% terminate option processing
-
 % ==================================================================
 
 \newenvironment{annotate}[2]%[num]%
@@ -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 ================================================



More information about the tex-live-commits mailing list