texlive[60673] Master/texmf-dist: decision-table (2oct21)

commits+karl at tug.org commits+karl at tug.org
Sat Oct 2 00:02:48 CEST 2021


Revision: 60673
          http://tug.org/svn/texlive?view=revision&revision=60673
Author:   karl
Date:     2021-10-02 00:02:48 +0200 (Sat, 02 Oct 2021)
Log Message:
-----------
decision-table (2oct21)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/decision-table/README
    trunk/Master/texmf-dist/doc/latex/decision-table/decision-table.pdf
    trunk/Master/texmf-dist/source/latex/decision-table/decision-table.dtx
    trunk/Master/texmf-dist/source/latex/decision-table/decision-table.ins
    trunk/Master/texmf-dist/tex/latex/decision-table/decision-table.sty

Modified: trunk/Master/texmf-dist/doc/latex/decision-table/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/decision-table/README	2021-10-01 22:02:32 UTC (rev 60672)
+++ trunk/Master/texmf-dist/doc/latex/decision-table/README	2021-10-01 22:02:48 UTC (rev 60673)
@@ -1,5 +1,5 @@
 decision-table.sty
-Copyright 2020 Simon Vandevelde, Francois Pantigny
+Copyright 2020-2021 Simon Vandevelde, Francois Pantigny
 
 This work may be distributed and/or modified under the
 conditions of the LaTeX Project Public License, either version 1.3c

Modified: trunk/Master/texmf-dist/doc/latex/decision-table/decision-table.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/decision-table/decision-table.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/decision-table/decision-table.dtx	2021-10-01 22:02:32 UTC (rev 60672)
+++ trunk/Master/texmf-dist/source/latex/decision-table/decision-table.dtx	2021-10-01 22:02:48 UTC (rev 60673)
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright (C) 2020 by S. Vandevelde, F. Pantigny
+% Copyright (C) 2020-2021 by S. Vandevelde, F. Pantigny
 % ------------------------------------------------
 %
 % This file may be distributed and/or modified under the
@@ -16,8 +16,8 @@
 % \fi
 % \iffalse
 %
-\def\dmnfileversion{0.0.3}
-\def\dmnfiledate{2020/12/08}
+\def\dmnfileversion{0.0.4}
+\def\dmnfiledate{2021/10/01}
 %
 %<*batchfile>
 \begingroup
@@ -26,7 +26,7 @@
 \usedir{tex/latex/cascade}
 \preamble
 
-Copyright (C) 2020 by S.Vandevelde, F. Pantigny
+Copyright (C) 2020-2021 by S.Vandevelde, F. Pantigny
 -----------------------------------
 
 This file may be distributed and/or modified under the
@@ -78,8 +78,9 @@
 % \maketitle
 %
 % \begin{abstract}
-% The LaTeX package \pkg{decision-table} provides a command |\dmntable|, which allows for an easy way to generate decision tables in the Decision Model and Notation (DMN) format. (See Fig. \ref{ex1})
+% The LaTeX package \pkg{decision-table} provides a command |\dmntable|, which allows for an easy way to generate decision tables in the Decision Model and Notation (DMN) format. (See Fig.~\ref{ex1})
 % This package ensures consistency in the tables (i.e. fontsize), and is thus a better alternative to inserting tables via images.
+% Besides pure DMN tables, it also supports the tables used in the cDMN and pDMN extensions, namely glossary and probability tables.
 % \end{abstract}
 % 
 %
@@ -87,21 +88,37 @@
 % \vspace{1cm}
 % \section{Description}
 % 
-% The \texttt{decision-table} package allows for an easy way to generate decision tables in the Decision Model and Notation (DMN) format. (See Fig. \ref{ex1})
-% This package ensures consistency in the tables (i.e. fontsize), and is thus a better alternative to inserting tables via images.
+% The \texttt{decision-table} package allows for easy and straightforward generation of decision tables (with or without input columns) in the Decision Model and Notation (DMN) format, as demonstrated in Fig.~\ref{ex1}.
+% Additionally, it also supports glossary and goal tables as defined by cDMN\footnote{https://cdmn.be}, and probability tables as defined by pDMN\footnote{Vandevelde S., et al., ``A Table-Based Representation for Probabilistic Logic: Preliminary Result''.}.
+% Usage of this package ensures consistency in tables (i.e. font type, font size, color, $\ldots$), and is thus a better alternative to inserting tables via images.
 % 
 % \begin{figure}[H]
 %     \centering
-%     \dmntable{Calculate BMI}{U}{Weight(kgs),Length(m)}{BMI}{ %               ---,---,weight/length*length}
+%     \dmntable{BMI Level}{U}{BMI}{BMILevel}
+%              {$< 18.5$, Underweight,
+%               $[18.5..25]$, Normal,
+%               $(25..30]$, Overweight,
+%               $> 30$, Obese}
 %     \caption{Example of a DMN table}
 %     \label{ex1}
 % \end{figure}
-% \section{How to use}
-% 
-% The \texttt{decision-table} package adds the \texttt{dmntable} command, with which tables can be created.
+% \section{Usage}
+%
+% In total, the \texttt{decision-table} package adds 5 new commands.
+% \begin{itemize}
+%     \item \texttt{dmntable}: basic DMN table.
+%     \item \texttt{dmnoutputtable}: basic DMN table, but without input columns.
+%     \item \texttt{dmnglossarytable}: glossary table, as defined by cDMN.
+%     \item \texttt{goaltable}: goal table, as defined by cDMN.
+%     \item \texttt{pdmntable}: probability table, as defined by pDMN.
+%     \item \texttt{pdmnoutputtable}: probability table, but without input columns.
+% \end{itemize}
+
+% \subsection{dmntable}
+% The \texttt{dmntable} command generates standard DMN decision tables.
 % This command expands into a \texttt{tabular}, so it can be used within a \texttt{table} or \texttt{figure} environment.
-% Furthermore, this allows labels and captions to be added seamlessly. 
-% It is also possible to place multiple DMN tables in one \texttt{table}/\texttt{figure} environment.
+% Furthermore, this allows labels and captions to be added seamlessly, and allows placing multiple DMN tables in the same environment.
+% These tables will automatically arrange themselves based on size.
 % 
 % The \texttt{dmntable} command has the following inputs:
 % \begin{itemize}
@@ -112,166 +129,197 @@
 %     \item the table values
 % \end{itemize}
 % The command is used as follows:
-% \begin{lstlisting}[language=tex, frame=single]
-% \dmntable{title}{hitpolicy}{input}{output}{values}
-% \end{lstlisting}
+% \iffalse
+%<*example>
+% \fi
+\begin{lstlisting}[language=tex, frame=single]
+\dmntable{title}{hitpolicy}{input}{output}{values}
+\end{lstlisting}
+% \iffalse
+%</example>
+% \fi
 % 
 % The input, output and cell values are split by a comma.
 % It is not necessary to include the row numbers for the cell values.
-% For example, \ref{ex1} is generated by the following code:
-% \begin{lstlisting}[language=tex, frame=single, basicstyle=\small]
-% \begin{figure}[H]
-%     \centering
-%     \dmntable{Calculate BMI}{U}             % Title and HP
-%              {Weight(kgs),Length(m)}{BMI}   % Input, output
-%              {---,---,weight/length*length} % Cell values
-%     \caption{Example of a DMN table}
-%     \label{ex1}
-% \end{figure}
-% \end{lstlisting}
+% For example, Fig.~\ref{ex1} is generated by the following code:
+
+% \iffalse
+%<*example>
+% \fi
+\begin{lstlisting}[language=tex, frame=single, basicstyle=\small]
+\begin{figure}[H]
+    \centering
+    \dmntable{BMI Level}{U}{BMI}{BMILevel}
+             {$< 18.5$, Underweight,
+              $[18.5..25]$, Normal,
+              $(25..30]$, Overweight,
+              $> 30$, Obese}
+    \caption{Example of a DMN table}
+    \label{ex1}
+\end{figure}
+\end{lstlisting}
+% \iffalse
+%</example>
+% \fi
 % 
 % If a cell value contains multiple values (e.g. multiple string values), then accolades should be written around them.
-% See the example \ref{ex2}.
+% See the example shown in Fig.~\ref{ex2}.
+
+% It is also possible to have cells be multiline using the \texttt{makecell} package. This is useful in cases where large text causes page overflow.
+% \iffalse
+%<*example>
+% \fi
+\begin{lstlisting}[language=tex, frame=single, basicstyle=\small]
+\include{makecell} % This should be somewhere at the top of document
+\begin{figure}[H]
+    \centering
+    \dmntable{BMI Level}{U}{BMI}{\makecell{BMI \\ Level}}
+             {$< 18.5$, Underweight,
+              $[18.5..25]$, Normal,
+              $(25..30]$, Overweight,
+              $> 30$, Obese}
+    \caption{Example of a DMN table with multiline cell}
+    \label{ex1}
+\end{figure}
+\end{lstlisting}
+% \iffalse
+%</example>
+% \fi
 % 
-% 
-% \section{Examples}
-% This section contains some example code and their resulting tables.
-% 
-% \begin{lstlisting}[language=tex, frame=single, basicstyle=\small]
+% \subsection{dmnoutputtable}
+% Decision tables that have no input columns can be created using the \texttt{dmnoutputtable} command.
+% Its usage is the same as the standard decision table, except that no input columns should be given.
+% For example, the following code generates the table shown in Fig.~\ref{outputtable}.
+% \iffalse
+%<*example>
+% \fi
+\begin{lstlisting}[language=tex, frame=single, basicstyle=\small]
+\begin{figure}[H]
+    \centering
+    \dmnoutputtable{BMI Level}{U}{BMI}{5}
+    \caption{Example of a DMN output table}
+    \label{ex1}
+\end{figure}
+\end{lstlisting}
+% \iffalse
+%</example>
+% \fi
 % \begin{figure}[H]
 %     \centering
-%     \dmntable{Calculate BMI}{U}             % Title and HP
-%              {Weight(kgs),Length(m)}{BMI}   % Input, output
-%              {---,---,weight/length*length} % Cell values
-%     \caption{Example of a DMN table}
+%     \dmnoutputtable{BMI Level}{U}{BMI}{5}
+%     \caption{Example of a DMN output table}
+%     \label{outputtable}
 % \end{figure}
-% \end{lstlisting}
-% \begin{figure}[H]
-%     \centering
-%     \dmntable{Calculate BMI}{U}
-%              {Weight(kgs),Length(m)}{BMI}
-%              {---,---,weight/length*length}
-%     \caption{Example of a DMN table}
-% \end{figure}
 % 
-% 
-% \begin{lstlisting}[language=tex, frame=single, basicstyle=\small]
-% \begin{ligure}[H]
-%     \centering
-%     \dmntable{Decide BMI Level}{U}
-%              {BMI}{BMI Level, Risk Level}
-%              {$< 18.5$, Underweight, Increased,
-%               $[18.5..24.9]$, Normal, Low,
-%               $[25..29.9]$, overweight, Increased,
-%               $[30..34.9]$, Obese I, High,
-%               $[35..39.9]$, Obese II, Very High,
-%               $> 39.9$, Extreme Obesity, Extremely High}
-%     \caption{Example of a DMN table}
-% \end{figure}
-% \end{lstlisting}
+% \subsection{dmnglossarytable}
+% Glossary tables are added by using the \texttt{glossarytable} command.
+% This command accepts three inputs: the title, the sub-titles of the columns, and the actual elements.
+% See Fig. \ref{glos1} for an example.
+% \iffalse
+%<*example>
+% \fi
+\begin{lstlisting}[language=tex, frame=single, basicstyle=\small]
+\begin{figure}[H]
+   \centering
+   \glossarytable{Type}{Name, DataType, Possible Values}
+                       {Country, String, {Belgium, France, Germany}}
+   \glossarytable{Function}{Name, DataType}{color of Country, Color}
+   \glossarytable{Relation}{Name}{Country borders Country}
+   \caption{Example glossary}
+   \label{glos1}
+\end{figure}
+\end{lstlisting}
+% \iffalse
+%</example>
+% \fi
+%
+%
 % \begin{figure}[H]
-%     \centering
-%     \dmntable{Decide BMI Level}{U}
-%              {BMI}{BMI Level, Risk Level}
-%              {$< 18.5$, Underweight, Increased,
-%               $[18.5..24.9]$, Normal, Low,
-%               $[25..29.9]$, overweight, Increased,
-%               $[30..34.9]$, Obese I, High,
-%               $[35..39.9]$, Obese II, Very High,
-%               $> 39.9$, Extreme Obesity, Extremely High}
-%     \caption{Example of a larger DMN table}
+%    \centering
+%    \glossarytable{Type}{Name, DataType, Possible Values}
+%                        {Country, String, {Belgium, France, Germany}}
+%    \glossarytable{Function}{Name, DataType}{color of Country, Color}
+%    \glossarytable{Relation}{Name}{Country borders Country}
+%    \caption{Example glossary}
+%    \label{glos1}
 % \end{figure}
-% 
-% \begin{lstlisting}[language=tex, frame=single, basicstyle=\tiny]
+
+% \subsection{goaltable}
+
+% Generating a \texttt{Goal} table is straightforward:
+
+% \iffalse
+%<*example>
+% \fi
+\begin{lstlisting}[language=tex, frame=single]
+\goaltable{tablename}{values}
+\end{lstlisting}
+% \iffalse
+%</example>
+% \fi
+
 % \begin{figure}[H]
 %     \centering
-%     \dmntable{Decide Risk Level}{U}
-%              {BMI level, Waist(cm)}{Risk Level}
-%              {Overweight, $<=88$, Increased,
-%               Overweight, $ > 88$, High,
-%               Obese I,$ <= 88$, High,
-%               Obese II, ---, Very High,
-%               Extreme Obesity, ---, Extremely High,
-%               {not(Overweight, Obese I, Obese II, Extreme Obesity)}, ---, Low
-%              }
-%     \caption{Example of cell with multiple values}
-%     \label{ex2}
+%     \goaltable{tablename}{value1, value2}
 % \end{figure}
-% \end{lstlisting}
-% 
+
+% \subsection{pdmntable}
+
+% pDMN probability tables are similar to standard DMN tables, but with a few changes.
+% The biggest change is the addition of probabilities. The syntax of \texttt{pdmntable} is as follows:
+
+% \iffalse
+%<*example>
+% \fi
+\begin{lstlisting}[language=tex, frame=single]
+\pdmntable{title}{hitpolicy}{inputs}{outputs}{output values}{cell values}
+\end{lstlisting}
+% \iffalse
+%</example>
+% \fi
+
+%For example, a table expressing the probabilities of an unbiased and biased dice throw can be expressed as follows:
+
+% \iffalse
+%<*example>
+% \fi
+\begin{lstlisting}[language=tex, frame=single]
+\pdmntable{Throwing Dice}{Ch}{biased}{die value}
+          {one, two, three, four, five, six}
+          {No, $1/6$, $1/6$, $1/6$, $1/6$, $1/6$, $1/6$,
+           Yes, $0.1$, $0.1$, $0.1$, $0.1$, $0.1$, $0.5$}
+\end{lstlisting}
+% \iffalse
+%</example>
+% \fi
+
 % \begin{figure}[H]
 %     \centering
-%     \dmntable{Decide Risk Level}{U}
-%              {BMI level, Waist(cm)}{Risk Level}
-%              {Overweight, $<=88$, Increased,
-%               Overweight, $ > 88$, High,
-%               Obese I,$ <= 88$, High,
-%               Obese II, ---, Very High,
-%               Extreme Obesity, ---, Extremely High,
-%               {not(Overweight, Obese I, Obese II, Extreme Obesity)}, ---, Low
-%              }
-%     \caption{Example of cell with multiple values}
-%     \label{ex2}
+% \pdmntable{Throwing Dice}{Ch}{biased}{die value}
+%           {one, two, three, four, five, six}
+%           {No, $1/6$, $1/6$, $1/6$, $1/6$, $1/6$, $1/6$,
+%            Yes, $0.1$, $0.1$, $0.1$, $0.1$, $0.1$, $0.5$}
 % \end{figure}
-% 
-% \begin{lstlisting}[language=tex, frame=single, basicstyle=\tiny]
+
+
+% \subsection{pdmnoutputtable}
+% The final type of table, \texttt{pdmnoutputtable}, is the same as the one shown in the previous subsection but without any input columns.
+
+% \iffalse
+%<*example>
+% \fi
+\begin{lstlisting}[language=tex, frame=single]
+\pdmnoutputtable{tablename}{hitpolicy}{output}{outputvalue}{probabilities}
+\end{lstlisting}
+% \iffalse
+%</example>
+% \fi
+
 % \begin{figure}[H]
 %     \centering
-%     \dmntable{Rule 1}{U}
-%              {Age, Service Years}{Eligible1}
-%              {$\leq18$, ---, Yes,
-%               $\geq60$, ---, Yes,
-%               {$[18, 60]$}, $\geq 30$, Yes
-%              }
-%     \dmntable{Rule 2}{U}
-%              {Age, Service Years}{Eligible2}
-%              {---,$\geq30$, Yes,
-%               $\geq60$,$<30$, Yes
-%              }
-%     \dmntable{Rule 3}{U}
-%              {Age, Service Years}{Eligible3}
-%              {$< 45$, {$[15, 30)$}, Yes,
-%               $> 45$, ---, Yes
-%              }
-%     \dmntable{Vacation days}{C+}
-%              {Eligible1, Eligible2, Eligble3}{Vacation Days}
-%              {---, ---, ---, 22,
-%               Yes, ---, ---, 5,
-%               ---, Yes, ---, 3,
-%               No, ---, Yes, 2
-%              }
-%     \caption{dmn table example for the Vacation Days}
+%     \pdmnoutputtable{h1}{U}{heads1}{Yes}{0.5}
 % \end{figure}
-% \end{lstlisting}
-% \begin{figure}[H]
-%     \centering
-%     \dmntable{Rule 1}{U}
-%              {Age, Service Years}{Eligible1}
-%              {$\leq18$, ---, Yes,
-%               $\geq60$, ---, Yes,
-%               {$[18, 60]$}, $\geq 30$, Yes
-%              }
-%     \dmntable{Rule 2}{U}
-%              {Age, Service Years}{Eligible2}
-%              {---,$\geq30$, Yes,
-%               $\geq60$,$<30$, Yes
-%              }
-%     \dmntable{Rule 3}{U}
-%              {Age, Service Years}{Eligible3}
-%              {$< 45$, {$[15, 30)$}, Yes,
-%               $> 45$, ---, Yes
-%              }
-%     \dmntable{Vacation days}{C+}
-%              {Eligible1, Eligible2, Eligble3}{Vacation Days}
-%              {---, ---, ---, 22,
-%               Yes, ---, ---, 5,
-%               ---, Yes, ---, 3,
-%               No, ---, Yes, 2
-%              }
-%     \caption{DMN table example for the Vacation Days}
-% \end{figure}
-% 
-% 
+
 % \section{Contributing}
 % 
 % Contributions are always welcome.
@@ -302,13 +350,12 @@
 %    \end{macrocode}
 %
 % \bigskip
-% We define the command |\dmntable| with the tools of \pkg{xparse} (in 2020
-% October, \pkg{xparse} will be included in the LaTeX kernel).
+% We define the command |\dmntable| with the tools of \pkg{xparse}.
 %    \begin{macrocode}
 \NewDocumentCommand \dmntable { m m m m m }
   {
 %    \end{macrocode}
-% The clist (\emph{commad separated list}) |\l_@@_input_clist| is for the list
+% The clist (\emph{comma separated list}) |\l_@@_input_clist| is for the list
 % of the names of the input fields. 
 %    \begin{macrocode}
     \clist_clear_new:N \l_@@_input_clist
@@ -453,6 +500,244 @@
     \end { NiceTabular }
   }
 %    \end{macrocode}
+% The other two commands are simply more of the same.
+%    \begin{macrocode}
+\NewDocumentCommand \dmnoutputtable { m m m m }
+  {
+    \clist_clear_new:N \l__dmn_output_clist
+    \clist_set:Nn \l__dmn_output_clist { #3 }
+    \int_zero_new:N \l__dmn_output_int
+    \int_set:Nn \l__dmn_output_int { \clist_count:N \l__dmn_output_clist }
+    \seq_clear_new:N \l__dmn_cells_seq
+    \seq_set_split:Nnn \l__dmn_cells_seq { , } { #4 }
+    \use:x
+      {
+        \exp_not:N \begin { NiceTabular }
+        { r \prg_replicate:nn { \l__dmn_output_int } l }
+        [
+          hvlines-except-corners ,
+          code-before =
+           \exp_not:N \rectanglecolor
+             { blue!10!green!60!black!30 }
+             { 2 - 2 }
+             { 2 - \int_eval:n { 1 } }
+           \exp_not:N \rectanglecolor
+             { green!30!blue!15 }
+             { 2 - \int_eval:n { 2 } }
+             { 2 - \int_eval:n { \l__dmn_output_int + 1 } }
+        ]
+      }
+    \exp_args:Ne \multicolumn
+      { \int_eval:n { 1 } }
+      { l }
+      { #1 } \\
+    #2 &
+    \clist_use:Nn \l__dmn_output_clist { & } \\
+    1 &
+    \seq_map_inline:Nn \l__dmn_cells_seq
+      {
+        \int_compare:nT { \c at jCol = 0 } { \int_eval:n { \c at iRow - 1 } & }
+        ##1
+        \int_compare:nTF { \c at jCol = \l__dmn_output_int + 1 }
+          { \\ }
+          { & }
+      }
+    \end { NiceTabular }
+  }
+
+\NewDocumentCommand \glossarytable { m m m }
+  {
+    \clist_clear_new:N \l__clist
+    \clist_set:Nn \l__clist { #2 }
+    \int_zero_new:N \l__cint
+    \int_set:Nn \l__cint { \clist_count:N \l__clist }
+    \seq_clear_new:N \l__dmn_cells_seq
+    \seq_set_split:Nnn \l__dmn_cells_seq { , } { #3 }
+    \use:x
+      {
+        \exp_not:N \begin { NiceTabular }
+        { c \prg_replicate:nn { \l__cint -1 } c }
+        [
+          hvlines-except-corners ,
+          code-before =
+           \exp_not:N \rectanglecolor
+             { blue!30!green!10!red!40 }
+             { 1 - \int_eval:n { 1 } }
+             { 1 - \int_eval:n { \l__cint} }
+        ]
+      }
+    \exp_args:Ne \multicolumn
+      { \int_eval:n { \l__cint } }
+      { c }
+      { \textbf{#1} } \\
+    \bf \clist_use:Nn \l__clist { & \bf } \\
+    \seq_map_inline:Nn \l__dmn_cells_seq
+      {
+        \int_compare:nT { \c at jCol = 0 } { }
+        ##1
+        \int_compare:nTF { \c at jCol = \l__cint }
+          { \\ }
+          { & }
+      }
+    \end { NiceTabular }
+  }
+\NewDocumentCommand \pdmntable { m m m m m m}
+  {
+    \clist_clear_new:N \l__dmn_input_clist
+    \clist_set:Nn \l__dmn_input_clist { #3 }
+    \clist_clear_new:N \l__dmn_output_clist
+    \clist_set:Nn \l__dmn_output_clist { #4 }
+    \clist_clear_new:N \l__suboutput_clist
+    \clist_set:Nn \l__dmn_suboutput_clist { #5 }
+    \int_zero_new:N \l__dmn_input_int
+    \int_set:Nn \l__dmn_input_int { \clist_count:N \l__dmn_input_clist }
+    \int_zero_new:N \l__dmn_output_int
+    \int_set:Nn \l__dmn_output_int { \clist_count:N \l__dmn_output_clist }
+    \int_zero_new:N \l__dmn_suboutput_int
+    \int_set:Nn \l__dmn_suboutput_int { \clist_count:N \l__dmn_suboutput_clist }
+    \seq_clear_new:N \l__dmn_cells_seq
+    \seq_set_split:Nnn \l__dmn_cells_seq { , } { #6 }
+    \seq_clear_new:N \l__dmn_inputcells_seq
+    \seq_set_split:Nnn \l__dmn_inputcells_seq { , } { #3 }
+    \use:x
+      {
+        \exp_not:N \begin { NiceTabular }
+        { r \prg_replicate:nn { \l__dmn_input_int + \l__dmn_suboutput_int  + 1} l }
+        [
+          hvlines-except-corners ,
+          code-before =
+           \exp_not:N \rectanglecolor
+             { blue!10!green!60!black!30 }
+             { 2 - 2 }
+             { 2 - \int_eval:n { \l__dmn_input_int + 1 } }
+           \exp_not:N \rectanglecolor
+             { green!30!blue!15 }
+             { 2 - \int_eval:n { \l__dmn_input_int + 2 } }
+             { 2 - \int_eval:n { \l__dmn_input_int + \l__dmn_suboutput_int + 1 } }
+          \exp_not:N \rectanglecolor
+             { red!60!green!60!blue!15}
+             { 3 - \int_eval:n { 1 } }
+             { 3 - \int_eval:n { \l__dmn_input_int + \l__dmn_suboutput_int + 1 } }
+        ]
+      }
+    \exp_args:Ne \multicolumn
+      { \int_eval:n { \l__dmn_input_int + 1 } }
+      { l }
+      { #1 } \\
+    #2 &
+    \clist_use:Nn \l__dmn_input_clist { & } &
+    \exp_args:Ne \multicolumn
+      { \int_eval:n {\l__dmn_suboutput_int}} 
+      { c }
+      { #4 } \\
+    \seq_map_inline:Nn \l__dmn_inputcells_seq 
+      { & }
+    & \clist_use:Nn \l__dmn_suboutput_clist { & } & \\
+    %\clist_use:Nn \l__dmn_output_clist { & } \\
+    1 &
+    \seq_map_inline:Nn \l__dmn_cells_seq
+      {
+        \int_compare:nT { \c at jCol = 0 } { \int_eval:n { \c at iRow - 2 } & }
+        ##1
+        \int_compare:nTF { \c at jCol = \l__dmn_input_int + \l__dmn_suboutput_int + 1 }
+          { \\ }
+          { & }
+      }
+    \end { NiceTabular }
+  }
+\NewDocumentCommand \pdmnoutputtable { m m m m m }
+  {
+    \clist_clear_new:N \l__dmn_output_clist
+    \clist_set:Nn \l__dmn_output_clist { #3 }
+    \clist_clear_new:N \l__suboutput_clist
+    \clist_set:Nn \l__dmn_suboutput_clist { #4 }
+    \int_zero_new:N \l__dmn_output_int
+    \int_set:Nn \l__dmn_output_int { \clist_count:N \l__dmn_output_clist }
+    \int_zero_new:N \l__dmn_suboutput_int
+    \int_set:Nn \l__dmn_suboutput_int { \clist_count:N \l__dmn_suboutput_clist }
+    \seq_clear_new:N \l__dmn_cells_seq
+    \seq_set_split:Nnn \l__dmn_cells_seq { , } { #5 }
+    \use:x
+      {
+        \exp_not:N \begin { NiceTabular }
+        { r \prg_replicate:nn { \l__dmn_suboutput_int } l }
+        [
+          hvlines-except-corners ,
+          code-before =
+           \exp_not:N \rectanglecolor
+             { blue!10!green!60!black!30 }
+             { 2 - 2 }
+             { 2 - \int_eval:n { 1 } }
+           \exp_not:N \rectanglecolor
+             { green!30!blue!15 }
+             { 2 - \int_eval:n { 2 } }
+             { 2 - \int_eval:n { \l__dmn_suboutput_int + 1 } }
+          \exp_not:N \rectanglecolor
+             { red!60!green!60!blue!15}
+             { 3 - \int_eval:n { 1 } }
+             { 3 - \int_eval:n { \l__dmn_suboutput_int + 1 } }
+        ]
+      }
+    \exp_args:Ne \multicolumn
+      { \int_eval:n { 1 } }
+      { l }
+      { #1 } \\
+    #2 &
+    \exp_args:Ne \multicolumn
+      { \int_eval:n {\l__dmn_suboutput_int}} 
+      { c }
+      { #3 } \\
+    & \clist_use:Nn \l__dmn_suboutput_clist { & } \\
+    1 &
+    \seq_map_inline:Nn \l__dmn_cells_seq
+      {
+        \int_compare:nT { \c at jCol = 0 } { \int_eval:n { \c at iRow - 1 } & }
+        ##1
+        \int_compare:nTF { \c at jCol = \l__dmn_suboutput_int + 1 }
+          { \\ }
+          { & }
+      }
+    \end { NiceTabular }
+  }
+
+\NewDocumentCommand \goaltable { m m }
+  {
+    \seq_clear_new:N \l__dmn_cells_seq
+    \seq_set_split:Nnn \l__dmn_cells_seq { , } { #2 }
+    \use:x
+      {
+        \exp_not:N \begin { NiceTabular }
+        { \prg_replicate:nn { 1 } c }
+        [
+          hvlines-except-corners ,
+          code-before =
+           \exp_not:N \rectanglecolor
+             { blue!30!green!10!red!20 }
+             { 1 - \int_eval:n { 1 } }
+             { 1 - \int_eval:n { 1} }
+        ]
+      }
+    \textbf{#1} \\
+    %\exp_args:Ne \multicolumn
+    %  { \int_eval:n { 1 } }
+    %  { c }
+    %  { \textbf{#1} } \\
+    \seq_map_inline:Nn \l__dmn_cells_seq
+      {
+        \int_compare:nT { \c at jCol = 0 } { }
+        ##1
+        \int_compare:nTF { \c at jCol = 1 }
+          { \\ }
+          { & }
+      }
+    \end { NiceTabular }
+  }
+
+\endinput
+%%
+%% End of file `decision-table.sty'.
+
+%    \end{macrocode}
 % 
 %
 %

Modified: trunk/Master/texmf-dist/source/latex/decision-table/decision-table.ins
===================================================================
--- trunk/Master/texmf-dist/source/latex/decision-table/decision-table.ins	2021-10-01 22:02:32 UTC (rev 60672)
+++ trunk/Master/texmf-dist/source/latex/decision-table/decision-table.ins	2021-10-01 22:02:48 UTC (rev 60673)
@@ -1,5 +1,5 @@
 %%
-%% Copyright (C) 2020 by S. Vandevelde and F. Pantigny
+%% Copyright (C) 2020-2021 by S. Vandevelde and F. Pantigny
 %%
 %%
 %% This file may be distributed and/or modified under the
@@ -17,7 +17,7 @@
 \usedir{tex/latex/decision-table}
 \preamble
 
-Copyright (C) 2020 by S. Vandevelde, F. Pantigny 
+Copyright (C) 2020-2021 by S. Vandevelde, F. Pantigny 
 
 This file may be distributed and/or modified under the
 conditions of the LaTeX Project Public License, either

Modified: trunk/Master/texmf-dist/tex/latex/decision-table/decision-table.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/decision-table/decision-table.sty	2021-10-01 22:02:32 UTC (rev 60672)
+++ trunk/Master/texmf-dist/tex/latex/decision-table/decision-table.sty	2021-10-01 22:02:48 UTC (rev 60673)
@@ -6,7 +6,7 @@
 %%
 %% decision-table.dtx  (with options: `package')
 %% 
-%% Copyright (C) 2020 by S. Vandevelde, F. Pantigny
+%% Copyright (C) 2020-2021 by S. Vandevelde, F. Pantigny
 %% 
 %% This file may be distributed and/or modified under the
 %% conditions of the LaTeX Project Public License, either
@@ -18,9 +18,26 @@
 %% and version 1.3c or later is part of all distributions of
 %% LaTeX version 2005/12/01 or later.
 %% 
-\def\dmnfileversion{0.0.3}
-\def\dmnfiledate{2020/12/08}
+\def\dmnfileversion{0.0.4}
+\def\dmnfiledate{2021/10/01}
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 \RequirePackage{l3keys2e}
 \ProvidesExplPackage
   {decision-table}
@@ -75,7 +92,237 @@
       }
     \end { NiceTabular }
   }
+\NewDocumentCommand \dmnoutputtable { m m m m }
+  {
+    \clist_clear_new:N \l__dmn_output_clist
+    \clist_set:Nn \l__dmn_output_clist { #3 }
+    \int_zero_new:N \l__dmn_output_int
+    \int_set:Nn \l__dmn_output_int { \clist_count:N \l__dmn_output_clist }
+    \seq_clear_new:N \l__dmn_cells_seq
+    \seq_set_split:Nnn \l__dmn_cells_seq { , } { #4 }
+    \use:x
+      {
+        \exp_not:N \begin { NiceTabular }
+        { r \prg_replicate:nn { \l__dmn_output_int } l }
+        [
+          hvlines-except-corners ,
+          code-before =
+           \exp_not:N \rectanglecolor
+             { blue!10!green!60!black!30 }
+             { 2 - 2 }
+             { 2 - \int_eval:n { 1 } }
+           \exp_not:N \rectanglecolor
+             { green!30!blue!15 }
+             { 2 - \int_eval:n { 2 } }
+             { 2 - \int_eval:n { \l__dmn_output_int + 1 } }
+        ]
+      }
+    \exp_args:Ne \multicolumn
+      { \int_eval:n { 1 } }
+      { l }
+      { #1 } \\
+    #2 &
+    \clist_use:Nn \l__dmn_output_clist { & } \\
+    1 &
+    \seq_map_inline:Nn \l__dmn_cells_seq
+      {
+        \int_compare:nT { \c at jCol = 0 } { \int_eval:n { \c at iRow - 1 } & }
+        ##1
+        \int_compare:nTF { \c at jCol = \l__dmn_output_int + 1 }
+          { \\ }
+          { & }
+      }
+    \end { NiceTabular }
+  }
 
+\NewDocumentCommand \glossarytable { m m m }
+  {
+    \clist_clear_new:N \l__clist
+    \clist_set:Nn \l__clist { #2 }
+    \int_zero_new:N \l__cint
+    \int_set:Nn \l__cint { \clist_count:N \l__clist }
+    \seq_clear_new:N \l__dmn_cells_seq
+    \seq_set_split:Nnn \l__dmn_cells_seq { , } { #3 }
+    \use:x
+      {
+        \exp_not:N \begin { NiceTabular }
+        { c \prg_replicate:nn { \l__cint -1 } c }
+        [
+          hvlines-except-corners ,
+          code-before =
+           \exp_not:N \rectanglecolor
+             { blue!30!green!10!red!40 }
+             { 1 - \int_eval:n { 1 } }
+             { 1 - \int_eval:n { \l__cint} }
+        ]
+      }
+    \exp_args:Ne \multicolumn
+      { \int_eval:n { \l__cint } }
+      { c }
+      { \textbf{#1} } \\
+    \bf \clist_use:Nn \l__clist { & \bf } \\
+    \seq_map_inline:Nn \l__dmn_cells_seq
+      {
+        \int_compare:nT { \c at jCol = 0 } { }
+        ##1
+        \int_compare:nTF { \c at jCol = \l__cint }
+          { \\ }
+          { & }
+      }
+    \end { NiceTabular }
+  }
+\NewDocumentCommand \pdmntable { m m m m m m}
+  {
+    \clist_clear_new:N \l__dmn_input_clist
+    \clist_set:Nn \l__dmn_input_clist { #3 }
+    \clist_clear_new:N \l__dmn_output_clist
+    \clist_set:Nn \l__dmn_output_clist { #4 }
+    \clist_clear_new:N \l__suboutput_clist
+    \clist_set:Nn \l__dmn_suboutput_clist { #5 }
+    \int_zero_new:N \l__dmn_input_int
+    \int_set:Nn \l__dmn_input_int { \clist_count:N \l__dmn_input_clist }
+    \int_zero_new:N \l__dmn_output_int
+    \int_set:Nn \l__dmn_output_int { \clist_count:N \l__dmn_output_clist }
+    \int_zero_new:N \l__dmn_suboutput_int
+    \int_set:Nn \l__dmn_suboutput_int { \clist_count:N \l__dmn_suboutput_clist }
+    \seq_clear_new:N \l__dmn_cells_seq
+    \seq_set_split:Nnn \l__dmn_cells_seq { , } { #6 }
+    \seq_clear_new:N \l__dmn_inputcells_seq
+    \seq_set_split:Nnn \l__dmn_inputcells_seq { , } { #3 }
+    \use:x
+      {
+        \exp_not:N \begin { NiceTabular }
+        { r \prg_replicate:nn { \l__dmn_input_int + \l__dmn_suboutput_int  + 1} l }
+        [
+          hvlines-except-corners ,
+          code-before =
+           \exp_not:N \rectanglecolor
+             { blue!10!green!60!black!30 }
+             { 2 - 2 }
+             { 2 - \int_eval:n { \l__dmn_input_int + 1 } }
+           \exp_not:N \rectanglecolor
+             { green!30!blue!15 }
+             { 2 - \int_eval:n { \l__dmn_input_int + 2 } }
+             { 2 - \int_eval:n { \l__dmn_input_int + \l__dmn_suboutput_int + 1 } }
+          \exp_not:N \rectanglecolor
+             { red!60!green!60!blue!15}
+             { 3 - \int_eval:n { 1 } }
+             { 3 - \int_eval:n { \l__dmn_input_int + \l__dmn_suboutput_int + 1 } }
+        ]
+      }
+    \exp_args:Ne \multicolumn
+      { \int_eval:n { \l__dmn_input_int + 1 } }
+      { l }
+      { #1 } \\
+    #2 &
+    \clist_use:Nn \l__dmn_input_clist { & } &
+    \exp_args:Ne \multicolumn
+      { \int_eval:n {\l__dmn_suboutput_int}}
+      { c }
+      { #4 } \\
+    \seq_map_inline:Nn \l__dmn_inputcells_seq
+      { & }
+    & \clist_use:Nn \l__dmn_suboutput_clist { & } & \\
+    %\clist_use:Nn \l__dmn_output_clist { & } \\
+    1 &
+    \seq_map_inline:Nn \l__dmn_cells_seq
+      {
+        \int_compare:nT { \c at jCol = 0 } { \int_eval:n { \c at iRow - 2 } & }
+        ##1
+        \int_compare:nTF { \c at jCol = \l__dmn_input_int + \l__dmn_suboutput_int + 1 }
+          { \\ }
+          { & }
+      }
+    \end { NiceTabular }
+  }
+\NewDocumentCommand \pdmnoutputtable { m m m m m }
+  {
+    \clist_clear_new:N \l__dmn_output_clist
+    \clist_set:Nn \l__dmn_output_clist { #3 }
+    \clist_clear_new:N \l__suboutput_clist
+    \clist_set:Nn \l__dmn_suboutput_clist { #4 }
+    \int_zero_new:N \l__dmn_output_int
+    \int_set:Nn \l__dmn_output_int { \clist_count:N \l__dmn_output_clist }
+    \int_zero_new:N \l__dmn_suboutput_int
+    \int_set:Nn \l__dmn_suboutput_int { \clist_count:N \l__dmn_suboutput_clist }
+    \seq_clear_new:N \l__dmn_cells_seq
+    \seq_set_split:Nnn \l__dmn_cells_seq { , } { #5 }
+    \use:x
+      {
+        \exp_not:N \begin { NiceTabular }
+        { r \prg_replicate:nn { \l__dmn_suboutput_int } l }
+        [
+          hvlines-except-corners ,
+          code-before =
+           \exp_not:N \rectanglecolor
+             { blue!10!green!60!black!30 }
+             { 2 - 2 }
+             { 2 - \int_eval:n { 1 } }
+           \exp_not:N \rectanglecolor
+             { green!30!blue!15 }
+             { 2 - \int_eval:n { 2 } }
+             { 2 - \int_eval:n { \l__dmn_suboutput_int + 1 } }
+          \exp_not:N \rectanglecolor
+             { red!60!green!60!blue!15}
+             { 3 - \int_eval:n { 1 } }
+             { 3 - \int_eval:n { \l__dmn_suboutput_int + 1 } }
+        ]
+      }
+    \exp_args:Ne \multicolumn
+      { \int_eval:n { 1 } }
+      { l }
+      { #1 } \\
+    #2 &
+    \exp_args:Ne \multicolumn
+      { \int_eval:n {\l__dmn_suboutput_int}}
+      { c }
+      { #3 } \\
+    & \clist_use:Nn \l__dmn_suboutput_clist { & } \\
+    1 &
+    \seq_map_inline:Nn \l__dmn_cells_seq
+      {
+        \int_compare:nT { \c at jCol = 0 } { \int_eval:n { \c at iRow - 1 } & }
+        ##1
+        \int_compare:nTF { \c at jCol = \l__dmn_suboutput_int + 1 }
+          { \\ }
+          { & }
+      }
+    \end { NiceTabular }
+  }
+
+\NewDocumentCommand \goaltable { m m }
+  {
+    \seq_clear_new:N \l__dmn_cells_seq
+    \seq_set_split:Nnn \l__dmn_cells_seq { , } { #2 }
+    \use:x
+      {
+        \exp_not:N \begin { NiceTabular }
+        { \prg_replicate:nn { 1 } c }
+        [
+          hvlines-except-corners ,
+          code-before =
+           \exp_not:N \rectanglecolor
+             { blue!30!green!10!red!20 }
+             { 1 - \int_eval:n { 1 } }
+             { 1 - \int_eval:n { 1} }
+        ]
+      }
+    \textbf{#1} \\
+    %\exp_args:Ne \multicolumn
+    %  { \int_eval:n { 1 } }
+    %  { c }
+    %  { \textbf{#1} } \\
+    \seq_map_inline:Nn \l__dmn_cells_seq
+      {
+        \int_compare:nT { \c at jCol = 0 } { }
+        ##1
+        \int_compare:nTF { \c at jCol = 1 }
+          { \\ }
+          { & }
+      }
+    \end { NiceTabular }
+  }
+
 \endinput
 %%
 %% End of file `decision-table.sty'.



More information about the tex-live-commits mailing list.