summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/tkz/tkz-euclide/doc/latex/TKZdoc-euclide-styles.tex
blob: d28226ee971f74f0585dcbc3215330387f28b41f (plain)
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
\section{Predefined styles}\label{custom}
The way to proceed will depend on your use of the package. A method that seems to me to be correct is to use as much as possible predefined styles in order to separate the content from the form. This method will be the right one if you plan to create a document (like this documentation) with many figures. We will see how to define a global style for a document. We will see how to use a style locally.

The file \tkzname{tkz-euclide.cfg} contains the predefined styles of the main objects. Among these the most important are points, lines, segments, circles, arcs and compass traces.
 If you always use the same styles and if you create many figures then it is interesting to create your own styles . To do this you need to know what features you can modify. It will be necessary to know some notions of \TIKZ.
 
 The predefined styles are global styles. They exist before the creation of the figures. It is better to avoid changing them between two figures. On the other hand these styles can be modified in a figure temporarily. There the styles are defined locally and do not influence the other figures.
 
 For the document you are reading here is how I defined the different styles.

\begin{tkzltxexample}[]
  \tkzSetUpColors[background=white,text=black]  
  \tkzSetUpPoint[size=2,color=teal]
  \tkzSetUpLine[line width=.4pt,color=teal]
  \tkzSetUpCompass[color=orange, line width=.4pt,delta=10]
  \tkzSetUpArc[color=gray,line width=.4pt]
  \tkzSetUpStyle[orange]{new}
\end{tkzltxexample}

The macro \tkzcname{tkzSetUpColors} allows you to set the background color as well as the text color. If you don't use it, the colors of your document will be used as well as the fonts. Let's see how to define the styles of the main objects.

\section{Points style}
This is how the points  are defined :
\begin{tkzltxexample}[]
\tikzset{point style/.style = {%
       draw         = \tkz@euc@pointcolor,
       inner sep    = 0pt,
       shape        = \tkz@euc@pointshape,
       minimum size = \tkz@euc@pointsize,
       fill         = \tkz@euc@pointcolor}}  
\end{tkzltxexample}

It is of course possible to use \tkzcname{tikzset} but you can use a macro provided by the package. You can use the macro \tkzcname{tkzSetUpPoint} globally or locally, \\ Let's look at this possibility.

\subsubsection{Use of \tkzcname{tkzSetUpPoint}}

\begin{NewMacroBox}{tkzSetUpPoint}{\oarg{local options}}%
\begin{tabular}{lll}%
options &  default & definition                 \\ 
\midrule
\TOline{color}{black}{point color} 
\TOline{size}{3}{point size} 
\TOline{fill}{black!50}{inside point color} 
\TOline{shape}{circle}{point shape circle, cross or cross out} 
\end{tabular}
\end{NewMacroBox}



\subsubsection{Global style or local style}
First of all here is a figure created with the styles of my documentation, then the style of the points is modified within the environment \tkzNameEnv{tikzspicture}. 

You can use the macro \tkzcname{tkzSetUpPoint} globally or locally, If you place this macro in your preamble or before your first figure then the point style will be valid for all figures in your document. Il sera possible d'utiliser un autre style locallement en utilisant cette commande au sein d'un environnement \tkzNameEnv{tikzpicture}.\\ Let's look at this possibility.
\begin{tkzexample}[latex=7cm,small]
\begin{tikzpicture}
  \tkzDefPoints{0/0/A,5/0/B,3/2/C,3/1/D}
  \tkzDrawPolygon(A,B,C)
  \tkzDrawPoints(A,B,C)
  \tkzLabelPoints(A,B) 
  \tkzLabelPoints[above right](C) 
\end{tikzpicture}
\end{tkzexample}

The style of the points is modified locally in the second figure 
\begin{tkzexample}[latex=7cm,small]
\begin{tikzpicture}
  \tkzSetUpPoint[size=4,color=red,fill=red!20]
  \tkzDefPoints{0/0/A,5/0/B,3/2/C,3/1/D}
  \tkzDrawPolygon(A,B,C)
  \tkzDrawPoints(A,B,C)
  \tkzDrawPoint[shape=cross out,thick](D)
  \tkzLabelPoints(A,B) 
  \tkzLabelPoints[above right](C) 
\end{tikzpicture}
\end{tkzexample}

The points get back the initial style. Point D has a new style limited by the environment \tkzNameEnv{scope}. It is also possible to use |{...}| orThe points get back the initial style. Point $D$ has a new style limited by the environment \tkzNameEnv{scope}. It is also possible to use |{...}| or |\begingoup  ... \endgroup|.

\begin{tkzexample}[latex=7cm,small]
\begin{tikzpicture}
  \tkzDefPoints{0/0/A,5/0/B,3/2/C,3/1/D}
  \tkzDrawPolygon(A,B,C)
  \tkzDrawPoints(A,B,C)
  \begin{scope}
    \tkzSetUpPoint[size=4,color=red,fill=red!20]
    \tkzDrawPoint(D)
  \end{scope}
  \tkzLabelPoints(A,B) 
  \tkzLabelPoints[above right](C) 
\end{tikzpicture}
\end{tkzexample}

\subsubsection{Simple example with \tkzcname{tkzSetUpPoint}}

\begin{tkzexample}[latex=5cm,small]
\begin{tikzpicture}
  \tkzSetUpPoint[shape = cross out,color=blue]
  \tkzDefPoint(2,1){A}
  \tkzDefPoint(4,0){B}
  \tkzDrawLine(A,B)
  \tkzDrawPoints(A,B)
\end{tikzpicture}
\end{tkzexample}

\subsubsection{Use of \tkzcname{tkzSetUpPoint} inside a group}
\begin{tkzexample}[latex=8cm,small]
\begin{tikzpicture}
  \tkzDefPoints{0/0/A,2/4/B,4/0/C,3/2/D}
  \tkzDrawSegments(A,B A,C A,D)
  {\tkzSetUpPoint[shape=cross out,
            fill= teal!50,
            size=4,color=teal]
  \tkzDrawPoints(A,B)}
  \tkzSetUpPoint[fill= teal!50,size=4,
               color=teal]
   \tkzDrawPoints(C,D)
  \tkzLabelPoints(A,B,C,D)
\end{tikzpicture}
\end{tkzexample}

\section{Lines style}

\subsubsection{Use of \tkzcname{tkzSetUpLine}} \label{tkzsetupline}
It is a macro that allows you to define the style of all the lines.

\begin{NewMacroBox}{tkzSetUpLine}{\oarg{local options}}%
\begin{tabular}{lll}%
options &  default & definition                 \\
\midrule
\TOline{color}{black}{colour of the construction lines}
\TOline{line width}{0.4pt}{thickness of the construction lines}
\TOline{style}{solid}{style of construction lines}
\TOline{add}{.2 and .2}{changing the length of a line segment}
\end{tabular}
\end{NewMacroBox}

\subsubsection{Change line width}
\begin{tkzexample}[latex=8cm,small]
\begin{tikzpicture}[scale=.75]
\tkzSetUpLine[line width=1pt]
\begin{scope}[rotate=-90]
    \tkzDefPoints{0/6/A,10/0/B,10/6/C}
    \tkzDefPointBy[projection = onto B--A](C)
    \tkzGetPoint{H}
    \tkzMarkRightAngle[size=.4,
                       fill=teal!20](B,C,A)
    \tkzMarkRightAngle[size=.4,
                       fill=orange!20](B,H,C)
    \tkzDrawPolygon(A,B,C)
    \tkzDrawSegment[new](C,H)
\end{scope}
 \tkzLabelSegment[below](C,B){$a$}
 \tkzLabelSegment[right](A,C){$b$}
 \tkzLabelSegment[left](A,B){$c$}
 \tkzLabelSegment[color=red](C,H){$h$}
 \tkzDrawPoints(A,B,C)
 \tkzLabelPoints[above left](H)
 \tkzLabelPoints(B,C)
 \tkzLabelPoints[above](A)
\end{tikzpicture}
\end{tkzexample}

\subsubsection{Change style of line}

\begin{tkzexample}[latex=7cm,small]
\begin{tikzpicture}[scale=.5]
\tikzset{line style/.style = {color = gray,
                             style=dashed}}
\tkzDefPoints{1/0/A,4/0/B,1/1/C,5/1/D}
\tkzDefPoints{1/2/E,6/2/F,0/4/A',3/4/B'}
\tkzCalcLength(C,D)
\tkzGetLength{rCD}
\tkzCalcLength(E,F)
\tkzGetLength{rEF}
\tkzInterCC[R](A',\rCD)(B',\rEF)
\tkzGetPoints{I}{J}
\tkzDrawLine(A',B')
\tkzCompass(A',B')
\tkzDrawSegments(A,B C,D E,F)
\tkzDrawCircles[R](A',{\rCD} B',\rEF)
\begin{scope}
  \tkzSetUpLine[color=red]
  \tkzDrawSegments(A',I B',I)
\end{scope}
\tkzDrawPoints(A,B,C,D,E,F,A',B',I,J)
\tkzLabelPoints(A,B,C,D,E,F,A',B',I,J)
\end{tikzpicture}
\end{tkzexample}

\subsubsection{Example 3: extend lines}
\begin{tkzexample}[latex=7cm,small]
  \begin{tikzpicture}[scale=.75]
  \tkzSetUpLine[add=.5 and .5]
  \tkzDefPoints{0/0/A,4/0/B,1/3/C}
  \tkzDrawLines(A,B B,C A,C)
  \tkzDrawPolygon[red,thick](A,B,C)
  \tkzSetUpPoint[size=4,circle,color=red,fill=red!20]
  \tkzDrawPoints(A,B,C)
  \end{tikzpicture}
\end{tkzexample}

\section{Arc style}

\begin{NewMacroBox}{tkzSetUpArc}{\oarg{local options}}%
\begin{tabular}{lll}%
options &  default & definition                 \\
\midrule
\TOline{color}{black}{colour of the  lines}
\TOline{line width}{0.4pt}{thickness of the lines}
\TOline{style}{solid}{style of construction lines}
\end{tabular}
\end{NewMacroBox}

\begin{tkzexample}[latex=7cm,small]
  \begin{tikzpicture}
  \def\r{3} \def\angle{200}
  \tkzSetUpArc[delta=5,color=purple,style=dashed]
  \tkzSetUpLabel[font=\scriptsize,red]
  \tkzDefPoint(0,0){O}
  \tkzDefPoint(\angle:\r){A}
  \tkzInterCC(O,A)(A,O) \tkzGetPoints{C'}{C}
  \tkzInterCC(O,A)(C,O) \tkzGetPoints{D'}{D}
  \tkzInterCC(O,A)(D,O) \tkzGetPoints{X'}{X}
  \tkzDrawCircle(O,A)
  \tkzDrawArc(A,C')(C)
  \tkzDrawArc(C,O)(D)
  \tkzDrawArc(D,O)(X)
  \tkzDrawLine[add=.1 and .1](A,X)
  \tkzDrawPoints(O,A)
  \tkzDrawPoints[new](C,C',D,X)
  \tkzLabelPoints[below left](O,A)
  \tkzLabelPoints[below](C,C')
  \tkzLabelPoints[below right](X)
  \tkzLabelPoints[above](D)
  \end{tikzpicture}
\end{tkzexample}

\section{Compass style, configuration macro \tkzcname{tkzSetUpCompass}}
The following macro will help to understand the construction of a figure by showing the compass traces necessary to obtain certain points. 

\begin{NewMacroBox}{tkzSetUpCompass}{\oarg{local options}}%
\begin{tabular}{lll}%
options &  default & definition                 \\
\midrule
\TOline{color}{black}{colour of the construction lines}
\TOline{line width}{0.4pt}{thickness of the construction lines}
\TOline{style}{solid}{style of  lines : solid, dashed,dotted,...}
\TOline{delta}{0}{changes the length of the arc }
\end{tabular}
\end{NewMacroBox}

\subsubsection{Use of \tkzcname{tkzSetUpCompass}}

\begin{tkzexample}[latex=7cm,small]
\begin{tikzpicture}
  \tkzSetUpCompass[color=red,delta=15]
  \tkzDefPoint(1,1){A}
  \tkzDefPoint(6,1){B}
  \tkzInterCC[R](A,4)(B,4) \tkzGetPoints{C}{D}
  \tkzCompass(A,C)
  \tkzCompass(B,C)
  \tkzDrawPolygon(A,B,C)
  \tkzDrawPoints(A,B,C)
\end{tikzpicture} 
\end{tkzexample}

\subsubsection{Use of \tkzcname{tkzSetUpCompass} with \tkzcname{tkzShowLine}}

\begin{tkzexample}[latex=7cm,small]
\begin{tikzpicture}[scale=.75]
\tkzSetUpStyle[bisector,size=2,gap=3]{showbi}
\tkzSetUpCompass[color=teal,line width=.3 pt] 
\tkzDefPoints{0/1/A, 8/3/B, 3/6/C} 
\tkzDrawPolygon(A,B,C) 
\tkzDefLine[bisector](B,A,C) \tkzGetPoint{a} 
\tkzDefLine[bisector](C,B,A) \tkzGetPoint{b} 
\tkzShowLine[showbi](B,A,C) 
\tkzShowLine[showbi](C,B,A) 
\tkzInterLL(A,a)(B,b) \tkzGetPoint{I} 
\tkzDefPointBy[projection= onto A--B](I)
\tkzGetPoint{H} 
\tkzDrawCircle[radius,new](I,H) 
\tkzDrawSegments[new](I,H) 
\tkzDrawLines[add=0 and .2,new](A,I B,I)
\end{tikzpicture}
\end{tkzexample} 





\section{Label style}
The macro \tkzcname{tkzSetUpLabel} is used to define the style of the point labels.
\begin{NewMacroBox}{tkzSetUpStyle}{\oarg{local options}}%
  The options are the same as those of \TIKZ
\end{NewMacroBox}

\begin{tkzexample}[latex=6cm,small]
\begin{tikzpicture}[scale=.75]
  \tkzSetUpLabel[font=\scriptsize,red]
  \tkzSetUpStyle[line width=1pt,teal,<->]{XY}
  \tkzInit[xmin=-3,xmax=3,ymin=-3,ymax=3]
  \tkzDrawX[XY]
  \tkzDrawY[XY]
  \tkzDefPoints{1/0/A,0/1/B,-1/0/C,0/-1/D}
  \tkzDrawPoints[teal,fill=teal!30,size=6](A,...,D)
  \tkzLabelPoint[above right](A){$(1,0)$}
  \tkzLabelPoint[above right](B){$(0,1)$}
  \tkzLabelPoint[above left](C){$(-1,0)$}
  \tkzLabelPoint[below left](D){$(0,-1)$}
\end{tikzpicture}
\end{tkzexample}


\section{Own style}
You can set  your own style with \tkzcname{tkzSetUpStyle}

\begin{NewMacroBox}{tkzSetUpStyle}{\oarg{local options}}%
  The options are the same as those of \TIKZ
\end{NewMacroBox}

\begin{tkzexample}[latex=2cm,small]
\begin{tikzpicture}
  \tkzSetUpStyle[color=blue!20!black,fill=blue!20]{mystyle}
  \tkzDefPoint(0,0){O}
  \tkzDefPoint(0,1){A}
  \tkzDrawPoints(O) % general style
  \tkzDrawPoints[mystyle,size=4](A) % my style
  \tkzLabelPoints(O,A)
\end{tikzpicture}
\end{tkzexample}

\endinput