From 3b599d9910b4fe668c87ddd32a48d48f8a377560 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 28 Sep 2015 21:17:02 +0000 Subject: fcolumn (28sep15) git-svn-id: svn://tug.org/texlive/trunk@38489 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/fcolumn/fcolumn.sty | 263 +++++++++++++----------- 1 file changed, 140 insertions(+), 123 deletions(-) (limited to 'Master/texmf-dist/tex/latex/fcolumn') diff --git a/Master/texmf-dist/tex/latex/fcolumn/fcolumn.sty b/Master/texmf-dist/tex/latex/fcolumn/fcolumn.sty index f0c7225d080..88a33413bce 100644 --- a/Master/texmf-dist/tex/latex/fcolumn/fcolumn.sty +++ b/Master/texmf-dist/tex/latex/fcolumn/fcolumn.sty @@ -12,138 +12,132 @@ %% %% This file may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either -%% version 1.2 of this license or (at your option) any later +%% 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.2 or later is part of all distributions of +%% and version 1.3 or later is part of all distributions of %% LaTeX version 1999/12/01 or later. \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{fcolumn} - [2015/03/07 v1.0 automatic currency package] + [2015/09/20 v1.1.1 Automatic Currency Package (EO)] \RequirePackage{array} \newcolumntype{F}[3]{>{\b@fi{#1}{#2}{#3}}r<{\e@fi}} \newcolumntype{f}{F{.}{,}{3,2}} -\newcount\FCsc@l \FCsc@l0 -\newcount\FCtc@l \FCtc@l0 -\newcount\g@lda -\newcount\g@ldb +\newcount\FCsc@l \FCsc@l=0 +\newcount\FCtc@l \FCtc@l=0 \newif\ifwiths@p \newif\ifstrictaccounting \strictaccountingfalse \def\geldm@cro#1#2{\withs@pfalse - \afterassignment\g@ldm@cro\count@#2\relax{#1}} +\afterassignment\g@ldm@cro\count@#2\relax{#1}} \def\g@ldm@cro#1\relax#2{% - \ifnum#2<0 \ifstrictaccounting(\else-\fi\g@lda=-#2 \else\g@lda=#2 \fi - \ifx\relax#1\relax\g@ldb=2 \else \g@ldb\@gobble#1\relax\fi +\ifnum#2<0 \ifstrictaccounting(\else-\fi\count2=-#2 \else\count2=#2 \fi +\count3=\ifx\relax#1\relax2 \else \@gobble#1\relax\fi +\count4=\count3 +\loop + \ifnum\count3>0 \divide\count2 by 10 \advance\count3 by \m@ne +\repeat +\g@ldens{\the\count@}% +\ifnum\count4>0\decim@lmark + \ifnum#2>0 \count2=-#2\else\count2=#2 \fi + \count3=\count4 \loop - \ifnum\g@ldb>0 \divide\g@lda by 10 \advance\g@ldb by \m@ne + \ifnum\count3>0 \divide\count2 by 10 \advance\count3 by \m@ne \repeat - \g@ldens{\the\count@}% - \ifx\relax#1\relax\g@ldb=2 \else \g@ldb\@gobble#1\relax\fi - \ifnum\g@ldb>0\decim@lmark - \ifnum#2>0 \g@lda=-#2\else\g@lda=#2 \fi - \loop - \ifnum\g@ldb>0 \divide\g@lda by 10 \advance\g@ldb by \m@ne - \repeat - \ifx\relax#1\relax\g@ldb=2 \else \g@ldb\@gobble#1\relax\fi - \loop - \ifnum\g@ldb>0 \multiply\g@lda by 10 \advance\g@ldb by \m@ne - \repeat - \ifnum#2>0 \advance\g@lda by #2 - \else \advance\g@lda by -#2 - \fi - \ifx\relax#1\relax\g@ldb=2 \else \g@ldb\@gobble#1\relax\fi - \zerop@d{\number\g@ldb}{\number\g@lda}% - \fi - \ifnum#2<0 \ifstrictaccounting\rlap{)}\fi\fi} -\def\g@ldens#1{{\g@ldb=\g@lda \count0=#1 - \loop - \ifnum\count0>0 - \divide\g@lda by 10 - \advance\count0 by \m@ne - \repeat - \ifnum\g@lda>0 \g@ldens{#1}\fi - \count0=#1 \loop - \ifnum\count0>0 - \multiply\g@lda by 10 - \advance\count0 by \m@ne + \ifnum\count3<\count4 \multiply\count2 by 10 \advance\count3 by \@ne \repeat - \g@lda=-\g@lda - \advance\g@lda by \g@ldb \du@zendprint{#1}}} -\def\du@zendprint#1{\ifwiths@p\sep@rator\zerop@d{#1}{\number\g@lda}% - \else\zerop@d{1}{\number\g@lda}\fi - \global\withs@ptrue} + \ifnum#2>0 \advance\count2 by #2 + \else \advance\count2 by -#2 + \fi + \zerop@d{\number\count3}{\number\count2}% +\fi +\ifnum#2<0 \ifstrictaccounting\rlap{)}\fi\fi} +\def\g@ldens#1{{\count3=\count2 \count0=#1 +\loop + \ifnum\count0>0 + \divide\count2 by 10 + \advance\count0 by \m@ne +\repeat +\ifnum\count2>0 \g@ldens{#1}\fi +\count0=#1 +\loop + \ifnum\count0>0 + \multiply\count2 by 10 + \advance\count0 by\m@ne +\repeat +\count2=-\count2 +\advance\count2 by \count3 \du@zendprint{#1}}} +\def\du@zendprint#1{\ifwiths@p\sep@rator\zerop@d{#1}{\number\count2}% + \else\zerop@d{1}{\number\count2}\fi \global\withs@ptrue} \def\zerop@d#1#2{{\count0=1 \count1=#2 - \loop - \divide \count1 by 10 - \ifnum\count1>0 \advance\count0 by 1 - \repeat - \loop - \ifnum\count0<#1 0\advance\count0 by 1 - \repeat - \number#2}} +\loop + \divide \count1 by 10 + \ifnum\count1>0 \advance\count0 by\@ne +\repeat +\loop + \ifnum\count0<#1\relax 0\advance\count0 by\@ne +\repeat +\number#2}} \def\zetg@ld#1#2{\global\advance\csname - FCtot@\romannumeral\FCsc@l\endcsname by #1 - \setbox0=\hbox{$\geldm@cro{#1}{#2}$}% - \ifdim\wd0>\csname FCwd@\romannumeral\FCsc@l\endcsname - \global\csname FCwd@\romannumeral\FCsc@l\endcsname=\wd0 - \fi\unhbox0} -\def\check#1#2{\noalign{\ifnum\csname FCtot@\romannumeral#1\endcsname= - \csname FCtot@\romannumeral#2\endcsname\else - \message{Columns #1 and #2 do not balance!}\fi}} +FCtot@\romannumeral\FCsc@l\endcsname by #1 +\setbox0=\hbox{$\geldm@cro{#1}{#2}$}% +\ifdim\wd0>\csname FCwd@\romannumeral\FCsc@l\endcsname + \global\csname FCwd@\romannumeral\FCsc@l\endcsname=\wd0 +\fi\unhbox0} \newcount\bedr@g \def\b@fi#1#2#3{\def\sep@rator{{#1}}\def\decim@lmark{{#2}}% - \let\ignorespaces=\@empty \def\sp@l{#3}\global\advance\FCsc@l by \@ne - \bedr@g=} -\def\e@fi{\relax \zetg@ld{\number\bedr@g}{\sp@l}} -\def\@xarraycr{\@ifnextchar [% - \@argarraycr {\ifnum 0=`{}\fi \cr\noalign{\global\FCsc@l=0 }}} +\def\sp@l{#3}\let\ignorespaces=\@empty \let\unskip=\@empty +\global\advance\FCsc@l by \@ne +\setbox0=\hbox\bgroup\global\bedr@g=} +\def\e@fi{ 123\relax\egroup\ifdim\wd0>\z@ + \zetg@ld{\number\bedr@g}{\sp@l}% +\fi} \def\@array[#1]#2{% - \@tempdima \ht \strutbox - \advance \@tempdima by\extrarowheight - \setbox \@arstrutbox \hbox{\vrule - \@height \arraystretch \@tempdima - \@depth \arraystretch \dp \strutbox - \@width \z@}% - \begingroup - \@mkpream{#2}% - \xdef\@preamble{\noexpand \ialign \@halignto - \bgroup \@arstrut \@preamble - \tabskip \z@ \cr}% - \endgroup - \begingroup - \@mksumline{#2}% - \endgroup - \res@tsumline - \@arrayleft - \if #1t\vtop \else \if#1b\vbox \else \vcenter \fi \fi - \bgroup - \let \@sharp ##\let \protect \relax - \lineskip \z@ - \baselineskip \z@ - \m@th - \let\\\@arraycr \let\tabularnewline\\\let\par\@empty \@preamble} +\@tempdima \ht \strutbox +\advance \@tempdima by\extrarowheight +\setbox \@arstrutbox \hbox{\vrule + \@height \arraystretch \@tempdima + \@depth \arraystretch \dp \strutbox + \@width \z@}% +\def\ialign{\everycr{\noalign{\global\FCsc@l=0 }}% + \tabskip\z@skip\halign} +\begingroup +\@mkpream{#2}% +\xdef\@preamble{\noexpand \ialign \@halignto +\bgroup\@arstrut\@preamble\tabskip\z@\cr}% +\endgroup +\begingroup +\@mksumline{#2}% +\endgroup +\res@tsumline +\@arrayleft +\if #1t\vtop \else \if#1b\vbox \else \vcenter \fi \fi +\bgroup +\let \@sharp ##\let \protect \relax +\lineskip \z@ +\baselineskip \z@ +\m@th +\let\\\@arraycr \let\tabularnewline\\\let\par\@empty \@preamble} \let\@@array=\@array -\def\@mksumline#1{\gdef\sumline{} - \@lastchclass 4 \@firstamptrue - \global\FCsc@l=\z@ - \let\prr@sult=\relax - \@temptokena{#1} - \@tempswatrue - \@whilesw\if@tempswa\fi{\@tempswafalse\the\NC@list}% - \count@\m@ne - \let\the@toks\relax - \prepnext@tok - \expandafter \@tfor \expandafter \@nextchar - \expandafter :\expandafter =\the\@temptokena \do - {\@testpach - \ifcase \@chclass \@classfz +\def\@mksumline#1{\gdef\sumline{}\@lastchclass 4 \@firstamptrue +\global\FCsc@l=0 +\let\prr@sult=\relax +\@temptokena{#1} +\@tempswatrue +\@whilesw\if@tempswa\fi{\@tempswafalse\the\NC@list}% +\count0\m@ne +\let\the@toks\relax +\prepnext@tok +\expandafter \@tfor \expandafter \@nextchar + \expandafter :\expandafter =\the\@temptokena \do + {\@testpach + \ifcase \@chclass \@classfz \or \or \@classfii \or \or \or \or \or \or \or \or \@classfx \fi - \@lastchclass\@chclass}% - \xdef\sumline{\sumline\noexpand\\}} + \@lastchclass\@chclass}% +\xdef\sumline{\sumline\noexpand\aut@check\noexpand\\}} \def\@addtosumline#1{\xdef\sumline{\sumline #1}} \def\@classfx{\if@firstamp \@firstampfalse \else \@addtosumline &\fi} \def\@classfz{\ifnum\@chnum<\thr@@ \@classfx\fi} @@ -157,32 +151,55 @@ \expandafter\ifx\csname FCtot@\romannumeral\FCsc@l\endcsname\relax \expandafter\newcount\csname FCtot@\romannumeral\FCsc@l\endcsname \else - \message{\noexpand\FCtot@\romannumeral\FCsc@l already exists.} + \message{^^JWarning: FCtot@\romannumeral\FCsc@l \space is already + defined and it may not even be a . I'll proceed, + but with fingers crossed. } \fi \expandafter\ifx\csname FCwd@\romannumeral\FCsc@l\endcsname\relax \expandafter\newdimen\csname FCwd@\romannumeral\FCsc@l\endcsname \global\FCtc@l=\FCsc@l \else - \message{\noexpand\FCwd@\romannumeral\FCsc@l already exists.} + \message{^^JWarning: FCwd@\romannumeral\FCsc@l \space is already + defined and it may not even be a . I'll proceed, + but with fingers crossed. } \fi \fi \fi \fi} -\def\leeg{0\relax \let\e@fi=\relax} -\def\prr@sult{\leeg - \setbox0=\hbox{$\geldm@cro{\number\csname - FCtot@\romannumeral\FCsc@l\endcsname}{\sp@l}$}% - \ifdim\wd0>\csname FCwd@\romannumeral\FCsc@l\endcsname - \global\csname FCwd@\romannumeral\FCsc@l\endcsname=\wd0 - \fi - \vbox{\hbox to \csname - FCwd@\romannumeral\FCsc@l\endcsname{\hrulefill}\vskip2pt - \hbox to \csname - FCwd@\romannumeral\FCsc@l\endcsname{\hfil\unhbox0}}} -\def\res@tsumline{\FCsc@l\FCtc@l \loop\ifnum\FCsc@l>0 - \global\csname FCtot@\romannumeral\FCsc@l\endcsname=0 - \global\csname FCwd@\romannumeral\FCsc@l\endcsname=0pt - \advance\FCsc@l by \m@ne \repeat} +\def\leeg#1{ 234\relax\egroup \let\e@fi=\relax \setbox0=\hbox{#1}% +\ifdim\wd0>\csname FCwd@\romannumeral\FCsc@l\endcsname + \global\csname FCwd@\romannumeral\FCsc@l\endcsname=\wd0 +\fi\unhbox0} +\def\prr@sult{ 345\relax\egroup \let\e@fi=\relax +\setbox0=\hbox{$\geldm@cro{\number\csname +FCtot@\romannumeral\FCsc@l\endcsname}{\sp@l}$}% +\ifdim\wd0>\csname FCwd@\romannumeral\FCsc@l\endcsname + \global\csname FCwd@\romannumeral\FCsc@l\endcsname=\wd0 +\fi +\vbox{\hrule width \csname FCwd@\romannumeral\FCsc@l\endcsname +\vskip2pt +\hbox to \csname FCwd@\romannumeral\FCsc@l\endcsname{\hfil\unhbox0}}} +\def\aut@check{\ifodd\FCsc@l\else \count0=\@ne \count1=\FCsc@l + \divide\count1 by \tw@ \advance\count1 by \@ne + \loop + \ifnum\csname FCtot@\romannumeral\count0\endcsname= + \csname FCtot@\romannumeral\count1\endcsname\else + \message{^^JWarning: F-columns \number\count0 \space + and \number\count1 \space do not balance! }% + \fi + \ifnum\count1=\FCsc@l\else + \advance\count0 by\@ne \advance\count1 by\@ne + \repeat +\fi } +\def\checkfcolumns#1#2{\noalign{\ifnum\csname FCtot@\romannumeral#1 +\endcsname=\csname FCtot@\romannumeral#2\endcsname\else + \message{^^JWarning: F-columns #1 and #2 do not balance! }% +\fi}} +\def\res@tsumline{\FCsc@l=\FCtc@l\loop\ifnum\FCsc@l>0 + \global\csname FCtot@\romannumeral\FCsc@l\endcsname=0 + \global\csname FCwd@\romannumeral\FCsc@l\endcsname=\z@ + \advance\FCsc@l by \m@ne +\repeat} \def\resetsumline{\noalign{\res@tsumline}} \endinput %% -- cgit v1.2.3