| 1 |
%% |
| 2 |
%% This is file `testsample.tex', |
| 3 |
%% generated with the docstrip utility. |
| 4 |
%% |
| 5 |
%% The original source files were: |
| 6 |
%% |
| 7 |
%% ontesting.dtx (with options: `testbed') |
| 8 |
%% |
| 9 |
%% Copyright (C) 2013 by Adrian P Robson |
| 10 |
%% [email protected] |
| 11 |
%% |
| 12 |
%% This work may be distributed and/or modified under the |
| 13 |
%% conditions of the LaTeX Project Public License, either |
| 14 |
%% version 1.3c of this license or (at your option) any later |
| 15 |
%% version. The latest version of this license is in |
| 16 |
%% http://www.latex-project.org/lppl.txt |
| 17 |
%% |
| 18 |
%% This work has the LPPL maintenance status `maintained'. |
| 19 |
%% The Current Maintainer of this work is Adrian Robson. |
| 20 |
%% |
| 21 |
%% This work consists of the files makeshape.ins |
| 22 |
%% makeshape.dtx and |
| 23 |
%% ontesting.dtx |
| 24 |
%% and the derived files makeshape.sty |
| 25 |
%% makeshape.pdf |
| 26 |
%% sampleshape.tex |
| 27 |
%% ontesting.pdf |
| 28 |
%% testsample.tex and |
| 29 |
%% testsample.pdf |
| 30 |
%% |
| 31 |
%%-------------------------------------------------------- |
| 32 |
%% |
| 33 |
%% This is a test bed for the makeshape package's |
| 34 |
%% sampleshape in sampleshape.tex |
| 35 |
%% |
| 36 |
%% It can be easily adapted for other shapes. |
| 37 |
%% |
| 38 |
%% 22 January 2013 |
| 39 |
|
| 40 |
\documentclass[10pt,a4paper]{article} |
| 41 |
|
| 42 |
\usepackage{enumitem} |
| 43 |
\usepackage{tikz} |
| 44 |
\usetikzlibrary{backgrounds} |
| 45 |
\usetikzlibrary{arrows} |
| 46 |
|
| 47 |
%%------------------------------------------------- |
| 48 |
%% file and shape being tested |
| 49 |
\def\filename{sampleshape} % file being tested |
| 50 |
\input{\filename} % It is a .tex |
| 51 |
%%\usepackage{\filename} % It is a .sty |
| 52 |
\def\testshape{sample} % shape being tested |
| 53 |
%%------------------------------------------------- |
| 54 |
|
| 55 |
%%-------------------------------------------------------- |
| 56 |
%% Utility macros |
| 57 |
%%-------------------------------------------------------- |
| 58 |
|
| 59 |
%% \spot{x}{y} |
| 60 |
\newcommand{\spot}[2]{ |
| 61 |
\draw[help lines,red] (#1,#2) circle (1pt); |
| 62 |
} |
| 63 |
|
| 64 |
%% \markOrig |
| 65 |
\def\mrksz{4pt} |
| 66 |
\def\mrkcol{yellow} |
| 67 |
\newcommand{\markOrig}{ |
| 68 |
\draw[help lines,\mrkcol] (0,0) circle (\mrksz); |
| 69 |
\draw[help lines,\mrkcol] (-\mrksz,0) -- (\mrksz,0); |
| 70 |
\draw[help lines,\mrkcol] (0,-\mrksz) -- (0,\mrksz); |
| 71 |
} |
| 72 |
|
| 73 |
%% \markOrigC{colour} |
| 74 |
\def\mrksz{4pt} |
| 75 |
\newcommand{\markOrigC}[1]{ |
| 76 |
\draw[help lines,#1] (0,0) circle (\mrksz); |
| 77 |
\draw[help lines,#1] (-\mrksz,0) -- (\mrksz,0); |
| 78 |
\draw[help lines,#1] (0,-\mrksz) -- (0,\mrksz); |
| 79 |
} |
| 80 |
|
| 81 |
%% Anchors ... |
| 82 |
%% \***{node}{size}{colour} |
| 83 |
|
| 84 |
\def\centeranchor#1#2#3{ |
| 85 |
\draw[help lines,#3] (#1.center) circle (#2); |
| 86 |
} |
| 87 |
|
| 88 |
\def\textanchor#1#2#3{ |
| 89 |
\draw[help lines,#3] (#1.text) circle (#2); |
| 90 |
} |
| 91 |
|
| 92 |
\def\cardinalanchors#1#2#3{ |
| 93 |
\draw[help lines,#3] (#1.north) circle (#2); |
| 94 |
\draw[help lines,#3] (#1.west) circle (#2); |
| 95 |
\draw[help lines,#3] (#1.south) circle (#2); |
| 96 |
\draw[help lines,#3] (#1.east) circle (#2); |
| 97 |
} |
| 98 |
|
| 99 |
\def\corneranchors#1#2#3{ |
| 100 |
\draw[help lines,#3] (#1.north west) circle (#2); |
| 101 |
\draw[help lines,#3] (#1.south west) circle (#2); |
| 102 |
\draw[help lines,#3] (#1.south east) circle (#2); |
| 103 |
\draw[help lines,#3] (#1.north east) circle (#2); |
| 104 |
} |
| 105 |
|
| 106 |
\def\allanchors#1#2#3{ |
| 107 |
\corneranchors{#1}{#2}{#3} |
| 108 |
\cardinalanchors{#1}{#2}{#3} |
| 109 |
} |
| 110 |
|
| 111 |
%%-------------------------------------------------------- |
| 112 |
|
| 113 |
\title{The {\sf makeshape} package\\ |
| 114 |
Shape Test Bed |
| 115 |
\vspace{-3ex} } |
| 116 |
\author{} |
| 117 |
\date{ |
| 118 |
\begin{tabular}{rl} |
| 119 |
File & {\tt \filename}\\ |
| 120 |
Shape & {\tt \testshape} |
| 121 |
\end{tabular} |
| 122 |
\\[2ex] |
| 123 |
\today} |
| 124 |
|
| 125 |
\begin{document} |
| 126 |
|
| 127 |
\maketitle |
| 128 |
|
| 129 |
%%-------------------------------------------------------- |
| 130 |
\section*{Basic Shape} |
| 131 |
|
| 132 |
\begin{center} |
| 133 |
\begin{tikzpicture} |
| 134 |
|
| 135 |
\node at (0,0) |
| 136 |
[\testshape, draw |
| 137 |
] (test) {\verb|x x|} ; |
| 138 |
|
| 139 |
\allanchors{test}{2pt}{red} |
| 140 |
\textanchor{test}{2pt}{green} |
| 141 |
\draw[help lines,green] (test.text) -- ++(7pt,0); |
| 142 |
\draw[help lines,green] (test.text) -- ++(0,5pt); |
| 143 |
\centeranchor{test}{2pt}{blue} |
| 144 |
|
| 145 |
%% mark the anchors with arrows from enclosing rectangle |
| 146 |
\node at (0,0) |
| 147 |
[rectangle, red, |
| 148 |
minimum width=4cm, |
| 149 |
minimum height=2cm |
| 150 |
] (outer) {} ; |
| 151 |
\begin{scope}[>=latex'] |
| 152 |
\draw[->,help lines,red] (outer.north) -- (test.north); |
| 153 |
\draw[->,help lines,red] (outer.east) -- (test.east); |
| 154 |
\draw[->,help lines,red] (outer.south) -- (test.south); |
| 155 |
\draw[->,help lines,red] (outer.west) -- (test.west); |
| 156 |
\draw[->,help lines,red] (outer.north east) -- (test.north east); |
| 157 |
\draw[->,help lines,red] (outer.south east) -- (test.south east); |
| 158 |
\draw[->,help lines,red] (outer.south west) -- (test.south west); |
| 159 |
\draw[->,help lines,red] (outer.north west) -- (test.north west); |
| 160 |
\end{scope} |
| 161 |
|
| 162 |
\begin{scope}[on background layer] |
| 163 |
\node at (4cm,0) |
| 164 |
[rectangle, draw |
| 165 |
] (rectRmin) {\verb|x x|}; |
| 166 |
|
| 167 |
\node at (0,-1.7cm) |
| 168 |
[rectangle, draw |
| 169 |
] (rectBmin) {\verb|x x|}; |
| 170 |
|
| 171 |
\draw[help lines,green] (rectRmin.north west) -- ++(-4.5cm,0); |
| 172 |
\draw[help lines,green] (rectRmin.south west) -- ++(-4.5cm,0); |
| 173 |
\draw[help lines,green] (rectBmin.north west) -- ++(0,2.3cm); |
| 174 |
\draw[help lines,green] (rectBmin.north east) -- ++(0,2.3cm); |
| 175 |
\markOrig |
| 176 |
\end{scope} |
| 177 |
|
| 178 |
\end{tikzpicture} |
| 179 |
|
| 180 |
\end{center} |
| 181 |
|
| 182 |
\vfill |
| 183 |
%%-------------------------------------------------------- |
| 184 |
\section*{Minimum Dimensions} |
| 185 |
|
| 186 |
\def\minh{30pt} |
| 187 |
\def\minw{80pt} |
| 188 |
|
| 189 |
{\tt minimum width = \minw}\\ |
| 190 |
{\tt minimum height = \minh} |
| 191 |
|
| 192 |
\begin{center} |
| 193 |
\begin{tikzpicture} |
| 194 |
|
| 195 |
%% The test shape |
| 196 |
\node at (0,0) |
| 197 |
[\testshape, draw, |
| 198 |
minimum width=\minw, |
| 199 |
minimum height=\minh, |
| 200 |
] (test) {\verb|x x|} ; |
| 201 |
|
| 202 |
\allanchors{test}{1pt}{red} |
| 203 |
|
| 204 |
%% Guide lines |
| 205 |
\begin{scope}[on background layer] |
| 206 |
\node at (4.5cm+\minw,0) |
| 207 |
[rectangle, draw |
| 208 |
] (rectRmin) {\verb|x x|}; |
| 209 |
|
| 210 |
\node at (1.5cm+\minw,0) |
| 211 |
[rectangle, draw, |
| 212 |
minimum width=\minw, |
| 213 |
minimum height=\minh |
| 214 |
] (rectR) {\verb|x x|}; |
| 215 |
|
| 216 |
\node at (0,-1cm-\minh) |
| 217 |
[rectangle, draw, |
| 218 |
minimum width=\minw, |
| 219 |
minimum height=\minh |
| 220 |
] (rectB) {\verb|x x|}; |
| 221 |
|
| 222 |
\node at (0,-2.5cm-\minh) |
| 223 |
[rectangle, draw, |
| 224 |
] (rectBmin) {\verb|x x|}; |
| 225 |
|
| 226 |
\markOrig |
| 227 |
\draw[help lines,yellow] (rectR.north west) -- ++(-1.7cm-\minw,0); |
| 228 |
\draw[help lines,yellow] (rectR.south west) -- ++(-1.7cm-\minw,0); |
| 229 |
\draw[help lines,yellow] (rectR.west) -- ++(-1.7cm-\minw,0); |
| 230 |
\draw[help lines,yellow] (rectR.west) -- ++(\minw+0.2cm,0); |
| 231 |
\draw[help lines,yellow] (rectB.north west) -- ++(0,1.2cm+\minh); |
| 232 |
\draw[help lines,yellow] (rectB.north east) -- ++(0,1.2cm+\minh); |
| 233 |
\draw[help lines,yellow] (rectB.north) -- ++(0,1.2cm+\minh); |
| 234 |
\draw[help lines,yellow] (rectB.north) -- ++(0,-\minh-0.2cm); |
| 235 |
|
| 236 |
\draw[help lines,green] (rectRmin.north west) -- ++(-4.6cm-\minw,0); |
| 237 |
\draw[help lines,green] (rectBmin.north west) -- ++(0,2.6cm+\minh); |
| 238 |
\end{scope} |
| 239 |
|
| 240 |
\end{tikzpicture} |
| 241 |
\end{center} |
| 242 |
\vfill |
| 243 |
|
| 244 |
\newpage |
| 245 |
%%-------------------------------------------------------- |
| 246 |
\section*{Inner Separation} |
| 247 |
|
| 248 |
\def\insepx{20pt} |
| 249 |
\def\insepy{10pt} |
| 250 |
|
| 251 |
{\tt inner x seperation = \insepx}\\ |
| 252 |
{\tt inner y seperation = \insepy} |
| 253 |
|
| 254 |
\begin{center} |
| 255 |
\begin{tikzpicture} |
| 256 |
|
| 257 |
%% The test shape |
| 258 |
\node at (0,0) |
| 259 |
[\testshape, draw, |
| 260 |
inner xsep=\insepx, inner ysep=\insepy |
| 261 |
] (test) {\verb|x x|} ; |
| 262 |
|
| 263 |
\allanchors{test}{1pt}{red} |
| 264 |
|
| 265 |
%% Guide lines |
| 266 |
\begin{scope}[on background layer] |
| 267 |
\markOrig |
| 268 |
|
| 269 |
\node at (2.5cm,0) |
| 270 |
[rectangle, draw |
| 271 |
] (rectRmin) {\verb|x x|}; |
| 272 |
|
| 273 |
\node at (0,-1.5cm) |
| 274 |
[rectangle, draw |
| 275 |
] (rectBmin) {\verb|x x|}; |
| 276 |
|
| 277 |
\node at (4cm,0) |
| 278 |
[rectangle, draw, |
| 279 |
inner ysep=\insepy |
| 280 |
] (rectRwithSep) {\verb|x x|}; |
| 281 |
|
| 282 |
\node at (0,-2.2cm) |
| 283 |
[rectangle, draw, |
| 284 |
inner xsep=\insepx |
| 285 |
] (rectBwithSep) {\verb|x x|}; |
| 286 |
|
| 287 |
\draw[help lines,green] (rectRmin.north west) -- ++(-3.4cm,0); |
| 288 |
\draw[help lines,green] (rectBmin.north west) -- ++(0,2cm); |
| 289 |
\draw[help lines,blue] (rectRwithSep.north west) -- ++(-4.9cm,0); |
| 290 |
\draw[help lines,blue] (rectBwithSep.north west) -- ++(0,2.7cm); |
| 291 |
\end{scope} |
| 292 |
|
| 293 |
\end{tikzpicture} |
| 294 |
\end{center} |
| 295 |
|
| 296 |
%%-------------------------------------------------------- |
| 297 |
\section*{Outer Separation} |
| 298 |
|
| 299 |
\def\minh{20pt} |
| 300 |
\def\minw{60pt} |
| 301 |
\def\outerx{20pt} |
| 302 |
\def\outery{10pt} |
| 303 |
|
| 304 |
{\tt outer x separation = \outerx}\\ |
| 305 |
{\tt outer y separation = \outery} |
| 306 |
|
| 307 |
\begin{center} |
| 308 |
\begin{tikzpicture} |
| 309 |
|
| 310 |
\markOrig |
| 311 |
|
| 312 |
%% the shape with outer separation |
| 313 |
\node at (0,0) |
| 314 |
[\testshape, draw, |
| 315 |
minimum width=\minw, |
| 316 |
minimum height=\minh, |
| 317 |
outer xsep=\outerx, outer ysep=\outery |
| 318 |
] (test) {\verb|x x|} ; |
| 319 |
|
| 320 |
%% shape expanded to outer separation boundary |
| 321 |
\node at (0,0) |
| 322 |
[\testshape, draw, help lines, green, |
| 323 |
minimum width=\minw+2*\outerx, |
| 324 |
minimum height=\minh+2*\outery, |
| 325 |
] (bigger) {} ; |
| 326 |
|
| 327 |
%% mark the anchors with arrows from enclosing rectangle |
| 328 |
\node at (0,0) |
| 329 |
[rectangle, |
| 330 |
minimum width=\minw+1cm, |
| 331 |
minimum height=\minh+1cm, |
| 332 |
outer xsep=\outerx, outer ysep=\outery |
| 333 |
] (outer) {} ; |
| 334 |
|
| 335 |
\begin{scope}[>=latex'] |
| 336 |
\draw[->,help lines,red] (outer.north) -- (test.north); |
| 337 |
\draw[->,help lines,red] (outer.east) -- (test.east); |
| 338 |
\draw[->,help lines,red] (outer.south) -- (test.south); |
| 339 |
\draw[->,help lines,red] (outer.west) -- (test.west); |
| 340 |
\draw[->,help lines,red] (outer.north east) -- (test.north east); |
| 341 |
\draw[->,help lines,red] (outer.south east) -- (test.south east); |
| 342 |
\draw[->,help lines,red] (outer.south west) -- (test.south west); |
| 343 |
\draw[->,help lines,red] (outer.north west) -- (test.north west); |
| 344 |
\end{scope} |
| 345 |
|
| 346 |
%% mark anchors with circles |
| 347 |
\allanchors{test}{2pt}{red} |
| 348 |
|
| 349 |
%% mark text and centre anchors |
| 350 |
\textanchor{test}{2pt}{green} |
| 351 |
\draw[help lines,green] (test.text) -- ++(7pt,0); |
| 352 |
\draw[help lines,green] (test.text) -- ++(0,5pt); |
| 353 |
\centeranchor{test}{2pt}{blue} |
| 354 |
|
| 355 |
\end{tikzpicture} |
| 356 |
\end{center} |
| 357 |
|
| 358 |
%%-------------------------------------------------------- |
| 359 |
\section*{Anchorborder } |
| 360 |
|
| 361 |
%%-------------------------------------------------------- |
| 362 |
\subsection*{External Points with Outer Separation and\\Minimum Dimensions} |
| 363 |
|
| 364 |
\def\width{2cm} |
| 365 |
\def\height{1cm} |
| 366 |
\def\testouter{10pt} |
| 367 |
|
| 368 |
{\tt outer sep = \testouter}\\ |
| 369 |
{\tt minimum height = \height}\\ |
| 370 |
{\tt minimum width = \width} |
| 371 |
|
| 372 |
\begin{center} |
| 373 |
\begin{tikzpicture} |
| 374 |
|
| 375 |
\markOrig |
| 376 |
|
| 377 |
%% The test shape |
| 378 |
\node at (0,0) [\testshape, draw, font={\sf \small}, |
| 379 |
minimum width=\width, |
| 380 |
minimum height=\height, |
| 381 |
outer sep=\testouter |
| 382 |
] (test) {Test}; |
| 383 |
|
| 384 |
%% green path where anchors should be |
| 385 |
\node at (0,0) [\testshape, draw, help lines, green, |
| 386 |
minimum width=\width+2*\testouter, |
| 387 |
minimum height=\height+2*\testouter, |
| 388 |
] (bigger) {} ; |
| 389 |
|
| 390 |
\def\n{20} |
| 391 |
\def\radius{3cm} |
| 392 |
\draw[dotted] (0,0) circle (\radius); |
| 393 |
\foreach \s in {1,...,\n} |
| 394 |
{ |
| 395 |
\draw[->, >=latex'] ({360/\n * (\s - 1)}:\radius) -- (test); |
| 396 |
} |
| 397 |
\end{tikzpicture} |
| 398 |
\end{center} |
| 399 |
|
| 400 |
%%-------------------------------------------------------- |
| 401 |
\subsection*{Internal Points with Minimum Dimensions} |
| 402 |
|
| 403 |
\def\width{3cm} |
| 404 |
\def\height{3cm} |
| 405 |
|
| 406 |
{\tt minimum height = \height}\\ |
| 407 |
{\tt minimum width = \width} |
| 408 |
|
| 409 |
\vspace{-3ex} |
| 410 |
\begin{center} |
| 411 |
\begin{tikzpicture} |
| 412 |
|
| 413 |
\markOrig |
| 414 |
|
| 415 |
%% The test shape |
| 416 |
\node at (0,0) [\testshape, draw, font={\sf \small}, |
| 417 |
minimum width=\width, |
| 418 |
minimum height=\height, |
| 419 |
] (test) {}; |
| 420 |
|
| 421 |
\def\n{20} |
| 422 |
\def\radius{1cm} |
| 423 |
\draw[dotted] (0,0) circle (\radius); |
| 424 |
\foreach \s in {1,...,\n} |
| 425 |
{ |
| 426 |
\draw[->, >=latex', red] ({360/\n * (\s - 1)}:\radius) -- (test); |
| 427 |
} |
| 428 |
\end{tikzpicture} |
| 429 |
\end{center} |
| 430 |
|
| 431 |
|
| 432 |
%%-------------------------------------------------------- |
| 433 |
\subsection*{Angles with Outer Separation and Minimum Dimensions} |
| 434 |
|
| 435 |
\def\angle{120} |
| 436 |
\def\width{2cm} |
| 437 |
\def\height{1cm} |
| 438 |
\def\testouterx{20pt} |
| 439 |
\def\testoutery{10pt} |
| 440 |
|
| 441 |
Marked angle = \angle\\ |
| 442 |
{\tt outer xsep = \testouterx}\\ |
| 443 |
{\tt outer ysep = \testoutery}\\ |
| 444 |
{\tt minimum height = \height}\\ |
| 445 |
{\tt minimum width = \width} |
| 446 |
|
| 447 |
\vspace{-5ex} |
| 448 |
\begin{center} |
| 449 |
\begin{tikzpicture} |
| 450 |
|
| 451 |
\markOrig |
| 452 |
|
| 453 |
%% red path where anchors should be ? |
| 454 |
\node at (0,0) [\testshape, draw, help lines, red, |
| 455 |
minimum width=\width+2*\testouterx, |
| 456 |
minimum height=\height+2*\testoutery, |
| 457 |
] (bigger) {}; |
| 458 |
|
| 459 |
\node at (0,0) [\testshape, draw, |
| 460 |
minimum width=\width, |
| 461 |
minimum height=\height, |
| 462 |
outer xsep=\testouterx, |
| 463 |
outer ysep=\testoutery |
| 464 |
] (test) {}; |
| 465 |
|
| 466 |
\foreach \angle in {0,5,...,355} { |
| 467 |
\fill[blue] (test.\angle) circle[radius=1pt]; |
| 468 |
} |
| 469 |
|
| 470 |
%% single angle test |
| 471 |
\def\angle{120} |
| 472 |
\draw [help lines] (test.center) -- ++(\angle:1.5cm); |
| 473 |
\draw[green] (test.\angle) circle[radius=2pt]; |
| 474 |
\draw[green] (test.\angle) -- ++(3pt,3pt); |
| 475 |
\draw[green] (test.\angle) -- ++(-3pt,-3pt); |
| 476 |
\draw[green] (test.\angle) -- ++(-3pt,3pt); |
| 477 |
\draw[green] (test.\angle) -- ++(3pt,-3pt); |
| 478 |
|
| 479 |
\end{tikzpicture} |
| 480 |
\end{center} |
| 481 |
|
| 482 |
%%-------------------------------------------------------- |
| 483 |
\section*{Simple Node Connections} |
| 484 |
|
| 485 |
\begin{center} |
| 486 |
\begin{tikzpicture} |
| 487 |
\def\ra{0} \def\rb{60pt} \def\rc{120pt} |
| 488 |
\def\ca{0} \def\cb{100pt} \def\cc{200pt} |
| 489 |
|
| 490 |
\draw[help lines,step=20pt,dotted] (0pt,0pt) grid (\cc,\rc); |
| 491 |
|
| 492 |
\tikzset{node style/.style={ minimum width=40pt,minimum height=20pt}} |
| 493 |
|
| 494 |
\markOrig |
| 495 |
|
| 496 |
\node at (\ca,\ra) [draw, \testshape, node style] (A) {A}; |
| 497 |
\node at (\cb,\ra) [draw, \testshape, node style] (B) {B}; |
| 498 |
\node at (\cc,\ra) [draw, \testshape, node style] (C) {C}; |
| 499 |
%% |
| 500 |
\node at (\ca,\rb) [draw, \testshape, node style] (D) {D}; |
| 501 |
\node at (\cb,\rb) [draw, \testshape, node style] (E) {E}; |
| 502 |
\node at (\cc,\rb) [draw, \testshape, node style] (F) {F}; |
| 503 |
%% |
| 504 |
\node at (\ca,\rc) [draw, \testshape, node style] (G) {G}; |
| 505 |
\node at (\cb,\rc) [draw, \testshape, node style] (H) {H}; |
| 506 |
\node at (\cc,\rc) [draw, \testshape, node style] (I) {I}; |
| 507 |
|
| 508 |
\draw (E) -- (F); |
| 509 |
\draw (E) -- (D); |
| 510 |
\draw (E) -- (B); |
| 511 |
\draw (E) -- (H); |
| 512 |
\draw (E) -- (G); |
| 513 |
\draw (E) -- (A); |
| 514 |
\draw (E) -- (I); |
| 515 |
\draw (E) -- (C); |
| 516 |
|
| 517 |
\end{tikzpicture} |
| 518 |
\end{center} |
| 519 |
|
| 520 |
%%-------------------------------------------------------- |
| 521 |
\section*{Scaling} |
| 522 |
|
| 523 |
\def\minh{20pt} |
| 524 |
\def\minw{80pt} |
| 525 |
\def\exd{5pt} |
| 526 |
|
| 527 |
\begin{center} |
| 528 |
\begin{tikzpicture} |
| 529 |
|
| 530 |
\node at (0,0) |
| 531 |
[\testshape, draw, |
| 532 |
minimum width=\minw, |
| 533 |
minimum height=\minh, |
| 534 |
] (test1) {} ; |
| 535 |
|
| 536 |
\node at (0,0) |
| 537 |
[\testshape, draw, blue, |
| 538 |
minimum width=\minw+1cm, |
| 539 |
minimum height=\minh+1cm, |
| 540 |
] (test2) {} ; |
| 541 |
|
| 542 |
\node at (0,0) |
| 543 |
[\testshape, draw, red, |
| 544 |
minimum width=\minw+2cm, |
| 545 |
minimum height=\minh+2cm, |
| 546 |
] (test3) {} ; |
| 547 |
|
| 548 |
\def\tgridA#1#2{ |
| 549 |
\draw[help lines] ({0.5*(\minw+#1)+\exd},{0.5*(\minh+#1)}) -- ({-0.5*(\minw+#1)-\exd},{0.5*(\minh+#1)}); |
| 550 |
\draw[help lines] ({0.5*(\minw+#1)+\exd},{-0.5*(\minh+#1)}) -- ({-0.5*(\minw+#1)-\exd},{-0.5*(\minh+#1)}); |
| 551 |
\draw[help lines] ({0.5*(\minw+#1)},{0.5*(\minh+#1)+\exd}) -- ({0.5*(\minw+#1)},{-0.5*(\minh+#1)-\exd}); |
| 552 |
\draw[help lines] ({-0.5*(\minw+#1)},{0.5*(\minh+#1)+\exd}) -- ({-0.5*(\minw+#1)},{-0.5*(\minh+#1)-\exd}); |
| 553 |
} |
| 554 |
|
| 555 |
\begin{scope}[on background layer] |
| 556 |
\tgridA{0pt}{0pt} |
| 557 |
\tgridA{1cm}{1cm} |
| 558 |
\tgridA{2cm}{2cm} |
| 559 |
\markOrig |
| 560 |
\end{scope} |
| 561 |
|
| 562 |
\end{tikzpicture} |
| 563 |
\end{center} |
| 564 |
|
| 565 |
%%-------------------------------------------------------- |
| 566 |
\section*{Package Tests} |
| 567 |
|
| 568 |
%%-------------------------------------------------------- |
| 569 |
\subsection*{Text Alignment and the Text Box} |
| 570 |
|
| 571 |
\begin{center} |
| 572 |
\begin{tikzpicture} |
| 573 |
|
| 574 |
\node at (0,0) |
| 575 |
[\testshape, draw |
| 576 |
] (test1) {\verb|x x|} ; |
| 577 |
|
| 578 |
\node[ \testshape, draw, |
| 579 |
below of=test1, |
| 580 |
node distance=1cm |
| 581 |
] (test2) {\verb|x dx|} ; |
| 582 |
|
| 583 |
\node[ \testshape, draw, |
| 584 |
below of=test2, node distance=1cm |
| 585 |
] (test3) {\verb|xp x|} ; |
| 586 |
|
| 587 |
\node[ \testshape, draw, |
| 588 |
below of=test3, node distance=1cm |
| 589 |
] (test4) {\verb|xp dx|} ; |
| 590 |
|
| 591 |
\allanchors{test1}{1pt}{red} |
| 592 |
\corneranchors{test2}{1pt}{red} |
| 593 |
\corneranchors{test3}{1pt}{red} |
| 594 |
\corneranchors{test4}{1pt}{red} |
| 595 |
\centeranchor{test1}{2pt}{blue} |
| 596 |
\centeranchor{test2}{2pt}{blue} |
| 597 |
\centeranchor{test3}{2pt}{blue} |
| 598 |
\centeranchor{test4}{2pt}{blue} |
| 599 |
\textanchor{test1}{1pt}{green} |
| 600 |
\draw[help lines,green] (test1.text) -- ++(7pt,0); |
| 601 |
\draw[help lines,green] (test1.text) -- ++(0,5pt); |
| 602 |
\textanchor{test2}{1pt}{green} |
| 603 |
\textanchor{test3}{1pt}{green} |
| 604 |
\textanchor{test4}{1pt}{green} |
| 605 |
|
| 606 |
\begin{scope}[on background layer] |
| 607 |
|
| 608 |
\markOrig |
| 609 |
|
| 610 |
\node at(4cm,0) [ rectangle, draw |
| 611 |
] (ref1) {\verb|x x|} ; |
| 612 |
\draw[green] (ref1.north west) -- ++(-5cm,0); |
| 613 |
\draw[green] (ref1.south west) -- ++(-5cm,0); |
| 614 |
|
| 615 |
\node[rectangle, draw, |
| 616 |
below of=ref1, node distance=1cm |
| 617 |
] (ref2) {\verb|x dx|} ; |
| 618 |
\draw[green] (ref2.north west) -- ++(-5cm,0); |
| 619 |
\draw[green] (ref2.south west) -- ++(-5cm,0); |
| 620 |
|
| 621 |
\node[rectangle, draw, |
| 622 |
below of=ref2, node distance=1cm |
| 623 |
] (ref3) {\verb|xp x|} ; |
| 624 |
\draw[green] (ref3.north west) -- ++(-5cm,0); |
| 625 |
\draw[green] (ref3.south west) -- ++(-5cm,0); |
| 626 |
|
| 627 |
\node[rectangle, draw, |
| 628 |
below of=ref3, node distance=1cm |
| 629 |
] (ref4) {\verb|xp dx|} ; |
| 630 |
\draw[green] (ref4.north west) -- ++(-5cm,0); |
| 631 |
\draw[green] (ref4.south west) -- ++(-5cm,0); |
| 632 |
|
| 633 |
\end{scope} |
| 634 |
|
| 635 |
\end{tikzpicture} |
| 636 |
\end{center} |
| 637 |
|
| 638 |
%%-------------------------------------------------------- |
| 639 |
\subsection*{Inner, Outer and Angle for Shape Off Origin} |
| 640 |
|
| 641 |
The box should closely contain picture if {\tt anchorborder} is working correctly. |
| 642 |
\bigskip |
| 643 |
|
| 644 |
\begin{center} |
| 645 |
\begin{tikzpicture}[framed] |
| 646 |
|
| 647 |
\markOrigC{black} |
| 648 |
\draw (2pt,0) node[anchor=west]{\tt \tiny origin}; |
| 649 |
|
| 650 |
%% The test shape |
| 651 |
\node at (70pt,40pt) |
| 652 |
[\testshape, draw, |
| 653 |
red, minimum width=60pt, minimum height=40pt |
| 654 |
] (node) {}; |
| 655 |
|
| 656 |
%% outer test line |
| 657 |
\path (node); |
| 658 |
\pgfgetlastxy{\macrox}{\macroy} |
| 659 |
\coordinate (Xout) at (\macrox+20pt,\macroy+40pt); |
| 660 |
|
| 661 |
\draw (Xout) circle(3pt); |
| 662 |
\draw [help lines] (node.center) -- (Xout); |
| 663 |
\draw [->, >=latex',green] (Xout) -- (node); % <<< |
| 664 |
|
| 665 |
%% inner test line |
| 666 |
\path (node); |
| 667 |
\pgfgetlastxy{\macrox}{\macroy} |
| 668 |
\coordinate (Xin) at (\macrox-5pt,\macroy-5pt); |
| 669 |
|
| 670 |
\draw (Xin) circle(3pt); |
| 671 |
\draw [help lines,shorten >=-1cm] (node.center) -- (Xin); |
| 672 |
\draw [->, >=latex',green] (Xin) -- (node); % <<< |
| 673 |
|
| 674 |
%% test angle |
| 675 |
\def\angle{120} |
| 676 |
\draw [help lines] (node.center) -- ++(\angle:1.5cm); |
| 677 |
\draw[green] (node.\angle) circle[radius=2pt]; % <<< |
| 678 |
|
| 679 |
\end{tikzpicture} |
| 680 |
\end{center} |
| 681 |
|
| 682 |
\end{document} |
| 683 |
\endinput |
| 684 |
%% |
| 685 |
%% End of file `testsample.tex'. |