diff options
author | Norbert Preining <norbert@preining.info> | 2021-04-11 03:01:03 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2021-04-11 03:01:03 +0000 |
commit | 9b552e1a4637af098a01847c97658f65bc505356 (patch) | |
tree | 5fdca147f23bfe92704e86bbcac8e13521185c6c /macros | |
parent | 5960076e4c9c15e2a052cf015dd697a65db3150d (diff) |
CTAN sync 202104110301
Diffstat (limited to 'macros')
27 files changed, 8201 insertions, 500 deletions
diff --git a/macros/generic/expkv-def/README.md b/macros/generic/expkv-def/README.md index ffea8dd5ca..f2c9e9cfac 100644 --- a/macros/generic/expkv-def/README.md +++ b/macros/generic/expkv-def/README.md @@ -1,7 +1,7 @@ ------------------------------------------------------------------------------- # expkv-def -- a key-defining frontend for expkv -Version 2020-12-28 v0.7 +Version 2021-04-10 v0.8 Released under the LaTeX Project Public License v1.3c or later See http://www.latex-project.org/lppl.txt @@ -10,7 +10,7 @@ Hosted at https://github.com/Skillmon/tex_expkv-def ------------------------------------------------------------------------------- -Copyright (C) 2020 Jonathan P. Spratte +Copyright (C) 2020-2021 Jonathan P. Spratte This work may be distributed and/or modified under the conditions of the LaTeX Project Public License (LPPL), either version 1.3c of this license or diff --git a/macros/generic/expkv-def/expkv-def.dtx b/macros/generic/expkv-def/expkv-def.dtx index 5edf48780c..eaec17b22c 100644 --- a/macros/generic/expkv-def/expkv-def.dtx +++ b/macros/generic/expkv-def/expkv-def.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% File: expkv-def.dtx Copyright (C) 2020 Jonathan P. Spratte +% File: expkv-def.dtx Copyright (C) 2020-2021 Jonathan P. Spratte % % This work may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this license or @@ -27,7 +27,7 @@ Released under the LaTeX Project Public License v1.3c or later See http://www.latex-project.org/lppl.txt -------------------------------------------------------------- -Copyright (C) 2020 Jonathan P. Spratte +Copyright (C) 2020-2021 Jonathan P. Spratte This work may be distributed and/or modified under the conditions of the LaTeX Project Public License (LPPL), either version 1.3c of this license or @@ -600,6 +600,64 @@ and the derived files expkv-def.pdf % you can refer to the choice which was passed in with |#1|. % \end{function} % +% \begin{function}{unknown code} +% \begin{syntax} +% unknown code = \marg{definition} \prefixes2322 +% \end{syntax} +% By default \expkv\ throws errors when it encounters unknown keys in a set. +% With the |unknown| prefix you can define handlers that deal with undefined +% keys, instead of a \key\ name you have to specify a subtype for this prefix, +% here the subtype is |code|.\par +% With |unknown code| the \meta{definition} is used for unknown keys which +% were provided a value (so corresponds to |\ekvdefunknown|), you can access +% the key name with |#1| and the value with |#2|.\footnotemark +% \end{function} +% \footnotetext +% {^^A +% There is some trickery involved to get this more intuitive argument order +% without any performance hit if you compare this to +% \cs[no-index]{ekvdefunknown} directly.^^A +% } +% +% \begin{function}{unknown noval} +% \begin{syntax} +% unknown noval = \marg{definition} \prefixes2323 +% \end{syntax} +% This is like |unknown code| but uses \meta{definition} for unknown keys to +% which no value was passed (so corresponds to |\ekvdefunknownNoVal|). You can +% access the key name with |#1|. +% \end{function} +% +% \begin{function}{unknown redirect-code} +% \begin{syntax} +% unknown redirect-code = \marg{set-list} \prefixes2331 +% \end{syntax} +% This uses a predefined action for |unknown code|. Instead of throwing an +% error, it is tried to find the \key\ in each \set\ in the comma separated +% \meta{set-list}. The first found match will be used and the remaining +% options from the list discarded. If the \key\ isn't found in any \set\ an +% expandable error will be thrown eventually. Internally \expkv's +% |\ekvredirectunknown| will be used. +% \end{function} +% +% \begin{function}{unknown redirect-noval} +% \begin{syntax} +% unknown redirect-noval = \marg{set-list} \prefixes2333 +% \end{syntax} +% This behaves just like |unknown redirect-code| but will set up means to +% forward keys for |unknown noval|. Internally \expkv's +% |\ekvredirectunknownNoVal| will be used. +% \end{function} +% +% \begin{function}{unknown redirect} +% \begin{syntax} +% unknown redirect = \marg{set-list} \prefixes2333 +% \end{syntax} +% This is a short cut to apply both, |unknown redirect-code| and +% |unknown redirect-noval|, as a result you might get doubled error messages, +% one from each. +% \end{function} +% % \subsection{Bugs} % I don't think there are any (but every developer says that), if you find some % please let me know, either via the email address on the first page or on @@ -766,8 +824,8 @@ and the derived files expkv-def.pdf % \begin{macro}{\ekvdVersion,\ekvdDate} % We're on our first input, so lets store the version and date in a macro. % \begin{macrocode} -\def\ekvdVersion{0.7} -\def\ekvdDate{2020-12-28} +\def\ekvdVersion{0.8} +\def\ekvdDate{2021-04-10} % \end{macrocode} % \end{macro} % @@ -1543,12 +1601,7 @@ and the derived files expkv-def.pdf % \begin{macrocode} \protected\long\expandafter\def\csname ekvd@t@unknown-choice\endcsname#1#2% {% - \ifx\ekvd@ifnew\ekvd@assert@new - \ekv@fi@firstoftwo - \fi - \@secondoftwo - {\ekv@ifdefined{\ekvd@unknown@choice@name\ekvd@set{#1}}\ekvd@err@not@new}% - \@firstofone + \ekvd@assert@new@for@name{\ekvd@unknown@choice@name\ekvd@set{#1}}% {% \ekvd@assert@arg {% @@ -1562,6 +1615,103 @@ and the derived files expkv-def.pdf % \end{macrocode} % \end{macro} % +% \begin{macro}[internal] +% {\ekvd@t@unknown,\ekvd@type@unknown@code,\ekvd@type@unknown@noval} +% The |unknown| type has different subtypes which would be the key names for +% other types. It is first checked whether that subtype is defined, if it +% isn't throw an error, else use that subtype. +% \begin{macrocode} +\protected\long\def\ekvd@t@unknown#1#2% + {% + \ekv@ifdefined{ekvd@type@unknown@\detokenize{#1}}% + {\csname ekvd@type@unknown@\detokenize{#1}\endcsname{#2}}% + \ekvd@err@misused@unknown + } +% \end{macrocode} +% The |unknown noval| type can use |\ekvdefunknownNoVal| directly (after +% asserting some prefixes). +% \begin{macrocode} +\protected\long\def\ekvd@type@unknown@noval#1% + {% + \ekvd@assert@new@for@name{\ekv@name\ekvd@set{}uN}% + {% + \ekvd@assert@arg + {% + \ekvd@assert@not@also + \ekvd@assert@not@long + \ekvd@prot\ekvdefunknownNoVal\ekvd@set{#1}% + }% + }% + } +% \end{macrocode} +% The |unknown code| type uses some trickery during the definition in order to +% swap out |#1| and |#2| in the user supplied definition. This is done via a +% temporary macro that stores the definition but gets the parameter numbers +% reversed while the real definition is done. +% \begin{macrocode} +\protected\long\def\ekvd@type@unknown@code#1% + {% + \ekvd@assert@new@for@name{\ekv@name\ekvd@set{}u}% + {% + \ekvd@assert@arg + {% + \ekvd@assert@not@also + \begingroup + \def\ekvd@tmp##1##2{#1}% + \ekv@exparg + {% + \endgroup + \ekvd@prot\ekvd@long\ekvdefunknown\ekvd@set + }% + {\ekvd@tmp{##2}{##1}}% + }% + }% + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[internal] +% { +% \ekvd@type@unknown@redirect, +% \ekvd@type@unknown@redirect-code, +% \ekvd@type@unknown@redirect-noval +% } +% The |unknown redirect| types also just forward to |\ekvredirectunknown| +% after asserting some prefixes. +% \begin{macrocode} +\protected\edef\ekvd@type@unknown@redirect#1% + {% + \expandafter\noexpand\csname ekvd@type@unknown@redirect-code\endcsname{#1}% + \expandafter\noexpand\csname ekvd@type@unknown@redirect-noval\endcsname{#1}% + } +\protected\expandafter\def\csname ekvd@type@unknown@redirect-code\endcsname#1% + {% + \ekvd@assert@new@for@name{\ekv@name\ekvd@set{}u}% + {% + \ekvd@assert@arg + {% + \ekvd@assert@not@also + \ekvd@assert@not@protected + \expandafter\ekvredirectunknown\expandafter{\ekvd@set}{#1}% + }% + }% + } +\protected\expandafter\def\csname ekvd@type@unknown@redirect-noval\endcsname#1% + {% + \ekvd@assert@new@for@name{\ekv@name\ekvd@set{}uN}% + {% + \ekvd@assert@arg + {% + \ekvd@assert@not@also + \ekvd@assert@not@protected + \ekvd@assert@not@long + \expandafter\ekvredirectunknownNoVal\expandafter{\ekvd@set}{#1}% + }% + }% + } +% \end{macrocode} +% \end{macro} +% % \subsubsection{Key Type Helpers} % There are some keys that might need helpers during their execution (not during % their definition, which are gathered as |@type@| macros). These helpers are @@ -1819,6 +1969,15 @@ and the derived files expkv-def.pdf {\csname ekvifdefined#1\endcsname\ekvd@set{#2}{\ekvd@err@not@new}} \def\ekvd@assert@not@new {\ifx\ekvd@ifnew\ekvd@assert@new\ekvd@err@no@prefix{new}\fi} +\def\ekvd@assert@new@for@name#1% + {% + \ifx\ekvd@ifnew\ekvd@assert@new + \ekv@fi@firstoftwo + \fi + \@secondoftwo + {\ekv@ifdefined{#1}\ekvd@err@not@new}% + \@firstofone + } % \end{macrocode} % \end{macro} % @@ -1917,17 +2076,16 @@ and the derived files expkv-def.pdf } \protected\def\ekvd@err@not@new {\ekvd@errm{The key for `\ekvd@cur' is already defined}} +\protected\long\def\ekvd@err@misused@unknown + {\ekvd@errm{Misuse of the unknown type found while processing `\ekvd@cur'}} % \end{macrocode} % \end{macro} % % \begin{macro}[internal] % { % \ekvd@err@choice@invalid,\ekvd@err@choice@invalid@,\ekvd@choice@name, -% \ekvd@unknown@choice@name,\ekvd@err +% \ekvd@unknown@choice@name % } -% The expandable error messages use |\ekvd@err|, which is just like |\ekv@err| -% from \expkv\ or the way \pkg{expl3} throws expandable error messages. It uses -% an undefined control sequence to start the error message. % |\ekvd@err@choice@invalid| will have to use this mechanism to throw its % message. Also we have to retrieve the name parts of the choice in an easy way, % so we use parentheses of catcode 8 here, which should suffice in most cases to @@ -1956,18 +2114,20 @@ and the derived files expkv-def.pdf {\ekvd@err{invalid choice `#3' (`#2', set `#1')}}% } } -\begingroup -\edef\ekvd@err +% \end{macrocode} +% \end{macro} +% +% \begin{macro}[internal]{\ekvd@err} +% The expandable error messages use |\ekvd@err|, which is just like |\ekv@err| +% from \expkv\ or the way \pkg{expl3} throws expandable error messages. It uses +% an undefined control sequence to start the error message. +% \begin{macrocode} +\def\ekvd@err#1% {% - \endgroup - \unexpanded{\long\def\ekvd@err}##1% - {% - \unexpanded{\expandafter\ekv@err@\@firstofone}% - {\unexpanded\expandafter{\csname ! expkv-def Error:\endcsname}##1.}% - \unexpanded{\ekv@stop}% - }% + \long\def\ekvd@err##1{\expandafter\ekv@err@\@firstofone{#1##1.}\ekv@stop}% } -\ekvd@err +\begingroup\expandafter\endgroup +\expandafter\ekvd@err\csname ! expkv-def Error:\endcsname % \end{macrocode} % \end{macro} % diff --git a/macros/generic/expkv-def/expkv-def.pdf b/macros/generic/expkv-def/expkv-def.pdf Binary files differindex 727d6c43d4..b483ade6c1 100644 --- a/macros/generic/expkv-def/expkv-def.pdf +++ b/macros/generic/expkv-def/expkv-def.pdf diff --git a/macros/generic/expkv/README.md b/macros/generic/expkv/README.md index beeba1ca09..7a696a1f7f 100644 --- a/macros/generic/expkv/README.md +++ b/macros/generic/expkv/README.md @@ -1,7 +1,7 @@ ------------------------------------------------------------------------------- # expkv -- an expandable key=val implementation -Version 2020-12-28 v1.6 +Version 2021-04-09 v1.7 Released under the LaTeX Project Public License v1.3c or later See http://www.latex-project.org/lppl.txt @@ -10,7 +10,7 @@ Hosted at https://github.com/Skillmon/tex_expkv ------------------------------------------------------------------------------- -Copyright (C) 2020 Jonathan P. Spratte +Copyright (C) 2020-2021 Jonathan P. Spratte This work may be distributed and/or modified under the conditions of the LaTeX Project Public License (LPPL), either version 1.3c of this license or diff --git a/macros/generic/expkv/expkv.dtx b/macros/generic/expkv/expkv.dtx index d3fc414f39..49af99c01d 100644 --- a/macros/generic/expkv/expkv.dtx +++ b/macros/generic/expkv/expkv.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% File: expkv.dtx Copyright (C) 2020 Jonathan P. Spratte +% File: expkv.dtx Copyright (C) 2020-2021 Jonathan P. Spratte % % This work may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this license or @@ -27,7 +27,7 @@ Released under the LaTeX Project Public License v1.3c or later See http://www.latex-project.org/lppl.txt -------------------------------------------------------------- -Copyright (C) 2020 Jonathan P. Spratte +Copyright (C) 2020-2021 Jonathan P. Spratte This work may be distributed and/or modified under the conditions of the LaTeX Project Public License (LPPL), either version 1.3c of this license or @@ -84,10 +84,18 @@ and the derived files expkv.pdf ,basicstyle=\fontfamily{jkp}\itshape ,morekeywords=^^A {^^A - \ekvdef,\ekvdefNoVal,\ekvlet,\ekvletNoVal,\ekvletkv,\ekvletkvNoVal,^^A - \ekvset,\ekvparse,\ekvVersion,\ekvDate,\ekvifdefined,^^A - \ekvifdefinedNoVal,\ekvbreak,\ekvbreakPreSneak,\ekvbreakPostSneak,^^A - \ekvsneak,\ekvsneakPre,\ekvchangeset + \ekvdef,\ekvdefNoVal,^^A + \ekvlet,\ekvletNoVal,\ekvletkv,\ekvletkvNoVal,^^A + \ekvdefunknown,\ekvdefunknownNoVal,^^A + \ekvredirectunknown,\ekvredirectunknownNoVal,^^A + \ekvset,\ekvsetSneaked,^^A + \ekvsetdef,\ekvsetSneakeddef,\ekvsetdefSneaked,^^A + \ekvparse,^^A + \ekvVersion,\ekvDate,^^A + \ekvifdefined,\ekvifdefinedNoVal,\ekvifdefinedset,^^A + \ekvbreak,\ekvbreakPreSneak,\ekvbreakPostSneak,^^A + \ekvsneak,\ekvsneakPre,^^A + \ekvchangeset } ,morecomment=[l]\% ,commentstyle=\color[gray]{0.4} @@ -103,6 +111,7 @@ and the derived files expkv.pdf \definecolor{expkvred}{HTML}{9F393D} \colorlet{expkvgrey}{black!75} \makeatletter +\newcommand*\example{\par\smallskip\noindent\textit{Example:} \ignorespaces} \newcommand*\expFormat {^^A {^^A @@ -164,6 +173,31 @@ and the derived files expkv.pdf \newcommand*\expkvd{\expkvpkg{def}} \newcommand*\expkvc{\expkvpkg{cs}} \newcommand*\expkvo{\expkvpkg{opt}} +\ExplSyntaxOn +\newcommand*\pkglogo[1] + { + \texorpdfstring + { + \mbox + { + \BeginAccSupp{ActualText=#1} + \rmfamily + \str_case:nn {#1} + { + {yax} + { + Y\kern-.1em + \raise.15em\hbox{\scshape a} + \kern-.1em \lower.15em\hbox{X}% + } + } + \EndAccSupp{} + } + } + {#1} + } +\newcommand*\yax{\pkglogo{yax}} +\ExplSyntaxOff \newcommand\kv{\meta{key}=\meta{value}} \newcommand\key{\meta{key}} \newcommand\val{\meta{value}} @@ -173,6 +207,7 @@ and the derived files expkv.pdf \DoNotIndex{\endgroup,\endinput,\errmessage,\expandafter,\input,\let,\long} \DoNotIndex{\protected,\ProvidesFile,\ProvidesPackage,\relax,\space} \DoNotIndex{\@,\unexpanded,\string,\expanded,\detokenize,\meaning,\lastnamedcs} +\DoNotIndex{\romannumeral,\z@} \DoNotIndex{\ifcsname} \DoNotIndex{\ifx} \DoNotIndex{\else} @@ -257,6 +292,9 @@ and the derived files expkv.pdf % Note that while the package names are stylised with a vertical rule, their % names are all lower case with a hyphen (\emph{e.g.}, \file{expkv-def}). % +% A list of concise comparisons to other \kv\ packages is contained in +% \autoref{sec:cmp}. +% % \subsection{Setting up Keys}\label{sec:define} % \expkv\ provides a rather simple approach to setting up keys, similar to % \pkg{keyval}. However there is an auxiliary package named \expkvd\ which @@ -285,6 +323,10 @@ and the derived files expkv.pdf % Defines a \key\ taking a value in a \set\ to expand to \meta{code}. In % \meta{code} you can use |#1| to refer to the given value. % \end{function} +% \example Define |text| in |foo| to store the value inside |\foo@text|: +% \begin{lstlisting}[aboveskip=0pt,belowskip=0pt] +% \protected\long\ekvdef{foo}{text}{\def\foo@width{#1}} +% \end{lstlisting} % % \begin{function}{\ekvdefNoVal} % \begin{syntax} @@ -292,6 +334,10 @@ and the derived files expkv.pdf % \end{syntax} % Defines a no value taking \key\ in a \set\ to expand to \meta{code}. % \end{function} +% \example Define |bool| in |foo| to set |\iffoo@bool| to |true|: +% \begin{lstlisting}[aboveskip=0pt,belowskip=0pt] +% \protected\ekvdefNoVal{foo}{bool}{\foo@booltrue} +% \end{lstlisting} % % \begin{function}{\ekvlet} % \begin{syntax} @@ -300,6 +346,10 @@ and the derived files expkv.pdf % Let the value taking \key\ in \set\ to \meta{cs}, there are no checks on % \meta{cs} enforced. % \end{function} +% \example Let |cmd| in |foo| do the same as |\foo@cmd|: +% \begin{lstlisting}[aboveskip=0pt,belowskip=0pt] +% \ekvlet{foo}{cmd}\foo@cmd +% \end{lstlisting} % % \begin{function}{\ekvletNoVal} % \begin{syntax} @@ -308,6 +358,7 @@ and the derived files expkv.pdf % Let the no value taking \key\ in \set\ to \meta{cs}, it is not checked % whether \meta{cs} exists or that it takes no parameter. % \end{function} +% \example See above. % % \begin{function}{\ekvletkv} % \begin{syntax} @@ -317,6 +368,10 @@ and the derived files expkv.pdf % whether that second key exists (but take a look at % \cs[no-index]{ekvifdefined}). % \end{function} +% \example Let |B| in |bar| be an alias for |A| in |foo|: +% \begin{lstlisting}[aboveskip=0pt,belowskip=0pt] +% \ekvletkv{bar}{B}{foo}{A} +% \end{lstlisting} % % \begin{function}{\ekvletkvNoVal} % \begin{syntax} @@ -326,6 +381,7 @@ and the derived files expkv.pdf % whether that second key exists (but take a look at % \cs[no-index]{ekvifdefinedNoVal}). % \end{function} +% \example See above. % % \begin{function}{\ekvdefunknown} % \begin{syntax} @@ -335,9 +391,19 @@ and the derived files expkv.pdf % this macro you can define \meta{code} that will be executed for a given % \set\ when an unknown \key\ with a \val\ was encountered instead of throwing % an error. You can refer to the given \val\ with |#1| and to the unknown -% \key's name with |#2| in \meta{code}.\footnotemark +% \key's name with |#2| in \meta{code}.\footnotemark{} +% |\ekvdefunknown| and |\ekvredirectunknown| are mutually exclusive, +% you can't use both. % \end{function} % \footnotetext{That order is correct, this way the code is faster.} +% \example Also search |bar| for undefined keys of set |foo|: +% \begin{lstlisting}[aboveskip=0pt,belowskip=0pt] +% \long\ekvdefunknown{foo}{\ekvset{bar}{#2={#1}}} +% \end{lstlisting} +% This example differs from using |\ekvredirectunknown{foo}{bar}| (see below) in +% that also the unknown-key handler of the |bar| set will be triggered, error +% messages for undefined keys will look different, and this is slower than using +% |\ekvredirectunknown|. % % \begin{function}{\ekvdefunknownNoVal} % \begin{syntax} @@ -347,7 +413,49 @@ and the derived files expkv.pdf % an error when encountering an unknown \key. With this you can instead let it % execute \meta{code} if an unknown |NoVal| \key\ was encountered. You can % refer to the given \key\ with |#1| in \meta{code}. +% |\ekvdefunknownNoVal| and |\ekvredirectunknownNoVal| are mutually exclusive, +% you can't use both. % \end{function} +% \example Also search |bar| for undefined keys of set |foo|: +% \begin{lstlisting}[aboveskip=0pt,belowskip=0pt] +% \ekvdefunknownNoVal{foo}{\ekvset{bar}{#1}} +% \end{lstlisting} +% +% \begin{function}{\ekvredirectunknown} +% \begin{syntax} +% \cs{ekvredirectunknown}\marg{set}\marg{set-list} +% \end{syntax} +% This is a short cut to set up a special |\ekvdefunknown| for \set\ that will +% check each set in the comma separated \meta{set-list} for the unknown \key. +% You can't use prefixes (so no |\long| or |\protected|) with this macro, the +% resulting unknown-key handler will always be |\long|. The first set in the +% \meta{set-list} has highest priority. Once the \key\ is found the remaining +% sets are discarded, if the \key\ isn't found in any set an error will be +% thrown eventually. Note that the error messages are affected by the use of +% this macro, in particular, it isn't checked whether a |NoVal| key of the +% same name is defined in order to throw a |value forbidden| error. +% |\ekvdefunknown| and |\ekvredirectunknown| are mutually exclusive, +% you can't use both. +% \end{function} +% \example For every key not defined in the set |foo| also search the sets |bar| +% and |baz|: +% \begin{lstlisting}[aboveskip=0pt,belowskip=0pt] +% \ekvredirectunknown{foo}{bar, baz} +% \end{lstlisting} +% +% \begin{function}{\ekvredirectunknownNoVal} +% \begin{syntax} +% \cs{ekvredirectunknownNoVal}\marg{set}\marg{set-list} +% \end{syntax} +% This behaves just like |\ekvredirectunknown| and does the same but for the +% |NoVal| keys. Again no prefixes are supported. Note that the error messages +% are affected by the use of this macro, in particular, it isn't checked +% whether a normal key of the same name is defined in order to throw a +% |value forbidden| error. +% |\ekvdefunknownNoVal| and |\ekvredirectunknownNoVal| are mutually exclusive, +% you can't use both. +% \end{function} +% \example See above. % % \subsection{Parsing Keys} % @@ -367,6 +475,10 @@ and the derived files expkv.pdf % be split at the first one and the others are considered part of the value. % |\ekvset| should be nestable. % \end{function} +% \example Parse |key=arg, key| in the set |foo|: +% \begin{lstlisting}[aboveskip=0pt,belowskip=0pt] +% \ekvset{foo}{key=arg, key} +% \end{lstlisting} % % \begin{function}{\ekvsetSneaked} % \begin{syntax} @@ -377,6 +489,10 @@ and the derived files expkv.pdf % \cs[no-index]{ekvsneak} has been called with \meta{sneak} as its argument as % the first action. % \end{function} +% \example Parse |key=arg, key| in the set |foo| with |\afterwards| sneaked out: +% \begin{lstlisting}[aboveskip=0pt,belowskip=0pt] +% \ekvsetSneaked{foo}{\afterwards}{key=arg, key} +% \end{lstlisting} % % \begin{function}{\ekvsetdef} % \begin{syntax} @@ -389,6 +505,12 @@ and the derived files expkv.pdf % \texttt % {\string\long\string\def\meta{cs}\#1\{\string\ekvset\marg{set}\{\#1\}\}} % \end{function} +% \example Define the macro |\foosetup| to parse keys in the set |foo| and use +% it to parse |key=arg, key|: +% \begin{lstlisting}[aboveskip=0pt,belowskip=0pt] +% \ekvsetdef\foosetup{foo} +% \foosetup{key=arg, key} +% \end{lstlisting} % % \begin{function}{\ekvsetSneakeddef} % \begin{syntax} @@ -406,10 +528,17 @@ and the derived files expkv.pdf % \string\ekvsetSneaked\marg{set}\{\#1\}\{\#2\}\}^^A % } % \end{function} +% \example Define the macro |\foothings| to parse keys in the set |foo| and +% accept a sneaked argument, then use it to parse |key=arg, key| and sneak +% |\afterwards|: +% \begin{lstlisting}[aboveskip=0pt,belowskip=0pt] +% \ekvsetSneakeddef\foothings{foo} +% \foothings{\afterwards}{key=arg, key} +% \end{lstlisting} % % \begin{function}{\ekvsetdefSneaked} % \begin{syntax} -% \cs{ekvsetSneakeddef}\meta{cs}\marg{set}\marg{sneaked} +% \cs{ekvsetdefSneaked}\meta{cs}\marg{set}\marg{sneaked} % \end{syntax} % And this one behaves like \cs[no-index]{ekvsetSneakeddef} but with a fixed % \meta{sneaked} argument. So the resulting macro is faster than but else @@ -420,6 +549,12 @@ and the derived files expkv.pdf % \string\ekvsetSneaked\marg{set}\marg{sneaked}\{\#1\}\}^^A % } % \end{function} +% \example Define the macro |\barthing| to parse keys in the set |bar| and +% always execute |\afterwards| afterwards, then use it to parse |key=arg, key|: +% \begin{lstlisting}[aboveskip=0pt,belowskip=0pt] +% \ekvsetdefSneaked\barthing{bar}{\afterwards} +% \barthing{key=arg, key} +% \end{lstlisting} % % \begin{function}{\ekvparse} % \begin{syntax} @@ -449,8 +584,7 @@ and the derived files expkv.pdf % you can put an \cs[no-index]{expanded} around it and will still be faster % since you need only a single \cs[no-index]{expandafter} this way.^^A % } -% -% As a small example: +% \example % \begin{lstlisting} % \ekvparse{\handlekey{S}}{\handlekeyval{S}}{foo = bar, key, baz={zzz}} % \end{lstlisting} @@ -472,15 +606,14 @@ and the derived files expkv.pdf % \handle\kv{foo}{bar}\k{key}\kv{baz}{zzz} % \end{lstlisting} % -% \subsection{Miscellaneous} -% -% \subsubsection{Other Macros} +% \subsection{Other Macros} % % \expkv\ provides some other macros which might be of interest. % % \begin{function}{\ekvVersion,\ekvDate} % These two macros store the version and date of the package. % \end{function} +% % \begin{function}{\ekvifdefined,\ekvifdefinedNoVal} % \begin{syntax} % \cs{ekvifdefined}\marg{set}\marg{key}\marg{true}\marg{false} @@ -490,6 +623,11 @@ and the derived files expkv.pdf % either a hash table entry doesn't exist for that key or its meaning is % |\relax|. % \end{function} +% \example Check whether the key |special| is already defined in set |foo|, if +% it isn't input a file that contains more key definitions: +% \begin{lstlisting}[aboveskip=0pt,belowskip=0pt] +% \ekvifdefined{foo}{special}{}{\input{foo.morekeys.tex}} +% \end{lstlisting} % % \begin{function}{\ekvifdefinedset} % \begin{syntax} @@ -498,6 +636,12 @@ and the derived files expkv.pdf % This macro tests whether \set\ is defined (which it is if at least one key % was defined for it). If it is \meta{true} will be run, else \meta{false}. % \end{function} +% \example Check whether the set |VeRyUnLiKeLy| is already defined, if so throw +% an error, else do nothing: +% \begin{lstlisting}[aboveskip=0pt,belowskip=0pt] +% \ekvifdefinedset{VeRyUnLiKeLy} +% {\errmessage{VeRyUnLiKeLy already defined}}{} +% \end{lstlisting} % % \begin{function}{\ekvbreak,\ekvbreakPreSneak,\ekvbreakPostSneak} % \begin{syntax} @@ -510,6 +654,12 @@ and the derived files expkv.pdf % \meta{after} before anything that has been smuggled and |\ekvbreakPostSneak| % will put \meta{after} after the stuff that has been sneaked out. % \end{function} +% \example Define a key |abort| that will stop key parsing inside the set |foo| +% and execute |\foo@aborted|, or if it got a value |\foo@aborted@with|: +% \begin{lstlisting}[aboveskip=0pt,belowskip=0pt] +% \ekvdefNoVal{foo}{abort}{\ekvbreak{\foo@aborted}} +% \ekvdef{foo}{abort}{\ekvbreak{\foo@aborted@with{#1}}} +% \end{lstlisting} % % \begin{function}{\ekvsneak,\ekvsneakPre} % \begin{syntax} @@ -523,6 +673,11 @@ and the derived files expkv.pdf % list everything that has been |\ekvsneak|ed will be left in the input % stream. A small usage example is shown in \autoref{sec:sneakex}. % \end{function} +% \example Define a key |secret| in the set |foo| that will sneak out a macro +% |\foo@secretly@sneaked|: +% \begin{lstlisting}[aboveskip=0pt,belowskip=0pt] +% \ekvdefNoVal{foo}{secret}{\ekvsneak{\foo@secretly@sneaked}} +% \end{lstlisting} % % \begin{function}{\ekvchangeset} % \begin{syntax} @@ -530,17 +685,23 @@ and the derived files expkv.pdf % \end{syntax} % Replaces the current set with \meta{new-set}, so for the rest of the current % |\ekvset| call, that call behaves as if it was called with -% \texttt{\cs[no-index]{ekvset}\marg{new-set}}. Just like |\ekvsneak| this -% reads and reinserts the remainder of the current |\ekvset| macro to do its -% job. It is comparable to using \texttt{\meta{key}/.cd} in \pkg{pgfkeys}. +% \texttt{\cs[no-index]{ekvset}\marg{new-set}}. It is comparable to using +% \texttt{\meta{key}/.cd} in \pkg{pgfkeys}. % \end{function} +% \example Define a key |cd| in set |foo| that will change to another set as +% specified in the value, if the set is undefined it'll stop the parsing and +% throw an error as defined in the macro |\foo@cd@error|: +% \begin{lstlisting}[aboveskip=0pt,belowskip=0pt] +% \ekvdef{foo}{cd} +% {\ekvifdefinedset{#1}{\ekvchangeset{#1}}{\ekvbreak{\foo@cd@error}}} +% \end{lstlisting} % % \bigskip % % \begin{function}{\ekv@name,\ekv@name@set,\ekv@name@key} % \begin{syntax} -% \cs{ekv@name}\marg{set}\marg{key}\\ -% \cs{ekv@name@set}\marg{set}\\ +% \cs{ekv@name}\marg{set}\marg{key} +% \cs{ekv@name@set}\marg{set} % \cs{ekv@name@key}\marg{key} % \end{syntax} % The names of the macros that correspond to a key in a set are build with @@ -556,190 +717,11 @@ and the derived files expkv.pdf % macros outside of \expkv, but \emph{don't} change them! \expkv\ relies on % their exact definitions internally. % \end{function} -% -% \subsubsection{Bugs} -% -% Just like \pkg{keyval}, \expkv\ is bug free. But if you find \pmso{bugs}hidden -% features\footnote{Thanks, David!} you can tell me about them either via mail -% (see the first page) or directly on GitHub if you have an account there: -% \url{https://github.com/Skillmon/tex_expkv} -% -% \subsubsection{Comparisons} -% -% Comparisons of speed are done with a very simple test key and the help of the -% \pkg{l3benchmark} package. The key and its usage should be equivalent to -% \begin{lstlisting} -% \protected\ekvdef{test}{height}{\def\myheight{#1}} -% \ekvsetdef\expkvtest{test} -% \expkvtest{ height = 6 } -% \end{lstlisting} -% and only the usage of the key, not its definition, is benchmarked. For the -% impatient, the essence of these comparisons regarding speed and buggy -% behaviour is contained in \autoref{tab:comp}. -% -% As far as I know \expkv\ is the only fully expandable \kv\ parser. I tried to -% compare \expkv\ to every \kv\ package listed on -% \href{https://ctan.org/topic/keyval}{CTAN}, however, one might notice that -% some of those are missing from this list. That's because I didn't get the -% others to work due to bugs, or because they just provide wrappers around other -% packages in this list. -% -% In this subsubsection is no benchmark of |\ekvparse| and |\keyval_parse:NNn| -% contained, as most other packages don't provide equivalent features to my -% knowledge. |\ekvparse| is slightly faster than |\ekvset|, but keep in mind -% that it does less. The same is true for |\keyval_parse:NNn| compared to -% |\keys_set:nn| of \pkg{expl3} (where the difference is much bigger). Comparing -% just the two, |\ekvparse| is a tad faster than |\keyval_parse:NNn| because of -% the two tests (for empty key names and only a single equal sign) which are -% omitted. -% -% \paragraph{\pkg{keyval}} is about \SIrange{30}{40}{\percent} faster and has a -% comparable feature set just a slightly different way how it handles keys -% without values. That might be considered a drawback, as it limits the -% versatility, but also as an advantage, as it might reduce doubled code. Keep -% in mind that as soon as someone loads \pkg{xkeyval} the performance of -% \pkg{keyval} gets replaced by \pkg{xkeyval}'s. -% -% Also \pkg{keyval} has a bug, which unfortunately can't really be resolved -% without breaking backwards compatibility for \emph{many} documents, namely it -% strips braces from the argument before stripping spaces if the argument isn't -% surrounded by spaces, also it might strip more than one set of braces. Hence -% all of the following are equivalent in their outcome, though the last two -% lines should result in something different than the first two: -% \begin{lstlisting}[belowskip=0pt] -% \setkeys{foo}{bar=baz} -% \setkeys{foo}{bar= {baz}} -% \setkeys{foo}{bar={ baz}} % should be ` baz' -% \setkeys{foo}{bar={{baz}}} % should be `{baz}' -% \end{lstlisting} -% -% \paragraph{\pkg{xkeyval}} is roughly twenty times slower, but it provides more -% functionality, e.g., it has choice keys, boolean keys, and so on. It contains -% the same bug as \pkg{keyval} as it has to be compatible with it by design (it -% replaces \pkg{keyval}'s frontend), but also adds even more cases in which -% braces are stripped that shouldn't be stripped, worsening the situation. -% -% \paragraph{\pkg{ltxkeys}} is no longer compatible with the \LaTeX\ kernel -% starting with the release 2020-10-01. It is over 380 times slower -- which is -% funny, because it aims to be ``[\ldots] faster [\ldots] than these earlier -% packages [referring to \pkg{keyval} and \pkg{xkeyval}].'' It needs more time -% to parse zero~keys than five of the packages in this comparison need to parse -% 100~keys. Since it aims to have a bigger feature set than \pkg{xkeyval}, it -% most definitely also has a bigger feature set than \expkv. Also, it can't -% parse |\long| input, so as soon as your values contain a |\par|, it'll throw -% errors. Furthermore, \pkg{ltxkeys} doesn't strip outer braces at all by -% design, which, imho, is a weird design choice. In addition \pkg{ltxkeys} loads -% \pkg{catoptions} which is known to introduce bugs (e.g., see -% \url{https://tex.stackexchange.com/questions/461783}). Because it is no longer -% compatible with the kernel, I stop benchmarking it (so the numbers listed here -% and in \autoref{tab:comp} regarding \pkg{ltxkeys} were last updated on -% 2020-10-05). -% -% \paragraph{\pkg{l3keys}} is around four and a half times slower, but has an, -% imho, great interface to define keys. It strips \emph{all} outer spaces, even -% if somehow multiple spaces ended up on either end. It offers more features, -% but is pretty much bound to \pkg{expl3} code. Whether that's a drawback is up -% to you. -% -% \paragraph{\pkg{pgfkeys}} is around \num{2.7} times slower for one key if one -% uses the |/|\meta{path}|/.cd| syntax and almost \SI{20}{\percent} slower if -% one uses |\pgfqkeys|, but has an \emph{enormous} feature set. -% To get the best performance |\pgfqkeys| was used in the benchmark. This -% reduces the overhead for setting the base directory of the benchmark keys by -% about \SI{43}{\ops} (so both $p_0$ and $T_0$ would be about \SI{43}{\ops} -% bigger if |\pgfkeys{|\meta{path}|/.cd,|\meta{keys}|}| was used instead). -% It has the same or a very similar bug \pkg{keyval} has. The brace bug (and -% also the category fragility) can be fixed by \pkg{pgfkeyx}, but this package -% was last updated in 2012 and it slows down |\pgfkeys| by factor~\num{8}. Also -% \pkg{pgfkeyx} is no longer compatible with versions of \pkg{pgfkeys} newer -% than 2020-05-25. -% -% \paragraph{\pkg{kvsetkeys} with \pkg{kvdefinekeys}} is about \num{4.4} times -% slower, but it works even if commas and equals have category codes different -% from 12 (just as some other packages in this list). Else the features of the -% keys are equal to those of \pkg{keyval}, the parser has more features, though. -% -% \paragraph{\pkg{options}} is \num{1.7} times slower for only a single value. -% It has a much bigger feature set. Unfortunately it also suffers from the -% premature unbracing bug \pkg{keyval} has. -% -% \paragraph{\pkg{simplekv}} is hard to compare because I don't speak French (so -% I don't understand the documentation). There was an update released on -% 2020-04-27 which greatly improved the package's performance and adds -% functionality so that it can be used more like most of the other \kv\ -% packages. It has problems with stripping braces and spaces in a hard to -% predict manner just like \pkg{keyval}. Also, while it tries to be robust -% against category code changes of commas and equal signs, the used mechanism -% fails if the \kv\ list already got tokenised. Regarding unknown keys it got a -% very interesting behaviour. It doesn't throw an error, but stores the \val\ in -% a new entry accessible with \cs[no-index]{useKV}. Also if you omit \val\ it -% stores |true| for that \key. For up to three keys, \expkv\ is a bit faster, -% for more keys \pkg{simplekv} takes the lead. -% -% \paragraph{\pkg{yax}} is over twenty times slower. It has a pretty strange -% syntax, imho, and again a direct equivalent is hard to define. It has the -% premature unbracing bug, too. Also somehow loading \pkg{yax} broke -% \pkg{options} for me. The tested definition was: -% \begin{lstlisting}[belowskip=0pt] -% \usepackage{yax} -% \defactiveparameter yax {\storevalue\myheight yax:height } % key setup -% \setparameterlist{yax}{ height = 6 } % benchmarked +% \example Execute the callback of the |NoVal| key |key| in set |foo|: +% \begin{lstlisting}[aboveskip=0pt,belowskip=0pt] +% \csname\ekv@name{foo}{key}N\endcsname % \end{lstlisting} % -% \begin{table} -% \def\fnsym{\textcolor{red!80!black}{*}}% -% \sisetup{round-precision=1, round-mode=places}% -% \begingroup -% \centering -% \newcommand*\yes{\textcolor{red!80!black} {yes}}^^A -% \newcommand*\no {\textcolor{green!80!black}{no}}^^A -% \caption[Comparison of \kv\ packages] -% {^^A -% Comparison of \kv\ packages. The packages are ordered from -% fastest to slowest for one \kv\ pair. Benchmarking was done using -% \pkg{l3benchmark} and the scripts in the \file{Benchmarks} folder -% of the \href{https://github.com/Skillmon/tex_expkv}{git repository}. -% The columns $p_i$ are the polynomial coefficients of a linear fit to the -% run-time, $p_0$ can be interpreted as the overhead for initialisation -% and $p_1$ the cost per key. The $T_0$ column is the actual mean ops -% needed for an empty list argument, as the linear fit doesn't match that -% point well in general. The column ``BB'' lists whether the -% parsing is affected by some sort of brace bug, ``CF'' stands for -% category code fragile and lists whether the parsing breaks with active -% commas or equal signs.^^A -% \label{tab:comp}^^A -% } -% \begin{tabular} -% {>{\collectcell\pkg}l<{\endcollectcell}*3{S[table-format=4.1]}ccc} -% \toprule -% \rmfamily Package & {$p_1$} & {$p_0$} & {$T_0$}& BB & CF & Date \\ -% \midrule -% keyval & 13.742 & 1.486 & 7.254 & \yes & \yes & 2014-10-28 \\ -% \expkv & 19.701 & 2.169 & 6.592 & \no & \no & 2020-10-10 \\ -% simplekv & 18.334 & 6.971 & 17.710 & \yes & \yes & 2020-04-27 \\ -% pgfkeys & 24.274 & 1.725 & 10.650 & \yes & \yes & 2020-09-05 \\ -% options & 23.600 & 15.638 & 20.830 & \yes & \yes & 2015-03-01 \\ -% kvsetkeys & {\fnsym} & {\fnsym} & 40.290 & \no & \no & 2019-12-15 \\ -% l3keys & 71.309 & 33.131 & 31.590 & \no & \no & 2020-09-24 \\ -% xkeyval & 253.563 & 202.246 & 168.300 & \yes & \yes & 2014-12-03 \\ -% yax & 421.853 & 157.003 & 114.700 & \yes & \yes & 2010-01-22 \\ -% ltxkeys & 3400.142 & 4737.958 & 5368.000 & \no & \no & 2012-11-17 \\ -% \bottomrule -% \end{tabular} -% \par -% \endgroup -% \medskip -% \fnsym For \pkg{kvsetkeys} the linear model used for the other -% packages is a poor fit, \pkg{kvsetkeys} seems to have approximately -% quadratic run-time, the coefficients of the second degree polynomial fit are -% $p_2=\num{8.240}$, $p_1=\num{44.862}$, and $p_0=\num{60.793}$. Of course the -% other packages might not really have linear run-time, but at least from 1~to -% 20~keys the fits don't seem too bad. If one extrapolates the fits for 100 -% \kv\ pairs one finds that most of them match pretty well, the exception -% being \pkg{ltxkeys}, which behaves quadratic as well with -% $p_2=\num{23.500}$, $p_1=\num{2906.634}$, and $p_0=\num{6547.489}$. -% \end{table} -% % \subsection{Examples} % % \subsubsection{Standard Use-Case} @@ -783,7 +765,7 @@ and the derived files expkv.pdf % \ourmacro{width=5pt}\par % \end{minipage} % -% \paragraph{The same key using \protect\expkvd} +% \paragraph{The same keys using \protect\expkvd} % Using \expkvd\ we can set up the equivalent key using a \kv\ interface, after % the following we could use |\ourmacro| in the same way as above. \expkvd\ will % allocate and initialise |\ourdim| and define the |width| key |\protected| for @@ -799,6 +781,59 @@ and the derived files expkv.pdf % } % \end{lstlisting} % +% \subsubsection{A Macro to Draw Rules} +% +% Another small example could be a \kv\ driven |\rule| alternative, because I +% keep forgetting the correct order of its arguments. First we define the keys +% (and initialize the used macros to store the keys): +% \begin{lstlisting} +% \makeatletter +% \newcommand*\myrule@ht{1ex} +% \newcommand*\myrule@wd{0.1em} +% \newcommand*\myrule@raise{\z@} +% \protected\ekvdef{myrule}{ht}{\def\myrule@ht{#1}} +% \protected\ekvdef{myrule}{wd}{\def\myrule@wd{#1}} +% \protected\ekvdef{myrule}{raise}{\def\myrule@raise{#1}} +% \end{lstlisting} +% Then we define a macro to change the defaults outside of |\myrule| and +% |\myrule| itself: +% \begin{lstlisting} +% \ekvsetdef\myruleset{myrule} +% \newcommand*\myrule[1][]{\begingroup\myruleset{#1}\myrule@out\endgroup} +% \end{lstlisting} +% And finally the output: +% \begin{lstlisting} +% \newcommand*\myrule@out{\rule[\myrule@raise]\myrule@wd\myrule@ht} +% \makeatother +% \end{lstlisting} +% And we can use it:\\ +% \begin{minipage}{7cm} +% \begin{lstlisting} +% a\myrule\par +% a\myrule[ht=2ex,raise=-.5ex]\par +% \myruleset{wd=5pt} +% a\myrule +% \end{lstlisting} +% \end{minipage}^^A +% \begin{minipage}{\dimexpr\linewidth-7cm\relax} +% \makeatletter +% \newcommand*\myrule@ht{1ex} +% \newcommand*\myrule@wd{0.1em} +% \newcommand*\myrule@raise{\z@} +% \protected\ekvdef{myrule}{ht}{\def\myrule@ht{#1}} +% \protected\ekvdef{myrule}{wd}{\def\myrule@wd{#1}} +% \protected\ekvdef{myrule}{raise}{\def\myrule@raise{#1}} +% \ekvsetdef\myruleset{myrule} +% \newcommand*\myrule[1][]{\begingroup\myruleset{#1}\myrule@out\endgroup} +% \newcommand*\myrule@out{\rule[\myrule@raise]\myrule@wd\myrule@ht} +% \makeatother +% a\myrule\par +% a\myrule[ht=2ex,raise=-.5ex]\par +% \myruleset{wd=5pt} +% a\myrule +% \end{minipage} +% +% % \subsubsection{An Expandable \kv\ Macro Using \cs[no-index]{ekvsneak}} % \label{sec:sneakex} % @@ -1004,6 +1039,23 @@ and the derived files expkv.pdf % value forbidden (`<key>', set `<set>'). % \end{lstlisting} % +% If you're using an undefined key in a set for which |\ekvredirectunknown| was +% used, and the key isn't found in any of the other sets as well, you'll get: +% \begin{lstlisting} +% ! Undefined control sequence. +% <argument> \! expkv Error: +% no key `<key>' in sets {<set1>}{<set2>}... +% \end{lstlisting} +% +% If you're using an undefined |NoVal| key in a set for which +% |\ekvredirectunknownNoVal| was used, and the key isn't found in any of the +% other sets as well, you'll get: +% \begin{lstlisting} +% ! Undefined control sequence. +% <argument> \! expkv Error: +% no NoVal key `<key>' in sets {<set1>}... +% \end{lstlisting} +% % If you're using a set for which you never executed one of the defining macros % from \autoref{sec:define} you'll get a low level \TeX\ error, as that isn't % actively tested by the parser (and hence will lead to undefined behaviour and @@ -1014,6 +1066,195 @@ and the derived files expkv.pdf % \! expkv Error: Set `<set>' undefined. % \end{lstlisting} % +% \subsection{Bugs} +% +% Just like \pkg{keyval}, \expkv\ is bug free. But if you find \pmso{bugs}hidden +% features\footnote{Thanks, David!} you can tell me about them either via mail +% (see the first page) or directly on GitHub if you have an account there: +% \url{https://github.com/Skillmon/tex_expkv} +% +% \subsection{Comparisons}\label{sec:cmp} +% +% This subsection makes some basic comparison between \expkv\ and other \kv\ +% packages. The comparisons are really concise, regarding speed, feature range +% (without listing the features of each package), and bugs and misfeatures. +% +% Comparisons of speed are done with a very simple test key and the help of the +% \pkg{l3benchmark} package. The key and its usage should be equivalent to +% \begin{lstlisting} +% \protected\ekvdef{test}{height}{\def\myheight{#1}} +% \ekvsetdef\expkvtest{test} +% \expkvtest{ height = 6 } +% \end{lstlisting} +% and only the usage of the key, not its definition, is benchmarked. For the +% impatient, the essence of these comparisons regarding speed and buggy +% behaviour is contained in \autoref{tab:comp}. +% +% As far as I know \expkv\ is the only fully expandable \kv\ parser. I tried to +% compare \expkv\ to every \kv\ package listed on +% \href{https://ctan.org/topic/keyval}{CTAN}, however, one might notice that +% some of those are missing from this list. That's because I didn't get the +% others to work due to bugs, or because they just provide wrappers around other +% packages in this list. +% +% In this subsection is no benchmark of |\ekvparse| and |\keyval_parse:NNn| +% contained, as most other packages don't provide equivalent features to my +% knowledge. |\ekvparse| is slightly faster than |\ekvset|, but keep in mind +% that it does less. The same is true for |\keyval_parse:NNn| compared to +% |\keys_set:nn| of \pkg{expl3} (where the difference is much bigger). Comparing +% just the two, |\ekvparse| is a tad faster than |\keyval_parse:NNn| because of +% the two tests (for empty key names and only a single equal sign) which are +% omitted. +% +% \paragraph{\pkg{keyval}} is about \SIrange{30}{40}{\percent} faster and has a +% comparable feature set (actually a bit smaller since \expkv\ supports +% unknown-key handlers and redirection to other sets) just a slightly different +% way how it handles keys without values. That might be considered a drawback, +% as it limits the versatility, but also as an advantage, as it might reduce +% doubled code. Keep in mind that as soon as someone loads \pkg{xkeyval} the +% performance of \pkg{keyval} gets replaced by \pkg{xkeyval}'s. +% +% Also \pkg{keyval} has a bug, which unfortunately can't really be resolved +% without breaking backwards compatibility for \emph{many} documents, namely it +% strips braces from the argument before stripping spaces if the argument isn't +% surrounded by spaces, also it might strip more than one set of braces. Hence +% all of the following are equivalent in their outcome, though the last two +% lines should result in something different than the first two: +% \begin{lstlisting}[belowskip=0pt] +% \setkeys{foo}{bar=baz} +% \setkeys{foo}{bar= {baz}} +% \setkeys{foo}{bar={ baz}} % should be ` baz' +% \setkeys{foo}{bar={{baz}}} % should be `{baz}' +% \end{lstlisting} +% +% \paragraph{\pkg{xkeyval}} is roughly twenty times slower, but it provides more +% functionality, e.g., it has choice keys, boolean keys, and so on. It contains +% the same bug as \pkg{keyval} as it has to be compatible with it by design (it +% replaces \pkg{keyval}'s frontend), but also adds even more cases in which +% braces are stripped that shouldn't be stripped, worsening the situation. +% +% \paragraph{\pkg{ltxkeys}} is no longer compatible with the \LaTeX\ kernel +% starting with the release 2020-10-01. It is over 380 times slower -- which is +% funny, because it aims to be ``[\ldots] faster [\ldots] than these earlier +% packages [referring to \pkg{keyval} and \pkg{xkeyval}].'' It needs more time +% to parse zero~keys than five of the packages in this comparison need to parse +% 100~keys. Since it aims to have a bigger feature set than \pkg{xkeyval}, it +% most definitely also has a bigger feature set than \expkv. Also, it can't +% parse |\long| input, so as soon as your values contain a |\par|, it'll throw +% errors. Furthermore, \pkg{ltxkeys} doesn't strip outer braces at all by +% design, which, imho, is a weird design choice. In addition \pkg{ltxkeys} loads +% \pkg{catoptions} which is known to introduce bugs (e.g., see +% \url{https://tex.stackexchange.com/questions/461783}). Because it is no longer +% compatible with the kernel, I stop benchmarking it (so the numbers listed here +% and in \autoref{tab:comp} regarding \pkg{ltxkeys} were last updated on +% 2020-10-05). +% +% \paragraph{\pkg{l3keys}} is around four and a half times slower, but has an, +% imho, great interface to define keys. It strips \emph{all} outer spaces, even +% if somehow multiple spaces ended up on either end. It offers more features, +% but is pretty much bound to \pkg{expl3} code. Whether that's a drawback is up +% to you. +% +% \paragraph{\pkg{pgfkeys}} is around \num{2.7} times slower for one key if one +% uses the |/|\meta{path}|/.cd| syntax and almost \SI{20}{\percent} slower if +% one uses |\pgfqkeys|, but has an \emph{enormous} feature set. +% To get the best performance |\pgfqkeys| was used in the benchmark. This +% reduces the overhead for setting the base directory of the benchmark keys by +% about \SI{43}{\ops} (so both $p_0$ and $T_0$ would be about \SI{43}{\ops} +% bigger if |\pgfkeys{|\meta{path}|/.cd,|\meta{keys}|}| was used instead). +% It has the same or a very similar bug \pkg{keyval} has. The brace bug (and +% also the category fragility) can be fixed by \pkg{pgfkeyx}, but this package +% was last updated in 2012 and it slows down |\pgfkeys| by factor~\num{8}. Also +% \pkg{pgfkeyx} is no longer compatible with versions of \pkg{pgfkeys} newer +% than 2020-05-25. +% +% \paragraph{\pkg{kvsetkeys} with \pkg{kvdefinekeys}} is about \num{4.4} times +% slower, but it works even if commas and equals have category codes different +% from 12 (just as some other packages in this list). Else the features of the +% keys are equal to those of \pkg{keyval}, the parser has more features, though. +% +% \paragraph{\pkg{options}} is \num{1.7} times slower for only a single value. +% It has a much bigger feature set. Unfortunately it also suffers from the +% premature unbracing bug \pkg{keyval} has. +% +% \paragraph{\pkg{simplekv}} is hard to compare because I don't speak French (so +% I don't understand the documentation). There was an update released on +% 2020-04-27 which greatly improved the package's performance and adds +% functionality so that it can be used more like most of the other \kv\ +% packages. It has problems with stripping braces and spaces in a hard to +% predict manner just like \pkg{keyval}. Also, while it tries to be robust +% against category code changes of commas and equal signs, the used mechanism +% fails if the \kv\ list already got tokenised. Regarding unknown keys it got a +% very interesting behaviour. It doesn't throw an error, but stores the \val\ in +% a new entry accessible with \cs[no-index]{useKV}. Also if you omit \val\ it +% stores |true| for that \key. For up to three keys, \expkv\ is a bit faster, +% for more keys \pkg{simplekv} takes the lead. +% +% \paragraph{\protect\yax} is over twenty times slower. It has a pretty +% strange syntax for the \TeX-world, imho, and again a direct equivalent is hard +% to define (don't understand me wrong, I don't say I don't like the syntax, +% it's just atypical). It has the premature unbracing bug, too. Also somehow +% loading \yax\ broke \pkg{options} for me. The tested definition was: +% \begin{lstlisting}[belowskip=0pt] +% \usepackage{yax} +% \defactiveparameter yax {\storevalue\myheight yax:height } % key setup +% \setparameterlist{yax}{ height = 6 } % benchmarked +% \end{lstlisting} +% +% \begin{table} +% \def\fnsym{\textcolor{red!80!black}{*}}% +% \sisetup{round-precision=1, round-mode=places}% +% \begingroup +% \centering +% \newcommand*\yes{\textcolor{red!80!black} {yes}}^^A +% \newcommand*\no {\textcolor{green!80!black}{no}}^^A +% \caption[Comparison of \kv\ packages] +% {^^A +% Comparison of \kv\ packages. The packages are ordered from +% fastest to slowest for one \kv\ pair. Benchmarking was done using +% \pkg{l3benchmark} and the scripts in the \file{Benchmarks} folder +% of the \href{https://github.com/Skillmon/tex_expkv}{git repository}. +% The columns $p_i$ are the polynomial coefficients of a linear fit to the +% run-time, $p_0$ can be interpreted as the overhead for initialisation +% and $p_1$ the cost per key. The $T_0$ column is the actual mean ops +% needed for an empty list argument, as the linear fit doesn't match that +% point well in general. The column ``BB'' lists whether the +% parsing is affected by some sort of brace bug, ``CF'' stands for +% category code fragile and lists whether the parsing breaks with active +% commas or equal signs.^^A +% \label{tab:comp}^^A +% } +% \begin{tabular} +% {>{\collectcell\pkg}l<{\endcollectcell}*3{S[table-format=4.1]}ccc} +% \toprule +% \rmfamily Package & {$p_1$} & {$p_0$} & {$T_0$}& BB & CF & Date \\ +% \midrule +% keyval & 13.742 & 1.486 & 7.254 & \yes & \yes & 2014-10-28 \\ +% \expkv & 19.701 & 2.169 & 6.592 & \no & \no & 2020-10-10 \\ +% simplekv & 18.334 & 6.971 & 17.710 & \yes & \yes & 2020-04-27 \\ +% pgfkeys & 24.274 & 1.725 & 10.650 & \yes & \yes & 2020-09-05 \\ +% options & 23.600 & 15.638 & 20.830 & \yes & \yes & 2015-03-01 \\ +% kvsetkeys & {\fnsym} & {\fnsym} & 40.290 & \no & \no & 2019-12-15 \\ +% l3keys & 71.309 & 33.131 & 31.590 & \no & \no & 2020-09-24 \\ +% xkeyval & 253.563 & 202.246 & 168.300 & \yes & \yes & 2014-12-03 \\ +% \yax & 421.853 & 157.003 & 114.700 & \yes & \yes & 2010-01-22 \\ +% ltxkeys & 3400.142 & 4737.958 & 5368.000 & \no & \no & 2012-11-17 \\ +% \bottomrule +% \end{tabular} +% \par +% \endgroup +% \medskip +% \fnsym For \pkg{kvsetkeys} the linear model used for the other +% packages is a poor fit, \pkg{kvsetkeys} seems to have approximately +% quadratic run-time, the coefficients of the second degree polynomial fit are +% $p_2=\num{8.240}$, $p_1=\num{44.862}$, and $p_0=\num{60.793}$. Of course the +% other packages might not really have linear run-time, but at least from 1~to +% 20~keys the fits don't seem too bad. If one extrapolates the fits for 100 +% \kv\ pairs one finds that most of them match pretty well, the exception +% being \pkg{ltxkeys}, which behaves quadratic as well with +% $p_2=\num{23.500}$, $p_1=\num{2906.634}$, and $p_0=\num{6547.489}$. +% \end{table} +% % \subsection{License} % % Copyright \textcopyright\ 2020\unless\ifnum\year=2020--\the\year\fi\ @@ -1084,8 +1325,8 @@ and the derived files expkv.pdf % \begin{macro}{\ekvVersion,\ekvDate} % We're on our first input, so lets store the version and date in a macro. % \begin{macrocode} -\def\ekvVersion{1.6} -\def\ekvDate{2020-12-28} +\def\ekvVersion{1.7} +\def\ekvDate{2021-04-09} % \end{macrocode} % \end{macro} % @@ -1291,6 +1532,38 @@ and the derived files expkv.pdf % \end{macrocode} % \end{macro} % +% \begin{macro}[internal]{\ekv@csv@loop,\ekv@csv@loop@do,\ekv@csv@loop@end} +% This is just a very simple loop over a list of comma separated values, +% leaving each element as the argument to a specified function inside of +% |\unravel|. It should be used as +% \texttt +% {^^A +% \cs[no-index]{ekv@csv@loop}\hskip0pt^^A +% \marg{function}\hskip0pt^^A +% \cs[no-index]{ekv@mark}\hskip0pt^^A +% \meta{csv-list}\hskip0pt^^A +% ,\cs[no-index]{ekv@stop},^^A +% }. +% We use some |\expandafter| chain to preexpand |\ekv@strip| here. +% \begin{macrocode} +\ekv@exparg{\long\def\ekv@csv@loop#1#2,}% + {% + \expandafter + \ekv@gobble@from@mark@to@stop + \expandafter#\expandafter2\expandafter\ekv@csv@loop@end\expandafter + \ekv@stop + \ekv@strip{#2}{\ekv@csv@loop@do{#1}}% + \ekv@csv@loop{#1}\ekv@mark + } +\long\def\ekv@csv@loop@do#1#2{\unexpanded{#1{#2}}} +\long\expandafter\def\expandafter\ekv@csv@loop@end + \expandafter\ekv@stop + \ekv@strip{#1}#2% + \ekv@csv@loop#3\ekv@mark + {} +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\ekv@name,\ekv@name@set,\ekv@name@key} % The keys will all follow the same naming scheme, so we define it here. % \begin{macrocode} @@ -1429,11 +1702,148 @@ and the derived files expkv.pdf \unexpanded\expandafter{\ekv@undefined@set{#1}\endcsname{#1}}% }% {\unexpanded\expandafter{\ekv@name{#3}{#4}}}% - }% + } \expandafter\ekvdef\ekvdefNoVal % \end{macrocode} % \end{macro} % +% \begin{macro}{\ekvredirectunknown,\ekvredirectunknownNoVal} +% \begin{macro}[internal] +% { +% \ekv@defredirectunknown,\ekv@redirectunknown@aux, +% \ekv@redirectunknownNoVal@aux +% } +% The redirection macros prepare the unknown function by looping over the +% provided list of sets and leaving a |\ekv@redirect@kv| or |\ekv@redirect@k| +% for each set. Only the first of these internals will receive the \key\ and +% \val\ as arguments. +% \begin{macrocode} +\protected\def\ekvredirectunknown + {% + \ekv@defredirectunknown + \ekv@redirect@kv + \ekv@err@redirect@kv@notfound + {\long\ekvdefunknown}% + \ekv@redirectunknown@aux + } +\protected\def\ekvredirectunknownNoVal + {% + \ekv@defredirectunknown + \ekv@redirect@k + \ekv@err@redirect@k@notfound + \ekvdefunknownNoVal + \ekv@redirectunknownNoVal@aux + } +\protected\def\ekv@defredirectunknown#1#2#3#4#5#6% + {% + \begingroup + \edef\ekv@tmp + {% + \ekv@csv@loop#1\ekv@mark#6,\ekv@stop,% + \unexpanded{#2}% + {\ekv@csv@loop{}\ekv@mark#5,#6,\ekv@stop,}% + }% + \ekv@expargtwice + {\endgroup#3{#5}}% + {\expandafter#4\ekv@tmp\ekv@stop}% + } +\def\ekv@redirectunknown@aux#1{#1{##1}{##2}} +\def\ekv@redirectunknownNoVal@aux#1{#1{##1}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}[internal] +% { +% \ekv@redirect@k,\ekv@redirect@k@a,\ekv@redirect@k@a@, +% \ekv@redirect@k@b,\ekv@redirect@k@c,\ekv@redirect@k@d, +% \ekv@redirect@kv,\ekv@redirect@kv@a,\ekv@redirect@kv@a@, +% \ekv@redirect@kv@b,\ekv@redirect@kv@c,\ekv@redirect@kv@d +% } +% The redirect code works by some simple loop over all the sets, which we +% already preprocessed in |\ekv@defredirectunknown|. For some optimisation we +% blow this up a bit code wise, essentially, all this does is |\ekvifdefined| +% or |\ekvifdefinedNoVal| in each set, if there is a match gobble the +% remainder of the specified sets and execute the key macro, else go on with +% the next set (to which the \key\ and \val\ are forwarded). +% +% First we set up some code which is different depending on |\lastnamedcs| +% being available or not. All this is stored in a temporary macro to have +% pre-expanded |\ekv@name| constellations ready. +% \begin{macrocode} +\def\ekv@redirect@k#1#2#3#4% + {% + \ekv@if@lastnamedcs + {% + \def\ekv@redirect@k##1##2##3% + {% + \ifcsname#1\endcsname\ekv@redirect@k@a\fi + ##3{##1}% + }% + \def\ekv@redirect@k@a\fi{\fi\expandafter\ekv@redirect@k@b\lastnamedcs}% + \long\def\ekv@redirect@kv##1##2##3##4% + {% + \ifcsname#2\endcsname\ekv@redirect@kv@a\fi\@gobble{##1}% + ##4{##1}{##2}% + } + \def\ekv@redirect@kv@a\fi\@gobble + {\fi\expandafter\ekv@redirect@kv@b\lastnamedcs}% + } + {% + \def\ekv@redirect@k##1##2##3% + {% + \ifcsname#1\endcsname\ekv@redirect@k@a\fi\ekv@redirect@k@a@ + #1\endcsname + ##3{##1}% + }% + \def\ekv@redirect@k@a@#3\endcsname{}% + \def\ekv@redirect@k@a\fi\ekv@redirect@k@a@ + {\fi\expandafter\ekv@redirect@k@b\csname}% + \long\def\ekv@redirect@kv##1##2##3##4% + {% + \ifcsname#2\endcsname\ekv@redirect@kv@a\fi\ekv@redirect@kv@a@ + #2\endcsname{##1}% + ##4{##1}{##2}% + } + \long\def\ekv@redirect@kv@a@#4\endcsname##3{}% + \def\ekv@redirect@kv@a\fi\ekv@redirect@kv@a@ + {\fi\expandafter\ekv@redirect@kv@b\csname}% + } + } +% \end{macrocode} +% The key name given to this loop will already be |\detokenize|d by |\ekvset|, +% so we can safely remove the |\detokenize| here for some performance gain. +% \begin{macrocode} +\def\ekv@redirect@kv#1\detokenize#2#3\ekv@stop{\unexpanded{#1#2#3}} +\edef\ekv@redirect@kv + {% + {\expandafter\ekv@redirect@kv\ekv@name{#2}{#1}N\ekv@stop}% + {\expandafter\ekv@redirect@kv\ekv@name{#3}{#2}\ekv@stop}% + {\expandafter\ekv@redirect@kv\ekv@name{#1}{#2}N\ekv@stop}% + {\expandafter\ekv@redirect@kv\ekv@name{#1}{#2}\ekv@stop}% + } +% \end{macrocode} +% Everything is ready to make the real definitions. +% \begin{macrocode} +\expandafter\ekv@redirect@k\ekv@redirect@kv +% \end{macrocode} +% The remaining macros here are independent on |\lastnamedcs|, starting from +% the |@b| we know that there is a hash table entry, and get the macro as a +% parameter. We still have to test whether the macro is |\relax|, depending on +% the result of that test we have to either remove the remainder of the +% current test, or the remainder of the set list and invoke the macro. +% \begin{macrocode} +\def\ekv@redirect@k@b#1% + {\ifx\relax#1\ekv@redirect@k@c\fi\ekv@redirect@k@d#1} +\def\ekv@redirect@k@c\fi\ekv@redirect@k@d#1{\fi} +\def\ekv@redirect@k@d#1#2\ekv@stop{#1} +\def\ekv@redirect@kv@b#1% + {\ifx\relax#1\ekv@redirect@kv@c\fi\ekv@redirect@kv@d#1} +\long\def\ekv@redirect@kv@c\fi\ekv@redirect@kv@d#1#2{\fi} +\long\def\ekv@redirect@kv@d#1#2#3\ekv@stop{#1{#2}} +% \end{macrocode} +% \end{macro} +% % \begin{macro}[internal]{\ekv@defsetmacro} % In order to enhance the speed the set name given to |\ekvset| will be turned % into a control sequence pretty early, so we have to define that control @@ -1841,12 +2251,12 @@ and the derived files expkv.pdf % % \begin{macro}{\ekvchangeset} % Provide a macro that is able to switch out the current \set\ in |\ekvset|. -% This operation is slow (by comparison, it should be slightly faster than -% |\ekvsneak|), but allows for something similar to \pkg{pgfkeys}'s -% \texttt{\meta{key}/.cd} mechanism. However this operation is more expensive -% than |/.cd| as we can't just redefine some token to reflect this, but have to -% switch out the set expandably, so this works similar to the |\ekvsneak| macros -% reading and reinserting the remainder of the \kv\ list. +% This operation allows something similar to \pkg{pgfkeys}'s +% \texttt{\meta{key}/.cd} mechanism. However this operation can be more +% expensive than |/.cd| as we can't just redefine some token to reflect this, +% but have to switch out the set expandably, so this works similar to the +% |\ekvsneak| macros reading and reinserting things, but it only has to read and +% reinsert the remainder of the current key's replacement code. % \begin{macrocode} \ekv@exparg{\def\ekvchangeset#1}% {% @@ -2034,18 +2444,12 @@ and the derived files expkv.pdf % is unlikely) we want to somehow throw expandable errors, in our case via % undefined control sequences. % \begin{macrocode} -\begingroup -\edef\ekv@err +\def\ekv@err#1% {% - \endgroup - \unexpanded{\long\def\ekv@err}##1% - {% - \unexpanded{\expandafter\ekv@err@\@firstofone}% - {\unexpanded\expandafter{\csname ! expkv Error:\endcsname}##1.}% - \unexpanded{\ekv@stop}% - }% + \long\def\ekv@err##1{\expandafter\ekv@err@\@firstofone{#1##1.}\ekv@stop}% } -\ekv@err +\begingroup\expandafter\endgroup +\expandafter\ekv@err\csname ! expkv Error:\endcsname \def\ekv@err@{\expandafter\ekv@gobbleto@stop} % \end{macrocode} % \end{macro} @@ -2059,10 +2463,15 @@ and the derived files expkv.pdf % use those instead of the full strings. % \begin{macrocode} \long\def\ekv@err@common #1#2{\expandafter\ekv@err@common@\string#2{#1}} -\long\def\ekv@err@common@#1`#2' #3.#4#5{\ekv@err{#4 (`#5', set `#2')}} +\ekv@exparg{\long\def\ekv@err@common@#1`#2' #3.#4#5}% + {\ekv@err{#4 (`#5', set `#2')}} \ekv@exparg{\long\def\ekv@err@unknown#1}{\ekv@err@common{unknown key}{#1}} \ekv@exparg{\long\def\ekv@err@noarg #1}{\ekv@err@common{value forbidden}{#1}} \ekv@exparg{\long\def\ekv@err@reqval #1}{\ekv@err@common{value required}{#1}} +\ekv@exparg{\long\def\ekv@err@redirect@kv@notfound#1#2#3\ekv@stop}% + {\ekv@err{no key `#2' in sets #3}} +\ekv@exparg{\def\ekv@err@redirect@k@notfound#1#2\ekv@stop}% + {\ekv@err{no NoVal key `#1' in sets #2}} % \end{macrocode} % \end{macro} % diff --git a/macros/generic/expkv/expkv.pdf b/macros/generic/expkv/expkv.pdf Binary files differindex ba39085660..8cedc0f0e5 100644 --- a/macros/generic/expkv/expkv.pdf +++ b/macros/generic/expkv/expkv.pdf diff --git a/macros/latex/contrib/babel-contrib/serbian/README.md b/macros/latex/contrib/babel-contrib/serbian/README.md index c3b005e671..7006c05ad0 100644 --- a/macros/latex/contrib/babel-contrib/serbian/README.md +++ b/macros/latex/contrib/babel-contrib/serbian/README.md @@ -1,8 +1,8 @@ ---------------------------------------------------------------- -Serbian Latin language module for Babel, v2.0a +# Serbian Latin language module for Babel, v2.1 -Released under the LaTeX Project Public License v1.3c or later. +Released under the LaTeX Project Public License v1.3 or later. See http://www.latex-project.org/lppl.txt The package provides support for use of Babel in documents written in Serbian Latin @@ -11,7 +11,7 @@ under legacy TeX engines, and under XeTeX and LuaTeX. The Current Maintainer is Uroš Stefanović. -USAGE +## USAGE Serbian language definition file can be used both with legacy 8-bit engines (such as latex.exe or pdflatex.exe) and Unicode compilers (xelatex.exe or @@ -22,10 +22,15 @@ Typesetting in ijekavian dialect: \usepackage[english,serbianc]{babel} \languageattribute{serbianc}{ijekav} or + \usepackage[english,serbianc.ijekav]{babel} Also, the attributes 'datei' and 'quotes' are defined. -DOCUMENTATION +## CHANGES v2.1 + +New enumeration alphabets are available. + +## DOCUMENTATION See serbian.pdf for more information. diff --git a/macros/latex/contrib/babel-contrib/serbian/serbian.dtx b/macros/latex/contrib/babel-contrib/serbian/serbian.dtx index dd46341dfc..106ac9b7aa 100644 --- a/macros/latex/contrib/babel-contrib/serbian/serbian.dtx +++ b/macros/latex/contrib/babel-contrib/serbian/serbian.dtx @@ -1,7 +1,8 @@ % \iffalse meta-comment % -% Copyright 2019 Uroš Stefanović and any individual authors +% Copyright 2019--2021 Uroš Stefanović and any individual authors % listed elsewhere in this file. All rights reserved. +% Earlier Maintainers: Dejan Muhamedagić, Slobodan Janković, Javier Bezos López, Johannes L. Braams % % This file is intended to be used with the Babel system. % ------------------------------------------------------ @@ -31,7 +32,7 @@ %<code>\ProvidesLanguage{serbian} %\fi %\ProvidesFile{serbian.dtx} - [2019/12/15 2.0a Serbian Latin support for the Babel system] + [2021/04/10 2.1 Serbian Latin support for the Babel system] %\iffalse %% File `serbian.dtx' % @@ -99,6 +100,18 @@ % (used when after the date is the punctuation mark, such as comma). % Alternatively, the commands |\todayRoman| and |\todayRoman*| prints the current date using Roman numerals for months. % +% The alphabetical enumerations in texts use the Latin alphabet and alphabetic order, +% but the letters q, w, x and y are omitted by the rules of the Serbian language (22 letters are used). +% However, if the user wants to use the English alphabet for the enumeration (26 letters), this option is also available. +% We will also provide the enumeration with the Latin letters but in alphabetic order that matches the Cyrillic alphabet (30 letters). +% This of course shouldn't be used when the text is written in the Latin script. +% However, sometimes the text is written in the Latin script so it can be later +% converted into Cyrillic script (for example using the |OT2| encoding); in such case this alphabet order will be useful. +% One can manually switch the enumeration alphabet with the commands |\enumCyr|, |\enumLat| and |\enumEng|. +% This commands can be used after the |\begin{document}| when the \Lopt{serbian} language is active. +% In principle, enumerations are a matter for class and style designers but the same can be +% said also about things, other than enumerations, such as names of sections and bibliography lists. +% % Apart from defining shorthands we need to make sure that the % first paragraph of each section is indented. Furthermore the % following new math operators are defined: |\sh|, |\ch|, |\tg|, |\ctg|, @@ -285,7 +298,7 @@ % \end{macrocode} % % The Serbian hyphenation patterns can be used with |\lefthyphenmin| and -% |\righthyphenmin| set to 2. (Actually, the “official” definition allows even one character for |lefthyphen|, +% |\righthyphenmin| set to~2. (Actually, the “official” definition allows even one character for |lefthyphen|, % but it is recommended to use value two for better results.) % % \begin{macrocode} @@ -319,6 +332,72 @@ \addto\noextrasserbian{\bbl@nonserbianindent} % \end{macrocode} % +% We redefine the macro |\Alph|, which now produces (uppercase) Latin letters without the letters q, w, x and y +% when Serbian is switched on, but we will keep the English alphabet if the user wants to use it. +% Also we will define Latin alphabet in order that matches Cyrillic alphabet. +% The user can choose which alphabet to use through the commands |\enumCyr|, |\enumLat| and |\enumEng| +% (or even to switch from one enumeration to another). +% +% \begin{macrocode} +\newcount\srbl@lettering \srbl@lettering=\z@ +\addto\extrasserbian{\babel@save\@Alph \let\@Alph\srbl@Alph} +\def\srbl@Alph#1{% +\ifcase\srbl@lettering + \ifcase#1\or A\or B\or C\or D\or E\or F\or G\or H\or I\or + J\or K\or L\or M\or N\or O\or P\or R\or S\or T\or U\or V\or + Z\else\@ctrerr\fi +\or + \if@srb@uni@ode + \ifcase#1\or A\or B\or V\or G\or D\or Đ\or E\or Ž\or Z\or + I\or J\or K\or L\or Lj\or M\or N\or Nj\or O\or + P\or R\or S\or T\or Ć\or U\or F\or H\or C\or + Č\or Dž\or Š\else\@ctrerr\fi + \else + \ifcase#1\or A\or B\or V\or G\or D\or\DJ\or E\or\v Z\or Z\or + I\or J\or K\or L\or Lj\or M\or N\or Nj\or O\or + P\or R\or S\or T\or\'C\or U\or F\or H\or C\or + \v C\or D\v z\or\v S\else\@ctrerr\fi + \fi +\or + \ifcase#1\or A\or B\or C\or D\or E\or F\or G\or H\or I\or + J\or K\or L\or M\or N\or O\or P\or Q\or R\or S\or T\or U\or V\or + W\or X\or Y\or Z\else\@ctrerr\fi +\fi}% +% \end{macrocode} +% +% The same thing will be done with the macro |\alph|. +% +% \begin{macrocode} +\addto\extrasserbian{\babel@save\@alph \let\@alph\srbl@alph} +\def\srbl@alph#1{% +\ifcase\srbl@lettering + \ifcase#1\or a\or b\or c\or d\or e\or f\or g\or h\or i\or + j\or k\or l\or m\or n\or o\or p\or r\or s\or t\or u\or v\or + z\else\@ctrerr\fi +\or + \if@srb@uni@ode + \ifcase#1\or a\or b\or v\or g\or d\or đ\or e\or ž\or z\or + i\or j\or k\or l\or lj\or m\or n\or nj\or o\or + p\or r\or s\or t\or ć\or u\or f\or h\or c\or + č\or dž\or š\else\@ctrerr\fi + \else + \ifcase#1\or a\or b\or v\or g\or d\or\dj\or e\or\v z\or z\or + i\or j\or k\or l\or lj\or m\or n\or nj\or o\or + p\or r\or s\or t\or\'c\or u\or f\or h\or c\or + \v c\or d\v z\or\v s\else\@ctrerr\fi + \fi +\or + \ifcase#1\or a\or b\or c\or d\or e\or f\or g\or h\or i\or + j\or k\or l\or m\or n\or o\or p\or q\or r\or s\or t\or u\or v\or + w\or x\or y\or z\else\@ctrerr\fi +\fi}% +\addto\extrasserbian{% + \babel@save\enumEng \def\enumEng{\srbl@lettering=\tw@} + \babel@save\enumLat \def\enumLat{\srbl@lettering=\z@} + \babel@save\enumCyr \def\enumCyr{\srbl@lettering=\@ne} +}% +% \end{macrocode} +% % An |ijekav| attribute changes default behavior and activates an % alternative set of captions suitable for typesetting in ijekavian dialect. % The |quotes| attribute changes the |"'| shorthand to produce '' as closing quote, diff --git a/macros/latex/contrib/babel-contrib/serbian/serbian.ins b/macros/latex/contrib/babel-contrib/serbian/serbian.ins index c5610fcb3a..aa495cf06a 100644 --- a/macros/latex/contrib/babel-contrib/serbian/serbian.ins +++ b/macros/latex/contrib/babel-contrib/serbian/serbian.ins @@ -3,8 +3,9 @@ %% driver files from the doc files in this package when run through %% LaTeX or TeX. %% -%% Copyright 2019 Uroš Stefanović and any individual authors +%% Copyright 2019--2021 Uroš Stefanović and any individual authors %% listed elsewhere in this file. All rights reserved. +%% Earlier Maintainers: Dejan Muhamedagić, Slobodan Janković, Javier Bezos López, Johannes L. Braams %% %% This file is intended to be used with the Babel system. %% ------------------------------------------------------ @@ -28,7 +29,7 @@ %% %% --------------- start of docstrip commands ------------------ %% -\def\filedate{2019/12/15} +\def\filedate{2021/04/10} \def\batchfile{serbian.ins} \input docstrip.tex @@ -50,7 +51,7 @@ \declarepreamble\mainpreamble This is a generated file. -Copyright 2019 Uroš Stefanović and any individual authors +Copyright 2019--2021 Uroš Stefanović and any individual authors listed elsewhere in this file. All rights reserved. This file is intended to be used with the Babel system. @@ -76,7 +77,7 @@ extension .ins) which are part of the distribution. \declarepreamble\fdpreamble This is a generated file. -Copyright 2019 Uroš Stefanović and any individual authors +Copyright 2019--2021 Uroš Stefanović and any individual authors listed elsewhere in this file. All rights reserved. This file is intended to be used with the Babel system. diff --git a/macros/latex/contrib/babel-contrib/serbian/serbian.pdf b/macros/latex/contrib/babel-contrib/serbian/serbian.pdf Binary files differindex e79bce0e57..29d8d75b5e 100644 --- a/macros/latex/contrib/babel-contrib/serbian/serbian.pdf +++ b/macros/latex/contrib/babel-contrib/serbian/serbian.pdf diff --git a/macros/latex/contrib/babel-contrib/serbianc/README.md b/macros/latex/contrib/babel-contrib/serbianc/README.md index 3c6b5a0f48..5a9c48d83c 100644 --- a/macros/latex/contrib/babel-contrib/serbianc/README.md +++ b/macros/latex/contrib/babel-contrib/serbianc/README.md @@ -1,8 +1,8 @@ ---------------------------------------------------------------- -Serbian Cyrillic language module for Babel, v3.0a +# Serbian Cyrillic language module for Babel, v3.1 -Released under the LaTeX Project Public License v1.3c or later. +Released under the LaTeX Project Public License v1.3 or later. See http://www.latex-project.org/lppl.txt The package provides support for use of Babel in documents written in Serbian Cyrillic @@ -11,7 +11,7 @@ under legacy TeX engines, and under XeTeX and LuaTeX. The Current Maintainer is Uroš Stefanović. -USAGE +## USAGE Serbianc language definition file can be used both with legacy 8-bit engines (such as latex.exe or pdflatex.exe) and Unicode compilers (xelatex.exe or @@ -43,10 +43,15 @@ Typesetting in ijekavian dialect: \usepackage[english,serbianc]{babel} \languageattribute{serbianc}{ijekav} or + \usepackage[english,serbianc.ijekav]{babel} Also, the attributes 'datei' and 'quotes' are defined. -DOCUMENTATION +## CHANGES v3.1 + +New enumeration alphabets are available. + +## DOCUMENTATION See serbianc.pdf for more information. diff --git a/macros/latex/contrib/babel-contrib/serbianc/serbianc.dtx b/macros/latex/contrib/babel-contrib/serbianc/serbianc.dtx index 2a33327ee9..cca22b76c0 100644 --- a/macros/latex/contrib/babel-contrib/serbianc/serbianc.dtx +++ b/macros/latex/contrib/babel-contrib/serbianc/serbianc.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -%Copyright 2019 Uroš Stefanović, +%Copyright 2019--2021 Uroš Stefanović, %2002--2019 Filip Brčić %All rights reserved. % @@ -32,7 +32,7 @@ %<code>\ProvidesLanguage{serbianc} %\fi %\ProvidesFile{serbianc.dtx} - [2019/12/15 3.0a Serbian Cyrillic support for the Babel system] + [2021/04/10 3.1 Serbian Cyrillic support for the Babel system] %\iffalse %% File `serbianc.dtx' % @@ -98,7 +98,13 @@ % (used when after the date is the punctuation mark, such as comma). % Alternatively, the commands |\todayRoman| and |\todayRoman*| print the current date using Roman numerals for months. % -% The alphabetical enumerations in texts use the Cyrillic alphabet and alphabetic order. +% The alphabetical enumerations in texts use the Cyrillic alphabet and alphabetic order (all 30 letters of the Serbian language are used). +% Also, the Serbian language allows enumeration with the Latin alphabet. +% If the Latin alphabet is used in the enumeration the letters q, w, x and y are omitted by the rules of the Serbian language +% (22 letters are used in that case). +% However, if the user wants to use the English alphabet for the enumeration (26 letters), this option is also available. +% One can manually switch the enumeration alphabet with the commands |\enumCyr|, |\enumLat| and |\enumEng|. +% This commands can be used after the |\begin{document}| when the \Lopt{serbianc} language is active. % In principle, enumerations are a matter for class and style designers but the same can be % said also about things, other than enumerations, such as names of sections and bibliography lists. % @@ -471,8 +477,8 @@ % \end{macrocode} % % The Serbian hyphenation patterns can be used with |\lefthyphenmin| and -% |\righthyphenmin| set to 2. (Actually, the “official” definition allows even one character for |lefthyphen|, -% but it is recommended to use value two for better results.) +% |\righthyphenmin| set to~2. (Actually, the “official” definition allows even one character for |lefthyphen|, +% but it is recommended to use the value two for the better results.) % % \begin{macrocode} \providehyphenmins{\CurrentOption}{\tw@\tw@} @@ -514,46 +520,68 @@ % \end{macrocode} % % We redefine the macro |\Alph|, which now produces (uppercase) Cyrillic letters instead of Latin -% ones when Serbian is switched on. +% ones when Serbian is switched on. Also we will define Serbian Latin and English alphabets so +% the user can choose which alphabet to use through the commands |\enumCyr|, |\enumLat| and |\enumEng| +% (or even to switch from one enumeration to another). % % \begin{macrocode} -\addto\extrasserbianc{% -\babel@save\@Alph -\if@srbc@uni@ode - \def\@Alph#1{\ifcase#1\or - А\or Б\or В\or Г\or Д\or Ђ\or Е\or Ж\or З\or - И\or Ј\or К\or Л\or Љ\or М\or Н\or Њ\or О\or - П\or Р\or С\or Т\or Ћ\or У\or Ф\or Х\or Ц\or - Ч\or Џ\or Ш\else\@ctrerr\fi}% -\else - \def\@Alph#1{\ifcase#1\or - \CYRA\or\CYRB\or\CYRV\or\CYRG\or\CYRD\or\CYRDJE\or\CYRE\or\CYRZH\or\CYRZ\or - \CYRI\or\CYRJE\or\CYRK\or\CYRL\or\CYRLJE\or\CYRM\or\CYRN\or\CYRNJE\or\CYRO\or - \CYRP\or\CYRR\or\CYRS\or\CYRT\or\CYRTSHE\or\CYRU\or\CYRF\or\CYRH\or\CYRC\or - \CYRCH\or\CYRDZHE\or\CYRSH\else\@ctrerr\fi}% -\fi -} +\newcount\srbc@lettering \srbc@lettering=\z@ +\addto\extrasserbianc{\babel@save\@Alph \let\@Alph\srbc@Alph} +\def\srbc@Alph#1{% +\ifcase\srbc@lettering + \if@srbc@uni@ode + \ifcase#1\or А\or Б\or В\or Г\or Д\or Ђ\or Е\or Ж\or З\or + И\or Ј\or К\or Л\or Љ\or М\or Н\or Њ\or О\or П\or Р\or С\or + Т\or Ћ\or У\or Ф\or Х\or Ц\or Ч\or Џ\or Ш\else\@ctrerr\fi + \else + \ifcase#1\or\CYRA\or\CYRB\or\CYRV\or\CYRG\or\CYRD\or\CYRDJE\or + \CYRE\or\CYRZH\or\CYRZ\or\CYRI\or\CYRJE\or\CYRK\or\CYRL\or + \CYRLJE\or\CYRM\or\CYRN\or\CYRNJE\or\CYRO\or\CYRP\or\CYRR\or + \CYRS\or\CYRT\or\CYRTSHE\or\CYRU\or\CYRF\or\CYRH\or\CYRC\or + \CYRCH\or\CYRDZHE\or\CYRSH\else\@ctrerr\fi + \fi +\or + \ifcase#1\or A\or B\or C\or D\or E\or F\or G\or H\or I\or + J\or K\or L\or M\or N\or O\or P\or R\or S\or T\or U\or V\or + Z\else\@ctrerr\fi +\or + \ifcase#1\or A\or B\or C\or D\or E\or F\or G\or H\or I\or + J\or K\or L\or M\or N\or O\or P\or Q\or R\or S\or T\or U\or V\or + W\or X\or Y\or Z\else\@ctrerr\fi +\fi}% % \end{macrocode} % -% The macro |\alph| produces lowercase Cyrillic letters. +% The same thing will be done with the macro |\alph|. % % \begin{macrocode} +\addto\extrasserbianc{\babel@save\@alph \let\@alph\srbc@alph} +\def\srbc@alph#1{% +\ifcase\srbc@lettering + \if@srbc@uni@ode + \ifcase#1\or а\or б\or в\or г\or д\or ђ\or е\or ж\or з\or + и\or ј\or к\or л\or љ\or м\or н\or њ\or о\or п\or р\or с\or + т\or ћ\or у\or ф\or х\or ц\or ч\or џ\or ш\else\@ctrerr\fi + \else + \ifcase#1\or\cyra\or\cyrb\or\cyrv\or\cyrg\or\cyrd\or\cyrdje\or + \cyre\or\cyrzh\or\cyrz\or\cyri\or\cyrje\or\cyrk\or\cyrl\or + \cyrlje\or\cyrm\or\cyrn\or\cyrnje\or\cyro\or\cyrp\or\cyrr\or + \cyrs\or\cyrt\or\cyrtshe\or\cyru\or\cyrf\or\cyrh\or\cyrc\or + \cyrch\or\cyrdzhe\or\cyrsh\else\@ctrerr\fi + \fi +\or + \ifcase#1\or a\or b\or c\or d\or e\or f\or g\or h\or i\or + j\or k\or l\or m\or n\or o\or p\or r\or s\or t\or u\or v\or + z\else\@ctrerr\fi +\or + \ifcase#1\or a\or b\or c\or d\or e\or f\or g\or h\or i\or + j\or k\or l\or m\or n\or o\or p\or q\or r\or s\or t\or u\or v\or + w\or x\or y\or z\else\@ctrerr\fi +\fi}% \addto\extrasserbianc{% -\babel@save\@alph -\if@srbc@uni@ode - \def\@alph#1{\ifcase#1\or - а\or б\or в\or г\or д\or ђ\or е\or ж\or з\or - и\or ј\or к\or л\or љ\or м\or н\or њ\or о\or - п\or р\or с\or т\or ћ\or у\or ф\or х\or ц\or - ч\or џ\or ш\else\@ctrerr\fi}% -\else - \def\@alph#1{\ifcase#1\or - \cyra\or\cyrb\or\cyrv\or\cyrg\or\cyrd\or\cyrdje\or\cyre\or\cyrzh\or\cyrz\or - \cyri\or\cyrje\or\cyrk\or\cyrl\or\cyrlje\or\cyrm\or\cyrn\or\cyrnje\or\cyro\or - \cyrp\or\cyrr\or\cyrs\or\cyrt\or\cyrtshe\or\cyru\or\cyrf\or\cyrh\or\cyrc\or - \cyrch\or\cyrdzhe\or\cyrsh\else\@ctrerr\fi}% -\fi -} + \babel@save\enumEng \def\enumEng{\srbc@lettering=\tw@} + \babel@save\enumLat \def\enumLat{\srbc@lettering=\@ne} + \babel@save\enumCyr \def\enumCyr{\srbc@lettering=\z@} +}% % \end{macrocode} % % An |ijekav| attribute changes the default behavior and activates an @@ -609,17 +637,20 @@ \def\Prob{\mathop{\kern\z@\mathsf{P}}\nolimits} \def\Expect{\mathop{\kern\z@\mathsf{E}}\nolimits} \def\Variance{\mathop{\kern\z@\mathsf{D}}\nolimits} -\if@srbc@uni@ode - \def\nzs{\mathop{\mathrm{нзс}}\nolimits} - \def\nzd{\mathop{\mathrm{нзд}}\nolimits} - \def\NZS{\mathop{\mathrm{НЗС}}\nolimits} - \def\NZD{\mathop{\mathrm{НЗД}}\nolimits} -\else - \def\nzs{\mathop{\textnormal{\cyrn\cyrz\cyrs}}\nolimits} - \def\nzd{\mathop{\textnormal{\cyrn\cyrz\cyrd}}\nolimits} - \def\NZS{\mathop{\textnormal{\CYRN\CYRZ\CYRS}}\nolimits} - \def\NZD{\mathop{\textnormal{\CYRN\CYRZ\CYRD}}\nolimits} -\fi +\addto\extrasserbianc{% + \babel@save\nzs \babel@save\nzd + \babel@save\NZS \babel@save\NZD + \if@srbc@uni@ode + \def\nzs{\mathop{\mathrm{нзс}}\nolimits} + \def\nzd{\mathop{\mathrm{нзд}}\nolimits} + \def\NZS{\mathop{\mathrm{НЗС}}\nolimits} + \def\NZD{\mathop{\mathrm{НЗД}}\nolimits} + \else + \def\nzs{\mathop{\textnormal{\cyrn\cyrz\cyrs}}\nolimits} + \def\nzd{\mathop{\textnormal{\cyrn\cyrz\cyrd}}\nolimits} + \def\NZS{\mathop{\textnormal{\CYRN\CYRZ\CYRS}}\nolimits} + \def\NZD{\mathop{\textnormal{\CYRN\CYRZ\CYRD}}\nolimits} + \fi} % \end{macrocode} % % The macro |\ldf@finish| takes care of looking for a diff --git a/macros/latex/contrib/babel-contrib/serbianc/serbianc.ins b/macros/latex/contrib/babel-contrib/serbianc/serbianc.ins index 35ce930301..4260d94966 100644 --- a/macros/latex/contrib/babel-contrib/serbianc/serbianc.ins +++ b/macros/latex/contrib/babel-contrib/serbianc/serbianc.ins @@ -3,7 +3,7 @@ %% driver files from the doc files in this package when run through %% LaTeX or TeX. %% -%% Copyright 2019 Uroš Stefanović, +%% Copyright 2019--2021 Uroš Stefanović, %% 2002--2019 Filip Brčić %% All rights reserved. %% @@ -29,7 +29,7 @@ %% %% --------------- start of docstrip commands ------------------ %% -\def\filedate{2019/12/15} +\def\filedate{2021/04/10} \def\batchfile{serbianc.ins} \input docstrip.tex @@ -51,7 +51,7 @@ \declarepreamble\mainpreamble This is a generated file. -Copyright 2019 Uroš Stefanović, +Copyright 2019--2021 Uroš Stefanović, 2002--2019 Filip Brčić All rights reserved. @@ -78,7 +78,7 @@ extension .ins) which are part of the distribution. \declarepreamble\fdpreamble This is a generated file. -Copyright 2019 Uroš Stefanović, +Copyright 2019--2021 Uroš Stefanović, 2002--2019 Filip Brčić All rights reserved. diff --git a/macros/latex/contrib/babel-contrib/serbianc/serbianc.pdf b/macros/latex/contrib/babel-contrib/serbianc/serbianc.pdf Binary files differindex 8dd8ceec07..b886b7b261 100644 --- a/macros/latex/contrib/babel-contrib/serbianc/serbianc.pdf +++ b/macros/latex/contrib/babel-contrib/serbianc/serbianc.pdf diff --git a/macros/latex/contrib/easybook/doc/easybook-demo.pdf b/macros/latex/contrib/easybook/doc/easybook-demo.pdf Binary files differindex 08b9ac22cd..4b76732f4b 100644 --- a/macros/latex/contrib/easybook/doc/easybook-demo.pdf +++ b/macros/latex/contrib/easybook/doc/easybook-demo.pdf diff --git a/macros/latex/contrib/easybook/doc/easybook-demo.tex b/macros/latex/contrib/easybook/doc/easybook-demo.tex index 97f9fe4bb2..e08d970008 100644 --- a/macros/latex/contrib/easybook/doc/easybook-demo.tex +++ b/macros/latex/contrib/easybook/doc/easybook-demo.tex @@ -95,14 +95,14 @@ \usepackage{zhlipsum,bicaption,tasks,tcolorbox,imakeidx} \begin{document} -\title{\sffamily easybook书籍文档类} +\title{\sffamily easybook 书籍文档类} \author { 瞿毅\thanks{quee123@foxmail.com.} \\ \url{https://latexstudio.net} \\ \url{https://gitee.com/texl3/easybook}\thanks{Gitee为项目的主要发布地址。} } -\date{2021/04/09\hskip\ccwd\relax v1.24i} +\date{2021/04/10\hskip\ccwd\relax v1.24j} \frontmatter[roman] \maketitle diff --git a/macros/latex/contrib/easybook/doc/easybook.pdf b/macros/latex/contrib/easybook/doc/easybook.pdf Binary files differindex 0cbbdadb85..3de723b33c 100644 --- a/macros/latex/contrib/easybook/doc/easybook.pdf +++ b/macros/latex/contrib/easybook/doc/easybook.pdf diff --git a/macros/latex/contrib/easybook/easybook.dtx b/macros/latex/contrib/easybook/easybook.dtx index ff3a9f73fb..0eebece9c5 100644 --- a/macros/latex/contrib/easybook/easybook.dtx +++ b/macros/latex/contrib/easybook/easybook.dtx @@ -53,9 +53,9 @@ The latest version of this license is in % \changes{v1.20}{2021/01/09}{模板更改为使用 CC-BY 许可协议。} % \changes{v1.23}{2021/03/19}{修复在 \pkg{ctex} v2.5.6 更新后 \cls{easybook} 与 \pkg{hyperref} 冲突问题。} % -% \title{\sffamily easybook书籍文档类} +% \title{\sffamily easybook 书籍文档类} % \author{瞿毅} -% \date{2021/04/09\hskip\ccwd\relax v1.24i\thanks{\url{https://gitee.com/texl3/easybook}}} +% \date{2021/04/10\hskip\ccwd\relax v1.24j\thanks{\url{https://gitee.com/texl3/easybook}}} % \maketitle % \begin{abstract} % \cls{easybook} 是基于 \cls{ctexbook} 书籍文档类创建以极简为风格的模板,可以看作对 \cls{ctexbook} 的进一步包装。虽然\CTeX 文档类提供了较好的中文支持,但想实现个性化功能一般需要在其基础上载入更多宏包来定制。\cls{easybook} 考虑了一些细节并载入一些常用宏包实现一般的排版需求,它适用于排版中英文书籍或笔记,甚至可稍加调整成为学位论文模板。 @@ -67,7 +67,7 @@ The latest version of this license is in % 编译文档类的一个使用示例文件 \opt{easybook-demo.tex} 前建议满足以下的条件 % \begin{itemize} % \item 使用 \hologo{XeLaTeX}(推荐)或 \hologo{LuaLaTeX} 两种编译方式。 -% \item 由于用到了一些宏包较新的功能,建议安装最新的\TeX 发行版,例如 \TeX Live 2021或 \hologo{MiKTeX} 21.2之后的版本。 +% \item 由于用到了一些\LaTeX 和宏包较新的功能,建议安装最新的\TeX 发行版,例如 \TeX Live 2021或 \hologo{MiKTeX} 21.2之后的版本。 % \end{itemize} % % \subsection{编译步骤} @@ -114,12 +114,14 @@ The latest version of this license is in % \begin{function}[rEXP,added = 2021-01-05]{entitle} % 部分标题编号由中文数字变为大写罗马数字,章标题编号由中文数字变为阿拉伯数字。比如\textbf{第一部分}变为\textbf{第I部分},\textbf{第一章}变为\textbf{第1章}。 % \end{function} +% % \begin{function}[rEXP,added = 2021-01-05,updated = 2021-04-08]{scheme} % \begin{syntax} % scheme = <(chinese)|plain> % \end{syntax} % \opt{scheme} 代表文档的主题,扩展了此选项在\CTeX 文档类中原有的作用范围,\opt{plain} 选项可使各类标题变为英文形式。包括章节标题、图表标题和定理标题等。如\textbf{第一章}变为\textbf{Chapter 1},\textbf{图1.1} 变为 \textbf{Table 1.1}。 % \end{function} +% % \begin{function}[rEXP,added = 2021-01-05]{enstyle} % 同时开启 \opt{newline}、\opt{entitle} 和 \opt{scheme = plain} 三个选项以符合英文原生风格。 % \end{function} @@ -144,7 +146,7 @@ The latest version of this license is in % \begin{syntax} % class = <(book)|article> % \end{syntax} -% 设置文类风格,默认为 \opt{book} 文档类。选用 \opt{article} 使文档编号、结构等与 \cls{article} 文档类的特性相似,可用于短篇幅的文章,不要再使用 \tn{chapter} 命令,此时设置双栏目录的 \opt{style/multoc} 选项、小节 \ref{subsec:document command} 中打印目录命令的 \opt{multoc} 及 \opt{book} 选项均会失效,会以 \opt{section} 标题级别输出目录。 +% 设置文类风格,默认为 \opt{book} 文档类。选用 \opt{article} 会变为 \opt{oneside} 单面排版,同时使文档编号、结构等与标准 \cls{article} 文档类的特性相似,可用于短篇幅的文章,不需要再使用 \tn{chapter} 命令,此时设置双栏目录的 \opt{style/multoc} 选项、小节 \ref{subsec:document command} 中打印目录命令的 \opt{multoc} 及 \opt{book} 选项均会失效,会以 \opt{section} 标题级别输出目录。 % \changes{v1.23}{2021/03/16}{增加 article 文章模式,可用于短篇幅的文章。} % \end{function} % @@ -171,7 +173,7 @@ The latest version of this license is in % \end{syntax} % \opt{multoc} 与 \opt{style/multoc} 选项具有相同的效果,但是具有优先性且可单独设置不同目录是否双栏排版。已经预置了中英文的目录标题,可以使用 \opt{title} 选项更改目录标题的名称。\opt{book} 选项使目录标题按照 \opt{chapter} 级别输出,\opt{article} 选项使目录标题按照 \opt{article} 级别输出,默认为 \opt{chapter} 级别。 % \changes{v1.23}{2021/03/15}{为几个目录增加键值列表的选项,可设置标题输出级别以及是否加入主目录。} -% \changes{v1.24i}{2021/04/04}{目录命令的可选参数增加标题键值。} +% \changes{v1.24j}{2021/04/04}{目录命令的可选参数增加标题键值。} % \end{function} % % \section{接口选项} @@ -259,7 +261,7 @@ The latest version of this license is in % \ding{229} 以上选项路径为 \opt{link/...} \\ % \opt{link} 将超链接选项(包括以上选项)交给 \pkg{hyperref} 处理,除了一些关于 pdf 书签的选项可能会失效,其它由键值选项命令 \tn{hypersetup} 支持的多数选项可用。 % \changes{v1.10}{2021/01/08}{修复了 \opt{linktopage} 选项关闭时目录中标题编号无超链接的问题。} -% \changes{v1.24i}{2021/04/05}{增加 \pkg{hyperref} 超链接选项完整的支持。} +% \changes{v1.24j}{2021/04/05}{增加 \pkg{hyperref} 超链接选项完整的支持。} % \end{function} % % \begin{optdesc} @@ -335,7 +337,7 @@ The latest version of this license is in % \ding{229} 以上选项路径为 \opt{bibset/...} % \changes{v1.21}{2021/01/11}{增加 \opt{bibset} 选项,可以使用 \hologo{BibTeX} 或 \hologo{biber} 编译参考文献。} % \changes{v1.23}{2021/02/23}{使用 \opt{bibset} 选项时可设置标注风格。} -% \changes{v1.24i}{2021/04/09}{可以不载入参考文献包手动配置参考文献格式。} +% \changes{v1.24j}{2021/04/09}{可以不载入参考文献包手动配置参考文献格式。} % \end{function} % % \begin{optdesc} @@ -426,7 +428,7 @@ The latest version of this license is in % \end{ctexexam} % 若要给定理环境增加边框,可以如下进行设置 % \begin{ctexexam} -% \tcolorboxenvironment{定理环境名}{thmsty} +% \tcolorboxenvironment{定理环境名}{tc-theorem} % \end{ctexexam} % 定义一个新的定理样式可用于 \tn{newtheorem} 的 \opt{style} 选项。 % \begin{ctexexam} @@ -449,6 +451,9 @@ The latest version of this license is in % \end{syntax} % \ding{229} 以上选项路径为 \opt{geoset/...} \\ % 预置的页面尺寸与 \cls{Word} 的默认值接近,\opt{geoset} 会将前4个选项以外的其它选项交给 \pkg{geometry} 宏包接口命令 \tn{geometry} 处理,并且选项的键值列表与之相同,上面的选项仅是一小部分,支持的参数可查阅宏包帮助文档。当在此设置页面大小时,会覆盖 \opt{paper} 选项的设置。 +% \changes{v1.21}{2021/01/13}{增加配置页面尺寸的选项。} +% \end{function} +% % \begin{ctexexam} % \geoset % { @@ -459,8 +464,6 @@ The latest version of this license is in % list-labelsep = \hspace{0.5\ccwd} % } % \end{ctexexam} -% \changes{v1.21}{2021/01/13}{增加配置页面尺寸的选项。} -% \end{function} % % \subsection{页眉页脚} % \label{subsec:header and footer} @@ -482,7 +485,7 @@ The latest version of this license is in % \changes{v1.21}{2021/01/13}{增加配置页眉页脚的选项。} % \changes{v1.23}{2021/03/08}{优化页眉页脚设置,增加 \opt{chap-mark} 和 \opt{sec-mark} 标志选项。} % \changes{v1.23}{2021/03/14}{可以手动绘制页眉、页脚和脚注的横线。} -% \changes{v1.24i}{2021/04/09}{增加 \opt{subsec-mark} 标志选项,仅在 \opt{article} 模式生效。} +% \changes{v1.24j}{2021/04/09}{增加 \opt{subsec-mark} 标志选项,仅在 \opt{article} 模式生效。} % \end{function} % % \begin{function}[added = 2021-01-13,updated = 2021-03-14]{\easyhead,\easyfoot} @@ -522,6 +525,25 @@ The latest version of this license is in % \changes{v1.21}{2021/01/13}{增加配置目录样式的选项。} % \end{function} % +% \begin{function}[added = 2021-01-13,updated = 2021-04-06]{\tocrule} +% \begin{syntax} +% \tn{tocrule}*\oarg{引导点间距|(0.7pc)}\parg{引导点大小|(1.2)}\marg{引导点}\oarg{页码格式} +% \end{syntax} +% \tn{tocrule} 命令生成目录引导线,需要在 \opt{rule} 选项中使用。带有星号的命令会使当前级别的目录引导线右边与页码连接而不是对齐。引导点间距需带有长度单位,引导点大小不带单位,为引导点符号正常大小的倍数,引导点一般为英文句号或 \tn{cdot} 中心点符号。页码格式的内容位于页码前面,可以设置页码字体、距离。 +% \end{function} +% +% \begin{ctexexam} +% \tocset +% { +% chapter = +% { +% format = \addvspace{8pt}\large, +% indent = 1.5\ccwd, +% rule = \tocrule[0.6pc](1.1){.}[\zihao{5}] +% } +% } +% \end{ctexexam} +% % \begin{function}[EXP,added = 2021-01-13,updated = 2021-04-06]{lists/lolskip,lists/belowoffset,tocset/tocline-fig,tocset/tocline-tab,tocset/tocline-lst,tocset/belowoffset,tocset/line-align} % \begin{syntax} % lolskip = <(0.8pc)> @@ -533,6 +555,10 @@ The latest version of this license is in % line-align = <(true)|false> % \end{syntax} % \opt{lolskip} 是代码目录中章之间的代码标题的距离,与\CTeX 的表格目录和图片目录中章之间的标题距离选项 \opt{lotskip} 和 \opt{lofskip} 类似,它们的值均默认0.8 pc,在 \opt{article} 模式中此选项失效。目录标签整体使用 \opt{tocline} 设置,也可使用小节 \ref{subsec:page margins} 的 \opt{list-labelsep} 选项只设置编号与标题的间距。在图表标签的参数中,\#1与\#2分别代表编号和标题,代码标签的编号和标题则是 \tn{thelstlisting} 和 \tn{lstcaption},标签中还可包含标签名称,默认标签名称与图、表和代码环境的标题名称一致。下面举个设置标签的例子 +% \changes{v1.24j}{2021/04/05}{可以设置图、表和代码目录的标签。} +% \changes{v1.24j}{2021/04/06}{增加目录引导线右边对齐方式。} +% \end{function} +% % \begin{ctexexam} % \tocset % { @@ -542,27 +568,6 @@ The latest version of this license is in % \end{ctexexam} % % \opt{belowoffset} 选项为主目录标题 \tn{contentsname} 后的间距补偿,一般为负值,用于抵消 \opt{format} 中设置的垂直间距。\opt{lists} 中的 \opt{belowoffset} 与之意义类似,但是一般为正值,可以在 \opt{article} 模式中使用。建议 \opt{lists/lolskip(0.8pc) + lists/format/addvspace(0.2pc) + lists/belowoffset(0pc) = belowoffset(-1pc)}。\opt{line-align} 选项可以使目录引导线右边对齐并与页码保持一定间隙,否则会与页码连接。 -% \changes{v1.24i}{2021/04/05}{可以设置图、表和代码目录的标签。} -% \changes{v1.24i}{2021/04/06}{增加目录引导线右边对齐方式。} -% \end{function} -% -% \begin{function}[added = 2021-01-13,updated = 2021-04-06]{\tocrule} -% \begin{syntax} -% \tn{tocrule}*\oarg{引导点间距|(0.7pc)}\parg{引导点大小|(1.2)}\marg{引导点}\oarg{页码格式} -% \end{syntax} -% \tn{tocrule} 命令生成目录引导线,需要在 \opt{rule} 选项中使用。带有星号的命令会使当前级别的目录引导线右边与页码连接而不是对齐。引导点间距需带有长度单位,引导点大小不带单位,为引导点符号正常大小的倍数,引导点一般为英文句号或 \tn{cdot} 中心点符号。页码格式的内容位于页码前面,可以设置页码字体、距离。 -% \begin{ctexexam} -% \tocset -% { -% chapter = -% { -% format = \addvspace{8pt}\large, -% indent = 1.5\ccwd, -% rule = \tocrule[0.6pc](1.1){.}[\zihao{5}] -% } -% } -% \end{ctexexam} -% \end{function} % % \section{常用环境} % @@ -584,13 +589,14 @@ The latest version of this license is in % \tn{end}\marg{环境名} % \end{syntax} % \pkg{enumitem} 宏包为系统预置的列表环境 \env{enumerate}、\env{itemize}和 \env{description} 提供了更灵活的标签以及间距的控制,可使用 \tn{setlist} 命令设置原有的三种列表格式。已为三种列表预置了三个级别的格式可相互嵌套,默认标签与 \cls{book} 文档类相同,若自定义标签可例如 +% \changes{v1.24j}{2021/04/08}{重新优化列表环境的配置。} +% \end{function} +% % \begin{ctexexam} % \begin{enumerate}[label = \arabic*(a),leftmargin = 1cm,resume] % \begin{itemize}[label = \textbullet] % \begin{description}[font = \sffamily\bfseries,style = nextline] % \end{ctexexam} -% \changes{v1.24i}{2021/04/08}{重新优化列表环境的配置。} -% \end{function} % % \subsubsection{排序列表} % \label{subsec:sort list} @@ -644,14 +650,15 @@ The latest version of this license is in % \tn{end}\marg{exercise} % \end{syntax} % 习题环境 \env{exercise} 的标题紧接上一节编号并加入目录与页眉,当使用星号环境时不进行编号。三个可选参数中颜色为自定义或 \pkg{xcolor} 包含的颜色名称,已载入了 \opt{svgnames} 颜色库。正文编号格式与小节 \ref{subsec:sort list} 排序列表相同,标题名默认为摘要。注意,环境具有相同定界符的可选参数只能\textbf{从右往左}省略,省略的参数使用默认值。 +% \changes{v1.23}{2021/02/08}{增加准确的习题盒子标题目录锚点。} +% \end{function} +% % \begin{ctexexam} % \begin{exercise}[LightYellow][1.](习题) % \item 习题内容 % \item 习题内容 % \end{exercise} % \end{ctexexam} -% \changes{v1.23}{2021/02/08}{增加准确的习题盒子标题目录锚点。} -% \end{function} % % \subsection{盒子} % \label{subsec:box} @@ -665,13 +672,14 @@ The latest version of this license is in % \tn{end}\marg{outline} % \end{syntax} % 摘要盒子可用于章前摘要,它的标题是可选参数,默认标题是摘要。 +% \end{function} +% % \begin{ctexexam} % \begin{outline}(标题名称) % \item 摘要内容 % \item 摘要内容 % \end{outline} % \end{ctexexam} -% \end{function} % % \subsubsection{段落盒子} % \begin{function}[added = 2021-01-05,updated = 2021-03-19]{easybox} @@ -681,6 +689,8 @@ The latest version of this license is in % \tn{end}\marg{easybox} % \end{syntax} % 环境 \opt{easybox} 创建一个段落盒子,可以添加可选参数的标题,否则无标题框。当使用带有星号的环境时 \oarg{颜色名} 选项生效,可以自定义背景颜色,否则无背景颜色。 +% \end{function} +% % \begin{ctexexam} % \begin{easybox}*[MintCream](段落标题) % 盒子内容 @@ -688,7 +698,6 @@ The latest version of this license is in % 盒子内容 % \end{easybox} % \end{ctexexam} -% \end{function} % % \subsubsection{行内盒子} % \begin{function}[added = 2021-03-13]{\concise,\fuzzy} @@ -702,14 +711,14 @@ The latest version of this license is in % \section{其它用法} % % \subsection{代码} -% \begin{function}[added = 2021-01-05]{\lstinline,lstlisting,\listoflistings} +% \begin{function}[added = 2021-01-05]{\lstinline,lstlisting,lstlistlistingname,lstlistingname} % \begin{syntax} % \tn{lstinline}\oarg{键值列表}\marg{行内代码} % \tn{begin}\marg{lstlisting}\oarg{键值列表} % \ <行间代码> % \tn{end}\marg{lstlisting} % \end{syntax} -% 加载 \pkg{listings} 宏包以对代码格式进行高度定制,代码样式可使用 \tn{lstset} 命令设置,\tn{listoflistings} 命令用于输出代码目录。 +% 加载 \pkg{listings} 宏包以对代码格式进行高度定制,代码样式可使用 \tn{lstset} 命令设置。\opt{lstlistlistingname} 和 \opt{lstlistingname} 分别是代码目录名与代码环境标题名,与\CTeX 使用手册中标题汉化一节用法相同,可使用 \tn{ctexset} 直接定义。 % \end{function} % % \subsection{物理量} @@ -721,13 +730,14 @@ The latest version of this license is in % \tn{SIrange}\oarg{键值列表}\marg{数字1}\marg{数字2}\marg{单位} % \end{syntax} % \pkg{siunitx} 宏包的 \tn{num} 命令可以输出科学计数法,\tn{si} 命令支持数学模式,可以代替数学行内公式输入,而 \tn{SI} 命令可用来输出带有单位的量,\tn{SIrange} 可以输出带有范围和单位的量。 +% \end{function} +% % \begin{ctexexam} % \num{-21x.3e5} % \si{mL.min^{-1}} % \SI{5}{\mole} % \SIrange[unit-color = green]{1.5}{4}{kg} % \end{ctexexam} -% \end{function} % % \subsection{化学式} % \begin{function}[added = 2021-01-05]{\ch,\chemfig} @@ -763,10 +773,11 @@ The latest version of this license is in % \tn{Footnotemark}\marg{标记} % \end{syntax} % 自定义标记且不影响正常编号的脚注命令。 +% \end{function} +% % \begin{ctexexam} % \Footnote{*}{这是可以自定义标记的脚注。} % \end{ctexexam} -% \end{function} % % \subsubsection{边注} % \begin{function}[added = 2021-01-05]{\marginnote} @@ -851,7 +862,7 @@ The latest version of this license is in %<*class> \NeedsTeXFormat{LaTeX2e}[2020/10/01] \RequirePackage{l3keys2e} -\ProvidesExplClass{easybook}{2021/04/09}{1.24i}{beta} +\ProvidesExplClass{easybook}{2021/04/10}{1.24j}{beta} \cs_generate_variant:Nn \__ctex_define:nn {nx} \cs_generate_variant:Nn \int_to_arabic:n {v} @@ -909,11 +920,20 @@ The latest version of this license is in \bool_set_false:N \l__eb_page_twoside_bool \__eb_put_ctexbook:n {oneside} }, + twoside .code:n = + { + \bool_set_true:N \l__eb_page_twoside_bool + \__eb_put_ctexbook:n {twoside} + }, class .choice:, class .value_required:n = true, class/book .code:n = {}, - class/article .code:n = \bool_set_false:N \l__eb_class_book_bool, + class/article .code:n = + { + \bool_set_false:N \l__eb_class_book_bool + \keys_set:nn {easybook}{oneside} + }, class .initial:n = book, unknown .code:n = @@ -1190,9 +1210,15 @@ The latest version of this license is in head-foot .tl_set:N = \l__eb_fancyhf_content_tl, head-foot .initial:n = { - \easyhead[EC]{\color{ctex@frame}\kaishu\leftmark} - \easyhead[OC]{\color{ctex@frame}\kaishu\rightmark} - \easyhead[EL,OR]{\color{ctex@frame}\thepage} + \bool_if:NTF \l__eb_page_twoside_bool + { + \easyhead[EC]{\color{ctex@frame}\kaishu\leftmark} + \easyhead[OC]{\color{ctex@frame}\kaishu\rightmark} + \easyhead[EL,OR]{\color{ctex@frame}\thepage} + }{ + \easyhead[L]{\color{ctex@frame}\kaishu\leftmark} + \easyhead[R]{\color{ctex@frame}\thepage} + } }, chap-mark .cs_set:Np = \__eb_fancyhf_chap_mark:n #1, @@ -1248,19 +1274,19 @@ The latest version of this license is in \group_end: } } -\cs_new_protected:Npn \__eb_ifupper_chaptermark_set:n #1 +\cs_new:Npn \__eb_upper_chaptermark_bool:n #1 { \bool_if:NTF \l__eb_uppercase_bool {\text_uppercase:n {\__eb_fancyhf_chap_mark:n {#1}}} {\text_titlecase_first:n {\__eb_fancyhf_chap_mark:n {#1}}} } -\cs_new_protected:Npn \__eb_ifupper_sectionmark_set:n #1 +\cs_new:Npn \__eb_upper_sectionmark_bool:n #1 { \bool_if:NTF \l__eb_uppercase_bool {\text_uppercase:n {\__eb_fancyhf_sec_mark:n {#1}}} {\text_titlecase_first:n {\__eb_fancyhf_sec_mark:n {#1}}} } -\cs_new_protected:Npn \__eb_ifupper_subsectionmark_set:n #1 +\cs_new:Npn \__eb_upper_subsectionmark_bool:n #1 { \bool_if:NTF \l__eb_uppercase_bool {\text_uppercase:n {\__eb_fancyhf_subsec_mark:n {#1}}} @@ -1280,36 +1306,36 @@ The latest version of this license is in \cs_gset:Npn \chaptermark#1 { \markboth - {\__eb_ifupper_chaptermark_set:n {#1}} - {\__eb_ifupper_chaptermark_set:n {#1}} + {\__eb_upper_chaptermark_bool:n {#1}} + {\__eb_upper_chaptermark_bool:n {#1}} } }{ \cs_gset:Npn \chaptermark#1 - {\markboth{\__eb_ifupper_chaptermark_set:n {#1}}{}} + {\markboth{\__eb_upper_chaptermark_bool:n {#1}}{}} } \cs_gset:Npn \sectionmark#1 - {\markright{\__eb_ifupper_sectionmark_set:n {#1}}} + {\markright{\__eb_upper_sectionmark_bool:n {#1}}} }{ \bool_if:NTF \l__eb_page_twoside_bool { \cs_gset:Npn \sectionmark#1 { \markboth - {\__eb_ifupper_sectionmark_set:n {#1}} - {\__eb_ifupper_sectionmark_set:n {#1}} + {\__eb_upper_sectionmark_bool:n {#1}} + {\__eb_upper_sectionmark_bool:n {#1}} } }{ \cs_gset:Npn \sectionmark#1 - {\markboth{\__eb_ifupper_sectionmark_set:n {#1}}{}} + {\markboth{\__eb_upper_sectionmark_bool:n {#1}}{}} } \cs_gset:Npn \subsectionmark#1 - {\markright{\__eb_ifupper_subsectionmark_set:n {#1}}} + {\markright{\__eb_upper_subsectionmark_bool:n {#1}}} } \bool_if:NT \l__eb_draft_bool { \bool_if:NTF \l__eb_page_twoside_bool {\easyfoot[C]{\color{gray!60}\sffamily\today}} - {\easyhead[L]{\color{gray!60}\sffamily\today}} + {\easyhead[C]{\color{gray!60}\sffamily\today}} \geometry{showframe} } } @@ -1444,7 +1470,7 @@ The latest version of this license is in The~\string\chapter\space~command~will~not~be~used. } -\cs_new_protected:Npn \__eb_ifuppercase_set:n #1 +\cs_new_protected:Npn \__eb_uppercase_bool:n #1 { \bool_if:NTF \l__eb_uppercase_bool {\text_uppercase:n {#1}} @@ -1455,9 +1481,9 @@ The latest version of this license is in \bool_if:NTF \l__eb_page_twoside_bool { \markboth - {\__eb_ifuppercase_set:n {#1}} - {\__eb_ifuppercase_set:n {#1}} - }{\markboth{\__eb_ifuppercase_set:n {#1}}{}} + {\__eb_uppercase_bool:n {#1}} + {\__eb_uppercase_bool:n {#1}} + }{\markboth{\__eb_uppercase_bool:n {#1}}{}} } \tl_set:Nn \l__eb_toc_type_tl{book} @@ -1490,7 +1516,19 @@ The latest version of this license is in {\section*{\phantomsection#1}} \eb@markdouble{#1} } -\cs_new_protected:Npn \__eb_ifmultoc_pre_set: +\cs_new_protected:Npn \__eb_class_title_bool:n #1 + { + \bool_if:NTF \l__eb_class_book_bool + { + \chapter*{\phantomsection#1} + \CTEX@addtocline{chapter}{#1} + }{ + \section*{\phantomsection#1} + \CTEX@addtocline{section}{#1} + } + \eb@markdouble{#1} + } +\cs_new_protected:Npn \__eb_multoc_pre_bool: { \bool_if:NTF \l__eb_class_book_bool { @@ -1503,7 +1541,7 @@ The latest version of this license is in \fi }{\tl_set:Nn \l__eb_toc_type_tl{article}} } -\cs_new_protected:Npn \__eb_ifmultoc_post_set: +\cs_new_protected:Npn \__eb_multoc_post_bool: { \bool_if:NTF \l__eb_class_book_bool { @@ -1514,7 +1552,7 @@ The latest version of this license is in \fi }{\tl_set:Nn \l__eb_toc_type_tl{article}} } -\cs_new_protected:Npn \__eb_title_ifintoc_set:n #1 +\cs_new_protected:Npn \__eb_title_intoc_bool:n #1 { \IfBooleanTF{#1} {\__eb_title_mark_notoc:n {\eb@toc@title}} @@ -1525,11 +1563,11 @@ The latest version of this license is in \group_begin: \tl_set_eq:NN \eb@toc@title\contentsname \IfValueT{#1}{\keys_set:nn {listoc}{#1}} - \__eb_ifmultoc_pre_set: + \__eb_multoc_pre_bool: \__eb_title_mark_notoc:n {\eb@toc@title} \vspace*{\dim_use:N \l__eb_toc_offset_dim} \@starttoc{toc} - \__eb_ifmultoc_post_set: + \__eb_multoc_post_bool: \group_end: } \RenewDocumentCommand{\listoffigures}{so} @@ -1537,12 +1575,12 @@ The latest version of this license is in \group_begin: \tl_set_eq:NN \eb@toc@title\listfigurename \IfValueT{#2}{\keys_set:nn {listoc}{#2}} - \__eb_ifmultoc_pre_set: - \__eb_title_ifintoc_set:n {#1} + \__eb_multoc_pre_bool: + \__eb_title_intoc_bool:n {#1} \dim_add:NV \l__eb_toc_offset_dim\l__eb_toc_listsoffset_dim \vspace*{\dim_use:N \l__eb_toc_offset_dim} \@starttoc{lof} - \__eb_ifmultoc_post_set: + \__eb_multoc_post_bool: \group_end: } \RenewDocumentCommand{\listoftables}{so} @@ -1550,12 +1588,12 @@ The latest version of this license is in \group_begin: \tl_set_eq:NN \eb@toc@title\listtablename \IfValueT{#2}{\keys_set:nn {listoc}{#2}} - \__eb_ifmultoc_pre_set: - \__eb_title_ifintoc_set:n {#1} + \__eb_multoc_pre_bool: + \__eb_title_intoc_bool:n {#1} \dim_add:NV \l__eb_toc_offset_dim\l__eb_toc_listsoffset_dim \vspace*{\dim_use:N \l__eb_toc_offset_dim} \@starttoc{lot} - \__eb_ifmultoc_post_set: + \__eb_multoc_post_bool: \group_end: } \NewDocumentCommand{\listoflistings}{so} @@ -1563,12 +1601,12 @@ The latest version of this license is in \group_begin: \tl_set_eq:NN \eb@toc@title\lstlistlistingname \IfValueT{#2}{\keys_set:nn {listoc}{#2}} - \__eb_ifmultoc_pre_set: - \__eb_title_ifintoc_set:n {#1} + \__eb_multoc_pre_bool: + \__eb_title_intoc_bool:n {#1} \dim_add:NV \l__eb_toc_offset_dim\l__eb_toc_listsoffset_dim \vspace*{\dim_use:N \l__eb_toc_offset_dim} \@starttoc{lol} - \__eb_ifmultoc_post_set: + \__eb_multoc_post_bool: \group_end: } @@ -1945,14 +1983,14 @@ The latest version of this license is in \cs_gset:Npn \tagform@#1 {\maketag@@@{\color{ctex@emph}(\ignorespaces#1\unskip\@@italiccorr)}} \ctex_at_end_package:nn {unicode-math} - {\unimathsetup{warnings-off = {mathtools-overbracket,mathtools-colon}}} + {\msg_redirect_module:nnn {unicode-math}{warning}{none}} \ctex_at_end_package:nn {tcolorbox} { \__eb_ifpackage_later:nn {tcolorbox}{2020/10/09} \tcbset { - thmsty/.style = + tc-theorem/.style = { enhanced~jigsaw,pad~at~break* = 3pt, opacityback = 0, @@ -1960,7 +1998,7 @@ The latest version of this license is in left = .2pc,right = .2pc,top = .5pc,bottom = .5pc,middle= .5pc, arc = 0pt }, - outlinesty/.style = + tc-outline/.style = { enhanced,nofloat, tikznode~boxed~title, @@ -1974,7 +2012,7 @@ The latest version of this license is in left = 1.5pc,right = 1.5pc,top = 1pc,bottom = 0.5pc, boxsep = 5pt }, - exersty/.style = + tc-exercise/.style = { enhanced,on~line, arc = 5pt, @@ -1988,7 +2026,7 @@ The latest version of this license is in } \NewDocumentEnvironment{outline}{D(){\abstractname}o+b} { - \begin{tcolorbox}[outlinesty,title = #1,IfValueT = {#2}{#2}] + \begin{tcolorbox}[tc-outline,title = #1,IfValueT = {#2}{#2}] \begin{outlinelist} #3 \end{outlinelist} @@ -2001,7 +2039,7 @@ The latest version of this license is in \bool_if:NTF \l__eb_thmbox_bool { \tcbox[ - exersty, + tc-exercise, colback = #2,colframe = black, drop~fuzzy~shadow = #2, IfValueT = {#5}{#5}, @@ -2063,12 +2101,12 @@ The latest version of this license is in { \@ifpackageloaded{tcolorbox} { - \tcolorboxenvironment{theorem}{thmsty} - \tcolorboxenvironment{definition}{thmsty} - \tcolorboxenvironment{lemma}{thmsty} - \tcolorboxenvironment{corollary}{thmsty} - \tcolorboxenvironment{proposition}{thmsty} - \tcolorboxenvironment{example}{thmsty} + \tcolorboxenvironment{theorem}{tc-theorem} + \tcolorboxenvironment{definition}{tc-theorem} + \tcolorboxenvironment{lemma}{tc-theorem} + \tcolorboxenvironment{corollary}{tc-theorem} + \tcolorboxenvironment{proposition}{tc-theorem} + \tcolorboxenvironment{example}{tc-theorem} }{} } } @@ -2133,10 +2171,10 @@ The latest version of this license is in \group_begin: \tl_set_eq:NN \eb@toc@title\bibname \IfValueT{##2}{\keys_set:nn {listoc}{##2}} - \__eb_ifmultoc_pre_set: - \cs_set:Npn \bibsection{\__eb_title_ifintoc_set:n {##1}} + \__eb_multoc_pre_bool: + \cs_set:Npn \bibsection{\__eb_title_intoc_bool:n {##1}} \exp_args:NV \bibliography\l__eb_bib_file_tl - \__eb_ifmultoc_post_set: + \__eb_multoc_post_bool: \group_end: } } @@ -2159,7 +2197,7 @@ The latest version of this license is in { \exp_args:NV \addbibresource\l__eb_bib_file_tl \cs_gset:Npn \blx@default@theheading{bibintoc} - \defbibheading{bibintoc}[\bibname]{\__eb_title_mark_intoc:n {##1}} + \defbibheading{bibintoc}[\bibname]{\__eb_class_title_bool:n {##1}} \skip_set:Nn \bibitemsep{0ex} } \__eb_at_end_preamble:n @@ -2344,7 +2382,8 @@ The latest version of this license is in linkcolor .initial:n = fresh, linktoc .choice:, - linktoc/unknown .code:n = \__eb_put_hyperref:n {linktoc = \exp_not:n {#1}}, + linktoc/unknown .code:n = + {\__eb_put_hyperref:n {linktoc = \exp_not:n {#1}}}, linktoc .default:n = all, linktoc .initial:n = all, unknown .code:n = diff --git a/macros/latex/contrib/profcollege/doc/ProfCollege-doc.pdf b/macros/latex/contrib/profcollege/doc/ProfCollege-doc.pdf Binary files differindex 5c4ff2d70d..73055fdf99 100644 --- a/macros/latex/contrib/profcollege/doc/ProfCollege-doc.pdf +++ b/macros/latex/contrib/profcollege/doc/ProfCollege-doc.pdf diff --git a/macros/latex/contrib/profcollege/latex/ProfCollege.sty b/macros/latex/contrib/profcollege/latex/ProfCollege.sty index c370712314..8233385380 100644 --- a/macros/latex/contrib/profcollege/latex/ProfCollege.sty +++ b/macros/latex/contrib/profcollege/latex/ProfCollege.sty @@ -3,7 +3,7 @@ % or later, see http://www.latex-project.org/lppl.txtf \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{ProfCollege}[2021/04/01 v0.98 Aide pour l'utilisation de LaTeX au collège] +\ProvidesPackage{ProfCollege}[2021/04/09 v0.99 Aide pour l'utilisation de LaTeX au collège] \RequirePackage{verbatim} @@ -504,20 +504,20 @@ \xdef\LabyLong{\useKV[Labyrinthe]{Longueur}}% \xdef\LabyHaut{\useKV[Labyrinthe]{Hauteur}}% \ifboolKV[Labyrinthe]{SensImpose}{% - \xdef\TotalLaby{\fpeval{3*\useKV[Labyrinthe]{Colonnes}+1}}% + \xdef\TotalLaby{\fpeval{4*(\useKV[Labyrinthe]{Colonnes}-1)+1}}% }{% \xdef\TotalLaby{\fpeval{3*\useKV[Labyrinthe]{Colonnes}-2}}% }% \xdef\CouleurF{\useKV[Labyrinthe]{CouleurF}}% \xdef\MotifTexte{\useKV[Labyrinthe]{Texte}}% \xintifboolexpr{\ListeLabylen=\fpeval{\useKV[Labyrinthe]{Lignes}*\useKV[Labyrinthe]{Colonnes}}}{% - \begin{tikzpicture}[remember picture]%,FDeplacement] + \begin{tikzpicture}[remember picture]% % on dessine les cadres \foreach \compteurv in {1,...,\useKV[Labyrinthe]{Lignes}}{% \foreach \compteurh in {1,...,\useKV[Labyrinthe]{Colonnes}}{% \xdef\ColorFill{\ListeLaby[\fpeval{\useKV[Labyrinthe]{Colonnes}*(\compteurv-1)+\compteurh},2]}% \node[fill=\ColorFill,draw,minimum height=\LabyHaut*1cm,minimum width=\LabyLong*1cm,name=A-\compteurh-\compteurv] at - (\fpeval{\LabyLong+\useKV[Labyrinthe]{EcartH}}*\compteurh,-\fpeval{\LabyHaut+\useKV[Labyrinthe]{EcartV}}*\compteurv) {\ListeLaby[\fpeval{\useKV[Labyrinthe]{Colonnes}*(\compteurv-1)+\compteurh},1]};%\begin{minipage}{\LongLaby}\end{minipage} + (\fpeval{\LabyLong+\useKV[Labyrinthe]{EcartH}}*\compteurh,-\fpeval{\LabyHaut+\useKV[Labyrinthe]{EcartV}}*\compteurv) {\ListeLaby[\fpeval{\useKV[Labyrinthe]{Colonnes}*(\compteurv-1)+\compteurh},1]};% }% }% % fin des cadres @@ -527,14 +527,11 @@ \foreach \compteurv in {1,...,\fpeval{\useKV[Labyrinthe]{Lignes}-1}}{% \foreach \compteurh in {1,...,\useKV[Labyrinthe]{Colonnes}}{% \ifboolKV[Labyrinthe]{Passages}{% - \xdef\NomNode{\ListeLabySol[\fpeval{\TotalLaby*(\compteurv-1)+\useKV[Labyrinthe]{Colonnes}+3*(\compteurh-1)},1]}% + \xdef\NomNode{\noexpand\ListeLabySol[\fpeval{\TotalLaby*(\compteurv-1)+\useKV[Labyrinthe]{Colonnes}+3*(\compteurh-1)},1]}% \xintifboolexpr{\ListeLabySol[\fpeval{\TotalLaby*(\compteurv-1)+\useKV[Labyrinthe]{Colonnes}+3*(\compteurh-1)},2]>0}{\xintifboolexpr{\ListeLabySol[\fpeval{\TotalLaby*(\compteurv-1)+\useKV[Labyrinthe]{Colonnes}+3*(\compteurh-1)},2]=1}{\xdef\NomStyle{FDirect}}{\xintifboolexpr{\ListeLabySol[\fpeval{\TotalLaby*(\compteurv-1)+\useKV[Labyrinthe]{Colonnes}+3*(\compteurh-1)},2]=2}{\xdef\NomStyle{FIndirect}}{\xdef\NomStyle{FBidirect}}}% - \draw[\CouleurF,line width=3pt,\NomStyle] (A-\compteurh-\compteurv) -- node[fill=white,midway,inner sep=2pt]{\MotifTexte\NomNode}(A-\compteurh-\fpeval{\compteurv+1});% - }{}% + \draw[\CouleurF,line width=3pt,\NomStyle] (A-\compteurh-\compteurv) -- node[fill=white,midway,inner sep=2pt]{\MotifTexte\NomNode}(A-\compteurh-\fpeval{\compteurv+1});}{}% }{% - \xdef\NomNode{\ListeLabySol[\fpeval{\TotalLaby*(\compteurv-1)+\useKV[Labyrinthe]{Colonnes}+3*(\compteurh-1)},1]}% - \xintifboolexpr{\ListeLabySol[\fpeval{\TotalLaby*(\compteurv-1)+\useKV[Labyrinthe]{Colonnes}+3*(\compteurh-1)},2]>0}{\xintifboolexpr{\ListeLabySol[\fpeval{\TotalLaby*(\compteurv-1)+\useKV[Labyrinthe]{Colonnes}+3*(\compteurh-1)},2]=1}{\xdef\NomStyle{FDirect}}{\xintifboolexpr{\ListeLabySol[\fpeval{\TotalLaby*(\compteurv-1)+\useKV[Labyrinthe]{Colonnes}+3*(\compteurh-1)},2]=2}{\xdef\NomStyle{FIndirect}}{\xdef\NomStyle{FBidirect}}}% - \draw[\CouleurF,line width=3pt,\NomStyle] (A-\compteurh-\compteurv) -- (A-\compteurh-\fpeval{\compteurv+1});}{}% + \draw[\CouleurF,line width=3pt,FBidirect] (A-\compteurh-\compteurv) -- (A-\compteurh-\fpeval{\compteurv+1});% }% }% }% @@ -542,46 +539,39 @@ \foreach \compteurv in {1,...,\useKV[Labyrinthe]{Lignes}}{% \foreach \compteurh in {1,...,\fpeval{\useKV[Labyrinthe]{Colonnes}-1}}{% \ifboolKV[Labyrinthe]{Passages}{% - \xdef\NomNode{\ListeLabySol[\fpeval{\TotalLaby*(\compteurv-1)+\compteurh},1]}% + \xdef\NomNode{\noexpand\ListeLabySol[\fpeval{\TotalLaby*(\compteurv-1)+\compteurh},1]}% \xintifboolexpr{\ListeLabySol[\fpeval{\TotalLaby*(\compteurv-1)+\compteurh},2]>0}{\xintifboolexpr{\ListeLabySol[\fpeval{\TotalLaby*(\compteurv-1)+\compteurh},2]=1}{\xdef\NomStyle{FDirect}}{\xintifboolexpr{\ListeLabySol[\fpeval{\TotalLaby*(\compteurv-1)+\compteurh},2]=2}{\xdef\NomStyle{FIndirect}}{\xdef\NomStyle{FBidirect}}}% - \draw[\CouleurF,line width=3pt,\NomStyle] - (A-\compteurh-\compteurv) -- node[fill=white,midway,\LabySlop,inner sep=2pt]{\MotifTexte\NomNode}(A-\fpeval{\compteurh+1}-\compteurv);}{} + \draw[\CouleurF,line width=3pt,\NomStyle](A-\compteurh-\compteurv) -- node[fill=white,midway,\LabySlop,inner sep=2pt]{\MotifTexte\NomNode}(A-\fpeval{\compteurh+1}-\compteurv);}{} }{% - \xintifboolexpr{\ListeLabySol[\fpeval{\TotalLaby*(\compteurv-1)+\compteurh},2]>0}{\xintifboolexpr{\ListeLabySol[\fpeval{\TotalLaby*(\compteurv-1)+\compteurh},2]=1}{\xdef\NomStyle{FDirect}}{\xintifboolexpr{\ListeLabySol[\fpeval{\TotalLaby*(\compteurv-1)+\compteurh},2]=2}{\xdef\NomStyle{FIndirect}}{\xdef\NomStyle{FBidirect}}}% - \draw[\CouleurF,line width=3pt,\NomStyle] - (A-\compteurh-\compteurv) -- (A-\fpeval{\compteurh+1}-\compteurv);}{} + \draw[\CouleurF,line width=3pt,FBidirect](A-\compteurh-\compteurv) -- (A-\fpeval{\compteurh+1}-\compteurv);% }% }% }% - % diagonales "inverses" +% % diagonales "inverses" \foreach \compteurv in {2,...,\fpeval{\useKV[Labyrinthe]{Lignes}}}{% \foreach \compteurh in {1,...,\fpeval{\useKV[Labyrinthe]{Colonnes}-1}}{% \ifboolKV[Labyrinthe]{Passages}{% - \xdef\NomNode{\ListeLabySol[\fpeval{\TotalLaby*(\compteurv-2)+\useKV[Labyrinthe]{Colonnes}+3*(\compteurh-1)+2},1]}% + \xdef\NomNode{\noexpand\ListeLabySol[\fpeval{\TotalLaby*(\compteurv-2)+\useKV[Labyrinthe]{Colonnes}+3*(\compteurh-1)+2},1]}% \xintifboolexpr{\ListeLabySol[\fpeval{\TotalLaby*(\compteurv-2)+\useKV[Labyrinthe]{Colonnes}+3*(\compteurh-1)+2},2]>0}{\xintifboolexpr{\ListeLabySol[\fpeval{\TotalLaby*(\compteurv-2)+\useKV[Labyrinthe]{Colonnes}+3*(\compteurh-1)+2},2]=1}{\xdef\NomStyle{FDirect}}{\xintifboolexpr{\ListeLabySol[\fpeval{\TotalLaby*(\compteurv-2)+\useKV[Labyrinthe]{Colonnes}+3*(\compteurh-1)+2},2]=2}{\xdef\NomStyle{FIndirect}}{\xdef\NomStyle{FBidirect}}}% \draw[\CouleurF,line width=3pt,\NomStyle] (A-\compteurh-\compteurv) -- node[fill=white,near start,\LabySlop,inner sep=2pt]{\MotifTexte\NomNode}(A-\fpeval{\compteurh+1}-\fpeval{\compteurv-1}); }{} }{% - \xintifboolexpr{\ListeLabySol[\fpeval{\TotalLaby*(\compteurv-2)+\useKV[Labyrinthe]{Colonnes}+3*(\compteurh-1)+2},2]>0}{\xintifboolexpr{\ListeLabySol[\fpeval{\TotalLaby*(\compteurv-2)+\useKV[Labyrinthe]{Colonnes}+3*(\compteurh-1)+2},2]=1}{\xdef\NomStyle{FDirect}}{\xintifboolexpr{\ListeLabySol[\fpeval{\TotalLaby*(\compteurv-2)+\useKV[Labyrinthe]{Colonnes}+3*(\compteurh-1)+2},2]=2}{\xdef\NomStyle{FIndirect}}{\xdef\NomStyle{FBidirect}}}% - \draw[\CouleurF,line width=3pt,\NomStyle] (A-\compteurh-\compteurv) -- (A-\fpeval{\compteurh+1}-\fpeval{\compteurv-1}); - }{} + \draw[\CouleurF,line width=3pt,FBidirect] (A-\compteurh-\compteurv) -- (A-\fpeval{\compteurh+1}-\fpeval{\compteurv-1}); }% }% }% - % diagonales directes +% % diagonales directes \foreach \compteurv in {1,...,\fpeval{\useKV[Labyrinthe]{Lignes}-1}}{% \foreach \compteurh in {1,...,\fpeval{\useKV[Labyrinthe]{Colonnes}-1}}{% \ifboolKV[Labyrinthe]{Passages}{% - \xdef\NomNode{\ListeLabySol[\fpeval{\TotalLaby*(\compteurv-1)+\useKV[Labyrinthe]{Colonnes}+3*(\compteurh-1)+1},1]}% + \xdef\NomNode{\noexpand\ListeLabySol[\fpeval{\TotalLaby*(\compteurv-1)+\useKV[Labyrinthe]{Colonnes}+3*(\compteurh-1)+1},1]}% \xintifboolexpr{\ListeLabySol[\fpeval{\TotalLaby*(\compteurv-1)+\useKV[Labyrinthe]{Colonnes}+3*(\compteurh-1)+1},2]>0}{% \xintifboolexpr{\ListeLabySol[\fpeval{\TotalLaby*(\compteurv-1)+\useKV[Labyrinthe]{Colonnes}+3*(\compteurh-1)+1},2]=1}{\xdef\NomStyle{FDirect}}{\xintifboolexpr{\ListeLabySol[\fpeval{\TotalLaby*(\compteurv-1)+\useKV[Labyrinthe]{Colonnes}+3*(\compteurh-1)+1},2]=2}{\xdef\NomStyle{FIndirect}}{\xdef\NomStyle{FBidirect}}} \draw[\CouleurF,line width=3pt,\NomStyle] (A-\compteurh-\compteurv) -- node[fill=white,near start,\LabySlop,inner sep=2pt]{\MotifTexte\NomNode}(A-\fpeval{\compteurh+1}-\fpeval{\compteurv+1}); }{}% }{% - \xintifboolexpr{\ListeLabySol[\fpeval{\TotalLaby*(\compteurv-1)+\useKV[Labyrinthe]{Colonnes}+3*(\compteurh-1)+1},2]>0}{% - \xintifboolexpr{\ListeLabySol[\fpeval{\TotalLaby*(\compteurv-1)+\useKV[Labyrinthe]{Colonnes}+3*(\compteurh-1)+1},2]=1}{\xdef\NomStyle{FDirect}}{\xintifboolexpr{\ListeLabySol[\fpeval{\TotalLaby*(\compteurv-1)+\useKV[Labyrinthe]{Colonnes}+3*(\compteurh-1)+1},2]=2}{\xdef\NomStyle{FIndirect}}{\xdef\NomStyle{FBidirect}}} - \draw[\CouleurF,line width=3pt,\NomStyle] (A-\compteurh-\compteurv) -- node[fill=white,near start,\LabySlop]{\MotifTexte\NomNode}(A-\fpeval{\compteurh+1}-\fpeval{\compteurv+1}); - }{}% + \draw[\CouleurF,line width=3pt,FBidirect] (A-\compteurh-\compteurv) -- node[fill=white,near start,\LabySlop]{\MotifTexte\NomNode}(A-\fpeval{\compteurh+1}-\fpeval{\compteurv+1}); +% }{}% }% }% }% @@ -589,7 +579,7 @@ \foreach \compteurv in {1,...,\fpeval{\useKV[Labyrinthe]{Lignes}-1}}{% \foreach \compteurh in {1,...,\useKV[Labyrinthe]{Colonnes}}{% \ifboolKV[Labyrinthe]{Passages}{% - \xdef\NomNode{\ListeLabySol[1,\fpeval{\TotalLaby*(\compteurv-1)+\useKV[Labyrinthe]{Colonnes}+2*(\compteurh-1)}]}% + \xdef\NomNode{\noexpand\ListeLabySol[1,\fpeval{\TotalLaby*(\compteurv-1)+\useKV[Labyrinthe]{Colonnes}+2*(\compteurh-1)}]}% \draw[\CouleurF,line width=3pt,stealth-stealth] (A-\compteurh-\compteurv) -- node[fill=white,midway]{\MotifTexte\NomNode}(A-\compteurh-\fpeval{\compteurv+1});% }{% \draw[\CouleurF,line width=3pt,stealth-stealth] (A-\compteurh-\compteurv) -- (A-\compteurh-\fpeval{\compteurv+1});% @@ -623,8 +613,8 @@ }% }% }% - } - %fin des flèches + % fin des flèches + } \end{tikzpicture} }{\textbf{! Le nombre d'informations n'est pas compatible avec les définitions de {\ttfamily Colonnes} et {\ttfamily Lignes} !}}% @@ -9236,7 +9226,8 @@ Unite={},Largeur=1cm,Precision=2,Donnee=Valeurs,Effectif=Effectif,Origine=0,Angl \setKV[ClesFonction]{#1} \ifboolKV[ClesFonction]{Points}{% \toklistePtsFn{}% - \setsepchar[*]{,*/}%\ignoreemptyitems% + % \setsepchar[*]{,*/}%\ignoreemptyitems% + \setsepchar[*]{§*/}%\ignoreemptyitems% \readlist*\ListePoints{#2}% \ifboolKV[ClesFonction]{Tangentes}{% \foreachitem\compteur\in\ListePoints{% @@ -13835,4 +13826,49 @@ Unite={},Largeur=1cm,Precision=2,Donnee=Valeurs,Effectif=Effectif,Origine=0,Angl }% }% }% -}%
\ No newline at end of file +}% + +%%%% +% Scratch +%%%% +\newlength{\longbarreheight} +\setlength{\longbarreheight}{2.1ex+3pt} + +\newlength{\longbarredepth} +\setlength{\longbarredepth}{0.9ex+3pt} +\def\longbarre{\vrule height\longbarreheight depth\longbarredepth width0pt}% + +\def\barre{\vrule height2.1ex depth.9ex width0pt}% +\def\demibarre{\vrule height1.4ex depth.6ex width0pt}% + +\setKVdefault[Scratch]{Impression=false,Numerotation=false,Echelle=1} + +\ifluatex +\NewEnviron{Scratch}[1][]{% + \useKVdefault[Scratch]% + \setKV[Scratch]{#1}% + \mplibforcehmode% + \myfontScratch% + \begin{mplibcode}% + input PfC-Scratch;% + print:=\useKV[Scratch]{Impression};% + NumeroteLignes:=\useKV[Scratch]{Numerotation};% + \BODY + picture recap;% + recap:=currentpicture scaled \useKV[Scratch]{Echelle};% + currentpicture:=nullpicture; + draw recap; + \end{mplibcode} +}% +\else +\NewEnviron{Scratch}[1][]{% + \setKV[Scratch]{#1}% + \begin{mpost}[mpsettings={input PfC-Scratch-pdf;print:=\useKV[Scratch]{Impression};NumeroteLignes:=\useKV[Scratch]{Numerotation};Echelle:=\useKV[Scratch]{Echelle};}]% + \BODY + picture recap;% + recap:=currentpicture scaled Echelle;% + currentpicture:=nullpicture; + draw recap; + \end{mpost} +}% +\fi
\ No newline at end of file diff --git a/macros/latex/contrib/profcollege/metapost/PfC-Calculatriceold.mp b/macros/latex/contrib/profcollege/metapost/PfC-Calculatriceold.mp new file mode 100644 index 0000000000..0140e24b4d --- /dev/null +++ b/macros/latex/contrib/profcollege/metapost/PfC-Calculatriceold.mp @@ -0,0 +1,195 @@ +prologues:=3; + +path carre[]; + +u:=0.5mm; + +vardef BlocAffichage= + for k=0 upto 34: + carre[k]:=(unitsquare scaled u) shifted(u*(k mod 5,5-(k div 5))); + endfor; +enddef; + +vardef Affichage(expr decomp)= + save $; + picture $; + drawoptions(withpen pensquare scaled0.1); + $=image(% + for k=0 upto 34: + if (substring(k,k+1) of decomp)="1": + fill carre[k]; + fi; + endfor; + ); + drawoptions(); + $ +enddef; + +nblignes:=0; + +boolean print; +print:=false; + +color CouleurEcran; +CouleurEcran=(107/255,148/255,107/255); + +boolean Math; +Math=true; + +decahoriz:=0; + +vardef Test(expr cptk,cptnt)= + pair decalage; + if nblignes mod 2=0: + decalage:=u*((20-length(cptnt)+cptk)*6,-8*(nblignes-1)); + else: + decalage:=u*(decahoriz,-8*(nblignes-1)); + decahoriz:=decahoriz+6; + fi; + if substring(cptk,cptk+1) of cptnt="A":draw Affichage("01110100011000110001111111000110001") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="B":draw Affichage("11110100011000111110100011000111110") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="C":draw Affichage("01110100011000010000100001000101110") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="D":draw Affichage("11100100101000110001100011001011100") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="E":draw Affichage("11111100001000011111100001000011111") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="F":draw Affichage("11111100001000011111100001000010000") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="G":draw Affichage("01110100011000010111100011000101110") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="H":draw Affichage("10001100011000111111100011000110001") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="I":draw Affichage("01110001000010000100001000010001110") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="J":draw Affichage("00111000100001000010000101001001100") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="K":draw Affichage("10001100101010011000101001001010001") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="L":draw Affichage("10000100001000010000100001000011111") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="M":draw Affichage("10001110111010110101100011000110001") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="N":draw Affichage("10001100011100110101100111000110001") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="O":draw Affichage("01110100011000110001100011000101110") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="P":draw Affichage("11110100011000111110100001000010000") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="Q":draw Affichage("01110100011000110001101011001001101") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="R":draw Affichage("11110100011000111110101001001010001") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="S":draw Affichage("01111100001000001110000010000111110") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="T":draw Affichage("11111001000010000100001000010000100") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="U":draw Affichage("10001100011000110001100011000101110") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="V":draw Affichage("10001100011000110001100010101000100") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="W":draw Affichage("10101101011010110101101011010101010") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="X":draw Affichage("10001100010101000100010101000110001") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="Y":draw Affichage("10001100011000101010001000010000100") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="Z":draw Affichage("11111000010001000100010001000011111") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="a":draw Affichage("00000000000111100001011111000101111") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="b":draw Affichage("10000100001011011001100011000111110") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="c":draw Affichage("00000000000111010000100001000101110") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="d":draw Affichage("00001000010110110011100011000101111") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="e":if Math: + draw Affichage("00000000000000000001101000100010100") shifted(decalage); + decalage:=u*(decahoriz-1,-8*(nblignes-1)); + draw Affichage("00000000001001010101101011010110010") shifted(decalage); + decahoriz:=decahoriz+6; + else: + draw Affichage("00000000000111010001111111000001110") shifted(decalage); + fi; + elseif substring(cptk,cptk+1) of cptnt="@":draw Affichage("00010001000111010001111111000001110") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="f":draw Affichage("00110010010100011100010000100001000") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="g":draw Affichage("00000011111000110001011110000101110") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="h":draw Affichage("10000100001011011001100011000110001") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="i":draw Affichage("00100000000110000100001000010001110") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="j":if Math=true: + draw Affichage("00011000011110100001000000000000000") shifted(decalage); + else: + draw Affichage("00010000000011000010000101001001100") shifted(decalage); + fi; + elseif substring(cptk,cptk+1) of cptnt="k":if Math=true: + draw Affichage("11100001000100011100000000000000000") shifted(decalage); + else: + draw Affichage("10000100001001010100110001010010010") shifted(decalage); + fi; + elseif substring(cptk,cptk+1) of cptnt="l":if Math=true: + draw Affichage("11100010000010011100000000000000000") shifted(decalage); + else: + draw Affichage("01100001000010000100001000010001110") shifted(decalage); + fi; + elseif substring(cptk,cptk+1) of cptnt="m":draw Affichage("00000000001101010101101011000110001") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="n":draw Affichage("00000000001011011001100011000110001") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="o":draw Affichage("00000000000111010001100011000101110") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="p":draw Affichage("00000000001111010001111101000010000") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="q":if Math=true: + draw Affichage("00000000001111101010010100101010001") shifted(decalage); + else: + draw Affichage("00000000000110110011011110000100001") shifted(decalage); + fi; + elseif substring(cptk,cptk+1) of cptnt="r":draw Affichage("00000000001011011001100001000010000") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="s":draw Affichage("00000000000111010000011100000111110") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="t":draw Affichage("01000010001110001000010000100100110") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="u":draw Affichage("00000000001000110001100011001101101") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="v":if Math=true: + draw Affichage("00111001000010000100101000110000100") shifted(decalage); + else: + draw Affichage("00000000001000110001100010111000100") shifted(decalage); + fi; + elseif substring(cptk,cptk+1) of cptnt="w":draw Affichage("00000000001010110101101011010101110") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="x":draw Affichage("00000000001000101010001000101010001") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="y":draw Affichage("00000000001000110001011110000101110") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="z":draw Affichage("00000000001111100010001000100011111") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="0":draw Affichage("01110100011001110101110011000101110") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="1":draw Affichage("00100011000010000100001000010001110") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="2":draw Affichage("01110100010000100010001000100011111") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="3":draw Affichage("11111000100010000010000011000101110") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="4":draw Affichage("00010001100101010010111110001000010") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="5":draw Affichage("11111100001111000001000011000101110") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="6":draw Affichage("00110010001000011110100011000101110") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="7":draw Affichage("11111000010001000100010000100001000") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="8":draw Affichage("01110100011000101110100011000101110") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="9":draw Affichage("01110100011000101111000010001001100") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="!":draw Affichage("00100001000010000100000000000000100") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="'":draw Affichage("01100001000100000000000000000000000") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="(":draw Affichage("00010001000100001000010000010000010") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt=")":draw Affichage("01000001000001000010000100010001000") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="*":draw Affichage("00000001001010101110101010010000000") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="+":draw Affichage("00000001000010011111001000010000000") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt=",":draw Affichage("00000000000000000000011000010001000") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="-":draw Affichage("00000000000000011111000000000000000") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt=".":draw Affichage("00000000000000000000000000110001100") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="/":draw Affichage("00000000010001000100010001000000000") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt=":":if Math=true: + draw Affichage("00000000000000000000000000000000000") shifted(decalage); + else: + draw Affichage("00000011000110000000011000110000000") shifted(decalage); + fi; + elseif substring(cptk,cptk+1) of cptnt=";":if Math=true: + draw Affichage("00000001000000011111000000010000000") shifted(decalage); + else: + draw Affichage("00000011000110000000011000010001000") shifted(decalage); + fi; + elseif substring(cptk,cptk+1) of cptnt="<":draw Affichage("00010001000100010000010000010000010") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="=":draw Affichage("00000000001111100000111110000000000") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt=">":draw Affichage("10000010000010000010001000100010000") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="?":draw Affichage("01110100010000100010001000000000100") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="[":draw Affichage("01110010000100001000010000100001110") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="]":draw Affichage("01110000100001000010000100001001110") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="`":draw Affichage("01000001000001000000000000000000000") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="|":draw Affichage("00100001000010000100001000010000100") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt=" ":draw Affichage("00000100010101000100010101000100000") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="&":draw Affichage("00000100001100011100110001000000000") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="$":draw Affichage("00000000000000100001000010000111111") shifted(decalage); + elseif substring(cptk,cptk+1) of cptnt="^":draw Affichage("00100010101000100000000000000000000") shifted(decalage); + fi; +enddef; + +vardef LCD(text nt)(text rep)= + decahoriz:=0; + nblignes:=nblignes+1; + path Ecran; + Ecran:=(u*(0,-1)--u*(120,-1)--u*(120,7)--u*(0,7)--cycle) shifted(u*(0,-8*(nblignes-1))); + fill Ecran withcolor if print=true:0.8white else:CouleurEcran fi; + draw Ecran withcolor if print=true:0.8white else:CouleurEcran fi; + for k=0 upto length(nt)-1: + BlocAffichage; + Test(k,nt); + endfor; + nblignes:=nblignes+1; + Ecran:=(u*(0,-1)--u*(120,-1)--u*(120,7)--u*(0,7)--cycle) shifted(u*(0,-8*(nblignes-1))); + fill Ecran withcolor if print=true:0.8white else:CouleurEcran fi; + draw Ecran withcolor if print=true:0.8white else:CouleurEcran fi; + for k=0 upto length(rep)-1: + BlocAffichage; + Test(k,rep); + endfor; +enddef; + +endinput; diff --git a/macros/latex/contrib/profcollege/metapost/PfC-Scratch-pdf.mp b/macros/latex/contrib/profcollege/metapost/PfC-Scratch-pdf.mp new file mode 100644 index 0000000000..f3800b3d99 --- /dev/null +++ b/macros/latex/contrib/profcollege/metapost/PfC-Scratch-pdf.mp @@ -0,0 +1,3378 @@ +%%%%% epaisseur de tracés %%%%%%%% +numeric eppen; +eppen=0.25; + +pickup pencircle scaled eppen; +defaultpen := savepen; + +%points pour placer les différents éléments +pair _coinprec;%coinbasgauche de la boite précédente +pair _coincom;%coinbasdroite de la boite afin d'y mettre des commentaires +pair _coinnum;%milieu côté gauche pour placer la numérotation des lignes + +%paramètres +numeric Nblignes; Nblignes:=1; +pair DebutListe; DebutListe=(0,0); +boolean NumeroteLignes; NumeroteLignes=false; + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% couleurs +color CoulLignes; CoulLignes:=black; +color ColBloc; % alias des couleurs de bloc + +vardef LATEXSCRATCH primary s = + write "verbatimtex" to "mptextmp.mp"; + write "%&latex" to "mptextmp.mp"; + write "\documentclass[12pt]{article}" to "mptextmp.mp"; + write "\usepackage{ProfCollege}" to "mptextmp.mp"; + write "\usepackage[utf8]{inputenc}" to "mptextmp.mp"; + write "\usepackage[T1]{fontenc}" to "mptextmp.mp"; + write "\usepackage[sfdefault,lf]{carlito}" to "mptextmp.mp"; + write "\usepackage{pifont}" to "mptextmp.mp"; +% write "\usepackage[french]{babel}" to "mptextmp.mp"; +% write "\usepackage[autolanguage]{numprint}" to "mptextmp.mp"; +% write "\usepackage{amssymb}" to "mptextmp.mp"; +% write "\usepackage{amsmath}" to "mptextmp.mp"; +% write "\usepackage{mathrsfs}" to "mptextmp.mp"; +% write "\usepackage{xcolor}" to "mptextmp.mp"; +% write "\usepackage{calc}" to "mptextmp.mp"; +% write "\newlength{\longbarreheight}" to "mptextmp.mp"; +% write "\setlength{\longbarreheight}{2.1ex+3pt}" to "mptextmp.mp"; +% write "\newlength{\longbarredepth}" to "mptextmp.mp"; +% write "\setlength{\longbarredepth}{0.9ex+3pt}" to "mptextmp.mp"; +% write "\def\longbarre{\vrule height\longbarreheight depth\longbarredepth width0pt}" to "mptextmp.mp"; +% write "\usepackage{graphicx}" to "mptextmp.mp"; +% write "\def\barre{\vrule height2.1ex depth.9ex width0pt}" to "mptextmp.mp"; +% write "\def\demibarre{\vrule height1.4ex depth.6ex width0pt}" to "mptextmp.mp"; + write "\begin{document}" to "mptextmp.mp"; + write "etex" to "mptextmp.mp"; + write "btex "&s&" etex" to "mptextmp.mp"; + write EOF to "mptextmp.mp"; + scantokens "input mptextmp" +enddef; + + +%Version3 +color BleuMouvTrois,dBleuMouvTrois,VioletAppTrois,dVioletAppTrois,OrangeConTrois,OrangeTrois,OrangeListTrois,SonTrois,DSonTrois,EvenementTrois,CapteurTrois,StyloTrois,BlocTrois,BlocDefTrois,BlocDefLigneTrois,MessageTrois,ControleTrois,CapFonceTrois,CloneTrois,FondSonTrois,OvalStyloTrois,FondOvalOp; +BleuMouvTrois=(76/255,151/255,255/255); +dBleuMouvTrois=(66/255,128/255,215/255); +VioletAppTrois=(153/255,102/255,255/255); +dVioletAppTrois=(133/255,92/255,214/255); +OrangeConTrois=(255/255,171/255,25/255); +OrangeTrois=(255/255,140/255,26/255); +OrangeListTrois=(255/255,102/255,26/255); +SonTrois=(207/255,99/255,207/255); +DSonTrois=(201/255,79/255,201/255); +FondSonTrois=(15/255,189/255,140/255); +EvenementTrois=(255/255,191/255,0); +MessageTrois=(230/255,172/255,0); +CapteurTrois=(92/255,177/255,214/255); +CapFonceTrois=(71/255,168/255,209/255); +StyloTrois=(15/255,189/255,140/255); +OvalStyloTrois=(13/255,165/255,122/255); +BlocTrois=(255/255,102/255,128/255); +BlocDefTrois=(255/255,77/255,106/255); +BlocDefLigneTrois=(255/255,51/255,85/255); +ControleTrois=(255/255,171/255,25/255); +CloneTrois=(236/255,156/255,19/255); +FondOvalOp=(89/255,192/255,89/255); + +vardef FondOvalAppMenu= + save $; color $; + $=dVioletAppTrois; + $ +enddef; + +%%%%Alias +def Place expr o = + if path o: draw o else: draw o fi +enddef; + +%impression +boolean print; +print=false; + +numeric coefprint; +coefprint:=0.95; + +%texte ou symbole droite gauche +boolean symbole; +symbole=true; + +%divers +numeric eb;%ecart boite-texte +eb:=3pt; + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Création des boites +ecrt:=eb/2;%largeur de la bordure de départ des boites Box, OValBox... + +vardef Box(text t)= + save $; path $; + picture ox; + ox=image( + if string t: + string demitt; + demitt=t&"\barre"; + label(LATEXSCRATCH(demitt),(0,0)); + else: + draw t; + fi; + ); + $=(llcorner ox+(0,-ecrt))--(lrcorner ox+(0,-ecrt))--(urcorner ox+(0,ecrt))--(ulcorner ox+(0,ecrt))--cycle; + $ +enddef; + +vardef RecBox(text t)= + save $; path $; path xo; + if string t: + string demit; + demit=t&"\demibarre"; + xo=Box(demit);%on crée la boite contenant le texte + else: + xo=Box(t); + fi; + $=(llcorner xo+(-eb,eb)){dir-90}..{dir0}(llcorner xo)--(lrcorner xo){dir0}..{dir90}(lrcorner xo+(eb,eb))--(urcorner xo+(eb,-eb)){dir90}..{dir180}(urcorner xo)--(ulcorner xo){dir180}..{dir-90}(ulcorner xo+(-eb,-eb))--cycle; + $ +enddef; + +%%%%%%%%%%%%%% + +%%%%%%% Boites Ovales %%%%%%%% +vardef OvalBox(text t)= + save $; path $; path xo; + if string t: + string demit; + demit=t&"\barre"; + xo=Box(demit);%on crée la boite contenant le texte + else: + xo=Box(t); + fi; + $=(llcorner xo+(eb,0))--(lrcorner xo-(eb,0)){dir0}..{dir180}(urcorner xo+(-eb,0))--(ulcorner xo+(eb,0)){dir180}..{dir0}cycle;%on "arrondit" la boite + $ +enddef; + +vardef OvalVar(expr ar)= + save Ovar; picture Ovar; + save TAvar; path TAvar; + string TTv; + TTv=ar&"\barre"; + TAvar=OvalBox(TTv); + Ovar=image( + fill TAvar if print=false : withcolor OrangeTrois else : withcolor white fi; + draw TAvar if print=false : withcolor coefprint*white fi; + label(LATEXSCRATCH("\barre\bfseries "&ar),(0,0)) if print=false : withcolor white fi; + ); + Ovar:=Ovar shifted(-center Ovar); + Ovar +enddef; + +vardef OvalList(text listelist)= + save CList; picture CList; + path TAlist; picture LOCMt; + LOCMt=ColleBoxNew(listelist); + TAlist=OvalBox(LOCMt); + CList=image( + fill TAlist if print=false : withcolor OrangeListTrois else : withcolor white fi; + draw LOCMt; + draw TAlist if print=false : withcolor coefprint*white fi; + ); + CList:=CList shifted(-center CList); + CList +enddef; + +vardef OvalBloc(expr ar)= + save $; picture $; + path tabloc; + tabloc=OvalBox(ar); + $=image( + fill tabloc if print=false : withcolor BlocTrois else: withcolor white fi; + draw tabloc if print=true : withcolor black else: withcolor BlocDefLigneTrois fi; + label(LATEXSCRATCH("\bfseries\barre "&ar),(0,0)) if print=false : withcolor blanc fi; + ); + $ +enddef; + +vardef OvalMiniBox(text t)= + save $; path $; path xo; + if string t: + string demit; + demit=t&"\demibarre"; + xo=Box(demit);%on crée la boite contenant le texte + else: + xo=Box(t); + fi; + $=(llcorner xo+(eb/2,0))--(lrcorner xo-(eb/2,0)){dir0}..{dir180}(urcorner xo+(-eb/2,0))--(ulcorner xo+(eb/2,0)){dir180}..{dir0}cycle;%on "arrondit" la boite + $ +enddef; + +vardef DiamondBox(text t)= + save $; path $; path xo; + xo=Box(t);%on crée la boite contenant le texte + $=(llcorner xo-(eb,0))--(lrcorner xo+(eb,0))--(1/2[lrcorner xo,urcorner xo]+(4eb,0))--(urcorner xo+(eb,0))--(ulcorner xo-(eb,0))--(1/2[llcorner xo,ulcorner xo]+(-4eb,0))--cycle; + $ +enddef; + +vardef OvalNb(expr ar)= + save Onb; picture Onb; + path tanb; + tanb=OvalBox(ar); + Onb=image( + fill tanb withcolor white; + draw tanb if print=false : withcolor coefprint*white fi; + label(LATEXSCRATCH("\barre "&ar),(0,0)); + ); + Onb +enddef; + +vardef OvalText(expr ar)= + save $; save TA; + picture $; + path TA; + TA=OvalBox(ar); + $=image(% + fill TA withcolor white; + draw TA if print=false : withcolor coefprint*white fi; + label(LATEXSCRATCH("\barre "&ar),(0,0)); + ); + $:=$ shifted(-center $); + $ +enddef; + +vardef OvalOp(text listeop)= + save Oop; picture Oop; + save TAao; path TAao; + save LOPop; picture LOPop; + LOPop=ColleBoxNew(listeop); + TAao=OvalBox(LOPop); + Oop=image( + fill TAao if print=false : withcolor FondOvalOp else : withcolor coefprint*white fi; + draw LOPop; + draw TAao if print=false : withcolor coefprint*white fi; + ); + Oop:=Oop shifted(-center Oop); + Oop +enddef; + +vardef OvalApp(text listop)= + save $; picture $; + save ta; path ta; + save TTap; picture TTap; + TTap=ColleBoxNew(listop); + ta=OvalBox(TTap); + $=image( + fill ta if print=false : withcolor VioletAppTrois else: withcolor white fi; + draw ta if print=false : withcolor coefprint*white fi; + draw TTap; + ); + $:=$ shifted(-center $); + $ +enddef; + +vardef OvalSon(text listop)= + save $; picture $; + save ta; path ta; + save TTap; picture TTap; + TTap=ColleBoxNew(listop); + ta=OvalBox(TTap); + $=image( + fill ta if print=false : withcolor SonTrois else: withcolor white fi; + draw ta if print=false : withcolor coefprint*white fi; + draw TTap; + ); + $:=$ shifted(-center $); + $ +enddef; + +vardef OvalMusique(expr ar)= + save $; save TA; + picture $; + if string ar: + picture TT; + TT=ColleBoxNew(DoubleNote,"tempo"); + path TA; + TA=OvalBox(TT); + $=image( + fill TA if print : withcolor white else : withcolor StyloTrois fi; + draw TT if print=true : withcolor coefprint*white fi; + ); + else: + message("La commande --OvalStylo-- n'accepte qu'un argument de type string."); + $=nullpicture; + fi; + $ +enddef; + +vardef OvalMouv(expr ar)= + save $; picture $; + path ta; string TTm; + TTm=ar&"\longbarre"; + ta=OvalBox(TTm); + $=image( + fill ta if print=false : withcolor BleuMouvTrois else: withcolor white fi; + draw ta if print=false : withcolor coefprint*white fi; + label(LATEXSCRATCH("\longbarre "&ar),center ta) if print=false : withcolor blanc fi; + ); + $ +enddef; + +vardef OvalMenuCap(expr art)=OvalCapMenu(art) enddef; + +vardef OvalCapMenu(expr ar)= + save $; picture $; + string TTm; + TTm=if print:ar&"\hbox to1em{\barre}\blacktriangledown" else: "\color{white}"&ar&"\hbox to1em{\barre}\blacktriangledown"; + fi; + path TAMC; + TAMC=OvalBox(TTm); + $=image( + fill TAMC if print : withcolor white else : withcolor CapFonceTrois fi; + draw TAMC if print=false : withcolor coefprint*white fi; + label(LATEXSCRATCH(TTm),center TAMC); + ); + $ +enddef; + +vardef OvalCap(text listecap)= + save Cap; picture Cap; + save TAcap; path TAcap; + save LOCMcap; picture LOCMcap; + LOCMcap=ColleBoxNew(listecap); + TAcap=OvalBox(LOCMcap); + Cap=image( + fill TAcap if print=false : withcolor CapteurTrois else : withcolor white fi; + draw LOCMcap; + draw TAcap if print=false : withcolor coefprint*white fi; + ); + Cap:=Cap shifted(-center Cap); + Cap +enddef; + +vardef OvalMouvMenu(expr ar)= + save $; picture $; + path ta; string TTm; + TTm=if print:ar&"\hbox to1em{\barre}\blacktriangledown" else: + "\color{white}"&ar&"\hbox to1em{\barre}\color{black}\blacktriangledown" + fi; + ta=OvalBox(TTm); + $=image( + fill ta if print=false : withcolor dBleuMouvTrois else: withcolor white fi; + draw ta if print=false : withcolor coefprint*white fi; + label(LATEXSCRATCH(TTm),center ta); + ); + $ +enddef; + +vardef OvalAppMenu(expr ar)= + save $; picture $; + path ta; string TTm; + TTm=if print:ar&"\hbox to1em{\barre}\blacktriangledown" else: "\color{white}"&ar&"\hbox to1em{\barre}\blacktriangledown"; + fi; + ta=OvalBox(TTm); + $=image( + fill ta if print=false : withcolor FondOvalAppMenu else: withcolor white fi; + draw ta if print=false : withcolor coefprint*white fi; + label(LATEXSCRATCH(TTm),center ta); + ); + $ +enddef; + +vardef OvalSonMenu(expr art)=OvalMenuSon(art) enddef; + +vardef OvalMenuSon(expr ar)= + save $; save TA; + picture $; + string TTm; + TTm=if print:ar&"\hbox to1em{\barre}\blacktriangledown" else: "\color{white}"&ar&"\hbox to1em{\barre}\blacktriangledown"; + fi; + path TA; + TA=OvalBox(TTm); + $=image(% + fill TA if print : withcolor white else : withcolor DSonTrois fi; + draw TA if print=false : withcolor coefprint*white fi; + label(LATEXSCRATCH(TTm),center TA); + ); + $ +enddef; + +vardef OvalMenuControle(expr ar)= + save $; save TA; + picture $; + string TTm; + TTm=if print:ar&"\hbox to1em{\barre}\blacktriangledown" else: "\color{white}"&ar&"\hbox to1em{\barre}\blacktriangledown"; + fi; + path TA; + TA=OvalBox(TTm); + $=image( + fill TA if print : withcolor white else : withcolor CloneTrois fi; + draw TA if print=false : withcolor coefprint*white fi; + label(LATEXSCRATCH(TTm), center TA); + ); + $ +enddef; + +vardef OvalStylo(expr ar)= + save $; save TA; + picture $; + string TT,TTI; + if string ar: + if print: + TT=ar&"\hbox to1em{\barre}\blacktriangledown" + else: + TT=ar&"\hbox to1em{\barre}\color{white}\blacktriangledown" + fi; + TTI=ar&"\hbox to1em{\barre}\phantom{\blacktriangledown}"; + path TA; + TA=OvalBox(TT); + $=image( + fill TA if print : withcolor white else : withcolor OvalStyloTrois fi; + draw TA if print=false : withcolor coefprint*white fi; + label(LATEXSCRATCH(TT),(0,0)) if print=false : withcolor white fi; + ); + else: + message("La commande --OvalStylo-- n'accepte qu'un argument de type string."); + $=nullpicture; + fi; + $ +enddef; + +vardef OvalCouleur(expr redcc,greencc,bluecc)= + save $; picture $; + string TTv; + path tacol; + TTv="\phantom{10}\barre"; + tacol=OvalBox(TTv); + $=image( + fill tacol withcolor (redcc,greencc,bluecc); + draw tacol; + ); + $:=$ shifted(-center tacol); + $ +enddef; + +vardef OvalMenuEvenement(expr ar)= + save $; save TA; + picture $; + string TTm; + TTm=if print:ar&"\hbox to1em{\barre}\blacktriangledown" else: "\color{white}"&ar&"\hbox to1em{\barre}\blacktriangledown"; + fi; + path TA; + TA=OvalBox(TTm); + $=image( + fill TA if print : withcolor white else : withcolor MessageTrois fi; + draw TA if print=false : withcolor coefprint*white fi; + label(LATEXSCRATCH(TTm), center TA); + ); + $ +enddef; + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Rectangles +vardef RecMouvMenu(expr ar)= + save $; picture $; + path ta; string TTm; + TTm=if print:ar&"\hbox to1em{\barre}\blacktriangledown" else: "\color{white}"&ar&"\hbox to1em{\barre}\blacktriangledown" + fi; + ta=RecBox(TTm); + $=image( + fill ta if print=false : withcolor BleuMouvTrois else: withcolor white fi; + draw ta if print=false : withcolor coefprint*white fi; + label(LATEXSCRATCH(TTm),center ta); + ); + $ +enddef; + +vardef RecMenuApp(expr ar)= + save $; picture $; + save ta; path ta; string TTm; + TTm=if print:ar&"\hbox to1em{\barre}\blacktriangledown" else: "\color{white}"&ar&"\hbox to1em{\barre}\blacktriangledown"; + fi; + ta=RecBox(TTm); + $=image( + fill ta if print=false : withcolor VioletAppTrois else: withcolor white fi; + draw ta if print=false : withcolor coefprint*white fi; + label(LATEXSCRATCH(TTm),center ta); + ); + $ +enddef; + +vardef RecMenuOp(expr ar)= + save $; save TA; + picture $; string TTm; + TTm=if print:ar&"\hbox to1em{\barre}\blacktriangledown" else: "\color{white}"&ar&"\hbox to1em{\barre}\blacktriangledown"; + fi; + path TA; + TA=RecBox(TTm); + $=image( + fill TA if print : withcolor white else : withcolor FondOvalOp fi; + draw TA if print=false : withcolor coefprint*white fi; + label(LATEXSCRATCH(TTm), center TA); + ); + $ +enddef; + +vardef RecMenuSon(expr ar)= + save $; save TA; + picture $; string TTm; + TTm=if print:ar&"\hbox to1em{\barre}\blacktriangledown" else: "\color{white}"&ar&"\hbox to1em{\barre}\blacktriangledown" fi; + path TA; + TA=RecBox(TTm); + $=image( + fill TA if print : withcolor white else : withcolor SonTrois fi; + draw TA if print=false : withcolor coefprint*white fi; + label(LATEXSCRATCH(TTm), center TA); + ); + $ +enddef; + +vardef RecEvenementMenu(expr ar)= + save $; picture $; + path ta; string TTm; + TTm=if print:ar&"\hbox to1em{\barre}\blacktriangledown" else: "\color{white}"&ar&"\hbox to1em{\barre}\blacktriangledown"; + fi; + ta=RecBox(TTm); + $=image( + fill ta if print=false : withcolor EvenementTrois else: withcolor white fi; + draw ta if print=false : withcolor coefprint*white fi; + label(LATEXSCRATCH(TTm),center ta); + ); + $ +enddef; + +vardef RecMenuCap(expr ar)= + save $; picture $; + path ta; string TTm; + TTm=if print:ar&"\hbox to1em{\barre}\blacktriangledown" else: "\color{white}"&ar&"\hbox to1em{\barre}\blacktriangledown"; + fi; + ta=RecBox(TTm); + $=image( + fill ta if print=false : withcolor CapteurTrois else: withcolor white fi; + draw ta if print=false : withcolor coefprint*white fi; + label(LATEXSCRATCH(TTm),center ta); + ); + $ +enddef; + +vardef RecMenuVar(expr ar)= + save $; save TA; + picture $; string TTm; + TTm=if print:ar&"\hbox to1em{\barre}\blacktriangledown" else: "\color{white}"&ar&"\hbox to1em{\barre}\blacktriangledown"; + fi; + path TA; + TA=RecBox(TTm); + $=image( + fill TA if print : withcolor white else : withcolor OrangeTrois fi; + draw TA if print=false : withcolor coefprint*white fi; + label(LATEXSCRATCH(TTm), center TA); + ); + $ +enddef; + +vardef RecMenuList(expr ar)= + save $; save TA; + picture $; string TTm; + TTm=if print:ar&"\hbox to1em{\barre}\blacktriangledown" else: "\color{white}"&ar&"\hbox to1em{\barre}\blacktriangledown"; + fi; + path TA; + TA=RecBox(TTm); + $=image( + fill TA if print : withcolor white else : withcolor OrangeListTrois fi; + draw TA if print=false : withcolor coefprint*white fi; + label(LATEXSCRATCH(TTm), center TA); + ); + $ +enddef; + +%%%%%%% Affichage Complet %%%%%%%%%%%%% +vardef PuzzleBox(text t)= + save $; path $; path xo; + xo=Box(t);%on crée la boite contenant le texte + $=(llcorner xo+(-eb,0)){dir-90}..{dir0}(llcorner xo+(0,-eb))-- + (llcorner xo+(0.375cm,0)+(-eb,-eb)){dir0}.. + {dir0}(llcorner xo+(0.375cm,0)+(0,-2eb))-- + (llcorner xo+(0.625cm,0)+(0,-2eb)){dir0}.. + {dir0}(llcorner xo+(0.625cm,0)+(eb,-eb))-- + (lrcorner xo+(0,-eb)){dir0}..{dir90}(lrcorner xo+(eb,0))--(urcorner xo+(eb,0)){dir90}..{dir-180}(urcorner xo+(0,eb))-- + (ulcorner xo+(0.625cm,0)+(eb,eb)){dir180}.. + {dir180}(ulcorner xo+(0.625cm,0))-- + (ulcorner xo+(0.375cm,0)){dir180}.. + {dir180}(ulcorner xo+(0.375cm,0)+(-eb,eb))-- + (ulcorner xo+(0,eb)){dir-180}..{dir-90}(ulcorner xo+(-eb,0))--cycle; + $ +enddef; + +vardef BlocPuzzle(text nombloc)= + save Bpuzzle; picture Bpuzzle; + path TABp; picture LOCMp; + LOCMp=ColleBoxNew(nombloc); + TABp=PuzzleBox(LOCMp); + Bpuzzle=image( + fill TABp if print=false : withcolor BlocDefTrois else : withcolor white fi; + draw LOCMp; + draw TABp if print=true : withcolor black else: withcolor BlocDefLigneTrois fi; + ); + Bpuzzle:=Bpuzzle shifted(-center Bpuzzle+(0,-eb/2)); + Bpuzzle +enddef; + +vardef ColleBoxNew(text t)=%Pour coller plusieurs boites + save Colle; picture Colle; + Colle=nullpicture; + numeric nbcolle; nbcolle:=0; + save NBCOLLE; path NBCOLLE; + for p_ = t: + nbcolle:=nbcolle+1; + endfor; + picture HOLD; HOLD:=nullpicture; + if unknown LONG: LONG:=0 fi; + if nbcolle=1:%On dessine + for p_ = t: + if string p_: + NBCOLLE:=Box(p_); + HOLD:=image( + label(LATEXSCRATCH("\sffamily\bfseries\longbarre "&p_),(0,0)) if print=false : withcolor white fi;%->ok + ); + HOLD:=(HOLD shifted ((xpart((center HOLD)-(llcorner HOLD))+LONG,0))); + else: + HOLD:=(p_ shifted ((xpart((center p_)-(llcorner p_))+LONG,0))); + fi; + endfor; + addto Colle also HOLD; + LONG:=LONG+abs(lrcorner Colle - llcorner Colle)+eb; + else:%il faut coller les boites une à une + for p_ = t: + addto Colle also (ColleBoxNew(p_)); + endfor; + fi; + Colle +enddef; + +vardef CADRE(expr texti)= + save $; path $; + $=(llcorner texti+(-eb,0)){dir-90}..{dir0}(llcorner texti+(0,-eb))-- + (llcorner texti+(0.375cm,0)+(-eb,-eb)){dir0}.. + {dir0}(llcorner texti+(0.375cm,0)+(0,-2eb))-- + (llcorner texti+(0.625cm,0)+(0,-2eb)){dir0}.. + {dir0}(llcorner texti+(0.625cm,0)+(eb,-eb))-- + (lrcorner texti+(0,-eb)){dir0}..{dir90}(lrcorner texti+(eb,0))--(urcorner texti+(eb,0)){dir90}..{dir-180}(urcorner texti+(0,eb))-- + (ulcorner texti+(0.625cm,0)+(eb,eb)){dir180}.. + {dir180}(ulcorner texti+(0.625cm,0))-- + (ulcorner texti+(0.375cm,0)){dir180}.. + {dir180}(ulcorner texti+(0.375cm,0)+(-eb,eb))-- + (ulcorner texti+(0,eb)){dir-180}..{dir-90}(ulcorner texti+(-eb,0))--cycle; + $ +enddef; + +vardef AFFI(expr texta)= + path cadre; + cadre=CADRE(texta); + picture TEXT; + TEXT=image(% + fill cadre withcolor if print=true :coefprint*white else: if unknown ColBloc : white else : ColBloc fi; fi; + draw texta; + draw cadre withcolor CoulLignes; + ); + TEXT +enddef; + +vardef Affichage(expr textu)= + save $; + picture $; + $=AFFI(textu); + $:=$ shifted (if unknown _coinprec:(0,0) else :_coinprec fi - (ulcorner $)); +_coinprec:=(llcorner $)+(0,eb); +_coincom:=1/2[lrcorner $,urcorner $]+(eb,0); +_coinnum:=(xpart(DebutListe+(-3*eb,0)),ypart(1/2[llcorner $,ulcorner $])); +if NumeroteLignes=true: + label(LATEXSCRATCH("\footnotesize"&decimal(Nblignes)&""),_coinnum); + Nblignes:=Nblignes+1; +fi; +$ +enddef; + +%Pour les blocs de type contrôle +vardef CADRECONTROLE(expr texti)= + save $; path $; + path tracecadre; + $=(llcorner texti+(-eb,-eb))--%(llcorner texti+(0,-eb))-- + (llcorner texti+(0.875cm,0)+(-eb,-eb)){dir0}.. + {dir0}(llcorner texti+(0.875cm,0)+(0,-2eb))-- + (llcorner texti+(1.125cm,0)+(0,-2eb)){dir0}.. + {dir0}(llcorner texti+(1.125cm,0)+(eb,-eb))-- + (lrcorner texti+(0,-eb)){dir0}..{dir90}(lrcorner texti+(eb,0))--(urcorner texti+(eb,0)){dir90}..{dir180}(urcorner texti+(0,eb))-- + (ulcorner texti+(0.625cm,0)+(eb,eb)){dir180}.. + {dir180}(ulcorner texti+(0.625cm,0))-- + (ulcorner texti+(0.375cm,0)){dir180}.. + {dir180}(ulcorner texti+(0.375cm,0)+(-eb,eb))-- + (ulcorner texti+(0,eb)){dir180}..{dir-90}(ulcorner texti+(-eb,0))--cycle; + tracecadre=(llcorner texti+(0.5cm,0)+(0,-eb))--(llcorner texti+(0.875cm,0)+(-eb,-eb)){dir0}.. + {dir0}(llcorner texti+(0.875cm,0)+(0,-2eb))-- + (llcorner texti+(1.125cm,0)+(0,-2eb)){dir0}.. + {dir0}(llcorner texti+(1.125cm,0)+(eb,-eb))-- + (lrcorner texti+(0,-eb)){dir0}..{dir90}(lrcorner texti+(eb,0))--(urcorner texti+(eb,0)){dir90}..{dir180}(urcorner texti+(0,eb))-- + (ulcorner texti+(0.625cm,0)+(eb,eb)){dir180}.. + {dir180}(ulcorner texti+(0.625cm,0))-- + (ulcorner texti+(0.375cm,0)){dir180}.. + {dir180}(ulcorner texti+(0.375cm,0)+(-eb,eb))-- + (ulcorner texti+(0,eb)){dir180}..{dir-90}(ulcorner texti+(-eb,0))-- + (llcorner texti+(-eb,-eb)); + $ +enddef; + +vardef AFFICONTROLE(expr texta)= + path cadre; + cadre=CADRECONTROLE(texta); + picture TEXT; + TEXT=image( + fill cadre withcolor if print=true :coefprint*white else: if unknown ColBloc : white else : ColBloc fi; fi; + draw texta; + draw tracecadre withcolor CoulLignes; + ); + TEXT +enddef; + +vardef AffichageControle(expr textu)= + save $; + picture $; + $=AFFICONTROLE(textu); + $:=$ shifted (if unknown _coinprec:(0,0) else :_coinprec fi - (ulcorner $)); +_coinprec:=llcorner $+(0.5cm,0); +_coinprec:=_coinprec+(0,eb); +coindebutbloc[numblocrep]:=(llcorner $)+(0,eb); +_coincom:=1/2[lrcorner $,urcorner $]+(eb,0); +_coinnum:=(xpart(DebutListe+(-3*eb,0)),ypart(1/2[llcorner $,ulcorner $])); +if NumeroteLignes=true: + label(LATEXSCRATCH("\footnotesize"&decimal(Nblignes)&""),_coinnum); + Nblignes:=Nblignes+1; +fi; +$ +enddef; + +vardef CADREED(expr texti)= + save $; path $; + $=(llcorner texti+(-eb,0)){dir-90}..{dir0}(llcorner texti+(0,-eb))-- + (llcorner texti+(0.375cm,0)+(-eb,-eb)){dir0}.. + {dir0}(llcorner texti+(0.375cm,0)+(0,-2eb))-- + (llcorner texti+(0.625cm,0)+(0,-2eb)){dir0}.. + {dir0}(llcorner texti+(0.625cm,0)+(eb,-eb))-- + (lrcorner texti+(0,-eb)){dir0}..{dir90}(lrcorner texti+(eb,0))--(urcorner texti+(eb,0)){dir90}..{dir-180}(urcorner texti+(0,eb))-- + 1/2[ulcorner texti+(-eb,eb),urcorner texti+(eb,eb)]{dir150}..{dir-150}(ulcorner texti+(-eb,eb))--cycle; + $ +enddef; + +vardef AFFIED(expr texta)= + path cadre; + cadre=CADREED(texta); + picture TEXT; + TEXT=image( + fill cadre withcolor if print=true :coefprint*white else: if unknown ColBloc : white else : ColBloc fi; fi; + draw texta; + draw cadre withcolor CoulLignes; + ); + TEXT +enddef; + +vardef AffichageED(expr textu)= + save $; + picture $; + $=AFFIED(textu); + $:=$ shifted (if unknown _coinprec:(0,0) else :_coinprec fi - (ulcorner $)); +_coinprec:=llcorner $; +_coinprec:=_coinprec+(0,eb); +_coincom:=1/2[lrcorner $,urcorner $]+(eb,0); +_coinnum:=(xpart(DebutListe+(-3*eb,0)),ypart(1/2[llcorner $,ulcorner $])); +if NumeroteLignes=true: + label(LATEXSCRATCH("\footnotesize"&decimal(Nblignes)&""),_coinnum); + Nblignes:=Nblignes+1; +fi; +$ +enddef; + +%%% section Mouvement %%%%%%%%%% +vardef Avancer(expr nbpas)= + LONG:=0; + save $; + picture $, texto; + if string nbpas: + texto=ColleBoxNew("avancer de",OvalNb(nbpas),"pas"); + else: + texto=ColleBoxNew("avancer de",nbpas,"pas"); + fi; + ColBloc:=BleuMouvTrois; + $=Affichage(texto); + $ +enddef; + +vardef Arcdroite= + save $; + picture $; + $=image( + path cc; + cc=fullcircle scaled 10pt; + drawarrow reverse(subpath(0,0.75*length cc) of cc) withpen pencircle scaled 2bp if print=false: withcolor white fi; + ); + $ +enddef; + +vardef Arcgauche= + save $; + picture $; + $=image( + path cc; + cc=fullcircle scaled 10pt; + drawarrow (subpath(0.75*length cc,1.5*length cc) of cc) withpen pencircle scaled 2bp if print=false: withcolor white fi; + ); + $ +enddef; + +vardef Tournerd(expr nbpas)= + LONG:=0; + save $; + picture $, texto; + if string nbpas: + if symbole=true: + texto=ColleBoxNew("tourner",Arcdroite,"de",OvalNb(nbpas),"degré(s)"); + else: + texto=ColleBoxNew("tourner à droite de",OvalNb(nbpas),"degré(s)"); + fi; + else: + if symbole=true: + texto=ColleBoxNew("tourner",Arcdroite,"de",nbpas,"degré(s)"); + else: + texto=ColleBoxNew("tourner à droite de",nbpas,"degré(s)"); + fi; + fi; + ColBloc:=BleuMouvTrois; + $=Affichage(texto); + $ +enddef; + +vardef Tournerg(expr nbpas)= + LONG:=0; + save $; + picture $, texto; + if string nbpas: + if symbole=true: + texto=ColleBoxNew("tourner",Arcgauche,"de",OvalNb(nbpas),"degré(s)"); + else: + texto=ColleBoxNew("tourner à gauche de",OvalNb(nbpas),"degré(s)"); + fi; + else: + if symbole=true: + texto=ColleBoxNew("tourner",Arcgauche,"de",nbpas,"degré(s)"); + else: + texto=ColleBoxNew("tourner à gauche de",nbpas,"degré(s)"); + fi; + fi; + ColBloc:=BleuMouvTrois; + $=Affichage(texto); + $ +enddef; + +vardef Orienter(expr nbpas)= + LONG:=0; + save $; + picture $, texto; + if string nbpas: + texto=ColleBoxNew("s'orienter à",OvalNb(nbpas)); + else: + texto=ColleBoxNew("s'orienter à",nbpas); + fi; + ColBloc:=BleuMouvTrois; + $=Affichage(texto); + $ +enddef; + +vardef Orienterdirection(expr nbpas)= + LONG:=0; + save $; + picture $, texto; + if string nbpas: + texto=ColleBoxNew("s'orienter vers",OvalMouvMenu(nbpas)); + else: + texto=ColleBoxNew("s'orienter vers",nbpas); + fi; + ColBloc:=BleuMouvTrois; + $=Affichage(texto); + $ +enddef; + +vardef OrienterVers(expr nbpass)=Orienterdirection(nbpass) enddef; + +vardef Aller(expr xa,ya)= + LONG:=0; + save $; + picture $, texto; + texto=ColleBoxNew("aller à x:",if string xa:OvalNb(xa) else: xa fi,"y:",if string ya:OvalNb(ya) else: ya fi); + ColBloc:=BleuMouvTrois; + $=Affichage(texto); + $ +enddef; + +vardef Glisser(expr na,xa,ya)= + LONG:=0; + save $; + picture $, texto; + texto=ColleBoxNew("glisser en",if string na:OvalNb(na) else: na fi,"seconde(s) à x :",if string xa:OvalNb(xa) else: xa fi,"y:",if string ya:OvalNb(ya) else: ya fi); + ColBloc:=BleuMouvTrois; + $=Affichage(texto); + $ +enddef; + +vardef Allera(expr nbpas)= + LONG:=0; + save $; + picture $, texto; + if string nbpas: + texto=ColleBoxNew("aller à",OvalMouvMenu(nbpas)); + ColBloc:=BleuMouvTrois; + $=Affichage(texto); + else: + message(""); + message("La commande -- Allera -- n'accepte qu'un type string comme argument."); + message(""); + $=nullpicture; + fi; + $ +enddef; + +vardef Glissera(expr na,xa)= + LONG:=0; + save $; + picture $, texto; + if string xa: + texto=ColleBoxNew("glisser en",if string na:OvalNb(na) else: na fi,"seconde(s) à",OvalMouvMenu(xa)); + ColBloc:=BleuMouvTrois; + $=Affichage(texto); +else: + message(""); + message("La commande -- Glissera -- n'accepte qu'un type string comme deuxième argument."); + message(""); + $=nullpicture; +fi; + $ +enddef; + +vardef Ajouter(expr nba,xa)= + LONG:=0; + save $; + picture $, texto; + if string xa: + texto=ColleBoxNew("ajouter",if string nba:OvalNb(nba) else: nba fi,"à",xa); + ColBloc:=BleuMouvTrois; + $=Affichage(texto); +else: + message(""); + message("La commande -- Ajouter -- n'accepte qu'un type string comme deuxième argument."); + message(""); + $=nullpicture; +fi; +$ +enddef; + +vardef Mettre(expr xa,nba)= + LONG:=0; + save $; + picture $, texto; + if string xa: + texto=ColleBoxNew("mettre",xa,"à",if string nba:OvalNb(nba) else: nba fi); + ColBloc:=BleuMouvTrois; + $=Affichage(texto); + else: + message(""); + message("La commande -- Mettre -- n'accepte qu'un type string comme premier argument."); + message(""); + $=nullpicture; + fi; + $ +enddef; + +vardef Rebondir= + LONG:=0; + save $; + picture $, texto; + texto=ColleBoxNew("rebondir si le bord est atteint"); + ColBloc:=BleuMouvTrois; + $=Affichage(texto); + $ +enddef; + +vardef FixerSensRotation(expr nbpas)= + LONG:=0; + save $; + picture $, texto; + if string nbpas: + texto=ColleBoxNew("fixer le sens de rotation",RecMouvMenu(nbpas));%RecMouvMenu(nbpas)); + ColBloc:=BleuMouvTrois; + $=Affichage(texto); + else: + message("La commande --FixerSensRotation-- admet un seul argument de type string"); + $=nullpicture; + fi; + $ +enddef; + +%%%% fin section Mouvement %%%%%% + +%%%%% Section Apparence %%%%%%%%% +vardef DireT(expr na,xa)= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew("dire",if string na:OvalText(na) else: na fi,"pendant",if string xa : OvalNb(xa) else: xa fi,"seconde(s)"); +ColBloc:=VioletAppTrois; +$=Affichage(texto); +$ +enddef; + +vardef Dire(expr na)= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew("dire",if string na:OvalText(na) else: na fi); +ColBloc:=VioletAppTrois; +$=Affichage(texto); +$ +enddef; + +vardef PenserT(expr na,xa)= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew("penser à",if string na:OvalText(na) else: na fi,"pendant",if string xa : OvalNb(xa) else: xa fi,"seconde(s)"); +ColBloc:=VioletAppTrois; +$=Affichage(texto); +$ +enddef; + +vardef Penser(expr na)= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew("penser à",if string na:OvalText(na) else: na fi); +ColBloc:=VioletAppTrois; +$=Affichage(texto); +$ +enddef; + +vardef Montrer= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew("montrer"); + ColBloc:=VioletAppTrois; + $=Affichage(texto); + $ +enddef; + +vardef Cacher= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew("cacher"); + ColBloc:=VioletAppTrois; + $=Affichage(texto); + $ +enddef; + +vardef Basculer(expr nbpas)= + LONG:=0; + save $; + picture $,texto; + if string nbpas: + texto=ColleBoxNew("basculer sur le costume",OvalAppMenu(nbpas)); + ColBloc:=VioletAppTrois; + $=Affichage(texto); + else: + message("La commande --Basculer-- n'accepte qu'un argument string."); + $=nullpicture; + fi; + $ +enddef; + +vardef BasculerCostume(expr nbpass)=Basculer(nbpass) enddef; + +vardef CostumeSuivant= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew("costume suivant"); + ColBloc:=VioletAppTrois; + $=Affichage(texto); +$ +enddef; + +vardef ARSuivant= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew("arrière-plan suivant"); + ColBloc:=VioletAppTrois; + $=Affichage(texto); +$ +enddef; + +vardef BasculerAR(expr nbpas)= + LONG:=0; + save $; + picture $,texto; + if string nbpas: + texto=ColleBoxNew("basculer sur l'arrière-plan",OvalAppMenu(nbpas)); + ColBloc:=VioletAppTrois; + $=Affichage(texto); + else: + message("La commande --BasculerAR-- n'accepte qu'un argument string."); + $=nullpicture; + fi; + $ +enddef; + +vardef BasculerARA(expr nbpas)=%quand la scène est sélectionnée... + LONG:=0; + save $; + picture $,texto; + if string nbpas: + texto=ColleBoxNew("basculer sur l'arrière-plan",OvalAppMenu(nbpas)," et attendre"); + ColBloc:=VioletAppTrois; + $=Affichage(texto); + else: + message("La commande --BasculerARA-- n'accepte qu'un argument string."); + $=nullpicture; + fi; + $ +enddef; + +vardef AjouterEffet(expr nbpas,xa)= + LONG:=0; + save $; + picture $,texto; + if string xa: + texto=ColleBoxNew("ajouter",if string nbpas: OvalNb(nbpas) else: nbpas fi," à l'effet",RecMenuApp(xa)); + ColBloc:=VioletAppTrois; + $=Affichage(texto); +else: + message("La commande --AjouterEffet-- n'accepte qu'un deuxième argument de type string."); + $=nullpicture; +fi; +$ +enddef; + +vardef MettreEffet(expr xa,nbpas)= + LONG:=0; + save $; + picture $,texto; + if string xa: + texto=ColleBoxNew("mettre l'effet",RecMenuApp(xa),"à",if string nbpas:OvalNb(nbpas) else: nbpas fi); + ColBloc:=VioletAppTrois; + $=Affichage(texto); +else: + message("La commande --MettreEffet-- n'accepte qu'un premier argument de type string."); + $=nullpicture; +fi; +$ +enddef; + +vardef AnnulerEffet= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew("annuler les effets graphiques"); + ColBloc:=VioletAppTrois; + $=Affichage(texto); +$ +enddef; + +vardef AnnulerEffets=AnnulerEffet enddef; + +vardef AjouterTaille(expr na)= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew("ajouter",if string na:OvalNb(na) else: na fi,"à la taille"); +ColBloc:=VioletAppTrois; +$=Affichage(texto); +$ +enddef; + +vardef MettreA(expr na)= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew("mettre la taille à",if string na:OvalNb(na) else: na fi,"\% de la taille initiale"); +ColBloc:=VioletAppTrois; +$=Affichage(texto); +$ +enddef; + +vardef MettreTaille(expr art)=MettreA(art) enddef; + +vardef AllerPlan(expr nbpas)= + LONG:=0; + save $; + picture $,texto; + if string nbpas: + texto=ColleBoxNew("aller à l'",RecMenuApp(nbpas),"plan"); + ColBloc:=VioletAppTrois; + $=Affichage(texto); + else: + message("La commande --AllerPlan-- n'accepte qu'un argument de type string."); + $=nullpicture; + fi; + $ +enddef; + +vardef DeplacerPlan(expr nbpas,xa)= + LONG:=0; + save $; + picture $,texto; + if string xa: + texto=ColleBoxNew("déplacer de",if string nbpas:OvalNb(nbpas) else: nbpas fi,"plan(s) vers l'",RecMenuApp(xa)); + ColBloc:=VioletAppTrois; + $=Affichage(texto); +else: + message("La commande --DeplacerPlan-- n'accepte qu'un deuxième argument de type string."); + $=nullpicture; +fi; +$ +enddef; +%%%%fin Section Apparance%%%%%%%%%%%% + +%%%%%% Section Son%%%%%%%%%%%% +vardef Jouer(expr nbpas)= + LONG:=0; + save $; + picture $, texto; + if string nbpas : + texto=ColleBoxNew("jouer le son",OvalMenuSon(nbpas)); + ColBloc:=SonTrois; + $=Affichage(texto); + else: + message("La commande --Jouer-- n'accepte qu'un argument de type string."); + $=nullpicture; + fi; + $ +enddef; + +vardef JouerT(expr nbpas)= + LONG:=0; + save $; + picture $, texto; + if string nbpas: + texto=ColleBoxNew("jouer le son",OvalMenuSon(nbpas)," jusqu'au bout"); + ColBloc:=SonTrois; + $=Affichage(texto); + else: + message("La commande --Jouer-- n'accepte qu'un argument de type string."); + $=nullpicture; + fi; + $ +enddef; + +vardef ArreterSon= + LONG:=0; + save $; + picture $, texto; + texto=ColleBoxNew("arrêter tous les sons"); + ColBloc:=SonTrois;; + $=Affichage(texto); + $ +enddef; + +vardef ArreterSons=ArreterSon enddef; + +vardef AjouterVol(expr xa)= + LONG:=0; + save $; + picture $, texto; + texto=ColleBoxNew("ajouter",if string xa:OvalNb(xa) else: xa fi," au volume"); + ColBloc:=SonTrois; + $=Affichage(texto); + $ +enddef; + +vardef MettreVol(expr xa)= + LONG:=0; + save $; + picture $, texto; + texto=ColleBoxNew("mettre le volume à",if string xa: OvalNb(xa) else: xa fi,"~\%"); + ColBloc:=SonTrois; + $=Affichage(texto); + $ +enddef; + +vardef AjouterEffetSon(expr nombre, effet)= + LONG:=0; + save $; + picture $, texto; + if string effet: + texto=ColleBoxNew("ajouter",if string nombre : OvalNb(nombre) else: nombre fi," à l'effet",RecMenuSon(effet)); + ColBloc:=SonTrois; + $=Affichage(texto); +else: + message("La commande -- AjouterEffet -- n'accepte qu'un deuxième argument de type string."); + $=nullpicture; +fi; +$ +enddef; + +vardef MettreEffetSon(expr effet,nombre)= + LONG:=0; + save $; + picture $, texto; + if string effet: + texto=ColleBoxNew("mettre l'effet",RecMenuSon(effet),"à",if string nombre:OvalNb(nombre) else: nombre fi); + ColBloc:=SonTrois; + $=Affichage(texto); +else: + message("La commande -- MettreEffet -- n'accepte qu'un argument de type string."); + $=nullpicture; +fi; +$ +enddef; + +vardef AnnulerEffetSon= + LONG:=0; + save $; + picture $, texto; + texto=ColleBoxNew("annuler tous les effets sonores"); + ColBloc:=SonTrois; + $=Affichage(texto); + $ +enddef; + +%Musique +vardef Tambour(expr na,xa)= + LONG:=0; + save $; + picture $, texto; + if string na: + texto=ColleBoxNew(DoubleNote,"jouer du tambour",OvalStylo(na),"pendant",if string xa:OvalNb(xa) else: xa fi,"temps"); + ColBloc:=StyloTrois; + $=Affichage(texto); +else: + message("La commande --Tambour-- n'accepte qu'un premier argument de type string."); + $=nullpicture; +fi; +$ +enddef; + +vardef Pause(expr na)= + LONG:=0; + save $; + picture $, texto; + texto=ColleBoxNew(DoubleNote,"faire une pause pendant",if string na: OvalNb(na) else: na fi," temps"); + ColBloc:=StyloTrois; + $=Affichage(texto); + $ +enddef; + +vardef JouerNote(expr na,xa)= + LONG:=0; + save $; + picture $, texto; + texto=ColleBoxNew(DoubleNote,"jouer la note",if string na:OvalNb(na) else: na fi," pendant",if string xa:OvalNb(xa) else: xa fi," temps"); +ColBloc:=StyloTrois; +$=Affichage(texto); +$ +enddef; + +vardef ChoisirInstrument(expr na)= + LONG:=0; + save $; + picture $, texto; + if string na: + texto=ColleBoxNew(DoubleNote,"choisir l'instrument \no{}",OvalStylo(na)); + ColBloc:=StyloTrois; + $=Affichage(texto); + else: + message("La commande -- ChoisirInstrument -- n'accepte qu'un argument de type string"); + $=nullpicture; + fi; + $ +enddef; + +vardef MettreTempo(expr xa)= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew(DoubleNote,"mettre le tempo à",if string xa:OvalNb(xa) else: xa fi); + ColBloc:=FondSonTrois; + $=Affichage(texto); + $ +enddef; + +vardef AjouterTempo(expr xa)= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew(DoubleNote,"ajouter",if string xa:OvalNb(xa) else: xa fi," au tempo"); +ColBloc:=FondSonTrois; +$=Affichage(texto); +$ +enddef; + +vardef DoubleNote= + save $; + picture $; + $=image( + draw (((0,0)--(0,18pt)) shifted(-12,-9pt)) withpen pencircle scaled 1bp withcolor if print: coefprint*white else: StyloTrois fi; + draw NoteImage shifted((-5,-2)); + draw NoteImage shifted((3.5,2)); + draw (((0,0)--(0,18pt)) shifted(12,-9pt)) withpen pencircle scaled 1bp withcolor if print: 0.5*coefprint*white else: (69/255,168/255,140/255) fi;%Trop clair->(14/255,187/255,139/255); +); + $:=$ shifted(-3,0); + $ +enddef; + +vardef NoteImage= + save $; + picture $; + $=image( + linecap := butt; + linejoin := mitered; + fill (80.695297,716.262024)..controls (80.574203,716.257996) and (80.476601,716.171997)..(80.480499,716.062988) + --(80.687500,704.125000)..controls (79.941399,704.570007) and (78.644501,704.637024)..(77.312500,704.223022) + ..controls (75.503899,703.659973) and (74.339798,702.429993)..(74.710899,701.473022) + ..controls (75.082001,700.512024) and (76.851601,700.187988)..(78.656303,700.750000) + ..controls (80.425797,701.301025) and (81.574203,702.504028)..(81.273399,703.453003) + --(81.125000,711.987976)..controls (82.910202,711.909973) and (86.910202,711.625000)..(84.917999,706.456970) + ..controls (85.992203,707.906006) and (86.839798,709.598022)..(85.273399,711.629028) + ..controls (84.378899,712.789001) and (81.617203,713.348022)..(81.062500,715.398010) + --(81.054703,716.065979)..controls (81.050797,716.176025) and (80.953102,716.262024)..(80.832001,716.262024) + --cycle if print=false: withcolor white fi; + pickup pencircle scaled 0.797011bp; + draw (80.695297,716.262024)..controls (80.574203,716.257996) and (80.476601,716.171997)..(80.480499,716.062988) + --(80.687500,704.125000)..controls (79.941399,704.570007) and (78.644501,704.637024)..(77.312500,704.223022) + ..controls (75.503899,703.659973) and (74.339798,702.429993)..(74.710899,701.473022) + ..controls (75.082001,700.512024) and (76.851601,700.187988)..(78.656303,700.750000) + ..controls (80.425797,701.301025) and (81.574203,702.504028)..(81.273399,703.453003) + --(81.125000,711.987976)..controls (82.910202,711.909973) and (86.910202,711.625000)..(84.917999,706.456970) + ..controls (85.992203,707.906006) and (86.839798,709.598022)..(85.273399,711.629028) + ..controls (84.378899,712.789001) and (81.617203,713.348022)..(81.062500,715.398010) + --(81.054703,716.065979)..controls (81.050797,716.176025) and (80.953102,716.262024)..(80.832001,716.262024) + --cycle if print=false: withcolor white fi; + pickup pencircle scaled eppen; + ); + $:=($ rotatedabout((72.000000,699),15)) scaled 0.8; + $:=$ shifted(-center $); + $ +enddef; + +%%%%%% fin Section Son %%%%%%%%% + +%%%%%% Section Stylo %%%%%%%%% +vardef ImageCrayon= + save titi; + picture titi; + titi=image(% + draw CrayonImage shifted(-12,0); + draw (((0,0)--(0,18pt)) shifted(9,-9)) withpen pencircle scaled 1bp withcolor if print: 0.5*coefprint*white else: (69/255,168/255,140/255) fi;%Trop clair->(14/255,187/255,139/255); + ); + titi +enddef; + +vardef Effacer= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew(ImageCrayon,"effacer tout"); + ColBloc:=StyloTrois; + $=Affichage(texto); + $ +enddef; + +vardef Estampiller= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew(ImageCrayon,"estampiller"); + ColBloc:=StyloTrois; + $=Affichage(texto); + $ +enddef; + +vardef PoserStylo= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew(ImageCrayon," stylo en position d'écriture"); + ColBloc:=StyloTrois; + $=Affichage(texto); +$ +enddef; + +vardef ReleverStylo= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew(ImageCrayon,"relever le stylo"); + ColBloc:=StyloTrois; + $=Affichage(texto); +$ +enddef; + +vardef MettreCouleur(expr redc,greenc,bluec)= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew(ImageCrayon," mettre la couleur du stylo à",OvalCouleur(redc,greenc,bluec)); + ColBloc:=StyloTrois; + $=Affichage(texto); + $ +enddef; + +vardef AjouterCS(text t)= + LONG:=0; + save $; + picture $,texto; + numeric k; k=0; + for p_=t: + if k=1:string effet; effet=p_ fi; + if k=0: if string p_:string nombre; nombre=p_ else: if picture p_: picture nombre; nombre=p_; fi fi fi; + k:=k+1; + endfor; + texto=ColleBoxNew(ImageCrayon,"ajouter",if string nombre:OvalNb(nombre) else: nombre fi,"à la",OvalStylo(effet),"du stylo"); +ColBloc:=StyloTrois; +$=Affichage(texto); +$ +enddef; + +vardef MettreCS(text t)= + LONG:=0; + save $; + picture $,texto; + numeric k; k=0; + for p_=t: + if k=0:string effet; effet=p_ fi; + if k=1: if string p_:string nombre; nombre=p_ else: if picture p_: picture nombre; nombre=p_; fi fi fi; + k:=k+1; + endfor; + texto=ColleBoxNew(ImageCrayon,"mettre la",OvalStylo(effet),"du stylo à",if string nombre:OvalNb(nombre) else: nombre fi); +ColBloc:=StyloTrois; +$=Affichage(texto); +$ +enddef; + +%taille du stylo +vardef AjouterTS(expr nbpas)= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew(ImageCrayon,"ajouter",if string nbpas:OvalNb(nbpas) else: nbpas fi,"à la taille du stylo"); +ColBloc:=StyloTrois; +$=Affichage(texto); +$ +enddef; + +vardef MettreTS(expr nbpas)= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew(ImageCrayon,"mettre la taille du stylo à",if string nbpas:OvalNb(nbpas) else: nbpas fi); +ColBloc:=StyloTrois; +$=Affichage(texto); +$ +enddef; + +vardef CrayonImage= + picture cray; + cray=image(% + drawoptions (if print=false:withcolor (0.298050,0.556850,0.917650) fi); + linecap := butt; + linejoin := mitered; + fill (0.960938,1.390630)--(1.644530,2.996090)..controls (1.730470,3.199220) and (1.917970,3.500000)..(2.062500,3.664060)..controls (2.324220,3.968750) and (3.539060,2.753910)..(3.234380,2.488280)..controls (3.070310,2.343750) and (2.769530,2.160160)..(2.566410,2.074220)--cycle; + drawoptions (withcolor (0.349030,0.368640,0.450970)); + pickup pencircle scaled 0.498140bp; + draw (0.960938,1.390630)--(1.644530,2.996090)..controls (1.730470,3.199220) and (1.917970,3.500000)..(2.062500,3.664060)..controls (2.324220,3.968750) and (3.539060,2.753910)..(3.234380,2.488280)..controls (3.070310,2.343750) and (2.769530,2.160160)..(2.566410,2.074220)--cycle; + drawoptions (withcolor (1.000000,1.000000,1.000000)); + %pickup pencircle scaled 0.000000bp; + fill (1.800780,3.363280)--(2.558590,5.156250)..controls (2.601560,5.257810) and (2.699220,5.402340)..(2.777340,5.480470)--(8.281250,10.984400)..controls (8.300780,11.003900) and (8.339840,11.023400)..(8.367190,11.031300)..controls (9.757810,11.398400) and (10.968800,10.187500)..(10.601600,8.792970)..controls (10.593800,8.769530) and (10.574200,8.730470)..(10.554700,8.710940)--(6.316410,4.476560)..controls (5.539060,3.695310) and (4.089840,2.718750)..(3.074220,2.289060)--(2.980470,2.246090)..controls (2.957030,2.238280) and (2.953130,2.242190)..(2.972660,2.261720)..controls (3.539060,2.753910) and (2.324220,3.968750)..(1.800780,3.363280)--cycle; + drawoptions (if print=false:withcolor (0.349030,0.368640,0.450970) fi); + pickup pencircle scaled 0.498140bp; + draw (1.800780,3.363280)--(2.558590,5.156250)..controls (2.601560,5.257810) and (2.699220,5.402340)..(2.777340,5.480470)--(8.281250,10.984400)..controls (8.300780,11.003900) and (8.339840,11.023400)..(8.367190,11.031300)..controls (9.757810,11.398400) and (10.968800,10.187500)..(10.601600,8.792970)..controls (10.593800,8.769530) and (10.574200,8.730470)..(10.554700,8.710940)--(6.316410,4.476560)..controls (5.539060,3.695310) and (4.089840,2.718750)..(3.074220,2.289060)--(2.980470,2.246090)..controls (2.957030,2.238280) and (2.953130,2.242190)..(2.972660,2.261720)..controls (3.539060,2.753910) and (2.324220,3.968750)..(1.800780,3.363280); + drawoptions (if print=false:withcolor (0.298050,0.556850,0.917650) fi); + %pickup pencircle scaled 0.000000bp; + fill (8.316410,11.019500)--(13.031300,15.730500)..controls (13.109400,15.808600) and (13.257800,15.878900)..(13.371100,15.886700)..controls (14.308600,15.949200) and (15.519500,14.734400)..(15.457000,13.796900)..controls (15.449200,13.687500) and (15.378900,13.535200)..(15.300800,13.457000)--(10.589800,8.746090)..controls (10.968800,10.187500) and (9.757810,11.398400)..(8.316410,11.019500)--cycle; + drawoptions (if print=false:withcolor (0.349030,0.368640,0.450970) fi); + pickup pencircle scaled 0.498140bp; + draw (8.316410,11.019500)--(13.031300,15.730500)..controls (13.109400,15.808600) and (13.257800,15.878900)..(13.371100,15.886700)..controls (14.308600,15.949200) and (15.519500,14.734400)..(15.457000,13.796900)..controls (15.449200,13.687500) and (15.378900,13.535200)..(15.300800,13.457000)--(10.589800,8.746090)..controls (10.968800,10.187500) and (9.757810,11.398400)..(8.316410,11.019500)--cycle; + draw (12.562500,15.265600)..controls (7.937500,15.644500) and (9.453130,10.488300)..(6.117190,11.398400); + %pickup pencircle scaled 0.000000bp; + fill (7.199220,12.785200)..controls (6.812500,13.175800) and (6.179690,13.175800)..(5.792970,12.785200)..controls (5.402340,12.398400) and (5.402340,11.765600)..(5.792970,11.378900)..controls (6.179690,10.988300) and (6.812500,10.988300)..(7.199220,11.378900)..controls (7.589840,11.765600) and (7.589840,12.398400)..(7.199220,12.785200)--cycle; + fill (6.496090,12.082000)--cycle; + pickup pencircle scaled 0.498140bp; + draw (7.199220,12.785200)..controls (6.812500,13.175800) and (6.179690,13.175800)..(5.792970,12.785200)..controls (5.402340,12.398400) and (5.402340,11.765600)..(5.792970,11.378900)..controls (6.179690,10.988300) and (6.812500,10.988300)..(7.199220,11.378900)..controls (7.589840,11.765600) and (7.589840,12.398400)..(7.199220,12.785200)--cycle; + draw (6.496090,12.082000); + drawoptions(); + pickup pencircle scaled 0bp; + draw (-3,0)--(-3,18) withcolor if print : coefprint*white else: StyloTrois fi; + pickup pencircle scaled eppen; + ); + cray:=cray shifted((0,-9pt)); + cray +enddef; + +%%%%%% Fin Section Stylo %%%%%%%% + +%%%%%% Section Contrôle %%%%%%%%% +color colControle; +colControle:=OrangeConTrois; + +vardef AffichageStop= + path cadre; + cadre=(llcorner texto+(-eb,0)){dir-90}..{dir0}(llcorner texto+(0,-eb))-- + (lrcorner texto+(0,-eb)){dir0}..{dir90}(lrcorner texto+(eb,0))--(urcorner texto+(eb,0)){dir90}..{dir180}(urcorner texto+(0,eb))-- + (ulcorner texto+(0.625cm,0)+(eb,eb)){dir180}.. + {dir180}(ulcorner texto+(0.625cm,0))-- + (ulcorner texto+(0.375cm,0)){dir180}.. + {dir180}(ulcorner texto+(0.375cm,0)+(-eb,eb))-- + (ulcorner texto+(0,eb)){dir180}..{dir-90}(ulcorner texto+(-eb,0))--cycle; + picture TEXT; + TEXT=image( + fill cadre withcolor if print : coefprint*white else : if unknown colControle : LightOrange else : colControle fi fi; + draw texto; + draw cadre withcolor CoulLignes; + ); + TEXT +enddef; + +pair coindebutbloc[]; +numeric numblocrep; +numblocrep:=0; + +vardef Repeter(expr xa)= + LONG:=0; + save $; + numblocrep:=numblocrep+1; + picture $,texto; + texto=ColleBoxNew("répéter", if string xa : OvalNb(xa) else: xa fi,"fois"); +LongRep[numblocrep]:=abs(llcorner texto-lrcorner texto);%afin de conserver la longueur du"répéter..." +ColBloc:=OrangeConTrois; +$=AffichageControle(texto); +$ +enddef; + +vardef RepeterI= + LONG:=0; + save $; + numblocrep:=numblocrep+1; + picture $,texto; + texto=ColleBoxNew("répéter indéfiniment"); + LongRep[numblocrep]:=abs(llcorner texto-lrcorner texto);%afin de conserver la longueur du"répéter..." + ColBloc:=OrangeConTrois; + $=AffichageControle(texto); + $ +enddef; + +vardef RepeterJ(expr xa)= + LONG:=0; + save $; + numblocrep:=numblocrep+1; + picture $,texto; + if picture xa: + texto=ColleBoxNew("répéter jusqu'à ce que",xa); + LongRep[numblocrep]:=abs(llcorner texto-lrcorner texto);%afin de conserver la longueur du"répéter..." + ColBloc:=OrangeConTrois; + $=AffichageControle(texto); + else: + message("La commande -- RepeterJ -- n'admet qu'un argument de type picture."); + $=nullpicture; + fi; + $ +enddef; + +vardef FinBlocRepeter= + LONG:=0; + save $; + picture $,texto; + _coinprec:=_coinprec-(0.5cm,0); + drawoptions(); + texto=image( + labeloffset:=0; + label.lrt(LATEXSCRATCH("\hbox to"&decimal(LongRep[numblocrep])&"pt{\phantom{\barre fin du bloc}}"),if unknown _coinprec: (0,0) else:_coinprec fi); + labeloffset:=3; + ); +path cadre; +cadre=(coindebutbloc[numblocrep]+(0.125,0.125))-- + (coindebutbloc[numblocrep]+(0.0625+0.5cm+eb,0.125)){dir180}.. + {dir-90}(coindebutbloc[numblocrep]+(0.5cm,-eb))-- + (ulcorner texto+(0.5cm,eb)){dir-90}.. + {dir0}(ulcorner texto+(0.5cm+eb,0))-- + (ulcorner texto+(0.5cm+0.375cm,0)){dir0}..% + {dir0}(ulcorner texto+(0.5cm+0.375cm,0)+(eb,-eb))--% + (ulcorner texto+(0.5cm+0.625cm,0)+(eb,-eb)){dir0}..% + {dir0}(ulcorner texto+(0.5cm+0.625cm,0)+(2eb,0))--% + (urcorner texto+(-eb,0)){dir0}.. + {dir-90}(urcorner texto+(0,-eb))-- + (lrcorner texto+(0,eb)){dir-90}.. + {dir180}(lrcorner texto+(-eb,0))-- + (llcorner texto+(0.125+0.625cm,0)+(2eb,0)){dir180}.. + {dir180}(llcorner texto+(0.125+0.625cm,0)+(eb,-eb))-- + (llcorner texto+(0.125+0.375cm,0)+(eb,-eb)){dir180}.. + {dir180}(llcorner texto+(0.125+0.375cm,0))-- + (llcorner texto+(0.125,0)+(eb,0)){dir180}.. + {dir90}(llcorner texto+(0.125,0)+(0,eb))-- + cycle; +$=image( + fill cadre withcolor if print : coefprint*white else : if unknown colControle : LightOrange else : colControle fi fi; + draw cadre withcolor if print : coefprint*white else : if unknown colControle : LightOrange else : colControle fi fi; + AA:=ahangle; + ahangle:=90; + drawarrow (lrcorner texto+(-0.625cm,0.15cm)){dir-15}..{dir90}(urcorner texto+(-0.25cm,-0.1cm)) withpen pencircle scaled2bp if print=false : withcolor white fi; + ahangle:=AA; + draw (coindebutbloc[numblocrep]+(0.0625+0.5cm+eb,0.125)){dir180}.. + {dir-90}(coindebutbloc[numblocrep]+(0.5cm,-eb))-- + (ulcorner texto+(0.5cm,eb)){dir-90}.. + {dir0}(ulcorner texto+(0.5cm+eb,0))-- + (ulcorner texto+(0.5cm+0.375cm,0)){dir0}..% + {dir0}(ulcorner texto+(0.5cm+0.375cm,0)+(eb,-eb))--% + (ulcorner texto+(0.5cm+0.625cm,0)+(eb,-eb)){dir0}..% + {dir0}(ulcorner texto+(0.5cm+0.625cm,0)+(2eb,0))--% + (urcorner texto+(-eb,0)){dir0}.. + {dir-90}(urcorner texto+(0,-eb))-- + (lrcorner texto+(0,eb)){dir-90}.. + {dir180}(lrcorner texto+(-eb,0))-- + (llcorner texto+(0.125+0.625cm,0)+(2eb,0)){dir180}.. + {dir180}(llcorner texto+(0.125+0.625cm,0)+(eb,-eb))-- + (llcorner texto+(0.125+0.375cm,0)+(eb,-eb)){dir180}.. + {dir180}(llcorner texto+(0.125+0.375cm,0))-- + (llcorner texto+(0.125,0)+(eb,0)){dir180}.. + {dir90}(llcorner texto+(0.125,0)+(0,eb))--(coindebutbloc[numblocrep]+(0.125,0.125)) withcolor CoulLignes; + ); +_coinprec:=(llcorner $); +_coinprec:=_coinprec+(0,eb); +numblocrep:=numblocrep-1; +$ +enddef; + +vardef FinBlocRepeterI=FinBlocRepeter enddef; + +vardef Si(expr xa)= + LONG:=0; + save $; + numblocrep:=numblocrep+1; + picture $,texto; + if picture xa: + texto=ColleBoxNew("si\hbox to1em{}",xa,"alors"); + LongRep[numblocrep]:=abs(llcorner texto-lrcorner texto);%afin de conserver la longueur du"répéter..." + ColBloc:=OrangeConTrois; + $=AffichageControle(texto); + else: + message("La commande -- Si -- n'admet qu'un argument de type picture."); + $=nullpicture; + fi; + $ +enddef; + +vardef FinBlocSi= + LONG:=0; + save $; + picture $,texto; + _coinprec:=_coinprec-(0.5cm,0); + drawoptions(); + texto=image( + labeloffset:=0; + label.lrt(LATEXSCRATCH("\hbox to"&decimal(LongRep[numblocrep])&"pt{\phantom{\barre fin du bloc}}"),if unknown _coinprec: (0,0) else:_coinprec fi); + labeloffset:=3; + ); +path cadre; +if BlocStopAvant=false: + cadre=(coindebutbloc[numblocrep]+(0.125,0.125))-- + (coindebutbloc[numblocrep]+(0.0625+0.5cm+eb,0.125)){dir180}.. + {dir-90}(coindebutbloc[numblocrep]+(0.5cm,-eb))-- + (ulcorner texto+(0.5cm,eb)){dir-90}.. + {dir0}(ulcorner texto+(0.5cm+eb,0))-- + (ulcorner texto+(0.5cm+0.375cm,0)){dir0}..% + {dir0}(ulcorner texto+(0.5cm+0.375cm,0)+(eb,-eb))--% + (ulcorner texto+(0.5cm+0.625cm,0)+(eb,-eb)){dir0}..% + {dir0}(ulcorner texto+(0.5cm+0.625cm,0)+(2eb,0))--% + (urcorner texto+(-eb,0)){dir0}.. + {dir-90}(urcorner texto+(0,-eb))-- + (lrcorner texto+(0,eb)){dir-90}.. + {dir180}(lrcorner texto+(-eb,0))-- + (llcorner texto+(0.125+0.625cm,0)+(2eb,0)){dir180}.. + {dir180}(llcorner texto+(0.125+0.625cm,0)+(eb,-eb))-- + (llcorner texto+(0.125+0.375cm,0)+(eb,-eb)){dir180}.. + {dir180}(llcorner texto+(0.125+0.375cm,0))-- + (llcorner texto+(0.125,0)+(eb,0)){dir180}.. + {dir90}(llcorner texto+(0.125,0)+(0,eb))-- + cycle; +else: + cadre=(coindebutbloc[numblocrep]+(0.125,0.125))-- + (coindebutbloc[numblocrep]+(0.0625+0.5cm,0)+(eb,0.125)){dir180}.. + {dir-90}(coindebutbloc[numblocrep]+(0.5cm,0)+(0,-eb))-- + (ulcorner texto+(0.5cm,0)+(0,eb)){dir-90}.. + {dir0}(ulcorner texto+(0.5cm,0)+(eb,0))-- +% (ulcorner texto+(0.125+0.875cm,0)){dir0}.. +% {dir0}(ulcorner texto+(0.125+0.875cm,0)+(eb,-eb))-- +% (ulcorner texto+(0.125+1.125cm,0)+(eb,-eb)){dir0}.. +% {dir0}(ulcorner texto+(0.125+1.125cm,0)+(2eb,0))--%--% + (urcorner texto+(-eb,0)){dir0}.. + {dir-90}(urcorner texto+(0,-eb))-- + (lrcorner texto+(0,eb)){dir-90}.. + {dir180}(lrcorner texto+(-eb,0))-- + (llcorner texto+(0.125+0.625cm,0)+(2eb,0)){dir180}.. + {dir180}(llcorner texto+(0.125+0.625cm,0)+(eb,-eb))-- + (llcorner texto+(0.125+0.375cm,0)+(eb,-eb)){dir180}.. + {dir180}(llcorner texto+(0.125+0.375cm,0))-- + (llcorner texto+(0.125,0)+(eb,0)){dir180}.. + {dir90}(llcorner texto+(0.125,0)+(0,eb))-- + cycle; +fi; +$=image( + fill cadre withcolor if print : coefprint*white else : if unknown colControle : LightOrange else : colControle fi fi; + draw cadre withcolor if print : coefprint*white else : if unknown colControle : LightOrange else : colControle fi fi; + if BlocStopAvant=false: + draw (coindebutbloc[numblocrep]+(0.0625+0.5cm,0)+(eb,0)){dir180}.. + {dir-90}(coindebutbloc[numblocrep]+(0.5cm,0)+(0,-eb))-- + (ulcorner texto+(0.5cm,0)+(0,eb)){dir-90}.. + {dir0}(ulcorner texto+(0.5cm,0)+(eb,0))-- + (ulcorner texto+(0.125+0.875cm,0)){dir0}.. + {dir0}(ulcorner texto+(0.125+0.875cm,0)+(eb,-eb))-- + (ulcorner texto+(0.125+1.125cm,0)+(eb,-eb)){dir0}.. + {dir0}(ulcorner texto+(0.125+1.125cm,0)+(2eb,0))--%--% + (urcorner texto+(-eb,0)){dir0}.. + {dir-90}(urcorner texto+(0,-eb))-- + (lrcorner texto+(0,eb)){dir-90}.. + {dir180}(lrcorner texto+(-eb,0))-- + (llcorner texto+(0.125+0.625cm,0)+(2eb,0)){dir180}.. + {dir180}(llcorner texto+(0.125+0.625cm,0)+(eb,-eb))-- + (llcorner texto+(0.125+0.375cm,0)+(eb,-eb)){dir180}.. + {dir180}(llcorner texto+(0.125+0.375cm,0))-- + (llcorner texto+(0.125,0)+(eb,0)){dir180}.. + {dir90}(llcorner texto+(0.125,0)+(0,eb))-- + (coindebutbloc[numblocrep]+(0.125,0.125)) + withcolor CoulLignes; + else: + draw (coindebutbloc[numblocrep]+(0.0625+0.5cm,0)+(eb,0.125)){dir180}.. + {dir-90}(coindebutbloc[numblocrep]+(0.5cm,0)+(0,-eb))-- + (ulcorner texto+(0.5cm,0)+(0,eb)){dir-90}.. + {dir0}(ulcorner texto+(0.5cm,0)+(eb,0))-- + %(ulcorner texto+(0.125+0.875cm,0)){dir0}.. + %{dir0}(ulcorner texto+(0.125+0.875cm,0)+(eb,-eb))-- + %(ulcorner texto+(0.125+1.125cm,0)+(eb,-eb)){dir0}.. + %{dir0}(ulcorner texto+(0.125+1.125cm,0)+(2eb,0))--%--% + (urcorner texto+(-eb,0)){dir0}.. + {dir-90}(urcorner texto+(0,-eb))-- + (lrcorner texto+(0,eb)){dir-90}.. + {dir180}(lrcorner texto+(-eb,0))-- + (llcorner texto+(0.125+0.625cm,0)+(2eb,0)){dir180}.. + {dir180}(llcorner texto+(0.125+0.625cm,0)+(eb,-eb))-- + (llcorner texto+(0.125+0.375cm,0)+(eb,-eb)){dir180}.. + {dir180}(llcorner texto+(0.125+0.375cm,0))-- + (llcorner texto+(0.125,0)+(eb,0)){dir180}.. + {dir90}(llcorner texto+(0.125,0)+(0,eb))-- + (coindebutbloc[numblocrep]+(0.125,0.125)) + withcolor CoulLignes; + fi; + ); +_coinprec:=(llcorner $); +_coinprec:=_coinprec+(0,eb); +numblocrep:=numblocrep-1; +$ +enddef; + +boolean BlocStopAvant; +BlocStopAvant=false; + +vardef Sinon= + LONG:=0; + save $; + picture $,texto; + _coinprec:=_coinprec-(0.5cm,0); + drawoptions(); + texto=image( + labeloffset:=0; + label.lrt(LATEXSCRATCH("\, \hbox to"&decimal(LongRep[numblocrep])&"pt{\bfseries\barre sinon}"),if unknown _coinprec: (0,0) else:_coinprec fi) if print=false : withcolor blanc fi; + labeloffset:=3; + ); + path cadre; + if BlocStopAvant=false: + cadre=(llcorner texto+(0.125,0))-- + (coindebutbloc[numblocrep]+(0.125,0.125))-- + (coindebutbloc[numblocrep]+(0.0625+0.5cm,0)+(eb,0.125)){dir180}.. + {dir-90}(coindebutbloc[numblocrep]+(0.5cm,0)+(0,-eb))-- + (ulcorner texto+(0.5cm,0)+(0,eb)){dir-90}.. + {dir0}(ulcorner texto+(0.5cm,0)+(eb,0))-- + (ulcorner texto+(0.125+0.875cm,0)){dir0}.. + {dir0}(ulcorner texto+(0.125+0.875cm,0)+(eb,-eb))-- + (ulcorner texto+(0.125+1.125cm,0)+(eb,-eb)){dir0}.. + {dir0}(ulcorner texto+(0.125+1.125cm,0)+(2eb,0))--%--% + (urcorner texto+(-eb,0)){dir0}.. + {dir-90}(urcorner texto+(0,-eb))-- + (lrcorner texto+(0,eb)){dir-90}.. + {dir180}(lrcorner texto+(-eb,0))-- + (llcorner texto+(0.125+1.125cm,0)+(2eb,0)){dir180}.. + {dir180}(llcorner texto+(0.125+1.125cm,0)+(eb,-eb))-- + (llcorner texto+(0.125+0.875cm,0)+(eb,-eb)){dir180}.. + {dir180}(llcorner texto+(0.125+0.875cm,0))-- + cycle; + else: + cadre=(llcorner texto+(0.125,0))-- + (coindebutbloc[numblocrep]+(0.125,0.125))-- + (coindebutbloc[numblocrep]+(0.0625+0.5cm,0)+(eb,0.125)){dir180}.. + {dir-90}(coindebutbloc[numblocrep]+(0.5cm,0)+(0,-eb))-- + (ulcorner texto+(0.5cm,0)+(0,eb)){dir-90}.. + {dir0}(ulcorner texto+(0.5cm,0)+(eb,0))-- +% (ulcorner texto+(0.125+0.875cm,0)){dir0}.. +% {dir0}(ulcorner texto+(0.125+0.875cm,0)+(eb,-eb))-- +% (ulcorner texto+(0.125+1.125cm,0)+(eb,-eb)){dir0}.. +% {dir0}(ulcorner texto+(0.125+1.125cm,0)+(2eb,0))--%--% + (urcorner texto+(-eb,0)){dir0}.. + {dir-90}(urcorner texto+(0,-eb))-- + (lrcorner texto+(0,eb)){dir-90}.. + {dir180}(lrcorner texto+(-eb,0))-- + (llcorner texto+(0.125+1.125cm,0)+(2eb,0)){dir180}.. + {dir180}(llcorner texto+(0.125+1.125cm,0)+(eb,-eb))-- + (llcorner texto+(0.125+0.875cm,0)+(eb,-eb)){dir180}.. + {dir180}(llcorner texto+(0.125+0.875cm,0))-- + cycle; + fi; +$=image( + fill cadre withcolor if print=true : coefprint*white else : if unknown colControle : LightOrange else : colControle fi fi; + draw cadre withcolor if print=true : coefprint*white else : if unknown colControle : LightOrange else : colControle fi fi; + draw texto; + if BlocStopAvant=false: + draw (coindebutbloc[numblocrep]+(0.0625+0.5cm,0)+(eb,0.125)){dir180}.. + {dir-90}(coindebutbloc[numblocrep]+(0.5cm,0)+(0,-eb))-- + (ulcorner texto+(0.5cm,0)+(0,eb)){dir-90}.. + {dir0}(ulcorner texto+(0.5cm,0)+(eb,0))-- + (ulcorner texto+(0.125+0.875cm,0)){dir0}.. + {dir0}(ulcorner texto+(0.125+0.875cm,0)+(eb,-eb))-- + (ulcorner texto+(0.125+1.125cm,0)+(eb,-eb)){dir0}.. + {dir0}(ulcorner texto+(0.125+1.125cm,0)+(2eb,0))--%--% + (urcorner texto+(-eb,0)){dir0}.. + {dir-90}(urcorner texto+(0,-eb))-- + (lrcorner texto+(0,eb)){dir-90}.. + {dir180}(lrcorner texto+(-eb,0))-- + (llcorner texto+(0.125+1.125cm,0)+(2eb,0)){dir180}.. + {dir180}(llcorner texto+(0.125+1.125cm,0)+(eb,-eb))-- + (llcorner texto+(0.125+0.875cm,0)+(eb,-eb)){dir180}.. + {dir180}(llcorner texto+(0.125+0.875cm,0))-- + (llcorner texto+(0.125+0.5cm+eb,0)) + withcolor CoulLignes; + else: + draw (coindebutbloc[numblocrep]+(0.0625+0.5cm,0)+(eb,0.125)){dir180}.. + {dir-90}(coindebutbloc[numblocrep]+(0.5cm,0)+(0,-eb))-- + (ulcorner texto+(0.5cm,0)+(0,eb)){dir-90}.. + {dir0}(ulcorner texto+(0.5cm,0)+(eb,0))-- + %(ulcorner texto+(0.125+0.875cm,0)){dir0}.. + %{dir0}(ulcorner texto+(0.125+0.875cm,0)+(eb,-eb))-- + %(ulcorner texto+(0.125+1.125cm,0)+(eb,-eb)){dir0}.. + %{dir0}(ulcorner texto+(0.125+1.125cm,0)+(2eb,0))--%--% + (urcorner texto+(-eb,0)){dir0}.. + {dir-90}(urcorner texto+(0,-eb))-- + (lrcorner texto+(0,eb)){dir-90}.. + {dir180}(lrcorner texto+(-eb,0))-- + (llcorner texto+(0.125+1.125cm,0)+(2eb,0)){dir180}.. + {dir180}(llcorner texto+(0.125+1.125cm,0)+(eb,-eb))-- + (llcorner texto+(0.125+0.875cm,0)+(eb,-eb)){dir180}.. + {dir180}(llcorner texto+(0.125+0.875cm,0)) + withcolor CoulLignes; + fi; + draw (llcorner texto+(0.125,0))--(coindebutbloc[numblocrep]+(0.125,0.125)) withcolor CoulLignes; + ); + _coinprec:=(llcorner $)+(0.5cm,0); + _coinprec:=_coinprec+(0,eb); + coindebutbloc[numblocrep]:=(llcorner $)+(0,eb+0.125); + $ +enddef; + +vardef Attendre(expr nbpas)= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew("attendre",if string nbpas:OvalNb(nbpas) else: nbpas fi,"seconde(s)"); +ColBloc:=OrangeConTrois; +$=Affichage(texto); +$ +enddef; + +vardef AttendreJ(expr xa)= + LONG:=0; + save $; + picture $,texto; + if picture xa: + texto=ColleBoxNew("attendre jusqu'à ce que",xa); + ColBloc:=OrangeConTrois; + $=Affichage(texto); + else: + message("La commande -- AttendreJ -- n'admet qu'un argument de type picture."); + $=nullpicture; + fi; + $ +enddef; + +vardef Stop(expr nbpas)= + LONG:=0; + save $; + picture $,texto; + string TTm;%Pour sauvegarder le nbpas car en l'utilisant dans les if, il ne permet pas la concaténation... + TTm=if print:nbpas&"\hbox to1em{\barre}\blacktriangledown" else:"\color{white}"&nbpas&"\hbox to1em{\barre}\blacktriangledown"; + fi; + texto=image( + path ti; + ti=Box("stop"); + label(LATEXSCRATCH("\bfseries\barre stop"),center ti) if print=false : withcolor white fi;%_>ok + if picture nbpas: + picture ta; + ta=nbpas; + drawoptions(shifted (xpart((lrcorner ti)-(llcorner ta)+(eb,0)),ypart(center ti-center ta))); + draw ta; + drawoptions(); + else: + path ta; + ta=RecBox(TTm);% + drawoptions(shifted (xpart((lrcorner ti)-(llcorner ta)+(eb,0)),ypart(center ti-center ta))); + if print=false : fill ta withcolor ControleTrois fi; + draw ta withcolor 0.95white; + label(LATEXSCRATCH(TTm),center ta); + drawoptions(); + fi; + ); +$=AffichageStop shifted (if unknown _coinprec:(0,0) else :_coinprec fi - ulcorner AffichageStop); +_coinprec:=llcorner $; +_coinprec:=_coinprec;%+(0,eb); +_coincom:=1/2[lrcorner $,urcorner $]+(eb,0); +_coinnum:=(xpart(DebutListe+(-3*eb,0)),ypart(1/2[llcorner $,ulcorner $])); +if NumeroteLignes=true: + label(LATEXSCRATCH("\footnotesize"&decimal(Nblignes)&""),_coinnum); + Nblignes:=Nblignes+1; +fi; +$ +enddef; + +vardef CommencerClone= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew("quand je commence comme un clone"); + ColBloc:=ControleTrois; + $=AffichageED(texto); + $ +enddef; + +vardef CreerClone(expr nbpas)= + LONG:=0; + save $; + picture $,texto; + if string nbpas: + texto=ColleBoxNew("créer un clone de",OvalMenuControle(nbpas)); + ColBloc:=ControleTrois; + $=Affichage(texto); + else: + message("La commande -- CreerClone -- accepte un argument de type string."); + $=nullpicture; + fi; + $ +enddef; + +vardef SupprimerClone= + LONG:=0; + save $; + picture $,texto; + texto=image( + path ti; + ti=Box("supprimer ce clone"); + label(LATEXSCRATCH("\bfseries\barre supprimer ce clone"),center ti) if print=false : withcolor white fi;%_>ok + ); + $=AffichageStop shifted (if unknown _coinprec:(0,0) else :_coinprec fi - ulcorner AffichageStop); +_coinprec:=llcorner $; +_coinprec:=_coinprec+(0,eb); +_coincom:=1/2[lrcorner $,urcorner $]+(eb,0); +_coinnum:=(xpart(DebutListe+(-3*eb,0)),ypart(1/2[llcorner $,ulcorner $])); +if NumeroteLignes=true: + label(LATEXSCRATCH("\footnotesize"&decimal(Nblignes)&""),_coinnum); + Nblignes:=Nblignes+1; +fi; +$ +enddef; +%%fin Section Contrôle%%% + +%%%%%%%% Section Evenements %%%%% +vardef Drapeau= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew("quand",DrapeauImage shifted(-(80,707)),"est cliqué"); + ColBloc:=EvenementTrois; + $=AffichageED(texto); + $ +enddef; + +vardef QPresse(expr nbpas)= + LONG:=0; + save $; + picture $,texto; + if string nbpas: + texto=ColleBoxNew("quand la touche",RecEvenementMenu(nbpas),"est pressée"); + ColBloc:=EvenementTrois; + $=AffichageED(texto); + else: + message("La commande -- QPresse -- accepte un argument de type string."); + $=nullpicture; + fi; + $ +enddef; + +vardef QLutinPresse= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew("quand ce sprite est cliqué"); + ColBloc:=EvenementTrois; + $=AffichageED(texto); + $ +enddef; + +vardef QSpritePresse=QLutinPresse enddef; + +vardef QScenePressee= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew("quand la scène est cliquée"); + ColBloc:=EvenementTrois; + $=AffichageED(texto); + $ +enddef; + +vardef QBasculeAR(expr nbpas)= + LONG:=0; + save $; + picture $,texto; + if string nbpas: + texto=ColleBoxNew("quand l'arrière-plan bascule sur",RecEvenementMenu(nbpas)); + ColBloc:=EvenementTrois; + $=AffichageED(texto); + else: + message("La commande -- QBasculeAR -- accepte un argument de type string."); + $=nullpicture; + fi; + $ +enddef; + +vardef QVolumeSup(expr nbpas,xa)= + LONG:=0; + save $; + picture $,texto; + if string nbpas: + texto=ColleBoxNew("quand le",RecEvenementMenu(nbpas),"$>$",if string xa:OvalNb(xa) else: xa fi); + ColBloc:=EvenementTrois; + $=AffichageED(texto); +else: + message("La commande -- QVolumeSup -- accepte un premier argument de type string."); + $=nullpicture; +fi; +$ +enddef; + +vardef QRecevoirMessage(expr nbpas)= + LONG:=0; + save $; + picture $,texto; + if string nbpas: + texto=ColleBoxNew("quand je reçois",RecEvenementMenu(nbpas)); + ColBloc:=EvenementTrois; + $=AffichageED(texto); + else: + message("La commande -- QRecevoirMessage -- accepte un argument de type string."); + $=nullpicture; + fi; + $ +enddef; + +vardef EnvoyerMessage(expr nbpas)= + LONG:=0; + save $; + picture $,texto; + if string nbpas: + texto=ColleBoxNew("envoyer à tous",OvalMenuEvenement(nbpas)); + ColBloc:=EvenementTrois; + $=Affichage(texto); + else: + message("La commande -- EnvoyerMessage -- accepte un argument de type string."); + $=nullpicture; + fi; + $ +enddef; + +vardef EnvoyerMessageA(expr nbpas)= + LONG:=0; + save $; + picture $,texto; + if string nbpas: + texto=ColleBoxNew("envoyer à tous",OvalMenuEvenement(nbpas),"et attendre"); + ColBloc:=EvenementTrois; + $=Affichage(texto); + else: + message("La commande -- EnvoyerMessageA -- accepte un argument de type string."); + $=nullpicture; + fi; + $ +enddef; + +vardef DrapeauImage= + save $; picture $; + $=image( + linecap := butt; + linejoin := rounded; + if print = false: drawoptions(withcolor(76/255,191/255,86/255)) fi; + fill (72.000000,713.254028)--(72.000000,718.918030)--(72.507797,718.979980) + --(72.984398,719.026978)--(73.437500,719.054993)--(73.867203,719.070007) + --(74.273399,719.073975)--(74.660202,719.062988)--(75.023399,719.043030) + --(75.367203,719.012024)--(75.695297,718.968994)--(76.003899,718.918030) + --(76.300797,718.859009)--(76.578102,718.793030)--(76.847702,718.723022) + --(77.105499,718.648010)--(77.351601,718.570007)--(77.589798,718.484009) + --(77.820297,718.401978)--(78.042999,718.312988)--(78.234398,718.237976) + --(78.234398,706.906006)--(78.042999,706.979980)--(77.820297,707.065979) + --(77.589798,707.151978)--(77.351601,707.237976)--(77.105499,707.315979) + --(76.847702,707.390991)--(76.578102,707.460999)--(76.300797,707.526978) + --(76.003899,707.585999)--(75.695297,707.637024)--(75.367203,707.676025) + --(75.023399,707.710999)--(74.660202,707.729980)--(74.273399,707.742004) + --(73.867203,707.737976)--(73.437500,707.723022)--(72.984398,707.690979) + --(72.507797,707.648010)--(72.000000,707.585999)--cycle; +% drawoptions (withcolor (0,0.625,0)); + fill (78.246101,712.565979)--(78.261703,718.226990)--(78.476601,718.140991) + --(78.691399,718.059021)--(78.902298,717.976990)--(79.113297,717.895020) + --(79.328102,717.820007)--(79.546898,717.754028)--(79.765602,717.687988) + --(79.992203,717.632996)--(80.226601,717.585999)--(80.468803,717.543030) + --(80.718803,717.515991)--(80.980499,717.495972)--(81.253899,717.492004) + --(81.542999,717.495972)--(81.843803,717.515991)--(82.160202,717.546997) + --(82.492203,717.598022)--(82.847702,717.664001)--(83.218803,717.745972) + --(83.332001,717.773010)--(83.332001,706.440979)--(83.218803,706.414001) + --(82.847702,706.328003)--(82.492203,706.265991)--(82.160202,706.215027) + --(81.843803,706.179993)--(81.542999,706.164001)--(81.253899,706.156006) + --(80.980499,706.164001)--(80.718803,706.184021)--(80.468803,706.210999) + --(80.226601,706.250000)--(79.992203,706.301025)--(79.765602,706.354980) + --(79.546898,706.418030)--(79.328102,706.487976)--(79.113297,706.562988) + --(78.902298,706.645020)--(78.691399,706.723022)--(78.476601,706.809021) + --(78.234398,706.906006)--cycle; +% drawoptions (withcolor (0,0.625,0)); + fill (83.332001,712.109009)--(83.332001,717.773010)--(83.613297,717.843994) + --(84.031303,717.965027)--(84.468803,718.104980)--(84.933601,718.265991) + --(85.425797,718.448975)--(85.945297,718.651978)--(86.492203,718.882996) + --(87.070297,719.137024)--(87.679703,719.414001)--(88.324203,719.718994) + --(89.000000,720.054993)--(89.000000,708.718994)--(88.324203,708.387024) + --(87.679703,708.081970)--(87.070297,707.801025)--(86.492203,707.551025) + --(85.945297,707.320007)--(85.425797,707.117004)--(84.933601,706.934021) + --(84.468803,706.773010)--(84.031303,706.632996)--(83.613297,706.512024) + --(83.332001,706.440979)--cycle; +% drawoptions (withcolor (0,0.625,0)); +%pickup pencircle scaled 0.199253bp; + draw (72.000000,713.254028)--(72.000000,718.918030)--(72.507797,718.979980) + --(72.984398,719.026978)--(73.437500,719.054993)--(73.867203,719.070007) + --(74.273399,719.073975)--(74.660202,719.062988)--(75.023399,719.043030) + --(75.367203,719.012024)--(75.695297,718.968994)--(76.003899,718.918030) + --(76.300797,718.859009)--(76.578102,718.793030)--(76.847702,718.723022) + --(77.105499,718.648010)--(77.351601,718.570007)--(77.589798,718.484009) + --(77.820297,718.401978)--(78.042999,718.312988)--(78.261703,718.226990) + --(78.476601,718.140991)--(78.691399,718.059021)--(78.902298,717.976990) + --(79.113297,717.895020)--(79.328102,717.820007)--(79.546898,717.754028) + --(79.765602,717.687988)--(79.992203,717.632996)--(80.226601,717.585999) + --(80.468803,717.543030)--(80.718803,717.515991)--(80.980499,717.495972) + --(81.253899,717.492004)--(81.542999,717.495972)--(81.843803,717.515991) + --(82.160202,717.546997)--(82.492203,717.598022)--(82.847702,717.664001) + --(83.218803,717.745972)--(83.613297,717.843994)--(84.031303,717.965027) + --(84.468803,718.104980)--(84.933601,718.265991)--(85.425797,718.448975) + --(85.945297,718.651978)--(86.492203,718.882996)--(87.070297,719.137024) + --(87.679703,719.414001)--(88.324203,719.718994)--(89.000000,720.054993) + --(89.000000,708.718994)--(88.324203,708.387024)--(87.679703,708.081970) + --(87.070297,707.801025)--(86.492203,707.551025)--(85.945297,707.320007) + --(85.425797,707.117004)--(84.933601,706.934021)--(84.468803,706.773010) + --(84.031303,706.632996)--(83.613297,706.512024)--(83.218803,706.414001) + --(82.847702,706.328003)--(82.492203,706.265991)--(82.160202,706.215027) + --(81.843803,706.179993)--(81.542999,706.164001)--(81.253899,706.156006) + --(80.980499,706.164001)--(80.718803,706.184021)--(80.468803,706.210999) + --(80.226601,706.250000)--(79.992203,706.301025)--(79.765602,706.354980) + --(79.546898,706.418030)--(79.328102,706.487976)--(79.113297,706.562988) + --(78.902298,706.645020)--(78.691399,706.723022)--(78.476601,706.809021) + --(78.261703,706.895020)--(78.042999,706.979980)--(77.820297,707.065979) + --(77.589798,707.151978)--(77.351601,707.237976)--(77.105499,707.315979) + --(76.847702,707.390991)--(76.578102,707.460999)--(76.300797,707.526978) + --(76.003899,707.585999)--(75.695297,707.637024)--(75.367203,707.676025) + --(75.023399,707.710999)--(74.660202,707.729980)--(74.273399,707.742004) + --(73.867203,707.737976)--(73.437500,707.723022)--(72.984398,707.690979) + --(72.507797,707.648010)--(72.000000,707.585999)--cycle if print=false : withcolor (0,0.625,0) fi; + %pickup pencircle scaled 0.8bp; + draw (72.000000,699)--(72.000000,720); + drawoptions(); + ); + $:=$ rotatedabout((72.000000,699),-15); + $ +enddef; +%%Fin section Evenement%%% + +%%%% Section Bloc %%%% +vardef AffichageBlocDef= + path cadre; + cadre=(llcorner texto+(-eb,0)){dir-90}..{dir0}(llcorner texto+(0,-eb))-- + (llcorner texto+(0.375cm,0)+(-eb,-eb)){dir0}.. + {dir0}(llcorner texto+(0.375cm,0)+(0,-2eb))-- + (llcorner texto+(0.625cm,0)+(0,-2eb)){dir0}.. + {dir0}(llcorner texto+(0.625cm,0)+(eb,-eb))-- + (lrcorner texto+(0,-eb)){dir0}..{dir90}(lrcorner texto+(eb,0))-- + (urcorner texto+(eb,eb)){dir90}..{dir180}(urcorner texto+(0,2eb))-- + (ulcorner texto+(0,2eb)){dir180}.. + {dir-90}(ulcorner texto+(-eb,eb))-- + cycle; + picture TEXT; + TEXT=image( + fill cadre withcolor if print : coefprint*white else : BlocTrois fi;%if unknown colBloc : DarkPurple else: colBloc fi fi; + draw texto; + draw cadre withcolor CoulLignes; + ); + TEXT +enddef; + +vardef Bloc(text nomblocbloc)= + LONG:=0; + save $; + picture $,texto; + texto=image( + picture CBbloc; + CBbloc=ColleBoxNew(nomblocbloc); + draw CBbloc; + ); + ColBloc:=BlocTrois; + $=Affichage(texto); + $ +enddef; + +vardef NouveauBloc(text nbpasbloc)= + LONG:=0; + save $; + picture $,texto; + texto=image( + picture CB; + CB=ColleBoxNew("définir",BlocPuzzle(nbpasbloc)); + draw CB; + ); +$=AffichageBlocDef shifted (if unknown _coinprec:(0,0) else :_coinprec fi - ulcorner AffichageBlocDef); +_coinprec:=llcorner $; +_coinprec:=_coinprec+(0,eb); +_coincom:=1/2[lrcorner $,urcorner $]+(eb,0); +_coinnum:=(xpart(DebutListe+(-3*eb,0)),ypart(1/2[llcorner $,ulcorner $])); +if NumeroteLignes=true: + label(LATEXSCRATCH("\footnotesize"&decimal(Nblignes)&""),_coinnum); + Nblignes:=Nblignes+1; +fi; +$ +enddef; +%%%% Fin Section Bloc%%%% + +%%% Section Divers%%% +vardef CommandeVide(expr commande)= + LONG:=0; + save $; + picture $,texto,TEXT; + if string commande : + texto=image( + label.lrt(LATEXSCRATCH("\barre \hbox to"&commande&"cm{}"),if unknown _coinprec: (0,0) else:_coinprec fi); + ); +else: + texto=commande; +fi; +ColBloc:=white; +$=Affichage(texto); +$ +enddef; + +vardef LigneVide= + LONG:=0; + save $; + picture $,texto,TEXT; + texto=image( + label.lrt(LATEXSCRATCH("\barre \hbox to2cm{}"),if unknown _coinprec: (0,0) else:_coinprec fi); + ); +TEXT=image( + path cadre; + cadre=CADRE(texto); + unfill cadre; + %draw (urcorner texto+(0,eb))-- + % (ulcorner texto+(0.625cm,0)+(eb,eb)){dir180}.. + % {dir180}(ulcorner texto+(0.625cm,0))-- + % (ulcorner texto+(0.375cm,0)){dir180}.. + % {dir180}(ulcorner texto+(0.375cm,0)+(-eb,eb))-- + % (ulcorner texto+(0,eb)) withpen pencircle scaled 0; + ); +$=TEXT shifted (if unknown _coinprec:(0,0) else :_coinprec fi - ulcorner TEXT); +_coinprec:=llcorner $; +_coinprec:=_coinprec+(0,eb); +_coincom:=1/2[lrcorner $,urcorner $]+(eb,0); +_coinnum:=(xpart(DebutListe+(-3*eb,0)),ypart(1/2[llcorner $,ulcorner $])); +if NumeroteLignes=true: + label(LATEXSCRATCH("\footnotesize"&decimal(Nblignes)&""),_coinnum); + Nblignes:=Nblignes+1; +fi; +$ +enddef; + +vardef LigneVideVar(expr commande)= + LONG:=0; + save $; + picture $,texto,TEXT; + if string texto: + texto=image( + label.lrt(LATEXSCRATCH("\barre \hbox to2cm{}"),if unknown _coinprec: (0,0) else:_coinprec fi); + ); +else: + texto=commande; +fi; +TEXT=image( + path cadre; + cadre=(llcorner texto+(-eb,0))--(llcorner texto+(0,-eb))-- + (llcorner texto+(0.375cm,0)+(-eb,-eb))-- + (llcorner texto+(0.375cm,0)+(0,-2eb))-- + (llcorner texto+(0.625cm,0)+(0,-2eb))-- + (llcorner texto+(0.625cm,0)+(eb,-eb))-- + (lrcorner texto+(0,-eb))--(lrcorner texto+(eb,0))--(urcorner texto+(eb,0))--(urcorner texto+(0,eb))-- + (ulcorner texto+(0.625cm,0)+(eb,eb))-- + (ulcorner texto+(0.625cm,0))-- + (ulcorner texto+(0.375cm,0))-- + (ulcorner texto+(0.375cm,0)+(-eb,eb))-- + (ulcorner texto+(0,eb))--(ulcorner texto+(-eb,0))--cycle; + fill cadre withcolor white; +% draw (urcorner texto+(0,eb))-- +% (ulcorner texto+(0.625cm,0)+(eb,eb))-- +% (ulcorner texto+(0.625cm,0))-- +% (ulcorner texto+(0.375cm,0))-- +% (ulcorner texto+(0.375cm,0)+(-eb,eb))-- +% (ulcorner texto+(0,eb)) withpen pencircle scaled 0.05bp; + ); +$=TEXT shifted (if unknown _coinprec:(0,0) else :_coinprec fi - ulcorner TEXT); +_coinprec:=llcorner $; +_coinprec:=_coinprec+(0,eb); +_coincom:=1/2[lrcorner $,urcorner $]+(eb,0); +_coinnum:=(xpart(DebutListe+(-3*eb,0)),ypart(1/2[llcorner $,ulcorner $])); +if NumeroteLignes=true: + label(LATEXSCRATCH("\footnotesize"&decimal(Nblignes)&""),_coinnum); + Nblignes:=Nblignes+1; +fi; +$ +enddef; + +vardef LignePointilles= + LONG:=0; + save $; + picture $,texto,TEXT; + texto=image( + label.lrt(LATEXSCRATCH("\barre\Large \strut\ldots\hbox to1em{}"),if unknown _coinprec: (0,0) else:_coinprec fi); + ); +TEXT=image( + path cadre; + cadre=CADRE(texto); + fill cadre withcolor white; + draw %(urcorner texto+(0,eb))-- + (ulcorner texto+(0.625cm,0)+(eb,eb)){dir180}.. + {dir180}(ulcorner texto+(0.625cm,0))-- + (ulcorner texto+(0.375cm,0)){dir180}.. + {dir180}(ulcorner texto+(0.375cm,0)+(-eb,eb)) + %--(ulcorner texto+(0,eb)) + withpen pencircle scaled 0.01; + draw texto; + ); +$=TEXT shifted (if unknown _coinprec:(0,0) else :_coinprec fi - ulcorner TEXT); +_coinprec:=llcorner $; +_coinprec:=_coinprec+(0,eb); +_coincom:=1/2[lrcorner $,urcorner $]+(eb,0); +_coinnum:=(xpart(DebutListe+(-3*eb,0)),ypart(1/2[llcorner $,ulcorner $])); +if NumeroteLignes=true: + label(LATEXSCRATCH("\footnotesize"&decimal(Nblignes)&""),_coinnum); + Nblignes:=Nblignes+1; +fi; +$ +enddef; + +vardef Commentaires(expr commande)= + LONG:=0; + save $; + picture $,texto,TEXT; + texto=image( + label.lrt(LATEXSCRATCH("\barre "& commande &""),if unknown _coinprec: (0,0) else:_coinprec fi) withcolor 0.5*white; + ); +TEXT=image( + path cadre; + cadre=CADRE(texto); + fill cadre withcolor white; + draw texto; + ); +$=TEXT shifted (if unknown _coinprec:(0,0) else :_coinprec fi - ulcorner TEXT); +_coinprec:=llcorner $; +_coinprec:=_coinprec+(0,eb); +$ +enddef; + +color colcom; +colcom=0.5white; + +vardef CommentairesLigne(expr commande)= + LONG:=0; + save $; + picture $,texto,TEXT; + TEXT=image( + label.rt(LATEXSCRATCH(commande), _coincom) withcolor colcom; + ); +$=TEXT shifted (_coincom - 1/2[llcorner TEXT,ulcorner TEXT]); +$ +enddef; + +vardef BlocGris(expr ar)= + LONG:=0; + save $; picture $; + path ta; string TTm; + TTm=ar&"\barre"; + ta=OvalMiniBox(TTm); + $=image( + fill ta withcolor 0.975white; + draw ta withcolor 0.85white; + label(LATEXSCRATCH(TTm),center ta) if print=false : withcolor blanc fi; + ); +$ +enddef; + +vardef BlocGrisMulti(text argris)= + LONG:=0; + save $; picture $; + path ta; picture TTm; + TTm=ColleBox(argris); + ta=OvalMiniBox(TTm); + $=image( + fill ta withcolor grisBloc; + draw TTm; +% label(LALATEXSCRATCH(TTm),center ta) if print=false : withcolor blanc fi; + ); +$ +enddef; + +boolean BlocE; +BlocE:=false; + +vardef BlocUser(expr colblocuser)(text textbloc)= + LONG:=0; + save $; + picture $; + save TA; path TA; picture BUTB; picture texto; picture TEXT; + BUTB=ColleBoxNew(textbloc); + TA=Box(BUTB); + texto=image( + draw BUTB; + ); + ColBloc:=colblocuser; + if BlocE=false: + $=Affichage(texto); + else: + $=AffichageED(texto); + fi; + $ +enddef; + +vardef BlocCouleur(expr colblocuser)= + LONG:=0; + save $; + picture $,texto; + texto=image( + label.lrt(LATEXSCRATCH("\barre \hbox to4cm{}"),if unknown _coinprec: (0,0) else:_coinprec fi); + ); +ColBloc:=colblocuser; +$=Affichage(texto); +$ +enddef; +%% fin Section Divers %%% + +%% Section Capteur %%%% +vardef Demander(expr nbpas)= + LONG:=0; + save Dem; + picture Dem,texto; + if string nbpas: + texto=ColleBoxNew("demander",OvalNb(nbpas),"et attendre"); + ColBloc:=CapteurTrois; + Dem=Affichage(texto); + else: + message("La commande -- Demander -- admet un argument de type string."); + Dem=nullpicture; + fi; + Dem +enddef; + +vardef ReinitChrono= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew("réinitialiser le chronomètre"); + ColBloc:=CapteurTrois; + $=Affichage(texto); + $ +enddef; + +vardef MettreGlissement(expr nbpas)= + LONG:=0; + save $; + picture $,texto; + if string nbpas: + texto=ColleBoxNew("mettre mode de glissement à",RecMenuCap(nbpas)); + ColBloc:=CapteurTrois; + $=Affichage(texto); + else: + message("La commande -- MettreGlissement -- admet un argument de type string."); + $=nullpicture; + fi; + $ +enddef; + +%video + +vardef CameraImage= + LONG:=0; + save $; + picture $; + $=image( + pair A,B,C,D,E,F; + A=(0,0); + B-A=(10,0); + C-B=(0,10); + D-C=A-B; + E-B=(4,1.5); + F-C=(4,-1.5); + numeric EB; + EB=2pt; + path camera; + camera=(A+(EB,0))--(B+(-EB,0)){dir0}..{dir90}(B+(0,EB))--2/5[B,C]--E--F--3/5[B,C]--(C+(0,-EB)){dir90}..{dir-180}(C+(-EB,0))--(D+(EB,0)){dir180}..{dir-90}(D+(0,-EB))--(A+(0,EB)){dir-90}..{dir0}cycle; + fill camera withcolor (77,77,77)/255; + draw camera withcolor (77,77,77)*0.95/255; + path cc; + cc=fullcircle scaled 6; + color coul[]; + if print: + coul0:=0.9white; + coul1:=0.933white; + coul2:=0.966white; + coul3:=white; + else: + coul0=(75,205,169)/255; + coul1=(16,230,212)/255; + coul2=(224,247,241)/255; + coul3=(1,1,1); + fi; + for k=0 upto 3: + fill (cc shifted(B+(10,3*k))) withcolor coul[k]; + draw (cc shifted(B+(10,3*k))) withcolor 0.95*coul[k]; + endfor; + draw ((-3,0)--(-3,18)) withcolor if print : coefprint*white else: StyloTrois fi; + pickup pencircle scaled eppen; + ); + $:=$ scaled 0.8; + $ +enddef; + +vardef ImageCamera= + save titi; + picture titi; + titi=image( + draw CameraImage shifted(-12,-5); + draw (((0,0)--(0,18pt)) shifted(9,-9)) withpen pencircle scaled 1bp withcolor if print: 0.5*coefprint*white else: (69/255,168/255,140/255) fi; + ); + titi +enddef; + +vardef ActiverVideo(expr nbpas)= + LONG:=0; + save $; + picture $,texto; + if string nbpas: + texto=ColleBoxNew(ImageCamera,"vidéo",OvalStylo(nbpas)); + ColBloc:=StyloTrois; + $=Affichage(texto); + else: + message("La commande -- ActiverVideo -- admet un argument de type string."); + $=nullpicture; + fi; + $ +enddef; + +vardef TransparenceVideo(expr nbpas)= + LONG:=0; + save $; + picture $,texto; + if string nbpas: + texto=ColleBoxNew(ImageCamera,"mettre la transparence vidéo sur",OvalNb(nbpas)); + ColBloc:=StyloTrois; + $=Affichage(texto); + else: + message("La commande -- TransparenceVideo -- admet un argument de type string."); + $=nullpicture; + fi; + $ +enddef; + +vardef QuandMV(expr nbpas)= + LONG:=0; + save $; + picture $,texto; + if string nbpas: + texto=ColleBoxNew(ImageCamera,"quand mouvement vidéo $>$",OvalNb(nbpas)); + ColBloc:=StyloTrois; + $=AffichageED(texto); + else: + message("La commande -- QuandMV -- admet un argument de type string."); + $=nullpicture; + fi; + $ +enddef; + +vardef VideoSur(expr nbpas,xa)= + LONG:=0; + save $; + picture $,texto; + if (string nbpas) and (string xa): + texto=ColleBoxNew(ImageCamera,"vidéo",OvalStylo(nbpas),"sur",OvalStylo(xa)); + %ColBloc:=StyloTrois; + path ta; + ta=OvalBox(texto); + $=image( + fill ta withcolor if print: coefprint*white else: StyloTrois fi; + draw ta withcolor CoulLignes; + %label(LATEXSCRATCH(TTm),center ta) if print=false : withcolor blanc fi; + draw texto; + ); + else: + message("La commande -- VideoSur -- admet deux arguments de type string."); + $=nullpicture; + fi; + $ +enddef; + +%% fin Section Capteur %%% + +%%% Section Variables %%% +vardef MettreVar(expr nbpas,xa)= + LONG:=0; + save MV; + picture MV,texto; + if string nbpas : + texto=ColleBoxNew("mettre",RecMenuVar(nbpas),"à",if string xa:OvalNb(xa) else: xa fi); + ColBloc:=OrangeTrois; + MV=Affichage(texto); + else: + message("La commande -- MettreVar -- admet un premier paramètre de type string."); + MV=nullpicture; + fi; + MV +enddef; + +vardef AjouterVar(expr nbpas,xa)= + LONG:=0; + save $; + picture $,texto; + if string xa : + texto=ColleBoxNew("ajouter",if string nbpas:OvalNb(nbpas) else: nbpas fi,"à",RecMenuVar(xa)); + ColBloc:=OrangeTrois; + $=Affichage(texto); +else: + message("La commande -- AjouterVar -- admet un deuxième paramètre de type string."); + $=nullpicture; + fi; + $ +enddef; + +vardef MontrerVar(expr nbpas)= + LONG:=0; + save $; + picture $,texto; + if string nbpas : + texto=ColleBoxNew("montrer la variable",RecMenuVar(nbpas)); + ColBloc:=OrangeTrois; + $=Affichage(texto); + else: + message("La commande -- MontrerVar -- admet un premier paramètre de type string."); + $=nullpicture; + fi; + $ +enddef; + +vardef CacherVar(expr nbpas)= + LONG:=0; + save $; + picture $,texto; + if string nbpas : + texto=ColleBoxNew("cacher la variable",RecMenuVar(nbpas)); + ColBloc:=OrangeTrois; + $=Affichage(texto); + else: + message("La commande -- CacherVar -- admet un premier paramètre de type string."); + $=nullpicture; + fi; + $ +enddef; + +%Liste +vardef AjouterListe(expr nbpas,xa)= + LONG:=0; + save $; + picture $,texto; + if string xa : + texto=ColleBoxNew("ajouter",if string nbpas:OvalNb(nbpas) else: nbpas fi,"à",RecMenuList(xa)); + ColBloc:=OrangeListTrois; + $=Affichage(texto); +else: + message("La commande -- AjouterListe -- admet un deuxième paramètre de type string."); + $=nullpicture; + fi; + $ +enddef; + +vardef SupprimerListe(expr nbpas,xa)= + LONG:=0; + save $; + picture $,texto; + if string xa : + texto=ColleBoxNew("supprimer l'élément",if string nbpas:OvalNb(nbpas) else: nbpas fi,"de",RecMenuList(xa)); + ColBloc:=OrangeListTrois; + $=Affichage(texto); +else: + message("La commande -- SupprimerListe -- admet un deuxième paramètre de type string."); + $=nullpicture; + fi; + $ +enddef; + +vardef SupprimerListeAll(expr nbpas)= + LONG:=0; + save $; + picture $,texto; + if string nbpas : + texto=ColleBoxNew("supprimer tous les éléments de la liste",RecMenuList(nbpas)); + ColBloc:=OrangeListTrois; + $=Affichage(texto); +else: + message("La commande -- SupprimerListe -- admet un deuxième paramètre de type string."); + $=nullpicture; +fi; +$ +enddef; + +vardef InsererListe(expr xa,nbpas,ya)= + LONG:=0; + save $; + picture $,texto; + if string ya : + texto=ColleBoxNew("insérer",if string xa:OvalNb(xa) else: xa fi,"en position",if string nbpas:OvalNb(nbpas) else: nbpas fi,"de",RecMenuList(ya)); + ColBloc:=OrangeListTrois; + $=Affichage(texto); + else: + message("La commande -- InsererListe -- admet un troisième paramètre de type string."); + $=nullpicture; + fi; + $ +enddef; + +vardef RemplacerListe(expr xa,nbpas,ya)= + LONG:=0; + save $; + picture $,texto; + if string nbpas : + texto=ColleBoxNew("remplacer l'élément",if string xa:OvalNb(xa) else: xa fi,"de la liste",RecMenuList(nbpas),"par",if string ya:OvalNb(ya) else: ya fi); + ColBloc:=OrangeListTrois; + $=Affichage(texto); +else: + message("La commande -- RemplacerListe -- admet un deuxième paramètre de type string."); + $=nullpicture; +fi; +$ +enddef; + +vardef MontrerListe(expr xa)= + LONG:=0; + save $; + picture $,texto; + if string xa : + texto=ColleBoxNew("montrer la liste",RecMenuList(xa)); + ColBloc:=OrangeListTrois; + $=Affichage(texto); + else: + message("La commande -- MontrerListe -- admet un paramètre de type string."); + $=nullpicture; + fi; + $ +enddef; + +vardef CacherListe(expr xa)= + LONG:=0; + save $; + picture $,texto; + if string xa : + texto=ColleBoxNew("cacher la liste",RecMenuList(xa)); + ColBloc:=OrangeListTrois; + $=Affichage(texto); + else: + message("La commande -- CacherListe -- admet un paramètre de type string."); + $=nullpicture; + fi; + $ +enddef; + +%%% Section Operateur %%% + +vardef OpAdd(expr pasun,pasdeux)= + save Oop; picture Oop; + save TAao; path TAao; + save LOPop; picture LOPop; + LOPop=ColleBoxNew(if string pasun : OvalNb(pasun) else: pasun fi,"$+$",if string pasdeux : OvalNb(pasdeux) else: pasdeux fi); + TAao=OvalBox(LOPop); + Oop=image( + fill TAao if print=false : withcolor FondOvalOp else : withcolor coefprint*white fi; + draw LOPop; + draw TAao if print=false : withcolor coefprint*white fi; + ); + Oop:=Oop shifted(-center Oop); + Oop +enddef; + +vardef OpSous(expr pasun,pasdeux)= + save Oop; picture Oop; + save TAao; path TAao; + save LOPop; picture LOPop; + LOPop=ColleBoxNew(if string pasun : OvalNb(pasun) else: pasun fi,"$-$",if string pasdeux : OvalNb(pasdeux) else: pasdeux fi); + TAao=OvalBox(LOPop); + Oop=image( + fill TAao if print=false : withcolor FondOvalOp else : withcolor coefprint*white fi; + draw LOPop; + draw TAao if print=false : withcolor coefprint*white fi; + ); + Oop:=Oop shifted(-center Oop); + Oop +enddef; + +vardef OpMul(expr pasun,pasdeux)= + save Oop; picture Oop; + save TAao; path TAao; + save LOPop; picture LOPop; + LOPop=ColleBoxNew(if string pasun : OvalNb(pasun) else: pasun fi,"$\times$",if string pasdeux : OvalNb(pasdeux) else: pasdeux fi); + TAao=OvalBox(LOPop); + Oop=image( + fill TAao if print=false : withcolor FondOvalOp else : withcolor coefprint*white fi; + draw LOPop; + draw TAao if print=false : withcolor coefprint*white fi; + ); + Oop:=Oop shifted(-center Oop); + Oop +enddef; + +vardef OpDiv(expr pasun,pasdeux)= + save Oop; picture Oop; + save TAao; path TAao; + save LOPop; picture LOPop; + LOPop=ColleBoxNew(if string pasun : OvalNb(pasun) else: pasun fi,"$\div$",if string pasdeux : OvalNb(pasdeux) else: pasdeux fi); + TAao=OvalBox(LOPop); + Oop=image( + fill TAao if print=false : withcolor FondOvalOp else : withcolor coefprint*white fi; + draw LOPop; + draw TAao if print=false : withcolor coefprint*white fi; + ); + Oop:=Oop shifted(-center Oop); + Oop +enddef; + +vardef OpAlea(expr pasun,pasdeux)= + save Oop; picture Oop; + save TAao; path TAao; + save LOPop; picture LOPop; + LOPop=ColleBoxNew("nombre aléatoire entre",if string pasun : OvalNb(pasun) else: pasun fi,"et",if string pasdeux : OvalNb(pasdeux) else: pasdeux fi); + TAao=OvalBox(LOPop); + Oop=image( + fill TAao if print=false : withcolor FondOvalOp else : withcolor coefprint*white fi; + draw LOPop; + draw TAao if print=false : withcolor coefprint*white fi; + ); + Oop:=Oop shifted(-center Oop); + Oop +enddef; + +vardef OpRegrouper(expr pasun,pasdeux)= + save Oop; picture Oop; + save TAao; path TAao; + save LOPop; picture LOPop; + LOPop=ColleBoxNew("regrouper",if string pasun : OvalNb(pasun) else: pasun fi,"et",if string pasdeux : OvalNb(pasdeux) else: pasdeux fi); + TAao=OvalBox(LOPop); + Oop=image( + fill TAao if print=false : withcolor FondOvalOp else : withcolor coefprint*white fi; + draw LOPop; + draw TAao if print=false : withcolor coefprint*white fi; + ); + Oop:=Oop shifted(-center Oop); + Oop +enddef; + +vardef OpLettre(expr pasun,pasdeux)= + save Oop; picture Oop; + save TAao; path TAao; + save LOPop; picture LOPop; + LOPop=ColleBoxNew("lettre",if string pasun : OvalNb(pasun) else: pasun fi,"de",if string pasdeux : OvalNb(pasdeux) else: pasdeux fi); + TAao=OvalBox(LOPop); + Oop=image( + fill TAao if print=false : withcolor FondOvalOp else : withcolor coefprint*white fi; + draw LOPop; + draw TAao if print=false : withcolor coefprint*white fi; + ); + Oop:=Oop shifted(-center Oop); + Oop +enddef; + +vardef OpLongueur(expr pasun)= + save Oop; picture Oop; + save TAao; path TAao; + save LOPop; picture LOPop; + LOPop=ColleBoxNew("longueur de",if string pasun : OvalNb(pasun) else: pasun fi); + TAao=OvalBox(LOPop); + Oop=image( + fill TAao if print=false : withcolor FondOvalOp else : withcolor coefprint*white fi; + draw LOPop; + draw TAao if print=false : withcolor coefprint*white fi; + ); + Oop:=Oop shifted(-center Oop); + Oop +enddef; + +vardef OpArrondi(expr pasun)= + save Oop; picture Oop; + save TAao; path TAao; + save LOPop; picture LOPop; + LOPop=ColleBoxNew("arrondi de",if string pasun : OvalNb(pasun) else: pasun fi); + TAao=OvalBox(LOPop); + Oop=image( + fill TAao if print=false : withcolor FondOvalOp else : withcolor coefprint*white fi; + draw LOPop; + draw TAao if print=false : withcolor coefprint*white fi; + ); + Oop:=Oop shifted(-center Oop); + Oop +enddef; + +vardef OpFonction(expr pasun,pasdeux)= + save Oop; picture Oop; + save TAao; path TAao; + save LOPop; picture LOPop; + LOPop=ColleBoxNew(RecMenuOp(pasun),"de",if string pasdeux : OvalNb(pasdeux) else: pasdeux fi); + TAao=OvalBox(LOPop); + Oop=image( + fill TAao if print=false : withcolor FondOvalOp else : withcolor coefprint*white fi; + draw LOPop; + draw TAao if print=false : withcolor coefprint*white fi; + ); + Oop:=Oop shifted(-center Oop); + Oop +enddef; + +vardef TestOpSup(expr pasun, pasdeux)= + save $; picture $; + save TAa; path TAa; + save LTa; picture LTa; + LTa=ColleBoxNew(if string pasun : OvalNb(pasun) else: pasun fi,"$>$",if string pasdeux : OvalNb(pasdeux) else: pasdeux fi); + TAa=DiamondBox(LTa); + $=image( + fill TAa if print=false : withcolor FondOvalOp else : withcolor coefprint*white fi; + draw LTa; + draw TAa if print=false : withcolor coefprint*white fi; + ); + $:=$ shifted(-center $); + $ +enddef; + +vardef TestOpInf(expr pasun, pasdeux)= + save $; picture $; + save TAa; path TAa; + save LTa; picture LTa; + LTa=ColleBoxNew(if string pasun : OvalNb(pasun) else: pasun fi,"$<$",if string pasdeux : OvalNb(pasdeux) else: pasdeux fi); + TAa=DiamondBox(LTa); + $=image( + fill TAa if print=false : withcolor FondOvalOp else : withcolor coefprint*white fi; + draw LTa; + draw TAa if print=false : withcolor coefprint*white fi; + ); + $:=$ shifted(-center $); + $ +enddef; + +vardef TestOpEgal(expr pasun, pasdeux)= + save $; picture $; + save TAa; path TAa; + save LTa; picture LTa; + LTa=ColleBoxNew(if string pasun : OvalNb(pasun) else: pasun fi,"$=$",if string pasdeux : OvalNb(pasdeux) else: pasdeux fi); + TAa=DiamondBox(LTa); + $=image( + fill TAa if print=false : withcolor FondOvalOp else : withcolor coefprint*white fi; + draw LTa; + draw TAa if print=false : withcolor coefprint*white fi; + ); + $:=$ shifted(-center $); + $ +enddef; + +vardef TestOpEt(expr pasun, pasdeux)= + save $; picture $; + save TAa; path TAa; + save LTa; picture LTa; + LTa=ColleBoxNew(if string pasun : OvalNb(pasun) else: pasun fi,"et",if string pasdeux : OvalNb(pasdeux) else: pasdeux fi); + TAa=DiamondBox(LTa); + $=image( + fill TAa if print=false : withcolor FondOvalOp else : withcolor coefprint*white fi; + draw LTa; + draw TAa if print=false : withcolor coefprint*white fi; + ); + $:=$ shifted(-center $); + $ +enddef; + +vardef TestOpOu(expr pasun, pasdeux)= + save $; picture $; + save TAa; path TAa; + save LTa; picture LTa; + LTa=ColleBoxNew(if string pasun : OvalNb(pasun) else: pasun fi,"ou",if string pasdeux : OvalNb(pasdeux) else: pasdeux fi); + TAa=DiamondBox(LTa); + $=image( + fill TAa if print=false : withcolor FondOvalOp else : withcolor coefprint*white fi; + draw LTa; + draw TAa if print=false : withcolor coefprint*white fi; + ); + $:=$ shifted(-center $); + $ +enddef; + +vardef TestOpNon(expr pasun)= + save $; picture $; + save TAa; path TAa; + save LTa; picture LTa; + LTa=ColleBoxNew("non",if string pasun : OvalNb(pasun) else: pasun fi); + TAa=DiamondBox(LTa); + $=image( + fill TAa if print=false : withcolor FondOvalOp else : withcolor coefprint*white fi; + draw LTa; + draw TAa if print=false : withcolor coefprint*white fi; + ); + $:=$ shifted(-center $); + $ +enddef; + +vardef TestOpContient(expr pasun,pasdeux)= + save $; picture $; + save TAa; path TAa; + save LTa; picture LTa; + LTa=ColleBoxNew(if string pasun : OvalNb(pasun) else: pasun fi,"contient",if string pasun : OvalNb(pasdeux) else: pasun fi,"?"); + TAa=DiamondBox(LTa); + $=image( + fill TAa if print=false : withcolor FondOvalOp else : withcolor coefprint*white fi; + draw LTa; + draw TAa if print=false : withcolor coefprint*white fi; + ); + $:=$ shifted(-center $); + $ +enddef; + +vardef AppCostume(expr pasun)= + save $; picture $; + save TAa; path TAa; + save LTa; picture LTa; + LTa=ColleBoxNew(RecMenuApp(pasun),"du costume"); + TAa=OvalBox(LTa); + $=image( + fill TAa if print=false : withcolor VioletAppTrois else : withcolor coefprint*white fi; + draw LTa; + draw TAa if print=false : withcolor coefprint*white fi; + ); + $:=$ shifted(-center $); + $ +enddef; + +vardef AppAP(expr pasun)= + save $; picture $; + save TAa; path TAa; + save LTa; picture LTa; + LTa=ColleBoxNew(RecMenuApp(pasun),"de l'arrière-plan"); + TAa=OvalBox(LTa); + $=image( + fill TAa if print=false : withcolor VioletAppTrois else : withcolor coefprint*white fi; + draw LTa; + draw TAa if print=false : withcolor coefprint*white fi; + ); + $:=$ shifted(-center $); + $ +enddef; + +vardef CapDistance(expr pasun)= + save $; picture $; + save TAa; path TAa; + save LTa; picture LTa; + LTa=ColleBoxNew("distance de",OvalCapMenu(pasun)); + TAa=OvalBox(LTa); + $=image( + fill TAa if print=false : withcolor CapteurTrois else : withcolor coefprint*white fi; + draw LTa; + draw TAa if print=false : withcolor coefprint*white fi; + ); + $:=$ shifted(-center $); + $ +enddef; + +vardef CapTemps(expr pasun)= + save $; picture $; + save TAa; path TAa; + save LTa; picture LTa; + LTa=ColleBoxNew(RecMenuCap(pasun),"actuelle"); + TAa=OvalBox(LTa); + $=image( + fill TAa if print=false : withcolor CapteurTrois else : withcolor coefprint*white fi; + draw LTa; + draw TAa if print=false : withcolor coefprint*white fi; + ); + $:=$ shifted(-center $); + $ +enddef; + +vardef CapNumero(expr pasun,pasdeux)= + save $; picture $; + save TAa; path TAa; + save LTa; picture LTa; + LTa=ColleBoxNew(RecMenuCap(pasun),"de",OvalCapMenu(pasdeux)); + TAa=OvalBox(LTa); + $=image( + fill TAa if print=false : withcolor CapteurTrois else : withcolor coefprint*white fi; + draw LTa; + draw TAa if print=false : withcolor coefprint*white fi; + ); + $:=$ shifted(-center $); + $ +enddef; + +vardef TestCapToucheObjet(expr pasun)= + save $; picture $; + save TAa; path TAa; + save LTa; picture LTa; + LTa=ColleBoxNew("touche le",OvalCapMenu(pasun),"?"); + TAa=DiamondBox(LTa); + $=image( + fill TAa if print=false : withcolor CapteurTrois else : withcolor coefprint*white fi; + draw LTa; + draw TAa if print=false : withcolor coefprint*white fi; + ); + $:=$ shifted(-center $); + $ +enddef; + +vardef TestCapCouleur(expr pasun)= + save $; picture $; + save TAa; path TAa; + save LTa; picture LTa; + LTa=ColleBoxNew("couleur",OvalCouleur(redpart(pasun),greenpart(pasun),bluepart(pasun)),"touchée ?"); + TAa=DiamondBox(LTa); + $=image( + fill TAa if print=false : withcolor CapteurTrois else : withcolor coefprint*white fi; + draw LTa; + draw TAa if print=false : withcolor coefprint*white fi; + ); + $:=$ shifted(-center $); + $ +enddef; + +vardef TestCapCouleurs(expr pasun,pasdeux)= + save $; picture $; + save TAa; path TAa; + save LTa; picture LTa; + LTa=ColleBoxNew("couleur",OvalCouleur(redpart(pasun),greenpart(pasun),bluepart(pasun)),"touché",OvalCouleur(redpart(pasdeux),greenpart(pasdeux),bluepart(pasdeux)),"?"); + TAa=DiamondBox(LTa); + $=image( + fill TAa if print=false : withcolor CapteurTrois else : withcolor coefprint*white fi; + draw LTa; + draw TAa if print=false : withcolor coefprint*white fi; + ); + $:=$ shifted(-center $); + $ +enddef; + +vardef TestCapTouche(expr pasun)= + save $; picture $; + save TAa; path TAa; + save LTa; picture LTa; + LTa=ColleBoxNew("touche",OvalMenuCap(pasun),"pressée ?"); + TAa=DiamondBox(LTa); + $=image( + fill TAa if print=false : withcolor CapteurTrois else : withcolor coefprint*white fi; + draw LTa; + draw TAa if print=false : withcolor coefprint*white fi; + ); + $:=$ shifted(-center $); + $ +enddef; + +vardef TestCapSouris= + save $; picture $; + save TAa; path TAa; + save LTa; picture LTa; + LTa=ColleBoxNew("souris pressée ?"); + TAa=DiamondBox(LTa); + $=image( + fill TAa if print=false : withcolor CapteurTrois else : withcolor coefprint*white fi; + draw LTa; + draw TAa if print=false : withcolor coefprint*white fi; + ); + $:=$ shifted(-center $); + $ +enddef; + +vardef TestListeContient(expr nbpas,nbbas)= + save $; picture $; + save TAa; path TAa; + save LTa; picture LTa; + LTa=ColleBoxNew(RecMenuList(nbpas),"contient",if string nbbas:OvalNb(nbbas) else: nbbas fi); + TAa=DiamondBox(LTa); + $=image( + fill TAa if print=false : withcolor OrangeListTrois else : withcolor coefprint*white fi; + draw LTa; + draw TAa if print=false : withcolor coefprint*white fi; + ); + $:=$ shifted(-center $); + $ +enddef; + +vardef ListeElement(expr nbpas,nbbas)= + save $; picture $; + save TAa; path TAa; + save LTa; picture LTa; + LTa=ColleBoxNew("élément",if string nbpas:OvalNb(nbpas) else: nbpas fi,"de",RecMenuList(nbbas)); + TAa=OvalBox(LTa); + $=image( + fill TAa if print=false : withcolor OrangeListTrois else : withcolor coefprint*white fi; + draw LTa; + draw TAa if print=false : withcolor coefprint*white fi; + ); + $:=$ shifted(-center $); + $ +enddef; + +vardef ListePosition(expr nbpas,nbbas)= + save $; picture $; + save TAa; path TAa; + save LTa; picture LTa; + LTa=ColleBoxNew("position de",if string nbpas:OvalNb(nbpas) else: nbpas fi,"de",RecMenuList(nbbas)); + TAa=OvalBox(LTa); + $=image( + fill TAa if print=false : withcolor OrangeListTrois else : withcolor coefprint*white fi; + draw LTa; + draw TAa if print=false : withcolor coefprint*white fi; + ); + $:=$ shifted(-center $); + $ +enddef; + +vardef ListeLongueur(expr nbpas)= + save $; picture $; + save TAa; path TAa; + save LTa; picture LTa; + LTa=ColleBoxNew("longueur de",RecMenuList(nbpas)); + TAa=OvalBox(LTa); + $=image( + fill TAa if print=false : withcolor OrangeListTrois else : withcolor coefprint*white fi; + draw LTa; + draw TAa if print=false : withcolor coefprint*white fi; + ); + $:=$ shifted(-center $); + $ +enddef; + diff --git a/macros/latex/contrib/profcollege/metapost/PfC-Scratch.mp b/macros/latex/contrib/profcollege/metapost/PfC-Scratch.mp new file mode 100644 index 0000000000..8da257901b --- /dev/null +++ b/macros/latex/contrib/profcollege/metapost/PfC-Scratch.mp @@ -0,0 +1,3346 @@ +%%%%% epaisseur de tracés %%%%%%%% +numeric eppen; +eppen=0.25; + +pickup pencircle scaled eppen; +defaultpen := savepen; + +%points pour placer les différents éléments +pair _coinprec;%coinbasgauche de la boite précédente +pair _coincom;%coinbasdroite de la boite afin d'y mettre des commentaires +pair _coinnum;%milieu côté gauche pour placer la numérotation des lignes + +%paramètres +numeric Nblignes; Nblignes:=1; +pair DebutListe; DebutListe=(0,0); +boolean NumeroteLignes; NumeroteLignes=false; + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% couleurs +color CoulLignes; CoulLignes:=black; +color ColBloc; % alias des couleurs de bloc + +%Version3 +color BleuMouvTrois,dBleuMouvTrois,VioletAppTrois,dVioletAppTrois,OrangeConTrois,OrangeTrois,OrangeListTrois,SonTrois,DSonTrois,EvenementTrois,CapteurTrois,StyloTrois,BlocTrois,BlocDefTrois,BlocDefLigneTrois,MessageTrois,ControleTrois,CapFonceTrois,CloneTrois,FondSonTrois,OvalStyloTrois,FondOvalOp; +BleuMouvTrois=(76/255,151/255,255/255); +dBleuMouvTrois=(66/255,128/255,215/255); +VioletAppTrois=(153/255,102/255,255/255); +dVioletAppTrois=(133/255,92/255,214/255); +OrangeConTrois=(255/255,171/255,25/255); +OrangeTrois=(255/255,140/255,26/255); +OrangeListTrois=(255/255,102/255,26/255); +SonTrois=(207/255,99/255,207/255); +DSonTrois=(201/255,79/255,201/255); +FondSonTrois=(15/255,189/255,140/255); +EvenementTrois=(255/255,191/255,0); +MessageTrois=(230/255,172/255,0); +CapteurTrois=(92/255,177/255,214/255); +CapFonceTrois=(71/255,168/255,209/255); +StyloTrois=(15/255,189/255,140/255); +OvalStyloTrois=(13/255,165/255,122/255); +BlocTrois=(255/255,102/255,128/255); +BlocDefTrois=(255/255,77/255,106/255); +BlocDefLigneTrois=(255/255,51/255,85/255); +ControleTrois=(255/255,171/255,25/255); +CloneTrois=(236/255,156/255,19/255); +FondOvalOp=(89/255,192/255,89/255); + +vardef FondOvalAppMenu= + save $; color $; + $=dVioletAppTrois; + $ +enddef; + +%%%%Alias +def Place expr o = + if path o: draw o else: draw o fi +enddef; + +%impression +boolean print; +print=false; + +numeric coefprint; +coefprint:=0.95; + +%texte ou symbole droite gauche +boolean symbole; +symbole=true; + +%divers +numeric eb;%ecart boite-texte +eb:=3pt; + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Création des boites +ecrt:=eb/2;%largeur de la bordure de départ des boites Box, OValBox... + +vardef Box(text t)= + save $; path $; + picture ox; + ox=image( + if string t: + string demitt; + demitt=t&"\barre"; + label(TEX(demitt),(0,0)); + else: + draw t; + fi; + ); + $=(llcorner ox+(0,-ecrt))--(lrcorner ox+(0,-ecrt))--(urcorner ox+(0,ecrt))--(ulcorner ox+(0,ecrt))--cycle; + $ +enddef; + +vardef RecBox(text t)= + save $; path $; path xo; + if string t: + string demit; + demit=t&"\demibarre"; + xo=Box(demit);%on crée la boite contenant le texte + else: + xo=Box(t); + fi; + $=(llcorner xo+(-eb,eb)){dir-90}..{dir0}(llcorner xo)--(lrcorner xo){dir0}..{dir90}(lrcorner xo+(eb,eb))--(urcorner xo+(eb,-eb)){dir90}..{dir180}(urcorner xo)--(ulcorner xo){dir180}..{dir-90}(ulcorner xo+(-eb,-eb))--cycle; + $ +enddef; + +%%%%%%%%%%%%%% + +%%%%%%% Boites Ovales %%%%%%%% +vardef OvalBox(text t)= + save $; path $; path xo; + if string t: + string demit; + demit=t&"\barre"; + xo=Box(demit);%on crée la boite contenant le texte + else: + xo=Box(t); + fi; + $=(llcorner xo+(eb,0))--(lrcorner xo-(eb,0)){dir0}..{dir180}(urcorner xo+(-eb,0))--(ulcorner xo+(eb,0)){dir180}..{dir0}cycle;%on "arrondit" la boite + $ +enddef; + +vardef OvalVar(expr ar)= + save Ovar; picture Ovar; + save TAvar; path TAvar; + string TTv; + TTv=ar&"\barre"; + TAvar=OvalBox(TTv); + Ovar=image( + fill TAvar if print=false : withcolor OrangeTrois else : withcolor white fi; + draw TAvar if print=false : withcolor coefprint*white fi; + label(TEX("\barre\bfseries "&ar),(0,0)) if print=false : withcolor white fi; + ); + Ovar:=Ovar shifted(-center Ovar); + Ovar +enddef; + +vardef OvalList(text listelist)= + save CList; picture CList; + path TAlist; picture LOCMt; + LOCMt=ColleBoxNew(listelist); + TAlist=OvalBox(LOCMt); + CList=image( + fill TAlist if print=false : withcolor OrangeListTrois else : withcolor white fi; + draw LOCMt; + draw TAlist if print=false : withcolor coefprint*white fi; + ); + CList:=CList shifted(-center CList); + CList +enddef; + +vardef OvalBloc(expr ar)= + save $; picture $; + path tabloc; + tabloc=OvalBox(ar); + $=image( + fill tabloc if print=false : withcolor BlocTrois else: withcolor white fi; + draw tabloc if print=true : withcolor black else: withcolor BlocDefLigneTrois fi; + label(TEX("\bfseries\barre "&ar),(0,0)) if print=false : withcolor blanc fi; + ); + $ +enddef; + +vardef OvalMiniBox(text t)= + save $; path $; path xo; + if string t: + string demit; + demit=t&"\barre"; + xo=Box(demit);%on crée la boite contenant le texte + else: + xo=Box(t); + fi; + $=(llcorner xo+(eb/2,0))--(lrcorner xo-(eb/2,0)){dir0}..{dir180}(urcorner xo+(-eb/2,0))--(ulcorner xo+(eb/2,0)){dir180}..{dir0}cycle;%on "arrondit" la boite + $ +enddef; + +vardef DiamondBox(text t)= + save $; path $; path xo; + xo=Box(t);%on crée la boite contenant le texte + $=(llcorner xo-(eb,0))--(lrcorner xo+(eb,0))--(1/2[lrcorner xo,urcorner xo]+(4eb,0))--(urcorner xo+(eb,0))--(ulcorner xo-(eb,0))--(1/2[llcorner xo,ulcorner xo]+(-4eb,0))--cycle; + $ +enddef; + +vardef OvalNb(expr ar)= + save Onb; picture Onb; + path tanb; + tanb=OvalBox(ar); + Onb=image( + fill tanb withcolor white; + draw tanb if print=false : withcolor coefprint*white fi; + label(TEX("\barre "&ar),(0,0)); + ); + Onb +enddef; + +vardef OvalText(expr ar)= + save $; save TA; + picture $; + path TA; + TA=OvalBox(ar); + $=image(% + fill TA withcolor white; + draw TA if print=false : withcolor coefprint*white fi; + label(TEX("\barre "&ar),(0,0)); + ); + $:=$ shifted(-center $); + $ +enddef; + +vardef OvalOp(text listeop)= + save Oop; picture Oop; + save TAao; path TAao; + save LOPop; picture LOPop; + LOPop=ColleBoxNew(listeop); + TAao=OvalBox(LOPop); + Oop=image( + fill TAao if print=false : withcolor FondOvalOp else : withcolor coefprint*white fi; + draw LOPop; + draw TAao if print=false : withcolor coefprint*white fi; + ); + Oop:=Oop shifted(-center Oop); + Oop +enddef; + +vardef OvalApp(text listop)= + save $; picture $; + save ta; path ta; + save TTap; picture TTap; + TTap=ColleBoxNew(listop); + ta=OvalBox(TTap); + $=image( + fill ta if print=false : withcolor VioletAppTrois else: withcolor white fi; + draw ta if print=false : withcolor coefprint*white fi; + draw TTap; + ); + $:=$ shifted(-center $); + $ +enddef; + +vardef OvalSon(text listop)= + save $; picture $; + save ta; path ta; + save TTap; picture TTap; + TTap=ColleBoxNew(listop); + ta=OvalBox(TTap); + $=image( + fill ta if print=false : withcolor SonTrois else: withcolor white fi; + draw ta if print=false : withcolor coefprint*white fi; + draw TTap; + ); + $:=$ shifted(-center $); + $ +enddef; + +vardef OvalMusique(expr ar)= + save $; save TA; + picture $; + if string ar: + picture TT; + TT=ColleBoxNew(DoubleNote,"tempo"); + path TA; + TA=OvalBox(TT); + $=image( + fill TA if print : withcolor white else : withcolor StyloTrois fi; + draw TT if print=true : withcolor coefprint*white fi; + ); + else: + message("La commande --OvalStylo-- n'accepte qu'un argument de type string."); + $=nullpicture; + fi; + $ +enddef; + +vardef OvalMouv(expr ar)= + save $; picture $; + path ta; string TTm; + TTm=ar&"\longbarre"; + ta=OvalBox(TTm); + $=image( + fill ta if print=false : withcolor BleuMouvTrois else: withcolor white fi; + draw ta if print=false : withcolor coefprint*white fi; + label(TEX("\longbarre "&ar),center ta) if print=false : withcolor blanc fi; + ); + $ +enddef; + +vardef OvalMenuCap(expr art)=OvalCapMenu(art) enddef; + +vardef OvalCapMenu(expr ar)= + save $; picture $; + string TTm; + TTm=if print:ar&"\hbox to1em{\barre}\blacktriangledown" else: "\color{white}"&ar&"\hbox to1em{\barre}\blacktriangledown"; + fi; + path TAMC; + TAMC=OvalBox(TTm); + $=image( + fill TAMC if print : withcolor white else : withcolor CapFonceTrois fi; + draw TAMC if print=false : withcolor coefprint*white fi; + label(TEX(TTm),center TAMC); + ); + $ +enddef; + +vardef OvalCap(text listecap)= + save Cap; picture Cap; + save TAcap; path TAcap; + save LOCMcap; picture LOCMcap; + LOCMcap=ColleBoxNew(listecap); + TAcap=OvalBox(LOCMcap); + Cap=image( + fill TAcap if print=false : withcolor CapteurTrois else : withcolor white fi; + draw LOCMcap; + draw TAcap if print=false : withcolor coefprint*white fi; + ); + Cap:=Cap shifted(-center Cap); + Cap +enddef; + +vardef OvalMouvMenu(expr ar)= + save $; picture $; + path ta; string TTm; + TTm=if print:ar&"\hbox to1em{\barre}\blacktriangledown" else: + "\color{white}"&ar&"\hbox to1em{\barre}\color{black}\blacktriangledown" + fi; + ta=OvalBox(TTm); + $=image( + fill ta if print=false : withcolor dBleuMouvTrois else: withcolor white fi; + draw ta if print=false : withcolor coefprint*white fi; + label(TEX(TTm),center ta); + ); + $ +enddef; + +vardef OvalAppMenu(expr ar)= + save $; picture $; + path ta; string TTm; + TTm=if print:ar&"\hbox to1em{\barre}\blacktriangledown" else: "\color{white}"&ar&"\hbox to1em{\barre}\blacktriangledown"; + fi; + ta=OvalBox(TTm); + $=image( + fill ta if print=false : withcolor FondOvalAppMenu else: withcolor white fi; + draw ta if print=false : withcolor coefprint*white fi; + label(TEX(TTm),center ta); + ); + $ +enddef; + +vardef OvalSonMenu(expr art)=OvalMenuSon(art) enddef; + +vardef OvalMenuSon(expr ar)= + save $; save TA; + picture $; + string TTm; + TTm=if print:ar&"\hbox to1em{\barre}\blacktriangledown" else: "\color{white}"&ar&"\hbox to1em{\barre}\blacktriangledown"; + fi; + path TA; + TA=OvalBox(TTm); + $=image(% + fill TA if print : withcolor white else : withcolor DSonTrois fi; + draw TA if print=false : withcolor coefprint*white fi; + label(TEX(TTm),center TA); + ); + $ +enddef; + +vardef OvalMenuControle(expr ar)= + save $; save TA; + picture $; + string TTm; + TTm=if print:ar&"\hbox to1em{\barre}\blacktriangledown" else: "\color{white}"&ar&"\hbox to1em{\barre}\blacktriangledown"; + fi; + path TA; + TA=OvalBox(TTm); + $=image( + fill TA if print : withcolor white else : withcolor CloneTrois fi; + draw TA if print=false : withcolor coefprint*white fi; + label(TEX(TTm), center TA); + ); + $ +enddef; + +vardef OvalStylo(expr ar)= + save $; save TA; + picture $; + string TT,TTI; + if string ar: + if print: + TT=ar&"\hbox to1em{\barre}\blacktriangledown" + else: + TT=ar&"\hbox to1em{\barre}\color{white}\blacktriangledown" + fi; + TTI=ar&"\hbox to1em{\barre}\phantom{\blacktriangledown}"; + path TA; + TA=OvalBox(TT); + $=image( + fill TA if print : withcolor white else : withcolor OvalStyloTrois fi; + draw TA if print=false : withcolor coefprint*white fi; + label(TEX(TT),(0,0)) if print=false : withcolor white fi; + ); + else: + message("La commande --OvalStylo-- n'accepte qu'un argument de type string."); + $=nullpicture; + fi; + $ +enddef; + +vardef OvalCouleur(expr redcc,greencc,bluecc)= + save $; picture $; + string TTv; + path tacol; + TTv="\phantom{10}\barre"; + tacol=OvalBox(TTv); + $=image( + fill tacol withcolor (redcc,greencc,bluecc); + draw tacol; + ); + $:=$ shifted(-center tacol); + $ +enddef; + +vardef OvalMenuEvenement(expr ar)= + save $; save TA; + picture $; + string TTm; + TTm=if print:ar&"\hbox to1em{\barre}\blacktriangledown" else: "\color{white}"&ar&"\hbox to1em{\barre}\blacktriangledown"; + fi; + path TA; + TA=OvalBox(TTm); + $=image( + fill TA if print : withcolor white else : withcolor MessageTrois fi; + draw TA if print=false : withcolor coefprint*white fi; + label(TEX(TTm), center TA); + ); + $ +enddef; + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Rectangles +vardef RecMouvMenu(expr ar)= + save $; picture $; + path ta; string TTm; + TTm=if print:ar&"\hbox to1em{\barre}\blacktriangledown" else: "\color{white}"&ar&"\hbox to1em{\barre}\blacktriangledown" + fi; + ta=RecBox(TTm); + $=image( + fill ta if print=false : withcolor BleuMouvTrois else: withcolor white fi; + draw ta if print=false : withcolor coefprint*white fi; + label(TEX(TTm),center ta); + ); + $ +enddef; + +vardef RecMenuApp(expr ar)= + save $; picture $; + save ta; path ta; string TTm; + TTm=if print:ar&"\hbox to1em{\barre}\blacktriangledown" else: "\color{white}"&ar&"\hbox to1em{\barre}\blacktriangledown"; + fi; + ta=RecBox(TTm); + $=image( + fill ta if print=false : withcolor VioletAppTrois else: withcolor white fi; + draw ta if print=false : withcolor coefprint*white fi; + label(TEX(TTm),center ta); + ); + $ +enddef; + +vardef RecMenuOp(expr ar)= + save $; save TA; + picture $; string TTm; + TTm=if print:ar&"\hbox to1em{\barre}\blacktriangledown" else: "\color{white}"&ar&"\hbox to1em{\barre}\blacktriangledown"; + fi; + path TA; + TA=RecBox(TTm); + $=image( + fill TA if print : withcolor white else : withcolor FondOvalOp fi; + draw TA if print=false : withcolor coefprint*white fi; + label(TEX(TTm), center TA); + ); + $ +enddef; + +vardef RecMenuSon(expr ar)= + save $; save TA; + picture $; string TTm; + TTm=if print:ar&"\hbox to1em{\barre}\blacktriangledown" else: "\color{white}"&ar&"\hbox to1em{\barre}\blacktriangledown" fi; + path TA; + TA=RecBox(TTm); + $=image( + fill TA if print : withcolor white else : withcolor SonTrois fi; + draw TA if print=false : withcolor coefprint*white fi; + label(TEX(TTm), center TA); + ); + $ +enddef; + +vardef RecEvenementMenu(expr ar)= + save $; picture $; + path ta; string TTm; + TTm=if print:ar&"\hbox to1em{\barre}\blacktriangledown" else: "\color{white}"&ar&"\hbox to1em{\barre}\blacktriangledown"; + fi; + ta=RecBox(TTm); + $=image( + fill ta if print=false : withcolor EvenementTrois else: withcolor white fi; + draw ta if print=false : withcolor coefprint*white fi; + label(TEX(TTm),center ta); + ); + $ +enddef; + +vardef RecMenuCap(expr ar)= + save $; picture $; + path ta; string TTm; + TTm=if print:ar&"\hbox to1em{\barre}\blacktriangledown" else: "\color{white}"&ar&"\hbox to1em{\barre}\blacktriangledown"; + fi; + ta=RecBox(TTm); + $=image( + fill ta if print=false : withcolor CapteurTrois else: withcolor white fi; + draw ta if print=false : withcolor coefprint*white fi; + label(TEX(TTm),center ta); + ); + $ +enddef; + +vardef RecMenuVar(expr ar)= + save $; save TA; + picture $; string TTm; + TTm=if print:ar&"\hbox to1em{\barre}\blacktriangledown" else: "\color{white}"&ar&"\hbox to1em{\barre}\blacktriangledown"; + fi; + path TA; + TA=RecBox(TTm); + $=image( + fill TA if print : withcolor white else : withcolor OrangeTrois fi; + draw TA if print=false : withcolor coefprint*white fi; + label(TEX(TTm), center TA); + ); + $ +enddef; + +vardef RecMenuList(expr ar)= + save $; save TA; + picture $; string TTm; + TTm=if print:ar&"\hbox to1em{\barre}\blacktriangledown" else: "\color{white}"&ar&"\hbox to1em{\barre}\blacktriangledown"; + fi; + path TA; + TA=RecBox(TTm); + $=image( + fill TA if print : withcolor white else : withcolor OrangeListTrois fi; + draw TA if print=false : withcolor coefprint*white fi; + label(TEX(TTm), center TA); + ); + $ +enddef; + +%%%%%%% Affichage Complet %%%%%%%%%%%%% +vardef PuzzleBox(text t)= + save $; path $; path xo; + xo=Box(t);%on crée la boite contenant le texte + $=(llcorner xo+(-eb,0)){dir-90}..{dir0}(llcorner xo+(0,-eb))-- + (llcorner xo+(0.375cm,0)+(-eb,-eb)){dir0}.. + {dir0}(llcorner xo+(0.375cm,0)+(0,-2eb))-- + (llcorner xo+(0.625cm,0)+(0,-2eb)){dir0}.. + {dir0}(llcorner xo+(0.625cm,0)+(eb,-eb))-- + (lrcorner xo+(0,-eb)){dir0}..{dir90}(lrcorner xo+(eb,0))--(urcorner xo+(eb,0)){dir90}..{dir-180}(urcorner xo+(0,eb))-- + (ulcorner xo+(0.625cm,0)+(eb,eb)){dir180}.. + {dir180}(ulcorner xo+(0.625cm,0))-- + (ulcorner xo+(0.375cm,0)){dir180}.. + {dir180}(ulcorner xo+(0.375cm,0)+(-eb,eb))-- + (ulcorner xo+(0,eb)){dir-180}..{dir-90}(ulcorner xo+(-eb,0))--cycle; + $ +enddef; + +vardef BlocPuzzle(text nombloc)= + save Bpuzzle; picture Bpuzzle; + path TABp; picture LOCMp; + LOCMp=ColleBoxNew(nombloc); + TABp=PuzzleBox(LOCMp); + Bpuzzle=image( + fill TABp if print=false : withcolor BlocDefTrois else : withcolor white fi; + draw LOCMp; + draw TABp if print=true : withcolor black else: withcolor BlocDefLigneTrois fi; + ); + Bpuzzle:=Bpuzzle shifted(-center Bpuzzle+(0,-eb/2)); + Bpuzzle +enddef; + +vardef ColleBoxNew(text t)=%Pour coller plusieurs boites + save Colle; picture Colle; + Colle=nullpicture; + numeric nbcolle; nbcolle:=0; + save NBCOLLE; path NBCOLLE; + for p_ = t: + nbcolle:=nbcolle+1; + endfor; + picture HOLD; HOLD:=nullpicture; + if unknown LONG: LONG:=0 fi; + if nbcolle=1:%On dessine + for p_ = t: + if string p_: + NBCOLLE:=Box(p_); + HOLD:=image( + label(TEX("\sffamily\bfseries\longbarre "&p_),(0,0)) if print=false : withcolor white fi;%->ok + ); + HOLD:=(HOLD shifted ((xpart((center HOLD)-(llcorner HOLD))+LONG,0))); + else: + HOLD:=(p_ shifted ((xpart((center p_)-(llcorner p_))+LONG,0))); + fi; + endfor; + addto Colle also HOLD; + LONG:=LONG+abs(lrcorner Colle - llcorner Colle)+eb; + else:%il faut coller les boites une à une + for p_ = t: + addto Colle also (ColleBoxNew(p_)); + endfor; + fi; + Colle +enddef; + +vardef CADRE(expr texti)= + save $; path $; + $=(llcorner texti+(-eb,0)){dir-90}..{dir0}(llcorner texti+(0,-eb))-- + (llcorner texti+(0.375cm,0)+(-eb,-eb)){dir0}.. + {dir0}(llcorner texti+(0.375cm,0)+(0,-2eb))-- + (llcorner texti+(0.625cm,0)+(0,-2eb)){dir0}.. + {dir0}(llcorner texti+(0.625cm,0)+(eb,-eb))-- + (lrcorner texti+(0,-eb)){dir0}..{dir90}(lrcorner texti+(eb,0))--(urcorner texti+(eb,0)){dir90}..{dir-180}(urcorner texti+(0,eb))-- + (ulcorner texti+(0.625cm,0)+(eb,eb)){dir180}.. + {dir180}(ulcorner texti+(0.625cm,0))-- + (ulcorner texti+(0.375cm,0)){dir180}.. + {dir180}(ulcorner texti+(0.375cm,0)+(-eb,eb))-- + (ulcorner texti+(0,eb)){dir-180}..{dir-90}(ulcorner texti+(-eb,0))--cycle; + $ +enddef; + +vardef AFFI(expr texta)= + path cadre; + cadre=CADRE(texta); + picture TEXT; + TEXT=image(% + fill cadre withcolor if print=true :coefprint*white else: if unknown ColBloc : white else : ColBloc fi; fi; + draw texta; + draw cadre withcolor CoulLignes; + ); + TEXT +enddef; + +vardef Affichage(expr textu)= + save $; + picture $; + $=AFFI(textu); + $:=$ shifted (if unknown _coinprec:(0,0) else :_coinprec fi - (ulcorner $)); +_coinprec:=(llcorner $)+(0,eb); +_coincom:=1/2[lrcorner $,urcorner $]+(eb,0); +_coinnum:=(xpart(DebutListe+(-3*eb,0)),ypart(1/2[llcorner $,ulcorner $])); +if NumeroteLignes=true: + label(TEX("\footnotesize"&decimal(Nblignes)&""),_coinnum); + Nblignes:=Nblignes+1; +fi; +$ +enddef; + +%Pour les blocs de type contrôle +vardef CADRECONTROLE(expr texti)= + save $; path $; + path tracecadre; + $=(llcorner texti+(-eb,-eb))--%(llcorner texti+(0,-eb))-- + (llcorner texti+(0.875cm,0)+(-eb,-eb)){dir0}.. + {dir0}(llcorner texti+(0.875cm,0)+(0,-2eb))-- + (llcorner texti+(1.125cm,0)+(0,-2eb)){dir0}.. + {dir0}(llcorner texti+(1.125cm,0)+(eb,-eb))-- + (lrcorner texti+(0,-eb)){dir0}..{dir90}(lrcorner texti+(eb,0))--(urcorner texti+(eb,0)){dir90}..{dir180}(urcorner texti+(0,eb))-- + (ulcorner texti+(0.625cm,0)+(eb,eb)){dir180}.. + {dir180}(ulcorner texti+(0.625cm,0))-- + (ulcorner texti+(0.375cm,0)){dir180}.. + {dir180}(ulcorner texti+(0.375cm,0)+(-eb,eb))-- + (ulcorner texti+(0,eb)){dir180}..{dir-90}(ulcorner texti+(-eb,0))--cycle; + tracecadre=(llcorner texti+(0.5cm,0)+(0,-eb))--(llcorner texti+(0.875cm,0)+(-eb,-eb)){dir0}.. + {dir0}(llcorner texti+(0.875cm,0)+(0,-2eb))-- + (llcorner texti+(1.125cm,0)+(0,-2eb)){dir0}.. + {dir0}(llcorner texti+(1.125cm,0)+(eb,-eb))-- + (lrcorner texti+(0,-eb)){dir0}..{dir90}(lrcorner texti+(eb,0))--(urcorner texti+(eb,0)){dir90}..{dir180}(urcorner texti+(0,eb))-- + (ulcorner texti+(0.625cm,0)+(eb,eb)){dir180}.. + {dir180}(ulcorner texti+(0.625cm,0))-- + (ulcorner texti+(0.375cm,0)){dir180}.. + {dir180}(ulcorner texti+(0.375cm,0)+(-eb,eb))-- + (ulcorner texti+(0,eb)){dir180}..{dir-90}(ulcorner texti+(-eb,0))-- + (llcorner texti+(-eb,-eb)); + $ +enddef; + +vardef AFFICONTROLE(expr texta)= + path cadre; + cadre=CADRECONTROLE(texta); + picture TEXT; + TEXT=image( + fill cadre withcolor if print=true :coefprint*white else: if unknown ColBloc : white else : ColBloc fi; fi; + draw texta; + draw tracecadre withcolor CoulLignes; + ); + TEXT +enddef; + +vardef AffichageControle(expr textu)= + save $; + picture $; + $=AFFICONTROLE(textu); + $:=$ shifted (if unknown _coinprec:(0,0) else :_coinprec fi - (ulcorner $)); +_coinprec:=llcorner $+(0.5cm,0); +_coinprec:=_coinprec+(0,eb); +coindebutbloc[numblocrep]:=(llcorner $)+(0,eb); +_coincom:=1/2[lrcorner $,urcorner $]+(eb,0); +_coinnum:=(xpart(DebutListe+(-3*eb,0)),ypart(1/2[llcorner $,ulcorner $])); +if NumeroteLignes=true: + label(TEX("\footnotesize"&decimal(Nblignes)&""),_coinnum); + Nblignes:=Nblignes+1; +fi; +$ +enddef; + +vardef CADREED(expr texti)= + save $; path $; + $=(llcorner texti+(-eb,0)){dir-90}..{dir0}(llcorner texti+(0,-eb))-- + (llcorner texti+(0.375cm,0)+(-eb,-eb)){dir0}.. + {dir0}(llcorner texti+(0.375cm,0)+(0,-2eb))-- + (llcorner texti+(0.625cm,0)+(0,-2eb)){dir0}.. + {dir0}(llcorner texti+(0.625cm,0)+(eb,-eb))-- + (lrcorner texti+(0,-eb)){dir0}..{dir90}(lrcorner texti+(eb,0))--(urcorner texti+(eb,0)){dir90}..{dir-180}(urcorner texti+(0,eb))-- + 1/2[ulcorner texti+(-eb,eb),urcorner texti+(eb,eb)]{dir150}..{dir-150}(ulcorner texti+(-eb,eb))--cycle; + $ +enddef; + +vardef AFFIED(expr texta)= + path cadre; + cadre=CADREED(texta); + picture TEXT; + TEXT=image( + fill cadre withcolor if print=true :coefprint*white else: if unknown ColBloc : white else : ColBloc fi; fi; + draw texta; + draw cadre withcolor CoulLignes; + ); + TEXT +enddef; + +vardef AffichageED(expr textu)= + save $; + picture $; + $=AFFIED(textu); + $:=$ shifted (if unknown _coinprec:(0,0) else :_coinprec fi - (ulcorner $)); +_coinprec:=llcorner $; +_coinprec:=_coinprec+(0,eb); +_coincom:=1/2[lrcorner $,urcorner $]+(eb,0); +_coinnum:=(xpart(DebutListe+(-3*eb,0)),ypart(1/2[llcorner $,ulcorner $])); +if NumeroteLignes=true: + label(TEX("\footnotesize"&decimal(Nblignes)&""),_coinnum); + Nblignes:=Nblignes+1; +fi; +$ +enddef; + +%%% section Mouvement %%%%%%%%%% +vardef Avancer(expr nbpas)= + LONG:=0; + save $; + picture $, texto; + if string nbpas: + texto=ColleBoxNew("avancer de",OvalNb(nbpas),"pas"); + else: + texto=ColleBoxNew("avancer de",nbpas,"pas"); + fi; + ColBloc:=BleuMouvTrois; + $=Affichage(texto); + $ +enddef; + +vardef Arcdroite= + save $; + picture $; + $=image( + path cc; + cc=fullcircle scaled 10pt; + drawarrow reverse(subpath(0,0.75*length cc) of cc) withpen pencircle scaled 2bp if print=false: withcolor white fi; + ); + $ +enddef; + +vardef Arcgauche= + save $; + picture $; + $=image( + path cc; + cc=fullcircle scaled 10pt; + drawarrow (subpath(0.75*length cc,1.5*length cc) of cc) withpen pencircle scaled 2bp if print=false: withcolor white fi; + ); + $ +enddef; + +vardef Tournerd(expr nbpas)= + LONG:=0; + save $; + picture $, texto; + if string nbpas: + if symbole=true: + texto=ColleBoxNew("tourner",Arcdroite,"de",OvalNb(nbpas),"degré(s)"); + else: + texto=ColleBoxNew("tourner à droite de",OvalNb(nbpas),"degré(s)"); + fi; + else: + if symbole=true: + texto=ColleBoxNew("tourner",Arcdroite,"de",nbpas,"degré(s)"); + else: + texto=ColleBoxNew("tourner à droite de",nbpas,"degré(s)"); + fi; + fi; + ColBloc:=BleuMouvTrois; + $=Affichage(texto); + $ +enddef; + +vardef Tournerg(expr nbpas)= + LONG:=0; + save $; + picture $, texto; + if string nbpas: + if symbole=true: + texto=ColleBoxNew("tourner",Arcgauche,"de",OvalNb(nbpas),"degré(s)"); + else: + texto=ColleBoxNew("tourner à gauche de",OvalNb(nbpas),"degré(s)"); + fi; + else: + if symbole=true: + texto=ColleBoxNew("tourner",Arcgauche,"de",nbpas,"degré(s)"); + else: + texto=ColleBoxNew("tourner à gauche de",nbpas,"degré(s)"); + fi; + fi; + ColBloc:=BleuMouvTrois; + $=Affichage(texto); + $ +enddef; + +vardef Orienter(expr nbpas)= + LONG:=0; + save $; + picture $, texto; + if string nbpas: + texto=ColleBoxNew("s'orienter à",OvalNb(nbpas)); + else: + texto=ColleBoxNew("s'orienter à",nbpas); + fi; + ColBloc:=BleuMouvTrois; + $=Affichage(texto); + $ +enddef; + +vardef Orienterdirection(expr nbpas)= + LONG:=0; + save $; + picture $, texto; + if string nbpas: + texto=ColleBoxNew("s'orienter vers",OvalMouvMenu(nbpas)); + else: + texto=ColleBoxNew("s'orienter vers",nbpas); + fi; + ColBloc:=BleuMouvTrois; + $=Affichage(texto); + $ +enddef; + +vardef OrienterVers(expr nbpass)=Orienterdirection(nbpass) enddef; + +vardef Aller(expr xa,ya)= + LONG:=0; + save $; + picture $, texto; + texto=ColleBoxNew("aller à x:",if string xa:OvalNb(xa) else: xa fi,"y:",if string ya:OvalNb(ya) else: ya fi); + ColBloc:=BleuMouvTrois; + $=Affichage(texto); + $ +enddef; + +vardef Glisser(expr na,xa,ya)= + LONG:=0; + save $; + picture $, texto; + texto=ColleBoxNew("glisser en",if string na:OvalNb(na) else: na fi,"seconde(s) à x :",if string xa:OvalNb(xa) else: xa fi,"y:",if string ya:OvalNb(ya) else: ya fi); + ColBloc:=BleuMouvTrois; + $=Affichage(texto); + $ +enddef; + +vardef Allera(expr nbpas)= + LONG:=0; + save $; + picture $, texto; + if string nbpas: + texto=ColleBoxNew("aller à",OvalMouvMenu(nbpas)); + ColBloc:=BleuMouvTrois; + $=Affichage(texto); + else: + message(""); + message("La commande -- Allera -- n'accepte qu'un type string comme argument."); + message(""); + $=nullpicture; + fi; + $ +enddef; + +vardef Glissera(expr na,xa)= + LONG:=0; + save $; + picture $, texto; + if string xa: + texto=ColleBoxNew("glisser en",if string na:OvalNb(na) else: na fi,"seconde(s) à",OvalMouvMenu(xa)); + ColBloc:=BleuMouvTrois; + $=Affichage(texto); +else: + message(""); + message("La commande -- Glissera -- n'accepte qu'un type string comme deuxième argument."); + message(""); + $=nullpicture; +fi; + $ +enddef; + +vardef Ajouter(expr nba,xa)= + LONG:=0; + save $; + picture $, texto; + if string xa: + texto=ColleBoxNew("ajouter",if string nba:OvalNb(nba) else: nba fi,"à",xa); + ColBloc:=BleuMouvTrois; + $=Affichage(texto); +else: + message(""); + message("La commande -- Ajouter -- n'accepte qu'un type string comme deuxième argument."); + message(""); + $=nullpicture; +fi; +$ +enddef; + +vardef Mettre(expr xa,nba)= + LONG:=0; + save $; + picture $, texto; + if string xa: + texto=ColleBoxNew("mettre",xa,"à",if string nba:OvalNb(nba) else: nba fi); + ColBloc:=BleuMouvTrois; + $=Affichage(texto); + else: + message(""); + message("La commande -- Mettre -- n'accepte qu'un type string comme premier argument."); + message(""); + $=nullpicture; + fi; + $ +enddef; + +vardef Rebondir= + LONG:=0; + save $; + picture $, texto; + texto=ColleBoxNew("rebondir si le bord est atteint"); + ColBloc:=BleuMouvTrois; + $=Affichage(texto); + $ +enddef; + +vardef FixerSensRotation(expr nbpas)= + LONG:=0; + save $; + picture $, texto; + if string nbpas: + texto=ColleBoxNew("fixer le sens de rotation",RecMouvMenu(nbpas));%RecMouvMenu(nbpas)); + ColBloc:=BleuMouvTrois; + $=Affichage(texto); + else: + message("La commande --FixerSensRotation-- admet un seul argument de type string"); + $=nullpicture; + fi; + $ +enddef; + +%%%% fin section Mouvement %%%%%% + +%%%%% Section Apparence %%%%%%%%% +vardef DireT(expr na,xa)= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew("dire",if string na:OvalText(na) else: na fi,"pendant",if string xa : OvalNb(xa) else: xa fi,"seconde(s)"); +ColBloc:=VioletAppTrois; +$=Affichage(texto); +$ +enddef; + +vardef Dire(expr na)= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew("dire",if string na:OvalText(na) else: na fi); +ColBloc:=VioletAppTrois; +$=Affichage(texto); +$ +enddef; + +vardef PenserT(expr na,xa)= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew("penser à",if string na:OvalText(na) else: na fi,"pendant",if string xa : OvalNb(xa) else: xa fi,"seconde(s)"); +ColBloc:=VioletAppTrois; +$=Affichage(texto); +$ +enddef; + +vardef Penser(expr na)= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew("penser à",if string na:OvalText(na) else: na fi); +ColBloc:=VioletAppTrois; +$=Affichage(texto); +$ +enddef; + +vardef Montrer= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew("montrer"); + ColBloc:=VioletAppTrois; + $=Affichage(texto); + $ +enddef; + +vardef Cacher= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew("cacher"); + ColBloc:=VioletAppTrois; + $=Affichage(texto); + $ +enddef; + +vardef Basculer(expr nbpas)= + LONG:=0; + save $; + picture $,texto; + if string nbpas: + texto=ColleBoxNew("basculer sur le costume",OvalAppMenu(nbpas)); + ColBloc:=VioletAppTrois; + $=Affichage(texto); + else: + message("La commande --Basculer-- n'accepte qu'un argument string."); + $=nullpicture; + fi; + $ +enddef; + +vardef BasculerCostume(expr nbpass)=Basculer(nbpass) enddef; + +vardef CostumeSuivant= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew("costume suivant"); + ColBloc:=VioletAppTrois; + $=Affichage(texto); +$ +enddef; + +vardef ARSuivant= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew("arrière-plan suivant"); + ColBloc:=VioletAppTrois; + $=Affichage(texto); +$ +enddef; + +vardef BasculerAR(expr nbpas)= + LONG:=0; + save $; + picture $,texto; + if string nbpas: + texto=ColleBoxNew("basculer sur l'arrière-plan",OvalAppMenu(nbpas)); + ColBloc:=VioletAppTrois; + $=Affichage(texto); + else: + message("La commande --BasculerAR-- n'accepte qu'un argument string."); + $=nullpicture; + fi; + $ +enddef; + +vardef BasculerARA(expr nbpas)=%quand la scène est sélectionnée... + LONG:=0; + save $; + picture $,texto; + if string nbpas: + texto=ColleBoxNew("basculer sur l'arrière-plan",OvalAppMenu(nbpas)," et attendre"); + ColBloc:=VioletAppTrois; + $=Affichage(texto); + else: + message("La commande --BasculerARA-- n'accepte qu'un argument string."); + $=nullpicture; + fi; + $ +enddef; + +vardef AjouterEffet(expr nbpas,xa)= + LONG:=0; + save $; + picture $,texto; + if string xa: + texto=ColleBoxNew("ajouter",if string nbpas: OvalNb(nbpas) else: nbpas fi," à l'effet",RecMenuApp(xa)); + ColBloc:=VioletAppTrois; + $=Affichage(texto); +else: + message("La commande --AjouterEffet-- n'accepte qu'un deuxième argument de type string."); + $=nullpicture; +fi; +$ +enddef; + +vardef MettreEffet(expr xa,nbpas)= + LONG:=0; + save $; + picture $,texto; + if string xa: + texto=ColleBoxNew("mettre l'effet",RecMenuApp(xa),"à",if string nbpas:OvalNb(nbpas) else: nbpas fi); + ColBloc:=VioletAppTrois; + $=Affichage(texto); +else: + message("La commande --MettreEffet-- n'accepte qu'un premier argument de type string."); + $=nullpicture; +fi; +$ +enddef; + +vardef AnnulerEffet= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew("annuler les effets graphiques"); + ColBloc:=VioletAppTrois; + $=Affichage(texto); +$ +enddef; + +vardef AnnulerEffets=AnnulerEffet enddef; + +vardef AjouterTaille(expr na)= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew("ajouter",if string na:OvalNb(na) else: na fi,"à la taille"); +ColBloc:=VioletAppTrois; +$=Affichage(texto); +$ +enddef; + +vardef MettreA(expr na)= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew("mettre la taille à",if string na:OvalNb(na) else: na fi,"\% de la taille initiale"); +ColBloc:=VioletAppTrois; +$=Affichage(texto); +$ +enddef; + +vardef MettreTaille(expr art)=MettreA(art) enddef; + +vardef AllerPlan(expr nbpas)= + LONG:=0; + save $; + picture $,texto; + if string nbpas: + texto=ColleBoxNew("aller à l'",RecMenuApp(nbpas),"plan"); + ColBloc:=VioletAppTrois; + $=Affichage(texto); + else: + message("La commande --AllerPlan-- n'accepte qu'un argument de type string."); + $=nullpicture; + fi; + $ +enddef; + +vardef DeplacerPlan(expr nbpas,xa)= + LONG:=0; + save $; + picture $,texto; + if string xa: + texto=ColleBoxNew("déplacer de",if string nbpas:OvalNb(nbpas) else: nbpas fi,"plan(s) vers l'",RecMenuApp(xa)); + ColBloc:=VioletAppTrois; + $=Affichage(texto); +else: + message("La commande --DeplacerPlan-- n'accepte qu'un deuxième argument de type string."); + $=nullpicture; +fi; +$ +enddef; +%%%%fin Section Apparance%%%%%%%%%%%% + +%%%%%% Section Son%%%%%%%%%%%% +vardef Jouer(expr nbpas)= + LONG:=0; + save $; + picture $, texto; + if string nbpas : + texto=ColleBoxNew("jouer le son",OvalMenuSon(nbpas)); + ColBloc:=SonTrois; + $=Affichage(texto); + else: + message("La commande --Jouer-- n'accepte qu'un argument de type string."); + $=nullpicture; + fi; + $ +enddef; + +vardef JouerT(expr nbpas)= + LONG:=0; + save $; + picture $, texto; + if string nbpas: + texto=ColleBoxNew("jouer le son",OvalMenuSon(nbpas)," jusqu'au bout"); + ColBloc:=SonTrois; + $=Affichage(texto); + else: + message("La commande --Jouer-- n'accepte qu'un argument de type string."); + $=nullpicture; + fi; + $ +enddef; + +vardef ArreterSon= + LONG:=0; + save $; + picture $, texto; + texto=ColleBoxNew("arrêter tous les sons"); + ColBloc:=SonTrois;; + $=Affichage(texto); + $ +enddef; + +vardef ArreterSons=ArreterSon enddef; + +vardef AjouterVol(expr xa)= + LONG:=0; + save $; + picture $, texto; + texto=ColleBoxNew("ajouter",if string xa:OvalNb(xa) else: xa fi," au volume"); + ColBloc:=SonTrois; + $=Affichage(texto); + $ +enddef; + +vardef MettreVol(expr xa)= + LONG:=0; + save $; + picture $, texto; + texto=ColleBoxNew("mettre le volume à",if string xa: OvalNb(xa) else: xa fi,"~\%"); + ColBloc:=SonTrois; + $=Affichage(texto); + $ +enddef; + +vardef AjouterEffetSon(expr nombre, effet)= + LONG:=0; + save $; + picture $, texto; + if string effet: + texto=ColleBoxNew("ajouter",if string nombre : OvalNb(nombre) else: nombre fi," à l'effet",RecMenuSon(effet)); + ColBloc:=SonTrois; + $=Affichage(texto); +else: + message("La commande -- AjouterEffet -- n'accepte qu'un deuxième argument de type string."); + $=nullpicture; +fi; +$ +enddef; + +vardef MettreEffetSon(expr effet,nombre)= + LONG:=0; + save $; + picture $, texto; + if string effet: + texto=ColleBoxNew("mettre l'effet",RecMenuSon(effet),"à",if string nombre:OvalNb(nombre) else: nombre fi); + ColBloc:=SonTrois; + $=Affichage(texto); +else: + message("La commande -- MettreEffet -- n'accepte qu'un argument de type string."); + $=nullpicture; +fi; +$ +enddef; + +vardef AnnulerEffetSon= + LONG:=0; + save $; + picture $, texto; + texto=ColleBoxNew("annuler tous les effets sonores"); + ColBloc:=SonTrois; + $=Affichage(texto); + $ +enddef; + +%Musique +vardef Tambour(expr na,xa)= + LONG:=0; + save $; + picture $, texto; + if string na: + texto=ColleBoxNew(DoubleNote,"jouer du tambour",OvalStylo(na),"pendant",if string xa:OvalNb(xa) else: xa fi,"temps"); + ColBloc:=StyloTrois; + $=Affichage(texto); +else: + message("La commande --Tambour-- n'accepte qu'un premier argument de type string."); + $=nullpicture; +fi; +$ +enddef; + +vardef Pause(expr na)= + LONG:=0; + save $; + picture $, texto; + texto=ColleBoxNew(DoubleNote,"faire une pause pendant",if string na: OvalNb(na) else: na fi," temps"); + ColBloc:=StyloTrois; + $=Affichage(texto); + $ +enddef; + +vardef JouerNote(expr na,xa)= + LONG:=0; + save $; + picture $, texto; + texto=ColleBoxNew(DoubleNote,"jouer la note",if string na:OvalNb(na) else: na fi," pendant",if string xa:OvalNb(xa) else: xa fi," temps"); +ColBloc:=StyloTrois; +$=Affichage(texto); +$ +enddef; + +vardef ChoisirInstrument(expr na)= + LONG:=0; + save $; + picture $, texto; + if string na: + texto=ColleBoxNew(DoubleNote,"choisir l'instrument \no{}",OvalStylo(na)); + ColBloc:=StyloTrois; + $=Affichage(texto); + else: + message("La commande -- ChoisirInstrument -- n'accepte qu'un argument de type string"); + $=nullpicture; + fi; + $ +enddef; + +vardef MettreTempo(expr xa)= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew(DoubleNote,"mettre le tempo à",if string xa:OvalNb(xa) else: xa fi); + ColBloc:=FondSonTrois; + $=Affichage(texto); + $ +enddef; + +vardef AjouterTempo(expr xa)= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew(DoubleNote,"ajouter",if string xa:OvalNb(xa) else: xa fi," au tempo"); +ColBloc:=FondSonTrois; +$=Affichage(texto); +$ +enddef; + +vardef DoubleNote= + save $; + picture $; + $=image( + draw (((0,0)--(0,18pt)) shifted(-12,-9pt)) withpen pencircle scaled 1bp withcolor if print: coefprint*white else: StyloTrois fi; + draw NoteImage shifted((-5,-2)); + draw NoteImage shifted((3.5,2)); + draw (((0,0)--(0,18pt)) shifted(12,-9pt)) withpen pencircle scaled 1bp withcolor if print: 0.5*coefprint*white else: (69/255,168/255,140/255) fi;%Trop clair->(14/255,187/255,139/255); +); + $:=$ shifted(-3,0); + $ +enddef; + +vardef NoteImage= + save $; + picture $; + $=image( + linecap := butt; + linejoin := mitered; + fill (80.695297,716.262024)..controls (80.574203,716.257996) and (80.476601,716.171997)..(80.480499,716.062988) + --(80.687500,704.125000)..controls (79.941399,704.570007) and (78.644501,704.637024)..(77.312500,704.223022) + ..controls (75.503899,703.659973) and (74.339798,702.429993)..(74.710899,701.473022) + ..controls (75.082001,700.512024) and (76.851601,700.187988)..(78.656303,700.750000) + ..controls (80.425797,701.301025) and (81.574203,702.504028)..(81.273399,703.453003) + --(81.125000,711.987976)..controls (82.910202,711.909973) and (86.910202,711.625000)..(84.917999,706.456970) + ..controls (85.992203,707.906006) and (86.839798,709.598022)..(85.273399,711.629028) + ..controls (84.378899,712.789001) and (81.617203,713.348022)..(81.062500,715.398010) + --(81.054703,716.065979)..controls (81.050797,716.176025) and (80.953102,716.262024)..(80.832001,716.262024) + --cycle if print=false: withcolor white fi; + pickup pencircle scaled 0.797011bp; + draw (80.695297,716.262024)..controls (80.574203,716.257996) and (80.476601,716.171997)..(80.480499,716.062988) + --(80.687500,704.125000)..controls (79.941399,704.570007) and (78.644501,704.637024)..(77.312500,704.223022) + ..controls (75.503899,703.659973) and (74.339798,702.429993)..(74.710899,701.473022) + ..controls (75.082001,700.512024) and (76.851601,700.187988)..(78.656303,700.750000) + ..controls (80.425797,701.301025) and (81.574203,702.504028)..(81.273399,703.453003) + --(81.125000,711.987976)..controls (82.910202,711.909973) and (86.910202,711.625000)..(84.917999,706.456970) + ..controls (85.992203,707.906006) and (86.839798,709.598022)..(85.273399,711.629028) + ..controls (84.378899,712.789001) and (81.617203,713.348022)..(81.062500,715.398010) + --(81.054703,716.065979)..controls (81.050797,716.176025) and (80.953102,716.262024)..(80.832001,716.262024) + --cycle if print=false: withcolor white fi; + pickup pencircle scaled eppen; + ); + $:=($ rotatedabout((72.000000,699),15)) scaled 0.8; + $:=$ shifted(-center $); + $ +enddef; + +%%%%%% fin Section Son %%%%%%%%% + +%%%%%% Section Stylo %%%%%%%%% +vardef ImageCrayon= + save titi; + picture titi; + titi=image(% + draw CrayonImage shifted(-12,0); + draw (((0,0)--(0,18pt)) shifted(9,-9)) withpen pencircle scaled 1bp withcolor if print: 0.5*coefprint*white else: (69/255,168/255,140/255) fi;%Trop clair->(14/255,187/255,139/255); + ); + titi +enddef; + +vardef Effacer= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew(ImageCrayon,"effacer tout"); + ColBloc:=StyloTrois; + $=Affichage(texto); + $ +enddef; + +vardef Estampiller= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew(ImageCrayon,"estampiller"); + ColBloc:=StyloTrois; + $=Affichage(texto); + $ +enddef; + +vardef PoserStylo= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew(ImageCrayon," stylo en position d'écriture"); + ColBloc:=StyloTrois; + $=Affichage(texto); +$ +enddef; + +vardef ReleverStylo= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew(ImageCrayon,"relever le stylo"); + ColBloc:=StyloTrois; + $=Affichage(texto); +$ +enddef; + +vardef MettreCouleur(expr redc,greenc,bluec)= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew(ImageCrayon," mettre la couleur du stylo à",OvalCouleur(redc,greenc,bluec)); + ColBloc:=StyloTrois; + $=Affichage(texto); + $ +enddef; + +vardef AjouterCS(text t)= + LONG:=0; + save $; + picture $,texto; + numeric k; k=0; + for p_=t: + if k=1:string effet; effet=p_ fi; + if k=0: if string p_:string nombre; nombre=p_ else: if picture p_: picture nombre; nombre=p_; fi fi fi; + k:=k+1; + endfor; + texto=ColleBoxNew(ImageCrayon,"ajouter",if string nombre:OvalNb(nombre) else: nombre fi,"à la",OvalStylo(effet),"du stylo"); +ColBloc:=StyloTrois; +$=Affichage(texto); +$ +enddef; + +vardef MettreCS(text t)= + LONG:=0; + save $; + picture $,texto; + numeric k; k=0; + for p_=t: + if k=0:string effet; effet=p_ fi; + if k=1: if string p_:string nombre; nombre=p_ else: if picture p_: picture nombre; nombre=p_; fi fi fi; + k:=k+1; + endfor; + texto=ColleBoxNew(ImageCrayon,"mettre la",OvalStylo(effet),"du stylo à",if string nombre:OvalNb(nombre) else: nombre fi); +ColBloc:=StyloTrois; +$=Affichage(texto); +$ +enddef; + +%taille du stylo +vardef AjouterTS(expr nbpas)= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew(ImageCrayon,"ajouter",if string nbpas:OvalNb(nbpas) else: nbpas fi,"à la taille du stylo"); +ColBloc:=StyloTrois; +$=Affichage(texto); +$ +enddef; + +vardef MettreTS(expr nbpas)= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew(ImageCrayon,"mettre la taille du stylo à",if string nbpas:OvalNb(nbpas) else: nbpas fi); +ColBloc:=StyloTrois; +$=Affichage(texto); +$ +enddef; + +vardef CrayonImage= + picture cray; + cray=image(% + drawoptions (if print=false:withcolor (0.298050,0.556850,0.917650) fi); + linecap := butt; + linejoin := mitered; + fill (0.960938,1.390630)--(1.644530,2.996090)..controls (1.730470,3.199220) and (1.917970,3.500000)..(2.062500,3.664060)..controls (2.324220,3.968750) and (3.539060,2.753910)..(3.234380,2.488280)..controls (3.070310,2.343750) and (2.769530,2.160160)..(2.566410,2.074220)--cycle; + drawoptions (withcolor (0.349030,0.368640,0.450970)); + pickup pencircle scaled 0.498140bp; + draw (0.960938,1.390630)--(1.644530,2.996090)..controls (1.730470,3.199220) and (1.917970,3.500000)..(2.062500,3.664060)..controls (2.324220,3.968750) and (3.539060,2.753910)..(3.234380,2.488280)..controls (3.070310,2.343750) and (2.769530,2.160160)..(2.566410,2.074220)--cycle; + drawoptions (withcolor (1.000000,1.000000,1.000000)); + %pickup pencircle scaled 0.000000bp; + fill (1.800780,3.363280)--(2.558590,5.156250)..controls (2.601560,5.257810) and (2.699220,5.402340)..(2.777340,5.480470)--(8.281250,10.984400)..controls (8.300780,11.003900) and (8.339840,11.023400)..(8.367190,11.031300)..controls (9.757810,11.398400) and (10.968800,10.187500)..(10.601600,8.792970)..controls (10.593800,8.769530) and (10.574200,8.730470)..(10.554700,8.710940)--(6.316410,4.476560)..controls (5.539060,3.695310) and (4.089840,2.718750)..(3.074220,2.289060)--(2.980470,2.246090)..controls (2.957030,2.238280) and (2.953130,2.242190)..(2.972660,2.261720)..controls (3.539060,2.753910) and (2.324220,3.968750)..(1.800780,3.363280)--cycle; + drawoptions (if print=false:withcolor (0.349030,0.368640,0.450970) fi); + pickup pencircle scaled 0.498140bp; + draw (1.800780,3.363280)--(2.558590,5.156250)..controls (2.601560,5.257810) and (2.699220,5.402340)..(2.777340,5.480470)--(8.281250,10.984400)..controls (8.300780,11.003900) and (8.339840,11.023400)..(8.367190,11.031300)..controls (9.757810,11.398400) and (10.968800,10.187500)..(10.601600,8.792970)..controls (10.593800,8.769530) and (10.574200,8.730470)..(10.554700,8.710940)--(6.316410,4.476560)..controls (5.539060,3.695310) and (4.089840,2.718750)..(3.074220,2.289060)--(2.980470,2.246090)..controls (2.957030,2.238280) and (2.953130,2.242190)..(2.972660,2.261720)..controls (3.539060,2.753910) and (2.324220,3.968750)..(1.800780,3.363280); + drawoptions (if print=false:withcolor (0.298050,0.556850,0.917650) fi); + %pickup pencircle scaled 0.000000bp; + fill (8.316410,11.019500)--(13.031300,15.730500)..controls (13.109400,15.808600) and (13.257800,15.878900)..(13.371100,15.886700)..controls (14.308600,15.949200) and (15.519500,14.734400)..(15.457000,13.796900)..controls (15.449200,13.687500) and (15.378900,13.535200)..(15.300800,13.457000)--(10.589800,8.746090)..controls (10.968800,10.187500) and (9.757810,11.398400)..(8.316410,11.019500)--cycle; + drawoptions (if print=false:withcolor (0.349030,0.368640,0.450970) fi); + pickup pencircle scaled 0.498140bp; + draw (8.316410,11.019500)--(13.031300,15.730500)..controls (13.109400,15.808600) and (13.257800,15.878900)..(13.371100,15.886700)..controls (14.308600,15.949200) and (15.519500,14.734400)..(15.457000,13.796900)..controls (15.449200,13.687500) and (15.378900,13.535200)..(15.300800,13.457000)--(10.589800,8.746090)..controls (10.968800,10.187500) and (9.757810,11.398400)..(8.316410,11.019500)--cycle; + draw (12.562500,15.265600)..controls (7.937500,15.644500) and (9.453130,10.488300)..(6.117190,11.398400); + %pickup pencircle scaled 0.000000bp; + fill (7.199220,12.785200)..controls (6.812500,13.175800) and (6.179690,13.175800)..(5.792970,12.785200)..controls (5.402340,12.398400) and (5.402340,11.765600)..(5.792970,11.378900)..controls (6.179690,10.988300) and (6.812500,10.988300)..(7.199220,11.378900)..controls (7.589840,11.765600) and (7.589840,12.398400)..(7.199220,12.785200)--cycle; + fill (6.496090,12.082000)--cycle; + pickup pencircle scaled 0.498140bp; + draw (7.199220,12.785200)..controls (6.812500,13.175800) and (6.179690,13.175800)..(5.792970,12.785200)..controls (5.402340,12.398400) and (5.402340,11.765600)..(5.792970,11.378900)..controls (6.179690,10.988300) and (6.812500,10.988300)..(7.199220,11.378900)..controls (7.589840,11.765600) and (7.589840,12.398400)..(7.199220,12.785200)--cycle; + draw (6.496090,12.082000); + drawoptions(); + pickup pencircle scaled 0bp; + draw (-3,0)--(-3,18) withcolor if print : coefprint*white else: StyloTrois fi; + pickup pencircle scaled eppen; + ); + cray:=cray shifted((0,-9pt)); + cray +enddef; + +%%%%%% Fin Section Stylo %%%%%%%% + +%%%%%% Section Contrôle %%%%%%%%% +color colControle; +colControle:=OrangeConTrois; + +vardef AffichageStop= + path cadre; + cadre=(llcorner texto+(-eb,0)){dir-90}..{dir0}(llcorner texto+(0,-eb))-- + (lrcorner texto+(0,-eb)){dir0}..{dir90}(lrcorner texto+(eb,0))--(urcorner texto+(eb,0)){dir90}..{dir180}(urcorner texto+(0,eb))-- + (ulcorner texto+(0.625cm,0)+(eb,eb)){dir180}.. + {dir180}(ulcorner texto+(0.625cm,0))-- + (ulcorner texto+(0.375cm,0)){dir180}.. + {dir180}(ulcorner texto+(0.375cm,0)+(-eb,eb))-- + (ulcorner texto+(0,eb)){dir180}..{dir-90}(ulcorner texto+(-eb,0))--cycle; + picture TEXT; + TEXT=image( + fill cadre withcolor if print : coefprint*white else : if unknown colControle : LightOrange else : colControle fi fi; + draw texto; + draw cadre withcolor CoulLignes; + ); + TEXT +enddef; + +pair coindebutbloc[]; +numeric numblocrep; +numblocrep:=0; + +vardef Repeter(expr xa)= + LONG:=0; + save $; + numblocrep:=numblocrep+1; + picture $,texto; + texto=ColleBoxNew("répéter", if string xa : OvalNb(xa) else: xa fi,"fois"); +LongRep[numblocrep]:=abs(llcorner texto-lrcorner texto);%afin de conserver la longueur du"répéter..." +ColBloc:=OrangeConTrois; +$=AffichageControle(texto); +$ +enddef; + +vardef RepeterI= + LONG:=0; + save $; + numblocrep:=numblocrep+1; + picture $,texto; + texto=ColleBoxNew("répéter indéfiniment"); + LongRep[numblocrep]:=abs(llcorner texto-lrcorner texto);%afin de conserver la longueur du"répéter..." + ColBloc:=OrangeConTrois; + $=AffichageControle(texto); + $ +enddef; + +vardef RepeterJ(expr xa)= + LONG:=0; + save $; + numblocrep:=numblocrep+1; + picture $,texto; + if picture xa: + texto=ColleBoxNew("répéter jusqu'à ce que",xa); + LongRep[numblocrep]:=abs(llcorner texto-lrcorner texto);%afin de conserver la longueur du"répéter..." + ColBloc:=OrangeConTrois; + $=AffichageControle(texto); + else: + message("La commande -- RepeterJ -- n'admet qu'un argument de type picture."); + $=nullpicture; + fi; + $ +enddef; + +vardef FinBlocRepeter= + LONG:=0; + save $; + picture $,texto; + _coinprec:=_coinprec-(0.5cm,0); + drawoptions(); + texto=image( + labeloffset:=0; + label.lrt(TEX("\hbox to"&decimal(LongRep[numblocrep])&"pt{\phantom{\barre fin du bloc}}"),if unknown _coinprec: (0,0) else:_coinprec fi); + labeloffset:=3; + ); +path cadre; +cadre=(coindebutbloc[numblocrep]+(0.125,0.125))-- + (coindebutbloc[numblocrep]+(0.0625+0.5cm+eb,0.125)){dir180}.. + {dir-90}(coindebutbloc[numblocrep]+(0.5cm,-eb))-- + (ulcorner texto+(0.5cm,eb)){dir-90}.. + {dir0}(ulcorner texto+(0.5cm+eb,0))-- + (ulcorner texto+(0.5cm+0.375cm,0)){dir0}..% + {dir0}(ulcorner texto+(0.5cm+0.375cm,0)+(eb,-eb))--% + (ulcorner texto+(0.5cm+0.625cm,0)+(eb,-eb)){dir0}..% + {dir0}(ulcorner texto+(0.5cm+0.625cm,0)+(2eb,0))--% + (urcorner texto+(-eb,0)){dir0}.. + {dir-90}(urcorner texto+(0,-eb))-- + (lrcorner texto+(0,eb)){dir-90}.. + {dir180}(lrcorner texto+(-eb,0))-- + (llcorner texto+(0.125+0.625cm,0)+(2eb,0)){dir180}.. + {dir180}(llcorner texto+(0.125+0.625cm,0)+(eb,-eb))-- + (llcorner texto+(0.125+0.375cm,0)+(eb,-eb)){dir180}.. + {dir180}(llcorner texto+(0.125+0.375cm,0))-- + (llcorner texto+(0.125,0)+(eb,0)){dir180}.. + {dir90}(llcorner texto+(0.125,0)+(0,eb))-- + cycle; +$=image( + fill cadre withcolor if print : coefprint*white else : if unknown colControle : LightOrange else : colControle fi fi; + draw cadre withcolor if print : coefprint*white else : if unknown colControle : LightOrange else : colControle fi fi; + AA:=ahangle; + ahangle:=90; + drawarrow (lrcorner texto+(-0.625cm,0.15cm)){dir-15}..{dir90}(urcorner texto+(-0.25cm,-0.1cm)) withpen pencircle scaled2bp if print=false : withcolor white fi; + ahangle:=AA; + draw (coindebutbloc[numblocrep]+(0.0625+0.5cm+eb,0.125)){dir180}.. + {dir-90}(coindebutbloc[numblocrep]+(0.5cm,-eb))-- + (ulcorner texto+(0.5cm,eb)){dir-90}.. + {dir0}(ulcorner texto+(0.5cm+eb,0))-- + (ulcorner texto+(0.5cm+0.375cm,0)){dir0}..% + {dir0}(ulcorner texto+(0.5cm+0.375cm,0)+(eb,-eb))--% + (ulcorner texto+(0.5cm+0.625cm,0)+(eb,-eb)){dir0}..% + {dir0}(ulcorner texto+(0.5cm+0.625cm,0)+(2eb,0))--% + (urcorner texto+(-eb,0)){dir0}.. + {dir-90}(urcorner texto+(0,-eb))-- + (lrcorner texto+(0,eb)){dir-90}.. + {dir180}(lrcorner texto+(-eb,0))-- + (llcorner texto+(0.125+0.625cm,0)+(2eb,0)){dir180}.. + {dir180}(llcorner texto+(0.125+0.625cm,0)+(eb,-eb))-- + (llcorner texto+(0.125+0.375cm,0)+(eb,-eb)){dir180}.. + {dir180}(llcorner texto+(0.125+0.375cm,0))-- + (llcorner texto+(0.125,0)+(eb,0)){dir180}.. + {dir90}(llcorner texto+(0.125,0)+(0,eb))--(coindebutbloc[numblocrep]+(0.125,0.125)) withcolor CoulLignes; + ); +_coinprec:=(llcorner $); +_coinprec:=_coinprec+(0,eb); +numblocrep:=numblocrep-1; +$ +enddef; + +vardef FinBlocRepeterI=FinBlocRepeter enddef; + +vardef Si(expr xa)= + LONG:=0; + save $; + numblocrep:=numblocrep+1; + picture $,texto; + if picture xa: + texto=ColleBoxNew("si\hbox to1em{}",xa,"alors"); + LongRep[numblocrep]:=abs(llcorner texto-lrcorner texto);%afin de conserver la longueur du"répéter..." + ColBloc:=OrangeConTrois; + $=AffichageControle(texto); + else: + message("La commande -- Si -- n'admet qu'un argument de type picture."); + $=nullpicture; + fi; + $ +enddef; + +vardef FinBlocSi= + LONG:=0; + save $; + picture $,texto; + _coinprec:=_coinprec-(0.5cm,0); + drawoptions(); + texto=image( + labeloffset:=0; + label.lrt(TEX("\hbox to"&decimal(LongRep[numblocrep])&"pt{\phantom{\barre fin du bloc}}"),if unknown _coinprec: (0,0) else:_coinprec fi); + labeloffset:=3; + ); +path cadre; +if BlocStopAvant=false: + cadre=(coindebutbloc[numblocrep]+(0.125,0.125))-- + (coindebutbloc[numblocrep]+(0.0625+0.5cm+eb,0.125)){dir180}.. + {dir-90}(coindebutbloc[numblocrep]+(0.5cm,-eb))-- + (ulcorner texto+(0.5cm,eb)){dir-90}.. + {dir0}(ulcorner texto+(0.5cm+eb,0))-- + (ulcorner texto+(0.5cm+0.375cm,0)){dir0}..% + {dir0}(ulcorner texto+(0.5cm+0.375cm,0)+(eb,-eb))--% + (ulcorner texto+(0.5cm+0.625cm,0)+(eb,-eb)){dir0}..% + {dir0}(ulcorner texto+(0.5cm+0.625cm,0)+(2eb,0))--% + (urcorner texto+(-eb,0)){dir0}.. + {dir-90}(urcorner texto+(0,-eb))-- + (lrcorner texto+(0,eb)){dir-90}.. + {dir180}(lrcorner texto+(-eb,0))-- + (llcorner texto+(0.125+0.625cm,0)+(2eb,0)){dir180}.. + {dir180}(llcorner texto+(0.125+0.625cm,0)+(eb,-eb))-- + (llcorner texto+(0.125+0.375cm,0)+(eb,-eb)){dir180}.. + {dir180}(llcorner texto+(0.125+0.375cm,0))-- + (llcorner texto+(0.125,0)+(eb,0)){dir180}.. + {dir90}(llcorner texto+(0.125,0)+(0,eb))-- + cycle; +else: + cadre=(coindebutbloc[numblocrep]+(0.125,0.125))-- + (coindebutbloc[numblocrep]+(0.0625+0.5cm,0)+(eb,0.125)){dir180}.. + {dir-90}(coindebutbloc[numblocrep]+(0.5cm,0)+(0,-eb))-- + (ulcorner texto+(0.5cm,0)+(0,eb)){dir-90}.. + {dir0}(ulcorner texto+(0.5cm,0)+(eb,0))-- +% (ulcorner texto+(0.125+0.875cm,0)){dir0}.. +% {dir0}(ulcorner texto+(0.125+0.875cm,0)+(eb,-eb))-- +% (ulcorner texto+(0.125+1.125cm,0)+(eb,-eb)){dir0}.. +% {dir0}(ulcorner texto+(0.125+1.125cm,0)+(2eb,0))--%--% + (urcorner texto+(-eb,0)){dir0}.. + {dir-90}(urcorner texto+(0,-eb))-- + (lrcorner texto+(0,eb)){dir-90}.. + {dir180}(lrcorner texto+(-eb,0))-- + (llcorner texto+(0.125+0.625cm,0)+(2eb,0)){dir180}.. + {dir180}(llcorner texto+(0.125+0.625cm,0)+(eb,-eb))-- + (llcorner texto+(0.125+0.375cm,0)+(eb,-eb)){dir180}.. + {dir180}(llcorner texto+(0.125+0.375cm,0))-- + (llcorner texto+(0.125,0)+(eb,0)){dir180}.. + {dir90}(llcorner texto+(0.125,0)+(0,eb))-- + cycle; +fi; +$=image( + fill cadre withcolor if print : coefprint*white else : if unknown colControle : LightOrange else : colControle fi fi; + draw cadre withcolor if print : coefprint*white else : if unknown colControle : LightOrange else : colControle fi fi; + if BlocStopAvant=false: + draw (coindebutbloc[numblocrep]+(0.0625+0.5cm,0)+(eb,0)){dir180}.. + {dir-90}(coindebutbloc[numblocrep]+(0.5cm,0)+(0,-eb))-- + (ulcorner texto+(0.5cm,0)+(0,eb)){dir-90}.. + {dir0}(ulcorner texto+(0.5cm,0)+(eb,0))-- + (ulcorner texto+(0.125+0.875cm,0)){dir0}.. + {dir0}(ulcorner texto+(0.125+0.875cm,0)+(eb,-eb))-- + (ulcorner texto+(0.125+1.125cm,0)+(eb,-eb)){dir0}.. + {dir0}(ulcorner texto+(0.125+1.125cm,0)+(2eb,0))--%--% + (urcorner texto+(-eb,0)){dir0}.. + {dir-90}(urcorner texto+(0,-eb))-- + (lrcorner texto+(0,eb)){dir-90}.. + {dir180}(lrcorner texto+(-eb,0))-- + (llcorner texto+(0.125+0.625cm,0)+(2eb,0)){dir180}.. + {dir180}(llcorner texto+(0.125+0.625cm,0)+(eb,-eb))-- + (llcorner texto+(0.125+0.375cm,0)+(eb,-eb)){dir180}.. + {dir180}(llcorner texto+(0.125+0.375cm,0))-- + (llcorner texto+(0.125,0)+(eb,0)){dir180}.. + {dir90}(llcorner texto+(0.125,0)+(0,eb))-- + (coindebutbloc[numblocrep]+(0.125,0.125)) + withcolor CoulLignes; + else: + draw (coindebutbloc[numblocrep]+(0.0625+0.5cm,0)+(eb,0.125)){dir180}.. + {dir-90}(coindebutbloc[numblocrep]+(0.5cm,0)+(0,-eb))-- + (ulcorner texto+(0.5cm,0)+(0,eb)){dir-90}.. + {dir0}(ulcorner texto+(0.5cm,0)+(eb,0))-- + %(ulcorner texto+(0.125+0.875cm,0)){dir0}.. + %{dir0}(ulcorner texto+(0.125+0.875cm,0)+(eb,-eb))-- + %(ulcorner texto+(0.125+1.125cm,0)+(eb,-eb)){dir0}.. + %{dir0}(ulcorner texto+(0.125+1.125cm,0)+(2eb,0))--%--% + (urcorner texto+(-eb,0)){dir0}.. + {dir-90}(urcorner texto+(0,-eb))-- + (lrcorner texto+(0,eb)){dir-90}.. + {dir180}(lrcorner texto+(-eb,0))-- + (llcorner texto+(0.125+0.625cm,0)+(2eb,0)){dir180}.. + {dir180}(llcorner texto+(0.125+0.625cm,0)+(eb,-eb))-- + (llcorner texto+(0.125+0.375cm,0)+(eb,-eb)){dir180}.. + {dir180}(llcorner texto+(0.125+0.375cm,0))-- + (llcorner texto+(0.125,0)+(eb,0)){dir180}.. + {dir90}(llcorner texto+(0.125,0)+(0,eb))-- + (coindebutbloc[numblocrep]+(0.125,0.125)) + withcolor CoulLignes; + fi; + ); +_coinprec:=(llcorner $); +_coinprec:=_coinprec+(0,eb); +numblocrep:=numblocrep-1; +$ +enddef; + +boolean BlocStopAvant; +BlocStopAvant=false; + +vardef Sinon= + LONG:=0; + save $; + picture $,texto; + _coinprec:=_coinprec-(0.5cm,0); + drawoptions(); + texto=image( + labeloffset:=0; + label.lrt(TEX("\, \hbox to"&decimal(LongRep[numblocrep])&"pt{\bfseries\barre sinon}"),if unknown _coinprec: (0,0) else:_coinprec fi) if print=false : withcolor blanc fi; + labeloffset:=3; + ); + path cadre; + if BlocStopAvant=false: + cadre=(llcorner texto+(0.125,0))-- + (coindebutbloc[numblocrep]+(0.125,0.125))-- + (coindebutbloc[numblocrep]+(0.0625+0.5cm,0)+(eb,0.125)){dir180}.. + {dir-90}(coindebutbloc[numblocrep]+(0.5cm,0)+(0,-eb))-- + (ulcorner texto+(0.5cm,0)+(0,eb)){dir-90}.. + {dir0}(ulcorner texto+(0.5cm,0)+(eb,0))-- + (ulcorner texto+(0.125+0.875cm,0)){dir0}.. + {dir0}(ulcorner texto+(0.125+0.875cm,0)+(eb,-eb))-- + (ulcorner texto+(0.125+1.125cm,0)+(eb,-eb)){dir0}.. + {dir0}(ulcorner texto+(0.125+1.125cm,0)+(2eb,0))--%--% + (urcorner texto+(-eb,0)){dir0}.. + {dir-90}(urcorner texto+(0,-eb))-- + (lrcorner texto+(0,eb)){dir-90}.. + {dir180}(lrcorner texto+(-eb,0))-- + (llcorner texto+(0.125+1.125cm,0)+(2eb,0)){dir180}.. + {dir180}(llcorner texto+(0.125+1.125cm,0)+(eb,-eb))-- + (llcorner texto+(0.125+0.875cm,0)+(eb,-eb)){dir180}.. + {dir180}(llcorner texto+(0.125+0.875cm,0))-- + cycle; + else: + cadre=(llcorner texto+(0.125,0))-- + (coindebutbloc[numblocrep]+(0.125,0.125))-- + (coindebutbloc[numblocrep]+(0.0625+0.5cm,0)+(eb,0.125)){dir180}.. + {dir-90}(coindebutbloc[numblocrep]+(0.5cm,0)+(0,-eb))-- + (ulcorner texto+(0.5cm,0)+(0,eb)){dir-90}.. + {dir0}(ulcorner texto+(0.5cm,0)+(eb,0))-- +% (ulcorner texto+(0.125+0.875cm,0)){dir0}.. +% {dir0}(ulcorner texto+(0.125+0.875cm,0)+(eb,-eb))-- +% (ulcorner texto+(0.125+1.125cm,0)+(eb,-eb)){dir0}.. +% {dir0}(ulcorner texto+(0.125+1.125cm,0)+(2eb,0))--%--% + (urcorner texto+(-eb,0)){dir0}.. + {dir-90}(urcorner texto+(0,-eb))-- + (lrcorner texto+(0,eb)){dir-90}.. + {dir180}(lrcorner texto+(-eb,0))-- + (llcorner texto+(0.125+1.125cm,0)+(2eb,0)){dir180}.. + {dir180}(llcorner texto+(0.125+1.125cm,0)+(eb,-eb))-- + (llcorner texto+(0.125+0.875cm,0)+(eb,-eb)){dir180}.. + {dir180}(llcorner texto+(0.125+0.875cm,0))-- + cycle; + fi; +$=image( + fill cadre withcolor if print=true : coefprint*white else : if unknown colControle : LightOrange else : colControle fi fi; + draw cadre withcolor if print=true : coefprint*white else : if unknown colControle : LightOrange else : colControle fi fi; + draw texto; + if BlocStopAvant=false: + draw (coindebutbloc[numblocrep]+(0.0625+0.5cm,0)+(eb,0.125)){dir180}.. + {dir-90}(coindebutbloc[numblocrep]+(0.5cm,0)+(0,-eb))-- + (ulcorner texto+(0.5cm,0)+(0,eb)){dir-90}.. + {dir0}(ulcorner texto+(0.5cm,0)+(eb,0))-- + (ulcorner texto+(0.125+0.875cm,0)){dir0}.. + {dir0}(ulcorner texto+(0.125+0.875cm,0)+(eb,-eb))-- + (ulcorner texto+(0.125+1.125cm,0)+(eb,-eb)){dir0}.. + {dir0}(ulcorner texto+(0.125+1.125cm,0)+(2eb,0))--%--% + (urcorner texto+(-eb,0)){dir0}.. + {dir-90}(urcorner texto+(0,-eb))-- + (lrcorner texto+(0,eb)){dir-90}.. + {dir180}(lrcorner texto+(-eb,0))-- + (llcorner texto+(0.125+1.125cm,0)+(2eb,0)){dir180}.. + {dir180}(llcorner texto+(0.125+1.125cm,0)+(eb,-eb))-- + (llcorner texto+(0.125+0.875cm,0)+(eb,-eb)){dir180}.. + {dir180}(llcorner texto+(0.125+0.875cm,0))-- + (llcorner texto+(0.125+0.5cm+eb,0)) + withcolor CoulLignes; + else: + draw (coindebutbloc[numblocrep]+(0.0625+0.5cm,0)+(eb,0.125)){dir180}.. + {dir-90}(coindebutbloc[numblocrep]+(0.5cm,0)+(0,-eb))-- + (ulcorner texto+(0.5cm,0)+(0,eb)){dir-90}.. + {dir0}(ulcorner texto+(0.5cm,0)+(eb,0))-- + %(ulcorner texto+(0.125+0.875cm,0)){dir0}.. + %{dir0}(ulcorner texto+(0.125+0.875cm,0)+(eb,-eb))-- + %(ulcorner texto+(0.125+1.125cm,0)+(eb,-eb)){dir0}.. + %{dir0}(ulcorner texto+(0.125+1.125cm,0)+(2eb,0))--%--% + (urcorner texto+(-eb,0)){dir0}.. + {dir-90}(urcorner texto+(0,-eb))-- + (lrcorner texto+(0,eb)){dir-90}.. + {dir180}(lrcorner texto+(-eb,0))-- + (llcorner texto+(0.125+1.125cm,0)+(2eb,0)){dir180}.. + {dir180}(llcorner texto+(0.125+1.125cm,0)+(eb,-eb))-- + (llcorner texto+(0.125+0.875cm,0)+(eb,-eb)){dir180}.. + {dir180}(llcorner texto+(0.125+0.875cm,0)) + withcolor CoulLignes; + fi; + draw (llcorner texto+(0.125,0))--(coindebutbloc[numblocrep]+(0.125,0.125)) withcolor CoulLignes; + ); + _coinprec:=(llcorner $)+(0.5cm,0); + _coinprec:=_coinprec+(0,eb); + coindebutbloc[numblocrep]:=(llcorner $)+(0,eb+0.125); + $ +enddef; + +vardef Attendre(expr nbpas)= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew("attendre",if string nbpas:OvalNb(nbpas) else: nbpas fi,"seconde(s)"); +ColBloc:=OrangeConTrois; +$=Affichage(texto); +$ +enddef; + +vardef AttendreJ(expr xa)= + LONG:=0; + save $; + picture $,texto; + if picture xa: + texto=ColleBoxNew("attendre jusqu'à ce que",xa); + ColBloc:=OrangeConTrois; + $=Affichage(texto); + else: + message("La commande -- AttendreJ -- n'admet qu'un argument de type picture."); + $=nullpicture; + fi; + $ +enddef; + +vardef Stop(expr nbpas)= + LONG:=0; + save $; + picture $,texto; + string TTm;%Pour sauvegarder le nbpas car en l'utilisant dans les if, il ne permet pas la concaténation... + TTm=if print:nbpas&"\hbox to1em{\barre}\blacktriangledown" else:"\color{white}"&nbpas&"\hbox to1em{\barre}\blacktriangledown"; + fi; + texto=image( + path ti; + ti=Box("stop"); + label(TEX("\bfseries\barre stop"),center ti) if print=false : withcolor white fi;%_>ok + if picture nbpas: + picture ta; + ta=nbpas; + drawoptions(shifted (xpart((lrcorner ti)-(llcorner ta)+(eb,0)),ypart(center ti-center ta))); + draw ta; + drawoptions(); + else: + path ta; + ta=RecBox(TTm);% + drawoptions(shifted (xpart((lrcorner ti)-(llcorner ta)+(eb,0)),ypart(center ti-center ta))); + if print=false : fill ta withcolor ControleTrois fi; + draw ta withcolor 0.95white; + label(TEX(TTm),center ta); + drawoptions(); + fi; + ); +$=AffichageStop shifted (if unknown _coinprec:(0,0) else :_coinprec fi - ulcorner AffichageStop); +_coinprec:=llcorner $; +_coinprec:=_coinprec;%+(0,eb); +_coincom:=1/2[lrcorner $,urcorner $]+(eb,0); +_coinnum:=(xpart(DebutListe+(-3*eb,0)),ypart(1/2[llcorner $,ulcorner $])); +if NumeroteLignes=true: + label(TEX("\footnotesize"&decimal(Nblignes)&""),_coinnum); + Nblignes:=Nblignes+1; +fi; +$ +enddef; + +vardef CommencerClone= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew("quand je commence comme un clone"); + ColBloc:=ControleTrois; + $=AffichageED(texto); + $ +enddef; + +vardef CreerClone(expr nbpas)= + LONG:=0; + save $; + picture $,texto; + if string nbpas: + texto=ColleBoxNew("créer un clone de",OvalMenuControle(nbpas)); + ColBloc:=ControleTrois; + $=Affichage(texto); + else: + message("La commande -- CreerClone -- accepte un argument de type string."); + $=nullpicture; + fi; + $ +enddef; + +vardef SupprimerClone= + LONG:=0; + save $; + picture $,texto; + texto=image( + path ti; + ti=Box("supprimer ce clone"); + label(TEX("\bfseries\barre supprimer ce clone"),center ti) if print=false : withcolor white fi;%_>ok + ); + $=AffichageStop shifted (if unknown _coinprec:(0,0) else :_coinprec fi - ulcorner AffichageStop); +_coinprec:=llcorner $; +_coinprec:=_coinprec+(0,eb); +_coincom:=1/2[lrcorner $,urcorner $]+(eb,0); +_coinnum:=(xpart(DebutListe+(-3*eb,0)),ypart(1/2[llcorner $,ulcorner $])); +if NumeroteLignes=true: + label(TEX("\footnotesize"&decimal(Nblignes)&""),_coinnum); + Nblignes:=Nblignes+1; +fi; +$ +enddef; +%%fin Section Contrôle%%% + +%%%%%%%% Section Evenements %%%%% +vardef Drapeau= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew("quand",DrapeauImage shifted(-(80,707)),"est cliqué"); + ColBloc:=EvenementTrois; + $=AffichageED(texto); + $ +enddef; + +vardef QPresse(expr nbpas)= + LONG:=0; + save $; + picture $,texto; + if string nbpas: + texto=ColleBoxNew("quand la touche",RecEvenementMenu(nbpas),"est pressée"); + ColBloc:=EvenementTrois; + $=AffichageED(texto); + else: + message("La commande -- QPresse -- accepte un argument de type string."); + $=nullpicture; + fi; + $ +enddef; + +vardef QLutinPresse= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew("quand ce sprite est cliqué"); + ColBloc:=EvenementTrois; + $=AffichageED(texto); + $ +enddef; + +vardef QSpritePresse=QLutinPresse enddef; + +vardef QScenePressee= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew("quand la scène est cliquée"); + ColBloc:=EvenementTrois; + $=AffichageED(texto); + $ +enddef; + +vardef QBasculeAR(expr nbpas)= + LONG:=0; + save $; + picture $,texto; + if string nbpas: + texto=ColleBoxNew("quand l'arrière-plan bascule sur",RecEvenementMenu(nbpas)); + ColBloc:=EvenementTrois; + $=AffichageED(texto); + else: + message("La commande -- QBasculeAR -- accepte un argument de type string."); + $=nullpicture; + fi; + $ +enddef; + +vardef QVolumeSup(expr nbpas,xa)= + LONG:=0; + save $; + picture $,texto; + if string nbpas: + texto=ColleBoxNew("quand le",RecEvenementMenu(nbpas),"$>$",if string xa:OvalNb(xa) else: xa fi); + ColBloc:=EvenementTrois; + $=AffichageED(texto); +else: + message("La commande -- QVolumeSup -- accepte un premier argument de type string."); + $=nullpicture; +fi; +$ +enddef; + +vardef QRecevoirMessage(expr nbpas)= + LONG:=0; + save $; + picture $,texto; + if string nbpas: + texto=ColleBoxNew("quand je reçois",RecEvenementMenu(nbpas)); + ColBloc:=EvenementTrois; + $=AffichageED(texto); + else: + message("La commande -- QRecevoirMessage -- accepte un argument de type string."); + $=nullpicture; + fi; + $ +enddef; + +vardef EnvoyerMessage(expr nbpas)= + LONG:=0; + save $; + picture $,texto; + if string nbpas: + texto=ColleBoxNew("envoyer à tous",OvalMenuEvenement(nbpas)); + ColBloc:=EvenementTrois; + $=Affichage(texto); + else: + message("La commande -- EnvoyerMessage -- accepte un argument de type string."); + $=nullpicture; + fi; + $ +enddef; + +vardef EnvoyerMessageA(expr nbpas)= + LONG:=0; + save $; + picture $,texto; + if string nbpas: + texto=ColleBoxNew("envoyer à tous",OvalMenuEvenement(nbpas),"et attendre"); + ColBloc:=EvenementTrois; + $=Affichage(texto); + else: + message("La commande -- EnvoyerMessageA -- accepte un argument de type string."); + $=nullpicture; + fi; + $ +enddef; + +vardef DrapeauImage= + save $; picture $; + $=image( + linecap := butt; + linejoin := rounded; + if print = false: drawoptions(withcolor(76/255,191/255,86/255)) fi; + fill (72.000000,713.254028)--(72.000000,718.918030)--(72.507797,718.979980) + --(72.984398,719.026978)--(73.437500,719.054993)--(73.867203,719.070007) + --(74.273399,719.073975)--(74.660202,719.062988)--(75.023399,719.043030) + --(75.367203,719.012024)--(75.695297,718.968994)--(76.003899,718.918030) + --(76.300797,718.859009)--(76.578102,718.793030)--(76.847702,718.723022) + --(77.105499,718.648010)--(77.351601,718.570007)--(77.589798,718.484009) + --(77.820297,718.401978)--(78.042999,718.312988)--(78.234398,718.237976) + --(78.234398,706.906006)--(78.042999,706.979980)--(77.820297,707.065979) + --(77.589798,707.151978)--(77.351601,707.237976)--(77.105499,707.315979) + --(76.847702,707.390991)--(76.578102,707.460999)--(76.300797,707.526978) + --(76.003899,707.585999)--(75.695297,707.637024)--(75.367203,707.676025) + --(75.023399,707.710999)--(74.660202,707.729980)--(74.273399,707.742004) + --(73.867203,707.737976)--(73.437500,707.723022)--(72.984398,707.690979) + --(72.507797,707.648010)--(72.000000,707.585999)--cycle; +% drawoptions (withcolor (0,0.625,0)); + fill (78.246101,712.565979)--(78.261703,718.226990)--(78.476601,718.140991) + --(78.691399,718.059021)--(78.902298,717.976990)--(79.113297,717.895020) + --(79.328102,717.820007)--(79.546898,717.754028)--(79.765602,717.687988) + --(79.992203,717.632996)--(80.226601,717.585999)--(80.468803,717.543030) + --(80.718803,717.515991)--(80.980499,717.495972)--(81.253899,717.492004) + --(81.542999,717.495972)--(81.843803,717.515991)--(82.160202,717.546997) + --(82.492203,717.598022)--(82.847702,717.664001)--(83.218803,717.745972) + --(83.332001,717.773010)--(83.332001,706.440979)--(83.218803,706.414001) + --(82.847702,706.328003)--(82.492203,706.265991)--(82.160202,706.215027) + --(81.843803,706.179993)--(81.542999,706.164001)--(81.253899,706.156006) + --(80.980499,706.164001)--(80.718803,706.184021)--(80.468803,706.210999) + --(80.226601,706.250000)--(79.992203,706.301025)--(79.765602,706.354980) + --(79.546898,706.418030)--(79.328102,706.487976)--(79.113297,706.562988) + --(78.902298,706.645020)--(78.691399,706.723022)--(78.476601,706.809021) + --(78.234398,706.906006)--cycle; +% drawoptions (withcolor (0,0.625,0)); + fill (83.332001,712.109009)--(83.332001,717.773010)--(83.613297,717.843994) + --(84.031303,717.965027)--(84.468803,718.104980)--(84.933601,718.265991) + --(85.425797,718.448975)--(85.945297,718.651978)--(86.492203,718.882996) + --(87.070297,719.137024)--(87.679703,719.414001)--(88.324203,719.718994) + --(89.000000,720.054993)--(89.000000,708.718994)--(88.324203,708.387024) + --(87.679703,708.081970)--(87.070297,707.801025)--(86.492203,707.551025) + --(85.945297,707.320007)--(85.425797,707.117004)--(84.933601,706.934021) + --(84.468803,706.773010)--(84.031303,706.632996)--(83.613297,706.512024) + --(83.332001,706.440979)--cycle; +% drawoptions (withcolor (0,0.625,0)); +%pickup pencircle scaled 0.199253bp; + draw (72.000000,713.254028)--(72.000000,718.918030)--(72.507797,718.979980) + --(72.984398,719.026978)--(73.437500,719.054993)--(73.867203,719.070007) + --(74.273399,719.073975)--(74.660202,719.062988)--(75.023399,719.043030) + --(75.367203,719.012024)--(75.695297,718.968994)--(76.003899,718.918030) + --(76.300797,718.859009)--(76.578102,718.793030)--(76.847702,718.723022) + --(77.105499,718.648010)--(77.351601,718.570007)--(77.589798,718.484009) + --(77.820297,718.401978)--(78.042999,718.312988)--(78.261703,718.226990) + --(78.476601,718.140991)--(78.691399,718.059021)--(78.902298,717.976990) + --(79.113297,717.895020)--(79.328102,717.820007)--(79.546898,717.754028) + --(79.765602,717.687988)--(79.992203,717.632996)--(80.226601,717.585999) + --(80.468803,717.543030)--(80.718803,717.515991)--(80.980499,717.495972) + --(81.253899,717.492004)--(81.542999,717.495972)--(81.843803,717.515991) + --(82.160202,717.546997)--(82.492203,717.598022)--(82.847702,717.664001) + --(83.218803,717.745972)--(83.613297,717.843994)--(84.031303,717.965027) + --(84.468803,718.104980)--(84.933601,718.265991)--(85.425797,718.448975) + --(85.945297,718.651978)--(86.492203,718.882996)--(87.070297,719.137024) + --(87.679703,719.414001)--(88.324203,719.718994)--(89.000000,720.054993) + --(89.000000,708.718994)--(88.324203,708.387024)--(87.679703,708.081970) + --(87.070297,707.801025)--(86.492203,707.551025)--(85.945297,707.320007) + --(85.425797,707.117004)--(84.933601,706.934021)--(84.468803,706.773010) + --(84.031303,706.632996)--(83.613297,706.512024)--(83.218803,706.414001) + --(82.847702,706.328003)--(82.492203,706.265991)--(82.160202,706.215027) + --(81.843803,706.179993)--(81.542999,706.164001)--(81.253899,706.156006) + --(80.980499,706.164001)--(80.718803,706.184021)--(80.468803,706.210999) + --(80.226601,706.250000)--(79.992203,706.301025)--(79.765602,706.354980) + --(79.546898,706.418030)--(79.328102,706.487976)--(79.113297,706.562988) + --(78.902298,706.645020)--(78.691399,706.723022)--(78.476601,706.809021) + --(78.261703,706.895020)--(78.042999,706.979980)--(77.820297,707.065979) + --(77.589798,707.151978)--(77.351601,707.237976)--(77.105499,707.315979) + --(76.847702,707.390991)--(76.578102,707.460999)--(76.300797,707.526978) + --(76.003899,707.585999)--(75.695297,707.637024)--(75.367203,707.676025) + --(75.023399,707.710999)--(74.660202,707.729980)--(74.273399,707.742004) + --(73.867203,707.737976)--(73.437500,707.723022)--(72.984398,707.690979) + --(72.507797,707.648010)--(72.000000,707.585999)--cycle if print=false : withcolor (0,0.625,0) fi; + %pickup pencircle scaled 0.8bp; + draw (72.000000,699)--(72.000000,720); + drawoptions(); + ); + $:=$ rotatedabout((72.000000,699),-15); + $ +enddef; +%%Fin section Evenement%%% + +%%%% Section Bloc %%%% +vardef AffichageBlocDef= + path cadre; + cadre=(llcorner texto+(-eb,0)){dir-90}..{dir0}(llcorner texto+(0,-eb))-- + (llcorner texto+(0.375cm,0)+(-eb,-eb)){dir0}.. + {dir0}(llcorner texto+(0.375cm,0)+(0,-2eb))-- + (llcorner texto+(0.625cm,0)+(0,-2eb)){dir0}.. + {dir0}(llcorner texto+(0.625cm,0)+(eb,-eb))-- + (lrcorner texto+(0,-eb)){dir0}..{dir90}(lrcorner texto+(eb,0))-- + (urcorner texto+(eb,eb)){dir90}..{dir180}(urcorner texto+(0,2eb))-- + (ulcorner texto+(0,2eb)){dir180}.. + {dir-90}(ulcorner texto+(-eb,eb))-- + cycle; + picture TEXT; + TEXT=image( + fill cadre withcolor if print : coefprint*white else : BlocTrois fi;%if unknown colBloc : DarkPurple else: colBloc fi fi; + draw texto; + draw cadre withcolor CoulLignes; + ); + TEXT +enddef; + +vardef Bloc(text nomblocbloc)= + LONG:=0; + save $; + picture $,texto; + texto=image( + picture CBbloc; + CBbloc=ColleBoxNew(nomblocbloc); + draw CBbloc; + ); + ColBloc:=BlocTrois; + $=Affichage(texto); + $ +enddef; + +vardef NouveauBloc(text nbpasbloc)= + LONG:=0; + save $; + picture $,texto; + texto=image( + picture CB; + CB=ColleBoxNew("définir",BlocPuzzle(nbpasbloc)); + draw CB; + ); +$=AffichageBlocDef shifted (if unknown _coinprec:(0,0) else :_coinprec fi - ulcorner AffichageBlocDef); +_coinprec:=llcorner $; +_coinprec:=_coinprec+(0,eb); +_coincom:=1/2[lrcorner $,urcorner $]+(eb,0); +_coinnum:=(xpart(DebutListe+(-3*eb,0)),ypart(1/2[llcorner $,ulcorner $])); +if NumeroteLignes=true: + label(TEX("\footnotesize"&decimal(Nblignes)&""),_coinnum); + Nblignes:=Nblignes+1; +fi; +$ +enddef; +%%%% Fin Section Bloc%%%% + +%%% Section Divers%%% +vardef CommandeVide(expr commande)= + LONG:=0; + save $; + picture $,texto,TEXT; + if string commande : + texto=image( + label.lrt(TEX("\barre \hbox to"&commande&"cm{}"),if unknown _coinprec: (0,0) else:_coinprec fi); + ); +else: + texto=commande; +fi; +ColBloc:=white; +$=Affichage(texto); +$ +enddef; + +vardef LigneVide= + LONG:=0; + save $; + picture $,texto,TEXT; + texto=image( + label.lrt(TEX("\barre \hbox to2cm{}"),if unknown _coinprec: (0,0) else:_coinprec fi); + ); +TEXT=image( + path cadre; + cadre=CADRE(texto); + unfill cadre; + %draw (urcorner texto+(0,eb))-- + % (ulcorner texto+(0.625cm,0)+(eb,eb)){dir180}.. + % {dir180}(ulcorner texto+(0.625cm,0))-- + % (ulcorner texto+(0.375cm,0)){dir180}.. + % {dir180}(ulcorner texto+(0.375cm,0)+(-eb,eb))-- + % (ulcorner texto+(0,eb)) withpen pencircle scaled 0; + ); +$=TEXT shifted (if unknown _coinprec:(0,0) else :_coinprec fi - ulcorner TEXT); +_coinprec:=llcorner $; +_coinprec:=_coinprec+(0,eb); +_coincom:=1/2[lrcorner $,urcorner $]+(eb,0); +_coinnum:=(xpart(DebutListe+(-3*eb,0)),ypart(1/2[llcorner $,ulcorner $])); +if NumeroteLignes=true: + label(TEX("\footnotesize"&decimal(Nblignes)&""),_coinnum); + Nblignes:=Nblignes+1; +fi; +$ +enddef; + +vardef LigneVideVar(expr commande)= + LONG:=0; + save $; + picture $,texto,TEXT; + if string texto: + texto=image( + label.lrt(TEX("\barre \hbox to2cm{}"),if unknown _coinprec: (0,0) else:_coinprec fi); + ); +else: + texto=commande; +fi; +TEXT=image( + path cadre; + cadre=(llcorner texto+(-eb,0))--(llcorner texto+(0,-eb))-- + (llcorner texto+(0.375cm,0)+(-eb,-eb))-- + (llcorner texto+(0.375cm,0)+(0,-2eb))-- + (llcorner texto+(0.625cm,0)+(0,-2eb))-- + (llcorner texto+(0.625cm,0)+(eb,-eb))-- + (lrcorner texto+(0,-eb))--(lrcorner texto+(eb,0))--(urcorner texto+(eb,0))--(urcorner texto+(0,eb))-- + (ulcorner texto+(0.625cm,0)+(eb,eb))-- + (ulcorner texto+(0.625cm,0))-- + (ulcorner texto+(0.375cm,0))-- + (ulcorner texto+(0.375cm,0)+(-eb,eb))-- + (ulcorner texto+(0,eb))--(ulcorner texto+(-eb,0))--cycle; + fill cadre withcolor white; +% draw (urcorner texto+(0,eb))-- +% (ulcorner texto+(0.625cm,0)+(eb,eb))-- +% (ulcorner texto+(0.625cm,0))-- +% (ulcorner texto+(0.375cm,0))-- +% (ulcorner texto+(0.375cm,0)+(-eb,eb))-- +% (ulcorner texto+(0,eb)) withpen pencircle scaled 0.05bp; + ); +$=TEXT shifted (if unknown _coinprec:(0,0) else :_coinprec fi - ulcorner TEXT); +_coinprec:=llcorner $; +_coinprec:=_coinprec+(0,eb); +_coincom:=1/2[lrcorner $,urcorner $]+(eb,0); +_coinnum:=(xpart(DebutListe+(-3*eb,0)),ypart(1/2[llcorner $,ulcorner $])); +if NumeroteLignes=true: + label(TEX("\footnotesize"&decimal(Nblignes)&""),_coinnum); + Nblignes:=Nblignes+1; +fi; +$ +enddef; + +vardef LignePointilles= + LONG:=0; + save $; + picture $,texto,TEXT; + texto=image( + label.lrt(TEX("\barre\Large \strut\ldots\hbox to1em{}"),if unknown _coinprec: (0,0) else:_coinprec fi); + ); +TEXT=image( + path cadre; + cadre=CADRE(texto); + fill cadre withcolor white; + draw %(urcorner texto+(0,eb))-- + (ulcorner texto+(0.625cm,0)+(eb,eb)){dir180}.. + {dir180}(ulcorner texto+(0.625cm,0))-- + (ulcorner texto+(0.375cm,0)){dir180}.. + {dir180}(ulcorner texto+(0.375cm,0)+(-eb,eb)) + %--(ulcorner texto+(0,eb)) + withpen pencircle scaled 0.01; + draw texto; + ); +$=TEXT shifted (if unknown _coinprec:(0,0) else :_coinprec fi - ulcorner TEXT); +_coinprec:=llcorner $; +_coinprec:=_coinprec+(0,eb); +_coincom:=1/2[lrcorner $,urcorner $]+(eb,0); +_coinnum:=(xpart(DebutListe+(-3*eb,0)),ypart(1/2[llcorner $,ulcorner $])); +if NumeroteLignes=true: + label(TEX("\footnotesize"&decimal(Nblignes)&""),_coinnum); + Nblignes:=Nblignes+1; +fi; +$ +enddef; + +vardef Commentaires(expr commande)= + LONG:=0; + save $; + picture $,texto,TEXT; + texto=image( + label.lrt(TEX("\barre "& commande &""),if unknown _coinprec: (0,0) else:_coinprec fi) withcolor 0.5*white; + ); +TEXT=image( + path cadre; + cadre=CADRE(texto); + fill cadre withcolor white; + draw texto; + ); +$=TEXT shifted (if unknown _coinprec:(0,0) else :_coinprec fi - ulcorner TEXT); +_coinprec:=llcorner $; +_coinprec:=_coinprec+(0,eb); +$ +enddef; + +color colcom; +colcom=0.5white; + +vardef CommentairesLigne(expr commande)= + LONG:=0; + save $; + picture $,texto,TEXT; + TEXT=image( + label.rt(TEX(commande), _coincom) withcolor colcom; + ); +$=TEXT shifted (_coincom - 1/2[llcorner TEXT,ulcorner TEXT]); +$ +enddef; + +vardef BlocGris(expr ar)= + LONG:=0; + save $; picture $; + path ta; string TTm; + TTm=ar&"\barre"; + ta=OvalMiniBox(TTm); + $=image( + fill ta withcolor 0.975white; + draw ta withcolor 0.85white; + label(TEX(TTm),center ta) if print=false : withcolor blanc fi; + ); +$ +enddef; + +vardef BlocGrisMulti(text argris)= + LONG:=0; + save $; picture $; + path ta; picture TTm; + TTm=ColleBoxNew(argris); + ta=OvalMiniBox(TTm); + $=image( + fill ta withcolor 0.975white; + draw ta; + %label(TEX(TTm),center ta) if print=false : withcolor blanc fi; + ); +$ +enddef; + +boolean BlocE; +BlocE:=false; + +vardef BlocUser(expr colblocuser)(text textbloc)= + LONG:=0; + save $; + picture $; + save TA; path TA; picture BUTB; picture texto; picture TEXT; + BUTB=ColleBoxNew(textbloc); + TA=Box(BUTB); + texto=image( + draw BUTB; + ); + ColBloc:=colblocuser; + if BlocE=false: + $=Affichage(texto); + else: + $=AffichageED(texto); + fi; + $ +enddef; + +vardef BlocCouleur(expr colblocuser)= + LONG:=0; + save $; + picture $,texto,TEXT; + texto=image( + label.lrt(TEX("\barre \hbox to4cm{}"),if unknown _coinprec: (0,0) else:_coinprec fi); + ); +ColBloc:=colblocuser; +$=Affichage(texto); +$ +enddef; +%% fin Section Divers %%% + +%% Section Capteur %%%% +vardef Demander(expr nbpas)= + LONG:=0; + save Dem; + picture Dem,texto; + if string nbpas: + texto=ColleBoxNew("demander",OvalNb(nbpas),"et attendre"); + ColBloc:=CapteurTrois; + Dem=Affichage(texto); + else: + message("La commande -- Demander -- admet un argument de type string."); + Dem=nullpicture; + fi; + Dem +enddef; + +vardef ReinitChrono= + LONG:=0; + save $; + picture $,texto; + texto=ColleBoxNew("réinitialiser le chronomètre"); + ColBloc:=CapteurTrois; + $=Affichage(texto); + $ +enddef; + +vardef MettreGlissement(expr nbpas)= + LONG:=0; + save $; + picture $,texto; + if string nbpas: + texto=ColleBoxNew("mettre mode de glissement à",RecMenuCap(nbpas)); + ColBloc:=CapteurTrois; + $=Affichage(texto); + else: + message("La commande -- MettreGlissement -- admet un argument de type string."); + $=nullpicture; + fi; + $ +enddef; + +%video + +vardef CameraImage= + LONG:=0; + save $; + picture $; + $=image( + pair A,B,C,D,E,F; + A=(0,0); + B-A=(10,0); + C-B=(0,10); + D-C=A-B; + E-B=(4,1.5); + F-C=(4,-1.5); + numeric EB; + EB=2pt; + path camera; + camera=(A+(EB,0))--(B+(-EB,0)){dir0}..{dir90}(B+(0,EB))--2/5[B,C]--E--F--3/5[B,C]--(C+(0,-EB)){dir90}..{dir-180}(C+(-EB,0))--(D+(EB,0)){dir180}..{dir-90}(D+(0,-EB))--(A+(0,EB)){dir-90}..{dir0}cycle; + fill camera withcolor (77,77,77)/255; + draw camera withcolor (77,77,77)*0.95/255; + path cc; + cc=fullcircle scaled 6; + color coul[]; + if print: + coul0:=0.9white; + coul1:=0.933white; + coul2:=0.966white; + coul3:=white; + else: + coul0=(75,205,169)/255; + coul1=(16,230,212)/255; + coul2=(224,247,241)/255; + coul3=(1,1,1); + fi; + for k=0 upto 3: + fill (cc shifted(B+(10,3*k))) withcolor coul[k]; + draw (cc shifted(B+(10,3*k))) withcolor 0.95*coul[k]; + endfor; + draw ((-3,0)--(-3,18)) withcolor if print : coefprint*white else: StyloTrois fi; + pickup pencircle scaled eppen; + ); + $:=$ scaled 0.8; + $ +enddef; + +vardef ImageCamera= + save titi; + picture titi; + titi=image( + draw CameraImage shifted(-12,-5); + draw (((0,0)--(0,18pt)) shifted(9,-9)) withpen pencircle scaled 1bp withcolor if print: 0.5*coefprint*white else: (69/255,168/255,140/255) fi; + ); + titi +enddef; + +vardef ActiverVideo(expr nbpas)= + LONG:=0; + save $; + picture $,texto; + if string nbpas: + texto=ColleBoxNew(ImageCamera,"vidéo",OvalStylo(nbpas)); + ColBloc:=StyloTrois; + $=Affichage(texto); + else: + message("La commande -- ActiverVideo -- admet un argument de type string."); + $=nullpicture; + fi; + $ +enddef; + +vardef TransparenceVideo(expr nbpas)= + LONG:=0; + save $; + picture $,texto; + if string nbpas: + texto=ColleBoxNew(ImageCamera,"mettre la transparence vidéo sur",OvalNb(nbpas)); + ColBloc:=StyloTrois; + $=Affichage(texto); + else: + message("La commande -- TransparenceVideo -- admet un argument de type string."); + $=nullpicture; + fi; + $ +enddef; + +vardef QuandMV(expr nbpas)= + LONG:=0; + save $; + picture $,texto; + if string nbpas: + texto=ColleBoxNew(ImageCamera,"quand mouvement vidéo $>$",OvalNb(nbpas)); + ColBloc:=StyloTrois; + $=AffichageED(texto); + else: + message("La commande -- QuandMV -- admet un argument de type string."); + $=nullpicture; + fi; + $ +enddef; + +vardef VideoSur(expr nbpas,xa)= + LONG:=0; + save $; + picture $,texto; + if (string nbpas) and (string xa): + texto=ColleBoxNew(ImageCamera,"vidéo",OvalStylo(nbpas),"sur",OvalStylo(xa)); + %ColBloc:=StyloTrois; + path ta; + ta=OvalBox(texto); + $=image( + fill ta withcolor if print: coefprint*white else: StyloTrois fi; + draw ta withcolor CoulLignes; + %label(TEX(TTm),center ta) if print=false : withcolor blanc fi; + draw texto; + ); + else: + message("La commande -- VideoSur -- admet deux arguments de type string."); + $=nullpicture; + fi; + $ +enddef; + +%% fin Section Capteur %%% + +%%% Section Variables %%% +vardef MettreVar(expr nbpas,xa)= + LONG:=0; + save MV; + picture MV,texto; + if string nbpas : + texto=ColleBoxNew("mettre",RecMenuVar(nbpas),"à",if string xa:OvalNb(xa) else: xa fi); + ColBloc:=OrangeTrois; + MV=Affichage(texto); + else: + message("La commande -- MettreVar -- admet un premier paramètre de type string."); + MV=nullpicture; + fi; + MV +enddef; + +vardef AjouterVar(expr nbpas,xa)= + LONG:=0; + save $; + picture $,texto; + if string xa : + texto=ColleBoxNew("ajouter",if string nbpas:OvalNb(nbpas) else: nbpas fi,"à",RecMenuVar(xa)); + ColBloc:=OrangeTrois; + $=Affichage(texto); +else: + message("La commande -- AjouterVar -- admet un deuxième paramètre de type string."); + $=nullpicture; + fi; + $ +enddef; + +vardef MontrerVar(expr nbpas)= + LONG:=0; + save $; + picture $,texto; + if string nbpas : + texto=ColleBoxNew("montrer la variable",RecMenuVar(nbpas)); + ColBloc:=OrangeTrois; + $=Affichage(texto); + else: + message("La commande -- MontrerVar -- admet un premier paramètre de type string."); + $=nullpicture; + fi; + $ +enddef; + +vardef CacherVar(expr nbpas)= + LONG:=0; + save $; + picture $,texto; + if string nbpas : + texto=ColleBoxNew("cacher la variable",RecMenuVar(nbpas)); + ColBloc:=OrangeTrois; + $=Affichage(texto); + else: + message("La commande -- CacherVar -- admet un premier paramètre de type string."); + $=nullpicture; + fi; + $ +enddef; + +%Liste +vardef AjouterListe(expr nbpas,xa)= + LONG:=0; + save $; + picture $,texto; + if string xa : + texto=ColleBoxNew("ajouter",if string nbpas:OvalNb(nbpas) else: nbpas fi,"à",RecMenuList(xa)); + ColBloc:=OrangeListTrois; + $=Affichage(texto); +else: + message("La commande -- AjouterListe -- admet un deuxième paramètre de type string."); + $=nullpicture; + fi; + $ +enddef; + +vardef SupprimerListe(expr nbpas,xa)= + LONG:=0; + save $; + picture $,texto; + if string xa : + texto=ColleBoxNew("supprimer l'élément",if string nbpas:OvalNb(nbpas) else: nbpas fi,"de",RecMenuList(xa)); + ColBloc:=OrangeListTrois; + $=Affichage(texto); +else: + message("La commande -- SupprimerListe -- admet un deuxième paramètre de type string."); + $=nullpicture; + fi; + $ +enddef; + +vardef SupprimerListeAll(expr nbpas)= + LONG:=0; + save $; + picture $,texto; + if string nbpas : + texto=ColleBoxNew("supprimer tous les éléments de la liste",RecMenuList(nbpas)); + ColBloc:=OrangeListTrois; + $=Affichage(texto); +else: + message("La commande -- SupprimerListe -- admet un deuxième paramètre de type string."); + $=nullpicture; +fi; +$ +enddef; + +vardef InsererListe(expr xa,nbpas,ya)= + LONG:=0; + save $; + picture $,texto; + if string ya : + texto=ColleBoxNew("insérer",if string xa:OvalNb(xa) else: xa fi,"en position",if string nbpas:OvalNb(nbpas) else: nbpas fi,"de",RecMenuList(ya)); + ColBloc:=OrangeListTrois; + $=Affichage(texto); + else: + message("La commande -- InsererListe -- admet un troisième paramètre de type string."); + $=nullpicture; + fi; + $ +enddef; + +vardef RemplacerListe(expr xa,nbpas,ya)= + LONG:=0; + save $; + picture $,texto; + if string nbpas : + texto=ColleBoxNew("remplacer l'élément",if string xa:OvalNb(xa) else: xa fi,"de la liste",RecMenuList(nbpas),"par",if string ya:OvalNb(ya) else: ya fi); + ColBloc:=OrangeListTrois; + $=Affichage(texto); +else: + message("La commande -- RemplacerListe -- admet un deuxième paramètre de type string."); + $=nullpicture; +fi; +$ +enddef; + +vardef MontrerListe(expr xa)= + LONG:=0; + save $; + picture $,texto; + if string xa : + texto=ColleBoxNew("montrer la liste",RecMenuList(xa)); + ColBloc:=OrangeListTrois; + $=Affichage(texto); + else: + message("La commande -- MontrerListe -- admet un paramètre de type string."); + $=nullpicture; + fi; + $ +enddef; + +vardef CacherListe(expr xa)= + LONG:=0; + save $; + picture $,texto; + if string xa : + texto=ColleBoxNew("cacher la liste",RecMenuList(xa)); + ColBloc:=OrangeListTrois; + $=Affichage(texto); + else: + message("La commande -- CacherListe -- admet un paramètre de type string."); + $=nullpicture; + fi; + $ +enddef; + +%%% Section Operateur %%% + +vardef OpAdd(expr pasun,pasdeux)= + save Oop; picture Oop; + save TAao; path TAao; + save LOPop; picture LOPop; + LOPop=ColleBoxNew(if string pasun : OvalNb(pasun) else: pasun fi,"$+$",if string pasdeux : OvalNb(pasdeux) else: pasdeux fi); + TAao=OvalBox(LOPop); + Oop=image( + fill TAao if print=false : withcolor FondOvalOp else : withcolor coefprint*white fi; + draw LOPop; + draw TAao if print=false : withcolor coefprint*white fi; + ); + Oop:=Oop shifted(-center Oop); + Oop +enddef; + +vardef OpSous(expr pasun,pasdeux)= + save Oop; picture Oop; + save TAao; path TAao; + save LOPop; picture LOPop; + LOPop=ColleBoxNew(if string pasun : OvalNb(pasun) else: pasun fi,"$-$",if string pasdeux : OvalNb(pasdeux) else: pasdeux fi); + TAao=OvalBox(LOPop); + Oop=image( + fill TAao if print=false : withcolor FondOvalOp else : withcolor coefprint*white fi; + draw LOPop; + draw TAao if print=false : withcolor coefprint*white fi; + ); + Oop:=Oop shifted(-center Oop); + Oop +enddef; + +vardef OpMul(expr pasun,pasdeux)= + save Oop; picture Oop; + save TAao; path TAao; + save LOPop; picture LOPop; + LOPop=ColleBoxNew(if string pasun : OvalNb(pasun) else: pasun fi,"$\times$",if string pasdeux : OvalNb(pasdeux) else: pasdeux fi); + TAao=OvalBox(LOPop); + Oop=image( + fill TAao if print=false : withcolor FondOvalOp else : withcolor coefprint*white fi; + draw LOPop; + draw TAao if print=false : withcolor coefprint*white fi; + ); + Oop:=Oop shifted(-center Oop); + Oop +enddef; + +vardef OpDiv(expr pasun,pasdeux)= + save Oop; picture Oop; + save TAao; path TAao; + save LOPop; picture LOPop; + LOPop=ColleBoxNew(if string pasun : OvalNb(pasun) else: pasun fi,"$\div$",if string pasdeux : OvalNb(pasdeux) else: pasdeux fi); + TAao=OvalBox(LOPop); + Oop=image( + fill TAao if print=false : withcolor FondOvalOp else : withcolor coefprint*white fi; + draw LOPop; + draw TAao if print=false : withcolor coefprint*white fi; + ); + Oop:=Oop shifted(-center Oop); + Oop +enddef; + +vardef OpAlea(expr pasun,pasdeux)= + save Oop; picture Oop; + save TAao; path TAao; + save LOPop; picture LOPop; + LOPop=ColleBoxNew("nombre aléatoire entre",if string pasun : OvalNb(pasun) else: pasun fi,"et",if string pasdeux : OvalNb(pasdeux) else: pasdeux fi); + TAao=OvalBox(LOPop); + Oop=image( + fill TAao if print=false : withcolor FondOvalOp else : withcolor coefprint*white fi; + draw LOPop; + draw TAao if print=false : withcolor coefprint*white fi; + ); + Oop:=Oop shifted(-center Oop); + Oop +enddef; + +vardef OpRegrouper(expr pasun,pasdeux)= + save Oop; picture Oop; + save TAao; path TAao; + save LOPop; picture LOPop; + LOPop=ColleBoxNew("regrouper",if string pasun : OvalNb(pasun) else: pasun fi,"et",if string pasdeux : OvalNb(pasdeux) else: pasdeux fi); + TAao=OvalBox(LOPop); + Oop=image( + fill TAao if print=false : withcolor FondOvalOp else : withcolor coefprint*white fi; + draw LOPop; + draw TAao if print=false : withcolor coefprint*white fi; + ); + Oop:=Oop shifted(-center Oop); + Oop +enddef; + +vardef OpLettre(expr pasun,pasdeux)= + save Oop; picture Oop; + save TAao; path TAao; + save LOPop; picture LOPop; + LOPop=ColleBoxNew("lettre",if string pasun : OvalNb(pasun) else: pasun fi,"de",if string pasdeux : OvalNb(pasdeux) else: pasdeux fi); + TAao=OvalBox(LOPop); + Oop=image( + fill TAao if print=false : withcolor FondOvalOp else : withcolor coefprint*white fi; + draw LOPop; + draw TAao if print=false : withcolor coefprint*white fi; + ); + Oop:=Oop shifted(-center Oop); + Oop +enddef; + +vardef OpLongueur(expr pasun)= + save Oop; picture Oop; + save TAao; path TAao; + save LOPop; picture LOPop; + LOPop=ColleBoxNew("longueur de",if string pasun : OvalNb(pasun) else: pasun fi); + TAao=OvalBox(LOPop); + Oop=image( + fill TAao if print=false : withcolor FondOvalOp else : withcolor coefprint*white fi; + draw LOPop; + draw TAao if print=false : withcolor coefprint*white fi; + ); + Oop:=Oop shifted(-center Oop); + Oop +enddef; + +vardef OpArrondi(expr pasun)= + save Oop; picture Oop; + save TAao; path TAao; + save LOPop; picture LOPop; + LOPop=ColleBoxNew("arrondi de",if string pasun : OvalNb(pasun) else: pasun fi); + TAao=OvalBox(LOPop); + Oop=image( + fill TAao if print=false : withcolor FondOvalOp else : withcolor coefprint*white fi; + draw LOPop; + draw TAao if print=false : withcolor coefprint*white fi; + ); + Oop:=Oop shifted(-center Oop); + Oop +enddef; + +vardef OpFonction(expr pasun,pasdeux)= + save Oop; picture Oop; + save TAao; path TAao; + save LOPop; picture LOPop; + LOPop=ColleBoxNew(RecMenuOp(pasun),"de",if string pasdeux : OvalNb(pasdeux) else: pasdeux fi); + TAao=OvalBox(LOPop); + Oop=image( + fill TAao if print=false : withcolor FondOvalOp else : withcolor coefprint*white fi; + draw LOPop; + draw TAao if print=false : withcolor coefprint*white fi; + ); + Oop:=Oop shifted(-center Oop); + Oop +enddef; + +vardef TestOpSup(expr pasun, pasdeux)= + save $; picture $; + save TAa; path TAa; + save LTa; picture LTa; + LTa=ColleBoxNew(if string pasun : OvalNb(pasun) else: pasun fi,"$>$",if string pasdeux : OvalNb(pasdeux) else: pasdeux fi); + TAa=DiamondBox(LTa); + $=image( + fill TAa if print=false : withcolor FondOvalOp else : withcolor coefprint*white fi; + draw LTa; + draw TAa if print=false : withcolor coefprint*white fi; + ); + $:=$ shifted(-center $); + $ +enddef; + +vardef TestOpInf(expr pasun, pasdeux)= + save $; picture $; + save TAa; path TAa; + save LTa; picture LTa; + LTa=ColleBoxNew(if string pasun : OvalNb(pasun) else: pasun fi,"$<$",if string pasdeux : OvalNb(pasdeux) else: pasdeux fi); + TAa=DiamondBox(LTa); + $=image( + fill TAa if print=false : withcolor FondOvalOp else : withcolor coefprint*white fi; + draw LTa; + draw TAa if print=false : withcolor coefprint*white fi; + ); + $:=$ shifted(-center $); + $ +enddef; + +vardef TestOpEgal(expr pasun, pasdeux)= + save $; picture $; + save TAa; path TAa; + save LTa; picture LTa; + LTa=ColleBoxNew(if string pasun : OvalNb(pasun) else: pasun fi,"$=$",if string pasdeux : OvalNb(pasdeux) else: pasdeux fi); + TAa=DiamondBox(LTa); + $=image( + fill TAa if print=false : withcolor FondOvalOp else : withcolor coefprint*white fi; + draw LTa; + draw TAa if print=false : withcolor coefprint*white fi; + ); + $:=$ shifted(-center $); + $ +enddef; + +vardef TestOpEt(expr pasun, pasdeux)= + save $; picture $; + save TAa; path TAa; + save LTa; picture LTa; + LTa=ColleBoxNew(if string pasun : OvalNb(pasun) else: pasun fi,"et",if string pasdeux : OvalNb(pasdeux) else: pasdeux fi); + TAa=DiamondBox(LTa); + $=image( + fill TAa if print=false : withcolor FondOvalOp else : withcolor coefprint*white fi; + draw LTa; + draw TAa if print=false : withcolor coefprint*white fi; + ); + $:=$ shifted(-center $); + $ +enddef; + +vardef TestOpOu(expr pasun, pasdeux)= + save $; picture $; + save TAa; path TAa; + save LTa; picture LTa; + LTa=ColleBoxNew(if string pasun : OvalNb(pasun) else: pasun fi,"ou",if string pasdeux : OvalNb(pasdeux) else: pasdeux fi); + TAa=DiamondBox(LTa); + $=image( + fill TAa if print=false : withcolor FondOvalOp else : withcolor coefprint*white fi; + draw LTa; + draw TAa if print=false : withcolor coefprint*white fi; + ); + $:=$ shifted(-center $); + $ +enddef; + +vardef TestOpNon(expr pasun)= + save $; picture $; + save TAa; path TAa; + save LTa; picture LTa; + LTa=ColleBoxNew("non",if string pasun : OvalNb(pasun) else: pasun fi); + TAa=DiamondBox(LTa); + $=image( + fill TAa if print=false : withcolor FondOvalOp else : withcolor coefprint*white fi; + draw LTa; + draw TAa if print=false : withcolor coefprint*white fi; + ); + $:=$ shifted(-center $); + $ +enddef; + +vardef TestOpContient(expr pasun,pasdeux)= + save $; picture $; + save TAa; path TAa; + save LTa; picture LTa; + LTa=ColleBoxNew(if string pasun : OvalNb(pasun) else: pasun fi,"contient",if string pasun : OvalNb(pasdeux) else: pasun fi,"?"); + TAa=DiamondBox(LTa); + $=image( + fill TAa if print=false : withcolor FondOvalOp else : withcolor coefprint*white fi; + draw LTa; + draw TAa if print=false : withcolor coefprint*white fi; + ); + $:=$ shifted(-center $); + $ +enddef; + +vardef AppCostume(expr pasun)= + save $; picture $; + save TAa; path TAa; + save LTa; picture LTa; + LTa=ColleBoxNew(RecMenuApp(pasun),"du costume"); + TAa=OvalBox(LTa); + $=image( + fill TAa if print=false : withcolor VioletAppTrois else : withcolor coefprint*white fi; + draw LTa; + draw TAa if print=false : withcolor coefprint*white fi; + ); + $:=$ shifted(-center $); + $ +enddef; + +vardef AppAP(expr pasun)= + save $; picture $; + save TAa; path TAa; + save LTa; picture LTa; + LTa=ColleBoxNew(RecMenuApp(pasun),"de l'arrière-plan"); + TAa=OvalBox(LTa); + $=image( + fill TAa if print=false : withcolor VioletAppTrois else : withcolor coefprint*white fi; + draw LTa; + draw TAa if print=false : withcolor coefprint*white fi; + ); + $:=$ shifted(-center $); + $ +enddef; + +vardef CapDistance(expr pasun)= + save $; picture $; + save TAa; path TAa; + save LTa; picture LTa; + LTa=ColleBoxNew("distance de",OvalCapMenu(pasun)); + TAa=OvalBox(LTa); + $=image( + fill TAa if print=false : withcolor CapteurTrois else : withcolor coefprint*white fi; + draw LTa; + draw TAa if print=false : withcolor coefprint*white fi; + ); + $:=$ shifted(-center $); + $ +enddef; + +vardef CapTemps(expr pasun)= + save $; picture $; + save TAa; path TAa; + save LTa; picture LTa; + LTa=ColleBoxNew(RecMenuCap(pasun),"actuelle"); + TAa=OvalBox(LTa); + $=image( + fill TAa if print=false : withcolor CapteurTrois else : withcolor coefprint*white fi; + draw LTa; + draw TAa if print=false : withcolor coefprint*white fi; + ); + $:=$ shifted(-center $); + $ +enddef; + +vardef CapNumero(expr pasun,pasdeux)= + save $; picture $; + save TAa; path TAa; + save LTa; picture LTa; + LTa=ColleBoxNew(RecMenuCap(pasun),"de",OvalCapMenu(pasdeux)); + TAa=OvalBox(LTa); + $=image( + fill TAa if print=false : withcolor CapteurTrois else : withcolor coefprint*white fi; + draw LTa; + draw TAa if print=false : withcolor coefprint*white fi; + ); + $:=$ shifted(-center $); + $ +enddef; + +vardef TestCapToucheObjet(expr pasun)= + save $; picture $; + save TAa; path TAa; + save LTa; picture LTa; + LTa=ColleBoxNew("touche le",OvalCapMenu(pasun),"?"); + TAa=DiamondBox(LTa); + $=image( + fill TAa if print=false : withcolor CapteurTrois else : withcolor coefprint*white fi; + draw LTa; + draw TAa if print=false : withcolor coefprint*white fi; + ); + $:=$ shifted(-center $); + $ +enddef; + +vardef TestCapCouleur(expr pasun)= + save $; picture $; + save TAa; path TAa; + save LTa; picture LTa; + LTa=ColleBoxNew("couleur",OvalCouleur(redpart(pasun),greenpart(pasun),bluepart(pasun)),"touchée ?"); + TAa=DiamondBox(LTa); + $=image( + fill TAa if print=false : withcolor CapteurTrois else : withcolor coefprint*white fi; + draw LTa; + draw TAa if print=false : withcolor coefprint*white fi; + ); + $:=$ shifted(-center $); + $ +enddef; + +vardef TestCapCouleurs(expr pasun,pasdeux)= + save $; picture $; + save TAa; path TAa; + save LTa; picture LTa; + LTa=ColleBoxNew("couleur",OvalCouleur(redpart(pasun),greenpart(pasun),bluepart(pasun)),"touché",OvalCouleur(redpart(pasdeux),greenpart(pasdeux),bluepart(pasdeux)),"?"); + TAa=DiamondBox(LTa); + $=image( + fill TAa if print=false : withcolor CapteurTrois else : withcolor coefprint*white fi; + draw LTa; + draw TAa if print=false : withcolor coefprint*white fi; + ); + $:=$ shifted(-center $); + $ +enddef; + +vardef TestCapTouche(expr pasun)= + save $; picture $; + save TAa; path TAa; + save LTa; picture LTa; + LTa=ColleBoxNew("touche",OvalMenuCap(pasun),"pressée ?"); + TAa=DiamondBox(LTa); + $=image( + fill TAa if print=false : withcolor CapteurTrois else : withcolor coefprint*white fi; + draw LTa; + draw TAa if print=false : withcolor coefprint*white fi; + ); + $:=$ shifted(-center $); + $ +enddef; + +vardef TestCapSouris= + save $; picture $; + save TAa; path TAa; + save LTa; picture LTa; + LTa=ColleBoxNew("souris pressée ?"); + TAa=DiamondBox(LTa); + $=image( + fill TAa if print=false : withcolor CapteurTrois else : withcolor coefprint*white fi; + draw LTa; + draw TAa if print=false : withcolor coefprint*white fi; + ); + $:=$ shifted(-center $); + $ +enddef; + +vardef TestListeContient(expr nbpas,nbbas)= + save $; picture $; + save TAa; path TAa; + save LTa; picture LTa; + LTa=ColleBoxNew(RecMenuList(nbpas),"contient",if string nbbas:OvalNb(nbbas) else: nbbas fi); + TAa=DiamondBox(LTa); + $=image( + fill TAa if print=false : withcolor OrangeListTrois else : withcolor coefprint*white fi; + draw LTa; + draw TAa if print=false : withcolor coefprint*white fi; + ); + $:=$ shifted(-center $); + $ +enddef; + +vardef ListeElement(expr nbpas,nbbas)= + save $; picture $; + save TAa; path TAa; + save LTa; picture LTa; + LTa=ColleBoxNew("élément",if string nbpas:OvalNb(nbpas) else: nbpas fi,"de",RecMenuList(nbbas)); + TAa=OvalBox(LTa); + $=image( + fill TAa if print=false : withcolor OrangeListTrois else : withcolor coefprint*white fi; + draw LTa; + draw TAa if print=false : withcolor coefprint*white fi; + ); + $:=$ shifted(-center $); + $ +enddef; + +vardef ListePosition(expr nbpas,nbbas)= + save $; picture $; + save TAa; path TAa; + save LTa; picture LTa; + LTa=ColleBoxNew("position de",if string nbpas:OvalNb(nbpas) else: nbpas fi,"de",RecMenuList(nbbas)); + TAa=OvalBox(LTa); + $=image( + fill TAa if print=false : withcolor OrangeListTrois else : withcolor coefprint*white fi; + draw LTa; + draw TAa if print=false : withcolor coefprint*white fi; + ); + $:=$ shifted(-center $); + $ +enddef; + +vardef ListeLongueur(expr nbpas)= + save $; picture $; + save TAa; path TAa; + save LTa; picture LTa; + LTa=ColleBoxNew("longueur de",RecMenuList(nbpas)); + TAa=OvalBox(LTa); + $=image( + fill TAa if print=false : withcolor OrangeListTrois else : withcolor coefprint*white fi; + draw LTa; + draw TAa if print=false : withcolor coefprint*white fi; + ); + $:=$ shifted(-center $); + $ +enddef; + diff --git a/macros/latex/contrib/suppose/README.md b/macros/latex/contrib/suppose/README.md index f607b2fe13..3aa4bdcf2b 100644 --- a/macros/latex/contrib/suppose/README.md +++ b/macros/latex/contrib/suppose/README.md @@ -1,14 +1,22 @@ # the ``suppose`` package ## Andrew Lounsbury ### Licensed with LPPL 1.3c -### 1.2 2021/04/01 +### 1.2.1 2021/04/09 This package provides abbreviations of the word "Suppose" in various fonts and styles. \ See the documentation `suppose-doc.pdf` for a demonstration. -|Change log | Info | -|-------------------|--------------------------------------------------------------------------------| -|**1.1 2021/03/26** | Added options for setting `\supp`, `\bsup`, `\ssup`, and `\sbsup` to one font | -|**1.2 2021/04/01** | Added `slant` option | -| | Fixed bug in `\PackageWarning` message for unknown options | -| | Adjusted placement of the `\rule` for each font | +## Change log +|**1.1 2021/03/26** | +|-------------------| +| Added options for setting `\supp`, `\bsup`, `\ssup`, and `\sbsup` to one font | + +|**1.2 2021/04/01** | +|-------------------| +| Added `slant` option | +| Fixed bug in `\PackageWarning` message for unknown options | +| Adjusted placement of the `\rule` for each font | + +|**1.2.1 2021/04/09** | +|-------------------| +| Adjusted placement and thickness of the `\rule` for most commands | diff --git a/macros/latex/contrib/suppose/suppose-doc.pdf b/macros/latex/contrib/suppose/suppose-doc.pdf Binary files differindex 55bf001e0d..e0ab273d51 100644 --- a/macros/latex/contrib/suppose/suppose-doc.pdf +++ b/macros/latex/contrib/suppose/suppose-doc.pdf diff --git a/macros/latex/contrib/suppose/suppose-doc.tex b/macros/latex/contrib/suppose/suppose-doc.tex index 533c374125..5093f4e51b 100644 --- a/macros/latex/contrib/suppose/suppose-doc.tex +++ b/macros/latex/contrib/suppose/suppose-doc.tex @@ -1,17 +1,17 @@ \documentclass{article} \usepackage{xcolor} \usepackage{hyperref} -\usepackage[tt]{suppose} +\usepackage[tt, slant]{suppose} \setlength{\textwidth}{15.75cm} \setlength{\oddsidemargin}{0.75cm} \begin{document} \title{The \texttt{suppose} package} -\author{1.2 \ 2021/04/01} +\author{1.2.1 \ 2021/04/09} \date{Andrew Lounsbury, \href{mailto:alounsbury8@gmail.com}{alounsbury8@gmail.com}} \maketitle -This package is licensed with LPPL 1.3c, and provides the following abbreviations of the word ``Suppose.'' I recommend only using these symbols when the immediately succeeding strings are mathematical in nature. I do not recommend using them in formal work. \par +This package is licensed with LPPL 1.3c, and provides the following abbreviations of the word ``Suppose.'' I recommend only using these symbols when the immediately succeeding strings are mathematical in nature, and they do in fact require math mode. I do not recommend using them in formal work. \par The two main commands are \texttt{\textbackslash supp} and \texttt{\textbackslash bsup}, whose style and font may be specified with the options so that we can use them consistently. For example, \begin{verbatim} \usepackage[dutchcal, slant]{suppose} @@ -45,8 +45,8 @@ Though it is better to use the options with \texttt{\textbackslash supp} and \te & \scsup x < y & \sbcsup x < y & \mathcal{MATHCAL} \\ \textsl{Slanted} & \sdsup x < y & \sbdsup x < y & \mathdutchcal{DUTCHCAL} \\ \textsl{Line} & \sesup x < y & \sbesup x < y & \EuScript{EULERSCRIPT} \\ - & \svsup x < y & \sbvsup x < y & \mathsf{SANS\ SERIF} \\ - &\ \stsup x < y & \sbtsup x < y & \mathtt{TYPERWRITER} + & \svsup < y & \sbvsup x < y & \mathsf{SANS\ SERIF} \\ + & \stsup x < y & \sbtsup x < y & \mathtt{TYPERWRITER} \end{array} \] \end{document}
\ No newline at end of file diff --git a/macros/latex/contrib/suppose/suppose.sty b/macros/latex/contrib/suppose/suppose.sty index e0df512bfc..9c1d2ca830 100644 --- a/macros/latex/contrib/suppose/suppose.sty +++ b/macros/latex/contrib/suppose/suppose.sty @@ -1,4 +1,4 @@ -% suppose.sty 1.2 2021/04/01 +% suppose.sty 1.2.1 2021/04/09 % Andrew Lounsbury %************************************************************************ @@ -20,7 +20,7 @@ % This work consists of the file suppose.sty. %************************************************************************ \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{suppose}[2021/04/01 1.2 supposition symbols] +\ProvidesPackage{suppose}[2021/04/09 1.2.1 supposition symbols] % \RequirePackage{amsmath, euscript, graphicx}% % @@ -31,7 +31,6 @@ \newcommand*{\sansserif}[1]{\textit{{\fontfamily{lmss}\selectfont #1}}}% \newcommand*{\bfsansserif}[1]{\textbf{\textit{{\fontfamily{lmss}\selectfont #1}}}}% % -\font\btt=rm-lmtk10 % bold typewriter font \font\bitt=rm-lmtko10 % bold italicized typewriter font \newcommand*{\itt}[1]{\scalebox{1.11}{\textit{\texttt{#1}}}}% \newcommand*{\bolditt}[1]{$\scalebox{1.11}{\bitt #1}$}% @@ -44,8 +43,12 @@ \setlength{\boldshift}{0.0485in}% \newlength{\rulelength}% \setlength{\rulelength}{1.3ex}% +\newlength{\rulewidth}% +\setlength{\rulewidth}{0.15ex}% \newlength{\boldrulelength}% \setlength{\boldrulelength}{1.3ex}% +\newlength{\boldrulewidth}% +\setlength{\boldrulewidth}{0.25ex}% \newcommand{\curfont}{\mathnormal}% \newcommand{\curboldfont}{\boldsymbol}% % @@ -55,9 +58,9 @@ \setlength{\boldshift}{0.0425in}% }% \DeclareOption{mathcal}{% - \ifdim\boldshift = 0.0425in % if slant option selected + \ifdim\boldshift = 0.0425in % if slant option selected \addtolength{\shift}{0.00225in}% - \addtolength{\boldshift}{0.00225in}% + \addtolength{\boldshift}{0.0015in}% \fi% \renewcommand{\curfont}{\mathcal}% \renewcommand{\curboldfont}{\mathbfcal}% @@ -67,89 +70,95 @@ }% \DeclareOption{dutchcal}{% \ifdim\boldshift = 0.0425in% - \addtolength{\shift}{0.0025in}% - \addtolength{\boldshift}{0.002in}% + \addtolength{\shift}{0.0012in}% + \addtolength{\boldshift}{0.0012in}% \fi% \renewcommand{\curfont}{\mathdutchcal}% \renewcommand{\curboldfont}{\mathdutchbfcal}% \addtolength{\rulelength}{0.1ex}% \addtolength{\shift}{0.0025in}% - \addtolength{\boldrulelength}{0.1ex}% - \addtolength{\boldshift}{-0.003in}% + \addtolength{\boldrulelength}{0.145ex}% + \addtolength{\boldshift}{-0.0035in}% + \addtolength{\boldrulewidth}{-0.025ex}% }% \DeclareOption{eulerscript}{% \ifdim\boldshift = 0.0425in% \addtolength{\shift}{0.0000000000000000001in}% - \addtolength{\boldshift}{0.0015in}% + \addtolength{\boldshift}{0.00125in}% \fi% \renewcommand{\curfont}{\EuScript}% \renewcommand{\curboldfont}{\bfeuscript}% \addtolength{\rulelength}{0.1ex}% \addtolength{\shift}{-0.01275in}% - \addtolength{\boldshift}{-0.015in}% + \addtolength{\boldshift}{-0.01525in}% }% \DeclareOption{sans-serif}{% \ifdim\boldshift = 0.0425in% \addtolength{\shift}{0.001in}% + \addtolength{\boldshift}{0.001in}% \fi% \renewcommand{\curfont}{\sansserif}% \renewcommand{\curboldfont}{\bfsansserif}% \addtolength{\shift}{-0.01375in}% - \addtolength{\boldshift}{-0.006in}% + \addtolength{\boldshift}{-0.005in}% }% \DeclareOption{tt}{% + \ifdim\boldshift = 0.0425in% + \addtolength{\shift}{0.001in}% + \addtolength{\boldrulewidth}{-0.025ex}% + \fi% \renewcommand{\curfont}{\itt}% \renewcommand{\curboldfont}{\bolditt}% \addtolength{\shift}{0.0114in}% \addtolength{\boldrulelength}{0.1ex}% - \addtolength{\boldshift}{-0.0185in}% + \addtolength{\boldshift}{-0.02in}% }% +\DeclareOption*{\PackageWarning{suppose}{Unknown '\CurrentOption'}}% +\ProcessOptions\relax% +% % The two main commands \newlength{\Swidth}% \settowidth{\Swidth}{S}% \newcommand{\supp}{% \makebox[\Swidth][r]{% $\rotatebox{\value{angle}}{% - \rule[-0.5ex]{0.15ex}{\rulelength}% + \rule[-0.5ex]{\rulewidth}{\rulelength}% }$\hspace{\shift}\ % }\llap{$\curfont{S}$}\mspace{5mu}% }% \newcommand{\bsup}{% \makebox[\Swidth][r]{% $\rotatebox{\value{angle}}{% - \rule[-0.5ex]{0.2ex}{\boldrulelength}% + \rule[-0.5ex]{\boldrulewidth}{\boldrulelength}% }$\hspace{\boldshift}% }\llap{$\curboldfont{S}$% }\mspace{5mu}}% +% % Commands for hard-coding -\newcommand{\plainsupp}{\makebox[\Swidth][r]{$\rule[-0.5ex]{0.15ex}{1.3ex}\mspace{-0.25mu}$\ }\llap{$S$}\mspace{5mu}}% -\newcommand{\csup}{\makebox[\Swidth][c]{\ $\rule[-0.5ex]{0.15ex}{1.45ex}\mspace{8.5mu}$}\llap{$\mathcal{S}$}\mspace{5mu}}% -\newcommand{\dsup}{\makebox[\Swidth][c]{\ $\rule[-0.5ex]{0.15ex}{1.45ex}\mspace{9.5mu}$}\llap{$\mathdutchcal{S}$}\mspace{5mu}}% -\newcommand{\esup}{\makebox[\Swidth][c]{\ $\rule[-0.5ex]{0.15ex}{1.35ex}\mspace{5.25mu}$}\llap{$\EuScript{S}$}\mspace{5mu}}% -\newcommand{\tsup}{\makebox[\Swidth][c]{\ $\rule[-0.5ex]{0.15ex}{1.3ex}\mspace{5.5mu}$\ }\llap{\scalebox{1.1}{\textit{\texttt{S}}}}\mspace{5mu}}% - -\newcommand{\vsup}{\makebox[\Swidth][c]{\ $\rule[-0.5ex]{0.15ex}{1.45ex}\mspace{7.75mu}$}\llap{\textit{{\fontfamily{lmss}\selectfont S}}}\mspace{5mu}}% +\newcommand{\plainsupp}{\makebox[\Swidth][r]{$\rule[-0.5ex]{\rulewidth}{1.3ex}\mspace{-0.25mu}$\ }\llap{$S$}\mspace{5mu}}% +\newcommand{\csup}{\makebox[\Swidth][c]{\ $\rule[-0.5ex]{\rulewidth}{1.45ex}\mspace{8.5mu}$}\llap{$\mathcal{S}$}\mspace{5mu}}% +\newcommand{\dsup}{\makebox[\Swidth][c]{\ $\rule[-0.5ex]{\rulewidth}{1.45ex}\mspace{9.5mu}$}\llap{$\mathdutchcal{S}$}\mspace{5mu}}% +\newcommand{\esup}{\makebox[\Swidth][c]{\ $\rule[-0.5ex]{\rulewidth}{1.35ex}\mspace{5.25mu}$}\llap{$\EuScript{S}$}\mspace{5mu}}% +\newcommand{\tsup}{\makebox[\Swidth][c]{\ $\rule[-0.5ex]{\rulewidth}{1.3ex}\mspace{5.5mu}$\ }\llap{\scalebox{1.1}{\textit{\texttt{S}}}}\mspace{5mu}}% +\newcommand{\vsup}{\makebox[\Swidth][c]{\ $\rule[-0.5ex]{\rulewidth}{1.45ex}\mspace{7.75mu}$}\llap{\textit{{\fontfamily{lmss}\selectfont S}}}\mspace{5mu}}% % Bold -\newcommand{\plainbsup}{\makebox[\Swidth][r]{$\rule[-0.5ex]{0.20ex}{1.3ex}\mspace{6.3mu}$}\llap{$\boldsymbol{S}$}\mspace{5mu}}% -\newcommand{\bcsup}{\makebox[\Swidth][c]{\ $\rule[-0.5ex]{0.20ex}{1.5ex}\mspace{10mu}$}\llap{$\boldsymbol{\mathcal{S}}$}\mspace{5mu}}% -\newcommand{\bdsup}{\makebox[\Swidth][c]{\ $\rule[-0.5ex]{0.20ex}{1.5ex}\mspace{9.5mu}$}\llap{$\mathdutchbfcal{S}$}\mspace{5mu}}% -\newcommand{\besup}{\makebox[\Swidth][c]{\ $\rule[-0.5ex]{0.20ex}{1.35ex}\mspace{6mu}$}\llap{$\boldsymbol{\EuScript{S}}$}\mspace{5mu}}% -\newcommand{\btsup}{\makebox[\Swidth][c]{\ $\rule[-0.5ex]{0.2ex}{1.3ex}\mspace{-0.7mu}$\ }\llap{\scalebox{1.11}{\bitt S}}\mspace{5mu}}% -\newcommand{\bvsup}{\makebox[\Swidth][c]{\ $\rule[-0.5ex]{0.20ex}{1.45ex}\mspace{8.75mu}$}\llap{\textbf{\textit{{\fontfamily{lmss}\selectfont S}}}}\mspace{5mu}}% +\newcommand{\plainbsup}{\makebox[\Swidth][r]{$\rule[-0.5ex]{\boldrulewidth}{1.3ex}\mspace{6.3mu}$}\llap{$\boldsymbol{S}$}\mspace{5mu}}% +\newcommand{\bcsup}{\makebox[\Swidth][c]{\ $\rule[-0.5ex]{\boldrulewidth}{1.45ex}\mspace{10.5mu}$}\llap{$\boldsymbol{\mathcal{S}}$}\mspace{5mu}}% +\newcommand{\bdsup}{\makebox[\Swidth][c]{\ $\rule[-0.5ex]{0.225ex}{1.5ex}\mspace{9.5mu}$}\llap{$\mathdutchbfcal{S}$}\mspace{5mu}}% +\newcommand{\besup}{\makebox[\Swidth][c]{\ $\rule[-0.5ex]{\boldrulewidth}{1.35ex}\mspace{6.4mu}$}\llap{$\boldsymbol{\EuScript{S}}$}\mspace{5mu}}% +\newcommand{\btsup}{\makebox[\Swidth][c]{\ $\rule[-0.5ex]{\boldrulewidth}{1.3ex}\mspace{-0.675mu}$\ }\llap{\scalebox{1.11}{\bitt S}}\mspace{5mu}}% +\newcommand{\bvsup}{\makebox[\Swidth][c]{\ $\rule[-0.5ex]{\boldrulewidth}{1.45ex}\mspace{9mu}$}\llap{\textbf{\textit{{\fontfamily{lmss}\selectfont S}}}}\mspace{5mu}}% % Slanted rule -\newcommand{\ssup}{\makebox[\Swidth][r]{$\rotatebox{-15}{\rule[-0.5ex]{0.15ex}{1.3ex}}\mspace{5mu}$}\llap{$S$}\mspace{5mu}}% -\newcommand{\scsup}{\makebox[\Swidth][c]{\ $\rotatebox{-15}{\rule[-0.5ex]{0.15ex}{1.45ex}}\mspace{10mu}$}\llap{$\mathcal{S}$}\mspace{5mu}}% -\newcommand{\sdsup}{\makebox[\Swidth][c]{\ $\rotatebox{-15}{\rule[-0.5ex]{0.15ex}{1.35ex}}\mspace{11mu}$}\llap{$\mathdutchcal{S}$}\mspace{5mu}}% -\newcommand{\sesup}{\makebox[\Swidth][c]{\ $\rotatebox{-15}{\rule[-0.5ex]{0.15ex}{1.4ex}}\mspace{6.6mu}$}\llap{$\EuScript{S}$}\mspace{5mu}}% -\newcommand{\stsup}{\makebox[\Swidth][c]{\ $\rotatebox{-15}{\rule[-0.5ex]{0.15ex}{1.3ex}}\mspace{6.5mu}$\ }\llap{\scalebox{1.11}{\textit{\texttt{S}}}}\mspace{5mu}}% -\newcommand{\svsup}{\makebox[\Swidth][c]{\ $\rotatebox{-15}{\rule[-0.5ex]{0.15ex}{1.45ex}}\mspace{9mu}$}\llap{\textit{{\fontfamily{lmss}\selectfont S}}}\mspace{5mu}}% +\newcommand{\ssup}{\makebox[\Swidth][r]{$\rotatebox{-15}{\rule[-0.5ex]{\rulewidth}{1.3ex}}\mspace{5mu}$}\llap{$S$}\mspace{5mu}}% +\newcommand{\scsup}{\makebox[\Swidth][c]{\ $\rotatebox{-15}{\rule[-0.5ex]{\rulewidth}{1.45ex}}\mspace{10mu}$}\llap{$\mathcal{S}$}\mspace{5mu}}% +\newcommand{\sdsup}{\makebox[\Swidth][c]{\ $\rotatebox{-15}{\rule[-0.5ex]{\rulewidth}{1.35ex}}\mspace{11mu}$}\llap{$\mathdutchcal{S}$}\mspace{5mu}}% +\newcommand{\sesup}{\makebox[\Swidth][c]{\ $\rotatebox{-15}{\rule[-0.5ex]{\rulewidth}{1.4ex}}\mspace{6.6mu}$}\llap{$\EuScript{S}$}\mspace{5mu}}% +\newcommand{\stsup}{\makebox[\Swidth][c]{\ $\rotatebox{-15}{\rule[-0.5ex]{\rulewidth}{1.3ex}}\mspace{6.8mu}$\ }\llap{\scalebox{1.11}{\textit{\texttt{S}}}}\mspace{5mu}}% +\newcommand{\svsup}{\makebox[\Swidth][c]{\ $\rotatebox{-15}{\rule[-0.5ex]{\rulewidth}{1.45ex}}\mspace{9mu}$}\llap{\textit{{\fontfamily{lmss}\selectfont S}}}\mspace{5mu}}% % Slanted & bold -\newcommand{\sbsup}{\makebox[\Swidth][r]{$\rotatebox{-15}{\rule[-0.5ex]{0.20ex}{1.3ex}}\mspace{5.5mu}$}\llap{$\boldsymbol{S}$}\mspace{5mu}}% -\newcommand{\sbcsup}{\makebox[\Swidth][c]{\ $\rotatebox{-15}{\rule[-0.5ex]{0.20ex}{1.45ex}}\mspace{12mu}$}\llap{$\boldsymbol{\mathcal{S}}$}\mspace{5mu}}% -\newcommand{\sbdsup}{\makebox[\Swidth][c]{\ $\rotatebox{-15}{\rule[-0.5ex]{0.20ex}{1.4ex}}\mspace{11mu}$}\llap{$\mathdutchbfcal{S}$}\mspace{5mu}}% -\newcommand{\sbesup}{\makebox[\Swidth][c]{\ $\rotatebox{-15}{\rule[-0.5ex]{0.20ex}{1.45ex}}\mspace{7.2mu}$}\llap{$\boldsymbol{\EuScript{S}}$}\mspace{5mu}}% -\newcommand{\sbtsup}{\makebox[\Swidth][c]{\ $\rotatebox{-15}{\rule[-0.5ex]{0.2ex}{1.4ex}}\mspace{0.25mu}$\ }\llap{\scalebox{1.11}{\bitt S}}\mspace{5mu}}% -\newcommand{\sbvsup}{\makebox[\Swidth][c]{\ $\rotatebox{-15}{\rule[-0.5ex]{0.20ex}{1.45ex}}\mspace{10mu}$}\llap{\textbf{\textit{{\fontfamily{lmss}\selectfont S}}}}\mspace{5mu}}% -% -\DeclareOption*{\PackageWarning{suppose}{Unknown '\CurrentOption'}}% -\ProcessOptions\relax% +\newcommand{\sbsup}{\makebox[\Swidth][r]{$\rotatebox{-15}{\rule[-0.5ex]{\boldrulewidth}{1.3ex}}\mspace{5.5mu}$}\llap{$\boldsymbol{S}$}\mspace{5mu}}% +\newcommand{\sbcsup}{\makebox[\Swidth][c]{\ $\rotatebox{-15}{\rule[-0.5ex]{\boldrulewidth}{1.45ex}}\mspace{12mu}$}\llap{$\boldsymbol{\mathcal{S}}$}\mspace{5mu}}% +\newcommand{\sbdsup}{\makebox[\Swidth][c]{\ $\rotatebox{-15}{\rule[-0.5ex]{\boldrulewidth}{1.4ex}}\mspace{11mu}$}\llap{$\mathdutchbfcal{S}$}\mspace{5mu}}% +\newcommand{\sbesup}{\makebox[\Swidth][c]{\ $\rotatebox{-15}{\rule[-0.5ex]{\boldrulewidth}{1.45ex}}\mspace{7.6mu}$}\llap{$\boldsymbol{\EuScript{S}}$}\mspace{5mu}}% +\newcommand{\sbtsup}{\makebox[\Swidth][c]{\ $\rotatebox{-15}{\rule[-0.5ex]{\boldrulewidth}{1.4ex}}\mspace{0.5mu}$\ }\llap{\scalebox{1.11}{\bitt S}}\mspace{5mu}}% +\newcommand{\sbvsup}{\makebox[\Swidth][c]{\ $\rotatebox{-15}{\rule[-0.5ex]{\boldrulewidth}{1.45ex}}\mspace{10mu}$}\llap{\textbf{\textit{{\fontfamily{lmss}\selectfont S}}}}\mspace{5mu}}%
\ No newline at end of file |