我在文章中插入了表格,但字体太小。如何在不影响表格比例的情况下增加字体?我尝试了不同的方法,但表格超出了页面。
我的表格如下图所示:
'''
\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}
'''
艾德特 当我编辑表格时,我遇到了这个问题,单元格的内容不适合单元格,例如:
\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
答案1
- 您的表格中的代码很容易丢失...而且表格的图像质量很差,因此无法从中读取数据。
- 因此,我编辑了表格的前 11 行。在此过程中,我可能会误解某些行的归属。特别是因为表格代码不一致
- 无论如何,下面的 MWE 可以作为如何编辑表格其余部分的骨架和示例:
\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}
编辑(1):
- 如果您的表格长度超过一页,则需要将其替换
tblr
为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}
- 在上面的 MWE 中,我添加了您问题中编辑的表中的其余行。
- 由于使用的
\small
字体大小和缩小的linespread
尺寸,表格可以在一页中写满,但如果您的表格仍然有更多行,它现在被设计为长表格,可以分布在多个页面上。 - 长表格不应包含在
˙table
浮动元素中。如果包含在浮动元素中,则长表格不会在页面之间断开,但会超出页面底部。 - 为了最终获得进一步的帮助,您需要告知我(我们)以下信息:
- 使用两个 MWE 生成的表格格式是否符合您的要求(第一个 MWE(最小工作示例)生成垂直居中的单元格列,第二个 MWE 的内容顶部对齐)?
- 在评论中你说你遇到了一些错误,但不清楚是否有建议的解决方案或将其插入到你的文档中
- 你遇到了什么错误?
笔记:请(再次)始终提供完整、简短但完整的文档,以便我们按原样编译。通过此文档,您可以告知我们页面布局、您使用的(与问题相关的)软件包等。
编辑(2):
- 显然我们说的不是同一种语言,因为到目前为止我对你的猜测是错误的……
- 所以我仍然不确定我是否正确地理解了你想告诉我的内容。例如,细胞
NB, SVM, LR, KNN, FR, CNN, RNN, RNN-AM, GRU, LSTM
您喜欢缩短彼此之间的距离。
- 这很容易实现:
{NB\\ SVM\\ LR\\ KNN\\ FR\\ CNN\\ RNN\\ RNN-AM\\ GRU\\ LSTM}
- 您应该在所有其他单元格中执行相同的操作,以便以相同的方式书写缩写。我留给您做的是表格代码的更改。
- 经过这次修正后,您的表格(正如您提供有问题的代码)仍然可以放在一页上:
答案2
我想您的查询标题“增加字体[大小]”可以改为“停止减小字体大小”,因为认真减小字体大小正是这样\resizebox
做的。简而言之:\resizebox
除非您暗自鄙视您的论文的读者,否则不要使用。
由于 7 列中的 6 列似乎需要自动换行,并且表格的长度恰好超过一页,因此我建议您从常规tabular
环境切换到xltabular
环境,并在必要时允许换行。本质上,xltabular
环境是longtable
知道X
列类型的环境。
下面的截图显示了表格的前几行。
\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}