Wikiversity:Semantic templates/Truth tables/Latex
\newcommand{\truthtableone}[4]{
\begin{center}
\begin{tabular}{|c|c|}
\multicolumn{2}{l}{\textbf{#1}}\\
\hline
$p$ & $#2$\\ \hline
w & #3 \\ \hline
f & #4\\ \hline
\end{tabular}
\end{center} }
\newcommand{\truthtableonetwo}[7]{ \begin{center} \begin{tabular}{|c|c|c|} \multicolumn{3}{l}{\textbf{#1}}\\ \hline $p$ & $#2$ & $#5$ \\ \hline w & #3 & #4 \\ \hline f & #6 & #7 \\ \hline \end{tabular} \end{center} }
\newcommand{\truthtableonethree}[4]{ \begin{center} \begin{tabular}{|c|c|c|c|} \multicolumn{4}{l}{\textbf{#1}} \\ \hline #2 \\ \hline #3 \\ \hline #4 \\ \hline \end{tabular} \end{center} }
%truthtables with two variables p and q
\newcommand{\truthtabletwoone}[6]{ \begin{center} \begin{tabular}{|c|c|c|} \multicolumn{3}{l}{\textbf{#1}} \\ \hline #2 \\ \hline #3 \\ \hline #4 \\ \hline #5 \\ \hline #6 \\ \hline \end{tabular} \end{center} }
\newcommand{\truthtabletwotwo}[6]{ \begin{center} \begin{tabular}{|c|c|c|c|} \multicolumn{4}{l}{\textbf{#1}} \\ \hline #2 \\ \hline #3 \\ \hline #4 \\ \hline #5 \\ \hline #6 \\ \hline\end{tabular} \end{center} }
\newcommand{\truthtabletwothree}[6]{ \begin{center} \begin{tabular}{|c|c|c|c|c|} \multicolumn{5}{l}{\textbf{#1}} \\ \hline #2 \\ \hline #3 \\ \hline #4 \\ \hline #5 \\ \hline #6 \\ \hline \end{tabular} \end{center} }
\newcommand{\truthtabletwofour}[6]{ \begin{center} \begin{tabular}{|c|c|c|c|c|c|} \multicolumn{6}{l}{\textbf{#1}} \\ \hline #2 \\ \hline #3 \\ \hline #4 \\ \hline #5 \\ \hline #6 \\ \hline \end{tabular} \end{center} }
\newcommand{\truthtabletwofive}[6]{ \begin{center} \begin{tabular}{|c|c|c|c|c|c|c|} \multicolumn{7}{l}{\textbf{#1}} \\ \hline #2 \\ \hline #3 \\ \hline #4 \\ \hline #5 \\ \hline #6 \\ \hline \end{tabular} \end{center} }
%truthtables with three variables p,q,r
\newcommand{\truthtablethreeone}[6]{ \begin{center} \begin{tabular}{|c|c|c|c||} \multicolumn{4}{l}{\textbf{#1}} \\ \hline #2 \\ \hline #3 \\ \hline #4 \\ \hline #5 \\ \hline #6 \\ \hline
\end{tabular} \end{center} }