2017 update
Since xintexpr 1.1 (2014/10/28)
it is preferred to use ||
and &&
, the single |
and &
may change meaning from their current ones as Boolean or
resp. and
. One can also use the keywords 'or'
resp. 'and'
(quotes mandatory). Answer updated to anticipate possible future change of meaning of single |
and &
infix operators.
Perhaps you wish the table to be automatically filled in?
Update adds code for 1ex
vertical skip every four rows thing.
\documentclass{article}
\usepackage{booktabs}
\usepackage{xintexpr}
\newcommand\T{\textrm{T}} % "true"
\newcommand\F{\textrm{F}} % "false"
\newcommand\TF[1]{\if1#1\T\else\F\fi}
\begin{document}
\begin{table}[h]
\centering
$\begin{array}{ *{8}{c} }
\toprule
B & F & P & C & B \lor F & P \lor C & \neg(F \land C) & \neg(B \land P)\\
\midrule
\xintFor #1 in {1,0}\do {%
\xintFor #2 in {1,0}\do {%
\xintFor #3 in {1,0}\do {%
\xintFor #4 in {1,0}\do {%
\TF#1 & \TF#2 & \TF#3 & \TF#4 &
\xintifboolexpr {#1 || #2}{\T}{\F}&
\xintifboolexpr {#3 || #4}{\T}{\F} &
\xintifboolexpr {not(#2 && #4)}{\T}{\F} &
\xintifboolexpr {not(#1 && #3)}{\T}{\F} \\
}}}}
\bottomrule
\end{array}$
\end{table}
\end{document}
With extra skips:
\documentclass{article}
\usepackage{booktabs}
\usepackage{xintexpr}
\newcommand\T{\textrm{T}} % "true"
\newcommand\F{\textrm{F}} % "false"
\newcommand\TF[1]{\if1#1\T\else\F\fi}
\begin{document}
\begin{table}[h]
\centering
$\begin{array}{ *{8}{c} }
\toprule
B & F & P & C & B \lor F & P \lor C & \neg(F \land C) & \neg(B \land P)\\
\midrule
\xintFor #1 in {1,0}\do {%
\xintFor #2 in {1,0}\do {%
\xintFor #3 in {1,0}\do {%
\xintFor #4 in {1,0}\do {%
\TF#1 & \TF#2 & \TF#3 & \TF#4 &
\xintifboolexpr {#1 || #2}{\T}{\F}&
\xintifboolexpr {#3 || #4}{\T}{\F} &
\xintifboolexpr {not(#2 && #4)}{\T}{\F} &
\xintifboolexpr {#3 || #4}% every four, add 1ex space
{\xintifboolexpr {not(#1 && #3)}{\T}{\F}\\}
{\xintifboolexpr {not(#1 && #3)}{\T}{\F}\\[1ex]}
}}}}
\noalign{\addvspace{-1ex}}% compensate the last 1ex vskip
\bottomrule
\end{array}$
\end{table}
\end{document}
\\
at the end of the first row.array
,\True
and the similarly defined\False
. By the way, you're using “F” in apparently two very different meanings, which can be utterly confusing. In the first line you have “B” and the other variables appearing with different shapes, adding to confusion.