From 6587e7ce1fe72e0bb5e1e366de980cd60b259621 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 6 Sep 2017 22:07:49 +0000 Subject: widetable (6sep17) git-svn-id: svn://tug.org/texlive/trunk@45231 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/tex/latex/widetable/widetable.sty | 152 ++++++++------------- 1 file changed, 58 insertions(+), 94 deletions(-) (limited to 'Master/texmf-dist/tex/latex/widetable') diff --git a/Master/texmf-dist/tex/latex/widetable/widetable.sty b/Master/texmf-dist/tex/latex/widetable/widetable.sty index 499f033ccdc..71d5b01ca98 100644 --- a/Master/texmf-dist/tex/latex/widetable/widetable.sty +++ b/Master/texmf-dist/tex/latex/widetable/widetable.sty @@ -5,119 +5,65 @@ %% The original source files were: %% %% widetable.dtx (with options: `package') +%% ______________________________________________________ +%% The WIDETABLE bundle +%% Copyright (C) 2009-2017 Claudio Beccari +%% All rights reserved %% -%% Copyright 2009 Claudio Beccari +%% License information appended %% -%% This package is distributed in the hope that it will be useful, -%% but WITHOUT ANY WARRANTY; without even the implied warranty of -%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -%% -%% This work may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3 -%% of this license or (at your option) any later version. -%% The latest version of this license is in -%% http://www.latex-project.org/lppl.txt -%% and version 1.3 or later is part of all distributions of LaTeX -%% version 2003/12/01 or later. -%% -%% This work has the LPPL maintenance status "maintained". -%% -%% The Current Maintainer of this work is Claudio Beccari -%% -\NeedsTeXFormat{LaTeX2e}[2005/12/01] + +\NeedsTeXFormat{LaTeX2e}[2016/01/01] \ProvidesPackage{widetable}% - [2009/10/26 v.1.1 Package for typesetting specified width tables] + [2017/09/05 v.1.2 Package for typesetting specified width tables] + +\ProvidesPackage{widetable}[2017/09/05 v.1.2 A simpler way to produce + tables of specified width] \dimendef\wt@Numer=2 \dimendef\wt@Denom=4 \countdef\wt@Num=2 \countdef\wt@Den=4 -\countdef\wt@I=6 -\def\wt@segno{} - -\newif\ifm@mifetex - \m@mifetexfalse -\IfFileExists{ifetex.sty}{\RequirePackage{ifetex}\relax}{% - \PackageWarningNoLine{widetable}{% - If there is an `ifetex' package then it is not installed.\MessageBreak - The package is being emulated}% -\m@mifetextrue -\newif\ifetex - \etexfalse -\ifx\eTeXversion\undefined -\else - \ifx\eTeXversion\@undefined - \else - \ifx\eTeXversion\relax - \else - \ifnum\eTeXversion>0\relax - \etextrue - \fi - \fi - \fi -\fi -%%\EmulatedPackage{ifetex}[2008/07/23]% from memoir.cls -} - -\def\dividi#1\per#2\in#3{% - \begingroup - \wt@Numer #1\relax \wt@Denom #2\relax - \ifdim\wt@Denom<\z@ \wt@Denom -\wt@Denom \wt@Numer -\wt@Numer\fi - \ifdim\wt@Numer<\z@ \def\wt@segno{-}\wt@Numer -\wt@Numer\fi - \ifdim\wt@Denom=\z@ - \edef\wt@Q{\ifdim\wt@Numer<\z@-\fi\strip@pt\maxdimen}% - \else - \wt@Num=\wt@Numer \wt@Den=\wt@Denom \divide\wt@Num\wt@Den - \edef\wt@Q{\number\wt@Num.}% - \advance\wt@Numer -\wt@Q\wt@Denom \wt@I=6 - \@whilenum \wt@I>\z@ \do{\wt@dividiDec\advance\wt@I\m@ne}% - \fi - \edef\x{\noexpand\endgroup\noexpand\def\noexpand#3{\wt@segno\wt@Q}} - \x -} - -\def\wt@dividiDec{% - \wt@Numer=10\wt@Numer \wt@Num=\wt@Numer \divide\wt@Num\wt@Den - \edef\wt@q{\number\wt@Num}\edef\wt@Q{\wt@Q\wt@q}% - \advance\wt@Numer -\wt@q\wt@Denom} - -\def\scala#1\per#2\diviso#3\in#4{\begingroup +\usepackage{xparse} +\newcommand\WT@scale[4]{\begingroup \wt@Num #2\relax \wt@Den #3\relax -\ifnum\wt@Den<\z@ \wt@Den -\wt@Den \wt@Num -\wt@Num \fi -\ifnum\wt@Den=\z@ - \@tempdima\ifnum\wt@Num<0-\fi\maxdimen +\ifnum#3=\z@ + \@tempdima\ifnum#2<0-\fi\maxdimen \else - \@tempdima\dimexpr#1*\wt@Num/\wt@Den\relax + \@tempdima\dimexpr#1*#2/#3\relax \fi -\edef\x{\noexpand\endgroup\noexpand\def\noexpand#4{\the\@tempdima}}% +\edef\x{\noexpand\endgroup\noexpand\setlength{#4}{\the\@tempdima}}% \x} - \newdimen\wt@width - -\def\wt@starttabular{\expandafter\tabular\expandafter{\wt@preamble}} - -\def\widetable#1#2{% - \def\@tempC{widetable}\setlength{\wt@width}{#1}% - \def\wt@preamble{#2}\wt@getTable} - \newif\ifwt@scartare\wt@scartarefalse -\def\endwidetable{% +\DeclareDocumentCommand\widetable{m O{c} m} +{% OPENING WIDETABLE + \def\@tempC{widetable} + \setlength{\wt@width}{#1}% + \def\wt@preamble{#3} + \edef\wt@starttabular{\noexpand\tabular[#2]{\wt@preamble}} + \wt@getTable}% +\def\endwidetable{% CLOSING WIDETABLE \ifwt@scartare \noindent\null \else \tabcolsep=\z@ \setbox\z@=\hbox{\wt@starttabular\the\toks@\endtabular}% - \tabcolsep=1cm\relax + \tabcolsep=6pt\relax \setbox\tw@=\hbox{\wt@starttabular\the\toks@\endtabular}% - \advance\wt@width-\wd\z@ - \@tempdimb=\wd\tw@ - \advance\@tempdimb-\wd\z@ - \ifetex - \scala\tabcolsep\per\wt@width\diviso\@tempdimb\in\tabcolsep\relax + \ifdim\wt@width<\wd\z@ + \@tempdimb=\dimexpr\wd\tw@-\wd\z@\relax + \PackageWorning{widetable}{% + The natural width `\the\wd\z@' of the tabular + material\MessageBreak + is larger than the specified width + `\the\wt@width'\MessageBreak\null\space \MessageBreak + The table is typeset with the default column spacing} \else - \dividi\wt@width\per\@tempdimb\in\@tempA - \tabcolsep=\@tempA\tabcolsep + \@tempdimb=\dimexpr\wt@width-\wd\z@\relax \fi + \@tempdimc=\dimexpr\wd\tw@-\wd\z@\relax + \WT@scale{\tabcolsep}{\@tempdimb}{\@tempdimc}{\tabcolsep}\relax \wt@starttabular\the\toks@\endtabular \fi \ignorespacesafterend @@ -139,8 +85,9 @@ \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 + \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 } @@ -154,6 +101,23 @@ \fi } -\endinput +%% +%% Copyright 2009-2017 Claudio Beccari +%% +%% Distributable under the LaTeX Project Public License, +%% version 1.3c or higher (your choice). The latest version of +%% this license is at: http://www.latex-project.org/lppl.txt +%% +%% This work is "author-maintained" +%% +%% This work consists of this file WIDETABLE.dtx, a README file +%% the manifest.txt file, and the derived files: +%% 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. +%% %% %% End of file `widetable.sty'. -- cgit v1.2.3