带有文本和箭头的矩形单元格表

带有文本和箭头的矩形单元格表

我正在尝试制作一种矩阵,其单元格中有文本,对角线上有箭头。如何在 LaTeX 中制作像这样的矩形表?在此处输入图片描述

答案1

在此处输入图片描述

\documentclass{article} % or another class
\usepackage{xcolor} % before tikz or tkz-euclide if necessary

\usepackage{tkz-euclide} % no need to load TikZ
\usepackage{multirow}
\usetikzlibrary{babel} %if there are problems with the active characters
\begin{document}

\begin{tikzpicture}[scale=0.7]
%define the square edges
\tkzDefPoints{0/0/A,12/0/B,12/12/C,0/12/D}
\tkzDrawPolygon(A,...,D)
\tkzDrawPoints(A,B,C,D)
%connect square medians
\tkzDrawLine[color=blue,add=0 and 0.2](D,B)
\tkzDrawLine[color=blue,add=0 and 0.2](A,C)
%define middle of the square
\tkzInterLL(D,B)(A,C)\tkzGetPoint{O}
\tkzDrawPoint(O)
%connect upper lower midpoints
\tkzDefMidPoint(A,B) \tkzGetPoint{A'}
\tkzDefMidPoint(C,D) \tkzGetPoint{C'}
\tkzDrawLine[color=blue,add=-0 and 0](A',C')
%labels
\tkzLabelPoint[draw,xshift=1.7cm,yshift=-1.4cm,fill=orange!40,
text width=3cm,text centered,inner sep=1pt,
font=\scriptsize](B)%
{\begin{tabular}{@{}p{1em}p{2cm}@{}}
    \multirow{3}{*}{A} &Risk of Psy Strain and Phys Illness\\
    \end{tabular}}

\tkzLabelPoint[draw,xshift=1.7cm,yshift=2.3cm,fill=orange!40,
text width=3cm,text centered,inner sep=1pt,
font=\scriptsize](C)%
{\begin{tabular}{@{}p{1em}p{2cm}@{}}
    \multirow{5}{*}{B} &Active Learning, Motivation, to develop new behavior pattern\\
    \end{tabular}}

\tkzLabelLine[pos=0.7,black,rotate=0,fill=white](A,C){\scriptsize ACTIVE}   
\tkzLabelLine[pos=0.3,black,rotate=0,fill=white](A,C){\scriptsize PASSIVE}
\tkzLabelLine[pos=0.3,black,rotate=0,fill=white](D,B){\scriptsize LOW STRAIN}       
\tkzLabelLine[pos=0.7,black,rotate=0,fill=white](D,B){\scriptsize HIGH STRAIN}
\tkzLabelLine[pos=0.3,black,rotate=0,fill=white, xshift=-0.5cm](A,D){\scriptsize LOW}
\tkzLabelLine[pos=0.7,black,rotate=0,fill=white, xshift=-0.5cm](A,D){\scriptsize HIGH}
\tkzLabelLine[pos=0.3,black,rotate=0,fill=white, yshift=0.3cm](D,C){\scriptsize LOW}
\tkzLabelLine[pos=0.7,black,rotate=0,fill=white, yshift=0.3cm](D,C){\scriptsize HIGH}
\tkzLabelPoint[black,yshift=1cm,xshift=-1cm](C'){\scriptsize Job Demands}
\tkzLabelPoint[black,yshift=2cm,xshift=-2cm](C'){\scriptsize Karasek Job Strain Model}
\tkzLabelLine[pos=0.5,black,rotate=0,fill=white, xshift=-2cm](A,D){\scriptsize Job Decision Latitude}
\end{tikzpicture}
\end{document}

相关内容