[texhax] tabular, tabulary, tabularx, tabular* vs. rubber length ---> tabrule environment

Johan Glimming glimming at kth.se
Thu Mar 3 16:30:55 CET 2005


Robin,

> try \begin{tabulary}{\linewidth}{@{}CCC@{}} A & B & C \end{tabulary}

I have understood the @ symbol here now, but I have problem as follows. 
I want to have a rubber length also before the first column and after 
the last column, in cases such as

  a              &             b
|______________________________|

I want instead

        a        &        b
|______________________________|

I would like to add a first and last column but hide it so that
there is automatically an extra & at the start of each line, or, 
alternatively, maybe there is an easier way to achieve a rubber space 
here?

My current code is (see here that I have chosen to constrain the 
linewidth instead, but this is not a good solution since I do not want 
to manually fiddle with this setting for each tabs environment of the 
above mentioned form):

\newlength\tabsvspace
\setlength\tabsvspace{10pt}
\newlength\temptabs
\newcommand\tabshspace{9/10}

\newenvironment{tabs}[1][1]
  {\centering
   % Use 90% of \linewidth by default, change
   % \tabslength to other values to change it
   \setlength\temptabs{\linewidth*\tabshspace}
   \par\noindent
   \begin{tabular*}{\temptabs}{%
      @{}*{#1}{
         l
         @{\extracolsep{\fill}}
      }!{\vspace{\tabsvspace}}@{}}}
      % above: add extra space between rows
  {\end{tabular*}\par}

End of hack.

Johan Glimming.



More information about the texhax mailing list