summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/profcollege/latex/PfCDecDeci.tex
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/profcollege/latex/PfCDecDeci.tex')
-rw-r--r--macros/latex/contrib/profcollege/latex/PfCDecDeci.tex251
1 files changed, 143 insertions, 108 deletions
diff --git a/macros/latex/contrib/profcollege/latex/PfCDecDeci.tex b/macros/latex/contrib/profcollege/latex/PfCDecDeci.tex
index 3e9cc7d1c8..31daba08fc 100644
--- a/macros/latex/contrib/profcollege/latex/PfCDecDeci.tex
+++ b/macros/latex/contrib/profcollege/latex/PfCDecDeci.tex
@@ -1,7 +1,7 @@
%%%
% Décomposition décimale
%%
-\setKVdefault[DecompDeci]{Parentheses,Colore=false,CouleurU=Blue,CouleurD=Red,CouleurC=Green,Fleches=false,Details=false}
+\setKVdefault[DecompDeci]{Parentheses,Colore=false,CouleurU=Blue,CouleurD=Red,CouleurC=Green,Fleches=false,Details=false,ResultatSeul=false,SansMul=false}
\newcounter{PfCNbDecDeci}
\setcounter{PfCNbDecDeci}{0}
@@ -26,125 +26,146 @@
\modulo{\fpeval{\PfCNombrePuisMax}}{3}%
\xintifboolexpr{\remainder==0}{%
\xdef\PfCDecDeciEcart{0}
- }{\xintifboolexpr{\remainder==1}{\xdef\PfCDecDeciEcart{1}}{\xdef\PfCDecDeciEcart{2}}}
- \ifboolKV[DecompDeci]{Fleches}{%
- \colorlet{oldcolor}{black}%
- % On affiche
- \begin{center}
- \xintFor* ##1 in {\xintSeq{1}{\fpeval{\PfCNombrePuisMax}}}\do{%
- \StrChar{#2}{##1}[\PfCNombreChiffre]%
+ }{\xintifboolexpr{\remainder==1}{\xdef\PfCDecDeciEcart{1}}{\xdef\PfCDecDeciEcart{2}}}%
+ %%%%
+ \ifboolKV[DecompDeci]{SansMul}{%
+ \ensuremath{%
+ \ifboolKV[DecompDeci]{ResultatSeul}{}{\num{#2}=}%
+ \xintFor* ##1 in {\xintSeq{1}{\fpeval{\PfCNombrePuisMax-\PfCRetiensPuis}}}\do{%
+ \StrChar{#2}{##1}[\PfCNombreChiffre]
\modulo{\fpeval{\PfCNombrePuisMax+\PfCDecDeciEcart--##1}}{3}%
- \xintifboolexpr{\remainder==0}{%
- \color{\useKV[DecompDeci]{CouleurU}}\tikzmarknode[anchor=south,inner ysep=2pt]{DDA-\thePfCNbDecDeci-##1}{\PfCNombreChiffre}{}\xintifForLast{}{\,\color{oldcolor}}}{%
- \xintifboolexpr{\remainder==1}{%
- \color{\useKV[DecompDeci]{CouleurC}}\tikzmarknode[anchor=south,inner ysep=2pt]{DDA-\thePfCNbDecDeci-##1}{\PfCNombreChiffre}{}}{%
- \color{\useKV[DecompDeci]{CouleurD}}\tikzmarknode[anchor=south,inner ysep=2pt]{DDA-\thePfCNbDecDeci-##1}{\PfCNombreChiffre}{}%
- }%
+ % \colorlet{oldcolor}{.}
+ %\xintifboolexpr{\remainder==0}{\color{\useKV[DecompDeci]{CouleurU}}}{%
+ % \xintifboolexpr{\remainder==1}{\color{\useKV[DecompDeci]{CouleurC}}}{%
+ % \color{\useKV[DecompDeci]{CouleurD}}%
+ % }%
+ %}%
+ \xintifboolexpr{\PfCNombreChiffre==0}{}{%
+ \num{\fpeval{\PfCNombreChiffre*10^(\PfCNombrePuisMax-##1)}}%\color{oldcolor}%
+ \xintifForLast{}{+}%
}%
- }\color{oldcolor}%
-
- \vspace*{3em}
-
- \ifboolKV[DecompDeci]{Details}{%
+ }%
+ }%
+ }{%
+ \ifboolKV[DecompDeci]{Fleches}{%
+ \colorlet{oldcolor}{black}%
+ % On affiche
+ \begin{center}
+ \xintFor* ##1 in {\xintSeq{1}{\fpeval{\PfCNombrePuisMax}}}\do{%
+ \StrChar{#2}{##1}[\PfCNombreChiffre]%
+ \modulo{\fpeval{\PfCNombrePuisMax+\PfCDecDeciEcart--##1}}{3}%
+ \xintifboolexpr{\remainder==0}{%
+ \color{\useKV[DecompDeci]{CouleurU}}\tikzmarknode[anchor=south,inner ysep=2pt]{DDA-\thePfCNbDecDeci-##1}{\PfCNombreChiffre}{}\xintifForLast{}{\,\color{oldcolor}}}{%
+ \xintifboolexpr{\remainder==1}{%
+ \color{\useKV[DecompDeci]{CouleurC}}\tikzmarknode[anchor=south,inner ysep=2pt]{DDA-\thePfCNbDecDeci-##1}{\PfCNombreChiffre}{}}{%
+ \color{\useKV[DecompDeci]{CouleurD}}\tikzmarknode[anchor=south,inner ysep=2pt]{DDA-\thePfCNbDecDeci-##1}{\PfCNombreChiffre}{}%
+ }%
+ }%
+ }\color{oldcolor}%
+
+ \vspace*{3em}
+
+ \ifboolKV[DecompDeci]{Details}{%
+ \ensuremath{%
+ \xintFor* ##1 in {\xintSeq{1}{\fpeval{\PfCNombrePuisMax-\PfCRetiensPuis}}}\do{%
+ \StrChar{#2}{##1}[\PfCNombreChiffre]
+ \modulo{\fpeval{\PfCNombrePuisMax+\PfCDecDeciEcart--##1}}{3}%
+ \colorlet{oldcolor}{.}
+ \xintifboolexpr{\remainder==0}{\color{\useKV[DecompDeci]{CouleurU}}}{%
+ \xintifboolexpr{\remainder==1}{\color{\useKV[DecompDeci]{CouleurC}}}{%
+ \color{\useKV[DecompDeci]{CouleurD}}%
+ }%
+ }%
+ \xintifboolexpr{\PfCNombreChiffre==0}{}{%
+ \tikzmarknode[anchor=north,inner ysep=2pt]{DDC-\thePfCNbDecDeci-##1}{\boxed{\num{\fpeval{\PfCNombreChiffre*10^(\PfCNombrePuisMax-##1)}}}}\color{oldcolor}%
+ \xintifForLast{}{+}%
+ }%
+ }%
+ }%
+
+ \vspace*{3em}
+
+ }{}%
+
\ensuremath{%
\xintFor* ##1 in {\xintSeq{1}{\fpeval{\PfCNombrePuisMax-\PfCRetiensPuis}}}\do{%
\StrChar{#2}{##1}[\PfCNombreChiffre]
- \modulo{\fpeval{\PfCNombrePuisMax+\PfCDecDeciEcart--##1}}{3}%
- \colorlet{oldcolor}{.}
- \xintifboolexpr{\remainder==0}{\color{\useKV[DecompDeci]{CouleurU}}}{%
- \xintifboolexpr{\remainder==1}{\color{\useKV[DecompDeci]{CouleurC}}}{%
- \color{\useKV[DecompDeci]{CouleurD}}%
- }%
- }%
\xintifboolexpr{\PfCNombreChiffre==0}{}{%
- \tikzmarknode[anchor=north,inner ysep=2pt]{DDC-\thePfCNbDecDeci-##1}{\boxed{\num{\fpeval{\PfCNombreChiffre*10^(\PfCNombrePuisMax-##1)}}}}\color{oldcolor}%
+ \modulo{\fpeval{\PfCNombrePuisMax+\PfCDecDeciEcart--##1}}{3}%
+ \colorlet{oldcolor}{.}
+ \xintifboolexpr{\remainder==0}{\color{\useKV[DecompDeci]{CouleurU}}}{%
+ \xintifboolexpr{\remainder==1}{\color{\useKV[DecompDeci]{CouleurC}}}{%
+ \color{\useKV[DecompDeci]{CouleurD}}%
+ }%
+ }%
+ \tikzmarknode[anchor=north,inner ysep=2pt]{DDB-\thePfCNbDecDeci-##1}{\boxed{\PfCNombreChiffre\times\num{\fpeval{10^(\PfCNombrePuisMax-##1)}}}}{}\color{oldcolor}%
\xintifForLast{}{+}%
}%
}%
}%
-
- \vspace*{3em}
-
- }{}%
-
- \ensuremath{%
+ \end{center}
+ \begin{tikzpicture}[remember picture,overlay]
\xintFor* ##1 in {\xintSeq{1}{\fpeval{\PfCNombrePuisMax-\PfCRetiensPuis}}}\do{%
- \StrChar{#2}{##1}[\PfCNombreChiffre]
- \xintifboolexpr{\PfCNombreChiffre==0}{}{%
- \modulo{\fpeval{\PfCNombrePuisMax+\PfCDecDeciEcart--##1}}{3}%
- \colorlet{oldcolor}{.}
- \xintifboolexpr{\remainder==0}{\color{\useKV[DecompDeci]{CouleurU}}}{%
- \xintifboolexpr{\remainder==1}{\color{\useKV[DecompDeci]{CouleurC}}}{%
- \color{\useKV[DecompDeci]{CouleurD}}%
- }%
+ \StrChar{#2}{##1}[\PfCNombreChiffre]%
+ \modulo{\fpeval{\PfCNombrePuisMax+\PfCDecDeciEcart--##1}}{3}%
+ \xintifboolexpr{\remainder==0}{%
+ \colorlet{PfCDecDeciColor}{\useKV[DecompDeci]{CouleurU}}}{%
+ \xintifboolexpr{\remainder==1}{%
+ \colorlet{PfCDecDeciColor}{\useKV[DecompDeci]{CouleurC}}}{%
+ \colorlet{PfCDecDeciColor}{\useKV[DecompDeci]{CouleurD}}%
}%
- \tikzmarknode[anchor=north,inner ysep=2pt]{DDB-\thePfCNbDecDeci-##1}{\boxed{\PfCNombreChiffre\times\num{\fpeval{10^(\PfCNombrePuisMax-##1)}}}}{}\color{oldcolor}%
- \xintifForLast{}{+}%
}%
- }%
- }%
- \end{center}
- \begin{tikzpicture}[remember picture,overlay]
- \xintFor* ##1 in {\xintSeq{1}{\fpeval{\PfCNombrePuisMax-\PfCRetiensPuis}}}\do{%
- \StrChar{#2}{##1}[\PfCNombreChiffre]%
- \modulo{\fpeval{\PfCNombrePuisMax+\PfCDecDeciEcart--##1}}{3}%
- \xintifboolexpr{\remainder==0}{%
- \colorlet{PfCDecDeciColor}{\useKV[DecompDeci]{CouleurU}}}{%
- \xintifboolexpr{\remainder==1}{%
- \colorlet{PfCDecDeciColor}{\useKV[DecompDeci]{CouleurC}}}{%
- \colorlet{PfCDecDeciColor}{\useKV[DecompDeci]{CouleurD}}%
+ \ifboolKV[DecompDeci]{Details}{%
+ \xintifboolexpr{\PfCNombreChiffre>0}{%
+ \draw[-stealth,PfCDecDeciColor] (pic cs:DDA-\thePfCNbDecDeci-##1) to (pic cs:DDC-\thePfCNbDecDeci-##1);
+ \node (DDD-\thePfCNbDecDeci-##1) at ($(pic cs:DDC-\thePfCNbDecDeci-##1)!0.35!(pic cs:DDB-\thePfCNbDecDeci-##1)$) {};
+ \draw[-stealth,PfCDecDeciColor] (DDD-\thePfCNbDecDeci-##1) to (pic cs:DDB-\thePfCNbDecDeci-##1);
+ }{}%
+ }{%
+ \xintifboolexpr{\PfCNombreChiffre>0}{%
+ \draw[-stealth,PfCDecDeciColor] (pic cs:DDA-\thePfCNbDecDeci-##1) to (pic cs:DDB-\thePfCNbDecDeci-##1);
+ }{}%
}%
}%
- \ifboolKV[DecompDeci]{Details}{%
- \xintifboolexpr{\PfCNombreChiffre>0}{%
- \draw[-stealth,PfCDecDeciColor] (pic cs:DDA-\thePfCNbDecDeci-##1) to (pic cs:DDC-\thePfCNbDecDeci-##1);
- \node (DDD-\thePfCNbDecDeci-##1) at ($(pic cs:DDC-\thePfCNbDecDeci-##1)!0.35!(pic cs:DDB-\thePfCNbDecDeci-##1)$) {};
- \draw[-stealth,PfCDecDeciColor] (DDD-\thePfCNbDecDeci-##1) to (pic cs:DDB-\thePfCNbDecDeci-##1);
- }{}%
- }{%
- \xintifboolexpr{\PfCNombreChiffre>0}{%
- \draw[-stealth,PfCDecDeciColor] (pic cs:DDA-\thePfCNbDecDeci-##1) to (pic cs:DDB-\thePfCNbDecDeci-##1);
- }{}%
- }%
- }%
- \end{tikzpicture}
- }{%
- \ifboolKV[DecompDeci]{Colore}{%
- \colorlet{oldcolor}{black}%
- \ensuremath{%
- \xintFor* ##1 in {\xintSeq{1}{\fpeval{\PfCNombrePuisMax}}}\do{%
- \StrChar{#2}{##1}[\PfCNombreChiffre]%
- \modulo{\fpeval{\PfCNombrePuisMax+\PfCDecDeciEcart--##1}}{3}%
- \xintifboolexpr{\remainder==0}{\color{\useKV[DecompDeci]{CouleurU}}\PfCNombreChiffre\xintifForLast{}{\,\color{oldcolor}}}{%
- \xintifboolexpr{\remainder==1}{\color{\useKV[DecompDeci]{CouleurC}}\PfCNombreChiffre}{%
- \color{\useKV[DecompDeci]{CouleurD}}\PfCNombreChiffre%
+ \end{tikzpicture}
+ }{%
+ \ifboolKV[DecompDeci]{Colore}{%
+ \colorlet{oldcolor}{black}%
+ \ensuremath{%
+ \xintFor* ##1 in {\xintSeq{1}{\fpeval{\PfCNombrePuisMax}}}\do{%
+ \StrChar{#2}{##1}[\PfCNombreChiffre]%
+ \modulo{\fpeval{\PfCNombrePuisMax+\PfCDecDeciEcart--##1}}{3}%
+ \xintifboolexpr{\remainder==0}{\color{\useKV[DecompDeci]{CouleurU}}\PfCNombreChiffre\xintifForLast{}{\,\color{oldcolor}}}{%
+ \xintifboolexpr{\remainder==1}{\color{\useKV[DecompDeci]{CouleurC}}\PfCNombreChiffre}{%
+ \color{\useKV[DecompDeci]{CouleurD}}\PfCNombreChiffre%
+ }%
}%
- }%
- }\color{oldcolor}%
- =
- \xintFor* ##1 in {\xintSeq{1}{\fpeval{\PfCNombrePuisMax-\PfCRetiensPuis}}}\do{%
- \StrChar{#2}{##1}[\PfCNombreChiffre]
- \xintifboolexpr{\PfCNombreChiffre==0}{}{%
- \modulo{\fpeval{\PfCNombrePuisMax-\PfCRetiensPuis-##1}}{3}
- \colorlet{oldcolor}{.}
- \xintifboolexpr{\remainder==0}{\color{\useKV[DecompDeci]{CouleurU}}}{%
- \xintifboolexpr{\remainder==1}{\color{\useKV[DecompDeci]{CouleurD}}}{%
- \color{\useKV[DecompDeci]{CouleurC}}%
+ }\color{oldcolor}%
+ =
+ \xintFor* ##1 in {\xintSeq{1}{\fpeval{\PfCNombrePuisMax-\PfCRetiensPuis}}}\do{%
+ \StrChar{#2}{##1}[\PfCNombreChiffre]
+ \xintifboolexpr{\PfCNombreChiffre==0}{}{%
+ \modulo{\fpeval{\PfCNombrePuisMax-\PfCRetiensPuis-##1}}{3}
+ \colorlet{oldcolor}{.}
+ \xintifboolexpr{\remainder==0}{\color{\useKV[DecompDeci]{CouleurU}}}{%
+ \xintifboolexpr{\remainder==1}{\color{\useKV[DecompDeci]{CouleurD}}}{%
+ \color{\useKV[DecompDeci]{CouleurC}}%
+ }%
}%
+ \boxed{\PfCNombreChiffre\times\num{\fpeval{10^(\PfCNombrePuisMax-##1)}}}\color{oldcolor}%
+ \xintifForLast{}{+}%
}%
- \boxed{\PfCNombreChiffre\times\num{\fpeval{10^(\PfCNombrePuisMax-##1)}}}\color{oldcolor}%
- \xintifForLast{}{+}%
}%
- }%
- }
- }{%
- \ensuremath{%
- \num{#2}=
- \xintFor* ##1 in {\xintSeq{1}{\fpeval{\PfCNombrePuisMax-\PfCRetiensPuis}}}\do{%
- \StrChar{#2}{##1}[\PfCNombreChiffre]
- \xintifboolexpr{\PfCNombreChiffre==0}{}{%
- \ifboolKV[DecompDeci]{Parentheses}{\left(}{}\PfCNombreChiffre\times\num{\fpeval{10^(\PfCNombrePuisMax-##1)}}\ifboolKV[DecompDeci]{Parentheses}{\right)}{}%
- \xintifForLast{}{+}%
+ }
+ }{%
+ \ensuremath{%
+ \ifboolKV[DecompDeci]{ResultatSeul}{}{\num{#2}=}%
+ \xintFor* ##1 in {\xintSeq{1}{\fpeval{\PfCNombrePuisMax-\PfCRetiensPuis}}}\do{%
+ \StrChar{#2}{##1}[\PfCNombreChiffre]
+ \xintifboolexpr{\PfCNombreChiffre==0}{}{%
+ \ifboolKV[DecompDeci]{Parentheses}{\left(}{}\PfCNombreChiffre\times\num{\fpeval{10^(\PfCNombrePuisMax-##1)}}\ifboolKV[DecompDeci]{Parentheses}{\right)}{}%
+ \xintifForLast{}{+}%
+ }%
}%
}%
}%
@@ -163,13 +184,27 @@
\xdef\PfCRetiensPuis{\fpeval{\PfCRetiensPuis+1}}%
}{}%
}%
- \ensuremath{%
- \num{#2}=
- \xintFor* ##1 in {\xintSeq{1}{\PfCNombrePuisMax-\PfCRetiensPuis}}\do{%
- \StrChar{\PfCRetiensNombreEntier}{##1}[\PfCNombreChiffre]
- \xintifboolexpr{\PfCNombreChiffre==0}{}{%
- \ifboolKV[DecompDeci]{Parentheses}{\left(}{}\PfCNombreChiffre\times\num{\fpeval{10^(\PfCNombrePuisMax-##1-\PfCPuisDeci-1)}}\ifboolKV[DecompDeci]{Parentheses}{\right)}{}%
- \xintifForLast{}{+}%
+ %%
+ \ifboolKV[DecompDeci]{SansMul}{%
+ \ensuremath{%
+ \ifboolKV[DecompDeci]{ResultatSeul}{}{\num{#2}=}%
+ \xintFor* ##1 in {\xintSeq{1}{\PfCNombrePuisMax-\PfCRetiensPuis}}\do{%
+ \StrChar{\PfCRetiensNombreEntier}{##1}[\PfCNombreChiffre]
+ \xintifboolexpr{\PfCNombreChiffre==0}{}{%
+ \num{\fpeval{\PfCNombreChiffre*10^(\PfCNombrePuisMax-##1-\PfCPuisDeci-1)}}%
+ \xintifForLast{}{+}%
+ }%
+ }%
+ }%
+ }{%
+ \ensuremath{%
+ \ifboolKV[DecompDeci]{ResultatSeul}{}{\num{#2}=}%
+ \xintFor* ##1 in {\xintSeq{1}{\PfCNombrePuisMax-\PfCRetiensPuis}}\do{%
+ \StrChar{\PfCRetiensNombreEntier}{##1}[\PfCNombreChiffre]
+ \xintifboolexpr{\PfCNombreChiffre==0}{}{%
+ \ifboolKV[DecompDeci]{Parentheses}{\left(}{}\PfCNombreChiffre\times\num{\fpeval{10^(\PfCNombrePuisMax-##1-\PfCPuisDeci-1)}}\ifboolKV[DecompDeci]{Parentheses}{\right)}{}%
+ \xintifForLast{}{+}%
+ }%
}%
}%
}%