Received: by nummer-3.proteosys id <01C19443.46B02674@nummer-3.proteosys>; Thu, 3 Jan 2002 11:42:01 +0100 MIME-Version: 1.0 x-vm-v5-data: ([nil nil nil nil nil nil nil t nil][nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil]) Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C19443.46B02674" X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message Subject: RE: Should tables expand to width of text-column? Date: Sat, 7 Sep 1991 01:00:00 +0100 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: From: Sender: "LaTeX-L Mailing list" To: "Rainer M. Schoepf" Reply-To: "LaTeX-L Mailing list" Status: R X-Status: X-Keywords: X-UID: 380 This is a multi-part message in MIME format. ------_=_NextPart_001_01C19443.46B02674 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable [Taylor's pragmatic approach: ``never mind what the design gurus say --- here's some code that does what is required ...''] \newif \iferrornegative \newcount \percentage \newdimen \width \newdimen \deltatablewidth \newdimen \deltatabcolsep \newdimen \resultingerror \def \fractionof {0.618} % the default case \def \tabularstart #1\tabularstop #2% {\begingroup \ifdim \hsize < \textwidth \let \datum =3D \hsize \else \let \datum =3D \textwidth \fi \message {T} \setbox 0 =3D \hbox {\hbadness =3D \maxdimen \starttabular = #1\stoptabular #2}% \width =3D \wd 0 \deltatabcolsep =3D 1 sp \advance \tabcolsep by \deltatabcolsep \ifdim \wd 0 > \fractionof \datum % \loop % \setbox 0 =3D \hbox {\hbadness =3D \maxdimen \starttabular #1\stoptabular = #2}% \deltatablewidth =3D \wd 0 \advance \deltatablewidth by -\width \width =3D \wd 0 \resultingerror =3D \width \advance \resultingerror by -\datum \ifdim \resultingerror < 0 pt \resultingerror =3D -\resultingerror \errornegativetrue \else \errornegativefalse \fi \ifdim \resultingerror > \hfuzz \iferrornegative \message {-} \resultingerror =3D -\resultingerror \else \message {+} \fi \divide \deltatablewidth by \deltatabcolsep \divide \resultingerror by \deltatablewidth \deltatabcolsep =3D -\resultingerror \advance \tabcolsep by \deltatabcolsep \repeat \else \begingroup \percentage =3D \wd 0 \divide \datum by 100 \divide \percentage by \datum \endgroup \fi \ifdim \tabcolsep < 1 \jot \message {WARNING: \noexpand \tabcolsep less than 1 \noexpand = \jot at line: \the \inputlineno \space (\the = \tabcolsep)} \fi \starttabular #1\stoptabular #2 %%% And this line sets the table \endgroup #2} \def \tabularstop {\stoptabular} ------_=_NextPart_001_01C19443.46B02674 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable RE: Should tables expand to width of text-column?

[Taylor's pragmatic approach: ``never mind what the = design gurus say ---
 here's some code that does what is required = ...'']

\newif \iferrornegative

\newcount \percentage

\newdimen \width
\newdimen \deltatablewidth
\newdimen \deltatabcolsep
\newdimen \resultingerror

\def \fractionof {0.618} % the default case

\def \tabularstart #1\tabularstop #2%
{\begingroup
 \ifdim \hsize < \textwidth
        \let = \datum =3D \hsize
 \else
        \let = \datum =3D \textwidth
 \fi
 \message {T}
 \setbox 0 =3D \hbox {\hbadness =3D \maxdimen = \starttabular #1\stoptabular #2}%
 \width =3D \wd 0
 \deltatabcolsep =3D 1 sp
 \advance \tabcolsep by \deltatabcolsep
 \ifdim \wd 0 > \fractionof \datum
%
        = \loop
%
          &nbs= p;     \setbox 0 =3D \hbox {\hbadness =3D = \maxdimen
          &nbs= p;            = ;            =      \starttabular #1\stoptabular #2}%
          &nbs= p;     \deltatablewidth =3D \wd 0
          &nbs= p;     \advance \deltatablewidth by -\width
          &nbs= p;     \width =3D \wd 0
          &nbs= p;     \resultingerror =3D \width
          &nbs= p;     \advance \resultingerror by -\datum
          &nbs= p;     \ifdim   \resultingerror < 0 = pt
          &nbs= p;            = ;  \resultingerror =3D -\resultingerror
          &nbs= p;            = ;  \errornegativetrue
          &nbs= p;     \else
          &nbs= p;            = ;  \errornegativefalse
          &nbs= p;     \fi
        = \ifdim  \resultingerror > \hfuzz
          &nbs= p;     \iferrornegative
          &nbs= p;            = ; \message {-}
          &nbs= p;            = ; \resultingerror =3D -\resultingerror
          &nbs= p;     \else
          &nbs= p;            = ; \message {+}
          &nbs= p;     \fi
          &nbs= p;     \divide \deltatablewidth by = \deltatabcolsep
          &nbs= p;     \divide \resultingerror by = \deltatablewidth
          &nbs= p;     \deltatabcolsep =3D -\resultingerror
          &nbs= p;     \advance \tabcolsep by \deltatabcolsep
        = \repeat
\else
        = \begingroup
          &nbs= p;     \percentage =3D \wd 0
          &nbs= p;     \divide \datum by 100
          &nbs= p;     \divide \percentage by \datum
        = \endgroup
\fi
\ifdim  \tabcolsep < 1 \jot
        \message = {WARNING: \noexpand \tabcolsep less than 1 \noexpand \jot
          &nbs= p;            = ; at line: \the \inputlineno \space (\the \tabcolsep)}
\fi
\starttabular #1\stoptabular #2 %%% And this line = sets the table
\endgroup
#2}

\def \tabularstop {\stoptabular}


------_=_NextPart_001_01C19443.46B02674--