我正在使用 Latex 在 Overleaf 中创建表格,但表格的尺寸太小了。虽然我的表格有 6 列,即使我试图将其放入新页面,但它的尺寸仍然太小而无法阅读。找到以下代码:
\begin{table}[!h]
\centering
\caption{Comparative Synthesis of Community Detection Metrics}
\vspace{1em}
\label{tab:community_detection_synthesis}
\resizebox{.8\paperwidth}{!}{% Resize table to fit within page width
\begin{tabular}{|l|l|c|c|c|c|}
\hline
\textbf{\LARGE{Graph Classification}} & \textbf{\LARGE{Algorithm Employed}} & \textbf{\LARGE{Mod. Measure}}& \textbf{\LARGE{Inertial Measure}} & \textbf{\LARGE{Comm. Count}} & \textbf{\LARGE{Shared Members}}\\ \hline
\LARGE{Standard Graph} & \LARGE{Louvain Algorithm \cite{r71}} & \LARGE{0.12 / 0.09} & \LARGE{0.39 / 0.22} & \LARGE{12 / 10} & \LARGE{10} \\ \hline
\LARGE{Informational Single Graph} & \LARGE{Combined Community Detection Algorithm \cite{r72}} & \LARGE{0.17 / 0.13} & \LARGE{0.82 / 0.60} & \LARGE{30 / 35} & \LARGE{32} \\ \hline
\LARGE{Composite Graph} & \LARGE{Generalized modularity optimization \cite{r73}} & \LARGE{ 0.21 / 0.18} & \LARGE{0.67 / 0.50} & \LARGE{20 / 16} & \LARGE{17} \\ \hline
\LARGE{Dynamic Composite Information Graph} & \LARGE{MCLDA} & \LARGE{0.25 / 0.21} & \LARGE{0.94 / 0.97} & \LARGE{24 / 9 }& \LARGE{4} \\ \hline
\end{tabular}
}
\end{table}
目前产量如下 在此处输入图片描述
我尝试将内容的字体大小改为大号,但仍然无法阅读,甚至尝试在其他页面上打印也无济于事。什么都不起作用。
答案1
切勿\resizebox
与表格一起使用。
您可以使用tabularx
它来自行计算列大小。我还提供了一个更简洁的版本,其中没有大部分规则(尤其是垂直规则)。
为了节省空间,我将/
空格包围的替换为\,/\,
。
还要注意,标准类是为表格下方的标题设置的,因此我使用了caption
反转偏好的包。
\documentclass{article}
\usepackage{tabularx}
\usepackage{caption}
\usepackage{booktabs}% for the second realization
\newcommand{\splitcell}[1]{\begin{tabular}{@{}c@{}}#1\end{tabular}}
\begin{document}
\begin{table}[!htp]
\centering
\caption{Comparative Synthesis of Community Detection Metrics}
\label{tab:community_detection_synthesis}
\begin{tabularx}{\textwidth}{|>{\raggedright}X|>{\raggedright}X|c|c|c|c|}
\hline
\multicolumn{1}{|c|}{\splitcell{Graph \\ Classification}} &
\splitcell{Algorithm \\ Employed} &
\splitcell{Mod. \\ Measure} &
\splitcell{Inertial \\ Measure} &
\splitcell{Comm. \\ Count} &
\splitcell{Shared \\ Members} \\
\hline
Standard Graph & Louvain Algorithm \cite{r71}
& 0.12\,/\,0.09 & 0.39\,/\,0.22 & 12\,/\,10 & 10 \\
\hline
Informational Single Graph & Combined Community Detection Algorithm \cite{r72}
& 0.17\,/\,0.13 & 0.82\,/\,0.60 & 30\,/\,35 & 32 \\
\hline
Composite Graph & Generalized modularity optimization \cite{r73}
& 0.21\,/\,0.18 & 0.67\,/\,0.50 & 20\,/\,16 & 17 \\
\hline
Dynamic Composite Information Graph & MCLDA
& 0.25\,/\,0.21 & 0.94\,/\,0.97 & 24\,/\,9 & 4 \\
\hline
\end{tabularx}
\end{table}
\begin{table}[!htp]
\centering
\caption{Comparative Synthesis of Community Detection Metrics}
\label{tab:community_detection_synthesis_second_version}
\begin{tabularx}{\textwidth}{>{\raggedright}X>{\raggedright}Xcccc}
\toprule
\multicolumn{1}{c}{\splitcell{Graph \\ Classification}} &
\splitcell{Algorithm \\ Employed} &
\splitcell{Mod. \\ Measure} &
\splitcell{Inertial \\ Measure} &
\splitcell{Comm. \\ Count} &
\splitcell{Shared \\ Members} \\
\midrule
Standard Graph & Louvain Algorithm \cite{r71}
& 0.12\,/\,0.09 & 0.39\,/\,0.22 & 12\,/\,10 & 10 \\
\addlinespace
Informational Single Graph & Combined Community Detection Algorithm \cite{r72}
& 0.17\,/\,0.13 & 0.82\,/\,0.60 & 30\,/\,35 & 32 \\
\addlinespace
Composite Graph & Generalized modularity optimization \cite{r73}
& 0.21\,/\,0.18 & 0.67\,/\,0.50 & 20\,/\,16 & 17 \\
\addlinespace
Dynamic Composite Information Graph & MCLDA
& 0.25\,/\,0.21 & 0.94\,/\,0.97 & 24\,/\,9 & 4 \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}
您可能还想尝试\small
在之后添加的效果\centering
。
答案2
如果您应用于\resizebox
表格,则无法获得一致的字体大小。此外,大小命令不接受参数,因此\LARGE XXX
您\LARGE{XXX}
不希望在表格中使用大小命令。
这可能更接近可用,尽管我会删除水平和垂直规则(参见booktabs
包)
\documentclass[a4paper]{article}
\usepackage{array}
\begin{document}
\begin{table}[!h]
\centering
\caption{Comparative Synthesis of Community Detection Metrics}
\vspace{1em}
\label{tab:community_detection_synthesis}
\newcommand\hd[1]{\textbf{\begin{tabular}{@{}c@{}}#1\end{tabular}}}
\newcommand\citer{????}
\setlength\tabcolsep{3pt}
\small
\begin{tabular}{
@{}
|>{\raggedright}p{2.9cm}|
>{\raggedright}p{2.1cm}|
c|c|c|c|
@{}}
\hline
\hd{Graph\\ Classification} &
\hd{Algorithm\\ Employed} &
\hd{Mod.\\ Measure}& \hd{Inertial\\ Measure} &
\hd{Comm.\\ Count} & \hd{Shared\\ Members}\\ \hline
Standard Graph & Louvain Algorithm \citer71 & 0.12 / 0.09 & 0.39 / 0.22 & 12 / 10 & 10 \\ \hline
Informational Single Graph & Combined Community Detection Algorithm \citer72 & 0.17 / 0.13 & 0.82 / 0.60 & 30 / 35 & 32 \\ \hline
Composite Graph & Generalized modularity optimization \citer73 & 0.21 / 0.18 & 0.67 / 0.50 & 20 / 16 & 17 \\ \hline
Dynamic Composite Information Graph & MCLDA & 0.25 / 0.21 & 0.94 / 0.97 & 24 / 9 & 4 \\ \hline
\end{tabular}
\end{table}
\end{document}