# Math Help - what's wrong with this table?

1. ## what's wrong with this table?

\begin{tabular}[t]{|l|ccccc|c|}
\multicolumn{7}{c}{table of basic solutions}\\\hline
$&\x_{1}&\x_{2}&\x_{3}&\x_{4}&\x_{5}&f$\\ \hline
A&4&0&-4&0&-3&4\\
B&2&0&0&2&-1&2\\
C&1&0&2&3&0&1\\
D&0&0&4&4&1&0\\
E&0&-1&5&6&0&-1\\
F&0&2&2&0&3&2\\
G&0&4&0&-4&5&4\\
H&$\frac{4}{3}&\frac{4}{3}&0&0&1&\frac{8}{3}$\\
I&2&1&-1&0&0&3\\
J&$\frac{5}{3}&\frac{2}{3}&0&1&0&\frac{7}{3}$\\\hl ine
\end{tabular}

it stopped at the line in red.
it says: extra }, or forgotten $. 2. Hello, This code should work : Code: \begin{tabular}[t]{|l|ccccc|c|} \multicolumn{7}{c}{table of basic solutions}\\\hline &$x_{1}$&$x_{2}$&$x_{3}$&$x_{4}$&$x_{5}$&$f $\\ \hline %modified A&4&0&-4&0&-3&4\\ B&2&0&0&2&-1&2\\ C&1&0&2&3&0&1\\ D&0&0&4&4&1&0\\ E&0&-1&5&6&0&-1\\ F&0&2&2&0&3&2\\ G&0&4&0&-4&5&4\\ H&$\frac{4}{3}$&$\frac{4}{3}$&0&0&1&$\frac{8}{3}$\\ %modified I&2&1&-1&0&0&3\\ J&$\frac{5}{3}$&$\frac{2}{3}$&0&1&0&$\frac{7}{3}$\\ \hline %modified \end{tabular} I've added extra$ where needed : in each cell of the table where you use \frac{}{} or x_{}. You can't set a whole line of a table in math mode simply by enclosing it into to $. Instead, you have to enclose the content of each cell by$. I've also replaced every \x_{} by x_{} on line 3 (that may not be what you want if you did define the command \x ...).

If every cell of the table must be in math mode, you can use array instead of tabular. Every cell of an array is in math mode so there is no need to use the symbol \$. The following code gives the table on the attached picture (note that the first column is in italic font which, again, may not be what you want).

Code:
\begin{array}[t]{|l|ccccc|c|}
\multicolumn{7}{c}{\text{table of basic solutions}}\\\hline
&x_{1}&x_{2}&x_{3}&x_{4}&x_{5}&f \\ \hline %modified
A&4&0&-4&0&-3&4\\
B&2&0&0&2&-1&2\\
C&1&0&2&3&0&1\\
D&0&0&4&4&1&0\\
E&0&-1&5&6&0&-1\\
F&0&2&2&0&3&2\\
G&0&4&0&-4&5&4\\
H&\frac{4}{3}&\frac{4}{3}&0&0&1&\frac{8}{3}\\ %modified
I&2&1&-1&0&0&3\\
J&\frac{5}{3}&\frac{2}{3}&0&1&0&\frac{7}{3}\\ \hline %modified
\end{array}

3. ## thx

this works! thx.