From bd0e05b5b4dba5b38512acb2e7104f180fdb97e6 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Thu, 17 Feb 2022 03:01:15 +0000 Subject: CTAN sync 202202170301 --- .../latex/contrib/babel-contrib/serbian/README.md | 12 +- .../contrib/babel-contrib/serbian/serbian.dtx | 26 +- .../contrib/babel-contrib/serbian/serbian.ins | 8 +- .../contrib/babel-contrib/serbian/serbian.pdf | Bin 255910 -> 273184 bytes .../latex/contrib/babel-contrib/serbianc/README.md | 6 +- .../contrib/babel-contrib/serbianc/serbianc.dtx | 43 +- .../contrib/babel-contrib/serbianc/serbianc.ins | 8 +- .../contrib/babel-contrib/serbianc/serbianc.pdf | Bin 296954 -> 314360 bytes macros/latex/contrib/easybook/easybook.dtx | 6 +- macros/latex/contrib/easybook/easybook.pdf | Bin 578310 -> 578152 bytes macros/latex/contrib/easybook/easybook.tex | 8 +- .../latex/contrib/nicematrix/nicematrix-french.pdf | Bin 499106 -> 502752 bytes .../latex/contrib/nicematrix/nicematrix-french.tex | 103 ++- macros/latex/contrib/nicematrix/nicematrix.dtx | 534 +++++++----- macros/latex/contrib/nicematrix/nicematrix.pdf | Bin 1482850 -> 1489647 bytes .../contrib/profcollege/doc/ProfCollege-doc.pdf | Bin 7591580 -> 7630568 bytes .../contrib/profcollege/latex/ProfCollege.sty | 721 +++++++++++++--- .../profcollege/metapost/PfCCalculatrice.mp | 200 ++--- .../latex/contrib/proflycee/doc/ProfLycee-doc.pdf | Bin 362084 -> 426042 bytes .../latex/contrib/proflycee/doc/ProfLycee-doc.tex | 452 +++++----- macros/latex/contrib/proflycee/tex/ProfLycee.sty | 292 ++++++- macros/latex/contrib/wrapfig2/README.txt | 5 +- macros/latex/contrib/wrapfig2/commodilla.jpg | Bin 137378 -> 0 bytes macros/latex/contrib/wrapfig2/stele-todi-small.jpg | Bin 0 -> 64157 bytes macros/latex/contrib/wrapfig2/wrapfig2.dtx | 917 +++++++++++++-------- macros/latex/contrib/wrapfig2/wrapfig2.pdf | Bin 758679 -> 697282 bytes 26 files changed, 2347 insertions(+), 994 deletions(-) delete mode 100644 macros/latex/contrib/wrapfig2/commodilla.jpg create mode 100644 macros/latex/contrib/wrapfig2/stele-todi-small.jpg (limited to 'macros/latex') diff --git a/macros/latex/contrib/babel-contrib/serbian/README.md b/macros/latex/contrib/babel-contrib/serbian/README.md index 7006c05ad0..788773c140 100644 --- a/macros/latex/contrib/babel-contrib/serbian/README.md +++ b/macros/latex/contrib/babel-contrib/serbian/README.md @@ -1,6 +1,6 @@ ---------------------------------------------------------------- -# Serbian Latin language module for Babel, v2.1 +# Serbian Latin language module for Babel, v2.2 Released under the LaTeX Project Public License v1.3 or later. See http://www.latex-project.org/lppl.txt @@ -19,14 +19,18 @@ lualatex.exe). Typesetting in ijekavian dialect: - \usepackage[english,serbianc]{babel} - \languageattribute{serbianc}{ijekav} + \usepackage[english,serbian]{babel} + \languageattribute{serbian}{ijekav} or - \usepackage[english,serbianc.ijekav]{babel} + \usepackage[english,serbian.ijekav]{babel} Also, the attributes 'datei' and 'quotes' are defined. +## CHANGES v2.2 + +New date formats are available. + ## CHANGES v2.1 New enumeration alphabets are available. diff --git a/macros/latex/contrib/babel-contrib/serbian/serbian.dtx b/macros/latex/contrib/babel-contrib/serbian/serbian.dtx index 106ac9b7aa..70f9a2c38d 100644 --- a/macros/latex/contrib/babel-contrib/serbian/serbian.dtx +++ b/macros/latex/contrib/babel-contrib/serbian/serbian.dtx @@ -1,6 +1,6 @@ % \iffalse meta-comment % -% Copyright 2019--2021 Uroš Stefanović and any individual authors +% Copyright 2019--2022 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 % @@ -32,7 +32,7 @@ %\ProvidesLanguage{serbian} %\fi %\ProvidesFile{serbian.dtx} - [2021/04/10 2.1 Serbian Latin support for the Babel system] + [2022/02/16 2.2 Serbian Latin support for the Babel system] %\iffalse %% File `serbian.dtx' % @@ -98,7 +98,9 @@ % If you prefer to use `juni' and `juli' instead of default `jun' and `jul', % use the \Lopt{datei} attribute. Also, the |\today*| macro prints the date without dot after the year % (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. +% Alternatively, the commands |\todayRoman| and |\todayRoman*| prints the current date using Roman numerals for months; +% |\todayGen| and |\todayGen*| prints the current month name in the genitive case, +% and |\todayArabic| and |\todayArabic*| prints the current month as a number. % % 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). @@ -271,6 +273,7 @@ % \end{macrocode} % % The macro |\dateserbian| redefines the commands |\today|, |\today*|, |\todayRoman| and |\todayRoman*| to produce Serbian dates. +% Also, the commands |\todayGen|, |\todayGen*|, |\todayArabic| and |\todayArabic*| are provided. % % \begin{macrocode} \def\dateserbian{% @@ -287,8 +290,23 @@ oktobar\or novembar\or decembar\fi}% + \def\month@serbian@gen{\ifcase\month\or + januara\or + februara\or + marta\or + aprila\or + maja\or + juna\or + jula\or + avgusta\or + septembra\or + oktobra\or + novembra\or + decembra\fi}% \def\today{\number\day.~\month@serbian\ \number\year\@ifstar{}{.}}% - \def\todayRoman{\number\day.~\@Roman\month~\number\year\@ifstar{}{.}}} + \def\todayRoman{\number\day.~\@Roman\month~\number\year\@ifstar{}{.}}% + \def\todayGen{\number\day.~\month@serbian@gen\ \number\year\@ifstar{}{.}}% + \def\todayArabic{\number\day.~\number\month.~\number\year\@ifstar{}{.}}} \let\dateserbian@datei=\dateserbian \addto\dateserbian@datei{ \def\month@serbian@datei{\ifnum\month=6 juni% diff --git a/macros/latex/contrib/babel-contrib/serbian/serbian.ins b/macros/latex/contrib/babel-contrib/serbian/serbian.ins index aa495cf06a..8ab31c3415 100644 --- a/macros/latex/contrib/babel-contrib/serbian/serbian.ins +++ b/macros/latex/contrib/babel-contrib/serbian/serbian.ins @@ -3,7 +3,7 @@ %% driver files from the doc files in this package when run through %% LaTeX or TeX. %% -%% Copyright 2019--2021 Uroš Stefanović and any individual authors +%% Copyright 2019--2022 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 %% @@ -29,7 +29,7 @@ %% %% --------------- start of docstrip commands ------------------ %% -\def\filedate{2021/04/10} +\def\filedate{2022/02/16} \def\batchfile{serbian.ins} \input docstrip.tex @@ -51,7 +51,7 @@ \declarepreamble\mainpreamble This is a generated file. -Copyright 2019--2021 Uroš Stefanović and any individual authors +Copyright 2019--2022 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. @@ -77,7 +77,7 @@ extension .ins) which are part of the distribution. \declarepreamble\fdpreamble This is a generated file. -Copyright 2019--2021 Uroš Stefanović and any individual authors +Copyright 2019--2022 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 index 29d8d75b5e..2f02e91498 100644 Binary files a/macros/latex/contrib/babel-contrib/serbian/serbian.pdf and b/macros/latex/contrib/babel-contrib/serbian/serbian.pdf differ diff --git a/macros/latex/contrib/babel-contrib/serbianc/README.md b/macros/latex/contrib/babel-contrib/serbianc/README.md index 5a9c48d83c..5d43446d6a 100644 --- a/macros/latex/contrib/babel-contrib/serbianc/README.md +++ b/macros/latex/contrib/babel-contrib/serbianc/README.md @@ -1,6 +1,6 @@ ---------------------------------------------------------------- -# Serbian Cyrillic language module for Babel, v3.1 +# Serbian Cyrillic language module for Babel, v3.2 Released under the LaTeX Project Public License v1.3 or later. See http://www.latex-project.org/lppl.txt @@ -48,6 +48,10 @@ or Also, the attributes 'datei' and 'quotes' are defined. +## CHANGES v3.2 + +New date formats are available. + ## CHANGES v3.1 New enumeration alphabets are available. diff --git a/macros/latex/contrib/babel-contrib/serbianc/serbianc.dtx b/macros/latex/contrib/babel-contrib/serbianc/serbianc.dtx index cca22b76c0..c3716aff52 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--2021 Uroš Stefanović, +%Copyright 2019--2022 Uroš Stefanović, %2002--2019 Filip Brčić %All rights reserved. % @@ -32,7 +32,7 @@ %\ProvidesLanguage{serbianc} %\fi %\ProvidesFile{serbianc.dtx} - [2021/04/10 3.1 Serbian Cyrillic support for the Babel system] + [2022/02/16 3.2 Serbian Cyrillic support for the Babel system] %\iffalse %% File `serbianc.dtx' % @@ -96,7 +96,9 @@ % If you prefer to use `јуни' and `јули' instead of default `јун' and `јул', % use the \Lopt{datei} attribute. Also, the |\today*| macro prints the date without dot after the year % (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. +% Alternatively, the commands |\todayRoman| and |\todayRoman*| prints the current date using Roman numerals for months; +% |\todayGen| and |\todayGen*| prints the current month name in the genitive case, +% and |\todayArabic| and |\todayArabic*| prints the current month as a number. % % 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. @@ -426,6 +428,7 @@ % \end{macrocode} % % The macro |\dateserbianc| redefines the commands |\today|, |\today*|, |\todayRoman| and |\todayRoman*| to produce Serbian dates. +% Also, the commands |\todayGen|, |\todayGen*|, |\todayArabic| and |\todayArabic*| are provided. % % \begin{macrocode} \if@srbc@uni@ode @@ -443,8 +446,23 @@ октобар\or новембар\or децембар\fi}% + \def\month@serbianc@gen{\ifcase\month\or + јануара\or + фебруара\or + марта\or + априла\or + маја\or + јуна\or + јула\or + августа\or + септембра\or + октобра\or + новембра\or + децембра\fi}% \def\today{\number\day.~\month@serbianc\ \number\year\@ifstar{}{.}}% - \def\todayRoman{\number\day.~\@Roman\month~\number\year\@ifstar{}{.}}} + \def\todayRoman{\number\day.~\@Roman\month~\number\year\@ifstar{}{.}}% + \def\todayGen{\number\day.~\month@serbianc@gen\ \number\year\@ifstar{}{.}}% + \def\todayArabic{\number\day.~\number\month.~\number\year\@ifstar{}{.}}} \let\dateserbianc@datei=\dateserbianc \addto\dateserbianc@datei{% \def\month@serbianc@datei{\ifnum\month=6 јуни% @@ -465,8 +483,23 @@ \cyro\cyrk\cyrt\cyro\cyrb\cyra\cyrr\or \cyrn\cyro\cyrv\cyre\cyrm\cyrb\cyra\cyrr\or \cyrd\cyre\cyrc\cyre\cyrm\cyrb\cyra\cyrr\fi}% + \def\month@serbianc@gen{\ifcase\month\or + \cyrje\cyra\cyrn\cyru\cyra\cyrr\cyra\or + \cyrf\cyre\cyrb\cyrr\cyru\cyra\cyrr\cyra\or + \cyrm\cyra\cyrr\cyrt\cyra\or + \cyra\cyrp\cyrr\cyri\cyrl\cyra\or + \cyrm\cyra\cyrje\cyra\or + \cyrje\cyru\cyrn\cyra\or + \cyrje\cyru\cyrl\cyra\or + \cyra\cyrv\cyrg\cyru\cyrs\cyrt\cyra\or + \cyrs\cyre\cyrp\cyrt\cyre\cyrm\cyrb\cyrr\cyra\or + \cyro\cyrk\cyrt\cyro\cyrb\cyrr\cyra\or + \cyrn\cyro\cyrv\cyre\cyrm\cyrb\cyrr\cyra\or + \cyrd\cyre\cyrc\cyre\cyrm\cyrb\cyrr\cyra\fi}% \def\today{\number\day.~\month@serbianc\ \number\year\@ifstar{}{.}}% - \def\todayRoman{\number\day.~\@Roman\month~\number\year\@ifstar{}{.}}} + \def\todayRoman{\number\day.~\@Roman\month~\number\year\@ifstar{}{.}}% + \def\todayGen{\number\day.~\month@serbianc@gen\ \number\year\@ifstar{}{.}}% + \def\todayArabic{\number\day.~\number\month.~\number\year\@ifstar{}{.}}} \let\dateserbianc@datei=\dateserbianc \addto\dateserbianc@datei{% \def\month@serbianc@datei{\ifnum\month=6\cyrje\cyru\cyrn\cyri% diff --git a/macros/latex/contrib/babel-contrib/serbianc/serbianc.ins b/macros/latex/contrib/babel-contrib/serbianc/serbianc.ins index 4260d94966..e925a6f8db 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--2021 Uroš Stefanović, +%% Copyright 2019--2022 Uroš Stefanović, %% 2002--2019 Filip Brčić %% All rights reserved. %% @@ -29,7 +29,7 @@ %% %% --------------- start of docstrip commands ------------------ %% -\def\filedate{2021/04/10} +\def\filedate{2022/02/16} \def\batchfile{serbianc.ins} \input docstrip.tex @@ -51,7 +51,7 @@ \declarepreamble\mainpreamble This is a generated file. -Copyright 2019--2021 Uroš Stefanović, +Copyright 2019--2022 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--2021 Uroš Stefanović, +Copyright 2019--2022 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 index b886b7b261..34eaa6d233 100644 Binary files a/macros/latex/contrib/babel-contrib/serbianc/serbianc.pdf and b/macros/latex/contrib/babel-contrib/serbianc/serbianc.pdf differ diff --git a/macros/latex/contrib/easybook/easybook.dtx b/macros/latex/contrib/easybook/easybook.dtx index 050718cbb5..0903ac961b 100644 --- a/macros/latex/contrib/easybook/easybook.dtx +++ b/macros/latex/contrib/easybook/easybook.dtx @@ -15,7 +15,7 @@ %<*class> \NeedsTeXFormat{LaTeX2e}[2020/10/01] \RequirePackage{l3keys2e} -\ProvidesExplClass{easybook}{2022/02/15}{1.628} +\ProvidesExplClass{easybook}{2022/02/16}{1.629} {Typeset Chinese theses or books} \bool_set_false:N \l__eb_compile_draft_bool @@ -303,7 +303,7 @@ %<*package> \NeedsTeXFormat{LaTeX2e}[2020/10/01] \RequirePackage{l3keys2e,etoolbox} -\ProvidesExplPackage{easybase}{2022/02/15}{1.628} +\ProvidesExplPackage{easybase}{2022/02/16}{1.629} {Typeset Chinese theses or books} \cs_generate_variant:Nn \dim_set:Nn { NV } @@ -2271,7 +2271,7 @@ } % %<*tcolorbox> -\ProvidesExplFile{eb-tcolorbox.cfg}{2022/02/15}{1.628} +\ProvidesExplFile{eb-tcolorbox.cfg}{2022/02/16}{1.629} {Customization of tcolorbox for easybook} \cs_set_protected:Npn \addtotcbstyle #1#2 diff --git a/macros/latex/contrib/easybook/easybook.pdf b/macros/latex/contrib/easybook/easybook.pdf index d5fc5dc183..5080515171 100644 Binary files a/macros/latex/contrib/easybook/easybook.pdf and b/macros/latex/contrib/easybook/easybook.pdf differ diff --git a/macros/latex/contrib/easybook/easybook.tex b/macros/latex/contrib/easybook/easybook.tex index 39c87a9732..3b5358c2e0 100644 --- a/macros/latex/contrib/easybook/easybook.tex +++ b/macros/latex/contrib/easybook/easybook.tex @@ -21,8 +21,8 @@ name = easybook, color-scheme = blue, title = EASYBOOK 使用手册, - version = v1.628, - date = 2022/02/15, + version = v1.629, + date = 2022/02/16, authors = 瞿毅, info = 排版简体中文学位论文和书籍, email = q1jx@foxmail.com, @@ -450,7 +450,7 @@ \ebstyle{hyphen-figure = {-}} \end{ctexexam} - 文档类有三种选项:布尔型 \boolkey*{key},选项的值为真 \code{true} 或假 \code{false},如果不指定默认为真。键值型 \key*-{key}{value} 需要为选项指定值,后面 \code{=} 号不能省略。选择型 \choicekey*{key}{one,\default{two},three} 根据提供的可选值进行设定。 + 文档类有三种选项:布尔型 \boolkey*{key},选项的值为真 \code{true} 或假 \code{false},如果不指定默认为真。键值型 \key*{key}{value} 需要为选项指定值,后面 \code{=} 号不能省略。选择型 \choicekey*{key}{one,\default{two},three} 根据提供的可选值进行设定。 \end{commands} \subsection{风格} @@ -532,7 +532,7 @@ \keychoice{linktype}{edge,colors,none}\Module{refset}\Default{edge} 超链接类型。\code{edge} 使超链接形式为边框,\code{colors} 使超链接字体为彩色,\code{none} 关闭超链接边框与颜色,此时 \option{linkcolor} 选项无效。 \keychoice{linkcolor}{fresh,cutepink,navyblue,crimson}\Default{navyblue} - 超链接颜色样式。预置了四种超链接颜色风格。为使相关颜色能够正确显示,\option{linkcolor} 选项应当在 \option{linktype} 前使用。 + 超链接颜色样式。预置了四种超链接颜色风格。为使相关颜色能够正确显示,选项 \option{linkcolor} 应当在 \option{linktype} 前使用。 \begin{commands} \command{DeclareLinkColor}[\splitmarg{风格名称,ctex@link,ctex@url,ctex@cite}] 声明新的超链接颜色样式命令。它的参数以英文逗号分隔,第一部分为颜色风格名称,后面三部分为 \code{HTML} 颜色代码,构成超链接颜色列表。 diff --git a/macros/latex/contrib/nicematrix/nicematrix-french.pdf b/macros/latex/contrib/nicematrix/nicematrix-french.pdf index 0e75045e9a..060eb81773 100644 Binary files a/macros/latex/contrib/nicematrix/nicematrix-french.pdf and b/macros/latex/contrib/nicematrix/nicematrix-french.pdf differ diff --git a/macros/latex/contrib/nicematrix/nicematrix-french.tex b/macros/latex/contrib/nicematrix/nicematrix-french.tex index fc2cc12e34..d97d20c70e 100644 --- a/macros/latex/contrib/nicematrix/nicematrix-french.tex +++ b/macros/latex/contrib/nicematrix/nicematrix-french.tex @@ -10,7 +10,7 @@ \usepackage{nicematrix} \usepackage{tikz} -\usetikzlibrary{fit,patterns,arrows.meta} +\usetikzlibrary{fit,patterns,arrows.meta,decorations.pathmorphing} \usepackage{enumitem} \usepackage{siunitx} @@ -1246,7 +1246,8 @@ tracées par |\hdottedline| et «|:|» ont ce même effet. commandes et des lettres pour des filets personnalisés avec la clé |custom-line|, utilisable dans |\NiceMatrixOptions| ou bien dans un environnement. Cette clé prend en argument une liste de paires de la forme -\textsl{clé=valeur}. Les clés disponibles sont les suivantes : +\textsl{clé=valeur}. Il y a d'abord deux clés pour spécifier les outils qui +permettront d'utiliser ce nouveau type de filet. \begin{itemize} \item la clé |command| indique le nom (sans la contre-oblique) d'une commande @@ -1256,8 +1257,20 @@ tracer des filets horizontaux (de manière similaire à |\hline|) ; \item la clé |letter| prend en argument une lettre\footnote{Les lettres suivantes ne sont pas autorisées : \verb+lcrpmbVX:|()[]!@<>+} qui pourra être utilisée par l'utilisateur dans le préambule d'un environnement à préambule (comme -|{NiceTabular}|) pour spécifier un filet vertical ; +|{NiceTabular}|) pour spécifier un filet vertical. +\end{itemize} + +\bigskip +Pour la description du filet elle-même, il y a trois possibilités. + +\begin{itemize} +\item \emph{Première possibilité}\par\nobreak + +Il est possible de spécifier des filets multiples, colorés avec une couleur +entre les filets (comme on peut le faire avec \pkg{colortbl} par exemple). + +\begin{itemize} \item la clé |multiplicity| indique le nombre de traits successifs qui seront tracés : par exemple, une valeur de~$2$ va créer des filets doubles comme créés en standard par |\hline\hline| ou bien \verb+||+ dans le préambule d'un @@ -1266,13 +1279,35 @@ environnement ; \item la clé |color| fixe la couleur des filets ; \item la clé |sep-color| fixe la couleur entre deux filets consécutifs (n'a -d'intérêt que dans le cas où la clé |multiplicity| est utilisée) ; +d'intérêt que dans le cas où la clé |multiplicity| est utilisée). +\end{itemize} -\item la clé |dotted| impose un style de pointillés qui utilise le système -de pointillés de la commande |\hdottedline| (et de la lettre \verb|:|) décrit à -la partie précédente (cf. p.~\pageref{dotted}). +\bigskip +\item \emph{Deuxième possibilité}\par\nobreak + +On peut utiliser la clé |dotted| qui impose un style de pointillés qui utilise +le système de pointillés de la commande |\hdottedline| (et de la lettre +\verb|:|) décrit à la partie précédente (cf. p.~\pageref{dotted}). La clé +|color| est en fait aussi utilisable dans ce cas-là. + +\bigskip +\item \colorbox{yellow!50}{\textbf{Nouveau 6.6}}\enskip \emph{Troisième + possibilité} + +On peut utiliser la clé |tikz| (si Tikz est chargé, \pkg{nicematrix} ne +chargeant par défaut que \textsc{pgf}). Dans ce cas-là, le filet est tracé +directement avec Tikz en utilisant comme paramètres la valeur de la clé |tikz| +qui doit être une liste de couples \textsl{clé=valeur} applicables à un chemin +Tikz. + +Par défaut aucune réservation de place n'est faite par défaut pour le filet qui +sera tracé avec Tikz. On peut demander une réservation (horizontale pour un +filet vertical et verticale pour un filet horizontal) avec la clé |width| qui +est donc en quelque sorte la largeur du filet qui sera tracé (cette largeur +n'est pas déduite des caractéristiques fournies par la clé |tikz|). \end{itemize} + \medskip Ce système permet en particulier de définir des commandes pour tracer des filets avec une couleur spécifique (et ces filets respecteront les blocs comme les @@ -1307,6 +1342,52 @@ Produit C & 5 & 4 & 1 \\ \end{center} +\bigskip +Voici un exemple avec la clé |tikz|. + +\begin{Verbatim} +\documentclass{article} +\usepackage{nicematrix,tikz} +\usetikzlibrary{decorations.pathmorphing} + +\NiceMatrixOptions + { + custom-line = + { + letter = I , + ~emphase#tikz = { decorate, decoration = { coil, aspect = 0 } }}@ , + ~emphase#width = 2 mm@ + } + } + +\begin{document} +\begin{NiceTabular}{cIcIc} +un & deux & trois \\ +quatre & cinq & six \\ +sept & huit & neuf +\end{NiceTabular} +\end{document} +\end{Verbatim} + +\begin{center} +\NiceMatrixOptions + { + custom-line = + { + letter = I , + tikz = { decorate, decoration = { coil, aspect = 0 } } , + width = 2 mm + } + } +\begin{NiceTabular}{cIcIc} +un & deux & trois \\ +quatre & cinq & six \\ +sept & huit & neuf +\end{NiceTabular} +\end{center} + + + \section{Les couleurs des rangées et des colonnes} \subsection{Utilisation de colortbl} @@ -1812,7 +1893,9 @@ concerné.\footnote{Pour le moment, cette clé n'est \emph{pas} disponible dans On a alors accès aux trois commandes suivantes : \begin{itemize} -\item |\cellcolor| qui colorie la case courante ; +\item |\cellcolor| qui colorie la case courante\footnote{Néanmoins, cette + commande |\cellcolor| supprimera les espaces qui la suivent, ce que ne fait + pas la commande |\cellcolor| de \pkg{colortbl}.} ; \item |\rowcolor| à utiliser dans une case et qui colorie le reste de la rangée ; \item |\columncolor| à utiliser dans le préambule du tableau de la même manière @@ -2130,6 +2213,10 @@ un très très très très long texte \end{center} +Remarquons que l'extension \pkg{varwidth} a quelques problèmes (au moins dans sa +version 0.92). Par exemple, avec LuaLaTeX, elle en fonctionne pas si le contenu +commence par une instruction |\color|. + \subsection{Les colonnes X} diff --git a/macros/latex/contrib/nicematrix/nicematrix.dtx b/macros/latex/contrib/nicematrix/nicematrix.dtx index 80d98ae17e..cf717533a1 100644 --- a/macros/latex/contrib/nicematrix/nicematrix.dtx +++ b/macros/latex/contrib/nicematrix/nicematrix.dtx @@ -15,8 +15,8 @@ % % \fi % \iffalse -\def\myfileversion{6.5} -\def\myfiledate{2022/01/23} +\def\myfileversion{6.6} +\def\myfiledate{2022/02/16} % % %<*batchfile> @@ -53,7 +53,7 @@ version 2005/12/01 or later. \geometry{left=2.8cm,right=2.8cm,top=2.5cm,bottom=2.5cm,papersize={21cm,29.7cm}} \usepackage{tikz} -\usetikzlibrary{fit,patterns,arrows.meta} +\usetikzlibrary{fit,patterns,arrows.meta,decorations.pathmorphing} \usepackage{nicematrix} \usepackage{siunitx} \usepackage{varwidth} @@ -1257,8 +1257,9 @@ version 2005/12/01 or later. % \colorbox{yellow!50}{\textbf{New 6.5}}\enskip It's possible to define commands % and letters for customized rules with the key |custom-line| available in % |\NiceMatrixOptions| and in the options of individual environments. That key -% takes in as argument a list of \textsl{key=value} pairs. The available keys -% are the following: +% takes in as argument a list of \textsl{key=value} pairs. First, there is two +% keys to define the tools which will be used to use that new type of rule. +% % \begin{itemize} % \item the key |command| is the name (without the backslahs) of a command that % will be created by \pkg{nicematrix} and that will be available for the final @@ -1267,8 +1268,19 @@ version 2005/12/01 or later. % \item the key |letter| takes in as argument a letter\footnote{The following % letters are forbidden: \verb+lcrpmbVX:|()[]!@<>+} that the user will use in % the preamble of an environment with preamble (such as |{NiceTabular}| in order -% to specify a vertical rule; +% to specify a vertical rule. +% \end{itemize} +% +% \bigskip +% For the description of the rule itself, there is three possibilities. % +% \begin{itemize} +% \item \emph{First possibility}\par\nobreak +% +% It's possible to specify composite rules, with a color and a color for the +% inter-rule space (as possible with \pkg{colortbl} for instance). +% +% \begin{itemize} % \item the key |multiplicity| is the number to consecutive rules that will be % drawn: for instance, a value of $2$ will create double rules such those % created by |\hline\hline| or \verb+||+ in the preamble of an environment; @@ -1276,13 +1288,33 @@ version 2005/12/01 or later. % \item the key |color| sets the color of the rule ; % % \item the key |sep-color| sets the color between two successive rules (should be -% used only in conjonction with |multiplicity|); +% used only in conjonction with |multiplicity|). +% \end{itemize} +% +% \bigskip +% \item \emph{Second possibility}\par\nobreak +% +% The key |dotted| forces a style with dotted rules such as those created by +% |\hdottedline| or the letter ``|:|'' in the preamble (cf. +% p.~\pageref{dotted}). The key |color| may be used also in that case. % -% \item the key |dotted| forces a style with dotted rules such as those created by -% |\hdottedline| or the letter ``|:|'' in the preamble (cf. p.~\pageref{dotted}). +% \bigskip +% \item \colorbox{yellow!50}{\textbf{New 6.6}}\enskip \emph{Third +% possibility}\par\nobreak +% +% It's possible to use the key |tikz| (if Tikz is loaded). In that case, the +% rule is drawn directly with Tikz by using as parameters the value of the key +% |tikz| which must be a list of \textsl{key=value} pairs which may be applied +% to a Tikz path. +% +% By default, no space is reserved for the rule that will be drawn with Tikz. It +% possible to specify a reservation (horizontal for a vertical rule and vertical +% for an horizontal one) with the key |width|. That value of that key, is, in +% some ways, the width of the rule that will be drawn (\pkg{nicematrix} does not +% compute that width from the characteristics of the rule specified in |tikz|). % \end{itemize} % -% \medskip +% \bigskip % That system may be used, in particular, for the definition of commands and % letters to draw rules with a specific color (and those rules will respect the % blocks as do all rules of \pkg{nicematrix}). @@ -1316,7 +1348,50 @@ version 2005/12/01 or later. % \end{NiceTabular} % \end{center} % -% +% \bigskip +% Here is an example of the key |tikz|. +% +% \begin{Verbatim} +% \documentclass{article} +% \usepackage{nicematrix,tikz} +% \usetikzlibrary{decorations.pathmorphing} +% +% \NiceMatrixOptions +% { +% custom-line = +% { +% letter = I , +% ~emphase#tikz = { decorate, decoration = { coil, aspect = 0 } }}@ , +% ~emphase#width = 2 mm@ +% } +% } +% +% \begin{document} +% \begin{NiceTabular}{cIcIc} +% one & two & three \\ +% four & five & six \\ +% seven & eight & nine +% \end{NiceTabular} +% \end{document} +% \end{Verbatim} +% +% \begin{center} +% \NiceMatrixOptions +% { +% custom-line = +% { +% letter = I , +% tikz = { decorate, decoration = { coil, aspect = 0 } } , +% width = 2 mm +% } +% } +% \begin{NiceTabular}{cIcIc} +% one & two & three \\ +% four & five & six \\ +% seven & eight & nine +% \end{NiceTabular} +% \end{center} +% % %\section{The color of the rows and columns} % @@ -1801,7 +1876,9 @@ version 2005/12/01 or later. % There are three commands available (they are inspired by \pkg{colortbl} but % are \emph{independent} of \pkg{colortbl}): % \begin{itemize} -% \item |\cellcolor| which colorizes a cell; +% \item |\cellcolor| which colorizes a cell;\footnote{However, this command +% |\cellcolor| will delete the following spaces, which does not the command +% |\cellcolor| of \pkg{colortbl}.} % \item |\rowcolor| which must be used in a cell and which colorizes the end of % the row; % \item |\columncolor| which must be used in the preamble of the environment @@ -2112,6 +2189,10 @@ version 2005/12/01 or later. % \end{NiceTabular} % \end{center} % +% \bigskip +% One should remark that the extension \pkg{varwidth} (at least in its version +% 0.92) has some problems: for instance, with LuaLaTeX, it does not work when +% the content begins with |\color|. % % % \subsection{The columns X} @@ -5649,7 +5730,8 @@ version 2005/12/01 or later. % \begin{macrocode} \bool_new:N \c_@@_in_preamble_bool \bool_set_true:N \c_@@_in_preamble_bool -\AtBeginDocument { \bool_set_false:N \c_@@_in_preamble_bool } +\hook_gput_code:nnn { begindocument } { . } + { \bool_set_false:N \c_@@_in_preamble_bool } % \end{macrocode} % % \begin{macrocode} @@ -5659,7 +5741,7 @@ version 2005/12/01 or later. \bool_new:N \c_@@_tabularx_loaded_bool \bool_new:N \c_@@_tikz_loaded_bool \bool_new:N \c_@@_varwidth_loaded_bool -\AtBeginDocument +\hook_gput_code:nnn { begindocument } { . } { \@ifpackageloaded { varwidth } { \bool_set_true:N \c_@@_varwidth_loaded_bool } @@ -5789,7 +5871,7 @@ version 2005/12/01 or later. % be modified. In order to avoid an error message in this case, we will redefine % |\pgfutil@check@rerun| in the |aux| file. % \begin{macrocode} -\AtBeginDocument +\hook_gput_code:nnn { begindocument } { . } { \@ifpackageloaded { booktabs } { \iow_now:Nn \@mainaux \nicematrix@redefine@check@rerun } @@ -5816,7 +5898,7 @@ version 2005/12/01 or later. % redefinition of |\everycr|. % \begin{macrocode} \bool_new:N \c_@@_colortbl_loaded_bool -\AtBeginDocument +\hook_gput_code:nnn { begindocument } { . } { \@ifpackageloaded { colortbl } { \bool_set_true:N \c_@@_colortbl_loaded_bool } @@ -5989,7 +6071,7 @@ version 2005/12/01 or later. % loaded, we redefine the |S| columns of \pkg{siunitx}. % \begin{macrocode} \bool_new:N \c_@@_siunitx_loaded_bool -\AtBeginDocument +\hook_gput_code:nnn { begindocument } { . } { \@ifpackageloaded { siunitx } { \bool_set_true:N \c_@@_siunitx_loaded_bool } @@ -6003,7 +6085,7 @@ version 2005/12/01 or later. % The command |\@@_renew_NC@rewrite@S:| will be used in each environment of % \pkg{nicematrix} in order to ``rewrite'' the |S| column in each environment. % \begin{macrocode} -\AtBeginDocument +\hook_gput_code:nnn { begindocument } { . } { \bool_if:nTF { ! \c_@@_siunitx_loaded_bool } { \cs_set_eq:NN \@@_renew_NC@rewrite@S: \prg_do_nothing: } @@ -6399,11 +6481,10 @@ version 2005/12/01 or later. % % \bigskip % The L3 programming layer provides scratch dimensions |\l_tmpa_dim| and -% |\l_tmpb_dim|. We creates two more in the same spirit (if they don't exist -% yet: that's why we use |\dim_zero_new:N|). +% |\l_tmpb_dim|. We creates two more in the same spirit. % \begin{macrocode} -\dim_zero_new:N \l_tmpc_dim -\dim_zero_new:N \l_tmpd_dim +\dim_zero_new:N \l_@@_tmpc_dim +\dim_zero_new:N \l_@@_tmpd_dim % \end{macrocode} % % \bigskip @@ -6831,7 +6912,7 @@ version 2005/12/01 or later. % beginning of the document (we want to allow the user to load \pkg{enumitem} % after \pkg{nicematrix}). % \begin{macrocode} -\AtBeginDocument +\hook_gput_code:nnn { begindocument } { . } { \bool_if:nTF { ! \c_@@_enumitem_loaded_bool } { @@ -7051,10 +7132,11 @@ version 2005/12/01 or later. % initial value is 0.45~em but it will be changed if the option |small| is used. % \begin{macrocode} \dim_new:N \l_@@_inter_dots_dim -\AtBeginDocument { \dim_set:Nn \l_@@_inter_dots_dim { 0.45 em } } +\hook_gput_code:nnn { begindocument } { . } + { \dim_set:Nn \l_@@_inter_dots_dim { 0.45 em } } % \end{macrocode} -% The |\AtBeginDocument| is only a security in case \cls{revtex4-1} is used -% (even though it is obsolete). +% We use a hook only by security in case \cls{revtex4-1} +% is used (even though it is obsolete). % % \bigskip % The following dimension is the minimal distance between a node (in fact an @@ -7063,10 +7145,11 @@ version 2005/12/01 or later. % distance may vary a little). % \begin{macrocode} \dim_new:N \l_@@_xdots_shorten_dim -\AtBeginDocument { \dim_set:Nn \l_@@_xdots_shorten_dim { 0.3 em } } +\hook_gput_code:nnn { begindocument } { . } + { \dim_set:Nn \l_@@_xdots_shorten_dim { 0.3 em } } % \end{macrocode} -% The |\AtBeginDocument| is only a security in case \cls{revtex4-1} is used -% (even though it is obsolete). +% We use a hook only by security in case \cls{revtex4-1} is used (even though it +% is obsolete). % % \bigskip % The following dimension is the radius of the dots for the dotted lines (when @@ -7074,10 +7157,11 @@ version 2005/12/01 or later. % value is 0.53~pt but it will be changed if the option |small| is used. % \begin{macrocode} \dim_new:N \l_@@_radius_dim -\AtBeginDocument { \dim_set:Nn \l_@@_radius_dim { 0.53 pt } } +\hook_gput_code:nnn { begindocument } { . } + { \dim_set:Nn \l_@@_radius_dim { 0.53 pt } } % \end{macrocode} -% The |\AtBeginDocument| is only a security in case \cls{revtex4-1} is used -% (even if it is obsolete). +% We use a hook only by security in case \cls{revtex4-1} is used (even though it +% is obsolete). % % % \bigskip @@ -7134,10 +7218,11 @@ version 2005/12/01 or later. % \bigskip % \begin{macrocode} \dim_new:N \l_@@_notes_above_space_dim -\AtBeginDocument { \dim_set:Nn \l_@@_notes_above_space_dim { 1 mm } } +\hook_gput_code:nnn { begindocument } { . } + { \dim_set:Nn \l_@@_notes_above_space_dim { 1 mm } } % \end{macrocode} -% The |\AtBeginDocument| is only a security in case \cls{revtex4-1} is used -% (even if it is obsolete). +% We use a hook only by security in case \cls{revtex4-1} is used (even though it +% is obsolete). % % \bigskip % The flag |\l_@@_nullify_dots_bool| corresponds to the option |nullify-dots|. @@ -7487,7 +7572,7 @@ version 2005/12/01 or later. { \bool_if:NTF \c_@@_in_preamble_bool { - \AtBeginDocument + \hook_gput_code:nnn { begindocument } { . } { \bool_if:NT \c_@@_enumitem_loaded_bool { \setlist* [ tabularnotes ] { #1 } } @@ -7503,7 +7588,7 @@ version 2005/12/01 or later. { \bool_if:NTF \c_@@_in_preamble_bool { - \AtBeginDocument + \hook_gput_code:nnn { begindocument } { . } { \bool_if:NT \c_@@_enumitem_loaded_bool { \setlist* [ tabularnotes* ] { #1 } } @@ -7603,17 +7688,6 @@ version 2005/12/01 or later. renew-matrix .code:n = \@@_renew_matrix: , renew-matrix .value_forbidden:n = true , % \end{macrocode} -% The key |transparent| is now considered as obsolete (because its name is ambiguous). -% \begin{macrocode} - transparent .code:n = - { - \@@_renew_matrix: - \bool_set_true:N \l_@@_renew_dots_bool - \@@_error:n { Key~transparent } - } , - transparent .value_forbidden:n = true, -% \end{macrocode} -% % % \bigskip % The option |exterior-arraycolsep| will have effect only in |{NiceArray}| for @@ -8489,13 +8563,9 @@ version 2005/12/01 or later. % We redefine |\multicolumn| and, since we want |\multicolumn| to be available % in the potential environments |{tabular}| nested in the environments of % \pkg{nicematrix}, we patch |{tabular}| to go back to the original definition. -% The command |\AtBeginEnvironment| is the command of \pkg{l3hooks} and, if this -% command is not available (versions of LaTeX prior to 2020-10-01), -% \pkg{etoolbox} is loaded and the command |\AtBeginDocument| of \pkg{etoolbox} -% is used. % \begin{macrocode} \cs_set_eq:NN \multicolumn \@@_multicolumn:nnn - \AtBeginEnvironment { tabular } + \hook_gput_code:nnn { env / tabular / begin } { . } { \cs_set_eq:NN \multicolumn \@@_old_multicolumn } % \end{macrocode} % @@ -8972,15 +9042,15 @@ version 2005/12/01 or later. \@@_qpoint:n { #1 } \dim_set_eq:NN \l_tmpb_dim \pgf@y \@@_qpoint:n { col - \@@_succ:n { #4 } } - \dim_set_eq:NN \l_tmpc_dim \pgf@x + \dim_set_eq:NN \l_@@_tmpc_dim \pgf@x \@@_qpoint:n { \@@_succ:n { #3 } } - \dim_set_eq:NN \l_tmpd_dim \pgf@y + \dim_set_eq:NN \l_@@_tmpd_dim \pgf@y \@@_pgf_rect_node:nnnnn { \@@_env: - #5 } { \dim_use:N \l_tmpa_dim } { \dim_use:N \l_tmpb_dim } - { \dim_use:N \l_tmpc_dim } - { \dim_use:N \l_tmpd_dim } + { \dim_use:N \l_@@_tmpc_dim } + { \dim_use:N \l_@@_tmpd_dim } } } % \end{macrocode} @@ -12018,7 +12088,7 @@ version 2005/12/01 or later. % |\@@_draw_dotted_lines:| whether Tikz is loaded or not (in that case, only % \textsc{pgf} is loaded). % \begin{macrocode} -\AtBeginDocument +\hook_gput_code:nnn { begindocument } { . } { \cs_new_protected:Npx \@@_draw_dotted_lines: { @@ -12087,16 +12157,16 @@ version 2005/12/01 or later. \@@_qpoint:n { row - \int_min:nn { ##1 } { \c@iRow + 1 } } \dim_set_eq:NN \l_tmpb_dim \pgf@y \@@_qpoint:n { col - \int_min:nn { ##1 + 1 } { \c@jCol + 1 } } - \dim_set_eq:NN \l_tmpc_dim \pgf@x + \dim_set_eq:NN \l_@@_tmpc_dim \pgf@x \@@_qpoint:n { row - \int_min:nn { ##1 + 1 } { \c@iRow + 1 } } - \dim_set_eq:NN \l_tmpd_dim \pgf@y + \dim_set_eq:NN \l_@@_tmpd_dim \pgf@y \pgftransformshift { \pgfpoint \l_tmpa_dim \l_tmpb_dim } % \end{macrocode} % Now, |\l_tmpa_dim| and |\l_tmpb_dim| become the width and the height of the % node (of shape |@à_diag_node|) that we will construct. % \begin{macrocode} - \dim_set:Nn \l_tmpa_dim { ( \l_tmpc_dim - \l_tmpa_dim ) / 2 } - \dim_set:Nn \l_tmpb_dim { ( \l_tmpd_dim - \l_tmpb_dim ) / 2 } + \dim_set:Nn \l_tmpa_dim { ( \l_@@_tmpc_dim - \l_tmpa_dim ) / 2 } + \dim_set:Nn \l_tmpb_dim { ( \l_@@_tmpd_dim - \l_tmpb_dim ) / 2 } \pgfnode { @@_diag_node } { center } { } { \@@_env: - ##1 } { } \str_if_empty:NF \l_@@_name_str { \pgfnodealias { \l_@@_name_str - ##1 } { \@@_env: - ##1 } } @@ -13290,17 +13360,17 @@ version 2005/12/01 or later. % \pkg{nicematrix} rely upon |{NiceArray}|). % % -% \medskip +% \medskip % The syntax of these commands uses the character |_| as embellishment and % thats' why we have to insert a character |_| in the \emph{arg spec} of these % commands. However, we don't know the future catcode of |_| in the main % document (maybe the user will use \pkg{underscore}, and, in that case, the % catcode is $13$ because \pkg{underscore} activates |_|). That's why these -% commands will be defined in a |\AtBeginDocument| and the \emph{arg spec} will -% be rescanned. +% commands will be defined in a |\hook_gput_code:nnn { begindocument } { . }| +% and the \emph{arg spec} will be rescanned. % % \begin{macrocode} -\AtBeginDocument +\hook_gput_code:nnn { begindocument } { . } { \tl_set:Nn \l_@@_argspec_tl { O { } E { _ ^ } { { } { } } } \tl_set_rescan:Nno \l_@@_argspec_tl { } \l_@@_argspec_tl @@ -13418,7 +13488,7 @@ version 2005/12/01 or later. } } % \end{macrocode} -% End of the |\AtBeginDocument|. +% End of the |\AddToHook|. % % % \bigskip @@ -13487,7 +13557,7 @@ version 2005/12/01 or later. % |\NewDocumentCommand| is protected and that's why we have put the % |\multicolumn| before (in the definition of |\@@_Hdotsfor:|). % \begin{macrocode} -\AtBeginDocument +\hook_gput_code:nnn { begindocument } { . } { \tl_set:Nn \l_@@_argspec_tl { O { } m O { } E { _ ^ } { { } { } } } \tl_set_rescan:Nno \l_@@_argspec_tl { } \l_@@_argspec_tl @@ -13513,7 +13583,7 @@ version 2005/12/01 or later. } } % \end{macrocode} -% Enf of |\AtBeginDocument|. +% Enf of |\AddToHook|. % % \medskip % \begin{macrocode} @@ -13594,7 +13664,7 @@ version 2005/12/01 or later. % % \bigskip % \begin{macrocode} -\AtBeginDocument +\hook_gput_code:nnn { begindocument } { . } { \tl_set:Nn \l_@@_argspec_tl { O { } m O { } E { _ ^ } { { } { } } } \tl_set_rescan:Nno \l_@@_argspec_tl { } \l_@@_argspec_tl @@ -13614,7 +13684,7 @@ version 2005/12/01 or later. } } % \end{macrocode} -% Enf of |\AtBeginDocument|. +% Enf of |\AddToHook|. % % \begin{macrocode} \cs_new_protected:Npn \@@_Vdotsfor:nnnn #1 #2 #3 #4 @@ -13725,7 +13795,7 @@ version 2005/12/01 or later. % construction uses the fact the |\@@_line_i:nn| is protected and that % |\@@_double_int_eval:n| is fully expandable). % \begin{macrocode} -\AtBeginDocument +\hook_gput_code:nnn { begindocument } { . } { \tl_set:Nn \l_@@_argspec_tl { O { } m m ! O { } E { _ ^ } { { } { } } } \tl_set_rescan:Nno \l_@@_argspec_tl { } \l_@@_argspec_tl @@ -13764,7 +13834,7 @@ version 2005/12/01 or later. % \end{macrocode} % % \begin{macrocode} -\AtBeginDocument +\hook_gput_code:nnn { begindocument } { . } { \cs_new_protected:Npx \@@_draw_line_ii:nn #1 #2 { @@ -13831,7 +13901,7 @@ version 2005/12/01 or later. nb-rows .int_set:N = \l_@@_key_nb_rows_int , nb-rows .value_required:n = true , nb-rows .initial:n = 1 , - rowcolor .tl_set:N = \l_tmpc_tl , + rowcolor .tl_set:N = \l_@@_tmpc_tl , rowcolor .value_required:n = true , rowcolor .initial:n = , unknown .code:n = \@@_error:n { Unknown~key~for~RowStyle } @@ -13846,7 +13916,7 @@ version 2005/12/01 or later. % \end{macrocode} % If the key |rowcolor| has been used. % \begin{macrocode} - \tl_if_empty:NF \l_tmpc_tl + \tl_if_empty:NF \l_@@_tmpc_tl { % \end{macrocode} % First, the end of the current row (we remind that |\RowStyle| applies to the @@ -13855,7 +13925,7 @@ version 2005/12/01 or later. \tl_gput_right:Nx \g_nicematrix_code_before_tl { \@@_rectanglecolor - { \l_tmpc_tl } + { \l_@@_tmpc_tl } { \int_use:N \c@iRow - \int_use:N \c@jCol } { \int_use:N \c@iRow - * } } @@ -13867,7 +13937,7 @@ version 2005/12/01 or later. \tl_gput_right:Nx \g_nicematrix_code_before_tl { \@@_rowcolor - { \l_tmpc_tl } + { \l_@@_tmpc_tl } { \int_eval:n { \c@iRow + 1 } - \int_eval:n { \c@iRow + \l_@@_key_nb_rows_int - 1 } @@ -14092,13 +14162,13 @@ version 2005/12/01 or later. \cs_new_protected:Npn \@@_rectanglecolor:nnn #1 #2 #3 { \@@_cut_on_hyphen:w #1 \q_stop - \tl_clear_new:N \l_tmpc_tl - \tl_clear_new:N \l_tmpd_tl - \tl_set_eq:NN \l_tmpc_tl \l_tmpa_tl - \tl_set_eq:NN \l_tmpd_tl \l_tmpb_tl + \tl_clear_new:N \l_@@_tmpc_tl + \tl_clear_new:N \l_@@_tmpd_tl + \tl_set_eq:NN \l_@@_tmpc_tl \l_tmpa_tl + \tl_set_eq:NN \l_@@_tmpd_tl \l_tmpb_tl \@@_cut_on_hyphen:w #2 \q_stop - \tl_set:Nx \l_@@_rows_tl { \l_tmpc_tl - \l_tmpa_tl } - \tl_set:Nx \l_@@_cols_tl { \l_tmpd_tl - \l_tmpb_tl } + \tl_set:Nx \l_@@_rows_tl { \l_@@_tmpc_tl - \l_tmpa_tl } + \tl_set:Nx \l_@@_cols_tl { \l_@@_tmpd_tl - \l_tmpb_tl } % \end{macrocode} % The command |\@@_cartesian_path:n| takes in two implicit arguments: % |\l_@@_cols_tl| and |\l_@@_rows_tl|. @@ -14221,9 +14291,9 @@ version 2005/12/01 or later. \bool_if:NTF \l_@@_rowcolors_restart_bool { \int_set:Nn \l_@@_color_int 1 } { \int_set:Nn \l_@@_color_int \l_tmpa_tl } - \int_zero_new:N \l_tmpc_int - \int_set:Nn \l_tmpc_int \l_tmpb_tl - \int_do_until:nNnn \l_tmpa_int > \l_tmpc_int + \int_zero_new:N \l_@@_tmpc_int + \int_set:Nn \l_@@_tmpc_int \l_tmpb_tl + \int_do_until:nNnn \l_tmpa_int > \l_@@_tmpc_int { % \end{macrocode} % We will compute in |\l_tmpb_int| the last row of the ``block''. @@ -14245,7 +14315,7 @@ version 2005/12/01 or later. \tl_set:Nx \l_@@_rows_tl { \int_use:N \l_tmpa_int - \int_use:N \l_tmpb_int } % \end{macrocode} -% |\l_tmpc_tl| will be the color that we will use. +% |\l_@@_tmpc_tl| will be the color that we will use. % \begin{macrocode} \tl_clear_new:N \l_@@_color_tl \tl_set:Nx \l_@@_color_tl @@ -14373,9 +14443,9 @@ version 2005/12/01 or later. \int_compare:nNnT \l_tmpb_tl > \c@jCol { \tl_set:Nx \l_tmpb_tl { \int_use:N \c@jCol } } % \end{macrocode} -% |\l_tmpc_tl| will contain the number of column. +% |\l_@@_tmpc_tl| will contain the number of column. % \begin{macrocode} - \tl_set_eq:NN \l_tmpc_tl \l_tmpa_tl + \tl_set_eq:NN \l_@@_tmpc_tl \l_tmpa_tl % \end{macrocode} % If we decide to provide the commands |\cellcolor|, |\rectanglecolor|, % |\rowcolor|, |\columncolor|, |\rowcolors| and |\chessboardcolors| in the @@ -14384,8 +14454,8 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_qpoint:n { col - \l_tmpa_tl } \int_compare:nNnTF \l_@@_first_col_int = \l_tmpa_tl - { \dim_set:Nn \l_tmpc_dim { \pgf@x - 0.5 \arrayrulewidth } } - { \dim_set:Nn \l_tmpc_dim { \pgf@x + 0.5 \arrayrulewidth } } + { \dim_set:Nn \l_@@_tmpc_dim { \pgf@x - 0.5 \arrayrulewidth } } + { \dim_set:Nn \l_@@_tmpc_dim { \pgf@x + 0.5 \arrayrulewidth } } \@@_qpoint:n { col - \@@_succ:n \l_tmpb_tl } \dim_set:Nn \l_tmpa_dim { \pgf@x + 0.5 \arrayrulewidth } % \end{macrocode} @@ -14406,15 +14476,15 @@ version 2005/12/01 or later. % Now, the numbers of both rows are in |\l_tmpa_tl| and |\l_tmpb_tl|. % \begin{macrocode} \seq_if_in:NxF \l_@@_corners_cells_seq - { \l_tmpa_tl - \l_tmpc_tl } + { \l_tmpa_tl - \l_@@_tmpc_tl } { \@@_qpoint:n { row - \@@_succ:n \l_tmpb_tl } \dim_set:Nn \l_tmpb_dim { \pgf@y + 0.5 \arrayrulewidth } \@@_qpoint:n { row - \l_tmpa_tl } - \dim_set:Nn \l_tmpd_dim { \pgf@y + 0.5 \arrayrulewidth } + \dim_set:Nn \l_@@_tmpd_dim { \pgf@y + 0.5 \arrayrulewidth } \pgfsetcornersarced { \pgfpoint { #1 } { #1 } } \pgfpathrectanglecorners - { \pgfpoint \l_tmpc_dim \l_tmpd_dim } + { \pgfpoint \l_@@_tmpc_dim \l_@@_tmpd_dim } { \pgfpoint \l_tmpa_dim \l_tmpb_dim } } } @@ -14647,7 +14717,9 @@ version 2005/12/01 or later. % \begin{macrocode} tikz .tl_set:N = \l_@@_tikz_rule_tl , tikz .value_required:n = true , - tikz .initial:n = + tikz .initial:n = , + width .dim_set:N = \l_@@_rule_width_dim , + width .value_required:n = true } % \end{macrocode} % @@ -14685,7 +14757,7 @@ version 2005/12/01 or later. % \end{macrocode} % |\l_tmpa_tl| is the number of row and |\l_tmpb_tl| the number of column. When % we have found a row corresponding to a rule to draw, we note its number in -% |\l_tmpc_tl|. +% |\l_@@_tmpc_tl|. % \begin{macrocode} \tl_set:Nx \l_tmpb_tl { \int_eval:n \l_@@_position_int } \int_step_variable:nnNn \l_@@_start_int \l_@@_end_int @@ -14791,7 +14863,7 @@ version 2005/12/01 or later. \@@_qpoint:n { col - \int_use:N \l_@@_position_int } \dim_set_eq:NN \l_tmpb_dim \pgf@x \@@_qpoint:n { row - \int_eval:n { \l_@@_local_end_int + 1 } } - \dim_set_eq:NN \l_tmpc_dim \pgf@y + \dim_set_eq:NN \l_@@_tmpc_dim \pgf@y \bool_lazy_all:nT { { \int_compare_p:nNn \l_@@_multiplicity_int > 1 } @@ -14802,26 +14874,26 @@ version 2005/12/01 or later. \group_begin: \CT@drsc@ \dim_add:Nn \l_tmpa_dim { 0.5 \arrayrulewidth } - \dim_sub:Nn \l_tmpc_dim { 0.5 \arrayrulewidth } - \dim_set:Nn \l_tmpd_dim + \dim_sub:Nn \l_@@_tmpc_dim { 0.5 \arrayrulewidth } + \dim_set:Nn \l_@@_tmpd_dim { \l_tmpb_dim - ( \doublerulesep + \arrayrulewidth ) * ( \l_@@_multiplicity_int - 1 ) } \pgfpathrectanglecorners { \pgfpoint \l_tmpb_dim \l_tmpa_dim } - { \pgfpoint \l_tmpd_dim \l_tmpc_dim } + { \pgfpoint \l_@@_tmpd_dim \l_@@_tmpc_dim } \pgfusepath { fill } \group_end: } \pgfpathmoveto { \pgfpoint \l_tmpb_dim \l_tmpa_dim } - \pgfpathlineto { \pgfpoint \l_tmpb_dim \l_tmpc_dim } + \pgfpathlineto { \pgfpoint \l_tmpb_dim \l_@@_tmpc_dim } \prg_replicate:nn { \l_@@_multiplicity_int - 1 } { \dim_sub:Nn \l_tmpb_dim \arrayrulewidth \dim_sub:Nn \l_tmpb_dim \doublerulesep \pgfpathmoveto { \pgfpoint \l_tmpb_dim \l_tmpa_dim } - \pgfpathlineto { \pgfpoint \l_tmpb_dim \l_tmpc_dim } + \pgfpathlineto { \pgfpoint \l_tmpb_dim \l_@@_tmpc_dim } } \CT@arc@ \pgfsetlinewidth { 1.1 \arrayrulewidth } @@ -14866,13 +14938,13 @@ version 2005/12/01 or later. \@@_qpoint:n { row - \int_use:N \l_@@_local_start_int } \dim_set_eq:NN \l_tmpa_dim \pgf@y \@@_qpoint:n { col - \int_use:N \l_@@_position_int } - \dim_set_eq:NN \l_tmpb_dim \pgf@x + \dim_set:Nn \l_tmpb_dim { \pgf@x - 0.5 \l_@@_rule_width_dim } \@@_qpoint:n { row - \int_eval:n { \l_@@_local_end_int + 1 } } - \dim_set_eq:NN \l_tmpc_dim \pgf@y + \dim_set_eq:NN \l_@@_tmpc_dim \pgf@y \exp_args:NV \tikzset \l_@@_tikz_rule_tl \use:x { \exp_not:N \draw [ \l_@@_tikz_rule_tl ] } ( \l_tmpb_dim , \l_tmpa_dim ) -- - ( \l_tmpb_dim , \l_tmpc_dim ) ; + ( \l_tmpb_dim , \l_@@_tmpc_dim ) ; \end { tikzpicture } } % \end{macrocode} @@ -14934,7 +15006,7 @@ version 2005/12/01 or later. % \end{macrocode} % |\l_tmpa_tl| is the number of row and |\l_tmpb_tl| the number of column. When % we have found a column corresponding to a rule to draw, we note its number in -% |\l_tmpc_tl|. +% |\l_@@_tmpc_tl|. % \begin{macrocode} \tl_set:Nx \l_tmpa_tl { \int_use:N \l_@@_position_int } \int_step_variable:nnNn \l_@@_start_int \l_@@_end_int @@ -15039,7 +15111,7 @@ version 2005/12/01 or later. \@@_qpoint:n { row - \int_use:N \l_@@_position_int } \dim_set_eq:NN \l_tmpb_dim \pgf@y \@@_qpoint:n { col - \int_eval:n { \l_@@_local_end_int + 1 } } - \dim_set_eq:NN \l_tmpc_dim \pgf@x + \dim_set_eq:NN \l_@@_tmpc_dim \pgf@x \bool_lazy_all:nT { { \int_compare_p:nNn \l_@@_multiplicity_int > 1 } @@ -15049,25 +15121,25 @@ version 2005/12/01 or later. { \group_begin: \CT@drsc@ - \dim_set:Nn \l_tmpd_dim + \dim_set:Nn \l_@@_tmpd_dim { \l_tmpb_dim - ( \doublerulesep + \arrayrulewidth ) * ( \l_@@_multiplicity_int - 1 ) } \pgfpathrectanglecorners { \pgfpoint \l_tmpa_dim \l_tmpb_dim } - { \pgfpoint \l_tmpc_dim \l_tmpd_dim } + { \pgfpoint \l_@@_tmpc_dim \l_@@_tmpd_dim } \pgfusepathqfill \group_end: } \pgfpathmoveto { \pgfpoint \l_tmpa_dim \l_tmpb_dim } - \pgfpathlineto { \pgfpoint \l_tmpc_dim \l_tmpb_dim } + \pgfpathlineto { \pgfpoint \l_@@_tmpc_dim \l_tmpb_dim } \prg_replicate:nn { \l_@@_multiplicity_int - 1 } { \dim_sub:Nn \l_tmpb_dim \arrayrulewidth \dim_sub:Nn \l_tmpb_dim \doublerulesep \pgfpathmoveto { \pgfpoint \l_tmpa_dim \l_tmpb_dim } - \pgfpathlineto { \pgfpoint \l_tmpc_dim \l_tmpb_dim } + \pgfpathlineto { \pgfpoint \l_@@_tmpc_dim \l_tmpb_dim } } \CT@arc@ \pgfsetlinewidth { 1.1 \arrayrulewidth } @@ -15175,13 +15247,13 @@ version 2005/12/01 or later. \@@_qpoint:n { col - \int_use:N \l_@@_local_start_int } \dim_set_eq:NN \l_tmpa_dim \pgf@x \@@_qpoint:n { row - \int_use:N \l_@@_position_int } - \dim_set_eq:NN \l_tmpb_dim \pgf@y + \dim_set:Nn \l_tmpb_dim { \pgf@y - 0.5 \l_@@_rule_width_dim } \@@_qpoint:n { col - \int_eval:n { \l_@@_local_end_int + 1 } } - \dim_set_eq:NN \l_tmpc_dim \pgf@x + \dim_set_eq:NN \l_@@_tmpc_dim \pgf@x \exp_args:NV \tikzset \l_@@_tikz_rule_tl \use:x { \exp_not:N \draw [ \l_@@_tikz_rule_tl ] } ( \l_tmpa_dim , \l_tmpb_dim ) -- - ( \l_tmpc_dim , \l_tmpb_dim ) ; + ( \l_@@_tmpc_dim , \l_tmpb_dim ) ; \end { tikzpicture } } % \end{macrocode} @@ -15279,15 +15351,46 @@ version 2005/12/01 or later. % % \medskip % The following command will create the customized rule (it is executed when the -% final user uses the key |custom-line| in |\NiceMatrixOption|). +% final user uses the key |custom-line| in |\NiceMatrixOptions|). % \begin{macrocode} \cs_new_protected:Npn \@@_custom_line:n #1 { + \str_clear_new:N \l_@@_command_str + \str_clear_new:N \l_@@_letter_str + \dim_zero_new:N \l_@@_rule_width_dim +% \end{macrocode} +% The token list |\l_tmpa_tl| is for the key |color|. +% \begin{macrocode} + \tl_clear:N \l_tmpa_tl +% \end{macrocode} +% The flag |\l_tmpa_bool| will indicate whether the key |tikz| is present. +% \begin{macrocode} + \bool_set_false:N \l_tmpa_bool +% \end{macrocode} +% The flag |\l_tmpb_bool| will indicate whether the key |width| is present. +% \begin{macrocode} + \bool_set_false:N \l_tmpb_bool \keys_set_known:nn { NiceMatrix / Custom-Line } { #1 } + \bool_if:NT \l_tmpa_bool + { +% \end{macrocode} +% We can't use |\c_@@_tikz_loaded_bool| to test whether \pkg{tikz} is loaded +% because |\NiceMatrixOptions| may be used in the preamble of the document. +% \begin{macrocode} + \cs_if_exist:NF \tikzpicture + { \@@_error:n { tikz~in~custom-line~without~tikz } } + \tl_if_empty:NF \l_tmpa_tl + { \@@_error:n { color~in~custom-line~with~tikz } } + } + \bool_if:NT \l_tmpb_bool + { + \bool_if:NF \l_tmpa_bool + { \@@_error:n { key~width~without~key~tikz } } + } % \end{macrocode} % If the final user only wants to draw horizontal rules, he does not need to % specify a letter (for the vertical rules in the preamble of the array). On the -% other hand, if he only wants to draw vertical rules, the does not need to +% other hand, if he only wants to draw vertical rules, he does not need to % define a command (which is the tool to draw horizontal rules in the array). Of % course, a definition of custom lines with no letter and no command would be point-less. % @@ -15315,7 +15418,24 @@ version 2005/12/01 or later. { \@@_error:n { Several~letters } } } \str_if_empty:NF \l_@@_command_str - { \exp_args:NnV \@@_define_h_custom_line:nn { #1 } \l_tmpc_int } + { +% \end{macrocode} +% The flag |\l_tmpa_bool| means that the key 'tikz' have been used. When the key +% 'tikz' has not been used, the width of the rule is computed with the +% multiplicity of the rule. +% \begin{macrocode} + \bool_if:NF \l_tmpa_bool + { + \dim_set:Nn \l_@@_rule_width_dim + { + \arrayrulewidth * \l_@@_tmpc_int + + \doublerulesep * ( \l_@@_tmpc_int - 1 ) + } + } + \exp_args:NnV \@@_define_h_custom_line:nn + { #1 } + \l_@@_rule_width_dim + } } } % \end{macrocode} @@ -15329,47 +15449,52 @@ version 2005/12/01 or later. % However, the whole definition of the customized lines (as provided by the % final user as argument of |custom-line|) will also be used further with % other sets of keys (for instance |{NiceMatrix/Rules}|). That's why the -% following set of keys has only entries for three keys. +% following set of keys has only entries for a few keys. % \begin{macrocode} \keys_define:nn { NiceMatrix / Custom-Line } { letter .str_set:N = \l_@@_letter_str , letter .value_required:n = true , - letter .initial:n = , command .str_set:N = \l_@@_command_str , command .value_required:n = true , - command .initial:n = , + multiplicity .int_set:N = \l_@@_tmpc_int , + multiplicity .initial:n = 1 , + multiplicity .value_required:n = true , + color .tl_set:N = \l_tmpa_tl , + color. value_required:n = true , % \end{macrocode} -% We need to know the multiplicity of the rule right now in order to compute the -% total width of the rule (and reserve space both in vertical and horizontal rules). +% When the key |tikz| is used, the rule will be drawn with Tikz by using the set +% of keys specified in the value of that key |tikz|. % \begin{macrocode} - multiplicity .int_set:N = \l_tmpc_int , - multiplicity .initial:n = 1 , - multiplicity .value_required:n = true , + tikz .code:n = \bool_set_true:N \l_tmpa_bool , +% \end{macrocode} +% The key |width| must be used only when the key |tikz| is used. When used, the +% key |width| specifies the width of the rule: it will be used to reserve space +% (in the preamble of the array or in the command for the horizontal rules). +% \begin{macrocode} + width .code:n = \dim_set:Nn \l_@@_rule_width_dim { #1 } + \bool_set_true:N \l_tmpb_bool , + width .value_required:n = true , } % \end{macrocode} % % \bigskip % The following command will create the command that the final user will use in % its array to draw a horizontal rule (hence the `|h|` in the name). |#1| is the -% whole set of keys to pass to |\@@_line:n| and |#2| is the multiplicity of -% the line (number of consecutive rules). +% whole set of keys to pass to |\@@_line:n| and |#2| is the widht of the whole +% rule. % \begin{macrocode} \cs_new_protected:Npn \@@_define_h_custom_line:nn #1 #2 { % \end{macrocode} -% We use |\cs_set:cpn| and not |\cs_new:cpn| because we want a local définition. +% We use |\cs_set:cpn| and not |\cs_new:cpn| because we want a local definition. % Moreover, the command must \emph{not} be protected since it begins with |\noalign|. % \begin{macrocode} \cs_set:cpn \l_@@_command_str { \noalign { - \skip_vertical:n - { - \dim_eval:n - { \arrayrulewidth * #2 + \doublerulesep * ( #2 - 1) } - } + \skip_vertical:n { #2 } \tl_gput_right:Nx \g_@@_internal_code_after_tl { \@@_hline:n { #1 , position = \int_eval:n { \c@iRow + 1 } } } } @@ -15377,24 +15502,26 @@ version 2005/12/01 or later. } % \end{macrocode} % +% The flag |\l_tmpa_bool| means that the key 'tikz' have been used. When the key +% 'tikz' has not been used, the width of the rule is computed with the +% multiplicity of the rule. % \begin{macrocode} \cs_new_protected:Npn \@@_custom_line_i:n #1 { + \bool_if:NF \l_tmpa_bool + { + \dim_set:Nn \l_@@_rule_width_dim + { + \arrayrulewidth * \l_@@_tmpc_int + + \doublerulesep * ( \l_@@_tmpc_int - 1) + } + } \tl_gput_right:Nx \g_@@_preamble_tl { \exp_not:N ! - { - \skip_horizontal:n - { - \dim_eval:n - { - \arrayrulewidth * \l_tmpc_int - + \doublerulesep * ( \l_tmpc_int - 1) - } - } - } + { \skip_horizontal:n { \dim_use:N \l_@@_rule_width_dim } } } - \tl_gput_right:Nx \g_@@_internal_code_after_tl + \tl_gput_right:Nx \g_@@_internal_code_after_tl { \@@_vline:n { #1 , position = \@@_succ:n \c@jCol } } } % \end{macrocode} @@ -16833,9 +16960,9 @@ version 2005/12/01 or later. \@@_qpoint:n { col - #2 } \dim_set_eq:NN \l_tmpb_dim \pgf@x \@@_qpoint:n { row - \@@_succ:n { \l_@@_last_row_int } } - \dim_set_eq:NN \l_tmpc_dim \pgf@y + \dim_set_eq:NN \l_@@_tmpc_dim \pgf@y \@@_qpoint:n { col - \@@_succ:n { \l_@@_last_col_int } } - \dim_set_eq:NN \l_tmpd_dim \pgf@x + \dim_set_eq:NN \l_@@_tmpd_dim \pgf@x % \end{macrocode} % % We construct the node for the block with the name |(#1-#2-block)|. @@ -16845,7 +16972,7 @@ version 2005/12/01 or later. % \begin{macrocode} \@@_pgf_rect_node:nnnnn { \@@_env: - #1 - #2 - block } - \l_tmpb_dim \l_tmpa_dim \l_tmpd_dim \l_tmpc_dim + \l_tmpb_dim \l_tmpa_dim \l_@@_tmpd_dim \l_@@_tmpc_dim \str_if_empty:NF \l_@@_block_name_str { \pgfnodealias @@ -16902,7 +17029,7 @@ version 2005/12/01 or later. \@@_qpoint:n { col - #2 } \dim_set_eq:NN \l_tmpb_dim \pgf@x } - \dim_set:Nn \l_tmpd_dim { - \c_max_dim } + \dim_set:Nn \l_@@_tmpd_dim { - \c_max_dim } \int_step_inline:nnn \l_@@_first_row_int \g_@@_row_total_int { \cs_if_exist:cT @@ -16913,18 +17040,18 @@ version 2005/12/01 or later. \pgfpointanchor { \@@_env: - ##1 - \int_use:N \l_@@_last_col_int } { east } - \dim_set:Nn \l_tmpd_dim { \dim_max:nn \l_tmpd_dim \pgf@x } + \dim_set:Nn \l_@@_tmpd_dim { \dim_max:nn \l_@@_tmpd_dim \pgf@x } } } } - \dim_compare:nNnT \l_tmpd_dim = { - \c_max_dim } + \dim_compare:nNnT \l_@@_tmpd_dim = { - \c_max_dim } { \@@_qpoint:n { col - \@@_succ:n { \l_@@_last_col_int } } - \dim_set_eq:NN \l_tmpd_dim \pgf@x + \dim_set_eq:NN \l_@@_tmpd_dim \pgf@x } \@@_pgf_rect_node:nnnnn { \@@_env: - #1 - #2 - block - short } - \l_tmpb_dim \l_tmpa_dim \l_tmpd_dim \l_tmpc_dim + \l_tmpb_dim \l_tmpa_dim \l_@@_tmpd_dim \l_@@_tmpc_dim } % \end{macrocode} % @@ -17106,7 +17233,7 @@ version 2005/12/01 or later. \@@_qpoint:n { row - \l_tmpa_tl } \dim_set:Nn \l_tmpb_dim { \pgf@y } \@@_qpoint:n { col - \l_tmpb_tl } - \dim_set:Nn \l_tmpc_dim { \pgf@x } + \dim_set:Nn \l_@@_tmpc_dim { \pgf@x } \@@_cut_on_hyphen:w #3 \q_stop \int_compare:nNnT \l_tmpa_tl > \c@iRow { \tl_set:Nx \l_tmpa_tl { \int_use:N \c@iRow } } @@ -17115,10 +17242,10 @@ version 2005/12/01 or later. \@@_qpoint:n { row - \@@_succ:n \l_tmpa_tl } \dim_set:Nn \l_tmpa_dim { \pgf@y } \@@_qpoint:n { col - \@@_succ:n \l_tmpb_tl } - \dim_set:Nn \l_tmpd_dim { \pgf@x } + \dim_set:Nn \l_@@_tmpd_dim { \pgf@x } \pgfpathrectanglecorners - { \pgfpoint \l_tmpc_dim \l_tmpb_dim } - { \pgfpoint \l_tmpd_dim \l_tmpa_dim } + { \pgfpoint \l_@@_tmpc_dim \l_tmpb_dim } + { \pgfpoint \l_@@_tmpd_dim \l_tmpa_dim } \pgfsetlinewidth { 1.1 \l_@@_line_width_dim } % \end{macrocode} % We can't use |\pgfusepathqstroke| because of the key |rounded-corners|. @@ -17155,19 +17282,19 @@ version 2005/12/01 or later. \dim_set_eq:NN \l_@@_line_width_dim \arrayrulewidth \keys_set_known:nn { NiceMatrix / BlockBorders } { #1 } \@@_cut_on_hyphen:w #2 \q_stop - \tl_set_eq:NN \l_tmpc_tl \l_tmpa_tl - \tl_set_eq:NN \l_tmpd_tl \l_tmpb_tl + \tl_set_eq:NN \l_@@_tmpc_tl \l_tmpa_tl + \tl_set_eq:NN \l_@@_tmpd_tl \l_tmpb_tl \@@_cut_on_hyphen:w #3 \q_stop \tl_set:Nx \l_tmpa_tl { \int_eval:n { \l_tmpa_tl + 1 } } \tl_set:Nx \l_tmpb_tl { \int_eval:n { \l_tmpb_tl + 1 } } - \int_step_inline:nnn \l_tmpd_tl \l_tmpb_tl + \int_step_inline:nnn \l_@@_tmpd_tl \l_tmpb_tl { \use:x { \@@_vline:n { position = ##1 , - start = \l_tmpc_tl , + start = \l_@@_tmpc_tl , end = \@@_pred:n \l_tmpa_tl } } @@ -17178,19 +17305,19 @@ version 2005/12/01 or later. \dim_set_eq:NN \l_@@_line_width_dim \arrayrulewidth \keys_set_known:nn { NiceMatrix / BlockBorders } { #1 } \@@_cut_on_hyphen:w #2 \q_stop - \tl_set_eq:NN \l_tmpc_tl \l_tmpa_tl - \tl_set_eq:NN \l_tmpd_tl \l_tmpb_tl + \tl_set_eq:NN \l_@@_tmpc_tl \l_tmpa_tl + \tl_set_eq:NN \l_@@_tmpd_tl \l_tmpb_tl \@@_cut_on_hyphen:w #3 \q_stop \tl_set:Nx \l_tmpa_tl { \int_eval:n { \l_tmpa_tl + 1 } } \tl_set:Nx \l_tmpb_tl { \int_eval:n { \l_tmpb_tl + 1 } } - \int_step_inline:nnn \l_tmpc_tl \l_tmpa_tl + \int_step_inline:nnn \l_@@_tmpc_tl \l_tmpa_tl { \use:x { \@@_hline:n { position = ##1 , - start = \l_tmpd_tl , + start = \l_@@_tmpd_tl , end = \int_eval:n { \l_tmpb_tl - 1 } } } @@ -17217,8 +17344,8 @@ version 2005/12/01 or later. { \@@_error:nn { bad~border } { ##1 } } } \@@_cut_on_hyphen:w #2 \q_stop - \tl_set_eq:NN \l_tmpc_tl \l_tmpa_tl - \tl_set_eq:NN \l_tmpd_tl \l_tmpb_tl + \tl_set_eq:NN \l_@@_tmpc_tl \l_tmpa_tl + \tl_set_eq:NN \l_@@_tmpd_tl \l_tmpb_tl \@@_cut_on_hyphen:w #3 \q_stop \tl_set:Nx \l_tmpa_tl { \int_eval:n { \l_tmpa_tl + 1 } } \tl_set:Nx \l_tmpb_tl { \int_eval:n { \l_tmpb_tl + 1 } } @@ -17230,11 +17357,11 @@ version 2005/12/01 or later. \clist_if_in:NnT \l_@@_borders_clist { right } { \@@_stroke_vertical:n \l_tmpb_tl } \clist_if_in:NnT \l_@@_borders_clist { left } - { \@@_stroke_vertical:n \l_tmpd_tl } + { \@@_stroke_vertical:n \l_@@_tmpd_tl } \clist_if_in:NnT \l_@@_borders_clist { bottom } { \@@_stroke_horizontal:n \l_tmpa_tl } \clist_if_in:NnT \l_@@_borders_clist { top } - { \@@_stroke_horizontal:n \l_tmpc_tl } + { \@@_stroke_horizontal:n \l_@@_tmpc_tl } \endpgfpicture } } @@ -17246,13 +17373,13 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_stroke_vertical:n #1 { - \@@_qpoint:n \l_tmpc_tl + \@@_qpoint:n \l_@@_tmpc_tl \dim_set:Nn \l_tmpb_dim { \pgf@y + 0.5 \l_@@_line_width_dim } \@@_qpoint:n \l_tmpa_tl - \dim_set:Nn \l_tmpc_dim { \pgf@y + 0.5 \l_@@_line_width_dim } + \dim_set:Nn \l_@@_tmpc_dim { \pgf@y + 0.5 \l_@@_line_width_dim } \@@_qpoint:n { #1 } \pgfpathmoveto { \pgfpoint \pgf@x \l_tmpb_dim } - \pgfpathlineto { \pgfpoint \pgf@x \l_tmpc_dim } + \pgfpathlineto { \pgfpoint \pgf@x \l_@@_tmpc_dim } \pgfusepathqstroke } % \end{macrocode} @@ -17263,7 +17390,7 @@ version 2005/12/01 or later. % \begin{macrocode} \cs_new_protected:Npn \@@_stroke_horizontal:n #1 { - \@@_qpoint:n \l_tmpd_tl + \@@_qpoint:n \l_@@_tmpd_tl \clist_if_in:NnTF \l_@@_borders_clist { left } { \dim_set:Nn \l_tmpa_dim { \pgf@x - 0.5 \l_@@_line_width_dim } } { \dim_set:Nn \l_tmpa_dim { \pgf@x + 0.5 \l_@@_line_width_dim } } @@ -17521,10 +17648,10 @@ version 2005/12/01 or later. \dim_set_eq:NN \l_tmpb_dim \pgf@x \pgfpathmoveto { \pgfpoint \l_tmpb_dim \l_tmpa_dim } \@@_qpoint:n { row - \@@_succ:n { #3 } } - \dim_set_eq:NN \l_tmpc_dim \pgf@y + \dim_set_eq:NN \l_@@_tmpc_dim \pgf@y \@@_qpoint:n { col - \@@_succ:n { #4 } } - \dim_set_eq:NN \l_tmpd_dim \pgf@x - \pgfpathlineto { \pgfpoint \l_tmpd_dim \l_tmpc_dim } + \dim_set_eq:NN \l_@@_tmpd_dim \pgf@x + \pgfpathlineto { \pgfpoint \l_@@_tmpd_dim \l_@@_tmpc_dim } { % \end{macrocode} % The command |\CT@arc@| is a command of \pkg{colortbl} which sets the color of @@ -17537,7 +17664,7 @@ version 2005/12/01 or later. } \pgfset { inner~sep = 1 pt } \pgfscope - \pgftransformshift { \pgfpoint \l_tmpb_dim \l_tmpc_dim } + \pgftransformshift { \pgfpoint \l_tmpb_dim \l_@@_tmpc_dim } \pgfnode { rectangle } { south~west } { \begin { minipage } { 20 cm } @@ -17547,7 +17674,7 @@ version 2005/12/01 or later. { } { } \endpgfscope - \pgftransformshift { \pgfpoint \l_tmpd_dim \l_tmpa_dim } + \pgftransformshift { \pgfpoint \l_@@_tmpd_dim \l_tmpa_dim } \pgfnode { rectangle } { north~east } { \begin { minipage } { 20 cm } @@ -17826,13 +17953,13 @@ version 2005/12/01 or later. \peek_remove_spaces:n { \@@_cut_on_hyphen:w #3 \q_stop - \tl_clear_new:N \l_tmpc_tl - \tl_clear_new:N \l_tmpd_tl - \tl_set_eq:NN \l_tmpc_tl \l_tmpa_tl - \tl_set_eq:NN \l_tmpd_tl \l_tmpb_tl + \tl_clear_new:N \l_@@_tmpc_tl + \tl_clear_new:N \l_@@_tmpd_tl + \tl_set_eq:NN \l_@@_tmpc_tl \l_tmpa_tl + \tl_set_eq:NN \l_@@_tmpd_tl \l_tmpb_tl \@@_cut_on_hyphen:w #2 \q_stop \seq_gput_right:Nx \g_@@_submatrix_seq - { { \l_tmpa_tl } { \l_tmpb_tl } { \l_tmpc_tl } { \l_tmpd_tl } } + { { \l_tmpa_tl } { \l_tmpb_tl } { \l_@@_tmpc_tl } { \l_@@_tmpd_tl } } \tl_gput_right:Nn \g_@@_internal_code_after_tl { \SubMatrix { #1 } { #2 } { #3 } { #4 } [ #5 ] } } @@ -17854,7 +17981,7 @@ version 2005/12/01 or later. % For explanations about the construction with rescanning of the preamble, see % the documentation for the user command |\Cdots|. % \begin{macrocode} -\AtBeginDocument +\hook_gput_code:nnn { begindocument } { . } { \tl_set:Nn \l_@@_argspec_tl { m m m m O { } E { _ ^ } { { } { } } } \tl_set_rescan:Nno \l_@@_argspec_tl { } \l_@@_argspec_tl @@ -18564,16 +18691,6 @@ version 2005/12/01 or later. } % \end{macrocode} % -% \medskip -% Maybe we will completely delete the key 'transparent' in a future version. -% \begin{macrocode} -\@@_msg_new:nn { Key~transparent } - { - The~key~'transparent'~is~now~obsolete~(because~it's~name~ - is~not~clear).~You~must~use~the~conjonction~of~'renew-dots'~ - and~'renew-matrix'.~This~error~is~fatal. - } -% \end{macrocode} % % \begin{macrocode} \keys_define:nn { NiceMatrix / Package } @@ -18949,6 +19066,14 @@ version 2005/12/01 or later. If~you~go~on,~it~will~be~ignored. } % \end{macrocode} +% +% \begin{macrocode} +\@@_msg_new:nn { key~width~without~key~tikz } + { + In~'custom-line',~you~have~used~'width'~without~'tikz'.~That's~not~correct.~ + If~you~go~on,~that~key~'width'~will~be~discarded. + } +% \end{macrocode} % % \begin{macrocode} \@@_msg_new:nn { Several~letters } @@ -19142,6 +19267,25 @@ version 2005/12/01 or later. % \end{macrocode} % % \begin{macrocode} +\@@_msg_new:nn { tikz~in~custom-line~without~tikz } + { + You~have~used~the~key~'tikz'~in~the~definition~of~a~ + customized~line~(with~'custom-line')~but~Tikz~is~not~loaded.~ + You~can~go~on~but~you~will~have~another~error~if~you~actually~ + use~that~custom~line. + } +% \end{macrocode} +% +% \begin{macrocode} +\@@_msg_new:nn { color~in~custom-line~with~tikz } + { + In~a~'custom-line',~you~have~used~both~'tikz'~and~'color',~ + which~is~forbidden~(you~should~use~'color'~inside~the~key~'tikz').~ + If~you~go~on,~the~key~'color'~will~be~discarded. + } +% \end{macrocode} +% +% \begin{macrocode} \@@_msg_new:nn { Wrong~last~row } { You~have~used~'last-row=\int_use:N \l_@@_last_row_int'~but~your~ @@ -20107,6 +20251,10 @@ version 2005/12/01 or later. % % Key |respect-arraystretch|. % +% +% \subsection*{Changes between version 6.5 and 6.6} +% +% Keys |tikz| and |width| in |custom-line|. % \PrintIndex % % \tableofcontents diff --git a/macros/latex/contrib/nicematrix/nicematrix.pdf b/macros/latex/contrib/nicematrix/nicematrix.pdf index 703b8f8c3b..d96ed3fa4a 100644 Binary files a/macros/latex/contrib/nicematrix/nicematrix.pdf and b/macros/latex/contrib/nicematrix/nicematrix.pdf differ diff --git a/macros/latex/contrib/profcollege/doc/ProfCollege-doc.pdf b/macros/latex/contrib/profcollege/doc/ProfCollege-doc.pdf index 1acedf0c61..699123316d 100644 Binary files a/macros/latex/contrib/profcollege/doc/ProfCollege-doc.pdf and b/macros/latex/contrib/profcollege/doc/ProfCollege-doc.pdf differ diff --git a/macros/latex/contrib/profcollege/latex/ProfCollege.sty b/macros/latex/contrib/profcollege/latex/ProfCollege.sty index ba5e7d5675..411551409e 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}[2022/01/01 v0.99-j Aide pour l'utilisation de LaTeX au collège] +\ProvidesPackage{ProfCollege}[2022/02/16 v0.99-k Aide pour l'utilisation de LaTeX au collège] \RequirePackage{verbatim} @@ -178,7 +178,7 @@ \Dotfill% \else% \hbox to#1{\Dotfill}% - \fi + \fi% }% \newcommand\Lignespointilles[1]{% @@ -516,6 +516,456 @@ }%\raisebox } +%%% +% Modele en barre +%%% +\setKVdefault[ClesModeleBarre]{Hauteur=0.5cm,Largeur=1cm,Separation=0,Homogene=false}%Separation pour conserver le lien avec les équations. +\defKV[ClesModeleBarre]{Longueur=\setKV[ClesModeleBarre]{Homogene}} + +\newtoks\toklistemodelbarresup% +\toklistemodelbarresup{}% +\def\UpdateListeModelBarreSup#1\nil{\addtotok\toklistemodelbarresup{#1,}}% +\newtoks\toklistemodelbarreinf% +\toklistemodelbarreinf{}% +\def\UpdateListeModelBarreInf#1\nil{\addtotok\toklistemodelbarreinf{#1,}}% + +\newcommand\ModeleBarre[3][]{% + % #1 options + % #2 éléments de la barre supérieure C1 2 $x$ 1 3/C2 1 1x/ + % #3 éléments de la barre inférieure (même lecture) + \useKVdefault[ClesModeleBarre]% + \setKV[ClesModeleBarre]{#1}% + \setsepchar{\\/ }% + \readlist\ListeModelBarreSup{#2}% + \readlist\ListeModelBarreInf{#3}% + \toklistemodelbarresup{}% + \foreachitem\compteur\in\ListeModelBarreSup{% + \foreachitem\valeur\in\ListeModelBarreSup[\compteurcnt]{% + \expandafter\UpdateListeModelBarreSup\valeur\nil% + }% + }% + \toklistemodelbarreinf{}% + \foreachitem\compteur\in\ListeModelBarreInf{% + \foreachitem\valeur\in\ListeModelBarreInf[\compteurcnt]{% + \expandafter\UpdateListeModelBarreInf\valeur\nil% + }% + }% + \ifboolKV[ClesModeleBarre]{Homogene}{% + \PfCMPDessineModelBarre{\the\toklistemodelbarresup}{\the\toklistemodelbarreinf}% + }{% + \PfCMPDessineModelBarreNonHomogene{\the\toklistemodelbarresup}{\the\toklistemodelbarreinf}% + }% +}% + +\newcommand\PfCMPDessineModelBarre[2]{% + \begin{mplibcode} + Longueur:=\useKV[ClesModeleBarre]{Longueur}; + Hauteur:=\useKV[ClesModeleBarre]{Hauteur}; + + vardef Briquesup(expr col)(text t)= + save $; + picture $; + $=image( + u:=Longueur/MBnbcasessuptotal; + remplis polygone((0,0),(u,0),(u,Hauteur),(0,Hauteur)) withcolor col; + draw polygone((0,0),(u,0),(u,Hauteur),(0,Hauteur)); + label(TEX(t),iso((0,0),(u,Hauteur))); + u:=1cm; + ); + $ + enddef; + + vardef Briqueinf(expr col)(text t)= + save $; + picture $; + $=image( + u:=Longueur/MBnbcasesinftotal; + remplis polygone((0,0),(u,0),(u,Hauteur),(0,Hauteur)) withcolor col; + draw polygone((0,0),(u,0),(u,Hauteur),(0,Hauteur)); + label(TEX(t),iso((0,0),(u,Hauteur))); + u:=1cm; + ); + $ + enddef; + + numeric MBnbcolsup;%compte combien de couleurs + MBnbcolsup=0; + color MBColSup[];%Sauvegarde les couleurs de la barre sup + numeric MBnbinfosup[];%compte combien d'infos par couleurs. + numeric MBnbcasessup[][]; + numeric MBnbcasessuptotal; + MBnbcasessuptotal=0; + string MBTextcasessup[][]; + vardef toto(text t)= + for p_=t: + if color p_: + MBnbcolsup:=MBnbcolsup+1;% on incrémente le nombre de couleurs + MBColSup[MBnbcolsup]:=p_;% on définit la couleur de la série de cases + MBnbinfosup[MBnbcolsup]:=0; + else: + if numeric p_: + MBnbinfosup[MBnbcolsup]:=MBnbinfosup[MBnbcolsup]+1; + MBnbcasessuptotal:=MBnbcasessuptotal+p_; + MBnbcasessup[MBnbcolsup][MBnbinfosup[MBnbcolsup]]:=p_; + else: + MBTextcasessup[MBnbcolsup][MBnbinfosup[MBnbcolsup]]:=p_; + fi; + fi; + endfor; + enddef; + + toto(#1); + + numeric MBnbcolinf;%compte combien de couleurs + MBnbcolinf=0; + color MBColInf[];%Sauvegarde les couleurs de la barre inf + numeric MBnbinfoinf[];%compte combien d'infos par couleurs. + numeric MBnbcasesinf[][]; + numeric MBnbcasesinftotal; + MBnbcasesinftotal=0; + string MBTextcasesinf[][]; + vardef tata(text t)= + for p_=t: + if color p_: + MBnbcolinf:=MBnbcolinf+1;% on incrémente le nombre de couleurs + MBColInf[MBnbcolinf]:=p_;% on définit la couleur de la série de cases + MBnbinfoinf[MBnbcolinf]:=0; + else: + if numeric p_: + MBnbinfoinf[MBnbcolinf]:=MBnbinfoinf[MBnbcolinf]+1; + MBnbcasesinftotal:=MBnbcasesinftotal+p_; + MBnbcasesinf[MBnbcolinf][MBnbinfoinf[MBnbcolinf]]:=p_; + else: + MBTextcasesinf[MBnbcolinf][MBnbinfoinf[MBnbcolinf]]:=p_; + fi; + fi; + endfor; + enddef; + + tata(#2); + + pair VecteurDeplasup; + VecteurDeplasup=(Longueur/MBnbcasessuptotal,0); + + numeric MBnbdepla; + MBnbdepla=0; + for k=1 upto MBnbcolsup: + for l=1 upto MBnbinfosup[k]: + for j=1 upto MBnbcasessup[k][l]: + trace Briquesup(MBColSup[k])(MBTextcasessup[k][l]) shifted(MBnbdepla*VecteurDeplasup); + MBnbdepla:=MBnbdepla+1; + endfor; + endfor; + endfor; + + pair VecteurDeplainf; + VecteurDeplainf=(Longueur/MBnbcasesinftotal,0); + + numeric MBnbdepla; + MBnbdepla=0; + for k=1 upto MBnbcolinf: + for l=1 upto MBnbinfoinf[k]: + for j=1 upto MBnbcasesinf[k][l]: + trace Briqueinf(MBColInf[k])(MBTextcasesinf[k][l]) shifted(MBnbdepla*VecteurDeplainf+(0,-Hauteur)); + MBnbdepla:=MBnbdepla+1; + endfor; + endfor; + endfor; + \end{mplibcode} +} + +\newcommand\PfCMPDessineModelBarreNonHomogene[2]{% + \ifluatex% + \mplibforcehmode% + \begin{mplibcode} + Longueur:=\useKV[ClesModeleBarre]{Largeur}; + Hauteur:=\useKV[ClesModeleBarre]{Hauteur}; + Separation:=\useKV[ClesModeleBarre]{Separation}; + + vardef Brique(expr col,nbfois)(text t)= + save $; + picture $; + $=image( + u:=Longueur; + if t="?": + draw polygone((0,0),(u*abs(nbfois),0),(u*abs(nbfois),Hauteur),(0,Hauteur)) dashed evenly; + else: + remplis polygone((0,0),(u*abs(nbfois),0),(u*abs(nbfois),Hauteur),(0,Hauteur)) withcolor col; + draw polygone((0,0),(u*abs(nbfois),0),(u*abs(nbfois),Hauteur),(0,Hauteur)); + fi; + if nbfois>0: + label(TEX(t),iso((0,0),(u*abs(nbfois),Hauteur))); + else: + label.bot(TEX(t),iso((0,0),(u*abs(nbfois),-Hauteur))); + drawdblarrow (0,-0.5*Hauteur)--(u*abs(nbfois),-0.5*Hauteur); + fi; + u:=1cm; + ); + $ + enddef; + + numeric MBnbcolsup;%compte combien de couleurs + MBnbcolsup=0; + color MBColSup[];%Sauvegarde les couleurs de la barre sup + numeric MBnbinfosup[];%compte combien d'infos par couleurs. + numeric MBnbcasessup[][]; + numeric MBnbcasessuptotal; + MBnbcasessuptotal=0; + string MBTextcasessup[][]; + vardef toto(text t)= + for p_=t: + if color p_: + MBnbcolsup:=MBnbcolsup+1;% on incrémente le nombre de couleurs + MBColSup[MBnbcolsup]:=p_;% on définit la couleur de la série de cases + MBnbinfosup[MBnbcolsup]:=0; + else: + if numeric p_: + MBnbinfosup[MBnbcolsup]:=MBnbinfosup[MBnbcolsup]+1; + MBnbcasessuptotal:=MBnbcasessuptotal+p_; + MBnbcasessup[MBnbcolsup][MBnbinfosup[MBnbcolsup]]:=p_; + else: + MBTextcasessup[MBnbcolsup][MBnbinfosup[MBnbcolsup]]:=p_; + fi; + fi; + endfor; + enddef; + + toto(#1); + + numeric MBnbcolinf;%compte combien de couleurs + MBnbcolinf=0; + color MBColInf[];%Sauvegarde les couleurs de la barre inf + numeric MBnbinfoinf[];%compte combien d'infos par couleurs. + numeric MBnbcasesinf[][]; + numeric MBnbcasesinftotal; + MBnbcasesinftotal=0; + string MBTextcasesinf[][]; + vardef tata(text t)= + for p_=t: + if color p_: + MBnbcolinf:=MBnbcolinf+1;% on incrémente le nombre de couleurs + MBColInf[MBnbcolinf]:=p_;% on définit la couleur de la série de cases + MBnbinfoinf[MBnbcolinf]:=0; + else: + if numeric p_: + MBnbinfoinf[MBnbcolinf]:=MBnbinfoinf[MBnbcolinf]+1; + MBnbcasesinftotal:=MBnbcasesinftotal+p_; + MBnbcasesinf[MBnbcolinf][MBnbinfoinf[MBnbcolinf]]:=p_; + else: + MBTextcasesinf[MBnbcolinf][MBnbinfoinf[MBnbcolinf]]:=p_; + fi; + fi; + endfor; + enddef; + + tata(#2); + + pair VecteurDepla; + VecteurDepla=(Longueur,0); + + numeric MBnbdepla; + MBnbdepla=0; + for k=1 upto MBnbcolsup: + for l=1 upto MBnbinfosup[k]: + trace Brique(MBColSup[k],MBnbcasessup[k][l])(MBTextcasessup[k][l]) shifted(MBnbdepla*VecteurDepla); + MBnbdepla:=MBnbdepla+MBnbcasessup[k][l]; + endfor; + endfor; + + MBnbdepla:=0; + for k=1 upto MBnbcolinf: + for l=1 upto MBnbinfoinf[k]: + trace Brique(MBColInf[k],MBnbcasesinf[k][l])(MBTextcasesinf[k][l]) shifted(MBnbdepla*VecteurDepla+u*(0,-0.5)); + if MBnbcasesinf[k][l]<0: + for j=1 upto (abs(MBnbcasesinf[k][l])-1): + trace ((0,0)--(0,Hauteur)) shifted((MBnbdepla+j)*VecteurDepla+u*(0,-0.5)) withcolor black; + endfor; + fi; + MBnbdepla:=MBnbdepla+abs(MBnbcasesinf[k][l]); + endfor; + endfor; + + if Separation>0: + draw u*(Separation,-0.75)--u*(Separation,0.75) withpen pencircle scaled 1.5 dashed evenly withcolor red; + fi; + + \end{mplibcode} + \else + \begin{mpost}[mpsettings={Longueur:=\useKV[ClesModeleBarre]{Largeur};Hauteur:=\useKV[ClesModeleBarre]{Hauteur};Separation:=\useKV[ClesModeleBarre]{Separation};}] + vardef Brique(expr col,nbfois)(text t)= + save $; + picture $; + $=image( + u:=Longueur; + if t="?": + draw polygone((0,0),(u*abs(nbfois),0),(u*abs(nbfois),Hauteur),(0,Hauteur)) dashed evenly; + else: + remplis polygone((0,0),(u*abs(nbfois),0),(u*abs(nbfois),Hauteur),(0,Hauteur)) withcolor col; + draw polygone((0,0),(u*abs(nbfois),0),(u*abs(nbfois),Hauteur),(0,Hauteur)); + fi; + if nbfois>0: + label(LATEX(t),iso((0,0),(u*abs(nbfois),Hauteur))); + else: + label.bot(LATEX(t),iso((0,0),(u*abs(nbfois),-Hauteur))); + drawdblarrow (0,-0.5*Hauteur)--(u*abs(nbfois),-0.5*Hauteur); + fi; + u:=1cm; + ); + $ + enddef; + + numeric MBnbcolsup;%compte combien de couleurs + MBnbcolsup=0; + color MBColSup[];%Sauvegarde les couleurs de la barre sup + numeric MBnbinfosup[];%compte combien d'infos par couleurs. + numeric MBnbcasessup[][]; + numeric MBnbcasessuptotal; + MBnbcasessuptotal=0; + string MBTextcasessup[][]; + vardef toto(text t)= + for p_=t: + if color p_: + MBnbcolsup:=MBnbcolsup+1;% on incrémente le nombre de couleurs + MBColSup[MBnbcolsup]:=p_;% on définit la couleur de la série de cases + MBnbinfosup[MBnbcolsup]:=0; + else: + if numeric p_: + MBnbinfosup[MBnbcolsup]:=MBnbinfosup[MBnbcolsup]+1; + MBnbcasessuptotal:=MBnbcasessuptotal+p_; + MBnbcasessup[MBnbcolsup][MBnbinfosup[MBnbcolsup]]:=p_; + else: + MBTextcasessup[MBnbcolsup][MBnbinfosup[MBnbcolsup]]:=p_; + fi; + fi; + endfor; + enddef; + + toto(#1); + + numeric MBnbcolinf;%compte combien de couleurs + MBnbcolinf=0; + color MBColInf[];%Sauvegarde les couleurs de la barre inf + numeric MBnbinfoinf[];%compte combien d'infos par couleurs. + numeric MBnbcasesinf[][]; + numeric MBnbcasesinftotal; + MBnbcasesinftotal=0; + string MBTextcasesinf[][]; + vardef tata(text t)= + for p_=t: + if color p_: + MBnbcolinf:=MBnbcolinf+1;% on incrémente le nombre de couleurs + MBColInf[MBnbcolinf]:=p_;% on définit la couleur de la série de cases + MBnbinfoinf[MBnbcolinf]:=0; + else: + if numeric p_: + MBnbinfoinf[MBnbcolinf]:=MBnbinfoinf[MBnbcolinf]+1; + MBnbcasesinftotal:=MBnbcasesinftotal+p_; + MBnbcasesinf[MBnbcolinf][MBnbinfoinf[MBnbcolinf]]:=p_; + else: + MBTextcasesinf[MBnbcolinf][MBnbinfoinf[MBnbcolinf]]:=p_; + fi; + fi; + endfor; + enddef; + + tata(#2); + + pair VecteurDepla; + VecteurDepla=(Longueur,0); + + numeric MBnbdepla; + MBnbdepla=0; + for k=1 upto MBnbcolsup: + for l=1 upto MBnbinfosup[k]: + trace Brique(MBColSup[k],MBnbcasessup[k][l])(MBTextcasessup[k][l]) shifted(MBnbdepla*VecteurDepla); + MBnbdepla:=MBnbdepla+MBnbcasessup[k][l]; + endfor; + endfor; + + MBnbdepla:=0; + for k=1 upto MBnbcolinf: + for l=1 upto MBnbinfoinf[k]: + trace Brique(MBColInf[k],MBnbcasesinf[k][l])(MBTextcasesinf[k][l]) shifted(MBnbdepla*VecteurDepla+u*(0,-0.5)); + if MBnbcasesinf[k][l]<0: + for j=1 upto (abs(MBnbcasesinf[k][l])-1): + trace ((0,0)--(0,Hauteur)) shifted((MBnbdepla+j)*VecteurDepla+u*(0,-0.5)) withcolor black; + endfor; + fi; + MBnbdepla:=MBnbdepla+abs(MBnbcasesinf[k][l]); + endfor; + endfor; + + if Separation>0: + draw u*(Separation,-0.75)--u*(Separation,0.75) withpen pencircle scaled 1.5 dashed evenly withcolor red; + fi; + + \end{mpost} + \fi +} + +%%% +% Fiche m\'emorisation active +%%% +\setKVdefault[ClesFicheMemo]{TexteReponses=Réponses,TexteQuestions=Questions,Solution=false,Largeur=\linewidth} + +\newcommand\FicheMemo[3][]{% + \xdef\CountcolUn{0}% + \xdef\CountcolDeux{0}% + \useKVdefault[ClesFicheMemo]% + \setKV[ClesFicheMemo]{#1}% + \setsepchar[*]{§*/}% + \readlist*\ListeQuestionColonneUn{#2}% + \readlist*\ListeQuestionColonneDeux{#3}% + \renewcommand{\arraystretch}{1.35}% + \begin{NiceTabular}[width=\useKV[ClesFicheMemo]{Largeur}]{X[1]X[1]X[1]X[1]}[hvlines] + \CodeBefore% + \rowcolor{gray!15}{1}% + \tikz\draw[dashed,gray!50](2-|1.5) to (last-|1.5);% + \tikz\draw[dashed,gray!50](2-|4.5) to (last-|4.5);% + \Body% + \Block{1-1}{\bfseries\useKV[ClesFicheMemo]{TexteReponses}}&&&\Block{1-1}{\bfseries\useKV[ClesFicheMemo]{TexteReponses}}\\ + \xintFor* ##4 in {\xintSeq {1}{\ListeQuestionColonneUnlen}}\do{% + \xintifboolexpr{\listlen\ListeQuestionColonneUn[##4]==2}{% + \uppercase{&}}{% + \Block[l]{\fpeval{\ListeQuestionColonneUn[##4,1]}-1}{\ifboolKV[ClesFicheMemo]{Solution}{\ListeQuestionColonneUn[##4,3]}{}}\uppercase{&}\xdef\CountcolUn{\fpeval{\CountcolUn+1}}\Block[l]{\fpeval{\ListeQuestionColonneUn[##4,1]}-1}{\ListeQuestionColonneUn[##4,2]}% + }% + &% + \xintifboolexpr{\listlen\ListeQuestionColonneDeux[##4]==2}{% + \uppercase{&}% + }{% + \xdef\CountcolDeux{\fpeval{\CountcolDeux+1}}\Block[l]{\fpeval{\ListeQuestionColonneDeux[##4,1]}-1}{\ListeQuestionColonneDeux[##4,2]}\uppercase{&}\Block[l]{\fpeval{\ListeQuestionColonneDeux[##4,1]}-1}{\ifboolKV[ClesFicheMemo]{Solution}{\ListeQuestionColonneDeux[##4,3]}{}}% + }% + \\% + }% + \CodeAfter% + \tikz\node[xshift=0.5em] at (2-|1) {\scriptsize\faCut};% + \xdef\PfCCountCutUn{2}% + \xintFor* ##4 in {\xintSeq {1}{\ListeQuestionColonneUnlen}}\do{% + \xintifboolexpr{\listlen\ListeQuestionColonneUn[##4]==2}{% + }{% + \xdef\PfCCountCutUn{\fpeval{\PfCCountCutUn+\ListeQuestionColonneUn[##4,1]}}% + \tikz\node[xshift=0.5em] at (\fpeval{\PfCCountCutUn}-|1) {\scriptsize\faCut};% + }% + }% + \tikz\node[xshift=-0.5em] at (2-|last) {\scriptsize\rotatebox{180}{\faCut}};% + \xdef\PfCCountCutDeux{2}% + \xintFor* ##4 in {\xintSeq {1}{\ListeQuestionColonneDeuxlen}}\do{% + \xintifboolexpr{\listlen\ListeQuestionColonneDeux[##4]==2}{% + }{% + \xdef\PfCCountCutDeux{\fpeval{\PfCCountCutDeux+\ListeQuestionColonneDeux[##4,1]}}% + \tikz\node[xshift=-0.5em] at (\fpeval{\PfCCountCutDeux}-|last) {\scriptsize\rotatebox{180}{\faCut}};% + }% + }% + \tikz\node[xshift=0.5em] at (1-|1) {\color{gray}\scriptsize\faCut};% + \tikz\node[xshift=0.5em] at (last-|1) {\color{gray}\scriptsize\faCut};% + \tikz\node[xshift=-0.5em] at (1-|last) {\color{gray}\scriptsize\rotatebox{180}{\faCut}};% + \tikz\node[xshift=-0.5em] at (last-|last) {\color{gray}\scriptsize\rotatebox{180}{\faCut}};% + \tikz\node at (1.5-|2.5) {\bfseries\useKV[ClesFicheMemo]{TexteQuestions} 1 à \num{\CountcolUn}};% + \tikz\node at (1.5-|3.5) {\bfseries\useKV[ClesFicheMemo]{TexteQuestions} \num{\fpeval{\CountcolUn+1}} à \num{\fpeval{\CountcolUn+\CountcolDeux}}};% + \end{NiceTabular}% + \renewcommand{\arraystretch}{1}% +}% + %%% % Op\'erations pos\'es à trou %%% @@ -2465,7 +2915,7 @@ couleur indiquée, le nombre de cases donné par le résultat du calcul. %%% % Qui suis-je %%% -\setKVdefault[Quisuisje]{Solution=false,Largeur=5mm,Colonnes=5,CodePerso=false}% +\setKVdefault[Quisuisje]{Solution=false,Largeur=5mm,Colonnes=5,CodePerso=false,TexteA=Lettre,TexteB=R\'esultat du calcul}% \newcommand\QuisuisjeEnonce{% Chaque lettre du mot à découvrir porte un numéro qui correspond à un @@ -2481,11 +2931,11 @@ couleur indiquée, le nombre de cases donné par le résultat du calcul. \readlist*\ListeQuisuisje{#2}% \begin{NiceTabular}{|l|*{\ListeQuisuisjelen}{m{\useKV[Quisuisje]{Largeur}}|}}% \hline - Lettre\xintFor* ##1 in {\xintSeq {1}{\ListeQuisuisjelen}}\do{% + \useKV[Quisuisje]{TexteA}\xintFor* ##1 in {\xintSeq {1}{\ListeQuisuisjelen}}\do{% &\centering\arraybackslash\ListeQuisuisje[##1,1] }\\ \hline - R\'esultat du calcul\xintFor* ##1 in {\xintSeq {1}{\ListeQuisuisjelen}}\do{% + \useKV[Quisuisje]{TexteB}\xintFor* ##1 in {\xintSeq {1}{\ListeQuisuisjelen}}\do{% &\centering\arraybackslash\ListeQuisuisje[##1,2] }\\ \hline @@ -2919,16 +3369,16 @@ couleur indiquée, le nombre de cases donné par le résultat du calcul. \readlist*\ListeAutoQ{#2}% % \setsepchar{§} % \readlist*\ListeAutoR{#3}% - \setsepchar[*]{§*/} + \setsepchar[*]{§*/}% \readlist*\ListeAutoEn{#3}% \clearpage \begin{tikzpicture}[remember picture,overlay]% \ifboolKV[Autonomie]{AfficheMarge}{% - \node[xshift=5mm,yshift=-5mm,circle] (PfCA) at (current page.north west) {}; - \node[xshift=-5mm,yshift=5mm] (PfCB) at (current page.south east) {}; - \draw[blue,dashed] (PfCA) rectangle (PfCB); + \node[xshift=5mm,yshift=-5mm,circle] (PfCA) at (current page.north west) {};% + \node[xshift=-5mm,yshift=5mm] (PfCB) at (current page.south east) {};% + \draw[blue,dashed] (PfCA) rectangle (PfCB);% }{}% - \foreach \i in {1,...,3}{ + \foreach \i in {1,...,3}{% \coordinate[xshift=\i*0.25*\paperwidth] (A\i) at (current page.north west);% \coordinate[xshift=\i*0.25*\paperwidth] (B\i) at (current page.south west);% } @@ -2939,53 +3389,53 @@ couleur indiquée, le nombre de cases donné par le résultat du calcul. \coordinate[yshift=-\i*0.25*\paperheight] (E\i) at (A3);% }% \ifboolKV[Autonomie]{Deux}{% - \draw (C2) to (D2); - \draw (E2) to (F2); + \draw (C2) to (D2);% + \draw (E2) to (F2);% }{% \foreach\i in{1,...,4}{% - \draw (C\i) to (D\i); - \draw (E\i) to (F\i); + \draw (C\i) to (D\i);% + \draw (E\i) to (F\i);% }% }% - \coordinate (Q1) at ($(F1)!0.5!(A3)$); - \coordinate (Q2) at ($(F2)!0.5!(E1)$); - \coordinate (Q3) at ($(F3)!0.5!(E2)$); - \coordinate (Q4) at ($(F4)!0.5!(E3)$); - \coordinate (Q5) at ($(C1)!0.5!(A1)$); - \coordinate (Q6) at ($(C2)!0.5!(D1)$); - \coordinate (Q7) at ($(C3)!0.5!(D2)$); - \coordinate (Q8) at ($(C4)!0.5!(D3)$); + \coordinate (Q1) at ($(F1)!0.5!(A3)$);% + \coordinate (Q2) at ($(F2)!0.5!(E1)$);% + \coordinate (Q3) at ($(F3)!0.5!(E2)$);% + \coordinate (Q4) at ($(F4)!0.5!(E3)$);% + \coordinate (Q5) at ($(C1)!0.5!(A1)$);% + \coordinate (Q6) at ($(C2)!0.5!(D1)$);% + \coordinate (Q7) at ($(C3)!0.5!(D2)$);% + \coordinate (Q8) at ($(C4)!0.5!(D3)$);% \draw[dashed] (A1) to (B1);% \draw[dashed] (A3) to (B3);% \ifboolKV[Autonomie]{ARemplir}{% \ifboolKV[Autonomie]{Deux}{% - \node[align=justify,anchor=center,text width=0.9*0.25\textwidth] (Test1) at ($(Q1)!0.5!(Q2)$) {\ListeAutoQ[1,1]}; - \node[align=justify,anchor=center,text width=0.9*0.25\textwidth] (Test2) at ($(Q3)!0.5!(Q4)$) {\ListeAutoQ[2,1]}; - \node[align=justify,anchor=center,text width=0.9*0.25\textwidth] (Test3) at ($(Q5)!0.5!(Q6)$) {\ListeAutoQ[3,1]}; - \node[align=justify,anchor=center,text width=0.9*0.25\textwidth] (Test4) at ($(Q7)!0.5!(Q8)$) {\ListeAutoQ[4,1]}; + \node[align=justify,anchor=center,text width=0.9*0.25\textwidth] (Test1) at ($(Q1)!0.5!(Q2)$) {\ListeAutoQ[1,1]};% + \node[align=justify,anchor=center,text width=0.9*0.25\textwidth] (Test2) at ($(Q3)!0.5!(Q4)$) {\ListeAutoQ[2,1]};% + \node[align=justify,anchor=center,text width=0.9*0.25\textwidth] (Test3) at ($(Q5)!0.5!(Q6)$) {\ListeAutoQ[3,1]};% + \node[align=justify,anchor=center,text width=0.9*0.25\textwidth] (Test4) at ($(Q7)!0.5!(Q8)$) {\ListeAutoQ[4,1]};% }{% \foreach \i in {1,...,4}{% - \node[align=justify,anchor=center,text width=0.9*0.25\textwidth] (Test\i) at (Q\i) {\ListeAutoQ[\i,1]}; + \node[align=justify,anchor=center,text width=0.9*0.25\textwidth] (Test\i) at (Q\i) {\ListeAutoQ[\i,1]};% }% \foreach \i in {5,...,8}{% - \node[align=justify,anchor=center,text width=0.9*0.25\textwidth] (Test\i) at (Q\i) {\ListeAutoQ[\i,1]}; + \node[align=justify,anchor=center,text width=0.9*0.25\textwidth] (Test\i) at (Q\i) {\ListeAutoQ[\i,1]};% }% }% }{% \foreach \i in {1,...,4}{% - \node[xshift=-5mm,align=justify,anchor=center,text width=0.8*0.25\textwidth] (Test\i) at (Q\i) {\ding{\fpeval{171+\i}}~\ListeAutoQ[\i,1]}; + \node[xshift=-5mm,align=justify,anchor=center,text width=0.8*0.25\textwidth] (Test\i) at (Q\i) {\ding{\fpeval{171+\i}}~\ListeAutoQ[\i,1]};% }% \foreach \i in {5,...,8}{% - \node[align=justify,anchor=center,text width=0.8*0.25\textwidth] (Test\i) at (Q\i) {\ding{\fpeval{171+\i}}~\ListeAutoQ[\i,1]}; + \node[align=justify,anchor=center,text width=0.8*0.25\textwidth] (Test\i) at (Q\i) {\ding{\fpeval{171+\i}}~\ListeAutoQ[\i,1]};% }% }% - \end{tikzpicture} - \clearpage + \end{tikzpicture}% + \clearpage% \begin{tikzpicture}[remember picture,overlay]% \ifboolKV[Autonomie]{AfficheMarge}{% - \node[xshift=5mm,yshift=-5mm,circle] (PfCA) at (current page.north west) {}; - \node[xshift=-5mm,yshift=5mm] (PfCB) at (current page.south east) {}; - \draw[blue,dashed] (PfCA) rectangle (PfCB); + \node[xshift=5mm,yshift=-5mm,circle] (PfCA) at (current page.north west) {};% + \node[xshift=-5mm,yshift=5mm] (PfCB) at (current page.south east) {};% + \draw[blue,dashed] (PfCA) rectangle (PfCB);% }{}% \foreach \i in {1,...,3}{% \coordinate[xshift=\i*0.25*\paperwidth] (A\i) at (current page.north west);% @@ -2999,83 +3449,83 @@ couleur indiquée, le nombre de cases donné par le résultat du calcul. \coordinate[yshift=-\i*0.25*\paperheight] (E\i) at (A3);% }% \ifboolKV[Autonomie]{Deux}{% - \draw (C2) to (F2); + \draw (C2) to (F2);% }{% \foreach \i in{1,...,4}{% - \draw (C\i) to (F\i); + \draw (C\i) to (F\i);% }% }% - \coordinate (T1) at ($(current page.north west)!0.5!(A1)$); - \coordinate (T2) at ($(C1)!0.5!(D1)$); - \coordinate (T3) at ($(C2)!0.5!(D2)$); - \coordinate (T4) at ($(C3)!0.5!(D3)$); - \coordinate (T5) at ($(current page.north east)!0.5!(A3)$); - \coordinate (T6) at ($(E1)!0.5!(F1)$); - \coordinate (T7) at ($(E2)!0.5!(F2)$); - \coordinate (T8) at ($(E3)!0.5!(F3)$); - \coordinate (U1) at ($(C1)!0.5!(D1)$); - \coordinate (U2) at ($(C2)!0.5!(D2)$); - \coordinate (U3) at ($(C3)!0.5!(D3)$); - \coordinate (U4) at ($(current page.south west)!0.5!(B1)$); - \coordinate (U5) at ($(E1)!0.5!(F1)$); - \coordinate (U6) at ($(E2)!0.5!(F2)$); - \coordinate (U7) at ($(E3)!0.5!(F3)$); - \coordinate (U8) at ($(B3)!0.5!(current page.south east)$); - \coordinate (R1) at ($(D1)!0.5!(A2)$); - \coordinate (R2) at ($(D2)!0.5!(G1)$); - \coordinate (R3) at ($(D3)!0.5!(G2)$); - \coordinate (R4) at ($(D4)!0.5!(G3)$); - \coordinate (R5) at ($(E1)!0.5!(A2)$); - \coordinate (R6) at ($(E2)!0.5!(G1)$); - \coordinate (R7) at ($(E3)!0.5!(G2)$); - \coordinate (R8) at ($(E4)!0.5!(G3)$); - \coordinate (S1) at ($(A1)!0.5!(D1)$); - \coordinate (S2) at ($(D1)!0.5!(D2)$); - \coordinate (S3) at ($(D2)!0.5!(D3)$); - \coordinate (S4) at ($(D3)!0.5!(B1)$); - \coordinate (S5) at ($(R1)!0.5!(R5)$); - \coordinate (S6) at ($(R2)!0.5!(R6)$); - \coordinate (S7) at ($(R3)!0.5!(R7)$); - \coordinate (S8) at ($(R4)!0.5!(R8)$); - \coordinate (V1) at ($(T1)!0.5!(U1)$); - \coordinate (V2) at ($(T2)!0.5!(U2)$); - \coordinate (V3) at ($(T3)!0.5!(U3)$); - \coordinate (V4) at ($(T4)!0.5!(U4)$); - \coordinate (V5) at ($(T5)!0.5!(U5)$); - \coordinate (V6) at ($(T6)!0.5!(U6)$); - \coordinate (V7) at ($(T7)!0.5!(U7)$); - \coordinate (V8) at ($(T8)!0.5!(U8)$); + \coordinate (T1) at ($(current page.north west)!0.5!(A1)$);% + \coordinate (T2) at ($(C1)!0.5!(D1)$);% + \coordinate (T3) at ($(C2)!0.5!(D2)$);% + \coordinate (T4) at ($(C3)!0.5!(D3)$);% + \coordinate (T5) at ($(current page.north east)!0.5!(A3)$);% + \coordinate (T6) at ($(E1)!0.5!(F1)$);% + \coordinate (T7) at ($(E2)!0.5!(F2)$);% + \coordinate (T8) at ($(E3)!0.5!(F3)$);% + \coordinate (U1) at ($(C1)!0.5!(D1)$);% + \coordinate (U2) at ($(C2)!0.5!(D2)$);% + \coordinate (U3) at ($(C3)!0.5!(D3)$);% + \coordinate (U4) at ($(current page.south west)!0.5!(B1)$);% + \coordinate (U5) at ($(E1)!0.5!(F1)$);% + \coordinate (U6) at ($(E2)!0.5!(F2)$);% + \coordinate (U7) at ($(E3)!0.5!(F3)$);% + \coordinate (U8) at ($(B3)!0.5!(current page.south east)$);% + \coordinate (R1) at ($(D1)!0.5!(A2)$);% + \coordinate (R2) at ($(D2)!0.5!(G1)$);% + \coordinate (R3) at ($(D3)!0.5!(G2)$);% + \coordinate (R4) at ($(D4)!0.5!(G3)$);% + \coordinate (R5) at ($(E1)!0.5!(A2)$);% + \coordinate (R6) at ($(E2)!0.5!(G1)$);% + \coordinate (R7) at ($(E3)!0.5!(G2)$);% + \coordinate (R8) at ($(E4)!0.5!(G3)$);% + \coordinate (S1) at ($(A1)!0.5!(D1)$);% + \coordinate (S2) at ($(D1)!0.5!(D2)$);% + \coordinate (S3) at ($(D2)!0.5!(D3)$);% + \coordinate (S4) at ($(D3)!0.5!(B1)$);% + \coordinate (S5) at ($(R1)!0.5!(R5)$);% + \coordinate (S6) at ($(R2)!0.5!(R6)$);% + \coordinate (S7) at ($(R3)!0.5!(R7)$);% + \coordinate (S8) at ($(R4)!0.5!(R8)$);% + \coordinate (V1) at ($(T1)!0.5!(U1)$);% + \coordinate (V2) at ($(T2)!0.5!(U2)$);% + \coordinate (V3) at ($(T3)!0.5!(U3)$);% + \coordinate (V4) at ($(T4)!0.5!(U4)$);% + \coordinate (V5) at ($(T5)!0.5!(U5)$);% + \coordinate (V6) at ($(T6)!0.5!(U6)$);% + \coordinate (V7) at ($(T7)!0.5!(U7)$);% + \coordinate (V8) at ($(T8)!0.5!(U8)$);% \draw[dashed] (A1) to (B1);% - \draw[dashed] (A2) to (B2); + \draw[dashed] (A2) to (B2);% \draw[dashed] (A3) to (B3);% \ifboolKV[Autonomie]{ARemplir}{% \ifboolKV[Autonomie]{Deux}{% - \node[align=justify,anchor=center,text width=0.9*0.25\textwidth] at ($(V1)!0.5!(V2)$) {\ListeAutoEn[1,1]}; - \node[align=justify,anchor=center,text width=0.9*0.25\textwidth] at ($(V3)!0.5!(V4)$) {\ListeAutoEn[2,1]}; - \node[align=justify,anchor=center,text width=0.9*0.25\textwidth] at ($(V5)!0.5!(V6)$) {\ListeAutoEn[3,1]}; - \node[align=justify,anchor=center,text width=0.9*0.25\textwidth] at ($(V7)!0.5!(V8)$) {\ListeAutoEn[4,1]}; - \node[align=justify,anchor=center,text width=0.9*0.25\textwidth] at ($(R1)!0.5!(R2)$) {\ListeAutoQ[1,2]}; - \node[align=justify,anchor=center,text width=0.9*0.25\textwidth] at ($(R3)!0.5!(R4)$) {\ListeAutoQ[2,2]}; - \node[align=justify,anchor=center,text width=0.9*0.25\textwidth] at ($(R5)!0.5!(R6)$) {\ListeAutoQ[3,2]}; - \node[align=justify,anchor=center,text width=0.9*0.25\textwidth] at ($(R7)!0.5!(R8)$) {\ListeAutoQ[4,2]}; + \node[align=justify,anchor=center,text width=0.9*0.25\textwidth] at ($(V1)!0.5!(V2)$) {\ListeAutoEn[1,1]};% + \node[align=justify,anchor=center,text width=0.9*0.25\textwidth] at ($(V3)!0.5!(V4)$) {\ListeAutoEn[2,1]};% + \node[align=justify,anchor=center,text width=0.9*0.25\textwidth] at ($(V5)!0.5!(V6)$) {\ListeAutoEn[3,1]};% + \node[align=justify,anchor=center,text width=0.9*0.25\textwidth] at ($(V7)!0.5!(V8)$) {\ListeAutoEn[4,1]};% + \node[align=justify,anchor=center,text width=0.9*0.25\textwidth] at ($(R1)!0.5!(R2)$) {\ListeAutoQ[1,2]};% + \node[align=justify,anchor=center,text width=0.9*0.25\textwidth] at ($(R3)!0.5!(R4)$) {\ListeAutoQ[2,2]};% + \node[align=justify,anchor=center,text width=0.9*0.25\textwidth] at ($(R5)!0.5!(R6)$) {\ListeAutoQ[3,2]};% + \node[align=justify,anchor=center,text width=0.9*0.25\textwidth] at ($(R7)!0.5!(R8)$) {\ListeAutoQ[4,2]};% }{% \foreach \i in {1,...,8}{% - \node[text width=0.9*0.25\paperwidth] at (V\i) {\ListeAutoQ[\i,2]}; - \node[text width=0.9*0.25\paperwidth] at (R\i) {\ListeAutoEn[\i,1]}; + \node[text width=0.9*0.25\paperwidth] at (V\i) {\ListeAutoQ[\i,2]};% + \node[text width=0.9*0.25\paperwidth] at (R\i) {\ListeAutoEn[\i,1]};% }% }% }{% \foreach \i in {1,...,8}{% - \node[rotate=90,anchor=north] (Cor\i) at (S\i) {\useKV[Autonomie]{TexteCorrection}}; + \node[rotate=90,anchor=north] (Cor\i) at (S\i) {\useKV[Autonomie]{TexteCorrection}};% \node[anchor=west,xshift=2em,text width=0.8*0.25\paperwidth] (Test\i) - at (S\i) {\ListeAutoQ[\i,2]}; + at (S\i) {\ListeAutoQ[\i,2]};% \node[anchor=north,yshift=-1em,text width=0.85*0.25\paperwidth] (TestEn\i) - at (T\i) {\textbf{\useKV[Autonomie]{TitreAtoi} :} \ListeAutoEn[\i,1]}; + at (T\i) {\textbf{\useKV[Autonomie]{TitreAtoi} :} \ListeAutoEn[\i,1]};% \ifboolKV[Autonomie]{Enigme}{% \node[anchor=south,yshift=1em,text width=0.85*0.25\paperwidth] (TestREn\i) at (U\i) {% - \ListeAutoEn[\i,2] : \pointilles\\ - Lettre \ding{\fpeval{171+\i}} : \pointilles + \ListeAutoEn[\i,2] : \pointilles\\% + Lettre \ding{\fpeval{171+\i}} : \pointilles% };% }{% \node[anchor=south,yshift=1em,text width=0.85*0.25\paperwidth] (TestREn\i) @@ -3084,9 +3534,9 @@ couleur indiquée, le nombre de cases donné par le résultat du calcul. };% }% }% - } - \end{tikzpicture} -} + }% + \end{tikzpicture}% +}% %%% % Calculatrice @@ -3200,7 +3650,7 @@ couleur indiquée, le nombre de cases donné par le résultat du calcul. \def\MPCalculatrice#1#2#3{ % #1 Calcul %2 r\'eponse \ifluatex - \mplibforcehmode% + \mplibforcehmode% \begin{mplibcode}% input PfCCalculatrice; LCD(#1)(#2)(#3); @@ -6374,7 +6824,7 @@ couleur indiquée, le nombre de cases donné par le résultat du calcul. }% }% -\newcommand{\Resultat}[1][]{% +\newcommand\Resultat[1][]{% \setKV[ClesDistributivite]{#1}%On lit les arguments optionnels \ensuremath{% \Affichage{\SommeA}{\SommeB}{\SommeC} @@ -9263,7 +9713,7 @@ vardef Positions(expr Step)= % #6 hyp % #7 angle de rotation \ifluatex - \mplibcodeinherit{enable} + \mplibcodeinherit{enable} \mplibforcehmode \begin{mplibcode} u:=\useKV[ClesTrigo]{Echelle}; @@ -10795,7 +11245,7 @@ Unite={},Largeur=1cm,Precision=2,Donnee=Valeurs,Effectif=Effectif,Grille=false,O \fi% \fi% \ifnum\k=\meda% - La \the\meda\ieme{} valeur est \num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}\\Donc la m\'ediane de la s\'erie est \xdef\Mediane{\fpeval{(\Mediane+\ListeComplete[##1,1])/2}}\num{\Mediane}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}% + La \the\meda\ieme{} donn\'ee est \num{\ListeComplete[##1,1]}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}\\Donc la m\'ediane de la s\'erie est \xdef\Mediane{\fpeval{(\Mediane+\ListeComplete[##1,1])/2}}\num{\Mediane}\ifboolKV[ClesStat]{Concret}{~\useKV[ClesStat]{Unite}.}{.}% \fi% }% }% @@ -13020,8 +13470,8 @@ Unite={},Largeur=1cm,Precision=2,Donnee=Valeurs,Effectif=Effectif,Grille=false,O } \newcommand\Fonction[2][]{% - \useKVdefault[ClesFonction] - \setKV[ClesFonction]{#1} + \useKVdefault[ClesFonction]% + \setKV[ClesFonction]{#1}% \ifboolKV[ClesFonction]{Trace}{% \useKVdefault[TraceG]% \setKV[TraceG]{#1}% @@ -13029,7 +13479,6 @@ Unite={},Largeur=1cm,Precision=2,Donnee=Valeurs,Effectif=Effectif,Grille=false,O }{% \ifboolKV[ClesFonction]{Points}{% \toklistePtsFn{}% - % \setsepchar[*]{,*/}%\ignoreemptyitems% \setsepchar[*]{§*/}%\ignoreemptyitems% \readlist*\ListePoints{#2}% \ifboolKV[ClesFonction]{Tangentes}{% @@ -13052,25 +13501,26 @@ Unite={},Largeur=1cm,Precision=2,Donnee=Valeurs,Effectif=Effectif,Grille=false,O }% }% }{% - \ignoreemptyitems% - \readlist*\ListeFonction{#2} + \setsepchar{,}\ignoreemptyitems% + \readlist*\ListeFonction{#2}% \StrSubstitute{\useKV[ClesFonction]{Calcul}}{\useKV[ClesFonction]{Variable}}{\i}[\temp]% \StrSubstitute{\useKV[ClesFonction]{Calcul}}{**}{^}[\tempa]% \StrSubstitute{\tempa}{*}{}[\tempab]% \ifboolKV[ClesFonction]{Ecriture}{% - \ensuremath{\useKV[ClesFonction]{Nom}(\useKV[ClesFonction]{Variable})=\tempab} + \ensuremath{\useKV[ClesFonction]{Nom}(\useKV[ClesFonction]{Variable})=\tempab}% }{}% \ifboolKV[ClesFonction]{Definition}{% - \ensuremath{\useKV[ClesFonction]{Nom}:\useKV[ClesFonction]{Variable}\mapsto\tempab} + \ensuremath{\useKV[ClesFonction]{Nom}:\useKV[ClesFonction]{Variable}\mapsto\tempab}% }{}% \ifboolKV[ClesFonction]{Tableau}{% \buildtabfonction% }{}% + \reademptyitems% }% }% }% -\def\buildtabfonction{%\\ +\def\buildtabfonction{% \[% \begin{array}{|>{\columncolor{gray!15}}c|*{\number\numexpr\ListeFonctionlen}{>{\centering\arraybackslash}p{\useKV[ClesFonction]{Largeur}}|}}% \hline @@ -13078,9 +13528,9 @@ Unite={},Largeur=1cm,Precision=2,Donnee=Valeurs,Effectif=Effectif,Grille=false,O \hline \useKV[ClesFonction]{Nom}(\useKV[ClesFonction]{Variable})\xintFor* ##1 in {\xintSeq {1}{\ListeFonctionlen}}\do{& \StrSubstitute{\useKV[ClesFonction]{Calcul}}{\useKV[ClesFonction]{Variable}}{(\ListeFonction[##1])}[\tempab]\num{\fpeval{\tempab}}} \\\hline - \end{array} - \] -} + \end{array}% + \]% +}% %%% % Diff\'erentes représentations graphiques @@ -14513,7 +14963,7 @@ Unite={},Largeur=1cm,Precision=2,Donnee=Valeurs,Effectif=Effectif,Grille=false,O %%% % Proba %%% -\setKVdefault[ClesProba]{Echelle=false,Arbre=false,Branche=2,Angle=60,Rayon=0.25,LongueurEchelle=5,Affichage=0,Grille=1} +\setKVdefault[ClesProba]{Echelle=false,Arbre=false,Branche=2,Angle=60,Rayon=0.25,LongueurEchelle=5,Affichage=0,Grille=1,Incline} \def\Updatetoksproba#1/#2\nil{\addtotok\toklistepointproba{"#1","\footnotesize #2",}} \def\Updatetoksprobaechelle#1/#2/#3\nil{\addtotok\toklistepointproba{#1,#2,"#3",}} @@ -14666,6 +15116,8 @@ Unite={},Largeur=1cm,Precision=2,Donnee=Valeurs,Effectif=Effectif,Grille=false,O % #3:Liste des \'ev\`enements/proba \ifluatex \begin{mplibcode} + boolean Incline; + Incline=\useKV[ClesProba]{Incline}; pair A[],B[];%les noeuds de l'arbre Figure(-10u,-10u,10u,10u); A0=u*(1,1); @@ -14697,11 +15149,19 @@ Unite={},Largeur=1cm,Precision=2,Donnee=Valeurs,Effectif=Effectif,Grille=false,O else: if (l mod 2)=1: if p_<>"": + if Incline: draw appelation(A[(l-1) div 2],A[l],4mm,TEX(p_)); + else: + label.ulft(TEX(p_),iso(A[(l-1) div 2],A[l])); + fi; fi; else: if p_<>"": + if Incline: draw appelation(A[(l-1) div 2],A[l],-4mm,TEX(p_)); + else: + label.llft(TEX(p_),iso(A[(l-1) div 2],A[l])); + fi; fi; fi; l:=l+1; @@ -14712,7 +15172,7 @@ Unite={},Largeur=1cm,Precision=2,Donnee=Valeurs,Effectif=Effectif,Grille=false,O toto(#3); \end{mplibcode} \else - \begin{mpost}[mpsettings={input PfCGeometrie;}] + \begin{mpost}[mpsettings={input PfCGeometrie; boolean Incline; Incline=\useKV[ClesProba]{Incline};}] pair A[],B[];%les noeuds de l'arbre Figure(-10u,-10u,10u,10u); A0=u*(1,1); @@ -14737,13 +15197,27 @@ Unite={},Largeur=1cm,Precision=2,Donnee=Valeurs,Effectif=Effectif,Grille=false,O vardef toto(text t)= for p_=t: if (n mod 2)=1: + if p_<>"": label(LATEX(p_),A[k]); + fi; k:=k+1; else: if (l mod 2)=1: + if p_<>"": + if Incline: draw appelation(A[(l-1) div 2],A[l],4mm,LATEX(p_)); else: + label.ulft(LATEX(p_),iso(A[(l-1) div 2],A[l])); + fi; + fi; + else: + if p_<>"": + if Incline: draw appelation(A[(l-1) div 2],A[l],-4mm,LATEX(p_)); + else: + label.llft(LATEX(p_),iso(A[(l-1) div 2],A[l])); + fi; + fi; fi; l:=l+1; fi; @@ -16065,8 +16539,7 @@ Unite={},Largeur=1cm,Precision=2,Donnee=Valeurs,Effectif=Effectif,Grille=false,O n:=n+1; if p_<>"": drawarrow (unitp*(valeur[n],-1))--(unitp*(valeur[n],-0.3)); - label.bot(btex \hbox to2em{\dotfill} etex,(unitp*(valeur[n],-1))); - pointe(unitp*(valeur[n]-ValeurOrigine,0)); + label.bot(btex \pointilles[2em] etex,(unitp*(valeur[n],-1))); fi; endfor; elseif AffichageCoord=2: @@ -16075,7 +16548,7 @@ Unite={},Largeur=1cm,Precision=2,Donnee=Valeurs,Effectif=Effectif,Grille=false,O n:=n+1; if p_<>"": if ((ValeurUnitex*valeur[n]) mod pasx)<>0: - label.bot(TEX("\footnotesize$\frac{\num{\fpeval{"&decimal(ValeurUnitex)&"*"&decimal(valeur[n])&"}}}{\num{"&decimal(pasx)&"}}$"),unitp*(valeur[n],0)); + label.bot(TEX("\footnotesize$\frac{\num{\fpeval{"&decimal(ValeurOrigine*pasx)&"+"&decimal(ValeurUnitex-ValeurOrigine)&"*"&decimal(valeur[n])&"}}}{\num{"&decimal(pasx)&"}}$"),unitp*(valeur[n],0)); else: label.bot(TEX("\footnotesize\num{\fpeval{"&decimal(ValeurUnitex)&"*"&decimal(valeur[n])&"/"&decimal(pasx)&"}}"),unitp*(valeur[n],0)); fi; @@ -16087,7 +16560,7 @@ Unite={},Largeur=1cm,Precision=2,Donnee=Valeurs,Effectif=Effectif,Grille=false,O for p_=t: n:=n+1; if p_<>"": - label.bot(TEX("\footnotesize\num{\fpeval{"&decimal(ValeurUnitex)&"*"&decimal(valeur[n])&"/"&decimal(pasx)&"}}"),unitp*(valeur[n],0)); + label.bot(TEX("\footnotesize\num{\fpeval{"&decimal(ValeurOrigine)&"+"&decimal(ValeurUnitex-ValeurOrigine)&"*"&decimal(valeur[n])&"/"&decimal(pasx)&"}}"),unitp*(valeur[n],0)); pointe(unitp*(valeur[n],0)); fi; endfor; @@ -16163,8 +16636,8 @@ Unite={},Largeur=1cm,Precision=2,Donnee=Valeurs,Effectif=Effectif,Grille=false,O n:=n+1; if p_<>"": drawarrow (unitp*(valeur[n],-1))--(unitp*(valeur[n],-0.3)); - label.bot(btex \noexpand\hbox to2em{\noexpand\dotfill} etex,(unitp*(valeur[n],-1))); - pointe(unitp*(valeur[n]-ValeurOrigine,0)); + label.bot(btex \noexpand\hbox to2em{\noexpand\pointilles[2em]} etex,(unitp*(valeur[n],-1))); + %pointe(unitp*(valeur[n]-ValeurOrigine,0)); fi; endfor; elseif AffichageCoord=2: @@ -16173,7 +16646,7 @@ Unite={},Largeur=1cm,Precision=2,Donnee=Valeurs,Effectif=Effectif,Grille=false,O n:=n+1; if p_<>"": if ((ValeurUnitex*valeur[n]) mod pasx)<>0: - label.bot(LATEX("\noexpand\footnotesize$\noexpand\frac{\noexpand\num{\noexpand\fpeval{"&decimal(ValeurUnitex)&"*"&decimal(valeur[n])&"}}}{\noexpand\num{"&decimal(pasx)&"}}$"),unitp*(valeur[n],0)); + label.bot(LATEX("\noexpand\footnotesize$\noexpand\frac{\noexpand\num{\noexpand\fpeval{"&decimal(ValeurOrigine*pasx)&"+"&decimal(ValeurUnitex-ValeurOrigine)&"*"&decimal(valeur[n])&"}}}{\noexpand\num{"&decimal(pasx)&"}}$"),unitp*(valeur[n],0)); else: label.bot(LATEX("\noexpand\footnotesize\noexpand\num{\noexpand\fpeval{"&decimal(ValeurUnitex)&"*"&decimal(valeur[n])&"/"&decimal(pasx)&"}}"),unitp*(valeur[n],0)); fi; @@ -16185,7 +16658,7 @@ Unite={},Largeur=1cm,Precision=2,Donnee=Valeurs,Effectif=Effectif,Grille=false,O for p_=t: n:=n+1; if p_<>"": - label.bot(LATEX("\noexpand\footnotesize\noexpand\num{\noexpand\fpeval{"&decimal(ValeurUnitex)&"*"&decimal(valeur[n])&"/"&decimal(pasx)&"}}"),unitp*(valeur[n],0)); + label.bot(LATEX("\noexpand\footnotesize\noexpand\num{\noexpand\fpeval{"&decimal(ValeurOrigine)&"+"&decimal(ValeurUnitex-ValeurOrigine)&"*"&decimal(valeur[n])&"/"&decimal(pasx)&"}}"),unitp*(valeur[n],0)); pointe(unitp*(valeur[n],0)); fi; endfor; @@ -16461,13 +16934,13 @@ Unite={},Largeur=1cm,Precision=2,Donnee=Valeurs,Effectif=Effectif,Grille=false,O \foreachitem\compteur\in\ListePointDroite{\expandafter\Updatetoksdemidroite\compteur\nil}% \foreachitem\compteur\in\ListePointDroite{\xdef\Listedesvaleursaplacersurlademidroite{\Listedesvaleursaplacersurlademidroite,\ListePointDroite[\compteurcnt,1]}}% %\Listedesvaleursaplacersurlademidroite% - \[\MPNewDEMIGraduee{\Listedesvaleursaplacersurlademidroite}{\the\toklistenompointdemidroite}\]% + \MPNewDEMIGraduee{\Listedesvaleursaplacersurlademidroite}{\the\toklistenompointdemidroite}% }{% \foreachitem\compteur\in\ListePointDroite{\expandafter\Updatetoksdemidroite\compteur\nil}% \xdef\Listedesvaleursaplacersurlademidroite{}% \foreachitem\compteur\in\ListePointDroite{\xdef\Listedesvaleursaplacersurlademidroite{\Listedesvaleursaplacersurlademidroite,\ListePointDroite[\compteurcnt,1]}}% %\Listedesvaleursaplacersurlademidroite% - \[\MPNewDROITEGraduee{\Listedesvaleursaplacersurlademidroite}{\the\toklistenompointdemidroite}\]% + \MPNewDROITEGraduee{\Listedesvaleursaplacersurlademidroite}{\the\toklistenompointdemidroite}% }% }% @@ -17935,7 +18408,7 @@ Unite={},Largeur=1cm,Precision=2,Donnee=Valeurs,Effectif=Effectif,Grille=false,O \end{center}% \end{minipage}};% \node[yshift=-0.5em-0.5\hauteurtitre] (B) at (A){};% - \ifboolKV[Cards]{Titre}{\node[fill=white] at (B) {\useKV[Cards]{NomTitre}};}{},% + \ifboolKV[Cards]{Titre}{\node[fill=white] at (B) {\useKV[Cards]{NomTitre}};}{}% }% }% diff --git a/macros/latex/contrib/profcollege/metapost/PfCCalculatrice.mp b/macros/latex/contrib/profcollege/metapost/PfCCalculatrice.mp index 92d4d3057d..4e208cf560 100644 --- a/macros/latex/contrib/profcollege/metapost/PfCCalculatrice.mp +++ b/macros/latex/contrib/profcollege/metapost/PfCCalculatrice.mp @@ -39,135 +39,135 @@ Math=true; decahoriz:=0; vardef Test(expr cptk,cptnt)= - pair decalage; + pair Decalage; if nblignes mod 2=0: - decalage:=u*((20-length(cptnt)+cptk)*6,-8*(nblignes-1)); + Decalage:=u*((20-length(cptnt)+cptk)*6,-8*(nblignes-1)); else: - decalage:=u*(decahoriz,-8*(nblignes-1)); + 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); + 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); + 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); + 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="@":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); + draw Affichage("00011000011110100001000000000000000") shifted(Decalage); else: - draw Affichage("00010000000011000010000101001001100") shifted(decalage); + draw Affichage("00010000000011000010000101001001100") shifted(Decalage); fi; elseif substring(cptk,cptk+1) of cptnt="k":if Math=true: - draw Affichage("11100001000100011100000000000000000") shifted(decalage); + draw Affichage("11100001000100011100000000000000000") shifted(Decalage); else: - draw Affichage("10000100001001010100110001010010010") shifted(decalage); + draw Affichage("10000100001001010100110001010010010") shifted(Decalage); fi; elseif substring(cptk,cptk+1) of cptnt="l":if Math=true: - draw Affichage("11100010000010011100000000000000000") shifted(decalage); + draw Affichage("11100010000010011100000000000000000") shifted(Decalage); else: - draw Affichage("01100001000010000100001000010001110") shifted(decalage); + 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="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); + draw Affichage("00000000001111101010010100101010001") shifted(Decalage); else: - draw Affichage("00000000000110110011011110000100001") shifted(decalage); + 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="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); + draw Affichage("00111001000010000100101000110000100") shifted(Decalage); else: - draw Affichage("00000000001000110001100010111000100") shifted(decalage); + 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="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); + draw Affichage("00000000000000000000000000000000000") shifted(Decalage); else: - draw Affichage("00000011000110000000011000110000000") shifted(decalage); + draw Affichage("00000011000110000000011000110000000") shifted(Decalage); fi; elseif substring(cptk,cptk+1) of cptnt=";":if Math=true: - draw Affichage("00000001000000011111000000010000000") shifted(decalage); + draw Affichage("00000001000000011111000000010000000") shifted(Decalage); else: - draw Affichage("00000011000110000000011000010001000") shifted(decalage); + 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); + 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; diff --git a/macros/latex/contrib/proflycee/doc/ProfLycee-doc.pdf b/macros/latex/contrib/proflycee/doc/ProfLycee-doc.pdf index 28ebf75edb..e5c9cd1156 100644 Binary files a/macros/latex/contrib/proflycee/doc/ProfLycee-doc.pdf and b/macros/latex/contrib/proflycee/doc/ProfLycee-doc.pdf differ diff --git a/macros/latex/contrib/proflycee/doc/ProfLycee-doc.tex b/macros/latex/contrib/proflycee/doc/ProfLycee-doc.tex index c328b4035f..b513bc9a73 100644 --- a/macros/latex/contrib/proflycee/doc/ProfLycee-doc.tex +++ b/macros/latex/contrib/proflycee/doc/ProfLycee-doc.tex @@ -1,6 +1,5 @@ -% !TeX TXS-program:compile = txs:///pythonpdfse - \documentclass{article} +\usepackage[french]{babel} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[upright]{fourier} @@ -8,9 +7,7 @@ \renewcommand\ttdefault{lmtt} \usepackage[scaled=0.875]{cabin} \usepackage{ProfLycee} -\usepackage[most]{tcolorbox} \usetikzlibrary{hobby} -\usepackage[french]{babel} \usepackage{siunitx} \usepackage{graphics} \usepackage{hvlogos} @@ -21,40 +18,6 @@ \usepackage{hyperref} \hypersetup{pdfborder=0 0 0} -\usepackage{listings} - -\lstset{% - classoffset = 0,% - language = [LaTeX]TeX,% - basicstyle = \ttfamily,% - breaklines = true,% - commentstyle =\color{gray},% - columns=fullflexible,% - keepspaces, - frame=tb,% - %texcsstyle=*\color{blue},%pour colorer la contre-oblique - alsoletter={\\},% - keywordstyle=\color{blue},% - emph=[1]{tkz,ProfLycee,ProfCollege},% - emphstyle=[1]{\color{blue}},% - emph=[3]{beamer},% - emphstyle=[3]{\color{red}},% - classoffset=1,% - keywords={Ecran},% - keywordstyle=\color{green},% - classoffset=0,% - literate=*{[}{{\textcolor{orange}{[}}}{1} - {]}{{\textcolor{orange}{]}}}{1} - {\{}{\textcolor{amber}{\{}}{1} - {\}}{\textcolor{amber}{\}}}{1} - {\&}{\textcolor{red}{\&}}{1} - {\\[}{{\textcolor{purple}{\textbackslash[}}}{2} - {\\]}{{\textcolor{purple}{\textbackslash]}}}{2} - {$}{{\textcolor{purple}{\$}}}{1}%$ - {_}{{\textcolor{purple}{\_}}}{1}% - {^}{{\textcolor{purple}{\^{}}}}{1}%, -} - \usepackage{minted} \sisetup{locale=FR} \usepackage{geometry} @@ -172,7 +135,7 @@ {\ttfamily c pierquet -- at -- outlook . fr} \end{tabular} } -\date{Version 1.0.2 -- 13 Février 2022} +\date{Version 1.0.5 -- 16 Février 2022} \newcommand\Cle[1]{{\bfseries\sffamily\textlangle #1\textrangle}} @@ -189,7 +152,7 @@ \noindent Quelques commandes (dans des environnements \TikZ) pour faciliter l'utilisation de \LaTeX{} pour les enseignants de mathématiques en lycée.\\ -\bigskip +\newpage \tableofcontents @@ -205,7 +168,20 @@ On peut le voir comme un (maigre) complément à \ctex{ProfCollege}, et je préc \medskip -L'idée est donc de conserver l'idée de \Cle{Clés} qui sont : +Il se charge, dans le préambule, par \ctex{\textbackslash usepackage\{ProfLycee\}}. + +\begin{minted}[frame=lines,framesep=2mm,bgcolor=LightGray,fontsize=\footnotesize,tabsize=2]{tex} +\documentclass{article} +\usepackage[french]{babel} +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{ProfLycee} +... +\end{minted} + +\medskip + +L'idée est de conserver l'idée de \Cle{Clés} qui sont : % \begin{itemize} \item modifiables ; @@ -633,7 +609,7 @@ Ainsi, le code : \paramCF[titre=true,couleurcmd=olive,couleurres=orange] \ligneCF{COMMANDE 1}{RÉSULTAT 1} \ligneCF{\texttt{(x+1)\chap2}}{$\mathtt{x^2+2x+1}$} - \ligneCF[HC=1,HR=1]{\textsf{Dérivée[(x+5)*exp(-0.1*x)]}}{$\mathsf{\rightarrow (0.5-0.1*x)*exp(-0.1*x)}$} + \ligneCF[hc=1,hr=1.25]{\textsf{Dérivée[(x+5)*exp(-0.1*x)]}}{$\mathsf{\rightarrow (0.5-0.1*x)*exp(-0.1*x)}$} \end{tikzpicture} \end{minted} @@ -705,7 +681,13 @@ Le \textsf{package} \ctex{pythontex} permet d'insérer et d'exécuter du code Py \item charger du code python, et éventuellement l'utiliser dans la console. \end{itemize} -\subsection{Présentation de code Python} +\medskip + +\textbf{Attention : }il faut dans ce cas une compilation en plusieurs parties, comme par exemple \textsf{pdflatex puis pythontex puis pdflatex} ! + +Voir par exemple \url{http://lesmathsduyeti.fr/fr/informatique/latex/pythontex/} ! + +\subsection{Présentation de code Python via pythontex} L'environnement \ctex{\textbackslash envcodepythontex} (chargé par \ctex{ProfLycee}, avec l'option \textit{autogobble}) permet de présenter du code python, dans une \ctex{colorbox} avec un style particulier. @@ -763,6 +745,70 @@ produira : \newpage +\subsection{Présentation de code Python via minted} + +Pour celles et ceux qui ne sont pas à l'aise avec le \textsf{package} \ctex{pythontex} et notamment sa spécificité pour compiler, il existe le \textsf{package} \ctex{minted} qui permet de présenter du code, et notamment python (il nécessite quand même une compilation avec l'option \ctex{--shell-escape} ou \ctex{-write18}). + +\medskip + +L'environnement \ctex{\textbackslash envcodepythonminted} permet de présenter du code python, dans une \ctex{colorbox} avec un style (\textit{minted}) particulier. + +\begin{minted}[frame=lines,framesep=2mm,bgcolor=LightGray,fontsize=\footnotesize,tabsize=2]{tex} +\begin{envcodepythonminted}(*)[largeur][options] +... +\end{envcodepythonminted} +\end{minted} + +Plusieurs \Cle{arguments} (optionnels) sont disponibles : + +\begin{itemize} + \item la version \textit{étoilée} qui permet de pas afficher les numéros de lignes ; + \item le premier argument optionnel concerne la \Cle{largeur} de la \ctex{tcbox} ;\hfill{}défaut \Cle{12cm} + \item le second argument optionnel concerne les \Cle{options} de la \ctex{tcbox} en \textit{langage tcolorbox}.\hfill{}défaut \Cle{vide} +\end{itemize} + +\medskip + +Ainsi le code : + +\begin{minted}[frame=lines,framesep=2mm,bgcolor=lightgray!5,fontsize=\footnotesize,tabsize=4]{tex} +\begin{envcodepythonminted}[12cm][center] + #environnement Python(minted) centré avec numéros, de largeur 12cm + def f(x) : + return x**2 +\end{envcodepythonminted} +\end{minted} + +produira : + +\begin{envcodepythonminted}[12cm][center] + #environnement Python(minted) centré avec numéros + def f(x) : + return x**2 +\end{envcodepythonminted} + +\medskip + +Et le code : + +\begin{minted}[frame=lines,framesep=2mm,bgcolor=lightgray!5,fontsize=\footnotesize,tabsize=4]{tex} +\begin{envcodepythonminted}*[0.8\linewidth][] + #environnement Python(minted) sans numéro, de largeur 0.8\linewidth + def f(x) : + return x**2 +\end{envcodepythonminted} +\end{minted} + +produira : + +\begin{envcodepythonminted}*[0.8\linewidth][] + #environnement Python(minted) sans numéro, de largeur 0.8\linewidth + def f(x) : + return x**2 +\end{envcodepythonminted} + +\newpage + \subsection{Console d'exécution Python} \ctex{pythontex} permet également de \textit{simuler} (en exécutant également !) du code python dans une \textit{console}. @@ -833,157 +879,183 @@ Cela peut donner -- en tout cas -- des idées de personnalisation en ayant une b \newpage +\section{Pseudo-Code} + +\subsection{Introduction} + +Le \textsf{package} \ctex{listings} permet d'insérer et de présenter du code, et avec \ctex{tclorobx} on peut obtenir une présentation similaire à celle du code Python. Pour le moment la \textit{philosophie} de la commande est un peu différente de celle du code python, avec son système de \Cle{Clés}, car l'environnement \ctex{tcblisting} est un peu différente\ldots + +\subsection{Présentation de Pseudo-Code} + +L'environnement \ctex{\textbackslash envpseudocode} (chargé par \ctex{ProfLycee} permet de présenter du (pseudo-code) dans une \ctex{tcolorbox}. + +\smallskip + +De plus, le package \ctex{listings} avec \ctex{tcolorbox} ne permet pas de gérer le paramètre \textit{autogobble}, donc il faudra être vigilant quant à la position du code (pas de tabulation en fait\ldots) + + +\begin{minted}[frame=lines,framesep=2mm,bgcolor=LightGray,fontsize=\footnotesize,tabsize=2]{tex} +\begin{envpseudocode}(*)[largeur][options] +%attention à l'indentation, gobble ne fonctionne pas... +... +\end{envpseudocode} +\end{minted} + +Plusieurs \Cle{arguments} (optionnels) sont disponibles : + +\begin{itemize} + \item la version \textit{étoilée} qui permet de pas afficher les numéros de lignes ; + \item le premier argument optionnel concerne la \Cle{largeur} de la \ctex{tcbox} ;\hfill{}défaut \Cle{12cm} + \item le second argument optionnel concerne les \Cle{options} de la \ctex{tcbox} en \textit{langage tcolorbox}.\hfill{}défaut \Cle{vide} +\end{itemize} + +\medskip + +Ainsi le code : + +\begin{minted}[frame=lines,framesep=2mm,bgcolor=lightgray!5,fontsize=\footnotesize,tabsize=4]{tex} +\begin{envpseudocode} +%non centré, de largeur par défaut (12cm) avec lignes +List = [...] # à déclarer au préalable +n = longueur(List) +Pour i allant de 0 à n-1 Faire + Afficher(List[i]) +FinPour +\end{envpseudocode} +\end{minted} + +produira : + +\begin{envpseudocode} +List = [...] # à déclarer au préalable +n = longueur(List) +Pour i allant de 0 à n-1 Faire + Afficher(List[i]) +FinPour +\end{envpseudocode} + +\medskip + +Et le code : + +\begin{minted}[frame=lines,framesep=2mm,bgcolor=lightgray!5,fontsize=\footnotesize,tabsize=4]{tex} +\begin{envpseudocode}*[15cm][center] +%centré, de largeur 15cm sans ligne +List = [...] # à déclarer au préalable +n = longueur(List) +Pour i allant de 0 à n-1 Faire + Afficher(List[i]) +FinPour +\end{envpseudocode} +\end{minted} + +produira : + +\begin{envpseudocode}*[15cm][center] +List = [...] # à déclarer au préalable +n = longueur(List) +Pour i allant de 0 à n-1 Faire + Afficher(List[i]) +FinPour +\end{envpseudocode} + +\newpage + +\section{Terminal Windows/UNiX/OSX} + +\subsection{Introduction} + +L'idée des \textsf{commandes} suivantes est de permettre de simuler des fenêtres de \textsf{Terminal}, que ce soit pour Windows, Ubuntu ou OSX. + +\smallskip + +Le \textsf{contenu} est géré par le package \ctex{listings}, sans langage particulier, et donc sans coloration syntaxique particulière. + +\smallskip + +Comme pour le pseudo-code, pas d'\textsf{autogobble}, donc commandes à aligner à gauche ! + +\subsection{Commandes} + +Les (trois) environnements disponibles sont : + +\begin{minted}[frame=lines,framesep=2mm,bgcolor=lightgray!5,fontsize=\footnotesize,tabsize=4]{tex} +\begin{PLtermwin}[largeur]{titre=...}[options] +... + +\begin{PLtermunix}[largeur]{titre=...}[options] +... + +\begin{PLtermosx}[largeur]{titre=...}[options] +... +\end{minted} + +Peu d'options pour ces commandes : + +\begin{itemize} + \item le premier, optionnel, est la \Cle{largeur} de la \ctex{tcbox} ;\hfill{}défaut \Cle{\textbackslash linewidth} + \item le deuxième, mandataire, permet de spécifier le titre par la clé \Cle{titre}.\hfill{}défaut \Cle{Terminal Windows/UNiX/OSX} + \item le troisième, optionnel, concerne les \Cle{options} de la \ctex{tcbox} en \textit{langage tcolorbox}.\hfill{}défaut \Cle{vide} +\end{itemize} + +\medskip + +Ainsi le code : + +\begin{minted}[frame=lines,framesep=2mm,bgcolor=lightgray!5,fontsize=\footnotesize,tabsize=4]{tex} +\begin{PLtermwin}[15cm]{} %largeur 15cm avec titre par défaut +Microsoft Windows [version 10.0.22000.493] +(c) Microsoft Corporation. Tous droits réservés. + +C:\Users\test>ping -c 2ctan.org +Envoi d'une requête 'ping' sur ctan.org [5.35.249.60] avec 32 octets de données : +\end{PLtermwin} + +\begin{PLtermunix}[12cm]{titre=Terminal Ubuntu}[center] %12cm, avec titre modifié et centré +test@DESKTOP:~$ ping -c 2 ctan.org +PING ctan.org (5.35.249.60) 56(84) bytes of data. +\end{PLtermunix} + +\begin{PLtermosx}[0.5\linewidth]{titre=Terminal MacOSX}[flush right] %1/2-largeur et titre modifié et droite +[test@server]$ ping -c 2 ctan.org +PING ctan.org (5.35.249.60) 56(84) bytes of data. +\end{PLtermosx} +\end{minted} + +produira : + +\begin{PLtermwin}[15cm]{} +Microsoft Windows [version 10.0.22000.493] +(c) Microsoft Corporation. Tous droits réservés. + +C:\Users\test>ping -c 2ctan.org +Envoi d'une requête 'ping' sur ctan.org [5.35.249.60] avec 32 octets de données : +\end{PLtermwin} + +\begin{PLtermunix}[12cm]{titre=Terminal Ubuntu}[center] +test@DESKTOP:~$ ping -c 2 ctan.org +PING ctan.org (5.35.249.60) 56(84) bytes of data. +\end{PLtermunix} + +\begin{PLtermosx}[0.5\linewidth]{titre=Terminal MacOSX}[flush right] +[test@server]$ ping -c 2 ctan.org +PING ctan.org (5.35.249.60) 56(84) bytes of data. +\end{PLtermosx} + +\newpage + \section{Historique} -{\small \bverb|v1.0.2| : Ajout des environnements pour Python +{\small \bverb|v1.0.5| : Ajout d'un environnement pour Python (minted) -{\small \bverb|v1.0.1| : Modification mineure liée au chargement de \ctex{xcolor} +{\small \bverb|v1.0.4| : Ajout des environnements pour Terminal (win, osx, unix) -{\small \bverb|v1.0 | : Version initiale} +{\small \bverb|v1.0.3| : Ajout des environnements pour PseudoCode -%\newpage -% -%\section{Codes du package splinetikz.sty} -% -%\begin{minted}[frame=lines,framesep=2mm,bgcolor=LightGray,fontsize=\footnotesize,tabsize=2]{tex} -%\NeedsTeXFormat{LaTeX2e} -%\ProvidesPackage{splinetikz}[2022/02/10 - v1.0 - Splines cubiques, en TikZ] -% -%%------Packages utiles -%\RequirePackage[dvipsnames,table]{xcolor} -%\RequirePackage{tikz} -%\RequirePackage{pgf,pgffor,pgfplots} -%\pgfplotsset{compat=1.18} -%\RequirePackage{ifthen} -%\RequirePackage{xkeyval} -%\RequirePackage{xfp} -%\RequirePackage{xstring} -%\RequirePackage{simplekv} -%\RequirePackage{listofitems} -%\RequirePackage{xintexpr} -%\usetikzlibrary{decorations.pathreplacing} -%\usetikzlibrary{decorations.markings} -%\usetikzlibrary{arrows.meta} -%\end{minted} -% -%\begin{minted}[frame=lines,framesep=2mm,bgcolor=LightGray,fontsize=\footnotesize,tabsize=2]{tex} -%%------commande utile pour extraire des infos d'une liste -%\newcommand\extractcoeff[2]{% #1=liste & #2=numero -% \setsepchar{§}% -% \readlist\lcoeffs{#1} -% \ifnum \lcoeffslen=1 -% \def\COEFFA{#1} -% \def\COEFFB{#1} -% \else -% \itemtomacro\lcoeffs[#2]\COEFF -% \IfSubStr{\COEFF}{/}% -% {\StrCut{\COEFF}{/}{\COEFFA}{\COEFFB}}% -% {\def\COEFFA{\COEFF}\def\COEFFB{\COEFF}} -% \fi -%} -%\end{minted} -% -%\begin{minted}[frame=lines,framesep=2mm,bgcolor=LightGray,fontsize=\footnotesize,tabsize=2]{tex} -%%------tangente(s) en TikZ, avec point/dérivée ou liste points/dérivées -%\defKV[tgte]{% -% liste=\def\TGTliste{#1},% -% width=\def\TGTepaisseur{#1},% -% couleur=\def\TGTcouleur{#1},% -% xl=\def\TGTXL{#1},% -% xr=\def\TGTXR{#1},% -% style=\def\TGTstyle{#1},% -% point=\def\TGTnumpt{#1} -%} -% -%\setKVdefault[tgte]{ -% liste=,% -% width=1.25pt,% -% couleur=red,% -% xl=0.5,xr=0.5,% -% style=,% -% point=1 -%} -% -%\newcommand\tangentetikz[1][]{% -% \useKVdefault[tgte]% -% \setKV[tgte]{#1}% on paramètres les nouvelles clés et on les simplifie -% \setsepchar[.]{§./}% -% \readlist\TGTlistepoints\TGTliste -% \itemtomacro\TGTlistepoints[\TGTnumpt,1]\xa -% \itemtomacro\TGTlistepoints[\TGTnumpt,2]\ya -% \itemtomacro\TGTlistepoints[\TGTnumpt,3]\fprimea -% \def\TGTDEB{\fpeval{\xa-\TGTXL}}\def\TGTFIN{\fpeval{\xa+\TGTXR}}% -% \draw[line width=\TGTepaisseur,\TGTcouleur,domain=\TGTDEB:\TGTFIN,\TGTstyle] plot (\x,{\fprimea*(\x-\xa)+\ya}) ;% -%} -%\end{minted} -% -%\begin{minted}[frame=lines,framesep=2mm,bgcolor=LightGray,fontsize=\footnotesize,tabsize=2,breaklines]{tex} -%%------splines en tikz avec ..controls -%\defKV[spline]{% -% liste=\def\SPLliste{#1},% -% width=\def\SPLepaisseur{#1},% -% couleur=\def\SPLcouleur{#1},% -% coeffs=\def\SPLcoeffs{#1},% -% couleurpoints=\def\SPLcouleurpoints{#1},% -% taillepoints=\def\SPLtaillepoints{#1},% -% style=\def\SPLstyle{#1} -%} -% -%\setKVdefault[spline]{% -% liste=,% -% width=1.25pt,% -% couleur=red,% -% coeffs=3,% -% couleurpoints=black,% -% taillepoints=2pt,% -% affpoints=false,% -% style= -%} -% -%\newcommand\splinetikz[1][]{% -% \useKVdefault[spline] -% \setKV[spline]{#1}% on paramètres les nouvelles clés et on les simplifie -% %on lit la liste des points/nbderivés et on stocke dans \listepoints -% \setsepchar[.]{§./} -% \readlist\SPLlistepoints\SPLliste -% \def\SPLnbsplines{\inteval{\SPLlistepointslen-1}} -% %si uniquement deux points, pas de boucle... -% \ifnum \SPLlistepointslen=2 -% %extraction des coeffs de compensation -% \extractcoeff{\SPLcoeffs}{1} -% %extraction des coordonnées -% \itemtomacro\SPLlistepoints[1,1]\xa -% \itemtomacro\SPLlistepoints[1,2]\ya -% \itemtomacro\SPLlistepoints[1,3]\fprimea -% \itemtomacro\SPLlistepoints[2,1]\xb -% \itemtomacro\SPLlistepoints[2,2]\yb -% \itemtomacro\SPLlistepoints[2,3]\fprimeb -% \draw[line width=\SPLepaisseur,\SPLcouleur,\SPLstyle] (\xa,\ya) ..controls +({atan \fprimea}:{(\xb-\xa)/\COEFFA}) and +({-180 + atan \fprimeb}:{(\xb-\xa)/\COEFFA}).. (\xb,\yb) ;% -% %sinon on construit bout par bout ! -% \else -% \foreach \i in {1,2,...,\SPLnbsplines}{ -% %extraction des coeffs de compensation -% \extractcoeff{\SPLcoeffs}{\i} -% \def\j{\inteval{\i+1}} -% \itemtomacro\SPLlistepoints[\i,1]\xa -% \itemtomacro\SPLlistepoints[\i,2]\ya -% \itemtomacro\SPLlistepoints[\i,3]\fprimea -% \itemtomacro\SPLlistepoints[\j,1]\xb -% \itemtomacro\SPLlistepoints[\j,2]\yb -% \itemtomacro\SPLlistepoints[\j,3]\fprimeb -% \draw[line width=\SPLepaisseur,\SPLcouleur,\SPLstyle] (\xa,\ya) ..controls +({atan \fprimea}:{(\xb-\xa)/\COEFFA}) and +({-180 + atan \fprimeb}:{(\xb-\xa)/\COEFFB}).. (\xb,\yb) ;% -% } -% \fi -% \ifboolKV[spline]{affpoints}%on affiche les points de contrôle -% {% -% \foreach \i in {1,2,...,\SPLlistepointslen}{% -% \itemtomacro\SPLlistepoints[\i,1]\xa -% \itemtomacro\SPLlistepoints[\i,2]\ya -% \filldraw[\SPLcouleurpoints] (\xa,\ya) circle[radius=\SPLtaillepoints] ;% -% } -% } -% {} -%} -%\end{minted} +{\small \bverb|v1.0.2| : Ajout des environnements pour Python (pythontex) + +{\small \bverb|v1.0.1| : Modification mineure liée au chargement de \ctex{xcolor} + +{\small \bverb|v1.0 | : Version initiale} \end{document} \ No newline at end of file diff --git a/macros/latex/contrib/proflycee/tex/ProfLycee.sty b/macros/latex/contrib/proflycee/tex/ProfLycee.sty index ceaf2ef191..8938888868 100644 --- a/macros/latex/contrib/proflycee/tex/ProfLycee.sty +++ b/macros/latex/contrib/proflycee/tex/ProfLycee.sty @@ -3,22 +3,29 @@ % or later, see http://www.latex-project.org/lppl.txtf \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{ProfLycee}[2022/02/13 - v1.0.2 - Aide pour l'utilisation de LaTeX en lycée] +\ProvidesPackage{ProfLycee}[2022/02/16 - v1.0.5 - Aide pour l'utilisation de LaTeX en lycée] +% 1.0.5 Environnement code python avec minted +% 1.0.4 Environnement pour simuler terminal windows & linux +% 1.0.3 Environnement pour présenter du pseudocode % 1.0.2 Environnement pour présenter du code python (avec pythontex) % 1.0.1 Modif mineure du chargement de xcolor (compatibilité avec d'autres packages notamment...) % 1.0 Version initiale %------Packages utiles \RequirePackage[table,svgnames]{xcolor}%Gestion des couleurs +\RequirePackage{amssymb} \RequirePackage{tikz} \RequirePackage{pgf,pgffor} \RequirePackage{ifthen} +\RequirePackage{environ} +\RequirePackage{xparse} \RequirePackage{xkeyval} \RequirePackage{xfp} \RequirePackage{xstring} \RequirePackage{simplekv} \RequirePackage{listofitems} \RequirePackage{xintexpr} +\RequirePackage{tabularray} \RequirePackage{fontawesome5} %librairies tikz \usetikzlibrary{calc} @@ -248,7 +255,6 @@ {} } - %=========CONSOLEPYTHON=========== OK !! \defKV[envpythonconsole]{% largeur=\def\CSPYlargeur{#1},% @@ -309,7 +315,7 @@ top=2pt,bottom=1pt,left=6pt,right=6pt }, fonttitle=\color{ForestGreen}\itshape\ttfamily\footnotesize, - title={\scriptsize\faPython}\:Code Python\vphantom{/}, + title={\scriptsize\faPython}\:Code Python\vphantom{p}, watermark text={\faPython},watermark opacity=0.175,watermark zoom=0.50, } } @@ -358,4 +364,284 @@ \verbcenterpost } +%=========PYTHONMINTED========= OK !! +\tcbuselibrary{minted} + +\tcbset{pytmintedno/.style={% + listing engine=minted,minted style=colorful, + minted language=python,listing only, + minted options={tabsize=4,fontsize=\small,autogobble}, + } +} + +\tcbset{pytminted/.style={% + listing engine=minted,minted style=colorful, + minted language=python,listing only, + minted options={tabsize=4,fontsize=\small,autogobble,xleftmargin=16pt,linenos,numbersep=10pt}, + } +} + +\DeclareTCBListing{envcodepythonminted}{ s O{12cm} O{} }{% étoilée sans numéro, taille puis option... + \IfBooleanTF{#1}{pytmintedno}{pytminted}, + enhanced,width=#2,#3, + colframe=Green,colback=ForestGreen!5,% + boxrule=1.25pt, + sharp corners=downhill,arc=12pt, + before skip=12pt,after skip=12pt,% + leftupper=8pt,top=10pt,bottom=4pt,rightupper=4pt,% + attach boxed title to top right={yshift=-\tcboxedtitleheight}, + boxed title style={ + size=small,colback=ForestGreen!25,boxrule=1.25pt, + colframe=Green,boxsep=1.25pt, + sharp corners=downhill, + arc=12pt, + top=2pt,bottom=1pt,left=6pt,right=6pt + }, + fonttitle=\color{ForestGreen}\itshape\ttfamily\footnotesize, + title={\scriptsize\faPython}\:Code Python\vphantom{y}, + watermark text={\faPython},watermark opacity=0.175,watermark zoom=0.50, + before upper = \renewcommand{\theFancyVerbLine}{\scriptsize\ttfamily\color{Green}\arabic{FancyVerbLine}} +} + +%=========PSEUDOCODE=========== OK !! +\ifluatex + \tcbuselibrary{listings} + \lstdefinelanguage{langnat}{% + keywords={}, + inputencoding=utf8, + comment=[l]{}} +\else + \tcbuselibrary{listingsutf8} + \lstdefinelanguage{langnat}{% + keywords={}, + inputencoding=utf8/latin1, + comment=[l]{}} +\fi + +%language pseudocode listings +\lstdefinestyle{pseudocodePL}{% + language=langnat, + basicstyle=\footnotesize\ttfamily, + numberstyle=\scriptsize\ttfamily\color{gray}, + keywordstyle=\bfseries, + stringstyle=\color{red!75}, + keepspaces=true, + tabsize=4,numbersep=10pt, + xleftmargin=14pt, + numbers=left, + morestring=[b]", + showstringspaces=false, + %showtabs=false, + escapeinside={(*}{*)} +} + +\lstdefinestyle{pseudocodenoPL}{% + language=langnat, + basicstyle=\footnotesize\ttfamily, + numberstyle=\scriptsize\ttfamily\color{gray}, + keywordstyle=\bfseries, + stringstyle=\color{red!75}, + keepspaces=true, + tabsize=4,numbersep=10pt, + numbers=none, + showstringspaces=false, + morestring=[b]", + %showtabs=true, + escapeinside={(*}{*)} +} + +%style tcbox pseudocode avec bannière hautdroite +\tcbset{stylepseudocodePL/.style={% + %fontupper=\small\sffamily,% + enhanced,boxrule=1.25pt,sharp corners=downhill,arc=12pt, + before skip=12pt,after skip=12pt,leftupper=10pt,top=8pt,bottom=2pt,rightupper=4pt,% + attach boxed title to top right={yshift=-\tcboxedtitleheight}, + boxed title style={ + size=small,colback=gray!25,boxrule=1.25pt, + colframe=darkgray,boxsep=1.25pt, + sharp corners=downhill, + arc=12pt, + top=2pt,bottom=1pt,left=6pt,right=6pt + }, + fonttitle=\color{darkgray}\ttfamily\footnotesize, + title={\scriptsize\faFileCode}\:\textit{Pseudo-Code}\vphantom{p}, + watermark text={\faCode},watermark opacity=0.175,watermark zoom=0.50, + } +} + +\ifluatex + \newcommand\algomathttPL[1]{\symtt{#1}} +\else + \newcommand\algomathttPL[1]{\mathtt{#1}} +\fi + +\DeclareTCBListing{envpseudocode}{ s O{12cm} O{} }{% étoilée sans numéro, taille puis option... + width=#2,#3, + stylepseudocodePL, + listing only,listing engine=listings, + listing options={ + style=\IfBooleanTF{#1}{pseudocodenoPL}{pseudocodePL},%version étoilée sans numéro de lignes + aboveskip=2pt,belowskip=2pt, + columns=fullflexible, + literate={é}{{\'e}}1 {í}{{\'i}}1 {ó}{{\'o}}1% + {ú}{{\'u}}1 {Á}{{\'A}}1 {É}{{\'E}}1 {Í}{{\'I}}1 {Ó}{{\'O}}1 {Ú}{{\'U}}1% + {è}{{\`e}}1 {ì}{{\`i}}1 {ò}{{\`o}}1 {ù}{{\`u}}1% + {À}{{\`A}}1 {È}{{\'E}}1 {Ì}{{\`I}}1 {Ò}{{\`O}}1 {Ù}{{\`U}}1% + {ä}{{\"a}}1 {ë}{{\"e}}1 {ï}{{\"i}}1 {ö}{{\"o}}1 {ü}{{\"u}}1% + {Ä}{{\"A}}1 {Ë}{{\"E}}1 {Ï}{{\"I}}1 {Ö}{{\"O}}1 {Ü}{{\"U}}1% + {â}{{\^a}}1 {ê}{{\^e}}1 {î}{{\^i}}1 {ô}{{\^o}}1 {û}{{\^u}}1% + {Â}{{\^A}}1 {Ê}{{\^E}}1 {Î}{{\^I}}1 {Ô}{{\^O}}1 {Û}{{\^U}}1% + {œ}{{\oe}}1 {Œ}{{\OE}}1 {æ}{{\ae}}1 {Æ}{{\AE}}1 {ß}{{\ss}}1% + {ű}{{\H{u}}}1 {Ű}{{\H{U}}}1 {ő}{{\H{o}}}1 {Ő}{{\H{O}}}1% + {ç}{{\c c}}1 {Ç}{{\c C}}1 {ø}{{\o}}1 {å}{{\r a}}1 {Å}{{\r A}}1% + {€}{{\texteuro}}1 {£}{{\pounds}}1% + {=}{\textleftarrow}1 {==}{=}1% + {*}{$\algomathttPL{\times}$}{1}% + } +} + +%============FakeTerm=========== +%couleurs (inspirées par termsim !) +\definecolor{PLmpurple}{RGB}{48,10,36} +\definecolor{PLmgray}{RGB}{70,72,67} +\definecolor{PLogray}{RGB}{148,147,141} +\definecolor{PLoorange}{RGB}{233,101,56} +\definecolor{PLterminal}{RGB}{80,78,70} +\definecolor{PLlinux}{RGB}{0,39,51} +\definecolor{PLwinblue}{HTML}{1883D7} +\definecolor{PLosxgray}{HTML}{D8D6D9} + +%WINDOWS +\tcbset{PLfaketermwin/.style={% + enhanced,boxrule=1pt,sharp corners,before skip=12pt,after skip=12pt,% + colframe=PLwinblue,colback=black,colbacktitle=white,colupper=white,coltitle=black,% + titlerule=0.4pt,left=2pt,top=2pt,bottom=2pt,right=2pt,middle=2pt,% + fonttitle=\bfseries\small\sffamily + } +} + +\setKVdefault[fakeTERMwin]{titre={Terminal Windows}} + +\newcommand\PLcommandeswin{% + \begin{tikzpicture}[thick,scale=0.66] + \draw (0,0)--(1em,0) ; \draw (2em,0) rectangle (3em,1em) ; \draw (4em,1em)--(5em,0) (4em,0)--(5em,1em) ; + \end{tikzpicture}% +} + +\newcommand\termwintitre[1][]{% + \restoreKV[fakeTERMwin] + \setKV[fakeTERMwin]{#1} + \begin{tblr}{colsep=0pt,rowsep=0pt,width=\linewidth,colspec={X[l]r}} + {\footnotesize\faTerminal}~~\useKV[fakeTERMwin]{titre} & \PLcommandeswin \\ % + \end{tblr} +} + +\DeclareTCBListing{PLtermwin}{ O{\linewidth} m !O{} }{%[taille] puis {titre=...} puis [option] + PLfaketermwin,title={\termwintitre[#2]},% + listing only,listing engine=listings,% + listing options={style=tcblatex,language={},basicstyle=\footnotesize\ttfamily},% + width=#1,#3 +} + +%LINUX +\newcommand{\PLUbuntuWhite}{% + \begin{tikzpicture}[thick,anchor=base,baseline] + \filldraw[PLmgray] (0,0.25em) circle[radius=0.5em] ; + \end{tikzpicture}% +} +\newcommand{\PLUbuntuMin}{% + \begin{tikzpicture}[thick,anchor=base,baseline] + \filldraw[color=PLogray!50!white] (0,0.25em) circle[radius=0.5em]; + \draw[PLterminal](-0.35em,0.25em)--(0.35em,0.25em); + \end{tikzpicture}% +} +\newcommand{\PLUbuntuClose}{% + \begin{tikzpicture}[thick,anchor=base,baseline] + \filldraw[color=PLoorange!70!white] (0,0.25em) circle[radius=0.5em]; + \draw[PLterminal] (-0.32em,-0.07em)--(0.32em,0.57em); + \draw[PLterminal] (-0.32em,0.57em)--(0.32em,-0.07em); + \end{tikzpicture}% +} +\newcommand{\PLUbuntuMax}{% + \begin{tikzpicture}[thick,anchor=base,baseline] + \filldraw[color=PLogray!50!white] (0,0.25em) circle[radius=0.5em]; + \draw[PLterminal] (-0.32em,0.5em) rectangle (0.32em,0); + \end{tikzpicture}% +} + +\tcbset{PLtermlinux/.style={% + enhanced,boxrule=1pt,arc=4pt,before skip=12pt,after skip=12pt,% + colframe=PLmgray,colback=PLmpurple,colbacktitle=PLmgray,colupper=white,coltitle=white,% + titlerule=0.4pt,left=2pt,top=2pt,bottom=2pt,right=2pt,middle=2pt,% + fonttitle=\bfseries\small\sffamily + } +} + +\setKVdefault[fakeTERMnux]{titre={Terminal UNiX}} + +\newcommand\termnuxtitre[1][]{% + \restoreKV[fakeTERMnux] + \setKV[fakeTERMnux]{#1} + \begin{tblr}{colsep=0pt,rowsep=0pt,width=\linewidth,colspec={lX[c]r}} + \PLUbuntuWhite~~\PLUbuntuWhite~~\PLUbuntuWhite & \vphantom{p}\useKV[fakeTERMnux]{titre} & \PLUbuntuMin~~\PLUbuntuMax~~\PLUbuntuClose \\ + \end{tblr} +} + +\DeclareTCBListing{PLtermunix}{ O{\linewidth} m !O{} }{%[taille] puis {titre=...} puis [option] + PLtermlinux,title={\termnuxtitre[#2]},% + listing only,listing engine=listings,% + listing options={style=tcblatex,language={},basicstyle=\footnotesize\ttfamily},% + width=#1,#3 +} + +%OSX +\tcbset{PLfaketermosx/.style={% + enhanced,boxrule=1pt,arc=6pt,before skip=12pt,after skip=12pt,% + colframe=PLosxgray,colback=lightgray!15,colbacktitle=PLosxgray,colupper=black,coltitle=black,% + titlerule=0.4pt,left=2pt,top=2pt,bottom=2pt,right=2pt,middle=2pt,% + fonttitle=\bfseries\small\sffamily + } +} + +\newcommand{\PLOSXRed}{% + \begin{tikzpicture}[thick,anchor=base,baseline] + \filldraw[red] (0,0.25em) circle[radius=0.45em] ; + \end{tikzpicture}% +} + +\newcommand{\PLOSXOrange}{% + \begin{tikzpicture}[thick,anchor=base,baseline] + \filldraw[orange] (0,0.25em) circle[radius=0.45em] ; + \end{tikzpicture}% +} + +\newcommand{\PLOSXGreen}{% + \begin{tikzpicture}[thick,anchor=base,baseline] + \filldraw[ForestGreen] (0,0.25em) circle[radius=0.45em] ; + \end{tikzpicture}% +} + +\newcommand{\PLOSXLG}{% + \begin{tikzpicture}[thick,anchor=base,baseline] + \filldraw[PLosxgray] (0,0.25em) circle[radius=0.45em] ; + \end{tikzpicture}% +} + +\setKVdefault[fakeTERMosx]{titre={Terminal OSX}} + +\newcommand\termosxtitre[1][]{% + \restoreKV[fakeTERMosx] + \setKV[fakeTERMosx]{#1} + \begin{tblr}{colsep=0pt,rowsep=0pt,width=\linewidth,colspec={lX[c]r}} + \PLOSXRed~\PLOSXOrange~\PLOSXGreen & \vphantom{p}\useKV[fakeTERMosx]{titre} & \PLOSXLG~\PLOSXLG~\PLOSXLG \\ + \end{tblr} +} + +\DeclareTCBListing{PLtermosx}{ O{\linewidth} m !O{} }{%[taille] puis {titre=...} puis [option] + PLfaketermosx,title={\termosxtitre[#2]},% + listing only,listing engine=listings,% + listing options={style=tcblatex,language={},basicstyle=\footnotesize\ttfamily},% + width=#1,#3 +} + \endinput \ No newline at end of file diff --git a/macros/latex/contrib/wrapfig2/README.txt b/macros/latex/contrib/wrapfig2/README.txt index 720a426f33..368a0784d0 100644 --- a/macros/latex/contrib/wrapfig2/README.txt +++ b/macros/latex/contrib/wrapfig2/README.txt @@ -1,5 +1,5 @@ %%%% README.txt file -This README.txt for package wrapfig2[2022-01-26 v.5.0.7 ...] +This README.txt for package wrapfig2[2022-02-16 v.6.0.0 ...] This work is author maintained @@ -27,6 +27,9 @@ older than 1st January 2019. In any case this package loading is aborted in order to avoid conflicts, and in some other circumstances; the error messages describe why the process was aborted. +Version 6 of this package accepts options in the form key=value. +Options are available to fall back to version 5 and version 4. + Claudio Beccari claudio dot beccari at gmail dot com \ No newline at end of file diff --git a/macros/latex/contrib/wrapfig2/commodilla.jpg b/macros/latex/contrib/wrapfig2/commodilla.jpg deleted file mode 100644 index 4c8dc01e2e..0000000000 Binary files a/macros/latex/contrib/wrapfig2/commodilla.jpg and /dev/null differ diff --git a/macros/latex/contrib/wrapfig2/stele-todi-small.jpg b/macros/latex/contrib/wrapfig2/stele-todi-small.jpg new file mode 100644 index 0000000000..8f85df10a8 Binary files /dev/null and b/macros/latex/contrib/wrapfig2/stele-todi-small.jpg differ diff --git a/macros/latex/contrib/wrapfig2/wrapfig2.dtx b/macros/latex/contrib/wrapfig2/wrapfig2.dtx index 55147dcd01..dbcec7a0c6 100644 --- a/macros/latex/contrib/wrapfig2/wrapfig2.dtx +++ b/macros/latex/contrib/wrapfig2/wrapfig2.dtx @@ -45,7 +45,7 @@ wrapfig2.sty and wrapfig2.pdf, plus this file README.txt. %<+package>\ProvidesPackage{wrapfig2}% %^^A<+readme>File README.txt for package wrapfig2 %<*package|readme> - [2022-01-26 v.5.0.7 Wrap text around figures, tables, framed text blocks] + [2022-02-16 v.6.0.0 Wrap text around figures, tables, framed text blocks] % %<*driver> % @@ -65,6 +65,7 @@ wrapfig2.sty and wrapfig2.pdf, plus this file README.txt. \date{Version \fileversion~--~Last revised \filedate.} % \providecommand*\diff{\mathop{}\!\mathrm{d}} +\providecommand*\ped[1]{\ensuremath{_{\mathrm{#1}}}} \renewcommand\meta[1]{{\normalfont\textlangle\textit{#1}\textrangle}} \renewcommand\marg[1]{\texttt{\{\meta{#1}\}}} \providecommand\opz{} @@ -156,7 +157,7 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % % \begin{abstract} % This new package \pack{wrapfig2} is a fork that extends Donald -% Arseneau's package \pack{wrapfig} (version 2.6, dated 2003) by +% Arseneau's package \pack{wrapfig} (version 3.6, dated 2003) by % adding some \LaTeXiii definitions that accept a final optional star; % its presence changes the meaning of the first optional % argument so that it becomes a correction to the number of lines @@ -166,8 +167,9 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % to wrap a small framed text block on a coloured background; the % philosophy of this new environment is similar to that of the % other two environments, but the syntax was different with -% version~4.0 of this package, and is very similar with this -% version 5.0. A fall back option is available for backwards +% version~4 of this package, and is very similar with +% version 5.0; a further important enhancement is implemented +% in version~6. Fall back options are available for backwards % compatibility. % \end{abstract} % @@ -189,14 +191,12 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi %^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % The purpose of this package is manyfold. On one side it tries -% to modernise the original software by Donald Arseneau by -% upgrading it to the \LaTeXiii modern language. On another it +% to upgrade the original software by Donald Arseneau by +% using some parts of the \LaTeXiii modern language. On another it % creates a new environment, with the same philosophy % of the original Arseneau's ones, such that a document author -% can emphasise short blocks of text by framing them while -% typesetting the text on a coloured background by means of -% the \pack{curve2e} functionalities, and wrapping this -% inserted text with the surrounding main text. +% can emphasise short blocks of wrapped text by framing them while +% typesetting the text on a coloured background. % % The original software had some idiosyncrasies; Donald Arseneau % described them in the documentation of his package; we are sorry @@ -223,15 +223,16 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % section; or at the beginning of a chapter that starts with plain % text, in particular just at the beginning of the first paragraph. % -% The code of this package does very little if anything to correct +% The code of this package does very little, if anything, to correct % such idiosyncrasies. They are caused by the limitations of the % \cs{ShipOut} \LaTeXe kernel macro, and very little we were able % to do in addition to what Arseneau already did. % -% Another purpose of this package is to add an optional argument +% Another purpose of this package is to add another optional argument % so that the \meta{number of indented lines} argument does not mean % the total number, but the correction number to add-to or subtract-from % the value computed by the default mechanism devised by Arseneau. +% % We assume that most users first use the software to insert an object % to be wrapped by the surrounding text without specifying any value % with the specific optional argument; then they evaluate the result, @@ -248,28 +249,33 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % to a user who was asking for such an arrangement; the solution % resorted to a specific use of the \Env{wrapfigure} environment and % used the \Env{tcolorbox} environment. +% % We thought that an \emph{ad hoc} solution would be a better one, % since the parameters to be used for a figure have nothing or % little to do with a text, therefore most of them would be useless % with a wrapped text. Nevertheless the \meta{location} of the wrapped % text and the optional correction of the indented lines number would % still be necessary. We added also the possibility of optionally -% specifying the measure of the wrapped text, even if this measure -% should not be too different from a half the wrapping text measure. +% specifying the measure of the wrapped text, even if it +% should not be too different from a half of the wrapping text measure. % In facts, with a value too different from \texttt{0.5\cs{linewidth}} % either the wrapped text has problems with inter word spaces and % hyphenation because of the small measure, or, on the opposite, the % indented lines of the wrapping text would have similar problems. % -% Notice that the first implementation of this package, version~4.0, +% Notice that the first implementation of this package, version~4, % achieved the desired result but there were two drawbacks: $(a)$ -% the syntax was different from that of the other environments, +% the syntax was rather different from that of the other environments, % and $(b)$ any possible caption was typeset within the same -% framing environment. In version~5.0 both drawbacks were +% framing environment. In version~5 both drawbacks were % eliminated, but since the environment syntax is different, % in oder to assure backwards compatibility a package option -% was defined in order to fall back to the previous version~4.0 -% behaviour. +% was defined in order to fall back to the previous version~4 +% behaviour. In version 6.0 the \Env{wraptext} environment was +% further enhanced so as to accept several \texttt{key=value} settings +% concerned wit the text appearance, the colours, and other details +% relative to the wrapping process. Again another fall back option +% was defined in order to use the same functionalities of version~5. % %^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \section{Environment syntax} @@ -284,9 +290,9 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % requires the first four optional and mandatory arguments to be % maintained identical. When the optional star is specified, the % \meta{indented lines number} is interpreted as the correction to the -% computed number. +% computed value. % -% Notice the different syntax in version 4.0 and version 5.0 of the +% Notice the different syntax in versions~4, 5, and~6 of the % \Env{wraptext} syntax. % % \begin{ttsintassi}\setfontsize{8.00} @@ -298,40 +304,52 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi %\qquad\meta{table} %\Eambiente{wraptable} %~ -%\textnormal{\color{red}Package option \opt{WFold} required for backwards compatibility with version 4.0.*}. +%\textnormal{\color{red}Package option \opt{WFold} required for backwards compatibility with version 4.*}. %~ %\Bambiente{wraptext}\oarg{location}\barg{width}\aarg{indented line number correction}\parg{caption label} %\qquad\meta{text to frame} %\Eambiente{wraptext} %~ -%\textnormal{\color{red}No package option required for version 5.0.*}. +%\textnormal{\color{red}Package option \opt{WFfive} required for backwards compatibility with version 5.*}. %~ -%\Bambiente{wraptext}\oarg{indented lines number correction} \marg{location} \oarg{overhang} \oarg{width} +%\Bambiente{wraptext}\oarg{indented lines number correction} \marg{location} \oarg{overhang} \marg{width} %\qquad \meta{optional colour settings} -%\qquad\cs{includeframedtext}\marg{text to frame}\Oarg{\meta{frame thickness},\meta{frame separation}} +%\qquad\cs{includeframedtext}\oarg{insertion measure}\marg{text to frame}\oarg{\meta{frame thickness},\meta{frame separation}}\oarg{radius} +%\Eambiente{wraptext} +%~ +%\textnormal{\color{red} No package option required for version~6.*}. +%~ +%\Bambiente{wraptext}\oarg{indented lines number correction}\marg{location}\oarg{overhang}\marg{width} +%\qquad \meta{optional style settings} +%\qquad\cs{includeframedtext}\oarg{insertion measure}\marg{text to frame}\oarg{settings}\oarg{radius} %\Eambiente{wraptext} % \end{ttsintassi} %^^A -% Please notice that both syntaxes, thanks to differently +% Please notice that all three syntaxes, thanks to differently % delimited optional arguments with peculiar default values, % become very similar when such optional arguments are reduced % to a minimum; only the \meta{location} argument is delimited % by brackets with the old version and with braces with the newer -% one. +% ones. % % It may be useful to compare the \cs{includeframedtext} macro, % used to insert a framed test into a \Env{wraptext} environment, -% with \cs{includegrphics}, used to insert an external image into +% with \cs{includegraphics}, used to insert an external image into % a \Env{figure} environment. Their functions are similar even if % they refer to different objects to include. Their codes are % obviously very different and the latter is much more complex % than the former. The solution for a framed text used by -% version~4.0 was inspired by the information found on +% version~4 was inspired by the information found on % \texttt{texstackexchange} that used the very elaborate \Env{tcolorbox} -% environment; version~5.0 uses instead a much simpler command +% environment; version~5 uses instead a much simpler command % \cs{framedbox} based on the \pack{curve2e} package macro -% \cs{Curve}. As it can be seen, the logic behind these different -% macros are very similar. +% \cs{Curve}. Version 6.0 admits many settings, not just the +% \meta{frame thickness} and the space around the framed text, but +% several others ones collectively indicated with \meta{settings}; +% such settings refer to colours, dimensions, styles, and so on, +% relative to the text and to the frame; moreover they are set by +% means of the \texttt{key=value} syntax. As it can be seen, the +% logic, not the code, behind these different macros are very similar. % %^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\section{Examples} @@ -345,9 +363,19 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % \subsection{A wrapped figure} %^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % +% +%\begin{wrapfigure}{r}{50mm} +%\centering\unitlength=1mm +%\begin{picture}(40,30) +%\polygon(0,0)(40,0)(40,30)(0,30) +%\Line(0,0)(40,30)\Line(0,30)(40,0) +%\end{picture} +%\caption{A rectangle with its diagonals}\label{fig:figure} +%\end{wrapfigure} +%{\itshape \kant[1]} % The code used to type figure~\ref{fig:figure} is the following: % -%\begin{flushleft}\obeylines% +%\begin{flushleft}\ttfamily\obeylines% %\noindent\Bambiente{wrapfigure}\Marg{r}\Marg{50mm} %\cs{centering}\cs{unitlength}=1mm %\Bambiente{picture}\texttt{(40,30)} @@ -362,33 +390,10 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % No asterisk was used because the package succeeded to correctly % compute the necessary number of indented lines. % -%\begin{wrapfigure}{r}{50mm} -%\centering\unitlength=1mm -%\begin{picture}(40,30) -%\polygon(0,0)(40,0)(40,30)(0,30) -%\Line(0,0)(40,30)\Line(0,30)(40,0) -%\end{picture} -%\caption{A rectangle with its diagonals}\label{fig:figure} -%\end{wrapfigure} -%{\itshape \kant[1]} -% %^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \subsection{A wrapped table} %^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Wrapping a small table is a little more difficult than wrapping -% a figure, because the width of the inserted object is not known -% exactly in advance and is difficult to estimate; therefore it is -% possible that several trial compilations are necessary. In any -% case a \cs{centering} command might help to center the table -% within the indention of the wrapping text. Nevertheless the -% software can compute the object width if a zero value is specified -% or if the \meta{width} parameter is completely omitted together -% with its braces; this second possibility is a feature of this -% package, that uses a \LaTeXiii property by which even a braced -% argument can be treated as an optional argument with a predefined -% default value; see below more details about this feature. -% -%\begin{wraptable}{l} +%\begin{wraptable}[-1]{l}* %\centering % \begin{tabular}{cc} % \hline @@ -396,14 +401,14 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % Third & Fourth\\ % \hline %\end{tabular} -%\caption{A small table} +%\caption{A small table}\label{tab;small-table} %\end{wraptable} %{\itshape \kant[2]} % -% The above wrapped small table has been typeset by means of the -% following code. +% The wrapped small table~\ref{tab;small-table} has been typeset +% by means of the following code. %\begin{flushleft}\ttfamily\obeylines -%\Bambiente{wraptable}\Marg{l} +%\Bambiente{wraptable}\Oarg{-1}\Marg{l}* %\quad\cs{centering} %\quad\Bambiente{tabular}\Marg{cc} %\qquad\cs{hline} @@ -413,20 +418,21 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi %\quad\Eambiente{tabular} %\quad\cs{caption}\Marg{A small table} %\Eambiente{wraptable} -%\Marg{\cs{\itshape} \cs{kant}\Oarg{2}} +%\Marg{\cs{itshape} \cs{kant}\Oarg{2}} %\end{flushleft} % -% You notice the absence of the braced width value; as said above, -% this braced value is optional, and the software autonomously -% computes the width of the wrapped object. This feature may be -% useful in many instances, although a smart use of -% this width parameter might yield better looking results. -% -% On the opposite if the user estimates that the table with its -% caption might use 5~lines, and specified such a value as the -% first (optional) argument to the environment, the result would -% be the following poor one, with the last caption line overlapping the -% wrapping text. +% Wrapping a small table is a little more difficult than wrapping +% a figure, because the width of the inserted object is not known +% exactly in advance, and it is difficult to estimate; therefore +% it might be necessary to execute several trial compilations. In any +% case a \cs{centering} command might help to center the table +% within the indention of the wrapping text. Nevertheless the +% software can compute the object width if a zero value is specified, +% or if the \meta{width} parameter is completely omitted together +% with its braces; this second possibility is a feature of this +% package, that uses a \LaTeXiii property by which even a braced +% argument can be treated as an optional argument with a predefined +% default value; see below more details about this feature. % %\begin{wraptable}[5]{l} %\centering @@ -436,12 +442,24 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % Third & Fourth\\ % \hline %\end{tabular} -%\caption{A small table} +%\caption{A small table}\label{tab:wrong-wrapped-table} %\end{wraptable} %{\itshape \kant[2]} % +% Notice the absence of the braced width value; as said above, +% this braced value is optional, and the software autonomously +% computes the width of the wrapped object. This feature may be +% useful in many instances, although a smart use of +% this width parameter might yield better looking results. +% +% On the opposite if the user estimates that the table with its +% caption might use 5~lines, and specified such a value as the +% first (optional) argument to the environment, the result is +% shown in table~\ref{tab:wrong-wrapped-table}, but it is a very +% poor one, with the last caption line overlapping the wrapping text. +% %^^A\goodpagebreak -% \newpage +%^^A \newpage % %^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \subsection{A wrapped text} @@ -457,15 +475,15 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % \Bamb{wraptext}\Marg{l} % \cs{includeframedtext}\Marg{\ttfamily Text, text, text, text, text, text, text, text, text, text, text.} % \Eamb{wraptext} -% \Marg{\itshape \cs{kant}[3]} +% \Marg{\cs{itshape} \cs{kant}[3]} %\end{flushleft} % -% The result is the same as that obtainable with version~4.0 of this -% package where the \meta{location} argument specification is braced +% The result is the same as that obtainable with version~4 of this +% package, but the \meta{location} argument specification is braced % instead of bracketed. % -% If a caption is specified, version~4.0 would print it within the -% framed box, while version 5.0 prints it outside the framed box. +% If a caption is specified, version~4 would print it within the +% framed box, while versions~5 and~6 print it outside the framed box. % % \begin{wraptext}{r} % \includeframedtext{Text, text, text, text, text, text, text, text, text, text, text.} @@ -473,7 +491,7 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % \end{wraptext} % {\itshape \kant[3]} % -% The further feature introduced by version~5.0.* is the +% The further feature introduced by version~5 is the % possibility of choosing the colours for all three elements of the % framed text; if within the environment \Env{wraptext} and before using % \cs{includeframedtext} the following colours are set, it is @@ -484,31 +502,152 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi %\cs{SetWFbgd}\marg{background colour} %\cs{SetWFtxt}\marg{text colour} % \end{ttsintassi} -%See figure~\ref{fig:framed text} +% Such commands, in version~6, are already taken care by the relevant +% \texttt{key=value} options. With version~5 these are user commands. +% See figure~\ref{fig:framed text} typeset with various version~6 +% options. % %\begin{figure} -%\includeframedtext[0.45\linewidth]{Text}\hspace{9mm}% -%\includeframedtext[0.45\linewidth]{Text}[3pt,1ex]\\[2ex] -%{\SetWFtxt{red}\includeframedtext[0.45\linewidth]{Text}[2pt,0.6em]}\hspace{9mm}% -%{\Large\includeframedtext[0.45\linewidth]{Text}[1pt,1ex]}\\[2ex] -%{\SetWFbgd{yellow}\includeframedtext[0.45\linewidth]{Text}}\hspace{9mm}% -%{\SetWFfrm{blue}\SetWFbgd{yellow}\includeframedtext[0.45\linewidth]{Text}[3pt,1ex]}% +%\makebox[\textwidth]{\includeframedtext{Text}[insertionwidth=0.45\linewidth] +%\hfill +%\includeframedtext{Text}[insertionwidth=0.45\linewidth,fboxrule=3pt]}\\[2ex] +%\makebox[\textwidth]{\includeframedtext{Text}[insertionwidth=0.45\linewidth,textcolor=red,fboxrule=2pt] +%\hfill +%\includeframedtext{Text}[insertionwidth=0.45\linewidth,fontstyle=\Large]}\\[2ex] +%\makebox[\textwidth]{\includeframedtext{Text}[insertionwidth=0.45\linewidth,backgroundcolor=yellow] +%\hfill +%\includeframedtext{Text}[insertionwidth=0.45\linewidth,framecolor=blue,backgroundcolor=yellow,fboxrule=1mm]}\\[2ex] +% \makebox[\textwidth]{\includeframedtext{Text}[insertionwidth=0.5\linewidth, fboxrule=0pt, backgroundcolor=cyan, textcolor=white, fontstyle=\Huge\bfseries]} %\caption{Some framed text boxes with different dimension parameters, % different font size, and different colours}\label{fig:framed text} %\end{figure} % +% Figure~\ref{fig:framed text} used the following code, where it is +% evident that the \cs{includeframedtext} command is available even +% outside the \Env{wraptext} environment. +%\begin{flushleft}\ttfamily\obeylines +%\Bambiente{figure} +%\cs{makebox}[\cs{textwidth}]\Marg{\cs{includeframedtext}\Marg{Text}\% +%\qquad [insertionwidth=0.45\cs{linewidth}] +%\quad\cs{hfill} +%\quad\cs{includeframedtext}\Marg{Text}\% +%\quad [insertionwidth=0.45\cs{linewidth},fboxrule=3pt]}\cs{\char92}[2ex] +%\% +%\cs{makebox}[\cs{textwidth}]\Marg{\cs{includeframedtext}\Marg{Text}\% +%\quad [insertionwidth=0.45\cs{linewidth},textcolor=red,fboxrule=2pt] +%\quad\cs{hfill} +%\quad\cs{includeframedtext}\Marg{Text}\% +%\qquad[insertionwidth=0.45\cs{linewidth},fontstyle=\cs{Large}]}\cs{\char92}[2ex] +%\% +%\cs{makebox}[\cs{textwidth}]{\cs{includeframedtext}\Marg{Text}\% +%\quad[insertionwidth=0.45\cs{linewidth}, backgroundcolor=yellow] +%\quad\cs{hfill} +%\quad\cs{includeframedtext}\Marg{Text}\% +%\qquad[insertionwidth=0.45\cs{linewidth},framecolor=blue, +%\qquad backgroundcolor=yellow,fboxrule=1mm]}\cs{\char92}[2ex] +%\% +% \cs{makebox}[\cs{textwidth}]{\cs{includeframedtext}\Marg{Text}\% +%\quad [insertionwidth=0.5\cs{linewidth}, fboxrule=0pt,\% +%\qquad backgroundcolor=cyan,textcolor=white,fontstyle=\cs{Huge}\cs{bfseries}]} +%\cs{caption}\Marg{Some framed text boxes ... different colours} +%\cs{label}\Marg{fig:framed text} +%\Eambiente{figure} +%\end{flushleft} +% +% +% As it is possible to notice from figure~\ref{fig:framed text}, +% version~6 adds another facility; the colours and dimensions of the +% elements of the wrapped objects are inserted as +% \textit{key=value} options to the \cs{includeframedtext} third +% argument \meta{settings}; its default value is “empty”; the +% users can introduce as many options as they desire, among the +% valid ones; if an option is misspelled or its value is not +% coherent with its nature, either the option is ignored, or an +% error is raised. The valid options are the following; they are +% listed in alphabetical order, because the options described with the +% \texttt{key=value} syntax do not require either a specific order +% or their presence; the users can therefore specify from zero to +% nine options. +%\begin{description} +%^^A +%\item{\ttfamily backgroundcolor} sets the background colour among +% those defined by the default set provided by package \pack{xcolor}. +% The default colour is a light grey. +%^^A +% \item{\ttfamily fboxrule} sets the thickness of the line +% around the frame; a zero value is allowed, otherwise it should +% not be smaller than \texttt{0.4pt}; on the opposite it +% should not be set too large and \texttt{1mm} appears as +% a thick enough line around the wrapped text. +%^^A +% \item{\ttfamily fboxsep} sets the distance of the frame from +% the wrapped text; by default it is set to \texttt{1ex}; +% also in this case it is better to avoid exaggerations. +% Notice that the default value depends on the wrapping text +% font x-height. +%^^A +%\item{\ttfamily fontstyle} sets any available \emph{declaration} +% that changes the characteristics of a font: size, series, +% shape; it is possible to use also the \cs{usefont} command +% with all its four arguments, even the font encoding. This +% \pack{wrapfig2} has available also the \cs{setfontsize} +% command that can select any size with any font that has +% available at least a step wise continuous size set; for +% example the Latin Modern fonts have a stepwise continuous +% size set, while Computer Modern have available only a discrete +% size set. +%^^A +%\item{\ttfamily framecolor} sets the color of the frame; the colours +% available are those available with package \pack{xcolor} to which +% no options have been specified; see its documentation and in case +% load \pack{xcolor} with the desired options before this package +% \pack{wrapfig2}. The default colour is a very dark grey. +%^^A +%\item{\ttfamily insertionwidth} sets the insertion width; as +% it was previously specified, if this width is too small +% or too large it will be automatically reassigned a value +% within the allowed range. +%^^A +%\item{\ttfamily radius} sets the optional radius of the frame +% rounded “corners”; if it is not specified, such radius is +% equal to the default value of \cs{fboxsep}. Although it is +% possible to use it, we suggest to abide from using it. +%^^A +% \item{\ttfamily scalefactor} sets the value that establishes +% a reasonable range of the insertion width; users can specify +% any value in the range $xy_0 = y\ped{min} \leq y \leq +% y\ped{max} = y_0/x$ , where $y_0$ is the default value, +% and $x$ is the scaling factor that by default equals $0.8$; +% this means $y_0$ equals half the current measure and the +% inserted wrapped text produces an indentation of the wrapping +% lines approximately between 60\% and 40\% the current measure; +% the wrapped text should never have a too short measure and the +% wrapping indented lines never have a too short measure. If users +% specify a different value to this key, they might get problems +% with inter word spacing and of hyphenation. +%^^A +%\item{\ttfamily textcolor} sets the text colour among those available +% among those available with the default set provided by package +% \pack{xcolor}. The default colour is black. +%^^A +%\end{description} +% +% This version~6 has a more flexible way compared to version~5 +% to specify the details relative to the framed text, but they are +% relevant only for the \cs{includeframedtext} command; the syntax +% for the \Env{wraptext} environment opening command is identical. % As it was previously shown, the syntax of environment \Env{wraptext} -% for version~5.0 is practically identical to the one used for the +% for version~6 and~5 is practically identical to the one used for the % other two environments; actually, as it can be seen below in -% the code description of this version~5.0, it has a fairly +% the code description of version~6 and~5, it has a fairly % longer definition; it is required by the necessity of avoiding -% the \cs{caption} redefinition by the adjustments foreseen in -% version~4.0, but in effects the new definition of the \Env{wraptex} -% environment uses the same \cs{wrapfloat} and \cs{endwrapfloat} -% commands. +% the \cs{caption} changes foreseen in package{wrapfig} when +% \pack{float} is used to define another floating object, but in +% effects the new definition of the \Env{wraptext} environment uses +% the same \cs{wrapfloat} and \cs{endwrapfloat} commands. % -% In all cases the \meta{width} parameter is a braced optional -% argument; for the \Env{wraptext} environment its preset value is +% In all three cases the \meta{width} parameter is a \emph{braced optional +% argument}; for the \Env{wraptext} environment its preset value is % half the column width, that in one column typesetting mode % coincides with the text width. The wrapped text is typeset % in justified mode within a \cs{parbox} argument; the @@ -517,14 +656,14 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % word spacing might be too large; at the same time the measure % of the mini paragraph cannot be too large, otherwise the indented % wrapping lines, generally justified, might get a bad word -% spacing. Therefore it is suggested to avoid specifying the -% optional \meta{widh} outside the range of 40\% to 60\% the -% column width. Actually specifying \texttt{0.2\cs{textwidth}} +% spacing. As it was already explained, it is recoommended to avoid +% specifying the optional \meta{widh} outside the range of 40\% to 60\% +% the column width. Actually specifying \texttt{0.2\cs{textwidth}} % or \texttt{0.4\cs{columnwidth}} when typesetting in two column % mode produces approximately the same result, because % \cs{columnwidth} is a little less than half the \cs{textwidth}. -% In any case version~5.0 of \Env{wrapfig2} resets any specified -% width outside the above range at the nearest range bound. +% In any case versions~6 and~5 of \Env{wrapfig2} reset any specified +% width outside the above range to the nearest range bound. % %^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \section{Remarks} @@ -532,7 +671,7 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % % The syntax of the original environments \amb{wrapfigure} and % \amb{wraptable} has not been changed, except for a last optional -% star. The fact that the last braced argument is optional does not +% star. The fact that the last \emph{braced argument is optional} does not % change the backward compatibility with the original environments. % % Therefore the optional \meta{line number} argument maintains its @@ -548,29 +687,25 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % % We tested all of them, but as a (possibly questionable) personal % choice we prefer to place the wrapped object at the left of the text, -% without floating it and irrespective of the page number parity. +% without floating it and irrespective of the folio parity. +% +%\begin{wraptext}{l}{0.5\textwidth}% +%\includegraphics[width=\hsize]{stele-todi-small} +%\caption{The Todi stela written in Gallic and Latin. Gregorian Etruscan Museum in Rome.}\label{txt:todi-stela} +%\end{wraptext} +%{\itshape\kant[4]} % % As in the previous examples, we prefer to specify the wrapping % environment just before a sufficiently long paragraph. Should the % paragraph be too short to completely wrap the object, all % the environments are capable of counting the number of used indented -% lines and to apply the remaining number and the \cs{overhang} amount +% lines and to apply the remaining number (and the \cs{overhang} amount) % to the following paragraph(s); in these circumstances % it might be necessary to recourse to the optional star in order % to correct the indention, since the mechanism does not consider % the inter paragraph spacing that \LaTeX introduces only at ship~out % time. % -%\begin{wraptext}{l} -%\includegraphics[width=\hsize]{commodilla} -%\caption{A IX century text written in a language half way between -% Latin and Italian. It is written on the frame of a fresco in the -% Comodilla catacombs, Rome; an apparently free picture is available -% from the internet site of the Bibliotheca Augustana in Germany. -% The text is: «Non dicere ille secrita a bboce».}\label{fig:commodilla} -%\end{wraptext} -%{\textit{\kant[4]} -% % We avoid also to enter the wrapping environment before paragraphs % that are close to a page break; this action would tickle the % idiosyncrasies of the software, and requires moving the wrapping @@ -584,9 +719,9 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % that a section title falls alone at the bottom of the page and % the wrapping environment with its wrapping text gets typeset on the next % page; this of course is not acceptable. We found the place to -% correct and this version~5.0 more often than not does not +% correct and versions~6 and~5 more often than not do not % exhibit any more this “feature”. Unfortunately in some rare cases -% this “feature” pops up agains; a \cs{newpage} command before the +% this “feature” pops up again; a \cs{newpage} command before the % section title solves the problem. This rare feature could be avoided % if the sectioning commands are redefined; but this would imply % modifications to a large number of redefinitions due to the large @@ -597,7 +732,7 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % does exactly what its name implies: the wrapped object protrudes % into the adjacent margin exactly by the specified amount. This % parameter is not available for the \Env{wraptext} environment, -% or better, it is still available in version~5.0, but we recommend +% or better, it is still available in versions~6 and~5, but we recommend % to abide from using it; we believe that a wrapped text logically % pairs the wrapping text; of course this personal opinion might be wrong. % @@ -608,7 +743,7 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % insertion width can be specified but it should not be too different % from its default value $y_0$, set to 50\% of the current measure. % For the standard environments this parameter value appears to be -% mandatory; actually it is a braced optional argument only for the +% mandatory; actually it is a braced really optional argument only for the % redefined environments \env{wrapfigure} and \env{wraptable}. % % Matter of facts, for the \Env{wraptext} environment we defined a @@ -621,20 +756,21 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % the \cs{WFscalefactor} macro, but such resetting is strongly % discouraged; the default value is~$0.8$. % +%\begin{wraptext}{l} +%\includeframedtext{^^A +% \foreignlanguage{greek}{Κα᾽γὼ σὲ πατάξας διαλύσω τὸ κρανὶον}} +% \caption{A sample text in Greek}\label{txt:greek} +%\end{wraptext} +%{\itshape\kant[7]} +% % If optional parameters are not used and the mandatory ones are % reduced to a minimum (remember the \meta{width}, in spite of being % braced is optional) the three environments produce the same results; % the difference, in spite of the nature of the wrapped object differs -% only with the environment name. Text~\ref{fig:commodilla} displays -% an image that contains some text; it is reasonable to insert it with -% the \Env{wrapfigure} environment, but it is not absurd to insert -% it with the \Env{wraptext} one. -% -%\begin{wraptext}{l} -%\includeframedtext{% -% \foreignlanguage{greek}{Κα᾽γὼ σὲ πατάξας διαλύσω τὸ κρανὶον}}\caption{A sample text in Greek}\label{txt:greek} -%\end{wraptext} -%{\textit{\kant[7]} +% only with the environment name. Text~\ref{txt:todi-stela} displays +% an \emph{image} that contains some text; it is reasonable to insert +% it with the \Env{wrapfigure} environment, but it is not absurd to insert +% it with the \Env{wraptext} one as we did with text~\ref{txt:todi-stela}. % % The wrapped text may be written also in a foreign language, even % if it uses a differente alphabet. Evidently this language should @@ -657,7 +793,7 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % objects may be defined by means of other packages, such as % \pack{float}, or classes, such as \class{memoir}. Besides floating, % the main difference is the name of the caption “label”: Figure, Table, -% Algorithm, Example, and so on and the lists of such objects. +% Algorithm, Example, and so on, and the lists of such objects. % % If floating is not necessary, this package (as well as the original % one) allows to use the underlying environment \Env{wrapfloat} @@ -678,33 +814,33 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi %\end{flushleft} % % By reading the documentation of the original \pack{wrapfig} package, -% it may be assumed that if the floating \meta{location} codes have to +% it may be assumed that, if the floating \meta{location} codes have to % be used, another floating object with the desired \meta{object name} -% has to be previously defined by means of the functionalities of other +% has to be previously defined by means of the functionalities of other % packages or classes. But, if the non floating \meta{location} codes % are used, the presence of another \meta{floating object} environment % appears to be unnecessary. % -% This is actually possible by “cheating” a little bit; it can be actually -% wraped any \meta{object} by using the \Env{wrapfigure} environment, +% This is actually possible by “cheating” a little bit: it can be actually +% wrapped any \meta{object} by using the \Env{wrapfigure} environment, % while assigning a different name to the caption label; something % similar to typeset a small figure within a non floating environment. % The obvious draw back is that the caption is numbered as a figure. % % In order to avoid such drawbacks and to have a real floating -% \Env{text} environment it is necessary to procede by defining +% \meta{other object} environment it is necessary to procede by defining % a new real floating environment with that name. To do this task, -% \pack{wrapfig2} version~5.0 uses the \pack{float} package. +% \pack{wrapfig2} versions~5 and~6 use the \pack{float} package. % % As it is possible to verify by reading the section where the % code is documented, the operation is not that simple because % \pack{float} redefines several internal macros that are incompatible % with both \pack{wrapfig} and \pack{wrapfig2}. This is why, even -% with \pack{wrapfig2} in version~5.0, that loads the \pack{float} -% package, the code for this environment redefines the \cs{caption} +% with \pack{wrapfig2} in versions~5 and~6, that load the \pack{float} +% package, the code for this environment redefines the \cs{caption} % command so that Arseneau had to define some adjusting macros in order % to deal with something different from what it was with the \LaTeXe -% kernel. We did not modify what Arseneau defined in although it did not +% kernel. We did not modify what Arseneau defined, although it did not % work correctly with the new \Env{text} floating environment. Therefore % we reinstated the \LaTeXe kernel relevant definitions. % @@ -712,32 +848,36 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % necessary also with floating objects defined by other means, for % example by using the functionalities of \class{memoir}. We admit % we did not test this package functionality with class -% \class{memoir}; feedback on this compatibility issue is very -% welcome +% \class{memoir}; \textcolor{red}{feedback on this compatibility issue +% is very welcome}. % %^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \section*{Acknowledgements} %^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % We gratefully thank Donald Arseneau who gave the \TeX community -% the original \Env{wrapfig} package. +% the original \Env{wrapfig} package. For what concerns wrapped text, +% we did not use Arseneau's \pack{framed} package, because we wanted a +% frame with rounded corners. Nevertheless, while developing our package, +% we experimented also with his package that yields good results but +% with the ordinary right angle frame corners. % % Thanks to Heinrich Fleck who submitted to our attention the % \texttt{texstackexchange} message where the problem of wrapping text was % presented possibly for the first time. The solution presented in % \texttt{texstackexchange} appears to be oversimple, almost trivial; -% especially it does not solve the problem of a caption if one is desired -% under the wrapped text. -% Moreover the solution of \texttt{texstackexchange} uses an almost -% trivial usage of the \Env{tcolorbox} environment, that behind the -% scenes uses a very heavy set of multifunctional macros the offer -% functionalities are not required for this problem. +% especially it does not solve the problem of a caption if one is desired +% to describe that wrapped text. +% Moreover the solution of \texttt{texstackexchange} used in a very +% simple way the \Env{tcolorbox} environment, that behind the +% scenes uses a very heavy set of multifunctional macros that offer +% functionalities that are not required for this problem. % % Warm thanks also to Juan Luis Varona Malumbres for his precious % feedback and his suggestions. % %^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% \CheckSum{1345} +% \CheckSum{1411} % \StopEventually{} %^^A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % @@ -759,15 +899,14 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % First of all we check if certain packages have already been % loaded; some of these packages, such as \pack{wrapfig}, that % might have been previously directly loaded, or might have been -% loaded by other packages, are incompatible with this new version -% (and also with the previous versions, but the problem was less -% serious). That package might have been loaded by other packages, -% such as \pack{caption} or \pack{subcaption}, that redefine some -% internals that we did not want to replace so as to avoid other +% loaded by other packages, are incompatible with this package +% \pack{wrapfig2}. \pack{wrapfig} might have been loaded by other +% packages, such as \pack{caption} or \pack{subcaption}, that redefine +% some internals that we did not want to replace so as to avoid other % possible incompatibilities. We first check if a specific macro % with the \texttt{WF} prefix has already been defined; if so, -% this package loading is aborted with a very evident error -% message. In contrast the job is not aborted, because the presence +% this package \emph{loading} is aborted with a very evident error +% message. In contrast the \emph{job} is not aborted, because the presence % of the original \pack{wrapfig} package might still be sufficient; % evidently there will be many errors if some new user commands % or environments are used. @@ -786,27 +925,30 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi Package `wrapfig' has already been loaded perhaps \MessageBreak by other packages, for example caption or subcaption.\MessageBreak Such packages are incompatible with wrapfig2 \MessageBreak - Loading `wrapfig2' aborted \MessageBreak + Loading of`wrapfig2' is aborted \MessageBreak ****************************************************\MessageBreak }{You might type X and might get along without\MessageBreak this package if you don't use the new environment \MessageBreak - `wraptext'; otherwise you get errors about such \MessageBreak - environment not being defined; you must kill your job!} + `wraptext' and the new commands; otherwise you get \MessageBreak + errors about such environment not being defined; \MessageBreak + you must kill your job!} \expandafter\endinput\fi % \end{macrocode} % We keep the original definition of the \cs{WF@warning} and the % original definition of the \opt{verbose} option; but we add the -% new \opt{WFold} option in order to fall back to the functionalities -% of the previous version~4.0, at least for what concerns the -% \Env{swraptext} environment. +% new \opt{WFold} and \opt{WFfivw} options in order to fall back +% to the functionalities of the previous version~4 or~5, at least +% for what concerns the \Env{wraptext} environment. % % % \begin{macrocode} \def\WF@warning{\PackageWarning{wrapfig2}} \DeclareOption{verbose}{\def\WF@info{\PackageInfo{wrapfig2}}} \newif\ifWFnew \let\ifWFnew\iftrue +\newif\ifWFfive \let\ifWFfive\iffalse \DeclareOption{WFold}{\let\ifWFnew\iffalse} +\DeclareOption{WFfive}{\let\ifWFnew\iffalse \let\ifWFfive\iftrue} \ProcessOptions % \end{macrocode} @@ -828,12 +970,13 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % now available directly within the \LaTeXe kernel. %\end{quote} % Their availability eases the treatment of the backwards -% compatibility of this software with the original \pack{wrapfig} -% functionality. It deals with the mandatory \meta{width} argument -% of the \Env{wrapfigure}, \Env{wraptable}, the new \Env{wraptext}, -% and \Env{wrapfloat} environments, where it was possible to specify -% a zero value. Now it is possible to omit it completely because it -% is a \emph{braced optional argument} with a \texttt{0pt} default value. +% compatibility of this software with the original \pack{wrapfig} and +% \pack{wraptable} functionality. It deals with the mandatory +% \meta{width} argument of the \Env{wrapfigure}, \Env{wraptable}, +% the new \Env{wraptext}, and \Env{wrapfloat} environments, where +% it was possible to specify a zero value. Now it is possible to +% omit it completely because it is a \emph{braced optional argument} +% with a \texttt{0pt} default value. % % % \begin{macrocode} @@ -845,12 +988,13 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi \@ifpackageloaded{xcolor}{}{\RequirePackage{xcolor}}% } \@ifpackageloaded{curve2e}{}{\RequirePackage{curve2e}} +\@ifpackageloaded{xkeyval}{}{\RequirePackage{xkeyval}} % \end{macrocode} % Notice that we loaded the \pack{xcolor} package without any option % in order to avoid option clash errors, and users who want to use % \pack{xcolor} with options should load it \emph{before} this package -% \pack{wrapfig2}, version~5.0.*. {\color{red}Users are warned +% \pack{wrapfig2}, version~5 and~6. {\color{red}Users are warned % to pay attention to this \pack{color} package loading: they should load % it neither before nor after loading \pack{wrapfig2}; if they do, they % receive various warning or error messages because \pack{xcolor} @@ -858,8 +1002,8 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % explained in the \pack{xcolor} documentation.} % % In order to define the new floating object \texttt{text} we have -% to load the package \pack{float}, but only if version~5.0.* -% is used; in other words only if the \cs{ifWFnew} switch +% to load the package \pack{float}, but only if versions~5 or~6 +% ae used; in other words only if the \cs{ifWFnew} switch % is \texttt{true}. % % If the \cs{chapter} command is or is not defined we have to load @@ -871,24 +1015,25 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % \Env{text} environment correctly reset the right counter with the % right label before the object number. % \begin{macrocode} -\ifWFnew - \floatstyle{plain} +\ifboolexpr{ bool{WFfive} or bool{WFnew} }% + {\floatstyle{plain}% \ifcsname chapter\endcsname - \newfloat{text}{tbp}{lotx}[chapter] - \else - \newfloat{text}{tbp}{lotx} + \newfloat{text}{tbp}{lotx}[chapter]% + \else + \newfloat{text}{tbp}{lotx}% \fi - \floatname{text}{Text} + \floatname{text}{Text}% come personalizzare con le diverse lingue? \let\WF@text@caption\float@caption -\fi + }{} % \end{macrocode} % % If the users wanted to add the \texttt{text} counter to some -% sectioning command counter reset list they might use the +% sectioning command counter reset list, they might use the % \cs{counterwithin} command now available with the recent updates % of the \LaTeX kernel; see the \LaTeX newsletter~28 for details -% (terminal command \texttt{texdoc ltnews28}). Its syntax is the following: +% (terminal command \texttt{texdoc ltnews28}). Its syntax is the +% following: %\begin{ttsintassi} %\cs{counterwithin}\marg{counter}\marg{main counter reset list} %\end{ttsintassi} @@ -903,7 +1048,7 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % \begin{macrocode} \newdimen\wrapoverhang \wrapoverhang\z@ \newdimen\WF@size -\newcounter{WF@wrappedlines} +\newcount\c@WF@wrappedlines \newbox\WF@box \newbox\NWF@box \newtoks\WF@everypar @@ -913,6 +1058,7 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi \let\WF@@everypar\everypar \newdimen\insertwidth +\newdimen\radius \newdimen\WFinsertwidthL \newdimen\WFinsertwidthH @@ -922,8 +1068,14 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi \def\SetWFbgd#1{\colorlet{WFbackground}{#1}} \def\SetWFfrm#1{\colorlet{WFframe}{#1}} \def\SetWFtxt#1{\colorlet{WFtext}{#1}} + + \def\WFsplitdimens#1,#2!{\fboxrule=#1\relax\fboxsep=#2\relax} +\providecommand\setfontsize{} +\RenewDocumentCommand\setfontsize{O{1.2} m}{% + \fontsize{#2}{\fpeval{#1*#2}}\selectfont} + \def\WFscalefactor{0.8}% \newcommand*\WFscalewidth{% \WFinsertwidthL=\fpeval{\WFscalefactor*0.5\columnwidth}\p@ @@ -937,21 +1089,52 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi \fi }% +% \end{macrocode} +% We define several options that use the \texttt{key=value} syntax. +% Above we have already loaded the \pack{xkeyval} package that +% offers also some ‘X’ labeled macros that mimic the corresponding +% \LaTeXe kernel macros, but that are necessary for using the +% \pack{xkeyval} internal macros. We chose the \texttt{wraptext} +% option family name, because such options are to be used mostly within +% the \cs{includeframedtext} macro. +% The \cs{ExecuteOptionX} used here stands for a general +% initialisation of the listed options, but it will be used also +% within the \cs{includeframedtext} command in order to set the +% specified options for the specific use of this command. +% \begin{macrocode} +\DeclareOptionX{scalefactor}[0.8]{\def\WFscalefactor{#1}} +\DeclareOptionX{fboxrule}[1pt]{\fboxrule=#1} +\DeclareOptionX{fboxsep}[1ex]{\fboxsep=#1} +\DeclareOptionX{framecolor}[WFframe]{\SetWFfrm{#1}} +\DeclareOptionX{backgroundcolor}[WFbackground]{\SetWFbgd{#1}} +\DeclareOptionX{textcolor}[WFtext]{\SetWFtxt{#1}} +\DeclareOptionX{fontstyle}[\normalfont]{#1} +\DeclareOptionX{radius}[\fboxsep]{\radius=#1} +\DeclareOptionX{insertionwidth}[0.5\columnwidth]{\insertwidth=#1} + +\DeclareOptionX*{\PackageWarning{wrapfig2}{`\CurrentOption' ignored}} + +\ExecuteOptionsX{scalefactor, fboxrule, fboxsep, framecolor, +backgroundcolor, textcolor, fontstyle, radius, insertionwidth} + +\ProcessOptionsX* + % \end{macrocode} % % % {\color{red}Should the format file be not so up to date, a multitude % of errors would be produced, and the user should take care to load the % \pack{xparse} and \pack{xfp} packages before loading \pack{wrapfig2}. -% Notice that most of the \pack{xparse} package functionalities -% at the date required for the format file are already included. The -% \pack{xparse} package has been available since about 2018; should the -% users have available a definitely older \TeX system installation, they -% should upgrade it, or must avoid using this \pack{wrapfig2} package -% and use the original \pack{wrapfig} one; if they need to wrap text, -% they should resort to some ingenious, not so trivial, tricks to do it.} -% -% Originally version~4.0 used the \pack{tcolrbox} package to frame +% Notice that most of the \pack{xparse} package functionalities are +% already included in the format file at the date required for this +% file. The \pack{xparse} package has been available since about 2018; +% should the users have available a definitely older \TeX system +% installation, either they upgrade it, or they must avoid using this +% \pack{wrapfig2} package and should use the original \pack{wrapfig} one; +% if they need to wrap text, they should resort to some ingenious, +% not so trivial tricks to do it.} +% +% Originally version~4 used the \pack{tcolrbox} package to frame % the wrapped text; we thought that loading that package was too % heavy on memory, even if the modern computers have large working % memories. But in order to maintain and track possible errors @@ -959,10 +1142,10 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % help; therefore in oder to draw a framed box with rounded corners % we thought it would be much simpler to load the \pack{curve2e} % package, just a second level extension of the original \Env{picture} -% environment defined in the \LaTeXe kernel; just some 30 lines of code +% environment defined in the \LaTeXe kernel; only some 30 lines of code % are sufficient to replace the extremely powerful \pack{tcolorbox} -% functionalities needed by this \pack{wrapfig2} package. -% +% functionalities otherwise required to frame wrapped text with this +% \pack{wrapfig2} package. % % The definitions of the \Env{wrapfigure} and \Env{wraptable} % environments are very simple by means of the underlaying @@ -987,21 +1170,39 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % to insert it with its frame into the \Env{wraptext} environment body. % Here is the code of some extra macros and of the \Env{wraptext} % environment. +% +% We start with two different \cs{includeframedtext}, one for +% version~6, that accepts \texttt{key=velue} options, and +% another one for version~5, that requires only a comma +% separated list of dimensional values. % \begin{macrocode} +\ifbool{WFnew}{% +\NewDocumentCommand\includeframedtext{O{\insertwidth} m O{} o}{\bgroup% + \ExecuteOptionsX{#3}% executes possible key=value options + \insertwidth=#1\WFscalewidth + \framedbox{#2}{\fboxrule}{\fboxsep}[\radius]\egroup} +}{} + +\ifbool{WFfive}{% \NewDocumentCommand\includeframedtext{O{\insertwidth} m O{1pt,1ex} o}% -{\bgroup \WFsplitdimens #3!% -\insertwidth=#1\relax -\IfNoValueTF{#4}% - {\framedbox{#2}{\fboxrule}{\fboxsep}}% - {\framedbox{#2}{\fboxrule}{\fboxsep}[#4]}% -\egroup} +{\bgroup + \WFsplitdimens #3!\relax + \IfNoValueTF{#4}% + {\framedbox{#2}{\fboxrule}{\fboxsep}}% + {\framedbox{#2}{\fboxrule}{\fboxsep}[#4]} +\egroup}% +}{} % \end{macrocode} % -% -% Its simple syntax is the following +% Their simple syntaxes are the following %\begin{ttsintassi} -%\cs{includeframedtext}\oarg{text width}\marg{text}\oarg{settings}\oarg{radius} +%~ +%\% for version 6.0 +%\cs{includeframedtext}\oarg{text width}\marg{text}\oarg{options}\oarg{radius} +% +%\% for version 5.0 +%\cs{includeframedtext}\oarg{text width}\marg{text}\oarg{dimensions}\oarg{radius} %\end{ttsintassi} % % The optional \meta{text width} is the (possibly scaled) width computed @@ -1010,36 +1211,42 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % in any case the default value is half the current measure % \cs{linewidth}. The \meta{text} is the unformatted text to be wrapped; % it will be boxed and framed by the service macro \cs{framedbox}; the -% \meta{settings} are passed on to \cs{framedbox} command; they are a +% \meta{dimensions} are passed on to \cs{framedbox} command; they are a % comma separated list of dimensions, namely the thickness of the frame -% and the necessary distance of the frame from the formatted text; the -% last optional \meta{radius} is the curvature radius of the rounded frame -% corners; no default value is specified, because it is going to be -% received by \cs{framedbox} that by default sets it equal to the frame -% separation width; this value is certainly the best one, but the user -% can specify a different value, of course not too different from the -% default one. See some examples in figure~\ref{fig:framed text}. +% and the necessary frame distance from the formatted text. The +% \meta{options} contains a comma separated list of zero to nine options +% with the syntax \texttt{key=vale} that are going to be used by both +% the \cs{includeframedtext} and \cs{framedbox}. The last optional +% \meta{radius} is the curvature radius of the rounded frame corners; +% the default value is going to be set to \cs{fboxsep}: in +% version~5 \cs{framedbox} by default sets it equal to the frame +% separation width, while with version~6 its value is received with +% the option \texttt{radius=\meta{dimension}}; the default value is +% certainly the best one, but the users can specify a different value, +% of course not too different from the default one. See some examples +% in figure~\ref{fig:framed text}. % % The definition of the \cs{framedbox} command appears to be % complicated; it is just an apparent complication due to the % fact that it uses the powerful \cs{Curve} command that draws an -% arbitrary curved line or fills the area delimited by the +% arbitrary curved line or fills the area delimited by such % curved line; it suffices to specify the nodes and the tangents % to each node; the nodes are the points the line should pass % through, their tangents may be specified with arbitrary vector % components along the horizontal and vertical axes. For a -% rectangle such vector componente are just 0 or $\pm 1$. The -% node coordinates, on the opposite, must be determined with -% accuracy; we used the \cs{fpeval} function of package \pack{xfp}, -% that performs precise operation on operands in fractional -% decimal numbers; if the operands are dimensions, the operands -% are their fractional values in printer points, the results of -% such operations are pure fractional decimal numbers without units; -% if the numerical result is to be interpreted again as the measure of a -% dimensional entity, \texttt{pt} must be appended to the -% assignments to a dimension register; within the \Env{picture} +% rectangle such vector components are just 0 or $\pm 1$. The +% node coordinates of the rounded corners, on the opposite, must be +% determined with accuracy; we used the \cs{fpeval} function of +% package \pack{xfp}, that performs precise computations on operands +% in fractional decimal numbers; if the operands are dimensions, the +% operands are their fractional decimal values in printer points, the +% results of such operations are pure fractional decimal numbers +% without units; if the numerical result is to be interpreted again +% as the measure of a dimensional entity, \texttt{pt} must be appended +% to the assignments to a dimension register; within the \Env{picture} % environment, any coordinate is expressed in multiples of -% \cs{unitlength}. +% \cs{unitlength}, therefore no unit of measure is necessary, once +% \cs{unitlength} has been specified. % % For a rectangle with curved corners of a given radius \cs{R} % we have four quarter circles joined by straight lines; therefore @@ -1047,42 +1254,50 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % % The shaded background and the coloured frame have the same contour; % but the former is filled, while the latter is stroked; we have to -% draw the same curve two times; first the shaded background, then -% the frame. +% draw the same curve two times; first the shaded background, then we +% superimpose the frame % -% This shaded framed rectangle is at the center of the coordinate -% system of a \Env{piture} environment, and has the correct dimensions -% to receive the boxed text; it is trivial to center the text within a -% zero dimensioned box, typical of the \Env{picture} environment. +% This shaded framed curved corners rectangle is at the center of the +% coordinate system of a \Env{piture} environment, and has the correct +% dimensions to receive the boxed text; it is trivial to center the text +% by means of a zero dimensioned box, typical of the \Env{picture} +% environment. % % The code of this long but simple code is the following. % \begin{macrocode} \NewDocumentCommand\framedbox{ m m m O{#3}}{\bgroup \fboxrule=#2\fboxsep=#3\relax -\setbox0\hbox{\fboxrule=0pt\fboxsep=#3\relax -\framebox{\parbox{% - \fpeval{\insertwidth-2\fboxrule-2\fboxsep}pt}{\textcolor{WFtext}{#1}}}}% -% -\unitlength=\fpeval{\wd0/100}pt -\edef\x{100}\edef\y{\fpeval{(\ht0 +\dp0)/\unitlength}}% -\edef\xc{50}\edef\yc{\fpeval{\y/2}}\edef\R{\fpeval{#4/\unitlength}}% -% +\setbox0\hbox{\fboxrule=\z@\fboxsep=#3\relax +\framebox{\parbox{% draw a framed box without the frame + \fpeval{\insertwidth-2\fboxrule-2\fboxsep}\p@}{\textcolor{WFtext}{#1}}}} + +\unitlength=\fpeval{\wd0/100}\p@ % set the picture \unitlength + % determine the picture coordinates and displacement of the axes origin +\edef\x{100}% +\edef\y{\fpeval{(\ht0 +\dp0)/\unitlength}}% +\edef\xc{50}% +\edef\yc{\fpeval{\y/2}}\edef\R{\fpeval{#4/\unitlength}}% +\edef\R{\fpeval{#4/\unitlength}}% radius in unit lengths + % compute the horizontal and vertical shifts of the corner extrema \edef\WFXds{\fpeval{-\xc+\R}}\edef\WFXsd{-\WFXds}% \edef\WFYuo{\fpeval{\yc-\R}}\edef\WFYou{-\WFYuo}% -% + % compute the coordinates of the curved corners frame contour \edef\PSEl{\WFXsd,-\yc}\edef\PSEu{\xc,\WFYou}\edef\PNEd{\xc,\WFYuo}% \edef\PNEl{\WFXsd,\yc}\edef\PNWr{\WFXds,\yc}\edef\PNWd{-\xc,\WFYuo}% \edef\PSWu{-\xc,\WFYou}\edef\PSWr{\WFXds,-\yc}% -% -\def\WFrectangle{% + +\def\WFrectangle{% define the contour as the argument of \Curve (\WFXsd,-\yc)<1,0>(\xc,\WFYou)<0,1>(\xc,\WFYuo)<0,1>% (\WFXsd,\yc)<-1,0>(\WFXds,\yc)<-1,0>(-\xc,\WFYuo)<0,-1>% (-\xc,\WFYou)<0,-1>(\WFXds,-\yc)<1,0>(\WFXsd,-\yc)<1,0>}% -\def\CurveStar{\Curve*}% -% +\def\CurveStar{\Curve*}% define a macro for adding the asterisk + \begin{picture}(\x,\y)(-\xc,-\yc) -{\color{WFbackground}\expandafter\CurveStar\WFrectangle}% -{\color{WFframe}\linethickness{#2}\expandafter\Curve\WFrectangle}% +{\color{WFbackground}\expandafter\CurveStar\WFrectangle}% draw background +\ifdim\fboxrule>\z@% draw the frame if its thickness is not zero + {\color{WFframe}\linethickness{#2}\expandafter\Curve\WFrectangle}% +\fi + % put the text block in a null box at the coordinates origin \put(0,0){\makebox(0,0)[cc]{\box0}}% \end{picture} \egroup} @@ -1094,14 +1309,14 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi %\end{ttsintassi} % % The default value of the \meta{corner radius} is assigned to -% equal argument number~3, that is the \meta{frame separation}; both -% have a default value of \texttt{1ex} therefore they vary with the +% equal argument number~3, that is the \meta{frame separation} and both +% have a default value of \texttt{1ex}; therefore they vary with the % current font size. See figure~\ref{fig:framed text}. The frame % thickness is given a default value of \texttt{1pt} if the command is % used within the body of the \cs{includeframedtext}; but if this % command received a different value the frame may be thicker, % or even vanish; we discourage values higher than \texttt{3pt} -% (about \texttt{1mm}) and lower than \texttt{1pt}. +% (about \texttt{1mm}) and lower than \texttt{1pt} unless is zero. % % The definition of the \Env{wraptext} environment is more detailed, % because most of the computations must be done on the actual text @@ -1110,10 +1325,12 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % problems with its justification or the justification of the wrapping % lines. The framed box width is preset to 50\% of the normal text % measure, but it can be optionally specified to a different value (not -% too different from 50\%); as with the other wrapping environments, the -% inserted material width is a \emph{braced optional parameter}. +% too different from 50\%); as with the other wrapping environments, +% with versions~6 and~5 the inserted material width is a \emph{braced +% optional argument}; with version 6.0 the default value of +% the \opz{radius} option is equal to \cs{fboxsep}. % -% For what concerns \Env{wraptext}, the first statement argument +% For what concerns \Env{wraptext}, the opening statement argument % description list does not contain any descriptor for an optional % star. There is no need because the computation of the insertion % block height is pretty precise and at most the user might desire @@ -1121,15 +1338,17 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % and that of the inserted block and/or the measure of the indented % wrapping lines; sometimes it might be necessary to get rid of the % space below the inserted block when it gets typeset at the bottom -% of a page. +% of a page. The asterisk is not needed because for this environment +% the optional first argument is always interpreted as the indented +% lines number correction. % % It is true that some of the input parameters specified to the opening % command of any environment with \LaTeXiii are available also to the % closing commands; see the last paragraph of section~2 in the % \pack{xparse} documentation. -% But the following definition, besides using special delimiters for -% optional parameters, uses the separate opening and closing -% macros of the \Env{wrapfloat} environment; such procedure +% +% But the following definition uses the separate opening and closing +% macros of the \Env{wrapfloat} environment; such procedure % breaks this second availability of the input parameters, % therefore it is necessary to save them into local macros or count % registers (assignments to \TeX count registers are \emph{local}, @@ -1137,38 +1356,41 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % \cs{setcounter} macro and its siblings, are \emph{global}) so % that we can use their values within the closing commands. % -% The \cs{NWF@box} box register has been allocated at the beginning; +% The \cs{NWF@box} box register has been allocated at the code beginning; % remember that \LaTeXiii registers of any kind are not limited in number % as they were some years ago with \LaTeXe. % % The last opening commands are conceived to box the object to be % wrapped, typeset within a coloured box with the default of -% specified width; compared to version 4.0.*, this new version~5.0.* -% does not use anymore the functionalities provided by package -% \pack{tcolorbox}; instead it uses the \pack{curve2e} package +% specified width; compared to version~4, these new versions~5 +% and~6 do not use anymore the functionalities provided by package +% \pack{tcolorbox}; instead they use the \pack{curve2e} package % functionalities to draw similar framed and shaded boxes; this % implies much less memory used by the almost unlimited, % but unused, functionalities of the \pack{tikz} package on which -% \pack{tcolorbox} relies. -% -% Notice the \Env{wraptext} has two definitions depending on the -% logical switch \texttt{WFnew}; if this switch is \texttt{true} -% the definition applies to version~5.0.* of this package; otherwise -% the second definition is a fall back to the functionality and the -% syntax of the previous version~4.0.* implementation of this package; -% in this latter case, in spite of the fact the the previous version +% \pack{tcolorbox} relies. Notice that the plain \Env{picture} +% environment extended with the \pack{pict2e} package can draw +% “ovals”, that is rectangles with rounded corners, but as far as +% we know they have the frame but cannot be filled. +% +% Notice the \Env{wraptext} has two or three definitions depending on the +% logical switches \texttt{WFnew} and \texttt{WFfive}; if one of these +% switches is \texttt{true} the definitions apply to either version~5 +% or~6 of this package; otherwise the last definition is a fall back to +% the functionality and the syntax of the previous version~4 of this +% package; in this case, in spite of the fact the the previous version % used package \pack{tcolorbox}, the new code relies on the % \pack{curve2e} functionalities in oder to get the same results % without using the memory heavy \pack{tcolorbox} package. % -% With this new solution the frame that surrounds the wrapped text +% With version 6.0, the frame that surrounds the wrapped text % has the desired rounded corners; it is possible to easily % specify the background and the frame colours, that by default -% are maintained to light grey and black respectively; this new +% are maintained to light grey and almost black respectively; this % flexibility allows to set also the frame thickness and the % separation width of the frame from its contents; by default % they are~1pt for the frame thickness, and~1ex for the separation -% width, that changes with the size of the surrounding fonts. +% width, that changes with the font size. % The number of indented lines is computed by means of the % \cs{fpeval} \LaTeXiii function; among the operands of this % function there is the number \texttt{2} used to take into @@ -1179,7 +1401,7 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % a better choice. % % Eventually the opening \Env{wrapfloat} statement is created by -% expanding the whole line complete of arguments, by means of the +% expanding the whole line complete of its arguments, by means of the % usual trick of defining a dummy macro within a group that contains % among its expansion the group closing command, so that while % it is being executed, it deletes itself from memory. @@ -1188,13 +1410,13 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % absolutely identical to that of the other two wrapping environments % in terms of \meta{line number correction}, mandatory \meta{location}, % optional \meta{overhang} and braced optional \meta{width}. See below -% for the very different syntax of the fall back version~4.0.* opening +% for the very different syntax of the fall back version~4 opening % \Env{wraptext} statement; they become almost identical when no % optional parameters are specified, the only little difference being -% that the \meta{location} argument is mandatory for version~5.0.*, -% while it is optional for version~4.0.*. +% that the \meta{location} argument is mandatory for versions~5 and~6, +% while it is optional for version~4. % \begin{macrocode} -\ifWFnew +\ifboolexpr{bool{WFnew} or bool{WFfive}}{% definition for versions 5 and 6 \NewDocumentEnvironment{wraptext}{O{0} m O{0pt} G{0.5\columnwidth}}{% \insertwidth=#4\WFscalewidth \def\textplacement{#2}% @@ -1202,7 +1424,7 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi \def\textoverhang{#3}% \bgroup\edef\x{\egroup\noexpand\wrapfloat{text}% [\textcorrection]{\textplacement}[\textoverhang]{\insertwidth}*}\x% - \def\caption{\unskip + \def\caption{\unskip \refstepcounter\@captype \let\@tempf\@caption \unless\ifcsname @float@c@\@captype\endcsname @@ -1214,16 +1436,16 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi }{\endwrapfloat\ignorespaces}% % \end{macrocode} % -% For the fallback definition of this \Env{wraptext} environment -% we have to start with the old list of specifically delimited -% optional arguments. We remember that this opening statement -% receives in order a bracket delimited \meta{location} parameter, -% a vertical bar delimited optional \meta{width}, an angle bracket -% delimited \meta{line number correction}, a round parenthesis -% delimited \meta{caption label}; the different delimiters allow -% to specify any optional argument without regard with the other -% ones, provided they are in the same logical order when more than one -% optional argument is specified. +% For the fallback to version!4 definition of this \Env{wraptext} +% environment we have to start with the old list of specifically +% delimited optional arguments. We remember that this opening statement +% receives in order a bracket delimited optional \meta{location} +% parameter, a vertical bar delimited optional \meta{width}, an angle +% bracket delimited optional \meta{line number correction}, a round +% parenthesis delimited optional \meta{caption label}; the different +% delimiters allow to specify any optional argument without regard with +% the other ones, provided they are in the same logical order when more +% than one optional argument is specified. % % Notice that the third optional argument contains the % \meta{line number correction}, therefore the star used with the @@ -1235,35 +1457,32 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % easily obtained with a \Env{minipage} environment, of which the % internal commands are used; this insures that the text is % typeset with the correct measure; with the closing commands -% this boxed text shall be fed to the \cs{framedbox} command, in -% oder to be framed and assigned a default background color. +% this boxed text is fed to the \cs{framedbox} command, in +% order to be framed and assigned a default background color. % There is no possibility of specifying the colours unless the % whole \Env{wraptext} environment, preceded by explicit color -% settings, is confined within a group delimited, for example -%, by the \cs{begingroup} and \cs{endgroup} commands. -% \begin{macrocode} -\else % +% settings, is confined within a group delimited, for example, +% by the \cs{begingroup} and \cs{endgroup} commands. +% \begin{macrocode} +}{% definition for version 4 fall back % \NewDocumentEnvironment{wraptext}% {O{l} D||{0.5\columnwidth} D<>{0} D(){text} }% - {% + {% Open environment \insertwidth=#2 \def\textplacement{#1}% \def\textcorrection{#3}% \def\WF@caption@label{#4}% \setbox0\hbox\bgroup \minipage{\dimexpr\insertwidth-2pt-6ex}% -}{\endminipage\egroup +}{% Close environment + \endminipage\egroup \begin{lrbox}{\NWF@box}% \framedbox{\box0}{1pt}{1ex}% \end{lrbox} - \edef\NWF@wli - {% - \fpeval{% - round((\ht\NWF@box+\dp\NWF@box)/\baselineskip,0)+2+ - \textcorrection - }% - }% + \edef\NWF@wli]{\fpeval{% + round((\ht\NWF@box+\dp\NWF@box)/\baselineskip,0)+2+\textcorrection}% + }% \unles\ifhmode \leavevmode\noindent \fi @@ -1273,7 +1492,7 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi \endwrapfloat \ignorespaces } -\fi +} % \end{macrocode} % @@ -1289,7 +1508,7 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % to be wrapped, but certain tasks are demanded to other service % macros. % -% It is possible to set the width of the box if the \meta{width} +% It is possible to set the width of the box if the \meta{width} % parameter is specified; otherwise it closes the \cs{hbox} that was used; % then it closes the main vertical box \cs{WF@box}. After executing % \cs{WF@floatstyhook}, necessary when package \pack{float.sty} @@ -1299,11 +1518,11 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % in the same box register with a negative initial vertical skip % that raises the box contents. % -% Now comes the definition of the fundamental environment \Env{wrapfloat}; -% compared to the original Arseneau's definition it is much longer, -% but it contains the code that Arseneau, who used the \LaTeXe -% language, had to split in several macros in order to handle the -% multitude of interspersed mandatory and optional arguments. +% Now comes the new actual definition of the fundamental environment +% \Env{wrapfloat}; compared to the original Arseneau's definition it is +% much longer, but it contains the code that Arseneau, who used the +% \LaTeXe language, and had to split it in several macros in order to +% handle the multitude of interspersed mandatory and optional arguments. % % The main function of this environment is to handle the box that % contains the figure, or the table, or the framed text, or what @@ -1315,25 +1534,27 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % corrected. As it can be seen the optional star is not among % the argument descriptors of the opening commands; it will be % the following macro \cs{WR@wr} responsible of taking care of -% the list of arguments and see if a star has been specified and -% not yet read by the preceding commands. +% the list of arguments and see if a star has been specified but +% is still in the input flow. % % In order to handle any kind of wrapped object, this environment % first argument is the \meta{caption label}. It may remain blank; % but for wrapping figures or tables their respective definitions % specify the name of the floating object they belong to; it is % necessary that there exists a floating environment with the same -% name of the wrapped object, even when its wrapping environment +% name of the wrapped object, even when its wrapping environment % is not specified with a floating \meta{location} argument. % % \begin{macrocode} - \NewDocumentEnvironment{wrapfloat}{m o m o G{\z@}}% - {\def\@captype{#1}\WF@wr[#2]{#3}[#4]{#5}}% - {\ifdim\hsize>\z@ +{% open environment code + \def\@captype{#1}\WF@wr[#2]{#3}[#4]{#5}% +}{% close environment code + \ifdim\hsize>\z@ \par\hrule\@width\hsize\@height\z@ % force width with invisible rule \else - \unskip \egroup \box\z@ % or close hbox +% \unskip % is the \unskip necessary? + \egroup \box\z@ % or close hbox \fi \egroup % close the vtop box; its width now is known \WF@floatstyhook % support for float.sty @@ -1354,7 +1575,7 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi \fi \fi \global\@ignoretrue - } +} % \end{macrocode} % @@ -1380,19 +1601,24 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % height to \cs{WF@size}. Afterwards some unusual macros are executed; % they were devised by Arseneau to deal with possibly floating wrapped % objects. The optional star is not accepted by this macro; if the user -% specified it, it is still in the input flux; notice that the -% \Env{wraptext} environment in version~4.0 does not accept the -% optional star; if the user specifies it for this environment, an -% asterisk appears at the beginning of the wrapped text; with -% version~5.0 the asterisk appears at the left of the framed text. -% In both cases, in facts, the first optional parameter is always -% interpreted as the \meta{line number correction}. +% specified it, it is still in the input flow; notice that the +% \Env{wraptext} environment does not accept the optional star; if the +% user indadvertedly specifies it for this environment, an +% asterisk appears at the beginning of the wrapped text with version~4; +% with versions~5 and~6 the asterisk appears at the left of the framed +% text. In all three cases, in facts, the first optional parameter is +% always interpreted as the \meta{line number correction}. % % The braced \meta{width} fourth parameter (actually a % \textit{braced optional parameter}) may be specified % to be \texttt{0pt}; in any case \texttt{0pt} is the default parameter % value; if so, the object is treated at its natural width, by -% boxing it into an hbox and using this box width as the working width. +% boxing it into an hbox and using this box width as the working +% width of course this works only with \Env{wrapfigure} and +% \Env{wraptable}, because what is being wrapped has its own natural +% width; with text the natural width is the default setting made +% with the \emph{braced optional argument} described with the +% \texttt{G} descriptor. % \begin{macrocode} \NewDocumentCommand\WF@wr{o m o m s}{% \xdef\WF@wfname{wrap\@captype\space}% @@ -1434,9 +1660,8 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi \IfBooleanTF{#5}% if the asterisk is present set the numerical switch {\global\WF@correctlines@switch=\@ne}% {\global\WF@correctlines@switch=\z@}% - \global\@ignoretrue -} +} % \end{macrocode} % % At this point the main box \cs{WF@box} is opened in order to @@ -1514,26 +1739,23 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi \vskip-\parskip \global\WF@floatfalse \let\pagetotal\maxdimen % kludge flag for "not top of page" \else % outer page - \unless\ifWFnew \@tempdima\pagedepth \fi% save page depth {\advance\parskip\@tempdima\vskip-\parskip}% back up to base line \penalty\interlinepenalty % update page parameters - \@tempdimb\pagegoal \advance\@tempdimb-\pagetotal % room left on page + \@tempdimb\dimexpr\pagegoal - \pagetotal \relax% room left on page \ifdim \@tempdimb<\z@ % page already full \global\WF@floatfalse - \unless\ifdim-\@tempdimb>\pageshrink - \pagebreak - \fi + \unless\ifdim-\@tempdimb>\pageshrink \pagebreak \fi \else \ifdim\WF@size>\@tempdimb% box too high does not fit in \@tempdimb \ifWF@float - \dimen@.5\baselineskip + \dimen@ 0.5\baselineskip \else \dimen@ 2\baselineskip \fi \ifdim\pagestretch>\dimen@ \dimen@\pagestretch \fi \ifdim\pagefilstretch>\z@ \dimen@\@tempdimb \fi \ifdim\pagefillstretch>\z@ \dimen@\@tempdimb \fi - \advance\dimen@.5\baselineskip + \advance\dimen@ 0.5\baselineskip \ifdim\dimen@>\@tempdimb % stretch page contents \global\WF@floatfalse \pagebreak \fi @@ -1541,7 +1763,7 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi \global\WF@floatfalse \fi \fi - \vskip\@tempdima\relax % return erased page depth + \vskip\@tempdima% return erased page depth \fi \noindent \ifWF@float @@ -1562,7 +1784,7 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi \ifnum `l=\WF@place % object on left \hss \def\@tempa{\kern\columnsep}% take right gap into action - \else % insert on light + \else % object on right \@tempdima\z@ % no left indentation \kern\@tempdimb \kern\columnsep \def\@tempa{\hss}% object overlaps space to the right @@ -1586,9 +1808,10 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi \aftergroup\WF@startwrapping \fi } + % \end{macrocode} % -% Here comes the very important macro that counts the wrapping indented +% Here comes the very important macro that counts the indented wrapping % lines, so that wrapping is correct; of course the limitations % of the \LaTeX processing (needed to ship out a complete % page) forbid to take into account the spaces inserted between @@ -1614,18 +1837,19 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi \ifnum\WF@correctlines@switch>\z@ % line number correction \setcounter{WF@wrappedlines} {\fpeval{round((\WF@size)/\baselineskip,0)+\WF@wli}}% - \xdef\WF@wli{\value{WF@wrappedlines}}% + \xdef\WF@wli{\the\c@WF@wrappedlines}% \else \setcounter{WF@wrappedlines}{\WF@wli}% absolute number of lines - \global\advance\c@WF@wrappedlines\@ne + \stepcounter{WF@wrappedlines}% \fi \fi \ifnum\c@WF@wrappedlines>\@ne % fine tuning \let\parshape\WF@fudgeparshape \let\WF@pspars\@empty \let\WF@@par\par \def\@setpar##1{\def\WF@@par{##1}}\def\par{\@par}\let\@par\WF@mypar - \xdef\WF@restoretol{\tolerance\the\tolerance}\tolerance9999 + \xdef\WF@restoretol{\tolerance\the\tolerance}\tolerance9999\relax \advance\linewidth-\WF@adjlw \advance\@totalleftmargin\WF@adjtlm - \fi} + \fi +} % \end{macrocode} % @@ -1692,7 +1916,7 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi \ifnum\c@WF@wrappedlines<\tw@ \WF@finale \else - \afterassignment\WF@fudgeparshapee \fam + \afterassignment\WF@fudgeparshapee \fam \fi } @@ -1826,18 +2050,18 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi % with package \pack{float.sty}, since, after defining a new float % \meta{foo}, it suffices to define the new environment % \Env{wrap\meta{foo}}. This fork version of his package should do -% the same: is suffices to mimic the definitions of environments +% the same: it suffices to mimic the definitions of environments % \Env{wrapfigure} or \Env{wraptable}. % % Here there is some Arseneau's code that renders his \pack{wrapfig} % code compatible with \cs{newfloat} of class \class{memoir}, and -% with \cs{newfloatlist} of package \pack{ccaption}. We leave his code -% hereafter; but we did not test it with this package. -% \begin{macrocode} +% with \cs{newfloatlist} of package \pack{ccaption}. We keep his code, +% but we did not test it with this package. +% \begin{macrocode} \let\WF@floatstyhook\relax -% + \@ifundefined{newfloat}{}{% \newfloat comes from somewhere besides -% float.sty + % float.sty \@ifundefined{restylefloat}{% \@ifclassloaded{memoir}{% \toks@=\expandafter\expandafter\expandafter @@ -1850,10 +2074,11 @@ X\ifdim\fontdimen1\font=0pt\kern-0.15em\fi }% end memoir support {}% other origins of \newfloat here? }{% float.sty handler. Ops: Two versions for different versions -% Changing \floatstyle or \restylefloat changes \newfloat too. + % Changing \floatstyle or \restylefloat changes also \newfloat. \@ifundefined{float@restyle}% {% older float.sty - \toks@=\expandafter{\restylefloat{#1}% env. might be undefined + + \toks@=\expandafter{\restylefloat{##1}% env. might be undefined \@namedef{wrap#1}{% \def\@captype{#1}\@nameuse{fst@#1}% \def\WF@floatstyhook{\let\@currbox\WF@box \columnwidth\wd\WF@box diff --git a/macros/latex/contrib/wrapfig2/wrapfig2.pdf b/macros/latex/contrib/wrapfig2/wrapfig2.pdf index dcbb079d64..d8b27c3e18 100644 Binary files a/macros/latex/contrib/wrapfig2/wrapfig2.pdf and b/macros/latex/contrib/wrapfig2/wrapfig2.pdf differ -- cgit v1.2.3