无法在 Latex 中定位表格

无法在 Latex 中定位表格

我对 LaTex 中的表格定位存在问题。

这是该表的代码:

\begin{tabular}
{|m{2cm}|m{2cm}|m{1.5cm}|l|}
     \hline Title&Methodology&Dataset&Accuracy\\ \hline A Supervised Machine Learning Approach to Detect Fake Online Reviews & Naive Bayes, Decision Tree, Random Forest, and Support Vector Machine & Amazon reviews &91.45\%\\
     \hline Declarative Programming Approach for Fake Review Detection & Declarative Programming Approach & Hotel reviews & 94.87\% \\
     \hline Detecting Fake Reviews through Sentiment Analysis Using Machine Learning Techniques & Sentiment Analysis with Naive Bayes and SVM & Hotel Reviews & 87\% \\
    \hline Fake Review Detection Based on Multiple Feature Fusion and Rolling Collaborative Training & Naive Bayes, Decision Tree, Random Forest, and Support Vector Machine & Amazon reviews & 97.98\% \\
    \hline Impact of Sentiment Analysis in Fake Online Review Detection & Naive Bayes, Random Forest, and Support Vector Machine & E-commerce website & 96.36\% \\
    \hline The Effect of Fake Reviews on e-Commerce During and After the Covid-19 Pandemic: SKL-Based Fake Reviews Detection. & Machine learning algorithm based on the Scikit-Learn library & E-commerce platform & 95.22\% \\
    \hline Using Boosting Approaches to Detect Spam Reviews & AdaBoost, Gradient Boosting, and XGBoost, using various features such as n-grams, part-of-speech tags & E-commerce websites & 95.4\% \\
    \hline   
\end{tabular}

文档的布局是 IEEE 会议论文。内容分为两列,我的表格位于中间的右列。由于我的表格有 8 列,所以它会在下一页全部移动到左列。我想拆分表格以便可以容纳它。

我曾尝试使用 float 和 h! 命令,但无济于事。

答案1

  • 您没有提供MWE(最小工作示例),这是一个小但有用的文档,我们可以按原样对其进行测试。
  • 因此,我们没有关于您的文档页面布局的任何信息。
  • 在表格片段中您声明了六列但只使用了四列!
  • 我建议X前三列使用列类型,S最后一列使用列类型,并减少列间距。
  • 使用tblrtabularray使表代码更短:
\documentclass{article}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{lipsum}% For dummy text. Don't use in a real document

\usepackage{ragged2e}
\usepackage{tabularray}
\UseTblrLibrary{siunitx}

\usepackage{lipsum}
\begin{document}
    \begin{table}[ht]
\begin{tblr}{hlines, vlines,
             colspec = { *{3}{X[j, cmd=\RaggedRight\hskip0pt]} Q[c, m, si={table-format=3.2{\%}}]},
             cell{2-Z}{4} = {appto=\%},
             colsep = 3pt,
             row{1} = {guard, c}
             }
Title
    &   Methodology
        &   Dataset
            &   Accuracy            \\
A Supervised Machine Learning Approach to Detect Fake Online Reviews 
    &   Naive Bayes, Decision Tree, Random Forest, and Support Vector Machine 
        &   Amazon reviews 
            &   91.45   \\
Declarative Programming Approach for Fake Review Detection 
    & Declarative Programming Approach 
        & Hotel reviews 
            &   94.87   \\
Detecting Fake Reviews through Sentiment Analysis Using Machine Learning Techniques
    &   Sentiment Analysis with Naive Bayes and SVM 
        &   Hotel Reviews 
            &   87      \\
Fake Review Detection Based on Multiple Feature Fusion and Rolling Collaborative Training 
    &   Naive Bayes, Decision Tree, Random Forest, and Support Vector Machine 
        &   Amazon reviews
            &   97.98   \\
Impact of Sentiment Analysis in Fake Online Review Detection 
    &   Naive Bayes, Random Forest, and Support Vector Machine 
        &   E-commerce website 
            &   96.36   \\
The Effect of Fake Reviews on e-Commerce During and After the Covid-19 Pandemic: SKL-Based Fake Reviews Detection. 
    &   Machine learning algorithm based on the Scikit-Learn library 
        &   E-commerce platform 
            &   95.22   \\
Using Boosting Approaches to Detect Spam Reviews
    &   AdaBoost, Gradient Boosting, and XGBoost, using various features such as n-grams, part-of-speech tags 
        &   E-commerce websites 
            &   95.4    \\
\end{tblr}
    \end{table}
\end{document}

在此处输入图片描述

(红线表示页面布局)

相关内容