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