![一个环境中有三张带有两个箭头的表格](https://linux22.com/image/468610/%E4%B8%80%E4%B8%AA%E7%8E%AF%E5%A2%83%E4%B8%AD%E6%9C%89%E4%B8%89%E5%BC%A0%E5%B8%A6%E6%9C%89%E4%B8%A4%E4%B8%AA%E7%AE%AD%E5%A4%B4%E7%9A%84%E8%A1%A8%E6%A0%BC.png)
我有这些树表,我试图将它们放在一个通过箭头连接的环境中:
\begin{table}[H]
\begin{tabular}{|l|l|l|l|}
\hline
\multicolumn{1}{|c|}{StudentID} & \multicolumn{1}{c|}{Course} & Grade & P \\ \hline
1 & Math & \multicolumn{1}{l|}{A} & $p_1= 0.25$ \\ \cline{3-4}
& & B & $p_2=0.75$ \\ \hline
\end{tabular}
\caption{Probabilistic Database}
\end{table}
\begin{table}[H]
\begin{tabular}{|l|l|l|}
\hline
\multicolumn{1}{|c|}{StudentID} & \multicolumn{1}{c|}{Course} & \multicolumn{1}{c|}{Grade} \\ \hline
1 & Math & A \\ \hline
\end{tabular}
\caption{World 1}
\end{table}
\begin{table}[H]
\begin{tabular}{|l|l|l|}
\hline
\multicolumn{1}{|c|}{StudentID} & \multicolumn{1}{c|}{Course} & \multicolumn{1}{c|}{Grade} \\ \hline
1 & Math & B \\ \hline
\end{tabular}
\caption{World 2}
\end{table}
编辑所需的输出如下,应适合两列:
答案1
这钛钾Z 封装是一个流行的 LaTeX 插图包,使用它,你可以将文本放在节点在坐标系上的点处。在下面的代码中,我将“概率数据库”表定位为始终位于原点的左侧(即原点位于east
)。我将“世界 1”和“世界 2”表定位为始终分别位于 (2,2) 和 (2,−2) 的右侧(即这些锚点始终位于west
)。使用\draw[->]
,我绘制了几乎但不完全从原点开始的箭头,并以“世界 1”和“世界 2”表的锚点结束。您可以更改这些坐标以更改表显示的高度或低度或每个箭头的起点或终点。
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw (0,0) node [anchor=east,align=center,yshift=-1ex] {
\begin{tabular}{|l|l|l|l|}
\hline
\multicolumn{1}{|c|}{StudentID} & \multicolumn{1}{c|}{Course} & Grade & P \\ \hline
1 & Math & \multicolumn{1}{l|}{A} & $p_1= 0.25$ \\ \cline{3-4}
& & B & $p_2=0.75$ \\ \hline
\end{tabular}\\[1ex]
Probabilistic database
};
\draw[thick,->] (0.2,0.2) -- (2,2) node[anchor=west,align=center,yshift=-1ex] {
\begin{tabular}{|l|l|l|}
\hline
\multicolumn{1}{|c|}{StudentID} & \multicolumn{1}{c|}{Course} & \multicolumn{1}{c|}{Grade} \\ \hline
1 & Math & A \\ \hline
\end{tabular}\\[1ex]
World 1
};
\draw[thick,->] (0.2,-0.2) -- (2,-2) node[anchor=west,align=center,yshift=-1ex] {
\begin{tabular}{|l|l|l|}
\hline
\multicolumn{1}{|c|}{StudentID} & \multicolumn{1}{c|}{Course} & \multicolumn{1}{c|}{Grade} \\ \hline
1 & Math & B \\ \hline
\end{tabular}\\[1ex]
World 2
};
\end{tikzpicture}
\end{document}