What I have is a table that should stretch to the text width and want a specific column to stretch. What I have now is

\begin{tabular*}{\textwidth}{ll r@{.}l l r@{.}l r@{.}l}

What I want is that all columns except one (the second) should have prescribed width and the second column have whatever width that's needed for the table to add up to \textwidth

  • 4
    You seem to be looking for tabularx, where the X columns have this property. E.g.\documentclass{article} \usepackage{tabularx} \begin{document} \begin{tabularx}{\textwidth}{lX r@{.}l l r@{.}l r@{.}l} A & B & C & D & E & F & G\\ \end{tabularx} \end{document} – marmot Feb 7 at 5:02
  • @marmot does the tabularx stretches the specific column? I thought it, by itself, renders the table to span an entire column. I did not knew it stretch a single column :D – Raaja Feb 7 at 7:26
  • @Raaja Yes, I think so. You can just run the code to check. – marmot Feb 7 at 7:29
  • @marmot Atleast works for me ;) (may be you should make that as the answer imo) – Raaja Feb 7 at 7:55
  • @marmot Yes, I think that would answer the question as asked. A bonus would be if you have a solution to fulfill the intent too (to have the other columns have prescribed width, for example I want the first column to be say 42mm wide etc). – skyking Feb 7 at 8:54

The tabularx package allows you to typeset tables with one or more columns of type X, which stretch to the available space. Columns of fixed width w can be obtained with p{w} where w is length. By default, the stuff in these columns is left-aligned, but you can change this as the following shows.

A & B & C & D & E & F & G\\ 

enter image description here

The vertical delimiters are only introduced for illustration. Of course, there is much more one could say about tables, and this site is full of examples.

This site is temporarily in read only mode and not accepting new answers.

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