3

(Note that I am NOT trying to make a table with equal column spacing.)

Here's a table with 6 columns:

\begin{tabular}{cccccc}
  a&bbbbb&cccccccccc&d&eeeee&ffffffffff\\
  g&hhhh&iiiiiiiii&j&kkkk&lllllllll\\
  m&nnnnn&ooooooooooo&pp&qqqqq&rrrrrrrrr
\end{tabular}

The tabular environment adds some intercolumn spacing, which I can adjust manually by changing \tabcolsep. However, what I need is to be able to set a total width for the table (e.g. 4in). It would then calculate on its own what the intercolumn spacing should be, to achieve a 4-inch table. That is, the widths of each column are subtracted from the total width, and the remainder is split equally among the 5 intercolumn spaces. The columns still have different widths. Is this something that can be easily done with tabular, tabularx, or similar?

1
  • Try \begin{tabularx}{3in}{*{3}{X} ... \end{tabularx}.. If you want the content to be centred, replace X with >{\centering\arraybackslash}X.
    – Bernard
    Commented Oct 31, 2018 at 0:02

1 Answer 1

3

at 10pt the suggested data does not fit in a 3in table, but at \small size it does:

enter image description here

\documentclass{article}

\begin{document}

\rule{3in}{2pt}
\small

\begin{tabular*}{3in}{@{\extracolsep{\fill}}cccccc@{}}
  a&bbbbb&cccccccccc&d&eeeee&ffffffffff\\
  g&hhhh&iiiiiiiii&j&kkkk&lllllllll\\
  m&nnnnn&ooooooooooo&pp&qqqqq&rrrrrrrrr
\end{tabular*}
\end{document}
1
  • That's a fair critique--I just changed it to 4 inches.
    – Adam Smith
    Commented Oct 31, 2018 at 0:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .