| 1 |
% tkz-tool-print.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-print} |
| 16 |
\makeatletter |
| 17 |
%<------------- tkzPrintFrac ----------------------------------> |
| 18 |
\def\tkzPrintFrac#1#2{% |
| 19 |
\begingroup |
| 20 |
\tkzReducFrac{#1}{#2} |
| 21 |
\xdef\tkzprintfrac{$ \frac{\tkzMathFirstResult}{\tkzMathSecondResult}$}% |
| 22 |
\ifnum\tkzMathFirstResult=0% |
| 23 |
\xdef\tkzprintfrac{$0$}% |
| 24 |
\else |
| 25 |
\ifnum\tkzMathSecondResult=1 % |
| 26 |
\ifnum\tkzMathFirstResult=1 % |
| 27 |
\xdef\tkzprintfrac{$1$}% |
| 28 |
\else |
| 29 |
\ifnum\tkzMathFirstResult=-1% |
| 30 |
\xdef\tkzprintfrac{$-1$}% |
| 31 |
\else |
| 32 |
\xdef\tkzprintfrac{$\tkzMathFirstResult$}% |
| 33 |
\fi\fi |
| 34 |
\else |
| 35 |
\ifnum\tkzMathFirstResult=1 % |
| 36 |
\xdef\tkzprintfrac{$\tkzmathstyle\frac{1}{\tkzMathSecondResult}$}% |
| 37 |
\else |
| 38 |
\ifnum\tkzMathFirstResult=-1 % |
| 39 |
\xdef\tkzprintfrac{$\tkzmathstyle\frac{-1}{\tkzMathSecondResult}$}% |
| 40 |
\else |
| 41 |
\xdef\tkzprintfrac{$\tkzmathstyle\frac{\tkzMathFirstResult}{% |
| 42 |
\tkzMathSecondResult}$}% |
| 43 |
\fi\fi\fi\fi |
| 44 |
\endgroup} |
| 45 |
%<------------- tkzPrintFracWithPi ----------------------------------> |
| 46 |
\def\tkzPrintFracWithPi#1#2{% |
| 47 |
\begingroup |
| 48 |
\tkzReducFrac{#1}{#2} |
| 49 |
\xdef\tkzprintfrac{% |
| 50 |
$\tkzmathstyle\frac{\tkzMathFirstResult\pi}{\tkzMathSecondResult}$}% |
| 51 |
\ifnum\tkzMathFirstResult=0% |
| 52 |
\xdef\tkzprintfrac{$0$}% |
| 53 |
\else |
| 54 |
\ifnum\tkzMathSecondResult=1 % |
| 55 |
\ifnum\tkzMathFirstResult=1 % |
| 56 |
\xdef\tkzprintfrac{$\pi$}% |
| 57 |
\else |
| 58 |
\ifnum\tkzMathFirstResult=-1% |
| 59 |
\xdef\tkzprintfrac{$-\pi$}% |
| 60 |
\else |
| 61 |
\xdef\tkzprintfrac{$\tkzMathFirstResult\pi$}% |
| 62 |
\fi |
| 63 |
\fi |
| 64 |
\else |
| 65 |
\ifnum\tkzMathFirstResult=1 % |
| 66 |
\xdef\tkzprintfrac{% |
| 67 |
$\tkzmathstyle\frac{\pi}{\tkzMathSecondResult}$ |
| 68 |
}% |
| 69 |
\else |
| 70 |
\ifnum\tkzMathFirstResult=-1 % |
| 71 |
\xdef\tkzprintfrac{$\tkzmathstyle\frac{-\pi}{% |
| 72 |
\tkzMathSecondResult}$}% |
| 73 |
\else |
| 74 |
\xdef\tkzprintfrac{$\tkzmathstyle\frac{% |
| 75 |
\tkzMathFirstResult\pi}{% |
| 76 |
\tkzMathSecondResult}$ |
| 77 |
}% |
| 78 |
\fi |
| 79 |
\fi |
| 80 |
\fi |
| 81 |
\fi |
| 82 |
\endgroup |
| 83 |
}% |
| 84 |
|
| 85 |
\makeatother |
| 86 |
\endinput |