表格中如何表示列名和行名?

表格中如何表示列名和行名?

如何像这样表示列和行?

在此处输入图片描述

这是我的代码,但我无法复制图片中的表格。

\begin{table}[ht]
    \large


\centering
\begin{tabular}{|c ||c | c |c |c | c | c |c | c | c |}
    \hline

%\multicolumn{}{c}{Area Range} & \\
%\cline{1-9}
    \parbox[t]{3mm} %{\multirow{8}{*}{\rotatebox[origin=c]{90}{\bf\underline{~No.of tasks}}}} 
      & \bf 0 & \bf 1 & \bf 2 & \bf 3 & \bf 4 &\bf 5 & \bf 6 &\bf 7  \\[1 ex] \hline
      \bf 0 & 0 &  0 &  0 &  0 & 0 & 0 & 0 & 0 \\ [1ex] \hline
     \bf 1 & 0 &  1 &  1 &  1 & 1 & 1 & 1 & 1\\ [1ex] \hline
    \bf 2 & 0 &  1 &  1 &  4 & 5 & 5 & 5 & 5 \\ [1ex] \hline
     \bf3 & 0 &  1 &  1 &  4 & 5 & 6 & 6 & 9 \\ [1ex] \hline
     \bf 4 & 0 &  1 &  1 &  4 & 5 & 7& 8 & \bf 9 \\ [1 ex] \hline
    \hline 
\end{tabular}

\end{table} 

答案1

\overbrace数学模式下,您可以添加带有一些文本或数学符号的大括号。

\documentclass{article}
\usepackage{graphicx,amsmath}
\usepackage{multirow,array}
\begin{document}

\begin{table}[ht]
  \large  
  \centering 
  \renewcommand{\arraystretch}{1.5}
  \begin{tabular}{c|c||*{8}{c|}}
    \multicolumn{2}{c}{} & \multicolumn{8}{@{}c}{$\overbrace{\rule{12.5em}{0pt}}^{J}$} \\
\cline{2-10}
&& \bfseries 0 & \bfseries 1 & \bfseries 2 & \bfseries 3 & \bfseries 4 &\bfseries 5 & \bfseries 6 &\bfseries 7  \\
\cline{2-10}
\multirow{5}*{\rotatebox{90}{$\overbrace{\rule{8.8em}{0pt}}^{I}$}}
&    \bfseries 0 & 0 &  0 &  0 &  0 & 0 & 0 & 0 & 0 \\ 
    \cline{2-10}
&    \bfseries 1 & 0 &  1 &  1 &  1 & 1 & 1 & 1 & 1 \\
    \cline{2-10}
&    \bfseries 2 & 0 &  1 &  1 &  4 & 5 & 5 & 5 & 5 \\ 
    \cline{2-10}
&    \bfseries 3 & 0 &  1 &  1 &  4 & 5 & 6 & 6 & 9 \\ 
    \cline{2-10}
&    \bfseries 4 & 0 &  1 &  1 &  4 & 5 & 7& 8 & \bfseries 9 \\ 
    \cline{2-10}
  \end{tabular}
\end{table} 
\end{document}

在此处输入图片描述

答案2

\documentclass{article}

\usepackage{graphicx}
\usepackage{multirow}
\begin{document}



\begin{table}[ht]
  \large
  \centering
  \begin{tabular}{c|c||*{8}{c|}}
    \multicolumn{2}{c}{} & \multicolumn{8}{c}{Area Range} \tabularnewline
    \cline{2-10}
    \multirow{9}*{\rotatebox{90}{No. of tasks}} &
&    \bfseries 0 & \bfseries 1 & \bfseries 2 & \bfseries 3 & \bfseries 4 &\bfseries 5 & \bfseries 6 &\bfseries 7  \tabularnewline[1 ex] 
\cline{2-10}
&    \bfseries 0 & 0 &  0 &  0 &  0 & 0 & 0 & 0 & 0 \tabularnewline [1ex] 
    \cline{2-10}
&    \bfseries 1 & 0 &  1 &  1 &  1 & 1 & 1 & 1 & 1\tabularnewline [1ex] 
    \cline{2-10}
&    \bfseries 2 & 0 &  1 &  1 &  4 & 5 & 5 & 5 & 5 \tabularnewline [1ex] 
    \cline{2-10}
&    \bfseries 3 & 0 &  1 &  1 &  4 & 5 & 6 & 6 & 9 \tabularnewline [1ex] 
    \cline{2-10}
&    \bfseries 4 & 0 &  1 &  1 &  4 & 5 & 7& 8 & \bfseries 9 \tabularnewline [1 ex]
    \cline{2-10}
  \end{tabular}
\end{table} 
\end{document}

在此处输入图片描述

相关内容