如何更改此表以使其适合可用的文本块?

如何更改此表以使其适合可用的文本块?

我正在尝试插入一个表格。如果我通过 缩放表格\resizbox,字形会因为太小而无法读取。我该如何调整它以便内容易于读取?

\begin{table}[]
\small\addtolength{\tabcolsep}{-4pt}
\caption{Number of Projects in each Rank}
\label{my-label}
\resizebox{\columnwidth}{!}{%
\begin{tabular}{lllllllll}
 & \multicolumn{2}{l}{{\bf 2012-13}} & \multicolumn{2}{l}{{\bf 2013-14}} & \multicolumn{2}{l}{{\bf 2014-15}} & \multicolumn{2}{l}{{\bf Cumulative}} \\
{\bf Ranking Criteria} & Allocations  (Rs. Million) & No. of Projects & Allocations  (Rs. Million) & No. of Projects & Allocations         (Rs. Million) & No. of Projects & Allocations       (Rs. Million) & No. of Projects \\
{\bf 1} & 422 & 15 & 1317 & 24 & 1941 & 9 & 3680 & 48 \\
{\bf 2} & 2237 & 28 & 1348 & 37 & 5271 & 18 & 8856 & 83 \\
{\bf 3} & 1010 & 7 & 1393 & 22 & 2666 & 23 & 5069 & 52 \\
{\bf 4} & 1215 & 2 & 386 & 2 & 110.46 & 2 & 1711 & 6
\end{tabular}
}
\end{table}

答案1

我建议你

  • 使用环境(例如tabularx)及其关联的X列类型代替基本tabular环境。这样,您就可以获得自动换行

  • 修改基本X列类型以采用右对齐排版,同时允许使用连字符

  • 根据需要插入\hspace{0pt}指令,以允许在每个单元格中对第一个单词进行连字符连接(补充:如果您使用 LuaLaTeX 编译文档,则此措施不是必需的)

  • 使用包的线条绘制命令booktabs来直观地组织表格标题中的材料。

在此处输入图片描述

\documentclass{article}
\usepackage{tabularx,ragged2e,caption,booktabs}
\newcolumntype{L}{>{\RaggedRight\arraybackslash}X}
\begin{document}
\begin{table}
\small
\addtolength{\tabcolsep}{-3pt}
\caption{Number of projects in each rank} \label{my-label}
\begin{tabularx}{\textwidth}{*{9}{L}}
\toprule
 & \multicolumn{2}{c}{\textbf{2012--13}}
 & \multicolumn{2}{c}{\textbf{2013--14}}
 & \multicolumn{2}{c}{\textbf{2014--15}}
 & \multicolumn{2}{c}{\textbf{Cumulative}} \\
 \cmidrule(r){2-3} \cmidrule(r){4-5} \cmidrule(r){6-7} \cmidrule{8-9} 
\textbf{\hspace{0pt}Ranking Criteria}
& \hspace{0pt}Allocations  (Rs.\ Million) & No.\ of Projects 
& \hspace{0pt}Allocations  (Rs.\ Million) & No.\ of Projects 
& \hspace{0pt}Allocations  (Rs.\ Million) & No.\ of Projects 
& \hspace{0pt}Allocations  (Rs.\ Million) & No.\ of Projects \\
\midrule
\textbf{1} & 422 & 15 & 1317 & 24 & 1941 & 9 & 3680 & 48 \\
\textbf{2} & 2237 & 28 & 1348 & 37 & 5271 & 18 & 8856 & 83 \\
\textbf{3} & 1010 & 7 & 1393 & 22 & 2666 & 23 & 5069 & 52 \\
\textbf{4} & 1215 & 2 & 386 & 2 & 110.46 & 2 & 1711 & 6\\
\bottomrule
\end{tabularx}
\end{table}
\end{document} 

答案2

我认为,比起调整大小来适应大标题,更好的办法是在表格底部添加图例。

\documentclass{article}
\usepackage{booktabs,siunitx,caption}

\begin{document}

\begin{table}[htp]
\centering

\caption{Number of Projects in each Rank}
\label{my-label}

\begin{tabular}{
 l
 S[table-format=4.0]S[table-format=2.0]
 S[table-format=4.0]S[table-format=2.0]
 S[table-format=4.2]S[table-format=2.0]
 S[table-format=4.0]S[table-format=2.0]
}
\toprule
{\bfseries RC}
 & \multicolumn{2}{c}{\bfseries 2012-13}
 & \multicolumn{2}{c}{\bfseries 2013-14}
 & \multicolumn{2}{c}{\bfseries 2014-15}
 & \multicolumn{2}{c}{\bfseries Cumulative}
\\
\cmidrule(lr){2-3}
\cmidrule(lr){4-5}
\cmidrule(lr){6-7}
\cmidrule(lr){8-9}
 & {A} & {NP} & {A} & {NP} & {A} & {NP} & {A} & {NP}
\\
\midrule
\textbf{1} &  422 & 15 & 1317 & 24 & 1941    &  9 & 3680 & 48 \\
\textbf{2} & 2237 & 28 & 1348 & 37 & 5271    & 18 & 8856 & 83 \\
\textbf{3} & 1010 &  7 & 1393 & 22 & 2666    & 23 & 5069 & 52 \\
\textbf{4} & 1215 &  2 &  386 &  2 &  110.46 &  2 & 1711 &  6 \\
\midrule[\heavyrulewidth]
\multicolumn{9}{@{}l@{}}{\small RC stands for ``Ranking Criteria''} \\
\multicolumn{9}{@{}l@{}}{\small A stands for ``Allocations (Rs.\ Million)''} \\
\multicolumn{9}{@{}l@{}}{\small NP stands for ``Number of Projects''}
\end{tabular}

\end{table}

\end{document}

在此处输入图片描述

相关内容