\多列不工作

\多列不工作

我做错了什么?想不通!一直收到 \multispan \omit。

谢谢

\begin{center}
    \begin{tabular}{|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|c|}
        \hline
        \textbf{taxa de amostragem} & \multicolumn{4}{|c|}{\textbf{44.1k Htz}} & \multicolumn{4}{|c|}{\textbf{48k Htz}} & \multicolumn{4}{|c|}{\textbf{96k Htz}} & \multicolumn{4}{|c|}{\textbf{192k Htz}}\\
        \hline
        \small  \textbf{duração da amostra (ms)} & \small \multicolumn{4}{|c|}{0.0226} & \small \multicolumn{4}{|c|}{0.0208} & \multicolumn{4}{|c|}{0.0104} & \multicolumn{4}{|c|}{0.0052} \\
        \hline
        \small  \textbf{tamanho do bloco} & \small 128 & \small 256 & \small 512 & \small 1024 & \small 128 & \small 256 & \small 512 & \small 1024 & \small 128 & \small 256 & \small 512 & \small 1024 & \small 128 & \small 256 & \small 512 & \small 1024 \\
        \hline
        \small \textbf{duração do bloco (ms)} & \small 2.90 & \small 5.80 & \small 11.60 & \small 23.21 & \small 2.66 & \small 5.33 & \small 10.66 & \small 21.33 & \small 1.33 & \small 2.66 & \small 5.33 & \small 10.66 & \small 0.66 & \small 1.33 & \small 2.66 & \small 5.33 \\
        \hline
    \end{tabular}
\end{center}

答案1

如果它必须适合普通尺寸的纸张,我宁愿建议这种布局,并交换行和列,加载siunitx数字以对齐,并正确输入带有单位的数字:

\documentclass{article}
\usepackage{array, makecell, multirow}
\renewcommand{\theadfont}{\small\bfseries}
\usepackage{siunitx}

\begin{document}

 \begin{center}
\setlength{\extrarowheight}{2pt}
\sisetup{detect-weight, table-number-alignment=center}
 \begin{tabular}{|c|c|S[table-format=4.0]| S[table-format=2.2]|}%c|c|c|c|c|c|c|c|c|c|c|c|c|}
 \hline
 \thead{taxa de\\ amostragem} &\thead{duração da\\ amostra (ms)} & {\thead{tamanho\\ do bloco}} & {\thead{duração\\ do bloco (ms)}} \\
\hline
 \multirowthead{4} {\SI{44.1}{\kHz}} & \multirowcell{4}{ 0.0226} & 128 & 2.90 \\
 & & 256 & 5.80\\
 & & 512 & 11.60 \\
  & & 1024 & 23.21 \\
 \hline
 \multirowthead{4}{\SI{48}{\kHz}} & \multirowcell{4}{ 0.0208} & 128 & 2.66 \\
 & & 256 & 5.33 \\
 & & 512 & 10.66 \\
  & & 1024 & 21.33 \\
 \hline
 \multirowthead{4}{\SI{96}{\kHz}} & \multirowcell{4}{0.0104} & 128 & 1.33 \\
  & & 256 & 2.66 \\
   & & 512 & 5.33 \\
  & & 1024 & 10.66\\%128 & 256 & 512 & 1024 & 128 & 256 & 512 & 1024 \\
 \hline
 \multirowthead{4}{\SI{192}{\kHz}} & \multirowcell{4}{0.0052} & 128 & 0.66 \\
  & & 256 & 1.33 \\
   & & 512 & 2.66 \\
  & & 1024 & 5.33 \\%
 \hline
 \end{tabular}
 \end{center}

 \end{document}

在此处输入图片描述

答案2

如果你必须保留表格材料的 4 行/17 列布局,即如果你不能按照建议转置材料@Bernard 的回答,我建议您修改您的代码如下:

  • \small对整个表使用单个指令
  • 使用tabular*环境而不是tabular*环境
  • 不要使用垂直线,使用较少但间距适当的水平线
  • 使用\SI宏(由包提供siunitx)排版数字及其科学单位
  • 不要使用大胆的——除非你想给人留下有必要在你的读者

在此处输入图片描述

\documentclass{article}
\usepackage[letterpaper,margin=1in]{geometry} % choose paper size and margins appropriately
\usepackage{booktabs,siunitx}
\begin{document}
\begin{table}[ht!]
\setlength\tabcolsep{0pt} % make LaTeX figure out intercolumn whitespace automatically
\small
    \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} l *{16}{c} }
    \toprule
    Taxa de amostragem & 
    \multicolumn{4}{c}{\SI{44.1}{\kilo\hertz}} & 
    \multicolumn{4}{c}{\SI{48}{\kilo\hertz}} & 
    \multicolumn{4}{c}{\SI{96}{\kilo\hertz}} & 
    \multicolumn{4}{c}{\SI{192}{\kilo\hertz}}\\
    Duração da amostra (ms) & 
    \multicolumn{4}{c}{0.0226} & 
    \multicolumn{4}{c}{0.0208} & 
    \multicolumn{4}{c}{0.0104} & 
    \multicolumn{4}{c}{0.0052} \\
    \cmidrule{2-5} \cmidrule{6-9} \cmidrule{10-13} \cmidrule{14-17} 
    Tamanho do bloco & 
        128 & 256 & 512 & 1024 & 128 & 256 & 512 & 1024 & 128 & 256 & 512 & 1024 & 128 & 256 & 512 & 1024 \\
    Duração do bloco (ms) & 
        2.90 & 5.80 & 11.60 & 23.21 & 2.66 & 5.33 & 10.66 & 21.33 & 1.33 & 2.66 & 5.33 & 10.66 & 0.66 & 1.33 & 2.66 & 5.33 \\
    \bottomrule
    \end{tabular*}
\end{table}
\end{document}

相关内容