2

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.

3
  • 1
    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. Commented Jun 6, 2015 at 2:23
  • 1
    It is the tabular* environment that allows width specification, not straight tabular. Commented Jun 6, 2015 at 2:24
  • 1
    I have solved my problem using your tips. Thanks a lot
    – Huang Mao
    Commented Jun 6, 2015 at 2:39

0

You must log in to answer this question.

Browse other questions tagged .