通过箭头连接表格单元格中的框

通过箭头连接表格单元格中的框

我正在尝试创建一个包含三列的表格:

  1. 自上而下的流程图
  2. 图表
  3. 人物

预期布局

我使用框架绘制了流程图中的步骤parbox

\fbox{\parbox{20mm}{
    \centering
    Text
}}

为了连接这些盒子,我尝试使用 tikzmark 包手动设置坐标。

但我怎样才能确保箭头是:

  1. 框下方/上方居中
  2. 连接至箱子框架吗?

梅威瑟:

\documentclass[12pt,a4paper]{standalone}

\usepackage{tabularx}
\usepackage{tikz}
\usetikzlibrary{tikzmark}


% Table Setup
\renewcommand\tabularxcolumn[2]{m{#1}} % for vertical centering text in X column

\begin{document}
\minipage{\textwidth}

    \begin{tabularx}{\textwidth}{ c|X|X| }
        \hline
            Process Step
        &
            Relevant Parameters
        &
            Visual Representation
        \\
        \hline
            \fbox{\parbox{20mm}{
                \centering
                Wire
                Bonding
            }} \tikzmark{a}
        &
            Figure
        &
            Image
        \\
        \hline
            \fbox{\parbox{20mm}{
                \centering
                Phosphor
                Deposition
            }} \tikzmark{b}
        &
            Figure
        &
            Image
        \\
        \hline
        
    \end{tabularx}
    
    \begin{tikzpicture}[overlay, remember picture]
        \draw [->] ({pic cs:a}) to ({pic cs:b});
    \end{tikzpicture}


\endminipage
\end{document}

答案1

在此处输入图片描述

\documentclass[12pt,a4paper]{article}

\usepackage{tikz}
\usetikzlibrary{tikzmark}

\usepackage[export]{adjustbox} % for the valign=c option

\usepackage[column=0]{cellspace}
\setlength{\cellspacetoplimit}{\tabcolsep}
\setlength{\cellspacebottomlimit}{\cellspacetoplimit}


\begin{document}
\minipage{\textwidth}

    \begin{tabular}{ |0c|0c|0c| }
        \hline
            Process Step
        &
            Relevant Parameters
        &
            Visual Representation
        \\
        \hline
        
        \begin{tikzpicture}[baseline=(current bounding  box.center), remember picture]
          \node (A) [draw=black,text width=2cm, align=center]  {Wire Bonding};
        \end{tikzpicture}
        &
            \includegraphics[width=4cm, valign=c]{example-image}
        &
            \includegraphics[width=4cm, valign=c]{example-image}
        \\
        \hline
        \begin{tikzpicture}[baseline=(current bounding  box.center), remember picture]
          \node (B) [draw=black,text width=2cm, align=center]{Phosphor Deposition};
        \end{tikzpicture}
        &
            \includegraphics[width=4cm, valign=c]{example-image}
        &
            \includegraphics[width=4cm, valign=c]{example-image}
        \\
        \hline
        
    \end{tabular}
    
\begin{tikzpicture}[overlay, black, remember picture]
\draw[ultra thick, ->] (A.south) -- (B.north);
\end{tikzpicture}

\endminipage

\end{document}

答案2

这是否满足要求 - 我在框之间添加了一行,以便可以看到箭头 - 您还可以通过调整坐标来试验箭头的位置(-1,0)- hline 已被注释掉以获得干净的表格,您可以根据需要将它们放回去

在此处输入图片描述

\documentclass[12pt,a4paper]{standalone}

\usepackage{tabularx}
\usepackage{tikz}
\usetikzlibrary{tikzmark,positioning,calc}

\begin{document}    
    \begin{tabularx}{\textwidth}{c|X|X|}
%        \hline
            Process Step &
            Relevant Parameters &
            Visual Representation\\
%        \hline
            \fbox{\parbox{20mm}{
                \centering
                Wire Bonding
            }} \tikzmark{a} &
            Figure &
            Image\\
%        \hline
&&\\
            \fbox{\parbox{20mm}{
                \centering
                Phosphor Deposition}} \tikzmark{b} &
            Figure &
            Image\\
        \hline
        \end{tabularx}
        \begin{tikzpicture}[overlay, remember picture]
        \draw [->,ultra thick, red] ($({pic cs:a})+(-1,0)$) -- ($({pic cs:b})+(-1,0)$);
    \end{tikzpicture}

\end{document}

编辑

可选择使用以下 tikzpicture 作为侧向箭头--

\begin{tikzpicture}[remember picture, overlay]
\draw ($(pic cs:a)+(-2pt,0pt) $) edge[bend left=60, -latex,  red,ultra thick] 
($(pic cs:b)+(-2pt,0pt)$) ;
\end{tikzpicture}

在此处输入图片描述

相关内容