[texhax] variable number of columns in a longtable

Susan Dittmar SDittmar at eureca.de
Thu May 8 13:32:06 CEST 2008


Hi,

I would like to use the same document for two output formats, both
generated with LaTeX. One of the differences is the number of columns in
one longtable.

What I have right now (stripped down of course):

--------------------
\documentclass{scrartcl}
\usepackage{longtable}
\begin{document}

\makeatletter
\newif\if at SHORT
% only the short column (does not work):
%\@SHORTtrue
% two columns instead (seems to work):
\@SHORTfalse

\if at SHORT\longtable{|l|l|}\else\longtable{|l|l|l|}\fi
\hline
\endhead
\endfoot
main column
& \if at SHORT
    only one additional column
  \else
      first  additional column
    & second additional column
  \fi
\\\hline
\endlongtable
\end{document}
---------------

I think I understand why it does not work (it seems OK if you generate the
long version, but its flaw shows itself for the short version).

Any ideas how I could make this work?

Thanks a lot for your help,

	Susan


More information about the texhax mailing list