有人知道如何在这样的表格中添加箭头和侧注吗?我花了三天时间,但仍然在努力:(:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{array}
\usepackage{multirow}
\usepackage[table]{xcolor}
\usepackage{tcolorbox}
\usepackage{tikz}
\usepackage{colortbl}
\def\boxit#1{%
\smash{\color{red}\fboxrule=1pt\relax\fboxsep=2pt\relax%
\llap{\rlap{\fbox{\vphantom{0}\makebox[#1]{}}}~}}\ignorespaces
}
\definecolor{Gray}{gray}{0.9}
\newcolumntype{g}{>{\columncolor{Gray}}c}
\title{Meow \_ Meow}
\author{user1}
\date{May 2022}
\begin{document}
\maketitle
\section{Tabelle 1}
\begin{table}[ht!]
\begin{tabular}{ c c|| c g c c c c c c c c c |c c }
& & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & & b/a\\
& & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & & \\
\hline\hline
1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1\\
1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1\\\rowcolor{Gray}
1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1\\
1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1\\
1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & \textcolor{red}{1}\\
\hline
& & \boxit{0.1in} 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & & \\
\end{tabular}
\caption{\label{tab:table-name}Your caption.}
\end{table}
\end{document}
我只实现了这个简单的表格:
非常感谢!
答案1
我只是尝试编写一个命令来在文档内容上绘制一些东西。基本上在这个命令中,第二个参数 #2 是您将放入节点的内容tikz
。第一个参数 #1 是使用 tikz 代码进行的一些额外绘制。在您的情况下,整个tabular
环境将放入tikz
节点。并且您path
在第一个参数中使用一些命令来绘制箭头和注释。
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{array}
\usepackage{multirow}
\usepackage[table]{xcolor}
\usepackage{tcolorbox}
\usepackage{tikz}
\usepackage{colortbl}
\def\boxit#1{%
\smash{\color{red}\fboxrule=1pt\relax\fboxsep=2pt\relax%
\llap{\rlap{\fbox{\vphantom{0}\makebox[#1]{}}}~}}\ignorespaces
}
\definecolor{Gray}{gray}{0.9}
\newcolumntype{g}{>{\columncolor{Gray}}c}
\title{Meow \_ Meow}
\author{user1}
\date{May 2022}
\newcommand{\addstuff}[2]{\tikz[remember picture]{
\node[inner sep=0pt](current content){#2};
#1
}}
\begin{document}
\maketitle
\section{Tabelle 1}
\begin{table}[ht!]
\centering
\addstuff{
\draw [<-] ([xshift=-2.52cm]current content.north) -- ++(0,1.5) node [anchor=south] {note 1};
\draw [<-] ([yshift=1.5cm]current content.south west) -- ++(-1.5,0) node [anchor=east] {note 2};
}{
\begin{tabular}{ c c|| c g c c c c c c c c c |c c }
& & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & & b/a\\
& & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & & \\
\hline\hline
1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1\\
1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1\\\rowcolor{Gray}
1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1\\
1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1\\
1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & \textcolor{red}{1}\\
\hline
& & \boxit{0.1in} 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & 1 & & \\
\end{tabular}}
\caption{\label{tab:table-name}Your caption.}
\end{table}
\end{document}