[Tex/LaTex] undefined control sequence in a table

errorstablesundefined

\documentclass[a4paper,12pt,twoside]{book}
\usepackage{etex}

\usepackage[left=2.50cm,right=2.50cm,top=2.50cm,bottom=2.75cm]{geometry}
\usepackage{amsmath,amssymb,amscd,amsbsy,array,color,epsfig}
\usepackage{fancyhdr,framed,latexsym,multicol,pstricks,slashed,xcolor}
\usepackage{picture}
\usepackage{indentfirst}
\usepackage{enumitem}

\begin{document}

\begin{proof}
    \begin{table}[!ht]
\centering
    \begin{tabular}{|c|c||c|c|c||c|c|}
    \hline
        $P$ & $Q$ & $P \Rightarrow Q$ & $\neg P$ & $\neg Q$ & $(\neg Q) \Rightarrow (\neg P)$ & $Q \Rightarrow P$ \\
    \hline
        $T$ & $T$ & $T$ & $F$ & $F$ & $T$ & $T$ \\
    \hline
        $T$ & $F$ & $F$ & $F$ & $T$ & $F$ & $T$ \\
    \hline
        $F$ & $T$ & $T$ & $T$ & $F$& $T$ & $F$ \\
    \hline
        $F$ & $F$ & $T$ & $T$ & $T$ & $T$ & $T$ \\
    \hline
    \end{tabular}
\caption{\emph{Truth Table for $P \Rightarrow Q$, $(\neg Q) \Rightarrow (\neg P),$ and $Q \Rightarrow P.$}}
\end{table}
\end{proof}

\end{document}

Hopefully I have given enough information in the MWE, because in my original I have a preamble, a table of contents, a chapter 0 (from which the table comes), and an analysis file which has the previous as inputs. So, I might have left something out that is needed from the MWE for it to compile.

But when I compile I get the following error at the beginning of the table:

Not in outer par mode \begin{table}[!ht]
Undefined control sequence \begin{table}[!ht]
Missing number, treated as zero \begin{table}[!ht]

Thanks.

Best Answer

An attempt:

\documentclass[a4paper,12pt,twoside]{book}
\usepackage{etex}

\usepackage[left=2.50cm,right=2.50cm,top=2.50cm,bottom=2.75cm]{geometry}
\usepackage{amsmath,amssymb,amscd,amsbsy,array,color,epsfig}
\usepackage{fancyhdr,framed,latexsym,multicol,pstricks,slashed,xcolor}
\usepackage{picture}
\usepackage{indentfirst}
\usepackage{enumitem}

\usepackage{amsthm}% PS

\begin{document}

\begin{proof}
$\,$ %PS (some text [invisible])
%    \begin{table}[!ht]
\begin{table}[h!]
\centering
    \begin{tabular}{|c|c||c|c|c||c|c|}
    \hline
        $P$ & $Q$ & $P \Rightarrow Q$ & $\neg P$ & $\neg Q$ & $(\neg Q) \Rightarrow (\neg P)$ & $Q \Rightarrow P$ \\
    \hline
        $T$ & $T$ & $T$ & $F$ & $F$ & $T$ & $T$ \\
    \hline
        $T$ & $F$ & $F$ & $F$ & $T$ & $F$ & $T$ \\
    \hline
        $F$ & $T$ & $T$ & $T$ & $F$& $T$ & $F$ \\
    \hline
        $F$ & $F$ & $T$ & $T$ & $T$ & $T$ & $T$ \\
    \hline
    \end{tabular}
\caption{\emph{Truth Table for $P \Rightarrow Q$, $(\neg Q) \Rightarrow (\neg P),$ and $Q \Rightarrow P.$}}
\end{table}

\end{proof}

\end{document}

enter image description here

Some suggestions:

  1. Do you really need float table in the proof? An unnumbered version (only tabular) is less problematic.

    1. If you use array insted of tabular, all your dollars inside it are unneeded.

    2. There were some suggestions about packages in comments.