I have a table in which the header is making the last column too wide. How do I avoid this situation?
\documentclass{amsart}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{array}
\usepackage{makecell}
\setlength{\oddsidemargin}{0.0in}
\setlength{\evensidemargin}{0.0in} \setlength{\textwidth}{6.1in}
\setlength{\topmargin}{0.0in} \setlength{\textheight}{9in}
\begin{document}
\setlength\extrarowheight{2pt}
\begin{tabular}{|| c !{\vrule width0.8pt}c | c | c | c | c | c | c | c | c ||} \hline
\multicolumn{10}{|| c ||}{{\textbf{Force in newtons required to move an object \boldmath$x$ meters\unboldmath}}} \\ \Xhline{0.8pt}
$x$ & 4 & 6 & 8 & 10 & 12 & 14 & 16 & 18 & 20 \\ \hline
$f(x)$ & 5 & 5.8 & 7 & 8.8 & 9.6 & 8.2 & 6.7 & 5.2 & 4.1 \\ \hline
\end{tabular}
\end{document}
Best Answer
I suggest you use a
tabularx
environment instead of the basictabular
environment. Moreover, I think the nine data columns should have equal widths. Use a\settowidth
instruction to calculate the required width of thetabularx
. You may also want to get rid of all vertical lines, to give the table a more "open" look.Addendum to address the OP's follow-up comment: If you do want the vertical bars, you can't use the line-drawing macros of the
booktabs
package. Instead, I suggest you insert (typographic) struts to provide a bit more vertical whitespace.