![我试过这张表,有人可以帮忙设计吗](https://linux22.com/image/432142/%E6%88%91%E8%AF%95%E8%BF%87%E8%BF%99%E5%BC%A0%E8%A1%A8%EF%BC%8C%E6%9C%89%E4%BA%BA%E5%8F%AF%E4%BB%A5%E5%B8%AE%E5%BF%99%E8%AE%BE%E8%AE%A1%E5%90%97.png)
\documentclass[]{IEEEtran}
\usepackage{lipsum} % Dummy Text
\begin{document}
\title{Title}
\maketitle
\section{A Section}
\lipsum
\begin{table*}
\caption{The Caption}
\centering
\begin{tabular}{|*{18}{c|}}
\hline
\multicolumn{2}{|c}{Instances} & \multicolumn{4}{|c|}{no protection} \multicolumn{4}{|c|}{ protection}\\ \hline
Networks & K \multicolumn{2}{|c}{ILP} & \multicolumn{2}{|c}{Greedy} & \multicolumn{2}{|c}{ILP} &
\multicolumn{2}{|c}{Greedy} \\ \hline
& & & S & T & S & T & S & T \\ \hline
NFNET & 5 10 & 3 5 & 200 400 & 300 500 & 4 8 & 600 900 & 5 8 & 921 633 & 5 4 \\ \hline
\end{tabular}
\end{table*}
\section{A Second Section}
\lipsum
\end{document}
答案1
这是起点booktabs
。我不太喜欢它,但是 a) 它可以编译,b) 我不完全清楚表格应该传达什么,因此不清楚应该将哪些单元格组合在一起。
\documentclass[]{IEEEtran}
\usepackage{lipsum} % Dummy Text
\usepackage{booktabs,multirow,multicol}
\usepackage[activate={true,nocompatibility},kerning=true,spacing=true,tracking=true,final]{microtype} %% pdflatex
\microtypecontext{spacing=nonfrench} %% just because
\begin{document}
\title{Title} \maketitle
\section{A Section} \lipsum
\begin{table*} \caption{The Caption} \centering
\begin{tabular}{*{18}{c}}
\toprule
\multicolumn{2}{c}{Instances} & \multicolumn{4}{c}{no protection} & \multicolumn{4}{c}{protection} \\
% \midrule
\multirow{2}{*}{Networks} & \multirow{2}{*}{K} & \multicolumn{2}{c}{ILP} & \multicolumn{2}{c}{Greedy} & \multicolumn{2}{c}{ILP} & \multicolumn{2}{c}{Greedy} \\
& & & S & T & S & T & S & T \\
\midrule
NFNET & 5 10 & 3 5 & 200 400 & 300 500 & 4 8 & 600 900 & 5 8 & 921 633 & 5 4 \\
\bottomrule
\end{tabular} \end{table*}
\section{A Second Section} \lipsum
\end{document}
答案2
如果您确实想按照问题中的格式格式化表格,我建议使用{NiceTabular}
。nicematrix
但是,我认为本着精神的设计booktabs
会更好。
\documentclass[]{IEEEtran}
\usepackage{nicematrix}
\begin{document}
\begin{table*}
\caption{The Caption}
\centering
\begin{NiceTabular}{*{10}{c}}[vlines,cell-space-limits=3pt]
\Hline
\Block{1-2}{Instances} && \Block{1-4}{no protection} &&&& \Block{1-4}{protection}\\ \Hline
\Block{2-1}{Networks} & \Block{2-1}{K} & \Block{1-2}{ILP} && \Block{1-2}{Greedy} && \Block{1-2}{ILP} &&
\Block{1-2}{Greedy} \\ \Hline
& & S & T & S & T & S & T & S & T \\ \Hline
\Block{2-1}{NFNET} & 5 & 3 & 200 & 300 & 4 & 600 & 5 & 921 & 5 \\[-1pt]
& 10 & 5 & 400 & 500 & 8 & 900 & 8 & 633 & 4 \\ \Hline
\end{NiceTabular}
\end{table*}
\end{document}
您需要多次编译(因为nicematrix
在后台使用 PGF/Tikz 节点)。