如何在表格上叠加图像?

如何在表格上叠加图像?

我希望将彩色的标注对象叠加为指示表格中特定单元格的图像。标注框将指向一个单元格并位于其他几个单元格之上。

答案1

像这样吗?

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{booktabs}
\usepackage{tikz}
\usetikzlibrary{shapes.callouts}
\begin{document}

\begin{tabular}{ccc}
\toprule
Column 1 & Column 2 & Column 3 \\
\midrule
11 & 12 & \tikz[overlay, remember picture,anchor=base] \node (Center){13}; \\
21 & 22 & 23 \\
31 & \tikz[overlay, remember picture,anchor=base] \node (Mark){32}; & 33 \\
41 & 42 & 43 \\
\bottomrule
\end{tabular}

\begin{tikzpicture}[remember picture, overlay, note/.style={rectangle callout, fill=#1}]
\node [note=red!50, callout absolute pointer={(Mark)}] at (Center) {This is the cell!};
\end{tikzpicture}

\end{document}

在此处输入图片描述

要用调出节点覆盖多行,您可以minimum height修复note/.style

note/.style={rectangle callout, fill=#1, minimum height=1cm}

在此处输入图片描述

如果你喜欢其他位置,只需更改标注anchor和居中位置即可,即

\begin{tikzpicture}[remember picture, overlay, 
     note/.style={rectangle callout, fill=#1, 
     minimum height=1cm, anchor=north}]
\node [note=red!50, callout absolute pointer={(Mark)}] at (Center.north) 
      {This is the cell!};
\end{tikzpicture}

在此处输入图片描述

相关内容