summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/tkz/tkz-base/doc/latex/TKZdoc-base-texte.tex
blob: eb53581ab9679927e3fb88974a721b41228b98d3 (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
\section{Texts and Legends} 

\subsection{Placing a title}  
Of course you can use \TIKZ, but the macro I propose to allow you to place the text using the units chosen for the drawing.

The options are always those of \TIKZ, in particular the following ones: 
\begin{NewMacroBox}{tkzText}{\oarg{local options}\parg{dot}\var{text}}%
The point can either be given by its coordinates or by its name.
\hypertarget{text}{}
\begin{tabular}{lll}%  
\toprule
options  & default & definition\\
\midrule
\TOline{color   }{|black|}{current colour}
\TOline{text    }{|black|}{text colour}
\TOline{fill    }{|white|}{background colour} 
\TOline{opacity }{|1|    }{opacity} 
\end{tabular}
\end{NewMacroBox}

\subsubsection{A title} 

\begin{tkzexample}[latex=8cm]
\begin{tikzpicture}
  \tkzInit[xmax  = 6,   ymin  = 1000,%
           ymax  = 4000,ystep = 1000]
  \tkzAxeXY 
  \tkzText[draw,
           line width = 1pt,%
           color    = red,%
           fill = orange!20](3,4000)%
           {Recette en fonction du mois}
\end{tikzpicture}
\end{tkzexample}

\subsubsection{Draft} 

\begin{tkzexample}[latex=8cm]
\begin{tikzpicture}
  \tkzInit[xmax  = 6,   ymin  = 1000,%
           ymax  = 4000,ystep = 1000]
  \tkzGrid   \tkzAxeXY
  \tkzText[draw,opacity=.2,
           rotate=45,inner sep=.6 cm,
           line width = 1pt,
           color = black,
           fill = purple!20](3,2500)
           {\Huge DRAFT}
\end{tikzpicture}
\end{tkzexample}

\subsubsection{Text with a period}
It is possible to give the reference of a point instead of its coordinates.

\begin{tkzexample}[latex=8cm]
\begin{tikzpicture}
  \tkzInit[ymax=5,xmax=6]
  \tkzAxeXY 
  \tkzDefPoint(3,3){A}
  \tkzText[draw,opacity=.6,
           inner sep=.6 cm,
           line width = 1pt,
           color    = black,
           fill = purple!20](A)
           {My text}
\end{tikzpicture}
\end{tkzexample}

\subsubsection{Text format}
 The option \tkzname{text width} is interesting, see the pgfmanual for more information.
\begin{tkzexample}[latex=8cm,small]
\begin{tikzpicture}
 \tkzInit[ymax=5,xmax=6]
 \tkzAxeXY 
 \tkzText[draw,opacity=.6,
          inner sep=.6 cm,
          line width = 1pt,
          color    = black,
          fill = purple!20,
          text width=3cm](3,3)
          {My text\\\ Reference}
\end{tikzpicture}
\end{tkzexample}    

\subsection{Placing legends}
There are two ways to use this macro. Either you can place legends for curves. Then you can represent lines with their own style, or you can differentiate symbols (mark).
\hypertarget{legend}{}
\begin{NewMacroBox}{tkzLegend}{\oarg{local options}\var{mark/color/size/text}}%
The arguments differ according to the boolean \tkzname{line}. 

\medskip
\begin{tabular}{lll}%  
\toprule
options  & default & definition\\
\midrule
\TOline{line}{false}{Boolean :line or symbol}
\end{tabular}
 
Avec |line=true|

\begin{tabular}{lll}  
\toprule
arguments  & default & example\\
\midrule
\TAline{style/line width/color/texte}{no default}{dashed/1pt/red/Recipe}
\end{tabular}  

\medskip
With |line=false|
  
\begin{tabular}{lll}  
\toprule
arguments  & default & example\\
\midrule
\TAline{mark/mark size/color/texte}{no default}{heart/1ex/red!30/Product Recipe A}
\end{tabular}
\end{NewMacroBox}

\subsubsection{Legends with symbols}
\begin{tkzexample}[vbox]
\begin{tikzpicture}
\tkzInit[xmax=12,ymin=1000,ymax=11000,ystep=2000]
\tkzGrid[color=orange!30]
\tkzDrawX[below right,label=Mois]
\tkzDrawY[above left,label=Recette]
\tkzLabelX
\tkzLabelY
\tkzDefSetOfPoints{1/2000,2/3000,3/2000,4/2500,5/4200,6/4800,7/4600,
                   8/5200,9/6200,10/7000,11/7400,12/10000}
\tkzDefSetOfPoints[prefix=P]{1/3200,2/4100,3/3300,4/3300,5/5000,6/5500,7/5200,8/4000,
         9/3000,10/6000,11/8400,12/9000}
\tkzSetUpMark[mark=heart,color=black,fill=red!30,size=4pt]
\tkzJoinSetOfPoints[thick,color=brown,double]
\tkzDrawSetOfPoints
\tkzJoinSetOfPoints[prefix=P,thick,color=orange,double]
\tkzDrawSetOfPoints[prefix=P,mark=square*,mark size=4pt,
                    mark options={color=blue,fill=blue!40}]
\tkzLegend[draw,rounded corners,fill=orange!20,text=brown,
          line width=2pt](5,10000){heart/1ex/red!30/Product Recipe A,%
                                   square*/0.75ex/blue!40/Product Recipe B}
\end{tikzpicture}
\end{tkzexample}



\endinput