| 1 |
%% |
| 2 |
%% This is file `tikz-imagelabels.sty', |
| 3 |
%% generated with the docstrip utility. |
| 4 |
%% |
| 5 |
%% The original source files were: |
| 6 |
%% |
| 7 |
%% tikz-imagelabels.dtx (with options: `package') |
| 8 |
%% |
| 9 |
%% This is a generated file. |
| 10 |
%% |
| 11 |
%% Copyright (C) 2019 by Tobias Plüss <[email protected]> |
| 12 |
%% |
| 13 |
%% This work may be distributed and/or modified under the |
| 14 |
%% conditions of the LaTeX Project Public License, either version 1.3 |
| 15 |
%% of this license or (at your option) any later version. |
| 16 |
%% The latest version of this license is in |
| 17 |
%% |
| 18 |
%% http://www.latex-project.org/lppl.txt |
| 19 |
%% |
| 20 |
%% and version 1.3 or later is part of all distributions of LaTeX |
| 21 |
%% version 2005/12/01 or later. |
| 22 |
%% |
| 23 |
\NeedsTeXFormat{LaTeX2e}[2011/06/27] |
| 24 |
\ProvidesPackage{tikz-imagelabels} |
| 25 |
[2019/06/27 v0.2 put labels on images using TikZ] |
| 26 |
\RequirePackage{tikz} |
| 27 |
\RequirePackage{xifthen} |
| 28 |
\usetikzlibrary{ |
| 29 |
arrows.meta, |
| 30 |
calc, |
| 31 |
positioning, |
| 32 |
decorations, |
| 33 |
decorations.markings, |
| 34 |
math, |
| 35 |
} |
| 36 |
\pgfkeys{ |
| 37 |
/imagelabels/.is family, |
| 38 |
/imagelabels/.search also={/tikz}, |
| 39 |
} |
| 40 |
|
| 41 |
\def\imagelabelset{\pgfqkeys{/imagelabels}} |
| 42 |
\imagelabelset{ |
| 43 |
coarse grid color/.store in = \maingridcolor, |
| 44 |
fine grid color/.store in = \finegridcolor, |
| 45 |
} |
| 46 |
|
| 47 |
\imagelabelset{ |
| 48 |
image label font/.store in = \imagelabelfont, |
| 49 |
image label distance/.store in = \imagelabelsep, |
| 50 |
image label back/.store in = \imagelabelback, |
| 51 |
image label text/.store in = \imagelabeltext, |
| 52 |
} |
| 53 |
|
| 54 |
\imagelabelset{ |
| 55 |
coordinate label font/.store in = \coordinatelabelfont, |
| 56 |
coordinate label distance/.store in = \coordinatelabelsep, |
| 57 |
coordinate label back/.store in = \coordinatelabelback, |
| 58 |
coordinate label text/.store in = \coordinatelabeltext, |
| 59 |
} |
| 60 |
|
| 61 |
\imagelabelset{ |
| 62 |
annotation font/.store in = \annotationfont, |
| 63 |
arrow distance/.store in = \arrowdistance, |
| 64 |
arrow thickness/.store in = \arrowthickness, |
| 65 |
tip size/.store in = \tipsize, |
| 66 |
border thickness/.store in = \borderthickness, |
| 67 |
outer dist/.store in = \labeloutersep, |
| 68 |
} |
| 69 |
\imagelabelset{ |
| 70 |
coarse grid color = red, |
| 71 |
fine grid color = gray, |
| 72 |
image label font = \sffamily\bfseries\small, |
| 73 |
image label distance = 2mm, |
| 74 |
image label back = black, |
| 75 |
image label text = white, |
| 76 |
coordinate label font = \sffamily\bfseries\scriptsize, |
| 77 |
coordinate label distance = 2mm, |
| 78 |
coordinate label back = black, |
| 79 |
coordinate label text = white, |
| 80 |
annotation font = \normalfont\small, |
| 81 |
arrow distance = 1.5mm, |
| 82 |
border thickness = 0.6pt, |
| 83 |
arrow thickness = 0.4pt, |
| 84 |
tip size = 1.2mm, |
| 85 |
outer dist = 0.5cm, |
| 86 |
} |
| 87 |
\newenvironment{annotationimage}[3][]{ |
| 88 |
\let\tikzset\imagelabelset |
| 89 |
\begin{tikzpicture} |
| 90 |
\node[anchor=south west, inner sep=0] |
| 91 |
(image) at (0,0) {\includegraphics[#2]{#3}}; |
| 92 |
\begin{scope}[x={(image.south east)},y={(image.north west)}] |
| 93 |
\ifthenelse{\equal{#1}{grid}}{% |
| 94 |
\draw[very thin, draw=\finegridcolor, step=0.02] |
| 95 |
(0,0) grid (1,1); |
| 96 |
\draw[thin, draw=\maingridcolor, xstep=0.1, ystep=0.1] |
| 97 |
(0,0) grid (1,1); |
| 98 |
\foreach \x in {0,1,...,9} { |
| 99 |
\node [anchor=north] at (\x/10,0) {\tiny 0.\x}; |
| 100 |
} |
| 101 |
\node [anchor=north] at (1,0) {\tiny 1}; |
| 102 |
|
| 103 |
\foreach \y in {0,1,...,9} { |
| 104 |
\node [anchor=east] at (0,\y/10) {\tiny 0.\y}; |
| 105 |
} |
| 106 |
\node [anchor=east] at (0,1) {\tiny 1}; |
| 107 |
}{} |
| 108 |
} |
| 109 |
{ |
| 110 |
\end{scope} |
| 111 |
\end{tikzpicture}} |
| 112 |
\imagelabelset{ |
| 113 |
annotation arrow/.style = |
| 114 |
{ |
| 115 |
preaction = |
| 116 |
{ |
| 117 |
draw, |
| 118 |
-{Circle[fill=white, length=\tipsize+2*\borderthickness, |
| 119 |
width=\tipsize+2*\borderthickness]}, |
| 120 |
line width = 2*\borderthickness + \arrowthickness, |
| 121 |
white, |
| 122 |
shorten >= \arrowdistance, |
| 123 |
}, |
| 124 |
draw, |
| 125 |
-{Circle[fill=black, length=\tipsize, width=\tipsize]}, |
| 126 |
black, |
| 127 |
line width = \arrowthickness, |
| 128 |
shorten >= \borderthickness + \arrowdistance, |
| 129 |
}, |
| 130 |
annotation node/.style = |
| 131 |
{ |
| 132 |
font=\annotationfont, |
| 133 |
inner sep = 0.5ex, |
| 134 |
}, |
| 135 |
annotation below/.style args = {#1 at #2}{ |
| 136 |
annotation arrow, |
| 137 |
insert path = { |
| 138 |
(#2,0) ++ (0,-\labeloutersep) |
| 139 |
node[anchor = north, annotation node] {#1\strut} |
| 140 |
} |
| 141 |
}, |
| 142 |
annotation above/.style args = {#1 at #2}{ |
| 143 |
annotation arrow, |
| 144 |
insert path = { |
| 145 |
(#2,1.0) ++ (0,\labeloutersep) |
| 146 |
node[anchor = south, annotation node] {#1\strut} |
| 147 |
} |
| 148 |
}, |
| 149 |
annotation left/.style args = {#1 at #2}{ |
| 150 |
annotation arrow, |
| 151 |
insert path = { |
| 152 |
(0,#2) ++ (-\labeloutersep,0) |
| 153 |
node[anchor = east, annotation node] {#1} |
| 154 |
} |
| 155 |
}, |
| 156 |
annotation right/.style args = {#1 at #2}{ |
| 157 |
annotation arrow, |
| 158 |
insert path = { |
| 159 |
(1.0,#2) ++ (\labeloutersep,0) |
| 160 |
node[anchor = west, annotation node] {#1} |
| 161 |
} |
| 162 |
}, |
| 163 |
} |
| 164 |
\imagelabelset{ |
| 165 |
image label style/.style = { |
| 166 |
rectangle, |
| 167 |
minimum width = 5mm, |
| 168 |
minimum height = 5mm, |
| 169 |
fill = \imagelabelback, |
| 170 |
text = \imagelabeltext, |
| 171 |
font = \imagelabelfont, |
| 172 |
}, |
| 173 |
coordinate label style/.style = { |
| 174 |
rectangle, |
| 175 |
minimum width = 3mm, |
| 176 |
minimum height = 3mm, |
| 177 |
fill = \coordinatelabelback, |
| 178 |
text = \coordinatelabeltext, |
| 179 |
font = \coordinatelabelfont, |
| 180 |
}, |
| 181 |
image label/.style args = {#1 at #2}{ |
| 182 |
insert path = { |
| 183 |
(image.#2) node[outer sep = \imagelabelsep, |
| 184 |
anchor=#2, image label style] {#1} |
| 185 |
} |
| 186 |
}, |
| 187 |
coordinate label/.style args = {#1 at (#2)}{ |
| 188 |
insert path = { |
| 189 |
node[outer sep = \coordinatelabelsep, |
| 190 |
anchor=center, coordinate label style] at (#2) {#1} |
| 191 |
} |
| 192 |
}, |
| 193 |
} |
| 194 |
\endinput |
| 195 |
%% |
| 196 |
%% End of file `tikz-imagelabels.sty'. |