列中的圆圈突出显示

列中的圆圈突出显示

我正在尝试制作下图所示的表格。我可以制作表格,但我无法插入一些圆圈来突出显示某些列,在每个圆圈的末尾,我想放置与总和相关的向下箭头。我的代码如下:

\documentclass[12pt,a4paper]{article}
\usepackage[brazil]{babel}
\usepackage[latin1]{inputenc}
\usepackage{setspace}
\usepackage{lipsum}
\usepackage[bottom=2.5cm,top=2.5cm,left=2.5cm,right=2.5cm]{geometry}
\usepackage{array}
\usepackage{mathtools}
\usepackage{amsmath,amsfonts,amssymb,amsthm}
\usepackage{calc}
\usepackage{bm}
\usepackage{indentfirst}
\usepackage{enumitem}
\usepackage{makecell}
\usepackage{rotating}
\usepackage{dsfont}
\usepackage{comment}
\usepackage{placeins}
\usepackage{booktabs,siunitx}
\usepackage[alf]{abntex2cite}
\sisetup{%
output-decimal-marker={,},
}

\usepackage{tikz}
\usetikzlibrary{tikzmark,calc,decorations.pathreplacing}

\pagestyle{empty}
\date{}

\begin{document}

\begin{center}
\centering
\begin{table}[]
\large
\begin{tabular}{lllll}
\multicolumn{1}{c}{NOV/96}           & \multicolumn{1}{c}{DEZ/96}           
& \multicolumn{1}{c}{JAN/97}           & \multicolumn{1}{c}{FEV/97}           
& \multicolumn{1}{c}{MAR/97}           \\
1, 2, 3, ..., 30                     & 1, 2, 3, ..., 30                     
& 1, 2, 3, ..., 30                     & 1, 2, 3, ..., 30                     
& 1, 2, 3, ..., 30                     \\
\multicolumn{1}{c}{1, 2, 3, ..., 30} & \multicolumn{1}{c}{1, 2, 3, 
..., 30} & \multicolumn{1}{c}{1, 2, 3, ..., 30} & \multicolumn{1}{c}
{1, 2, 3, ..., 30} & \multicolumn{1}{c}{1, 2, 3, ..., 30} \\
1, 2, 3, ..., 30                     & 1, 2, 3, ..., 30                     
& 1, 2, 3, ..., 30                     & 1, 2, 3, ..., 30                     
& 1, 2, 3, ..., 30                     \\
1, 2, 3, ..., 30                     & 1, 2, 3, ..., 30                     
& 1, 2, 3, ..., 30                     & 1, 2, 3, ..., 30                     
& 1, 2, 3, ..., 30                     \\
1, 2, 3, ..., 30                     & 1, 2, 3, ..., 30                     
& 1, 2, 3, ..., 30                     & 1, 2, 3, ..., 30                     
& 1, 2, 3, ..., 30                     \\
1, 2, 3, ..., 30                     & 1, 2, 3, ..., 30                     
& 1, 2, 3, ..., 30                     & 1, 2, 3, ..., 30                     
& 1, 2, 3, ..., 30                     \\
1, 2, 3, ..., 30                     & 1, 2, 3, ..., 30                     
& 1, 2, 3, ..., 30                     & 1, 2, 3, ..., 30                     
& 1, 2, 3, ..., 30                     \\
1, 2, 3, ..., 30                     & 1, 2, 3, ..., 30                     
& 1, 2, 3, ..., 30                     & 1, 2, 3, ..., 30                     
& 1, 2, 3, ..., 30                     \\
1, 2, 3, ..., 30                     & 1, 2, 3, ..., 30                     
& 1, 2, 3, ..., 30                     & 1, 2, 3, ..., 30                     
& 1, 2, 3, ..., 30                     \\
1, 2, 3, ..., 30                     & 1, 2, 3, ..., 30                     
& 1, 2, 3, ..., 30                     & 1, 2, 3, ..., 30                     
& 1, 2, 3, ..., 30                     \\
1, 2, 3, ..., 30                     & 1, 2, 3, ..., 30                     
& 1, 2, 3, ..., 30                     & 1, 2, 3, ..., 30                     
& 1, 2, 3, ..., 30                     \\
1, 2, 3, ..., 30                     & 1, 2, 3, ..., 30                     
& 1, 2, 3, ..., 30                     & 1, 2, 3, ..., 30                     
& 1, 2, 3, ..., 30                     \\
1, 2, 3, ..., 30                     & 1, 2, 3, ..., 30                     
& 1, 2, 3, ..., 30                     & 1, 2, 3, ..., 30                     
& 1, 2, 3, ..., 30                     \\
1, 2, 3, ..., 30                     & 1, 2, 3, ..., 30                     
& 1, 2, 3, ..., 30                     & 1, 2, 3, ..., 30                     
& 1, 2, 3, ..., 30                     \\
1, 2, 3, ..., 30                     & 1, 2, 3, ..., 30                     
& 1, 2, 3, ..., 30                     & 1, 2, 3, ..., 30                     
& 1, 2, 3, ..., 30                     \\
1, 2, 3, ..., 30                     & 1, 2, 3, ..., 30                     
& 1, 2, 3, ..., 30                     & 1, 2, 3, ..., 30                     
& 1, 2, 3, ..., 30                     \\
1, 2, 3, ..., 30                     & 1, 2, 3, ..., 30                     
& 1, 2, 3, ..., 30                     & 1, 2, 3, ..., 30                     
& 1, 2, 3, ..., 30                     \\
1, 2, 3, ..., 30                     & 1, 2, 3, ..., 30                     
& 1, 2, 3, ..., 30                     & 1, 2, 3, ..., 30                     
& 1, 2, 3, ..., 30                     \\
                                 &                                      
&                                      &                                      
&                                      \\
                                 &                                      
&                                      &                                      
&                                     
\end{tabular}
\end{table}
\end{center}

\end{document}

enter image description here

答案1

在这个答案中,我限制自己到十一月,其余都是重复。我还建议使用\dots而不是...,但这当然取决于你。我删除了未使用的软件包和库。

\documentclass[12pt,a4paper]{article}
\usepackage[brazil]{babel}
\usepackage[latin1]{inputenc}
\usepackage[bottom=2.5cm,top=2.5cm,left=2.5cm,right=2.5cm]{geometry}

\usepackage{tikz}
\usetikzlibrary{fit}
\newcommand{\tikznode}[2]{\relax
\ifmmode%
  \tikz[remember picture,baseline=(#1.base),inner sep=0pt] \node (#1) {$#2$};
\else
  \tikz[remember picture,baseline=(#1.base),inner sep=0pt] \node (#1) {#2};%
\fi}
\pagestyle{empty}
\date{}

\begin{document}

\begin{center}
\centering
\begin{table}[]
\large
\begin{tabular}{lllll}
\multicolumn{1}{c}{NOV/96}           & \multicolumn{1}{c}{DEZ/96}           
& \multicolumn{1}{c}{JAN/97}           & \multicolumn{1}{c}{FEV/97}           
& \multicolumn{1}{c}{MAR/97}           \\
\tikznode{NOV-1-T}{1}, 2, 3, \dots, \tikznode{NOV-30-T}{30}                     & 1, 2, 3, \dots, 30                     
& 1, 2, 3, \dots, 30                     & 1, 2, 3, \dots, 30                     
& 1, 2, 3, \dots, 30                     \\
\multicolumn{1}{c}{1, 2, 3, \dots, 30} & \multicolumn{1}{c}{1, 2, 3, 
\dots, 30} & \multicolumn{1}{c}{1, 2, 3, \dots, 30} & \multicolumn{1}{c}
{1, 2, 3, \dots, 30} & \multicolumn{1}{c}{1, 2, 3, \dots, 30} \\
1, 2, 3, \dots, 30                     & 1, 2, 3, \dots, 30                     
& 1, 2, 3, \dots, 30                     & 1, 2, 3, \dots, 30                     
& 1, 2, 3, \dots, 30                     \\
1, 2, 3, \dots, 30                     & 1, 2, 3, \dots, 30                     
& 1, 2, 3, \dots, 30                     & 1, 2, 3, \dots, 30                     
& 1, 2, 3, \dots, 30                     \\
1, 2, 3, \dots, 30                     & 1, 2, 3, \dots, 30                     
& 1, 2, 3, \dots, 30                     & 1, 2, 3, \dots, 30                     
& 1, 2, 3, \dots, 30                     \\
1, 2, 3, \dots, 30                     & 1, 2, 3, \dots, 30                     
& 1, 2, 3, \dots, 30                     & 1, 2, 3, \dots, 30                     
& 1, 2, 3, \dots, 30                     \\
1, 2, 3, \dots, 30                     & 1, 2, 3, \dots, 30                     
& 1, 2, 3, \dots, 30                     & 1, 2, 3, \dots, 30                     
& 1, 2, 3, \dots, 30                     \\
1, 2, 3, \dots, 30                     & 1, 2, 3, \dots, 30                     
& 1, 2, 3, \dots, 30                     & 1, 2, 3, \dots, 30                     
& 1, 2, 3, \dots, 30                     \\
1, 2, 3, \dots, 30                     & 1, 2, 3, \dots, 30                     
& 1, 2, 3, \dots, 30                     & 1, 2, 3, \dots, 30                     
& 1, 2, 3, \dots, 30                     \\
1, 2, 3, \dots, 30                     & 1, 2, 3, \dots, 30                     
& 1, 2, 3, \dots, 30                     & 1, 2, 3, \dots, 30                     
& 1, 2, 3, \dots, 30                     \\
1, 2, 3, \dots, 30                     & 1, 2, 3, \dots, 30                     
& 1, 2, 3, \dots, 30                     & 1, 2, 3, \dots, 30                     
& 1, 2, 3, \dots, 30                     \\
1, 2, 3, \dots, 30                     & 1, 2, 3, \dots, 30                     
& 1, 2, 3, \dots, 30                     & 1, 2, 3, \dots, 30                     
& 1, 2, 3, \dots, 30                     \\
1, 2, 3, \dots, 30                     & 1, 2, 3, \dots, 30                     
& 1, 2, 3, \dots, 30                     & 1, 2, 3, \dots, 30                     
& 1, 2, 3, \dots, 30                     \\
1, 2, 3, \dots, 30                     & 1, 2, 3, \dots, 30                     
& 1, 2, 3, \dots, 30                     & 1, 2, 3, \dots, 30                     
& 1, 2, 3, \dots, 30                     \\
1, 2, 3, \dots, 30                     & 1, 2, 3, \dots, 30                     
& 1, 2, 3, \dots, 30                     & 1, 2, 3, \dots, 30                     
& 1, 2, 3, \dots, 30                     \\
1, 2, 3, \dots, 30                     & 1, 2, 3, \dots, 30                     
& 1, 2, 3, \dots, 30                     & 1, 2, 3, \dots, 30                     
& 1, 2, 3, \dots, 30                     \\
1, 2, 3, \dots, 30                     & 1, 2, 3, \dots, 30                     
& 1, 2, 3, \dots, 30                     & 1, 2, 3, \dots, 30                     
& 1, 2, 3, \dots, 30                     \\
\tikznode{NOV-1-B}{1}, 2, 3, \dots, \tikznode{NOV-30-B}{30}                     & 1, 2, 3, \dots, 30                     
& 1, 2, 3, \dots, 30                     & 1, 2, 3, \dots, 30                     
& 1, 2, 3, \dots, 30                     \\
                                 &                                      
&                                      &                                      
&                                      \\
                                 &                                      
&                                      &                                      
&                                     
\end{tabular}
\end{table}
\end{center}
\begin{tikzpicture}[overlay,remember picture]
 \node[rounded corners=2mm,draw,fit=(NOV-1-T)(NOV-1-B)] (NOV-L){};
 \node[rounded corners=2mm,draw,fit=(NOV-30-T)(NOV-30-B)] (NOV-R){};
 \draw[thick,-latex] (NOV-L.south) -- ++(0,-0.5) node[below]{$\displaystyle
 \frac{\sum d_1}{18}$};
 \draw[thick,-latex] (NOV-R.south) -- ++(0,-0.5) node[below]{$\displaystyle
 \frac{\sum d_1}{18}$};
\end{tikzpicture}
\end{document}

enter image description here

附录:让 TeX 进行重复。不得不减小字体大小,如果要恢复到原始大小,您可能需要切换到横向模式,该模式已被注释掉。

\documentclass[10pt,a4paper]{article}
\usepackage[brazil]{babel}
\usepackage[latin1]{inputenc}
\usepackage[bottom=2.5cm,top=2.5cm,left=2.5cm,right=2.5cm]{geometry}
%\usepackage{pdflscape}
\usepackage{tikz}
\usetikzlibrary{fit}
\newcommand{\tikznode}[2]{\relax
\ifmmode%
  \tikz[remember picture,baseline=(#1.base),inner sep=0pt] \node (#1) {$#2$};
\else
  \tikz[remember picture,baseline=(#1.base),inner sep=0pt] \node (#1) {#2};%
\fi}
\pagestyle{empty}
\date{}
\newcounter{it}
\setcounter{it}{0}

\begin{document}
\def\mylines{}% from https://tex.stackexchange.com/a/50299/121799
\loop\ifnum\theit<16
  \addtocounter{it}{1}
  \expandafter\def\expandafter\mylines\expandafter{%
    \mylines
     1,2,3,4,5,\dots,30 &  1,2,3,4,5,\dots,31 & 
      1,2,3,4,5,\dots,31 &  1,2,3,4,5,\dots,28 &  1,2,3,4,5,\dots,30\\
  }%
\repeat
%\begin{landscape}
\begin{center}
\centering
\begin{table}[]
\large
\begin{tabular}{lllll}
\multicolumn{1}{c}{NOV/96}           & \multicolumn{1}{c}{DEZ/96}           
& \multicolumn{1}{c}{JAN/97}           & \multicolumn{1}{c}{FEV/97}           
& \multicolumn{1}{c}{MAR/97}           \\
\tikznode{NOV-1-T}{1},2,3,4,5 \dots,\tikznode{NOV-30-T}{30}                  
& 1,\tikznode{DEZ-2-T}{2},3,4,5 \dots,\tikznode{DEZ-31-T}{31}                
& 1,2,\tikznode{JAN-3-T}{3},4,5 \dots,31               
& 1,2,3,\tikznode{FEB-4-T}{4},5 \dots,28               
& 1,2,3,4,\tikznode{MAR-5-T}{5} \dots,28 \\              
\mylines
\tikznode{NOV-1-B}{1},2,3,4,5 \dots,\tikznode{NOV-30-B}{30}                  
& 1,\tikznode{DEZ-2-B}{2},3,4,5 \dots,\tikznode{DEZ-31-B}{31}                
& 1,2,\tikznode{JAN-3-B}{3},4,5 \dots,31               
& 1,2,3,\tikznode{FEB-4-B}{4},5 \dots,28               
& 1,2,3,4,\tikznode{MAR-5-B}{5} \dots,28 \end{tabular}
\end{table}
\end{center}
\begin{tikzpicture}[overlay,remember picture]
 \foreach \X/\Y in {NOV/1,NOV/30,DEZ/2,DEZ/31,JAN/3,FEB/4,MAR/5}
 {\node[rounded corners=2mm,draw,fit=(\X-\Y-T)(\X-\Y-B)] (\X-L){};
 \draw[thick,-latex] (\X-L.south) -- ++(0,-0.5) node[below]{$\displaystyle
 \frac{\sum d_1}{18}$};
 }
\end{tikzpicture}
%\end{landscape}
\end{document}

enter image description here

相关内容