% tkz-tool-print.tex
% Copyright 2020 by Alain Matthes
% This file may be distributed and/or modified
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Public License.
\def\fileversion{3.02c}
\def\filedate{2020/01/24} 
\typeout{2020/01/24 3.02c  tkz-tools-print.tex}  
\makeatletter
%<------------- tkzPrintFrac ---------------------------------->
\def\tkzPrintFrac#1#2{% 
\begingroup
\tkzReducFrac{#1}{#2}
\xdef\tkzprintfrac{$     \frac{\tkzMathFirstResult}{\tkzMathSecondResult}$}%
 \ifnum\tkzMathFirstResult=0%
    \xdef\tkzprintfrac{$0$}%
 \else
 \ifnum\tkzMathSecondResult=1 %
    \ifnum\tkzMathFirstResult=1 %
         \xdef\tkzprintfrac{$1$}%
      \else
       \ifnum\tkzMathFirstResult=-1%
          \xdef\tkzprintfrac{$-1$}%
        \else
          \xdef\tkzprintfrac{$\tkzMathFirstResult$}%
       \fi\fi
 \else 
   \ifnum\tkzMathFirstResult=1 %
          \xdef\tkzprintfrac{$\tkzmathstyle\frac{1}{\tkzMathSecondResult}$}%
     \else
       \ifnum\tkzMathFirstResult=-1 %
      \xdef\tkzprintfrac{$\tkzmathstyle\frac{-1}{\tkzMathSecondResult}$}%
        \else
     \xdef\tkzprintfrac{$\tkzmathstyle\frac{\tkzMathFirstResult}{%
                             \tkzMathSecondResult}$}%
 \fi\fi\fi\fi   
\endgroup}
%<------------- tkzPrintFracWithPi ---------------------------------->
\def\tkzPrintFracWithPi#1#2{%
\begingroup
\tkzReducFrac{#1}{#2}
\xdef\tkzprintfrac{%
           $\tkzmathstyle\frac{\tkzMathFirstResult\pi}{\tkzMathSecondResult}$}%
\ifnum\tkzMathFirstResult=0%
    \xdef\tkzprintfrac{$0$}%
\else
	\ifnum\tkzMathSecondResult=1 %
    	\ifnum\tkzMathFirstResult=1 %
        	\xdef\tkzprintfrac{$\pi$}%
      	\else
       		\ifnum\tkzMathFirstResult=-1%
          		\xdef\tkzprintfrac{$-\pi$}%
        	\else
          		\xdef\tkzprintfrac{$\tkzMathFirstResult\pi$}%
       		\fi
		\fi
	\else 
   		\ifnum\tkzMathFirstResult=1 %
    		\xdef\tkzprintfrac{%
								$\tkzmathstyle\frac{\pi}{\tkzMathSecondResult}$
									}%
     	\else
       		\ifnum\tkzMathFirstResult=-1 %
        		\xdef\tkzprintfrac{$\tkzmathstyle\frac{-\pi}{%
	        	 			\tkzMathSecondResult}$}%
        	\else
         		\xdef\tkzprintfrac{$\tkzmathstyle\frac{%
					  					   \tkzMathFirstResult\pi}{%
                             			   \tkzMathSecondResult}$
										   }%
     		\fi
	  	\fi
	\fi
\fi   
\endgroup
}%

\makeatother
\endinput
