我正在尝试使用 tkz-tab 包创建一个符号表。我知道如何使用lgt
或espcl
选项更改第一列或所有剩余列的宽度\tkzTabInit
,但它们同时更改。我希望列的宽度不同。有没有合适的方法来设置各个列的宽度?我搜索了包手册(法语),但没有找到。
现在,我通过创建空列来作弊,但这不是很可靠。
\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}
答案1
我查看了tkz-tab
手册,但没有找到其他方法来扩大您使用的单个(非第一)列(因为手册是法语的,也许我错过了一些东西)。
然而,如果你想要更多的自由去做任何你想做的事情,你可以tikz matrix
直接使用。
\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}