# Insert table with fixed width

I want to insert a table into my article. The following code can work.

\begin{table}
\centering
\caption{Table 1 Normal function table}
\begin{tabular}{|c|c|c|c|}
\hline
& $x<0$     & $x=0$     & $x>0$\\ \hline
$y<0$ & $x^2-y^2$ & $x^2+y^2$ & $x^2-y^2$\\ \hline
$y=0$ & $x+y$     & $x^2-y^2$ & $x^2+y^2$ \\ \hline
$y>0$ & $x^2+y^2$ & $x+y$     & $x^2+y^2$\\ \hline
\end{tabular}
\end{table}


But I want to fix the table's width, so I changed the fourth line as \begin{tabular}{\textwidth}{|c|c|c|c|} but it's error, the pdf can't be generated.

• Welcome to the site. If you indent code blocks by 4 spaces, they will display as code. Alternately, highlight the block and click on the {}icon above the edit box. For inline code highlighting, enclose the code in grave accents. – Steven B. Segletes Jun 6 '15 at 2:23
• It is the tabular* environment that allows width specification, not straight tabular. – Steven B. Segletes Jun 6 '15 at 2:24
• I have solved my problem using your tips. Thanks a lot – Huang Mao Jun 6 '15 at 2:39