As seen with the following example, the `tabular` environment adds some horizontal space after every column. ``` \documentclass{article} \usepackage{booktabs} \begin{document} \begin{tabular}{*{10}{p{0.1\linewidth}}% }% \toprule &&&&&&&&&\\ \midrule &&&&&&&&&\\ &&&&&&&&&\\ &&&&&&&&&\\ \bottomrule \end{tabular} \end{document} ``` Instead of hard-coding the measurements of the columns in my table, I prefer to do it logically. So, if I need four columns of equal widths, I use `{*{4}{p{0.25\linewidth}}}`. The mechanism I need is of the following type: 1. Calculate the number of columns. So, if the argument for `\begin{tabular}` is, say, `{p{0.2\linewidth}*{2}{p{0.4\linewidth}}}`, first the algorithm should recognize that there are three columns used here. 1. Calculate the total "additional" width caused by those many columns. So, for example, in the example given above, there are three columns. So, if the distance added after one column is `x em`, the total distance should be `3x em`. 1. Deduct `3x em` from the `\linewidth` parameter. 1. Calculate `{p{0.2\linewidth}*{2}{p{0.4\linewidth}}}` **now** (i.e., after all this calculation done in 1 -- 3). Is this possible? Is it already implemented? I like to use as less packages as possible, so I would want to avoid new fancy table-packages. PS: @Skillmon, consider this as a feature request for your tabular implementation :P

You don't need to calculate the space which `tabular` inserts in front and after your columns, it is readily available in `\tabcolsep`. However I don't think calculating the widths of your columns is worth the effort. Even if you don't want to use the "new fancy table-packages", a simple `tabularx` will happily calculate appropriate column widths for you: ``` \documentclass{article} \usepackage{booktabs} \usepackage{tabularx} \usepackage{parskip} \usepackage{array} \newcolumntype{q}[1]{p{\dimexpr#1-2\tabcolsep}} \begin{document} \noindent\rule{\linewidth}{1pt} \section{Calculate widths manually:} \begin{tabular}{*{10}{p{\dimexpr0.1\linewidth-2\tabcolsep}}% }% \toprule a&dddd&eeee&f&dd&s&s&e&f&e\\ \bottomrule \end{tabular} \section{A new column type:} \begin{tabular}{*{10}{q{0.1\linewidth}}% }% \toprule a&dddd&eeee&f&dd&s&s&e&f&e\\ \bottomrule \end{tabular} \begin{tabular}{q{0.2\linewidth} *{2}{q{0.4\linewidth}}% }% \toprule a&dddd&eeee\\ \bottomrule \end{tabular} \section{Let tabularx do its job:} \begin{tabularx}{\linewidth}{*{10}{X}% }% \toprule a&dddd&eeee&f&dd&s&s&e&f&e\\ \bottomrule \end{tabularx} \begin{tabularx}{\textwidth}{>{\hsize=0.6\hsize}X *{2}{>{\hsize=1.2\hsize}X} } \toprule a&dddd&eeee\\ \bottomrule \end{tabularx} \end{document} ``` ![Screenshot 2023-07-11 at 12.01.59.png](/image?hash=04f1a60f4e69a39ac5fb049a7860a5337a429105efcf40e7dca081af1e092a04)