diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/profcollege/PfCCalculsFractions.tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/profcollege/PfCCalculsFractions.tex | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/Master/texmf-dist/tex/latex/profcollege/PfCCalculsFractions.tex b/Master/texmf-dist/tex/latex/profcollege/PfCCalculsFractions.tex index 06a02de387e..fdf037ef818 100644 --- a/Master/texmf-dist/tex/latex/profcollege/PfCCalculsFractions.tex +++ b/Master/texmf-dist/tex/latex/profcollege/PfCCalculsFractions.tex @@ -1,11 +1,32 @@ \setKVdefault[CalculsFractions]{Couleurs=false,Negatif=false}% -\defKV[CalculsFractions]{Couleur=\setKV[CalculsFractions]{Couleurs}}% +\defKV[CalculsFractions]{Couleur=\setKV[CalculsFractions]{Couleurs}\setKV[ClesSimplification]{Couleur=#1}}% \NewDocumentCommand\tofrac{m}{% \IfDecimal{#1}{#1}{% \StrBefore{#1}{/}[\PfCnum]% \StrBehind{#1}{/}[\PfCden]% - \frac{\PfCnum}{\PfCden}% + \ifnum\PfCden=1\relax% + \num{\PfCnum}% + \else% + \frac{\num{\PfCnum}}{\num{\PfCden}}% + \fi% + }% +}% + +\NewDocumentCommand\Tofrac{m}{% + \IfDecimal{#1}{#1}{% + \StrBefore{#1}{/}[\PfCnum]% + \StrBehind{#1}{/}[\PfCden]% + \ifnum\PfCden=1\relax% + \num{\PfCnum}% + \else% + %\PGCD{\PfCnum}{\PfCden}% + %\ifnum\the\pgcd>1\relax% + \Simplification{\PfCnum}{\PfCden}%\frac{\num{\PfCnum}}{\num{\PfCden}}% + %\else% + %\frac{\num{\PfCnum}}{\num{\PfCden}}% + %\fi% + \fi% }% }% @@ -36,8 +57,10 @@ \reademptyitems% \setsepchar{,}% % Partie calculs - \PGCD{\ListeFractions[1,2]}{\ListeFractions[2,2]}% + \PGCD{\fpeval{abs(\ListeFractions[1,2])}}{\fpeval{abs(\ListeFractions[2,2])}}% +% pgcd=\the\pgcd% \xdef\PfCPremierMul{\fpeval{\ListeFractions[2,2]/\the\pgcd}}% +% PfCPremierMul=\PfCPremierMul \xdef\PfCDeuxiemeMul{\fpeval{\ListeFractions[1,2]/\the\pgcd}}% \xdef\PfCAddNumFin{\fpeval{(\ListeFractions[1,1])*(\PfCPremierMul)\PfCFractionOp(\ListeFractions[2,1])*(\PfCDeuxiemeMul)}}% \xdef\PfCAddDenoFin{\fpeval{(\ListeFractions[1,2])*(\PfCPremierMul)}}% @@ -59,14 +82,14 @@ \SSimpliTest{\fpeval{abs(\PfCAddNumFin)}}{\fpeval{abs(\PfCAddDenoFin)}}\ifthenelse{\boolean{Simplification}}{\tofrac{\PfCAddNumFin/\PfCAddDenoFin}}{\tofrac{\PfCAddSumSimp}}% \else% \ifnum#3=1\relax% - \ifnum\PfCPremierMul>1\relax% - \frac{\ListeFractions[1,1]_{\mathcolor{CouleurDenoCom}{\times\num{\PfCPremierMul}}}}{\ListeFractions[1,2]_{\mathcolor{CouleurDenoCom}{\times\num{\PfCPremierMul}}}} + \ifnum\fpeval{abs(\PfCPremierMul)}>1\relax% + \frac{\ListeFractions[1,1]_{\mathcolor{CouleurDenoCom}{\times\NumMA{\PfCPremierMul}}}}{\ListeFractions[1,2]_{\mathcolor{CouleurDenoCom}{\times\NumMA{\PfCPremierMul}}}} \else% \tofrac{#4}% \fi% \PfCFractionOp% - \ifnum\PfCDeuxiemeMul>1\relax% - \frac{\ListeFractions[2,1]_{\mathcolor{CouleurDenoCom}{\times\num{\PfCDeuxiemeMul}}}}{\ListeFractions[2,2]_{\mathcolor{CouleurDenoCom}{\times\num{\PfCDeuxiemeMul}}}}% + \ifnum\fpeval{abs(\PfCDeuxiemeMul)}>1\relax% + \frac{\ListeFractions[2,1]_{\mathcolor{CouleurDenoCom}{\times\NumMA{\PfCDeuxiemeMul}}}}{\ListeFractions[2,2]_{\mathcolor{CouleurDenoCom}{\times\NumMA{\PfCDeuxiemeMul}}}}% \else% \tofrac{#5}% \fi% @@ -122,7 +145,8 @@ }{\tofrac{\PfCMulPdtSimp}}% \else \ifnum#2=2\relax% - \SSimpliTest{\PfCMulNumFin}{\PfCMulDenoFin}\ifthenelse{\boolean{Simplification}}{\frac{\ifnum\PfCMulNumFin<0\relax-\fi\Decomposition[Longue]{\fpeval{abs(\PfCMulNumFin)}}}{\ifnum\PfCMulDenoFin<0\relax-\fi\Decomposition[Longue]{\fpeval{abs(\PfCMulDenoFin)}}}}{\tofrac{\PfCMulPdtSimp}}% + %\SSimpliTest{\PfCMulNumFin}{\PfCMulDenoFin}\ifthenelse{\boolean{Simplification}}{\frac{\ifnum\PfCMulNumFin<0\relax-\fi\Decomposition[Longue]{\fpeval{abs(\PfCMulNumFin)}}}{\ifnum\PfCMulDenoFin<0\relax-\fi\Decomposition[Longue]{\fpeval{abs(\PfCMulDenoFin)}}}}{\tofrac{\PfCMulPdtSimp}}% + \DecompositionSimplificationSeule{\PfCMulNumFin}{\PfCMulDenoFin}% \else% \ifnum#2=1\relax% \frac{\ListeFractions[1,1]\times\ifnum\ListeFractions[2,1]<0\relax(\fi\ListeFractions[2,1]\ifnum\ListeFractions[2,1]<0\relax)\fi}{\ListeFractions[1,2]\times\ifnum\ListeFractions[2,2]<0\relax(\fi\ListeFractions[2,2]\ifnum\ListeFractions[2,2]<0\relax)\fi} |