高级表结构

高级表结构

我是一名乳胶初学者,我必须制作一张带有以下图像的表格:

在此处输入图片描述

您知道要遵循哪个结构以及要导入哪些库吗?

以下是我能重现的内容。

在此处输入图片描述

\begin{center}
\FloatBarrier
%   \vspace{-1em}
    \begin{table}[H]
    \caption{Classification of Anomaly Detection Techniques, Based on Their Class.
    {\label{tab:stats_num_data}}}
%   \vspace{-0.5em}
%   \setlength\extrarowheight{-2pt}
    \input{tables/papers_summary}
    \end{table}
%\vspace{-2em}
\FloatBarrier
\end{center}

\begin{tabular}{| l | c | c | c | c | c | c | c | c | c | c | c | c |}
\toprule
  Paper(s) &  \multicolumn{3}{c}{Class} & \multicolumn{9}{|c|}{Method} \\
\midrule
  {} &  \rotatebox{90}{~\parbox{4cm}{Log-based}~} &   \rotatebox{90}{~\parbox{4cm}{Distributed Tracing-based}~} &   \rotatebox{90}{~\parbox{4cm}{Monitoring-Based}~} &   \rotatebox{90}{~\parbox{4cm}{Unsupervised learning}~} &  \rotatebox{90}{~\parbox{4cm}{Supervised learning}~} & \rotatebox{90}{~\parbox{4cm}{Reinforcement learning}~} &  \rotatebox{90}{~\parbox{4cm}{Semi-supervised learning}~} &   \rotatebox{90}{~\parbox{4cm}{Statistical Approach}~} & \rotatebox{90}{~\parbox{4cm}{Causal Inference}~} &   \rotatebox{90}{~\parbox{4cm}{Trace comparison}~} & \rotatebox{90}{~\parbox{4cm}{HeartBeating}~} &   \rotatebox{90}{~\parbox{4cm}{SLO checks}~} \\
   \hline
  \cite{7TechGia49:online} & \textbullet {} & {} & {} & {} & {} & {} & {} & {} & \textbullet {} & {} & {} & {} \\
   \hline
  \cite{abdelrahman2016detection} & \textbullet {} & {} & {} & {} & {} & {} & {} & {} & \textbullet {} & {} & {} & {}\\
   \hline
  \cite{ahad2015toward} & \textbullet {} & {} & {} & {} & {} & {} & {} & {} & \textbullet {} & {} & {} & {}\\
\bottomrule
\end{tabular}

您知道如何将表格宽度设置为与文章文本相同的宽度吗?

我怎样才能改变行的样式来匹配原始表格?

答案1

你应该不使用booktabs如果您想保留表格的原始布局并使用垂直线,因为这会导致单元格边框出现间隙。

如果您想让表格与文本一样宽,并且让几列(或所有)具有相同的宽度,那么您应该查看该tabularx包。

因此,我可能会做这样的事情:

\documentclass{article}

% geometry package loaded to make margin smaller, since I don't know your set up
\usepackage[margin=2cm]{geometry} 

\usepackage{tabularx, multirow, graphicx}

\newcolumntype{C}{>{\centering\arraybackslash}X}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}

\newcommand{\tilt}[2][7em]{\rotatebox[origin=r]{90}{\parbox{#1}{\raggedleft #2}}}

\begin{document}

\noindent\begin{table}
\renewcommand{\arraystretch}{1.2}%
\begin{tabularx}{\textwidth}{ |P{6em}| |C|C|C| |C|C| |C|C|C|C| }

    \hline
    \textbf{Paper(s)} &
    \multicolumn{3}{|c||}{\textbf{Data Sources}} &
    \multicolumn{2}{|c||}{\textbf{SDP Typology}} &
    \multicolumn{4}{|c|}{\textbf{Target Code Unit}} \\

    \cline{2-10}
    &
    \multicolumn{2}{|c|}{\textbf{Code Metrics}} &
    \multirow{2}{*}{\tilt{\textbf{AST Data}}} &
    \multirow{2}{*}{\tilt{\textbf{Same-project}}} &
    \multirow{2}{*}{\tilt{\textbf{Cross-project}}} &
    \multirow{2}{*}{\tilt{\textbf{Function}}} &
    \multirow{2}{*}{\tilt{\textbf{File}}} &
    \multirow{2}{*}{\tilt{\textbf{Class}}} &
    \multirow{2}{*}{\tilt{\textbf{Module}}} \\

    \cline{2-3}
    &
    \tilt[5.75em]{\textbf{Static}} &
    \tilt[5.75em]{\textbf{Change-related}} &
    &
    &
    &
    &
    &
    &
    \\
    
    \hline
    [102] &
    \textbullet &
    &
    &
    \textbullet &
    \textbullet &
    &
    &
    &
    \textbullet \\

\end{tabularx}
\end{table}

\end{document}

在此处输入图片描述

相关内容