我正在尝试设计这张表,但它包含多列
接下来该怎么做:
\usepackage{multirow}
\begin{table}[]
\begin{tabular}{llllll}
\hline
\multicolumn{1}{|l|}{Type} & \multicolumn{1}{l|}{Dataset} & \multicolumn{1}{l|}{\#Features} & \multicolumn{1}{l|}{\#Avg. sparsity} & \multicolumn{1}{l|}{\#Nodes} & \multicolumn{1}{l|}{\# Clusters} \\ \hline
& Facebook & 1284 & 80\% & 300 & 20 \\
Social Network & Gplus & 1284 & 80\% & 300 & 20 \\
& Twitter & 1284 & 80\% & 300 & 20 \\
& Cora & 321 & 19\% & 100 & 4 \\
Citation Dataset & Citeseer & 321 & 20\% & 100 & 3 \\
& Pubmed & 321 & 20\% & 100 & 6
\end{tabular}
\end{table}
但它没有按照我想要的方式显示:
如何像该图片那样设计?我应该使用任何额外的包吗?
答案1
你可以在以下网站找到一些关于如何设计故事的基本描述:维基百科/表格. 进一步设计你的桌子也值得一看 “哪些标签是真实存在的”从两个链接中了解到,您可以设计下面的表格,其中有多列和多行单元格:
\documentclass{article}
\usepackage{geometry}
\usepackage{booktabs, multirow}
\begin{document}
\begin{table}
\centering
\begin{tabular}{c ccc ccc}
\toprule
\multirow{2}{*}{two rows}
& \multicolumn{3}{c}{3-columns cell} & \multicolumn{3}{c}{3-columns cell} \\
\cmidrule(lr){2-4} \cmidrule(lr){5-7}
& column 1 & column 2 & column 3 & column 4 & column 5 & column 6 \\
\midrule
\multirow{4}{*}{Social Network}
& item 1 & item 2 & then 3 & item 4 & item 5 & item 6 \\
& item 1 & item 2 & then 3 & item 4 & item 5 & item 6 \\
& item 1 & item 2 & then 3 & item 4 & item 5 & item 6 \\
& item 1 & item 2 & then 3 & item 4 & item 5 & item 6 \\
\addlinespace
\multirow{4}{*}{Citation Dataset}
& item 1 & item 2 & then 3 & item 4 & item 5 & item 6 \\
& item 1 & item 2 & then 3 & item 4 & item 5 & item 6 \\
& item 1 & item 2 & then 3 & item 4 & item 5 & item 6 \\
& item 1 & item 2 & then 3 & item 4 & item 5 & item 6 \\
\bottomrule
\end{tabular}
\caption{Example of professional table design}
\end{table}
\end{document}
答案2
这有帮助吗?
\documentclass{article}
\usepackage{booktabs}
\usepackage{multirow}
\begin{document}
\begin{table}
\centering
\begin{tabular}{c|ccc|ccc}
\toprule
\multirow{2}{*}{two rows} & \multicolumn{3}{|c|}{three columns} & \multicolumn{3}{|c|}{three other columns} \\
\cline{2-7}
& column 1 & column 2 & column 3 & column 4 & column 5 & column 6 \\
\midrule
\midrule
line 1 & \multicolumn{2}{c}{columns 1 and 2} & then 3 & then 4 & \multicolumn{2}{|c}{then 5 and 6 with vert bar} \\
\midrule
line 2 & \multirow{2}{*}{2 rows' cell} & lorem & ipsum & & & \\
line 3 & & lorem & ipsum & & & \\
\bottomrule
\end{tabular}
\caption{Example of what you can do...}
\end{table}
\end{document}
作为@leandriis说,
问题中的代码似乎与图像仅有松散的关系。
可能有助于更精确地实现您想要实现的目标。
答案3
这是我尝试过的并且和我想要的一样:
\begin{table*}
\centering
\begin{tabular}{c|c|c|cccccc}
\toprule
column 1 & column 2 & column 3 & column 4 & column 5 & column 6 & column 6 & column 6 \\
\toprule
\multirow{4}{*}{two rows} & column 1 & column 2 & column 3 & column 4 & column 5 & column 6 & column 6 \\
\cline{2-8}
& column 1 & column 2 & column 3 & column 4 & column 5 & column 6 & column 6 \\
\cline{2-8}
& column 1 & column 2 & column 3 & column 4 & column 5 & column 6 & column 6 \\
\cline{2-8}
& column 1 & column 2 & column 3 & column 4 & column 5 & column 6 & column 6 \\
\cline{1-8}
\multirow{2}{*}{two rows} & column 1 & column 2 & column 3 & column 4 & column 5 & column 6 & column 6 \\
\cline{2-8}
& column 1 & column 2 & column 3 & column 4 & column 5 & column 6 & column 6 \\
\cline{2-8}
& column 1 & column 2 & column 3 & column 4 & column 5 & column 6 & column 6 \\
\bottomrule
\end{tabular}
\caption{Example}
\end{table*}