2

I have inserted a table in my article but the font is too small. How can I increase it without affecting the scale of the table? I tried different ways but the table is out the page.

My table looks like the below picture:

enter image description here

'''
\begin{table}[h]

\centering \caption{Comparative Study in The Related Work of Sentiment Analysis} \normalsize \resizebox{\textwidth}{!}{ \begin{tabular}{lllllll} \hline \multirow{2}{}{\textbf{Ref.}} & \multirow{2}{}{\textbf{Language}} & \multicolumn{2}{c}{\textbf{Dataset}} & \multirow{2}{}{\textbf{algorithm}} & \multirow{2}{}{\textbf{Polarity}} & \multirow{2}{}{\begin{tabular}[c]{@{}l@{}}\textbf{Performance}\\textbf{( Acc.)}\end{tabular}} \\cline{3-4} & & \textbf{Name/Types} & \textbf{Size} & & & \ \hline \multirow{2}{}{\cite{AlSalman2020}} & \multirow{2}{}{Arabic} & \multirow{2}{}{Tweets} & \multirow{2}{}{2000} & \multirow{2}{}{Discriminative multinomial NB} & Positive & \multirow{2}{}{87.50%} \ & & & & & Negative & \ \addlinespace \multirow{3}{}{\cite{IKAUNIECE2018}} & \multirow{3}{}{Spanish and Catalan} & \multirow{3}{}{Student feedback} & \multirow{3}{}{2925} & \multirow{2}{}{SVM} & Positive
& \multirow{2}{}{71%} \ & & & & & Negative & \ & & & & Logistic regression & neutral & 72% \ \addlinespace \multirow{3}{}{\cite{Sengkey2019}} & \multirow{3}{}{Indonesian and English} & \multirow{3}{}{Student feedback documents} & \multirow{3}{}{636} & \multirow{3}{}{SVM} & Positive & \multirow{3}{}{74%} \ & & & & & Negative & \ & & & & & neutral & \ \addlinespace \multirow{3}{}{(\cite{Kamiş}} & \multirow{3}{}{English} & \multirow{3}{}{SemEval} & \multirow{3}{}{32000} & CNN & Positive & \multirow{3}{}{59% on CNN +LSTM} \ & & & & LSTM & Negative & \ & & & & CNN + LSTM & neutral & \ \addlinespace \multirow{2}{}{\cite{Munna2020}} & \multirow{2}{}{Bangla} & \multirow{2}{}{Online shops reviews} & \multirow{2}{}{5109} & \multirow{2}{}{DNN} & Good, Bad & 84% \ & & & & & \begin{tabular}[c]{@{}l@{}}Complain\Recommended\Wrong delivery Appreciation\end{tabular} & 69% \ \addlinespace \multirow{2}{}{\cite{Al-Bayati}} & \multirow{2}{}{Arabic} & \multirow{2}{}{LABR} & \multirow{2}{}{14448} & \multirow{2}{}{LSTM} & 0 & \multirow{2}{}{82%} \ & & & & & 1 & \ \addlinespace \multirow{4}{}{\cite{Al-Hassan}} & \multirow{4}{}{Arabic} & \multirow{4}{}{Tweets} & \multirow{4}{}{11000} & LSTM & \multirow{4}{}{\begin{tabular}[c]{@{}l@{}}none, religious\racial, sexism\general hate\end{tabular}} & \multirow{4}{}{72% on LSTM + CNN} \ & & & & LSTM+CNN & & \ & & & & GRU & & \ & & & & GRU+CNN & & \ \addlinespace \multirow{10}{}{\cite{Onan2020}} & \multirow{10}{}{English} & \multirow{10}{}{Student feedback} & \multirow{10}{}{154000} & NB & \multirow{10}{}{\begin{tabular}[c]{@{}l@{}}Positive\~Negative\end{tabular}} & \multirow{10}{}{98.29% on RNN} \ & & & & SVM & & \ & & & & LR & & \ & & & & KNN & & \ & & & & FR & & \ & & & & CNN & & \ & & & & RNN & & \ & & & & RNN-AM & & \ & & & & GRU & & \ & & & & LSTM & & \ \addlinespace \multirow{4}{}{\cite{Alshutayri}} & \multirow{4}{}{Arabic} & \multirow{4}{}{Tweets} & \multirow{4}{}{32186} & NB & \multirow{4}{}{\begin{tabular}[c]{@{}l@{}}Positive\~Negative\~Neutral\end{tabular}} & \multirow{4}{}{70% on LSTM} \ & & & & Logistic regression & & \ & & & & SVM & & \ & & & & LSTM & & \ \addlinespace \multirow{5}{}{\cite{Chouikhi2021}} & \multirow{5}{}{Arabic} & ASTD & 10K & \multirow{5}{}{Arabic BERT} & \begin{tabular}[c]{@{}l@{}}Pos,Neg\Neu,Mix\end{tabular} & 91% \ & & HARD & 93.7k & & Pos,Neg,Neu & 95% \ & & LABR & 63k & & 0,1 & 87% \ & & AJGT & 1800 & & Pos, neg & 96.60% \ & & ArSenTD-Lev & 4000 & & Used 3 classes of 5 & 75% \ \addlinespace \multirow{5}{}{\cite{Alsuhemi2022}} & \multirow{5}{}{Arabic} & \multirow{5}{}{restaurant, movies, products reviews} & \multirow{5}{}{7686} & LR & \multirow{5}{*}{\begin{tabular}[c]{@{}l@{}}Positive\Negative\end{tabular}} & 83% \ & & & & RF & & 82% \ & & & & NB & & 84% \ & & & & SVM & & 83% \ & & & & araBERT & & 82% \ \addlinespace \cite{ElMoubtahij} & Arabic & ARev & 40K & araBERT & \begin{tabular}[c]{@{}l@{}}Positive\Negative\end{tabular} & 92.50% \ \hline \end{tabular}} \end{table}

'''

Eidet I when I edit my table I faced this issue the content of cell does not fit the cell like: enter image description here

\begingroup
\small\linespread{0.9}\selectfont
\sisetup{group-minimum-digits=4}
    \begin{longtblr}[
caption = {Comparative Study in The Related Work of Sentiment Analysis},
  label = {RW},
                    ]{colsep  = 4pt,
                      colspec = {@{} l  X[0.8, l]  X[1.2, l] Q[c, si={table-format=6.0}]
                                       X[1.2, l]       X[l] X[0.8, l] @{}},
                     row{1,2}= {guard, font=\footnotesize\bfseries},
                     rowsep  = 4pt,
                     rowhead = 2
                    }
    \toprule
\SetCell[r=2]{l}    Ref. 
    &   \SetCell[r=2]{l}    Language 
        &   \SetCell[c=2]{c}    Dataset
            &   &    \SetCell[r=2]{l}Algorithm
                    &   \SetCell[r=2]{l}    Polarity
                        &   \SetCell[r=2]{l}    Performance (Acc.)      
                                                    \\
    \cmidrule[lr]{3-4}
    &   &   Name/Types 
            &   Size 
                &   &   &                           \\ 
    \midrule
\cite{AlSalman2020}
    &   Arabic 
        &   Tweets 
            &   2000 
                &   Discriminative multinomial NB 
                    & {Positive\\ Negative} 
                        &   \qty{87.5}{\percent}    \\
\cite{IKAUNIECE2018}
    &   Spanish and Catalan
        &   Student feedback
            &   2925
                &   {SVM\\  Logistic regression} 
                    &   {Positive\\ Negative\\ neutral} 
                        &   {\qty{71}{\percent}\\
                             \qty{72}{\percent}}    \\
\cite{Sengkey2019}
    &   Indonesian and English 
        &   Student feedback documents 
            &   636 
                &   SVM 
                    &   {Positive\\ Negative\\ neutral} 
                        &   \qty{74}{\percent}      \\
\cite{Kamiş} 
    &   English
        &   SemEval
            &   32000
                &   {CNN\\  LSTM\\ CNN + LSTM}
                    &   {Positive\\ Negative\\ neutral} 
                        &   \qty{59}{\percent}  on CNN + LSTM   
                                                    \\
\cite{Munna2020} 
    &   Bangla
        &   Online shops reviews
            &   5109
                &   DNN
                    &   {Good,\\  Bad} 
                        &  \qty{84}{\percent}       \\
    &   &   &   &   &   Complain, Recommended Wrong  delivery, Appreciation
                        &   \qty{69}{\percent}      \\

\cite{Al-Bayati} & Arabic & LABR & 14448 & LSTM & {0\ 1} & \qty{82}{\percent} \ \cite{Al-Hassan} & Arabic & Tweets & 11000 & LSTM, LSTM+CNN, GRU, GRU+CNN & {none, religious,\ racial, sexism,\ general hate} & \qty{72}{\percent} on LSTM + CNN
\

\cite{Onan2020} & English & Student feedback & 154000 & NB, SVM, LR, KNN, FR, CNN, RNN, RNN-AM, GRU, LSTM & {Positive,\ Negative} & \qty{98.29}{\percent} on RNN
\ \cite{Alshutayri} & Arabic & Tweets & 32186 & NB, Logistic regression, SVM, LSTM & {Positive,\ Negative,\ Neutral} & \qty{70}{\percent} on LSTM \ \cite{Chouikhi2021} & Arabic & {ASTD\ HARD\ LABR\ AJGT\ ArSenTD\ Lev} & {10K\ 93.7K\ 63K\ 1800\\ 4000} & Arabic BERT & {Pos, Neg, Neu, Mix\ pos, neg, neu\0, 1\ pos, neg \ used 3 classes from 5 } & { \qty{91}{\percent}\ 95%\ 87%\96.6%\ 75% } \ \cite{Alsuhemi2022} & Arabic & restaurant, movies, products reviews & 7686 & {LR\ RF\ NB\ SVM\ araBERT} & positive, negative & {83% \ 82% \ 84% \ 83% \ 82%} \

\cite{ElMoubtahij} & Arabic & ARev & 40000 & araBERT & poditive, negative & 92.5% \ \bottomrule \end{longtblr} \endgroup

2 Answers2

3

I suppose the title of your query, "Increase the font [size]" could be changed to "stop reducing the font size", because serious font size reduction is exactly what \resizebox does. In short: don't use \resizebox unless you secretly despise the readers of your papers.

Since automatic line breaking would appear to be required in 6 of the 7 columns of the, and because the table's length comfortably exceeds one page, I suggest you switch from a regular tabular environment to an xltabular environment and let line breaks occur wherever deemed necessary. In essence, an xltabular environment is a longtable environment that knows about the X column type.

The following screenshot shows the first few lines of the table.

enter image description here

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[margin=1in,letterpaper]{geometry}
\usepackage{xltabular,ragged2e,booktabs}
\newcolumntype{L}{>{\RaggedRight\hspace{0pt}}X}

\begin{document}

\begingroup % limit scope of next instruction to current TeX group \setlength\tabcolsep{4pt} % default value: 6pt \begin{xltabular}{\textwidth}{@{} LLL l LLL @{}} \caption{Table caption\strut} \label{tab:my-table} \ \toprule Reference & Language & \multicolumn{2}{c}{Dataset} & Algorithm & Polarity & Performance (Acc.) \ \cmidrule(lr){3-4} & & Name\slash Types & Size \ \midrule \endfirsthead

\multicolumn{5}{@{}l}{Table \thetable, cont'd}\[0.5ex] \toprule Reference & Language & \multicolumn{2}{c}{Dataset} & Algorithm & Polarity & Performance (Acc.) \ \cmidrule(lr){3-4} & & Name\slash Types & Size \ \midrule \endhead

\midrule \multicolumn{7}{r@{}}{\footnotesize (continued on following page)}\ \endfoot

\bottomrule \endlastfoot

AlSalman (2020) & Arabic & Tweets & 2000 & Discriminative multinomial NB & Positive\slash Negative & 87.5% \ \addlinespace IKAUNIECE (2018) & Spanish and Catalan & Student feedback & 2925 & SVM & Positive\slash Negative\slash neutral & 71\ \ & & & & Logistic regression & & 72% \ \addlinespace Sengkey, Jacobus, and Manoppo (2019) & Indonesian and English & Student feedback documents & 636 & SVM & Positive\slash Negative \newline neutral & 74% \ \addlinespace Kamiş and Goularas (2019) & English & SemEval & 32000 & CNN & Positive\slash Negative\slash neutral & 59% on CNN+LSTM \ & & & & LSTM & & \ & & & & CNN + LSTM & & \ \addlinespace Munna, Rifat, and Badrudduza (2020) & Bangla & Online shops reviews & 5109 & DNN & Good, Bad & 84% \ & & & & & Complain, Recommended, Wrong delivery, Appreciation & 69% \ \addlinespace Al-Bayati, Al-Araji, and Ameen (2020) & Arabic & LABR & 14448 & LSTM & 0, 1 & 82% \ \addlinespace Al-Hassan and Al-Dossari (2021) & Arabic & Tweets & 11000 & LSTM & none, religious, racial, sexism, general hate & 72% on LSTM + CNN \ & & & & LSTM+CNN & & \ & & & & GRU & & \ & & & & GRU+CNN & & \ \addlinespace Onan (2020) & English & Student feedback & 154000 & NB & Positive, Negative & 98.29% on RNN \ & & & & SVM & & \ & & & & LR & & \ & & & & KNN & & \ & & & & FR & & \ & & & & CNN & & \ & & & & RNN & & \ & & & & RNN-AM & & \ & & & & GRU & & \ & & & & LSTM & & \ \addlinespace Alshutayri et~al.\ (n.d.) & Arabic & Tweets & 32186 & NB & Positive, Negative, Neutral & 70% on LSTM \ & & & & Logistic regression & & \ & & & & SVM & & \ & & & & LSTM & & \ \addlinespace Chouikhi, Chniter, and Jarray (2021) & Arabic & ASTD & 10K & Arabic BERT & Pos, Neg, Neu, Mix & 91% \ & & HARD & 93.7k & & Pos, Neg, Neu & 95% \ & & LABR & 63k & & 0, 1 & 87% \ & & AJGT & 1800 & & Pos, neg & 96.6% \ & & ArSenTD-Lev & 4000 & & Used 3 classes of 5 & 75% \ \addlinespace Alsuhemi et~al.\ (2022) & Arabic & restaurant, movies, product reviews & 7686 & LR & Positive, Negative & 83% \ & & & & RF & & 82% \ & & & & NB & & 84% \ & & & & SVM & & 83% \ & & & & araBERT & & 82% \
\addlinespace el Moubtahij, Abdelali, and Tazi (2022) & Arabic & ARev & 40K & araBERT & Positive, negative & 92.5% \

\end{xltabular} \endgroup % cf. "\begingroup" directive above

\end{document}

Mico
  • 506,678
3
  • In your table code is very easy went to lost ... Also image of table is poor quality, so reading data from it is impossible.
  • So, I edit few first eleven rows of your table. In this effort may happen, that I misunderstood what belong to some rows. Especially because table code is not consistent
  • Anyway, MWE below may serve as skeleton and example how to edit rest of your table:
\documentclass{article}
\usepackage[margin=25mm]{geometry}
\usepackage[skip=1ex,
            font=small, labelfont=bf]{caption}      
\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}

\begin{document} \begin{table}[ht] \caption{Mx wide table} \label{tab:my-table} \small\linespread{0.9}\selectfont \sisetup{group-minimum-digits=4} \begin{tblr}{colspec = {@{} l X[0.8, l,m] X[1.2, l,m] Q[c, si={table-format=6.0}] X[1.2, l,m] X[l,m] X[0.8, l,m] @{}}, row{1,2}= {guard, font=\footnotesize\bfseries, m}, rowsep = 4pt } \toprule \SetCell[r=2]{l} Ref. & \SetCell[r=2]{l} Language & \SetCell[c=2]{c} Dataset & & \SetCell[r=2]{l}Algorithm & \SetCell[r=2]{l} Polarity & \SetCell[r=2]{l} Performance (Acc.)
\ \cmidrule[lr]{3-4} & & Name/Types & Size & & & \ \midrule \cite{AlSalman 2020} & Arabic & Tweets & 2000 & Discriminative multinomial NB & {Positive\ Negative} & \qty{87.5}{\percent} \ \cite{IKAUNIECE 2018} & Spanish and Catalan & Student feedback & 2925 & {SVM\ Logistic regression} & {Positive\ Negative\ neutral} & {\qty{71}{\percent}\ \qty{72}{\percent}} \ \cite{Sengkey, Jacobus, and Manoppo 2019} & Indonesian and English & Student feedback documents & 636 & SVM & {Positive\ Negative\ neutral} & \qty{74}{\percent} \ \cite{Kamiş and Goularas 2019} & English & SemEval & 32000 & {CNN\ LSTM\ CNN + LSTM} & {Positive\ Negative\ neutral} & \qty{59}{\percent} on CNN + LSTM
\ \cite{Munna, Rifat, and Badrudduza 2020} & Bangla & Online shops reviews & 5109 & DNN & {Good,\ Bad} & \qty{84}{\percent} \ & & & & & Complain, Recommended Wrong delivery, Appreciation & \qty{69}{\percent} \

\cite{Al-Bayati, Al-Araji, and Ameen 2020} & Arabic & LABR & 14448 & LSTM & {0\ 1} & \qty{82}{\percent} \ \cite{Al-Hassan and Al-Dossari 2021} & Arabic & Tweets & 11000 & LSTM, LSTM+CNN, GRU, GRU+CNN & {none, religious,\ racial, sexism,\ general hate} & \qty{72}{\percent} on LSTM + CNN
\

\cite{Onan 2020} & English & Student feedback & 154000 & NB, SVM, LR, KNN, FR, CNN, RNN, RNN-AM, GRU, LSTM & {Positive,\ Negative} & \qty{98.29}{\percent} on RNN
\ \cite{Alshutayri et al. n.d.} & Arabic & Tweets & 32186 & NB, Logistic regression, SVM, LSTM & {Positive,\ Negative,\ Neutral} & \qty{70}{\percent} on LSTM \ \cite{Chouikhi, Chniter, and Jarray 2021} & Arabic & ASTD & 10000 & Arabic BERT & Positive, Negative, Neutral, Mix & \qty{9}{\percent} \ \bottomrule \end{tblr} \end{table} \end{document}

enter image description here

Edit (1):

  • In the case, that your table is longer than one page, you need to replace tblr with longtblr:
\documentclass{article}
\usepackage[margin=25mm]{geometry}

\usepackage[skip=1ex, font=small, labelfont=bf]{caption} \usepackage{tabularray} \UseTblrLibrary{booktabs, siunitx}

\begin{document} \begingroup \small\linespread{0.9}\selectfont \sisetup{group-minimum-digits=4} \begin{longtblr}[ caption = {Comparative Study in The Related Work of Sentiment Analysis}, label = {tab:my-table}, ]{colsep = 4pt, colspec = {@{} l X[0.8, l] X[1.2, l] Q[c, si={table-format=6.0}] X[1.2, l] X[l] X[0.8, l] @{}}, row{1,2}= {guard, font=\footnotesize\bfseries}, rowsep = 4pt, rowhead = 2 } \toprule \SetCell[r=2]{l} Ref. & \SetCell[r=2]{l} Language & \SetCell[c=2]{c} Dataset & & \SetCell[r=2]{l}Algorithm & \SetCell[r=2]{l} Polarity & \SetCell[r=2]{l} Performance (Acc.) \ \cmidrule[lr]{3-4} & & Name/Types & Size & & & \ \midrule %% table body \cite{AlSalman 2020} & Arabic & Tweets & 2000 & Discriminative multinomial NB & {Positive\ Negative} & \qty{87.5}{\percent} \ \cite{IKAUNIECE 2018} & Spanish and Catalan & Student feedback & 2925 & {SVM\ Logistic regression} & {Positive\ Negative\ neutral} & {\qty{71}{\percent}\ \qty{72}{\percent}} \ \cite{Sengkey, Jacobus, and Manoppo 2019} & Indonesian and English & Student feedback documents & 636 & SVM & {Positive\ Negative\ neutral} & \qty{74}{\percent} \ \cite{Kamiş and Goularas 2019} & English & SemEval & 32000 & {CNN\ LSTM\ CNN + LSTM} & {Positive\ Negative\ neutral} & \qty{59}{\percent} on CNN + LSTM \ \cite{Munna, Rifat, and Badrudduza 2020} & Bangla & Online shops reviews & 5109 & DNN & {Good,\ Bad} & \qty{84}{\percent} \ & & & & & Complain, Recommended Wrong delivery, Appreciation & \qty{69}{\percent} \

\cite{Al-Bayati, Al-Araji, and Ameen 2020} & Arabic & LABR & 14448 & LSTM & {0\ 1} & \qty{82}{\percent} \ \cite{Al-Hassan and Al-Dossari 2021} & Arabic & Tweets & 11000 & LSTM, LSTM+CNN, GRU, GRU+CNN & {none, religious,\ racial, sexism,\ general hate} & \qty{72}{\percent} on LSTM + CNN \

\cite{Onan 2020} & English & Student feedback & 154000 & NB, SVM, LR, KNN, FR, CNN, RNN, RNN-AM, GRU, LSTM & {Positive,\ Negative} & \qty{98.29}{\percent} on RNN \ \cite{Alshutayri et al. n.d.} & Arabic & Tweets & 32186 & NB, Logistic regression, SVM, LSTM & {Positive,\ Negative,\ Neutral} & \qty{70}{\percent} on LSTM \ \cite{Chouikhi, Chniter, and Jarray 2021} & Arabic & ASTD & 10000 & Arabic BERT & Positive, Negative, Neutral, Mix & \qty{9}{\percent} \ \cite{Alsuhemi2022} & Arabic & restaurant, movies, products reviews & 7686 & {LR\ RF\ NB\ SVM\ araBERT} & {positive\Negative}
& {\qty{83}{\percent} \ \qty{82}{\percent} \
\qty{84}{\percent} \
\qty{83}{\percent} \
\qty{82}{\percent}} \
\cite{ElMoubtahij}
& Arabic & ARev & 40000 & araBERT & {Positive\ Negative}
& \qty{92.50}{\percent} \
\bottomrule \end{longtblr} \endgroup \end{document}

  • In above MWE I added rest of rows from edited table in your question.
  • Due to used \small font size and reduced linespread size table can be dit in one page, but for case, that your table still have more rows, it is now designed as long table, which can be spread over many pages.
  • Long table should not be enclosed in ˙table float. If it is, it will not be broken between pages but will protrude out of bottom of page.
  • For eventual further help you need to inform me (us) about the following:
    • does format of table produced with both MWE is what you after (first MWE (Minimal Working Example) produce vertical centered cells columns, in the second contents are top aligned)?
    • in comment you said that you got some errors, but from it is not clear, if with proposed solution or with inserting it in your document
    • what errors you got?

Note: please (again), always provide complete small, but complete document, which we can compile as it is. With this you inform use about page layout, which (to problem relevant) packages you use, etc.

enter image description here

Edit (2):

  • Apparently we don't speak the same language since so far my guessing what you after was wrong ...
  • So I'm still not sure if now I correctly figured out what you like to tell me. Cells as for example is
NB, SVM, LR, KNN, FR, CNN, RNN, RNN-AM,  GRU, LSTM

you like that shortens be below each other.

  • This is simple to achieve:
{NB\\ SVM\\ LR\\ KNN\\ FR\\ CNN\\ RNN\\ RNN-AM\\  GRU\\ LSTM}
  • The same you should do in all other cells where you like to have abbreviation written on the same way. This changes of table code I left you to do.
  • After this correction your table (as you provide code in question) still can be fit on one page:

enter image description here

Zarko
  • 296,517
  • it worked but the my data is too long so I used longeTable then there are an error I cannot understand it. I put MWE if you can help me @Zarko – Huda Alamoudi Feb 11 '23 at 23:56
  • @HudaAlamoudi, if your table is longer than one page, than instead of tblr you should use longtblr which can be span over several pages if needed (see edited answer). For any further help you first need to extend your code fragment to small but complete document which can be compiled as it is. About errors: what error you get? At compiling of proposed solution? Anyway, first I need to know, if table form given my MWE is what you looking for. – Zarko Feb 12 '23 at 01:39
  • Thank it works... but I have a question, How can I enable the size column to multiple lines like the algorithms column? – Huda Alamoudi Feb 12 '23 at 09:10
  • @HudaAlamoudi, sorry, I don't understand your comment. If you have new problem, please ask new follows-up question where you can add link to this one and by some sketch show us, what is new problem. BTW, you got two answers which bot solve your question as is. It my be a time that you accept one (by clicking on check mark at top left side of answers), which you estimate that solve a question on the best way. – Zarko Feb 12 '23 at 10:08
  • I edited the question to illustrate my issue with BTW @zarko – Huda Alamoudi Feb 12 '23 at 12:36