[Tex/LaTex] Last column in a table is too wide

tablestabularx

I have been trying to create a table detailing the changes in speed over time, and have noticed that the last column (22 seconds) is disproportionately wide. Is there any way I can reduce the size of it so that it is the same width as the others?

\begin{center}
\begin{tabularx}{\columnwidth}{|l|l|l|l|l|l|l|l|l|l|l|l|X|}
\hline
Time (sec)    & 0  & 2  & 4  & 6  & 8  & 10 & 12 & 14 & 16 & 18 & 20 & 22 \\
 \hline
Speed (m/sec) & 10 & 14 & 20 & 24 & 22 & 18 & 16 & 15 & 14 & 14 & 13 & 11 \\
 \hline
\end{tabularx}
\end{center}\\

Best Answer

If you want the table to span a certain width, e.g., the width of the text block, but don't need (or want) all columns to be equally wide, you could employ a tabular* environment instead of the tabularx environment you're using at the moment. (The directive @{\extracolsep{\fill}} serves to insert additional intercolumn whitespace.)

enter image description here

\documentclass{article}
\begin{document}
\noindent
\begin{tabular*}{\columnwidth}{ @{\extracolsep{\fill}} |l| *{12}{l|} }
\hline
Time (sec)    & 0  & 2  & 4  & 6  & 8  & 10 & 12 & 14 & 16 & 18 & 20 & 22 \\
 \hline
Speed (m/sec) & 10 & 14 & 20 & 24 & 22 & 18 & 16 & 15 & 14 & 14 & 13 & 11 \\
 \hline
\end{tabular*}
\end{document}

Echoing the comments made by @BenediktBauer in his answer, you may want to give some serious thought to omitting all vertical bars -- trust me, they add clutter rather than provide clarity -- and to replacing the \hline directives with the macros of the booktabs package, as they produce horizontal lines with much improved spacing properties.

enter image description here

\documentclass{article}
\usepackage{booktabs}
\begin{document}
\setlength\tabcolsep{0.1pt} % let tabular* figure out the intercolumn separation
\noindent
\begin{tabular*}{\columnwidth}{ @{} l @{\extracolsep{\fill}} *{12}{r} @{}}
\toprule
Time (sec)    & 0  & 2  & 4  & 6  & 8  & 10 & 12 & 14 & 16 & 18 & 20 & 22 \\
\midrule
Speed (m/sec) & 10 & 14 & 20 & 24 & 22 & 18 & 16 & 15 & 14 & 14 & 13 & 11 \\
\bottomrule
\end{tabular*}
\end{document}