Debian Codegraph @

texmf-dist/tex/latex/tkz-euclide/tkz-tools-eu-text.tex

raw
1 % tkz-tools-eu-text.tex
2 % Copyright 2011-2026 Alain Matthes
3 % SPDX-License-Identifier: LPPL-1.3c
4 % Maintainer: Alain Matthes
5
6 \typeout{2026/01/25 5.13c tkz-tools-eu-text.tex}
7 \makeatletter
8 %<--------------------------------------------------------------------------–>
9 % tkzText
10 %<--------------------------------------------------------------------------–>
11 \def\tkz@parsenode#1{%
12 \tkz@getvirg#1,\@nil
13 \iftkz@node
14 \else
15 \tkz@getfromcart#1\@nil
16 \fi
17 }
18 \def\tkz@getvirg#1,#2\@nil{%
19 \ifx\tkzempty#2\tkzempty%
20 \tkz@nodetrue
21 \else
22 \tkz@nodefalse
23 \fi
24 }
25 \def\tkzText{\pgfutil@ifnextchar[{\tkz@Text}{\tkz@Text[]}}
26 \def\tkz@Text[#1](#2)#3{%
27 \begingroup
28 \tkz@parsenode{#2}
29 \iftkz@node
30 \node[#1] at (#2){#3};
31 \else
32 \edef\tkzpt@xa{\fpeval{(\tkz@absc-\tkz@init@xorigine)/\tkz@init@xstep}}
33 \edef\tkzpt@ya{\fpeval{(\tkz@ord-\tkz@init@yorigine)/\tkz@init@ystep}}
34 \node[#1] at (\tkzpt@xa,\tkzpt@ya){#3};%
35 \fi
36 \endgroup
37 }%
38 % %<--------------------------------------------------------------------------–>
39 % % légende
40 % %<--------------------------------------------------------------------------–>
41 \pgfkeys{/tkzlegend/.cd,
42 line/.is if = tkz@legend@line,
43 line/.default = true,
44 line = false,
45 /tkzlegend/.search also = {/tikz},
46 }
47 \def\tkzLegend{\pgfutil@ifnextchar[{\tkz@Legend}{\tkz@Legend[]}}
48 \def\tkz@Legend[#1](#2,#3)#4{%
49 \pgfqkeys{/tkzlegend}{#1}
50 \begingroup
51 \c@pgfmath@counta=0 %
52 \edef\tkzpt@xa{\fpeval{(#2-\tkz@init@xorigine)/\tkz@init@xstep}}
53 \edef\tkzpt@ya{\fpeval{(#3-\tkz@init@yorigine)/\tkz@init@ystep}}
54 \node[/tkzlegend/.cd,#1] at (\tkzpt@xa,\tkzpt@ya) {%
55 \begin{tikzpicture}
56 \foreach \motif/\size/\col/\mtext in {#4}{%
57 \iftkz@legend@line
58 \draw[color = \col,
59 line width = \size,
60 style = \motif,
61 text = \tkz@mainlinecolor]%
62 (0cm ,\the\c@pgfmath@counta ex)--%
63 (\tkz@legend@line@len,\the\c@pgfmath@counta ex)
64 \else
65 \draw plot[mark size = \size,%
66 mark = \motif,%
67 mark options = {color=\col}]%
68 coordinates{(0 ex,\the\c@pgfmath@counta ex)}%
69 \fi
70 node[right=1ex] {\mtext};
71 \global\advance\c@pgfmath@counta by 3 %
72 }%
73
74 \end{tikzpicture}%
75 };%
76 \endgroup
77 }
78 \makeatother
79 \endinput