| 1 |
% tkz-tools-text.tex |
| 2 |
% Copyright 2024 Alain Matthes |
| 3 |
% This work may be distributed and/or modified under the |
| 4 |
% conditions of the LaTeX Project Public License, either version 1.3 |
| 5 |
% of this license or (at your option) any later version. |
| 6 |
% The latest version of this license is in |
| 7 |
% http://www.latex-project.org/lppl.txt |
| 8 |
% and version 1.3 or later is part of all distributions of LaTeX |
| 9 |
% version 2005/12/01 or later. |
| 10 |
% This work has the LPPL maintenance status “maintained”. |
| 11 |
% The Current Maintainer of this work is Alain Matthes. |
| 12 |
|
| 13 |
\def\fileversion{4.21c} |
| 14 |
\def\filedate{2024/01/16} |
| 15 |
\typeout{2024/01/16 4.21c tkz-tools-text.tex} |
| 16 |
\makeatletter |
| 17 |
%<--------------------------------------------------------------------------–> |
| 18 |
% tkzText |
| 19 |
%<--------------------------------------------------------------------------–> |
| 20 |
\def\tkz@parsenode#1{% |
| 21 |
\tkz@getvirg#1,\@nil |
| 22 |
\iftkz@node |
| 23 |
\else |
| 24 |
\tkz@getfromcart#1\@nil |
| 25 |
\fi |
| 26 |
} |
| 27 |
\def\tkz@getvirg#1,#2\@nil{% |
| 28 |
\ifx\tkzempty#2\tkzempty% |
| 29 |
\tkz@nodetrue |
| 30 |
\else |
| 31 |
\tkz@nodefalse |
| 32 |
\fi |
| 33 |
} |
| 34 |
\def\tkzText{\pgfutil@ifnextchar[{\tkz@Text}{\tkz@Text[]}} |
| 35 |
\def\tkz@Text[#1](#2)#3{% |
| 36 |
\begingroup |
| 37 |
\tkz@parsenode{#2} |
| 38 |
\iftkz@node |
| 39 |
\node[#1] at (#2){#3}; |
| 40 |
\else |
| 41 |
\edef\tkzpt@xa{\fpeval{(\tkz@absc-\tkz@init@xorigine)/\tkz@init@xstep}} |
| 42 |
\edef\tkzpt@ya{\fpeval{(\tkz@ord-\tkz@init@yorigine)/\tkz@init@ystep}} |
| 43 |
\node[#1] at (\tkzpt@xa,\tkzpt@ya){#3};% |
| 44 |
\fi |
| 45 |
\endgroup |
| 46 |
}% |
| 47 |
% %<--------------------------------------------------------------------------–> |
| 48 |
% % légende |
| 49 |
% %<--------------------------------------------------------------------------–> |
| 50 |
\pgfkeys{/tkzlegend/.cd, |
| 51 |
line/.is if = tkz@legend@line, |
| 52 |
line/.default = true, |
| 53 |
line = false, |
| 54 |
/tkzlegend/.search also = {/tikz}, |
| 55 |
} |
| 56 |
\def\tkzLegend{\pgfutil@ifnextchar[{\tkz@Legend}{\tkz@Legend[]}} |
| 57 |
\def\tkz@Legend[#1](#2,#3)#4{% |
| 58 |
\pgfqkeys{/tkzlegend}{#1} |
| 59 |
\begingroup |
| 60 |
\c@pgfmath@counta=0 % |
| 61 |
\edef\tkzpt@xa{\fpeval{(#2-\tkz@init@xorigine)/\tkz@init@xstep}} |
| 62 |
\edef\tkzpt@ya{\fpeval{(#3-\tkz@init@yorigine)/\tkz@init@ystep}} |
| 63 |
\node[/tkzlegend/.cd,#1] at (\tkzpt@xa,\tkzpt@ya) {% |
| 64 |
\begin{tikzpicture} |
| 65 |
\foreach \motif/\size/\col/\mtext in {#4}{% |
| 66 |
\iftkz@legend@line |
| 67 |
\draw[color = \col, |
| 68 |
line width = \size, |
| 69 |
style = \motif, |
| 70 |
text = \tkz@mainlinecolor]% |
| 71 |
(0cm ,\the\c@pgfmath@counta ex)--% |
| 72 |
(\tkz@legend@line@len,\the\c@pgfmath@counta ex) |
| 73 |
\else |
| 74 |
\draw plot[mark size = \size,% |
| 75 |
mark = \motif,% |
| 76 |
mark options = {color=\col}]% |
| 77 |
coordinates{(0 ex,\the\c@pgfmath@counta ex)}% |
| 78 |
\fi |
| 79 |
node[right=1ex] {\mtext}; |
| 80 |
\global\advance\c@pgfmath@counta by 3 % |
| 81 |
}% |
| 82 |
|
| 83 |
\end{tikzpicture}% |
| 84 |
};% |
| 85 |
\endgroup |
| 86 |
} |
| 87 |
\makeatother |
| 88 |
\endinput |