1

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
\linespread{1}\selectfont
    \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}

enter image description here

4
  • 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
  • 1
    Please, provide a MWE. x columns aren't supported it tabularx by default. – homocomputeris Dec 15 '20 at 17:01
  • 1
    @Plergux no!... – David Carlisle Dec 15 '20 at 17:06
  • 1
    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
1

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}
1
  • You are absolutely right! Thanks! – Joao Campos Dec 15 '20 at 17:06

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.