diff options
author | Karl Berry <karl@freefriends.org> | 2006-08-27 18:13:13 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-08-27 18:13:13 +0000 |
commit | 617dae2d7d395ded39239d68c56768ed4342aa20 (patch) | |
tree | 796af9bd91ea6e9164019d9a79b0a635795f13be /Master/texmf-dist/tex/latex/tools/calc.sty | |
parent | eda6bc9ada7e4f5e901c11203666f0d3f0caa719 (diff) |
latex required package tools update from latex-tds (27aug06)
git-svn-id: svn://tug.org/texlive/trunk@2039 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/tools/calc.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/tools/calc.sty | 179 |
1 files changed, 136 insertions, 43 deletions
diff --git a/Master/texmf-dist/tex/latex/tools/calc.sty b/Master/texmf-dist/tex/latex/tools/calc.sty index d0b1a78fed9..cf08c19eb48 100644 --- a/Master/texmf-dist/tex/latex/tools/calc.sty +++ b/Master/texmf-dist/tex/latex/tools/calc.sty @@ -8,7 +8,7 @@ %% %% This is a generated file. %% -%% Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 +%% Copyright 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 %% The LaTeX3 Project and any individual authors listed elsewhere %% in this file. %% @@ -16,12 +16,12 @@ %% -------------------------------------------------------------------------- %% %% It may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either version 1.3 +%% conditions of the LaTeX Project Public License, either version 1.3c %% 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. +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. %% %% This file may only be distributed together with a copy of the LaTeX %% `Tools Bundle'. You may however distribute the LaTeX `Tools Bundle' @@ -33,7 +33,7 @@ %% File `calc.dtx'. %% Copyright (C) 1992--1995 %% Kresten Krab Thorup and Frank Jensen. -%% Copyright (C) 1997--1998 +%% Copyright (C) 1997--2005 %% Kresten Krab Thorup, Frank Jensen and the LaTeX3 Project. %% %% The original authors (fj@hugin.dk and krab@daimi.aau.dk) have @@ -42,9 +42,9 @@ %% the normal LaTeX bug report address. \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{calc} - [1998/07/07 v4.1b Infix arithmetic (KKT,FJ)] + [2005/08/06 v4.2 Infix arithmetic (KKT,FJ)] \def\calc@assign@generic#1#2#3#4{\let\calc@A#1\let\calc@B#2% - \expandafter\calc@open\expandafter(#4!% + \calc@open(#4!% \global\calc@A\calc@B\endgroup#3\calc@B} \def\calc@assign@count{\calc@assign@generic\calc@Acount\calc@Bcount} \def\calc@assign@dimen{\calc@assign@generic\calc@Adimen\calc@Bdimen} @@ -54,60 +54,99 @@ \newskip\calc@Askip \newskip\calc@Bskip \def\setcounter#1#2{\@ifundefined{c@#1}{\@nocounterr{#1}}% {\calc@assign@count{\global\csname c@#1\endcsname}{#2}}} -\def\addtocounter#1#2{\@ifundefined{c@#1}{\@nocounterr{#1}}% - {\calc@assign@count{\global\advance\csname c@#1\endcsname}{#2}}} + \def\addtocounter#1#2{\@ifundefined{c@#1}{\@nocounterr{#1}}% + {\calc@assign@count{\global\advance\csname c@#1\endcsname}{#2}}}% + \def\stepcounter#1{\@ifundefined {c@#1}% + {\@nocounterr {#1}}% + {\global\advance\csname c@#1\endcsname \@ne + \begingroup + \let\@elt\@stpelt \csname cl@#1\endcsname + \endgroup}}% +\@ifpackageloaded{amstext}{% + \expandafter\def\expandafter\stepcounter + \expandafter#\expandafter1\expandafter{% + \expandafter\iffirstchoice@\stepcounter{#1}\fi + } + \expandafter\def\expandafter\addtocounter + \expandafter#\expandafter1\expandafter#\expandafter2\expandafter{% + \expandafter\iffirstchoice@\addtocounter{#1}{#2}\fi + } +}{} \DeclareRobustCommand\setlength{\calc@assign@skip} \DeclareRobustCommand\addtolength[1]{\calc@assign@skip{\advance#1}} \def\calc@pre@scan#1{% - \ifx(#1% - \expandafter\calc@open - \else - \ifx\widthof#1% - \expandafter\expandafter\expandafter\calc@textsize - \else - \calc@numeric% no \expandafter needed for this one. - \fi - \fi - #1} + \expandafter\@calc@pre@scan\romannumeral-`\a#1} +\def\@calc@pre@scan#1{% + \ifx(#1% + \expandafter\calc@open + \else + \ifx\widthof#1% + \expandafter\expandafter\expandafter\calc@textsize + \else + \ifx\maxof#1% + \expandafter\expandafter\expandafter\expandafter + \expandafter\expandafter\expandafter\calc@maxmin@addsub + \else + \calc@numeric% no \expandafter needed for this one. + \fi + \fi + \fi + #1} \def\calc@open({\begingroup\aftergroup\calc@initB \begingroup\aftergroup\calc@initB \calc@pre@scan} \def\calc@initB{\calc@B\calc@A} \def\calc@numeric{\afterassignment\calc@post@scan \global\calc@A} -\newcommand\widthof{} +\@for\reserved@a:=widthof,heightof,depthof,totalheightof,maxof,minof\do +{\@ifundefined{\reserved@a}{}{% + \PackageError{calc}{% + The\space calc\space package\space reserves\space the\space + command\space name\space `\@backslashchar\reserved@a'\MessageBreak + but\space it\space has\space already\space been\space defined\space + with\space the\space meaning\MessageBreak + `\expandafter\meaning\csname\reserved@a\endcsname'.\MessageBreak + This\space original\space definition\space will\space be\space lost}% + {If\space you\space need\space a\space command\space with\space + this\space definition,\space you\space must\space use\space a\space + different\space name.}}% +} \let\widthof\ignorespaces -\newcommand\heightof{} \let\heightof\ignorespaces -\newcommand\depthof{} \let\depthof\ignorespaces +\let\totalheightof\ignorespaces \def\calc@textsize #1#2{% \begingroup \let\widthof\wd \let\heightof\ht \let\depthof\dp - \@settodim #1% + \def\totalheightof{\ht\dp}% + \expandafter\@settodim\expandafter{#1}% {\global\calc@A}% {% \let\widthof\ignorespaces \let\heightof\ignorespaces \let\depthof\ignorespaces + \let\totalheightof\ignorespaces #2}% \endgroup \calc@post@scan} \def\calc@post@scan#1{% - \ifx#1!\let\calc@next\endgroup \else + \expandafter\@calc@post@scan\romannumeral-`\a#1} +\def\@calc@post@scan#1{% + \ifx#1!\let\calc@next\endgroup \else \ifx#1+\let\calc@next\calc@add \else - \ifx#1-\let\calc@next\calc@subtract \else - \ifx#1*\let\calc@next\calc@multiplyx \else - \ifx#1/\let\calc@next\calc@dividex \else - \ifx#1)\let\calc@next\calc@close \else \calc@error#1% + \ifx#1-\let\calc@next\calc@subtract \else + \ifx#1*\let\calc@next\calc@multiplyx \else + \ifx#1/\let\calc@next\calc@dividex \else + \ifx#1)\let\calc@next\calc@close \else + \calc@error#1% + \fi + \fi \fi - \fi \fi - \fi \fi - \fi - \calc@next} + \fi + \calc@next} \def\calc@add{\calc@generic@add\calc@addAtoB} \def\calc@subtract{\calc@generic@add\calc@subtractAfromB} \def\calc@generic@add#1{\endgroup\global\calc@A\calc@B\endgroup @@ -120,19 +159,23 @@ \def\calc@ratio@x{\ratio} \def\calc@real@x{\real} \def\calc@multiplyx#1{\def\calc@tmp{#1}% - \ifx\calc@tmp\calc@ratio@x \let\calc@next\calc@ratio@multiply \else - \ifx\calc@tmp\calc@real@x \let\calc@next\calc@real@multiply \else - \let\calc@next\calc@multiply + \ifx\calc@tmp\calc@ratio@x \let\calc@next\calc@ratio@multiply \else + \ifx\calc@tmp\calc@real@x \let\calc@next\calc@real@multiply \else + \ifx\maxof#1\let\calc@next\calc@maxmin@multiply \else + \let\calc@next\calc@multiply \fi - \fi - \calc@next#1} + \fi + \fi + \calc@next#1} \def\calc@dividex#1{\def\calc@tmp{#1}% - \ifx\calc@tmp\calc@ratio@x \let\calc@next\calc@ratio@divide \else - \ifx\calc@tmp\calc@real@x \let\calc@next\calc@real@divide \else - \let\calc@next\calc@divide + \ifx\calc@tmp\calc@ratio@x \let\calc@next\calc@ratio@divide \else + \ifx\calc@tmp\calc@real@x \let\calc@next\calc@real@divide \else + \ifx\maxof#1\let\calc@next\calc@maxmin@divide \else + \let\calc@next\calc@divide \fi - \fi - \calc@next#1} + \fi + \fi + \calc@next#1} \def\calc@multiply{\calc@generic@multiply\calc@multiplyBbyA} \def\calc@divide{\calc@generic@multiply\calc@divideBbyA} \def\calc@generic@multiply#1{\endgroup\begingroup @@ -146,8 +189,9 @@ \calc@post@scan} \def\calc@ratio@multiply\ratio{\calc@ratio@evaluate} \def\calc@ratio@divide\ratio#1#2{\calc@ratio@evaluate{#2}{#1}} +\newcount\calc@Ccount \let\calc@numerator=\calc@Bcount -\newcount\calc@denominator +\let\calc@denominator=\calc@Ccount \def\calc@ratio@evaluate#1#2{% \endgroup\begingroup \calc@assign@dimen\calc@numerator{#1}% @@ -180,10 +224,59 @@ \calc@multiply@by@real{#1}\begingroup \calc@post@scan} \def\calc@real@divide\real#1{\calc@ratio@evaluate{1pt}{#1pt}} +\let\maxof\@@italiccorr +\let\minof\@@italiccorr +\newskip\calc@Cskip +\newif\ifcalc@count@ +\def\calc@maxmin@addsub#1#2#3{\begingroup + \ifx\calc@A\calc@Acount% + \calc@count@true + \else + \calc@count@false + \fi + \calc@maxmin@generic#1{#2}{#3}% + \endgroup + \calc@post@scan +} +\def\calc@maxmin@generic#1#2#3{% + \begingroup + \ifcalc@count@ + \calc@assign@count\calc@Ccount{#2}% + \calc@assign@count\calc@Bcount{#3}% + \def\minof{<}\def\maxof{>}% + \global\calc@A\ifnum\calc@Ccount#1\calc@Bcount + \calc@Ccount\else\calc@Bcount\fi + \else + \calc@assign@skip\calc@Cskip{#2}% + \calc@assign@skip\calc@Bskip{#3}% + \def\minof{<}\def\maxof{>}% + \global\calc@A\ifdim\calc@Cskip#1\calc@Bskip + \calc@Cskip\else\calc@Bskip\fi + \fi + \endgroup +} +\def\calc@maxmin@divmul#1#2#3#4{% + \endgroup\begingroup + \calc@count@true + \aftergroup#1% + \calc@maxmin@generic#2{#3}{#4}% + \endgroup\begingroup + \calc@post@scan +} +\def\calc@maxmin@multiply{\calc@maxmin@divmul\calc@multiplyBbyA} +\def\calc@maxmin@divide {\calc@maxmin@divmul\calc@divideBbyA} \def\calc@error#1{% \PackageError{calc}% {`#1' invalid at this point}% {I expected to see one of: + - * / )}} +\def\@settodim#1#2#3{% + \setbox\@tempboxa\hbox{{#3}}% + \dimen@ii=\z@ + \@tf@r\reserved@a #1\do{% + \advance\dimen@ii\reserved@a\@tempboxa}% + #2=\dimen@ii + \setbox\@tempboxa\box\voidb@x} +\def\settototalheight{\@settodim{\ht\dp}} \endinput %% %% End of file `calc.sty'. |