\documentclass{article} \usepackage{decision-table} \usepackage{hyperref} \usepackage{listings} \usepackage{float} \author{Simon Vandevelde} \title{The \texttt{decision-table} Package} \date{2020/08/22} \begin{document} \maketitle \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. \begin{figure}[H] \centering \dmntable{Calculate BMI}{U}{Weight(kgs),Length(m)}{BMI}{ ---,---,weight/length*length} \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. 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. The \texttt{dmntable} command has the following inputs: \begin{itemize} \item title \item hit policy \item input column headers \item output column headers \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} 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} If a cell value contains multiple values (e.g. multiple string values), then accolades should be written around them. See the example \ref{ex2}. \section{Examples} This section contains some example code and their resulting tables. \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} \end{figure} \end{lstlisting} \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} \end{figure} \begin{lstlisting}[language=tex, frame=single, basicstyle=\small] \begin{ligure}[H] \centering \dmntable{Decide BMI Level}{U} % Title and HP {BMI}{BMI Level, Risk Level} % Input, output {$< 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} \begin{figure}[H] \centering \dmntable{Decide BMI Level}{U} % Title, HP {BMI}{BMI Level, Risk Level} % Input, output {$< 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} \end{figure} \begin{lstlisting}[language=tex, frame=single, basicstyle=\tiny] \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} \end{figure} \end{lstlisting} \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} \end{figure} \begin{lstlisting}[language=tex, frame=single, basicstyle=\tiny] \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} \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. The project is hosted at \url{https://gitlab.com/Vadevesi/dmn-tex} \end{document}