表格中有多行和多列

表格中有多行和多列

你能帮我画一下这个表格吗:

穆特

这是一个 MWE,看起来一点也不相似,但它是一个起点。我会做\begin{tabular}{*{11}{c}}

\documentclass{article}
\usepackage{multirow}
\usepackage{amsmath}
\usepackage{setspace}
\usepackage{booktabs} % provides \toprule, \bottomrule,\midrule, \cmidrule
\begin{document}

\begin{table}
        \small

        \begin{tabular}{*{8}{c}}
            \toprule
            &  &  &   & \multicolumn{2}{c}{\textbf{ML}}
            & \multicolumn{2}{c}{\textbf{ML}}  \\
            \cmidrule(lr){5-6} \cmidrule(lr){7-8}
            $\lambda$   & $\gamma$  & $n$& $L$ &  RMSE    &  MAE      & RMSE  & MAE \\
            \midrule
            0.01        & 0.006  & 30 & 1       & 0.9133    &    \textbf{0.9401}    &       &   \\
            0.01        & 0.002  & 50 & 2      &           & &0.8973       &  \textbf{0.9080} \\
            \bottomrule
        \end{tabular}


    \end{table}

\end{document}


\documentclass{article}
\usepackage{multirow}
\usepackage{amsmath}
\usepackage{setspace}
\usepackage{booktabs} % provides \toprule, \bottomrule,\midrule, \cmidrule
\begin{document}

\begin{table}
        \small

        \begin{tabular}{*{8}{c}}
            \toprule
            &  &  &   & \multicolumn{2}{c}{\textbf{ML}}
            & \multicolumn{2}{c}{\textbf{ML}}  \\
            \cmidrule(lr){5-6} \cmidrule(lr){7-8}
            $\lambda$   & $\gamma$  & $n$& $L$ &  RMSE    &  MAE      & RMSE  & MAE \\
            \midrule
            0.01        & 0.006  & 30 & 1       & 0.9133    &    \textbf{0.9401}    &       &   \\
            0.01        & 0.002  & 50 & 2      &           & &0.8973       &  \textbf{0.9080} \\
            \bottomrule
        \end{tabular}


    \end{table}

\end{document}

在此处输入图片描述

第二部分:

\documentclass{article}
\usepackage{multirow}

\begin{document}

\begin{table}[htbp]
\centering
\begin{tabular}{|c|c|c|c|p{1cm}p{1cm}p{1cm}p{1cm}p{1cm}p{1cm}p{1cm}|}
\hline
A & B & C & D & \multicolumn{7}{|c|}{F}  \\ \hline
\multirow{ 2}{*}{1} & 0 & 6 & 230 & 35 & 40 & 55 & 25 & 40 & 35 & \\
& 1 & 5 & 195 & 25 & 50 & 35 & 40 & 45 &  &  \\ \hline
\end{tabular}
\caption{A test caption}
\label{table2}
\end{table}

\end{document}

答案1

以下是该表格的重新制作。有些列有所不同,但在我看来,这样效果更好(不过,第二个“详细信息”列也许可以以不同的方式对齐)。

\documentclass[border=3.14]{standalone}

\usepackage{siunitx}
\usepackage{booktabs}
\usepackage{array}
\usepackage{multirow}

\newcolumntype\math[1]{>{$}#1<{$}}

\begin{document}
\begin{tabular}
  {
    ll \math{r}@{${}={}$} S[table-format=4]
    S[table-format=1.2] *4{S[table-format=2]} *2{S[table-format=.3]}
    S[table-format=2]@{\,}l
  }
  \toprule
  Algorithm & Details & \multicolumn{2}{c}{}
    & {RMSE} & {Cov} & {Prec} & {Rec} & {F}
    & {Surp\textsuperscript{max}}
    & {Surp\textsuperscript{avg}}
    & \multicolumn{2}{c}{Time}
  \\
  \midrule
  \multirow{4}{*}{Parall} & \multirow{2}{*}{Sample} & n&100
    & 1.18 & 57 & 95 & 68 & 79 & .419 & .166
    & 10&m
  \\
  & & n&1000
    & 1.04 & 23 & 95 & 27 & 42 & .418 & .168
    & 1&h
  \\
  & \multirow{2}{*}{$k$-NN} & k&20
    & 1.00 & 31 & 97 & 38 & 54 & .421 & .176
    & 6&h
  \\
  & & k&30
    & 0.99 & 25 & 96 & 31 & 47 & .422 & .177
    & 19&h
  \\
  \cmidrule{1-4}
  & MSD & k&40
    & 0.98 & 23 & 96 & 28 & 43 & .423 & .175
    & 30&s
  \\
  $k$-NN & Cos & k&40
    & 1.02 & 21 & 96 & 26 & 41 & .426 & .180
    & 30&s
  \\
  & Pears & k&40
    & 1.01 & 25 & 95 & 30 & 46 & .425 & .170
    & 30&s
  \\
  \cmidrule{1-4}
  PMF & & f&100
    & 0.95 & 38 & 99 & 47 & 64 & .422 & .178
    & 45&s
  \\
  Mean & & \multicolumn{2}{c}{}
    & 1.13 & \multicolumn{6}{c}{}
    & 1&s
  \\
  Random & & \multicolumn{2}{c}{}
    & 1.52 & 81 & 86 & 89 & 88 & .432 & .155
    & 1&s
  \\
  \bottomrule
\end{tabular}
\end{document}

在此处输入图片描述

相关内容