Debian Codegraph @

texmf-dist/doc/latex/calctab/calctab_manual.tex

raw
1 % 0.6.1 - 2009/07/12
2 \documentclass[a4paper]{article}
3
4 \usepackage[utf8]{inputenc}
5 \usepackage[T1]{fontenc}
6 \usepackage[ left=32mm,
7 right=45mm,
8 top=32mm,
9 bottom=28mm]{geometry}
10
11 \usepackage[english]{babel}
12 \usepackage{inconsolata}
13
14 \usepackage{fancyhdr}
15 \usepackage{calctab}
16 \usepackage{microtype}
17 \usepackage{url}
18 \usepackage{fancyvrb}
19 \usepackage{caption}
20 \usepackage[ pdfauthor={Roberto Giacomelli},
21 pdfsubject={Calctab package user manual},
22 pdfkeywords={table, invoice, expense note, report},
23 pdftitle={Calctab user manual},
24 colorlinks,
25 linkcolor=blue]{hyperref}
26
27 % set the Verbatim environment
28 \fvset{numbers=left,numbersep=7pt}
29
30 % set page layout
31 \pagestyle{fancy}
32
33 % new command definition section
34 \newcommand{\ct}{\textsc{calctab}} % calctab package
35 \newcommand{\pkg}[1]{\textsf{#1}}
36 \newcommand{\env}[1]{\textsf{#1}}
37 \newcommand{\cmd}[1]{\texttt{\char`\\#1}}
38 \newcommand{\meta}[1]{\ensuremath{\langle}\emph{#1}\ensuremath{\rangle}}
39 \newcommand{\curlyp}[1]{\texttt{\{}\meta{#1}\texttt{\}}}
40 \newcommand{\squarep}[1]{\texttt{[}\meta{#1}\texttt{]}}
41
42 \author{Roberto Giacomelli\\
43 e-mail: \texttt{giaconet dot mailbox at gmail dot com}}
44 \date{2009/07/12}
45 \title{\ct{} package\\version 0.6.1}
46
47 \begin{document}
48 \maketitle
49
50 \bigskip
51 \hspace*{238pt}\begin{minipage}{125pt}\em
52 ``The table computes the sum\\
53 not because is useful,\\
54 but because the result\\
55 is not an user essential data''
56 \end{minipage}
57
58 \vfill
59 \begin{center}
60 \begin{minipage}{112mm}%.8\textwidth
61 \tableofcontents
62 \end{minipage}
63 \end{center}
64 \vfill
65 \newpage
66 %
67 %
68 %
69 \section{Introduction}
70 The \ct{} package helps the user to typeset a kind of economic table such as invoices, expence notes and liquidation, or other tabular material with numeric columns.
71
72 A standard \env{tabular} environment works well but forces the author \emph{to think} in a generic \LaTeX{} language to reference economic object and without a conceptual relation among them. In addition a lot of formatting commands takes the same relevance of the main data, values, text description, etc.
73
74 Economic items maybe are independent values or not, like sums and percentages on previous values. The language must be expressive concerning together data and its relations. So, the priority is to add a new language element.
75
76 %
77 %
78 %
79 \section{User manual}
80 This section will be explain the use of the two \ct{} environments \env{calctab} and \env{xcalctab}, first through several examples and then showing its formal syntax.
81
82 %
83 %
84 %
85 \subsection{\env{calctab} and \env{xcalctab} by examples}
86 %
87 \subsubsection{A simple table}
88 Well, starting with a simple case of a list of three entries, a 10\% tax apply on it, and the final sum as showed in the next table:
89
90 \begin{calctab}
91 \amount{First cost}{12500,9}
92 \amount{Second cost}{8560,03}
93 \amount{Third cost}{9200,45}
94 \perc{Tax}{10}
95 \add{Total cost}
96 \end{calctab}
97
98 The user can typesetting the example table with the followed \ct{} code (obviously, the directive \verb=\usepackage{calctab}= must be present in the document preamble).
99
100 {\color{blue}
101 \begin{Verbatim}[numbers=none]
102 % in the document preamble
103 \usepackage{calctab}
104 \end{Verbatim}
105 }
106
107 \begin{Verbatim}
108 % in the document body
109 \begin{calctab}
110 \amount{First cost}{12500,9}
111 \amount{Second cost}{8560,03}
112 \amount{Third cost}{9200,45}
113 \perc{Tax}{10}
114 \add{Total cost}
115 \end{calctab}
116 \end{Verbatim}
117
118 Probably, is better to show the sum on which the 10\% tax is applied. Look this code:
119
120
121 \begin{Verbatim}
122 \begin{calctab}
123 \amount{First cost}{12500,9}
124 \amount{Second cost}{8560,03}
125 \amount{Third cost}{9200,45}
126 \add{Partial total} % <-- The 'Partial total' row is not
127 \perc{Tax}{10} % considered in the 'Total cost' sum...
128 \add{Total cost}
129 \end{calctab}
130 \end{Verbatim}
131
132 Since the \cmd{add} command not adds new table element in the stack so is easy to insert a subtotal. This is one of the basic rules implicit in the \env{calctab} environment so you are free to add an \cmd{add} row without you worry about following row's computation. In other words, the \cmd{add} command is a \emph{trasparent} math object.
133
134 The behaviour of the inner commands is based on these main rules:
135
136 \begin{itemize}
137 \item Each command typeset one table row;
138 \item The sequence of commands produce the sequence of the table rows;
139 \item The \verb=\perc= and the \verb=\add= commands computes all previous values (with exception to the \verb=\add= rows);
140 \item Optional command argument provides a relation rows language to select an item or a group of items.
141 \end{itemize}
142
143 An independent item is not only a numeric data but also it's defined by a description text. This concept is directly express by the \verb=\amount= command which needs two mandatory arguments: the \emph{description text} and the item \emph{numeric consistency}.
144
145 No more different is a percentage object structured in a description text and in a numeric value this time not an absolute number but a \emph{factor} multiply by one hundred applied on some previous data, still we can easy express this with the \verb=\perc= command.
146
147 Finally, we encountered a sum that only needs a description text. The \ct{} language provides the \verb=\add= command to cover this concept.
148
149 These three commands are available in an environment called \env{calctab} that represents the comprehensive structure of a table.
150
151 The code implementation of the inner commands computes the numeric results with the floating point algorithm rounded it with a max of two decimal digit (currently the results are truncated at this fixed precision).
152 The number of the commands mandatory argument can be negative.
153
154 The \ct{} environments manages all the table format elements such as the rows color, the rules, the columns header description text, etc. Furthermore, the code executes the data numeric formatting, the font family selection and more. For example, to the rows description text the \verb=\add= and \verb=\perc= commands adds a list of uppercase alphabetical character to explicate the computed rows.
155
156 Potentially all of these \emph{visual property} could be adjust by the \ct{} user.
157
158 %
159 \subsubsection{Quantity and price columns}
160 The \ct{} package provides another environment called \env{xcalctab} where the \env{x} character suggests a multiply operation and an extension of the base \env{calctab} too.
161 The inner commands are the same already discussed except the \verb=\amount= command that accepts the description test and \emph{two} numbers indeed only one.
162
163 The final table will appears with three columns typesetting with the two numeric arguments and their product. The following table with its corresponding code clarify this structure:
164
165 \begin{xcalctab}
166 \amount{Newspapers}{3}{1,30}
167 \amount{Coloured pencils}{12}{6,00}
168 \amount{Maths exercise book}{6}{2,50}
169 \amount{Compass}{1}{9,90}
170 \amount{Ruler}{1}{5,90}
171 \amount{Protractor}{1}{6,80}
172 \perc{Deduction}{-5}
173 \add{Total}
174 \end{xcalctab}
175
176 \begin{Verbatim}
177 \begin{xcalctab}
178 \amount{Newspapers}{3}{1,30}
179 \amount{Coloured pencils}{12}{6,00}
180 \amount{Maths exercise book}{6}{2,50}
181 \amount{Compass}{1}{9,90}
182 \amount{Ruler}{1}{5,90}
183 \amount{Protractor}{1}{6,80}
184 \perc{Deduction}{-5}
185 \add{Total}
186 \end{xcalctab}
187 \end{Verbatim}
188
189 The help text A+B+C+D+$\cdots$+\meta{LAST}, will be shorted when the items are more than \emph{five} elements, in A+B+$\cdots$+\meta{LAST}. The abbreviation condition is true only if the items in the subgroup are a consecutive sequence.
190
191 %
192 %
193 %
194 \subsubsection{Items relations}
195 If more complex tables require \emph{relational} information between rows is necessary to assign an items names and to recall later these identifiers in a list. This simply way can be achieved with the command optional argument.
196
197 A name can be assign to a table row by using the \texttt{id} key (a significance name of the key improve code clarity). The syntax is based to \meta{key} $=$ \meta{value} assignment, where key is the 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 names.
198
199 The next example explains the language support to the rows relation by naming with commands optional argument at work. For example, we want to apply a different discount on each expense or on each group of expense.
200
201 \begin{calctab}
202 \amount[id=dinner]{Five dinner}{146}
203 \amount[id=breakfast]{Five breakfast}{35}
204 \perc[dinner]{Discount}{-8}
205 \perc[breakfast]{Discount}{-4}
206 \add{Grand total}
207 \end{calctab}
208
209 \medskip
210 \begin{Verbatim}
211 \begin{calctab}
212 \amount[id=dinner] {Five dinner}{146}
213 \amount[id=breakfast]{Five breakfast}{35}
214 \perc[dinner] {Discount}{-8}
215 \perc[breakfast]{Discount}{-4}
216 \add{Grand total}
217 \end{calctab}
218 \end{Verbatim}
219
220 \subsubsection{Subtotals}
221 To the table of the last example we will add a subtotal as the sum of the discount rows. These \cmd{perc} rows handling together own identifiers and a list of previous names (one id name list in this case). As the reader can be notice, the optional \emph{table description} is typeset as a paragraph having the same (variable) table width.
222
223 \begin{calctab}[Hotel bill:\\
224 Period from 12 october 2008 to 18 october 2008 (room 456)]
225 \amount[id=dinner] {Five dinner} {29,2 * 5}
226 \amount[id=breakfast] {Five breakfast}{ 7 * 5}
227 \perc[id=dis8,dinner] {Discount} { -8}
228 \perc[id=dis4,breakfast]{Discount} { -4}
229 \add[dis8,dis4] {Total of discount}
230 \add {Grand total}
231 \end{calctab}
232
233 \bigskip
234
235 \begin{Verbatim}
236 \begin{calctab}[Hotel bill:\\
237 Period from 12 october 2008 to 18 october 2008 (room 456)]
238 \amount[id=dinner] {Five dinner} {29,2 * 5}
239 \amount[id=breakfast] {Five breakfast}{ 7 * 5}
240 \perc[id=dis8,dinner] {Discount} { -8}
241 \perc[id=dis4,breakfast]{Discount} { -4}
242 \add[dis8,dis4] {Total of discount}
243 \add {Grand total}
244 \end{calctab}
245 \end{Verbatim}
246
247 %
248 %
249 %
250 \subsubsection{An arithmetic argument}
251 The last example silently uses a feature of the \cmd{amount} command (only for \env{calctab} and not for \env{xcalctab}) available from the version 0.6. The numeric argument can optionally be a \emph{binary} math expression. The parse algorithm is very simple and the only syntax allowed are show in Tab.~\ref{tabOper} where \meta{a} and \meta{b} are two decimal numbers.
252
253 \begin{table}[bh]
254 \centering
255 \caption{\env{calctab} \cmd{amount} command optional binary operation}
256 \label{tabOper}
257 \begin{tabular}{lcc}\toprule
258 Floating point operation & Symbolic description & Numeric example\\\midrule
259 \emph{Addition} & \meta{a} $+$ \meta{b} & $15{,}20 + 41$\\
260 \emph{Addition} & $-$\meta{a} $+$ \meta{b} & $-15{,}20 + 41$\\
261 \emph{Subtraction} & \meta{a} $-$ \meta{b} & $15{,}20 - 41$\\
262 \emph{Subtraction} & $-$\meta{a} $-$ \meta{b} & $-15{,}20 - 41$\\
263 \emph{Multiplication} & \meta{a} $\cdot$ \meta{b} & $15{,}20 * 41$\\
264 \emph{Multiplication} & $-$\meta{a} $\cdot$ $-$\meta{b} & $-15{,}20 * -41$\\
265 \emph{Division} & \meta{a} $/$ \meta{b} & $15{,}20 / 41$\\
266 \emph{Division} & $-$\meta{a} $/$ \meta{b} & $-15{,}20 / 41$\\\bottomrule
267 \end{tabular}
268 \end{table}
269
270 Sometimes the applied round off number must be show in the table. This is possible because \env{calctab} reports the \cmd{amount} binary operations. Here is an example.
271
272 \begin{calctab}
273 \amount{A rounded cost}{4506-6}
274 \amount{Positive rounded cost}{3598,30+1,70}
275 \add{Total (rounded)}
276 \end{calctab}
277
278 \begin{Verbatim}
279 \begin{calctab}
280 \amount{A rounded cost}{4506-6}
281 \amount{Positive rounded cost}{3598,30+1,70}
282 \add{Total (rounded)}
283 \end{calctab}
284 \end{Verbatim}
285
286
287 \subsubsection{Sum of sums}
288 The next table a 20\% deduction amount must be apply on the total of the first three values (see the F row). A solution is to assign a name for each rows and to write its list in the optional argument of \cmd{perc} command. Nevertheless, this sum is just computed in previus row, thus we can assign a name only to 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\}}.
289
290 \begin{calctab}[Plant project Fee Note:\\
291 Italian restaurant and pizzeria ``La Margherita'']
292 \amount{Design of the air conditioned plant}{5400}
293 \amount{Design of the electric plant and video surveillance}{8000}
294 \perc{General expence}{8,55}
295 \add[id=total]{Total amount of the design task}
296 \perc{Tax}{2}
297 \perc{VAT}{20}
298 \perc[total]{Deduction}{-20}
299 \add{Total}
300 \end{calctab}
301
302 The complete code is showed here:
303
304 \begin{Verbatim}
305 \begin{calctab}[Plant project Fee Note:\\
306 Italian restaurant and pizzeria ``La Margherita'']
307 \amount{Design of the air conditioned plant}{5400}
308 \amount{Design of the electric plant and video surveillance}{8000}
309 \perc{General expence}{8,55}
310 \add[id=total]{Total amount of design task}
311 \perc{Tax}{2}
312 \perc{VAT}{20}
313 \perc[total]{Deduction}{-20}
314 \add{Total}
315 \end{calctab}
316 \end{Verbatim}
317
318 \subsubsection{Interval selection}
319 The \emph{interval} selection of a elements list is simply an identification of consecutive elements. So we only need to specify the first and the last elements delimiters of the series. If the first delimeter is not an explicit information, we can give to the first list element this role. Equally, the default last element of the interval can be the last list element, if one is not available.
320
321 The \ct{} commands \cmd{perc} and \cmd{add} supports the 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 groups.
322
323 Is possible to combine the key \texttt{until} with the key \texttt{from} in the same optional argument to select a completely defined inner interval.
324 In case of a selection overlap, a package warning will be throw at compile time.
325
326 \begin{calctab}[The interval selection table]
327 \amount{One} {100000000}
328 \amount{Two} {20000000}
329 \amount{Three} {3000000}
330 \amount{Four} {400000}
331 \amount[id=five]{Five}{50000}
332 \inrule
333 \amount[id=six]{Six} {6000}
334 \amount{Seven} {700}
335 \amount{Eight} {80}
336 \amount{Nine} {9}
337 \add[until=five]{From one to five}
338 \add[from=six]{From six to nine}
339 \add[from=five,until=six]{From five to six}
340 \add{As well as total}
341 \end{calctab}
342
343 \begin{Verbatim}
344 \begin{calctab}[The interval selection table]
345 \amount {One}{100000000}
346 \amount {Two}{20000000}
347 \amount {Three}{3000000}
348 \amount {Four}{400000}
349 \amount[id=five]{Five}{50000}
350 \inrule
351 \amount[id=six] {Six}{6000}
352 \amount {Seven}{700}
353 \amount {Eight}{80}
354 \amount {Nine}{9}
355 \add[until=five]{From one to five}
356 \add[from=six]{From six to nine}
357 \add[from=five,until=six]{From five to six} % same of [five,six]
358 \add{As well as total}
359 \end{calctab}
360 \end{Verbatim}
361
362 An inner rule is adding \emph{manually} to the table with command \cmd{inrule} (that just sounds \emph{inner rule}).
363
364 \subsection{Environments formal syntax}
365 \subsubsection{\env{calctab} syntax}
366 The \env{calctab} environment syntax will be described in succession:
367
368 \medskip
369 \noindent\fbox{
370 \parbox{220pt}{
371 \noindent\cmd{begin}\texttt{\{calctab\}}\squarep{description paragraph}\smallskip
372
373 \hspace*{5mm}\meta{calctab commands list}\smallskip
374
375 \noindent\cmd{end}\texttt{\{calctab\}}
376 }
377 }\medskip
378
379 The \meta{calctab commands list} is a sequence of the internal commands \cmd{amount}, \cmd{perc}, \cmd{add} and \cmd{inrule}.\medskip
380
381 \noindent\fbox{\cmd{amount}\squarep{key-value identifier}\curlyp{description}\curlyp{value}}\medskip
382
383 \meta{key-value identifier} $=$ \texttt{id=}\meta{rowID};\medskip
384
385 \meta{description} $=$ \meta{text line};\medskip
386
387 \meta{value} $=$ \meta{decimal value} or \meta{basic binary operation}.\medskip
388
389 \noindent\fbox{\cmd{perc}\squarep{key-value list}\curlyp{description}\curlyp{percentage}}\medskip
390
391 \meta{key-value list} $=$ \texttt{id=}\meta{rowID}\texttt{,} \texttt{from=}\meta{rowID}\texttt{,} \texttt{until=}\meta{rowID}\texttt{,} \meta{rowID~list};\medskip
392
393 \meta{description} $=$ \meta{text line};\medskip
394
395 \meta{value} $=$ \meta{percentage decimal value}.\medskip
396
397 \noindent\fbox{\cmd{add}\squarep{key-value list}\curlyp{description}}\medskip
398
399 \meta{key-value list} $=$ \texttt{id=}\meta{rowID}\texttt{,} \texttt{from=}\meta{rowID}\texttt{,} \texttt{until=}\meta{rowID}\texttt{,} \meta{rowID~list};\medskip
400
401 \meta{description} $=$ \meta{text line}.\medskip
402
403 \noindent\fbox{\cmd{inrule}}\medskip
404
405
406 \subsubsection{\env{xcalctab} syntax}
407 The \pkg{xcalctab} environment syntax will be described in the next paragraph:
408
409 \medskip
410 \noindent\fbox{
411 \parbox{220pt}{
412 \noindent\cmd{begin}\texttt{\{xcalctab\}}\squarep{description paragraph}\smallskip
413
414 \hspace*{5mm}\meta{xcalctab commands list}\smallskip
415
416 \noindent\cmd{end}\texttt{\{xcalctab\}}
417 }
418 }
419 \medskip
420
421 The \meta{xcalctab commands list} is a sequence of the internal commands \cmd{amount}, \cmd{perc}, \cmd{add} and \cmd{inrule}.\medskip
422
423 \noindent\fbox{\cmd{amount}\squarep{key-value identifier}\curlyp{description}\curlyp{value1}\curlyp{value2}}\medskip
424
425 \meta{key-value identifier} $=$ \texttt{id=}\meta{rowID};\medskip
426
427 \meta{description} $=$ \meta{text line};\medskip
428
429 \meta{value1} $=$ \meta{decimal value};\medskip
430
431 \meta{value2} $=$ \meta{decimal value}.\medskip
432
433 \noindent\fbox{\cmd{perc}\squarep{key-value list}\curlyp{description}\curlyp{percentage}}\medskip
434
435 \meta{key-value list} $=$ \texttt{id=}\meta{rowID}\texttt{,} \texttt{from=}\meta{rowID}\texttt{,}
436 \texttt{until=}\meta{rowID}\texttt{,} \meta{rowID~list};\medskip
437
438 \meta{description} $=$ \meta{text line};\medskip
439
440 \meta{value} $=$ \meta{percentage decimal value}.\medskip
441
442 \noindent\fbox{\cmd{add}\squarep{key-value list}\curlyp{description}}\medskip
443
444 \meta{key-value list} $=$ \texttt{id=}\meta{rowID}\texttt{,} \texttt{from=}\meta{rowID}\texttt{,} \texttt{until=}\meta{rowID}\texttt{,} \meta{rowID~list};\medskip
445
446 \meta{description} $=$ \meta{text line}.\medskip
447
448 \noindent\fbox{\cmd{inrule}}\medskip
449
450 Please note that the \pkg{calctab} and \pkg{xcalctab} environments are based on the standard \LaTeX{} \env{tabular} environment, so you can manage your table as a float object all-surrounding it with a \pkg{table} environment.
451
452 \subsection{The table appearance commands (at the moment)}
453 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}.
454
455 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.
456
457 \bigskip
458 \noindent\fbox{\cmd{ctcurrency}\curlyp{user text}}
459
460 \smallskip
461
462 \noindent\fbox{\cmd{ctdescription}\curlyp{user text}}
463
464
465 \bigskip
466 A table example show explicit assignment of the description text and currency unit after this commands:
467
468 \begin{Verbatim}
469 \ctdescription{Your bill, thanks a lot.}
470 \ctcurrency{USD}
471 \end{Verbatim}
472
473 \ctdescription{Your bill, thanks a lot.}
474 \ctcurrency{USD}
475
476 \begin{calctab}
477 \amount[id=dinner]{Five dinner}{146}
478 \amount[id=breakfast]{Five breakfast}{35}
479 \perc[dinner]{Discount}{-8}
480 \perc[breakfast]{Discount}{-4}
481 \add{Grand total}
482 \end{calctab}
483
484 The default english text in percentage row can be changed in the same way with the command \cmd{ctontranslation}.
485
486 \bigskip
487 \noindent\fbox{\cmd{ctontranslation}\curlyp{on traslation}}
488 \bigskip
489
490 and the headers of the two \env{xcalctab} numeric columns can be setting with
491
492 \bigskip
493 \noindent\fbox{\cmd{ctheaderone}\curlyp{first text header}}
494 \noindent\fbox{\cmd{ctheadertwo}\curlyp{second text header}}
495 %
496 %
497 %
498 \subsection{Incrementing the table width}
499 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:
500
501 \medskip
502 \texttt{\cmd{setlength}\{\cmd{ctsep}\}\{28pt\}}
503
504
505 %
506 %
507 %
508 \newcommand{\closetable}[1][10]{
509 \add{Subtotal}
510 \perc{Tax}{#1}
511 \add{Total}
512 }
513 %
514 \newcommand{\billtab}[2][10]{%
515 \begin{calctab}[This is my table]
516 \amount{Confirmed cost}{#2}
517 \perc{Tax}{#1}
518 \add{Total}
519 \end{calctab}}
520 %
521 \ctdescription{Description}
522 \ctcurrency{\euro}
523 %
524 %
525 %
526 \subsection{New command with \ct{} environments}
527 Some cases requires repetitive tasks with tables. How \ct{} can help to do these?
528
529 \subsubsection{One command, one table}
530 A table similar to \env{calctab} basic structure can to be build with a unique command.
531
532 \begin{Verbatim}
533 \newcommand{\billtab}[2][10]{% two arg command
534 \begin{calctab}[This is my table]
535 \amount{Confirmed cost}{#2}
536 \perc{Tax}{#1}
537 \add{Total}
538 \end{calctab}}
539 \end{Verbatim}
540
541 When you write: \verb=\billtab{2800}= you achieved this table:
542
543 \billtab{2800}\bigskip
544
545 and with the command \verb=\billtab[20]{2000}= you achieved:
546
547 \billtab[20]{2000}
548
549 %
550 %
551 %
552 \subsubsection{Inner table command}
553
554 Sometimes is useful to insert only one command to insert several rows of \ct{} computation. The next code is an example.
555
556 \begin{Verbatim}
557 \newcommand{\closetable}[1][10]{
558 \add{Subtotal}
559 \perc{Tax}{#1}
560 \add{Total}
561 }
562 \end{Verbatim}
563
564 With this command the user can write shortly:
565
566 \begin{Verbatim}
567 \begin{calctab}
568 \amount{Cost}{1200}
569 \amount{Save pricing}{-400}
570 \closetable
571 \end{calctab}
572 \end{Verbatim}
573
574 \begin{calctab}
575 \amount{Cost}{1200}
576 \amount{Save pricing}{-400}
577 \closetable
578 \end{calctab}
579
580
581
582 %
583 %
584 %
585 \section{\ct{} idea}
586 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.
587
588 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.
589
590 \section{ToDo}
591 A big work remain to do until the release 1.0 version: a language design and implementation too of a new user interface that make easy modify the view paramenter of the table such as the type of label row (number, letter and so on), or to define the description text in the header column.
592
593
594 This list report tasks:
595
596 \begin{itemize}
597 \item write in good english the package documentation;
598 \item internationalization of the fixed text in table and the currency unit;
599 \item data input and inner commands language development;
600 \item new infrastructure to manage the table view properties;
601 \item \dots
602 \end{itemize}
603
604 \section{Package License}
605 This work may be distributed and/or modified under the
606 conditions of the \LaTeX{} Project Public License, either version 1.3
607 of this license or any later version.
608 The latest version of this license is in
609 \url{http://www.latex-project.org/lppl.txt}
610 and version 1.3 or later is part of all distributions of \LaTeX{}
611 version 2005/12/01 or later.
612
613
614 \section{Thanks and acknowledgments}
615
616 The enthusiasm raised during GuIT\emph{meeting}2008 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 suggest me by Norbert Preining (Vienna University of Technology) to upload on CTAN the code in experimental section, finally persuade me to publish this work.
617
618 Thanks GuIT\emph{meeting}2008 people, thanks Norbert.
619
620 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 the tabular cells, and solve consequent \verb=\expandafter= \emph{jungle}.
621
622 Thanks a lot to the authors of the packages used by \pkg{calctab}.
623
624 And finally, thanks to my family.
625
626 Every comment are welcome as well as any language discussion, so don't esitate to send to me an e-mail message with your opinion, suggestion or desiderata, or to leave a public comment in my site blog\footnote{Blog site address: \url{http://robitex.wordpress.com/calctab-package/}}. Thank you.
627
628
629
630 \section{Change history}
631
632 \begin{tabular}{lccp{247pt}}\toprule
633 Ver. & N. & Date & Improvement description\\\midrule
634 0.5 & & 2009/02/23 & first \ct{} CTAN release\\\midrule
635 & 1 & 2009/03/03 & New \cmd{inrule} command to manual draw a rule
636 among the table rows\\
637 & 2 & 2009/03/03 & Fixed bug: the absense of a rule after an add row\\
638 & 3 & 2009/03/05 & New \env{xcalctab} environment (extended environment
639 with the ``quantity'' and ``price'' columns)\\
640 & 4 & 2009/03/10 & New feature: automatic short of the description
641 string (A+B+C+$\cdots$) if it's long than more five items\\
642 & 5 & 2009/03/10 & Substituted the standard \LaTeX{} command \cmd{Alph}
643 with \cmd{AlphAlph} by Heiko Oberdiek to eliminate
644 the 26 rows limit in label column\\
645 & 6 & 2009/03/12 & New feature for \cmd{amount} command: basic binary
646 operation with two numbers implemented with the \pkg{xstring}
647 package\\
648 & 7 & 2009/03/12 & Some minor internal code adjustments\\\midrule
649 0.6 & & 2009/03/29 & CTAN upload of the new version\\\midrule
650 & 1 & 2009/06/26 & Fixed parsing of negative numbers in the \cmd{amount}
651 command binary operations\\
652 & 2 & 2009/07/12 & User manual improvement\\\midrule
653 0.6.1 & & 2009/07/14 & CTAN upload of the maintenance release\\\bottomrule
654 \end{tabular}
655
656 \end{document}
657
658