There has got to be a better/easier way to do this!! And by the way, how does one format the code [when posting a question] to look nice, compact, and full of colours?
\documentclass{article}
\usepackage[2.5cm]{geometry}% http://ctan.org/pkg/geometry
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\begin{document}
\begin{tabular}{ l || l c c c c c c c r |}
$x$ \vspace{1pt}
& $ -\, \infty $
& \hspace*{-0.5cm}
& \hspace*{-0.5cm} $ -\, 1 $
& \hspace*{-0.5cm}
& \hspace*{-0.7cm} $0$
& \hspace*{-1.0cm}
& \hspace*{-0.5cm} $+\, 1$
& \hspace*{-0.5cm}
& \hspace*{-0.5cm} $ +\, \infty $ \\
\hline
\parbox[t][1.0cm]{2.0cm}{\vspace{1pt} $y' \,=\, \dfrac{\,x^{2} \,-\, 1\,}{x^{2}}$ \vspace{1pt}}
& $\begin{array}{c} \\ + \quad +\\ \end{array}$
& \hspace*{-0.5cm} $\begin{array}{c} \\ + \quad + \quad + \\ \end{array}$
& \hspace*{-0.5cm} $\begin{array}{c} \\ 0 \\ \end{array}$
& \hspace*{-0.5cm} $\begin{array}{c} \\ - \quad - \quad - \\ \end{array}$
& \hspace*{-0.7cm} $\begin{array}{c} \\ \vert \\ \end{array}$
& \hspace*{-1.0cm} $\begin{array}{c} \\ - \quad - \quad - \\ \end{array}$
& \hspace*{-0.5cm} $\begin{array}{c} \\ 0 \\ \end{array}$
& \hspace*{-0.5cm} $\begin{array}{c} \\ + \quad + \quad + \\ \end{array}$
& \hspace*{-1.0cm} $\begin{array}{c} \\ + \\ \end{array}$ \\
\hline
\parbox[t][1.0cm]{2.0cm}{\vspace{1pt} $y'' \,=\, \dfrac{2}{\,x^{3}\,}$ \vspace{1pt}}
& $\begin{array}{c} \\ - \quad - \\ \end{array}$
& \hspace*{-0.5cm} $\begin{array}{c} \\ - \quad - \quad - \\ \end{array}$
& \hspace*{-0.5cm} $\begin{array}{c} \\ - \\ \end{array}$
& \hspace*{-0.5cm} $\begin{array}{c} \\ - \quad - \quad - \\ \end{array}$
& \hspace*{-0.7cm} $\begin{array}{c} \\ \vert \\ \end{array}$
& \hspace*{-1.0cm} $\begin{array}{c} \\ + \quad + \quad + \\ \end{array}$
& \hspace*{-0.5cm} $\begin{array}{c} \\ + \\ \end{array}$
& \hspace*{-0.5cm} $\begin{array}{c} \\ + \quad + \quad + \\ \end{array}$
& \hspace*{-1.0cm} $\begin{array}{c} \\ + \\ \end{array}$ \\
\hline
\parbox[t][1.0cm]{2.0cm}{ $y \,=\, x \,+\, \dfrac{1}{\,x\,}$ }
& $-\, \infty \;\; \nearrow$
& \hspace*{-0.5cm} $ \begin{array}{c} \\ \nearrow \quad \nearrow \quad \nearrow \\ \bigcap \end{array} $
& \hspace*{-0.5cm} $ -\, 2 $
& \hspace*{-0.5cm} $ \begin{array}{c} \\ \searrow \quad \searrow \quad \searrow \\ \bigcap \end{array} $
& \hspace*{-0.7cm} $ \;\genfrac{}{}{0.0pt}{}{}{}_{-\,\infty} {\Big |}^{+\, \infty}\; $
& \hspace*{-0.7cm} $ \begin{array}{c} \\ \searrow \quad \searrow \quad \searrow \\ \bigcup \end{array} $
& \hspace*{-0.5cm} $ +\, 2 $
& \hspace*{-0.5cm} $ \begin{array}{c} \\ \nearrow \quad \nearrow \quad \nearrow \\ \bigcup \end{array} \vspace{2pt} $
& \hspace*{-1.0cm} $+\, \infty$ \\
\hline
\end{tabular}\\
\end{document}
Best Answer
In my original comment, I asked if your code came from a
WYSIWYG
, because it looked as if it had a lot of unnecessary code- typically you get this kind of code when (attempting) to export from another program toTeX
.Anyway, here's my version of your table:
In the code below I have
\begin{array}{c}...\end{array}
\hspace*{...}
booktabs
package which gives lots of useful features for tables, including\toprule
,\midrule
, and\bottomrule
tabularx
package to allow the table to stretch to (in this case) the\textwidth
\arraystretch
You'll also notice that I have been quite sparing with my
+
,-
,\searrow
, and\nearrow
. As the examples get more complicated and you need to consider more intervals, you would necessarily need to delete a lot of them anyway.If you want to see how wide the table is, you can change
showframe=true
in the loading of thegeometry
package. If ever you want your table to be wider than the standardtextwidth
, then you can enclose it in anadjustwidth
environment from thechangepage
package.