0

I am having an issue with the positioning of the table in LaTex.

This is the code for the table:

\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}

The layout of the document is the IEEE conference paper. The content is divided into two columns and my table is on the right column in the middle. Since my table has 8 columns, it is moving all together to the left column on the next page. I want to break the table so that it could fit in.

I have tried using float, and h! commands, but in vain.

  • 2
    Welcome! Please clone your project and then minimize it to the minimum and post a minimal working example (MWE); otherwise it will be much more difficult to help. – Rmano May 19 '23 at 10:53
  • 1
    Anyway, the sensation is that the table is too big; if it doesn't fit, it doesn't fit. You can try to look at https://tex.stackexchange.com/questions/332902/my-table-doesnt-fit-what-are-my-options – Rmano May 19 '23 at 10:54
  • you are forcing 6 columns of 2cm each with 12pt padding so it will never fit in a column, surround with \begin{table*} so it spans over 2 columns at the top of a page – David Carlisle May 19 '23 at 10:56
  • Pleas extend your code fragment to complete small document (MWE: Minimal working Example) beginning with \documentclass and ending with \end{document} as you have been asked in other comments. Something similar as you can see in my answer. Mentioned, that this is ieee conference paper is not sufficient. Help us to help you. – Zarko May 22 '23 at 06:38
  • 1
    Do you read our comments? Why you nat provide what we asked you? Your ignorance doesn't lead anywhere ... – Zarko May 22 '23 at 06:50

1 Answers1

2
  • You not provide MWE (Minimal Working Example), a small but colete document, which we can test as it is.
  • Consequently we haven't any information about your document page layout.
  • In table fragment you declare six columns but use only four!
  • I suggest to use X column type for the first three columns and S column type for the last one, and reduce column separation too.
  • Using the tblr of the tabularray package make table code shorter:
\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}

enter image description here

(red lines indicate page layout)

Zarko
  • 296,517
  • Thank you for your reply. I was able to resize the table by declaring 4 columns. I apologize for not clarifying the document structure. It is the template of the IEEE conference paper.

    After resizing the table, the position of the table is not accurate, it is too big to fit on one page, and rather than being broken into two parts, the whole table is being shifted to a new page. I tried using h!, H commands but it doesn't seem to work.

    If you could help me with that, it would be a huge thanks.

    – Kirti Rattan May 21 '23 at 07:02
  • 1
    Don't resize table! Rather extend your code fragment to complete small document which reproduce your problem that we can help you Table as it is, will automatically have width equal to \textwidth. – Zarko May 21 '23 at 09:16
  • 2
    @KirtiRattan, be aware that we haven't crystal balls in which we see what you doing and what document you like to write. Please, edit your question and add requested information. – Zarko May 21 '23 at 09:31