From 32d0b3285fe157a86330df36bb2edec3e8ed7340 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 28 Jul 2017 21:45:33 +0000 Subject: scratchx (28jul17) git-svn-id: svn://tug.org/texlive/trunk@44906 c570f23f-e606-0410-a88d-b1316a301751 --- .../doc/latex/scratchx/Explanations_ScratchX.pdf | Bin 0 -> 224175 bytes .../doc/latex/scratchx/Explanations_ScratchX.tex | 1098 +++++++++++++++++++ .../doc/latex/scratchx/Explications_ScratchX.pdf | Bin 0 -> 226721 bytes .../doc/latex/scratchx/Explications_ScratchX.tex | 1102 ++++++++++++++++++++ Master/texmf-dist/doc/latex/scratchx/README.txt | 23 + Master/texmf-dist/tex/latex/scratchx/ScratchX.sty | 737 +++++++++++++ Master/tlpkg/bin/tlpkg-ctan-check | 3 +- Master/tlpkg/tlpsrc/collection-mathscience.tlpsrc | 3 +- Master/tlpkg/tlpsrc/scratchx.tlpsrc | 0 9 files changed, 2964 insertions(+), 2 deletions(-) create mode 100644 Master/texmf-dist/doc/latex/scratchx/Explanations_ScratchX.pdf create mode 100644 Master/texmf-dist/doc/latex/scratchx/Explanations_ScratchX.tex create mode 100644 Master/texmf-dist/doc/latex/scratchx/Explications_ScratchX.pdf create mode 100644 Master/texmf-dist/doc/latex/scratchx/Explications_ScratchX.tex create mode 100644 Master/texmf-dist/doc/latex/scratchx/README.txt create mode 100644 Master/texmf-dist/tex/latex/scratchx/ScratchX.sty create mode 100644 Master/tlpkg/tlpsrc/scratchx.tlpsrc (limited to 'Master') diff --git a/Master/texmf-dist/doc/latex/scratchx/Explanations_ScratchX.pdf b/Master/texmf-dist/doc/latex/scratchx/Explanations_ScratchX.pdf new file mode 100644 index 00000000000..139d0172b60 Binary files /dev/null and b/Master/texmf-dist/doc/latex/scratchx/Explanations_ScratchX.pdf differ diff --git a/Master/texmf-dist/doc/latex/scratchx/Explanations_ScratchX.tex b/Master/texmf-dist/doc/latex/scratchx/Explanations_ScratchX.tex new file mode 100644 index 00000000000..6630e6c6236 --- /dev/null +++ b/Master/texmf-dist/doc/latex/scratchx/Explanations_ScratchX.tex @@ -0,0 +1,1098 @@ +\documentclass[a4paper,11pt]{article} +\usepackage{array} +\usepackage{multirow} +\usepackage{lastpage} +\usepackage{verbatim} +\usepackage[francais,english]{babel} +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{tikz} +\usetikzlibrary{calc} +\usepackage{amsfonts,amsmath,amssymb,mathrsfs,amsthm} +\usepackage{fancyhdr} +\usepackage{lmodern} +\usepackage{ScratchX} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%----------------------------------- SI ALORS TOUTE BLANCHE----------------------------------------------------------- +\newcommand{\whitesailors}[2]{%loop with as many blocks as we want + % Créer un compteur à chaque passage dans cette boucle. % l'incrémenter du nombre de fois où ce décalage s'opère + % décaler en abscisse : ajouter 0,4 à x % mettre le compteur NbreComptr à NbreComptr+1 +\ifthenelse{\value{NbrCptrLoupeDuplicate}=0}%aucun compteurs loupe créés + { + \ifthenelse{\value{CompteurMax}=0} + {\loope{\theNbrCptrLoupe}{#2}} + { + \ifthenelse{\value{NbrCptrLoupe}<\value{CompteurMax}}%\or\value{NbrCptrLoupe}=\value{CompteurMax}} + {\looope{\theNbrCptrLoupe}{#2}} + {\loope{\theNbrCptrLoupe}{#2}}%pour ne pas recréer des compteurs déjà créés + } + } + {\looope{\theNbrCptrLoupe}{#2}} + +\ifthenelse{\value{NbrCptrAlorsDuplicate}=0}%aucun compteurs aloors créés + {\sialoors{#1}} + {\sialooors{#1}}%pour ne pas recréer des compteurs déjà créés +\settowidth{\malongueuR}{\pgfinterruptpicture #1 \endpgfinterruptpicture} + + \FPeval{X}{\x+(0.4)*\thedecalageX} + \FPeval{Y}{\y+(neg 0.66)*(\thedecalageY)} + + %\StrLen{#1}[\valeur]% pour ajuster la longueur de la boîte en fonction de la longueur du text + \FPeval{b}{neg 0.1+Y}\FPeval{c}{0.36+Y}\FPeval{d}{0.1+X} + \FPeval{e}{0.46+Y}\FPeval{f}{0.4+X}\FPeval{g}{0.5+X}\FPeval{h}{0.7+X}\FPeval{i}{0.8+X}\FPeval{j}{0.7+(X)} + \FPeval{ii}{1.2+X}\FPeval{iii}{1.1+X}\FPeval{iiii}{0.9+X}\FPeval{gg}{0.6+X} + \FPeval{l}{neg 0.2+(Y)}\FPeval{m}{neg 0.3+(Y)}\FPeval{o}{0.1+(Y)} + %top + %bottom#1 + \FPeval{mm}{neg 0.1+(neg 0.66)*(#2)+(Y)} + \FPeval{mmm}{neg 0.2+(neg 0.66)*(#2)+(Y)}\FPeval{mmmm}{neg 0.3+(neg 0.66)*(#2)+(Y)}\FPeval{M}{neg 0.75+(neg 0.66)*(#2)+(Y)}\FPeval{MM}{neg 0.85+(neg 0.66)*(#2)+(Y)}\FPeval{MN}{neg 0.95+(neg 0.66)*(#2)+(Y)}\FPeval{MMM}{neg 0.55+(neg 0.66)*(#2)+(Y)}\FPeval{MMMM}{MMM-0.02}\FPeval{JJ}{j+0.02}%adjusting the height of the bottom + \coordinate (A) at ($(\d,\e) ! \malongueuR ! (\f,\e)$); + \coordinate (AA) at ($(\X,\c) ! \malongueuR+0.2cm ! (\g,\c)$); + \coordinate (BB) at ($(\X,\M) ! \malongueuR+0.2cm ! (\f,\M)$); + \coordinate (B) at ($(\g,\mmm) ! \malongueuR-0.4cm ! (\i,\mmm)$); + +\multido{\i=1+1}{\value{NbrCptrLoupe}}{%Fait défiler tous les compteurs jusqu'au nombre de compteurs : si compteur différent de -1 : + % si différent de 0, leur enlever 1. / si égal à 0 : enlever 1 à décalageX et mettre le compteur correspondant à -1. + \ifthenelse{\value{loupe\i}>-1}{ + \ifthenelse{\value{loupe\i}=0} + {\addtocounter{decalageX}{-1}\addtocounter{decalageY}{1}\setcounter{loupe\i}{-1}} + {\addtocounter{loupe\i}{-1}} + }{} + } +\addtocounter{decalageX}{1} +\addtocounter{decalageY}{1} +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{document} +\selectlanguage{english} +\pagestyle{fancy} +\fancyhead{} + \fancyhead[LE,LO]{\em \LaTeX} + \fancyhead[CE,CO]{\Large \textsc{The \texttt{ScratchX.sty} package}} + \fancyhead[RE,RO]{\em 2016--2017} + \fancyfoot[CE,CO]{\thepage /\pageref{LastPage}} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%----------------------------------------------------------------------------------------------------------------------------------% +%----------------------------------------------------------------------------------------------------------------------------------% +\section*{ +\centering{ + \begin{Scratch} + \beginbox{User guide: package \cb[ope]{ScratchX.sty\ }} + \end{Scratch} + } +} +\begin{center} +\begin{Scratch} +\scbox{Thibault Ralet}{ctrl} +\scbox{March \rb{2017}}{data} +\end{Scratch} +\end{center} + +\noindent\rule{\linewidth}{.5pt} + + +\parbox{1ex}{\Scratchy[0.1][0.1]}\\ + +\hspace{1cm}\parbox{1ex}{\Scratchy[0.2][0.2]}\\ + +\hspace{2cm}\parbox{1ex}{\Scratchy[0.5][1]}\\ + +\hspace{5cm}\parbox{1ex}{\Scratchy[0.75][1.5]}\\ + +%----------------------------------------------------------------------------------------------------------------------------------% +%----------------------------------------------------------------------------------------------------------------------------------% +\section{Introduction} +The \texttt{ScratchX.sty} package allows you to write any kind of Scratch program in \LaTeX. + +The \texttt{ScratchX.sty} package has to be put at least in the same file where the document \texttt{.tex} is created, or in the dedicated place in your computer. + +The \texttt{ScratchX.sty} package must be called in the preamble of the document \texttt{.tex} with: + +\begin{verbatim} \usepackage{ScratchX} \end{verbatim} + +The \texttt{ScratchX.sty} package uses the following packages: +\begin{verbatim} +\usepackage[nomessages]{fp} +\usepackage{calc} +\usepackage{xstring} +\usepackage[alpine]{ifsym}%pour avoir VarFlag comme +%drapeau de départ de Scratch +\usepackage{ifthen} +\usepackage{multido} +\usepackage{xargs} +\end{verbatim} + +In the document \texttt{.tex} that you want to create, you need to load: +\begin{verbatim} +\usepackage{tikz} +\usetikzlibrary{calc} +\end{verbatim} +and also: +\begin{verbatim} +\usepackage{amssymb} +\end{verbatim} + +You can compile with XeLaTeX or pdfLaTeX. + +\newpage +%----------------------------------------------------------------------------------------------------------------------------------% +%----------------------------------------------------------------------------------------------------------------------------------% +\section{General description} + +We write a program (or simply a command) Scratch with the environment: + +\begin{verbatim} +\begin{Scratch} +%\LaTeX commands in order to create the Scratch commands +\end{Scratch} +\end{verbatim} + +The command \texttt{\textbackslash begin\{Scratch\}} has the scale in option (1 by default). + +Thus,\texttt{\textbackslash begin\{Scratch\}[2]} doubles the program size, whereas \texttt{\textbackslash begin\{Scratch\}[0.7]} reduces by 70\% the size of the created program. + +\begin{center} +\begin{tabular}{cc} + +\begin{Scratch}[1] +\scbox{default size}{app} +\end{Scratch} +& +\begin{Scratch}[2] +\scbox{bigger}{app} +\end{Scratch}\\ +& +\begin{Scratch}[0.7] +\scbox{smaller}{app} +\end{Scratch} +\end{tabular} +\end{center} + +%----------------------------------------------------------------------------------------------------------------------------------% +\subsection*{The colors} +The ten specific Scratch colors are defined like this: +\begin{center} +\begin{tabular}{c@{:\quad}cp{1cm}c@{:\quad }c}\hline +mvt&\textcolor{mvt}{Motion}&&evt&\textcolor{evt}{Events}\\ +app&\textcolor{app}{Looks}&&ctrl&\textcolor{ctrl}{Control}\\ +son&\textcolor{son}{Sound}&&capt&\textcolor{capt}{Sensing}\\ +stylo&\textcolor{stylo}{Pen}&&ope&\textcolor{ope}{Operators}\\ +data&\textcolor{data}{Data}&&bloc&\textcolor{bloc}{More blocks}\\\hline +\end{tabular} +\end{center} + +\newpage +%----------------------------------------------------------------------------------------------------------------------------------% +%----------------------------------------------------------------------------------------------------------------------------------% +\section{Command list} + +%----------------------------------------------------------------------------------------------------------------------------------% +\subsection{Simples} +Obtained with \texttt{\textbackslash scbox\{\}\{\}}. + +Typing: +\begin{verbatim} +\begin{Scratch} +\scbox{if on edge, bounce}{mvt} +\scbox{hide}{app} +\scbox{stop all sounds}{son} +\scbox{pen down}{stylo} +\scbox{reset timer}{capt} +\end{Scratch} +\end{verbatim} + +you get:\\ + +\begin{Scratch} +\scbox{if on edge, bounce}{mvt} +\scbox{hide}{app} +\scbox{stop all sounds}{son} +\scbox{pen down}{stylo} +\scbox{reset timer}{capt} +\end{Scratch} + +%----------------------------------------------------------------------------------------------------------------------------------% +\subsection{Specials} + +\subsubsection{Events}%%%%%%%%%%%%%%%%%%%%%%%% +Obtained with \texttt{\textbackslash beginbox\{\}}. + +\texttt{\textbackslash beginbox\{\}} gives \parbox{1ex}{\begin{Scratch}\beginbox{}\end{Scratch}} + +\texttt{\textbackslash beginbox\{clone\}} gives \parbox{1ex}{\begin{Scratch}\beginbox{clone}\end{Scratch}} + +\texttt{\textbackslash beginbox\{when this sprite clicked\}} gives + +\hfill\parbox{6cm}{\begin{Scratch}\beginbox{when this sprite clicked}\end{Scratch}} + +\subsubsection{Turn}%%%%%%%%%%%%%%%%%%%%%%%% +Obtained with \texttt{\textbackslash turnbox\{\}\{\}}.\\ + +\texttt{\textbackslash turnbox\{\}\{-145\}} gives \raisebox{-3mm}{\begin{Scratch}\turnbox{}{-145}\end{Scratch}} + +\texttt{\textbackslash turnbox\{gauche\}\{30\}} gives \raisebox{-3mm}{\begin{Scratch}\turnbox{gauche}{30}\end{Scratch}} + +You can also write \texttt{\textbackslash turnbox\{g\}\{30\}} or \texttt{\textbackslash turnbox\{G\}\{30\}}. + +\subsubsection{Loops}%%%%%%%%%%%%%%%%%%%%%%%% +Obtained with + +\texttt{\textbackslash boucle\{\}\{\}\{\}}, + +where is an integer which can be equal to 1 (\emph{repeat $x$ times} or \emph{repeat until}) or -1 (\emph{forever loop}).\\ + +\parbox{0.53\linewidth}{\texttt{\textbackslash boucle\{repeat \$x\$ times\}\{2\}\{1\}} +\par +\texttt{\textbackslash scbox\{two blocks\}\{red\}} +\par +\texttt{\textbackslash scbox\{in the loop\}\{gray\}} +} +\parbox{0.12\linewidth}{makes} +\parbox{0.2\linewidth}{\raisebox{-3mm}{ +\begin{Scratch}[0.9] +\boucle{repeat $x$ times}{2}{1} +\scbox{two blocks}{red} +\scbox{in the loop}{gray} +\end{Scratch}}} + +\begin{center} +\begin{tabular}{lcr} +\texttt{\textbackslash boucle\{forever loop\}\{3\}\{-1\}}&&\multirow{3}{*}{\begin{Scratch}[0.9] +\boucle{forever loop}{3}{-1} +\scbox{this time}{pink} +\scbox{three blocks}{blue} +\scbox{in the loop}{purple} +\end{Scratch}}\\ +\texttt{\textbackslash scbox\{this time\}\{pink\}}&&\\ +\texttt{\textbackslash scbox\{three blocks\}\{blue\}}&&\\ +\texttt{\textbackslash scbox\{in the loop\}\{purple\}}&&\\ +&&\\ +&&\\ +\end{tabular}\end{center} + +\emph{Notice that if you want to put a loop into another loop, you have to count the correct number of blocks inside the main loop. Actually, a loop counts for two blocks (without the inside blocks).} + +\subsubsection{If \dots\ Then}%%%%%%%%%%%%%%%%%%%%%%%% + +\emph{Notice that you get this command with the same syntax seen above. Actually:} + +\texttt{\textbackslash boucle\{\}\{\}\{2\}}.\\ + +\parbox{0.53\linewidth}{\texttt{\textbackslash boucle\{if 4 > 5 then\}\{1\}\{2\}} +\par +\texttt{\textbackslash scbox\{problem!\}\{app\}} +} +\parbox{0.12\linewidth}{produit} +\parbox{0.2\linewidth}{\raisebox{-3mm}{ +\begin{Scratch}[0.9] +\boucle{if 4 > 5 then}{1}{2} +\scbox{problem!}{app} +\end{Scratch}}} + +Remark: in order to properly type the \emph{if\dots then} test, see \emph{the small boxes} in section 3.3. + +\subsubsection{If \dots\ Then \dots\ Else}%%%%%%%%%%%%%%%%%%%%%%%% +Obtained with + +\texttt{\textbackslash sailors\{\}\{\}} + +et + +\texttt{\textbackslash simenon\{\}}.\\ + +Typing: +\begin{verbatim} +\begin{Scratch} +\sailors{if it's an understandable example}{1} +\scbox{then it's all right}{app} +\simenon{2} +\scbox{don't panick}{stylo} +\scbox{see the section \emph{Examples}}{capt} +\end{Scratch} +\end{verbatim} + +you get:\\ + +\begin{Scratch} +\sailors{if it's an understandable example}{1} +\scbox{then it's all right}{app} +\simenon{2} +\scbox{don't panick}{stylo} +\scbox{see the section \emph{Examples}}{capt} +\end{Scratch} + +\subsubsection{More blocks}%%%%%%%%%%%%%%%%%%%%%%%% + +You get them with \texttt{\textbackslash blocbox\{\}}.\\ + +\texttt{\textbackslash blocbox\{triangle\}} gives \raisebox{-3mm}{\begin{Scratch}\blocbox{triangle}\end{Scratch}} + +\subsubsection{Spécial control}%%%%%%%%%%%%%%%%%%%%%%%% +It's for \raisebox{-3mm}{\begin{Scratch}\kbox{stop \rb{all}}\end{Scratch}}\hspace{-1cm} and \raisebox{-2mm}{\begin{Scratch}\kbox{delete this clone}\end{Scratch}}\hspace{-1cm}. + +These commands are obtained with \texttt{\textbackslash kbox\{\}}. + +%----------------------------------------------------------------------------------------------------------------------------------% +\subsection{Inside the Scratch commands: the little boxes} +How to get some specific commands, like: \raisebox{-3mm}{\begin{Scratch}\kbox{stop \rb{all}}\end{Scratch}}\hspace{-1cm}? + +How to type \raisebox{-3mm}{\begin{Scratch}\scbox{wait until \hb[capt]{color \sqb{orange} is touching \sqb{green}?}\ }{ctrl}\end{Scratch}}\hspace{-1cm}? + +or \raisebox{-3mm}{\begin{Scratch}\scbox{point towards \rb{mouse-pointer}}{mvt}\end{Scratch}}\hspace{-1cm}? or even + +\raisebox{-3mm}{\begin{Scratch} +\scbox{change volume by \cb[ope]{pick random \cb[w]{1} to \cb[w]{10}} }{son}\end{Scratch}}\hspace{-1cm} ? + +\subsubsection{The little rectangular boxes}%%%%%%%%%%%%%%%%%%%%%%%% +\begin{itemize} +\item In the \texttt{\textbackslash scbox}: + +obtained with + +\texttt{\textbackslash rb[]\{\}}\\ + +\item dans les \texttt{\textbackslash beginbox} : + +you get them with + +\texttt{\textbackslash rbb[]\{\}}\\ +\end{itemize} + +In both cases, has by default the color of the box it is inside. In order to get a white rectangular box, you just have to put at white or w.\\ + +Typing: +\begin{verbatim} +\begin{Scratch} +\scbox{play sound \rb{meow}}{son} +\scbox{think \rb[white]{Hmm\dots}}{app} +\scbox{ask \rb[w]{What's your name?} and wait}{capt} +\end{Scratch} +\end{verbatim} + +you get:\\ + +\begin{Scratch} +\scbox{play sound \rb{meow}}{son} +\scbox{think \rb[white]{Hmm\dots}}{app} +\scbox{ask \rb[w]{What's your name?} and wait}{capt} +\end{Scratch} + +\subsubsection{The small round boxes}%%%%%%%%%%%%%%%%%%%%%%%% + +They are hollowed or embossed. + +You get them with + +\texttt{\textbackslash cb[]\{\}}\\ + +By default, has the same color of the circular box it is inside. If is white or w, the circular box is hollowed.\\ + +Typing: +\begin{verbatim} +\begin{Scratch} +\scbox{set video transparency to \cb{answer} \%}{capt} +\scbox{go to x:\cb[w]{x} y:\cb[white]{y}}{mvt} +\scbox{change tempo by \cb[data]{variable} }{son} +\end{Scratch} +\end{verbatim} + +you get:\\ + +\begin{Scratch} +\scbox{set video transparency to \cb{answer} \%}{capt} +\scbox{go to x:\cb[w]{x} y:\cb[white]{y}}{mvt} +\scbox{change tempo by \cb[data]{variable} }{son} +\end{Scratch} + + +\subsubsection{The small hexagonal boxes}%%%%%%%%%%%%%%%%%%%%%%%% +Only for \emph{Sensing} et \emph{Operators} commands. + +You get them with + +\texttt{\textbackslash hb[]\{\}}\\ + +By default, is ope. + +Typing: +\begin{verbatim} +\begin{Scratch} +\boucle{if \hb{\cb[data]{variable}=\rb[w]{10}} then}{1}{1} +\scbox{wait until \hb[capt]{mouse down?}}{ctrl} +\end{Scratch} +\end{verbatim} + +you get:\\ + +\begin{Scratch} +\boucle{if \hb{\cb[data]{variable}=\rb[w]{10}} then}{1}{1} +\scbox{wait until \hb[capt]{mouse down?}}{ctrl} +\end{Scratch} + + +\subsubsection{The small squared boxes}%%%%%%%%%%%%%%%%%%%%%%%% +Only for the colored squares. + +You get them with + +\texttt{\textbackslash sqb\{\}}\\ + +Typing: +\begin{verbatim} +\begin{Scratch} +\scbox{set pen color to \sqb{brown}}{stylo} +\end{Scratch} +\end{verbatim} + +you get: \raisebox{-3mm}{\begin{Scratch} +\scbox{set pen color to \sqb{brown}}{stylo} +\end{Scratch}} + +%----------------------------------------------------------------------------------------------------------------------------------% +\subsection{Intricate commands} + +\begin{Scratch}%%%%%%%%%%%%%%%%%%%%%%%% 1 +\beginbox{clone} +\boucle{repeat until \hb[capt]{color \sqb{black} + is touching \sqb{yellow} ? }}{1}{1} +\scbox{go to x: \cb[ope]{\cb[data]{x}+\cb[w]{10}} y: \cb[data]{y}}{mvt} +\boucle{if \hb{\cb[data]{y}<\cb[capt]{answer}} then}{3}{1} +\scbox{set \rb{y} to \cb[son]{volume}}{data} +\scbox{say \rb[w]{Hello!} for \cb[capt]{distance to +\rb{mouse-pointer} } secs}{app} +\kbox{stop \rb{all}} +\turnbox{2}{-146} +\end{Scratch} + +Got with: + +\begin{verbatim} +\begin{Scratch} +\beginbox{clone} +\boucle{repeat until \hb[capt]{color \sqb{black} + is touching \sqb{yellow} ? }}{1}{1} +\scbox{go to x: \cb[ope]{\cb[data]{x}+\cb[w]{10}} y: \cb[data]{y}}{mvt} +\boucle{if \hb{\cb[data]{y}<\cb[capt]{answer}} then}{3}{1} +\scbox{set \rb{y} to \cb[son]{volume}}{data} +\scbox{say \rb[w]{Hello!} for \cb[capt]{distance to +\rb{mouse-pointer} } secs}{app} +\kbox{stop \rb{all}} +\turnbox{2}{-146} +\end{Scratch} +\end{verbatim} + +%----------------------------------------------------------------------------------------------------------------------------------% +\subsection{Other sort of commands} + +\subsubsection{In the loops}%%%%%%%%%%%%%%%%%%%%%% + +You need to use the command \texttt{\textbackslash blank} when in the Scratch program, two loops ends at the same time.\\ + +Typing: +\begin{verbatim} +\begin{Scratch} +\boucle{repeat \cb[w]{3}}{4}{1} +\scbox{move \cb[w]{10} steps}{mvt} +\boucle{repeat \cb[w]{5}}{1}{1} +\scbox{change x by \cb[w]{10}}{mvt} +\scbox{this block is not ok}{data} +\end{Scratch} +\end{verbatim} + +you get:\\ + +\begin{Scratch} +\boucle{repeat \cb[w]{3}}{4}{1} +\scbox{move \cb[w]{10} steps}{mvt} +\boucle{repeat \cb[w]{5}}{1}{1} +\scbox{change x by \cb[w]{10}}{mvt} +\scbox{this block is not ok}{data} +\end{Scratch} + +\vspace{0.5cm} + +Whereas typing: +\begin{verbatim} +\begin{Scratch} +\boucle{repeat \cb[w]{3}}{4}{1} +\scbox{move \cb[w]{10} steps}{mvt} +\boucle{repeat \cb[w]{5}}{1}{1} +\scbox{change x by \cb[w]{10}}{mvt} +\blank +\scbox{this block is \emph{now} ok}{data} +\end{Scratch} +\end{verbatim} + +you get:\\ + +\begin{Scratch} +\boucle{repeat \cb[w]{3}}{4}{1} +\scbox{move \cb[w]{10} steps}{mvt} +\boucle{repeat \cb[w]{5}}{1}{1} +\scbox{change x by \cb[w]{10}}{mvt} +\blank +\scbox{this block is \emph{now} ok}{data} +\end{Scratch} + +\vspace{0.5cm} + +If you type: +\begin{verbatim} +\begin{Scratch} +\boucle{repeat \cb[w]{3}}{5}{1} +\scbox{move \cb[w]{10} steps}{mvt} +\boucle{repeat \cb[w]{5}}{1}{1} +\scbox{change x by \cb[w]{10}}{mvt} +\scbox{this block is in another position}{data} +\end{Scratch} +\end{verbatim} + +you get:\\ + +\begin{Scratch} +\boucle{repeat \cb[w]{3}}{5}{1} +\scbox{move \cb[w]{10} steps}{mvt} +\boucle{repeat \cb[w]{5}}{1}{1} +\scbox{change x by \cb[w]{10}}{mvt} +\scbox{this block is in another position}{data} +\end{Scratch} + +\subsubsection{How to draw the cat} + +You can get the cover cat with: + +\texttt{\small\textbackslash Scratchy[][]} + +By default, the scale is 0.25 and the lines width is set at 0.25 pt.\\ + +Here is the code for the cover: +\begin{verbatim} +\parbox{1ex}{\Scratchy[0.1][0.1]}\\ + +\hspace{1cm}\parbox{1ex}{\Scratchy[0.2][0.2]}\\ + +\hspace{2cm}\parbox{1ex}{\Scratchy[0.5][1]}\\ + +\hspace{5cm}\parbox{1ex}{\Scratchy[0.75][1.5]}\\ +\end{verbatim} + +\newpage +%----------------------------------------------------------------------------------------------------------------------------------% +%----------------------------------------------------------------------------------------------------------------------------------% +\section{Known problems and solutions} +\begin{enumerate} +\item +The black little triangle doesn't exist in the command \emph{point in direction} (motion). You have to write it down. +\begin{verbatim} +\scbox{point in direction \cb[w]{90 \scriptsize$\blacktriangledown$}}{mvt} +\end{verbatim} +\raisebox{-3mm}{\begin{Scratch}\scbox{point in direction \cb[w]{90 \scriptsize$\blacktriangledown$}}{mvt}\end{Scratch}}\\ + +\item The height of the boxes is set. Therefor, you cannot put a lot of under-commands in a Scratch command.\\ + +\item When you need to put only one Scratch command into some text, it is not vertically centered. You can use a: \texttt{\textbackslash raisebox\{-3mm\}}.\\ + +\item There is also a tiny horizontal gap. When a Scratch environment is over, you often need to add a \texttt{\textbackslash hspace\{-1cm\}}.\\ + +\item The compile time is sometimes long! +\end{enumerate} + +%----------------------------------------------------------------------------------------------------------------------------------% +%----------------------------------------------------------------------------------------------------------------------------------% +\section{Commands summary} + +\begin{tabular}{m{5cm}l}%%%%%%%%%% +\texttt{\small\textbackslash beginbox\{\}} + +&\begin{Scratch}[0.75] +\beginbox{} +\end{Scratch} +\\%%%%%%%%%% +\texttt{\small\textbackslash beginbox\{\}} + +\tiny(when this sprite clicked) +&\begin{Scratch}[0.75] +\beginbox{quand ce lutin est cliqué} +\end{Scratch}\\%%%%%%%%%% +\texttt{\small\textbackslash beginbox\{clone\}} + +&\begin{Scratch}[0.75] +\beginbox{clone} +\end{Scratch} +\\%%%%%%%%%% +\texttt{\small\textbackslash blocbox\{\}} + +&\begin{Scratch}[0.75] +\blocbox{function} +\end{Scratch} +\\%%%%%%%%%% +\texttt{\small\textbackslash turnbox\{\}\{90\}} + +&\begin{Scratch}[0.75] +\turnbox{}{90} +\end{Scratch}\\%%%%%%%%%% +\texttt{\small\textbackslash turnbox\{g\}\{-270\}} + +\tiny(or or or ) +&\begin{Scratch}[0.75] +\turnbox{g}{-270} +\end{Scratch} +\\%%%%%%%%%% +\texttt{\small\textbackslash scbox\{\}\{\}} + +&\begin{Scratch}[0.75] +\scbox{any color, any text}{purple} +\end{Scratch}\\%%%%%%%%%% +\texttt{\small\textbackslash boucle\{repeat\}\{2\}\{1\}} +\tiny(\{\}\{\}\{\}) +\vspace{3cm} +&\begin{Scratch}[0.75] +\boucle{repeat}{2}{1} +\end{Scratch}\vspace{-1.5cm} +\\%%%%%%%%%% +\texttt{\small\textbackslash boucle\{forever\}\{1\}\{-1\}} + +\tiny(\{\}\{\}\{\}) +\vspace{2cm} +&\begin{Scratch}[0.75] +\boucle{forever}{1}{-1} +\end{Scratch}\vspace{-1.2cm} +\\%%%%%%%%%% +\texttt{\small\textbackslash boucle\{if \dots then\}\{1\}\{2\}} + +\tiny(\{\}\{\}\{\}) +\vspace{2cm} +&\begin{Scratch}[0.75] +\boucle{if \dots then}{1}{2} +\end{Scratch}\vspace{-1.2cm} +\\%%%%%%%%%% + +\texttt{\small\textbackslash sailors\{if\dots then\dots\}\{2\}} + +\tiny(\{\}\{\}) +\vspace{2cm} +&\begin{Scratch}[0.75] +\sailors{fi\dots then\dots}{2} +\end{Scratch}\vspace{-1cm} +\\%%%%%%%%%% +\texttt{\small\textbackslash simenon\{\}} + +\tiny(ici, \textbackslash simenon\{1\}) +\vspace{2.2cm} +&\begin{Scratch}[0.75] +\whitesailors{il faut que ce }{1} +\simenon{1} +\end{Scratch}\vspace{-1.2cm} +\\%%%%%%%%%% +\texttt{\small\textbackslash kbox\{\}} + +&\begin{Scratch}[0.75] +\kbox{delete this clone} +\end{Scratch} +\\%%%%%%%%%% +\end{tabular} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\begin{tabular}{m{5cm}l} +\texttt{\small\textbackslash rb\{\}} + +\tiny (\texttt{\textbackslash rb\{variable\}}) +&\begin{Scratch}[0.75] +\scbox{\phantom{tex} \rb{variable} \phantom{tex}}{data} +\end{Scratch} +\\ +\texttt{\small\textbackslash rb[w]\{\}} + +\tiny(ou \texttt{\textbackslash rb[white]\{\}}) +&\begin{Scratch}[0.75] +\scbox{\phantom{tex} \rb[w]{text} }{data} +\end{Scratch} +\\ +\texttt{\small\textbackslash rbb\{\}} + +\tiny(only for \texttt{\textbackslash beginbox}) + +\texttt{\textbackslash beginbox\{when I receive \textbackslash rbb\{message1\}\}} +&\begin{Scratch}[0.75] +\beginbox{when I receive \rbb{message1}} +\end{Scratch} +\\ + +\texttt{\small\textbackslash cb\{\}} + +\tiny(transparent) +&\begin{Scratch}[0.75] +\scbox{\phantom{rex} \cb{answer}}{ctrl} +\end{Scratch} +\\ +\texttt{\small\textbackslash cb[w]\{\}} + +\tiny(ou \textbackslash cb[white]\{\}) +&\begin{Scratch}[0.75] +\scbox{\phantom{rex} \cb[w]{answer}}{ctrl} +\end{Scratch} +\\ +\texttt{\small\textbackslash cb[]\{\}} + +\texttt{\tiny\textbackslash cb[ope]\{answer\}} +&\begin{Scratch}[0.75] +\scbox{\phantom{rex} \cb[ope]{answer}}{ctrl} +\end{Scratch} +\\ +\texttt{\small\textbackslash hb\{\}} + +&\begin{Scratch}[0.75] +\scbox{\phantom{rex} \hb{answer}}{ctrl} +\end{Scratch} +\\ + +\texttt{\small\textbackslash hb[capt]\{\}} + +&\begin{Scratch}[0.75] +\scbox{\phantom{rex} \hb[capt]{answer}}{ctrl} +\end{Scratch} +\\ +\texttt{\small\textbackslash sqb\{\}} + +&\begin{Scratch}[0.75] +\scbox{set pen color to \sqb{red}}{stylo} +\end{Scratch} +\\ + +\end{tabular} + +%----------------------------------------------------------------------------------------------------------------------------------% +%----------------------------------------------------------------------------------------------------------------------------------% +\newpage +\section{Examples of programs (in French):} + +\begin{verbatim} +\begin{Scratch} +\boucle{répéter \cb[w]{3} fois}{5}{1} +\scbox{avancer de \cb[w]{10}}{mvt} +\boucle{répéter \cb[w]{5} fois}{1}{1} +\scbox{ajouter \cb[w]{10} à x}{mvt} +\scbox{ce bloc est placé autrement}{data} +\scbox{un nouveau bloc}{son} +\end{Scratch} +\end{verbatim} + +\begin{verbatim} +\begin{Scratch} +\beginbox{quand \rbb{espace} est pressé} +\boucle{répéter \cb[w]{3} fois}{8}{1} + \scbox{aller à x: \cb[w]{0} y: \cb[data]{y}}{mvt} + \boucle{répéter \cb[w]{2} fois}{3}{1} + \scbox{mettre \rb{x} à \rb[w]{0}}{data} + \scbox{ajouter à \rb{y} \cb[w]{10}}{data} + \scbox{mettre la couleur du stylo à \sqb{red}}{stylo} + \scbox{mon bloc}{bloc} + \scbox{montrer}{app} +\scbox{effacer tout}{stylo} +\end{Scratch} +\end{verbatim} +\begin{center} +\begin{tabular}{cc}%\hline +\parbox[b]{5.5cm}{ +\hspace{1cm}deuxième programme $\rightarrow$ +\vspace{2em} +\par +premier programme +\par +\hspace{1.25em}$\downarrow$ +\par +\begin{Scratch} +\boucle{répéter \cb[w]{3} fois}{5}{1} +\scbox{avancer de \cb[w]{10}}{mvt} +\boucle{répéter \cb[w]{5} fois}{1}{1} +\scbox{ajouter \cb[w]{10} à x}{mvt} +\scbox{ce bloc est placé \dots}{data} +\scbox{un nouveau bloc}{son} +\end{Scratch} +} +& +\begin{Scratch} +\beginbox{quand \rbb{espace} est pressé} +\boucle{répéter \cb[w]{3} fois}{8}{1} + \scbox{aller à x: \cb[w]{0} y: \cb[data]{y}}{mvt} + \boucle{répéter \cb[w]{2} fois}{3}{1} + \scbox{mettre \rb{x} à \rb[w]{0}}{data} + \scbox{ajouter à \rb{y} \cb[w]{10}}{data} + \scbox{mettre la couleur du stylo à \sqb{red}}{stylo} + \scbox{mon bloc}{bloc} + \scbox{montrer}{app} +\scbox{effacer tout}{stylo} +\end{Scratch} +\end{tabular} +\end{center} +\newpage +%----------------------------------------------------------------------------------------------------------------------------------% +\subsection{Loops of loops} + +%%%%%%%%%%%%%%%%%%%%%%%% 1 +\begin{verbatim} +\begin{Scratch} +\beginbox{quand \rb{chronomètre} > \cb[w]{10}} + +\sailors{si \hb[capt]{touche \rb{espace} pressée?} alors}{12} + + \sailors{si \hb[capt]{souris pressée?} alors}{1} + \scbox{aller à x: \cb[w]{0} y: \cb[w]{0}}{mvt} + + \simenon{2} + \scbox{donner la valeur \cb[w]{0} à x}{mvt} + \scbox{ajouter \cb[w]{10} à y}{mvt} + + \sailors{si couleur \sqb{son} touchée?}{1} + \scbox{aller à x: \cb[w]{0} y: \cb[w]{0}}{mvt} + + \simenon{1} + \scbox{donner la valeur \cb[w]{0} à x}{mvt} + + \simenon{1} + \scbox{donner la valeur \cb[w]{0} à y}{mvt} + +\sailors{si \hb[capt]{souris pressée?} alors}{1} + \scbox{ajouter \cb[w]{10} à y}{mvt} + +\simenon{2} + \scbox{donner la valeur \cb[w]{0} à x}{mvt} + \scbox{cacher la variable \rb{variable}}{data} + +\end{Scratch} +\end{verbatim} + +\begin{center} +\begin{Scratch}[1]%%%%%%%%%%%%%%%%%%%%%%%% 1 +\beginbox{quand \rb{chronomètre} > \cb[w]{10}} + +\sailors{si \hb[capt]{touche \rb{espace} pressée?} alors}{12} + + \sailors{si \hb[capt]{souris pressée?} alors}{1} + \scbox{aller à x: \cb[w]{0} y: \cb[w]{0}}{mvt} + + \simenon{2} + \scbox{donner la valeur \cb[w]{0} à x}{mvt} + \scbox{ajouter \cb[w]{10} à y}{mvt} + + \sailors{si couleur \sqb{son} touchée?}{1} + \scbox{aller à x: \cb[w]{0} y: \cb[w]{0}}{mvt} + + \simenon{1} + \scbox{donner la valeur \cb[w]{0} à x}{mvt} + + \simenon{1} + \scbox{donner la valeur \cb[w]{0} à y}{mvt} + +\sailors{si \hb[capt]{souris pressée?} alors}{1} + \scbox{ajouter \cb[w]{10} à y}{mvt} + +\simenon{2} + \scbox{donner la valeur \cb[w]{0} à x}{mvt} + \scbox{cacher la variable \rb{variable}}{data} + +\end{Scratch}\end{center} +\newpage +%%%%%%%%%%%%%%%%%%%%%%%% 2 +\begin{verbatim} +\begin{Scratch} +\beginbox{} + +\sailors{si couleur \sqb{stylo} touchée?}{12} + + \sailors{si \hb[capt]{souris pressée?} alors}{6} + \scbox{aller à x: \cb[w]{0} y: \cb[w]{0}}{mvt} + + \sailors{si \hb[capt]{touche \rb{espace} pressée?} alors}{1} + \scbox{aller à x: \cb[w]{0} y: \cb[w]{0}}{mvt} + + \simenon{1} + \scbox{donner la valeur \cb[w]{0} à x}{mvt} + + \simenon{2} + \scbox{donner la valeur \cb[w]{0} à x}{mvt} + \scbox{ajouter \cb[w]{10} à y}{mvt} + + \simenon{1} + \scbox{donner la valeur \cb[w]{0} à x}{mvt} + +\end{Scratch} +\end{verbatim} +\begin{center} +\begin{Scratch}[1]%%%%%%%%%%%%%%%%%%%%%%%% 2 +\beginbox{} + +\sailors{si couleur \sqb{stylo} touchée?}{12} + + \sailors{si \hb[capt]{souris pressée?} alors}{6} + \scbox{aller à x: \cb[w]{0} y: \cb[w]{0}}{mvt} + + \sailors{si \hb[capt]{touche \rb{espace} pressée?} alors}{1} + \scbox{aller à x: \cb[w]{0} y: \cb[w]{0}}{mvt} + + \simenon{1} + \scbox{donner la valeur \cb[w]{0} à x}{mvt} + + \simenon{2} + \scbox{donner la valeur \cb[w]{0} à x}{mvt} + \scbox{ajouter \cb[w]{10} à y}{mvt} + + \simenon{1} + \scbox{donner la valeur \cb[w]{0} à x}{mvt} + +\end{Scratch}\end{center} + +\newpage +%%%%%%%%%%%%%%%%%%%%%%%% 3 +\begin{verbatim} +\begin{Scratch} +\beginbox{} +\boucle{répéter indéfiniment}{13}{-1} + \turnbox{}{24} + \boucle{répéter \cb[w]{4} fois}{2}{1} + \scbox{stylo en position d'écriture}{stylo} + \scbox{ajouter \cb[w]{20} au tempo}{son} + \boucle{quand le lutin s'en va}{6}{1} + \scbox{cacher la variable \rb{A}}{data} + \scbox{costume suivant}{app} + \scbox{arrêter tous les sons}{son} + \turnbox{g}{24} + \scbox{stylo en position d'écriture}{stylo} + \scbox{ajouter \cb[w]{20} au tempo}{son} + \blank +\end{Scratch} +\end{verbatim} +\begin{center} +\begin{Scratch}[1]%%%%%%%%%%%%%%%%%%%%%%%% 3 +\beginbox{} +\boucle{répéter indéfiniment}{13}{-1} + \turnbox{}{24} + \boucle{répéter \cb[w]{4} fois}{2}{1} + \scbox{stylo en position d'écriture}{stylo} + \scbox{ajouter \cb[w]{20} au tempo}{son} + \boucle{répéter \cb[w]{4} fois}{6}{1} + \scbox{cacher la variable \rb{A}}{data} + \scbox{costume suivant}{app} + \scbox{arrêter tous les sons}{son} + \turnbox{g}{24} + \scbox{stylo en position d'écriture}{stylo} + \scbox{ajouter \cb[w]{20} au tempo}{son} + \blank +\end{Scratch} +\end{center} +\newpage +%%%%%%%%%%%%%%%%%%%%%%%% 4 +\begin{verbatim} +\begin{Scratch} +\beginbox{quand on le veut} +\boucle{répéter un certain nombre de fois}{8}{1} + \scbox{aller à x: \cb[w]{0} y: \cb[w]{0}}{mvt} + \boucle{le dernier ??}{2}{1} + \scbox{on peut faire}{gray} + \scbox{ce que l'on veut}{black} + \boucle{ne pas répéter}{1}{1} + \scbox{faux bloc}{brown} + \blank +\scbox{dernier bloc}{pink} +\end{Scratch} +\end{verbatim} + +\begin{center} +\begin{Scratch}[1]%%%%%%%%%%%%%%%%%%%%%%%% 4 +\beginbox{quand on le veut} +\boucle{répéter un certain nombre de fois}{8}{1} + \scbox{aller à x: \cb[w]{0} y: \cb[w]{0}}{mvt} + \boucle{se répéter que}{2}{1} + \scbox{l'on peut faire}{gray} + \scbox{ce que l'on veut}{black} + \boucle{ne pas répéter}{1}{1} + \scbox{faux bloc}{brown} + \blank +\scbox{dernier bloc}{pink} +\end{Scratch} +\end{center} +\newpage +%%%%%%%%%%%%%%%%%%%%%%%% 5 +\begin{verbatim} +\begin{Scratch} +\beginbox{} +\boucle{répéter \cb[w]{3} fois}{19}{1} + \scbox{costume suivant}{app} + \scbox{arrêter tous les sons}{son} + \turnbox{1}{24} + \scbox{stylo en position d'écriture}{stylo} + \boucle{répéter \cb[data]{compteur} fois}{10}{1} + \scbox{ajouter \cb[w]{20} au tempo}{son} + \boucle{répéter \cb[ope]{\cb[data]{A}+1} fois}{6}{1} + \scbox{réinitialiser le chronomètre}{capt} + \boucle{répéter jusqu'à \hb[capt]{\rb{pointeur de souris} touché?}}{2}{1} + \scbox{cacher la variable \rb{A}}{data} + \scbox{avancer de 35}{mvt} + \scbox{regroupe \rb[w]{hello}\rb[w]{world}}{ope} + \scbox{nouveau bloc}{bloc} + \turnbox{2}{-146} + \scbox{estampiller}{stylo} + \scbox{annuler les effets graphiques}{app} +\sailors{si ça marche}{1} + \scbox{je suis content}{stylo} +\simenon{1} + \scbox{je suis déçu}{app} +\end{Scratch} +\end{verbatim} + +\begin{center} +\begin{Scratch}[1]%%%%%%%%%%%%%%%%%%%%%%%% 5 +\beginbox{} +\boucle{répéter \cb[w]{3} fois}{19}{1} + \scbox{costume suivant}{app} + \scbox{arrêter tous les sons}{son} + \turnbox{1}{24} + \scbox{stylo en position d'écriture}{stylo} + \boucle{répéter \cb[data]{compteur} fois}{10}{1} + \scbox{ajouter \cb[w]{20} au tempo}{son} + \boucle{répéter \cb[ope]{\cb[data]{A}+1} fois}{6}{1} + \scbox{réinitialiser le chronomètre}{capt} + \boucle{répéter jusqu'à \hb[capt]{\rb{pointeur de souris} touché?}}{2}{1} + \scbox{cacher la variable \rb{A}}{data} + \scbox{avancer de 35}{mvt} + \scbox{regroupe \rb[w]{hello}\rb[w]{world}}{ope} + \scbox{nouveau bloc}{bloc} + \turnbox{2}{-146} + \scbox{estampiller}{stylo} + \scbox{annuler les effets gRaphiques}{app} +\sailors{si ça marche}{1} + \scbox{je suis content}{stylo} +\simenon{1} + \scbox{je suis déçu}{app} +\end{Scratch} +\end{center} + +\newpage +%----------------------------------------------------------------------------------------------------------------------------------% +%----------------------------------------------------------------------------------------------------------------------------------% +\section{Conclusion} + +Please feel free to leave a comment: + +Thibault.Ralet\at ac-clermont.fr. + +Thank you! + +\end{document} +%% +%% This is file `ScratchX.sty', +%% +%% Copyright (C) Thibault Ralet - Thibault.Ralet@ac-clermont.fr +%% +%% 16 mars 2017 (version 0.1) - 27 juillet 2017 (version 1.1) +%% +%% the LaTeX Project Public License v1.3c or later, see http://www.latex-project.org/lppl.txt +%% +%% Unlimited copying and redistribution of this file are permitted as +%% long as this file is not modified. Modifications, and distribution +%% of modified versions, are permitted, but only if the resulting file +%% is renamed. \ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/scratchx/Explications_ScratchX.pdf b/Master/texmf-dist/doc/latex/scratchx/Explications_ScratchX.pdf new file mode 100644 index 00000000000..a66f10a53d8 Binary files /dev/null and b/Master/texmf-dist/doc/latex/scratchx/Explications_ScratchX.pdf differ diff --git a/Master/texmf-dist/doc/latex/scratchx/Explications_ScratchX.tex b/Master/texmf-dist/doc/latex/scratchx/Explications_ScratchX.tex new file mode 100644 index 00000000000..7497310980d --- /dev/null +++ b/Master/texmf-dist/doc/latex/scratchx/Explications_ScratchX.tex @@ -0,0 +1,1102 @@ +\documentclass[a4paper,11pt]{article} +\usepackage{array} +\usepackage{multirow} +\usepackage{lastpage} +\usepackage{verbatim} +\usepackage[francais]{babel} +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{tikz} +\usetikzlibrary{calc} +\usepackage{amsfonts,amsmath,amssymb,mathrsfs,amsthm} +\usepackage{fancyhdr} +\usepackage{lmodern} +\usepackage{ScratchX} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%----------------------------------- SI ALORS TOUTE BLANCHE----------------------------------------------------------- +\newcommand{\whitesailors}[2]{%loop with as many blocks as we want + % Créer un compteur à chaque passage dans cette boucle. % l'incrémenter du nombre de fois où ce décalage s'opère + % décaler en abscisse : ajouter 0,4 à x % mettre le compteur NbreComptr à NbreComptr+1 +\ifthenelse{\value{NbrCptrLoupeDuplicate}=0}%aucun compteurs loupe créés + { + \ifthenelse{\value{CompteurMax}=0} + {\loope{\theNbrCptrLoupe}{#2}} + { + \ifthenelse{\value{NbrCptrLoupe}<\value{CompteurMax}}%\or\value{NbrCptrLoupe}=\value{CompteurMax}} + {\looope{\theNbrCptrLoupe}{#2}} + {\loope{\theNbrCptrLoupe}{#2}}%pour ne pas recréer des compteurs déjà créés + } + } + {\looope{\theNbrCptrLoupe}{#2}} + +\ifthenelse{\value{NbrCptrAlorsDuplicate}=0}%aucun compteurs aloors créés + {\sialoors{#1}} + {\sialooors{#1}}%pour ne pas recréer des compteurs déjà créés +\settowidth{\malongueuR}{\pgfinterruptpicture #1 \endpgfinterruptpicture} + + \FPeval{X}{\x+(0.4)*\thedecalageX} + \FPeval{Y}{\y+(neg 0.66)*(\thedecalageY)} + + %\StrLen{#1}[\valeur]% pour ajuster la longueur de la boîte en fonction de la longueur du texte + \FPeval{b}{neg 0.1+Y}\FPeval{c}{0.36+Y}\FPeval{d}{0.1+X} + \FPeval{e}{0.46+Y}\FPeval{f}{0.4+X}\FPeval{g}{0.5+X}\FPeval{h}{0.7+X}\FPeval{i}{0.8+X}\FPeval{j}{0.7+(X)} + \FPeval{ii}{1.2+X}\FPeval{iii}{1.1+X}\FPeval{iiii}{0.9+X}\FPeval{gg}{0.6+X} + \FPeval{l}{neg 0.2+(Y)}\FPeval{m}{neg 0.3+(Y)}\FPeval{o}{0.1+(Y)} + %top + %bottom#1 + \FPeval{mm}{neg 0.1+(neg 0.66)*(#2)+(Y)} + \FPeval{mmm}{neg 0.2+(neg 0.66)*(#2)+(Y)}\FPeval{mmmm}{neg 0.3+(neg 0.66)*(#2)+(Y)}\FPeval{M}{neg 0.75+(neg 0.66)*(#2)+(Y)}\FPeval{MM}{neg 0.85+(neg 0.66)*(#2)+(Y)}\FPeval{MN}{neg 0.95+(neg 0.66)*(#2)+(Y)}\FPeval{MMM}{neg 0.55+(neg 0.66)*(#2)+(Y)}\FPeval{MMMM}{MMM-0.02}\FPeval{JJ}{j+0.02}%adjusting the height of the bottom + \coordinate (A) at ($(\d,\e) ! \malongueuR ! (\f,\e)$); + \coordinate (AA) at ($(\X,\c) ! \malongueuR+0.2cm ! (\g,\c)$); + \coordinate (BB) at ($(\X,\M) ! \malongueuR+0.2cm ! (\f,\M)$); + \coordinate (B) at ($(\g,\mmm) ! \malongueuR-0.4cm ! (\i,\mmm)$); + +\multido{\i=1+1}{\value{NbrCptrLoupe}}{%Fait défiler tous les compteurs jusqu'au nombre de compteurs : si compteur différent de -1 : + % si différent de 0, leur enlever 1. / si égal à 0 : enlever 1 à décalageX et mettre le compteur correspondant à -1. + \ifthenelse{\value{loupe\i}>-1}{ + \ifthenelse{\value{loupe\i}=0} + {\addtocounter{decalageX}{-1}\addtocounter{decalageY}{1}\setcounter{loupe\i}{-1}} + {\addtocounter{loupe\i}{-1}} + }{} + } +\addtocounter{decalageX}{1} +\addtocounter{decalageY}{1} +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{document} +\pagestyle{fancy} +\fancyhead{} + \fancyhead[LE,LO]{\em \LaTeX} + \fancyhead[CE,CO]{\Large \textsc{Le paquet \texttt{ScratchX.sty}}} + \fancyhead[RE,RO]{\em 2016--2017} + \fancyfoot[CE,CO]{\thepage /\pageref{LastPage}} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%----------------------------------------------------------------------------------------------------------------------------------% +%----------------------------------------------------------------------------------------------------------------------------------% +\section*{ +\centering{ + \begin{Scratch} + \beginbox{Guide d'utilisation du paquet \cb[ope]{ScratchX.sty\ }} + \end{Scratch} + } +} +\begin{center} +\begin{Scratch} +\scbox{Thibault Ralet}{ctrl} +\scbox{mars \rb{2017}}{data} +\end{Scratch} +\end{center} + +\noindent\rule{\linewidth}{.5pt} + + +\parbox{1ex}{\Scratchy[0.1][0.1]}\\ + +\hspace{1cm}\parbox{1ex}{\Scratchy[0.2][0.2]}\\ + +\hspace{2cm}\parbox{1ex}{\Scratchy[0.5][1]}\\ + +\hspace{5cm}\parbox{1ex}{\Scratchy[0.75][1.5]}\\ + +%----------------------------------------------------------------------------------------------------------------------------------% +%----------------------------------------------------------------------------------------------------------------------------------% +\section{Introduction} +Le paquet \texttt{ScratchX.sty} permet d'écrire n'importe quel programme Scratch en \LaTeX. + +Le paquet \texttt{ScratchX.sty} doit être mis dans le même dossier que celui dans lequel le fichier \texttt{.tex} est créé, ou dans le dossier dédié aux packages de l'éditeur de fichiers .tex. + +Le paquet\texttt{ScratchX.sty} doit être appelé dans le préambule du fichier \texttt{.tex} par : + +\begin{verbatim} \usepackage{ScratchX} \end{verbatim} + +Le paquet \texttt{ScratchX.sty} utilise les paquets suivants : +\begin{verbatim} +\usepackage[nomessages]{fp} +\usepackage{calc} +\usepackage{xstring} +\usepackage[alpine]{ifsym}%pour avoir VarFlag comme +%drapeau de départ de Scratch +\usepackage{ifthen} +\usepackage{multido} +\usepackage{xargs} +\end{verbatim} + +Dans le document \texttt{.tex} créé, il faut charger : +\begin{verbatim} +\usepackage{tikz} +\usetikzlibrary{calc} +\end{verbatim} +et aussi : +\begin{verbatim} +\usepackage{amssymb} +\end{verbatim} + +La compilation peut s'effectuer en XeLaTeX ou en pdfLaTeX. + +\newpage +%----------------------------------------------------------------------------------------------------------------------------------% +%----------------------------------------------------------------------------------------------------------------------------------% +\section{Description générale} + +On écrit un programme (ou simplement une commande) Scratch à l'aide de l'environnement : + +\begin{verbatim} +\begin{Scratch} +%commandes LaTeX pour créer les commandes Scratch +\end{Scratch} +\end{verbatim} + +La commande \texttt{\textbackslash begin\{Scratch\}} admet en option l'échelle (1 par défaut). + +Ainsi,\texttt{\textbackslash begin\{Scratch\}[2]} double la taille du programme, alors que \texttt{\textbackslash begin\{Scratch\}[0.7]} réduit de 70\% la taille du programme créé. + +\begin{center} +\begin{tabular}{cc} + +\begin{Scratch}[1] +\scbox{taille par défaut}{app} +\end{Scratch} +& +\begin{Scratch}[2] +\scbox{plus gros}{app} +\end{Scratch}\\ +& +\begin{Scratch}[0.7] +\scbox{plus petit}{app} +\end{Scratch} +\end{tabular} +\end{center} + +%----------------------------------------------------------------------------------------------------------------------------------% +\subsection*{Les couleurs} +Les dix couleurs spécifiques à Scratch sont définies ainsi : +\begin{center} +\begin{tabular}{c@{:\quad}cp{1cm}c@{:\quad }c}\hline +mvt&\textcolor{mvt}{Mouvement}&&evt&\textcolor{evt}{Evénements}\\ +app&\textcolor{app}{Apparence}&&ctrl&\textcolor{ctrl}{Contrôle}\\ +son&\textcolor{son}{Sons}&&capt&\textcolor{capt}{Capteurs}\\ +stylo&\textcolor{stylo}{Stylo}&&ope&\textcolor{ope}{Opérateurs}\\ +data&\textcolor{data}{Données}&&bloc&\textcolor{bloc}{Ajouter blocs}\\\hline +\end{tabular} +\end{center} + +\newpage +%----------------------------------------------------------------------------------------------------------------------------------% +%----------------------------------------------------------------------------------------------------------------------------------% +\section{Liste des commandes} + +%----------------------------------------------------------------------------------------------------------------------------------% +\subsection{Commandes Scratch simples} +On les obtient avec \texttt{\textbackslash scbox\{\}\{\}}. + +En tapant : +\begin{verbatim} +\begin{Scratch} +\scbox{rebondir si le bord est atteint}{mvt} +\scbox{cacher}{app} +\scbox{arrêter tous les sons}{son} +\scbox{stylo en position d'écriture}{stylo} +\scbox{réinitialiser le chronomètre}{capt} +\end{Scratch} +\end{verbatim} + +on obtient :\\ + +\begin{Scratch} +\scbox{rebondir si le bord est atteint}{mvt} +\scbox{cacher}{app} +\scbox{arrêter tous les sons}{son} +\scbox{stylo en position d'écriture}{stylo} +\scbox{réinitialiser le chronomètre}{capt} +\end{Scratch} + +%----------------------------------------------------------------------------------------------------------------------------------% +\subsection{Commandes Scratch spéciales} + +\subsubsection{\'Evénement}%%%%%%%%%%%%%%%%%%%%%%%% +On les obtient avec \texttt{\textbackslash beginbox\{\}}. + +\texttt{\textbackslash beginbox\{\}} produit \parbox{1ex}{\begin{Scratch}\beginbox{}\end{Scratch}} + +\texttt{\textbackslash beginbox\{clone\}} produit \parbox{1ex}{\begin{Scratch}\beginbox{clone}\end{Scratch}} + +\texttt{\textbackslash beginbox\{quand ce lutin est cliqué\}} produit + +\hfill\parbox{6cm}{\begin{Scratch}\beginbox{quand ce lutin est cliqué}\end{Scratch}} + +\subsubsection{Tourner}%%%%%%%%%%%%%%%%%%%%%%%% +On les obtient avec \texttt{\textbackslash turnbox\{\}\{\}}.\\ + +\texttt{\textbackslash turnbox\{\}\{-145\}} produit \raisebox{-3mm}{\begin{Scratch}\turnbox{}{-145}\end{Scratch}} + +\texttt{\textbackslash turnbox\{gauche\}\{30\}} produit \raisebox{-3mm}{\begin{Scratch}\turnbox{gauche}{30}\end{Scratch}} + +On peut également écrire \texttt{\textbackslash turnbox\{g\}\{30\}} ou \texttt{\textbackslash turnbox\{G\}\{30\}} + +\subsubsection{Boucles}%%%%%%%%%%%%%%%%%%%%%%%% +On les obtient avec + +\texttt{\textbackslash boucle\{\}\{\}\{\}}, + +où est un entier égal à 1 (\emph{répéter $x$ fois} ou \emph{répéter jusqu'à}) ou -1 (\emph{répéter indéfiniment}).\\ + +\parbox{0.53\linewidth}{\texttt{\textbackslash boucle\{répéter \$x\$ fois\}\{2\}\{1\}} +\par +\texttt{\textbackslash scbox\{deux blocs\}\{red\}} +\par +\texttt{\textbackslash scbox\{dans la boucle\}\{gray\}} +} +\parbox{0.12\linewidth}{produit} +\parbox{0.2\linewidth}{\raisebox{-3mm}{ +\begin{Scratch}[0.9] +\boucle{répéter $x$ fois}{2}{1} +\scbox{deux blocs}{red} +\scbox{dans la boucle}{gray} +\end{Scratch}}} + +\begin{center} +\begin{tabular}{lcr} +\texttt{\textbackslash boucle\{répéter indéfiniment\}\{3\}\{-1\}}&&\multirow{3}{*}{\begin{Scratch}[0.9] +\boucle{répéter indéfiniment}{3}{-1} +\scbox{cette fois-ci}{pink} +\scbox{trois blocs}{blue} +\scbox{dans la boucle}{purple} +\end{Scratch}}\\ +\texttt{\textbackslash scbox\{cette fois-ci\}\{pink\}}&&\\ +\texttt{\textbackslash scbox\{trois blocs\}\{blue\}}&&\\ +\texttt{\textbackslash scbox\{dans la boucle\}\{purple\}}&&\\ +&&\\ +&&\\ +\end{tabular}\end{center} + +\emph{Attention, lorsque l'on souhaite placer des boucles dans des boucles, il faut repenser le nombre de blocs de la boucle principale ! En effet, une boucle compte pour deux blocs (sans les blocs contenus à l'intérieur).} + +\subsubsection{Si \dots\ Alors}%%%%%%%%%%%%%%%%%%%%%%%% + +\emph{Attention, on obtient cette commande Scratch avec la même syntaxe que précédemment, à savoir :} + +\texttt{\textbackslash boucle\{\}\{\}\{2\}}.\\ + +\parbox{0.53\linewidth}{\texttt{\textbackslash boucle\{si 4 > 5 alors\}\{1\}\{2\}} +\par +\texttt{\textbackslash scbox\{rien ne va plus !\}\{app\}} +} +\parbox{0.12\linewidth}{produit} +\parbox{0.2\linewidth}{\raisebox{-3mm}{ +\begin{Scratch}[0.9] +\boucle{si 4 > 5 alors}{1}{2} +\scbox{rien ne va plus !}{app} +\end{Scratch}}} + +Remarque : pour connaître comment bien écrire le test du si, voir \emph{les petites boîtes} à la section 3.3. + +\subsubsection{Si \dots\ Alors \dots\ Sinon}%%%%%%%%%%%%%%%%%%%%%%%% +On les obtient avec + +\texttt{\textbackslash sailors\{\}\{\}} + +et + +\texttt{\textbackslash simenon\{\}}.\\ + +En tapant : +\begin{verbatim} +\begin{Scratch} +\sailors{si cet exemple est parlant alors}{1} +\scbox{tout va bien}{app} +\simenon{2} +\scbox{ne pas paniquer}{stylo} +\scbox{voir la section \emph{Exemples}}{capt} +\end{Scratch} +\end{verbatim} + +on obtient :\\ + +\begin{Scratch} +\sailors{si cet exemple est parlant alors}{1} +\scbox{tout va bien}{app} +\simenon{2} +\scbox{ne pas paniquer}{stylo} +\scbox{voir la section \emph{Exemples}}{capt} +\end{Scratch} + +\subsubsection{Ajouter blocs}%%%%%%%%%%%%%%%%%%%%%%%% + +On les obtient avec \texttt{\textbackslash blocbox\{\}}.\\ + +\texttt{\textbackslash blocbox\{triangle\}} produit \raisebox{-3mm}{\begin{Scratch}\blocbox{triangle}\end{Scratch}} + +\subsubsection{Contrôle spécial}%%%%%%%%%%%%%%%%%%%%%%%% +Cela concerne \raisebox{-3mm}{\begin{Scratch}\kbox{stop \rb{tout}}\end{Scratch}}\hspace{-1cm} et \raisebox{-2mm}{\begin{Scratch}\kbox{supprimer ce clone}\end{Scratch}}\hspace{-1cm}. + +Ces commandes s'obtiennent avec \texttt{\textbackslash kbox\{\}}. + +%----------------------------------------------------------------------------------------------------------------------------------% +\subsection{À l'intérieur des commandes Scratch : les petites boîtes} +Comment obtenir certaines commandes plus évoluées, comme par exemple : \raisebox{-3mm}{\begin{Scratch}\kbox{stop \rb{tout}}\end{Scratch}}\hspace{-1cm} ? + +Comment écrire \raisebox{-3mm}{\begin{Scratch}\scbox{attendre jusqu'à \hb[capt]{couleur \sqb{orange} touche \sqb{green} ?}}{ctrl}\end{Scratch}}\hspace{-1cm} ? + +ou \raisebox{-3mm}{\begin{Scratch}\scbox{aller à \rb{pointeur de souris}}{mvt}\end{Scratch}}\hspace{-1cm} ? ou encore + +\raisebox{-3mm}{\begin{Scratch} +\scbox{ajouter \cb[ope]{nombre aléatoire entre \cb[w]{1} et \cb[w]{10}} au volume}{son}\end{Scratch}}\hspace{-1cm} ? + +\subsubsection{Les petites boîtes rectangulaires}%%%%%%%%%%%%%%%%%%%%%%%% +\begin{itemize} +\item Dans les \texttt{\textbackslash scbox} : + +on les obtient avec + +\texttt{\textbackslash rb[]\{\}}\\ + +\item dans les \texttt{\textbackslash beginbox} : + +on les obtient avec + +\texttt{\textbackslash rbb[]\{\}}\\ +\end{itemize} + +Dans les deux cas, a par défaut la couleur de la boîte dans laquelle il est inscrit. Pour obtenir une boîte rectangulaire blanche, il suffit de mettre à white ou w.\\ + +En tapant : +\begin{verbatim} +\begin{Scratch} +\scbox{jouer le son \rb{miaou}}{son} +\scbox{penser à \rb[white]{Hmm\dots}}{app} +\scbox{demander \rb[w]{What's your name?} et attendre}{capt} +\end{Scratch} +\end{verbatim} + +on obtient :\\ + +\begin{Scratch} +\scbox{jouer le son \rb{miaou}}{son} +\scbox{penser à \rb[white]{Hmm\dots}}{app} +\scbox{demander \rb[w]{What's your name?} et attendre}{capt} +\end{Scratch} + +\subsubsection{Les petites boîtes circulaires}%%%%%%%%%%%%%%%%%%%%%%%% + +Elles sont en creux ou en relief. + +On les obtient avec + +\texttt{\textbackslash cb[]\{\}}\\ + +Par défaut, est de la couleur de la boîte dans laquelle la boîte circulaire est insérée. Si est white ou w, la boite circulaire est en creux.\\ + +En tapant : +\begin{verbatim} +\begin{Scratch} +\scbox{mettre la transparence vidéo à \cb{réponse} \%}{capt} +\scbox{aller à x:\cb[w]{x} y:\cb[white]{y}}{mvt} +\scbox{ajouter \cb[data]{variable} au tempo}{son} +\end{Scratch} +\end{verbatim} + +on obtient :\\ + +\begin{Scratch} +\scbox{mettre la transparence vidéo à \cb{réponse} \%}{capt} +\scbox{aller à x:\cb[w]{x} y: \cb[white]{y}}{mvt} +\scbox{ajouter \cb[data]{variable} au tempo}{son} +\end{Scratch} + + +\subsubsection{Les petites boîtes hexagonales}%%%%%%%%%%%%%%%%%%%%%%%% +Elles ne concernent que les commandes \emph{Capteurs} et \emph{Opérateurs}. + +On les obtient avec + +\texttt{\textbackslash hb[]\{\}}\\ + +Par défaut, est ope. + +En tapant : +\begin{verbatim} +\begin{Scratch} +\boucle{si \hb{\cb[data]{variable}=\rb[w]{10}} alors}{1}{1} +\scbox{attendre jusqu'à \hb[capt]{souris pressée?}}{ctrl} +\end{Scratch} +\end{verbatim} + +on obtient :\\ + +\begin{Scratch} +\boucle{si \hb{\cb[data]{variable}=\rb[w]{10}} alors}{1}{1} +\scbox{attendre jusqu'à \hb[capt]{souris pressée?}}{ctrl} +\end{Scratch} + + +\subsubsection{Les petites boîtes carrées}%%%%%%%%%%%%%%%%%%%%%%%% +Elles ne concernent que les carrés de couleur. + +On les obtient avec + +\texttt{\textbackslash sqb\{\}}\\ + +En tapant : +\begin{verbatim} +\begin{Scratch} +\scbox{mettre la couleur du stylo à \sqb{brown}}{stylo} +\end{Scratch} +\end{verbatim} + +on obtient : \raisebox{-3mm}{\begin{Scratch} +\scbox{mettre la couleur du stylo à \sqb{brown}}{stylo} +\end{Scratch}} + +%----------------------------------------------------------------------------------------------------------------------------------% +\subsection{Des commandes plus riches} + +\begin{Scratch}%%%%%%%%%%%%%%%%%%%%%%%% 1 +\beginbox{clone} +\boucle{répéter jusqu'à \hb[capt]{couleur \sqb{black} + touche \sqb{yellow} ? }}{1}{1} +\scbox{aller à x: \cb[ope]{\cb[data]{x}+\cb[w]{10}} y: \cb[data]{y}}{mvt} +\boucle{si \hb{\cb[data]{y}<\cb[capt]{réponse}} alors}{3}{1} +\scbox{mettre \rb{y} à \cb[son]{volume}}{data} +\scbox{dire \rb[w]{Hello!} pendant \cb[capt]{distance de +\rb{pointeur de souris} } secondes}{app} +\kbox{stop \rb{tout}} +\turnbox{2}{-146} +\end{Scratch} + +Obtenu avec : + +\begin{verbatim} +\begin{Scratch} +\beginbox{clone} +\boucle{répéter jusqu'à \hb[capt]{couleur \sqb{black} +touche \sqb{yellow} ? }}{1}{1} +\scbox{aller à x: \cb[ope]{\cb[data]{x}+\cb[w]{10}} y: \cb[data]{y}}{mvt} +\boucle{si \hb{\cb[data]{y}<\cb[capt]{réponse}} alors}{3}{1} +\scbox{mettre \rb{y} à \cb[son]{volume}}{data} +\scbox{dire \rb[w]{Hello!} pendant \cb[capt]{distance de +\rb{pointeur de souris}} secondes}{app} +\kbox{stop \rb{tout}} +\turnbox{2}{-146} +\end{Scratch} +\end{verbatim} + +%----------------------------------------------------------------------------------------------------------------------------------% +\subsection{Autre type de commandes} + +\subsubsection{Dans les boucles}%%%%%%%%%%%%%%%%%%%%%% + +La commande \texttt{\textbackslash blank} ne s'emploie (artificiellement) que lorsque dans le programme Scratch, deux boucles se terminent l'une après l'autre.\\ + +En tapant : +\begin{verbatim} +\begin{Scratch} +\boucle{répéter \cb[w]{3} fois}{4}{1} +\scbox{avancer de \cb[w]{10}}{mvt} +\boucle{répéter \cb[w]{5} fois}{1}{1} +\scbox{ajouter \cb[w]{10} à x}{mvt} +\scbox{ce bloc ne va pas}{data} +\end{Scratch} +\end{verbatim} + +on obtient :\\ + +\begin{Scratch} +\boucle{répéter \cb[w]{3} fois}{4}{1} +\scbox{avancer de \cb[w]{10}}{mvt} +\boucle{répéter \cb[w]{5} fois}{1}{1} +\scbox{ajouter \cb[w]{10} à x}{mvt} +\scbox{ce bloc ne va pas}{data} +\end{Scratch} + +\vspace{0.5cm} + +Alors qu'en tapant : +\begin{verbatim} +\begin{Scratch} +\boucle{répéter \cb[w]{3} fois}{4}{1} +\scbox{avancer de \cb[w]{10}}{mvt} +\boucle{répéter \cb[w]{5} fois}{1}{1} +\scbox{ajouter \cb[w]{10} à x}{mvt} +\blank +\scbox{ce bloc est bien placé}{data} +\end{Scratch} +\end{verbatim} + +on obtient :\\ + +\begin{Scratch} +\boucle{répéter \cb[w]{3} fois}{4}{1} +\scbox{avancer de \cb[w]{10}}{mvt} +\boucle{répéter \cb[w]{5} fois}{1}{1} +\scbox{ajouter \cb[w]{10} à x}{mvt} +\blank +\scbox{ce bloc est bien placé}{data} +\end{Scratch} + +\vspace{0.5cm} + +Noter que si l'on tape : +\begin{verbatim} +\begin{Scratch} +\boucle{répéter \cb[w]{3} fois}{5}{1} +\scbox{avancer de \cb[w]{10}}{mvt} +\boucle{répéter \cb[w]{5} fois}{1}{1} +\scbox{ajouter \cb[w]{10} à x}{mvt} +\scbox{ce bloc est placé autrement}{data} +\end{Scratch} +\end{verbatim} + +on obtient :\\ + +\begin{Scratch} +\boucle{répéter \cb[w]{3} fois}{5}{1} +\scbox{avancer de \cb[w]{10}}{mvt} +\boucle{répéter \cb[w]{5} fois}{1}{1} +\scbox{ajouter \cb[w]{10} à x}{mvt} +\scbox{ce bloc est placé autrement}{data} +\end{Scratch} + + +\subsubsection{Dessiner le chat} + +Le chat de la couverture est obtenu en appelant la commande : + +\texttt{\small\textbackslash Scratchy[<échelle>][]} + +Par défaut, l'échelle est 0.25 et la largeur des lignes est fixée à 0.25 pt.\\ + +Voici le code écrit pour la couverture : +\begin{verbatim} +\parbox{1ex}{\Scratchy[0.1][0.1]}\\ + +\hspace{1cm}\parbox{1ex}{\Scratchy[0.2][0.2]}\\ + +\hspace{2cm}\parbox{1ex}{\Scratchy[0.5][1]}\\ + +\hspace{5cm}\parbox{1ex}{\Scratchy[0.75][1.5]}\\ +\end{verbatim} + +\newpage +%----------------------------------------------------------------------------------------------------------------------------------% +%----------------------------------------------------------------------------------------------------------------------------------% +\section{Problèmes connus et solutions} +\begin{enumerate} +\item +On n'a pas le petit triangle dans la commande \emph{s'orienter à} (mouvement). Il faut le placer à la main. +\begin{verbatim} +\scbox{s'orienter à \cb[w]{90 \scriptsize$\blacktriangledown$}}{mvt} +\end{verbatim} +\raisebox{-3mm}{\begin{Scratch}\scbox{s'orienter à \cb[w]{90 \scriptsize$\blacktriangledown$}}{mvt}\end{Scratch}}\\ + +\item La hauteur des boîtes est fixée. Ainsi, on ne peut pas imbriquer beaucoup de sous-commandes dans des commandes Scratch.\\ + +\item Lorsque l'on insère une seule commande Scratch dans du texte, elle n'est pas centrée verticalement. On peut la réajuster avec un \texttt{\textbackslash raisebox\{-3mm\}}.\\ + +\item Il y a un également un décalage horizontal. À la fin d'un environnement Scratch, il faut souvent ajouter un \texttt{\textbackslash hspace\{-1cm\}}.\\ + +\item Le temps de compilation est parfois assez long. +\end{enumerate} + +%----------------------------------------------------------------------------------------------------------------------------------% +%----------------------------------------------------------------------------------------------------------------------------------% +\section{Résumé des commandes} + +\begin{tabular}{m{5cm}l}%%%%%%%%%% +\texttt{\small\textbackslash beginbox\{\}} + +&\begin{Scratch}[0.75] +\beginbox{} +\end{Scratch} +\\%%%%%%%%%% +\texttt{\small\textbackslash beginbox\{\}} + +\tiny(quand ce lutin est cliqué) +&\begin{Scratch}[0.75] +\beginbox{quand ce lutin est cliqué} +\end{Scratch}\\%%%%%%%%%% +\texttt{\small\textbackslash beginbox\{clone\}} + +&\begin{Scratch}[0.75] +\beginbox{clone} +\end{Scratch} +\\%%%%%%%%%% +\texttt{\small\textbackslash blocbox\{\}} + +&\begin{Scratch}[0.75] +\blocbox{fonction} +\end{Scratch} +\\%%%%%%%%%% +\texttt{\small\textbackslash turnbox\{\}\{90\}} + +&\begin{Scratch}[0.75] +\turnbox{}{90} +\end{Scratch}\\%%%%%%%%%% +\texttt{\small\textbackslash turnbox\{g\}\{-270\}} + +\tiny(ou ou ou ) +&\begin{Scratch}[0.75] +\turnbox{g}{-270} +\end{Scratch} +\\%%%%%%%%%% +\texttt{\small\textbackslash scbox\{\}\{\}} + +&\begin{Scratch}[0.75] +\scbox{texte et couleur que l'on veut}{purple} +\end{Scratch}\\%%%%%%%%%% +\texttt{\small\textbackslash boucle\{répéter\}\{2\}\{1\}} +\tiny(\{\}\{\}\{\}) +\vspace{3cm} +&\begin{Scratch}[0.75] +\boucle{répéter}{2}{1} +\end{Scratch}\vspace{-1.5cm} +\\%%%%%%%%%% +\texttt{\small\textbackslash boucle\{répéter indéfiniment\}\{1\}\{-1\}} + +\tiny(\{\}\{\}\{\}) +\vspace{2cm} +&\begin{Scratch}[0.75] +\boucle{répéter indéfiniment}{1}{-1} +\end{Scratch}\vspace{-1.2cm} +\\%%%%%%%%%% +\texttt{\small\textbackslash boucle\{si \dots alors\}\{1\}\{2\}} + +\tiny(\{\}\{\}\{\}) +\vspace{2cm} +&\begin{Scratch}[0.75] +\boucle{si \dots alors}{1}{2} +\end{Scratch}\vspace{-1.2cm} +\\%%%%%%%%%% + +\texttt{\small\textbackslash sailors\{si\dots alors\dots\}\{2\}} + +\tiny(\{\}\{\}) +\vspace{2cm} +&\begin{Scratch}[0.75] +\sailors{si\dots alors\dots}{2} +\end{Scratch}\vspace{-1cm} +\\%%%%%%%%%% +\texttt{\small\textbackslash simenon\{\}} + +\tiny(ici, \textbackslash simenon\{1\}) +\vspace{2.2cm} +&\begin{Scratch}[0.75] +\whitesailors{il faut que ce }{1} +\simenon{1} +\end{Scratch}\vspace{-1.2cm} +\\%%%%%%%%%% +\texttt{\small\textbackslash kbox\{\}} + +&\begin{Scratch}[0.75] +\kbox{supprimer ce clone} +\end{Scratch} +\\%%%%%%%%%% +\end{tabular} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\begin{tabular}{m{5cm}l} +\texttt{\small\textbackslash rb\{\}} + +\tiny (\texttt{\textbackslash rb\{variable\}}) +&\begin{Scratch}[0.75] +\scbox{\phantom{tex} \rb{variable} \phantom{tex}}{data} +\end{Scratch} +\\ +\texttt{\small\textbackslash rb[w]\{\}} + +\tiny(ou \texttt{\textbackslash rb[white]\{\}}) +&\begin{Scratch}[0.75] +\scbox{\phantom{tex} \rb[w]{texte} }{data} +\end{Scratch} +\\ +\texttt{\small\textbackslash rbb\{\}} + +\tiny(uniquement pour \texttt{\textbackslash beginbox}) + +\texttt{\textbackslash beginbox\{quand je reçois \textbackslash rbb\{message1\}\}} +&\begin{Scratch}[0.75] +\beginbox{quand je reçois \rbb{message1}} +\end{Scratch} +\\ + +\texttt{\small\textbackslash cb\{\}} + +\tiny(transparent) +&\begin{Scratch}[0.75] +\scbox{\phantom{rex} \cb{réponse}}{ctrl} +\end{Scratch} +\\ +\texttt{\small\textbackslash cb[w]\{\}} + +\tiny(ou \textbackslash cb[white]\{\}) +&\begin{Scratch}[0.75] +\scbox{\phantom{rex} \cb[w]{réponse}}{ctrl} +\end{Scratch} +\\ +\texttt{\small\textbackslash cb[]\{\}} + +\texttt{\tiny\textbackslash cb[ope]\{réponse\}} +&\begin{Scratch}[0.75] +\scbox{\phantom{rex} \cb[ope]{réponse}}{ctrl} +\end{Scratch} +\\ +\texttt{\small\textbackslash hb\{\}} + +&\begin{Scratch}[0.75] +\scbox{\phantom{rex} \hb{réponse}}{ctrl} +\end{Scratch} +\\ + +\texttt{\small\textbackslash hb[capt]\{\}} + +&\begin{Scratch}[0.75] +\scbox{\phantom{rex} \hb[capt]{réponse}}{ctrl} +\end{Scratch} +\\ +\texttt{\small\textbackslash sqb\{\}} + +&\begin{Scratch}[0.75] +\scbox{mettre la couleur du stylo à \sqb{red}}{stylo} +\end{Scratch} +\\ + +\end{tabular} + +%----------------------------------------------------------------------------------------------------------------------------------% +%----------------------------------------------------------------------------------------------------------------------------------% +\newpage +\section{Exemples de programme} + +\begin{verbatim} +\begin{Scratch} +\boucle{répéter \cb[w]{3} fois}{5}{1} +\scbox{avancer de \cb[w]{10}}{mvt} +\boucle{répéter \cb[w]{5} fois}{1}{1} +\scbox{ajouter \cb[w]{10} à x}{mvt} +\scbox{ce bloc est placé autrement}{data} +\scbox{un nouveau bloc}{son} +\end{Scratch} +\end{verbatim} + +\begin{verbatim} +\begin{Scratch} +\beginbox{quand \rbb{espace} est pressé} +\boucle{répéter \cb[w]{3} fois}{8}{1} + \scbox{aller à x: \cb[w]{0} y: \cb[data]{y}}{mvt} + \boucle{répéter \cb[w]{2} fois}{3}{1} + \scbox{mettre \rb{x} à \rb[w]{0}}{data} + \scbox{ajouter à \rb{y} \cb[w]{10}}{data} + \scbox{mettre la couleur du stylo à \sqb{red}}{stylo} + \scbox{mon bloc}{bloc} + \scbox{montrer}{app} +\scbox{effacer tout}{stylo} +\end{Scratch} +\end{verbatim} +\begin{center} +\begin{tabular}{cc}%\hline +\parbox[b]{5.5cm}{ +\hspace{1cm}deuxième programme $\rightarrow$ +\vspace{2em} +\par +premier programme +\par +\hspace{1.25em}$\downarrow$ +\par +\begin{Scratch} +\boucle{répéter \cb[w]{3} fois}{5}{1} +\scbox{avancer de \cb[w]{10}}{mvt} +\boucle{répéter \cb[w]{5} fois}{1}{1} +\scbox{ajouter \cb[w]{10} à x}{mvt} +\scbox{ce bloc est placé \dots}{data} +\scbox{un nouveau bloc}{son} +\end{Scratch} +} +& +\begin{Scratch} +\beginbox{quand \rbb{espace} est pressé} +\boucle{répéter \cb[w]{3} fois}{8}{1} + \scbox{aller à x: \cb[w]{0} y: \cb[data]{y}}{mvt} + \boucle{répéter \cb[w]{2} fois}{3}{1} + \scbox{mettre \rb{x} à \rb[w]{0}}{data} + \scbox{ajouter à \rb{y} \cb[w]{10}}{data} + \scbox{mettre la couleur du stylo à \sqb{red}}{stylo} + \scbox{mon bloc}{bloc} + \scbox{montrer}{app} +\scbox{effacer tout}{stylo} +\end{Scratch} +\end{tabular} +\end{center} +\newpage +%----------------------------------------------------------------------------------------------------------------------------------% +\subsection{Des boucles imbriquées} + +%%%%%%%%%%%%%%%%%%%%%%%% 1 +\begin{verbatim} +\begin{Scratch} +\beginbox{quand \rb{chronomètre} > \cb[w]{10}} + +\sailors{si \hb[capt]{touche \rb{espace} pressée?} alors}{12} + + \sailors{si \hb[capt]{souris pressée?} alors}{1} + \scbox{aller à x: \cb[w]{0} y: \cb[w]{0}}{mvt} + + \simenon{2} + \scbox{donner la valeur \cb[w]{0} à x}{mvt} + \scbox{ajouter \cb[w]{10} à y}{mvt} + + \sailors{si couleur \sqb{son} touchée?}{1} + \scbox{aller à x: \cb[w]{0} y: \cb[w]{0}}{mvt} + + \simenon{1} + \scbox{donner la valeur \cb[w]{0} à x}{mvt} + + \simenon{1} + \scbox{donner la valeur \cb[w]{0} à y}{mvt} + +\sailors{si \hb[capt]{souris pressée?} alors}{1} + \scbox{ajouter \cb[w]{10} à y}{mvt} + +\simenon{2} + \scbox{donner la valeur \cb[w]{0} à x}{mvt} + \scbox{cacher la variable \rb{variable}}{data} + +\end{Scratch} +\end{verbatim} + +\begin{center} +\begin{Scratch}[1]%%%%%%%%%%%%%%%%%%%%%%%% 1 +\beginbox{quand \rb{chronomètre} > \cb[w]{10}} + +\sailors{si \hb[capt]{touche \rb{espace} pressée?} alors}{12} + + \sailors{si \hb[capt]{souris pressée?} alors}{1} + \scbox{aller à x: \cb[w]{0} y: \cb[w]{0}}{mvt} + + \simenon{2} + \scbox{donner la valeur \cb[w]{0} à x}{mvt} + \scbox{ajouter \cb[w]{10} à y}{mvt} + + \sailors{si couleur \sqb{son} touchée?}{1} + \scbox{aller à x: \cb[w]{0} y: \cb[w]{0}}{mvt} + + \simenon{1} + \scbox{donner la valeur \cb[w]{0} à x}{mvt} + + \simenon{1} + \scbox{donner la valeur \cb[w]{0} à y}{mvt} + +\sailors{si \hb[capt]{souris pressée?} alors}{1} + \scbox{ajouter \cb[w]{10} à y}{mvt} + +\simenon{2} + \scbox{donner la valeur \cb[w]{0} à x}{mvt} + \scbox{cacher la variable \rb{variable}}{data} + +\end{Scratch}\end{center} +\newpage +%%%%%%%%%%%%%%%%%%%%%%%% 2 +\begin{verbatim} +\begin{Scratch} +\beginbox{} + +\sailors{si couleur \sqb{stylo} touchée?}{12} + + \sailors{si \hb[capt]{souris pressée?} alors}{6} + \scbox{aller à x: \cb[w]{0} y: \cb[w]{0}}{mvt} + + \sailors{si \hb[capt]{touche \rb{espace} pressée?} alors}{1} + \scbox{aller à x: \cb[w]{0} y: \cb[w]{0}}{mvt} + + \simenon{1} + \scbox{donner la valeur \cb[w]{0} à x}{mvt} + + \simenon{2} + \scbox{donner la valeur \cb[w]{0} à x}{mvt} + \scbox{ajouter \cb[w]{10} à y}{mvt} + + \simenon{1} + \scbox{donner la valeur \cb[w]{0} à x}{mvt} + +\end{Scratch} +\end{verbatim} +\begin{center} +\begin{Scratch}[1]%%%%%%%%%%%%%%%%%%%%%%%% 2 +\beginbox{} + +\sailors{si couleur \sqb{stylo} touchée?}{12} + + \sailors{si \hb[capt]{souris pressée?} alors}{6} + \scbox{aller à x: \cb[w]{0} y: \cb[w]{0}}{mvt} + + \sailors{si \hb[capt]{touche \rb{espace} pressée?} alors}{1} + \scbox{aller à x: \cb[w]{0} y: \cb[w]{0}}{mvt} + + \simenon{1} + \scbox{donner la valeur \cb[w]{0} à x}{mvt} + + \simenon{2} + \scbox{donner la valeur \cb[w]{0} à x}{mvt} + \scbox{ajouter \cb[w]{10} à y}{mvt} + + \simenon{1} + \scbox{donner la valeur \cb[w]{0} à x}{mvt} + +\end{Scratch}\end{center} + +\newpage +%%%%%%%%%%%%%%%%%%%%%%%% 3 +\begin{verbatim} +\begin{Scratch} +\beginbox{} +\boucle{répéter indéfiniment}{13}{-1} + \turnbox{}{24} + \boucle{répéter \cb[w]{4} fois}{2}{1} + \scbox{stylo en position d'écriture}{stylo} + \scbox{ajouter \cb[w]{20} au tempo}{son} + \boucle{quand le lutin s'en va}{6}{1} + \scbox{cacher la variable \rb{A}}{data} + \scbox{costume suivant}{app} + \scbox{arrêter tous les sons}{son} + \turnbox{g}{24} + \scbox{stylo en position d'écriture}{stylo} + \scbox{ajouter \cb[w]{20} au tempo}{son} + \blank +\end{Scratch} +\end{verbatim} +\begin{center} +\begin{Scratch}[1]%%%%%%%%%%%%%%%%%%%%%%%% 3 +\beginbox{} +\boucle{répéter indéfiniment}{13}{-1} + \turnbox{}{24} + \boucle{répéter \cb[w]{4} fois}{2}{1} + \scbox{stylo en position d'écriture}{stylo} + \scbox{ajouter \cb[w]{20} au tempo}{son} + \boucle{répéter \cb[w]{4} fois}{6}{1} + \scbox{cacher la variable \rb{A}}{data} + \scbox{costume suivant}{app} + \scbox{arrêter tous les sons}{son} + \turnbox{g}{24} + \scbox{stylo en position d'écriture}{stylo} + \scbox{ajouter \cb[w]{20} au tempo}{son} + \blank +\end{Scratch} +\end{center} +\newpage +%%%%%%%%%%%%%%%%%%%%%%%% 4 +\begin{verbatim} +\begin{Scratch} +\beginbox{quand on le veut} +\boucle{répéter un certain nombre de fois}{8}{1} + \scbox{aller à x: \cb[w]{0} y: \cb[w]{0}}{mvt} + \boucle{le dernier ??}{2}{1} + \scbox{on peut faire}{gray} + \scbox{ce que l'on veut}{black} + \boucle{ne pas répéter}{1}{1} + \scbox{faux bloc}{brown} + \blank +\scbox{dernier bloc}{pink} +\end{Scratch} +\end{verbatim} + +\begin{center} +\begin{Scratch}[1]%%%%%%%%%%%%%%%%%%%%%%%% 4 +\beginbox{quand on le veut} +\boucle{répéter un certain nombre de fois}{8}{1} + \scbox{aller à x: \cb[w]{0} y: \cb[w]{0}}{mvt} + \boucle{se répéter que}{2}{1} + \scbox{l'on peut faire}{gray} + \scbox{ce que l'on veut}{black} + \boucle{ne pas répéter}{1}{1} + \scbox{faux bloc}{brown} + \blank +\scbox{dernier bloc}{pink} +\end{Scratch} +\end{center} +\newpage +%%%%%%%%%%%%%%%%%%%%%%%% 5 +\begin{verbatim} +\begin{Scratch} +\beginbox{} +\boucle{répéter \cb[w]{3} fois}{19}{1} + \scbox{costume suivant}{app} + \scbox{arrêter tous les sons}{son} + \turnbox{1}{24} + \scbox{stylo en position d'écriture}{stylo} + \boucle{répéter \cb[data]{compteur} fois}{10}{1} + \scbox{ajouter \cb[w]{20} au tempo}{son} + \boucle{répéter \cb[ope]{\cb[data]{A}+1} fois}{6}{1} + \scbox{réinitialiser le chronomètre}{capt} + \boucle{répéter jusqu'à \hb[capt]{\rb{pointeur de souris} touché?}}{2}{1} + \scbox{cacher la variable \rb{A}}{data} + \scbox{avancer de 35}{mvt} + \scbox{regroupe \rb[w]{hello}\rb[w]{world}}{ope} + \scbox{nouveau bloc}{bloc} + \turnbox{2}{-146} + \scbox{estampiller}{stylo} + \scbox{annuler les effets graphiques}{app} +\sailors{si ça marche}{1} + \scbox{je suis content}{stylo} +\simenon{1} + \scbox{je suis déçu}{app} +\end{Scratch} +\end{verbatim} + +\begin{center} +\begin{Scratch}[1]%%%%%%%%%%%%%%%%%%%%%%%% 5 +\beginbox{} +\boucle{répéter \cb[w]{3} fois}{19}{1} + \scbox{costume suivant}{app} + \scbox{arrêter tous les sons}{son} + \turnbox{1}{24} + \scbox{stylo en position d'écriture}{stylo} + \boucle{répéter \cb[data]{compteur} fois}{10}{1} + \scbox{ajouter \cb[w]{20} au tempo}{son} + \boucle{répéter \cb[ope]{\cb[data]{A}+1} fois}{6}{1} + \scbox{réinitialiser le chronomètre}{capt} + \boucle{répéter jusqu'à \hb[capt]{\rb{pointeur de souris} touché?}}{2}{1} + \scbox{cacher la variable \rb{A}}{data} + \scbox{avancer de 35}{mvt} + \scbox{regroupe \rb[w]{hello}\rb[w]{world}}{ope} + \scbox{nouveau bloc}{bloc} + \turnbox{2}{-146} + \scbox{estampiller}{stylo} + \scbox{annuler les effets gRaphiques}{app} +\sailors{si ça marche}{1} + \scbox{je suis content}{stylo} +\simenon{1} + \scbox{je suis déçu}{app} +\end{Scratch} +\end{center} + +\newpage +%----------------------------------------------------------------------------------------------------------------------------------% +%----------------------------------------------------------------------------------------------------------------------------------% +\section{Conclusion} + +%Voilà une toute première version qui attend des améliorations. + +%La finalité étant d'en faire un package.\\ + +%C'est l'utilisation dans la durée de ce programme qui permettra de connaître ses faiblesses et surtout les points à améliorer.\\ + +Pour tout suggestion, remarque ou commentaire : + +Thibault.Ralet\at ac-clermont.fr. + +\end{document} +%% +%% This is file `ScratchX.sty', +%% +%% Copyright (C) Thibault Ralet - Thibault.Ralet@ac-clermont.fr +%% +%% 16 mars 2017 (version 0.1) - 27 juillet 2017 (version 1.1) +%% +%% the LaTeX Project Public License v1.3c or later, see http://www.latex-project.org/lppl.txt +%% +%% Unlimited copying and redistribution of this file are permitted as +%% long as this file is not modified. Modifications, and distribution +%% of modified versions, are permitted, but only if the resulting file +%% is renamed. \ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/scratchx/README.txt b/Master/texmf-dist/doc/latex/scratchx/README.txt new file mode 100644 index 00000000000..6fed6071af8 --- /dev/null +++ b/Master/texmf-dist/doc/latex/scratchx/README.txt @@ -0,0 +1,23 @@ +%———————————————————————————————————————————————————————————————————————————————————% + +The ScratchX package is used in order to include every kind of Scratch programs in LaTeX documents. +Particularly useful for Math Teachers ans IT specialists. + + +Le paquet ScratchX est utilisé pour écrire n’importe quel type de programme Scratch dans des documents LaTeX. +Notamment très utile pour les professeurs de Mathématiques et les informaticiens. + +%———————————————————————————————————————————————————————————————————————————————————% + +Author / auteur : Thibault Ralet +Version : 27 juillet 2017 (version 1.1) +E-mail : Thibault.Ralet@ac-clermont.fr +Licence : Released under the LaTeX Project Public License v1.3c or later, see http://www.latex-project.org/lppl.txt + +%———————————————————————————————————————————————————————————————————————————————————% + +Please read the user’s guide (Explanations_ScratchX.pdf) for further information. + +Lire le fichier d’aide (Explications_ScratchX.pdf) pour plus d’informations. + +%———————————————————————————————————————————————————————————————————————————————————% \ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/scratchx/ScratchX.sty b/Master/texmf-dist/tex/latex/scratchx/ScratchX.sty new file mode 100644 index 00000000000..66ba70e507a --- /dev/null +++ b/Master/texmf-dist/tex/latex/scratchx/ScratchX.sty @@ -0,0 +1,737 @@ +%% +%% This is file `ScratchX.sty', +%% +%% Copyright (C) 2016-2017 by Thibault Ralet - Thibault.Ralet@ac-clermont.fr +%% +%% 16 mars 2017 (version 0.1) - 27 juillet 2017 (version 1.1) +%% +%% The LaTeX Project Public License v1.3c or later, see http://www.latex-project.org/lppl.txt +%% +%% Unlimited copying and redistribution of this file are permitted as +%% long as this file is not modified. Modifications, and distribution +%% of modified versions, are permitted, but only if the resulting file +%% is renamed. + +\usepackage[nomessages]{fp} +\usepackage{calc} +\usepackage{xstring}%StrLen calcule des longueurs +\usepackage[alpine]{ifsym}%pour avoir le VarFlag comme drapeau de départ de Scratch +\usepackage{ifthen} +\usepackage{multido} +\usepackage{xargs} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%-------------------------------------------------------------- FIN PACKAGE -------------------------------------------------------------% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%-------------------------------------------------------- DÉBUT COMMANDES --------------------------------------------------------% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\newcounter{decalageX} +\newcounter{decalageY} +\newcounter{NbrCptrLoupe} +\newcounter{NbrCptrLoupeDuplicate} +\newcounter{NbrCptrAlors} +\newcounter{NbrCptrAlorsDuplicate} +\newcounter{CompteurMax}%garde en mémoire le maximum de compteurs "loupe" créés dans un environnement Scratch +\newlength{\malongueuR} +\newlength{\malongueuRE} + +%----------------------------------------------------- SCRATCH COLORS --------------------------------------------------------------% +\definecolor{mvt}{RGB}{85,120,216}%motion +\definecolor{app}{RGB}{152,97,218}%looks +\definecolor{son}{RGB}{202,77,199}%sound +\definecolor{stylo}{RGB}{10,164,122}%pen +\definecolor{data}{RGB}{249,133,58}%data +\definecolor{evt}{RGB}{213,140,73}%events +\definecolor{ctrl}{RGB}{237,178,71}%control +\definecolor{capt}{RGB}{35,176,231}%sensing +\definecolor{ope}{RGB}{90,193,69}%operators +\definecolor{bloc}{RGB}{110,56,155}%more blocks +\definecolor{flag}{RGB}{0,175,0}%flag +\definecolor{myblack}{RGB}{10,10,10} +%+10 to get R, G and V whiter + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%----------------------------------------------------------- SCRATCH BOXES ----------------------------------------------------------% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%-------------------------------------------------------- BEGIN BOX ----------------------------------------------------------------------% +\newcommand{\beginbox}[1]{%avec ou sans drapeau (hauteur de la boîte) +\ifthenelse{\equal{#1}{}} + {%avec le drapeau + \FPeval{X}{\x+(0.4)*\thedecalageX} + \FPeval{Y}{\y+(0.66)*(neg 1)*\thedecalageY} + \settowidth{\malongueuR}{\pgfinterruptpicture \texttt{quand \SFlag est cliqué} \endpgfinterruptpicture} + \FPeval{C}{2.51+X}\FPeval{d}{0.66+(Y)} + \FPeval{h}{(neg 0.2)+(Y)}\FPeval{i}{0.8+(X)}\FPeval{j}{0.7+(X)} + \FPeval{k}{0.5+(X)}\FPeval{kk}{(neg 0.3)+(Y)}\FPeval{l}{0.4+(X)}\FPeval{m}{0.1+(X)}\FPeval{n}{(neg 0.1)+(Y)} + \FPeval{t}{0.6+(Y)}\FPeval{T}{0.66+(neg 0.1)}\FPeval{D}{d+(neg 0.1)} + \coordinate (A) at ($(\X,\d) ! \malongueuR*1+0.1cm ! (\C,\d)$); + \coordinate (AA) at ($(\X,\T) ! \malongueuR*1+0.2cm ! (\C,\D)$); + \draw[black,fill=evt] (\C,\d)--(A)--(AA)--($(AA)+(0,-0.66)$)--($(A)+(0,-0.86)$)--(\i,\h)--(\j,\kk)--(\k,\kk)--(\l,\h)--(\m,\h)--(\X,\n)--(\X,\t)arc(120:63:2.6)--cycle; + \draw(\X,\h)node[above right]{\color{white}\texttt{quand \SFlag est cliqué}}; + \addtocounter{decalageY}{1} + } + {%les autres types + \FPeval{X}{x+(0.4)*\thedecalageX} + \FPeval{Y}{y+(neg 0.66)*\thedecalageY} +\ifthenelse{\equal{#1}{clone}} + {%pour l'instruction contrôle + \settowidth{\malongueuR}{\pgfinterruptpicture quand je commence comme un clone \endpgfinterruptpicture} + \def\couleur{ctrl} + \def\texte{quand je commence comme un clone} + } + {%tous les autres cas (événements) + \settowidth{\malongueuR}{\pgfinterruptpicture #1 \endpgfinterruptpicture} + \def\couleur{evt} + \def\texte{#1} + } + \FPeval{b}{neg 0.1+(Y)}\FPeval{C}{0.36+(Y)}\FPeval{D}{0.1+(X)} + \FPeval{e}{0.46+(Y)}\FPeval{f}{0.4+(X)}\FPeval{g}{0.5+(X)}\FPeval{h}{0.7+(X)} + \FPeval{i}{0.8+(X)} + \FPeval{l}{neg 0.2+(Y)} + \FPeval{m}{neg 0.3+(Y)}\FPeval{o}{0.1+(Y)} + \FPeval{F}{f+0.1}\FPeval{G}{g+0.1} + \coordinate (A) at ($(\D,\e) ! \malongueuR*1 ! (\f,\e)$); + \coordinate (AA) at ($(\X,\C) ! \malongueuR*1+0.2cm ! (\G,\C)$); + \draw[black,fill=\couleur](\X,\b)--(\X,\e)arc(120:60:2.6)--(A)--(AA)--($(AA)+(0,-0.46)$)--($(A)+(0,-0.66)$)--(\i,\l)--(\h,\m)--(\g,\m)--(\f,\l)--(\D,\l)--cycle; + \draw(\X,\o)node[right]{\color{white}\texttt{\texte}}; + \addtocounter{decalageY}{1} + } +} + +%-------------------------------------------------------- BLOC BOX ----------------------------------------------------------------------% +\newcommand{\blocbox}[1]{% + \FPeval{X}{0+(0.4)*\thedecalageX} + \FPeval{Y}{0+(neg 1.06)*\thedecalageY} + \StrLen{définir}[\valeur] + \settowidth{\malongueuR}{\pgfinterruptpicture #1 \endpgfinterruptpicture} + \def\texte{#1} + %pour la grande boîte : + \FPeval{b}{neg 0.1+(Y)}\FPeval{C}{0.76+(Y)}\FPeval{D}{0.1+(X)} + \FPeval{e}{0.76+(Y)}\FPeval{f}{0.4+(X)}\FPeval{g}{0.5+(X)}\FPeval{h}{0.7+(X)} + \FPeval{i}{0.8+(X)} + \FPeval{l}{neg 0.2+(Y)} + \FPeval{m}{neg 0.3+(Y)}\FPeval{o}{0.25+(Y)} + + \FPeval{F}{f+0.1}\FPeval{G}{g+0.1} + \coordinate (A) at ($(\D,\e) ! \malongueuR*1+\valeur/0.15 ! (\f,\e)$); + \coordinate (AA) at ($(\X,\C) ! \malongueuR*1+0.2cm+\valeur/0.15 ! (\G,\C)$); + + \coordinate (MXY) at ($0.5*(\X,\e)+0.5*(AA)$); + \coordinate (MMXY) at ($(MXY)+(0,0.4)$); + \draw[black,fill=bloc](\X,\b)--(\X,\e) parabola bend (MMXY)(AA)--($(AA)+(0,-0.86)$)--($(A)+(0,-0.96)$)--(\i,\l)--(\h,\m)--(\g,\m)--(\f,\l)--(\D,\l)--cycle; + %pour la petite boîte : + \FPeval{newX}{X+valeur*0.24} + \FPeval{newb}{0.1+(Y)}\FPeval{newC}{0.46+(Y)}\FPeval{newD}{0.1+(newX)} + \FPeval{newe}{0.56+(Y)}\FPeval{newf}{0.4+(newX)}\FPeval{newg}{0.5+(newX)}\FPeval{newh}{0.7+(newX)} + \FPeval{newi}{0.8+(newX)} + \FPeval{newl}{neg 0+(Y)} + \FPeval{newm}{neg 0.1+(Y)} + + \FPeval{newF}{newf+0.1}\FPeval{newG}{newg+0.1} + \coordinate (newA) at ($(\newD,\newe) ! \malongueuR*1-0.15cm ! (\newf,\newe)$); + \coordinate (newAA) at ($(\newX,\newC) ! \malongueuR*1+0.05cm ! (\newG,\newC)$); + \draw[app,thick](\newX,\newb)--(\newX,\newC)--(\newD,\newe)--(\newf,\newe)--(\newg,\newC)--(\newh,\newC)--(\newi,\newe)--(newA)--(newAA)--($(newAA)+(0,-0.36)$)--($(newA)+(0,-0.56)$)--(\newi,\newl)--(\newh,\newm)--(\newg,\newm)--(\newf,\newl)--(\newD,\newl)--cycle; + + \draw(\X,\o)node[right]{\color{white}\texttt{définir \texte}}; + \addtocounter{decalageY}{1} + } + +%-------------------------------------------------------- TURN BOX -----------------------------------------------------------------------% +\newcommand{\turnbox}[2]{%turnbox{1: left; 2: right}{angle} + + \FPeval{X}{x+(0.4)*\thedecalageX} + \FPeval{Y}{y+(neg 0.66)*\thedecalageY} + + \StrLen{tourner de \quad degr és}[\valeur] + \StrLen{#2}[\valeurr] + \FPeval{V}{valeurr*0.15+X+3.05}\FPeval{VV}{valeurr*0.15+X} + \ifnum%Si l'angle est pluspetit que -99 ou plus grand que 100 + \ifnum#2>100 1 + \else \ifnum#2<-99 1 + \else 0 + \fi + \fi + =1 + \FPeval{IXE}{3.05+X}\FPeval{XX}{3.35+X} + \FPeval{j}{valeur*0.21+VV}\FPeval{k}{valeur*0.21+VV+0.1}%length of the box to the right + \else + \FPeval{IXE}{3.1+X}\FPeval{XX}{3.3+X} + \FPeval{j}{valeur*0.21+0.1+(X)}\FPeval{k}{valeur*0.21+0.2+(X)} + \fi + \FPeval{b}{neg 0.1+(Y)}\FPeval{C}{0.36+(Y)}\FPeval{d}{0.1+X}\FPeval{e}{0.46+(Y)}\FPeval{f}{0.4+X}\FPeval{g}{0.5+X}\FPeval{h}{0.7+X}\FPeval{i}{0.8+X}\FPeval{l}{neg 0.2+(Y)}\FPeval{m}{neg 0.3+(Y)}\FPeval{o}{0.1+(Y)}\FPeval{nn}{2+X}\FPeval{oo}{neg 0.1+(Y)}\FPeval{NN}{2.1+X}\FPeval{OO}{0.2+(Y)}\FPeval{NNN}{2.1+X}\FPeval{OOO}{0.2+(Y)}\FPeval{NNNN}{2.2+X}\FPeval{OOOO}{0.05+(Y)}\FPeval{nnn}{1.9+X}\FPeval{ooo}{0.25+(Y)}\FPeval{nnnn}{1.75+X}\FPeval{oooo}{0.05+(Y)}\FPeval{YY}{0.375+Y}\FPeval{YYY}{neg 0.065+Y} + \draw [black,fill=mvt](\X,\b)--(\X,\C)--(\d,\e)--(\f,\e)--(\g,\C)--(\h,\C)--(\i,\e)--(\j,\e)--(\k,\C)--(\k,\b)--(\j,\l)--(\i,\l)--(\h,\m)--(\g,\m)--(\f,\l)--(\d,\l)--cycle;%the box + \draw(\X,\o)node[right]{\color{white}\texttt{\,tourner \phantom{dg}\,de\cb[w]{#2}degrés}}; + \ifthenelse{\equal{#1}{g}\or\equal{#1}{G}\or\equal{#1}{gauche}} + {\draw[white,fill=white](\NN,\oo)arc(-60:140:0.2)--($(\NN-0.3,\oo+0.33)$)--($(\NN-0.32,\oo+0.16)$)--($(\NN-0.182,\oo+0.258)$)--($(\NN-0.23,\oo+0.2875)$)arc(140:-58:0.17)--cycle;}%curved left arrow + {\draw[white,fill=white](\NN,\OO)arc(39:240:0.2)--($(\NN-0.24,\OO-0.275)$)arc(240:41:0.17)--($(\NN-0.066,\OO-0.0365)$)--($(\NN+0.05,\OO-0.12)$)--($(\NN+0.04,\OO+0.021)$)--cycle;}%curved right arrow + +\multido{\i=1+1}{\value{NbrCptrLoupe}}{%Faire défiler tous les compteurs jusqu'au nombre de compteur : Si compteur différent de -1 : + % si différent de 0, leur enlever 1. / si égal à 0 : enlever 1 à décalageX et mettre le compteur correspondant à -1. + \ifthenelse{\value{loupe\i}>-1}{ + \ifthenelse{\value{loupe\i}=0} + {\addtocounter{decalageX}{-1}\addtocounter{decalageY}{1}\setcounter{loupe\i}{-1}%pour gérer le décalage quand boucle finie + \multido{\ia=1+1}{\i-1}{%si on termine une boucle mais que celle(s) d'avant ne sont pas terminées, alors on met -1 au compteur de celles d'avant + \ifthenelse{\value{loupe\ia}>0}{\addtocounter{loupe\ia}{-1}}{} + } + } + {\addtocounter{loupe\i}{-1}} + }{} + } + \addtocounter{decalageY}{1} +} + +%-------------------------------------------------------- SIMPLE BOX --------------------------------------------------------------------% +%\scbox{texte}{couleur} +\newcommand{\scbox}[2]{%pour faire une boite avec du texte où on veut + + \FPeval{X}{0+(0.4)*\thedecalageX} + \FPeval{Y}{0+(neg 0.66)*\thedecalageY} + \settowidth{\malongueuR}{\pgfinterruptpicture \text{#1} \endpgfinterruptpicture} + + \FPeval{b}{neg 0.1+(Y)}\FPeval{C}{0.36+(Y)}\FPeval{D}{0.1+(X)} + \FPeval{e}{0.46+(Y)}\FPeval{f}{0.4+(X)}\FPeval{g}{0.5+(X)}\FPeval{h}{0.7+(X)} + \FPeval{i}{0.8+(X)} + \FPeval{l}{neg 0.2+(Y)} + \FPeval{m}{neg 0.3+(Y)}\FPeval{o}{0.1+(Y)} + \FPeval{F}{f+0.1}\FPeval{G}{g+0.1} + \coordinate (A) at ($(\D,\e) ! \malongueuR ! (\f,\e)$); + \coordinate (AA) at ($(\X,\C) ! \malongueuR+0.2cm ! (\G,\C)$); + \draw[black,fill=#2](\X,\b)--(\X,\C)--(\D,\e)--(\f,\e)--(\g,\C)--(\h,\C)--(\i,\e)--(A)--(AA)--($(AA)+(0,-0.46)$)--($(A)+(0,-0.66)$)--(\i,\l)--(\h,\m)--(\g,\m)--(\f,\l)--(\D,\l)--cycle; + \draw(\X,\o)node[right]{\color{white}{\text{#1}}}; + + \multido{\i=1+1}{\value{NbrCptrLoupe}}{ %Faire défiler tous les compteurs jusqu'au nombre de compteur : Si compteur différent de -1 : + % si différent de 0, leur enlever 1. / si égal à 0 : enlever 1 à décalageX et mettre le compteur correspondant à -1. + \ifthenelse{\value{loupe\i}>-1}{ + \ifthenelse{\value{loupe\i}=0} + {\addtocounter{decalageX}{-1}\addtocounter{decalageY}{1}\setcounter{loupe\i}{-1}%pour gérer le décalage quand boucle finie + \multido{\ia=1+1}{\i-1}{%si on termine une boucle mais que celle d'avant ne sont pas terminées, alors on met -1 au compteur de celles d'avant + \ifthenelse{\value{loupe\ia}>0}{\addtocounter{loupe\ia}{-1}}{} + } + } + {\addtocounter{loupe\i}{-1}} + }{} + } + \addtocounter{decalageY}{1} +} + +%-------------------------------------------------------- BLANK BOX --------------------------------------------------------------------% +\newcommand{\blank}{%pour faire une boite blanche. SEULEMENT APRES DEUX FINS DE BOUCLE DE SUITE. VOIR EXEMPLE. + \multido{\i=1+1}{\value{NbrCptrLoupe}}{ %Faire défiler tous les compteurs jusqu'au nombre de compteur : Si compteur différent de -1 : + % si différent de 0, leur enlever 1. / si égal à 0 : enlever 1 à décalageX et mettre le compteur correspondant à -1. + \ifthenelse{\value{loupe\i}>-1}{ + \ifthenelse{\value{loupe\i}=0} + {\addtocounter{decalageX}{-1}\addtocounter{decalageY}{1}\setcounter{loupe\i}{-1}%pour gérer le décalage quand boucle finie + \multido{\ia=1+1}{\i-1}{%si on termine une boucle mais que celle d'avant ne sont pas terminées, alors on met -1 au compteur de celles d'avant + \ifthenelse{\value{loupe\ia}>0}{\addtocounter{loupe\ia}{-1}}{} + } + } + {\addtocounter{loupe\i}{-1}} + }{} + } +} + +%----------------------------------------------------------- BOUCLE -----------------------------------------------------------------------% +%\boucle{text}{number of blocks inside}{type : -1 means infinite loop ; 1 means with the arrow (répéter); 2 means si ... alors. +\newcommand{\boucle}[3]{%loop with as many blocks as we want + % Créer un compteur à chaque passage dans cette boucle. % l'incrémenter du nombre de fois où ce décalage s'opère + % décaler en abscisse : ajouter 0,4 à x % mettre le compteur NbreComptr à NbreComptr+1 + %\addtocounter{CompteurMax}{1} +\ifthenelse{\value{NbrCptrLoupeDuplicate}=0}%aucun compteurs loupe créés + { + \ifthenelse{\value{CompteurMax}=0} + {\loope{\theNbrCptrLoupe}{#2}} + { + \ifthenelse{\value{NbrCptrLoupe}<\value{CompteurMax}}%\or\value{NbrCptrLoupe}=\value{CompteurMax}} + {\looope{\theNbrCptrLoupe}{#2}} + {\loope{\theNbrCptrLoupe}{#2}}%pour ne pas recréer des compteurs déjà créés + } + } + {\looope{\theNbrCptrLoupe}{#2}} + +\settowidth{\malongueuR}{\pgfinterruptpicture #1 \endpgfinterruptpicture} + + \FPeval{X}{\x+(0.4)*\thedecalageX} + \FPeval{Y}{\y+(neg 0.66)*\thedecalageY} + \FPeval{b}{neg 0.1+Y}\FPeval{C}{0.36+Y}\FPeval{d}{0.1+X} + \FPeval{e}{0.46+Y}\FPeval{f}{0.4+X}\FPeval{g}{0.5+X}\FPeval{h}{0.7+X}\FPeval{i}{0.8+X}\FPeval{j}{0.7+(X)} + \FPeval{ii}{1.2+X}\FPeval{iii}{1.1+X}\FPeval{iiii}{0.9+X}\FPeval{gg}{0.6+X} + \FPeval{l}{neg 0.2+(Y)}\FPeval{m}{neg 0.3+(Y)}\FPeval{o}{0.1+(Y)} + %top + %bottom + \FPeval{mm}{neg 0.1+(neg 0.66)*(#2)+(Y)} + \FPeval{mmm}{neg 0.2+(neg 0.66)*(#2)+(Y)}\FPeval{mmmm}{neg 0.3+(neg 0.66)*(#2)+(Y)}\FPeval{M}{neg 0.75+(neg 0.66)*(#2)+(Y)}\FPeval{MM}{neg 0.85+(neg 0.66)*(#2)+(Y)}\FPeval{MN}{neg 0.95+(neg 0.66)*(#2)+(Y)}\FPeval{MMM}{neg 0.55+(neg 0.66)*(#2)+(Y)}\FPeval{MMMM}{MMM-0.02}\FPeval{JJ}{j+0.02}%adjusting the height of the bottom + \coordinate (A) at ($(\d,\e) ! \malongueuR ! (\f,\e)$); + \coordinate (AA) at ($(\X,\C) ! \malongueuR+0.2cm ! (\g,\C)$); + \coordinate (BB) at ($(\X,\M) ! \malongueuR+0.2cm ! (\f,\M)$); + \coordinate (B) at ($(\g,\mmm) ! \malongueuR-0.4cm ! (\i,\mmm)$); + \ifnum#3=-1%infinite loop + \draw [black,fill=ctrl](\X,\C)--(\d,\e)--(\f,\e)--(\g,\C)--(\h,\C)--(\i,\e)--(A)--(AA)--($(AA)+(0,-0.46)$) -- ($(A)+(0,-0.66)$)--(\ii,\l)--(\iii,\m)--(\iiii,\m)--(\i,\l)--(\g,\l)--(\f,\m)--(\f,\mm)--(\g,\mmm)--(\i,\mmm)--(\iiii,\mmmm)--(\iii,\mmmm)--(\ii,\mmm)--(B)--($(B)+(0.1,-0.1)$)--(BB)--($(BB)+(-0.1,-0.1)$)--(\d,\MM)--(\X,\M)--cycle; + \else%nombre fois loop + \draw [black,fill=ctrl](\X,\C) -- (\d,\e) -- (\f,\e) -- (\g,\C) -- (\h,\C) -- (\i,\e) -- (A) -- (AA) -- ($(AA)+(0,-0.46)$) -- ($(A)+(0,-0.66)$) -- (\ii,\l) -- (\iii,\m) -- (\iiii,\m) -- (\i,\l) -- (\g,\l) -- (\f,\m) -- (\f,\mm) -- (\g,\mmm) -- (\i,\mmm) -- (\iiii,\mmmm) -- (\iii,\mmmm) -- (\ii,\mmm) -- (B) -- ($(B)+(0.1,-0.1)$) -- (BB) -- ($(BB)+(-0.1,-0.1)$) -- (\i,\MM) -- (\h,\MN) -- (\g,\MN) -- (\f,\MM) -- (\d,\MM) -- (\X,\M) -- cycle ; + \fi + \draw (\X,\o) node[right]{\color{white}\texttt{#1}}; + \ifnum#3=2 + {} + \else + {\draw ($(BB)+(0.02,-0.17)$) node[above left]{\rotatebox{-90}{\Huge$\Lsh$}} ; + \draw($(BB)+(0,-0.15)$) node[above left]{\rotatebox{-90}{\Huge\color{white}$\Lsh$}} ;} + \fi + + +\multido{\i=1+1}{\value{NbrCptrLoupe}}{%Fait défiler tous les compteurs jusqu'au nombre de compteurs : si compteur différent de -1 : + % si différent de 0, leur enlever 1. / si égal à 0 : enlever 1 à décalageX et mettre le compteur correspondant à -1. + \ifthenelse{\value{loupe\i}>-1}{ + \ifthenelse{\value{loupe\i}=0} + {\addtocounter{decalageX}{-1}\addtocounter{decalageY}{1}\setcounter{loupe\i}{-1}} + {\addtocounter{loupe\i}{-1}} + }{} + } +\addtocounter{decalageX}{1} +\addtocounter{decalageY}{1} +} + +%----------------------------------------------------------- SI ALORS ---------------------------------------------------------------------- +%\boucle{text}{number of blocks inside the si...alors} +\newcommand{\sailors}[2]{%loop with as many blocks as we want + % Créer un compteur à chaque passage dans cette boucle. % l'incrémenter du nombre de fois où ce décalage s'opère + % décaler en abscisse : ajouter 0,4 à x % mettre le compteur NbreComptr à NbreComptr+1 +\ifthenelse{\value{NbrCptrLoupeDuplicate}=0}%aucun compteurs loupe créés + { + \ifthenelse{\value{CompteurMax}=0} + {\loope{\theNbrCptrLoupe}{#2}} + { + \ifthenelse{\value{NbrCptrLoupe}<\value{CompteurMax}}%\or\value{NbrCptrLoupe}=\value{CompteurMax}} + {\looope{\theNbrCptrLoupe}{#2}} + {\loope{\theNbrCptrLoupe}{#2}}%pour ne pas recréer des compteurs déjà créés + } + } + {\looope{\theNbrCptrLoupe}{#2}} + +\ifthenelse{\value{NbrCptrAlorsDuplicate}=0}%aucun compteurs aloors créés + {\sialoors{#1}} + {\sialooors{#1}}%pour ne pas recréer des compteurs déjà créés +\settowidth{\malongueuR}{\pgfinterruptpicture #1 \endpgfinterruptpicture} + + \FPeval{X}{\x+(0.4)*\thedecalageX} + \FPeval{Y}{\y+(neg 0.66)*(\thedecalageY)} + + \FPeval{b}{neg 0.1+Y}\FPeval{C}{0.36+Y}\FPeval{d}{0.1+X} + \FPeval{e}{0.46+Y}\FPeval{f}{0.4+X}\FPeval{g}{0.5+X}\FPeval{h}{0.7+X}\FPeval{i}{0.8+X}\FPeval{j}{0.7+(X)} + \FPeval{ii}{1.2+X}\FPeval{iii}{1.1+X}\FPeval{iiii}{0.9+X}\FPeval{gg}{0.6+X} + \FPeval{l}{neg 0.2+(Y)}\FPeval{m}{neg 0.3+(Y)}\FPeval{o}{0.1+(Y)} + %top + %bottom#1 + \FPeval{mm}{neg 0.1+(neg 0.66)*(#2)+(Y)} + \FPeval{mmm}{neg 0.2+(neg 0.66)*(#2)+(Y)}\FPeval{mmmm}{neg 0.3+(neg 0.66)*(#2)+(Y)}\FPeval{M}{neg 0.75+(neg 0.66)*(#2)+(Y)}\FPeval{MM}{neg 0.85+(neg 0.66)*(#2)+(Y)}\FPeval{MN}{neg 0.95+(neg 0.66)*(#2)+(Y)}\FPeval{MMM}{neg 0.55+(neg 0.66)*(#2)+(Y)}\FPeval{MMMM}{MMM-0.02}\FPeval{JJ}{j+0.02}%adjusting the height of the bottom + \coordinate (A) at ($(\d,\e) ! \malongueuR ! (\f,\e)$); + \coordinate (AA) at ($(\X,\C) ! \malongueuR+0.2cm ! (\g,\C)$); + \coordinate (BB) at ($(\X,\M) ! \malongueuR+0.2cm ! (\f,\M)$); + \coordinate (B) at ($(\g,\mmm) ! \malongueuR-0.4cm ! (\i,\mmm)$); + + \draw [ctrl,fill=ctrl](\X,\C)--(\d,\e)--(\f,\e)--(\g,\C)--(\h,\C)--(\i,\e)--(A)--(AA)--($(AA)+(0,-0.46)$) -- ($(A)+(0,-0.66)$)--(\ii,\l)--(\iii,\m)--(\iiii,\m)--(\i,\l)--(\g,\l)--(\f,\m)--(\f,\mm)--(\g,\mmm)--(\X,\mmm)--cycle; + \draw [black](\X,\mmm)--(\X,\C)--(\d,\e)--(\f,\e)--(\g,\C)--(\h,\C)--(\i,\e)--(A)--(AA)--($(AA)+(0,-0.46)$) -- ($(A)+(0,-0.66)$)--(\ii,\l)--(\iii,\m)--(\iiii,\m)--(\i,\l)--(\g,\l)--(\f,\m)--(\f,\mm)--(\g,\mmm); + \draw (\X,\o) node[right]{\color{white}\texttt{#1}}; + +\multido{\i=1+1}{\value{NbrCptrLoupe}}{%Fait défiler tous les compteurs jusqu'au nombre de compteurs : si compteur différent de -1 : + % si différent de 0, leur enlever 1. / si égal à 0 : enlever 1 à décalageX et mettre le compteur correspondant à -1. + \ifthenelse{\value{loupe\i}>-1}{ + \ifthenelse{\value{loupe\i}=0} + {\addtocounter{decalageX}{-1}\addtocounter{decalageY}{1}\setcounter{loupe\i}{-1}} + {\addtocounter{loupe\i}{-1}} + }{} + } +\addtocounter{decalageX}{1} +\addtocounter{decalageY}{1} +} + +%-------------------------------------------------------------- SINON -----------------------------------------------------------------------% +\newcommand{\simenon}[1]{%loop with as many blocks as we want + % Créer un compteur à chaque passage dans cette boucle. % l'incrémenter du nombre de fois où ce décalage s'opère + % décaler en abscisse : ajouter 0,4 à x % mettre le compteur NbreComptr à NbreComptr+1 +\ifthenelse{\value{NbrCptrLoupeDuplicate}=0}%aucun compteurs loupe créés + { + \ifthenelse{\value{CompteurMax}=0} + {\loope{\theNbrCptrLoupe}{#1}} + { + \ifthenelse{\value{NbrCptrLoupe}<\value{CompteurMax}}%\or\value{NbrCptrLoupe}=\value{CompteurMax}} + {\looope{\theNbrCptrLoupe}{#1}} + {\loope{\theNbrCptrLoupe}{#1}}%pour ne pas recréer des compteurs déjà créés + } + } + {\looope{\theNbrCptrLoupe}{#1}} + + \FPeval{X}{\x+(0.4)*\thedecalageX} + \FPeval{Y}{\y+(neg 0.66)*(\thedecalageY-1)} + + \FPeval{b}{neg 0.1+Y}\FPeval{C}{0.36+Y}\FPeval{d}{0.1+X} + \FPeval{e}{0.46+Y}\FPeval{f}{0.4+X}\FPeval{g}{0.5+X}\FPeval{h}{0.7+X}\FPeval{i}{0.8+X} + \FPeval{ii}{1.2+X}\FPeval{iii}{1.1+X}\FPeval{iiii}{0.9+X}\FPeval{gg}{0.6+X} + \FPeval{l}{neg 0.2+(Y)}\FPeval{m}{neg 0.3+(Y)}\FPeval{o}{0.1+(Y)} + %top + %bottom + \FPeval{mm}{neg 0.1+(neg 0.66)*(#1)+(Y)} + \FPeval{mmm}{neg 0.2+(neg 0.66)*(#1)+(Y)}\FPeval{mmmm}{neg 0.3+(neg 0.66)*(#1)+(Y)}\FPeval{M}{neg 0.75+(neg 0.66)*(#1)+(Y)}\FPeval{MM}{neg 0.85+(neg 0.66)*(#1)+(Y)}\FPeval{MN}{neg 0.95+(neg 0.66)*(#1)+(Y)}\FPeval{MMM}{neg 0.55+(neg 0.66)*(#1)+(Y)}\FPeval{MMMM}{MMM-0.02}\FPeval{JJ}{j+0.02}%adjusting the height of the bottom + +%-------------------- pour gérer la longueur du si...alors associé ------------------------------------------------- +\foreach \i in {\theNbrCptrAlors,...,1}{ +\teste{\i} +} +%------------------------------------------------------------------------------------------------------------------------------- + + \draw [ctrl,fill=ctrl](\X,\C) -- (\X,\e) -- (\f,\e) -- (\i,\e) -- (A) -- (AA) -- ($(AA)+(0,-0.46)$) -- ($(A)+(0,-0.66)$) -- (\ii,\l) -- (\iii,\m) -- (\iiii,\m) -- (\i,\l) -- (\g,\l) -- (\f,\m) -- (\f,\mm) -- (\g,\mmm) -- (\i,\mmm) -- (\iiii,\mmmm) -- (\iii,\mmmm) -- (\ii,\mmm) -- (B) -- ($(B)+(0.1,-0.1)$) -- (BB) -- ($(BB)+(-0.1,-0.1)$) -- (\i,\MM) -- (\h,\MN) -- (\g,\MN) -- (\f,\MM) -- (\d,\MM) -- (\X,\M) -- cycle ; + \draw [black](\g,\e) -- (\i,\e) -- (A) -- (AA) -- ($(AA)+(0,-0.46)$) -- ($(A)+(0,-0.66)$) -- (\ii,\l) -- (\iii,\m) -- (\iiii,\m) -- (\i,\l) -- (\g,\l) -- (\f,\m) -- (\f,\mm) -- (\g,\mmm) -- (\i,\mmm) -- (\iiii,\mmmm) -- (\iii,\mmmm) -- (\ii,\mmm) -- (B) -- ($(B)+(0.1,-0.1)$) -- (BB) -- ($(BB)+(-0.1,-0.1)$) -- (\i,\MM) -- (\h,\MN) -- (\g,\MN) -- (\f,\MM) -- (\d,\MM) -- (\X,\M)--(\X,\C) -- (\X,\e); + \draw (\X,\o) node[right]{\color{white}\texttt{sinon}}; + + +\multido{\i=1+1}{\value{NbrCptrLoupe}}{%Fairt défiler tous les compteurs jusqu'au nombre de compteur : si compteur différent de -1 : + % si différent de 0, leur enlever 1. / si égal à 0 : enlever 1 à décalageX et mettre le compteur correspondant à -1. + \ifthenelse{\value{loupe\i}>-1}{ + \ifthenelse{\value{loupe\i}=0} + {\addtocounter{decalageX}{-1}\addtocounter{decalageY}{1}\setcounter{loupe\i}{-1}} + {\addtocounter{loupe\i}{-1}} + }{} + } +\addtocounter{decalageX}{1} +%\addtocounter{decalageY}{1} +} + +%------------------------------------------------------------- KILL BOX --------------------------------------------------------------------% +\newcommand{\kbox}[1]{%supprimer ce clone + + \FPeval{X}{x+(0.4)*\thedecalageX} + \FPeval{Y}{y+(neg 0.66)*\thedecalageY} + + \settowidth{\malongueuR}{\pgfinterruptpicture #1 \endpgfinterruptpicture} + + \FPeval{b}{neg 0.1+(Y)}\FPeval{C}{0.36+(Y)}\FPeval{D}{0.1+(X)} + \FPeval{e}{0.46+(Y)}\FPeval{f}{0.4+(X)}\FPeval{g}{0.5+(X)}\FPeval{h}{0.7+(X)} + \FPeval{i}{0.8+(X)} + \FPeval{l}{neg 0.2+(Y)} + \FPeval{m}{neg 0.3+(Y)}\FPeval{o}{0.1+(Y)} + \FPeval{F}{f+0.1}\FPeval{G}{g+0.1} + \coordinate (A) at ($(\D,\e) ! \malongueuR ! (\f,\e)$); + \coordinate (AA) at ($(\X,\C) ! \malongueuR+0.2cm ! (\G,\C)$); + \draw[black,fill=ctrl](\X,\b)--(\X,\C)--(\D,\e)--(\f,\e)--(\g,\C)--(\h,\C)--(\i,\e)--(A)--(AA)--($(AA)+(0,-0.46)$)--($(A)+(0,-0.66)$)--(\f,\l)--(\D,\l)--cycle; + \draw(\X,\o)node[right]{\color{white}\texttt{#1}}; + + \multido{\i=1+1}{\value{NbrCptrLoupe}}{%Fait défiler tous les compteurs jusqu'au nombre de compteurs : si compteur différent de -1 : + % si différent de 0, leur enlever 1. / si égal à 0 : enlever 1 à décalageX et mettre le compteur correspondant à -1. + \ifthenelse{\value{loupe\i}>-1}{ + \ifthenelse{\value{loupe\i}=0} + {\addtocounter{decalageX}{-1}\addtocounter{decalageY}{1}\setcounter{loupe\i}{-1}%pour gérer le décalage quand boucle finie + \multido{\ia=1+1}{\i-1}{%si on termine une boucle mais que celle d'avant ne sont pas terminées, alors on met -1 au compteur de celles d'avant + \ifthenelse{\value{loupe\ia}>0}{\addtocounter{loupe\ia}{-1}}{} + } + } + {\addtocounter{loupe\i}{-1}} + }{} + } + \addtocounter{decalageY}{1} +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%------------------------------------------------------------ INSIDE BOXES -------------------------------------------------------------% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%----------------------------------------------------- RECTANGLE BOX ----------------------------------------------------------------% +\newcommandx{\rb}[2][1=black]{%[Color: w or white (the same as the box by default)]{Text} + +\ifthenelse{\equal{#1}{w}\or\equal{#1}{white}} +{%If white +\hspace{-0.9em} +\settowidth\malongueuR{\small#2} +\parbox{\malongueuR}{ + \begin{tikzpicture}[scale=1, every node/.style={scale=1}] + \settowidth{\malongueuR}{\pgfinterruptpicture \small#2 \endpgfinterruptpicture} + \draw[white,fill=white](0,0)rectangle($(0+\malongueuR,0.4)$); + \draw(-0.05,0.2) node{\color{myblack}\small#2}; + \draw[gray](0,0)--(0,0.4)--(\malongueuR,0.4);%shading + \end{tikzpicture} + } +} +{%if black +\hspace{-1em} +\settowidth\malongueuR{\small#2} +\addtolength{\malongueuR}{3pt} +\parbox{\malongueuR}{ + \begin{tikzpicture}[scale=1, every node/.style={scale=1}] + \settowidth{\malongueuR}{\pgfinterruptpicture \small#2 \scriptsize$\blacktriangledown$ \endpgfinterruptpicture} + \fill[black,fill opacity=0.12](-0.05,0)rectangle($(0+\malongueuR,0.4)$); + \draw(-0.05,0.2) node{\color{white}\small#2}; + \draw[black,opacity=0.5](-0.05,0)--(-0.05,0.4)--(\malongueuR,0.4);%shading + \draw($(\malongueuR*1+3,0.2)$) node[left]{\color{myblack}\scriptsize$\blacktriangledown$}; + \end{tikzpicture} + } +} +} + +%---------------------------------------------- SPECIAL RECTANGLE BOX ----------------------------------------------------------% +\newcommandx{\rbb}[2][1=black]{%[Color: w or white (the same as the box by default)]{Text} +%for begin box use only! +\ifthenelse{\equal{#1}{w}\or\equal{#1}{white}} +{%If white +\hspace{-0.9em} +\settowidth\malongueuR{\small#2} +\parbox{\malongueuR}{ + \begin{tikzpicture}[scale=1, every node/.style={scale=1}] + \settowidth{\malongueuR}{\pgfinterruptpicture \small#2 \endpgfinterruptpicture} + \draw[white,fill=white](0,0)rectangle($(0+\malongueuR,0.4)$); + \draw(-0.05,0.2) node{\color{myblack}\small#2}; + \draw[gray](0,0)--(0,0.4)--(\malongueuR,0.4);%shading + \end{tikzpicture} + } +} +{%if black +\hspace{-1em} +\settowidth\malongueuR{\small#2} +\addtolength{\malongueuR}{3pt} +\parbox{\malongueuR}{ + \begin{tikzpicture}[scale=1, every node/.style={scale=1}] + \settowidth{\malongueuR}{\pgfinterruptpicture \small#2 \scriptsize$\blacktriangledown$ \endpgfinterruptpicture} + \fill[black,fill opacity=0.12](-0.05,0)rectangle($(0+\malongueuR,0.4)$); + \draw(-0.05,0.2) node{\color{white}\small#2\phantom{pd}}; + \draw[black,opacity=0.5](-0.05,0)--(-0.05,0.4)--(\malongueuR,0.4);%shading + \draw($(\malongueuR*1+3,0.2)$) node[left]{\color{myblack}\scriptsize$\blacktriangledown$}; + \end{tikzpicture} + } +} +} + +%--------------------------------------------------------- CIRCLE BOX -------------------------------------------------------------------% +\newcommandx{\cb}[2][1={black,fill opacity=0.05}]{%[Color: w or white (the same as the box by default)]{Text} + +\ifthenelse{\equal{#1}{w}\or\equal{#1}{white}} +{%If white +\hspace{-0.9em} +\settowidth\malongueuR{\small#2} +\parbox{\malongueuR}{ + \begin{tikzpicture}[scale=1, every node/.style={scale=1}] + \settowidth{\malongueuR}{\pgfinterruptpicture \small#2 \endpgfinterruptpicture} + \ifthenelse{\lengthtest{\the\malongueuR < 11pt}}{\settowidth{\malongueuR}{\pgfinterruptpicture M \endpgfinterruptpicture}}{}%{not smaller}%pour permettre un bel affichage avec une seule lettre en texte + \fill[white](-0.05,0.45)--(\malongueuR-0.44cm,0.45)arc(90:-90:0.22)--(-0.05,0.01)arc(270:90:0.22)--cycle;%corps + \draw[gray](\malongueuR-0.44cm,0.45)--(-0.05,0.45)arc(90:190:0.22);%contour haut + \draw[gray](\malongueuR-0.44cm,0.45)arc(90:45:0.22);%...suite + \draw[white](\malongueuR-0.22cm,0.23)arc(0:-90:0.22)--(-0.05,0.01);%contour bas + + \foreach \r in {0,...,45}%right shading +{\FPeval{R}{45-r} +\colorlet{degrade}{black!\R} + \FPeval{Z}{45-\r} +\draw[degrade,opacity=1](\malongueuR-0.22cm,0.23) arc(0:\Z:0.22); } + +\foreach \r in {0,...,45}%left shading +{\FPeval{R}{45-r} +\colorlet{degrade}{black!\R} + \FPeval{Z}{180+\r} +\draw[degrade,opacity=1](-0.05,0.01) arc(270:\Z:0.22); } + \draw(-0.3,0.2) node{\color{myblack}\small#2}; + \end{tikzpicture} + } +} +{%if black or another color +\hspace{-0.9em} +\settowidth\malongueuR{\small#2} +\parbox{\malongueuR}{ + \begin{tikzpicture}[scale=1, every node/.style={scale=1}] + \settowidth{\malongueuR}{\pgfinterruptpicture \small#2 \endpgfinterruptpicture} + \ifthenelse{\lengthtest{\the\malongueuR < 11pt}}{\settowidth{\malongueuR}{\pgfinterruptpicture M \endpgfinterruptpicture}}{}%{not smaller} + \fill[#1](-0.05,0.45)--(\malongueuR-0.44cm,0.45)arc(90:-90:0.22)--(-0.05,0.01)arc(270:90:0.22)--cycle;%slighty shaded + \draw[white](\malongueuR-0.44cm,0.45)--(-0.05,0.45)arc(90:190:0.22); + \draw[white](\malongueuR-0.44cm,0.45)arc(90:45:0.22); + \draw[black!80](\malongueuR-0.22cm,0.23)arc(0:-90:0.22)--(-0.05,0.01); + +\foreach \r in {0,...,80}%right shading +{%\colorlet{degrade}{black!\r} + \FPeval{Z}{45-\r/2+5} +\draw[black!\r,opacity=1](\malongueuR-0.22cm,0.23) arc(0:\Z:0.22); } + +\foreach \r in {0,...,80}%left shading +{%\colorlet{degrade}{black!\r} + \FPeval{Z}{190+\r} +\draw[black!\r,opacity=1](-0.05,0.01) arc(270:\Z:0.22); } + + \draw(-0.25,0.22) node{\color{white}\small#2};%text + + \end{tikzpicture} + } +} +} + +%------------------------------------------------------- HEXAGONAL BOX --------------------------------------------------------------% +\newcommand{\hb}[2][1=ope]{%[Color : "capt" for capteur (ope by default)]{Text} +\hspace{-1.5em} +\settowidth\malongueuR{\small#2\,} +\ifthenelse{\equal{#1}{capt}}{\def\cooleur{capt}}{\def\cooleur{ope}} +\parbox{\malongueuR}{ + +\begin{tikzpicture}[scale=1, every node/.style={scale=1}] + \settowidth{\malongueuR}{\pgfinterruptpicture \small#2 \endpgfinterruptpicture} + \draw[\cooleur,fill=\cooleur](-0.05,0.2)--(0.15,0.4)--($(\malongueuR-0.05cm,0.4)$)--($(\malongueuR+0.15cm,0.2)$)--($(\malongueuR-0.05cm,0)$)--(0.15,0)--cycle; + \ifthenelse{\equal{#1}{capt}} + {\draw[black,opacity=0.35]($(\malongueuR+0.15cm,0.2)$)--($(\malongueuR-0.05cm,0)$)--(0.15,0);} + {\draw[black,opacity=0.35]($(\malongueuR+0.15cm,0.2)$)--($(\malongueuR-0.05cm,0)$)--(0.15,0); + \draw[white,opacity=0.5](-0.05,0.2)--(0.15,0.4)--($(\malongueuR-0.05cm,0.4)$);} + \draw(-0.0,0.2) node{\color{white}\small#2}; +\end{tikzpicture}} +} + +%------------------------------------------------------------ SQUARE BOX ---------------------------------------------------------------% +\newcommand{\sqb}[1]{%{Shape : R or S or H}{Color : white or the same}{Triangle: 0 or 1}{Text} +\hspace{-1em} +\settowidth\malongueuR{x} +\parbox{\malongueuR}{ + +\begin{tikzpicture}[scale=1, every node/.style={scale=1}] + \draw[#1,fill=#1](-0.05,0.2)rectangle(0.25,0.5); + \draw[black,opacity=0.5](-0.05,0.2)--(-0.05,0.5)--(0.25,0.5); + \draw[white,opacity=0.5](-0.05,0.2)--(0.25,0.2)--(0.25,0.5); +\end{tikzpicture}} +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%--------------------------------------------------------------- SCRATCHY ---------------------------------------------------------------% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\newcommandx{\Scratchy}[2][1=0.25,2=0.25]{ + +\begin{tikzpicture}[scale=#1,line width=#2pt,every node/.style={scale=#1}] + +\draw[fill=ctrl](3,7.5)..controls(2,6.3)and(2.3,4.8)..(4,4.2) ..controls(4.55,4.05).. (5.5,3.99)..controls(6.6,4)and(7.8,4.1)..(8.6,5.3)..controls(9,6)and(8.5,6.7)..(7.9,6.7) .. controls(7.9,7.2)and(7.5,8.1)..(6.8,8.4)--(6.5,9.6)--(5.6,8.7) .. controls(5,8.8)and(4.4,8.7)..(4,8.5)--(2.7,9.4)--(3,7.5);%visage +\draw[fill=white,line width=0.01pt,white] (5.5,3.99) ..controls(3.3,4.5)and(3,5.9).. (4.4,6.2) -- (5.2,6.5) -- (5.75,6.35)--(6.65,6.5)--(6.7,6.7)--(7.6,7)--(7.9,6.7) ..controls(8.5,6.7)and(9,6)..(8.6,5.3)..controls(7.8,4.1)and(6.6,4).. cycle;%visage pâle +\draw(3,7.5)..controls(2,6.3)and(2.3,4.8)..(4,4.2) ..controls(4.55,4.05).. (5.5,3.99)..controls(6.6,4)and(7.8,4.1)..(8.6,5.3)..controls(9,6)and(8.5,6.7)..(7.9,6.7) .. controls(7.9,7.2)and(7.5,8.1)..(6.8,8.4)--(6.5,9.6)--(5.6,8.7) .. controls(5,8.8)and(4.4,8.7)..(4,8.5)--(2.7,9.4)--(3,7.5);%visage contour + +\draw[fill=white,rotate around={-50:(4.5,7)}] (4.5,7) ellipse (26.5pt and 18.5pt) ;\draw[fill=white,rotate around={-55:(6.85,7.4)}] (6.85,7.4) ellipse (26pt and 17pt) ;\draw[fill=black] (4.7,6.8) circle(0.15);\draw[fill=black] (7.12,7) circle(0.15);%yeux + +\draw[fill=darkgray] (6.6,6.5)--(5.9,6.5) ..controls(5.8,6.49)and(5.68,6.5).. (5.75,6.4) -- (6.1,6.1) ..controls(6.2,6.02)and(6.38,6).. (6.45,6.1) --(6.65,6.4) ..controls(6.7,6.5)and(6.63,6.5).. cycle;%nez + +\draw(2.6,6.1)..controls(2,6.5)..(1.4,6.65);\draw (2.6,5.8)..controls(2,5.7)..(1.5,5.7);\draw (8.4,5.7)..controls(8.8,5.5)..(9.3,5.55);\draw(8.3,6.2)..controls(8.9,6.4)..(9.4,6.6);\draw (4,8.5) -- (4.25,8.4);\draw (5.6,8.7)..controls(5.75,8.65)..(5.9,8.6);%visage fin + +\draw[fill=ctrl] (5.45,3)--(6.1,2.5) ..controls (6.2,2.4)and(6.3,2.4) .. (6.5,2.45) ..controls(7.1,2.7)and(7.45,3).. (7.5,3.3) ..controls(7.55,3.55)and(7.2,3.8).. (7,3.65)--(6.5,3.3) ..controls(6.4,3.25)and(6.25,3.25)..(6.15,3.35)--(5.61,3.9) ..controls(5.75,3.7)and(5.57,3.2).. cycle;%bras doit + +\draw[fill=ctrl] (1.3,1.5) ..controls(1.3,1)and(1.7,0.4).. (2.2,0.2) ..controls(2.7,0.1)and(3,0.6).. (2.4,1.05) ..controls(3.5,1.5)..(4.1,1.9)--(5.8,0.35)--(7.5,0.35) .. controls (8,0.4)and(7.7,1.15).. (7.2,1.1)--(6.2,1.1)--(4.95,2.35)..controls(5.3,2.75).. (5.45,3)..controls(5.57,3.2)and(5.75,3.7).. (5.61,3.9) ..controls(5.56,3.96).. (5.5,3.99)..controls(4.5,4)and(4.2,4.15)..(4,4.2) ..controls (3.8,4.28)and(3.5,4.3).. (3.4,4.25)--(2.4,3.5) ..controls(2.2,3.3).. (2.6,2.6) ..controls(2.7,2.45).. (2.95,2.25) -- (2.59,2.05)--(1.9,1.7) ..controls(1.6,1.9)and(1.3,1.8).. cycle;%corps gauche +\draw[fill=white,line width=0.01pt,white] (4.95,2.35)--(4.25,3.05) ..controls(4.1,3.2)and(4.3,3.6)..(4.7,3.6) ..controls(5.1,3.6)and(5.5,3.4).. (5.45,3)..controls(5.3,2.75).. cycle;%ventre blanc +\draw(1.3,1.5) ..controls(1.3,1)and(1.7,0.4).. (2.2,0.2) ..controls(2.7,0.1)and(3,0.6).. (2.4,1.05) ..controls(3.5,1.5)..(4.1,1.9)--(5.8,0.35)--(7.5,0.35) .. controls (8,0.4)and(7.7,1.15).. (7.2,1.1)--(6.2,1.1)--(4.95,2.35)..controls(5.3,2.75).. (5.45,3)..controls(5.57,3.2)and(5.75,3.7).. (5.61,3.9) ..controls(5.56,3.96).. (5.5,3.99)..controls(4.5,4)and(4.2,4.15)..(4,4.2) ..controls (3.8,4.28)and(3.5,4.3).. (3.4,4.25)--(2.4,3.5) ..controls(2.2,3.3).. (2.6,2.6) ..controls(2.7,2.45).. (2.95,2.25) -- (2.59,2.05)--(1.9,1.7) ..controls(1.6,1.9)and(1.3,1.8).. cycle;%corps contour +\draw (4.95,2.35)--(4.6,2.65);\draw (4.1,1.9)--(3.65,2.3) ..controls(3.5,2.2)and(3.2,2.1).. (2.95,2.25) ; \draw(3.65,2.3)..controls(3.9,2.5)and(3.55,3.05)..(3.2,3.25);\draw (3.35,3.15) -- (4,3.7) ..controls (4.1,3.8)and(4.2,4.15) .. (4,4.2);%corps fin + +\draw[fill=ctrl] (2.6,2.6) ..controls(2.1,2.75)..(1.8,3) ..controls(1.6,3.15)and(1.2,3.8)..(1,4) ..controls(0.6,4.3)and(0.2,3.2)..(1.05,2.45)..controls(1.4,2.2)and(1.7,2.05)..(2.59,2.05)-- (2.95,2.25) ..controls(2.7,2.45).. cycle;%queue jaune +\draw[fill=white,line width=0.01pt,white] (1.8,3) ..controls(1.6,3.15)and(1.2,3.8)..(1,4) ..controls(0.6,4.3)and(0.2,3.2)..(1.05,2.45)..controls(1.1,2.9)and(1.2,3).. cycle;%queue blanche +\draw (2.6,2.6) ..controls(2.1,2.75)..(1.8,3) ..controls(1.6,3.15)and(1.2,3.8)..(1,4) ..controls(0.6,4.3)and(0.2,3.2)..(1.05,2.45)..controls(1.4,2.2)and(1.7,2.05)..(2.59,2.05)-- (2.95,2.25) ..controls(2.7,2.45).. cycle;%queue contour + +\draw[fill=white] (4.95,5.8)..controls(6.5,5.4)..(7.35,5.3)..controls(6.2,4)and(4.5,4.5)..cycle;%bouche + + +\end{tikzpicture} +} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%----------------------------------------------- ENVIRONNEMENT SCRATCH ------------------------------------------------------% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%--------------------------------------------------------- COMPTEURS LOOP ---------------------------------------------------------% +\newcommand{\loope}[2]{ +\addtocounter{NbrCptrLoupe}{1} +\newcounter{loupe#1} +\setcounter{loupe#1}{#2} +} + +%------------------------------------------------------- COMPTEURS LOOOP ---------------------------------------------------------% +\newcommand{\looope}[2]{ +\addtocounter{NbrCptrLoupe}{1} +\setcounter{loupe#1}{#2} +\addtocounter{NbrCptrLoupeDuplicate}{-1} +} + +%------------------------------------------------------- COMPTEURS SI ALOORS ----------------------------------------------------% +\newcommand{\sialoors}[1]{ +\addtocounter{NbrCptrAlors}{1} +\settowidth{\malongueuR}{\pgfinterruptpicture#1\endpgfinterruptpicture} +\StrBefore{\the\malongueuR}{.}[\num] +\newcounter{aloors\theNbrCptrAlors} +\setcounter{aloors\theNbrCptrAlors}{\num} +} + +%----------------------------------------------------- COMPTEURS SI ALOOORS ----------------------------------------------------% +\newcommand{\sialooors}[1]{ +\addtocounter{NbrCptrAlors}{1} +\settowidth{\malongueuR}{\pgfinterruptpicture#1\endpgfinterruptpicture} +\StrBefore{\the\malongueuR}{.}[\num] +\setcounter{aloors\theNbrCptrAlors}{\num} +\addtocounter{NbrCptrAlorsDuplicate}{-1} +} + +%-------------------------------------------------------- THE SCRATCH FLAG ---------------------------------------------------------% +\newcommand{\SFlag}{ +\hspace{-1em}\rotatebox{-20}{\reflectbox{\textcolor{flag}\VarFlag}} +} + +%-------------------------------------------------------- A VERY DELIVRANCE --------------------------------------------------------% +\newcommand{\teste}[1]{ +\ifnum \value{aloors#1}>0 + \settowidth{\malongueuRE}{\pgfinterruptpicture {\hspace{\value{aloors#1}pt}} \endpgfinterruptpicture} + \coordinate (A) at ($(\d+2+\malongueuRE,\e)$); + \coordinate (AA) at ($(\X+6+\malongueuRE,\C)$); + \coordinate (BB) at ($(\X+6+\malongueuRE,\M)$); + \coordinate (B) at ($(\g+2.6+\malongueuRE,\mmm)$); + \setcounter{aloors#1}{-1} + \breakforeach + \else {} + \fi +} + +%----------------------------------------------- ENVIRONNEMENT SCRATCH ------------------------------------------------------% +\newenvironmentx{Scratch}[1][1=1]%pour réinitialiser tous les compteurs à chaque création de programme Scratch +%réinitialise également les compteurs définis "localement" pour les boucles Fois ! +{\begingroup +\begin{ttfamily}%pour gérer le calcul des longueurs \malongueuR +\begin{tikzpicture}[scale=#1, every node/.style={scale=#1}]%#3 avant avec x et y en paramètres\def\x{#1}\def\y{#2} +\def\x{0}\def\y{0} +\setcounter{decalageX}{0} +\setcounter{decalageY}{0} +\setcounter{NbrCptrLoupe}{0} +\setcounter{NbrCptrAlors}{0} +} +{ +\end{tikzpicture} +\end{ttfamily} +\multido{\i=1+1}{\value{NbrCptrLoupe}}{\setcounter{loupe\i}{0}} + +\ifthenelse{\value{NbrCptrLoupe}=0} + { } + {\setcounter{NbrCptrLoupeDuplicate}{\value{NbrCptrLoupe}}} + +\multido{\i=1+1}{\value{NbrCptrAlors}}{\setcounter{aloors\i}{0}} + +\ifthenelse{\value{NbrCptrAlors}=0} + { } + {\setcounter{NbrCptrAlorsDuplicate}{\value{NbrCptrAlors}} } + +\ifthenelse{\value{CompteurMax}>\value{NbrCptrLoupe}} + { } + {\setcounter{CompteurMax}{\value{NbrCptrLoupe}} } + +\endgroup} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%--------------------------------------------------------- FIN COMMANDES ------------------------------------------------------------% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% This is file `ScratchX.sty', +%% +%% Copyright (C) 2016-2017 by Thibault Ralet - Thibault.Ralet@ac-clermont.fr +%% +%% 16 mars 2017 (version 0.1) - 27 juillet 2017 (version 1.1) +%% +%% The LaTeX Project Public License v1.3c or later, see http://www.latex-project.org/lppl.txt +%% +%% Unlimited copying and redistribution of this file are permitted as +%% long as this file is not modified. Modifications, and distribution +%% of modified versions, are permitted, but only if the resulting file +%% is renamed. \ No newline at end of file diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check index 14670a50fbe..6a6a18741d2 100755 --- a/Master/tlpkg/bin/tlpkg-ctan-check +++ b/Master/tlpkg/bin/tlpkg-ctan-check @@ -543,7 +543,8 @@ my @TLP_working = qw( sauter sauterfonts savefnmark savesym savetrees scale scalebar scalerel scanpages schemabloc schemata sclang-prettifier schule schulschriften schwalbe-chess - sciposter scratch screenplay screenplay-pkg scrjrnl scrlttr2copy scsnowman + sciposter scratch scratchx screenplay screenplay-pkg + scrjrnl scrlttr2copy scsnowman sdrt sduthesis secdot section sectionbox sectsty seealso selectp selnolig semantic semantic-markup semaphor diff --git a/Master/tlpkg/tlpsrc/collection-mathscience.tlpsrc b/Master/tlpkg/tlpsrc/collection-mathscience.tlpsrc index 8d4c7b30889..aa4570d2aa3 100644 --- a/Master/tlpkg/tlpsrc/collection-mathscience.tlpsrc +++ b/Master/tlpkg/tlpsrc/collection-mathscience.tlpsrc @@ -1,5 +1,5 @@ category Collection -shortdesc Mathematics and science packages +shortdesc Mathematics, natural sciences, computer science packages # depend collection-fontsrecommended depend collection-latex @@ -126,6 +126,7 @@ depend rmathbr depend sasnrdisplay depend sciposter depend sclang-prettifier +depend scratchx depend sesamanuel depend sfg depend shuffle diff --git a/Master/tlpkg/tlpsrc/scratchx.tlpsrc b/Master/tlpkg/tlpsrc/scratchx.tlpsrc new file mode 100644 index 00000000000..e69de29bb2d -- cgit v1.2.3