summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2009-02-26 00:50:17 +0000
committerKarl Berry <karl@freefriends.org>2009-02-26 00:50:17 +0000
commit951ab8ce2fe8420509db19af0937bdddb314b1de (patch)
tree7a1a1901bfe72b8aa0655b5e0d07e98cb1d9e801
parentddbbbe630665e57743e59ca5df71b2d054bd5d81 (diff)
new latex package calctab (24feb09)
git-svn-id: svn://tug.org/texlive/trunk@12235 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/calctab/README20
-rw-r--r--Master/texmf-dist/doc/latex/calctab/calctab_manual.pdfbin0 -> 430027 bytes
-rw-r--r--Master/texmf-dist/doc/latex/calctab/calctab_manual.tex393
-rw-r--r--Master/texmf-dist/tex/latex/calctab/calctab.sty291
-rwxr-xr-xMaster/tlpkg/bin/tlpkg-ctan-check3
-rw-r--r--Master/tlpkg/tlpsrc/calctab.tlpsrc2
-rw-r--r--Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc1
7 files changed, 709 insertions, 1 deletions
diff --git a/Master/texmf-dist/doc/latex/calctab/README b/Master/texmf-dist/doc/latex/calctab/README
new file mode 100644
index 00000000000..ef4decb138d
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/calctab/README
@@ -0,0 +1,20 @@
+calctab package - Autocalc table environment
+experimental version 0.5 2009/02/20
+
+The calctab package help the user to typeset a kind of economic table such as invoices, expense notes and liquidation, or other tabular material with a values column.
+The code compute sum and percentage with floating point numeric method (with fltpoint package by Eckhart Guthoehrlein) and formatting table action.
+
+A standard tabular environment works well but force the user to write in a generic LaTeX language without a conceptual relation among the economic items. In addition a lot of formatting command takes the same relevance of the document main data.
+
+So, the priority is to add a new language element.
+
+Economics items may be are independent values or not like sums and percentage on previous values. The language must be expressive concerning together data and its relations.
+
+This experimental version waiting for the user help and feedback and somehow a powerful implemented language to adjust all the view property such as row numbering, label operation, coloring, etc.
+
+Happy TeXing!
+
+Copyright (C) 2009 Roberto Giacomelli -- giaconet at tin dot it
+
+This program can be redistributed and/or modified under the terms of the LaTeX Project Public License Distributed from CTAN archives in directory macros/latex/base/lppl.txt; either version 1 of the License, or any later version.
+
diff --git a/Master/texmf-dist/doc/latex/calctab/calctab_manual.pdf b/Master/texmf-dist/doc/latex/calctab/calctab_manual.pdf
new file mode 100644
index 00000000000..a76f2f1b304
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/calctab/calctab_manual.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/calctab/calctab_manual.tex b/Master/texmf-dist/doc/latex/calctab/calctab_manual.tex
new file mode 100644
index 00000000000..2a816b9ff3f
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/calctab/calctab_manual.tex
@@ -0,0 +1,393 @@
+\documentclass[a4paper]{article}
+
+\usepackage[utf8]{inputenc}
+\usepackage[T1]{fontenc}
+\usepackage[left=32mm,
+ right=45mm,
+ top=32mm,
+ bottom=28mm]{geometry}
+
+\usepackage[english]{babel}
+
+\usepackage{fancyhdr}
+\usepackage{calctab}
+\usepackage{microtype}
+\usepackage{url}
+\usepackage{fancyvrb}
+
+% set the Verbatim environment
+\fvset{numbers=left,numbersep=7pt}
+
+% set page layout
+\pagestyle{fancy}
+
+% new command definition section
+\newcommand{\ct}{\textsc{calctab}}
+\newcommand{\pkg}[1]{\textsf{#1}}
+\newcommand{\env}[1]{\textsf{#1}}
+\newcommand{\cmd}[1]{\texttt{\char`\\#1}}
+\newcommand{\meta}[1]{\ensuremath{\langle}\emph{#1}\ensuremath{\rangle}}
+\newcommand{\graffe}[1]{\texttt{\{}\meta{#1}\texttt{\}}}
+\newcommand{\quadre}[1]{\texttt{[}\meta{#1}\texttt{]}}
+
+\author{Roberto Giacomelli\\e-mail: \texttt{giaconet at tin dot it}}
+\date{2009/02/20}
+\title{\ct{} package\\Experimental version\\0.5}
+
+\begin{document}
+\maketitle
+
+\bigskip
+\hspace*{238pt}\begin{minipage}{125pt}
+\em
+``The table compute the sum\\
+not because is useful,\\
+but because the result\\
+is not an user essential data.''
+\end{minipage}
+
+\bigskip
+\begin{center}
+\begin{minipage}{96mm}%.8\textwidth
+\tableofcontents
+\end{minipage}
+\end{center}
+
+
+\bigskip
+\section{Introduction}
+The \pkg{calctab} package help the user to typeset a kind of economic table such as invoices, expense notes and liquidation, or other tabular material with a values column.
+
+A normal \env{tabular} environment works well but force the user to write in a generic \LaTeX{} language without a conceptual relation among the economic items. In addition a lot of formatting command takes the same relevance of the document main data.
+
+So, the priority is to add a new language element.
+
+Economics items may be are independent values or not like sums and percentage on previous values. The language must be expressive concerning together data and its relations.
+
+\section{ToDo}
+I don't know if in the future this package will merge into another or became under further development. I hope in user discussion on the language issues and implementation too.
+
+The code have a good level of stability, nevertheless the package is considered experimental because some essential tasks are in \emph{ToDo} status as result in the following list:
+
+\begin{itemize}
+ \item write in good english the package documentation;
+ \item internationalization of the table fixed description string;
+ \item internationalization of the currency unit;
+ \item inner commands language development;
+ \item language development to manage the table view;
+ \item \dots
+\end{itemize}
+
+The enthusiasm raised during GuITmeeting2008 in Pisa (Italy)\footnote{For information please visit the site \url{www.guit.sssup.it/guitmeeting/2008/2008.it.php}} by the talk \emph{``Una tabella che fa calcoli''} and the tip by Norbert Preining (Vienna University of Technology) to upload on CTAN the code in experimental section, finally persuade me to publish it.
+
+Thanks GuITmeeting2008 people, thanks Norbert.
+
+\section{User manual}
+In this section will be explain the use of the environment \pkg{calctab}, first through several examples and later showing its formal syntax.
+
+\subsection{\pkg{calctab} by examples}
+\subsubsection{Simple table}
+Well, starting with a simple case, consider a list of three entries with a final sum as showed in the next table:
+
+\begin{calctab}
+ \amount{First cost}{12500,9}
+ \amount{Second cost}{8560,03}
+ \amount{Third cost}{9200,45}
+ \add{Final sum}
+\end{calctab}
+
+\bigskip
+
+To mark items as independent value we can use the \verb=\amount= command, which needs two mandatory arguments: an item description text and its economic consistency.
+
+In the last row, the \verb=\add= command have care to execute the sum of the previous amount, thus only a description text needs as input.
+
+So, the user can typesetting the table with the \LaTeX{} source code show next. Obviously, the directive \verb=\usepackage{calctab}= must be present in the document preamble.
+
+\begin{Verbatim}
+\begin{calctab}
+ \amount{First cost}{12500,9}
+ \amount{Second cost}{8560,03}
+ \amount{Third cost}{9200,45}
+ \add{Final sum}
+\end{calctab}
+\end{Verbatim}
+
+The behaviour of the inner commands is based on these rules:
+
+\begin{itemize}
+ \item Each command typeset one table row;
+ \item the sequence of commands produce the sequence of the table row;
+ \item \verb=\add= command sum all previous values (with exception to \verb=\add= values so).
+\end{itemize}
+
+The environment manages all the formatting elements of table as colored rows, rules, description entry row. The command execute calculation in floating point algorithm and adds description text (a list of uppercase letter to explicate the rows computed).
+Also commands execute formatting task as numeric values printing, font family selection and more.
+
+Potentially all of these \emph{visual} property could be adjust by the \pkg{calctab} user.
+
+\subsubsection{Percentage}
+
+Now we discuss the last inner command of the environment \pkg{calctab} named \verb=\perc= to compute a percentage.
+
+In this second example we have only three items: an independent value, an its percentage, and the sum of all.
+
+\begin{calctab}
+ \amount{Building costruction}{560000}
+ \perc{Tax}{10}
+ \add{Total}
+\end{calctab}
+
+The \LaTeX{} code to produce the table is show here:
+
+\begin{Verbatim}
+\begin{calctab}
+ \amount{Building costruction}{560000}
+ \perc{Tax}{10}
+ \add{Total}
+\end{calctab}
+\end{Verbatim}
+
+The number of the second argument of \verb=\perc= command is interpreted as percentage value so not in absolute mode. This number may be negative with a max of two decimal digit (currently number are truncated at this point).
+
+
+\subsubsection{Items relations}
+If more complex tables require \emph{relational} information between rows is necessary to assign to it a names and recall these identifier in a list. This simply way can be achieved with the command optional argument.
+
+A name can be assign to a table row by using the \texttt{id} key (a significance name improve code clarity).
+The syntax is based to \meta{key} $=$ \meta{value} assignment, where key is fixed \texttt{id} string.
+Later on, compute sum or percentage only on a subset of previous \pkg{calctab} items, can get recall in a comma separated list, the user row name.
+
+The next example show the command optional argument at work.
+For example, we want to apply a different discount on each expense or on each group of expense.
+
+\begin{calctab}
+ \amount[id=dinner]{Five dinner}{146}
+ \amount[id=breakfast]{Five breakfast}{35}
+ \perc[dinner]{Discount}{-8}
+ \perc[breakfast]{Discount}{-4}
+ \add{Grand total}
+\end{calctab}
+
+The next \LaTeX{} code show rows relation by name:
+
+\begin{Verbatim}
+\begin{calctab}
+ \amount[id=dinner]{Five dinner}{146}
+ \amount[id=breakfast]{Five breakfast}{35}
+ \perc[dinner]{Discount}{-8}
+ \perc[breakfast]{Discount}{-4}
+ \add{Grand total}
+\end{calctab}
+\end{Verbatim}
+
+\subsubsection{Sums in table}
+In the table of the last example we will add a subtotal as the sum of discounts (and a short table description paragraph too):
+
+\begin{calctab}[Hotel bill:\\
+Period from 12 october 2008 to 18 october 2008 (room 456)]
+ \amount[id=dinner] {Five dinner} {146}
+ \amount[id=breakfast] {Five breakfast}{35}
+ \perc[id=dis8,dinner] {Discount} {-8}
+ \perc[id=dis4,breakfast]{Discount} {-4}
+ \add[dis8,dis4]{Total of discount}
+ \add{Grand total}
+\end{calctab}
+
+\bigskip
+The table's \LaTeX{} code is this:
+
+\begin{Verbatim}
+\begin{calctab}[Hotel bill:\\
+ Period from 12 october 2008 to 18 october 2008 (room 456)]
+ \amount[id=dinner] {Five dinner} {146}
+ \amount[id=breakfast] {Five breakfast}{35}
+ \perc[id=dis8,dinner] {Discount} {-8}
+ \perc[id=dis4,breakfast]{Discount} {-4}
+ \add[dis8,dis4]{Total of discount}
+ \add{Grand total}
+\end{calctab}
+\end{Verbatim}
+
+As the reader can be notice, \emph{table description} is typeset as a paragraph having the same (variable) table width.
+
+\subsubsection{Sum of the sum}
+
+\begin{calctab}[Plant project Fee Note:\\
+ Italian restaurant and pizzeria ``La Margherita'']
+ \amount{Design of the air conditioned plant}{5400}
+ \amount{Design of the electric plant and video surveillance}{8000}
+ \perc{General expense}{8,55}
+ \add[id=total]{Total amount of the design task}
+ \perc{Tax}{2}
+ \perc{VAT}{20}
+ \perc[total]{Deduction}{-20}
+ \add{Total}
+\end{calctab}
+
+In this table a 20\% deduction amount must be apply on the total of the first three values. A solution is to assign a name for each rows and write its list in optional argument of \cmd{perc} command. Nevertheless, this sum is just computed in previus row, thus we can assign a name only to this table row \texttt{\cmd{add}[id=total]\{Total amount of the design task\}}, and later recall the result and then apply percentage on it with the line \texttt{\cmd{perc}[total]\{Deduction\}\{-20\}}.
+The complete code is show next:
+
+\begin{Verbatim}
+\begin{calctab}[Plant project Fee Note:\\
+ Italian restaurant and pizzeria ``La Margherita'']
+ \amount{Design of the air conditioned plant}{5400}
+ \amount{Design of the electric plant and video surveillance}{8000}
+ \perc{General expense}{8,55}
+ \add[id=total]{Total amount of design task}
+ \perc{Tax}{2}
+ \perc{TVA}{20}
+ \perc[total]{Deduction}{-20}
+ \add{Total}
+\end{calctab}
+\end{Verbatim}
+
+\subsubsection{Interval rows selection}
+In some particular list of independent values the idea of interval selection is simply a consecutive group selection. So we only need to specify the first and the last element of the series.
+If the first element is no explicit information its default is the element one, and similary, the last element of whole dataset became the default if a limit is no available.
+
+The \ct{} commands \cmd{perc} and \cmd{add} support an interval selection with \texttt{from} and \texttt{until} keys that referenced row name.
+
+For example in this follow table the first five items and the last four are two separated group.
+
+\begin{calctab}[The interval selection table]
+ \amount{One} {100000000}
+ \amount{Two} {20000000}
+ \amount{Three} {3000000}
+ \amount{Four} {400000}
+ \amount[id=five]{Five}{50000}
+ \amount[id=six]{Six} {6000}
+ \amount{Seven} {700}
+ \amount{Eight} {80}
+ \amount{Nine} {9}
+ \add[until=five]{From one to five}
+ \add[from=six]{From six to nine}
+ \add{As well as total}
+\end{calctab}
+
+The code needs to render this demo table is explain here:
+
+\begin{Verbatim}
+\begin{calctab}[The interval selection table]
+ \amount {One}{100000000}
+ \amount {Two}{20000000}
+ \amount {Three}{3000000}
+ \amount {Four}{400000}
+ \amount[id=five]{Five}{50000}
+ \amount[id=six] {Six}{6000}
+ \amount {Seven}{700}
+ \amount {Eight}{80}
+ \amount {Nine}{9}
+ \add[until=five]{From one to five}
+ \add[from=six]{From six to nine}
+ \add{As well as total}
+\end{calctab}
+\end{Verbatim}
+
+Is possible to combine the keys \texttt{until} and \texttt{from} in the same optional argument to select a whole inner interval, and a row name list too.
+In case of selection overlap, a package warning will be throws at compile time.
+
+\subsection{Environment formal syntax}
+
+The environment syntax will be described follow:
+
+\medskip
+\noindent\fbox{
+ \parbox{220pt}{
+ \noindent\cmd{begin}\texttt{\{calctab\}}\quadre{description paragraph}\smallskip
+
+ \hspace*{5mm}\meta{calctab commands list}\smallskip
+
+ \noindent\cmd{end}\texttt{\{calctab\}}
+ }
+}
+\medskip
+
+where \meta{calctab commands list} is a sequence of the internal commands:\medskip
+
+
+\noindent\fbox{\cmd{amount}\texttt{[id=}\meta{rowID}\texttt{]}\graffe{descr}\graffe{value}}\medskip
+
+\noindent\fbox{\cmd{perc}\texttt{[id=}\meta{rowID}\texttt{,from=}\meta{rowID}\texttt{,until=}\meta{rowID}\texttt{,}\meta{rowID~list}\texttt{]}\graffe{descr}\graffe{percentage}}\medskip
+
+\noindent\fbox{\cmd{add}\texttt{[id=}\meta{rowID}\texttt{,from=}\meta{rowID}\texttt{,until=}\meta{rowID}\texttt{,}\meta{rowID~list}\texttt{]}\graffe{descr}}
+
+\medskip
+Please note that the \pkg{calctab} environment is based on the standard \LaTeX{} \env{tabular} environment, so you can manage \pkg{calctab} as a float object all-surrounding it with a \pkg{table} environment.
+
+\subsection{Appearance commands (at the moment)}
+The first row of the table typeset by \pkg{calctab} environment contains a pair of texts. The title of description column, that can be modify by the user with the command \cmd{ctdescription}, and the title of economic column that describe currency, set by the command \cmd{ctcurrency}. Default values are ``\texttt{Items description}'' and \cmd{euro}.
+
+These command save the argument in defined internal macro, in the same way of the common \cmd{title} and \cmd{author} command of the \pkg{article} class. Insert these commands before the \pkg{calctab} environment to change it.
+
+\bigskip
+\noindent\fbox{\cmd{ctcurrency}\graffe{user text}}
+
+\smallskip
+
+\noindent\fbox{\cmd{ctdescription}\graffe{user text}}
+
+
+\bigskip
+An example show explicit assignment of the description text and currency unit:
+
+\ctdescription{Your bill, thanks a lot.}
+\ctcurrency{USD}
+
+\begin{calctab}
+ \amount[id=dinner]{Five dinner}{146}
+ \amount[id=breakfast]{Five breakfast}{35}
+ \perc[dinner]{Discount}{-8}
+ \perc[breakfast]{Discount}{-4}
+ \add{Grand total}
+\end{calctab}
+
+\begin{Verbatim}
+\ctdescription{Your bill, thanks a lot.}
+\ctcurrency{USD}
+
+\begin{calctab}
+ \amount[id=dinner]{Five dinner}{146}
+ \amount[id=breakfast]{Five breakfast}{35}
+ \perc[dinner]{Discount}{-8}
+ \perc[breakfast]{Discount}{-4}
+ \add{Grand total}
+\end{calctab}
+\end{Verbatim}
+
+The default english text in percentage row can be change in the same way with the command \cmd{ctontranslation}.
+
+\bigskip
+\noindent\fbox{\cmd{ctontranslation}\graffe{on traslation}}
+
+\subsection{Table width}
+The width of the \ct{} table can be adjust via a standard \LaTeX{} length called \cmd{ctsep} (default value is 8mm). The horizontal space will be add to the central column of the table. The next line is an example:
+
+\medskip
+\texttt{\cmd{setlength}\{\cmd{ctsep}\}\{28pt\}}
+
+\section{\ct{} idea}
+The language efficacy is particularly important for the \LaTeX{} user. The \ct{} underline concept is to build an expressive language for the model -- view paradigm.
+
+So one \emph{model} of structured data, can have more and more presentation \emph{view}. For example, a text with tabular structure can became a report or a graphic plot image.
+
+\section{Package License}
+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 any later version.
+The latest version of this license is in
+\url{http://www.latex-project.org/lppl.txt}
+and version 1.3 or later is part of all distributions of \LaTeX{}
+version 2005/12/01 or later.
+
+\section{Thanks}
+Thanks a lot to Professor Enrico Gregorio for help me to resolve some code problem: balance the table description paragraph width to the table variable width, save in a tokens registry the material of table so as over the implicit group barrier of tabular cell, and solve consequent \verb=\expandafter= \emph{jungle}.
+
+Thanks a lot to the authors of packages used by \pkg{calctab}.
+
+And finally, thanks to my family.
+
+Every comment are welcome as well as any language discussion, so don't esitate to send to the author an e-mail message with your opinion, suggestion or desiderata. Thank you.
+\end{document}
+
+
diff --git a/Master/texmf-dist/tex/latex/calctab/calctab.sty b/Master/texmf-dist/tex/latex/calctab/calctab.sty
new file mode 100644
index 00000000000..229ce5cd65f
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/calctab/calctab.sty
@@ -0,0 +1,291 @@
+%% calctab.sty
+%% Copyright (C) 2009 Roberto Giacomelli <giaconet at tin dot it>
+%
+% 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 2005/12/01 or later.
+%
+% This work has the LPPL maintenance status `maintained'.
+%
+% The Current Maintainer of this work is Roberto Giacomelli
+%
+% This work consists of the files calctab.sty, calctab_manual.pdf
+% and README.txt
+%
+% Please make attention to this important note:
+% This package is experimetal: the language syntax can be change.
+%
+% version 0.5
+% date: 2009_02_20
+%
+% History of 0.5 version
+% 1 - single row key definition without a fltpoint registry
+% 2 - add a package warning if the keys generate an override
+% 3 - new feature: id key for \add command
+% 4 - Fixed bug in single row key definition
+% 5 - add warning or error internal command, at the end of the listing code
+% 6 - new feature: interval keys 'from' and 'until' in opt arg of the \perc and \add command
+% complete by warning feature.
+%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{calctab}[2009/02/20 v0.5 Autocalc table environment]
+%
+% ''library'' package for the table's visual property
+\RequirePackage{booktabs}
+\RequirePackage{eurosym}
+\RequirePackage[table]{xcolor}
+\RequirePackage{numprint}
+%
+% ''library'' package for algorithms and language implementation
+\RequirePackage{xkeyval}
+\RequirePackage{ifthen}
+\RequirePackage{fltpoint}
+%
+% length to tuning distance of central column of calctab table
+% 8 mm is the default value
+\newlength{\ctsep}\setlength{\ctsep}{0.8cm}
+%
+% main row counter of the table
+\newcounter{ct@RowIndex}
+%
+% loop simple counter
+\newcounter{ct@i}
+%
+% macrokey definition command
+\newcommand{\makemacrokey}[1]{\expandafter\def\csname #1\endcsname##1{%
+ \expandafter\def\csname @@#1\endcsname{##1}}}
+%
+% apparence command definition and default assignment
+\makemacrokey{ctcurrency}\ctcurrency{\euro}
+\makemacrokey{ctdescription}\ctdescription{Items description}
+\makemacrokey{ctontraslation}\ctontraslation{on}
+%
+% new boolean to control numeric loop, if ctGlobflag is true sum all row values
+\newboolean{ctGlobflag}\setboolean{ctGlobflag}{true}
+%
+% control flag of the from, until keys
+% this flag is false if from and/or unil keys is/are not specified
+\newboolean{ct@fromctrl}\setboolean{ct@fromctrl}{false}
+\newboolean{ct@untilctrl}\setboolean{ct@untilctrl}{false}
+%
+% definition of ordinary key
+% the ordinary keys is useful for assign a name to table row
+% note the use of different families
+%
+%
+\define@key{ctfamId}{id}{%
+ % save in ctreg@<idname> its row number
+ \expandafter\edef\csname ctreg@#1\endcsname{\thect@RowIndex}
+ % definition of the key <idvalue>, the id argument #1
+ \define@key{ctfamLabel}{#1}[]{
+ % activate ctflag<n>
+ \ifthenelse{\boolean{ctflag\csname ctreg@#1\endcsname}}{
+ %ops, overriding of keys condition
+ \PackageWarning{calctab}{\ct@overridingkeyerr{#1}}
+ }{%
+ \setboolean{ctflag\csname ctreg@#1\endcsname}{true}
+ }
+ % global flag is false if a key is specifed
+ \setboolean{ctGlobflag}{false}
+ }%
+}%
+%
+% the id key for \add command
+\define@key{ctfamAddid}{id}{%
+ \ifthenelse{\boolean{ctGlobflag}}{%
+ \expandafter\edef\csname ctref@#1\endcsname{\thect@RowIndex}
+ \define@key{ctfamLabel}{#1}[]{% set all row flag on true
+ \setcounter{ct@i}{1}
+ \whiledo{\not\(\value{ct@i}>\expandafter\number\csname ctref@#1\endcsname\)}{
+ \ifthenelse{\boolean{ctflag\thect@i}}{
+ \PackageWarning{calctab}{\ct@overridingkeyerr{#1}}
+ }{
+ \setboolean{ctflag\thect@i}{true}
+ }
+ \stepcounter{ct@i}
+ }% end whiledo
+ \setboolean{ctGlobflag}{false}
+ }
+ }{% else clause
+ \expandafter\edef\csname ctref@#1\endcsname{\ctref@temp}
+ \define@key{ctfamLabel}{#1}[]{% repeat the original id list
+ \edef\n@xt{\noexpand\setkeys{ctfamLabel}[id]{\csname ctref@#1\endcsname}}
+ \n@xt
+ }
+ }
+}
+%
+% definition of ``interval'' keys
+\define@key{ctfamLabel}{from}{%
+ \@ifundefined{ctreg@#1}
+ {\PackageError{calctab}{\ct@keynotexisterr{#1}}}
+ {%
+ \def\ct@fromrow{\csname ctreg@#1\endcsname}
+ \ifthenelse{\ct@fromrow=1}{\PackageWarning{calctab}{\ct@notusefulwarning{from}}}{}
+ \setboolean{ct@fromctrl}{true}
+ \setboolean{ctGlobflag}{false}
+ }
+}
+%
+\define@key{ctfamLabel}{until}{%
+ \@ifundefined{ctreg@#1}
+ {\PackageError{calctab}{\ct@keynotexisterr{#1}}}
+ {%
+ \def\ct@untilrow{\csname ctreg@#1\endcsname}
+ \ifthenelse{\ct@untilrow=\thect@RowIndex}{\PackageWarning{calctab}{\ct@notusefulwarning{until}}}{}
+ \setboolean{ct@untilctrl}{true}
+ \setboolean{ctGlobflag}{false}
+ }
+}
+%
+% table box allocation
+\newsavebox{\ctTabBox}
+%
+% set standard decimal position
+\nprounddigits{2}
+%
+%
+% main environment: definition
+%
+\newenvironment{calctab}[1][]{%
+%set font family
+\sffamily
+%
+%set the token register (TeX primitive command resolve the tabular grouping problem)
+\toks255={\rowcolors{1}{gray!15}{}\begin{tabular}{clr}\midrule&\@@ctdescription & \@@ctcurrency \\\midrule}
+%
+% reset main counter to starting value
+\setcounter{ct@RowIndex}{0}
+%
+% save paragraph table header to use it
+% in the environment end code
+\newcommand{\ct@FirstPar}[1]{#1}
+%
+% internal command definition
+\newcommand\ctLoop{%
+ \fpRegSet{ctSum}{0}
+ \setcounter{ct@i}{1}
+ \edef\ctlabelreg{}% for text of labels row
+ \edef\ctplustext{}% '+' char
+ \whiledo{\not\(\value{ct@i}>\value{ct@RowIndex}\)}{%
+ \ifthenelse{\(\boolean{ctflag\thect@i}\OR\boolean{ctGlobflag}\)}{%
+ \fpRegAdd{ctSum}{ctRowValue\thect@i}%
+ \setboolean{ctflag\thect@i}{false}% reset the row flag status
+ \edef\ctlabelreg{\ctlabelreg\ctplustext\Alph{ct@i}}
+ \edef\ctplustext{+}
+ }{}%else clause denied
+ \stepcounter{ct@i}%
+ }%
+ \setboolean{ctGlobflag}{true}% reset the global flag status
+}%
+%
+% from until keys internal command
+\newcommand{\ct@intervalloop}{%
+ \ifthenelse{\(\boolean{ct@fromctrl}\OR\boolean{ct@untilctrl}\)}
+ {
+ \ifthenelse{\boolean{ct@fromctrl}}{\setboolean{ct@fromctrl}{false}}{\def\ct@fromrow{1}}
+ \ifthenelse{\boolean{ct@untilctrl}}{\setboolean{ct@untilctrl}{false}}{\def\ct@untilrow{\thect@RowIndex}}
+ \ifthenelse{\number\ct@fromrow<\number\ct@untilrow}
+ {% canonical interval from until
+ \ct@setintervalflag{\ct@fromrow}{\ct@untilrow}}
+ {% negative interval 1 -> until plus from -> last row
+ \ct@setintervalflag{1}{\ct@untilrow}
+ \ct@setintervalflag{\ct@fromrow}{\thect@RowIndex}
+ }% else clause denied
+ }{}
+}
+%
+% internal command to set true the flags row in an interval
+\newcommand{\ct@setintervalflag}[2]{
+ % #1 arg -> start row value
+ % #2 arg -> finish row value
+ \setcounter{ct@i}{##1}
+ \whiledo{\not\(\value{ct@i}>\number##2\)}{
+ \ifthenelse{\boolean{ctflag\thect@i}}{
+ \PackageWarning{calctab}{\ct@overridingkeyerr{from or until}}
+ }{
+ \setboolean{ctflag\thect@i}{true}
+ }
+ \stepcounter{ct@i}
+ }
+}
+%
+\newcommand\amount[3][]{%
+ \stepcounter{ct@RowIndex}
+ \newboolean{ctflag\thect@RowIndex}%definition of bool flag for each row
+ \setboolean{ctflag\thect@RowIndex}{false}%initial value of ctflag<n>
+ \setkeys{ctfamId}{##1}%
+ \fpRegSet{ctRowValue\thect@RowIndex}{##3}
+ %append the tabular entry to the token register
+ \toks255=\expandafter{\the\toks255\Alph{ct@RowIndex}&##2\rule{\ctsep}{0pt}&\numprint{##3}\\}
+}%
+%
+\newcommand\perc[3][]{%
+ \stepcounter{ct@RowIndex}% another new row
+ \newboolean{ctflag\thect@RowIndex}% definition of bool flag for each row
+ \setboolean{ctflag\thect@RowIndex}{false}% initial value of ctflag<n>
+ % user id label task
+ \setkeys*{ctfamLabel}{##1}
+ \setrmkeys{ctfamId}
+ % 'from' and 'until' keys process
+ \ct@intervalloop
+ %
+ \addtocounter{ct@RowIndex}{-1}\ctLoop\stepcounter{ct@RowIndex}
+ \fpDiv{\tempPerc}{##3}{100}%
+ \fpRegSet{tempreg}{\tempPerc}
+ \fpRegMul{ctSum}{tempreg}
+ \fpRegRound{ctSum}{-2}% approx to the second digit
+ \fpRegGet{ctSum}{\atempnumber}
+ \fpRegSet{ctRowValue\thect@RowIndex}{\atempnumber}
+ \toks255=\expandafter{\the\toks255\Alph{ct@RowIndex}&##2 (\numprint{##3}\% \@@ctontraslation{} }
+ \edef\ctnum{\noexpand\ctlabelreg)\noexpand\rule{\ctsep}{0pt}}
+ \toks255=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\toks255\ctnum&}
+ \edef\ctnum{\noexpand\numprint{\atempnumber}}
+ \toks255=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\toks255\ctnum\\}
+}
+%
+\newcommand\add[2][]{%
+ \def\ctref@temp{##1}% save id list
+ \setkeys*{ctfamLabel}{##1}
+ \setrmkeys{ctfamAddid}
+ % 'from' and 'until' keys process
+ \ct@intervalloop
+ %
+ \ctLoop\fpRegGet{ctSum}{\atempnumber}
+ \toks255=\expandafter{\the\toks255\midrule\rowcolor{gray!15}&\bfseries##2 (}
+ \edef\ctnum{\noexpand\ctlabelreg)\noexpand\rule{\ctsep}{0pt}}
+ \toks255=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\toks255\ctnum&\bfseries}
+ \edef\ctnum{\noexpand\numprint{\atempnumber}}
+ \toks255=\expandafter\expandafter\expandafter{\expandafter\the\expandafter\toks255\ctnum\\}
+}%
+%
+}{% calctab environment closing code
+ \begin{center}
+ \begin{lrbox}{\ctTabBox}
+ \the\toks255\bottomrule
+ \end{tabular}
+ \end{lrbox}
+ \sffamily
+ \parbox{\wd\ctTabBox}{
+ \ct@FirstPar\par\smallskip\par
+ \usebox{\ctTabBox}}
+ \end{center}
+}
+%
+%
+% package warning and error macro definition part code
+%
+% the user has defined a key that not exist
+\newcommand{\ct@keynotexisterr}[1]{The key #1 not exist}
+%
+% in the id list command optional argument, a key is been specifed more then one time
+\newcommand{\ct@overridingkeyerr}[1]{The #1 key is just specifed in optional arg sequence.\MessageBreak
+Overriding ignored}
+%
+\newcommand{\ct@notusefulwarning}[1]{The key '#1' is non influential on calc}
+%
+% end of file calctab.sty \ No newline at end of file
diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check
index f48d9ee7991..a6636dee6b0 100755
--- a/Master/tlpkg/bin/tlpkg-ctan-check
+++ b/Master/tlpkg/bin/tlpkg-ctan-check
@@ -42,7 +42,8 @@ my @WorkingTLP = qw(
blockdraw_mp blowup boisik
boites boldtensors bookest booklet booktabs bophook bosisio
boxhandler bpchem breakurl bullcntr bussproofs bytefield
- calligra calrsfs captcont caption carlisle casyl catechis carolmin-ps
+ calctab calligra calrsfs captcont caption carlisle casyl
+ catechis carolmin-ps
cbcoptic cbfonts ccaption cclicenses cd cdpbundl cellspace
changebar changepage changes chappg chapterfolder
chem-journal chembst chemcompounds
diff --git a/Master/tlpkg/tlpsrc/calctab.tlpsrc b/Master/tlpkg/tlpsrc/calctab.tlpsrc
new file mode 100644
index 00000000000..8d00ae0ab36
--- /dev/null
+++ b/Master/tlpkg/tlpsrc/calctab.tlpsrc
@@ -0,0 +1,2 @@
+name calctab
+category Package
diff --git a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
index 035b6bdcdbb..e213e1c9bf8 100644
--- a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
+++ b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
@@ -46,6 +46,7 @@ depend boxhandler
depend breakurl
depend bullcntr
depend bussproofs
+depend calctab
depend calrsfs
depend calxxxx
depend captcont