How to create a table of signs
Not identical to your table, but still quite near.
\documentclass[a4paper]{article}
\usepackage{tkz-tab}
\usepackage{xpatch}
% tkz-tab hardcodes $0$ for the zeros
\xpatchcmd{\tkzTabLine}{$0$}{$\bullet$}{}{}
% we want solid lines
\tikzset{t style/.style={style=solid}}
\begin{document}
\begin{tikzpicture}
\tkzTabInit[lgt=2,espcl=2,deltacl=0]
{ /.8, $3(x-2)^2$ /.8, $x+3$ /.8, $p(x)$ /.8}
{,$-3$,$2$,} % four main references
\tkzTabLine {,+,t,+,z,+,} % seven denotations
\tkzTabLine {,-,z,+,t,+,}
\tkzTabLine {,-,z,+,z,+,}
\end{tikzpicture}
\end{document}
above table is drawn with TikZ:
\documentclass[ tikz,
border=5mm]{standalone}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}
\matrix (m) [matrix of math nodes,
column sep=0cm, row sep=0pt,
nodes={text width=15mm, align=center,
text height=3ex, text depth=1.5ex}]
{
3(x-2)^2 & + & + & + \\
(x+3) & - & + & + \\
p(x) & - & + & + \\
};
\foreach \i in {1, 2, 3}
{
\draw (m-\i-1.north west) -- (m-\i-4.north east);
\draw (m-1-\i.north east) -- (m-3-\i.south east);
}
\draw (m-3-1.south west) -- (m-3-4.south east);
%
\node[above] at (m-1-2.north east) {$-3$};
\node[above] at (m-1-3.north east) {$2$};
\end{tikzpicture}
\end{document}
If the n columns with the signs always have the same width, and always with n-1
headers, then a simple trick could be make a multicolumn cell with the headers spaced with \hfil
:
\documentclass{article}
\usepackage{array}
\begin{document}
\def\arraystretch{1.5}
\begin{tabular}{>{$}l<{$}|>{$}l<{$}|>{$}l<{$}|>{$}l<{$}}
\multicolumn{1}{l}{} & \multicolumn{3}{c}{$-3$ \hfil 2 \hfil } \\\hline
3(x-2)^2 & + & + & + \\\hline
(x+3) & - & + & + \\\hline
p(x) & - & + & + \\\hline
\end{tabular}
\end{document}