diff options
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/profcollege/ProfCollege-doc.pdf | bin | 9671406 -> 9020920 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/profcollege/ProfCollege-doc.zip | bin | 2286437 -> 2300789 bytes | |||
-rw-r--r-- | Master/texmf-dist/metapost/profcollege/PfCGeometrie.mp | 426 | ||||
-rw-r--r-- | Master/texmf-dist/metapost/profcollege/PfCScratch.mp | 2 | ||||
-rw-r--r-- | Master/texmf-dist/metapost/profcollege/PfCScratchpdf.mp | 2 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/profcollege/ProfCollege.sty | 1257 |
6 files changed, 1585 insertions, 102 deletions
diff --git a/Master/texmf-dist/doc/latex/profcollege/ProfCollege-doc.pdf b/Master/texmf-dist/doc/latex/profcollege/ProfCollege-doc.pdf Binary files differindex 4e59174d84c..562263c9210 100644 --- a/Master/texmf-dist/doc/latex/profcollege/ProfCollege-doc.pdf +++ b/Master/texmf-dist/doc/latex/profcollege/ProfCollege-doc.pdf diff --git a/Master/texmf-dist/doc/latex/profcollege/ProfCollege-doc.zip b/Master/texmf-dist/doc/latex/profcollege/ProfCollege-doc.zip Binary files differindex aeb6ba27535..bddd5c7bc6b 100644 --- a/Master/texmf-dist/doc/latex/profcollege/ProfCollege-doc.zip +++ b/Master/texmf-dist/doc/latex/profcollege/ProfCollege-doc.zip diff --git a/Master/texmf-dist/metapost/profcollege/PfCGeometrie.mp b/Master/texmf-dist/metapost/profcollege/PfCGeometrie.mp index 3c5ed4be0d0..dd49ba8c3b3 100644 --- a/Master/texmf-dist/metapost/profcollege/PfCGeometrie.mp +++ b/Master/texmf-dist/metapost/profcollege/PfCGeometrie.mp @@ -1534,4 +1534,430 @@ vardef compas(expr centre,extre,n)= piccompas enddef; +%Grilles +boolean orig,uni; +orig=false; +uni=false; + +vardef origine(expr p)= + x.origine:=x.so+xpart(p)*quad.u; + y.origine:=y.so+ypart(p)*quad.u; + orig:=true; +enddef; + +vardef unites(expr g,h)= + x.u:=g*cm; + y.u:=h*cm; + uni:=true; +enddef; + +vardef axes= + path axehor,axever; + axehor=(x.so*cm,y.origine)--(x.ne*cm,y.origine); + axever=(x.origine,y.so*cm)--(x.origine,y.ne*cm); + picture axx; + axx=image( + drawarrow (x.so*cm,y.origine)--(x.ne*cm,y.origine); + drawarrow (x.origine,y.so*cm)--(x.origine,y.ne*cm); + label.llft(btex $O$ etex,z.origine); + ); + axx +enddef; + +vardef axesvide= + path axehor,axever; + axehor=(x.so*cm,y.origine)--(x.ne*cm,y.origine); + axever=(x.origine,y.so*cm)--(x.origine,y.ne*cm); + picture axxx; + axxx=image( + drawarrow (x.so*cm,y.origine)--(x.ne*cm,y.origine); + drawarrow (x.origine,y.so*cm)--(x.origine,y.ne*cm); + ); + axxx +enddef; + +vardef axesvideorigine= + path axehor,axever; + axehor=(x.origine,y.origine)--(x.ne*cm,y.origine); + axever=(x.origine,y.origine)--(x.origine,y.ne*cm); + picture axxx; + axxx=image( + drawarrow (x.origine,y.origine)--(x.ne*cm,y.origine); + drawarrow (x.origine,y.origine)--(x.origine,y.ne*cm); + ); + axxx +enddef; + +def enplace= + if orig: + xscaled x.u yscaled y.u shifted (z.origine) + else: + xscaled x.u yscaled y.u shifted (z.so) + fi +enddef; + +vardef placepoint(expr q,r)= + (q,r) enplace +enddef; + +vardef pp(expr qq,rr)=placepoint(qq,rr) +enddef; + +def replace= + xscaled (1/x.u) yscaled (1/y.u) shifted (-z.origine) +enddef; + +def retrouvecoord(expr p)=%trasnforme les coordonées du point d'affixe p dans le repère absolu de metapost en les coordonnées du point dans le repère défini par l'utilisateur + p replace +enddef; + +vardef placepointtri(expr q,r)= + save $; + pair $; + if orig: + $=z.origine shifted (q*(x.u,0)+r*(x.u/2,y.u)); + else: + $=z.so*cm shifted (q*(x.u,0)+r*(x.u/2,y.u)); + fi; + $ +enddef; + +vardef pptri(expr qq,rr)=placepointtri(qq,rr) +enddef; + +vardef placepointiso(expr q,r)= + save $; + pair $; + $=if orig: z.origine else: (z.so+((sqrt(3)/2),0.5))*cm fi shifted (q*(sqrt(3)*cm,0)+0.5*r*cm*(sqrt(3),1)); + $ +enddef; + +vardef ppiso(expr qq,rr)=placepointiso(qq,rr) +enddef; + +vardef reperehexa(expr colo,lign)= + save $; + path $; + if (colo mod 2)=1: + $=(hexa shifted(0.5cm,0)) shifted((colo-1)*1.5*cm,(lign-1)*2*((sqrt 3)/2)*cm); + else: + $=(hexa shifted(0.5cm,0)) shifted((colo-1)*1.5*cm,((lign-1)*2+1)*((sqrt 3)/2)*cm); + fi; + $ +enddef; + +vardef Centrehexa(expr colo,lign)= + save $; + pair $; + if (colo mod 2)=1: + $=(centrehexa shifted(0.5cm,0)) shifted((colo-1)*1.5*cm,(lign-1)*2*((sqrt 3)/2)*cm); + else: + $=(centrehexa shifted(0.5cm,0)) shifted((colo-1)*1.5*cm,((lign-1)*2+1)*((sqrt 3)/2)*cm); + fi; + $ +enddef; + +%%Les grilles + +vardef grille(expr t)= + save gri; + picture gri; + orig:=false; + x.u:=t*cm; + y.u:=t*cm; + quad.u:=t*cm; + gri=image( + path p[]; + %horizontale + p1:=(x.so*cm,0)--(x.ne*cm,0); + %verticale + p2:=(0,y.so*cm)--(0,y.ne*cm); + %options + %horizontales + for i:=0 step t until (y.ne-y.so): + draw p1 shifted (0,i*cm); + endfor; + %verticales + for i:=0 step t until (x.ne-x.so) : + draw p2 shifted (i*cm,0); + endfor; + ); + gri +enddef; + +vardef papiermillimetre= + save $; + picture $; + orig:=false; + x.u:=1cm; + y.u:=1cm; + quad.u:=1cm; + $=image( + path p[]; + %horizontale + p1:=(x.so*cm,0)--(x.ne*cm,0); + %verticale + p2:=(0,y.so*cm)--(0,y.ne*cm); + %grille millimétrique + pickup pencircle scaled 0.2; + %horizontales + for j:=y.so step 0.1 until y.ne: + draw p1 shifted (0,j*cm); + endfor; + %verticales + for j:=x.so step 0.1 until x.ne : + draw p2 shifted (j*cm,0); + endfor; + %grille demi-centimétrique + pickup pencircle scaled 0.5; + %horizontales + for j:=y.so step 0.5 until y.ne: + draw p1 shifted (0,j*cm); + endfor; + %verticales + for j:=x.so step 0.5 until x.ne : + draw p2 shifted (j*cm,0); + endfor; + %grille centimétrique + pickup pencircle scaled 0.7; + %horizontales + for j:=y.so step 1 until y.ne: + draw p1 shifted (0,j*cm); + endfor; + %verticales + for j:=x.so step 1 until x.ne : + draw p2 shifted (j*cm,0); + endfor; + %grille penta-centimétrique + pickup pencircle scaled 1; + %horizontales + for j:=y.so step 5 until y.ne: + draw p1 shifted (0,j*cm); + endfor; + %verticales + for j:=x.so step 5 until x.ne : + draw p2 shifted (j*cm,0); + endfor; + ); + $ +enddef; + +vardef Pointe(text t)= + for p_=t: if pair p_: + fill fullcircle scaled 1mm shifted p_; + fi; + endfor; +enddef; + +vardef papiercahier= + save $; + orig:=false; + picture $; + x.u:=8mm; + y.u:=8mm; + quad.u:=8mm; + $=image( + path p[]; + %horizontale +p1:=(x.so*cm,0)--(x.ne*cm,0); + %verticale +p2:=(0,y.so*cm)--(0,y.ne*cm); + %grille 2-millimétrique + pickup pencircle scaled 0.5; + %lignes horizontales + for i:=y.ne step -0.2 until y.so: + draw p1 shifted (0,i*cm); + endfor; + %grille 8-millimétrique + pickup pencircle scaled 1bp; + %lignes horizontales + for i:=y.ne step -0.8 until y.so: + draw p1 shifted (0,i*cm); + endfor; + %lignes verticales + for i:=x.so step 0.8 until (x.ne+1): + draw p2 shifted (i*cm,0); + endfor; + ); + $ +enddef; + +vardef papierdeuxlignes= + save $; + orig:=false; + picture $; + x.u:=8mm; + y.u:=6mm; + $=image( + path p[]; + %horizontale + p1:=(x.so*cm,0)--(x.ne*cm,0); + %grille 2-millimétrique + pickup pencircle scaled 0.5; + %lignes horizontales + for i:=y.so+0.2 step 0.6 until y.ne: + draw p1 shifted (0,i*cm); + endfor; + %grille 8-millimétrique + pickup pencircle scaled 1; + %lignes horizontales + for i:=y.so step 0.6 until y.ne: + draw p1 shifted (0,i*cm); + endfor; + ); + $ +enddef; + +vardef papierpointe= + save $; + picture $; + orig:=false; + x.u:=5mm; + y.u:=5mm; + quadu:=5mm; + $=image( + for i:=0 upto 2*(xpart(retrouvecoord(z.ne*cm))-xpart(retrouvecoord(z.so*cm))): + for j:=0 upto 2*(ypart(retrouvecoord(z.ne*cm))-ypart(retrouvecoord(z.so*cm))): + fill ((fullcircle scaled 1bp shifted(z.so*cm)) shifted ((i/2,j/2)*cm)); + endfor + endfor; + ); + $ +enddef; + +vardef papiertriangle= + save $; + orig:=false; + if uni=false: + x.u:=1cm; + y.u:=(sqrt(3)/2)*cm; + fi; + picture $; + $=image( + path p[]; + %triangle haut + %p1:=(x.so*cm,0)--(x.so*cm+1cm,0)--((x.so*cm,0) rotatedabout((x.so*cm+1cm,0),-60))--cycle; + p1:=(x.so*cm,0)--(x.so*cm+x.u,0)--((x.so*cm,0) rotatedabout((x.so*cm+x.u,0),-60))--cycle; + %triangle bas + %p2:=((x.so*cm,0)--(x.so*cm+1cm,0)--((x.so*cm,0) rotatedabout((x.so*cm+1cm,0),60))--cycle) shifted (-0.5cm,((sqrt3)/2)*cm); + p2:=((x.so*cm,0)--(x.so*cm+x.u,0)--((x.so*cm,0) rotatedabout((x.so*cm+x.u,0),60))--cycle) shifted (-x.u/2,y.u); + %grille horizontale1 + pickup pencircle scaled 0.5; + numeric etag; + etag=floor(2*cm*(ypart(retrouvecoord(z.ne*cm))-ypart(retrouvecoord(z.so*cm)))/(y.u))+1; + for i:=0 step 2 until etag: + for j:=0 upto (xpart(retrouvecoord(z.ne*cm))-xpart(retrouvecoord(z.so*cm))): + draw p1 shifted (j*x.u,i*y.u); + draw p2 shifted (j*x.u,i*y.u); + endfor + endfor; + %grille horizontale 2 + pickup pencircle scaled 0.5; + for i:=1 step 2 until etag: + for j:=0 upto (xpart(retrouvecoord(z.ne*cm))-xpart(retrouvecoord(z.so*cm))): + draw p1 shifted ((j-1/2)*x.u,i*y.u); + draw p2 shifted ((j+1/2)*x.u,i*y.u); + endfor + endfor; + ); + $ +enddef; + +vardef papiertrianglepointe= + save $; + orig:=false; + if uni=false: + x.u:=1cm; + y.u:=(sqrt(3)/2)*cm; + fi; + picture $; + $=image( + pickup pencircle scaled 0.5; + numeric etag; + etag=floor(2*cm*(ypart(retrouvecoord(z.ne*cm))-ypart(retrouvecoord(z.so*cm)))/(y.u))+1; + for i:=0 step 2 until etag: + for j:=0 upto (xpart(retrouvecoord(z.ne*cm))-xpart(retrouvecoord(z.so*cm))): + fill (fullcircle scaled 1bp shifted(z.so*cm)) shifted (j*x.u,i*y.u); + endfor + endfor; + for i:=1 step 2 until etag: + for j:=0 upto (xpart(retrouvecoord(z.ne*cm))-xpart(retrouvecoord(z.so*cm))): + fill (fullcircle scaled 1bp shifted(z.so*cm)) shifted ((j-1/2)*x.u,i*y.u); + endfor + endfor; + ); + $ +enddef; + +vardef papierisometriquepointe= + save $; + orig:=false; + y.u:=1cm; + x.u:=(sqrt(3)/2)*cm; + picture $; + $=image( + %grille horizontale1 + pickup pencircle scaled 0.5; + for i:=0 step 1 until (ypart(retrouvecoord(z.ne*cm))-ypart(retrouvecoord(z.so*cm))): + for j:=0 step 2 until (xpart(retrouvecoord(z.ne*cm))-xpart(retrouvecoord(z.so*cm))+2): + fill (fullcircle scaled 1bp shifted (z.so*cm)) shifted (j*((sqrt3)/2)*cm,i*cm); + endfor + endfor; + %grille horizontale 2 + for i:=0 step 1 until (ypart(retrouvecoord(z.ne*cm))-ypart(retrouvecoord(z.so*cm))-1): + for j:=1 step 2 until (xpart(retrouvecoord(z.ne*cm))-xpart(retrouvecoord(z.so*cm))+1): + fill (fullcircle scaled 1bp shifted (z.so*cm)) shifted (j*((sqrt3)/2)*cm,(i+0.5)*cm); + endfor + endfor; + ); + $ +enddef; + +vardef papierisometrique= + save $; + orig:=false; + x.u:=(sqrt(3)/2)*cm; + y.u:=1cm; + picture $; + $=image( + path p[]; + %triangle haut + p1:=(x.so*cm,1cm)--((x.so*cm,0) rotatedabout((x.so*cm,1cm),60))--(x.so*cm,0); + %triangle bas + p2:=((x.so*cm,1cm)--((x.so*cm,0) rotatedabout((x.so*cm,1cm),-60))--(x.so*cm,0)) shifted (((sqrt3)/2)*cm,0); + %grille horizontale1 + pickup pencircle scaled 0.5; + for i:=0 step 2 until (xpart(retrouvecoord(z.ne*cm))-xpart(retrouvecoord(z.so*cm))): + for j:=0 upto (ypart(retrouvecoord(z.ne*cm))-ypart(retrouvecoord(z.so*cm))-1): + draw p1 shifted (i*((sqrt3)/2)*cm,j*cm); + draw p2 shifted ((i+1)*((sqrt3)/2)*cm,j*cm); + endfor + endfor; + ); + $ +enddef; + +vardef papierhexagonal= + save $; + picture $; + orig:=false; + path hexa; + %hexagone de départ + hexa:=z.so*cm--(x.so*cm+1cm,y.so*cm)--(z.so*cm rotatedabout((x.so*cm+1cm,y.so*cm),-120))--((x.so*cm+1cm,y.so*cm) rotatedabout((z.so*cm rotatedabout((x.so*cm+1cm,y.so*cm),-120)),-120))--((z.so*cm rotatedabout((x.so*cm+1cm,y.so*cm),-120)) rotatedabout(((x.so*cm+1cm,y.so*cm) rotatedabout((z.so*cm rotatedabout((x.so*cm+1cm,y.so*cm),-120)),-120)),-120))--(((x.so*cm+1cm,y.so*cm) rotatedabout((z.so*cm rotatedabout((x.so*cm+1cm,y.so*cm),-120)),-120)) rotatedabout(((z.so*cm rotatedabout((x.so*cm+1cm,y.so*cm),-120)) rotatedabout(((x.so*cm+1cm,y.so*cm) rotatedabout((z.so*cm rotatedabout((x.so*cm+1cm,y.so*cm),-120)),-120)),-120)),-120))--cycle; + $=image( + pair centrehexa; + centrehexa=1/2[z.so*cm,((x.so*cm+1cm,y.so*cm) rotatedabout((z.so*cm rotatedabout((x.so*cm+1cm,y.so*cm),-120)),-120))]; + pickup pencircle scaled 0.5; + numeric etag; + etag=floor((abs(y.ne*cm-y.so*cm))/((sqrt(3)/2)*cm)); + for i:=0 step 3 until (abs(x.ne*cm-x.so*cm)/1cm): + for j:=0 step 2 until etag: + draw hexa shifted ((i+0.5)*cm,j*((sqrt 3)/2)*cm); + draw hexa shifted ((i+2)*cm,(j+1)*((sqrt 3)/2)*cm); + endfor + endfor; + ); + $ +enddef; + endinput; diff --git a/Master/texmf-dist/metapost/profcollege/PfCScratch.mp b/Master/texmf-dist/metapost/profcollege/PfCScratch.mp index 10a8972ef85..3c6826777a7 100644 --- a/Master/texmf-dist/metapost/profcollege/PfCScratch.mp +++ b/Master/texmf-dist/metapost/profcollege/PfCScratch.mp @@ -1858,7 +1858,7 @@ vardef Sinon= drawoptions(); texto=image( labeloffset:=0; - label.lrt(TEX("\barre\,\hbox to"&decimal(LongRep[numblocrep])&"pt{}"),if unknown _coinprec: (0,0) else:_coinprec fi) if print=false : withcolor blanc fi; + label.lrt(TEX("\longbarre\,\hbox to"&decimal(LongRep[numblocrep])&"pt{}"),if unknown _coinprec: (0,0) else:_coinprec fi) if print=false : withcolor blanc fi; labeloffset:=3; ); path cadre; diff --git a/Master/texmf-dist/metapost/profcollege/PfCScratchpdf.mp b/Master/texmf-dist/metapost/profcollege/PfCScratchpdf.mp index f3acd75d3db..f0ef36f1e02 100644 --- a/Master/texmf-dist/metapost/profcollege/PfCScratchpdf.mp +++ b/Master/texmf-dist/metapost/profcollege/PfCScratchpdf.mp @@ -1885,7 +1885,7 @@ vardef Sinon= drawoptions(); texto=image( labeloffset:=0; - label.lrt(LATEXSCRATCH("\, \hbox to"&decimal(LongRep[numblocrep])&"pt{\bfseries\barre sinon}"),if unknown _coinprec: (0,0) else:_coinprec fi) if print=false : withcolor blanc fi; + label.lrt(LATEXSCRATCH("\, \hbox to"&decimal(LongRep[numblocrep])&"pt{\bfseries\longbarre sinon}"),if unknown _coinprec: (0,0) else:_coinprec fi) if print=false : withcolor blanc fi; labeloffset:=3; ); path cadre; diff --git a/Master/texmf-dist/tex/latex/profcollege/ProfCollege.sty b/Master/texmf-dist/tex/latex/profcollege/ProfCollege.sty index 15a4cd6b732..e6f559aa713 100644 --- a/Master/texmf-dist/tex/latex/profcollege/ProfCollege.sty +++ b/Master/texmf-dist/tex/latex/profcollege/ProfCollege.sty @@ -2,16 +2,27 @@ % licence : Released under the LaTeX Project Public License v1.3c % or later, see http://www.latex-project.org/lppl.txtf \NeedsTeXFormat{LaTeX2e}% -\def\filedate{2023/01/23}% +\def\filedate{2023/03/06}% \let\PfCfiledate\filedate% -\def\fileversion{0.99-z-e}% +\def\fileversion{0.99-z-f}% \let\PfCfileversion\fileversion% \ProvidesPackage{ProfCollege}[\filedate\space v\fileversion\space Aide pour utiliser LaTeX au college] \RequirePackage{verbatim} \RequirePackage{mathtools} + +\newif\if@shellescape \@shellescapetrue +\newif\if@amssymb \@amssymbtrue +\DeclareOption{nonshellescape}{\@shellescapefalse} +\DeclareOption{nonamssymb}{\@amssymbfalse} +\ProcessOptions\relax + +%\ProcessOptions\relax + +\if@amssymb \RequirePackage{amssymb} +\fi % mathématiques \RequirePackage{siunitx} @@ -44,10 +55,6 @@ \RequirePackage{modulus}%Pour certains calculs arithmétiques. \RequirePackage{xinttools}%Pour la création dynamique d'un tableau -\newif\if@shellescape \@shellescapetrue -\DeclareOption{nonshellescape}{\@shellescapefalse} -\ProcessOptions\relax - \RequirePackage{iftex} \ifluatex @@ -60,7 +67,8 @@ \RequirePackage[shellescape,latex]{gmp}%inclusion de figures metapost "à la volée"% \gmpoptions{everymp={prologues:=3; input PfCLaTeX; input PfCSvgnames; input PfCConstantes; input PfCGeometrie; input PfCAfficheur;}} \usempxclass{article} -\usempxpackage[locale=FR,mode = match, propagate-math-font = true,reset-math-version = false, reset-text-family = false,reset-text-series = false, reset-text-shape = false,text-family-to-math = true, text-series-to-math = true, output-decimal-marker={,},group-minimum-digits=4]{siunitx} +\usempxpackage{ProfCollege} +%\usempxpackage[locale=FR,mode = match, propagate-math-font = true,reset-math-version = false, reset-text-family = false,reset-text-series = false, reset-text-shape = false,text-family-to-math = true, text-series-to-math = true, output-decimal-marker={,},group-minimum-digits=4]{siunitx} \usempxpackage[utf8]{inputenc} \usempxpackage[T1]{fontenc} \usempxpackage{fourier} @@ -70,7 +78,8 @@ \RequirePackage[latex]{gmp}%inclusion de figures metapost "à la volée"% \gmpoptions{everymp={prologues:=3; input PfCLaTeX; input PfCSvgnames; input PfCConstantes; input PfCGeometrie; input PfCAfficheur;}} \usempxclass{article} -\usempxpackage[locale=FR,mode = match, propagate-math-font = true,reset-math-version = false, reset-text-family = false,reset-text-series = false, reset-text-shape = false,text-family-to-math = true, text-series-to-math = true, output-decimal-marker={,},group-minimum-digits=4]{siunitx} +\usempxpackage{ProfCollege} +%\usempxpackage[locale=FR,mode = match, propagate-math-font = true,reset-math-version = false, reset-text-family = false,reset-text-series = false, reset-text-shape = false,text-family-to-math = true, text-series-to-math = true, output-decimal-marker={,},group-minimum-digits=4]{siunitx} \usempxpackage[utf8]{inputenc} \usempxpackage[T1]{fontenc} \usempxpackage{fourier} @@ -93,6 +102,7 @@ % https://tex.stackexchange.com/questions/349259/curved-arrow-describing-a-step-in-a-equation-derivation %https://tex.stackexchange.com/questions/58656/best-way-to-draw-a-chevron-diagram-using-tikz \usetikzlibrary{calc,shapes,arrows,tikzmark,chains,positioning,shapes.symbols,babel,fit} +\usetikzlibrary{backgrounds} \RequirePackage{suffix}%pour la commande étoilée @@ -348,6 +358,742 @@ } %%% +% Kakurasu +%%% +\setKVdefault[Kakurasu]{Solution=false,Longueur=6,Largeur=6,Echelle=8mm,Graines=false,Trace=false} +\defKV[Kakurasu]{Graine=\setKV[Kakurasu]{Graines}} +\defKV[Kakurasu]{Traces=\setKV[Kakurasu]{Trace}} + +\NewDocumentCommand\Kakurasu{o}{% + \useKVdefault[Kakurasu]% + \setKVdefault[Kakurasu]{#1}% + \BuildKakurasu% +} + +\NewDocumentCommand\BuildKakurasu{}{% + \ifluatex + \mplibforcehmode + \begin{mplibcode} + boolean Graines,Solution,Trace; + Graines=\useKV[Kakurasu]{Graines}; + Solution=\useKV[Kakurasu]{Solution}; + Trace=\useKV[Kakurasu]{Trace}; + + if Graines: + randomseed:=\useKV[Kakurasu]{Graine}; + fi; + + numeric Longueur,Largeur; + Longueur=\useKV[Kakurasu]{Longueur}; + Largeur=\useKV[Kakurasu]{Largeur}; + + u:=\useKV[Kakurasu]{Echelle}; + + pair A[][];%centre des carrés. + boolean Allume[][]; + numeric NombreLigne[][],NombreColonne[][]; + + for k=-1 upto Largeur+1: + for l=-1 upto Longueur+1: + Allume[k][l]=false; + endfor; + endfor; + + for k=0 upto Largeur-1: + for l=0 upto Longueur-1: + A[k][l]=u*(l,-k); + trace (unitsquare scaled u) shifted A[k][l]; + endfor; + endfor; + + for k=0 upto Largeur-1: + for l=0 upto Longueur-1: + if Allume[k][l]: + else: + Allume[k][l]:=true; + m:=uniformdeviate(1); + if m<0.5: + % on ne met pas de case noire + else: + % on met une case noire + NombreLigne[k][l]=l+1; + NombreColonne[k][l]=k+1; + if Solution: + fill (unitsquare scaled 0.9u) shifted (A[k][l]+0.05*u*(1,1)); + fi; + fi; + fi; + endfor; + endfor; + + % on compte le nombre de chiffres dans les lignes et on les ajoute + for k=0 upto Largeur-1: + Somme:=0; + for l=0 upto Longueur-1: + if unknown NombreLigne[k][l]: + else: + Somme:=Somme+NombreLigne[k][l]; + fi; + endfor; + label(TEX(decimal(Somme)),u*(-0.5,-k+0.5)); + endfor; + + % on compte le nombre de chiffres dans les colonnes et on les ajoute + for k=0 upto Longueur-1: + Somme:=0; + for l=0 upto Largeur-1: + if unknown NombreColonne[l][k]: + else: + Somme:=Somme+NombreColonne[l][k]; + fi; + endfor; + label(TEX(decimal(Somme)),u*(k+0.5,1.5)); + endfor; + + % On affiche les valeurs des cases noires. + drawoptions(withcolor 0.5white); + for k=0 upto Longueur-1: + label(TEX("\footnotesize"&decimal(k+1)),u*(k+0.5,-Largeur+0.5)); + endfor; + for k=0 upto Largeur-1: + label(TEX("\footnotesize"&decimal(k+1)),u*(Longueur+0.5,-k+0.5)); + endfor; + drawoptions(); + if Trace: + \useKV[Kakurasu]{Traces}; + fi; + \end{mplibcode} + \fi +}% + +%%% +% Midpoint +%%% +\setKVdefault[MidPoint]{Solution=false,Graines=false,Hard=false} +\defKV[MidPoint]{Graine=\setKV[MidPoint]{Graines}} + +\NewDocumentCommand\MidPoint{o}{% + \useKVdefault[MidPoint]% + \setKV[MidPoint]{#1}% + \BuildMidPoint +} + +\NewDocumentCommand\BuildMidPoint{}{% + \ifluatex + \mplibforcehmode + \begin{mplibcode} + numeric Longueur,Largeur; + Longueur=8; + Largeur=4; + boolean Horizontal,Vertical,RetiensSens; + Horizontal=false; + Vertical=false; + + boolean Solution,Hard,Graines; + Solution:=\useKV[MidPoint]{Solution}; + Hard:=\useKV[MidPoint]{Hard}; + Graines:=\useKV[MidPoint]{Graines}; + if Graines: + randomseed:=\useKV[MidPoint]{Graine} + fi; + + u:=8mm; + + pair A[][];%centre des carrés. + + vardef CherchePoint(expr basek,basel)= + % Si le déplacement précédent est horizontal, il faut passer en vertical + % Si le déplacement précédent est vertical, il faut passer en horizontal + p:=p+1; + if basel=ColonneArrivee: + RP[p]:=Arrivee; + else: + if Vertical: + %deplacement horizontal + ecart:=ColonneArrivee-basel; + if ecart=1: + Basel:=ColonneArrivee; + RP[p]:=A[basek][ColonneArrivee]; + else: + Basel:=ceiling(basel+uniformdeviate(ecart)); + RP[p]:=A[basek][Basel]; + fi; + Basek:=basek; + Horizontal:=true; + Vertical:=false; + else: + %on vérifie qu'on peut se déplacer dans les deux sens. + % on choisit vertical positif ou vertical négatif + if basek=1: + choix:=0.75; + elseif basek=Largeur: + choix:=0.25; + else: + choix:=uniformdeviate(1); + fi; + if choix<0.5: + ecart:=basek-1; + if ecart=1: + Basek:=1; + RP[p]:=A[1][basel]; + else: + Basek:=ceiling(uniformdeviate(ecart)); + RP[p]:=A[Basek][basel]; + fi; + Basel:=basel; + else: + ecart:=Largeur-basek; + if ecart=1: + Basek:=Largeur; + RP[p]:=A[Largeur][basel]; + else: + Basek:=basek+ceiling(uniformdeviate(ecart)); + RP[p]:=A[Basek][basel]; + fi; + Basel:=basel; + fi; + Horizontal:=false; + Vertical:=true; + fi; + fi; +enddef; + +vardef MidPoint(expr Aa,Bb)= + save $; + picture $; + $=image( + if Solution: + trace Aa--Bb withpen pencircle scaled 1.5; + fi; + if Hard: + NbMid:=NbMid+1; + if NbMid mod 2=0: + remplis cercles(1/2[Aa,Bb],1mm); + fi; + else: + remplis cercles(1/2[Aa,Bb],1mm); + fi; + ); + $ +enddef; + + % tracé de la grille + for k=1 upto 2*Largeur: + for l=-3 upto Largeur+Longueur-4: + trace (unitsquare scaled u) shifted (u*(l,-k)-center (unitsquare scaled u)) withcolor 0.5*white; + endfor; + endfor; + + for k=1 upto Largeur: + for l=1 upto Longueur: + A[k][l]=u*(l,-k); + %trace (unitsquare scaled u) shifted (A[k][l]-center (unitsquare scaled u)) withcolor 0.5*white; + endfor; + endfor; + +%On choisit le premier déplacement + choix:=uniformdeviate(1); + if choix<0.5: + Horizontal:=true; + else: + Vertical:=true; + fi; + + p:=0; + NbMid=ceiling(uniformdeviate(2));%Pour le niveau Hard + + %1er rectangle +LigneDepart:=2;%2; +ColonneDepart:=1; +LigneArrivee:=4;%4; +ColonneArrivee:=8; +pair Depart,Arrivee; +Depart=A[LigneDepart][ColonneDepart]; +Arrivee=A[LigneArrivee][ColonneArrivee]; + +pair RP[];%RetiensPoints +RP[0]=Depart; + +Basek:=LigneDepart; +Basel:=ColonneDepart; +forever: + CherchePoint(Basek,Basel); + exitif RP[p]=Arrivee; +endfor; + +if ypart(RP[p])=ypart(RP[p-1]): + RetiensSens:=true; +else: + RetiensSens:=false; + p:=p-1; +fi; + +%2eme rectangle +for k=1 upto Largeur: + for l=1 upto Longueur: + A[k][l]:=u*(Longueur+l,-k); + endfor; +endfor; + +LigneDepart:=4; +ColonneDepart:=1; +LigneArrivee:=2; +ColonneArrivee:=8; +Depart:=A[LigneDepart][ColonneDepart]; +Arrivee:=A[LigneArrivee][ColonneArrivee]; + +Basek:=LigneDepart; +Basel:=ColonneDepart; +Retiens:=p; +RP[p+1]:=Depart; + +forever: + CherchePoint(Basek,Basel); + exitif RP[p]=Arrivee; +endfor; + +if ypart(RP[p])=ypart(RP[p-1]): + RetiensSens:=true; + p:=p-1; +else: + RetiensSens:=false; +fi; + +for h=(Retiens+1) upto p: + RP[h]:=symetrie(RP[h],u*(Longueur+0.5,-Largeur-0.5)); +endfor; +%3eme Rectangle +for k=1 upto Largeur: + for l=1 upto Longueur: + A[k][l]:=u*(2*Longueur+l,-k); + endfor; +endfor; + +LigneDepart:=4; +ColonneDepart:=2; +LigneArrivee:=1; +ColonneArrivee:=4; +Depart:=A[LigneDepart][ColonneDepart]; +Arrivee:=A[LigneArrivee][ColonneArrivee]; + + +Basek:=LigneDepart; +Basel:=ColonneDepart; +Retiens:=p; +RP[p+1]:=Depart; +forever: + CherchePoint(Basek,Basel); + exitif RP[p]=Arrivee; +endfor; +for h=(Retiens+1) upto p: + RP[h]:=rotation(RP[h],u*(2*Longueur+0.5,-Largeur-0.5),90) shifted(u*(-2*Longueur,-Largeur)); +endfor; +%4eme rectangle. On termine la boucle ? +for k=1 upto Largeur: + for l=1 upto Longueur: + A[k][l]:=u*(3*Longueur+l,-k); + endfor; +endfor; + +LigneDepart:=4; +ColonneDepart:=1; +LigneArrivee:=2; +ColonneArrivee:=4; +Depart:=A[LigneDepart][ColonneDepart]; +Arrivee:=A[LigneArrivee][ColonneArrivee]; + +Basek:=LigneDepart; +Basel:=ColonneDepart; +Retiens:=p; +RP[p+1]:=Depart; +forever: + CherchePoint(Basek,Basel); + exitif RP[p]=Arrivee; +endfor; + +if ypart(RP[p])=ypart(RP[p-1]): + p:=p-1; +fi; + +if ypart(RP[0])=ypart(RP[1]): + RetiensSens:=true; +else: + RetiensSens:=false; +fi; + +for h=(Retiens+1) upto p: + RP[h]:=RP[h] shifted(u*(-3.5*Longueur,0)); +endfor; + +if RetiensSens: + RP[p+1]:=RP[1]; + go:=1; +else: + RP[p+1]:=RP[0]; + go:=0; +fi; + +for h=go upto p: + draw MidPoint(RP[h],RP[h+1]); +endfor; +\end{mplibcode} +\fi +} + +%%% +% Grades +%%% +\setKVdefault[Grades]{Solution=false,Longueur=9,Largeur=9,Echelle=8mm,Graines=false} +\defKV[Grades]{Graine=\setKV[Grades]{Graines}} + +\NewDocumentCommand\Grades{o}{% + \useKVdefault[Grades]% + \setKVdefault[Grades]{#1}% + \BuildGrades% +} + +\NewDocumentCommand\BuildGrades{}{% + \ifluatex + \mplibforcehmode + \begin{mplibcode} + boolean Graines,Solution; + Graines=\useKV[Grades]{Graines}; + Solution=\useKV[Grades]{Solution}; + + if Graines: + randomseed:=\useKV[Grades]{Graine}; + fi; + + numeric Longueur,Largeur; + Longueur=\useKV[Grades]{Longueur}; + Largeur=\useKV[Grades]{Largeur}; + + u:=\useKV[Grades]{Echelle}; + + p:=0; + pair A[];%centre des carrés. + boolean Allume[][]; + numeric Nombre[][]; + + for k=-1 upto Largeur+1: + for l=-1 upto Longueur+1: + Allume[k][l]=false; + endfor; + endfor; + + for k=0 upto Longueur-1: + for l=0 upto Largeur-1: + p:=p+1; + A[p]=u*(k,-l); + trace (unitsquare scaled u) shifted A[p]; + endfor; + endfor; + + for k=0 upto Largeur-1: + for l=0 upto Longueur-1: + if Allume[k][l]: + else: + Allume[k][l]:=true; + m:=uniformdeviate(1); + if m<0.5: + % on ne met pas de nombre + else: + % on met un nombre + Nombre[k][l]=floor(1+uniformdeviate(9)); + Allume[k][l+1]:=true; + Allume[k+1][l-1]:=true; + Allume[k+1][l]:=true; + Allume[k+1][l+1]:=true; + if Solution: + label(TEX(decimal(Nombre[k][l])),u*(l+0.5,-k+0.5)); + fi; + fi; + fi; + endfor; + endfor; + + % on compte le nombre de chiffres dans les lignes et on les ajoute + for k=0 upto Largeur-1: + p:=0; + Somme:=0; + for l=0 upto Longueur-1: + if unknown Nombre[k][l]: + else: + p:=p+1; + Somme:=Somme+Nombre[k][l]; + fi; + endfor; + label(TEX(decimal(p)),u*(-0.5,-k+0.5)); + label(TEX(decimal(Somme)),u*(Longueur+0.5,-k+0.5)); + endfor; + + % on compte le nombre de chiffres dans les colonnes et on les ajoute + for k=0 upto Longueur-1: + p:=0; + Somme:=0; + for l=0 upto Largeur-1: + if unknown Nombre[l][k]: + else: + p:=p+1; + Somme:=Somme+Nombre[l][k]; + fi; + endfor; + label(TEX(decimal(p)),u*(k+0.5,1.5)); + label(TEX(decimal(Somme)),u*(k+0.5,-Largeur+0.5)); + endfor; + \end{mplibcode} + \fi +}% + +%%% +% Squaro +%%% +\setKVdefault[Squaro]{Solution=false,Longueur=8,Largeur=8,Echelle=8mm,Nom=Jeu1,Graines=false} +\defKV[Squaro]{Graine=\setKV[Squaro]{Graines}}% + +\NewDocumentCommand\SquarO{o}{% + \useKVdefault[Squaro]% + \setKVdefault[Squaro]{#1}% + \ifboolKV[Squaro]{Solution}{\BuildSquaroSolution}{\BuildSquaro}% +} + +\NewDocumentCommand\BuildSquaro{}{% + \ifluatex + \mplibforcehmode + \xdef\PfCSquaroNom{\useKV[Squaro]{Nom}}% + \begin{mplibcode}[\PfCSquaroNom] + numeric Longueur,Largeur; + Longueur=\useKV[Squaro]{Longueur}; + Largeur=\useKV[Squaro]{Largeur}; + boolean Solution,Graines; + Solution=\useKV[Squaro]{Solution}; + Graines:=\useKV[Squaro]{Graines}; + if Graines: + randomseed:=\useKV[Squaro]{Graine}; + fi; + + u:=\useKV[Squaro]{Echelle}; + + p:=0; + pair A[];%centre des carrés. + boolean Allume[][]; + + for k=0 upto Longueur-1: + for l=0 upto Largeur-1: + p:=p+1; + A[p]=u*(k,-l); + trace (unitsquare scaled u) shifted A[p]; + endfor; + endfor; + + for k=0 upto Largeur: + for l=0 upto Longueur: + m:=uniformdeviate(1); + if m<0.5: + Allume[k][l]=true; + fill cercles(u*(l,-k+1),1mm) if Solution=false:withcolor white fi; + else: + Allume[k][l]=false; + fill cercles(u*(l,-k+1),1mm) withcolor white; + fi; + trace cercles(u*(l,-k+1),1mm); + endfor; + endfor; + + for k=0 upto Largeur-1: + for l=0 upto Longueur-1: + Retiens:=0; + if Allume[k][l]:Retiens:=Retiens+1 fi; + if Allume[k][l+1]:Retiens:=Retiens+1 fi; + if Allume[k+1][l]:Retiens:=Retiens+1 fi; + if Allume[k+1][l+1]:Retiens:=Retiens+1 fi; + label(TEX(decimal(Retiens)),u*(l+0.5,-k+0.5)); + endfor; + endfor; + \end{mplibcode} + \fi +} + +\NewDocumentCommand\BuildSquaroSolution{}{% + \ifluatex + \mplibforcehmode + \xdef\PfCSquaroNom{\useKV[Squaro]{Nom}}% + \begin{mplibcode}[\PfCSquaroNom] + u:=\useKV[Squaro]{Echelle}; + p:=0; + for k=0 upto Longueur-1: + for l=0 upto Largeur-1: + p:=p+1; + trace (unitsquare scaled u) shifted A[p]; + endfor; + endfor; + + for k=0 upto Largeur: + for l=0 upto Longueur: + if Allume[k][l]=true: + fill cercles(u*(l,-k+1),1mm); + else: + fill cercles(u*(l,-k+1),1mm) withcolor white; + fi; + trace cercles(u*(l,-k+1),1mm); + endfor; + endfor; + + for k=0 upto Largeur-1: + for l=0 upto Longueur-1: + Retiens:=0; + if Allume[k][l]:Retiens:=Retiens+1 fi; + if Allume[k][l+1]:Retiens:=Retiens+1 fi; + if Allume[k+1][l]:Retiens:=Retiens+1 fi; + if Allume[k+1][l+1]:Retiens:=Retiens+1 fi; + label(TEX(decimal(Retiens)),u*(l+0.5,-k+0.5)); + endfor; + endfor; + \end{mplibcode} + \fi +} + +%%% +% Garam +%%% +\setKVdefault[Garam]{Taille=7,Largeur=15pt,Solution=false,CouleurSolution=Black} +\newlength\PfCGaramHeight + +\NewDocumentCommand\Garam{o m}{% + \useKVdefault[Garam] + \setKV[Garam]{#1}% + \setlength{\PfCGaramHeight}{\useKV[Garam]{Largeur}+\tabcolsep}% + \reademptyitems% + \setsepchar[*]{§*,*/}% + \readlist*\PfCListeGaram{#2}% + \colorlet{PfCGaramCoulSol}{\useKV[Garam]{CouleurSolution}}% + \begin{NiceTabular}{*{\useKV[Garam]{Taille}}{m{\useKV[Garam]{Largeur}}}} + \CodeBefore + \xintFor* ##1 in{\xintSeq{2}{\fpeval{\useKV[Garam]{Taille}}}}\do{% + \tikz{\draw[dashed,LightGray] (1-|##1)--(last-|##1);}% + }% + \xintFor* ##1 in{\xintSeq{2}{\fpeval{\PfCListeGaramlen-1}}}\do{% + \tikz{\draw[dashed,LightGray] (##1-|1)--(##1-|last);}% + }% + \tikz{\draw (1-|1) rectangle (last-|last);}% + \Body + \xintFor* ##1 in{\xintSeq{1}{\PfCListeGaramlen}}\do{% + \rule{0pt}{\PfCGaramHeight}\xintFor* ##2 in {\xintSeq{1}{\useKV[Garam]{Taille}}}\do{% + \xintifForFirst{}{&}\StrChar{\PfCListeGaram[##1,##2,1]}{1}[\PfCCaracGaram]% + \IfStrEq{\PfCCaracGaram}{*}{\Block[draw,fill=black]{1-1}{}}{% + \IfStrEq{\PfCCaracGaram}{!}{\Block{}{\ifboolKV[Garam]{Solution}{\StrGobbleLeft{\PfCListeGaram[##1,##2,1]}{1}}{}}}{\Block{}{\color{PfCGaramCoulSol}\PfCListeGaram[##1,##2,1]}}% + }% + }\\ + }% + \CodeAfter + % On place les symboles + \xintFor* ##1 in{\xintSeq{1}{\PfCListeGaramlen}}\do{% + \xintFor* ##2 in {\xintSeq{1}{\useKV[Garam]{Taille}}}\do{% + \StrChar{\PfCListeGaram[##1,##2,1]}{1}[\PfCCaracGaram]% + \IfStrEq{\PfCCaracGaram}{*}{}{% + \tikz{% + \StrSubstitute{\PfCListeGaram[##1,##2,2]}{x}{\times}[\PfCGaramUn]% + \StrSubstitute{\PfCGaramUn}{:}{\div}[\PfCGaramUn]% + \StrSubstitute{\PfCListeGaram[##1,##2,3]}{x}{\times}[\PfCGaramDeux]% + \StrSubstitute{\PfCGaramDeux}{:}{\div}[\PfCGaramDeux]% + \xintifForLast{}{\node at (\fpeval{##1+0.5}-|\fpeval{##2+1}) {$\PfCGaramUn$};} + \node at (\fpeval{##1+1}-|\fpeval{##2+0.5}) {$\PfCGaramDeux$}; + }% + }% + }% + }% + \end{NiceTabular} +}% + +%%% +% Futoshiki +%%% +\setKVdefault[Futo]{Largeur=15pt,Solution=false,CouleurSolution=Black,CouleurCase=Cornsilk,StyleTexte={}} + +\newlength\PfCFutoHeight + +\NewDocumentCommand\Futoshiki{o m}{% + \useKVdefault[Futo] + \setKV[Futo]{#1}% + \setlength{\PfCFutoHeight}{\useKV[Futo]{Largeur}+\tabcolsep}% + \setsepchar{\\/,}% + \readlist\ListeFuto{#2}% + \xdef\PfCTailleFuto{\ListeFutolen}% + \def\PfCFutoStyleTexte{\useKV[Futo]{StyleTexte}}% + \colorlet{PfCFutoCase}{\useKV[Futo]{CouleurCase}}% + \begin{NiceTabular}{*{\fpeval{\PfCTailleFuto-1}}{m{\useKV[Futo]{Largeur}}m{5pt}}m{\useKV[Futo]{Largeur}}}%[hvlines] + \xintFor* ##1 in{\xintSeq{1}{\PfCTailleFuto}}\do{% + \xintFor* ##2 in{\xintSeq{1}{\PfCTailleFuto}}\do{% + \rule{0pt}{\PfCFutoHeight}% + \StrChar{\ListeFuto[##1,\fpeval{2*##2-1}]}{1}[\PfCCaracFuto]% + \IfStrEq{\PfCCaracFuto}{*}{% + \StrGobbleLeft{\ListeFuto[##1,\fpeval{2*##2-1}]}{1}[\PfCResteFuto]% + \Block[draw]{}{\PfCFutoStyleTexte\PfCResteFuto}% + }{% + \IfStrEq{\PfCCaracFuto}{!}{% + \StrGobbleLeft{\ListeFuto[##1,\fpeval{2*##2-1}]}{1}[\PfCResteFuto]% + \Block[draw,fill=PfCFutoCase]{}{\PfCFutoStyleTexte\PfCResteFuto}% + }{% + \ifboolKV[Futo]{Solution}{\Block[draw]{}{\PfCFutoStyleTexte\color{\useKV[Futo]{CouleurSolution}}\ListeFuto[##1,\fpeval{2*##2-1}]}}{\Block[draw]{}{}}% + }% + }% + \xintifForLast{}{&&}% + }\\ + \rule{0pt}{\fpeval{5pt+\tabcolsep}pt}\Block[]{}{}\\ + }% + \CodeAfter%Pour écrire les symboles + \xintFor* ##1 in{\xintSeq{1}{\PfCTailleFuto}}\do{% + \xintFor* ##2 in{\xintSeq{1}{\PfCTailleFuto}}\do{% + \IfStrEq{\ListeFuto[##1,2*##2]}{>}{% + \tikz{% + \draw[transform canvas={xshift=\fpeval{2pt+0.5\tabcolsep}pt}] (\fpeval{2*##1-1}-|\fpeval{2*##2})--(\fpeval{2*##1-0.5}-|\fpeval{2*##2+0.5})--(\fpeval{2*##1}-|\fpeval{2*##2}); + }% + }{}% + \IfStrEq{\ListeFuto[##1,2*##2]}{<}{% + \tikz{% + \draw[transform canvas={xshift=\fpeval{2pt+0.5\tabcolsep}pt}] (\fpeval{2*##1-1}-|\fpeval{2*##2+0.5})--(\fpeval{2*##1-0.5}-|\fpeval{2*##2})--(\fpeval{2*##1}-|\fpeval{2*##2+0.5}); + }% + }{}% + \IfStrEq{\ListeFuto[##1,2*##2]}{v}{% + \tikz{% + \draw[transform canvas={yshift=\fpeval{2pt+0.5\tabcolsep}pt}] (\fpeval{2*##1-1.5}-|\fpeval{2*##2-1})--(\fpeval{2*##1-1}-|\fpeval{2*##2-0.5})--(\fpeval{2*##1-1.5}-|\fpeval{2*##2}); + }% + }{}% + \IfStrEq{\ListeFuto[##1,2*##2]}{A}{% + \tikz{% + \draw[transform canvas={yshift=\fpeval{2pt+0.5\tabcolsep}pt}] (\fpeval{2*##1-1}-|\fpeval{2*##2-1})--(\fpeval{2*##1-1.5}-|\fpeval{2*##2-0.5})--(\fpeval{2*##1-1}-|\fpeval{2*##2}); + }% + }{}% + \IfStrEq{\ListeFuto[##1,2*##2]}{>A}{% + \tikz{% + \draw[transform canvas={xshift=\fpeval{2pt+0.5\tabcolsep}pt}] (\fpeval{2*##1-1}-|\fpeval{2*##2})--(\fpeval{2*##1-0.5}-|\fpeval{2*##2+0.5})--(\fpeval{2*##1}-|\fpeval{2*##2}); + \draw[transform canvas={yshift=\fpeval{2pt+0.5\tabcolsep}pt}] (\fpeval{2*##1-1}-|\fpeval{2*##2-1})--(\fpeval{2*##1-1.5}-|\fpeval{2*##2-0.5})--(\fpeval{2*##1-1}-|\fpeval{2*##2}); + }% + }{}% + \IfStrEq{\ListeFuto[##1,2*##2]}{>v}{% + \tikz{% + \draw[transform canvas={xshift=\fpeval{2pt+0.5\tabcolsep}pt}] (\fpeval{2*##1-1}-|\fpeval{2*##2})--(\fpeval{2*##1-0.5}-|\fpeval{2*##2+0.5})--(\fpeval{2*##1}-|\fpeval{2*##2}); + \draw[transform canvas={yshift=\fpeval{2pt+0.5\tabcolsep}pt}] (\fpeval{2*##1-1.5}-|\fpeval{2*##2-1})--(\fpeval{2*##1-1}-|\fpeval{2*##2-0.5})--(\fpeval{2*##1-1.5}-|\fpeval{2*##2}); + }% + }{}% + \IfStrEq{\ListeFuto[##1,2*##2]}{<A}{% + \tikz{% + \draw[transform canvas={xshift=\fpeval{2pt+0.5\tabcolsep}pt}] (\fpeval{2*##1-1}-|\fpeval{2*##2+0.5})--(\fpeval{2*##1-0.5}-|\fpeval{2*##2})--(\fpeval{2*##1}-|\fpeval{2*##2+0.5}); + \draw[transform canvas={yshift=\fpeval{2pt+0.5\tabcolsep}pt}] (\fpeval{2*##1-1}-|\fpeval{2*##2-1})--(\fpeval{2*##1-1.5}-|\fpeval{2*##2-0.5})--(\fpeval{2*##1-1}-|\fpeval{2*##2}); + }% + }{}% + \IfStrEq{\ListeFuto[##1,2*##2]}{<v}{% + \tikz{% + \draw[transform canvas={xshift=\fpeval{2pt+0.5\tabcolsep}pt}] (\fpeval{2*##1-1}-|\fpeval{2*##2+0.5})--(\fpeval{2*##1-0.5}-|\fpeval{2*##2})--(\fpeval{2*##1}-|\fpeval{2*##2+0.5}); + \draw[transform canvas={yshift=\fpeval{2pt+0.5\tabcolsep}pt}] (\fpeval{2*##1-1.5}-|\fpeval{2*##2-1})--(\fpeval{2*##1-1}-|\fpeval{2*##2-0.5})--(\fpeval{2*##1-1.5}-|\fpeval{2*##2}); + }% + }{}% + }% + }% + \end{NiceTabular} +}% + +%%% % Ronde infernale %%% \newcommand\TestNombrePremier[1]{% @@ -742,11 +1488,11 @@ fi; else: if p_="*": - label.top(TEX("$\times"&Nombre[n]&"$"),1/2[A[n-1],A[n]]); + label.top(LATEX("$\times"&Nombre[n]&"$"),1/2[A[n-1],A[n]]); elseif p_="/": - label.top(TEX("$\div"&Nombre[n]&"$"),1/2[A[n-1],A[n]]); + label.top(LATEX("$\div"&Nombre[n]&"$"),1/2[A[n-1],A[n]]); else: - label.top(TEX("$"&p_&Nombre[n]&"$"),1/2[A[n-1],A[n]]); + label.top(LATEX("$"&p_&Nombre[n]&"$"),1/2[A[n-1],A[n]]); fi; fi; endfor; @@ -783,7 +1529,7 @@ O=(0,0); A[0]=O; for k=1 upto nbcase: - A[k]-A[k-1]=(Rayon,0); + A[k]-A[k-1]=(Rayon+2cm,0); endfor; for k=0 upto nbcase-2: drawarrow (A[k]--A[k+1]) cutbefore (BoiteRectangle shifted A[k]) cutafter (BoiteRectangle shifted A[k+1]) withpen pencircle scaled 1.5; @@ -805,12 +1551,12 @@ fi; if Vide=false: if Perso: - label(TEX("$"&Depart&"$"),A[0]); + label(LATEX("$"&Depart&"$"),A[0]); else: - label(TEX("$"&decimal(Depart)&"$"),A[0]); + label(LATEX("$"&decimal(Depart)&"$"),A[0]); fi; fi; - \end{mplibcode} + \end{mpost} \fi }% @@ -1477,13 +2223,23 @@ %%% % Enigme Aire %%% -\setKVdefault[EnigmeAire]{Modele=A,Couleur=LightSteelBlue,Echelle=7mm,Etape=1} +\setKVdefault[EnigmeAire]{Modele=A,Couleur=LightSteelBlue,Echelle=7mm,Etape=1,Solution=false,Graines=false} +\defKV[EnigmeAire]{Graine=\setKV[EnigmeAire]{Graines}} \def\MPEnigmeAireA{% \ifluatex \mplibforcehmode \begin{mplibcode} + boolean Graines,Solution; + Graines:=\useKV[EnigmeAire]{Graines}; + Solution:=\useKV[EnigmeAire]{Solution}; + + if Graines: + randomseed:=\useKV[EnigmeAire]{Graine}; + fi; + u:=\useKV[EnigmeAire]{Echelle}; + pair A[],B[]; numeric la[]; la1=ceiling(3+uniformdeviate(7)); @@ -1502,7 +2258,12 @@ trace polygone(B1,B2,B3,B4); trace polygone(A1,A2,A3,A4); label(TEX("\Aire[m]{"&decimal(la1*la4)&"}"),iso(A1,B4)); + if Solution: + label(TEX(decimal(la2*la4)&"\,\si{\square\meter}"),iso(B1,B3)); + else: label(TEX("?\,\si{\square\meter}"),iso(B1,B3)); + fi; + label(TEX("\Aire[m]{"&decimal(la3*la4)&"}"),iso(B2,A3)); trace cotation(A4,B3,3mm,3mm,TEX("\Lg[m]{"&decimal(la1+la2)&"}")); trace cotation(B1,A2,-3mm,-3mm,TEX("\Lg[m]{"&decimal(la3+la2)&"}")); @@ -1514,6 +2275,14 @@ \ifluatex \mplibforcehmode \begin{mplibcode} + boolean Graines,Solution; + Graines:=\useKV[EnigmeAire]{Graines}; + Solution:=\useKV[EnigmeAire]{Solution}; + + if Graines: + randomseed:=\useKV[EnigmeAire]{Graine}; + fi; + u:=\useKV[EnigmeAire]{Echelle}; pair A[],B[]; numeric La[],la[],Ca[]; @@ -1538,7 +2307,12 @@ trace polygone(A1,A2,A3,A4,A5,A6); trace chemin(A7,A4); label(TEX("\Aire[m]{"&decimal(la1*La1)&"}"),iso(A1,A3)); + if Solution: + label(TEX(decimal(Ca1*Ca2)&"\,\si{\square\meter}"),iso(B1,B3)); + else: label(TEX("?\,\si{\square\meter}"),iso(B1,B3)); + fi; + label(TEX("\Aire[m]{"&decimal(la2*La2)&"}"),iso(A7,A5)); trace appelation(A6,A5,3mm,TEX("\Lg[m]{"&decimal(La2)&"}")); trace appelation(B1,A3,3mm,TEX("\Lg[m]{"&decimal(La1-La2-Ca1)&"}")); @@ -1552,6 +2326,14 @@ \ifluatex \mplibforcehmode \begin{mplibcode} + boolean Graines,Solution; + Graines:=\useKV[EnigmeAire]{Graines}; + Solution:=\useKV[EnigmeAire]{Solution}; + + if Graines: + randomseed:=\useKV[EnigmeAire]{Graine}; + fi; + u:=\useKV[EnigmeAire]{Echelle}; pair A[]; numeric la[],La[]; @@ -1588,7 +2370,11 @@ trace cotation(A1,A4,-3mm,-3mm,TEX("\Lg[cm]{"&decimal(La1+La2+La3)&"}")); label.lft(TEX("\Lg{"&decimal(la1)&"}"),iso(A1,A10)); label.lft(TEX("\Lg{"&decimal(la2)&"}"),iso(A9,A8)); + if Solution: + label.lft(TEX(decimal(la3)&"\,\si{\centi\meter}"),iso(A7,A6)); + else: label.lft(TEX("?\,\si{\centi\meter}"),iso(A7,A6)); + fi; \end{mplibcode} \fi } @@ -1597,6 +2383,14 @@ \ifluatex \mplibforcehmode \begin{mplibcode} + boolean Graines,Solution; + Graines:=\useKV[EnigmeAire]{Graines}; + Solution:=\useKV[EnigmeAire]{Solution}; + + if Graines: + randomseed:=\useKV[EnigmeAire]{Graine}; + fi; + u:=\useKV[EnigmeAire]{Echelle}; Etape:=\useKV[EnigmeAire]{Etape}; pair A[]; @@ -1613,7 +2407,11 @@ A[6*(k-1)+6]-A[6*(k-1)+5]=A[6*(k-1)+2]-A[6*(k-1)+1]; trace polygone(A[6*(k-1)+1],A[6*(k-1)+2],A[6*(k-1)+3],A[6*(k-1)+4]); trace segment(A[6*(k-1)+5],A[6*(k-1)+6]); + if Solution: + trace cotation(A[6*(k-1)+5],A[6*(k-1)+1],-3mm,-3mm,TEX("\Lg{"&decimal(la[k])&"}")); + else: trace cotation(A[6*(k-1)+5],A[6*(k-1)+1],-3mm,-3mm,TEX("?\,\si{\centi\meter}")); + fi; label(TEX("\Aire{"&decimal(la[k]*La[k])&"}"),iso(A[6*(k-1)+5],A[6*(k-1)+2])); label(TEX("\Aire{"&decimal(la[k+1]*La[k])&"}"),iso(A[6*(k-1)+4],A[6*(k-1)+6])); if Etape<2: @@ -1644,6 +2442,14 @@ \ifluatex \mplibforcehmode \begin{mplibcode} + boolean Graines,Solution; + Graines:=\useKV[EnigmeAire]{Graines}; + Solution:=\useKV[EnigmeAire]{Solution}; + + if Graines: + randomseed:=\useKV[EnigmeAire]{Graine}; + fi; + u:=\useKV[EnigmeAire]{Echelle}; pair A[]; numeric la[],La[]; @@ -1673,7 +2479,11 @@ trace cotationarc(A5,A4,5mm,4,1,TEX("\Lg[cm]{"&decimal(La3)&"}") rotated 90); trace cotationarc(A9,A8,3mm,4,1,TEX("\Lg[cm]{"&decimal(la3-la1)&"}") rotated 180); trace cotationarc(A4,A3,3mm,4,1,TEX("\Lg[cm]{"&decimal(la3-la2)&"}")); + if Solution: + trace cotationarc(A3,A1,5mm,3,1,TEX("\Lg{"&decimal(La1+La2)&"}") rotated 90); + else: trace cotationarc(A3,A1,5mm,3,1,TEX("?") rotated 90); + fi; \end{mplibcode} \fi } @@ -1682,6 +2492,14 @@ \ifluatex \mplibforcehmode \begin{mplibcode} + boolean Graines,Solution; + Graines:=\useKV[EnigmeAire]{Graines}; + Solution:=\useKV[EnigmeAire]{Solution}; + + if Graines: + randomseed:=\useKV[EnigmeAire]{Graine}; + fi; + u:=\useKV[EnigmeAire]{Echelle}; pair A[]; numeric la[],La[]; @@ -1710,7 +2528,11 @@ trace polygone(A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13); trace segment(A7,A13); trace segment(A10,A4); + if Solution: + label(TEX("\Aire{"&decimal(la2*La2)&"}"),iso(A1,A6)); + else: label(TEX("?\,\si{\square\centi\meter}"),iso(A1,A6)); + fi; label(TEX("\Aire[cm]{"&decimal(la1*La1)&"}"),iso(A2,A4)); label(TEX("\Aire[cm]{"&decimal(la3*La3)&"}"),iso(A10,A8)); label(TEX("\Aire[cm]{"&decimal(la4*La4)&"}"),iso(A12,A1)); @@ -7989,11 +8811,13 @@ transform canvas={xshift=0em,yshift=0em}},rectangle,rounded corners,ultra thick, %%% % D\'ecomposition de fractions d\'ecimales %%% -\setKVdefault[ClesFracDeci]{Complete=false,SansZero=false,Remediation=false} +\setKVdefault[ClesFracDeci]{Complete=false,SansZero=false,Remediation=false,Longueur=1cm} +\newlength{\PfCLongueurP}% \newcommand\FractionDecimale[2][]{% \useKVdefault[ClesFracDeci]% \setKV[ClesFracDeci]{#1}% + \setlength{\PfCLongueurP}{\useKV[ClesFracDeci]{Longueur}}% \setsepchar[*]{/}% \readlist*\ListeFractionDecimale{#2}% \xdef\FractionDeciNum{\ListeFractionDecimale[1]}% @@ -8005,14 +8829,14 @@ transform canvas={xshift=0em,yshift=0em}},rectangle,rounded corners,ultra thick, \StrLen{\fpeval{\FractionDeciNum}}[\LongueurFracDeciNum]% \xintifboolexpr{\PartieEntiereFractionDeci == 0}{\xdef\LongueurPartieEntiere{0}}{\StrLen{\PartieEntiereFractionDeci}[\LongueurPartieEntiere]}% \xintifboolexpr{\PartieEntiereFractionDeci == \fpeval{\FractionDeciNum/\FractionDeciDeno}}{% - \ensuremath{\ifboolKV[ClesFracDeci]{Remediation}{\dots}{\num{\PartieEntiereFractionDeci}}}% + \ensuremath{\ifboolKV[ClesFracDeci]{Remediation}{\pointilles[\PfCLongueurP]}{\num{\PartieEntiereFractionDeci}}}% }{% \ifboolKV[ClesFracDeci]{SansZero}{% \ensuremath{% - \xintifboolexpr{\PartieEntiereFractionDeci == 0}{}{\ifboolKV[ClesFracDeci]{Remediation}{\dots}{\num{\PartieEntiereFractionDeci}}+}% + \xintifboolexpr{\PartieEntiereFractionDeci == 0}{}{\ifboolKV[ClesFracDeci]{Remediation}{\pointilles[\PfCLongueurP]}{\num{\PartieEntiereFractionDeci}}+}% \xintFor* ##1 in {\xintSeq{1}{\LongueurPartieDecimale}}\do{% \StrMid{\PartieDecimaleFractionDeci}{##1}{##1}[\ChiffrePartieDecimale]% - \xintifForFirst{}{\xintifboolexpr{\ChiffrePartieDecimale == 0}{}{+}}\xintifboolexpr{\ChiffrePartieDecimale == 0}{}{\frac{\ifboolKV[ClesFracDeci]{Remediation}{\dots}{\num{\ChiffrePartieDecimale}}}{\num{\fpeval{10**(\LongueurFracDeciDeno-1-\LongueurPartieDecimale+##1)}}}}% + \xintifForFirst{}{\xintifboolexpr{\ChiffrePartieDecimale == 0}{}{+}}\xintifboolexpr{\ChiffrePartieDecimale == 0}{}{\frac{\ifboolKV[ClesFracDeci]{Remediation}{\pointilles[\PfCLongueurP]}{\num{\ChiffrePartieDecimale}}}{\num{\fpeval{10**(\LongueurFracDeciDeno-1-\LongueurPartieDecimale+##1)}}}}% }% }% }{% @@ -8020,24 +8844,24 @@ transform canvas={xshift=0em,yshift=0em}},rectangle,rounded corners,ultra thick, \xintifboolexpr{\FractionDeciNum>\FractionDeciDeno}{% \ensuremath{% % on affiche la partie entière. - \xintifboolexpr{\PartieEntiereFractionDeci == 0}{}{\ifboolKV[ClesFracDeci]{Remediation}{\dots}{\num{\PartieEntiereFractionDeci}}+}% + \xintifboolexpr{\PartieEntiereFractionDeci == 0}{}{\ifboolKV[ClesFracDeci]{Remediation}{\pointilles[\PfCLongueurP]}{\num{\PartieEntiereFractionDeci}}+}% \StrGobbleLeft{\FractionDeciNum}{\fpeval{\LongueurPartieEntiere}}[\DecompositionFracDeciComplete]% % on affiche la partie décimale. \xintFor* ##1 in {\xintSeq{1}{\fpeval{\LongueurFracDeciNum-\LongueurPartieEntiere}}}\do{% - \xintifForFirst{}{+}\StrMid{\DecompositionFracDeciComplete}{##1}{##1}[\ChiffrePartieDecimale]\frac{\ifboolKV[ClesFracDeci]{Remediation}{\dots}{\num{\ChiffrePartieDecimale}}}{\num{\fpeval{10**##1}}}% + \xintifForFirst{}{+}\StrMid{\DecompositionFracDeciComplete}{##1}{##1}[\ChiffrePartieDecimale]\frac{\ifboolKV[ClesFracDeci]{Remediation}{\pointilles[\PfCLongueurP]}{\num{\ChiffrePartieDecimale}}}{\num{\fpeval{10**##1}}}% }% }% }{% \ensuremath{% \xintFor* ##1 in {\xintSeq{1}{\LongueurPartieDecimale}}\do{% \StrMid{\PartieDecimaleFractionDeci}{##1}{##1}[\ChiffrePartieDecimale]% - \xintifForFirst{}{+}\frac{\ifboolKV[ClesFracDeci]{Remediation}{\dots}{\num{\ChiffrePartieDecimale}}}{\num{\fpeval{10**(\LongueurFracDeciDeno-1-\LongueurPartieDecimale+##1)}}}% + \xintifForFirst{}{+}\frac{\ifboolKV[ClesFracDeci]{Remediation}{\pointilles[\PfCLongueurP]}{\num{\ChiffrePartieDecimale}}}{\num{\fpeval{10**(\LongueurFracDeciDeno-1-\LongueurPartieDecimale+##1)}}}% }% }% }% }{% \ensuremath{% - \xintifboolexpr{\PartieEntiereFractionDeci == 0}{}{\ifboolKV[ClesFracDeci]{Remediation}{\dots}{\num{\PartieEntiereFractionDeci}}+}\frac{\ifboolKV[ClesFracDeci]{Remediation}{\dots}{\num{\PartieDecimaleFractionDeci}}}{\num{\FractionDeciDeno}}% + \xintifboolexpr{\PartieEntiereFractionDeci == 0}{}{\ifboolKV[ClesFracDeci]{Remediation}{\pointilles[\PfCLongueurP]}{\num{\PartieEntiereFractionDeci}}+}\frac{\ifboolKV[ClesFracDeci]{Remediation}{\pointilles[\PfCLongueurP]}{\num{\PartieDecimaleFractionDeci}}}{\num{\FractionDeciDeno}}% }% }% }% @@ -8777,6 +9601,8 @@ transform canvas={xshift=0em,yshift=0em}},rectangle,rounded corners,ultra thick, \tikzset{FIndirect/.style={stealth-}} \tikzset{FBidirect/.style={stealth-stealth}} +\newlength{\LabyLongCM} + \newcommand\Labyrinthe[3][]{% \useKVdefault[Labyrinthe]% \setKV[Labyrinthe]{#1}% @@ -8787,6 +9613,7 @@ transform canvas={xshift=0em,yshift=0em}},rectangle,rounded corners,ultra thick, \readlist*\ListeLabySol{#3}% }{}% \xdef\LabyLong{\useKV[Labyrinthe]{Longueur}}% +% \setlength{\LabyLongCM}{\fpeval{\LabyLong*28.3465}pt}% \xdef\LabyHaut{\useKV[Labyrinthe]{Hauteur}}% \ifboolKV[Labyrinthe]{SensImpose}{% \xdef\TotalLaby{\fpeval{4*(\useKV[Labyrinthe]{Colonnes}-1)+1}}% @@ -8802,7 +9629,11 @@ transform canvas={xshift=0em,yshift=0em}},rectangle,rounded corners,ultra thick, \foreach \compteurh in {1,...,\useKV[Labyrinthe]{Colonnes}}{% \xdef\ColorFill{\ListeLaby[\fpeval{\useKV[Labyrinthe]{Colonnes}*(\compteurv-1)+\compteurh},2]}% \node[fill=\ColorFill,draw,minimum height=\LabyHaut*1cm,minimum width=\LabyLong*1cm,name=A-\compteurh-\compteurv] at - (\fpeval{\LabyLong+\useKV[Labyrinthe]{EcartH}}*\compteurh,-\fpeval{\LabyHaut+\useKV[Labyrinthe]{EcartV}}*\compteurv) {\ListeLaby[\fpeval{\useKV[Labyrinthe]{Colonnes}*(\compteurv-1)+\compteurh},1]};% + (\fpeval{\LabyLong+\useKV[Labyrinthe]{EcartH}}*\compteurh,-\fpeval{\LabyHaut+\useKV[Labyrinthe]{EcartV}}*\compteurv) {% +% \begin{minipage}{\LabyLongCM} + \ListeLaby[\fpeval{\useKV[Labyrinthe]{Colonnes}*(\compteurv-1)+\compteurh},1]% +% \end{minipage} + };% }% }% % fin des cadres @@ -13791,14 +14622,15 @@ couleur indiquée, le nombre de cases donné par le résultat du calcul. % y a dans un "seul calcul". \setcounter{NbCalculDistri}{0} -\setKVdefault[ClesDistributivite]{Cours=false,Etape=1,Lettre=x,Fleches=false,AideMul=false,Reduction=false,AideAdda=false,AideAddb=false,CouleurAide=red,CouleurReduction=black,CouleurFH=blue,CouleurFB=red,Somme=false,Difference=false,RAZ=false,Oppose=false,All=false,NomExpression=A,Fin=4,Numerique=false,Remarquable=false,Echange=0,Tuile=false,Vide=false,Impression=false,Tableau=false}%,AideAdd=false:inutile ? +\setKVdefault[ClesDistributivite]{Cours=false,Etape=1,Lettre=x,Fleches=false,AideMul=false,Reduction=false,AideAdda=false,AideAddb=false,CouleurAide=red,CouleurReduction=black,CouleurFH=blue,CouleurFB=red,Somme=false,Difference=false,RAZ=false,Oppose=false,All=false,NomExpression=A,Fin=4,Numerique=false,Remarquable=false,Echange=0,Tuile=false,Vide=false,Reperes=false,Impression=false,Tableau=false}%,AideAdd=false:inutile ? \newcommand\Tuile[4]{% \ifluatex \mplibforcehmode \begin{mplibcode} - boolean Vide,Print; + boolean Vide,Reperes,Print; Vide=\useKV[ClesDistributivite]{Vide}; + Reperes=\useKV[ClesDistributivite]{Reperes}; Print=\useKV[ClesDistributivite]{Impression}; pair _CoinTuilev; _CoinTuilev=(0,0); @@ -13891,7 +14723,52 @@ couleur indiquée, le nombre de cases donné par le résultat du calcul. labeloffset:=labeloffset*2; label.ulft(TEX("$\times$"),iso(u*(largeur/2,ecart/2),u*(largeur+ecart/2,largeur/2+ecart))); labeloffset:=labeloffset/2; - if Vide=false: + if Vide: + if Reperes: + %%%% + %% tuile a*c + if #1*#3<>0: + for k=0 upto (abs(#3)-1): + for l=0 upto (abs(#1)-1): + path titi; + titi=polygone((0,0),u*(longueur,0),u*(longueur,-longueur),u*(0,-longueur)) shifted (u*(largeur+ecart,0)+(u*(k*longueur,-l*longueur))); + trace titi withcolor 0.6white; + endfor; + endfor; + fi; + %tuile a*d + if #1*#4<>0: + for k=0 upto (abs(#4)-1): + for l=0 upto (abs(#1)-1): + path titi; + titi=polygone((0,0),u*(largeur,0),u*(largeur,-longueur),u*(0,-longueur)) shifted (u*(largeur+ecart+abs(#3)*longueur,0)+(u*(k*largeur,-l*longueur))); + trace titi withcolor 0.6white; + endfor; + endfor; + fi; + %tuile b*c + if #2*#3<>0: + for k=0 upto (abs(#3)-1): + for l=0 upto (abs(#2)-1): + path titi; + titi=polygone((0,0),u*(longueur,0),u*(longueur,-largeur),u*(0,-largeur)) shifted (u*(largeur+ecart,-abs(#1)*longueur)+(u*(k*longueur,-l*largeur))); + trace titi withcolor 0.6white; + endfor; + endfor; + fi; + %tuile b*d + if #2*#4<>0: + for k=0 upto (abs(#4)-1): + for l=0 upto (abs(#2)-1): + path titi; + titi=polygone((0,0),u*(largeur,0),u*(largeur,-largeur),u*(0,-largeur)) shifted (u*(largeur+ecart+abs(#3)*longueur,-abs(#1)*longueur)+(u*(k*largeur,-l*largeur))); + trace titi withcolor 0.6white; + endfor; + endfor; + fi; + fi; + %%% + else: %% tuile a*c if #1*#3<>0: for k=0 upto (abs(#3)-1): @@ -14233,6 +15110,17 @@ couleur indiquée, le nombre de cases donné par le résultat du calcul. \DistriEchange[#1]{#2}{#3}{#4}{#5}% }{% \ifboolKV[ClesDistributivite]{Remarquable}{% + \ifboolKV[ClesDistributivite]{Numerique}{% + \ifx\bla#4\bla% + \xintifboolexpr{#3>0}{% + \num{\fpeval{#2+#3}}^2=(\num{#2}+\num{#3})^2=\num{#2}^2+2\times\num{#2}\times\num{#3}+\num{#3}^2=\num{\fpeval{#2*#2}}+\num{\fpeval{2*#2*#3}}+\num{\fpeval{#3*#3}}=\num{\fpeval{(#2+#3)**2}} + }{% + \num{\fpeval{#2+#3}}^2=(\num{#2}\num{#3})^2=\num{#2}^2-2\times\num{#2}\times\num{\fpeval{-#3}}+\num{\fpeval{-#3}}^2=\num{\fpeval{#2*#2}}-\num{\fpeval{2*#2*abs(#3)}}+\num{\fpeval{#3*#3}}=\num{\fpeval{(#2-abs(#3))**2}} + } + \else + \num{\fpeval{#2+#3}}\times\num{\fpeval{#4+#5}}=(\num{#2}+\num{#3})\times(\num{#4}\num{#5})=\num{#2}^2-\num{#3}^2=\num{\fpeval{#2*#2}}-\num{\fpeval{#3*#3}}=\num{\fpeval{(#2+#3)*(#2-#3)}} + \fi% + }{% \xintifboolexpr{\useKV[ClesDistributivite]{Etape}==1}{% \ifx\bla#4\bla(\Affichage{0}{#2}{#3})^2\else(\Affichage{0}{#2}{#3})(\Affichage{0}{#4}{#5})\fi% }{} @@ -14282,6 +15170,8 @@ couleur indiquée, le nombre de cases donné par le résultat du calcul. \ifboolKV[ClesDistributivite]{Difference}{\xdef\SommeA{\fpeval{\SommeA-#2*#4}}\xdef\SommeB{\fpeval{\SommeB-#2*#5-#3*#4}}\xdef\SommeC{\fpeval{\SommeC-#3*#5}}}{}% \fi% }{}% + % fin Remarquable + }% }{% \ifboolKV[ClesDistributivite]{Numerique}{% \xintifboolexpr{\useKV[ClesDistributivite]{Etape}==0}{% @@ -14449,8 +15339,25 @@ couleur indiquée, le nombre de cases donné par le résultat du calcul. \xintifboolexpr{#2==0}{\xintifboolexpr{#3==-1}{-}{\num{#3}}}{\xintifboolexpr{#3==-1}{-}{-\num{\fpeval{abs(#3)}}}} }\LETTRE}% % partie du x^2 - \xintifboolexpr{#4==0}{}{\xintifboolexpr{#4>0}{\xintifboolexpr{#2==0}{\xintifboolexpr{#3==0}{}{+}}{+}\xintifboolexpr{#4==1}{}{\num{#4}}}{% - \xintifboolexpr{#2==0}{\xintifboolexpr{#3==0}{\num{#4}}{-\num{\fpeval{abs(#4)}}}}{-\num{\fpeval{abs(#4)}}}}\LETTRE^2}% + \xintifboolexpr{#4==0}{}{% + \xintifboolexpr{#4>0}{% + \xintifboolexpr{#2==0}{% + \xintifboolexpr{#3==0}{% + }{+}% + }{+}% + \xintifboolexpr{#4==1}{}{\num{#4}% + }% + }{% + \xintifboolexpr{#2==0}{% + \xintifboolexpr{#3==0}{% + \num{#4}% + }{-\num{\fpeval{abs(#4)% + }% + }% + }% + }{% + \xintifboolexpr{#4==-1}{-}{-\num{\fpeval{abs(#4)}}}}}% + \LETTRE^2}% }% }% @@ -17004,10 +17911,10 @@ couleur indiquée, le nombre de cases donné par le résultat du calcul. \end{multicols} }{\ifboolKV[ClesThales]{Figurecroisee}{% % \StrMid{#2}{1}{1}[\NomA]\StrMid{#2}{2}{2}[\NomB]\StrMid{#2}{3}{3}[\NomC]\StrMid{#2}{4}{4}[\NomM]\StrMid{#2}{5}{5}[\NomN] - \fbox{\begin{minipage}{0.4\linewidth}% + \begin{minipage}{0.4\linewidth}% {\em La figure est donn\'ee \`a titre indicatif.}% \[\MPFigReciThalesCroisee{\NomA}{\NomB}{\NomC}{\NomM}{\NomN}{\useKV[ClesThales]{Angle}}\]% - \end{minipage}} + \end{minipage} \hfill \begin{minipage}{0.55\linewidth}% \ReciThales[#1]{\StrMid{#2}{1}{1}}{\StrMid{#2}{2}{2}}{\StrMid{#2}{3}{3}}{\StrMid{#2}{4}{4}}{\StrMid{#2}{5}{5}}\par @@ -21943,7 +22850,7 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis %%% % Diff\'erentes représentations graphiques %%% -\setKVdefault[TraceG]{Grille=false,Graduations=false,PasGradX=1,PasGradY=1,PasGrilleX=1,PasGrilleY=1,Xmin=-5.5,Xmax=5.5,Xstep=1,Ymin=-5.5,Ymax=5.5,Ystep=1,Bornea=-5.5,Borneb=5.5,LabelX={},LabelY={},LabelC=0.5,NomCourbe={},Origine={(5.5,5.5)},Fonction=false,Points=false,Invisible=false,CouleurPoint=red,CouleurTrace=black,Epaisseur=1,Relie=false,RelieSegment=false,Marque=dot,Code=false,Vide=false}% +\setKVdefault[TraceG]{Grille=false,Graduations=false,PasGradX=1,PasGradY=1,PasGrilleX=1,PasGrilleY=1,Xmin=-5.5,Xmax=5.5,Xstep=1,Ymin=-5.5,Ymax=5.5,Ystep=1,Bornea=-5.5,Borneb=5.5,LabelX={},LabelY={},LabelC=0.5,NomCourbe={},Origine={(5.5,5.5)},Fonction=false,Points=false,Invisible=false,CouleurPoint=red,CouleurTrace=black,Epaisseur=1,Relie=false,RelieSegment=false,Marque=dot,Code=false,Vide=false,NbPointsCourbe=100}% \defKV[TraceG]{Traces=\setKV[TraceG]{Code}}% \newcommand\TraceGraphique[2][]{% @@ -22149,6 +23056,7 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis \begin{mplibcode} borneinf=\useKV[TraceG]{Bornea}; bornesup=\useKV[TraceG]{Borneb}; + nbpointsCourbe:=\useKV[TraceG]{NbPointsCourbe}; xmin=\useKV[TraceG]{Xmin}; xmax=\useKV[TraceG]{Xmax}; ymin=\useKV[TraceG]{Ymin}; @@ -22263,7 +23171,7 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis drawoptions(); if Vide: else: - draw courbe1(borneinf,bornesup,100)(#2) withpen (pencircle scaled Epaisseur) withcolor colortrace; + draw courbe1(borneinf,bornesup,nbpointsCourbe)(#2) withpen (pencircle scaled Epaisseur) withcolor colortrace; % labelisation numeric t; t=pos*length Cb1; @@ -22285,7 +23193,7 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis \usepackage{ProfCollege} \setKV[TraceG]{#1} } - \begin{mpost}[mpsettings={borneinf=\useKV[TraceG]{Bornea};bornesup=\useKV[TraceG]{Borneb};xmin=\useKV[TraceG]{Xmin};xmax=\useKV[TraceG]{Xmax};ymin=\useKV[TraceG]{Ymin};ymax=\useKV[TraceG]{Ymax};pasx=\useKV[TraceG]{Xstep};pasy=\useKV[TraceG]{Ystep};xu=1cm/\useKV[TraceG]{Xstep};yu=1cm/\useKV[TraceG]{Ystep};grillex=\useKV[TraceG]{PasGrilleX};grilley=\useKV[TraceG]{PasGrilleY};pos=\useKV[TraceG]{LabelC};Epaisseur=\useKV[TraceG]{Epaisseur}; color colortrace;colortrace=\useKV[TraceG]{CouleurTrace};boolean Grille,Vide;Grille=\useKV[TraceG]{Grille};Vide=\useKV[TraceG]{Vide};boolean Graduations;Graduations=\useKV[TraceG]{Graduations}; + \begin{mpost}[mpsettings={borneinf=\useKV[TraceG]{Bornea};bornesup=\useKV[TraceG]{Borneb};nbpointsCourbe:=\useKV[TraceG]{NbPointsCourbe};xmin=\useKV[TraceG]{Xmin};xmax=\useKV[TraceG]{Xmax};ymin=\useKV[TraceG]{Ymin};ymax=\useKV[TraceG]{Ymax};pasx=\useKV[TraceG]{Xstep};pasy=\useKV[TraceG]{Ystep};xu=1cm/\useKV[TraceG]{Xstep};yu=1cm/\useKV[TraceG]{Ystep};grillex=\useKV[TraceG]{PasGrilleX};grilley=\useKV[TraceG]{PasGrilleY};pos=\useKV[TraceG]{LabelC};Epaisseur=\useKV[TraceG]{Epaisseur}; color colortrace;colortrace=\useKV[TraceG]{CouleurTrace};boolean Grille,Vide;Grille=\useKV[TraceG]{Grille};Vide=\useKV[TraceG]{Vide};boolean Graduations;Graduations=\useKV[TraceG]{Graduations}; pair Origine; Origine=(xmin,ymin)+\useKV[TraceG]{Origine};}] @@ -22365,7 +23273,7 @@ Barre=false,Longueur=10cm,Hauteur=5mm,Bicolore=false,EcartBarre=0%Grille est dis drawoptions(); if Vide: else: - draw courbe1(borneinf,bornesup,100)(#2) withpen (pencircle scaled Epaisseur) withcolor colortrace; + draw courbe1(borneinf,bornesup,nbpointsCourbe)(#2) withpen (pencircle scaled Epaisseur) withcolor colortrace; % % labelisation numeric t; t=pos*length Cb1; @@ -23371,7 +24279,7 @@ u:=\useKV[ClesFormule]{Echelle}; {cube}{% \begin{center} \MPFigureCube\par - Volume d'une cube : $a^3\quad(a\times a\times a)$ + Volume d'un cube : $a^3\quad(a\times a\times a)$ \end{center} }% {pave}{% @@ -24990,46 +25898,67 @@ u:=\useKV[ClesFormule]{Echelle}; n:=0; for p_=t: n:=n+1; + if substring(1,2) of p_="*": + label.top(TEX(substring(2,length p_) of p_),unitp*(valeur[n],0)); + else: label.top(TEX(p_),unitp*(valeur[n],0)); + fi; + if p_<>"": pointe(unitp*(valeur[n],0)); + fi; endfor; fi; - if AffichageCoord=3: + % On ajoute une paramétrisation possible à chaque point. + if AffichageCoord>0: n:=0; for p_=t: n:=n+1; + if substring(1,2) of p_="*": + ACoord:=scantokens(substring(0,1) of p_); + if ACoord=3: + drawarrow (unitp*(valeur[n],-1))--(unitp*(valeur[n],-0.3)); + label.bot(btex \hbox to2em{\dotfill} etex,(unitp*(valeur[n],-1))); + pointe(unitp*(valeur[n]-ValeurOrigine,0)); + elseif ACoord=2: + if ((ValeurUnitex*valeur[n]) mod pasx)<>0: + label.bot(TEX("\footnotesize$\frac{\num{\fpeval{"&decimal(ValeurUnitex)&"*"&decimal(valeur[n])&"}}}{\num{"&decimal(pasx)&"}}$"),unitp*(valeur[n],0)); + else: + label.bot(TEX("\footnotesize\num{\fpeval{"&decimal(ValeurUnitex)&"*"&decimal(valeur[n])&"/"&decimal(pasx)&"}}"),unitp*(valeur[n],0)); + fi; + pointe(unitp*(valeur[n],0)); + elseif ACoord=1: + label.bot(TEX("\footnotesize\num{\fpeval{"&decimal(ValeurOrigine)&"+"&decimal(ValeurUnitex-(ValeurOrigine))&"*"&decimal(valeur[n])&"/"&decimal(pasx)&"}}"),unitp*(valeur[n],0)); + pointe(unitp*(valeur[n],0)); + fi; + else: + if AffichageCoord=3: if p_<>"": drawarrow (unitp*(valeur[n],-1))--(unitp*(valeur[n],-0.3)); - label.bot(btex \pointilles[2em] etex,(unitp*(valeur[n],-1))); + label.bot(btex \hbox to2em{\dotfill} etex,(unitp*(valeur[n],-1))); + pointe(unitp*(valeur[n],0)); fi; - endfor; elseif AffichageCoord=2: - n:=0; - for p_=t: - n:=n+1; if p_<>"": if ((ValeurUnitex*valeur[n]) mod pasx)<>0: - label.bot(TEX("\footnotesize$\frac{\num{\fpeval{"&decimal(ValeurOrigine*pasx)&"+"&decimal(ValeurUnitex-ValeurOrigine)&"*"&decimal(valeur[n])&"}}}{\num{"&decimal(pasx)&"}}$"),unitp*(valeur[n],0)); + label.bot(TEX("\footnotesize$\frac{\num{\fpeval{"&decimal(ValeurUnitex)&"*"&decimal(valeur[n])&"}}}{\num{"&decimal(pasx)&"}}$"),unitp*(valeur[n],0)); else: label.bot(TEX("\footnotesize\num{\fpeval{"&decimal(ValeurUnitex)&"*"&decimal(valeur[n])&"/"&decimal(pasx)&"}}"),unitp*(valeur[n],0)); fi; pointe(unitp*(valeur[n],0)); fi; - endfor; elseif AffichageCoord=1: - n:=0; - for p_=t: - n:=n+1; if p_<>"": - label.bot(TEX("\footnotesize\num{\fpeval{"&decimal(ValeurOrigine)&"+"&decimal(ValeurUnitex-ValeurOrigine)&"*"&decimal(valeur[n])&"/"&decimal(pasx)&"}}"),unitp*(valeur[n],0)); + label.bot(TEX("\footnotesize\num{\fpeval{"&decimal(ValeurOrigine)&"+"&decimal(ValeurUnitex-(ValeurOrigine))&"*"&decimal(valeur[n])&"/"&decimal(pasx)&"}}"),unitp*(valeur[n],0)); pointe(unitp*(valeur[n],0)); fi; + fi; + fi; endfor; fi; enddef; %---- tata(#2); - clip currentpicture to polygone(u*(-1,-1),((maxx+0.75)*unitp,-u),((maxx+0.75)*unitp,u),u*(-1,1)); +% clip currentpicture to polygone(u*(-1,-2),((maxx+0.75)*unitp,-2u),((maxx+0.75)*unitp,2u),u*(-1,2)); \end{mplibcode} \else \begin{mpost}[mpsettings={unitex:=\useKV[ClesReperage]{Unitex}*cm; pasx:=\useKV[ClesReperage]{Pasx}; unitp:=unitex/pasx; ValeurUnitex:=\useKV[ClesReperage]{ValeurUnitex}; ValeurOrigine:=\useKV[ClesReperage]{ValeurOrigine}; AffichageGrad:=\AffichageGrad; AffichageCoord:=\useKV[ClesReperage]{AffichageAbs}; AffichageNom:=\AffichageNom;}] @@ -26293,7 +27222,7 @@ label.lft(LATEX("\noexpand\footnotesize\noexpand\SI{\noexpand\fpeval{"&decimal(V %%% % Tableaux d'unit\'es %%% -\setKVdefault[ClesTableaux]{Virgule=true,Incline=false,Entiers=false,Decimaux=false,Milliards=false,Millions=false,Micro=false,Nano=false,Partie=false,CouleurG=gray!15,CouleurM=gray!15,Couleurm=gray!15,Couleuru=gray!15,Couleurd=gray!15,Classes=false,Nombres=false,Puissances=false,NbLignes=2,Metre=false,Are=false,Capacite=false,Carre=false,Cube=false,Litre=false,Gramme=false,Fleches=false,FlechesB=false,FlechesH=false,Colonnes=false,Prefixes=false,Escalier=false,Taille=5,Largeur=4.75em,Nom=PfCTableau,CodeAfter={},PuissancesSeules=false,Colonne=-1} +\setKVdefault[ClesTableaux]{Virgule=true,Incline=false,Entiers=false,Decimaux=false,Milliards=false,Millions=false,Micro=false,Nano=false,Partie=false,CouleurG=gray!15,CouleurM=gray!15,Couleurm=gray!15,Couleuru=gray!15,Couleurd=gray!15,Classes=false,Nombres=false,Puissances=false,NbLignes=2,Metre=false,Are=false,Capacite=false,Carre=false,Cube=false,Litre=false,Gramme=false,Fleches=false,FlechesB=false,FlechesH=false,Colonnes=false,Prefixes=false,Escalier=false,Taille=5,Largeur=4.75em,Nom=PfCTableau,CodeAfter={},PuissancesSeules=false,Colonne=-1,Octet=false} \newcommand\PfCTBstrut{\rule[-1.2ex]{0pt}{3.8ex}}% Top and Bottom strut \newcommand\PfCTstrut{\rule{0pt}{3.8ex}}% Top strut @@ -26323,6 +27252,74 @@ label.lft(LATEX("\noexpand\footnotesize\noexpand\SI{\noexpand\fpeval{"&decimal(V }{}% \PfCTableauIncline% }{% + % + %%% Clé Octet + % + \ifboolKV[ClesTableaux]{Octet}{% + \[\renewcommand{\arraystretch}{1.15}% + \setlength{\tabcolsep}{0.275\tabcolsep}% + \xdef\DecalageLigne{0} + \begin{NiceTabular}{*{5}{wc{15pt}wc{15pt}wc{15pt}}} + \Block[]{1-3}{}% + &&&\Block[]{1-3}{}% + &&&\Block[]{1-3}{}% + &&&\Block[]{1-3}{}% + &&&\Block[]{1-3}{}\\ + \hline + \ifboolKV[ClesTableaux]{Classes}{% + \xdef\DecalageLigne{\fpeval{\DecalageLigne+1}}\Block[borders={left,top,right}]{1-3}{téraoctet\PfCTBstrut}&&&\Block[borders={top,right}]{1-3}{gigaoctet\PfCTBstrut}&&&\Block[borders={top,right}]{1-3}{mégaoctet\PfCTBstrut}&&&\Block[borders={top,right}]{1-3}{kilooctet\PfCTBstrut}&&&\Block[borders={top,right}]{1-3}{octet\PfCTBstrut}&&\\ + \hline + }{}% + \Block[borders={left,top,right}]{1-3}{To\PfCTBstrut}&&&\Block[borders={top,right}]{1-3}{Go\PfCTBstrut}&&&\Block[borders={top,right}]{1-3}{Mo\PfCTBstrut}&&&\Block[borders={top,right}]{1-3}{ko\PfCTBstrut}&&&\Block[borders={top,right}]{1-3}{o\PfCTBstrut}&&\\ + \hline + \xintFor* ##1 in {\xintSeq{1}{\useKV[ClesTableaux]{NbLignes}}}\do{% + &&&&&&&&&&&&&&\\ + }% + \Block[]{1-3}{}% + &&&\Block[]{1-3}{}% + &&&\Block[]{1-3}{}% + &&&\Block[]{1-3}{}% + &&&\Block[]{1-3}{}\\ + \CodeAfter + % on trace les lignes verticales + \xintFor* ##1 in {\xintSeq{1}{6}}\do{% + \tikz\draw (3-|\fpeval{3*(##1-1)+1})--(\fpeval{3+\useKV[ClesTableaux]{NbLignes}}-|\fpeval{3*(##1-1)+1}); + }% + \xintifboolexpr{\useKV[ClesTableaux]{Colonnes}}{% + \xintFor* ##1 in {\xintSeq{1}{5}}\do{% + \tikz\draw[gray!50] (3-|\fpeval{3*(##1-1)+2})--(\fpeval{3+\useKV[ClesTableaux]{NbLignes}}-|\fpeval{3*(##1-1)+2}); + \tikz\draw[gray!50] (3-|\fpeval{3*##1})--(\fpeval{3+\useKV[ClesTableaux]{NbLignes}}-|\fpeval{3*##1}); + }% + }{}% + % On place le nombre éventuel + \ifx\bla#2\bla% + \else% + \setsepchar[*]{,*/} + \readlist*\ListeNombreAPlacer{#2}% + \xintFor* ##2 in{\xintSeq {1}{\ListeNombreAPlacerlen}}\do{% + \StrLen{\ListeNombreAPlacer[##2,1]}[\TabLongueurNombre]% + \xintFor* ##1 in{\xintSeq {1}{\TabLongueurNombre}}\do{% + \tikz\node at (\fpeval{\DecalageLigne+##2+2.5}-|\fpeval{\ListeNombreAPlacer[##2,2]-0.5+##1}) {\PfCTBstrut\StrMid{\ListeNombreAPlacer[##2,1]}{##1}{##1}};% + }% + }% + \fi% + % on trace les flèches + \ifboolKV[ClesTableaux]{Fleches}{\setKV[ClesTableaux]{FlechesH,FlechesB}}{}% + \ifboolKV[ClesTableaux]{FlechesH}{% + \xintFor* ##1 in {\xintSeq{1}{4}}\do{% + \tikz\draw[gray,->,>=latex,out=30,in=150] (1.5-|\fpeval{2.5+3*(##1-1)}) to node[above, midway]{\small$\times\num{1000}$}(1.5-|\fpeval{2.5+3*##1});% + }% + }{}% + \ifboolKV[ClesTableaux]{Classes}{\xdef\PfCTableauDepart{4}}{\xdef\PfCTableauDepart{3}}% + \ifboolKV[ClesTableaux]{FlechesB}{% + \xintFor* ##1 in {\xintSeq{1}{4}}\do{% + \tikz\draw[gray,->,>=latex,out=-150,in=-30] (\fpeval{\PfCTableauDepart+\useKV[ClesTableaux]{NbLignes}+0.5}-|\fpeval{2.5+3*##1}) to node[below,midway]{\small$\div\num{1000}$}(\fpeval{\PfCTableauDepart+\useKV[ClesTableaux]{NbLignes}+0.5}-|\fpeval{2.5+3*(##1-1)});% + }% + }{}% + \useKV[ClesTableaux]{CodeAfter}% + \end{NiceTabular} + \]% + }{}% % %%% Cl\'e Prefixes % @@ -27308,7 +28305,6 @@ label.lft(LATEX("\noexpand\footnotesize\noexpand\SI{\noexpand\fpeval{"&decimal(V \]% }% {}% - % %%% Prise en compte de la cl\'e Carre % @@ -27653,14 +28649,27 @@ label.lft(LATEX("\noexpand\footnotesize\noexpand\SI{\noexpand\fpeval{"&decimal(V colbacktitle=TrameCouleur,% } +\makeatletter \newtcolorbox{MyboxJQ}[2]{% - enhanced, - nobeforeafter, - left=0pt,right=0pt,top=0pt, - text fill, - width=\largeurcarte, - height=\hauteurcarte, - arc=5pt, + enhanced,% + nobeforeafter,% + left=0pt,right=0pt,top=0pt,% + text fill,% + width=\largeurcarte,% + height=\hauteurcarte,% + arc=5pt,% + underlay={% + \ifboolKV[Cards]{BackgroundAv}{% + \begin{tcbclipinterior} + \node[anchor=center,opacity=1] + at (interior.center) {% + \includegraphics[% + height=\tcb@height, + width=\tcb@width, + ]{\useKV[Cards]{ImageAv}}};% + \end{tcbclipinterior}% + }{}% + },% overlay unbroken and first={% \coordinate[yshift=-0.5\hauteurtitre] (A1) at (frame.north west); \coordinate[yshift=0\hauteurtitre] (S3) at (frame.center); @@ -27681,10 +28690,32 @@ label.lft(LATEX("\noexpand\footnotesize\noexpand\SI{\noexpand\fpeval{"&decimal(V \end{center}% \end{minipage}}; }, - colback=white, + colback=white } - -\usetikzlibrary{backgrounds} +% +\newtcolorbox{MyboxJQAr}{% + enhanced,% + nobeforeafter,% + left=0pt,right=0pt,top=0pt,% + text fill,% + width=\largeurcarte,% + height=\hauteurcarte,% + arc=5pt,% + underlay={% + \ifboolKV[Cards]{BackgroundAv}{% + \begin{tcbclipinterior} + \node[anchor=center,opacity=1] + at (interior.center) {% + \includegraphics[% + height=\tcb@height, + width=\tcb@width, + ]{\useKV[Cards]{ImageAr}}};% + \end{tcbclipinterior}% + }{}% + },% + colback=white +} +\makeatother \makeatletter %https://tex.stackexchange.com/questions/347434/clip-background-image-inside-tcolorbox @@ -27706,7 +28737,7 @@ label.lft(LATEX("\noexpand\footnotesize\noexpand\SI{\noexpand\fpeval{"&decimal(V height=\tcb@height, width=\tcb@width, ]{\useKV[Cards]{ImageAv}}};% - \end{tcbclipinterior},% + \end{tcbclipinterior}% }{}% },% overlay unbroken and first={% @@ -27775,7 +28806,8 @@ label.lft(LATEX("\noexpand\footnotesize\noexpand\SI{\noexpand\fpeval{"&decimal(V \newlength{\margeh}% \newlength{\margev}% -\NewEnviron{Trame}{% +% \NewEnviron{Trame}{% +\NewDocumentEnvironment{Trame}{+b}{% \begin{tikzpicture}[remember picture,overlay] % quadrillages horizontal et vertical \coordinate[yshift=-\margev] (A) at (current page.north west);% @@ -27796,11 +28828,11 @@ label.lft(LATEX("\noexpand\footnotesize\noexpand\SI{\noexpand\fpeval{"&decimal(V \coordinate[xshift=\largeurcards] (D2) at (D1);% \coordinate[xshift=\largeurcards] (C3) at (C2);% \coordinate[xshift=\largeurcards] (D3) at (D2);% - \draw (A) -- (B);% - \draw (A1) -- (B1);% - \draw (A2) -- (B2);% - \draw (A3) -- (B3);% - \draw (A4) -- (B4);% + \draw (A)--(B);% + \draw (A1)--(B1);% + \draw (A2)--(B2);% + \draw (A3)--(B3);% + \draw (A4)--(B4);% \draw (C)--(D);% \draw (C1)--(D1);% \draw (C2)--(D2);% @@ -27815,7 +28847,7 @@ label.lft(LATEX("\noexpand\footnotesize\noexpand\SI{\noexpand\fpeval{"&decimal(V \coordinate[xshift=0mm,yshift=-\hauteurcards] (Carte7) at (Carte4);% \coordinate[xshift=0mm,yshift=-\hauteurcards] (Carte8) at (Carte5);% \coordinate[xshift=0mm,yshift=-\hauteurcards] (Carte9) at (Carte6);% - \BODY% + #1% \end{tikzpicture}% }% @@ -27825,11 +28857,12 @@ label.lft(LATEX("\noexpand\footnotesize\noexpand\SI{\noexpand\fpeval{"&decimal(V Trivial=false,Symboles={\faInfinity,\faSignal,\faProjectDiagram,\faHiking,\faRuler,\faLockOpen} }% -\newcommand\Cartes[2][]{% +\NewDocumentCommand\Cartes{o +m}{%[2][]{% \useKVdefault[Cards]% \setKV[Cards]{#1}% \setsepchar[*]{§*/}% \readlist*\ListeCards{#2}% + \setsepchar{,}% \ifboolKV[Cards]{Landscape}{% \setlength{\hauteurcarte}{\fpeval{\useKV[Cards]{Largeur}-\useKV[Cards]{Marge}}mm}% \setlength{\largeurcarte}{\fpeval{\useKV[Cards]{Hauteur}-\useKV[Cards]{Marge}}mm}% @@ -27856,17 +28889,17 @@ label.lft(LATEX("\noexpand\footnotesize\noexpand\SI{\noexpand\fpeval{"&decimal(V \ifboolKV[Cards]{Trame}{% \clearpage% \thispagestyle{empty}% - \begin{Trame} + \begin{Trame}% \multido{\i=1+1}{9}{% \node[] at (Carte\i) {% \begin{MyboxTrivial}% \begin{center} - \begin{NiceTabular}[width=0.9\largeurcarte]{X[1,m]X[9,m]}[hvlines] + \begin{NiceTabular}[width=0.9\largeurcarte]{X[1,m]X[9,m]}[hvlines]% \xintFor* ##1 in{\xintSeq{1}{6}}\do{% \rule{0pt}{0.12\hauteurcards}\Block{1-1}{\ListeSymbolesTrivial[##1]}&\ListeCards[\i,\fpeval{1+2*(##1-1)}]\\ }% - \end{NiceTabular} - \end{center} + \end{NiceTabular}% + \end{center}% \end{MyboxTrivial}% };% }% @@ -27874,43 +28907,43 @@ label.lft(LATEX("\noexpand\footnotesize\noexpand\SI{\noexpand\fpeval{"&decimal(V \ifboolKV[Cards]{AffichageSolution}{% \clearpage% \thispagestyle{empty}% - \begin{Trame} + \begin{Trame}% \multido{\i=1+1}{3}{% \node at (Carte\i) {% \begin{MyboxTrivial}% - \begin{center} - \begin{NiceTabular}[width=0.9\largeurcarte]{X[1,m]X[10,m]}[hvlines] + \begin{center}% + \begin{NiceTabular}[width=0.9\largeurcarte]{X[1,m]X[10,m]}[hvlines]% \xintFor* ##1 in{\xintSeq{1}{6}}\do{% \rule{0pt}{0.12\hauteurcards}\Block{1-1}{\ListeSymbolesTrivial[##1]}&\ListeCards[\fpeval{4-\i},\fpeval{2*##1}]\\ }% - \end{NiceTabular} - \end{center} + \end{NiceTabular}% + \end{center}% \end{MyboxTrivial}% };% }% \multido{\i=4+1}{3}{% \node at (Carte\i) {% \begin{MyboxTrivial}% - \begin{center} - \begin{NiceTabular}[width=0.9\largeurcarte]{X[1,m]X[10,m]}[hvlines] + \begin{center}% + \begin{NiceTabular}[width=0.9\largeurcarte]{X[1,m]X[10,m]}[hvlines]% \xintFor* ##1 in{\xintSeq{1}{6}}\do{% \rule{0pt}{0.12\hauteurcards}\Block{1-1}{\ListeSymbolesTrivial[##1]}&\ListeCards[\fpeval{10-\i},\fpeval{2*##1}]\\ }% - \end{NiceTabular} - \end{center} + \end{NiceTabular}% + \end{center}% \end{MyboxTrivial}% };% }% \multido{\i=7+1}{3}{% \node at (Carte\i) {% - \begin{MyboxTrivial} - \begin{center} - \begin{NiceTabular}[width=0.9\largeurcarte]{X[1,m]X[10,m]}[hvlines] + \begin{MyboxTrivial}% + \begin{center}% + \begin{NiceTabular}[width=0.9\largeurcarte]{X[1,m]X[10,m]}[hvlines]% \xintFor* ##1 in{\xintSeq{1}{6}}\do{% \rule{0pt}{0.12\hauteurcards}\Block{1-1}{\ListeSymbolesTrivial[##1]}&\ListeCards[\fpeval{16-\i},\fpeval{2*##1}]\\ }% - \end{NiceTabular} - \end{center} + \end{NiceTabular}% + \end{center}% \end{MyboxTrivial}% };% }% @@ -27919,23 +28952,23 @@ label.lft(LATEX("\noexpand\footnotesize\noexpand\SI{\noexpand\fpeval{"&decimal(V }{}% }{% \begin{MyboxTrivial}% - \begin{center} - \begin{NiceTabular}[width=0.9\largeurcarte]{X[1,m]X[10,m]}[hvlines] + \begin{center}% + \begin{NiceTabular}[width=0.9\largeurcarte]{X[1,m]X[10,m]}[hvlines]% \xintFor* ##1 in{\xintSeq{1}{6}}\do{% \rule{0pt}{0.12\hauteurcards}\Block{1-1}{\ListeSymbolesTrivial[##1]}&\ListeCards[1,\fpeval{1+2*(##1-1)}]\\ }% - \end{NiceTabular} - \end{center} + \end{NiceTabular}% + \end{center}% \end{MyboxTrivial}% \ifboolKV[Cards]{AffichageSolution}{% \begin{MyboxTrivial}% - \begin{center} - \begin{NiceTabular}[width=0.9\largeurcarte]{X[1,m]X[10,m]}[hvlines] + \begin{center}% + \begin{NiceTabular}[width=0.9\largeurcarte]{X[1,m]X[10,m]}[hvlines]% \xintFor* ##1 in{\xintSeq{1}{6}}\do{% \rule{0pt}{0.12\hauteurcards}\Block{1-1}{\ListeSymbolesTrivial[##1]}&\ListeCards[1,\fpeval{2*##1}]\\ }% - \end{NiceTabular} - \end{center} + \end{NiceTabular}% + \end{center}% \end{MyboxTrivial}% }{}% }% @@ -27945,7 +28978,7 @@ label.lft(LATEX("\noexpand\footnotesize\noexpand\SI{\noexpand\fpeval{"&decimal(V \ifboolKV[Cards]{Trame}{% \clearpage% \thispagestyle{empty}% - \begin{Trame} + \begin{Trame}% \multido{\i=1+1}{9}{% \node at (Carte\i) {% \begin{MyboxJQ}{\ListeCards[\i,1]}{\ListeCards[\i,2]}% @@ -27955,10 +28988,34 @@ label.lft(LATEX("\noexpand\footnotesize\noexpand\SI{\noexpand\fpeval{"&decimal(V }% \end{Trame}% \clearpage% + \ifboolKV[Cards]{AffichageSolution}{% + \thispagestyle{empty}% + \begin{Trame} + \multido{\i=1+1}{3}{% + \node at (Carte\i) {% + \begin{MyboxJQAr}% + \end{MyboxJQAr}% + };% + }% + \multido{\i=4+1}{3}{% + \node at (Carte\i) {% + \begin{MyboxJQAr}% + \end{MyboxJQAr}% + };% + }% + \multido{\i=7+1}{3}{% + \node at (Carte\i) {% + \begin{MyboxJQAr}% + \end{MyboxJQAr}% + };% + }% + \end{Trame}% + \clearpage% + }{}% }{% - \begin{MyboxJQ}{\ListeCards[1,1]}{\ListeCards[1,2]}% + \begin{MyboxJQAr}% %% - \end{MyboxJQ}% + \end{MyboxJQAr}% }% }{% \ifboolKV[Cards]{Loop}{% |