diff options
author | Norbert Preining <norbert@preining.info> | 2023-07-04 03:00:52 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2023-07-04 03:00:52 +0000 |
commit | ab7f5e4df027c13f5aef4fbdb032184cf2f3d5c3 (patch) | |
tree | 0b38ffb066618d85c27ed23a0095689acbb45b6e /graphics | |
parent | 4b749d92c46780575d3bd3dd7544030300a51301 (diff) |
CTAN sync 202307040300
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/pgf/contrib/profsio/doc/ProfSio-doc-fr.pdf | bin | 692493 -> 307885 bytes | |||
-rw-r--r-- | graphics/pgf/contrib/profsio/doc/ProfSio-doc-fr.tex | 379 | ||||
-rw-r--r-- | graphics/pgf/contrib/profsio/tex/ProfSio.sty | 583 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-math/Changes | 1 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-math/README | 7 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-math/doc/pst-math-doc.pdf | bin | 228170 -> 253131 bytes | |||
-rw-r--r-- | graphics/pstricks/contrib/pst-math/doc/pst-math-doc.tex | 4 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-math/latex/pst-math.sty | 8 | ||||
-rw-r--r-- | graphics/pstricks/contrib/pst-math/tex/pst-math.tex | 4 |
9 files changed, 947 insertions, 39 deletions
diff --git a/graphics/pgf/contrib/profsio/doc/ProfSio-doc-fr.pdf b/graphics/pgf/contrib/profsio/doc/ProfSio-doc-fr.pdf Binary files differindex e90084029e..3c07f06d1c 100644 --- a/graphics/pgf/contrib/profsio/doc/ProfSio-doc-fr.pdf +++ b/graphics/pgf/contrib/profsio/doc/ProfSio-doc-fr.pdf diff --git a/graphics/pgf/contrib/profsio/doc/ProfSio-doc-fr.tex b/graphics/pgf/contrib/profsio/doc/ProfSio-doc-fr.tex index ac11dc168a..0d7a8b3b51 100644 --- a/graphics/pgf/contrib/profsio/doc/ProfSio-doc-fr.tex +++ b/graphics/pgf/contrib/profsio/doc/ProfSio-doc-fr.tex @@ -1,13 +1,14 @@ % !TeX TXS-program:compile = txs:///arara -% arara: pdflatex: {shell: yes, synctex: no, interaction: batchmode} -% arara: pdflatex: {shell: yes, synctex: no, interaction: batchmode} if found('log', '(undefined references|Please rerun|Rerun to get)') +% arara: lualatex: {shell: yes, synctex: no, interaction: batchmode} +% arara: lualatex: {shell: yes, synctex: no, interaction: batchmode} +% arara: lualatex: {shell: yes, synctex: no, interaction: batchmode} \documentclass[french,a4paper,11pt]{article} \usepackage[margin=2cm,includefoot]{geometry} -\def\TPversion{0.1.1} -\def\TPdate{26 juin 2023} -\usepackage[utf8]{inputenc} -\usepackage[T1]{fontenc} +\def\TPversion{0.1.2} +\def\TPdate{3 juillet 2023} +%\usepackage[utf8]{inputenc} +%\usepackage[T1]{fontenc} \usepackage{amsmath,amssymb} \usepackage{ProfSio} \usepackage{awesomebox} @@ -17,6 +18,7 @@ \usepackage{enumitem} \usepackage{wrapstuff} \usepackage{lipsum} +\UseTblrLibrary{booktabs} \usepackage{fancyvrb} \usepackage{fancyhdr} \fancyhf{} @@ -48,7 +50,7 @@ \AddThinSpaceBeforeFootnotes \FrenchFootnotes -\usepackage{listings} +%\usepackage{listings} \usepackage{newverbs} \newverbcommand{\motcletex}{\color{cyan!75!black}}{} @@ -79,10 +81,10 @@ keywordstyle={\color{violet}},% classoffset=2,% alsoletter={-},% - morekeywords={\MPMPlaceTache,\MPMPlaceNotice,\MPMPlaceDuree,GrapheMPM,TableKarnaugh,\KarnaughCasesResult,\KarnaughBlocRegroup,\MPMPlaceTaches,\MPMPlaceDurees,GrapheTikz,\GrphPlaceSommets,\GrphTraceAretes,\tikzset,\DiagrammeSagittal,\draw},% + morekeywords={\MPMPlaceTache,\MPMPlaceNotice,\MPMPlaceDuree,GrapheMPM,TableKarnaugh,\KarnaughCasesResult,\KarnaughBlocRegroup,\MPMPlaceTaches,\MPMPlaceDurees,GrapheTikz,\GrphPlaceSommets,\GrphTraceAretes,\tikzset,\DiagrammeSagittal,\draw,\DiagrammeSagittalCompo,\TableVerite},% keywordstyle={\color{green!50!black}},% classoffset=3,% - morekeywords={CouleurDurees,CouleurFleches,LargeurCases,Epaisseur,Police,CouleurDates,CouleurBords,NoirBlanc,Grille,DecalHorizDeb,DecalVertDeb,DecalHorizFin,DecalVertFin,Coude,SensCoude,Unite,Variables,Swap,Aide,CouleurCases,Decalage,Couleur,Type,Legende,PosVarLaterale,CouleurLegende,CouleurSommets,TypeSommets,Unite,CouleurFT,DimensionSommets,PositionFleches,EchelleFleches,TypeFleche,Droit,Milieu,AngleGauche,AngleDroite,Boucle,GrphStyleArc,GrphStyleSommet,Poids,GrphStylepoids,DistElem,DistEns,LargEns,NomAppli,CouleurE,CouleurAppli,CouleurF,CouleurFleches,TypeFleche,Epaisseur,Labels,Ensembles,PosLabels,PoliceLabels},% + morekeywords={CouleurDurees,CouleurFleches,LargeurCases,Epaisseur,Police,CouleurDates,CouleurBords,NoirBlanc,Grille,DecalHorizDeb,DecalVertDeb,DecalHorizFin,DecalVertFin,Coude,SensCoude,Unite,Variables,Swap,Aide,CouleurCases,Decalage,Couleur,Type,Legende,PosVarLaterale,CouleurLegende,CouleurSommets,TypeSommets,Unite,CouleurFT,DimensionSommets,PositionFleches,EchelleFleches,TypeFleche,Droit,Milieu,AngleGauche,AngleDroite,Boucle,GrphStyleArc,GrphStyleSommet,Poids,GrphStylepoids,DistElem,DistEns,LargEns,NomAppli,CouleurE,CouleurAppli,CouleurF,CouleursFleches,TypeFleche,Epaisseur,Labels,Ensembles,PosLabels,PoliceLabels,Offset,NomApplis,CouleursAppli,VF,LargeursColonnes,CouleurEnonce,CodeAvant,CodeApres},% keywordstyle={\color{orange}} },% #1 @@ -126,8 +128,6 @@ {\Huge \texttt{ProfSio} [fr]}\\ \\ {\LARGE Des outils pour les Maths en BTS SIO.} \\ - \\ - {\large (Services Informatiques aux Organisations)} \end{tabular} \bigskip @@ -140,8 +140,7 @@ \begin{center} \begin{tabular}{c} - \texttt{Cédric Pierquet}\\ - {\ttfamily c pierquet -- at -- outlook . fr}\\ + \texttt{Cédric Pierquet} ({\ttfamily c pierquet -- at -- outlook . fr})\\ \texttt{\url{https://github.com/cpierquet/profsio}} \end{tabular} \end{center} @@ -162,6 +161,10 @@ {$\blacktriangleright$~~Créer des graphes simples ou des diagrammes sagittaux. +\vspace{0.15cm} + +{$\blacktriangleright$~~Créer des tables de vérité (via \hologo{LuaLaTeX}) grâce au code du package \packagetex!luatruthtable!\footnotemark\footnotetext{Package \LaTeX{} : \href{https://ctan.org/pkg/luatruthtable}{[Lien]} sur le site du CTAN}. + \vspace{1cm} \hfill @@ -195,18 +198,20 @@ \hfill~ \hfill -\begin{TableKarnaugh}<scale=0.9> +\begin{TableKarnaugh}<scale=0.9,baseline=(current bounding box.center)> \KarnaughCasesResult{0,1,1,0,1,1,1,1} \KarnaughBlocRegroup[Type=Centre,Couleur=blue!75,Decalage=-1.5pt]{10}{32} \KarnaughBlocRegroup[Type=Gauche,Couleur=red!75,Decalage=-1.5pt]{00}{11} \KarnaughBlocRegroup[Type=Droite,Couleur=red!75,Decalage=-1.5pt]{40}{31} \end{TableKarnaugh} \hspace{1cm} -\begin{TableKarnaugh}[Variables=u/v/w,Swap,CouleurCases=lime] +\begin{TableKarnaugh}[Variables=u/v/w,Swap,CouleurCases=lime]<scale=0.9,baseline=(current bounding box.center)> \KarnaughCasesResult*{1,1,1,1,1,0,0,0} \KarnaughBlocRegroup[Type=Centre,Couleur=blue!75,Decalage=-1.5pt]{00}{12} \KarnaughBlocRegroup[Type=Centre,Couleur=red!75,Decalage=-1.15pt]{01}{42} \end{TableKarnaugh} +\hspace{1cm} +\TableVerite<baseline=c>{P,Q}{$P$,$Q$}{lognot*P,P*logand*Q,P*imp*Q}{$\lnot P$,$P \lor Q$,$P \Rightarrow Q$} \hfill~ \vspace{0.5cm} @@ -246,8 +251,14 @@ \vfill +\newpage + \section{Historique} +\verb|v0.1.2|~:~~~~Clé \Cle{Offset} pour les diagrammes sagittaux + Diagrammes sagittaux de composées. + +\verb| |~:~~~~Ajout des tables de vérité (via \hologo{LuaLaTeX}). + \verb|v0.1.1|~:~~~~Mise à jour de la documentation + Diagrammes sagittaux. \verb|v0.1.0|~:~~~~Version initiale. @@ -264,13 +275,18 @@ Le package \packagetex!ProfSio! propose quelques commandes pour travailler sur d \begin{itemize} \item graphe d'ordonnancement par la méthode MPM ; \item tableau de Karnaugh à 3 variables ; - \item graphes \textit{simples} orientés, pondérés. + \item graphes \textit{simples} orientés ou pondérés, des diagrammes sagittaux ; + \item des tables de vérité (via \hologo{LuaLaTeX}). \end{itemize} \vspace*{-\baselineskip}\leavevmode \end{noteblock} \begin{warningblock} Le code ne propose par de \og résolution \fg{} du graphe MPM, de \og simplification \fg{} d'expressions booléennes ou de représentation \og automatique \fg{} d'un graphe, il ne consiste \textit{qu'en} une mise en forme du graphe MPM, du tableau de Karnaugh ou du graphe. + +\smallskip + +Par contre, pour les tables de vérité, le code se charge de créer le tableau \underline{entièrement}, grâce aux données du package \packagetex!luatruthtable! (légèrement \textit{patchées} pour obtenir une alternance un peu plus homogène). \end{warningblock} \subsection{Chargement du package, packages utilisés} @@ -291,20 +307,17 @@ Il n'existe pas d'option pour le package, et \packagetex!xcolor! n'est pas charg \packagetex!ProfSio! charge les packages suivantes : \begin{itemize} - \item \packagetex!tikz!, \packagetex!pgffor! et \packagetex!xintexpr! ; - \item \packagetex!tabularray!, \packagetex!simplekv!, \packagetex!xstring! et \packagetex!listofitems! ; + \item \packagetex!tikz!, \packagetex!pgffor!, \packagetex!xintexpr!, \packagetex!tabularray!, \packagetex!simplekv!, \packagetex!xstring! et \packagetex!listofitems! ; + \item \packagetex!luacode! et \packagetex!nicematrix! (uniquement si le compilateur détecté est \hologo{LuaLaTeX}) ; \item les librairies \packagetex!tikz! : \begin{itemize} - \item \motcletex!tikz.positioning! + \item \motcletex!tikz.positioning!, \motcletex!tikz.babel!, \motcletex!tikz.calc! ; \item \motcletex!tikz.decorations.pathreplacing! et \motcletex!tikz.decorations.markings! ; - \item \motcletex!tikz.babel! ; - \item \motcletex!tikz.calc! ; - \item \motcletex!tikz.shapes! et \motcletex!tikz.shapes.geometric! ; - \item \motcletex!tikz.arrows! et \motcletex!tikz.arrows.meta!. + \item \motcletex!tikz.shapes!, \motcletex!tikz.shapes.geometric!, \motcletex!tikz.arrows! et \motcletex!tikz.arrows.meta!. \end{itemize} \end{itemize} -Il est compatible avec les compilations usuelles en \textsf{latex}, \textsf{pdflatex}, \textsf{lualatex} ou \textsf{xelatex}. +Il est compatible avec les compilations usuelles en \textsf{latex}, \textsf{pdflatex}, \textsf{lualatex} (obligatoire pour les tables de vérité !) ou \textsf{xelatex}. \end{noteblock} \subsection{Fonctionnement global} @@ -321,7 +334,7 @@ Le choix a été fait de : \begin{itemize} \item présenter l'ordonnancement par la méthode MPM, avec présentation des tâches \textit{fixée} ; \item limiter les tableaux de Karnaugh pour 3 variables, avec présentation \textit{fixée} ; - \item de ne pas forcément proposer de modification de la présentation \textit{globale} + \item de ne pas forcément proposer de modification de la présentation \textit{globale}. \end{itemize} \vspace*{-\baselineskip}\leavevmode \end{noteblock} @@ -1006,7 +1019,7 @@ Pour marquer une fermeture transitive, on peut utiliser le style \verb|FT| dans \pagebreak -\section{Diagrammes sagittaux} +\section{Diagramme sagittal d'une application} \subsection{Commande et fonctionnement global} @@ -1075,12 +1088,13 @@ Les \Cle{clés} disponibles sont : \item \Cle{DistElem} := distance verticale entre les éléments ; \hfill{}défaut : \Cle{0.75} \item \Cle{DistEns} := distance entre les \og patates \fg{} ; \hfill{}défaut : \Cle{4} \item \Cle{LargEns} := largeur des \og patates \fg{} ; \hfill{}défaut : \Cle{1.5} - \item \Cle{NomAppli} := nom de l'application ; \hfill{}défaut : \Cle{$f$} + \item \Cle{NomAppli} := nom de l'application ; \hfill{}défaut : \Cle{\$f\$} \item \Cle{CouleurE} := couleur de l'ensemble de départ ; \hfill{}défaut : \Cle{blue} \item \Cle{CouleurAppli} := couleur de l'application ; \hfill{}défaut : \Cle{violet} \item \Cle{CouleurF} := couleur de l'ensemble d'arrivée ; \hfill{}défaut : \Cle{red} \item \Cle{CouleurFleches} := couleur des flèches ; \hfill{}défaut : \Cle{teal} \item \Cle{TypeFleche} := type de la flèche ; \hfill{}défaut : \Cle{Latex} + \item \Cle{Offset} := décalage entre les flèches et les éléments (points) ; \hfill{}défaut : \Cle{2pt} \item \Cle{Epaisseur} := épaisseur des tracés ; \hfill{}défaut : \Cle{0.8pt} \item \Cle{Police} := police pour les éléments ; \hfill{}défaut : \Cle{vide} \item \Cle{NoirBlanc} := booléen pour forcer l'affichage en N\&{}B ; \hfill{}défaut : \Cle{false} @@ -1105,7 +1119,7 @@ Le troisième argument, obligatoire et entre \texttt{\{...\}}, permet de précis \begin{DemoCode}[] \DiagrammeSagittal[% E={1,2,3,4,5,6,7},F={a,b,c,d,e},Labels=false,% - DistElem=1,DistEns=6,LargEns=2,% + DistElem=1,DistEns=6,LargEns=2,Offset=4pt,% CouleurE=teal,CouleurF=orange,CouleurAppli=brown,CouleurFleches=brown ]{1/a,2/b,3/b,4/c,5/d,6/e,7/e} \end{DemoCode} @@ -1121,4 +1135,313 @@ Le troisième argument, obligatoire et entre \texttt{\{...\}}, permet de précis \end{tikzpicture} \end{DemoCode} +\pagebreak + +\section{Diagramme sagittal d'une composée d'applications} + +\subsection{Commande et fonctionnement global} + +\begin{cautionblock} +La commande dédiée à la création d'un diagramme sagittal pour une application est \motcletex!\DiagrammeSagittalCompo!. + +Le diagramme créé est réalisé avec un environnement \motcletex!tikzpicture!. +\end{cautionblock} + +\begin{DemoCode}[listing only] +%commande autonome +\DiagrammeSagittalCompo[clés]<options tikz>{liaisons1}{liaisons2} + +%commande à insérer dans un environnement tikzpicture +\begin{tikzpicture} + \DiagrammeSagittalCompo*[clés]{liaisons1}{liaisons2} +\end{tikzpicture} +\end{DemoCode} + +\begin{DemoCode}[] +\DiagrammeSagittalCompo% + [E={a,b,c,d},F={A,B,C,E,F,G,H},G={1,2,3,4,5}]% + {a/B,d/H}% + {B/1,B/2,H/5} +\end{DemoCode} + +\begin{warningblock} +La majorité des paramètres sont personnalisables, mais le \textit{thème} général est globalement \textit{fixé}, dans le sens où ce sont les éléments \textit{cosmétiques} qui pourront être modifiés. + +\smallskip + +La commande de création de \packagetex!ProfSio! est volontairement pour des applications basiques, dans l'optique de travailler avec exemples en adéquation avec le programme de BTS SIO. +\end{warningblock} + +\subsection{Arguments et clés} + +\begin{DemoCode}[listing only] +\DiagrammeSagittalCompo[clés]<options tikz>{liaisons1}{liaisons2} + +\begin{tikzpicture} + \DiagrammeSagittalCompo*[clés]{liaisons1}{liaisons2} +\end{tikzpicture} +\end{DemoCode} + +\begin{noteblock} +Le code se charge, grâce aux \Cle{clés}, de positionner et d'aligner les éléments des ensembles et les flèches. + +De ce fait, les \textit{écarts} entre les éléments d'un ensemble sont fixées globalement, tout comme le style général des flèches. +\end{noteblock} + +\begin{tipblock} +La version \textit{étoilé} permet de ne pas créer l'environnement \motcletex!tikzpicture!, pour d'éventuels rajouts ultérieurs : + +\begin{itemize} + \item les éléments de l'ensemble de départ sont des nœuds nommés \verb!(E...)! ; + \item les éléments de l'ensemble du milieu sont des nœuds nommés \verb!(F...)! ; + \item les éléments de l'ensemble d'arrivée sont des nœuds nommés \verb!(G...)!. +\end{itemize} +\vspace*{-\baselineskip}\leavevmode +\end{tipblock} + +\begin{tipblock} +Les \Cle{clés} disponibles sont : + +\begin{itemize} + \item \Cle{DistElem} := distance verticale entre les éléments ; \hfill{}défaut : \Cle{0.75} + \item \Cle{DistEns} := distance entre les \og patates \fg{} ; \hfill{}défaut : \Cle{4} + \item \Cle{LargEns} := largeur des \og patates \fg{} ; \hfill{}défaut : \Cle{1.5} + \item \Cle{NomApplis} := nom des applications ; \hfill{}défaut : \Cle{\$f\$/\$g\$} + \item \Cle{CouleurE} := couleur de l'ensemble de départ ; \hfill{}défaut : \Cle{blue} + \item \Cle{CouleurApplis} := couleurs des applications, \Cle{Couleur} ou \Cle{Couleur\_f/Couleur\_g} ; + + \hfill{}défaut : \Cle{violet} + \item \Cle{CouleurF} := couleur de l'ensemble du milieu ; \hfill{}défaut : \Cle{red} + \item \Cle{CouleurG} := couleur de l'ensemble d'arrivée ; \hfill{}défaut : \Cle{gray} + \item \Cle{CouleursFleches} := couleurs des flèches, \Cle{Couleur} ou \Cle{Couleur\_f/Couleur\_g} ; + + \hfill{}défaut : \Cle{teal} + \item \Cle{TypeFleche} := type de la flèche ; \hfill{}défaut : \Cle{Latex} + \item \Cle{Offset} := décalage entre les flèches et les éléments (points) ; \hfill{}défaut : \Cle{2pt} + \item \Cle{Epaisseur} := épaisseur des tracés ; \hfill{}défaut : \Cle{0.8pt} + \item \Cle{Police} := police pour les éléments ; \hfill{}défaut : \Cle{vide} + \item \Cle{NoirBlanc} := booléen pour forcer l'affichage en N\&{}B ; \hfill{}défaut : \Cle{false} + \item \Cle{Labels} := booléen pour afficher les noms des ensembles ; \hfill{}défaut : \Cle{true} + \item \Cle{Ensembles} := nom des ensembles ; + + \hfill{}défaut : \Cle{\$\textbackslash mathcal\{E\}\$/\$\textbackslash mathcal\{F\}\$/\$\textbackslash mathcal\{G\}\$} + \item \Cle{PosLabels} := position des labels, parmi \Cle{haut/bas}. \hfill{}défaut : \Cle{bas} +\end{itemize} + +Le deuxième argument, optionnel et entre \texttt{<...>} propose des options, en langage \packagetex!tikz! à passer à l'environnement. + +\smallskip + +Les arguments \texttt{3} et \texttt{4}, obligatoires et entre \texttt{\{...\}}, permettent de préciser les \textit{liaisons} sous la forme \verb!x1/f(x1),x2/f(x2),...! et \verb!y1/g(y1),y2/g(y2),...! . +\end{tipblock} + +\subsection{Exemples} + +\begin{DemoCode}[] +\DiagrammeSagittalCompo% + [DistElem=1,DistEns=5,LargEns=1.75,Police={\Large\ttfamily},% + Epaisseur=1pt,NomApplis={$h$/$\varphi$},CouleursFleches={teal/lime},% + E={a,b,c,d,e,f},F={A,C,H,P},G={1,2,3,4,5},PoliceLabels=\Large]% + {a/A,a/P,b/H,e/P,c/C}% + {A/5,C/3,H/3,P/4}% +\end{DemoCode} + +\begin{DemoCode}[] +\DiagrammeSagittalCompo% + [E={a,b,c,d,e},F={1,2,3,4,5,6,7},G={a,b,c,d,e},% + Ensembles={E/F/E}]% + {a/1,b/2,c/4,d/5,e/6}% + {1/a,2/b,3/b,4/c,5/d,6/e,7/e}% +\end{DemoCode} + +\begin{DemoCode}[] +\begin{tikzpicture} + \DiagrammeSagittalCompo*% + [E={a,b,c,d,e},F={1,2,3,4,5,6,7},G={a,b,c,d,e},% + Ensembles={E/F/E}]% + {a/1,b/2,c/4,d/5,e/6}% + {1/a,2/b,3/b,4/c,5/d,6/e,7/e}% + \draw[orange!50!black,<-,thick,dashed,>=Latex] ($(Gc)+(12pt,0)$) to[bend left=10]++ (2,-1) node[right] {\parbox{4cm}{On a donc $g\,{\small\circ\,}f(c)=c$}} ; +\end{tikzpicture} +\end{DemoCode} + +\pagebreak + +\section{Table de vérité} + +\subsection{Commande et fonctionnement global} + +\begin{cautionblock} +La commande dédiée à la création d'une table de vérité (à deux variables minimum) est \motcletex!\TableVerite!. + +La commande est accessible \textbf{uniquement} en cas d'une compilation en \hologo{LuaLaTeX} ! + +Le tableau est créé grâce au package \packagetex!nicematrix!. +\end{cautionblock} + +\begin{importantblock} +Une \textbf{double compilation} peut être nécessaire pour le placement correct des filets ! + +Les fonction \textsf{LUA} utilisées sont issues du \packagetex!luatruthtable!, elles sont légèrement modifiées pour \textit{coller} à une présentation plus classique. +\end{importantblock} + +\begin{DemoCode}[listing only] +\TableVerite[clés]<opts nicematrix>{vars}{colonnes_vars}{calculs}{colonnes_calculs} +\end{DemoCode} + +\begin{DemoCode}[] +\TableVerite{P}{$P$}% + {lognot*P,P*logand*P,P*logor*P,P*iff*P,P*imp*P}% + {$\lnot P$,$P \land P$,$P \lor P$,$P \Leftrightarrow P$,$P \Rightarrow P$} +\end{DemoCode} + +\begin{DemoCode}[] +\TableVerite{P,Q}{$P$,$Q$}{lognot*P,P*logand*Q}{$\lnot P$,$P \land Q$} +\end{DemoCode} + +\subsection{Arguments et clés pour la commande} + +\begin{DemoCode}[listing only] +\TableVerite[clés]<opts nicematrix>{vars}{colonnes_vars}{calculs}{colonnes_calculs} +\end{DemoCode} + +\begin{tipblock} +En ce qui concerne la création du tableau, les \Cle{clés} sont : + +\begin{itemize} + \item \Cle{VF} := pour préciser Vrai/Faux ; \hfill~défaut : \Cle{V/F} + \item \Cle{Swap} := booléen pour commencer par FFF au lieu de VVV ; \hfill~défaut : \Cle{false} + \item \Cle{LargeursColonnes} := largeur des colonnes, \Cle{auto} ou \Cle{largeurG} ou \Cle{LargeurVar/LargeurCalc} ; + + \hfill~défaut : \Cle{auto} + \item \Cle{CouleurEnonce} := couleur de fond de la première ligne ; \hfill~défaut : \Cle{vide} + \item \Cle{CodeAvant} := code \texttt{CodeBefore} (et avant l'éventuel coloriage de la première ligne) pour \motcletex!nicetabular! ; + + \hfill~défaut : \Cle{vide} + \item \Cle{CodeApres} := code \texttt{CodeAfter} pour \motcletex!nicetabular!. \hfill~défaut : \Cle{vide} +\end{itemize} + +Le deuxième argument, optionnel et entre \texttt{<...>} propose des options, en langage \packagetex!nicematrix! à passer à la commande. +\end{tipblock} + +\pagebreak + +\begin{tipblock} +Le troisième argument, obligatoire et entre \texttt{\{...\}}, permet de spécifier les calculs à effectuer, en langage \motcletex!luatruthtable!, notamment : + +\begin{itemize} + \item \texttt{lognot*} pour le \textsf{CONTRAIRE} ; + \item \texttt{*logand*} pour le \textsf{ET} ; + \item \texttt{*logor*} pour le \textsf{OU} ; + \item \texttt{*iff*} pour le \textsf{ÉQUIVALENT} ; + \item \texttt{*imp*} pour le \textsf{IMPLIQUE} ; + \item le reste est disponible dans la documentation (\url{http://mirrors.ctan.org/macros/luatex/latex/luatruthtable/luatruthtable.pdf}). +\end{itemize} + +Le dernier argument, obligatoire et entre \texttt{\{...\}}, permet de spécifier les labels des calculs, en langage \LaTeX{} cette fois-ci. +\end{tipblock} + +\subsection{Compléments pour le package luatruthtable} + +\begin{tipblock} +Le tableau suivant présente les connecteurs logiques issues du package \packagetex!luatruthtable! : + +\begin{center} + \begin{tblr}{colspec={Q[m,l]Q[m,l]Q[m,l]Q[m,l]},row{1}={fg=red!50!black,font=\sffamily},cell{2-Z}{1-2}={fg=cyan!75!black},column{3}={c}} + \toprule + Opérateur & Syntaxe & Expression & Description \\ + \toprule + \texttt{lognot*} & \texttt{lognot*P} & $\lnot P$ & Négation de P \\ + \midrule + \texttt{*logand*} & \texttt{P*logand*Q} & $P \land Q$ & Conjonction (et) de P et Q \\ + \midrule + \texttt{*logor*} & \texttt{P*logor*Q} & $P \lor Q$ & Disjonction (ou) de P et Q \\ + \midrule + \texttt{*imp*} & \texttt{P*imp*Q} & $P \Rightarrow Q$ & Implication de P vers Q \\ + \midrule + \texttt{*iff*} & \texttt{P*iff*Q} & $P \Leftrightarrow Q$ & Équivalence de P et Q \\ + \midrule + \texttt{*lognand*} & \texttt{P*lognand*Q} & $\lnot(P \land Q)$ & NAND de P et Q \\ + \midrule + \texttt{*logxor*} & \texttt{P*logxor*Q} & $(P \lor Q) \land \lnot (P \land Q)$ & XOR de P et Q \\ + \midrule + \texttt{*lognor*} & \texttt{P*lognor*Q} & $\lnot(P \lor Q)$ & NOR de P et Q \\ + \midrule + \texttt{*logxnor*} & \texttt{P*logxnor*Q} & $(P \land Q) \lor (\lnot P \land \lnot Q)$ & XNOR de P et Q \\ + \bottomrule + \end{tblr} +\end{center} +\end{tipblock} + +\subsection{Exemples} + +\begin{DemoCode}[] +\TableVerite{P,Q}{$P$,$Q$}{lognot*P,P*logand*Q}{$\lnot P$,$P \land Q$} +\end{DemoCode} + +\begin{DemoCode}[] +\TableVerite[LargeursColonnes=2cm]{P,Q}{$P$,$Q$}{lognot*P,P*logand*Q}{$\lnot P$,$P \land Q$} +\end{DemoCode} + +\begin{DemoCode}[] +\TableVerite[LargeursColonnes=1cm/2cm]{P,Q}{$P$,$Q$}{lognot*P,P*logand*Q}{$\lnot P$,$P \land Q$} +\end{DemoCode} + +\begin{DemoCode}[] +\TableVerite[CouleurEnonce=lightgray!25]{P,Q}{$P$,$Q$}{lognot*P,P*logand*Q}{$\lnot P$,$P \land Q$} +\end{DemoCode} + +\begin{DemoCode}[] +\TableVerite% + [CodeAvant={\columncolor{red!15}{1}\columncolor{teal!15}{4}}]% + {P,Q}{$P$,$Q$}{lognot*P,P*logand*Q}{$\lnot P$,$P \land Q$} +\end{DemoCode} + +\begin{DemoCode}[] +\TableVerite% + [CodeApres={\UnderBrace[yshift=4pt]{1-4}{5-4}{et}}]% + {P,Q}{$P$,$Q$}{lognot*P,P*logand*Q}{$\lnot P$,$P \land Q$} +\hspace{5mm} +\TableVerite% + [Swap,CodeApres={\UnderBrace[yshift=4pt]{1-4}{5-4}{et}}]% + {P,Q}{$P$,$Q$}{lognot*P,P*logand*Q}{$\lnot P$,$P \land Q$} +\hspace{5mm} +\TableVerite% + [VF={Vrai/Faux},CodeApres={\UnderBrace[yshift=4pt]{1-4}{5-4}{et}}]% + {P,Q}{$P$,$Q$}{lognot*P,P*logand*Q}{$\lnot P$,$P \land Q$} +\vspace*{0.75cm} +\end{DemoCode} + +\begin{DemoCode}[] +\TableVerite% + [CodeAvant={\columncolor{red!15}{5}\columncolor{red!15}{8}}]% + {P,Q,R}% + {$P$,$Q$,$R$}% + {% + Q*logand*R,P*logor*(Q*logand*R),P*logor*Q,% + Q*logor*R,(P*logor*Q)*logand*(P*logor*R) + }% + {$Q \land R$,$P \lor (Q \land R)$,$P \lor Q$,$Q \lor R$,$(P \lor Q) \land (P \lor R)$} +\end{DemoCode} + +\begin{DemoCode}[] +%Loi de De Morgan + +\TableVerite% + [CouleurEnonce=lightgray!15,LargeursColonnes=0.75cm/2cm,% + CodeAvant={\columncolor{teal!10}{6}\columncolor{teal!10}{7}}]% + {P,Q}{$P$,$Q$}% + {lognot*P,lognot*Q,P*logand*Q, + lognot*(P*logand*Q),(lognot*P)*logor*(lognot*Q)}% + {$\lnot P$,$\lnot Q$,$P\land Q$,$\lnot(P\land Q)$,$(\lnot P)\lor(\lnot Q)$} + +\TableVerite% + [CouleurEnonce=lightgray!15,LargeursColonnes=0.75cm/2cm,VF={1/0},% + CodeAvant={\columncolor{orange!10}{6}\columncolor{orange!10}{7}}]% + {P,Q}{$P$,$Q$}% + {lognot*P,lognot*Q,P*logand*Q, + lognot*(P*logand*Q),(lognot*P)*logor*(lognot*Q)}% + {$\lnot P$,$\lnot Q$,$P\land Q$,$\lnot(P\land Q)$,$(\lnot P)\lor(\lnot Q)$} +\end{DemoCode} + \end{document}
\ No newline at end of file diff --git a/graphics/pgf/contrib/profsio/tex/ProfSio.sty b/graphics/pgf/contrib/profsio/tex/ProfSio.sty index 103b2667dd..1de0681384 100644 --- a/graphics/pgf/contrib/profsio/tex/ProfSio.sty +++ b/graphics/pgf/contrib/profsio/tex/ProfSio.sty @@ -1,12 +1,15 @@ % Author : C. Pierquet % licence : Released under the LaTeX Project Public License v1.3c or later, see http://www.latex-project.org/lppl.txtf +% : Luatruthtable from Chetan Shirore and Dr. Ajit Kumar https://ctan.org/pkg/luatruthtable \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{ProfSio}[2023/06/26 0.1.1 Pour les enseignants en BTS SIO] +\ProvidesPackage{ProfSio}[2023/07/03 0.1.2 Pour les enseignants en BTS SIO] +%0.1.2 Ajout d'une option [Offset] pour les diagrammes sagittaux + Diagrammes sagittaux de composée + Tables de vérité %0.1.1 Correction de la documentation + Ajout des diagrammes sagittaux %0.1.0 Version initiale %------Packages utiles +\RequirePackage{iftex} \RequirePackage{tikz,pgffor} \RequirePackage{tabularray} \RequirePackage{simplekv} @@ -557,7 +560,8 @@ Police=\def\DSPolicePatates{#1},% PoliceLabels=\def\DSPoliceLabels{#1},% Ensembles=\def\DSNomEns{#1},% - PosLabels=\def\DSPosLabels{#1} + PosLabels=\def\DSPosLabels{#1},% + Offset=\def\DSOffset{#1} } \setKVdefault[DiagSagitt]{% @@ -576,7 +580,8 @@ Labels=true,% Ensembles={$\mathcal{E}$/$\mathcal{F}$},%{E/F},% PosLabels=bas,% - PoliceLabels={} + PoliceLabels={},% + Offset=2pt } \NewDocumentCommand\DiagrammeSagittal{s O{} D<>{} m }{% @@ -631,11 +636,581 @@ }% %ARCS \foreach \Deb/\Fin in {#4} {% - \draw[line width=\DSThick,->,>=\DSTypeFleche,\DSCouleurArc] (E\Deb)--(F\Fin) ; + \draw[line width=\DSThick,->,>=\DSTypeFleche,\DSCouleurArc] ([xshift=\DSOffset]E\Deb)--([xshift=-\DSOffset]F\Fin) ; }% \IfBooleanTF{#1}% {}% {\end{tikzpicture}}% } +%------Diagramme Sagittal Compo +\defKV[DiagSagittCompo]{% + E=\def\DSListeEltE{#1},% + F=\def\DSListeEltF{#1},% + G=\def\DSListeEltG{#1},% + DistElem=\def\DSEcartIN{#1},% + DistEns=\def\DSEcartIP{#1},% + LargEns=\def\DSLargPatates{#1},% + NomApplis=\def\DSNomsFcts{#1},% + CouleurE=\def\DSCouleurE{#1},% + CouleursAppli=\def\DSCouleursFct{#1},% + CouleurF=\def\DSCouleurF{#1},% + CouleursFleches=\def\DSCouleurArc{#1},% + CouleurG=\def\DSCouleurG{#1},% + TypeFleche=\def\DSTypeFleche{#1},% + Epaisseur=\def\DSThick{#1},% + Police=\def\DSPolicePatates{#1},% + PoliceLabels=\def\DSPoliceLabels{#1},% + Ensembles=\def\DSNomEns{#1},% + PosLabels=\def\DSPosLabels{#1},% + Offset=\def\DSOffset{#1} +} + +\setKVdefault[DiagSagittCompo]{% + DistElem=0.75,% + DistEns=4,% + LargEns=1.5,% + NomApplis={$f$/$g$},% + CouleurE={blue},% + CouleursAppli={violet},% + CouleurF={red},% + CouleurG={gray},% + CouleursFleches={teal},% + TypeFleche=Latex,% + Epaisseur=0.8pt,% + Police={},% + NoirBlanc=false,% + Labels=true,% + Ensembles={$\mathcal{E}$/$\mathcal{F}$/$\mathcal{G}$},% + PosLabels=bas,% + PoliceLabels={},% + Offset=2pt +} + +\NewDocumentCommand\DiagrammeSagittalCompo{s O{} D<>{} m m }{% + \restoreKV[DiagSagittCompo]%paramètres par défaut + \setKV[DiagSagittCompo]{#2}% + \readlist*\DSLstE{\DSListeEltE}% + \readlist*\DSLstF{\DSListeEltF}% + \readlist*\DSLstG{\DSListeEltG}% + \def\DSHauteurPatateE{\fpeval{\DSEcartIN*(1+\DSLstElen)}}% + \def\DSHauteurPatateF{\fpeval{1.1*\DSEcartIN*(1+\DSLstFlen)}}% + \def\DSHauteurPatateG{\fpeval{\DSEcartIN*(1+\DSLstGlen)}}% + \def\DSMaxHauteursPatates{\fpeval{max(\DSHauteurPatateE,\DSHauteurPatateF,\DSHauteurPatateG)}}% + \def\DSOffsetPatateF{\fpeval{0.5*\DSHauteurPatateF-0.5*\DSHauteurPatateE}}% + \def\DSOffsetPatateG{\fpeval{0.5*\DSHauteurPatateG-0.5*\DSHauteurPatateE}}% + \IfStrEq{\DSPosLabels}{bas}% + {% + \def\DSHautLegende{\fpeval{min(0,-\DSOffsetPatateF,-\DSOffsetPatateG)-0.5*\DSEcartIN}}% + \def\DSHautCompo{\fpeval{max(\DSHauteurPatateE,\DSHauteurPatateF-\DSOffsetPatateF,\DSHauteurPatateG-\DSOffsetPatateG)+0.5*\DSEcartIN}}% + \def\DSposlabelcompo{above}% + }{}% + \IfStrEq{\DSPosLabels}{haut}% + {% + \def\DSHautLegende{\fpeval{max(\DSHauteurPatateE,\DSHauteurPatateF-\DSOffsetPatateF,\DSHauteurPatateG-\DSOffsetPatateG)+0.5*\DSEcartIN}}% + \def\DSHautCompo{\fpeval{min(0,-\DSOffsetPatateF,-\DSOffsetPatateG)-0.5*\DSEcartIN}}% + \def\DSposlabelcompo{below}% + }{} + %découpage des couleurs et des noms + \IfSubStr{\DSCouleursFct}{/}% + {% + \StrCut{\DSCouleursFct}{/}{\DSCouleursFctF}{\DSCouleursFctG}% + }% + {% + \def\DSCouleursFctF{\DSCouleursFct}\def\DSCouleursFctG{\DSCouleursFct}% + }% + \IfSubStr{\DSCouleurArc}{/}% + {% + \StrCut{\DSCouleurArc}{/}{\DSCouleurArcF}{\DSCouleurArcG}% + }% + {% + \def\DSCouleurArcF{\DSCouleurArc}\def\DSCouleurArcG{\DSCouleurArc}% + }% + \ifboolKV[DiagSagittCompo]{NoirBlanc}% + {% + \def\DSCouleurE{black}% + \def\DSCouleurF{black}% + \def\DSCouleurG{black}% + \def\DSCouleurArcF{black}% + \def\DSCouleurArcG{black}% + \def\DSCouleurArcG{black}% + \def\DSCouleurFctF{black}% + \def\DSCouleurFctG{black}% + }{}% + %CONSTRUCTION + \IfBooleanTF{#1}% + {}% + {\begin{tikzpicture}[#3]}% + %LABELS + %\draw[lightgray,thin,->] (-1,0)--++({3*\DSEcartIP},0) ; + \ifboolKV[DiagSagittCompo]{Labels}% + {% + \saveexpandmode\expandarg + %découpage des noms d'ensembles + \StrBefore{\DSNomEns}{/}[\DSNomE] + \StrBetween[1,2]{\DSNomEns}{/}{/}[\DSNomF] + \StrBehind[2]{\DSNomEns}{/}[\DSNomG] + %découpage des fonctions + \StrCut{\DSNomsFcts}{/}{\DSNomFctF}{\DSNomFctG}% + \restoreexpandmode + \draw (0,{\DSHautLegende}) node[\DSCouleurE,inner sep=1pt,font=\DSPoliceLabels] {\DSNomE} ; + \draw ({\DSEcartIP},{\DSHautLegende}) node[\DSCouleurF,inner sep=1pt,font=\DSPoliceLabels] {\DSNomF} ; + \draw ({2*\DSEcartIP},{\DSHautLegende}) node[\DSCouleurG,inner sep=1pt,font=\DSPoliceLabels] {\DSNomG} ; + \draw (0,{\DSHautCompo}) node[\DSCouleurE,inner sep=1pt,font=\DSPoliceLabels] {\DSNomE} ; + \draw ({2*\DSEcartIP},{\DSHautCompo}) node[\DSCouleurG,inner sep=1pt,font=\DSPoliceLabels] {\DSNomG} ; + \draw[line width=\DSThick,->,>=\DSTypeFleche] ({0.45},{\DSHautLegende})--({\DSEcartIP-0.45},{\DSHautLegende}) node[midway,above=2pt,inner sep=1pt,text=\DSCouleursFctF,font=\DSPoliceLabels] {\DSNomFctF} ; + \draw[line width=\DSThick,->,>=\DSTypeFleche] ({\DSEcartIP+0.45},{\DSHautLegende})--({2*\DSEcartIP-0.45},{\DSHautLegende}) node[midway,above=2pt,inner sep=1pt,text=\DSCouleursFctG,font=\DSPoliceLabels] {\DSNomFctG} ; + \draw[line width=\DSThick,->,>=\DSTypeFleche] ({0.45},{\DSHautCompo}) -- ({2*\DSEcartIP-0.45},{\DSHautCompo}) node[midway,\DSposlabelcompo=2pt,inner sep=1pt,font=\DSPoliceLabels] {\textcolor{\DSCouleursFctG}{\DSNomFctG}{\small\,$\circ$\,}\textcolor{\DSCouleursFctF}{\DSNomFctF}} ; + }{}% + %PATATE_E (ok) + \draw[line width=\DSThick] (0,{0.5*\DSHauteurPatateE}) ellipse ({0.5*\DSLargPatates} and {0.5*\DSHauteurPatateE} ); + \foreach \i in {1,...,\DSLstElen}{% + \coordinate (E\DSLstE[\i]) at ({0.05*\DSLargPatates},{(\DSLstElen-\i+1)*\DSEcartIN}) ;% + \filldraw[\DSCouleurE] (E\DSLstE[\i]) circle[radius=1.5pt] node[left,font=\DSPolicePatates] {\DSLstE[\i]} ;% + }% + %PATATE_F (ok) + \draw[line width=\DSThick] ({\DSEcartIP},{0.5*\DSHauteurPatateF-\DSOffsetPatateF}) ellipse ({0.5*\DSLargPatates} and {0.5*\DSHauteurPatateF} ); + \foreach \i in {1,...,\DSLstFlen}{% + \coordinate (F\DSLstF[\i]) at ({\DSEcartIP},{(\DSLstFlen-\i+1)*1.1*\DSEcartIN-\DSOffsetPatateF}) ;% + \filldraw[\DSCouleurF] (F\DSLstF[\i]) circle[radius=1.5pt] node[above=0pt,font=\DSPolicePatates] {\DSLstF[\i]} ;% + }% + %PATATE_G (ok) + \draw[line width=\DSThick] ({2*\DSEcartIP},{0.5*\DSHauteurPatateG-\DSOffsetPatateG}) ellipse ({0.5*\DSLargPatates} and {0.5*\DSHauteurPatateG} ); + \foreach \i in {1,...,\DSLstGlen}{% + \coordinate (G\DSLstG[\i]) at ({2*\DSEcartIP-0.05*\DSLargPatates},{(\DSLstGlen-\i+1)*\DSEcartIN-\DSOffsetPatateG}) ;% + \filldraw[\DSCouleurG] (G\DSLstG[\i]) circle[radius=1.5pt] node[right,font=\DSPolicePatates] {\DSLstG[\i]} ;% + }% + %ARCSf + \foreach \Deb/\Fin in {#4} {% + \draw[line width=\DSThick,->,>=\DSTypeFleche,\DSCouleurArcF] ([xshift=\DSOffset]E\Deb)--([xshift=-\DSOffset]F\Fin) ; + }% + %ARCSg + \foreach \Deb/\Fin in {#5} {% + \draw[line width=\DSThick,->,>=\DSTypeFleche,\DSCouleurArcG] ([xshift=\DSOffset]F\Deb)--([xshift=-\DSOffset]G\Fin) ; + }% + \IfBooleanTF{#1}% + {}% + {\end{tikzpicture}}% +} + +%------Table de vérité +\ifluatex +\RequirePackage{xkeyval} +\RequirePackage{luacode} +\RequirePackage{nicematrix} + +%patchs pour luatruthtable (échange 1ère ligne <-> dernière ligne), à voir si le package sera patché pour éviter de "piquer" le code ! +%patchs from luatruthtable +\begin{luacode*} +local function toBinary(x,y) + y = y or math.max(1, select(2, math.frexp(x))) + local res = {} + for i = y, 1, -1 do + res[i] = math.fmod(x, 2) + x = math.floor((x - res[i]) / 2) + end + return res +end + +local function _not(a) + if a ==0 then return 1 + else return 0 end +end + +local lognot = {} + +local not_mt= { + __mul = function(a,b) + return _not(b) +end +} + +setmetatable(lognot, not_mt) +_G.lognot = lognot + +local function _and(a, b) + if a == 1 and b == 1 then return 1 + else return 0 end +end + +local tmp1 = {} +local logand = {} +local v1 = 0 + +local and_mt= { + __mul = function(a,b) + if b==logand then + v1 = v1 + 1 + tmp1[v1]=a + return tmp1 + elseif a == tmp1 then + local w1 = _and(tmp1[v1], b) + v1 = v1 - 1 + return w1 + end +end +} + +setmetatable(tmp1, and_mt) +setmetatable(logand, and_mt) +_G.logand = logand + +local function _or(a, b) + if a == 0 and b == 0 then return 0 + else return 1 end +end + +local tmp2 = {} +local logor = {} +local v2 = 0 + +local or_mt= { + __mul = function(a,b) + if b==logor then + v2 = v2 + 1 + tmp2[v2] = a + return tmp2 + elseif a == tmp2 then + local w2 = _or(tmp2[v2], b) + v2 = v2 - 1 + return w2 + end +end +} + +setmetatable(tmp2, or_mt) +setmetatable(logor, or_mt) +_G.logor = logor + +local function _imp(a, b) + if a == 1 and b == 0 then return 0 + else return 1 end +end + +local tmp3 = {} +local imp = {} +local v3 = 0 + +local imp_mt= { + __mul = function(a,b) + if b==imp then + v3 = v3 + 1 + tmp3[v3]=a + return tmp3 + elseif a == tmp3 then + local w3 = _imp(tmp3[v3], b) + v3 = v3 - 1 + return w3 + end +end +} + +setmetatable(tmp3, imp_mt) +setmetatable(imp, imp_mt) +_G.imp = imp + +local function _iff(a, b) + if a == b then return 1 + else return 0 end +end + +local tmp4 = {} +local iff = {} +local v4 = 0 + +local iff_mt= { + __mul = function(a,b) + if b==iff then + v4 = v4 + 1 + tmp4[v4]=a + return tmp4 + elseif a == tmp4 then + local w4 = _iff(tmp4[v4], b) + v4 = v4 - 1 + return w4 + end +end +} + +setmetatable(tmp4, iff_mt) +setmetatable(iff, iff_mt) +_G.iff = iff + +local function _xor(a, b) + if a ~= b then return 1 + else return 0 end +end + +local tmp5 = {} +local logxor = {} +local v5 = 0 + +local xor_mt= { + __mul = function(a,b) + if b==logxor then + v5 = v5 + 1 + tmp5[v5]=a + return tmp5 + elseif a == tmp5 then + local w5 = _xor(tmp5[v5], b) + v5 = v5 - 1 + return w5 + end +end +} + +setmetatable(tmp5, xor_mt) +setmetatable(logxor, xor_mt) +_G.logxor = logxor + +local function _nand(a, b) + if a ==1 and b == 1 then return 0 + else return 1 end +end + +local tmp6 = {} +local lognand = {} +local v6 = 0 + +local nand_mt= { + __mul = function(a,b) + if b==lognand then + v6 = v6 + 1 + tmp6[v6]=a + return tmp6 + elseif a == tmp6 then + local w6 = _nand(tmp6[v6], b) + v6 = v6 - 1 + return w6 + end +end +} + +setmetatable(tmp6, nand_mt) +setmetatable(lognand, nand_mt) +_G.lognand = lognand + +local function _nor(a, b) + if a ==0 and b == 0 then return 1 + else return 0 end +end + +local tmp7 = {} +local lognor = {} +local v7 = 0 + +local nor_mt= { + __mul = function(a,b) + if b==lognor then + v7 = v7 + 1 + tmp7[v7]=a + return tmp7 + elseif a == tmp7 then + local w7 = _nor(tmp7[v7], b) + v7 = v7 - 1 + return w7 + end +end +} + +setmetatable(tmp7, nor_mt) +setmetatable(lognor, nor_mt) +_G.lognor = lognor + +local function _xnor(a, b) + if a == b then return 1 + else return 0 end +end + +local tmp8 = {} +local logxnor = {} +local v8 = 0 + +local xnor_mt= { + __mul = function(a,b) + if b==logxnor then + v8 = v8 + 1 + tmp8[v8]=a + return tmp8 + elseif a == tmp8 then + local w8 = _xnor(tmp8[v8], b) + v8 = v8 - 1 + return w8 + end +end +} + +setmetatable(tmp8, xnor_mt) +setmetatable(logxnor, xnor_mt) +_G.logxnor = logxnor + +function TruthTbl(str0,str,trtext,fltext) + local eval="" + local names={lognot=lognot,logand=logand,logor=logor, imp=imp, iff=iff, logxor=logxor,lognand=lognand,lognor=lognor, logxnor=logxnor} + local vars={} + local expr={} + local countexp = 1 + local countvars =1 + local res="" + local sep=" & " + trtext = trtext or "$T$" + fltext = fltext or "$F$" + for variables in string.gmatch(str0, '([^,]+)') do + vars[countvars] = variables + countvars = countvars + 1 + end + for subexp in string.gmatch(str, '([^,]+)') do + expr[countexp] = subexp + countexp = countexp + 1 + end + local n =#vars + for i =1,2^n do + itr = toBinary(i,n) + for j=1, #itr do + names[vars[j]] = itr[j] + end + for k = 1, #expr do + res= res ..sep.. load("return " .. expr[k],nil,"t",names)() + end + if i~=2^n then + eval = eval .. table.concat(toBinary(i,n)," & ") .. res .. "\\\\" + else + eval = table.concat(toBinary(i,n)," & ") .. res .. "\\\\" .. eval + end + res="" + end + eval=eval:sub(1,-3) + if trtext:gsub("%s+", "") =="0" or trtext:gsub("%s+", "") == "$0$" or fltext:gsub("%s+", "") =="1" or fltext:gsub("%s+", "") == "$1$" then + eval=eval + else + eval=eval:gsub(0,fltext):gsub(1,trtext) + end + return eval +end + +function TruthTblSwap(str0,str,trtext,fltext) + local eval="" + local names={lognot=lognot,logand=logand,logor=logor, imp=imp, iff=iff, logxor=logxor,lognand=lognand,lognor=lognor, logxnor=logxnor} + local vars={} + local expr={} + local countexp = 1 + local countvars =1 + local res="" + local sep=" & " + trtext = trtext or "$T$" + fltext = fltext or "$F$" + for variables in string.gmatch(str0, '([^,]+)') do + vars[countvars] = variables + countvars = countvars + 1 + end + for subexp in string.gmatch(str, '([^,]+)') do + expr[countexp] = subexp + countexp = countexp + 1 + end + local n =#vars + for i =1,2^n do + itr = toBinary(i,n) + for j=1, #itr do + names[vars[j]] = itr[j] + end + for k = 1, #expr do + res= res ..sep.. load("return " .. expr[k],nil,"t",names)() + end + if i~=2^n then + eval = table.concat(toBinary(i,n)," & ") .. res .. "\\\\" .. eval + else + eval = eval .. table.concat(toBinary(i,n)," & ") .. res .. "\\\\" + end + res="" + end + eval=eval:sub(1,-3) + if trtext:gsub("%s+", "") =="0" or trtext:gsub("%s+", "") == "$0$" or fltext:gsub("%s+", "") =="1" or fltext:gsub("%s+", "") == "$1$" then + eval=eval + else + eval=eval:gsub(0,fltext):gsub(1,trtext) + end + return eval +end +\end{luacode*} + +\define@key{LuaTruthTable}{trtext}{\def\luatrtbl@trtext{#1}} +\define@key{LuaTruthTable}{fltext}{\def\luatrtbl@fltext{#1}} +\setkeys{LuaTruthTable}{trtext=$T$,fltext=$F$}% + +\NewDocumentCommand\GenTruthTable{ s O{} m m }{%1=swap + \setkeys{LuaTruthTable}{#2}% + \IfBooleanTF{#1}% + {% + \directlua{tex.sprint(TruthTblSwap(\luastringN{#3},\luastringN{#4},'\luatrtbl@trtext','\luatrtbl@fltext'))}% + }% + {% + \directlua{tex.sprint(TruthTbl(\luastringN{#3},\luastringN{#4},'\luatrtbl@trtext','\luatrtbl@fltext'))}% + }% +} + +\defKV[tableverite]{% + VF=\def\TTABLEtruefalse{#1},% + LargeursColonnes=\def\TTABLElargeurs{#1},% + CouleurEnonce=\def\TTABLEcoul{#1},% + CodeAvant=\def\TTABLEcodebefore{#1},% + CodeApres=\def\TTABLEcodeafter{#1} +} + +\setKVdefault[tableverite]{% + VF={V/F},% + LargeursColonnes=auto,% + CouleurEnonce={}, + CodeAvant={},% + CodeApres={},% + Swap=false +} + +\NewDocumentCommand\TableVerite{ O{} D<>{} m m m m }{% + %1=options/clés + %2=variables + %3=colonnes des variables + %4=calculs + %5=colonne des calculs + \useKVdefault[tableverite]% + \setKV[tableverite]{#1}% + \setsepchar{,}% + \readlist*\TableVeriteVariables{#4}% + \readlist*\TableVeriteEnonce{#5}% + \readlist*\TableVeriteCalculs{#6}% + \StrCut{\TTABLEtruefalse}{/}{\TTTrue}{\TTFalse}% + \xdef\TTNbCol{\fpeval{\TableVeriteVariableslen+\TableVeriteEnoncelen}}%\TTNbCol% + \IfStrEq{\TTABLElargeurs}{auto}% + {% + \begin{NiceTabular}[cell-space-limits=3pt,#2]{|*{\TTNbCol}{c|}}% + }% + {% + \IfSubStr{\TTABLElargeurs}{/}% + {% + \StrCut{\TTABLElargeurs}{/}{\TTlargvars}{\TTlargcals}% + }% + {% + \def\TTlargvars{\TTABLElargeurs}\def\TTlargcals{\TTABLElargeurs}% + }% + \begin{NiceTabular}[cell-space-limits=3pt,#2]{|*{\TableVeriteVariableslen}{W{c}{\TTlargvars}|}*{\TableVeriteEnoncelen}{W{c}{\TTlargcals}|}}% + }% + \CodeBefore + \IfStrEq{\TTABLEcodebefore}{}{}{\TTABLEcodebefore}% + \IfStrEq{\TTABLEcoul}{}{}{\rowcolor{\TTABLEcoul}{1}}% + \Body + \hline + {\TableVeriteVariables[1]}\xintifboolexpr{\TableVeriteVariableslen==1}{}{\xintFor*##1in{\xintSeq{2}{\TableVeriteVariableslen}}\do{&\TableVeriteVariables[##1]}}&\TableVeriteCalculs[1]\xintifboolexpr{\TableVeriteCalculslen==1}{}{\xintFor*##1in{\xintSeq{2}{\TableVeriteCalculslen}}\do{&\TableVeriteCalculs[##1]}} \\ \hline + \ifboolKV[tableverite]{Swap}% + {% + \GenTruthTable[trtext=\TTTrue,fltext=\TTFalse]{#3}{#5} \\ \hline + }% + {% + \GenTruthTable*[trtext=\TTTrue,fltext=\TTFalse]{#3}{#5} \\ \hline + }% + \CodeAfter + \IfStrEq{\TTABLEcodeafter}{}{}{\TTABLEcodeafter}% + \end{NiceTabular}% +} + +\fi + \endinput
\ No newline at end of file diff --git a/graphics/pstricks/contrib/pst-math/Changes b/graphics/pstricks/contrib/pst-math/Changes index fe248f97a8..62de93b697 100644 --- a/graphics/pstricks/contrib/pst-math/Changes +++ b/graphics/pstricks/contrib/pst-math/Changes @@ -1,4 +1,5 @@ ..... pst-math.sty/pro +0.67 2023-07-03 - fix bug with random list (doubled first entry) 0.66 2022-10-17 - fix bug with random list (doubled first entry) 0.65 2018-12-16 - allow lists with more than 100 numbers 0.64 2018-12-13 - added macros for creating lists of randoms diff --git a/graphics/pstricks/contrib/pst-math/README b/graphics/pstricks/contrib/pst-math/README index 2838a7bf4b..1b37f432ee 100644 --- a/graphics/pstricks/contrib/pst-math/README +++ b/graphics/pstricks/contrib/pst-math/README @@ -1,8 +1,13 @@ pst-math: PostScript extension for mathematical functions: The macros for random numbers cannot be used with xelatex! +Use lualatex instead, it has an buildin postscript hvoss@tug.org +%% This program can be redistributed and/or modified under the terms +%% of the LaTeX Project Public License Distributed from CTAN archives +%% in directory CTAN:/macros/latex/base/lppl.txt. -%% $Id: README 864 2018-12-15 21:15:11Z herbert $ + +%% $Id: README 741 2023-07-03 17:53:43Z herbert $ diff --git a/graphics/pstricks/contrib/pst-math/doc/pst-math-doc.pdf b/graphics/pstricks/contrib/pst-math/doc/pst-math-doc.pdf Binary files differindex a9fee0d9d3..16dc2baf17 100644 --- a/graphics/pstricks/contrib/pst-math/doc/pst-math-doc.pdf +++ b/graphics/pstricks/contrib/pst-math/doc/pst-math-doc.pdf diff --git a/graphics/pstricks/contrib/pst-math/doc/pst-math-doc.tex b/graphics/pstricks/contrib/pst-math/doc/pst-math-doc.tex index c3c2a80746..e0b76d200b 100644 --- a/graphics/pstricks/contrib/pst-math/doc/pst-math-doc.tex +++ b/graphics/pstricks/contrib/pst-math/doc/pst-math-doc.tex @@ -1,4 +1,5 @@ -%% $Id: pst-math-doc.tex 887 2018-12-29 13:17:59Z herbert $ +%% $Id: pst-math-doc.tex 741 2023-07-03 17:53:43Z herbert $ +\DocumentMetadata{} \documentclass[fontsize=11pt,english,BCOR=10mm,DIV=12,bibliography=totoc,parskip=false, headings=small, headinclude=false,footinclude=false,oneside,abstract=on]{pst-doc} \usepackage{pst-math} @@ -43,6 +44,7 @@ defines all the new mathematical functions for use with PostScript. \vfill\noindent Thanks to: \\ Denis Bitouzé; +Frédéric Bréal; Jacques L'helgoualc'h; Patrice M\'egret; Dominik Rodriguez diff --git a/graphics/pstricks/contrib/pst-math/latex/pst-math.sty b/graphics/pstricks/contrib/pst-math/latex/pst-math.sty index ce7a536d8b..257bee7e4c 100644 --- a/graphics/pstricks/contrib/pst-math/latex/pst-math.sty +++ b/graphics/pstricks/contrib/pst-math/latex/pst-math.sty @@ -1,10 +1,10 @@ -% $Id: pst-math.sty 867 2018-12-16 12:07:22Z herbert $ +% $Id: pst-math.sty 741 2023-07-03 17:53:43Z herbert $ %% %% This is file `pst-math.sty'. %% %% IMPORTANT NOTICE: %% -%% pst-math Copyright (C) 2019- Herbert Voss <hvoss@tug.org> +%% pst-math Copyright (C) 2023- Herbert Voss <hvoss@tug.org> %% %% This package may be distributed under the terms of the LaTeX Project %% Public License, as described in lppl.txt in the base LaTeX distribution. @@ -12,7 +12,9 @@ %% \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{pst-math}[2022/10/17 v 0.66 package wrapper for PSTricks pst-math.tex] +\ProvidesPackage{pst-math}[2023/07/03 v 0.67 package wrapper for PSTricks pst-math.tex] +\RequirePackage{multido} +\RequirePackage{pstricks} \RequirePackage{pst-calculate} \RequirePackage{ifluatex} \RequirePackage{xstring} diff --git a/graphics/pstricks/contrib/pst-math/tex/pst-math.tex b/graphics/pstricks/contrib/pst-math/tex/pst-math.tex index b3c0e69f00..050a042f17 100644 --- a/graphics/pstricks/contrib/pst-math/tex/pst-math.tex +++ b/graphics/pstricks/contrib/pst-math/tex/pst-math.tex @@ -20,8 +20,8 @@ \csname PSTmathLoaded\endcsname \let\PSTmathLoaded\endinput \ifx\PSTricksLoaded\endinput\else\input pstricks.tex\fi -\def\fileversion{0.66} -\def\filedate{2022/10/17} +\def\fileversion{0.67} +\def\filedate{2023/07/03} \message{`pst-math' v\fileversion\space, (CJ,hv)} \pstheader{pst-math.pro} |