在表格中包含框和箭头的最佳方法是什么?

在表格中包含框和箭头的最佳方法是什么?

我想创建一个表格,但在第一列中我想要用箭头连接的框。它应该类似于下面的图片。框应该是正常的(黑白,没有花哨的颜色),箭头应该是正常的黑色箭头。

有人能帮我创建这个吗?

在此处输入图片描述

答案1

在此处输入图片描述

\documentclass{article}

\usepackage{tikz}

\newlength{\mylength}       
\settoheight{\mylength}{S}
\tikzset{mybox/.style={draw=black,text width=2cm, align=center}, 
         baseline={([yshift=-\mylength]current bounding box.north)}}
    
\usepackage{booktabs}
\usepackage{tabularx}

\usepackage{enumitem}
\newlist{tabitemize}{itemize}{1}
\setlist[tabitemize]{label=\textbullet, 
                     noitemsep,
                     leftmargin=*,
                     topsep=0pt,
                     partopsep=0pt, 
                     nosep, 
                     before=\begin{minipage}[t]{\hsize}\raggedright, 
                     after=\end{minipage}}


\begin{document}
\noindent
\begin{tabularx}{\textwidth}{c XX}
  \toprule
  Column1 & Column2 & Column3  \\
  \midrule
  \begin{tikzpicture}[remember picture]
    \node (A) [mybox]  {Box 1};
  \end{tikzpicture}
  & \begin{tabitemize} \item some longer text in this item \item some text \end{tabitemize}
  & \begin{tabitemize}\item some text \end{tabitemize}\\
  \addlinespace  
  \begin{tikzpicture}[remember picture]
    \node (B) [mybox]{Box 2};
  \end{tikzpicture}
  & \begin{tabitemize} \item some text \item some text \item some text \item some longer text in this item \item some text \end{tabitemize}
  & \begin{tabitemize}\item some text \item some longer text in this item  \item some longer text in this item \end{tabitemize}\\ 
  \addlinespace 
  \begin{tikzpicture}[remember picture]
    \node (C) [mybox]  {Box 3};
  \end{tikzpicture}
  & \begin{tabitemize} \item some text \item some text \end{tabitemize}
  & \begin{tabitemize}\item some text \end{tabitemize}\\     
  \bottomrule
\end{tabularx}
\begin{tikzpicture}[overlay, remember picture, ultra thick, ->]
  \draw (A) -- (B);
  \draw (B) -- (C);
\end{tikzpicture}


\end{document}

答案2

在此处输入图片描述

\documentclass[12pt,a4paper]{article}

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

\usepackage{booktabs}% http://ctan.org/pkg/booktabs
\newcommand{\tabitem}{~~\llap{\textbullet}~~}
\usepackage{makecell}
\begin{document}
\minipage{\textwidth}
    \begin{tabular}{ 0c0c0c }
        \toprule
            Column1
                &Column2
                    &Column3        \\
        \midrule
            \begin{tikzpicture}[baseline=(current bounding  box.center), remember picture]
                \node (A) [draw=black,text width=2cm, align=center]  {Box 1};
            \end{tikzpicture}
                &\makecell[t]{\tabitem some text\\\tabitem some text}
                    &\tabitem some text\\
        
            \begin{tikzpicture}[baseline=(current bounding  box.center), remember picture]
            \node (B) [draw=black,text width=2cm, align=center]{Box 2};
            \end{tikzpicture}
                &\makecell[t]{\tabitem some text\\\tabitem some text}
                    &\tabitem some text\\
        \bottomrule
    \end{tabular}
\begin{tikzpicture}[overlay, black, remember picture]
\draw[ultra thick, ->] (A.south) -- (B.north);
\end{tikzpicture}
\endminipage

\end{document}

相关内容