在页面上适合冗长的表格

在页面上适合冗长的表格

这就是我尝试在一页上放置一个冗长的表格的方法。

\documentclass{IEEEtran}% http://www.ctan.org/pkg/ieeetran


\begin{document}
\begin{table}[]
    \centering
    \caption{My caption}
    \label{my-label}
    \begin{tabular}{|l|l|l|l|}
            \hline
        \textbf{Paper} & \textbf{Goal} & \textbf{Data} & \multicolumn{1}{c|}{\textbf{Tool/Technology}} \\ \hline
        Security threats for big data: A study on Enron e-mail dataset & Mitigating Phishing Attacks & Enron E-mail Dataset & Enronic Software \\ \hline
        A Big Data architecture for security data and its application to phishing characterization & Defending Against Spam and Phishing & \begin{tabular}[c]{@{}l@{}}pcap\\ files, logs from honey net\end{tabular} & \begin{tabular}[c]{@{}l@{}}Hadoop,\\ Spark\end{tabular} \\ \hline
        Data mining methods for detection of new malicious executables & \begin{tabular}[c]{@{}l@{}}Detect\\ malicious malware\end{tabular} & \begin{tabular}[c]{@{}l@{}}Malicious\\ and benign executable binaries\end{tabular} & \begin{tabular}[c]{@{}l@{}}Data\\ Mining Algorithms\end{tabular} \\ \hline
        A practical solution to improve cyber security on a global scale & \begin{tabular}[c]{@{}l@{}}Security\\ monitoring Tool\end{tabular} & \begin{tabular}[c]{@{}l@{}}Network\\ flow\end{tabular} & \begin{tabular}[c]{@{}l@{}}Data\\ Mining Techniques, High Functioning autistic graduates\end{tabular} \\ \hline
        Automate Cybersecurity Data Triage by Leveraging Human Analysts' Cognitive Process & \begin{tabular}[c]{@{}l@{}}Help\\ security analysts with data triage\end{tabular} & Securityanalysts' operation traces & Data mining Techniques, Humans \\ \hline
        Analyzing and Predicting Security Event Anomalies: Lessons Learned from a Large Enterprise Big Data Streaming Analytics Deployment & Improve SIEM by adding important features. & Traditional SIEM systems & Data Mining, Graph Analytics \\ \hline
        Study on Network Information Security Based on Big Data & APT Detection & \begin{tabular}[c]{@{}l@{}}Network\\ data collection\end{tabular} & Big Data Analytics(BDA), Network event collection, Big Data correlation analysis \\ \hline
        Big data machine learning and graph analytics: Current state and future challenges & Combine batch and stream data processes for efficeincy & Hetereogeneous big data & Lambda architecture \\ \hline
        SIM in light of big data & Cyber attack detection & Security logs & Machine learning techniques \\ \hline
        Data fusion \& visualization application for network forensic investigation-a case study & \begin{tabular}[c]{@{}l@{}}Network\\ forensic investigation\end{tabular} & Network logs & \begin{tabular}[c]{@{}l@{}}Data\\ fusion techniques, visualization, Self Organizing Map\end{tabular} \\ \hline
        Owlsight: Platform for real-time detection and visualization of cyber threats & \begin{tabular}[c]{@{}l@{}}Real\\ time detection and visualization of threats\end{tabular} & Heterogeneous network data & \begin{tabular}[c]{@{}l@{}}BDA,\\ web services, data visualization\end{tabular} \\ \hline
        Predicting and fixing vulnerabilities before they occur: a big data approach & \begin{tabular}[c]{@{}l@{}}Proactive\\ (Prevention better than cure approach)\end{tabular} & Heterogeneous network data & \begin{tabular}[c]{@{}l@{}}BDA\\ techniques, machine learning\end{tabular} \\ \hline
        Machine learning classification model for Network based Intrusion Detection System & Network Intrusion Detection System in Android phones & Android OS data & Machine Learning Algorithms \\ \hline
        A big data architecture for large scale security monitoring & \begin{tabular}[c]{@{}l@{}}Intrusion\\ detection and prevention systems\end{tabular} & \begin{tabular}[c]{@{}l@{}}NetFlow\\ records, HTTP traffic and honeypot data\end{tabular} & Shark, Spark, machine learning algorithms \\ \hline
        A Scalable Meta-Model for Big Data Security Analyses & \begin{tabular}[c]{@{}l@{}}Detect\\ network anomaly at per flow level rather than the usual per packet level which\\ tends to bring scalability issues\end{tabular} & \begin{tabular}[c]{@{}l@{}}Networkflow\\ data\end{tabular} & Machine learning and data mining algorithms \\ \hline
        Network security and anomaly detection with Big-DAMA, a big data analytics framework & Intrusion Detection System & \begin{tabular}[c]{@{}l@{}}Network\\ flow Data\end{tabular} & \begin{tabular}[c]{@{}l@{}}Spark,\\ Cassandra, Machine Learning Algorithms\end{tabular} \\ \hline
        SHIELD: A novel NFV-based cybersecurity framework & \begin{tabular}[c]{@{}l@{}}SecaaS\\ to protect applications on software as service platform\end{tabular} & Heterogeneous Data & Big Data Analytics \\ \hline
        Security evaluation of RC4 using big data analytics & \begin{tabular}[c]{@{}l@{}}Analysing\\ RC4 based on big data processing technique to analyse the security of RC4\end{tabular} & RC4 & MapReduce \\ \hline
    \end{tabular}
\end{table}
\end{document}

这是我得到的结果。 enter image description here

我怎样才能做到这一点?

答案1

我建议使用以下解决方案,使用可变宽度tabularx列,并采用左对齐、booktabs水平线和extrarowheight作为视觉指南。此外,新列类型定义中ragged2e的命令\RaggedRight允许在不规则文本中使用连字符,并且在使用加载适当的连字符模式时效果最佳babel

\documentclass{IEEEtran}
\usepackage[english]{babel}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{ragged2e}
\newcolumntype{R}{>{\RaggedRight\let\newline\\\arraybackslash\hspace{0pt}}X}
\begin{document}
\begin{table*}[]
    \setlength\extrarowheight{5pt}
    \centering
    \caption{My caption}
    \label{my-label}
    \begin{tabularx}{\textwidth}{RRRR}
    \toprule
    \textbf{Paper} & \textbf{Goal} & \textbf{Data} & \textbf{Tool/Technology} \\
    \midrule
        Security threats for big data: A study on Enron e-mail dataset & Mitigating Phishing Attacks & Enron E-mail Dataset & Enronic Software \\
        A Big Data architecture for security data and its application to phishing characterization & Defending Against Spam and Phishing & pcap files, logs from honey net & Hadoop, Spark \\
        Data mining methods for detection of new malicious executables & Detect malicious malware & Malicious and benign executable binaries & Data Mining Algorithms \\
        A practical solution to improve cyber security on a global scale & Security monitoring Tool & Network flow & Data Mining Techniques, High Functioning autistic graduates \\ 
        Automate Cybersecurity Data Triage by Leveraging Human Analysts' Cognitive Process & Help security analysts with data triage & Securityanalysts' operation traces & Data mining Techniques, Humans \\ 
        Analyzing and Predicting Security Event Anomalies: Lessons Learned from a Large Enterprise Big Data Streaming Analytics Deployment & Improve SIEM by adding important features. & Traditional SIEM systems & Data Mining, Graph Analytics \\ 
        Study on Network Information Security Based on Big Data & APT Detection & Network data collection & Big Data Analytics(BDA), Network event collection, Big Data correlation analysis \\ 
        Big data machine learning and graph analytics: Current state and future challenges & Combine batch and stream data processes for efficeincy & Hetereogeneous big data & Lambda architecture \\ 
        SIM in light of big data & Cyber attack detection & Security logs & Machine learning techniques \\ 
        Data fusion \& visualization application for network forensic investigation-a case study & Network forensic investigation & Network logs & Data fusion techniques, visualization, Self Organizing Map \\ 
        Owlsight: Platform for real-time detection and visualization of cyber threats & Real time detection and visualization of threats & Heterogeneous network data &BDA, web services, data visualization \\ 
        Predicting and fixing vulnerabilities before they occur: a big data approach & Proactive (Prevention better than cure approach) & Heterogeneous network data & BDA techniques, machine learning \\ 
        Machine learning classification model for Network based Intrusion Detection System & Network Intrusion Detection System in Android phones & Android OS data & Machine Learning Algorithms \\ 
        A big data architecture for large scale security monitoring & Intrusion detection and prevention systems& NetFlow records, HTTP traffic and honeypot data & Shark, Spark, machine learning algorithms \\
        A Scalable Meta-Model for Big Data Security Analyses & Detect network anomaly at per flow level rather than the usual per packet level which tends to bring scalability issues & Networkflow data & Machine learning and data mining algorithms \\ 
        Network security and anomaly detection with Big-DAMA, a big data analytics framework & Intrusion Detection System & Network flow Data & Spark, Cassandra, Machine Learning Algorithms \\ 
        SHIELD: A novel NFV-based cybersecurity framework & SecaaS to protect applications on software as service platform & Heterogeneous Data & Big Data Analytics \\ 
        Security evaluation of RC4 using big data analytics & Analysing RC4 based on big data processing technique to analyse the security of RC4 & RC4 & MapReduce \\ 
        \bottomrule
    \end{tabularx}
\end{table*}
\end{document}

enter image description here

答案2

你可能无法轻易做到这一点......确保表格保持在页面宽度内很容易:替换

\begin{tabular}{|l|l|l|l|}

\begin{tabular}{|p{.25\textwidth}|p{.25\textwidth}|p{.25\textwidth}|p{.25\textwidth}|}

使线条可以在单元格内换行。

但是,您在很多单元格中使用了另一层表格,而这些表格不遵守外部表格所施加的限制。您必须摆脱这些嵌套的表格(当您将列规范更改为“p{}”时,许多表格似乎变得多余),或者确保它们被限制在列宽(表格*)内。

解决了这个问题后,您必须确保表格可以跨越两页(或更多),而表格环境不允许这样做。为此,您必须使用 xtab 或 longtable 之类的包。

(注意:以横向排版表格可能会更好,但这会使其不适合一页)。

答案3

还有一个选择……

  • 您的表格太宽,无法容纳在一列中。因此它必须跨越两列,即在tabular*环境中
  • 为了获得更“专业”的外观,我将\hline使用包定义的规则booktabs
  • 对于表格环境,我建议利用包tabularx(您在问题中标记它)。有了它,表格宽度可以设置为等于文本宽度,并且列的宽度可以自动确定
  • 如果表格有很多行,我会将字体大小减小到\small
  • 为了在表格中的行之间增加垂直空间,我将利用包\makegapedcells中的宏makecell

\documentclass{IEEEtran}% http://www.ctan.org/pkg/ieeetran
\usepackage{booktabs,
            makecell,   % <--- added
            tabularx}
\renewcommand\theadfont{\bfseries}
\renewcommand\theadgape{}
\setcellgapes{5pt}
\usepackage{rotating}
\usepackage{afterpage}

\usepackage{lipsum}% for dummy text when needed

\begin{document}
\lipsum[1]
\begin{sidewaystable*}
    \centering
    \caption{My caption}
    \label{my-label}
\makegapedcells
\begin{tabularx}{\linewidth}{ *{4}{X} }% here is defined number of collumns
    \toprule
\thead{Paper}  & \thead{Goal} & \thead{Paper} & \thead{Goal}    \\
    \midrule
\lipsum*[11]    & \lipsum*[11]  & \lipsum*[12]      & \lipsum*[11]  \\
\lipsum*[11]    & \lipsum*[11]  & \lipsum*[11]      & \lipsum*[11]  \\
    \bottomrule
\end{tabularx}
\end{sidewaystable*}
\lipsum\lipsum
\end{document}

这个 mwe 给出:

enter image description here

答案4

您可以尝试以下操作:

\begin{tabular}{|p{0.25\textwidth}|p{0.25\textwidth}|p{0.25\textwidth}|p{0.25\textwidth}|}

相关内容