From 19d739268d5ddc1cded19571b7d665efa4c0c999 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 8 Aug 2017 20:42:25 +0000 Subject: scratch (8aug17) git-svn-id: svn://tug.org/texlive/trunk@44989 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/scratch/scratch.sty | 48 +++++++++++++++---------- 1 file changed, 29 insertions(+), 19 deletions(-) (limited to 'Master/texmf-dist/tex/latex/scratch') diff --git a/Master/texmf-dist/tex/latex/scratch/scratch.sty b/Master/texmf-dist/tex/latex/scratch/scratch.sty index a764975caa5..ae4fa5cb6af 100644 --- a/Master/texmf-dist/tex/latex/scratch/scratch.sty +++ b/Master/texmf-dist/tex/latex/scratch/scratch.sty @@ -4,9 +4,9 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % \def\scrname {scratch} % -\def\scrver {0.2} % +\def\scrver {0.3} % % % -\def\scrdate {2017/05/28} % +\def\scrdate {2017/08/08} % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % @@ -24,10 +24,11 @@ % This work has the LPPL maintenance status `maintained'. % % The Current Maintainer of this work is Christian Tellechea -% email: unbonpetit@openmailbox.org +% email: unbonpetit@netc.fr % Commentaires, suggestions et signalement de bugs bienvenus ! % Comments, bug reports and suggestions are welcome. % Package URL: https://www.ctan.org/pkg/scratch +% Copyright: Christian Tellechea 2017 % -------------------------------------------------------------------- % L'extension scratch est composée des 4 fichiers suivants : % - code : scratch.sty @@ -36,13 +37,13 @@ % -------------------------------------------------------------------- \ProvidesPackage{scratch}[\scrdate\space v\scrver\space Draw scratch instructions (CT)] \NeedsTeXFormat{LaTeX2e} -\RequirePackage{hlist,tikz} +\RequirePackage{simplekv,tikz} \usepgflibrary{shapes.misc,arrows.meta} \usetikzlibrary{bending} \expandafter\edef\csname scr\string_restorecatcode\endcsname{\catcode`\noexpand\_=\the\catcode`\_\relax} \catcode`\_11 -% Les réglages par défaut (modifiables avec \setdefaulthlist) +% Les réglages par défaut (modifiables avec \setdefaultscratch) \setKVdefault[\scrname]{ else word = sinon,% mot dans branche "else" x sep = 0.5em,% séparation entre côtés droits et gauche du bloc et le texte @@ -52,9 +53,10 @@ loop width = 3ex,% épaisseur de la barre verticale à gauche d'un bloc de boucle loop height = 1.75ex,% hauteur de la barre du else et la barre finale corner = 0.66667ex,% valeur du chanfrein + scale = 1,% échelle du dessin init arcangle = 30,% angle début et fin de l'arc init arclength = 5em,% longueur de l'arc - moreblock arcangle = 15,% angle de départ et arriéve des "more blocks" + moreblock arcangle = 15,% angle de départ et arrivée des "more blocks" contrast = 20,% contraste des lignes de relief (0=aucun contraste, 100=noir/blanc) print = false,% impression noir et blanc ? fill blocks = false,% remplissage des blocks lorsque l'option "print" est vraie @@ -64,18 +66,18 @@ line gray = 0.4,% taux de gris pour les lignes lorsque l'option "print" est vraie bool sep = 1.25pt,% séparation entre les blocs booléens imbriqués } -\expandafter\let\expandafter\resetscratch\csname hlst_[\scrname]\endcsname +\def\resetscratch{\csname skv_[\scrname]\endcsname\scr_setcolors} \def\setscratch#1{\setKV[\scrname]{#1}\scr_setcolors} \def\setdefaultscratch#1{\setKVdefault[\scrname]{#1}\scr_setcolors} \def\scr_setcolors{% - \hlst_eearg{\definecolor{scr_fillgray}{gray}}{\useKV[\scrname]{fill gray}}% - \hlst_eearg{\definecolor{scr_linegray}{gray}}{\useKV[\scrname]{line gray}}% - \hlst_eearg{\definecolor{scr_flaggray}{gray}}{\useKV[\scrname]{flag gray}}% + \skv_eearg{\definecolor{scr_fillgray}{gray}}{\useKV[\scrname]{fill gray}}% + \skv_eearg{\definecolor{scr_linegray}{gray}}{\useKV[\scrname]{line gray}}% + \skv_eearg{\definecolor{scr_flaggray}{gray}}{\useKV[\scrname]{flag gray}}% } \def\scr_thesentinelkern{17}% nombre de "sp" sentinelle pour les booleanbox. Personne n'utilise 17sp j'espère ? -\def\scr_blockstrut{\vrule height2.1ex depth.9ex width0pt\relax}% TODO à modifier ? -\def\scr_ovalstrut{\vphantom{\`Alpgqyj}}% TODO c'est pas un peu petit en hauteur tout ça ? +\def\scr_blockstrut{\vrule height2.1ex depth.9ex width0pt\relax} +\def\scr_ovalstrut{\vphantom{\`Alpgqyj}} \def\scr_cslet#1{\expandafter\let\csname#1\endcsname} \def\scr_csedef#1{\expandafter\edef\csname#1\endcsname} \newcount\scr_loopnest @@ -377,8 +379,8 @@ \draw[fill=\scr_current_fillcolor,draw=none](\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;% \draw[\scr_current_linedark](\scr_retainedwd+\scr_totheight/2,\scr_totheight/2)--(\scr_retainedwd-\scr_boolsep,-\scr_boolsep)--(\scr_boolsep,-\scr_boolsep) \ifboolKV[\scrname]{print}{--(-\scr_totheight/2,\scr_totheight/2)}{}; - \draw[\scr_current_linelight](\scr_retainedwd+\scr_totheight/2,\scr_totheight/2)--(\scr_retainedwd-\scr_boolsep,\scr_boolsep+\scr_totheight)--(\scr_boolsep,\scr_boolsep+\scr_totheight) - \ifboolKV[\scrname]{print}{--(-\scr_totheight/2,\scr_totheight/2)}{}; + \draw[\scr_current_linelight](-\scr_totheight/2,\scr_totheight/2)--(\scr_boolsep,\scr_boolsep+\scr_totheight)--(\scr_retainedwd-\scr_boolsep,\scr_boolsep+\scr_totheight) + \ifboolKV[\scrname]{print}{--(\scr_retainedwd+\scr_totheight/2,\scr_totheight/2)}{}; \node[inner sep=0pt,outer sep=0pt,minimum size=0pt,draw=none,anchor=south west,text=\scr_current_textcolor](x){\sffamily\bfseries\scr_ovalstrut\kern\scr_thesentinelkern sp #2};% \end{tikzpicture}% \endgroup @@ -388,10 +390,11 @@ % environnement scratch % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newenvironment{scratch}[1][] - {\hlst_ifempty{#1}{}{\setscratch{#1}}% + {\skv_ifempty{#1}{}{\setscratch{#1}}% \normalfont \edef\scr_ex{\the\dimexpr1ex\relax}% valeur d'1ex pour le tracé de la flèche - \edef\scr_corner{\the\dimexpr\useKV[\scrname]{corner}\relax} + \edef\scr_corner{\the\dimexpr\useKV[\scrname]{corner}\relax}% + \edef\scr_currentscale{\useKV[\scrname]{scale}}% \edef\scr_xsep{\the\dimexpr\useKV[\scrname]{x sep}\relax}% \edef\scr_ysepsup{\the\dimexpr\useKV[\scrname]{y sepsup}\relax}% \edef\scr_ysepinf{\the\dimexpr\useKV[\scrname]{y sepinf}\relax}% @@ -412,7 +415,7 @@ \let\blockinitclone\scr_blockinitclone\let\blockcontrol\scr_blockcontrol \let\blocksensing\scr_blocksensing\let\blockmoreblocks\scr_blockmoreblocks \catcode`\:12 \catcode`\;12 \catcode`\!12 \catcode`\?12 \catcode`\_12 - \begin{tikzpicture}[line width=\scr_linewidth,inner sep=0pt,outer sep=0pt,minimum size=0pt,line cap=round] + \begin{tikzpicture}[line width=\scr_linewidth,inner sep=0pt,outer sep=0pt,minimum size=0pt,line cap=round,scale=\scr_currentscale,every node/.style={scale=\scr_currentscale}] \node[shape=coordinate](origin){};% origine } {\end{tikzpicture}} @@ -441,7 +444,7 @@ \def\ovallook{\scr_ovalbox{scrlook}} \def\txtbox#1{% #1=texte dans un rectangle blanc \begin{tikzpicture}[inner xsep=0.2em,inner ysep=0pt,baseline=(text.base west)] - \node[fill=white,text=black](text){\normalfont\sffamily\strut#1}; + \node[rectangle,fill=white,text=black](text){\normalfont\sffamily\strut#1}; \draw[draw=white!80!black,line width=0.5pt](text.south west)--(text.north west)--(text.north east); \ifboolKV[\scrname]{print} {\draw[draw=white!80!black,line width=0.5pt](text.south west)--(text.south east)--(text.north east); } @@ -540,6 +543,13 @@ Versions : |-----------------------------------------------------------------------------| | 0.1 | 16/05/2017 | Première version | |-----------------------------------------------------------------------------| -| 0.2 | 27/05/2017 | Ajout des options "constast" et print ainsi que | +| 0.2 | 28/05/2017 | Ajout des options "constast", "print" ainsi que | | | | les options relatives à "print" | +|-----------------------------------------------------------------------------| +| 0.3 | 08/08/2017 | - Correction d'une erreur dans le tracé des lignes | +| | | de contraste des "boolbox" | +| | | - Correction d'un bug dans \resetscratch | +| | | - Correction d'un bug dans \txtbox | +| | | - Appel à simplekv pour les clés/valeurs | +| | | - Ajout de la clé "scale" | |-----------------------------------------------------------------------------| \ No newline at end of file -- cgit v1.2.3