diff options
author | Karl Berry <karl@freefriends.org> | 2019-10-01 21:20:30 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-10-01 21:20:30 +0000 |
commit | 6f8e5e79f8a47db36e17189f91b9ceca17d0c613 (patch) | |
tree | bded62c1b0f425abdf72c366febef6e61f432c85 /Master/texmf-dist/tex | |
parent | 6621e36996b4d5fbfa4c42318eebc45a57ea9cfe (diff) |
scratch3 (1oct19)
git-svn-id: svn://tug.org/texlive/trunk@52250 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/scratch3/scratch3.sty | 388 |
1 files changed, 301 insertions, 87 deletions
diff --git a/Master/texmf-dist/tex/latex/scratch3/scratch3.sty b/Master/texmf-dist/tex/latex/scratch3/scratch3.sty index dfcacb89572..e23d7ca7ec1 100644 --- a/Master/texmf-dist/tex/latex/scratch3/scratch3.sty +++ b/Master/texmf-dist/tex/latex/scratch3/scratch3.sty @@ -1,12 +1,13 @@ +% !BIB TS-program = % !TeX encoding = ISO-8859-1 % Ce fichier contient le code de l'extension "scratch3" % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % \def\scrname{ scratch3 }% -\def\scrver { 0.13 }% +\def\scrver { 0.14 }% % % -\def\scrdate{ 2019/07/01 }% +\def\scrdate{ 2019/10/01 }% % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % @@ -19,7 +20,7 @@ % Repository : https://framagit.org/unbonpetit/scratch3/tree/master % Copyright : Christian Tellechea 2019 % Licence : Released under the LaTeX Project Public License v1.3c -% or later, see http://www.latex-project.org/lppl.txt +% or later, see http://www.latex-project.org/lppl.txtf % Files : 1) scratch3.sty % 2) scratch3-fr.tex % 3) scratch3-fr.pdf @@ -70,7 +71,12 @@ num start = 1 ,% numéro de départ baseline = 1 ,% alignement sur le 1er bloc (en partant du haut) } -\newcommand*\numblock[1]{\color{black}\footnotesize\bfseries#1} +\newcommand*\numblock[1]{% + \color{black}% + \footnotesize + \bfseries + #1% +} \newcommand*\resetscratch{\csname skv_[\scrname]\endcsname\scr_setcolors} \newcommand*\setscratch[1]{\setKV[\scrname]{#1}\scr_setcolors} \newcommand*\setdefaultscratch[1]{\setKVdefault[\scrname]{#1}\scr_setcolors} @@ -111,6 +117,8 @@ \fi \fi } +\newif\if_inpicture +\_inpicturefalse \newcount\scr_loopnest \newcount\scr_blocknum \newbox \scr_box @@ -135,6 +143,7 @@ \kern.6em \fi \useKV[\scrname]{pre text}% + \_inpicturetrue #2% \scr_blockstrut }% @@ -147,16 +156,27 @@ \edef\scr_boxht{\the\ht\scr_box}% \edef\scr_totht{\the\dimexpr\ht\scr_box+\dp\scr_box\relax}% \draw[ - draw={\ifboolKV[\scrname]{print}{scr_linegray!\scr_contrast!black}{#1dd}}, + draw={% + \ifboolKV[\scrname]{print} + {scr_linegray!\scr_contrast!black} + {#1dd} + }, line width=\scr_linewidth, - rounded corners=0.4*\scr_ex, - fill={\ifboolKV[\scrname]{print}{\ifboolKV[\scrname]{fill blocks}{scr_fillgray}{none}}{#1}}, + rounded corners=0.4*\scr_ex*\scr_scale, + fill={% + \ifboolKV[\scrname]{print} + {\ifboolKV[\scrname]{fill blocks} + {scr_fillgray} + {none}% + } + {#1}% + }, yshift=\scr_yoffset, xshift=\scr_xoffset ] (0,0)--++(0.66666*\scr_notch,0)--++(\scr_corner,-\scr_corner)--++(\scr_notch,0)--++(\scr_corner,\scr_corner)--++(\scr_boxwd+2*\scr_xsep-\scr_corner*2-\scr_notch*1.66666,0)% ligne sup --++(0,-\scr_totht-\scr_ysepsup-\scr_ysepinf-\scr_corner)% ligne est - --++(-\scr_boxwd-2*\scr_xsep+\scr_corner*2+\scr_notch*1.66666,0)--++(-\scr_corner,-\scr_corner)--++(-\scr_notch,0)--++(-\scr_corner,\scr_corner)--++(-0.66666*\scr_notch,0)% logne sud + --++(-\scr_boxwd-2*\scr_xsep+\scr_corner*2+\scr_notch*1.66666,0)--++(-\scr_corner,-\scr_corner)--++(-\scr_notch,0)--++(-\scr_corner,\scr_corner)--++(-0.66666*\scr_notch,0)% ligne sud --cycle; \node[ at=(origin), @@ -164,7 +184,11 @@ anchor=base west, xshift=\scr_xoffset+\scr_xsep, yshift=\scr_yoffset-\scr_boxht-\scr_corner-\scr_ysepsup, - text={\ifboolKV[\scrname]{print}{\useKV[\scrname]{text color}}{white}} + text={% + \ifboolKV[\scrname]{print} + {\useKV[\scrname]{text color}} + {white}% + } ] (txt\number\scr_blocknum) {\scr_currentstuff}; @@ -205,10 +229,21 @@ \edef\scr_boxht{\the\ht\scr_box}% \edef\scr_totht{\the\dimexpr\ht\scr_box+\dp\scr_box\relax}% \draw[ - draw={\ifboolKV[\scrname]{print}{scr_linegray!\scr_contrast!black}{\scr_current_blockcolor dd}}, + draw={% + \ifboolKV[\scrname]{print} + {scr_linegray!\scr_contrast!black} + {\scr_current_blockcolor dd}% + }, line width=\scr_linewidth, - rounded corners=0.4*\scr_ex, - fill={\ifboolKV[\scrname]{print}{\ifboolKV[\scrname]{fill blocks}{scr_fillgray}{none}}{\scr_current_blockcolor}}, + rounded corners=0.4*\scr_ex*\scr_scale, + fill={% + \ifboolKV[\scrname]{print} + {\ifboolKV[\scrname]{fill blocks} + {scr_fillgray} + {none}% + } + {\scr_current_blockcolor}% + }, yshift=\scr_yoffset, xshift=\scr_xoffset ] @@ -220,7 +255,11 @@ anchor=base west, xshift=\scr_xoffset+\scr_xsep, yshift=\scr_yoffset-\scr_boxht-\scr_corner-\scr_ysepsup, - text={\ifboolKV[\scrname]{print}{\useKV[\scrname]{text color}}{white}} + text={% + \ifboolKV[\scrname]{print} + {\useKV[\scrname]{text color}} + {white}% + } ] (txt\number\scr_blocknum) {\scr_currentstuff}; @@ -247,6 +286,7 @@ \def\scr_current_blockcolor{#1}% \def\scr_currentstuff{% \useKV[\scrname]{pre text}% + \_inpicturetrue #2% \scr_blockstrut }% @@ -259,10 +299,21 @@ \edef\scr_boxht{\the\ht\scr_box}% \edef\scr_totht{\the\dimexpr\ht\scr_box+\dp\scr_box\relax}% \draw[ - draw={\ifboolKV[\scrname]{print}{scr_linegray!\scr_contrast!black}{#1dd}}, + draw={% + \ifboolKV[\scrname]{print} + {scr_linegray!\scr_contrast!black} + {#1dd}% + }, line width=\scr_linewidth, - rounded corners=0.4*\scr_ex, - fill={\ifboolKV[\scrname]{print}{\ifboolKV[\scrname]{fill blocks}{scr_fillgray}{none}}{\scr_current_blockcolor}}, + rounded corners=0.4*\scr_ex*\scr_scale, + fill={% + \ifboolKV[\scrname]{print} + {\ifboolKV[\scrname]{fill blocks} + {scr_fillgray} + {none}% + } + {\scr_current_blockcolor}% + }, yshift=\scr_yoffset, xshift=\scr_xoffset ] @@ -275,7 +326,11 @@ anchor=base west, xshift=\scr_xoffset+\scr_xsep, yshift=\scr_yoffset-\scr_boxht-\scr_corner-\scr_ysepsup, - text={\ifboolKV[\scrname]{print}{\useKV[\scrname]{text color}}{white}} + text={% + \ifboolKV[\scrname]{print} + {\useKV[\scrname]{text color}} + {white}% + } ] (txt\number\scr_blocknum) {\scr_currentstuff}; @@ -301,6 +356,7 @@ \newcommand*\initmoreblocks[1]{% \def\scr_currentstuff{% \useKV[\scrname]{pre text}% + \_inpicturetrue #1% \scr_blockstrut }% @@ -314,14 +370,25 @@ \edef\scr_totht{\the\dimexpr\ht\scr_box+\dp\scr_box\relax}% \def\scr_current_blockcolor{scrmoreblocks}% \draw[ - draw={\ifboolKV[\scrname]{print}{scr_linegray!\scr_contrast!black}{\scr_current_blockcolor dd}}, - fill={\ifboolKV[\scrname]{print}{\ifboolKV[\scrname]{fill blocks}{scr_fillgray}{none}}{\scr_current_blockcolor}}, + draw={% + \ifboolKV[\scrname]{print} + {scr_linegray!\scr_contrast!black} + {\scr_current_blockcolor dd}% + }, + fill={% + \ifboolKV[\scrname]{print} + {\ifboolKV[\scrname]{fill blocks} + {scr_fillgray} + {none}% + } + {\scr_current_blockcolor}% + }, yshift=\scr_yoffset, xshift=\scr_xoffset, - rounded corners=0.4*\scr_ex + rounded corners=0.4*\scr_ex*\scr_scale ] - (0,-\scr_totht-\scr_ysepsup-\scr_ysepinf-\scr_corner)[rounded corners=2*\scr_ex]--(0,0)--(\scr_boxwd+2*\scr_xsep,0)% ligne sup - [rounded corners=0.4*\scr_ex]--++(0,-\scr_totht-\scr_ysepsup-\scr_ysepinf-\scr_corner)% ligne est + (0,-\scr_totht-\scr_ysepsup-\scr_ysepinf-\scr_corner)[rounded corners=2*\scr_ex*\scr_scale]--(0,0)--(\scr_boxwd+2*\scr_xsep,0)% ligne sup + [rounded corners=0.4*\scr_ex*\scr_scale]--++(0,-\scr_totht-\scr_ysepsup-\scr_ysepinf-\scr_corner)% ligne est --++(-\scr_boxwd-2*\scr_xsep+\scr_corner*2+\scr_notch*1.66666,0)--++(-\scr_corner,-\scr_corner)--++(-\scr_notch,0)--++(-\scr_corner,\scr_corner)--++(-.66666*\scr_notch,0)% ligne sud --cycle node[ @@ -330,7 +397,11 @@ anchor=base west, xshift=\scr_xoffset+\scr_xsep, yshift=\scr_yoffset-\scr_boxht-\scr_corner-\scr_ysepsup, - text={\ifboolKV[\scrname]{print}{\useKV[\scrname]{text color}}{white}} + text={% + \ifboolKV[\scrname]{print} + {\useKV[\scrname]{text color}} + {white}% + } ] (txt\number\scr_blocknum) {\scr_currentstuff}; @@ -370,6 +441,7 @@ \setbox\scr_box\hbox{% \pgfinterruptpicture \useKV[\scrname]{pre text}% + \_inpicturetrue #1% \scr_blockstrut \endpgfinterruptpicture @@ -435,8 +507,15 @@ \draw[ draw=\scr_current_linecolor, line width=\scr_linewidth, - rounded corners=0.4*\scr_ex, - fill={\ifboolKV[\scrname]{print}{\ifboolKV[\scrname]{fill blocks}{scr_fillgray}{none}}{\scr_current_blockcolor}} + rounded corners=0.4*\scr_ex*\scr_scale, + fill={% + \ifboolKV[\scrname]{print} + {\ifboolKV[\scrname]{fill blocks} + {scr_fillgray} + {none}% + } + {\scr_current_blockcolor}% + } ] (\csname toploopx\number\scr_loopnest\endcsname,\csname toploopy\number\scr_loopnest\endcsname)--++(0.66666*\scr_notch,0)--++(\scr_corner,-\scr_corner)--++(\scr_notch,0)--++(\scr_corner,\scr_corner)--++(\csname scr_txtloopwd\number\scr_loopnest\endcsname+2*\scr_xsep-\scr_corner*2-\scr_notch*1.66666,0)% ligne sup --++(0,-\csname scr_txtlooptotht\number\scr_loopnest\endcsname-\scr_ysepsup-\scr_ysepinf-\scr_corner)% ligne est "|" @@ -463,7 +542,7 @@ \else --++(-\csname scr_txtloopwd\number\scr_loopnest\endcsname-2*\scr_xsep+\scr_corner*2+\scr_notch*1.66666,0)--++(-\scr_corner,-\scr_corner)--++(-\scr_notch,0)--++(-\scr_corner,\scr_corner)--++(-.66666*\scr_notch,0)% ligne Sud "\--\__/---------" \fi - --(\csname toploopx\number\scr_loopnest\endcsname,\csname toploopy\number\scr_loopnest\endcsname-\scr_corner)--cycle;% remontée tout en haut et cycle + --cycle;% remontée tout en haut et cycle ## bugfix 0.14 \advance\scr_xoffset\dimexpr-\scr_loopblockwidth\relax \csname scr_numblockif\number\scr_loopnest\endcsname% numérote ou pas le texte dans le bandeau du haut \node[ @@ -472,10 +551,19 @@ anchor=base west, xshift=\csname toploopx\number\scr_loopnest\endcsname+\scr_xsep, yshift=\csname toploopy\number\scr_loopnest\endcsname-\csname scr_txtloopht\number\scr_loopnest\endcsname-\scr_corner-\scr_ysepsup, - text={\ifboolKV[\scrname]{print}{\useKV[\scrname]{text color}}{white}} + text={% + \ifboolKV[\scrname]{print} + {\useKV[\scrname]{text color}} + {white}% + } ] (txt\csname blocnum\number\scr_loopnest\endcsname) - {\useKV[\scrname]{pre text}#1\scr_blockstrut}; + {% + \useKV[\scrname]{pre text}% + \_inpicturetrue + #1% + \scr_blockstrut + }; \ifcat\relax\detokenize{#3}\relax\else \node[ at=(origin), @@ -483,10 +571,17 @@ anchor=base west, xshift=\csname toploopx\number\scr_loopnest\endcsname+\scr_xsep, yshift=\csname bottomify\number\scr_loopnest\endcsname-\scr_loopblockheight-\scr_corner, - text={\ifboolKV[\scrname]{print}{\useKV[\scrname]{text color}}{white}} + text={% + \ifboolKV[\scrname]{print} + {\useKV[\scrname]{text color}} + {white}% + } ] (txt\csname blocelsenum\number\scr_loopnest\endcsname) - {\useKV[\scrname]{pre text}\useKV[\scrname]{else word}}; + {% + \useKV[\scrname]{pre text}% + \useKV[\scrname]{else word}% + }; \csname scr_numblockelse\number\scr_loopnest\endcsname% numérotation bloc else ou pas \fi \ifnum#5=1 %fleche @@ -495,7 +590,7 @@ \scr_arrowcolor, line width=1.5pt, -{Triangle[length=\scr_scale*1.25ex,width=\scr_scale*1.5ex]}, - rounded corners=1pt + rounded corners=1pt*\scr_scale ] (\scr_xoffset+\scr_xsep*2+\csname scr_txtloopwd\number\scr_loopnest\endcsname-\scr_ex*3.5+1pt,\scr_yoffset+\scr_linewidth+\scr_ysepinf-1.25pt)--++(\scr_loopblockheight,0)--++(0,\scr_loopblockheight+\scr_corner*0.5); \edef\scr_arrowcolor{\ifboolKV[\scrname]{print}{scr_flaggray}{white}}% colmeur de la flèche @@ -503,7 +598,7 @@ \scr_arrowcolor, line width=\scr_scale*1.5pt, -{Triangle[length=\scr_scale*1.25ex,width=\scr_scale*1.5ex]}, - rounded corners=1pt + rounded corners=1pt*\scr_scale ] (\scr_xoffset+\scr_xsep*2+\csname scr_txtloopwd\number\scr_loopnest\endcsname-\scr_ex*3.5,\scr_yoffset+\scr_linewidth+\scr_ysepinf)--++(\scr_loopblockheight,0)--++(0,\scr_loopblockheight+\scr_corner*0.5); \fi @@ -525,24 +620,45 @@ \scr_normalizedec\scr_contrast contrast[0,100]% \edef\scr_contrast{\number\numexpr100-\scr_contrast}% \fi + \if_inpicture\def\scr_scale{1}\else\scr_normalizedec\scr_scale scale[0.2,5]\fi \begin{tikzpicture}[ baseline=(x.base), x=1ex, y=1ex, inner ysep=0.25ex, inner xsep=0.1ex, - line width={\the\dimexpr\useKV[\scrname]{line width}\relax} + line width={\the\dimexpr\useKV[\scrname]{line width}\relax}, + scale=\scr_scale, + every node/.style={scale=\scr_scale} ] \node[ line width={\the\dimexpr\useKV[\scrname]{line width}\relax}, rounded rectangle, - draw={\ifboolKV[\scrname]{print}{scr_linegray!\scr_contrast!black}{#2dd}}, - fill={\ifboolKV[\scrname]{print}{\ifboolKV[\scrname]{fill blocks}{scr_fillgray\if1#1!85!black\fi}{none}}{\scr_current_blockcolor\if1#1d\fi}}, - text={\ifboolKV[\scrname]{print}{\useKV[\scrname]{text color}}{white}} + draw={% + \ifboolKV[\scrname]{print} + {scr_linegray!\scr_contrast!black} + {#2dd}% + }, + fill={% + \ifboolKV[\scrname]{print} + {\ifboolKV[\scrname]{fill blocks} + {scr_fillgray\if1#1!85!black\fi} + {none}% + } + {\scr_current_blockcolor\if1#1d\fi}% + }, + text={% + \ifboolKV[\scrname]{print} + {\useKV[\scrname]{text color}} + {white}% + } ] (x) {% - \useKV[\scrname]{pre text}\relax\scr_ovalstrut\kern\scr_ovalsentinel sp + \useKV[\scrname]{pre text}\relax + \scr_ovalstrut + \kern\scr_ovalsentinel sp + \_inpicturetrue #3% \relax% pour contourner bug dans XeLaTeX \if1#1% si triangle de sélection @@ -565,7 +681,7 @@ baseline=-1ex, x=1.5ex, y=1.5ex, - rounded corners=1.5pt + rounded corners=1.5pt*\scr_scale ] \draw[ fill=white, @@ -577,24 +693,43 @@ % dessine un menu % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newcommand*\selectmenu[1]{% #1=texte du menu (sera composé et suivi du triangle de sélection) + \if_inpicture\def\scr_scale{1}\else\scr_normalizedec\scr_scale scale[0.2,5]\fi \begin{tikzpicture}[ anchor=base west, baseline=(textmenu.base west), outer sep=0pt, inner sep=0pt, - minimum size=0pt + minimum size=0pt, + scale=\scr_scale, + every node/.style={scale=\scr_scale} ] \node[ rectangle, - rounded corners=1.5pt, - draw={\ifboolKV[\scrname]{print}{scr_linegray}{\scr_current_blockcolor dd}}, + rounded corners=1.5pt*\scr_scale, + draw={% + \ifboolKV[\scrname]{print} + {scr_linegray} + {\scr_current_blockcolor dd}% + }, inner sep=0.2em, - fill={\ifboolKV[\scrname]{print}{\ifboolKV[\scrname]{fill blocks}{scr_fillgray!85!black}{none}}{\scr_current_blockcolor}}, - text={\ifboolKV[\scrname]{print}{\useKV[\scrname]{text color}}{white}} + fill={% + \ifboolKV[\scrname]{print} + {\ifboolKV[\scrname]{fill blocks} + {scr_fillgray!85!black} + {none}% + } + {\scr_current_blockcolor}% + }, + text={% + \ifboolKV[\scrname]{print} + {\useKV[\scrname]{text color}} + {white}% + } ] (textmenu) {% \useKV[\scrname]{pre text}% + \_inpicturetrue #1% \scr_ovalstrut \hskip.6666em @@ -613,20 +748,28 @@ \edef\_{\the\dimexpr.53033\dimexpr \scr_linewidth\relax\relax}% \def\scr_current_blockcolor{#1}% \edef\scr_boolsep{\useKV[\scrname]{bool sep}}% + \if_inpicture\def\scr_scale{1}\else\scr_normalizedec\scr_scale scale[0.2,5]\fi \begin{tikzpicture}[ inner sep=0pt, outer sep=0pt, minimum size=0pt, baseline=(x.base), line width=\scr_linewidth, - rounded corners=0pt% BUGFIX 0.11 + rounded corners=0pt,% BUGFIX 0.11 + scale=\scr_scale, + every node/.style={scale=\scr_scale} ] \setbox\scr_box\hbox{% \pgfinterruptpicture \useKV[\scrname]{pre text}% \scr_ovalstrut \kern\scr_boolsentinel sp - #2% + \_inpicturetrue + \if_boolempty + \vrule width#2 height0pt depth0pt\relax + \else + #2% + \fi \xdef\scr_endkern{\number\lastkern}% \endpgfinterruptpicture }% @@ -638,8 +781,19 @@ ] (\ifnum\scr_previouskern=\scr_boolsentinel-\scr_boolsep*.41421\else -\scr_totheight/2\fi,-\scr_boolsep)rectangle(\scr_retainedwd+\scr_totheight/2,\scr_totheight+\scr_boolsep);% \draw[ - fill={\ifboolKV[\scrname]{print}{\ifboolKV[\scrname]{fill blocks}{scr_fillgray}{none}}{\scr_current_blockcolor}}, - draw={\ifboolKV[\scrname]{print}{scr_linegray}{#1dd}} + fill={% + \ifboolKV[\scrname]{print} + {\ifboolKV[\scrname]{fill blocks} + {scr_fillgray\if_boolempty!85!black\fi} + {none}% + } + {\scr_current_blockcolor}% + }, + draw={% + \ifboolKV[\scrname]{print} + {scr_linegray} + {#1dd}% + } ] (\scr_boolsep,-\scr_boolsep)--++(\scr_retainedwd-\scr_boolsep*2,0)--++(\scr_totheight/2+\scr_boolsep,\scr_totheight/2+\scr_boolsep)--++(-\scr_totheight/2-\scr_boolsep,\scr_totheight/2+\scr_boolsep)--++(-\scr_retainedwd+\scr_boolsep*2,0)--++(-\scr_totheight/2-\scr_boolsep,-\scr_totheight/2-\scr_boolsep)--cycle;% \node[ @@ -648,7 +802,11 @@ minimum size=0pt, draw=none, anchor=south west, - text={\ifboolKV[\scrname]{print}{\useKV[\scrname]{text color}}{white}} + text={% + \ifboolKV[\scrname]{print} + {\useKV[\scrname]{text color}} + {white}% + } ] (x) {% @@ -656,11 +814,17 @@ \scr_ovalstrut \kern\_% \kern\scr_boolsentinel sp - #2% + \_inpicturetrue + \if_boolempty + \vrule width#2 height0pt depth0pt\relax + \else + #2% + \fi \kern\_% };% \end{tikzpicture}% \endgroup + \_boolemptyfalse \kern\scr_boolsentinel sp } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -704,40 +868,51 @@ \definecolor{penline} {HTML}{595e73}% \definecolor{penblue} {HTML}{4c8eea}% \definecolor{penvline} {HTML}{0da57a}% +\definecolor{boolempty} {HTML}{cf8b17}% new 0.14 +\definecolor{boolemptyd} {HTML}{cf8b17}% new 0.14 +\definecolor{boolemptydd} {HTML}{cf8b17}% new 0.14 \newenvironment{scratch}[1][] {\skv_ifempty{#1}{}{\setscratch{#1}}% \sffamily \edef\scr_ex{\the\dimexpr1ex\relax}% valeur d'1ex pour le tracé de la flèche \edef\scr_em{\the\dimexpr1em\relax}% - \scr_normalizedim\scr_corner corner[\scr_ex/3,\scr_ex]% - \scr_normalizedim\scr_notch notch[\scr_em/3,\scr_em*3]% - \scr_normalizedec\scr_scale scale[0.2,5]% échelle - \scr_normalizedim\scr_xsep x sep[0pt,\scr_em]% - \scr_normalizedim\scr_ysepsup y sepsup[1pt,\scr_ex*3]% - \scr_normalizedim\scr_ysepinf y sepinf[1pt,\scr_ex*3]% - \scr_normalizedim\scr_linewidth line width[0pt,5pt]% épaisseur des lignes soumises à l'échelle - \scr_normalizedim\scr_loopblockwidth loop width[3pt,\scr_em*3]% - \scr_normalizedim\scr_loopblockheight loop height[3pt,\scr_ex*3]% - \scr_normalizedec\scr_initarcangle init arcangle[20,40]% - \scr_normalizedim\scr_initarclength init arclength[\scr_em*3,\scr_em*8]% - \scr_normalizedim\scr_numsep num sep[0pt,\scr_em*3/2]% - \scr_normalizedec\scr_contrast contrast[0,100]% + \scr_normalizedim\scr_corner corner [\scr_ex/3,\scr_ex]% + \scr_normalizedim\scr_notch notch [\scr_em/3,\scr_em*3]% + \scr_normalizedec\scr_scale scale [0.2,5]% échelle + \scr_normalizedim\scr_xsep x sep [0pt,\scr_em]% + \scr_normalizedim\scr_ysepsup y sepsup [1pt,\scr_ex*3]% + \scr_normalizedim\scr_ysepinf y sepinf [1pt,\scr_ex*3]% + \scr_normalizedim\scr_linewidth line width [0pt,5pt]% épaisseur des lignes soumises à l'échelle + \scr_normalizedim\scr_loopblockwidth loop width [3pt,\scr_em*3]% + \scr_normalizedim\scr_loopblockheight loop height [3pt,\scr_ex*3]% + \scr_normalizedec\scr_initarcangle init arcangle [20,40]% + \scr_normalizedim\scr_initarclength init arclength [\scr_em*3,\scr_em*8]% + \scr_normalizedim\scr_numsep num sep [0pt,\scr_em*3/2]% + \scr_normalizedec\scr_contrast contrast [0,100]% \edef\scr_contrast{\number\numexpr100-\scr_contrast}% \edef\scr_minwd{\the\dimexpr\scr_corner*4+\scr_notch*3-\scr_xsep*2}% \edef\scr_valign{\useKV[\scrname]{baseline}}% \scr_blocknum\number\numexpr\useKV[\scrname]{num start}\relax\relax \setbox\scr_box\hbox{\scr_blockstrut}\edef\scr_blockstruttotht{\the\dimexpr\ht\scr_box+\dp\scr_box\relax}% haut totale du strut \def\turnleft{\turn_arrow{}}\def\turnright{\turn_arrow{xscale=-1}}% - \let\blockmove \scr_blockmove \let\blocklook \scr_blocklook - \let\blocksound \scr_blocksound \let\blocklist \scr_blocklist - \let\blockpen \scr_blockpen \let\blockvariable \scr_blockvariable - \let\blockevent \scr_blockevent \let\blockinit \scr_blockinit - \let\blockrepeat \scr_blockrepeat \let\blockinfloop \scr_blockinfloop - \let\blockifelse \scr_blockifelse \let\blockif \scr_blockif - \let\blockinitclone\scr_blockinitclone \let\blockcontrol \scr_blockcontrol - \let\blocksensing \scr_blocksensing \let\blockmoreblocks\scr_blockmoreblocks - \let\namemoreblocks\scr_namemoreblocks + \let\blockmove \scr_blockmove + \let\blocklook \scr_blocklook + \let\blocksound \scr_blocksound + \let\blocklist \scr_blocklist + \let\blockpen \scr_blockpen + \let\blockvariable \scr_blockvariable + \let\blockevent \scr_blockevent + \let\blockinit \scr_blockinit + \let\blockrepeat \scr_blockrepeat + \let\blockinfloop \scr_blockinfloop + \let\blockifelse \scr_blockifelse + \let\blockif \scr_blockif + \let\blockinitclone \scr_blockinitclone + \let\blockcontrol \scr_blockcontrol + \let\blocksensing \scr_blocksensing + \let\blockmoreblocks\scr_blockmoreblocks + \let\namemoreblocks \scr_namemoreblocks \scr_xoffset0pt \scr_yoffset0pt \catcode`\:12 \catcode`\;12 \catcode`\!12 \catcode`\?12 \catcode`\_12 \csname skv_\if c\expandafter\scr_firsttonil\scr_valign c\_nil first\else second\fi\endcsname @@ -750,19 +925,21 @@ \begin{tikzpicture}[ baseline=(txt\scr_valign.base), }% - transform shape, + scale=\scr_scale, + every node/.style={scale=\scr_scale}, line width=\scr_linewidth, inner sep=0pt, outer sep=0pt, minimum size=0pt, - line cap=round, - scale=\scr_scale + line cap=round ] + \_inpicturetrue \node[shape=coordinate](origin){};% origine }% {% \end{tikzpicture}% \scr_scratchend + \_inpicturefalse% par pure sécurité } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -786,18 +963,25 @@ \else \def\scr_current_blockcolor{black}% \fi + \if_inpicture\def\scr_scale{1}\else\scr_normalizedec\scr_scale scale[0.2,5]\fi \begin{tikzpicture}[ baseline=(x.base), x=1ex, y=1ex, inner ysep=0.25ex, inner xsep=0.1ex, - line width=\scr_linewidth + line width=\scr_linewidth, + scale=\scr_scale, + every node/.style={scale=\scr_scale} ] \node[ line width=\scr_linewidth, rounded rectangle, - draw={\ifboolKV[\scrname]{print}{scr_linegray}{\scr_current_blockcolor}}, + draw={% + \ifboolKV[\scrname]{print} + {scr_linegray} + {\scr_current_blockcolor}% + }, fill=white, text=black ] @@ -806,6 +990,7 @@ \useKV[\scrname]{pre text}\relax \scr_ovalstrut \kern\scr_ovalsentinel sp + \_inpicturetrue #1% \relax% pour contourner bug dans XeLaTeX \ifnum\lastkern=\scr_ovalsentinel\relax\expandafter\scr_execfirst\else\expandafter\scr_execsecond\fi @@ -818,7 +1003,10 @@ \endgroup \kern\scr_ovalsentinel sp } -\def\turn_arrow#1{\tikz[baseline=.25ex,x=6.5ex,y=6.5ex,#1]\draw[-{Triangle[angle=45:0.5ex 0.5ex,flex]},line width=.3333ex](0,0) arc[start angle=-80,end angle=190,radius=1ex];} +\def\turn_arrow#1{% + \tikz[baseline=.25ex,x=6.5ex,y=6.5ex,#1] + \draw[-{Triangle[angle=45:0.5ex 0.5ex,flex]},line width=.3333ex](0,0) arc[start angle=-80,end angle=190,radius=1ex];% +} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % menu apparence % @@ -847,7 +1035,7 @@ \def\scr_drawpen{% dessin du crayon \begin{tikzpicture}[ rotate=45, - rounded corners=.4pt, + rounded corners=.4pt*\scr_scale, line width=.5pt, x=5ex, y=5ex, @@ -858,19 +1046,27 @@ ] \draw[ penline, - fill={\ifboolKV[\scrname]{print}{scr_linegray}{penblue}} + fill={% + \ifboolKV[\scrname]{print} + {scr_linegray} + {penblue}% + } ] (0,0)--(22:0.1)..controls(0.13,0.04)and(0.13,-0.04)..(-22:0.1)[sharp corners]--cycle; \draw[ penline, fill=white, - rounded corners=.2pt + rounded corners=.2pt*\scr_scale ] - (22:0.1)--(22:0.2)[rounded corners=0.05pt]--(.56,.07492)..controls(.62,0.04)and(.62,-0.04)..(.56,-.07492)[rounded corners=2pt]--(-22:.2)[rounded corners=0.05pt]--(-22:0.1)..controls(0.13,-0.04)and(0.13,0.04)..(22:0.1); + (22:0.1)--(22:0.2)[rounded corners=0.05pt*\scr_scale]--(.56,.07492)..controls(.62,0.04)and(.62,-0.04)..(.56,-.07492)[rounded corners=2pt*\scr_scale]--(-22:.2)[rounded corners=0.05pt*\scr_scale]--(-22:0.1)..controls(0.13,-0.04)and(0.13,0.04)..(22:0.1); \draw[ penline, - fill={\ifboolKV[\scrname]{print}{scr_linegray}{penblue}}, - rounded corners=.2pt + fill={% + \ifboolKV[\scrname]{print} + {scr_linegray} + {penblue}% + }, + rounded corners=.2pt*\scr_scale ] (.56,.07492)--(.88,.07492)..controls(.92,0.04)and(.92,-0.04)..(0.88,-.07492)[sharp corners]--(.56,-.07492)..controls(.62,-0.04)and(.62,0.04)..cycle; \draw[penline](.84,0.07492)..controls(.7,.24)and(.58,0.02)..(.5,0.16); @@ -923,7 +1119,9 @@ }% } \newcommand*\boollist{\scr_boolbox{scrlist}} - +\newif\if_boolempty +\_boolemptyfalse +\newcommand*\boolempty[1][2em]{\_boolemptytrue\scr_boolbox{boolempty}{#1}} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % menu événement % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -938,8 +1136,16 @@ ] \draw[ line width=\scr_linewidth, - draw={\ifboolKV[\scrname]{print}{scr_flaggray}{flagcontour}}, - fill={\ifboolKV[\scrname]{print}{scr_flaggray!85!white}{greenflag}} + draw={% + \ifboolKV[\scrname]{print} + {scr_flaggray} + {flagcontour}% + }, + fill={% + \ifboolKV[\scrname]{print} + {scr_flaggray!85!white} + {greenflag}% + } ] (0,0.95)..controls(.4,1.4) and (.7,.7)..(1,1)--(1,.4)..controls(.7,0.1)and(.4,.8)..(0,.4)--cycle; \filldraw[{\ifboolKV[\scrname]{print}{scr_flaggray}{flagcontour}}] @@ -1017,4 +1223,12 @@ Versions : | | | * bug corrigé dans \scr_ovalbox | |---------+------------+------------------------------------------------------| | 0.13 | 01/07/2019 | * \relax ajoutés pour éviter le bug de XeLaTeX | -| | | concernant \lastkern |
\ No newline at end of file +| | | concernant \lastkern | +|---------+------------+------------------------------------------------------| +| 0.14 | 01/10/2019 | * gestion de l'échelle (via clé "scale") améliorée | +| | | * hors de l'environnement, les ovales et les losanges| +| | | sont affectés par la clé scale si elle est | +| | | spécifiée via \setscratch | +| | | * erreur de tracé corrigée dans \scr_blockloop | +| | | * nouveau losange vide : \boolempty[<dimension>] | +|---------+------------+------------------------------------------------------|
\ No newline at end of file |