# Table - Extra alignment tab has been changed to \cr

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}

• You're missing a \\ at the end of the first row. – Werner Sep 25 '14 at 19:24
• @dcmst: See Formatting Sand-Box and this comment. – Werner Sep 25 '14 at 19:25
• @werner, it seems to be too hard for me, I just removed the comment :P – Old Nick Sep 25 '14 at 19:27
• I see you're not following my suggestions about using 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. – egreg Sep 25 '14 at 19:38
• @egreg That's because I don't have much time now, I would like to follow all your suggestion, and actually I had thought to follow them, but I am full of work, unfortunately :( – nbro Sep 25 '14 at 19:41

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.

\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}

• It is not so difficult to come up with another variable name for "F", yes, but I had not thought about that, but of course you are completely right. – nbro Sep 27 '14 at 0:00

In my case it happened because I didn't declare the right number of columns

example:

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

• This answer saved me a lot of time searching for semantic problems with longtabu, tabu and so on. After all it was only a simple mistake. – Zelphir Kaltstahl Apr 26 '17 at 9:30

### 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}


I had this happen because I copy pasted some stuff from another table in my document, was using the following syntax to make a horizontal line under only part of the table:

\\\cline{2-3}


I copy pasted

\\\cline{2-5}


from a table with more columns, and it gave this error until I corrected it.

• This is probably a solution to a different problem that results in the same error. Technically it doesn't answer this question, since the OP doesn't user \cline. – Werner Sep 7 '17 at 21:00

You have to change |c|c|c| to crcrcr. I made this table as follows.

\begin{table}
\centering
\begin{tabular}{crcrcrcrcrcrcrcr}
\hline
B & F & P & C &  $B \lor F$ & $P \lor C$ & $\neg(F \land C)$ & $\neg(B \land P)$ \\
\hline
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 \\
\hline
\end{tabular}
\end{table}


Note: For top and bottom rule, I used \hline command