diff options
author | Karl Berry <karl@freefriends.org> | 2009-02-26 00:50:17 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2009-02-26 00:50:17 +0000 |
commit | 951ab8ce2fe8420509db19af0937bdddb314b1de (patch) | |
tree | 7a1a1901bfe72b8aa0655b5e0d07e98cb1d9e801 /Master/texmf-dist/doc | |
parent | ddbbbe630665e57743e59ca5df71b2d054bd5d81 (diff) |
new latex package calctab (24feb09)
git-svn-id: svn://tug.org/texlive/trunk@12235 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc')
-rw-r--r-- | Master/texmf-dist/doc/latex/calctab/README | 20 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/calctab/calctab_manual.pdf | bin | 0 -> 430027 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/calctab/calctab_manual.tex | 393 |
3 files changed, 413 insertions, 0 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 Binary files differnew file mode 100644 index 00000000000..a76f2f1b304 --- /dev/null +++ b/Master/texmf-dist/doc/latex/calctab/calctab_manual.pdf 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} + + |