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
|
% tkz-tools-text.tex
% Copyright 2020 Alain Matthes
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
% http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status “maintained”.
%
% The Current Maintainer of this work is Alain Matthes.
% utf8 encoding
\def\fileversion{3.06c}
\def\filedate{2020/03/18}
\typeout{2020/03/18 3.06c tkz-tools-text.tex}
\makeatletter
%<--------------------------------------------------------------------------–>
% tkzText
%<--------------------------------------------------------------------------–>
\def\tkz@parsenode#1{%
\tkz@getvirg#1,\@nil
\iftkz@node
\else
\tkz@getfromcart#1\@nil
\fi
}
\def\tkz@getvirg#1,#2\@nil{%
\ifx\tkzempty#2\tkzempty%
\tkz@nodetrue
\else
\tkz@nodefalse
\fi
}
\def\tkzText{\pgfutil@ifnextchar[{\tkz@Text}{\tkz@Text[]}}
\def\tkz@Text[#1](#2)#3{%
\begingroup
\tkz@parsenode{#2}
\iftkz@node
\node[#1] at (#2){#3};
\else
\edef\tkzpt@xa{\fpeval{(\tkz@absc-\tkz@init@xorigine)/\tkz@init@xstep}}
\edef\tkzpt@ya{\fpeval{(\tkz@ord-\tkz@init@yorigine)/\tkz@init@ystep}}
\node[#1] at (\tkzpt@xa,\tkzpt@ya){#3};%
\fi
\endgroup
}%
% %<--------------------------------------------------------------------------–>
% % légende
% %<--------------------------------------------------------------------------–>
\pgfkeys{/tkzlegend/.cd,
line/.is if = tkz@legend@line,
line/.default = true,
line = false,
/tkzlegend/.search also = {/tikz},
}
\def\tkzLegend{\pgfutil@ifnextchar[{\tkz@Legend}{\tkz@Legend[]}}
\def\tkz@Legend[#1](#2,#3)#4{%
\pgfqkeys{/tkzlegend}{#1}
\begingroup
\c@pgfmath@counta=0 %
\edef\tkzpt@xa{\fpeval{(#2-\tkz@init@xorigine)/\tkz@init@xstep}}
\edef\tkzpt@ya{\fpeval{(#3-\tkz@init@yorigine)/\tkz@init@ystep}}
\node[/tkzlegend/.cd,#1] at (\tkzpt@xa,\tkzpt@ya) {%
\begin{tikzpicture}
\foreach \motif/\size/\col/\mtext in {#4}{%
\iftkz@legend@line
\draw[color = \col,
line width = \size,
style = \motif,
text = \tkz@mainlinecolor]%
(0cm ,\the\c@pgfmath@counta ex)--%
(\tkz@legend@line@len,\the\c@pgfmath@counta ex)
\else
\draw plot[mark size = \size,%
mark = \motif,%
mark options = {color=\col}]%
coordinates{(0 ex,\the\c@pgfmath@counta ex)}%
\fi
node[right=1ex] {\mtext};
\global\advance\c@pgfmath@counta by 3 %
}%
\end{tikzpicture}%
};%
\endgroup
}
\makeatother
\endinput
|