我怎样才能在 LaTeX 中绘制这样的表格?

我怎样才能在 LaTeX 中绘制这样的表格?

我该如何处理这个问题?

桌子

我的代码没有按预期运行

\begin{table*}[ht]

\caption{Related Surveys Comparison}
\label{tab: RelatedSurveys}
% \setlength{\tabcolsep}{5pt}
\centering
\resizebox{1.0\textwidth}{!}{%
% \resizebox{\textwidth}{!}{%
% \resizebox{17.5cm}{3.5cm}{%
\begin{tabular}{|l|l|l|l|l|l|}
\hline
\multirow{2}{*}{Survey} & \multirow{2}{*}{Scope}&
\multirow{2}{*}{Major contribution}&  \multicolumn{5}{c|}{Topics}   \\ \cline{3-7}   &
\multirow{2}{*}{Enhancement in our paper}& \multirow{2}{*}{year}  \\ \hline

\end{tabular}
}

\end{table*}

答案1

我建议你让桌子看起来更加开放,从而更具吸引力。我也会减少使用大胆的

观察以下示例代码中环境的使用tabular*,以确保表格材料适合文本块的宽度。

在此处输入图片描述

\documentclass{article} % or some other suitable document class

\usepackage{array,booktabs,ragged2e,graphicx}
\newlength\mylenA  \settowidth\mylenA{Detection and}
\newlength\mylenB  \settowidth\mylenB{Enhancement}
\newcommand{\vertbox}[1]{\rotatebox{90}{\parbox{\mylenA}{\RaggedRight #1}}}
\newcolumntype{P}[1]{>{\RaggedRight}p{#1}}

\begin{document}
\begin{table}[ht]
\caption{Related Surveys Comparison\strut}
\label{tab: RelatedSurveys}

\setlength\tabcolsep{0pt}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} ll *{5}{c} *{2}{P{\mylenB}} l}
\toprule
Paper & Scope & \multicolumn{5}{c}{Topics} & Major contribution & Enhancement in our paper & Year\\
\cmidrule{3-7}
& & \vertbox{Architecture design} & \vertbox{Mobility} & \vertbox{Security} & \vertbox{Privacy} & \vertbox{Detection and prevention} \\
\midrule
Ref1 & \textbullet & \textbullet & \textbullet & \textbullet & \textbullet & \textbullet & \textbullet & \textbullet & \textbullet \\ 
\bottomrule
\end{tabular*}
\end{table}

\end{document}

答案2

使用tabularray+makecellrotating包时,所有单元都有边框:

在此处输入图片描述

\documentclass[twocolumn]{article}

\usepackage{rotating, makecell}
\usepackage{tabularray}
%\UseTblrLibrary{booktabs}

\begin{document}
    \begin{table*}[ht]
\caption{Related Surveys Comparison\strut}
\label{tab: RelatedSurveys}
\settowidth\rotheadsize{Detection and}    % from makecell

\begin{tblr}{hlines, vlines,
             colspec = {*{2}{c} *{5}{Q[c, wd=2em]} *{2}{X[l]} c},
             row{1}  = {font=\bfseries},
             row{2}  = {cmd=\rotcell, font=\small\linespread{0.84}\selectfont}, % <----
            }
\SetCell[r=2]{b}    Paper
    &   \SetCell[r=2]{b}    Scope
        &   \SetCell[c=5]{c}    Topics
            &   &   &   &   &   \SetCell[r=2]{b}    Major contribution
                                &   \SetCell[r=2]{b}    Enhancement in our paper
                                    &   \SetCell[r=2]{b}    Year    \\
    &   &   Architecture design
            &   Mobility
                &   Security
                    &   Privacy
                        &   Detection and prevention
                            &   &   &           \\
Ref 1
    & \textbullet
        & %\SetCell[c=5]{c}
            &   &   &   &   &   &   & 2019      \\
Ref 2
    &   & %\SetCell[c=5]{c}
            &   &   &   &   &   &   & 2019      \\
Ref 2
    &   & %\SetCell[c=5]{c}
            &   &   &   &   &   &   & 2020      \\
\end{tblr}
    \end{table*}
\end{document}

h在第一个表格行(列标题)中使用:

\SetCell[r=2]{h}    Paper
    &   \SetCell[r=2]{h}    Scope
        &   \SetCell[c=5]{c}    Topics
            &   &   &   &   &   \SetCell[r=2]{h}    Major contribution
                                &   \SetCell[r=2]{h}    Enhancement in our paper
                                    &   \SetCell[r=2]{h}    Year    \\

该表如下所示:

在此处输入图片描述

f

\SetCell[r=2]{f}    Paper
    &   \SetCell[r=2]{f}    Scope
        &   \SetCell[c=5]{c}    Topics
            &   &   &   &   &   \SetCell[r=2]{f}    Major contribution
                                &   \SetCell[r=2]{f}    Enhancement in our paper
                                    &   \SetCell[r=2]{f}    Year    \\

在此处输入图片描述

相关内容