Debian Codegraph @

texmf-dist/doc/latex/tikz-dimline/tikz-dimline-doc.tex

raw
1
2 \documentclass[a4paper]{article}
3
4 \usepackage[all]{nowidow}
5 \widowpenalty10000
6 \clubpenalty10000
7
8
9 %% See http://tex.stackexchange.com/questions/78334/print-system-information-in-latex-doc
10 \RequirePackage{ifxetex}
11 \ifxetex
12 \RequirePackage{fontspec}
13 \RequirePackage{xltxtra}
14 \newcommand{\myxetex}{\XeLaTeX}
15 \newcommand{\compilator}{\XeLaTeX{}}
16 \newcommand{\cversion}{\the\XeTeXversion\XeTeXrevision}
17
18 \else
19 \RequirePackage[utf8]{inputenc}
20 \newcommand{\myxetex}{\texttt{XeLaTeX}}
21 \newcommand{\compilator}{\LaTeX{}}
22 \makeatletter
23 \newcommand{\cversion}{
24 \ifnum\pdftexversion<100 %
25 \the\pdftexversion.\pdftexrevision
26 \else
27 \ifnum\pdftexversion<130 %
28 \expandafter\@car\the\pdftexversion\@empty\@nil.%
29 \expandafter\@cdr\the\pdftexversion\@empty\@nil
30 \pdftexrevision
31 \else
32 \expandafter\@car\the\pdftexversion\@empty\@nil.%
33 \expandafter\@cdr\the\pdftexversion\@empty\@nil.%
34 \pdftexrevision
35 \fi
36 \fi
37 }
38 \makeatother
39 \fi
40
41 \makeatletter
42 \newcommand{\tcbversion}{\tcb@version}
43 \makeatother
44
45 \RequirePackage{etoolbox}
46
47 \RequirePackage{minted}
48
49
50 \RequirePackage{tikz}
51 \usetikzlibrary{calc}
52 \usetikzlibrary{fit,spy}
53 \usetikzlibrary{intersections}
54
55 \usepackage{pgfplots}
56
57 \RequirePackage{tcolorbox}
58 \tcbuselibrary{skins,listings}
59 \tcbuselibrary{minted}
60 \tcbuselibrary{documentation}
61
62 %% Diameter
63 \usepackage{ wasysym }
64
65 \usepackage{tikz-dimline}
66
67
68 %%\tikzset{every picture/.append style={scale=0.5}}
69 %% \tikzset{global scale/.style={
70 %% scale=0.5,
71 %% every node/.style={scale=0.5}
72 %% }
73 %% }
74
75 %\tcbset{listing engine=latex}
76 \newminted[srcGrid]{latex}{baselinestretch=0.5,fontsize=\footnotesize}
77
78
79 \newtcblisting{exampleB}[2][]{%
80 colframe=red!50!yellow!50!black,
81 colback=white,
82 coltitle=red!50!yellow!3!white,
83 bicolor,colbacklower=red!50!yellow!5!white,
84 fonttitle=\sffamily\bfseries,
85 center upper,
86 minted language=latex,
87 minted options={baselinestretch=0.5,fontsize=\scriptsize},
88 %%lefthand ratio=0.33,
89 %%sidebyside,
90 text and listing,
91 title=#2,#1}
92
93 \newtcblisting{exampleA}[2][]{%
94 colframe=red!50!yellow!50!black,
95 colback=white,
96 coltitle=red!50!yellow!3!white,
97 bicolor,colbacklower=red!50!yellow!5!white,
98 fonttitle=\sffamily\bfseries,
99 center upper,
100 minted language=latex,
101 minted options={baselinestretch=0.5,fontsize=\scriptsize},
102 %%lefthand ratio=0.33,
103 %%sidebyside,
104 listing,
105 title=#2,#1}
106
107
108 %% \newtcblisting{exampleA}[2][]{%
109 %% colframe=red!50!yellow!50!black,
110 %% colback=white,
111 %% coltitle=red!50!yellow!3!white,
112 %% bicolor,colbacklower=red!50!yellow!5!white,
113 %% fonttitle=\sffamily\bfseries,
114 %% sidebyside,text and listing,
115 %% title=#2,#1}
116
117
118
119
120
121 \BeforeBeginEnvironment{srcGrid}{%
122 \begin{tcolorbox}[boxrule=0.5pt,left=1mm,width=\linewidth]}
123 \AfterEndEnvironment{srcGrid}{\end{tcolorbox}}%
124
125
126
127
128
129 %% \AtBeginEnvironment{exampleB}{}
130 %% \AtEndEnvironment{exampleB}{}
131
132
133 %% \BeforeBeginEnvironment{srcGrid}{%
134 %% \begin{exampleB}[boxrule=0.5pt,left=1mm,width=\linewidth]{}}
135 %% \AfterEndEnvironment{srcGrid}{\end{exampleB}}%
136
137
138
139 %% Just to draw a help grid
140 %% \helpgrid{Xa}{Ya}{Xb}{Yb}
141 \makeatletter
142 \newcommand{\helpgrid@do@nothing}[1]{#1}%
143 \newcommand{\helpgrid}[4]{%
144 \pgfplotsifinaxis{%
145 \let\helpgrid@internal\pgfplotsextra%
146 }{%
147 \let\helpgrid@internal\helpgrid@do@nothing%
148 }%
149
150 \begin{scope}
151
152 \coordinate (a) at (#1,#2) {};
153 \coordinate (b) at (#3,#4) {};
154
155 \draw[step=1,gray!10,very thin] (a) grid (b);
156
157 \foreach \x in {#1,...,#3}
158 \node[anchor=north,gray!20] at (\x, 0) {\tiny{\x}};
159
160 \foreach \y in {#2,...,#4}
161 \node[anchor=east,gray!20] at (0, \y) {\texttt{\tiny{$\y$}}};
162 \end{scope}
163 }%
164 \makeatother
165
166
167 \newcommand{\PGF}{\textsc{PGF}}
168 \newcommand{\TikZ}{Ti\textcolor{orange}{\emph{k}}Z}
169
170
171
172 \title{
173 \texttt{dimline}\\
174 Technical dimension lines using \PGF/\TikZ\\
175 }
176 \author{Sébastien Gross\\ \texttt{<seb•$\alpha\tau$•chezwam•$\partial\theta\tau$•org>}}
177 \date{\csname [email protected]\endcsname}
178
179 \begin{document}
180
181 \maketitle
182
183
184 \let\thefootnote\relax\footnotetext{This documentation was compiled on
185 {\platformname} using {\compilator} {\cversion}, {\PGF} {\pgfversion},
186 \texttt{tcolorbox} {\tcbversion} on {\today}.}
187
188
189 Dimension lines are drawn segments that indicate the measurement of a
190 feature. The line has an arrow at both ends to show that the dimension
191 displayed covers the entire span of that line. The direction of the line
192 (vertical, horizontal or diagonal) shows the direction of the
193 measurement. Dimension lines are kept outside of the object illustrated,
194 typically connected to other lines that display the area where that
195 measurement applies. This keeps the illustration clear.
196
197 \begin{tcolorbox}[title={Contents},fonttitle=\bfseries\Large,
198 colback=yellow!10!white,colframe=red!50!black,before=\par\bigskip\noindent]
199 \makeatletter
200 \@starttoc{toc}
201 \makeatother
202 %\tableofcontents
203 \end{tcolorbox}
204
205
206 \newpage
207
208
209
210 \section{Overview}
211
212 \begin{exampleB}{}
213
214 \begin{tikzpicture}[scale=2]
215 \draw[line width=1pt] (0,0) -- (0,4) -- (.5,4) -- (.5,5) -- (1.,5)
216 -- (1.,4) -- (1.5,4) -- (1.5,0) -- cycle;
217
218 \draw node (A) at (2.5,0) {};
219
220 \dimline[line style = {line width=0.7},
221 extension start length=-0.24,
222 extension end length=-0.24] {(A)}{($ (A) + (0,4) $)}{$4.0$};
223
224 \dimline[line style = {red, line width=0.7},
225 extension start length=0,
226 extension end length=0] {(0,2)}{(1.5, 2)}{ $\diameter 1.5$};
227
228 \dimline[label style={above=0.5ex,},
229 extension start path = {(0,6) (0,5.7) (0.5,5.4) (0.5,5.05)},
230 extension end path = {(1.5,6) (1.5,5.7) (1,5.4) (1,5.05)},]
231 {(0,6)}{(1.5,6)}{$\diameter 0.5$};
232 \end{tikzpicture}
233 \end{exampleB}
234
235
236 \let\thefootnote\relax\footnotetext{The \texttt{wasysym} package is required to have \texttt{\textbackslash diameter} command.}
237
238
239 \newpage
240
241
242 \section{Installation}
243
244 To install the \verb"tkiz-dimline" package copy its directory to either to
245 \begin{itemize}
246 \item \verb"$TEXHOME/tex/latex/"
247 \item \verb"$TEXMFHOME/tex/latex/"
248 \item \verb"~/texmf/tex/latex/"
249 \item \verb"~/Library/texmf/tex/latex/"
250 \end{itemize}
251
252 \section{Usage}
253
254 \subsection{command}
255 \begin{docCommand}{dimline}{\oarg{key path}\marg{start}\marg{end}\marg{label}}
256 Creates a new dimension line from \meta{start} to \meta{end} with
257 \meta{label}. An optional \meta{key path} can be used to customise the
258 dimension line.
259
260 This command has to be called within a \docAuxEnvironment*{tikzpicture}
261 environment.
262
263 \end{docCommand}
264
265 \subsection{options}
266 \begin{docKey}{color}{=\meta{color}}{black}
267 Dimension line color.
268 \end{docKey}
269 \begin{docKey}{line style}{=\meta{style}}{not set}
270 Dimension line style, identical to {\PGF} line style.
271 \end{docKey}
272 \begin{docKey}{label style}{=\meta{style}}{not set}
273 Dimension label style, identical to {\PGF} label style.
274 \end{docKey}
275
276 \begin{docKey}{extension start length}{=\meta{size}}{1cm}
277 Length of the extention line at the start point.
278 \end{docKey}
279
280 \begin{docKey}{extension end length}{=\meta{size}}{1cm}
281 Identical to \refKey*{extension start length}, but for the end point.
282 \end{docKey}
283
284 \begin{docKey}{extension start angle}{=\meta{angle}}{-90}
285 Angle between the dimension line and the extention line at the start
286 point. You dont't want to change that value unless you really know what
287 you are doing. You would rather have a look to \refKey*{extension start
288 path} and \refKey*{extension end path}.
289 \end{docKey}
290
291 \begin{docKey}{extension end angle}{=\meta{angle}}{90}
292 Identical to \refKey*{extension start angle}, but for the end point.
293 \end{docKey}
294
295 \begin{docKey}{extension start style}{=\meta{style}}{not set}
296 Style for the extension line at the start point.
297 \end{docKey}
298
299 \begin{docKey}{extension end style}{=\meta{style}}{not set}
300 Identical to \refKey*{extension start style}, but for the end point.
301 \end{docKey}
302
303 \begin{docKey}{extension start path}{=\meta{path}}{not set}
304 Path (coordinates relative to the current
305 \docAuxEnvironment*{tkizpicture}) for the extension line at the start
306 point.
307 \end{docKey}
308
309 \begin{docKey}{extension end path}{=\meta{path}}{not set}
310 Identical to \refKey*{extension start path}, but for the end point.
311 \end{docKey}
312
313
314 \begin{docKey}{arrows}{=\meta{arrows spec}}{dimline-dimline}
315 Arrows used for the dimension line. \docAuxKey{dimline-dimline} is used
316 for standard arrows. Use \docAuxKey{dimeline reverse-dimline reverse} to
317 reverse the arrow heads.
318 \end{docKey}
319
320
321
322 \section{Examples}
323
324 On following examples \docAuxCommand{helpgrid} is only used for a labeled
325 grid. This not mandatory you can dicard this line. See source of this
326 documentation to see how \docAuxCommand{helpgrid} command is defined.
327
328
329
330 \subsection{Basic usage}
331
332 This is a very simple usage. It just draws a dimension line (using default
333 values) between 2 points with a label on it. Note that the dimension starts
334 at the border of the side tick mark, not at the end of the arrow.
335
336 \begin{exampleB}{}
337 \begin{tikzpicture}[spy using outlines={circle, magnification=25, size=6cm,
338 connect spies}]
339 \helpgrid{-1}{-1}{5}{4}
340 \draw[line width=0.01,color=red] plot[mark=+] coordinates{(3,3)} {};
341 \draw[line width=0.01,color=green] plot[mark=x] coordinates{(3,3)} {};
342 \dimline[line style = {line width=0.5}]{(0,0)}{(3,3)}{Label};
343 \spy [blue] on (2.975,2.975) in node [fill=white] at (6.5,1.5);
344 \end{tikzpicture}
345 \end{exampleB}
346
347
348 \subsection{Reverse arrows}
349
350 Sometimes, shuch as for very small dimensions, you need to reverse the
351 arrows. You can then use a \docAuxKey{dimeline reverse} arrow.
352
353 \begin{exampleB}{}
354 \begin{tikzpicture}[spy using outlines={circle, magnification=25, size=6cm,
355 connect spies}]
356 \helpgrid{-1}{-1}{5}{4}
357 \draw[line width=0.01,color=red] plot[mark=+] coordinates{(3,3)} {};
358 \draw[line width=0.01,color=green] plot[mark=x] coordinates{(3,3)} {};
359
360 \dimline[line style = {line width=0.5,
361 arrows=dimline reverse-dimline reverse}]{(0,0)}{(3,3)}{Label};
362 \spy [blue] on (3.025,3.025) in node [fill=white] at (6.5,1.5);
363 \end{tikzpicture}
364 \end{exampleB}
365
366 \subsection{Styling your dimension lines}
367
368 You can customize your dimension lines like any other \TikZ{} environment.
369 \begin{exampleB}{}
370 \begin{tikzpicture}[scale=0.5]
371 \helpgrid{-1}{-1}{4}{7}
372 \draw (0,0) -- (0,4) -- (.5,4) -- (.5,5) -- (1.,5) -- (1.,4) -- (1.5,4) -- (1.5,0)
373 -- cycle;
374 \dimline[color=blue,
375 extension start length=-0.25, extension end length=-0.25]{(2.75,0)}{(2.75,4)}{4.0};
376 \dimline[color=red,
377 line style={arrows=dimline reverse-dimline reverse},
378 label style={above=0.8ex,font=\tiny},
379 extension start length=1,
380 extension end length=1]{(0.5,5.6)}{(1.0,5.6)}{0.5};
381 \end{tikzpicture}
382 \end{exampleB}
383
384
385 \subsection{Complex extension lines}
386
387 This example shows you how to use both a \docAuxKey{extension start path}
388 and \docAuxKey{extension end path}. This is useful if you want to enlarge a
389 small dimension area.
390
391 \begin{exampleB}{}
392 \begin{tikzpicture}[scale=0.5]
393 \helpgrid{-1}{-1}{4}{7}
394 \draw (0,0) -- (0,4) -- (.5,4) -- (.5,5) -- (1.,5) -- (1.,4) -- (1.5,4) -- (1.5,0)
395 -- cycle;
396
397 \draw[color=red] node (A) at (2.5,0) {} node [yshift=1ex,xshift=-1ex]
398 at (A) {\tiny{A}};
399 \dimline[color=blue,
400 line style = {line width=0.7},
401 extension start length=-0.24,
402 extension end length=-0.24] {(A)}{($ (A) + (0,4) $)}{4.0};
403 \dimline[label style={above=0.5ex, fill=blue!10,},
404 extension start path = {(0,6) (0,5.7) (0.5,5.4) (0.5,5.05)},
405 extension start style = { green },
406 extension end path = {(1.5,6) (1.5,5.7) (1,5.4) (1,5.05)},]
407 {(0,6)}{(1.5,6)}{0.5};
408 \draw[color=red,line width=0.01] plot[mark=x] coordinates{(A)} {};
409 \end{tikzpicture}
410 \end{exampleB}
411
412 \section{License}
413
414 This program is free software. It comes without any warranty, to the extent
415 permitted by applicable law. You can redistribute it and/or modify it under
416 the terms of the Do What The Fuck You Want To Public License, Version 2, as
417 published by Sam Hocevar. See http://sam.zoy.org/wtfpl/COPYING for more
418 details.
419
420
421
422 \end{document}