0

I prepared a small MWE that replicates the problem I am having. How do I properly center the header of a table for an IEEE publication?

Below the incorrect behavior:

enter image description here

Below the correct behavior I am looking for:

enter image description here

Below what I have done so far:

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

In order to solve the problem I tried several solutions I found int this source, this other source. In order to be even more precise this is what I tried:

\begin{table*}
  \centering
  \begin{tabularx}{|p{2.5cm}|p{2.5cm}|p{2.5cm}|p{2.5cm}|p{2.5cm}|}

But that didn't work as the post described. But also I tried another approach, which is a more general approach see below:

\begin{table}
 \centering
 \begin{tabularx}{|c|c|c|c|c|}

None of the solution gave me the expected behavior. Please point to the right direction to find a solution to this issue.

EDITS

As advised by a user, in order to properly align the header in the middle the following modification should be introduced at the beginning:

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

However, the extra space between the column still persists and as you see below this is still the incorrect behavior as I am looking for a more condensed table as I show in the question.

enter image description here

Emanuele
  • 143
  • 2
    If IEEE publication use ieeetran document class, neither examples are correct. Don't reformat caption style, which is determined by their document class. – Zarko Jul 01 '21 at 22:05
  • Thanks for reading the question. Based on your comment I switched the beginning \documentclass{ieeetran} with \documentclass[conference]{IEEEtran} but that also didn't solve the problem. Is that what you were referring to? – Emanuele Jul 01 '21 at 22:17
  • 2
    Even if you are able to modify the caption, IEEE will make you change it back again. – John Kormylo Jul 02 '21 at 03:25
  • I see, so what can I do to solve this issue? I just think that the misalignment is very strange especially after I seem to have everything almost correct. – Emanuele Jul 02 '21 at 12:19
  • Technically speaking I can't see the mistake I am making. Therefore I don't understand this strange behavior. Any suggestions? – Emanuele Jul 02 '21 at 12:29
  • As for the strange behavior, your L column is basically and X column with \RaggedRight. They are taking up most of the space and are not centered just the way they are supposed to. Might I suggest using \tabular* with \extracolsep and lose the L columns. – John Kormylo Jul 02 '21 at 15:32
  • Thanks the problem is almost solved. I updated the question with your suggestions. As you see here everything is now properly aligned :). But why do I have the extra space and how do I make the table more condensed like the one I show in the question? – Emanuele Jul 02 '21 at 17:12

2 Answers2

1

The table uses the entire width of the page, so the extra space has to go somewhere.

Having inter columns spaces of equal width gives a more pleasant distribution.

x

\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
    &amp; Qualitative &amp; Conceptual &amp; Literature review &amp; 21 \\

    Analytical
    &amp; Qualitative &amp; Conceptual &amp; Literature review &amp; 21 \\

    Analytical
    &amp; Qualitative &amp; Conceptual &amp; Literature review &amp; 21 \\

    Analytical
    &amp; Qualitative &amp; Conceptual &amp; Literature review &amp; 21 \\

    Empirical
    &amp; Qualitative &amp; Conceptual &amp; Literature review &amp; 21 \\

    Empirical
    &amp; Qualitative &amp; Conceptual &amp; Literature review &amp; 21 \\

    Empirical
    &amp; Qualitative &amp; Conceptual &amp; Literature review &amp; 21 \\

    Empirical
    &amp; Qualitative &amp; Conceptual &amp; Literature review &amp; 21 \\

    Empirical
    &amp; Qualitative &amp; Conceptual &amp; Literature review &amp; 21 \\
    \bottomrule
\end{tabularx}

\end{table*}

\end{document}

Using instead \begin{tabularx}{\linewidth}{@{} XXXX c} (and the longer header of the last column} you get a table similar to the one shown in the question.

y

Simon Dispa
  • 39,141
1

This version uses tabular*. It equalizes the gaps between the columns.

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

demo

John Kormylo
  • 79,712
  • 3
  • 50
  • 120