[Tex/LaTex] Table – Extra alignment tab has been changed to \cr

errors

What is the real problem with this table?

\begin{table}[h]
\centering

\begin{tabular}{ c | c | c | c | c | c | c | c }

B & F & P & C &  $B \lor F$ & $P \lor C$ & $\neg(F \land C)$ & $\neg(B \land P)$
T & T & T & T & T & T & F & F \\ % Error l.37 T & T & T & T & T & T & F & F \\ ?
T & T & T & F & T & T & T & F \\
T & T & F & T & T & T & F & T \\
T & T & F & F & T & F & T & T \\
T & F & T & T & T & T & T & F \\ 
T & F & T & F & T & T & T & F \\
T & F & F & T & T & T & T & T \\
T & F & F & F & T & F & T & T \\
F & T & T & T & T & T & F & T \\
F & T & T & F & T & T & T & T \\
F & T & F & T & T & T & F & T \\
F & T & F & F & T & F & T & T \\
F & F & T & T & F & T & T & T \\
F & F & T & F & F & T & T & T \\
F & F & F & T & F & T & T & T \\
F & F & F & T & F & T & T & T \\
\end{tabular}

\end{table}

Best Answer

In addition to inserting the missing \\ line break instruction, you should contemplate undertaking the following steps:

  • Implement fully the suggestions @egreg made with regard to your earlier posting, inluding the use of array instead of tabular and the use of macros rather than hard-coded letters for "True" and "False". (Do also think hard why you're using the letter F both as a variable and as the token for "false". Is it so difficult to come up with a better variable name than "F"?)

  • Get rid of all vertical bars, and use the line-drawing macros of the booktabs package to insert a few but well-spaced horizontal lines.

  • Add a bit of extra vertical whitespace after every fourth row in the body of the table, since four rows at a time provide a natural grouping for the table at hand.

enter image description here

\documentclass{article}
\usepackage{booktabs}
\newcommand\T{\textrm{T}}  % "true"
\newcommand\F{\textrm{F}}  % "false"
\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
\T & \T & \T & \T & \T & \T & \F & \F \\ 
\T & \T & \T & \F & \T & \T & \T & \F \\
\T & \T & \F & \T & \T & \T & \F & \T \\
\T & \T & \F & \F & \T & \F & \T & \T \\[1ex]
\T & \F & \T & \T & \T & \T & \T & \F \\
\T & \F & \T & \F & \T & \T & \T & \F \\
\T & \F & \F & \T & \T & \T & \T & \T \\
\T & \F & \F & \F & \T & \F & \T & \T \\[1ex]
\F & \T & \T & \T & \T & \T & \F & \T \\
\F & \T & \T & \F & \T & \T & \T & \T \\
\F & \T & \F & \T & \T & \T & \F & \T \\
\F & \T & \F & \F & \T & \F & \T & \T \\[1ex]
\F & \F & \T & \T & \F & \T & \T & \T \\
\F & \F & \T & \F & \F & \T & \T & \T \\
\F & \F & \F & \T & \F & \T & \T & \T \\
\F & \F & \F & \T & \F & \T & \T & \T \\
\bottomrule
\end{array}$
\end{table}
\end{document}
Related Question