如何在表格之间画箭头

如何在表格之间画箭头

我需要一个表格之间的箭头,像这样

表格

代码

\documentclass[11pt,a4paper]{article}

\begin{table}[h]
\centering
\label{my-label}
\begin{tabular}{|c|cccc|c|}
\hline
 & $x_1$ & $x_2$ & $x_3$ & $x_4$ & $h(x)$ \\ \hline
1 & 1 & 0 & 1 & 1 & 13.25 \\
2 &  &  &  &  &  \\
\vdots &  &  &  &  &  \\
N &  &  &  &  &  \\ \hline
\end{tabular}
\end{table}

\begin{table}[h]
\centering
\label{my-label}
\begin{tabular}{|c|cccc|c|}
\hline
 & $x_1$ & $x_2$ & $x_3$ & $x_4$ & $h(x)$ \\ \hline
1 & 1 & 0 & 1 & 1 & 13.25 \\
2 &  &  &  &  &  \\
\vdots &  &  &  &  &  \\
N &  &  &  &  &  \\ \hline
\end{tabular}
\end{table}

\end{document}

答案1

tikz来救援!由于表格是浮动对象,因此它们可以在文档中的任何位置移动,因此请将两个表格合并到同一个表格中。

在此处输入图片描述

\documentclass[11pt,a4paper]{article}
\usepackage{tikz}
\begin{document}
\begin{table}[h]
\centering
\begin{tikzpicture}
\node (a) at (0,0){
\begin{tabular}{|c|cccc|c|}
\hline
 & $x_1$ & $x_2$ & $x_3$ & $x_4$ & $h(x)$ \\ \hline
1 & 1 & 0 & 1 & 1 & 13.25 \\
2 &  &  &  &  &  \\
\vdots &  &  &  &  &  \\
N &  &  &  &  &  \\ \hline
\end{tabular}};
\node[yshift=-2cm] (b) at (a.south) 
{
\begin{tabular}{|c|cccc|c|}
\hline
 & $x_1$ & $x_2$ & $x_3$ & $x_4$ & $h(x)$ \\ \hline
1 & 1 & 0 & 1 & 1 & 13.25 \\
2 &  &  &  &  &  \\
\vdots &  &  &  &  &  \\
N &  &  &  &  &  \\ \hline
\end{tabular}
};
\draw[->,ultra thick](a)--(b);
\end{tikzpicture}
\label{my-label}
\end{table}

\end{document}

相关内容