在 Latex 中绘制带有箭头的表格

在 Latex 中绘制带有箭头的表格

在此处输入图片描述

我想在 Latex 中绘制这张表格,请帮帮我。

答案1

纯粹主义者甚至可以仅使用标准 LaTeXpicture环境来完成此操作,例如:

\documentclass{standalone}
\renewcommand\familydefault{\sfdefault}
\begin{document}

\setlength{\unitlength}{10mm}
\parbox{4em}{Bishop's case}
\begin{picture}(3,3)(0,1.5)
  \multiput(0,0)(1,0){4}{\line(0,1){3}}
  \multiput(0,0)(0,1){4}{\line(1,0){3}}
  \put(.5,2.5){\makebox(0,0)[c]{A}}
  \put(1.5,2.5){\makebox(0,0)[c]{B}}
  \put(2.5,2.5){\makebox(0,0)[c]{C}}
  \put(.5,1.5){\makebox(0,0)[c]{D}}
  \put(1.5,1.5){\makebox(0,0)[c]{E}}
  \put(2.5,1.5){\makebox(0,0)[c]{F}}
  \put(.5,.5){\makebox(0,0)[c]{G}}
  \put(1.5,.5){\makebox(0,0)[c]{H}}
  \put(2.5,.5){\makebox(0,0)[c]{I}}
  \thicklines
  \put(1.4,1.4){\vector(-1,-1){.75}}
  \put(1.6,1.4){\vector(1,-1){.75}}
  \put(1.4,1.6){\vector(-1,1){.75}}
  \put(1.6,1.6){\vector(1,1){.75}}
  \put(0,-1){\makebox(3,0.9)[tl]{\parbox{3\unitlength}{\raggedright\tiny Cells sharing a common vertex are
        considered contiguous/adjacent}}}
\end{picture}
$\longrightarrow$
\begin{picture}(3,3)(0,1.5)
  \multiput(0,0)(1,0){4}{\line(0,1){3}}
  \multiput(0,0)(0,1){4}{\line(1,0){3}}
  \put(.5,2.5){\makebox(0,0)[c]{$j$}}
  \put(2.5,2.5){\makebox(0,0)[c]{$j$}}
  \put(1.5,1.5){\makebox(0,0)[c]{$j$}}
  \put(.5,.5){\makebox(0,0)[c]{$j$}}
  \put(2.5,.5){\makebox(0,0)[c]{$j$}}
\end{picture}
$\longrightarrow \mathsf{W}_{ij}=
\begin{array}{*{10}{c}}
   & \mathsf{A} & \mathsf{B} & \mathsf{C} & \mathsf{D} & \mathsf{E} & \mathsf{F}
  & \mathsf{G} & \mathsf{H} & \mathsf{I} \\
  \mathsf{A} & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\
  \mathsf{B} & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
  \mathsf{C} & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\
  \mathsf{D} & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
  \mathsf{E} & 1 & 0 & 1 & 0 & 0 & 0 & 1 & 0 & 1 \\
  \mathsf{F} & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
  \mathsf{G} & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\
  \mathsf{H} & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
  \mathsf{I} & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\
\end{array}$
\end{document}

在此处输入图片描述

答案2

对于第一个表格及其箭头(最困难的部分)。

\documentclass{article}
\usepackage{nicematrix,tikz}

\begin{document}

\setlength{\tabcolsep}{0pt}

\begin{NiceTabular}{ccc}[hvlines,columns-width = 12 pt]
  A & B & C \\
  D & E & F \\
  G & H & I 
\CodeAfter
  \begin{tikzpicture} [->]
    \draw (2-2) -- (1-1) ; 
    \draw (2-2) -- (1-3) ; 
    \draw (2-2) -- (3-1) ; 
    \draw (2-2) -- (3-3) ;
  \end{tikzpicture}
\end{NiceTabular}

\end{document}

上述代码的输出

相关内容