\documentclass[a4paper, 12pt]{report}
\usepackage{tkz-tab}
\tikzset{t style/.style={style=solid}}
\begin{document}
\begin{tikzpicture}
\tkzTabInit[lgt=3,espcl=2,deltacl=0]
{ $x$ /.8, $2x^2+8x+6$ /.8, $x^2+2x$ /.8, $$\frac{2x^2+8x+6}{x^2+2x}$$ / 2}
{$\qquad-\infty$,$-3$,$-2$,$-1$,$0$,$+\infty\qquad$} % four main references
\tkzTabLine {,+,z,-,t,-,z,+,t,+,} % seven denotations
\tkzTabLine {,+,t,+,z,-,t,-,z,+,}
\tkzTabLine {,+,z,-,d,+,z,-,d,+,}
\end{tikzpicture}
\end{document}
答案1
{NiceArray}
这是使用和 TikZ 的解决方案nicematrix
。
\documentclass{article}
\usepackage{geometry}
\usepackage{nicematrix,tikz}
\usetikzlibrary{patterns}
\begin{document}
\renewcommand{\arraystretch}{1.8}
$\begin{NiceArray}{|c|*{4}{w{c}{1.2cm}w{c}{1mm}}w{c}{1.2cm}|}[hlines]
x & \multicolumn{1}{@{}l}{-\infty}
& -3 & & -2 & & -1 & & 0 & \multicolumn{1}{r@{\hspace{2pt}}}{+\infty} \\
2x^2+8x+6 & + & 0 & - & & - & 0 & + & & + \\
x^2+2x & + & & + & & - & & - & 0 & + \\
\frac{2x^2+8x+6}{x^2+2x}
& + & 0 & - & & + & 0 & - & & +
\CodeAfter
\begin{tikzpicture}
\draw (2-|3.5) -- (5-|3.5) ;
\draw (2-|5.5) -- (4-|5.5) ;
\draw [pattern = north west lines] ([xshift=-2pt]4-|5.5) rectangle ([xshift=2pt]5-|5.5) ;
\draw (2-|7.5) -- (5-|7.5) ;
\draw (2-|9.5) -- (4-|9.5) ;
\draw [pattern = north west lines] ([xshift=-2pt]4-|9.5) rectangle ([xshift=2pt]5-|9.5) ;
\end{tikzpicture}
\end{NiceArray}$
\end{document}
您需要多次编译(因为nicematrix
在后台使用 PGF/Tikz 节点)。