1

enter image description here

\begin{table}[!htbp]
\centering
\begin{tabular}{|c|c|c|c|c|c|c|c|}
\hline 
P & Q & R & (P \ensuremath{\vee} Q) & ((P \ensuremath{\vee} Q)    \ensuremath{\vee} R) & (Q \ensuremath{\vee} R) & (P \ensuremath{\vee} (Q\ensuremath{\vee} R)) & (P \ensuremath{\vee} Q) \ensuremath{\vee} R \ensuremath{\leftrightarrow} P \ensuremath{\vee} (Q \ensuremath{\vee} R)\\ \hline
True & True & True & True & True & True & True & True\\ \hline
True & True & False & True & True & True & True & True\\ \hline
True & False & False & True & True & False & True & True\\ \hline
True & False & True & True & True & True & True & True\\ \hline
False & True & True & True & True & True & True & True\\ \hline
False & True & False & True & True & True & True & True\\ \hline
False & False & True & False & True & True & True & True\\ \hline
False & False & False & False & False & False & False & True\\ \hline
\end{tabular}
\end{table}

How do I keep the table from going off the page?

  • I find rather puzzling the difference between $(P\vee Q)\vee R\leftrightarrow P\vee(Q\vee R)$ in the statement and (P \ensuremath{\vee} Q) in the table header. There's no reason for not typing $P\vee Q$ in the header. Besides, as already observed, a tabular is not required to live in a table; in this case it shouldn't. – egreg Oct 5 '16 at 22:26
1

There is rarely a reason for using \ensuremath; your usages are wrong, because P cannot appear italic in the statement and upright in the table.

I'd suggest to use “T” and “F” instead of the longer “True” and “False”. Then you can split the last formula in the table header.

Remove all vertical lines and almost all horizontal ones.

At the end you find a smaller table with the deduction using reverse Polish notation, where the truth value of a composed formula is placed below the connective.

In this context the double arrow should be a binary operation rather than a relation.

Finally, but very important: there's no law imposing that a tabular must be placed inside a table. In this case you do not want the table to float, do you? So, no table, but rather a \[...\] construction that will center it.

\documentclass{article}
\usepackage{amsmath,mathtools}
\usepackage{booktabs}

\newcommand{\liff}{\mathbin{\leftrightarrow}}

\begin{document}

\subsubsection*{Exercise 5}
Use truth tables to verify the associative laws:\\*[2ex]
a)\qquad $(P \lor Q) \lor R \liff P \lor (Q \lor R)$
\[
\addtolength{\tabcolsep}{-1pt}
\begin{tabular}{@{}*{8}{c}@{}}
\toprule
$P$ & $Q$ & $R$ & $P \lor Q$ & $(P \lor Q) \lor R$ & $Q \lor R$ & 
$P \lor (Q \lor R)$ & 
\begin{tabular}{@{}l@{}}
$(P \lor Q) \lor R$ \\ \quad${}\liff P \lor (Q \lor R)$\end{tabular}\\
\midrule
T & T & T & T & T & T & T & T\\
T & T & F & T & T & T & T & T\\
T & F & F & T & T & F & T & T\\
T & F & T & T & T & T & T & T\\
F & T & T & T & T & T & T & T\\
F & T & F & T & T & T & T & T\\
F & F & T & F & T & T & T & T\\
F & F & F & F & F & F & F & T\\
\bottomrule
\end{tabular}
\]
b)\qquad $(P \land Q) \land R \leftrightarrow P \land (Q\land R)$

\subsubsection*{Alternative}

\begin{tabular}{*{11}{c}}
\toprule
$P$ & $Q$ & $\lor$ & $R$ & $\lor$ & $P$ & $Q$ & $R$ & $\lor$ & $\lor$ & $\liff$ \\
\midrule
 T  &  T  &   T    &  T  &   T    &  T  &  T  &  T  &   T    &   T    &   T \\
 T  &  T  &   T    &  F  &   T    &  T  &  T  &  F  &   T    &   T    &   T \\
 T  &  F  &   T    &  T  &   T    &  T  &  F  &  T  &   T    &   T    &   T \\
 T  &  F  &   T    &  F  &   T    &  T  &  F  &  F  &   F    &   T    &   T \\
 F  &  T  &   T    &  T  &   T    &  F  &  T  &  T  &   T    &   T    &   T \\
 F  &  T  &   T    &  F  &   T    &  F  &  T  &  F  &   T    &   T    &   T \\
 F  &  F  &   F    &  T  &   T    &  F  &  F  &  T  &   T    &   T    &   T \\
 F  &  F  &   F    &  F  &   F    &  F  &  F  &  F  &   F    &   F    &   T \\
\bottomrule
\end{tabular}

\end{document}

enter image description here

1

Answer is simple: make table narrower :-) for example like this:

enter image description here

\begin{table}[!htbp]
\centering
\begin{tabular}{|c|c|c|c|c|c|c|c|}
\hline
$P$     & $Q$   & $R$   & $(P\vee Q)$ 
                                & $(P\vee Q)\vee R)$ 
                                        & $(Q\vee R)$ 
                                                & $(P\vee (Q\vee R))$ 
                                                        & $\begin{multlined}
                                                            (P\vee Q)\vee R \\[-2.5ex] 
                                                                \leftrightarrow P\vee (Q\vee R)
                                                  \end{multlined}$  \\ \hline
True    & True  & True  & True  & True  & True  & True  & True      \\ \hline
True    & True  & False & True  & True  & True  & True  & True      \\ \hline
True    & False & False & True  & True  & False & True  & True      \\ \hline
True    & False & True  & True  & True  & True  & True  & True      \\ \hline
False   & True  & True  & True  & True  & True  & True  & True      \\ \hline
False   & True  & False & True  & True  & True  & True  & True      \\ \hline
False   & False & True  & False & True  & True  & True  & True      \\ \hline
False   & False & False & False & False & False & False & True      \\ \hline
\end{tabular}
\end{table}    

And please edit your question and extend table code sniped to complete small document. This I test in my "test-bay" with the following preamble:

\documentclass{article}
\usepackage{mathtools}

If your page layout is very different as I use in my test, then result can be also different.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy