您好,我想在 Latex 中绘制这张表格,但由于我是新手,尝试了几个小时却无法正确绘制。
答案1
我希望不需要解释。
\documentclass{article}
\usepackage{multirow}
\usepackage{array}
\begin{document}
\begin{table}
\centering
\caption{some table}
\begin{tabular}{|>{\bfseries}c|*{4}{c|}}\hline
\multirow{2}{*}{\bfseries Wormhole type} & \multicolumn{2}{c|}{\bfseries 1-hop} &
\multicolumn{2}{c|}{\bfseries 2-hop} \\\cline{2-5}
& \textbf{node} & \textbf{true?} & \textbf{node} & \textbf{true?} \\ \hline
Hidden & Normal & No & Normal & No \\ \hline
Known Entrance & Malicious & No & Normal & No \\ \hline
Known Exit & Malicious & Yes & Normal & No \\ \hline
Exposed & Malicious & Yes & Malicious & No \\ \hline
None & Malicious & Yes & Normal or Malicious & Yes \\ \hline
\end{tabular}
\end{table}
\end{document}
有booktabs
和没有垂直规则,这就变成了,
\documentclass{article}
\usepackage{multirow}
\usepackage{array}
\usepackage{booktabs}
\begin{document}
\begin{table}
\centering
\caption{some table}
\begin{tabular}{>{\bfseries}c*{4}{c}}\toprule
\multirow{2}{*}{\bfseries Wormhole type} & \multicolumn{2}{c}{\bfseries 1-hop} &
\multicolumn{2}{c}{\bfseries 2-hop} \\\cmidrule(lr){2-3}\cmidrule(lr){4-5}
& \textbf{node} & \textbf{true?} & \textbf{node} & \textbf{true?} \\ \midrule
Hidden & Normal & No & Normal & No \\
Known Entrance & Malicious & No & Normal & No \\
Known Exit & Malicious & Yes & Normal & No \\
Exposed & Malicious & Yes & Malicious & No \\
None & Malicious & Yes & Normal or Malicious & Yes \\ \bottomrule
\end{tabular}
\end{table}
\end{document}