我准备了一个小型 MWE 来复制我遇到的问题。如何正确地将 IEEE 出版物的表格标题居中?
以下不正确行为:
以下正确行为我在寻找:
以下是我目前所做的工作:
\documentclass{ieeetran}
\usepackage{ragged2e}
\usepackage{booktabs, makecell,
tabularx} % added
\newcolumntype{L}[1]{>{\RaggedRight\hspace{0pt}%
\hsize=#1\hsize}X} % new
\usepackage{siunitx} % consider is v3
\begin{document}
% Paragraphs...
\begin{table*}
\caption{Ranking of research methodologies for QUERY-1}
\setlength{\tabcolsep}{4pt}
\setcellgapes{3pt}
\makegapedcells
\begin{tabularx}{\linewidth}{@{} >{\itshape}L{0.9}cc cL{1.1}c}
% \begin{tabularx}{\textwidth}{@{}l*{10}{C}c@{}}
\toprule
\multicolumn{2}{@{} l}{Breakdown of research methodologies} \\
\midrule
\normalfont{Criterion 1}
& Criterion 2 & Criterion 3 & Classification & Papers using the research method \\
\midrule
Analytical
& Qualitative & Conceptual & Literature review & 21 \\
Analytical
& Qualitative & Conceptual & Literature review & 21 \\
Analytical
& Qualitative & Conceptual & Literature review & 21 \\
Analytical
& Qualitative & Conceptual & Literature review & 21 \\
Analytical
& Qualitative & Conceptual & Literature review & 21 \\
Empirical
& Qualitative & Conceptual & Literature review & 21 \\
Empirical
& Qualitative & Conceptual & Literature review & 21 \\
Empirical
& Qualitative & Conceptual & Literature review & 21 \\
Empirical
& Qualitative & Conceptual & Literature review & 21 \\
Empirical
& Qualitative & Conceptual & Literature review & 21 \\
\bottomrule
\end{tabularx}
\end{table*}
为了解决这个问题,我尝试了几种解决方案,我发现此来源,其他来源。为了更加精确,我尝试了以下方法:
\begin{table*}
\centering
\begin{tabularx}{|p{2.5cm}|p{2.5cm}|p{2.5cm}|p{2.5cm}|p{2.5cm}|}
但这并不像帖子中描述的那样有效。但我也尝试了另一种方法,这是一种更通用的方法,如下所示:
\begin{table}
\centering
\begin{tabularx}{|c|c|c|c|c|}
所有解决方案均未给我带来预期的行为。请指出正确的方向以找到解决此问题的方法。
編輯
根据用户的建议,为了正确地将标题对齐到中间,应该在开始时进行以下修改:
\begin{table*}
\caption{Ranking of research methodologies for QUERY-1}
\setlength{\tabcolsep}{4pt}
\setcellgapes{3pt}
\makegapedcells
\begin{tabularx}{\linewidth}{@{}X !{\qquad}Xc!{\qquad}Xc!{\qquad}Xc}
% Table stuff...
\bottomrule
\end{tabularx}
\end{table*}
然而,列之间的额外空间仍然存在,正如你在下面看到的,这仍然是不正确行为,因为我正在寻找一个更简洁的表格,正如我在问题中所展示的那样。
答案1
表格占用了页面的整个宽度,因此必须把多余的空间放到某处。
具有相同宽度的列间距可以使分布更加美观。
\documentclass{ieeetran}
\usepackage{ragged2e}
\usepackage{booktabs, makecell, tabularx} % added
\newcolumntype{L}[1]{>{\RaggedRight\hspace{0pt} \hsize=#1\hsize}X} % new
\usepackage{siunitx} % consider is v3
\newcolumntype{Y}{>{\centering\arraybackslash}X}% added <<<<<<<<<<
\begin{document}
\begin{table*}
\caption{Ranking of research methodologies for QUERY-1}
\setlength{\tabcolsep}{4pt}
\setcellgapes{3pt}
\makegapedcells
\begin{tabularx}{\linewidth}{@{} XXXX Y}% changed <<<<
\toprule
\multicolumn{2}{@{} l}{Breakdown of research methodologies} \\
\midrule
\normalfont{Criterion 1}
& Criterion 2 & Criterion 3 & Classification & Nro papers \\
\midrule
Analytical
& Qualitative & Conceptual & Literature review & 21 \\
Analytical
& Qualitative & Conceptual & Literature review & 21 \\
Analytical
& Qualitative & Conceptual & Literature review & 21 \\
Analytical
& Qualitative & Conceptual & Literature review & 21 \\
Analytical
& Qualitative & Conceptual & Literature review & 21 \\
Empirical
& Qualitative & Conceptual & Literature review & 21 \\
Empirical
& Qualitative & Conceptual & Literature review & 21 \\
Empirical
& Qualitative & Conceptual & Literature review & 21 \\
Empirical
& Qualitative & Conceptual & Literature review & 21 \\
Empirical
& Qualitative & Conceptual & Literature review & 21 \\
\bottomrule
\end{tabularx}
\end{table*}
\end{document}
而是使用\begin{tabularx}{\linewidth}{@{} XXXX c}
(以及最后一列的较长标题),您将得到一个类似于问题中显示的表格。
答案2
此版本使用表格*。它均衡了列之间的间隙。
\documentclass{ieeetran}
\usepackage{booktabs}
\usepackage{siunitx} % consider is v3
\usepackage{lipsum}% MWE only
\begin{document}
% Paragraphs...
\begin{table*}
\caption{Ranking of research methodologies for QUERY-1}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} ccccc @{}}
%\begin{tabularx}{\textwidth}{@{}l*{10}{C}c@{}}
\toprule
\multicolumn{2}{@{}l}{Breakdown of research methodologies} \\
\midrule
{\normalfont Criterion 1}
& Criterion 2 & Criterion 3 & Classification & Papers using the research method \\
\midrule
Analytical
& Qualitative & Conceptual & Literature review & 21 \\
Analytical
& Qualitative & Conceptual & Literature review & 21 \\
Analytical
& Qualitative & Conceptual & Literature review & 21 \\
Analytical
& Qualitative & Conceptual & Literature review & 21 \\
Analytical
& Qualitative & Conceptual & Literature review & 21 \\
Empirical
& Qualitative & Conceptual & Literature review & 21 \\
Empirical
& Qualitative & Conceptual & Literature review & 21 \\
Empirical
& Qualitative & Conceptual & Literature review & 21 \\
Empirical
& Qualitative & Conceptual & Literature review & 21 \\
Empirical
& Qualitative & Conceptual & Literature review & 21 \\
\bottomrule
\end{tabular*}
\end{table*}
\lipsum[1-16]
\end{document}