箭头解释表头

箭头解释表头

StackOverflow 的回答中我们可以看到下面的图。

图表

我想知道如何在 Tikz 中做到这一点。我宁愿没有方框,也不要有指向标题正下方值的箭头,但如果我有可以借鉴的东西,这些细节我可能可以管理。

答案1

绘制这个并不难,但从屏幕截图中输入所有这些东西却很繁琐(这就是我刚才添加的原因can 1,您可以用您认为更合适的任何内容替换这些文本)。

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{fit,positioning}
\begin{document}
\begin{tikzpicture}[font=\sffamily,node distance=2pt and 4pt]
 \begin{scope}[local bounding box=top]
  \node (c1) {d};
  \node[right=of c1] (c2) {l};
  \node[fit=(c1) (c2),label=above:type]{};
  \node[right=1cm of c2] (c3) {r};
  \node[right=of c3] (c4) {w};
  \node[right=of c4] (c5) {x};
  \node[fit=(c3) (c5),label=above:users]{};
  \node[right=1cm of c5] (c6) {r};
  \node[right=of c6] (c7) {w};
  \node[right=of c7] (c8) {x};
  \node[fit=(c6) (c8),label=above:groups]{};
  \node[right=1cm of c8] (c9) {r};
  \node[right=of c9] (c10) {w};
  \node[right=of c10] (c11) {x};
  \node[fit=(c9) (c11),label=above:others]{};
 \end{scope}
 \foreach \X [count=\Y,evaluate=\Y as \Z using {int(12-\Y)},
 remember=\Z as \LastZ]
  in {can 1,can 2,can 3,can 4,can 5,can 6,can 7,can 8,can 9,can 10,can 11}
  {\ifnum\Y=1
   \node[anchor=north west] (l\Z) at ([xshift=1em,yshift=-1ex]top.south east) 
    {\X};
  \else
   \node[anchor=north west] (l\Z) at ([yshift=-0.2ex]l\LastZ.south west) {\X};
  \fi
  \draw[latex-] (c\Z) |- (l\Z);
  }
\end{tikzpicture}
\end{document}

在此处输入图片描述

答案2

我提出了一个完全不同的布局,只使用\tablenotesthreeparttable颜色的结合,在我看来,它和箭头一样富有表现力:

\documentclass[11pt]{article}
\usepackage{array, threeparttable, booktabs}
\usepackage[svgnames]{xcolor}
\newcommand{\dir}{\textcolor{Goldenrod}d}
\newcommand{\syl}{\textcolor{LightSteelBlue}l}
\newcommand{\rd}{\textcolor{Salmon}r}
\newcommand{\wri}{\textcolor{Gold}w}
\newcommand{\exc}{\textcolor{YellowGreen}x}
\begin{document}

\begin{table}[!htbp]
\centering\sffamily
\begin{threeparttable}
  \caption{Table}
  \label{}
\begin{tabular}{*{4} {>{\centering\arraybackslash}p{1.2cm}}}
\toprule
type & users & group & others \\
\cmidrule(lr){1-1}\cmidrule(lr){2-2}\cmidrule(lr){3-3}\cmidrule(lr){4-4}
\dir \enspace\syl & \rd\enspace\wri\enspace\exc & \rd\enspace\wri\enspace\exc& \rd\enspace\wri\enspace\exc \\
\bottomrule
\end{tabular}
\smallskip
\begin{tablenotes}[flushleft, online]\small
\item[\dir\rlap{:}] Is a directory.
\item[\syl: ] Is a symbolic link.
\item[\rd: ] Can Read,\, Read files.
\item[\wri: ] $\!\!$Can Write,\, Create files.
\item[\exc: ] Can Execute,\, List files.
\end{tablenotes}
\end{threeparttable}
\end{table}

\end{document} 

在此处输入图片描述

相关内容