diff options
author | Manuel Pégourié-Gonnard <mpg@elzevir.fr> | 2009-04-25 08:04:43 +0000 |
---|---|---|
committer | Manuel Pégourié-Gonnard <mpg@elzevir.fr> | 2009-04-25 08:04:43 +0000 |
commit | 4efb9f5021d5bbb11a16ffe52de1c3cc5b05e1d9 (patch) | |
tree | 15aefc679e432ac292e41112b31be2e1c38fedeb /Master/texmf-dist/tex | |
parent | 8db463317016335cd456246a0b8b4c94c7978755 (diff) |
tabularcalc v0.2
git-svn-id: svn://tug.org/texlive/trunk@12817 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/tabularcalc/tabularcalc.sty | 380 |
1 files changed, 292 insertions, 88 deletions
diff --git a/Master/texmf-dist/tex/latex/tabularcalc/tabularcalc.sty b/Master/texmf-dist/tex/latex/tabularcalc/tabularcalc.sty index 268d26d0049..66588b71428 100644 --- a/Master/texmf-dist/tex/latex/tabularcalc/tabularcalc.sty +++ b/Master/texmf-dist/tex/latex/tabularcalc/tabularcalc.sty @@ -1,19 +1,20 @@ % __________________________________________________ % | | % | | -% | tabularcalc v0.1 | +% | tabularcalc v0.2 | % | | -% | March 19 2009 | +% | April 21 2009 | % | | % |__________________________________________________| % % This is tabularcalc.sty % -% "tabularcalc" package consists of the 6 following files: +% The "tabularcalc" package consists of the 8 following files: % tabularcalc.sty (this file) % README % tabularcalc_doc_fr.tex, tabularcalc_doc_fr.pdf (manual in french) % tabularcalc_doc_en.tex, tabularcalc_doc_en.pdf (manual in english) +% tabularcalc_doc_vn.tex, tabularcalc_doc_vn.tex (manual in vietnamese) % % Christian Tellechea 2009 % email : unbonpetit@gmail.com @@ -33,63 +34,99 @@ % The Current Maintainer of this work is Christian Tellechea % ------------------------------------------------------------------- +\ProvidesPackage{tabularcalc}[2009/04/20 v0.2 Compute formulas in tables] \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{tabularcalc}% - [2009/02/15 v0.1 Compute formulas in tables] +\RequirePackage{fp} \RequirePackage{xstring} -\RequirePackage{numprint} -\RequirePackage{pgf,pgfmath} - -\newcommand\tabularcalcversion {0.1} -\newcommand\tabularcalcdate {2009/03/19} -\newcommand\tabularcalcfrenchdate {19 mars 2009} -\newcommand\tabularcalcenglishdate {March $19^{\mathrm{th}}$ 2009} -\newcount\tccol\newcount\tclin +\RequirePackage[autolanguage]{numprint} + +\newcommand\tabularcalcversion {0.2} +\newcommand\tabularcalcdate {2009/04/21} +\newcommand\tabularcalcfrenchdate {21 avril 2009} +\newcommand\tabularcalcenglishdate {April $21^{\mathrm{st}}$ 2009} +\newcount\tccol +\newcount\tclin \newif\iftc@showval +\newwrite\tc@export \newcommand\tc@checkdefine[2]{\@ifdefinable#1{\def#1{#2}}{}} +\tc@checkdefine\tc@evalexpr{} + +\def\tc@evalexpr#1#2#3{% calcul d'une expression avec fp + \IfBeginWith{#1}-% + {\def\tc@currentresult{0#1}}% + {\def\tc@currentresult{#1}}% + \FPset{#2}{#3}% variable:=#2 + \FPeval\tc@currentresult\tc@currentresult + \FPclip\tc@currentresult\tc@currentresult} + +\DeclareOption{fixFPpow}{% + \def\FP@pow#1#2#3{% enl\`eve l'espace ind\'esirable lors du calcul de a^b + \FP@beginmessage{POW}% + {\def\FP@beginmessage##1{}% + \def\FP@endmessage##1{}% + \FPifzero{#2}% + \FP@pow@zero{#3}% + \else + \FPifint{#3}% g\`ere les cas (-2)^3 + \FPifneg{#2}% + \FPneg\FP@tmpd{#2}% + \FPln\FP@tmpd\FP@tmpd + \FPmul\FP@tmpd\FP@tmpd{#3}% + \FPexp\FP@tmpd\FP@tmpd + \FPtrunc\FP@tmp{#3}0% + \ifodd\FP@tmp + \FPneg\FP@tmp\FP@tmpd + \else + \let\FP@tmp\FP@tmpd + \fi + \else + \FPln\FP@tmpd{#2}% + \FPmul\FP@tmpd\FP@tmpd{#3}% + \FPexp\FP@tmp\FP@tmpd + \fi + \else + \FPln\FP@tmpd{#2}% + \FPmul\FP@tmpd\FP@tmpd{#3}% + \FPexp\FP@tmp\FP@tmpd + \fi + \fi + \global\let\FP@tmp\FP@tmp}% + \FP@endmessage{}% + \let#1\FP@tmp}} + +\ProcessOptions\relax \newcommand\tc@addtomacro[2]{\expandafter\def\expandafter#1\expandafter{#1#2}} \newcommand\tc@expaddtomacro[2]{% \expandafter\tc@addtomacro\expandafter#1\expandafter{#2}} -% choisit le moteur pour calculer l'expression contenue dans \tc@currentresult -% puis assigne le r\'esultat dans \tc@currentresult -\tc@checkdefine\tc@evalexpr{% - \expandafter\pgfmathparse\expandafter{\tc@currentresult}% - \let\tc@currentresult\pgfmathresult} - -\tc@checkdefine\noshowmark{} -\makeatother\def\noshowmark{@}\makeatletter - -\tc@checkdefine\startline{\rule[-1.2ex]{0pt}{4ex}} +\tc@checkdefine\tcnoshowmark{} +\makeatother\def\tcnoshowmark{@}\makeatletter +\tc@checkdefine\tcatbeginrow{\rule[-1.2ex]{0pt}{4ex}} \tc@checkdefine\tc@cellcode{} \tc@checkdefine\tc@currentcellcode{} -\newcommand\resetcellcode{\let\tc@cellcode\@empty} - -\tc@checkdefine\numberletter{x} -\tc@checkdefine\listsep{,} +\newcommand\tcresetcellcode{\let\tc@cellcode\@empty} +\tc@checkdefine\tclistsep{,} +\tc@checkdefine\tcprintvalue{} +\def\tcprintvalue#1{\numprint{#1}} -% d\'efinit la routine d'affichage des valeurs -\tc@checkdefine\printvalue{} -\def\printvalue#1{\numprint{#1}} -% d\'efinit la routine d'affichage des r\'esultats -\tc@checkdefine\printresult{} -\def\printresult#1#2{\numprint{#1}} +\tc@checkdefine\tcprintresult{} +\def\tcprintresult#1#2{\numprint{#1}} \newcommand\edefcellcode[3]{% \ifx\@empty#1\@empty \ifx\@empty#2\@empty \tc@addtomacro\tc@cellcode{#3}% \else - \tc@addtomacro\tc@cellcode{\ifnum\tccol=#2\relax#3\fi}% + \tc@addtomacro\tc@cellcode{\ifnum\tccol=#2 #3\fi}% \fi \else \ifx\@empty#2\@empty - \tc@addtomacro\tc@cellcode{\ifnum\tclin=#1\relax#3\fi}% + \tc@addtomacro\tc@cellcode{\ifnum\tclin=#1 #3\fi}% \else \tc@addtomacro\tc@cellcode{% - \ifnum\tclin=#1\relax\ifnum\tccol=#2\relax#3\fi\fi}% + \ifnum\tclin=#1\relax\ifnum\tccol=#2 #3\fi\fi}% \fi \fi} @@ -100,45 +137,125 @@ \tc@checkdefine\tc@updwnrule\hline % d\'efinit les 3 types de lignes -\newcommand\sethrule[3]{% +\newcommand\tcsethrule[3]{% \def\tc@updwnrule{#1}\def\tc@firstrule{#2}\def\tc@interrule{#3}} -\newcommand\resethrule{\sethrule\hline\hline\hline} +\newcommand\tcresethrule{\tcsethrule\hline\hline\hline} \tc@checkdefine\tc@lastvline{} \tc@checkdefine\tc@firstcoltype{|c|} \tc@checkdefine\tc@othercoltype{c|} % d\'efinit les 3 types de colonnes -\newcommand\setcoltype[3][]{% +\newcommand\tcsetcoltype[3][]{% \def\tc@firstcoltype{#2}\def\tc@othercoltype{#3}\def\tc@lastvline{#1}} -\newcommand\resetcoltype{\setcoltype{|c|}{c|}} +\newcommand\tcresetcoltype{\tcsetcoltype{|c|}{c|}} -\newcommand\htablecalc{\def\tc@orientation{h}\tc@deftablestart} -\newcommand\vtablecalc{\def\tc@orientation{v}\tc@deftablestart} +\newcommand\tc@errmess[1]{\PackageError{tabularcalc}{#1}{}} +\newcommand\tc@ifemptyerrmess[2]{\ifx\empty#1\tc@errmess{#2}\fi} -\newcommand\tc@deftablestart[3][1]{% +\newcommand\htablecalc{% \begingroup - \expandarg + \@makeother\:\@makeother\;\@makeother\, + \fullexpandarg + \def\tc@orientation{h}% + \tc@deftableid} + +\newcommand\vtablecalc{% + \begingroup + \@makeother\:\@makeother\;\@makeother\, + \fullexpandarg + \def\tc@orientation{v}% + \tc@deftableid} + +\newcommand\tc@deftableid[3][1]{% \def\tc@nbformulas{#1}% - \StrCount{\listsep#3}\listsep[\tc@nbval]% \tc@nbval = nombre de valeurs + \IfSubStr{#3};% + {\tc@analysevalueformula{#3}}% construit la liste des valeurs + {\StrBefore{#3}=[\tc@formulavariable]% analyse les valeurs + \tc@ifemptyerrmess\tc@formulavariable{Empty variable!} + \StrLen\tc@formulavariable[\tc@temp]% + \ifnum\tc@temp=\@ne\else\tc@errmess{Invalid variable}\fi + \StrBehind{#3}=[\tc@valuelist]% + \tc@ifemptyerrmess\tc@valuelist{No value!}}% + \StrCount{\tclistsep\tc@valuelist}\tclistsep[\tc@nbval]% nombre de valeurs \let\tc@coltype\@empty \tc@expaddtomacro\tc@coltype{\tc@firstcoltype*}% construit \tc@coltype + \if\tc@orientation h\let\tc@temp\tc@nbval\fi + \if\tc@orientation v\let\tc@temp\tc@nbformulas\fi \expandafter\tc@addtomacro\expandafter\tc@coltype\expandafter - {\expandafter{\tc@nbval}}% qui contiendra par exemple |c|*{4}{c|} + {\expandafter{\tc@temp}}% qui contiendra par exemple |c|*{4}{c|} \expandafter\tc@addtomacro\expandafter\tc@coltype\expandafter {\expandafter{\tc@othercoltype}}% \tc@expaddtomacro\tc@coltype\tc@lastvline - \let\tc@firstline\tc@updwnrule% 1ere ligne + \let\tc@firstrow\@empty% 1ere ligne \tclin\z@\tccol\z@ \edef\tc@currentcellcode{\tc@cellcode}% - \tc@expaddtomacro\tc@firstline\tc@currentcellcode - \tc@expaddtomacro\tc@firstline{\startline#2&}% - \def\tc@valuelist{#3}% - \tc@expaddtomacro\tc@valuelist\listsep + \tc@expaddtomacro\tc@firstrow\tc@currentcellcode + \tc@addtomacro\tc@firstrow{\tcatbeginrow#2&}% + \tc@expaddtomacro\tc@valuelist\tclistsep \tclin\@ne\tccol\@ne - \csname tc@\tc@orientation readarg\endcsname} + \@nameuse{tc@\tc@orientation readarg}} + +\newcommand\tc@analysevalueformula[1]{% + \StrBefore{#1};[\tc@valueformula]% + \StrBehind{#1};[\tc@valueinterval]% + \StrBefore\tc@valueinterval=[\tc@variablevalue]% + \StrBehind\tc@valueinterval=[\tc@valueinterval]% + \StrLen\tc@variablevalue[\tc@temp]% controles + \ifnum\tc@temp=\@ne\else\tc@errmess{Invalid variable}\fi + \tc@ifemptyerrmess\tc@valueinterval{Invalid syntax}% + \StrBefore\tc@valueformula=[\tc@formulavariable]% + \StrLen\tc@formulavariable[\tc@temp]% contrôles + \ifnum\tc@temp=\@ne\else\tc@errmess{Invalid variable}\fi + \ifx\tc@variablevalue\tc@formulavariable + \tc@errmess{Variables must not be the same}% + \fi + \StrBehind\tc@valueformula=[\tc@valueformula]% + \tc@ifemptyerrmess\tc@valueformula{Empty formula}% + \StrBefore\tc@valueinterval:[\tc@startvalue]% + \tc@ifemptyerrmess\tc@startvalue{Invalid interval}% + \StrBehind\tc@valueinterval:[\tc@valueinterval]% + \StrBefore{\tc@valueinterval[}[[\tc@endvalue]% + \tc@ifemptyerrmess\tc@endvalue{Invalid interval}% + \StrBetween\tc@valueinterval[][\tc@valuestep]% + \ifx\@empty\tc@valuestep\def\tc@valuestep{1}\fi + \def\tc@temp{0}% + \ifx\tc@valuestep\tc@temp\tc@errmess{Step must not be 0}\fi + \ifdim\tc@startvalue pt<\tc@endvalue pt\ifdim\tc@valuestep pt<0pt% + \tc@errmess{Step should be positive}% + \fi\fi + \ifdim\tc@startvalue pt>\tc@endvalue pt\ifdim\tc@valuestep pt>0pt% + \tc@errmess{Step should be negative}% + \fi\fi + \let\tc@valuelist\@empty + \let\tc@currentvalue\tc@startvalue + \edef\tc@comparesign{\ifdim\tc@valuestep pt<0pt<\else>\fi}% < ou > + \tc@buildvaluelist} + +\newcommand\tc@buildvaluelist{% + \edef\tc@temp{% + \noexpand\tc@evalexpr + {\tc@valueformula}{\tc@variablevalue}{\tc@currentvalue}}% + \tc@temp + \tc@expaddtomacro\tc@valuelist\tc@currentresult + \FPadd\tc@currentvalue\tc@currentvalue\tc@valuestep + \FPclip\tc@currentresult\tc@currentresult + \expandafter\ifdim\expandafter\tc@currentvalue + \expandafter p\expandafter t\tc@comparesign\tc@endvalue pt + \else + \tc@expaddtomacro\tc@valuelist\tclistsep + \expandafter\tc@buildvaluelist + \fi + \tc@temp} + +\newcommand\tc@generatevaluelist[3][1]{% + \tc@analysevalueformula{#3}% + \edef\tc@temp{% + \unexpanded{\tc@deftableid[#1]{#2}}% + {\tc@formulavariable=\tc@valuelist}}% + \tc@temp} % lit tous les arguments {nom ligne}{formule} et les assigne dans les sc % \tcline@i et \tc@formula@i et ainsi de suite, puis va \`a \tc@hbuildlines @@ -147,7 +264,7 @@ \@namedef{tc@line@\romannumeral\tclin}{}% \edef\tc@currentcellcode{\tc@cellcode}% \tc@expaddtocurrentline\tc@currentcellcode - \tc@expaddtocurrentline{\startline#1&}% + \tc@addtocurrentline{\tcatbeginrow#1&}% \@namedef{tc@formula@\romannumeral\tclin}{#2}% \ifnum\tclin<\tc@nbformulas \advance\tclin\@ne @@ -160,19 +277,19 @@ \newcommand\tc@vreadarg[2]{% \tclin\z@ \edef\tc@currentcellcode{\tc@cellcode}% construit la 1\`ere ligne - \tc@expaddtomacro\tc@firstline{\tc@currentcellcode#1}% + \tc@expaddtomacro\tc@firstrow{\tc@currentcellcode#1}% \@namedef{tc@formula@\romannumeral\tccol}{#2}% \ifnum\tccol<\tc@nbformulas - \tc@addtomacro\tc@firstline&% + \tc@addtomacro\tc@firstrow&% \advance\tccol\@ne \expandafter\tc@vreadarg \else \tclin\@ne\tccol\z@ - \loop% initialise les lignes \`a "\tc@currentcellcode\startline" + \loop% initialise les lignes \`a "\tc@currentcellcode\tcatbeginrow" \@namedef{tc@line@\romannumeral\tclin}{}% \edef\tc@currentcellcode{\tc@cellcode}% \tc@expaddtocurrentline\tc@currentcellcode - \tc@expaddtocurrentline\startline + \tc@addtocurrentline\tcatbeginrow \ifnum\tclin<\tc@nbval \advance\tclin\@ne \repeat @@ -181,8 +298,8 @@ \fi}% \newcommand\tc@findskiplist{% - \IfBeginWith\tc@currentvalue\noshowmark - {\tc@showvalfalse% si le signe \noshowmark est pr\'esent... + \IfBeginWith\tc@currentvalue\tcnoshowmark + {\tc@showvalfalse% si le signe \tcnoshowmark est pr\'esent... \StrGobbleLeft\tc@currentvalue1[\tc@currentvalue]}% ...efface-le {\tc@showvaltrue}% \IfSubStr\tc@currentvalue[% s'il y a une skiplist... @@ -202,17 +319,19 @@ % le nombre de colonnes \newcommand\tc@hbuildlines{% \tclin\z@ - \StrBefore\tc@valuelist\listsep[\tc@currentvalue]% prend \tc@currentvalue - \StrBehind\tc@valuelist\listsep[\tc@valuelist]% purge \tc@valuelist + \StrBefore\tc@valuelist\tclistsep[\tc@currentvalue]% prend \tc@currentvalue + \StrBehind\tc@valuelist\tclistsep[\tc@valuelist]% purge \tc@valuelist \ifx\@empty\tc@currentvalue \else \tc@findskiplist \edef\tc@currentcellcode{\tc@cellcode}% - \tc@expaddtomacro\tc@firstline\tc@currentcellcode + \tc@expaddtomacro\tc@firstrow\tc@currentcellcode \iftc@showval% pas de noshowmark : ajoute affichage valeur courante - \expandafter\tc@expaddtomacro\expandafter\tc@firstline - \expandafter{\expandafter\printvalue\expandafter - {\tc@currentvalue}}% + \let\tc@currentvaluerounded\tc@currentvalue + \tc@tcroundvalue\tc@currentvaluerounded\tc@printvalueroundprecision + \expandafter\tc@addtomacro\expandafter\tc@firstrow + \expandafter{\expandafter\tcprintvalue\expandafter + {\tc@currentvaluerounded}}% \fi \tclin\@ne \loop @@ -224,7 +343,7 @@ \repeat% recommence pour toutes les lignes \fi \ifnum\tccol<\tc@nbval% s'il reste des colonnes - \tc@addtomacro\tc@firstline&% ajoute "&" \`a la 1\`ere ligne + \tc@addtomacro\tc@firstrow&% ajoute "&" \`a la 1\`ere ligne \tclin\@ne \loop% et ajoute "&" aux autres lignes \tc@addtocurrentline&% @@ -232,22 +351,28 @@ \advance\tclin\@ne \repeat \advance\tccol\@ne - \expandafter\tc@hbuildlines% recommence tout le processus + \let\tc@temp\tc@hbuildlines% recommence tout le processus \else \let\tc@nblines\tc@nbformulas - \expandafter\tc@printtabular% sinon, va afficher la table - \fi} + \ifx\tc@filename\@empty + \let\tc@temp\tc@printtabular% sinon, va afficher la table + \else + \let\tc@temp\tc@exporttabular% ou l'exporter dans un fichier + \fi + \fi + \tc@temp} % construit les lignes du tableau par r\'ecursivit\'e principale sur \tclin \newcommand\tc@vbuildlines{% - \StrBefore\tc@valuelist\listsep[\tc@currentvalue]% prend \tc@currentvalue - \StrBehind\tc@valuelist\listsep[\tc@valuelist]% purge \tc@valuelist + \StrBefore\tc@valuelist\tclistsep[\tc@currentvalue]% prend \tc@currentvalue + \StrBehind\tc@valuelist\tclistsep[\tc@valuelist]% purge \tc@valuelist \ifx\@empty\tc@currentvalue \else \tc@findskiplist \iftc@showval% pas de noshowmark : ajoute affichage valeur courante + \tc@tcroundvalue\tc@currentvalue\tc@printvalueroundprecision \expandafter\tc@expaddtocurrentline\expandafter - {\expandafter\printvalue\expandafter{\tc@currentvalue}}% + {\expandafter\tcprintvalue\expandafter{\tc@currentvalue}}% \fi \tccol\@ne \loop @@ -261,16 +386,21 @@ \fi \ifnum\tclin<\tc@nbval \advance\tclin\@ne - \expandafter\tc@vbuildlines% s'il reste des lignes, recommence + \let\tc@temp\tc@vbuildlines% s'il reste des lignes, recommence \else \let\tc@nblines\tc@nbval - \expandafter\tc@printtabular% sinon, va afficher la table - \fi} + \ifx\tc@filename\@empty + \let\tc@temp\tc@printtabular% sinon, va afficher la table + \else + \let\tc@temp\tc@exporttabular% ou l'exporter dans un fichier + \fi + \fi + \tc@temp} \newcommand\tc@displaycurrentresult[1]{% \StrBetween\tc@skiplist[][\tc@nexttoskip]% \ifx\@empty\tc@skiplist% pas de skiplist -> ajoute l'affichage de resultat - \tc@addcurrentresult#1 + \tc@addcurrentresult#1% \else \ifnum\tc@nexttoskip=\z@% si 0, n'affiche rien \else @@ -283,16 +413,18 @@ \fi} \newcommand\tc@addcurrentresult[1]{% #1 : compteur courant - \expandafter\StrSubstitute% remplace "x" par la valeur courante - \csname tc@formula@\romannumeral#1\endcsname - \numberletter\tc@currentvalue[\tc@currentresult]% - \tc@evalexpr% \'evalue l'expression - \edef\tc@currentresult{{\tc@currentresult}{\tc@currentvalue}}% - \expandafter\tc@expaddtocurrentline\expandafter - {\expandafter\printresult\tc@currentresult}} + \edef\tc@temp{% + \noexpand\tc@evalexpr{\@nameuse{tc@formula@\romannumeral#1}}% + {\tc@formulavariable}{\tc@currentvalue}}% + \tc@temp + \tc@tcroundresult\tc@currentresult\tc@printresultroundprecision + \edef\tc@temp{% + \noexpand\tc@addtocurrentline{\noexpand\tcprintresult + {\tc@currentresult}{\tc@currentvalue}}}% + \tc@temp} \newcommand\tc@printcalclines{% - \csname tc@line@\romannumeral\tclin\endcsname% affiche la ni\`eme ligne + \@nameuse{tc@line@\romannumeral\tclin}% affiche la ni\`eme ligne \ifnum\tclin<\tc@nblines% et s'il en reste encore \`a afficher \\\tc@interrule% va \`a la ligne, met le filet \global\advance\tclin\@ne @@ -302,15 +434,87 @@ \newcommand\tc@printtabular{% \global\tclin\z@ \def\tc@currentvalue{\begin{tabular}}% - \expandafter\tc@currentvalue\expandafter{\tc@coltype}% - \tc@firstline\\\tc@firstrule% 1\`ere ligne + 1er filet + \expandafter\tc@currentvalue\expandafter{\tc@coltype}\tc@updwnrule + \tc@firstrow\\\tc@firstrule% 1\`ere ligne + 1er filet \global\tclin\@ne \tc@printcalclines% affichage des autres lignes \\\tc@updwnrule% filet du bas \end{tabular}% fin du tableau \endgroup} + +% les macro d'export dans un fichier +\tc@checkdefine\tc@filename{} +\newcommand\tcwritetofile[1]{\gdef\tc@filename{#1}} + +\newcommand\tc@exporttabular{% + \immediate\openout\tc@export=\tc@filename + \immediate\write\tc@export{% + \noexpand\begin{tabular}{\unexpanded\expandafter{\tc@coltype}}% + \unexpanded\expandafter{\tc@updwnrule}}% + \immediate\write\tc@export{% + \unexpanded\expandafter{\tc@firstrow\\}% + \unexpanded\expandafter{\tc@firstrule}}% + \global\tclin\@ne + \tc@exportcalclines + \immediate\write\tc@export{\noexpand\end{tabular}}% + \immediate\closeout\tc@export + \endgroup + \gdef\tc@filename{}} + +\newcommand\tc@exportcalclines{% + \ifnum\tclin<\tc@nblines + \let\tc@temp\tc@interrule + \else + \let\tc@temp\tc@updwnrule + \fi + \immediate\write\tc@export{% + \unexpanded\expandafter\expandafter\expandafter + {\csname tc@line@\romannumeral\tclin\endcsname}\noexpand\\ + \unexpanded\expandafter{\tc@temp}}% affiche la ni\`eme ligne + \ifnum\tclin<\tc@nblines% et s'il en reste encore \`a afficher + \global\advance\tclin\@ne + \expandafter\tc@exportcalclines% et recommence + \fi} + +%%% Les macros d'arrondi %%%% +\newcommand\tcprintroundvalue{% + \@ifstar + {\let\tc@formatroundednumber\@gobbletwo\tc@printroundvalue}% + {\let\tc@formatroundednumber\FPclip\tc@printroundvalue}} + +\newcommand\tc@printroundvalue[1]{% + \ifx\@empty#1\@empty\let\tc@tcroundvalue\@gobbletwo + \else\let\tc@tcroundvalue\tc@round\def\tc@printvalueroundprecision{#1}% + \fi} + +\newcommand\tcprintroundresult{% + \@ifstar + {\let\tc@formatroundednumber\@gobbletwo\tc@printroundresult}% + {\let\tc@formatroundednumber\FPclip\tc@printroundresult}} + +\newcommand\tc@printroundresult[1]{% + \ifx\@empty#1\@empty\let\tc@tcroundresult\@gobbletwo + \else\let\tc@tcroundresult\tc@round\def\tc@printresultroundprecision{#1}% + \fi} + +\newcommand\tc@round[2]{% #1=sc contenant le nombre #2=rang d'arrondi + \FPround#1#1{#2}\tc@formatroundednumber#1#1} + +\tcprintroundresult{}% par d'arrondi \`a l'affichage par d\'efaut +\tcprintroundvalue{}% par d'arrondi \`a l'affichage par d\'efaut % % Historique %------------------------------------------------------------------------------ -%% v0.1 19/03/2009 : - Premi\`ere version -%------------------------------------------------------------------------------
\ No newline at end of file +% v0.1 19/03/2009 +% - Premi\`ere version +%------------------------------------------------------------------------------ +% v0.2 21/04/2009 +% - pgfmath est abandonn\'e puisque beaucoup trop imprecis. +% Le moteur de calcul est d\'esormais fp. +% 2 probl\`emes dans \FPpow peuvent \^etre corrig\'e par l'option "fixFPpow". +% - Les valeurs peuvent \^etre calcul\'ees au lieu d'\^etre entr\'ees une par +% une. Cette fonctionnalit\'e tile lorsque ces valeurs suivent une loi +% math\'ematique dans un intervalle donn\'e. +% - Il est possible avec la commande \tcwritetofile d'exporter le prochain +% tableau vers un fichier dont on choisit le nom +% - Ajout de la traduction du manuel en vietnamien.
\ No newline at end of file |