summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/widetable
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-06-28 21:07:30 +0000
committerKarl Berry <karl@freefriends.org>2019-06-28 21:07:30 +0000
commit06d8049b6815d93618978b4b921f2dc85fb63498 (patch)
treec10c195ba515653622718295d7c281543bb700f1 /Master/texmf-dist/tex/latex/widetable
parent6677e7d16babf1c0596fd30f9aeb6b13433725cd (diff)
widetable (28jun19)
git-svn-id: svn://tug.org/texlive/trunk@51501 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/widetable')
-rw-r--r--Master/texmf-dist/tex/latex/widetable/widetable.sty112
1 files changed, 28 insertions, 84 deletions
diff --git a/Master/texmf-dist/tex/latex/widetable/widetable.sty b/Master/texmf-dist/tex/latex/widetable/widetable.sty
index 314f513b659..0e8a755a0e6 100644
--- a/Master/texmf-dist/tex/latex/widetable/widetable.sty
+++ b/Master/texmf-dist/tex/latex/widetable/widetable.sty
@@ -7,102 +7,47 @@
%% widetable.dtx (with options: `package')
%% ______________________________________________________
%% The WIDETABLE bundle
-%% Copyright (C) 2009-2018 Claudio Beccari
+%% Copyright (C) 2009-2019 Claudio Beccari
%% All rights reserved
%%
%% License information appended
%%
+\NeedsTeXFormat{LaTeX2e}[2016/01/01]
\ProvidesPackage{widetable}%
- [2018-12-14 v.1.5 Package for typesetting specified width tables]
-\NeedsTeXFormat{LaTeX2e}[2018/01/01]
-\AtBeginDocument{%
- \@ifpackageloaded{array}{}{\RequirePackage{array}}%
- }
-\dimendef\wt@Numer=2
-\dimendef\wt@Denom=4
-\countdef\wt@Num=2
-\countdef\wt@Den=4
-\RequirePackage{xparse}
-\newcommand\WT@scale[4]{\begingroup
-\wt@Num #2\relax \wt@Den #3\relax
-\ifnum#3=\z@
- \@tempdima\ifnum#2<0-\fi\maxdimen
-\else
- \@tempdima\dimexpr#1*#2/#3\relax
-\fi
-\edef\x{\noexpand\endgroup\noexpand\setlength{#4}{\the\@tempdima}}%
-\x}
-\newdimen\wt@width
-\newif\ifwt@scartare\wt@scartarefalse
+ [2019-06-25 v.2.0 Package for typesetting specified width tables]
-\DeclareDocumentCommand\widetable{m O{c} m}
-{% OPENING WIDETABLE
- \def\@tempC{widetable}%
- \setlength{\wt@width}{#1}%
- \def\wt@preamble{#3}%
- \def\wt@starttabular{\tabular[#2]{#3}}%
- \wt@getTable}%
-\def\endwidetable{% CLOSING WIDETABLE
- \ifwt@scartare
- \noindent\null
- \else
+\ProvidesPackage{widetable}[2019-06-24 v.1.5 A simpler way to produce
+ tables of specified width]
+\RequirePackage{xparse}[2019-05-01]
+\DeclareDocumentEnvironment{widetable}{m O{c} m +b}
+{% OPENING WIDETABLE COMMANDS
+}%
+{% CLOSING WIDETABLE
+ \dimen0=#1 % required width
\tabcolsep=\z@
- \setbox\z@=\hbox{\wt@starttabular\the\toks@\endtabular}%
+ \setbox\z@=\hbox{\tabular{#3}#4\endtabular}%
\tabcolsep=6pt\relax
- \setbox\tw@=\hbox{\wt@starttabular\the\toks@\endtabular}%
- \ifdim\wt@width<\wd\z@
- \@tempdimb=\dimexpr\wd\tw@-\wd\z@\relax
- \PackageWarning{widetable}{%
- The natural width \the\wd\z@ \space of the tabular\MessageBreak
- material is larger than the specified width
- \the\wt@width.\MessageBreak\MessageBreak
- The table is typeset with the default\MessageBreak
- column spacing}%
+ \setbox\tw@=\hbox{\tabular{#3}#4\endtabular}%
+ \ifdim\dimen0>\wd\z@
+ \tabcolsep=\dimexpr \tabcolsep*(\dimen0-\wd\z@)/(\wd\tw@-\wd\z@)\relax
\else
- \@tempdimb=\dimexpr\wt@width-\wd\z@\relax
+ \ifdim\dimen0<\wd\z@
+ \PackageWarning{widetable}{%
+ The minimum width of the tabular material\MessageBreak
+ amounts to \the\wd\z@, and is larger\MessageBreak
+ than the required width of \the\dimen0\MessageBreak
+ \MessageBreak
+ The table is typeset with the default\MessageBreak
+ column spacing}%
+ \fi
\fi
- \@tempdimc=\dimexpr\wd\tw@-\wd\z@\relax
- \WT@scale{\tabcolsep}{\@tempdimb}{\@tempdimc}{\tabcolsep}\relax
- \wt@starttabular\the\toks@\endtabular
- \fi
+ \tabular[#2]{#3}#4\endtabular
\ignorespacesafterend
}
-\def\wt@finetabella{\end{widetable}}%
-
-\def\wt@getTable#1\end#2{\def\@tempB{#2}%
- \ifx\@tempB\@tempC
- \toks@={#1}%
- \expandafter\wt@finetabella
- \else
- \PackageWarning{widetable}{%
- The table contains environment `\@tempB' %
- \MessageBreak
- not enclosed in braces. This is expressly forbidden!%
- \MessageBreak
- The table is not typeset and is substituted%
- \MessageBreak
- with a framed box}%
- \advance\wt@width-2\fboxsep
- \noindent\fbox{\parbox{\wt@width}{The table was not typeset
- because it contains a visible \texttt{\char`\\end} in one
- or more cells.}}\par
- \expandafter\wt@finishTable
- \fi
-}
-
-\def\wt@finishTable#1\end#2{%
- \def\@tempB{#2}%
- \ifx\@tempB\@tempC
- \wt@scartaretrue\expandafter\wt@finetabella
- \else
- \expandafter\wt@finishTable
- \fi
-}
-
%%
-%% Copyright 2009-2017 Claudio Beccari
+%% Copyright 2009-2019 Claudio Beccari
%%
%% Distributable under the LaTeX Project Public License,
%% version 1.3c or higher (your choice). The latest version of
@@ -115,9 +60,8 @@
%% widetable.sty and widetable.pdf.
%%
%%
-%% By running pdflatex on widetable.dtx the user gets the sty
-%% file and the English documentation file in
-%% PDF format.
+%% By running pdflatex on widetable.dtx the user gets both
+%% the sty file and the English documentation PDF file.
%%
%%
%% End of file `widetable.sty'.