如何将这样的表格中的多列合并为一列?

如何将这样的表格中的多列合并为一列?

我如何编辑此表以拥有一列,例如,假设我有此表:

\documentclass[10pt,letterpaper]{article}

\usepackage{booktabs}
\usepackage{siunitx}
\newcommand{\cenMultlCell}[2][c]{\begin{tabular}[#1]{@{}l@{}}#2\end{tabular}}
\usepackage[colorlinks=true, linkcolor=black]{hyperref}
\newcommand{\tabitem}{~~\llap{\textbullet}~~}




\begin{document}



\begin{table}
    \footnotesize\centering % needed, as table is to wide
    \begin{tabular}{lS[table-format=2.2]SS} % supposing that you want to put numbers in the emty cells
        \toprule
        something & \multicolumn{3}{c}{aproach} \\\cmidrule(l){2-4}
        something  &{one} & {two} & {three} \\\midrule


        \textbullet~bullet one 
        %dummy
        %& {\cenMultlCell{text1:~33.68\\ text2:~33.92\\ text3:~34.31\\ text4:~33.68\\ text4:~34.19\\ text5:~66.31\\ text6:~33.68\\  text3:~21.53}}
        %RBF
        & {\cenMultlCell{text1:46.96\\ text2:~30.02\\ text3:~45.22\\ text4:~46.96\\ text4:~22.06\\ text5:~53.03\\ text6:~46.96\\  text3:~10.50}} 
        %polinomial
        & {\cenMultlCell{44.63\\27.55\\ 46.37\\44.37\\ 19.92\\ 55.36\\ 44.63\\  10.03}}
        %Lineal
        & {\cenMultlCell{82.86\\ 80.83\\ 84.31\\ 82.86\\85.56\\17.13\\82.86\\78.22}}
\\\midrule

            %RBF
        \cenMultlCell{\textbullet~bullet one \\ \textbullet~bullet two \\}
        & {\cenMultlCell{text1:47.08\\ text2:30.14\\ text3:45.17\\ text4:~47.86\\ text4:~22.17\\ text5:~52.91\\ text6:~47.08\\  text3:~10.53}} 
        %polinomial
        & {\cenMultlCell{44.87\\ 27.79\\ 46.26\\ 44.87\\ 20.13\\ 55.12\\ 44.87\\ 10.08}}
        %lineal
        & {\cenMultlCell{92.65\\ 92.44\\ 91.60\\ 92.44\\93.08\\ 0.73\\ 92.65\\  92.85}}
\\\midrule

        \cenMultlCell{\textbullet~bullet one \\ \textbullet~bullet two \\ \textbullet~bullet Three\\}
        & 
        %rbf
        {\cenMultlCell{text1:~45.68\\ text2:~28.65\\ text3:~45.86\\ text4:~45.86\\ text4:~20.87\\ text5:~54.31\\ text6:~45.68\\  text3:~10.25}} 
        %polinomial
        & {\cenMultlCell{45.10\\ 28.04\\ 46.14\\ 45.10\\20.34\\ 54.89\\ 45.10\\  10.13}}
        %lineal
        & {\cenMultlCell{65.03\\ 59.28\\ 64.08\\ 65.03\\72.38\\ 34.96\\ 65.03\\ 46.55}}
\\\midrule


        \cenMultlCell{\textbullet~bullet one \\ \textbullet~bullet two \\ \textbullet~bullet Three\\ \textbullet~bullet four\\}
        %rbf
        & {\cenMultlCell{text1:~44.63\\ text2:~27.55\\ text3:~46.37\\ text4:~44.63\\ text4:~19.92\\ text5:~55.36\\ text6:~44.63\\  text3:~10.03}} 
        %polinomial
        & {\cenMultlCell{47.55\\ 30.64\\ 44.94\\ 47.55\\ 22.61\\ 52.44\\ 47.55\\  10.62}}
        %lineal
        & {\cenMultlCell{93.12\\ 92.99\\ 94.36\\ 93.12\\ 93.12\\ 0.06\\93.12\\ 94.07}}
\\\midrule

        %Total: & 909 & 2323& 32332& \\ \bottomrule
\end{tabular}

\caption{your caption}\label{tab:label}
\end{table}





A reference to \autoref{tab:label}.
\end{document}

我只想留下其中一句话:

text1:
text2:
text3:
text4:
text4:
text5:
text6:
text3:

因此期望的输出是:

我想要获得一个新的列,它是第一个text1text8和这个空间:

---------------------|


                       one    two   three
              text1:  number number number  
              text2:  number number number  
              text3:  number number number  
bullet one    text4:  number number number  
              text5:  number number number  
              text6:  number number number  
              text7:  number number number  
              text8:  number number number 

              text1:  number number number  
              text2:  number number number  
bullet one    text3:  number number number  
bullet two    text4:  number number number  
              text5:  number number number  
              text6:  number number number  
              text7:  number number number  
              text8:  number number number 

              text1:  number number number  
              text2:  number number number  
bullet one    text3:  number number number  
bullet two    text4:  number number number  
nullet three  text5:  number number number  
              text6:  number number number  
              text7:  number number number  
              text8:  number number number 

              text1:  number number number  
              text2:  number number number  
              text3:  number number number  
bullet one    text4:  number number number  
bullet two    text5:  number number number  
bullet three  text6:  number number number  
bullet four   text7:  number number number  
              text8:  number number number 

到目前为止,我尝试给它一个空间,~但它不起作用,不知道如何处理或修改上面的表格以获得这个新列?提前谢谢大家!

更新:

我尝试了@DoubleYou 方法并得到了以下结果:

在此处输入图片描述

有办法修复吗?谢谢大家的支持

答案1

为什么不将简单的tabular(或longtable) 与 一起使用multirow?以下结果与您概述的示例相同(同时使用了 longtable 和 tabular,您可以选择所需的任何一种)。可以轻松添加任何空行或其他表格格式。

\documentclass[10pt,letterpaper]{article}

\usepackage{longtable}
\usepackage{multirow}

\begin{document}

\begin{longtable}{lllll}
    \caption{A table with a lot of numbers.}\label{tbl:numbers1} \\
    \hline
    && one & two & three \\
    \multirow{8}{*}{bullet one} & text1: & number & number & number \\
                                                            & text2: & number & number & number \\
                                                            & text3: & number & number & number \\
                                                            & text4: & number & number & number \\
                                                            & text5: & number & number & number \\
                                                            & text6: & number & number & number \\
                                                            & text7: & number & number & number \\
                                                            & text8: & number & number & number \\
    \hline
    \multirow{8}{*}{\parbox{2cm}{bullet one \\ bullet two}} & text1: & number & number & number \\
                                                            & text2: & number & number & number \\
                                                            & text3: & number & number & number \\
                                                            & text4: & number & number & number \\
                                                            & text5: & number & number & number \\
                                                            & text6: & number & number & number \\
                                                            & text7: & number & number & number \\
                                                            & text8: & number & number & number \\
    \hline \endhead
    \hline \endfoot
    \hline \endlastfoot
\end{longtable}

\begin{table}
\begin{tabular}{lllll}
    \hline
    && one & two & three \\
    \multirow{8}{*}{bullet one} & text1: & number & number & number \\
                                                            & text2: & number & number & number \\
                                                            & text3: & number & number & number \\
                                                            & text4: & number & number & number \\
                                                            & text5: & number & number & number \\
                                                            & text6: & number & number & number \\
                                                            & text7: & number & number & number \\
                                                            & text8: & number & number & number \\
    \hline
    \multirow{8}{*}{\parbox{2cm}{bullet one \\ bullet two}} & text1: & number & number & number \\
                                                            & text2: & number & number & number \\
                                                            & text3: & number & number & number \\
                                                            & text4: & number & number & number \\
                                                            & text5: & number & number & number \\
                                                            & text6: & number & number & number \\
                                                            & text7: & number & number & number \\
                                                            & text8: & number & number & number \\
    \hline
    \end{tabular}
    \caption{A table with a lot of numbers.}\label{tbl:numbers2}
\end{table}

\end{document}

相关内容