乳胶表(杂乱单元格)

乳胶表(杂乱单元格)

嗨,stackexchange 社区,

我有一些问卷调查的结果,想把它们汇总到一张表中。问题是有些单元格很混乱。有人能帮我解决这个问题吗?代码是:

\begin{table}[h]
\centering
\caption{Sample descriptive statistics}
\label{Sample descriptive statistics}
\resizebox{\textwidth}{!}{%
\def\arraystretch{1.5}
\begin{tabular}{l{4cm}p{2cm}p{2cm}p{2cm}p{2cm}p{2cm}p{2cm}}
\toprule
Current/former member of a RoSCA & {(53,9\%) Yes} & {(46,1\%) No} \\ \midrule
Number of members of joined RoSCA & \begin{tabular}[c]{@{}c@{}}\textless 5\\ (27.7 \%)\end{tabular} & \begin{tabular}[c]{@{}c@{}}6-10\\ (51.1 \%)\end{tabular} & \begin{tabular}[c]{@{}c@{}}11-15\\ (10.9 \%)\end{tabular}                               & & \begin{tabular}[c]{@{}c@{}}16-20\\ (3.6 \%)\end{tabular}  & \begin{tabular}[c]{@{}c@{}}21-25\\ (1.5\%)\end{tabular} & \begin{tabular}[c]{@{}c@{}}26 or more\\ (0.0\%)\end{tabular} \\ \midrule
Contribution's frequency & \begin{tabular}[c]{@{}c@{}}Daily\\ (3.7\%)\end{tabular} & & \begin{tabular}[c]{@{}c@{}}Weekly\\ (10.4\%)\end{tabular} & & \begin{tabular}[c]{@{}c@{}}Monthly\\ (85.7\%)\end{tabular} & & \begin{tabular}[c]{@{}c@{}}Other\\ (0.2\%)\end{tabular} \\ \midrule
Subscription amount (in MAD) & \begin{tabular}[c]{@{}c@{}}\textless 500\\ (32.6 \%)\end{tabular} & \begin{tabular}[c]{@{}c@{}}500-999\\ (24.2 \%)\end{tabular} & \begin{tabular}[c]{@{}c@{}}1000-1999\\ (28\%)\end{tabular}                              & \begin{tabular}[c]{@{}c@{}}2000-2999\\ (8.3\%)\end{tabular} & \begin{tabular}[c]{@{}c@{}}3000-3999\\ (3.8\%)\end{tabular} & \begin{tabular}[c]{@{}c@{}}4000-4999\\ (1.5 \%)\end{tabular} & \begin{tabular}[c]{@{}c@{}}5000 or more\\ (1.5\%)\end{tabular}  \\ \midrule
Joining motivations                                                           & \begin{tabular}[c]{@{}c@{}}Spontaneously\\ (35.3\%)\end{tabular} & \begin{tabular}[c]{@{}c@{}}Buy a home\\ (8.9\%)\end{tabular} & \begin{tabular}[c]{@{}c@{}}Buy durable goods\\ (22.5 \%)\end{tabular}& \begin{tabular}[c]{@{}c@{\centering}}Children education\\ (9.3\%)\end{tabular} & \begin{tabular}[c]{@{}c@{}}Vacation travel\\ (18.9)\end{tabular} & \begin{tabular}[c]{@{}c@{}}Pilgrimage\\ (2\%)\end{tabular} & \begin{tabular}[c]{@{}c@{}}Other reasons\\ (3.1)\end{tabular}   \\ \midrule
Tolerate a new proposed entrance & \multicolumn{3}{c}{(75.9\%) Yes}                                                                                                                                                                                                                                & \multicolumn{1}{l}{} & \multicolumn{3}{c}{(24.1\%) No} \\ \midrule
Order determining criteria & \begin{tabular}[c]{@{}c@{}}Drawing of lots\\ (26.2\%)\end{tabular} & \begin{tabular}[c]{@{}c@{}}Agreement of participants\\ (41.8\%)\end{tabular} &  & \begin{tabular}[c]{@{}c@{}}Social criteria (age, sexe...)\\ (6\%)\end{tabular} &  & \begin{tabular}[c]{@{}c@{}}Financial criteria\\ (21.3\%)\end{tabular} & \begin{tabular}[c]{@{}c@{}}Others\\(4.7\%)\end{tabular} \\ \midrule
Tolerate a urgent beneficiary & \multicolumn{3}{c}{(91.9\%) Yes} & \multicolumn{1}{l}{} & \multicolumn{3}{c}{(8.1\%) No} \\ \midrule
RoSCA or low interest rate bank loan ? & \multicolumn{3}{c}{\begin{tabular}[c]{@{}c@{}}RoSCA\\ (74.1\%)\end{tabular}} & \multicolumn{1}{l}{} & \multicolumn{3}{c}{\begin{tabular}[c]{@{}c@{}}Low interest rate bank loan\\ (25.9\%)\end{tabular}}                                                                                                                                           \\ \midrule
Respondents prefering RoSCA are motivated by & Administrative procedures (28.3\%) & Interest free \& no fees (47.3\%) & Religious conviction (19.1\%) & Other reasons (5.3\%) & \\ \bottomrule
\end{tabular}
}
\end{table}

我整理的表格的截图

答案1

一个快速的解决方案:将c列类型更改为C[2cm]——更好的解决方案需要一些时间。

\documentclass{article}


\usepackage{graphicx}
\usepackage{booktabs}
\usepackage{array}
\usepackage{multirow}

\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}

\begin{document}

\begin{table}[h]
\centering
\caption{Sample descriptive statistics}
\label{Sample descriptive statistics}
\resizebox{\textwidth}{!}{%
  \def\arraystretch{1.5}
\begin{tabular}{L{4cm}*{7}{p{2cm}}}
\toprule
Current/former member of a RoSCA & {(53,9\%) Yes} & {(46,1\%) No} \\ \midrule
Number of members of joined RoSCA & \begin{tabular}[c]{C{2cm}}\textless 5\\ (27.7 \%)\end{tabular} & \begin{tabular}[c]{C{2cm}}6-10\\ (51.1 \%)\end{tabular} & \begin{tabular}[c]{C{2cm}}11-15\\ (10.9 \%)\end{tabular}                               & & \begin{tabular}[c]{C{2cm}}16-20\\ (3.6 \%)\end{tabular}  & \begin{tabular}[c]{C{2cm}}21-25\\ (1.5\%)\end{tabular} & \begin{tabular}[c]{C{2cm}}26 or more\\ (0.0\%)\end{tabular} \\ \midrule
Contribution's frequency & \begin{tabular}[c]{C{2cm}}Daily\\ (3.7\%)\end{tabular} & & \begin{tabular}[c]{C{2cm}}Weekly\\ (10.4\%)\end{tabular} & & \begin{tabular}[c]{C{2cm}}Monthly\\ (85.7\%)\end{tabular} & & \begin{tabular}[c]{C{2cm}}Other\\ (0.2\%)\end{tabular} \\ \midrule
Subscription amount (in MAD) & \begin{tabular}[c]{C{2cm}}\textless 500\\ (32.6 \%)\end{tabular} & \begin{tabular}[c]{C{2cm}}500-999\\ (24.2 \%)\end{tabular} & \begin{tabular}[c]{C{2cm}}1000-1999\\ (28\%)\end{tabular}                              & \begin{tabular}[c]{C{2cm}}2000-2999\\ (8.3\%)\end{tabular} & \begin{tabular}[c]{C{2cm}}3000-3999\\ (3.8\%)\end{tabular} & \begin{tabular}[c]{C{2cm}}4000-4999\\ (1.5 \%)\end{tabular} & \begin{tabular}[c]{C{2cm}}5000 or more\\ (1.5\%)\end{tabular}  \\ \midrule
Joining motivations                                                           & \begin{tabular}[c]{C{2cm}}Spontaneously\\ (35.3\%)\end{tabular} & \begin{tabular}[c]{C{2cm}}Buy a home\\ (8.9\%)\end{tabular} & \begin{tabular}[c]{C{2cm}}Buy durable goods\\ (22.5 \%)\end{tabular}& \begin{tabular}[c]{@{}c@{\centering}}Children education\\ (9.3\%)\end{tabular} & \begin{tabular}[c]{C{2cm}}Vacation travel\\ (18.9)\end{tabular} & \begin{tabular}[c]{C{2cm}}Pilgrimage\\ (2\%)\end{tabular} & \begin{tabular}[c]{C{2cm}}Other reasons\\ (3.1)\end{tabular}   \\ \midrule
Tolerate a new proposed entrance & \multicolumn{3}{c}{(75.9\%) Yes}                                                                                                                                                                                                                                & \multicolumn{1}{l}{} & \multicolumn{3}{c}{(24.1\%) No} \\ \midrule
Order determining criteria & \begin{tabular}[c]{C{2cm}}Drawing of lots\\ (26.2\%)\end{tabular} & \begin{tabular}[c]{C{2cm}}Agreement of participants\\ (41.8\%)\end{tabular} &  & \begin{tabular}[c]{C{2cm}}Social criteria (age, sexe...)\\ (6\%)\end{tabular} &  & \begin{tabular}[c]{C{2cm}}Financial criteria\\ (21.3\%)\end{tabular} & \begin{tabular}[c]{C{2cm}}Others\\(4.7\%)\end{tabular} \\ \midrule
Tolerate a urgent beneficiary & \multicolumn{3}{c}{(91.9\%) Yes} & \multicolumn{1}{l}{} & \multicolumn{3}{c}{(8.1\%) No} \\ \midrule
RoSCA or low interest rate bank loan ? & \multicolumn{3}{c}{\begin{tabular}[c]{C{2cm}}RoSCA\\ (74.1\%)\end{tabular}} & \multicolumn{1}{l}{} & \multicolumn{3}{c}{\begin{tabular}[c]{C{2cm}}Low interest rate bank loan\\ (25.9\%)\end{tabular}}                                                                                                                                           \\ \midrule
Respondents prefering RoSCA are motivated by & Administrative procedures (28.3\%) & Interest free \& no fees (47.3\%) & Religious conviction (19.1\%) & Other reasons (5.3\%) & \\ \bottomrule
\end{tabular}
}
\end{table}

%%%%%%%%%%%%%%%%%




\end{document}

编辑改进的解决方案:其他所有事情都留给 OP

这样的表格确实容易出错!

\documentclass{article}


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

\newcommand{\permarkup}[1]{(\SI{#1}{\percent})}

\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}

\begin{document}

\begin{table}[h]
\centering
\caption{Sample descriptive statistics}
\label{Sample descriptive statistics}
\resizebox{\textwidth}{!}{%
  \def\arraystretch{1.5}
\begin{tabular}{L{4cm}*{7}{p{2cm}}}
\toprule
Current/former member of a RoSCA & {\permarkup{53,9} Yes} & {\permarkup{46,1} No} \tabularnewline \midrule
\multirow{2}{4cm}{Number of members of joined RoSCA} & \textless 5  & 6-10 & 11-15     & & 16-20  & 21-25 & 26 or more \tabularnewline
& \permarkup{ 27.7 }  &  \permarkup{51.1 } &  \permarkup{10.9 } & & \permarkup{ 3.6 } & \permarkup{ 1.5} &  \permarkup{0.0} \tabularnewline
\midrule
\multirow{2}{4cm}{Contribution's frequency} & Daily  & & Weekly  & & Monthly  & & Other \tabularnewline 
& \permarkup{ 3.7} & & \permarkup{ 10.4} & & \permarkup{ 85.7} & &  \permarkup{0.2} \tabularnewline
\midrule
\multirow{2}{4cm}{Subscription amount (in MAD)} & \textless 500 & 500-999 & 1000-1999 & 2000-2999 & 3000-3999  & 4000-4999  & 5000 or more  \tabularnewline 
& \permarkup{ 32.6 } & \permarkup{ 24.2 } & \permarkup{ 28} & \permarkup{8.3}& \permarkup{3.8} & \permarkup{1.5} & \permarkup{1.5} \tabularnewline
\midrule
\multirow{2}{4cm}{Joining motivations} & Spontaneously & Buy a home & Buy durable goods & Children education & Vacation travel & Pilgrimage & Other reasons\tabularnewline
& \permarkup{35.3} & \permarkup{8.9} & \permarkup{22.5} & \permarkup{9.3} & \permarkup{18.9} & \permarkup{2} & \permarkup{3.1} \tabularnewline
\midrule
%\multicolumn{8}{c}{} \tabularnewline
Tolerate a new proposed entrance & \multicolumn{3}{c}{\permarkup{75.9}  Yes} & \multicolumn{1}{l}{} & \multicolumn{3}{c}{\permarkup{24.1}  No} \tabularnewline

\midrule
\multirow{3}{4cm}{Order determining criteria} & Drawing of lots & \multicolumn{2}{L{4cm}}{Agreement of participants} &   \multicolumn{2}{L{4cm}}{Social criteria (age, sexe...)}   & Financial criteria & Others  \tabularnewline
& \permarkup{26.2} & \permarkup{41.8} &  & \permarkup{6} &  & \permarkup{21.3} & \permarkup{4.7}  \tabularnewline \midrule
Tolerate a urgent beneficiary & \multicolumn{3}{c}{\permarkup{91.9}  Yes} & \multicolumn{1}{l}{} & \multicolumn{3}{c}{\permarkup{8.1}  No} \tabularnewline 
\midrule
RoSCA or low interest rate bank loan ? & \multicolumn{3}{c}{RoSCA\permarkup{74.1} } & \multicolumn{1}{l}{} & \multicolumn{3}{c}{Low interest rate bank loan\permarkup{25.9}} \tabularnewline 
\midrule
\multirow{2}{4cm}{Respondents prefering RoSCA are motivated by} & \multicolumn{2}{C{4cm}}{Administrative procedures} & \multicolumn{2}{C{4cm}}{Interest free \& no fees } & \multicolumn{2}{C{4cm}}{Religious conviction}  & Other reasons   \tabularnewline
& \multicolumn{2}{C{4cm}}{\permarkup{28.3}}  & \multicolumn{2}{C{4cm}}{\permarkup{47.3}} & \multicolumn{2}{C{4cm}}{\permarkup{19.1}} & \permarkup{5.3}  \tabularnewline
\bottomrule
\end{tabular}
}
\end{table}
\end{document}

在此处输入图片描述

答案2

此建议基于makecellmultirowtabu包的使用。前两个用于在第一个表格列中组成多行单元格,包tabu简化了列宽的确定以及单元格内容的垂直放置。在所有其他单元格中,内容都直接写入,多列单元格除外:

\documentclass{article}
    \usepackage[margin=20mm]{geometry}
    \usepackage{caption}

    \usepackage{amsmath}

    \usepackage{makecell,multirow,tabu}
\newcommand\mrc[2]{\multirowcell{#1}[0pt][l]{#2}}
    \usepackage{stackengine}

    \begin{document}
%---------------------------------------------------------------%
    \footnotesize\sffamily
    \renewcommand{\arraystretch}{1.6}
    \setlength{\tabcolsep}{3pt}
    \abovetabulinesep=2mm
    \belowtabulinesep=2mm
    \tabulinestyle{0.2pt on 4pt off 1pt}
%\begin{tabu}to \textwidth{|X[1.5,l,m]|X[1,c,m]|X[3.5,l,m]|}
\begin{tabu}to \linewidth{@{}|
                 >{\bfseries}X[1.95,l,m]|
                             X[1.05,c]
                             X[1.00,c]X[1.00,c]X[1.00,c]X[1.00,c]X[1.00,c]
                             X[1.00,c]|@{}}
    \tabucline[1.5pt]{-}
Current/former member of a RoSCA
& (53,9\;\%) Yes    & (46,1\;\%) No &       &       &           &           &   \\  
    \tabucline{-}    
\mrc{2}{Number of members\\ of joined RoSCA }
& \textless 5       & 6-10          & 11-15 &       & 16-20     & 21-25     & 26 or more    \\
& (27.7\;\%)        & (51.1\;\%)    & (10.9\;\%)
                                            &       & (3.6\;\%) & (1.5\;\%)  & (0.0\%)
    \\  \tabucline{-}
\mrc{2}{Contribution's\\ frequency}
& Daily         &           & Weekly    &           & Monthly   &           & Other         \\
& (3.7\;\%)     &           & (10.4\;\%)&           & (85.7\;\%)&           & (0.2\;\%)
    \\ \tabucline{-}
\mrc{2}{Subscription\\ amount (in MAD)}
& \textless 500 & 500-999   & 1000-1999 & 2000-2999 & 3000-3999 & 4000-4999 & 5000 or more  \\
& (32.6\;\%)    & (24.2\;\%)&  (28\;\%) & (8.3\;\%) & (3.8\;\%) & (1.5\;\%) & (1.5\;\%)
    \\  \tabucline{-}
\mrc{2}{Joining motivations}
& Spontaneously & Buy a home& Buy durable goods
                                        & Children education
                                                    & Vacation travel
                                                                & Pilgrimage & Other reasons \\
& (35.3\%)      & (8.9\;\%) & (22.5\;\%)& (9.3\;\%) & (18.9\;\%)& (2\;\%)    & (3.1\;\%)
    \\ \tabucline -
Tolerate a urgent beneficiary
& \multicolumn{3}{c|}{Yes}              &(8.1\;\%) No&(91.96\;\%)&           &
    \\  \tabucline{-}
\mrc{2}{RoSCA or low interest\\ rate bank loan ?}
& \multicolumn{3}{c|}{RoSCA}
                &           & \multicolumn{3}{|c|}{Low interest rate bank loan} \\
& \multicolumn{3}{c|}{(74.16\;\%)}
                &           & \multicolumn{3}{|c|}{(25.96\;\%)}
    \\  \tabucline{-}
\mrc{1}{Respondents preferring\\ RoSCA are motivated by}
& Administrative procedures (28.36\;\%)             
                & Interest free \& no fees (47.36\;\%) 
                            & Religious conviction (19.16\;\%) 
                                        & Other reasons (5.36\;\%)
                                                    &   &   &    
    \\  \tabucline[1.5pt]{-}
    \end{tabu}
%---------------------------------------------------------------%
        \end{document}

我没有把表格放在table浮动环境中(这应该是简单的任务)。

由于您的表格很大,我缩小了字体大小\footnotesize并选择了sffamily比衬线字体稍窄的字体。

为了查看多列单元格范围,我引入了垂直阴影线。如果它们令人不安,只需将其擦除即可

在此处输入图片描述

表中缺少列标题(特定列的内容)。它们可以放在包\thead{..}中的宏中makecell

相关内容