I'm pretty new to TeX and LaTeX and to learn I'm trying to copy my handwritten notes from my notebook to a LaTeX document.
I feel like I'm starting to understand how LaTeX works, but I'm certainly not that good at using it.

Basically what I'm trying to achieve is the following table

enter image description here

It is a very basic table of signs, where on the top we have two numbers (-3 and 2) corresponding to the vertical line that divides the cells.
Additionally I would like to add the points as shown in the picture, to show the zeroes.

What I've tried / found so far:

  • Creating a table (with \begin{tabular}{c|c|c|c} ... \end{tabular}) doesn't seems to work, I cannot get the numbers to be aligned to the vertical line as I want.
  • This question may be related to mine, but the solution provided is too difficult and far different from what I'm trying to achieve.
  • This one is even more complicated, and adds to much things that for my case are not useful.

Thanks everyone in advance, I hope to enhance my skills with LaTeX / TeX in the upcoming months.

  • 2
    Welcome to TeX.SX! Interesting problem, although I'm not convinced of its pedagogical validity.
    – egreg
    Oct 23, 2016 at 21:27
  • 1
    I'm a masochist, obviously copying all my notes to LaTeX isn't the smartest choice ever, but I wanted to give it a try :) Oct 23, 2016 at 21:35

4 Answers 4


Not identical to your table, but still quite near.


% tkz-tab hardcodes $0$ for the zeros
% we want solid lines
\tikzset{t style/.style={style=solid}}


  { /.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,+,}


enter image description here

  • I do actually like it, and it respects the alignment of the numbers! Wonderful! Oct 23, 2016 at 22:18
  • @DenysVitali The manual of tkz-tab is in French, but quite readable, particularly for a Swiss, I believe. Not intuitive at first, but there are several examples.
    – egreg
    Oct 23, 2016 at 22:20
  • I do actually have read some parts of it (and I don't have any problem at understanding French), but found it too complicated for my level of knowledge of LaTeX. I'll certainly use that as a reference in the future, that package seems really powerful. (Grazie per l'aiuto!) Oct 23, 2016 at 22:27
  • @DenysVitali I had a very good teacher of French in middle school, a few years ago. ;-)
    – egreg
    Oct 23, 2016 at 22:34
  • Is it easy to evaluate the signs on the fly rather than hard-coded? Oct 23, 2016 at 22:37

enter image description here

above table is drawn with TikZ:

\documentclass[ tikz,


\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$};

  • I don't trust my eyes, hence took a ruler and it is strange the horizontal lines do not seem to be perpendicular to the vertical direction ... the thing looks strangely distorted, like when I take out my glasses.
    – user4686
    Oct 23, 2016 at 22:10
  • ups, not the last image and code, I will correct this immediately
    – Zarko
    Oct 23, 2016 at 22:13
  • oops -- that's "hyphen 3" at the top, not "minus 3". Oct 24, 2016 at 0:12

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:


\multicolumn{1}{l}{} & \multicolumn{3}{c}{$-3$ \hfil 2 \hfil } \\\hline
3(x-2)^2    &   +   &   +   &   +   \\\hline
(x+3)       &   -   &   +   &   +   \\\hline
p(x)        &   -   &   +   &   +   \\\hline
  • Using \multicolumn seems simple enough to me. It seems more natural to use \multicolumn{4}{l}{\phantom{3(x-2)**2 + } $-3$ \phantom{+} 2 }
    – wmora2
    Jul 17, 2018 at 17:03

With french people, I'used tabvar to draw table of signs and table of variations when needed. Easy to learn and readable. No Tikz nor Pstricks experience needed.

\[\begin{tabvar}{|C|CCCCC|} \hline
x &\quad-\infty & &\quad ...& &\quad+\infty
\\ \hline
f'(x)=...& &\quad-&\quad 0&\quad + &
\\ \hline
\TVcenter{f(x)=...}&\quad+\infty  &\quad\decroit &\quad...&\quad\croit&\quad+\infty
\\ \hline
%\TVstretch[0pt]{\dfrac{1}{2}} et \TVcenter{f(x)} 
%\addstackgap[5pt]{***} \usepackage{stackengine}

Here, a sample to show some tabvar possibilities with a basic LaTex experience.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .