0

Problem:

I am using the IEEE template for conference papers and do not manage to fill out the right part of a table in a way that makes the table look centered.

Minimal Working Example (MWE):

\documentclass[conference]{IEEEtran}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{blindtext}

\begin{document}

\title{Title}

\author{
\IEEEauthorblockN{Author 1}
\IEEEauthorblockA{\textit{Affiliation} \\
City, Country \\
E-mail}
\and
\IEEEauthorblockN{Author 2}
\IEEEauthorblockA{\textit{Affiliation}\\
City, Country \\
E-mail}
}

\maketitle

\begin{abstract}
\blindtext[1]
\end{abstract}

\begin{IEEEkeywords}
keywords
\end{IEEEkeywords}

\section{Chapter 1}
\blindtext
\section{Chapter 2}
\blindtext
\section{Chapter 3}
\blindtext
\begin{table}[htbp]
\caption{Caption text here}
\begin{tabularx}{\linewidth}{cccc}
\toprule
\multicolumn{4}{c}{\textbf{Main headline for countries}}\\
\midrule
\multicolumn{2}{c}{\textbf{Country 1}} & \multicolumn{2}{c}{\textbf{Country 2}} \\
\midrule
Description Country 1 & \# & Description Country 2 & \# \\
\midrule
text & 12 & text text text & 11 \\
text text text & 11 & text text text & 9 \\
text text & 10 & text text & 8 \\
text text & 8 & text text text & 8 \\
text text text & 7 & text text & 5 \\
text text text & 6 & text text & 1 \\
text text text & 1 & text text text text & 1 \\
text text & 1 & & \\
\bottomrule
\end{tabularx}
\end{table}

\end{document}

CLS file for IEEE is available here (was too big to include here):

https://www.ieee.org/content/dam/ieee-org/ieee/web/org/conferences/Conference-LaTeX-template_7-9-18.zip

Current output:

enter image description here

Desired output:

To fill out/center the content inside the table in a way that it does not leave space on the right side of the table.

1

It have no sense a tabularx table without any X column.

\begin{tabularx}{\linewidth}{cccc}

Simply change that line by

\begin{tabularx}{\linewidth}{{\centering}Xc>{\centering}Xc}

And you have exactly what you want, but IMHO it could better do not center the text columns:

\begin{tabularx}{\linewidth}{XcXc}

mwe

I also will change the seconc \midrule by:

\cmidrule(rl){1-2}\cmidrule(rl){3-4}

or maybe increase \tabcolsep and/or insert a third empty column:

%\tabcolsep1em
\begin{tabularx}{\linewidth}{@{}XccXc@{}}
\toprule
\multicolumn{5}{c}{\textbf{Main headline for countries}}\\
\midrule
\multicolumn{2}{c}{\textbf{Country 1}} && \multicolumn{2}{c}{\textbf{Country 2}} \\
\cmidrule(r){1-2}\cmidrule(l){4-5}
Description Country 1 & \# && Description Country 2 & \# \\
\midrule
text           & 12 &&  text text text & 11 \\
...

mwe

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.