# Tabularx: How to remove extra space in the end of lines

How can I remove the extra space at the end of each line? I want the table to end immediately after the last column and center it afterwards.

\begin{table}[]
\centering

\footnotesize
\begin{center}
\begin{tabularx}{\linewidth}{x x x x x x x}
\toprule
\textbf{Number of Validators} & x & x & x & x & x & x \\
\midrule
\textbf{Number of Shards} & x & x & x & x & x & x \\
\midrule
\textbf{Size of shards} & x & x & x & x & x & x \\
\bottomrule
\end{tabularx}
\end{center}

\caption{Setup with the size of each shard fixed.} \label{table:shards}
\end{table}


• I think this is happening because you have the table set to \linewidth. This means that the table will take up all the space no matter how much text is in it. I think you would get away with {0.5\linewidth} (half the page width). – Plergux Dec 15 '20 at 16:56
• Please, provide a MWE. x columns aren't supported it tabularx by default. – homocomputeris Dec 15 '20 at 17:01
• @Plergux no!... – David Carlisle Dec 15 '20 at 17:06
• Never ignore errors, you must have multiple errors as there is no x column defined so as ususal after an error the PDF is not intended to be usable, just a possible debugging aid. tabularx requires X columns. – David Carlisle Dec 15 '20 at 17:08

There's no real reason to use tabularx for your table. Why not just use a plain tabular ith columns ccccccc?

   \begin{tabular}{ccccccc}
\toprule
\textbf{Number of Validators} & x & x & x & x & x & x \\
\midrule
\textbf{Number of Shards} & x & x & x & x & x & x \\
\midrule
\textbf{Size of shards} & x & x & x & x & x & x \\
\bottomrule
\end{tabular}

• You are absolutely right! Thanks! – Joao Campos Dec 15 '20 at 17:06