如何创建带有注释的表格

如何创建带有注释的表格

我是乳胶的新手,我无法弄清楚如何实现这一点:

数字

到目前为止我已经完成了以下操作:

\documentclass[10pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{tabularx,ragged2e,booktabs,caption}
\begin{document}
    \begin{table}[ht]
        \caption {Dataframe} \label{tab:title} 
        \centering
        \begin{tabular}{rllll}
        \hline
        & a & b & c & d \\ 
        \hline
        1 & $a_1$ & $b_1$ & $c_1$ & $d_1$ \\ 
        2 & $a_2$ & $b_2$ & $c_2$ & $d_2$ \\ 
        3 & $a_3$ & $b_3$ & $c_3$ & $d_3$ \\ 
        4 & . & . & . & . \\ 
        5 & . & . & . & . \\ 
        6 & $a_n$ & $b_n$ & $c_n$ & $d_n$ \\ 
        \hline
    \end{tabular}
\end{table}
\end{document}

答案1

对我来说,最简单的方法是将该表绘制为tikz图片:

在此处输入图片描述

\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{matrix, positioning}

\begin{document}
    \begin{tikzpicture}[node distance=3mm and 0mm]
\matrix (m) [matrix of math nodes]
{
      & A   & B   & C   & D     \\
    0 & a_0 & b_0 & c_0 & d     \\
%
    1 & a_1 & b_1 & c_1 & d_1   \\
    2 & a_2 & b_2 & c_2 & d_2   \\
    3 & a_3 & b_3 & c_3 & d_3   \\
    4 & .   & .   & .   & .     \\
    5 & .   & .   & .   & .     \\
    6 & a_n & b_n & c_n & d_n   \\
};
\draw[densely dashed,blue]  (m-2-3.north west) -| (m-8-3.south east) -| cycle;
\draw[densely dashed,blue]  (m-3-2.north west) -| (m-5-5.south east) -| cycle;
% right part
\draw[->] (m-4-5) -- ++ (1.5,0) node (n1) [right] {xxxxx/yyyyy};
\matrix (n2) [matrix of math nodes,
              below=of n1]
{
    1 & A_1 & B_1 & C_1 & D_1   \\
    2 & A_2 & B_2 & C_2 & D_2   \\
    3 & A_3 & B_3 & C_3 & D_3   \\
};
\draw[->] (n1) -- (n2);
% bottom part
\draw[<-] (m-8-1.south) -- ++ (0,-0.8) node[below] {index};
%
\draw[<-] (m-8-3.south) |- ++ (1,-1) node (n3) [right] {xxx/yyy};
\matrix (n4) [matrix of math nodes,
              below=of n3]
{
    0 & b_0 \\
%
    1 & b_1 \\
    2 & b_2 \\
    3 & b_3 \\
    4 & .   \\
    5 & .   \\
    6 & b_n \\
};
\draw[->] (n4) -- (n3);
\end{tikzpicture}
\end{document}

希望从上面的 MWE 形成你喜欢的文档不是很高的步骤... :)

相关内容