\documentclass{article}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{siunitx}
\begin{document}
\begin{table}
\begin{tabular}{lSSSSSS}
\toprule
\multirow{3}{0.3cm}{} &
\multicolumn{3}{c}{Baripada } &
\multicolumn{3}{c}{Jagatsinghpur} \\
\hline
& {Absolute Frequency } & {Frequency(\%)} & {Cumulative Frequency} & {Absolute Frequency} & {Frequency(\%)} & {Cumulative Frequency} \\
\midrule
Recently & 0& 0.00& 0 &6& 3.33& 6 \\
More than 5 years & 3& 1.67& 3 &47& 26.11 &53\\
Less than 10 years & 47& 26.11 &50& 14 &7.78& 67 \\
More than 10 years & 58& 32.22& 108& 20 &11.11& 87 \\
Since the party formed & 72& 40.00& 180& 93& 51.67& 180 \\\hline
Toatal& 180&100&*&180&100&*\\
\bottomrule
\end{tabular}
\end{table}
\end{document}
答案1
- 您的表格太宽,无法放入页面的文本区域
- 你有两种选择:
- 使用列标题的缩写,并将其含义写为表格下方的表格注释(因为这可以通过包轻松完成
threeparttable
) - 使文本区域更宽(通过使用包
geometry
)并将列标题写成两行(使用\thead
包中的宏makecell
)
- 使用列标题的缩写,并将其含义写为表格下方的表格注释(因为这可以通过包轻松完成
第一种情况:
\documentclass{article} \usepackage{booktabs, threeparttable} \usepackage{siunitx} %---------------- show page layout. don't use in a real document! \usepackage{showframe} \renewcommand\ShowFrameLinethickness{0.15pt} \renewcommand*\ShowFrameColor{\color{red}} %---------------------------------------------------------------% \begin{document} \begin{table} \setlength\tabcolsep{0pt} \begin{threeparttable}[htb] \caption{My table} \label{tab:mytable} \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}} l *{2}{S[table-format=3.0] S[table-format=3.2] S[table-format=3.0]} } \toprule & \multicolumn{3}{c}{Baripada} & \multicolumn{3}{c}{Jagatsinghpur} \\ \cmidrule{2-4}\cmidrule{5-7} & {AF\tnote{a}} & {F\tnote{b} (\%)} & {CF\tnote{c}} & {AF\tnote{a}} & {F\tnote{b} (\%)} & {CF\tnote{c}} \\ \midrule Recently & 0 & 0.00 & 0 & 6 & 3.33 & 6 \\ More than 5 years & 3 & 1.67 & 3 & 47 & 26.11 & 53 \\ Less than 10 years & 47 & 26.11 & 50 & 14 & 7.78 & 67 \\ More than 10 years & 58 & 32.22 & 108 & 20 & 11.11 & 87 \\ Since the party formed & 72 & 40.00 & 180 & 93 & 51.67 & 180 \\ \midrule Toatal & 180 & 100 & * & 180 & 100 & * \\ \midrule[\heavyrulewidth] \end{tabular*} \begin{tablenotes}[para,flushleft]\footnotesize \item[a] Absolute Frequency \item[b] Frequency \item[c] Cumulative Frequency \end{tablenotes} \end{threeparttable} \end{table} \end{document}
(红线表示文本边框)
第二种情况
\documentclass{article} \usepackage{geometry} \usepackage{booktabs, makecell} \renewcommand\theadfont{\normalsize} \renewcommand\theadgape{} \usepackage{siunitx} \begin{document} \begin{table} \setlength\tabcolsep{0pt} \begin{tabular*}{\linewidth}{@{\extracolsep{\fill}} l *{2}{S[table-format=3.0] S[table-format=3.2] S[table-format=3.0]} } \toprule & \multicolumn{3}{c}{Baripada} & \multicolumn{3}{c}{Jagatsinghpur} \\ \cmidrule{2-4}\cmidrule{5-7} & {\thead{Absolute\\ Frequency}} & {\thead{Frequency\\ (\%)}} & {\thead{Cumulative\\ Frequency}} & {\thead{Absolute\\ Frequency}} & {\thead{Frequency\\ (\%)}} & {\thead{Cumulative\\ Frequency}} \\ \midrule Recently & 0 & 0.00 & 0 & 6 & 3.33 & 6 \\ More than 5 years & 3 & 1.67 & 3 & 47 & 26.11 & 53 \\ Less than 10 years & 47 & 26.11 & 50 & 14 & 7.78 & 67 \\ More than 10 years & 58 & 32.22 & 108 & 20 & 11.11 & 87 \\ Since the party formed & 72 & 40.00 & 180 & 93 & 51.67 & 180 \\ \midrule Toatal & 180 & 100 & * & 180 & 100 & * \\ \bottomrule \end{tabular*} \end{table} \end{document}