2

I am trying to create a signs table using the package tkz-tab. I know how to change the width of the first column or of all the remaining columns using the options lgt or espclon \tkzTabInit, but they all change at the same time. I would like to have columns with different widths. Is there a proper way to set width for individual columns? I searched the packaged manual (in French), but had not luck.

Right now, I am cheating by creating empty columns, but that is not very robust.

\documentclass{article}
\usepackage{tikz, tkz-tab}
\begin{document}
\begin{tikzpicture}
    \tikzset{t style/.style = {style = densely dashed}} 
    \tkzTabInit[lgt=4, espcl = 1.2, lw = 0.5pt, deltacl=0]{ / 0.7 , $x(x^2-5x+4)$ / 1}{ ,$0$, $1$, , $4$,}

    \tkzTabLine{,-,t,+,t,,-,,t, +,}

    %A few extra marks and labels
    \draw[fill=black] (N21) circle(2pt);
    \draw[fill=black] (N31) circle(2pt);
    \draw[fill=black] (N51) circle(2pt);
    \draw[->=stealth, line width=1.5pt] (N11) -> (N61.east) node[right=2pt] {$x$};
\end{tikzpicture}
\end{document}

enter image description here

1

I looked through the tkz-tab manual but, I didn't find other methods to enlarge a single (non-first) column out of the one you used (since the manual is in French, maybe I missed something).

However, if you want more freedom to do whatever you want, you could use a tikz matrix directly.

\documentclass{article}
\usepackage{tikz, tkz-tab}
\usetikzlibrary{matrix}

\begin{document}
A solution with a \texttt{tikz matrix}:
\begin{center}
\begin{tikzpicture}
    \matrix[%
        matrix of math nodes,
        nodes in empty cells,
        draw,
        inner sep=0pt,
        nodes={align=center},
        column 1/.style={text width=11.3em},
        column 2/.style={text width=3.44em},
        column 3/.style={text width=3.44em},
        column 4/.style={text width=6.88em},
        column 5/.style={text width=3.44em},
        row 1/.style={minimum height=.7cm},
        row 2/.style={minimum height=1cm},
        ] (m) {%
        & & & & \\
        x(x^2-5x+4) & - & + & - & + \\
    };
    \draw (m-1-1.south west) -- (m-1-5.south east);
    \draw (m-1-1.north east) -- (m-2-1.south east);
    \foreach \i/\descr in {2/0,3/1,4/4}{%
\draw[fill=black] (m-2-\i.north east) circle (2pt);
    \draw[densely dashed] (m-2-\i.south east) -- (m-2-\i.north east) node[above=3pt] {$\descr$};
    }
    \draw[->=stealth, line width=1.5pt] (m-1-1.south east) -> (m-1-5.south east) node[right=2pt] {$x$};
\end{tikzpicture}
\end{center}

Your original \texttt{tkz-tab}:
\begin{center}
\begin{tikzpicture}
    \tikzset{t style/.style = {style = densely dashed}} 
    \tkzTabInit[lgt=4, espcl = 1.2, lw = 0.5pt, deltacl=0]{ / 0.7 , $x(x^2-5x+4)$ / 1}{ ,$0$, $1$, , $4$,}

    \tkzTabLine{,-,t,+,t,,-,,t, +,}

    %A few extra marks and labels
    \draw[fill=black] (N21) circle(2pt);
    \draw[fill=black] (N31) circle(2pt);
    \draw[fill=black] (N51) circle(2pt);
    \draw[->=stealth, line width=1.5pt] (N11) -> (N61.east) node[right=2pt] {$x$};
\end{tikzpicture}
\end{center}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.