我想要这个句子(单元格内适合 IRS 元素的数量)

我想要这个句子(单元格内适合 IRS 元素的数量)
\begin{table}
  \centering
  \renewcommand{\arraystretch}{1.5}
  \begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|}
    \hline
    \multicolumn{1}{|c|}{} &\multicolumn{11}{|c|}{Number of Users  / Number of Active Users} \\
     \cline{2-12}
  \multirow{10}{*}{\rotatebox{90}{Number of IRS Elements}}  & N = 36 & 1/2 & 2/2 & 3/2 & 4/2 & 5/2 & 6/2 & 7/2 & 8/2 & 9/2 & 10/2 \\\cline{2-12}    
  & N = 49 & 1/2 & 2/2 & 3/2 & 4/2 & 5/2 & 6/2 & 7/2 & 8/2 & 9/2 & 10/2 \\\cline{2-12}
  & N = 64 & 1/2 & 2/2 & 3/2 & 4/2 & 5/2 & 6/2 & 7/2 & 8/2 & 9/2 & 10/2 \\\cline{2-12}
  & N = 81 & 1/2 & 2/2 & 3/2 & 4/2 & 5/2 & 6/2 & 7/2 & 8/2 & 9/2 & 10/2 \\ \cline{2-12}
  & N = 100 & 1/2 & 2/2 & 3/2 & 4/2 & 5/2 & 6/2 & 7/2 & 8/2 & 9/2 & 10/2 \\ 
   \hline  
  \end{tabular}
  \caption{The new one}
  \label{table}
\end{table}

答案1

短语的大小大约等于表格高度,实际上超出了表格高度一些。

它适合\arraystretch设置为1.7

\documentclass{article}
\usepackage{multirow,rotating}

\begin{document}

\begin{table}
\centering

\renewcommand{\arraystretch}{1.7}

\begin{tabular}{|*{12}{c|}}
\hline
&\multicolumn{11}{|c|}{Number of Users  / Number of Active Users} \\
\cline{2-12}
  & N = 36 & 1/2 & 2/2 & 3/2 & 4/2 & 5/2 & 6/2 & 7/2 & 8/2 & 9/2 & 10/2 \\\cline{2-12}    
  & N = 49 & 1/2 & 2/2 & 3/2 & 4/2 & 5/2 & 6/2 & 7/2 & 8/2 & 9/2 & 10/2 \\\cline{2-12}
  & N = 64 & 1/2 & 2/2 & 3/2 & 4/2 & 5/2 & 6/2 & 7/2 & 8/2 & 9/2 & 10/2 \\\cline{2-12}
  & N = 81 & 1/2 & 2/2 & 3/2 & 4/2 & 5/2 & 6/2 & 7/2 & 8/2 & 9/2 & 10/2 \\ \cline{2-12}
\smash{\rotatebox{90}{Number of IRS Elements}}
  & N = 100 & 1/2 & 2/2 & 3/2 & 4/2 & 5/2 & 6/2 & 7/2 & 8/2 & 9/2 & 10/2 \\ 
\hline  
\end{tabular}

\caption{The new one}
\label{table}

\end{table}

\end{document}

\smash告诉 LaTeX,旋转的盒子实际上没有高度。

在此处输入图片描述

但是,我不明白该列指的是什么。

答案2

如果您不想改变垂直间距,也可以使用包\makecell中的命令来完成。makecell

\documentclass{article}

\usepackage{multirow}
\usepackage{rotating}
\usepackage{makecell}

\begin{document}
\begin{table}
  \centering
  \renewcommand{\arraystretch}{1.5}
  \begin{tabular}{|*{12}{c|}}
    \hline
    \multirow{6}{*}{\rotatebox{90}{\makecell[c]{Number of IRS\\ Elements}}}   &\multicolumn{11}{|c|}{Number of Users  / Number of Active Users} \\
     \cline{2-12}
   & N = 36 & 1/2 & 2/2 & 3/2 & 4/2 & 5/2 & 6/2 & 7/2 & 8/2 & 9/2 & 10/2 \\\cline{2-12}    
  & N = 49 & 1/2 & 2/2 & 3/2 & 4/2 & 5/2 & 6/2 & 7/2 & 8/2 & 9/2 & 10/2 \\\cline{2-12}
  & N = 64 & 1/2 & 2/2 & 3/2 & 4/2 & 5/2 & 6/2 & 7/2 & 8/2 & 9/2 & 10/2 \\\cline{2-12}
  & N = 81 & 1/2 & 2/2 & 3/2 & 4/2 & 5/2 & 6/2 & 7/2 & 8/2 & 9/2 & 10/2 \\ \cline{2-12}
  & N = 100 & 1/2 & 2/2 & 3/2 & 4/2 & 5/2 & 6/2 & 7/2 & 8/2 & 9/2 & 10/2 \\ 
   \hline  
  \end{tabular}
  \caption{The new one}
  \label{table}
\end{table}
\end{document}

桌子

根据OP的评论进行编辑:

只需使用“IRS 元素数量”作为包含“N”值的列的标题即可。此外,如果需要,您还可以使用包\thead中的命令makecell插入任何换行符。

\documentclass{article}

\usepackage{multirow}
\usepackage{rotating}
\usepackage{makecell}

\begin{document}
\begin{table}
  \centering
  \renewcommand{\arraystretch}{1.5}
  \begin{tabular}{|*{11}{c|}}
    \hline
    \thead{Number of IRS\\ Elements}   &\multicolumn{10}{|c|}{Number of Users  / Number of Active Users} \\
    \hline
    N = 36 & 1/2 & 2/2 & 3/2 & 4/2 & 5/2 & 6/2 & 7/2 & 8/2 & 9/2 & 10/2 \\\hline    
    N = 49 & 1/2 & 2/2 & 3/2 & 4/2 & 5/2 & 6/2 & 7/2 & 8/2 & 9/2 & 10/2 \\\hline
    N = 64 & 1/2 & 2/2 & 3/2 & 4/2 & 5/2 & 6/2 & 7/2 & 8/2 & 9/2 & 10/2 \\\hline
    N = 81 & 1/2 & 2/2 & 3/2 & 4/2 & 5/2 & 6/2 & 7/2 & 8/2 & 9/2 & 10/2 \\ \hline
    N = 100 & 1/2 & 2/2 & 3/2 & 4/2 & 5/2 & 6/2 & 7/2 & 8/2 & 9/2 & 10/2 \\ 
    \hline  
  \end{tabular}
  \caption{The new one}
  \label{table}
\end{table}
\end{document}

第二张桌子

编辑2:根据@leandriis 的评论进行了改进。我还在第一列做了一些更改。

\documentclass{article}

\usepackage{multirow}
\usepackage{rotating}
\usepackage{makecell}

\begin{document}
\begin{table}
  \centering
  \renewcommand{\arraystretch}{1.5}
  \setlength{\tabcolsep}{5.5pt}
  %\renewcommand{\theadfont}{\normalsize}
  
  \begin{tabular}{|*{11}{c|}}
    \hline
    \thead{Number of IRS\\ Elements, N}   &\multicolumn{10}{c|}{\thead{Number of Users  / Number of Active Users}} \\
    \hline
    36 & 1/2 & 2/2 & 3/2 & 4/2 & 5/2 & 6/2 & 7/2 & 8/2 & 9/2 & 10/2 \\\hline    
    49 & 1/2 & 2/2 & 3/2 & 4/2 & 5/2 & 6/2 & 7/2 & 8/2 & 9/2 & 10/2 \\\hline
    64 & 1/2 & 2/2 & 3/2 & 4/2 & 5/2 & 6/2 & 7/2 & 8/2 & 9/2 & 10/2 \\\hline
    81 & 1/2 & 2/2 & 3/2 & 4/2 & 5/2 & 6/2 & 7/2 & 8/2 & 9/2 & 10/2 \\ \hline
    100 & 1/2 & 2/2 & 3/2 & 4/2 & 5/2 & 6/2 & 7/2 & 8/2 & 9/2 & 10/2 \\ 
    \hline  
  \end{tabular}
  \caption{The new one}
  \label{table}
\end{table}
\end{document}

leandriis 表

答案3

以下是您可以使用 做的{NiceTabular}事情nicematrix

\documentclass{article}
\usepackage{nicematrix}

\begin{document}

\begin{table}
  \centering
  \renewcommand{\arraystretch}{1.5}
  \setlength{\tabcolsep}{5.5pt}
  \begin{NiceTabular}{*{11}{c}}[hvlines]
    \Block{}{Number of IRS\\ Elements, N}   
       &\Block{1-*}{Number of Users  / Number of Active Users} \\
    36 & 1/2 & 2/2 & 3/2 & 4/2 & 5/2 & 6/2 & 7/2 & 8/2 & 9/2 & 10/2 \\    
    49 & 1/2 & 2/2 & 3/2 & 4/2 & 5/2 & 6/2 & 7/2 & 8/2 & 9/2 & 10/2 \\
    64 & 1/2 & 2/2 & 3/2 & 4/2 & 5/2 & 6/2 & 7/2 & 8/2 & 9/2 & 10/2 \\
    81 & 1/2 & 2/2 & 3/2 & 4/2 & 5/2 & 6/2 & 7/2 & 8/2 & 9/2 & 10/2 \\ 
    100 & 1/2 & 2/2 & 3/2 & 4/2 & 5/2 & 6/2 & 7/2 & 8/2 & 9/2 & 10/2 \\ 
  \end{NiceTabular}
  \caption{The new one}
\end{table}


\begin{table}
  \centering
  \renewcommand{\arraystretch}{1.5}
  \setlength{\tabcolsep}{5.5pt}
  \begin{NiceTabular}{*{12}{c}}[hvlines]
       &\Block{1-*}{Number of Users  / Number of Active Users} \\
    \Block{*-1}<\rotate>{Number of IRS\\ Elements, N}   
    & 36 & 1/2 & 2/2 & 3/2 & 4/2 & 5/2 & 6/2 & 7/2 & 8/2 & 9/2 & 10/2 \\    
    & 49 & 1/2 & 2/2 & 3/2 & 4/2 & 5/2 & 6/2 & 7/2 & 8/2 & 9/2 & 10/2 \\
    & 64 & 1/2 & 2/2 & 3/2 & 4/2 & 5/2 & 6/2 & 7/2 & 8/2 & 9/2 & 10/2 \\
    & 81 & 1/2 & 2/2 & 3/2 & 4/2 & 5/2 & 6/2 & 7/2 & 8/2 & 9/2 & 10/2 \\ 
    & 100 & 1/2 & 2/2 & 3/2 & 4/2 & 5/2 & 6/2 & 7/2 & 8/2 & 9/2 & 10/2 \\ 
  \end{NiceTabular}
  \caption{The new one}
\end{table}


\begin{table}
  \centering
  \renewcommand{\arraystretch}{1.5}
  \setlength{\tabcolsep}{5.5pt}
  \begin{NiceTabular}{*{12}{c}}[hvlines,corners]
       &\Block{1-*}{Number of Users  / Number of Active Users} \\
    \Block{*-1}<\rotate>{Number of IRS\\ Elements, N}   
    & 36 & 1/2 & 2/2 & 3/2 & 4/2 & 5/2 & 6/2 & 7/2 & 8/2 & 9/2 & 10/2 \\    
    & 49 & 1/2 & 2/2 & 3/2 & 4/2 & 5/2 & 6/2 & 7/2 & 8/2 & 9/2 & 10/2 \\
    & 64 & 1/2 & 2/2 & 3/2 & 4/2 & 5/2 & 6/2 & 7/2 & 8/2 & 9/2 & 10/2 \\
    & 81 & 1/2 & 2/2 & 3/2 & 4/2 & 5/2 & 6/2 & 7/2 & 8/2 & 9/2 & 10/2 \\ 
    & 100 & 1/2 & 2/2 & 3/2 & 4/2 & 5/2 & 6/2 & 7/2 & 8/2 & 9/2 & 10/2 \\ 
  \end{NiceTabular}
  \caption{The new one}
\end{table}

\end{document}

您需要多次编译(因为nicematrix在后台使用 PGF/Tikz 节点)。

上述代码的输出

答案4

我建议将这个句子分成两行,如下 stackengine

\documentclass{article}
\usepackage{array, multirow}
\usepackage{rotating, graphicx} 
\usepackage[usestackEOL]{stackengine}
\usepackage{geometry}

\begin{document}

\begin{table}
\centering
\renewcommand{\arraystretch}{1.5}
\begin{tabular}{|wc{8mm}|*{11}{c|}}
\hline
\multicolumn{1}{|c}{} &\multicolumn{11}{|c|}{Number of Users / Number of Active Users} \\
 \cline{2-12}
& N = 36 & 1/2 & 2/2 & 3/2 & 4/2 & 5/2 & 6/2 & 7/2 & 8/2 & 9/2 & 10/2 \\\cline{2-12}
& N = 49 & 1/2 & 2/2 & 3/2 & 4/2 & 5/2 & 6/2 & 7/2 & 8/2 & 9/2 & 10/2 \\\cline{2-12}
& N = 64 & 1/2 & 2/2 & 3/2 & 4/2 & 5/2 & 6/2 & 7/2 & 8/2 & 9/2 & 10/2 \\\cline{2-12}
& N = 81 & 1/2 & 2/2 & 3/2 & 4/2 & 5/2 & 6/2 & 7/2 & 8/2 & 9/2 & 10/2 \\ \cline{2-12}
\multirow{-5}{*}{\rotatebox{90}{\Centerstack{Number of\\ IRS Elements}}} & N = 100 & 1/2 & 2/2 & 3/2 & 4/2 & 5/2 & 6/2 & 7/2 & 8/2 & 9/2 & 10/2 \\
\hline
\end{tabular}
\caption{The new one}
\label{table}
\end{table}

\end{document} 

在此处输入图片描述

相关内容