summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2009-11-17 17:56:07 +0000
committerKarl Berry <karl@freefriends.org>2009-11-17 17:56:07 +0000
commit8caf232ea678d2a7c51b476be84aec1fc9e17423 (patch)
treef8edaa58283c01188f78d5126dd2821abef7c107 /Master
parent7c18d8c655e3ec05cb6c9479f08abcc7a98c28ac (diff)
new latex package spreadtab 0.1 (3nov09)
git-svn-id: svn://tug.org/texlive/trunk@16050 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/spreadtab/README24
-rw-r--r--Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_en.pdfbin0 -> 670143 bytes
-rw-r--r--Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_en.tex1060
-rw-r--r--Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_fr.pdfbin0 -> 700145 bytes
-rw-r--r--Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_fr.tex1060
-rw-r--r--Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_vn.pdfbin0 -> 711085 bytes
-rw-r--r--Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_vn.tex1013
-rw-r--r--Master/texmf-dist/tex/latex/spreadtab/spreadtab.sty1360
-rwxr-xr-xMaster/tlpkg/bin/tlpkg-ctan-check2
-rw-r--r--Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc1
-rw-r--r--Master/tlpkg/tlpsrc/spreadtab.tlpsrc0
11 files changed, 4519 insertions, 1 deletions
diff --git a/Master/texmf-dist/doc/latex/spreadtab/README b/Master/texmf-dist/doc/latex/spreadtab/README
new file mode 100644
index 00000000000..a5612028f3a
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/spreadtab/README
@@ -0,0 +1,24 @@
+_____________________
+
+ spreadtab package
+ v0.1
+ 2009/11/03
+_____________________
+
+This package provides spreadsheet features for LaTeX table environments.
+
+It allows to construct tables in a manner similar to a spreadsheet. The cells
+of a table have row and column indices and these can be used in formulas to
+generate values in other cells.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+Ce package permet d'imiter le fonctionnement d'un tableur dans les
+environnements tableau de LateX.
+
+Les cellules d'un tableau ont des coordonnées représentant leur ligne et
+colonne, et par cet intermédiaire, peuvent être insérées dans des formules
+pour générer des valeurs dans d'autres cellules.
+
+ Christian Tellechea
+ <unbonpetit@gmail.com> \ No newline at end of file
diff --git a/Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_en.pdf b/Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_en.pdf
new file mode 100644
index 00000000000..089f6ab0fe3
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_en.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_en.tex b/Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_en.tex
new file mode 100644
index 00000000000..1419c90311d
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_en.tex
@@ -0,0 +1,1060 @@
+% ____________________________________________________________________________
+% | |
+% | |
+% | spreadtab v0.1 |
+% | |
+% | November 3 2009 |
+% | |
+% |___________________________________________________________________________|
+%
+% This file is spreadtab_doc_en.tex, the source code of the english manual of
+% the spreadtab package.
+%
+% Copyright Christian Tellechea 2009
+% email : unbonpetit@gmail.com
+%
+% -------------------------------------------------------------------
+% 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.
+% -------------------------------------------------------------------
+\documentclass[a4paper,10pt]{article}
+\usepackage[utf8]{inputenc}
+\usepackage[T1]{fontenc}
+\usepackage{lmodern}
+\usepackage[a4paper,margin=2.5cm]{geometry}
+\usepackage{amsmath,amssymb}
+\usepackage{array}
+\usepackage{colortbl}
+\usepackage{tabularx}
+\usepackage{xcolor}
+\usepackage{listings}
+\usepackage{numprint}
+\usepackage{xspace}
+\usepackage[bottom]{footmisc}
+\usepackage{spreadtab}
+\usepackage{fancyhdr}
+ \fancyhead[L]{}
+ \fancyhead[C]{\small\bfseries\ST}
+ \fancyhead[R]{\scriptsize\slshape\leftmark}
+ \fancyfoot[l]{\tiny\LaTeX'd by Christian \textsc{Tellechea}, \today.}
+ \fancyfoot[c]{}
+ \fancyfoot[r]{\thepage}
+\usepackage[english]{babel}
+
+\makeatletter
+\definecolor{ST@bckgcolor}{rgb}{0.87,0.9,1}
+\definecolor{ST@codebckgcolor}{rgb}{0.9,0.9,0.9}
+\definecolor{ST@keywordstc}{rgb}{0.7,0,0}
+\definecolor{ST@keywordslatex}{rgb}{0,0,1}
+\definecolor{ST@arguments}{rgb}{0,0,0}
+\definecolor{ST@comments}{rgb}{0.5,0.5,0.5}
+\lstset{%
+ language=[AlLaTeX]TeX,float=hbp,basicstyle=\footnotesize\ttfamily,identifierstyle=\color{ST@arguments},%
+ keywordstyle=\color{ST@keywordslatex},commentstyle=\itshape\color{ST@comments},%
+ columns=fixed,tabsize=4,frame=single,extendedchars=false,%
+ showspaces=false,showstringspaces=false,numbers=left,numberstyle=\tiny\ttfamily,%
+ breaklines=true,breakindent=3em,backgroundcolor=\color{ST@bckgcolor},breakautoindent=true,%
+ captionpos=t,xleftmargin=1em,xrightmargin=1em,lineskip=0pt,%
+ numbersep=1em,classoffset=1,%
+ morekeywords={% les macros et commandes de spreadtab
+ spreadtab,SThiderow,SThidecol,STsavecell,STautoround,STmessage,%
+ STnumericfieldmarker,STtextcell,fact,ifeq,ifgt,iflt,numtofrshortdate,%
+ numtoengshortdate,numtofrlongdate,numtoenglongdate,numtofrmonth,%
+ numtoengmonth,numtofrday,numtoengday,sum,rand,randint,sumprod,%
+ frshortdatetonum,engshortdatetonum,englongdatetonum,frlongdatetonum},%
+ keywordstyle=\color{ST@keywordstc},classoffset=0}
+\makeatother
+
+\newcommand\verbinline{\lstinline[breaklines=false,basicstyle=\normalsize\ttfamily]}
+\newcommand\ST{\textsf{spreadtab}\xspace}
+\newcommand\falseverb[1]{\texttt{\detokenize{#1}}}
+
+\usepackage[a4paper,bookmarks=true,bookmarksopen=true,colorlinks=true,hyperfootnotes=false,filecolor=black,linkcolor=blue,urlcolor=magenta,pdfauthor={Christian TELLECHEA},pdftitle={spreadtab},pdfsubject={Spreadtab provides spreadsheet features for LaTeX table environments},pdfkeywords={spreadtab},pdfcreator={LaTeX}]{hyperref}
+
+\begin{document}
+\parindent0pt\pagestyle{fancy}
+\begin{titlepage}
+ \null\par\vfill
+ \begin{center}
+ \begin{minipage}{0.75\linewidth}
+ \begin{center}
+ \Huge\bfseries \ST\par\vspace{5pt}
+ \small v\csname ST@ver\endcsname\par\vspace{25pt}
+ \normalsize User's manual
+ \end{center}
+ \end{minipage}
+ \end{center}
+ \vspace{1cm}
+ \begin{center}
+ Christian {\sc Tellechea}\par\small
+ \href{mailto:unbonpetit@gmail.com}{\texttt{\textbf{unbonpetit@gmail.com}}}\par\vspace{5pt}
+ \csname ST@eng@date\endcsname
+ \end{center}
+ \vfill
+ \begin{center}
+ \begin{minipage}{0.8\linewidth}
+ \noindent\hrulefill\par
+ \hfill\textbf{\textit{Abstract}}\hfill{}\medskip\par\footnotesize
+ This package provides spreadsheet features for \LaTeX{} table environments.\par\medskip
+ The main feature allows the user to construct tables in a manner similar to a spreadsheet where cells are used in formulas to generate values in other cells. The package computes the formulas in the correct order and finally displays the table with the numeric results.\par
+ \hrulefill
+ \end{minipage}
+ \end{center}
+\vfill{}
+\end{titlepage}
+
+\tableofcontents\newpage
+\parskip\medskipamount
+\section{Introduction}
+\subsection{Presentation}
+This package allows us to construct tables in a manner similar to a spreadsheet. The cells of a table have row and column indices and these can be used in formulas to generate values in other cells.
+
+The package requires $\varepsilon$-\TeX, \LaTeXe{} and the \href{http://www.ctan.org/tex-archive/macros/latex/contrib/fp/}{\texttt{\textbf{fp}}} package, which performs arithmetic on cell values. Also, the \href{http://www.ctan.org/tex-archive/macros/latex/contrib/xstring/}{\texttt{\textbf{xstring}}} package is needed in its \falseverb{v1.5c [2009/06/05]} version or later.\medskip
+
+The package is compatible with \emph{all} tabular environments, and assumes that `\verb=&=' is used to delimit columns and `\verb-\\-' to end the lines. This compatibility requirement led me to program \ST so that it works independently of the table environment. Thus, reading the table, processing and calculating the formulas is done \emph{before} the environment table `sees' the body of the table.\medskip
+
+Consequently, \ST proceeds in 3 main stages before \verbinline=\begin{<table environment>}= sees the table:
+\begin{itemize}
+ \item first, it reads the body of the table, divides it in lines and cells, and in each cell, seeks a possible formula;
+ \item then, it computes the formulas in the cells, taking care for each to previously calculate all the dependent cells. The calculations are done by the \href{http://www.ctan.org/tex-archive/macros/latex/contrib/fp/}{\texttt{\textbf{fp}}} package;
+ \item finally, it is necessary to rebuild the table, replacing each formula by its numerical calculated value and handing over to the environment name specified by the user.
+\end{itemize}
+Here is the syntax:\par\nobreak
+\begin{lstlisting}[backgroundcolor=\color{ST@codebckgcolor}]
+\begin{spreadtab}{{<name of table environment>}<parameters of environment>}
+ table with formulas and numbers
+\end{spreadtab}
+\end{lstlisting}
+after the work of \ST, we get a display as if we had written:
+\begin{lstlisting}[backgroundcolor=\color{ST@codebckgcolor}]
+\begin{<name of table environment>}<parameters of environment>
+ table with numbers
+\end{<name of table environment>}
+\end{lstlisting}
+Although having features resembling those of a spreadsheet with \LaTeX{} is appreciable, the 3 stages described above take time, and above all, \verb-fp- is slow in its calculations. The \ST environment leads to \emph{much slower compilation} than with a classical table.
+
+Moreover, \ST \emph{cannot stand in for a spreadsheet program}. Indeed, it has very few features, and it does not provide visual assistance. This point may cause difficulty\footnote{I certify that, with the use, this discomfort tends to disappear (if you do not work with huge tables, of course).} for big or complex tables. The syntax of \ST is also another difficulty. In fact, the advantage of this package is that it makes possible to write \emph{in the \LaTeX{} code} tables invloving calculation when these tables are usually exported\footnote{I mention the main two exportation programs: \href{http://calc2latex.sourceforge.net/}{\texttt{\textbf{cacl2latex}}} for `calc' (Open Office), and \href{http://www.ctan.org/tex-archive/support/excel2latex/}{\texttt{\textbf{excel2latex}}} for `excel' (Microsoft Office).} from a spreadsheet program to \LaTeX{} code. Consequently, it becomes possible to avoid the disadvantages of the exportation programs: fine tuning often necessary to obtain exactly what you want, exported tables containing the values only (formulas are lost when exportation is done), no compatibility with all types of environments, exportation must be started again if a single number or formulas is modified in the table.
+
+\subsection{Motivation}
+A few months before I started to write this package, Derek \textsc{O'Connor} had pointed out that nothing was available in the world of \LaTeX{} packages to imitate --~even a little~-- the behaviour of spreadsheet programs. I found the challenge interesting and I started writing in this package which is only a good programming exercise.
+
+Indeed, the main algorithm contained in \ST that determines the order in which the cells must be calculated is quite general and not specific to \LaTeX. Other \LaTeX{} oriented algorithms analyze cells and formulas to find references to other cells. The exercise is interesting because for programming, \TeX{} does not provide anything resembling a pointer, useful to build linked lists of cells to calculate. Nothing is available either to attach to a `variable' `chils fields' which you can choose the type.
+
+The road was long before reaching this first version and I especially want to thank Christophe \textsc{Casseau} for his early interest and for the suggestions he made, and more recently Derek \textsc{O'Connor} for his advice and for the constructive discussions we have had. I also thank Huu Dien Khue~\textsc{Le} for the Vietnamese translation of this manual.
+
+\section{Basic features}
+A table is a rectangular array of cells which may be viewed as a set cells arranged in horizontal rows or vertical columns.
+
+\subsection{Absolute references}
+A table cell is identified by the pair \falseverb{<colref><rowref>}\footnote{Note: this is the opposite to the standard matrix convention}, where:
+\begin{itemize}
+ \item \verb|<colref>| is a letter from \falseverb a to \falseverb z, and \falseverb a is the first column on the left: it is limited to 26 columns, which should be sufficient for the majority of cases; the letter can be upper or lowercase;
+ \item \verb|<rowref>| is a positive integer representing row number. The row number 1 is the top row.
+\end{itemize}
+Here are examples of absolutes references: \falseverb{b4} or \falseverb{C1} or \falseverb{d13}.
+
+This example calculates the sum each row and each column and then calculates the grand total:\par\nobreak
+\begin{minipage}{0.75\linewidth}
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{rr|r}}
+22 & 54 & a1+b1 \\
+43 & 65 & a2+b2 \\
+49 & 37 & a3+b3 \\
+\hline
+a1+a2+a3 & b1+b2+b3 & a4+b4
+\end{spreadtab}
+\end{lstlisting}
+\end{minipage}%
+\begin{minipage}{0.25\linewidth}
+\centering
+\begin{spreadtab}{{tabular}{rr|r}}
+22 & 54 & a1+b1 \\
+43 & 65 & a2+b2 \\
+49 & 37 & a3+b3 \\
+\hline
+a1+a2+a3 & b1+b2+b3 & a4+b4
+\end{spreadtab}
+\end{minipage}%
+
+For people familiar with maths, this other example calculates the first lines of Pascal's triangle:\par\nobreak
+\begin{minipage}{0.75\linewidth}
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{ccccc}}
+1 & & & & \\
+a1 & a1 & & & \\
+a2 & a2+b2 & b2 & & \\
+a3 & a3+b3 & b3+c3 & c3 & \\
+a2 & a4+b4 & b4+c4 & c4+d4 & d4
+\end{spreadtab}
+\end{lstlisting}
+\end{minipage}%
+\begin{minipage}{0.25\linewidth}
+\centering
+\begin{spreadtab}{{tabular}{ccccc}}
+1 & & & & \\
+a1 & a1 & & & \\
+a2 & a2+b2 & b2 & & \\
+a3 & a3+b3 & b3+c3 & c3 & \\
+a2 & a4+b4 & b4+c4 & c4+d4 & d4
+\end{spreadtab}
+\end{minipage}%
+
+\subsection{Relative references}
+To refer to a cell, it may be convenient to specify its position relatively to where the formula is written. Thus, the relative coordinates of a cell are 2 relative numbers written using this syntax: \falseverb{[x,y]} where \falseverb x is the horizontal offset from the cell containing the formula and \falseverb y is the vertical offset. For example, \falseverb{[-2,3]} refers to the cell located 2 columns before (on the left) and 3 rows after (below) the cell where the formula is located.
+
+Here is the same table as above but the references are relatives and the \verbinline-matrix- environment of the \href{http://www.ctan.org/tex-archive/macros/latex/required/amslatex/math/}{\texttt{\textbf{amsmath}}} is used:\par\nobreak
+\begin{minipage}{0.82\linewidth}
+\begin{lstlisting}
+$
+\begin{spreadtab}{{matrix}{}}
+1\\
+[0,-1] & [-1,-1]\\
+[0,-1] & [-1,-1]+[0,-1] & [-1,-1]\\
+[0,-1] & [-1,-1]+[0,-1] & [-1,-1]+[0,-1] & [-1,-1]\\
+[0,-1] & [-1,-1]+[0,-1] & [-1,-1]+[0,-1] & [-1,-1]+[0,-1] & [-1,-1]
+\end{spreadtab}
+$
+\end{lstlisting}
+\end{minipage}\hfill
+\begin{minipage}{0.15\linewidth}
+\centering
+$
+\begin{spreadtab}{{matrix}{}}
+1\\
+[0,-1] & [-1,-1]\\
+[0,-1] & [-1,-1]+[0,-1] & [-1,-1]\\
+[0,-1] & [-1,-1]+[0,-1] & [-1,-1]+[0,-1] & [-1,-1]\\
+[0,-1] & [-1,-1]+[0,-1] & [-1,-1]+[0,-1] & [-1,-1]+[0,-1] & [-1,-1]
+\end{spreadtab}
+$
+\end{minipage}%
+
+We note that relative references are more appropriate here, since only 2 different references are used: \falseverb{[0,1]} which refers to the cell below and \falseverb{[-1,1]} which refers to the cell located at the SW of the current cell.\medskip
+
+Absolute and relative references can be mixed in a formula.
+
+\subsection{Text cells}
+If you want to put only text in a cell, you must tell \ST that the cell should not be calculated. Simply place somewhere in the cell character `\falseverb @' with its usual catcode 12. The cell will be ignored by \ST which will consider it as an inert cell impossible to refer\footnote{There is an exception, see page \pageref{datetonum}.} elsewhere in the table.
+
+Example:\par\nobreak
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{|r|ccc|}}
+\hline
+@ values of de $x$ & -5 & -1 & 4 \\
+@ $f(x)=2x$ & 2*[0,-1] & 2*[0,-1] & 2*[0,-1] \\\hline
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{|r|ccc|}}
+\hline
+@ values of $x$ & -5 & -1 & 4 \\
+@ $f(x)=2x$ & 2*[0,-1] & 2*[0,-1] & 2*[0,-1] \\\hline
+\end{spreadtab}
+\end{center}
+The control sequence \verbinline=\STtextcell= expands to the character `\falseverb @'. It is possible to redefine it, for example, after \verbinline-\renewcommand\STtextcell{\celltext}-, a cell containing \verb=\celltext= will be understood as a text cell.
+
+Moreover, if a cell is empty or filled with spaces, \ST will consider it as a text cell.
+
+\subsection{Mixed cells}
+In reality, each cell is composed of two fields. The first is a \emph{numeric field} containing the formula; the second is a \emph{text field}, ignored by \falseverb{fp} and not taken into account for calculations:
+\begin{itemize}
+ \item if nothing is specified in a cell, the entire cell is the number field, and the text field is empty (this was the case for all table cells of Pascal's triangle seen above);
+ \item if the cell contains the `\falseverb @' character, then the entire cell is the text field. The numeric field is empty and inaccessible;
+ \item if the cell contains the marker `\verb-:=-', then the following argument between braces is the numeric field, and everthing else is the text field. The cell has this structure:\par
+ \hfil\verb-<text field>:={numeric field}<end of text field>-\hfil\null\par
+ The marker `\verb-:=-' is the expansion of the control sequence \verbinline-\STnumericfieldmarker-. It is possible to redefine it, for example:\par\smallskip
+ {\centering\verbinline-\renewcommand\STnumericfieldmarker{\=}-\par\smallskip}
+ In this case, the expansion of the marker `\verb-\=-' would have no importance and would not be invloved in the process. For \ST, it is only a token showing where the formula begins. This token is sought and recognized but is never expanded.
+\end{itemize}
+Once the \falseverb{numeric field} is computed, `\falseverb{:={numeric field}}' is replaced by the numeric value.
+
+Note that '\verb-:={numeric field}-` may be inside brackets, whatever be the level of nesting. For example, if a cell contains \verb-\textbf{:={a1+1}}- and if the numeric value of the cell \falseverb{a1} is 5, then finally, the cell will contain \verb-\textbf{6}-\medskip
+
+Here is a simple example:\par\nobreak
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{|c|c||c|}}\hline
+value 1 : :={50} & value 2 : :={29} & average : \textbf{:={(a1+b1)/2}}\\\hline
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{|c|c||c|}}\hline
+value 1 : :={50} & value 2 : :={29} & average : \textbf{:={(a1+b1)/2}}\\\hline
+\end{spreadtab}
+\end{center}
+If '\verb-:=-` has an empty argument like this '\verb-:={}-`, then the cell is understood as a text cell. It is a synonym of '\falseverb{@}`.
+
+\section{Features for formatting the table}
+\subsection{End of lines and horizontal rules}
+\ST recognizes the usual line breaks and horizontal rules \verb|\\| and \verb|\hline|. Also, it may use the optional argument in line break: \verb-\\[<dimension>]-.
+
+For horizontal rule, it is possible to use:\par\nobreak
+\begin{itemize}
+ \item \verb-\hline-;
+ \item \verb=\cline{x-y}= where \falseverb x and \falseverb y define the start and the end of the rule;
+ \item \verb=\hhline{<type>}= where \verb=<type>= is the type of rule (read the manual of the \href{http://www.ctan.org/tex-archive/macros/latex/required/tools/}{\texttt{\textbf{hhline}}} package).
+\end{itemize}
+Example:
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{*5c}}
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]\\[1em]
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1] & \\
+[0,1] & [-1,1]+[0,1] & [-1,1] & & \\ \hline\hline
+[0,1] & [-1,1] & & & \\ \cline{2-4}
+1 & & & & \\ \hline
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{*5c}}
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]\\[1em]
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1] & \\
+[0,1] & [-1,1]+[0,1] & [-1,1] & & \\ \hline\hline
+[0,1] & [-1,1] & & & \\ \cline{2-4}
+1 & & & & \\ \hline
+\end{spreadtab}
+\end{center}
+
+\subsection{Hide a row or column}
+Sometimes, a column or a row is intended for intermediate calculations and does not need to be displayed in the final table. For this, \ST provides two control sequences \verbinline=\SThiderow= and \verbinline=\SThidecol= which, when placed in a cell, hide the row or column that contains the cell.
+
+An example:\par\nobreak
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{|r|ccc|}}
+\hline
+@ values of $x$ & -1 & 0\SThidecol & 2 & 3 \\\hline
+@$f(x)=2x-1$ & 2*[0,-1]-1 & 2*[0,-1]-1 & 2*[0,-1]-1 & 2*[0,-1]-1 \\
+@$g(x)=x-10$\SThiderow & [0,-2]-10 & [0,-2]-10 & [0,-2]-10 & [0,-2]-10 \\
+@$h(x)=1-x$ & 1-[0,-3] & 1-[0,-3] & 1-[0,-3] & 1-[0,-3] \\\hline
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{|r|ccc|}}
+\hline
+@ values of $x$ & -1 & 0\SThidecol & 2 & 3 \\\hline
+@$f(x)=2x-1$ & 2*[0,-1]-1 & 2*[0,-1]-1 & 2*[0,-1]-1 & 2*[0,-1]-1 \\
+@$g(x)=x-10$\SThiderow & [0,-2]-10 & [0,-2]-10 & [0,-2]-10 & [0,-2]-10 \\
+@$h(x)=1-x$ & 1-[0,-3] & 1-[0,-3] & 1-[0,-3] & 1-[0,-3] \\\hline
+\end{spreadtab}
+\end{center}
+The row containing $g(x)$ and column corresponding to the value 0 are hidden.
+
+You must be remember that the hidden rows and columns are \emph{invisible} to the tabular environment chosen by the user. Thus, only 4 columns have been defined (\falseverb{|r|ccc|}) and not 5 as seen by \ST.
+
+Just to see the difference, here is the table obtained when setting 5 columns in the preamble and not hiding any row or column:\par\nobreak
+\begin{center}
+\begin{spreadtab}{{tabular}{|r|cccc|}}
+\hline
+@ values of $x$ & -1 & 0 & 2 & 3 \\\hline
+@$f(x)=2x-1$ & 2*[0,-1]-1 & 2*[0,-1]-1 & 2*[0,-1]-1 & 2*[0,-1]-1 \\
+@$g(x)=x-10$ & [0,-2]-10 & [0,-2]-10 & [0,-2]-10 & [0,-2]-10 \\
+@$h(x)=1-x$ & 1-[0,-3] & 1-[0,-3] & 1-[0,-3] & 1-[0,-3] \\\hline
+\end{spreadtab}
+\end{center}
+
+\subsection{Save the result of a cell}
+It may be necessary to save the numerical value of a cell to display it outside of a formula or even outside of the table. Here is how to do it:
+\begin{center}
+\verbinline-\STsavecell{<control sequence>}{<absolute reference>}-
+\end{center}
+With a \verbinline-\global\def-\footnote{The \texttt{\string\def} command does not check if the macro it defines already exists.}, this command globally saves in \falseverb{<control sequence>} the result of the formula contained in the cell \falseverb{<absolute reference>}.\medskip
+
+Only absolute references can be used since this command must be placed in the optional argument of the \verbinline-spreadtab- environment.
+
+Example:\par\nobreak
+\begin{lstlisting}
+\begin{spreadtab}[\STsavecell\result{c1}]{{tabular}{|c|c|c|c|c|}}
+\hline
+10 & a1+10 & b1+10 & a1+b1+c1 & @cell c1 : \result\\\hline
+\end{spreadtab}
+\par\medskip
+Here is the cell c1 : \result
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}[\STsavecell\result{c1}]{{tabular}{|c|c|c|c|c|}}
+\hline
+10 & a1+10 & b1+10 & a1+b1+c1 & @cell c1 : \result\\\hline
+\end{spreadtab}
+\par\medskip
+Here is the cell c1 : \result
+\end{center}
+In order to save several cells, the command \verbinline-\STsavecell- can be put several times in the optionnal argument.
+
+Example:\par\nobreak
+\begin{lstlisting}
+\begin{spreadtab}[\STsavecell\hhh{b3}\STsavecell\mmm{c3}\STsavecell\sss{d3}]{{tabular}{|rc|}}\hline
+@Speed (km/h) &\SThidecol&\SThidecol&\SThidecol& 35 \\
+@distance (km) & & & & 180\\\hline
+@Time (h min s) & trunc(e2/e1,0) & trunc(60*(e2/e1-b3),0) & trunc(3600*(e2/e1-b3)-60*c3,1) &@\hhh\ h \mmm\ min \sss\ s\\\hline
+\end{spreadtab}\par\medskip
+It lasts more than \hhh\ hours.
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}[\STsavecell\hhh{b3}\STsavecell\mmm{c3}\STsavecell\sss{d3}]{{tabular}{|rc|}}\hline
+@Speed (km/h) &\SThidecol&\SThidecol&\SThidecol& 35 \\
+@distance (km) & & & & 180\\\hline
+@Time (h min s) & trunc(e2/e1,0) & trunc(60*(e2/e1-b3),0) & trunc(3600*(e2/e1-b3)-60*c3,1) &@\hhh\ h \mmm\ min \sss\ s\\\hline
+\end{spreadtab}\par\medskip
+It lasts more than \hhh\ hours.
+\end{center}
+
+\subsection{The use of \ttfamily\textbackslash multicolumn}
+\ST is compatible with the syntax \verbinline=\multicolumn{<number>}{<type>}{<content>}= which merges \falseverb{<number>} cells in unique cell whose type and content are specified in the arguments.
+
+Even when using \verbinline=\multicolumn=, \ST maintains some consistency in the references. In this table where \verbinline-\multicolumn- is used, the absolute references are displayed:\par\nobreak
+\begin{center}
+\ttfamily
+\begin{tabular}{|*7{c|}}\hline
+a1&b1&c1&d1&e1&f1&g1\\\hline
+a2&\multicolumn{2}{l|}{b2}&d2&e2&f2&g2\\\hline
+\multicolumn{3}{|l|}{a3}&d3&\multicolumn{2}{l|}{e3}&g3\\\hline
+\end{tabular}
+\end{center}
+Thus, whatever be the number of merged cells, the next cell has a column number that take into account the number of merged cells.\medskip
+
+In the last line, cells \falseverb{a3}, \falseverb{b3} and \falseverb{c3} are merged and consequently, the cells \falseverb{b3} and \falseverb{c3} \emph{do not exist} for \ST: it is not possible to refer to \falseverb{b3} or \falseverb{c3} anywhere in the table.\medskip
+
+In this example, every number in the top line is the product of the 2 numbers below:\par\nobreak
+\begin{lstlisting}
+\newcolumntype{K}[1]{@{}>{\centering\arraybackslash}p{#1cm}@{}}
+\begin{spreadtab}{{tabular}{*6{K{0.5}}}}
+\cline{2-5}
+&\multicolumn{2}{|K{1}|}{:={a2*c2}} & \multicolumn{2}{K{1}|}{:={c2*e2}} &\\\hline
+\multicolumn{2}{|K{1}}{:=8}&\multicolumn{2}{|K{1}}{:=7}&\multicolumn{2}{|K{1}|}{:=6}\\\hline
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\newcolumntype{K}[1]{@{}>{\centering\arraybackslash}p{#1cm}@{}}
+\begin{spreadtab}{{tabular}{*6{K{0.5}}}}
+\cline{2-5}
+&\multicolumn{2}{|K{1}|}{:={a2*c2}} & \multicolumn{2}{K{1}|}{:={c2*e2}} &\\\hline
+\multicolumn{2}{|K{1}}{:=8}&\multicolumn{2}{|K{1}}{:=7}&\multicolumn{2}{|K{1}|}{:=6}\\\hline
+\end{spreadtab}
+\end{center}
+The marker `\falseverb{:=}' is necessary in every cell where the command \verbinline-\multicolumn- is written. Without it, \ST would consider that the whole cell (i.e. \verb-\multicolumn{2}{|c|}{<formula>}-) as the formula, which is impossible to calculate.
+
+\subsection{Number formatting and the {\ttfamily fp} package}
+All calculations are made by the \verb-\FPeval- macro\footnote{This macro accepts infix or postfix notation. Consequently, both can be used to write formulas in a cell. For example the infix formula '\falseverb{a1+b1}' is equivalent to the postfix ones '\falseverb{a1 b1 add}' or '\falseverb{a1 b1 +}'.} of the \href{http://www.ctan.org/tex-archive/macros/latex/contrib/fp/}{\texttt{\textbf{fp}}} package. This package provides all necessary along with various scientific and trigonometric functions. Calculations are made with 18 decimal digits of precision, and \falseverb{fp} displays \emph{all} the decimals!
+
+The number of digits displayed can be controlled in various ways:
+\begin{itemize}
+ \item the \href{http://www.ctan.org/tex-archive/macros/latex/contrib/numprint/}{\texttt{\textbf{numprint}}} package can be used in order to properly display numbers;
+ \item \verb=fp= can round or truc numbers with \verb-round(number,integer)- or \verb-trunc(number,integer)- but the syntax makes this tedious to write if this is needed for many cells;
+ \item \ST can round \emph{all} the numbers in the table with the macro \verbinline-\STautoround- whose argument is number of digits in the decimal part. If the argument is empty, no rounding is done.
+\end{itemize}
+In this example, floating point numbers are rounded to 6 digits:\par\nobreak
+\begin{lstlisting}
+\STautoround{6}
+\begin{spreadtab}{{tabular}{|l|*7{>{\centering\arraybackslash}m{1.45cm}|}}}
+\hline
+@$x$ & 1 & 2 & 3 & 4 & 5 & 6 & 7 \\\hline
+@$x^{-1}$& 1/b1 & 1/c1 & 1/d1 & 1/e1 & 1/f1 & 1/g1 & 1/h1\\\hline
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\STautoround{6}
+\begin{spreadtab}{{tabular}{|l|*7{>{\centering\arraybackslash}m{1.45cm}|}}}
+\hline
+@$x$ & 1 & 2 & 3 & 4 & 5 & 6 & 7 \\\hline
+@$x^{-1}$& 1/b1 & 1/c1 & 1/d1 & 1/e1 & 1/f1 & 1/g1 & 1/h1\\\hline
+\end{spreadtab}
+\end{center}
+
+\section{Macro-functions}
+The \falseverb{fp} package provides a limited set of operations and functions. If these are not sufficient then \ST allows the advanced programmer to write macros using the operations and functions of \falseverb{fp}. This section presents the macro-functions currently available\footnote{Many others should be written soon and be available in future versions of the package.}. There will be more details on how to program macro functions in the next version of this manual.
+
+\subsection{Mathematical macro-functions}
+\subsubsection{Sum cells}
+The macro-function \verbinline=sum= sums one or several ranges of cells.
+
+It should be used like this: \verbinline=sum(<range 1>;<range 2>;...;<range n>)=, where a range of cells is:
+\begin{itemize}
+ \item either a single cell like \falseverb{a1} or \falseverb{[2,1]};
+ \item either a rectangular area bounded by the upper-left cell and lower-right with this syntax:\par{\centering\verb=<cell 1>:<cell 2>=\par}
+ Here are some examples of such areas: \falseverb{a2:d5}, \falseverb{[-1,-1]:[2,3]}, \falseverb{b4:[5,1]}.
+\end{itemize}
+In the ranges of cell, if a cell does have a numeric field (empty cell or text cell or merged cell with \verbinline-\mutlicolumn-), it is seen as 0 by \verbinline-sum-.
+
+In the following table, the sum of the binomial coefficients of the Pascal's triangle is calculated:\par\nobreak
+\begin{minipage}{0.75\linewidth}
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{*5c}}
+\multicolumn{5}{c}{sum: :={sum(a2:e6)}}\\
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1] \\
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1] & \\
+[0,1] & [-1,1]+[0,1] & [-1,1] & & \\
+[0,1] & [-1,1] & & & \\
+1 & & & &
+\end{spreadtab}
+\end{lstlisting}
+\end{minipage}%
+\begin{minipage}{0.25\linewidth}
+\centering
+\begin{spreadtab}{{tabular}{*5c}}
+\multicolumn{5}{c}{sum: :={sum(a2:e6)}}\\
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1] \\
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1] & \\
+[0,1] & [-1,1]+[0,1] & [-1,1] & & \\
+[0,1] & [-1,1] & & & \\
+1 & & & &
+\end{spreadtab}
+\end{minipage}%
+
+\subsubsection{The \texttt{fact} macro}
+The macro-function \verbinline=fact(<number>)= computes the factorial of its argument, assumed it is an \emph{integer} between 0 and 18 to avoid overflows\footnote{Indeed, for \falseverb{fp} the greatest integer is $10^{18}-1$. The factorial of 19 is greater than it.}. The \falseverb{<number>} can also be a reference to a cell whose numeric field contains an integer.\medskip
+
+Here are the factorial from 0 to 8:\par\nobreak
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{*9c}}
+ 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 &8\\\hline
+fact(a1)&fact(b1)&fact(c1)&fact(d1)&fact(e1)&fact(f1)&fact(g1)&fact(h1)&fact(i1)
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{*9c}}
+ 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 &8\\\hline
+fact(a1)&fact(b1)&fact(c1)&fact(d1)&fact(e1)&fact(f1)&fact(g1)&fact(h1)&fact(i1)
+\end{spreadtab}
+\end{center}
+
+\subsubsection{The \texttt{sumprod} macro}
+The function \verbinline=sumprod= multiplies the corresponding elements of 2 or more rectangular ranges and then adds these products.
+
+It should be used like this: \verbinline{sumprod(<range 1>;<range 2>;...;<range n>)}. All the ranges must have the same dimensions.
+
+In this simple example, the average age of a group of children aged from 10 to 15 years old is calculated:\par\nobreak
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{r*6c}}
+@\Ages & 10 & 11 & 12 & 13 & 14 & 15\\
+@Number & 5 & 8 & 20 & 55 & 9 & 3\\\hline
+@Average&\multicolumn{6}{l}{:={sumprod(b1:g1;b2:g2)/sum(b2:g2)}}
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{r*6c}}
+@Ages & 10 & 11 & 12 & 13 & 14 & 15\\
+@Number & 5 & 8 & 20 & 55 & 9 & 3\\\hline
+@Average&\multicolumn{6}{l}{:={sumprod(b1:g1;b2:g2)/sum(b2:g2)}}
+\end{spreadtab}
+\end{center}
+If any cell in the rages is empty, pure text or merged with \verbinline-\multicolumn-, its numeric field is replaced by 0.
+
+\subsubsection{Random numbers}
+The macro-functions \verbinline-randint- and \verbinline-rand- return a random number depending of its argument.
+
+It should be noted that the seed initializing the random sequence depends on the date and the minute at which the compilation is done. Thus, the random sequence of numbers given by this function will change between two compilations made at times which minutes differ. If randoms numbers need to be repeatable, the private macro \verb-\ST@seed- must be cancelled and a seed should be chosen for \falseverb{fp}. Here is the code to do this:\par\nobreak
+\begin{lstlisting}[backgroundcolor=\color{ST@codebckgcolor}]
+\makeatletter
+\renewcommand\ST@seed{}% redefines the private macro
+\makeatletter
+\FPseed=27% gives a seed (any integer) to fp.
+\end{lstlisting}
+The macro-function \verbinline-randint- returns a random \emph{integer} depending on its argument. Here is the syntax: \verbinline=randint([<number1>,]<number2>)=, where \verb=<number1>= is an optional integer which default value is 0. The random integer returned is in the interval \verb=[<number1>;<number2>]=.
+
+The macro-function \verbinline-rand()- returns a random number between 0 and 1.\par\nobreak
+\begin{lstlisting}
+\STautoround{6}
+\begin{spreadtab}{{tabular}{|l|cccc|}}\hline
+@numbers in [0;1] &rand() &rand() &rand() &rand() \\
+@numbers in [-5;5] &randint(-5,5) &randint(-5,5) &randint(-5,5) &randint(-5,5)\\
+@numbers in [0;20] &randint(20) &randint(20) &randint(20) &randint(20) \\
+\hline
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\STautoround{6}
+\begin{spreadtab}{{tabular}{|l|cccc|}}\hline
+@numbers in [0;1] &rand() &rand() &rand() &rand() \\
+@numbers in [-5;5] &randint(-5,5) &randint(-5,5) &randint(-5,5) &randint(-5,5)\\
+@numbers in [0;20] &randint(20) &randint(20) &randint(20) &randint(20) \\
+\hline
+\end{spreadtab}
+\end{center}
+
+\subsection{Tests}
+Three macro-functions provide tests:\par\nobreak
+\begin{center}
+\verbinline=ifeq(number1,number2,number3,number4)=\par
+\verbinline=ifgt(number1,number2,number3,number4)=\par
+\verbinline=iflt(number1,number2,number3,number4)=
+\end{center}
+\falseverb{number1} and \falseverb{number2} are compared:
+\begin{itemize}
+ \item for \verbinline-ifeq-, is \falseverb{number1} = \falseverb{number2}?
+ \item for \verbinline-ifgt-, is \falseverb{number1} > \falseverb{number2}?
+ \item for \verbinline-iflt-, is \falseverb{number1} < \falseverb{number2}?
+\end{itemize}
+If the test is positive, \falseverb{number3} is returned, otherwise it is \falseverb{number4}.
+
+Here are some values of the function
+$f(x)=\begin{cases}
+10 &\text{if }x<1\\
+0 &\text{if }x=1\\
+-10 &\text{if }x>1
+\end{cases}
+$
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{|*2c|}}\hline
+@$x$ & @$f(x)$ \\\hline
+-0.5 & iflt([-1,0],1,10,ifeq([-1,0],1,0,-10))\\
+[0,-1]+0.5 & iflt([-1,0],1,10,ifeq([-1,0],1,0,-10))\\
+[0,-1]+0.5 & iflt([-1,0],1,10,ifeq([-1,0],1,0,-10))\\
+[0,-1]+0.5 & iflt([-1,0],1,10,ifeq([-1,0],1,0,-10))\\
+[0,-1]+0.5 & iflt([-1,0],1,10,ifeq([-1,0],1,0,-10))\\
+[0,-1]+0.5 & iflt([-1,0],1,10,ifeq([-1,0],1,0,-10))\\
+[0,-1]+0.5 & iflt([-1,0],1,10,ifeq([-1,0],1,0,-10))\\\hline
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{|*2c|}}\hline
+@$x$ & @$f(x)$ \\\hline
+-0.5 & iflt([-1,0],1,10,ifeq([-1,0],1,0,-10))\\
+[0,-1]+0.5 & iflt([-1,0],1,10,ifeq([-1,0],1,0,-10))\\
+[0,-1]+0.5 & iflt([-1,0],1,10,ifeq([-1,0],1,0,-10))\\
+[0,-1]+0.5 & iflt([-1,0],1,10,ifeq([-1,0],1,0,-10))\\
+[0,-1]+0.5 & iflt([-1,0],1,10,ifeq([-1,0],1,0,-10))\\
+[0,-1]+0.5 & iflt([-1,0],1,10,ifeq([-1,0],1,0,-10))\\
+[0,-1]+0.5 & iflt([-1,0],1,10,ifeq([-1,0],1,0,-10))\\\hline
+\end{spreadtab}
+\end{center}
+
+\subsection{Macro-functions manipulating dates}
+\subsubsection{Date to number with \ttfamily engshortdatetonum}\label{datetonum}
+The macro \verbinline-engshortdatetonum- converts a short date like 1789/7/14 to an integer which is the number of days passed since the 1st march of the year 0\footnote{This year 0 does not exists but this should not be a problem with recent dates.}. It is important to note that this macro-function requires a \emph{textual} argument and not a number or the result of a mathematical calculation. Therefore, if the argument of this macro-function refers to a cell, that cell \emph{must} be a text cell, i.e. a cell containing '\verb-@-` or '\verb-:={}-`.
+
+In the example below, the first two lines show how to refer to a text cell. The third line displays the date 0 on the left, and more interesting on the right, it shows how to calculate the number corresponding to the current date with the use of the \TeX{} counters \verbinline-\year-, \verbinline-\month- and \verbinline-\day- which contain the numbers of the current year, month and day.\par\nobreak
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{cc}}
+@1789/7/14 & engshortdatetonum(a1)\\
+2001/1/1 :={} & engshortdatetonum(a2)\\\hline
+engshortdatetonum(0/3/1) & engshortdatetonum(\number\year/\number\month/\number\day)
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{cc}}
+@1789/7/14 & engshortdatetonum(a1)\\
+2001/1/1 :={} & engshortdatetonum(a2)\\\hline
+engshortdatetonum(0/3/1) & engshortdatetonum(\number\year/\number\month/\number\day)
+\end{spreadtab}
+\end{center}
+Another macro-function provides the same feature but with a long date like 'December 25, 1789` or the string contained in \verbinline-\today-:\par\nobreak
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{cc}}
+englongdatetonum(February 13, 2005) & englongdatetonum(\today)\\
+@July 1, 1970 & englongdatetonum(a2)
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{cc}}
+englongdatetonum(February 13, 2005) & englongdatetonum(\today)\\
+@July 1, 1970 & englongdatetonum(a2)
+\end{spreadtab}
+\end{center}
+
+\subsubsection{From a number to a date}
+Several macro-functions enable to translate a number into a date. All these macro-functions have in common that their result is \emph{text}. Therefore, the cells containing such results \emph{become cells containing text}: the numeric field becomes empty and the text field becomes this result.
+
+This macro-functions are:
+\begin{itemize}
+ \item \verbinline-numtoengshortdate- translate a number into a short date like '1789/7/14`;
+ \item \verbinline-numtoenglongdate- translate a number into a long date like 'July 14, 1789`;
+ \item \verbinline-numtoengmonth- given a number representing a date, it finds the name of the month;
+ \item \verbinline-numtoengday- same as above but it finds the name of the day.
+\end{itemize}
+Here is an example in which we consider 1000 days before and 1000 days after 2009/6/1. For each of these 2 dates, we calculate the short date, long date, month and day of the week.\par\nobreak
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{cc}} \hline
+\multicolumn{2}{|c|}{@2009/6/1} \\\hline\hline
+1000 & numtoengshortdate(engshortdatetonum(a1)+[-1,0])\\
+1000 & numtoenglongdate(engshortdatetonum(a1)+[-1,0]) \\
+1000 & numtoengmonth(engshortdatetonum(a1)+[-1,0]) \\
+1000 & numtoengday(engshortdatetonum(a1)+[-1,0]) \\\hline
+-1000 & numtoengshortdate(engshortdatetonum(a1)+[-1,0])\\
+-1000 & numtoenglongdate(engshortdatetonum(a1)+[-1,0]) \\
+-1000 & numtoengmonth(engshortdatetonum(a1)+[-1,0]) \\
+-1000 & numtoengday(engshortdatetonum(a1)+[-1,0])
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{cc}} \hline
+\multicolumn{2}{|c|}{@2009/6/1} \\\hline\hline
+1000 & numtoengshortdate(engshortdatetonum(a1)+[-1,0])\\
+1000 & numtoenglongdate(engshortdatetonum(a1)+[-1,0]) \\
+1000 & numtoengmonth(engshortdatetonum(a1)+[-1,0]) \\
+1000 & numtoengday(engshortdatetonum(a1)+[-1,0]) \\\hline
+-1000 & numtoengshortdate(engshortdatetonum(a1)+[-1,0])\\
+-1000 & numtoenglongdate(engshortdatetonum(a1)+[-1,0]) \\
+-1000 & numtoengmonth(engshortdatetonum(a1)+[-1,0]) \\
+-1000 & numtoengday(engshortdatetonum(a1)+[-1,0])
+\end{spreadtab}
+\end{center}
+
+\section{Particular care}
+\subsection{Defining new commands with \ttfamily\textbackslash hline}
+It may be useful to define a new command to produce, for example, a double horizontal line:\par\nobreak
+\begin{center}
+\verbinline-\newcommand\dline{\hline\hline}-
+\end{center}
+and then try to use it in a table as in this simple example that computes Fibonnacci sequence in the second line:
+\begin{center}
+\newcommand\dline{\hline\hline}
+\begin{spreadtab}{{tabular}{*7c}}
+0 & 1 & 2 & 3 & 4 & 5 & 6 \\\dline
+:={1} & 1 & a2+b2 & b2+c2 & c2+d2 & d2+e2 & e2+f2
+\end{spreadtab}
+\end{center}
+But, if you write the following code, there is a problem when compiling:\par\nobreak
+\begin{lstlisting}
+\newcommand\dline{\hline\hline}
+\begin{spreadtab}{{tabular}{*7c}}
+0 & 1 & 2 & 3 & 4 & 5 & 6 \\\dline
+1 & 1 & a2+b2 & b2+c2 & c2+d2 & d2+e2 & e2+f2
+\end{spreadtab}
+\end{lstlisting}
+In the log file, you can read that \verb-\FPeval- fails and complains:\par
+\hfill\falseverb{! Improper alphabetic constant.}\hfill\null
+
+The reason is simple, \verb-\dline- in line 4 is not recognized by \ST as an horizontal rule and therefore, \emph{it is placed in the cell next line}. For \ST, the cell \falseverb{b1} contains:\par
+\hfill\falseverb{\dline 1}\hfill\null
+
+Since there is no \verb-@- or \verb-:={<formula>}-, \ST considers that the whole cell is a numeric field and \verb-\FPeval- tries valiantly to calculate this content and obviously fails.
+
+To compile without error, the cell \falseverb{a2} \emph{must} contains a numeric field marker:\par\nobreak
+\begin{lstlisting}
+\newcommand\dline{\hline\hline}
+\begin{spreadtab}{{tabular}{*7c}}
+0 & 1 & 2 & 3 & 4 & 5 & 6 \\\dline
+:={1} & 1 & a2+b2 & b2+c2 & c2+d2 & d2+e2 & e2+f2
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\newcommand\dline{\hline\hline}
+\begin{spreadtab}{{tabular}{*7c}}
+0 & 1 & 2 & 3 & 4 & 5 & 6 \\\dline
+:={1} & 1 & a2+b2 & b2+c2 & c2+d2 & d2+e2 & e2+f2
+\end{spreadtab}
+\end{center}
+
+\subsection{The use of {\ttfamily\textbackslash multicolumn} and \ttfamily\textbackslash SThidecol}
+Firstly, in normal use, joint use of \verbinline |\multicolumn| and \verbinline-\SThiderow- should not happen, and most users should not encounter this situation and should not read this section.
+
+For the brave here is the problem: first, a hidden column \emph{must not} contain a cell with the command \verbinline-\multicolumn-! But what happens if a hidden column hides cells merged with \verbinline-\multicolumn-?
+
+In general, there is no compilation error or error messages, but there are some subtleties about the references that are a bit turned upside down in the line after the \verbinline-\multicolumn- command\ldots
+
+Let's take an example, and let's say that, in the following table, we want to merge the cell \falseverb{b2} to \falseverb{h2} and we also want to hide the colomns \falseverb{c}, \falseverb{d} and \falseverb{f}, here in gray:\par\nobreak
+\begin{center}
+\ttfamily
+\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|}
+\hline
+ a1 & b1 & \cellcolor[gray]{0.6}c1 & \cellcolor[gray]{0.6}d1 & e1 & \cellcolor[gray]{0.6}f1 & g1 & h1 & i1 & j1\\\hline
+ a2 & \multicolumn1c{b2} & \multicolumn1{>{\cellcolor[gray]{0.6}}c}{} & \multicolumn1{>{\cellcolor[gray]{0.6}}c}{} & \multicolumn1c{} & \multicolumn1{>{\cellcolor[gray]{0.6}}c}{} & \multicolumn1{c}{} & \multicolumn1{c|}{} & i2 & j2\\\hline
+\end{tabular}
+\end{center}
+There are 4 visible merged cells, so we write \verbinline-\multicolumn{4}- because hidden columns are never taken into account when counting the number of \verbinline-\multicolumn-.
+
+Then we count 4 letters from \falseverb{b} (this letter included): we obtain the letter \falseverb{e}. In the range \falseverb{b-e}, let's count: 2 gray hidden columns are included (\falseverb c and \falseverb d) and 1 hidden column is not included (\falseverb f). These numbers are important to understand the following, also let's call them $a$ and $b$ in the general case.
+
+The rule is:
+\begin{itemize}
+ \item it is necessary to add $b$ signs \verb-&- after \verbinline-\multicolumn- (in the example above, it would be 1);
+ \item references to columns of cells after the \verbinline-\multicolumn- will be shifted $a$ to the beginning of the alphabet. For the example given, if we want to refer to the cell \falseverb{i2}, we should write \falseverb{g2} instead of \falseverb{i2}.
+\end{itemize}
+Here is an example with a similar structure than the previous ($a=2$ and $b=1$) with simple formulas: add 1 to the number above.\par\nobreak
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{|*{7}{c|}}}
+\hline
+1 & 2 & \SThidecol3 & \SThidecol4 & 5& \SThidecol6 & 7& 8& 9 & 10 \\\hline
+a1+1& \multicolumn4{l|}{:={b1+1}} & & i1+1 & j1+1\\\hline
+a2+1& b2+1 & & & & & & & g2+1 & h2+1\\\hline
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{|*{7}{c|}}}
+\hline
+1 & 2 & \SThidecol3 & \SThidecol4 & 5& \SThidecol6 & 7& 8& 9 & 10 \\\hline
+a1+1& \multicolumn4{l|}{:={b1+1}} & & i1+1 & j1+1\\\hline
+a2+1& b2+1 & & & & & & & g2+1 & h2+1\\\hline
+\end{spreadtab}
+\end{center}
+And another example with $a=1$ and $b=0$ where a single column is hidden \falseverb d:\par\nobreak
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{|*{9}{c|}}}
+\hline
+1 & 2 & 3 & \SThidecol4 & 5 & 6 & 7 & 8 & 9 & 10 \\\hline
+a1+1& \multicolumn6{l|}{:={b1+1}} & i1+1 & j1+1\\\hline
+a2+1& b2+1 & & & & & & & h2+1 & i2+1\\\hline
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{|*{9}{c|}}}
+\hline
+1 & 2 & 3 & \SThidecol4 & 5 & 6 & 7 & 8 & 9 & 10 \\\hline
+a1+1& \multicolumn6{l|}{:={b1+1}} & i1+1 & j1+1\\\hline
+a2+1& b2+1 & & & & & & & h2+1 & i2+1\\\hline
+\end{spreadtab}
+\end{center}
+
+\subsection{Messages delivered by \ST}
+The package delivers error messages and abort compilation in these cases:
+\begin{itemize}
+ \item a circular reference is found in a cell. In this case, the dependant cells are displayed;
+ \item a cell refers to an empty cell or a text cell when a non empty numeric field is expected;
+ \item a cell refers to an undefined cell (outside the table);
+ \item a cell refers to a merged cell by a \verbinline-\multicolumn- command;
+ \item a relative reference has a bad syntax.
+\end{itemize}
+The package can deliver information messages (in the log file), which it does by default. If the user wants or not the delivery of information messages, the syntax is \verbinline-\STmessage{true}- or \verbinline-\STmessage{false}-.
+
+To understand the meaning of these messages, let's take a simple table:\par\nobreak
+\begin{minipage}{0.65\linewidth}
+\begin{lstlisting}
+\STmessage{true}% already set by default
+\begin{spreadtab}{{tabular}{|cccc|c|}}\hline
+b1+1 & c1+1 & d1+1 & 10 & a1+b1+c1+d1\\\hline
+\end{spreadtab}
+\end{lstlisting}
+\end{minipage}%
+\begin{minipage}{0.35\linewidth}
+\centering
+\begin{spreadtab}{{tabular}{|cccc|c|}}\hline
+b1+1 & c1+1 & d1+1 & 10 & a1+b1+c1+d1\\\hline
+\end{spreadtab}
+\end{minipage}
+
+Here are the messages deliverd by \ST:\par\nobreak
+\begin{lstlisting}
+[spreadtab] New spreadtab {tabular}{|cccc|c|}
+* reading tab: ok
+* computing formulas:
+ cell A1-B1-C1
+ cell B1
+ cell C1
+ cell D1
+ cell E1
+* building tab: ok
+[spreadtab] End of spreadtab
+\end{lstlisting}\medskip
+Preceded by a star, we recognize the 3 steps necessary to \ST to complete its task: reading the table, calculation of the formulas and building the final table.
+
+For the second step, cells are evaluated from top to bottom, left to right: at line 4 in the code above, \ST says that it begins by trying to calculate the first cell \falseverb{A1}. After a dash, we see that for this, it must first compute the cell \falseverb{B1}, which itself requires that the cell \falseverb{C1} is calculated: the latter can be calculated since it depends only on \falseverb{D1} which is a cell containing the number 10.
+
+In the following (lines 5 to 8), there is only one cell per line which means that when \ST tries to evaluate the cell, either it contains a number or dependant cells are already calculated.
+
+\section{Examples}
+In the examples of this section, the numbers entered by the user are in \textcolor{black}{red} and the calculated numbers are in \textcolor{black}{black}
+
+In these tables, lots of tricks (struts, \verbinline-\multicolumn- commands) and packages (including the numprint package and its columns 'N`, which aligns the decimal points) were used to obtain a satisfactory result. The code is sometimes cumbersome and difficult to read, but these tables are not basic but well-groomed examples!
+
+\subsection{The Pascal's triangle again!}
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{*7r}}
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]\\
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1] & \\
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1] & & \\
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1] & & & \\
+[0,1] & [-1,1]+[0,1] & [-1,1] & & & & \\
+[0,1] & [-1,1] & & & & & \\
+\color{red}:={1}& & & & & &
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{*7r}}
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]\\
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1] & \\
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1] & & \\
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1] & & & \\
+[0,1] & [-1,1]+[0,1] & [-1,1] & & & & \\
+[0,1] & [-1,1] & & & & & \\
+\color{red}:={1}& & & & & &
+\end{spreadtab}
+\end{center}
+
+\subsection{The convergence of a series}
+For people familiar with maths, here is the series of the exponential. Indeed,
+\[\forall x\in \mathbf{R}\qquad e^x=\sum_{k=0}^\infty\frac{x^k}{k!}\]
+and this table shows the speed of convergence for $x=0.5$
+\begin{lstlisting}
+\STautoround{15}
+\begin{spreadtab}[\STsavecell\xvalue{a1}]{{tabular}{cN{2}{15}}}
+\multicolumn{2}{c}{Convergence for $x=\color{red}{\numprint{:={0.5}}}$}\\[1.5ex]
+@$n$ & e^a1\SThidecol & \hfill{@ $\displaystyle e^{\numprint\xvalue}-\sum_{k=0}^n\frac{\numprint\xvalue^k}{k!}$}\hfill\\[3ex]\hline
+\color{red}:={0}& a1^[-1,0]/fact([-1,0]) & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\\hline
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\STautoround{15}
+\begin{spreadtab}[\STsavecell\xvalue{a1}]{{tabular}{cN{2}{15}}}
+\multicolumn{2}{c}{Convergence for $x=\color{red}{\numprint{:={0.5}}}$}\\[1.5ex]
+@$n$ & e^a1\SThidecol & \hfill{@ $\displaystyle e^{\numprint\xvalue}-\sum_{k=0}^n\frac{\numprint\xvalue^k}{k!}$}\hfill\\[3ex]\hline
+\color{red}:={0}& a1^[-1,0]/fact([-1,0]) & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\\hline
+\end{spreadtab}
+\end{center}
+
+\subsection{Convergence on the golden ration}
+In mathematical terms, the sequence $F_n$ of Fibonacci numbers is defined by the recurrence relation:\[F_0=1\qquad F_1=1\qquad F_{n+2}=F_{n+1}+F_n\]
+
+The golden ratio is the limit of the ratios of successive terms of the Fibonacci sequence. We show here that the quotients $F_{n+1}/F_n$ approximate the golden ration $\varphi=\frac{1+\sqrt{5}}{2}$ alternately lower and higher than $\varphi$.\par\nobreak
+\begin{lstlisting}
+\STautoround{9}
+$
+\begin{spreadtab}{{matrix}{}}
+@n & @F_n & @\dfrac{F_n}{F_{n-1}} & @\varphi-\dfrac{F_n}{F_{n-1}}\\[2ex]\hline
+\color{red}:=1 & \color{red}:=1 & & \\
+[0,-1]+1 & \color{red}:=1 & [-1,0]/[-1,-1] & (1+5^0.5)/2-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\\hline
+\end{spreadtab}
+$
+\end{lstlisting}
+\begin{center}
+\STautoround{9}
+$
+\begin{spreadtab}{{matrix}{}}
+@n & @F_n & @\dfrac{F_n}{F_{n-1}} & @\varphi-\dfrac{F_n}{F_{n-1}}\\[2ex]\hline
+\color{red}:=1 & \color{red}:=1 & & \\
+[0,-1]+1 & \color{red}:=1 & [-1,0]/[-1,-1] & (1+5^0.5)/2-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\\hline
+\end{spreadtab}
+$
+\end{center}
+
+\subsection{A billing table}
+Here is a billing table where the decimal points are aligned in columns with the column specifier 'N` of the package \falseverb{numprint}.
+
+This table is generated by the environment \verb=tabularx= stretched to fit 80\% of the width of the line. The command \verbinline=\multicolumn= has been widely used for formatting:\par\nobreak
+\begin{lstlisting}
+\nprounddigits2
+\let\PC\%
+\begin{spreadtab}{{tabularx}{0.8\linewidth}{|>{\rule[-1.2ex]{0pt}{4ex}}X>{{\color{red}}}N42>{\color{red}}cN42>{\color{red}}cN42|}}
+\hline
+@Items &@\multicolumn{1}{c}{Price/U}& @\multicolumn{1}{c}{Qty} & @\multicolumn{1}{c}{Price} & @\multicolumn{1}{c}{Reduction} & @\textbf{Net}\\\hline
+@Item 1 & 5.99 & 20 & [-2,0]*[-1,0] & $-:={20}\PC$ & [-2,0]*(1-[-1,0]/100)\\
+@Item 2 & 12 & 7 & [-2,0]*[-1,0] & $-:={10}\PC$ & [-2,0]*(1-[-1,0]/100)\\
+@Item 3 & 4.50 & 40 & [-2,0]*[-1,0] & $-:={35}\PC$ & [-2,0]*(1-[-1,0]/100)\\
+@Item 4 & 650 & 2 & [-2,0]*[-1,0] & $-:={15}\PC$ & [-2,0]*(1-[-1,0]/100)\\\hline
+@\multicolumn{6}{c}{\vspace{-1.5ex}}\\\cline{4-6}% empty line and raise it a little
+@\multicolumn{1}{c}{\rule[-1.2ex]{0pt}{4ex}}&@\multicolumn{2}{r|}{\textbf{Total}}& sum(d2:[0,-2]) & \multicolumn{1}{c}{$:={round(([1,0]/[-1,0]-1)*100,0)}\PC$} & {\fontseries{b}\selectfont}:={sum(f2:[0,-2])}\\
+\cline{4-6}
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\nprounddigits2
+\let\PC\%
+\begin{spreadtab}{{tabularx}{0.8\linewidth}{|>{\rule[-1.2ex]{0pt}{4ex}}X>{{\color{red}}}N42>{\color{red}}cN42>{\color{red}}cN42|}}
+\hline
+@Items &@\multicolumn{1}{c}{Price/U}& @\multicolumn{1}{c}{Qty} & @\multicolumn{1}{c}{Price} & @\multicolumn{1}{c}{Reduction} & @\textbf{Net}\\\hline
+@Item 1 & 5.99 & 20 & [-2,0]*[-1,0] & $-:={20}\PC$ & [-2,0]*(1-[-1,0]/100)\\
+@Item 2 & 12 & 7 & [-2,0]*[-1,0] & $-:={10}\PC$ & [-2,0]*(1-[-1,0]/100)\\
+@Item 3 & 4.50 & 40 & [-2,0]*[-1,0] & $-:={35}\PC$ & [-2,0]*(1-[-1,0]/100)\\
+@Item 4 & 650 & 2 & [-2,0]*[-1,0] & $-:={15}\PC$ & [-2,0]*(1-[-1,0]/100)\\\hline
+@\multicolumn{6}{c}{\vspace{-1.5ex}}\\\cline{4-6}% empty line and raise it a little
+@\multicolumn{1}{c}{\rule[-1.2ex]{0pt}{4ex}}&@\multicolumn{2}{r|}{\textbf{Total}}& sum(d2:[0,-2]) & \multicolumn{1}{c}{$:={round(([1,0]/[-1,0]-1)*100,0)}\PC$} & {\fontseries{b}\selectfont}:={sum(f2:[0,-2])}\\
+\cline{4-6}
+\end{spreadtab}
+\end{center}
+
+\subsection{A magic square}
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{|*3{>{\hfill\rule[-0.4cm]{0pt}{1cm}$}m{0.7cm}<{$\hfill\null}|}}}
+\hline
+\color{red}:=2 & 5*b2-4*a1 & 3*a1-2*b2 \\\hline
+2*a1-b2 & \color{red}:={-1} & 3*b2-2*a1 \\\hline
+4*b2-3*a1 & 4*a1-3*b2 & 2*b2-a1 \\\hline
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{|*3{>{\hfill\rule[-0.4cm]{0pt}{1cm}$}m{0.7cm}<{$\hfill\null}|}}}
+\hline
+\color{red}:=2 & 5*b2-4*a1 & 3*a1-2*b2 \\\hline
+2*a1-b2 & \color{red}:={-1} & 3*b2-2*a1 \\\hline
+4*b2-3*a1 & 4*a1-3*b2 & 2*b2-a1 \\\hline
+\end{spreadtab}
+\end{center}
+
+\subsection{A pyramid of additions}
+Each number is the sum of two numbers located below it.
+\begin{lstlisting}
+\newlength\cellsize
+\setlength\cellsize{1.5cm}
+\newcolumntype{K}{@{}>{\rule{0pt}{2.5ex}\centering\arraybackslash$}p{\cellsize}<$@{}}
+\begin{spreadtab}{{tabular}{*{8}{@{}p{.5\cellsize}@{}}}}
+\cline{4-5}
+&&&\multicolumn{2}{|K|}{:={[-1,1]+[1,1]}}&&&\\\cline{3-6}
+&&\multicolumn{2}{|K}{:={[-1,1]+[1,1]}}&\multicolumn{2}{|K|}{:={[-1,1]+[1,1]}}&&\\\cline{2-7}
+&\multicolumn{2}{|K}{:={[-1,1]+[1,1]}}&\multicolumn{2}{|K}{:={[-1,1]+[1,1]}}&\multicolumn{2}{|K|}{:={[-1,1]+[1,1]}}&\\\hline
+\multicolumn{2}{|K}{\color{red}:={-5}}&\multicolumn{2}{|K}{\color{red}:={3}}&\multicolumn{2}{|K}{\color{red}:={-2}}&\multicolumn{2}{|K|}{\color{red}:={-3}}\\\hline
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\newlength\cellsize
+\setlength\cellsize{1.5cm}
+\newcolumntype{K}{@{}>{\rule{0pt}{2.5ex}\centering\arraybackslash$}p{\cellsize}<$@{}}
+\begin{spreadtab}{{tabular}{*{8}{@{}p{.5\cellsize}@{}}}}
+\cline{4-5}
+&&&\multicolumn{2}{|K|}{:={[-1,1]+[1,1]}}&&&\\\cline{3-6}
+&&\multicolumn{2}{|K}{:={[-1,1]+[1,1]}}&\multicolumn{2}{|K|}{:={[-1,1]+[1,1]}}&&\\\cline{2-7}
+&\multicolumn{2}{|K}{:={[-1,1]+[1,1]}}&\multicolumn{2}{|K}{:={[-1,1]+[1,1]}}&\multicolumn{2}{|K|}{:={[-1,1]+[1,1]}}&\\\hline
+\multicolumn{2}{|K}{\color{red}:={-5}}&\multicolumn{2}{|K}{\color{red}:={3}}&\multicolumn{2}{|K}{\color{red}:={-2}}&\multicolumn{2}{|K|}{\color{red}:={-3}}\\\hline
+\end{spreadtab}
+\end{center}\medskip
+\parskip0pt
+\begin{center}
+$\star$\par
+$\star\quad\star$
+\end{center}\bigskip
+That's all, I hope we will find this package useful!\par\nobreak\medskip
+Given the youth of this package, please, be tolerant if you find bugs: with comments from users, better versions should be available soon. Indeed, this version is just beginning and, though rather stable, many things are still imperfect. Especially, it is obvious that many other macro-functions need to be written.\par\nobreak\medskip
+I thank you in advance for sending by \href{mailto:unbonpetit@gmail.com}{\texttt{\textbf{email}}} any bug you find, any macro-function or improvment you would like to be implemented, assumed that it must be \emph{realistic}. This package has to be modest and \ST is not excel or calc: it is impossible to implement some advanced features of these spreadsheets.\ldots\par\nobreak\bigskip
+Christian \textsc{Tellechea}
+\end{document} \ No newline at end of file
diff --git a/Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_fr.pdf b/Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_fr.pdf
new file mode 100644
index 00000000000..33fc2891570
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_fr.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_fr.tex b/Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_fr.tex
new file mode 100644
index 00000000000..1067308e3f1
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_fr.tex
@@ -0,0 +1,1060 @@
+% ____________________________________________________________________________
+% | |
+% | |
+% | spreadtab v0.1 |
+% | |
+% | November 3 2009 |
+% | |
+% |___________________________________________________________________________|
+%
+% Ce fichier est spreadtab_doc_fr.tex, le code source de la documentation en
+% français du package spreadtab.
+%
+% Copyright Christian Tellechea 2009
+% email : unbonpetit@gmail.com
+%
+% -------------------------------------------------------------------
+% 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.
+% -------------------------------------------------------------------
+\documentclass[a4paper,10pt]{article}
+\usepackage[utf8]{inputenc}
+\usepackage[T1]{fontenc}
+\usepackage{lmodern}
+\usepackage[a4paper,margin=2.5cm]{geometry}
+\usepackage{amsmath,amssymb}
+\usepackage{array}
+\usepackage{colortbl}
+\usepackage{tabularx}
+\usepackage{xcolor}
+\usepackage{listings}
+\usepackage{numprint}
+\usepackage{xspace}
+\usepackage[bottom]{footmisc}
+\usepackage{spreadtab}
+\usepackage{fancyhdr}
+ \fancyhead[L]{}
+ \fancyhead[C]{\small\bfseries\ST}
+ \fancyhead[R]{\scriptsize\slshape \leftmark}
+ \fancyfoot[l]{\tiny Compilé par Christian \textsc{Tellechea}, le \today.}
+ \fancyfoot[c]{}
+ \fancyfoot[r]{\thepage}
+\usepackage[frenchb]{babel}
+
+\makeatletter
+\definecolor{ST@bckgcolor}{rgb}{0.87,0.9,1}
+\definecolor{ST@codebckgcolor}{rgb}{0.9,0.9,0.9}
+\definecolor{ST@keywordstc}{rgb}{0.7,0,0}
+\definecolor{ST@keywordslatex}{rgb}{0,0,1}
+\definecolor{ST@arguments}{rgb}{0,0,0}
+\definecolor{ST@comments}{rgb}{0.5,0.5,0.5}
+\lstset{%
+ language=[AlLaTeX]TeX,float=hbp,basicstyle=\footnotesize\ttfamily,identifierstyle=\color{ST@arguments},%
+ keywordstyle=\color{ST@keywordslatex},commentstyle=\itshape\color{ST@comments},%
+ columns=fixed,tabsize=4,frame=single,extendedchars=false,%
+ showspaces=false,showstringspaces=false,numbers=left,numberstyle=\tiny\ttfamily,%
+ breaklines=true,breakindent=3em,backgroundcolor=\color{ST@bckgcolor},breakautoindent=true,%
+ captionpos=t,xleftmargin=1em,xrightmargin=1em,lineskip=0pt,%
+ numbersep=1em,classoffset=1,%
+ morekeywords={% les macros et commandes de spreadtab
+ spreadtab,SThiderow,SThidecol,STsavecell,STautoround,STmessage,%
+ STnumericfieldmarker,STtextcell,fact,ifeq,ifgt,iflt,numtofrshortdate,%
+ numtoengshortdate,numtofrlongdate,numtoenglongdate,numtofrmonth,%
+ numtoengmonth,numtofrday,numtoengday,sum,rand,randint,sumprod,%
+ frshortdatetonum,engshortdatetonum,englongdatetonum,frlongdatetonum},%
+ keywordstyle=\color{ST@keywordstc},classoffset=0}
+\makeatother
+
+\newcommand\verbinline{\lstinline[breaklines=false,basicstyle=\normalsize\ttfamily]}
+\newcommand\ST{\textsf{spreadtab}\xspace}
+\newcommand\falseverb[1]{\texttt{\detokenize{#1}}}
+
+\usepackage[a4paper,bookmarks=true,bookmarksopen=true,colorlinks=true,hyperfootnotes=false,filecolor=black,linkcolor=blue,urlcolor=magenta,pdfauthor={Christian TELLECHEA},pdftitle={spreadtab},pdfsubject={Spreadtab permet d'utiliser des fonctionnalités de tableur dans un tableau avec LaTeX},pdfkeywords={spreadtab},pdfcreator={LaTeX}]{hyperref}
+
+\begin{document}
+\parindent0pt\pagestyle{fancy}
+\begin{titlepage}
+ \null\par\vfill
+ \begin{center}
+ \begin{minipage}{0.75\linewidth}
+ \begin{center}
+ \Huge\bfseries\ST\par\vspace{5pt}
+ \small v\csname ST@ver\endcsname\par\vspace{35pt}
+ \normalsize Manuel de l'utilisateur
+ \end{center}
+ \end{minipage}
+ \end{center}
+ \vspace{1cm}
+ \begin{center}
+ Christian {\sc Tellechea}\par\small
+ \href{mailto:unbonpetit@gmail.com}{\texttt{\textbf{unbonpetit@gmail.com}}}\par\vspace{5pt}
+ \csname ST@fr@date\endcsname
+ \end{center}
+ \vfill
+ \begin{center}
+ \begin{minipage}{0.8\linewidth}
+ \noindent\hrulefill\par
+ \hfill\textbf{\textit{Résumé}}\hfill{}\medskip\par\footnotesize
+ Cette extension permet d'utiliser des fonctionnalités de tableur dans n'importe quel environnement \og tableau\fg{} avec \LaTeX{}.\par\smallskip
+ La principale fonctionnalité étant de pouvoir écrire des formules dans les cellules d'un tableau qui font références à d'autres cellules, de calculer les formules contenues dans les cellules et d'afficher les résultats numériques de ces formules dans le tableau.\par
+ \hrulefill
+ \end{minipage}
+ \end{center}
+ \vfill{}
+\end{titlepage}
+
+\tableofcontents\newpage
+\parskip\medskipamount
+\section{Introduction}
+\subsection{Présentation}
+Cette extension permet de construire des tableaux similaire à des feuilles de calculs. Les cellules du tableau ont des coordonnées (colonne et ligne) qui peuvent être utilisées dans des formules pour calculer des valeurs dans d'autres cellules.
+
+Ce package nécessite $\varepsilon$-\TeX, \LaTeXe{} ainsi que le package \href{http://www.ctan.org/tex-archive/macros/latex/contrib/fp/}{\texttt{\textbf{fp}}} à qui sont confiés les calculs. Le package \href{http://www.ctan.org/tex-archive/macros/latex/contrib/xstring/}{\texttt{\textbf{xstring}}} est également requis dans une version \emph{supérieure ou égale} à la \falseverb{v1.5c [2009/06/05]}.
+
+J'ai souhaité dès départ de rendre ce package compatible avec \emph{tous} les environnements de tableaux, sous réserve que les séparateurs entre colonnes soient \og\verb=&=\fg{} et les retours à la ligne soient \og\verb=\\=\fg{}. Cette contrainte forte sur la compatibilité m'a conduit à programmer \ST de façon à ce qu'il agisse d'une façon \emph{totalement indépendante} de l'environnement tableau. Ainsi, la lecture du tableau, le traitement et le calcul des formules se fait \emph{avant} que l'environnement tableau ne prenne la main et ne \og voit\fg{} le corps du tableau.
+
+Par conséquent, \ST procède en 3 étapes :\parindent2em\smallskip
+\begin{itemize}
+ \item en premier lieu, \ST lit le corps du tableau et le divise en lignes puis en cellules en reconnaissant dans chacune la présence d'une éventuelle formule;
+ \item ensuite, il procède au calcul des formules contenues dans les cellules, en ayant pris soin pour chacune de calculer auparavant les cellules dépendantes. L'ordre dans lequel les cellules doivent être calculées est déterminé par \ST. Les calculs sont faits par le package \href{http://www.ctan.org/tex-archive/macros/latex/contrib/fp/}{\texttt{\textbf{fp}}};
+ \item enfin, il faut reconstruire le tableau en ayant remplacé chaque formule par la valeur numérique préalablement calculée et passer la main à l'environnement tableau spécifié par l'utilisateur.
+\end{itemize}\parindent0pt\medskip
+La syntaxe est la suivante :\par\nobreak
+\begin{lstlisting}[backgroundcolor=\color{ST@codebckgcolor}]
+\begin{spreadtab}{{<nom de l'environnement>}<parametres de l'environnement>}
+ tableau avec formules et nombres
+\end{spreadtab}
+\end{lstlisting}
+et après le travail de \ST, on obtient un affichage comme si l'on avait écrit :\par\nobreak
+\begin{lstlisting}[backgroundcolor=\color{ST@codebckgcolor}]
+\begin{<nom de l'environnement>}<parametres de l'environnement>
+ tableau avec nombres
+\end{<nom de l'environnement>}
+\end{lstlisting}
+Même si disposer de fonctionnalités ressemblant à celles d'un tableur avec \LaTeX{} est appréciable, il ne faut pas perdre de vue que les 3 étapes décrites ci-dessus prennent du temps et surtout que \falseverb{fp} est lent dans ses calculs. L'ensemble conduit donc à des temps de compilation \emph{beaucoup plus importants} qu'avec un tableau classique.
+
+Il faut ajouter que \ST \emph{ne peut remplacer un tableur}. En effet, ses possibilités sont très limitées. De plus, surtout pour des tableaux complexes ou de grande taille, le manque d'aide visuelle devient gênant\footnote{Ceci dit, je certifie qu'avec l'habitude, cette gêne tend à s'estomper (si l'on s'en tient à des tableaux raisonnables, bien sûr).}, et la syntaxe de \ST constitue aussi un obstacle supplémentaire. L'avantage de cette extension est de pouvoir écrire \emph{dans le code \LaTeX} des tableaux comportant des calculs, alors que ces tableaux sont généralement exportés\footnote{On peut signaler les 2 principaux programmes d'exportation : \href{http://calc2latex.sourceforge.net/}{\texttt{\textbf{cacl2latex}}} pour \og calc\fg{} de Open Office, et \href{http://www.ctan.org/tex-archive/support/excel2latex/}{\texttt{\textbf{excel2latex}}} pour \og excel\fg{} de Microsoft Office.} d'une feuille de calcul d'un tableur vers le code \LaTeX. On évite ainsi les désagréments des programmes d'exportation : mise en forme souvent à retoucher pour obtenir exactement ce que l'on veut, non compatibilité avec tous les environnements de tableaux, obtention de tableaux ne contenant que les valeurs (les formules sont perdues à l'exportation), exportation à recommencer si l'on modifie un seul nombre ou formule dans le tableau.
+
+\subsection{Motivation}
+Quelques mois avant de commencer à m'attaquer à ce package, Derek \textsc{O'Connor} m'avait fait remarquer que rien n'était disponible dans le monde des extensions de \LaTeX{} pour imiter ---~ne serait-ce qu'un peu~--- le calcul de formules dans des tableaux, comme cela se fait couramment avec des tableurs. J'ai trouvé le défi intéressant et je me suis lancé dans l'écriture de ce package qui en fait, n'est qu'un exercice de programmation.
+
+En effet, l'algorithme principal contenu dans \ST qui détermine l'ordre dans lequel ces cellules doivent être calculées est assez généraliste et n'est pas spécifique à \LaTeX. D'autres algorithmes plus \LaTeX iens analysent les cellules et les formules pour y trouver les références à d'autres cellules. L'exercice est intéressant car en matière de programmation, \TeX{} n'offre rien qui ressemble à un pointeur pour construire des listes chaînées de cellules à calculer. Rien n'est disponible non plus pour attacher à une \og variable\fg{} des champs \og enfants\fg{} dont on peut choisir le type.
+
+La route a été longue avant d'arriver à cette première version et je tiens à remercier tout particulièrement Christophe \textsc{Casseau} pour l'intérêt qu'il a porté dès le début à ce travail et les suggestions qu'il m'a faites, ainsi que plus récemment Derek \textsc{O'Connor} pour ses conseils et pour les échanges constructifs que nous avons eus. J'adresse également mes remerciements à Huu~Dien~Khue \textsc{Le} pour la traduction de ce manuel en viet-namien.
+
+\section{Fonctionnalités courantes}
+Il faut noter tout d'abord qu'à l'intérieur d'un tableau sous environnement \ST, les caractères \og\verb=:=\fg{} et \og\verb=;=\fg{} perdent leur code de catégorie actif qui leur a été attribué si vous utilisez l'option \falseverb{frenchb} du package \falseverb{babel}. Par conséquent, l'espace automatique inséré avant ces caractères sera désactivé dans un tableau.
+
+\subsection{Références absolues}
+Dans le tableau, les cellules sont repérées par leur références absolues de cette façon :\parindent2em\smallskip
+\begin{itemize}
+ \item la colonne est une lettre de \falseverb a à \falseverb z, \falseverb a représentant la 1\iere{} colonne de gauche : on est donc d'emblée limité à 26 colonnes, ce qui devrait suffire pour la grande majorité des cas; la lettre est insensible à la casse, elle peut donc être indifféremment minuscule ou majuscule;
+ \item à la suite immédiate de la lettre, un nombre entier strictement positif représente le numéro de la ligne, la ligne numéro 1 étant la ligne du haut.
+\end{itemize}\parindent0pt\medskip
+Une référence absolue s'écrit donc par exemple : \og\falseverb{b4}\fg{}, \og\falseverb{C1}\fg{} ou \og\falseverb{d13}\fg\footnote{Cette notation se retrouve dans les tableurs : la lettre représente la colonne et le nombre qui suit représente la ligne. Cet ordre est le contraire de la convention utilisée avec les matrices en mathématiques.}.
+
+Voici un exemple où l'on calcule la somme de chaque ligne et de chaque colonne puis, la somme totale :\par\nobreak
+\begin{minipage}{0.75\linewidth}
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{rr|r}}
+22 & 54 & a1+b1 \\
+43 & 65 & a2+b2 \\
+49 & 37 & a3+b3 \\
+\hline
+a1+a2+a3 & b1+b2+b3 & a4+b4
+\end{spreadtab}
+\end{lstlisting}
+\end{minipage}%
+\begin{minipage}{0.25\linewidth}
+\centering
+\begin{spreadtab}{{tabular}{rr|r}}
+22 & 54 & a1+b1 \\
+43 & 65 & a2+b2 \\
+49 & 37 & a3+b3 \\
+\hline
+a1+a2+a3 & b1+b2+b3 & a4+b4
+\end{spreadtab}
+\end{minipage}%
+
+Pour les matheux, voici un autre exemple où l'on calcule quelques lignes du triangle de Pascal :\par\nobreak
+\begin{minipage}{0.75\linewidth}
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{ccccc}}
+1 & & & & \\
+a1 & a1 & & & \\
+a2 & a2+b2 & b2 & & \\
+a3 & a3+b3 & b3+c3 & c3 & \\
+a2 & a4+b4 & b4+c4 & c4+d4 & d4
+\end{spreadtab}
+\end{lstlisting}
+\end{minipage}%
+\begin{minipage}{0.25\linewidth}
+\centering
+\begin{spreadtab}{{tabular}{ccccc}}
+1 & & & & \\
+a1 & a1 & & & \\
+a2 & a2+b2 & b2 & & \\
+a3 & a3+b3 & b3+c3 & c3 & \\
+a2 & a4+b4 & b4+c4 & c4+d4 & d4
+\end{spreadtab}
+\end{minipage}%
+
+\subsection{Références relatives}
+Pour faire référence à une cellule, il peut être commode de spécifier sa position par rapport à la cellule où se trouve la formule. Ainsi, les coordonnées \og relatives\fg{} d'une cellule sont 2 nombres relatifs écrits selon cette syntaxe : \falseverb{[x,y]}, où \falseverb x est le décalage horizontal par rapport à la cellule contenant la formule et \falseverb y est le décalage vertical. Ainsi, \falseverb{[-2,3]} fait référence à la cellule se trouvant 2 colonnes avant (à gauche) et 3 lignes après (plus bas) la cellule où se trouve la formule.
+
+Voici à nouveau le triangle de Pascal vu ci-dessus, mais les références sont relatives et l'environnement \og\verbinline-matrix-\fg{} du package \href{http://www.ctan.org/tex-archive/macros/latex/required/amslatex/math/}{\texttt{\textbf{amsmath}}} est utilisé :\par\nobreak
+\begin{minipage}{0.82\linewidth}
+\begin{lstlisting}
+$
+\begin{spreadtab}{{matrix}{}}
+1\\
+[0,-1] & [-1,-1]\\
+[0,-1] & [-1,-1]+[0,-1] & [-1,-1]\\
+[0,-1] & [-1,-1]+[0,-1] & [-1,-1]+[0,-1] & [-1,-1]\\
+[0,-1] & [-1,-1]+[0,-1] & [-1,-1]+[0,-1] & [-1,-1]+[0,-1] & [-1,-1]
+\end{spreadtab}
+$
+\end{lstlisting}
+\end{minipage}\hfill
+\begin{minipage}{0.15\linewidth}
+\centering
+$
+\begin{spreadtab}{{matrix}{}}
+1\\
+[0,-1] & [-1,-1]\\
+[0,-1] & [-1,-1]+[0,-1] & [-1,-1]\\
+[0,-1] & [-1,-1]+[0,-1] & [-1,-1]+[0,-1] & [-1,-1]\\
+[0,-1] & [-1,-1]+[0,-1] & [-1,-1]+[0,-1] & [-1,-1]+[0,-1] & [-1,-1]
+\end{spreadtab}
+$
+\end{minipage}%
+
+On remarque que les références relatives sont plus adaptées ici puisque seulement 2 références différentes sont utilisées : \falseverb{[0,-1]} qui se réfère à la cellule de dessus et \falseverb{[-1,-1]} qui se réfère à la cellule au Nord-Ouest de la cellule où se trouve la formule.
+
+On peut utiliser dans une même formule un mélange de références absolues et relatives.
+
+\subsection{Des cellules de texte}
+Si l'on veut mettre du texte dans une cellule, il faut indiquer à \ST que la cellule ne doit pas être calculée. Il suffit de placer quelque part dans la cellule le caractère \og\falseverb @\fg{}. Ce faisant, la cellule est ignorée par \ST et devient une cellule inerte à qui il n'est pas possible\footnote{Il y a une exception à cette règle, voir la page \pageref{datetonum}.} de faire référence nulle part ailleurs dans le tableau.
+
+Voici un exemple :\par\nobreak
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{|r|ccc|}}
+\hline
+@ valeurs de $x$ & -5 & -1 & 4 \\
+@ $f(x)=2x$ & 2*[0,-1] & 2*[0,-1] & 2*[0,-1] \\\hline
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{|r|ccc|}}
+\hline
+@ valeurs de $x$ & -5 & -1 & 4 \\
+@ $f(x)=2x$ & 2*[0,-1] & 2*[0,-1] & 2*[0,-1] \\\hline
+\end{spreadtab}
+\end{center}
+Le caractère \og\falseverb @\fg{} est le développement de la séquence de contrôle \verbinline=\STtextcell=. On peut donc redéfinir cette séquence de contrôle en ce que l'on veut et par exemple, \verbinline-\renewcommand\STtextcell{\celltext}- fera qu'une cellule contenant \verb=\celltext= sera comprise comme étant une cellule de texte.
+
+De plus, si une cellule est vide ou entièrement constituée d'espaces, alors \ST la considérera comme une cellule de texte.
+
+\subsection{Des cellules mixtes}
+En réalité, chaque cellule est composée de \emph{deux} champs. D'un côté le \emph{champ numérique} qui contient la formule et de l'autre le \emph{champ textuel} qui sera ignoré par \falseverb{fp} et n'entre pas en ligne de compte pour les calculs :\parindent2em\smallskip
+\begin{itemize}
+ \item dans une cellule, si rien n'est précisé, la totalité de la cellule est considérée comme étant le champ numérique, et le champ textuel est vide (c'était le cas pour toutes les cellules du tableau du triangle de Pascal vu précédemment);
+ \item si la cellule contient \og\falseverb{@}\fg{}, alors la totalité de la cellule est considérée comme étant le champ textuel. Le champ numérique est vide et inaccessible.
+ \item si la cellule contient \og\verb-:=-\fg, alors l'argument entre accolades qui suit est le champ numérique, et tout le reste est le champ textuel. La cellule a cette structure :\par\smallskip
+ \hfil\verb-<champ textuel>:={champ numérique}<suite du champ textuel>-\hfil\null\par\smallskip
+ On peut changer ce marqueur en la séquence de contrôle \og\verb-\=-\fg{} par exemple, en redéfinissant la macro \verbinline-\STnumericfieldmarker- de cette façon :\par\smallskip{\centering
+ \verbinline-\renewcommand\STnumericfieldmarker{\=}-\par\smallskip}
+ Dans ce cas, le développement de \verb-\=- n'aurait strictement aucune importance et n'interviendrait pas dans le processus : pour \ST, il ne s'agit que d'un marqueur de début de formule qui est cherché et reconnu sans être développé.
+\end{itemize}\parindent0pt\bigskip
+Une fois le \og\verb-champ numérique-\fg{} calculé, lui seul et le marqueur \og\verb-:=-\fg{} seront remplacés par la valeur numérique calculée.
+
+Il faut noter que \og\verb-:={champ numérique}-\fg{} peut se trouver à l'intérieur d'accolades et ce quelque soit le niveau d'imbrication. Par exemple, dans une cellule, on peut écrire \verb-\textbf{:={a1+1}}-. Si le champ numérique de la cellule \falseverb{a1} est 5, alors la cellule contiendra au final \verb-\textbf{6}-.
+
+Pour fixer les idées, voici un exemple très simple :\par\nobreak
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{|c|c||c|}}\hline
+valeur 1 : :={50} & valeur 2 : :={29} & moyenne : \textbf{:={(a1+b1)/2}}\\\hline
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{|c|c||c|}}\hline
+valeur 1 : :={50} & valeur 2 : :={29} & moyenne : \textbf{:={(a1+b1)/2}}\\\hline
+\end{spreadtab}
+\end{center}
+À noter également que \og\verb-:={}-\fg{}, qui définit formule vide, est équivalent à \og\verb-@-\fg dans une cellule : celle-ci est comprise comme cellule de texte.
+
+\section{Mise en forme du tableau}
+\subsection{Retours à la ligne et filets horizontaux}
+Pour bien délimiter la fin d'une ligne, \ST est contraint de reconnaître les retours à la ligne et les filets horizontaux. Ce package permet d'utiliser dans le tableau l'argument optionnel de \verb-\\- de cette façon : \verb-\\[<dimension>]-.
+
+Pour les filets horizontaux, on peut utiliser autant de fois que l'on veut:\parindent2em\smallskip
+\begin{itemize}
+ \item \verb-\hline-;
+ \item \verb=\cline{x-y}= où \falseverb x et \falseverb y sont les numéro des colonnes de départ et d'arrivée du filet;
+ \item \verb=\hhline{<type>}= où \verb=<type>= est le type de ligne désirée (voir la documentation du package \href{http://www.ctan.org/tex-archive/macros/latex/required/tools/}{\texttt{\textbf{hhline}}}).
+\end{itemize}\parindent0pt\medskip
+Voici le triangle de Pascal inversé, et massacré pour l'exemple :\par\nobreak
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{*5c}}
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]\\[1em]
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1] & \\
+[0,1] & [-1,1]+[0,1] & [-1,1] & & \\ \hline\hline
+[0,1] & [-1,1] & & & \\ \cline{2-4}
+1 & & & & \\ \hline
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{*5c}}
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]\\[1em]
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1] & \\
+[0,1] & [-1,1]+[0,1] & [-1,1] & & \\ \hline\hline
+[0,1] & [-1,1] & & & \\ \cline{2-4}
+1 & & & & \\ \hline
+\end{spreadtab}
+\end{center}
+
+\subsection{Masquer une ligne ou une colonne}
+Parfois, une colonne ou une ligne entière est destinée à recevoir des calculs intermédiaires qui n'ont pas à être affichés dans le tableau final. Pour cela \ST dispose de deux séquences de contrôle \verbinline=\SThiderow= et \verbinline=\SThidecol= qui, lorsqu'elles sont placées dans une cellule, masquent la ligne ou la colonne dans laquelle se trouve cette cellule.
+
+Voici un exemple :\par\nobreak
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{|r|ccc|}}
+\hline
+@ valeurs de $x$ & -1 & 0\SThidecol & 2 & 3 \\\hline
+@$f(x)=2x-1$ & 2*[0,-1]-1 & 2*[0,-1]-1 & 2*[0,-1]-1 & 2*[0,-1]-1 \\
+@$g(x)=x-10$\SThiderow & [0,-2]-10 & [0,-2]-10 & [0,-2]-10 & [0,-2]-10 \\
+@$h(x)=1-x$ & 1-[0,-3] & 1-[0,-3] & 1-[0,-3] & 1-[0,-3] \\\hline
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{|r|ccc|}}
+\hline
+@ valeurs de $x$ & -1 & 0\SThidecol & 2 & 3 \\\hline
+@$f(x)=2x-1$ & 2*[0,-1]-1 & 2*[0,-1]-1 & 2*[0,-1]-1 & 2*[0,-1]-1 \\
+@$g(x)=x-10$\SThiderow & [0,-2]-10 & [0,-2]-10 & [0,-2]-10 & [0,-2]-10 \\
+@$h(x)=1-x$ & 1-[0,-3] & 1-[0,-3] & 1-[0,-3] & 1-[0,-3] \\\hline
+\end{spreadtab}
+\end{center}
+On peut observer comment on masque la ligne contenant $g(x)$ et la colonne correspondant à la valeur 0.
+
+Il faut se souvenir que les lignes et les colonnes masquées sont \emph{invisibles} pour l'environnement tableau choisi par l'utilisateur, ce qui explique que dans le préambule du tableau, seules 4 colonnes (\falseverb{|r|ccc|}) aient été définies et non 5 comme le voit \ST.
+
+Pour voir la différence, voici le tableau obtenu en définissant 5 colonnes et en ne masquant aucune ligne ni colonne :\par\nobreak
+\begin{center}
+\begin{spreadtab}{{tabular}{|r|cccc|}}
+\hline
+@ valeurs de $x$ & -1 & 0 & 2 & 3 \\\hline
+@$f(x)=2x-1$ & 2*[0,-1]-1 & 2*[0,-1]-1 & 2*[0,-1]-1 & 2*[0,-1]-1 \\
+@$g(x)=x-10$ & [0,-2]-10 & [0,-2]-10 & [0,-2]-10 & [0,-2]-10 \\
+@$h(x)=1-x$ & 1-[0,-3] & 1-[0,-3] & 1-[0,-3] & 1-[0,-3] \\\hline
+\end{spreadtab}
+\end{center}
+
+\subsection{Sauvegarder la valeur d'une cellule}
+On peut être amené à avoir besoin de la valeur numérique d'une cellule dans le tableau pour l'afficher en dehors d'une formule ou même à l'extérieur du tableau. On doit alors utiliser la commande :\par\nobreak
+\begin{center}
+\verbinline-\STsavecell{<sequence de controle>}{<reference absolue>}-
+\end{center}
+Avec un \verbinline-\global\def-\footnote{La commande \texttt{\string\def} ne vérifie pas si la macro qu'elle définit existe déjà.}, cette commande a pour effet de sauvegarder de façon globale dans \falseverb{<sequence de controle>} le résultat de la formule contenue dans la cellule \falseverb{<reference absolue>}.
+
+On ne peut utiliser que des références \emph{absolues}; les références relatives ne sont pas acceptées car cette commande doit se placer dans l'argument optionnel de l'environnement \verbinline-spreadtab-.
+
+Exemple :\par\nobreak
+\begin{lstlisting}
+\begin{spreadtab}[\STsavecell\result{c1}]{{tabular}{|c|c|c|c|c|}}
+\hline
+10 & a1+10 & b1+10 & a1+b1+c1 & @cell c1 : \result\\\hline
+\end{spreadtab}
+\par\medskip
+Voici la cellule c1 : \result
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}[\STsavecell\result{c1}]{{tabular}{|c|c|c|c|c|}}
+\hline
+10 & a1+10 & b1+10 & a1+b1+c1 & @cell c1 : \result\\\hline
+\end{spreadtab}
+\par\medskip
+Voici la cellule c1 : \result
+\end{center}
+Si l'on veut sauvegarder plusieurs cellules, on peut mettre autant de fois que l'on veut la commande \verbinline-\STsavecell- dans l'argument optionnel.
+
+Exemple :\par\nobreak
+\begin{lstlisting}
+\begin{spreadtab}[\STsavecell\hhh{b3}\STsavecell\mmm{c3}\STsavecell\sss{d3}]{{tabular}{|rc|}}\hline
+@Vitesse (km/h) &\SThidecol&\SThidecol&\SThidecol& 35 \\
+@distance (km) & & & & 180\\\hline
+@Temps (h min s) & trunc(e2/e1,0) & trunc(60*(e2/e1-b3),0) & trunc(3600*(e2/e1-b3)-60*c3,1) &@\hhh\ h \mmm\ min \sss\ s\\\hline
+\end{spreadtab}\par\medskip
+On met au moins \hhh\ heures
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}[\STsavecell\hhh{b3}\STsavecell\mmm{c3}\STsavecell\sss{d3}]{{tabular}{|rc|}}\hline
+@Vitesse (km/h) &\SThidecol&\SThidecol&\SThidecol& 35 \\
+@distance (km) & & & & 180\\\hline
+@Temps (h min s) & trunc(e2/e1,0) & trunc(60*(e2/e1-b3),0) & trunc(3600*(e2/e1-b3)-60*c3,1) &@\hhh\ h \mmm\ min \sss\ s\\\hline
+\end{spreadtab}\par\medskip
+On met au moins \hhh\ heures
+\end{center}
+
+\subsection{Utiliser \ttfamily\textbackslash multicolumn}
+Le package \ST est compatible avec la syntaxe \verbinline=\multicolumn{<nombre>}{<type>}{<contenu>}= qui fusionne \falseverb{<nombre>} cellules en une cellule de type et de contenu spécifiés dans les arguments.
+
+En utilisant \verbinline=\multicolumn=, \ST permet même de conserver une certaine cohérence au niveau du référencement des cellules. Sur ce tableau où des cellules sont fusionnées, les cases du tableau contiennent les références absolues vues par \ST :\par\nobreak
+\begin{center}
+\ttfamily
+\begin{tabular}{|*7{c|}}\hline
+a1&b1&c1&d1&e1&f1&g1\\\hline
+a2&\multicolumn{2}{l|}{b2}&d2&e2&f2&g2\\\hline
+\multicolumn{3}{|l|}{a3}&d3&\multicolumn{2}{l|}{e3}&g3\\\hline
+\end{tabular}
+\end{center}
+Ainsi, quelque soit le nombre de cellules fusionnées, la cellule suivante porte un numéro de colonne qui tient compte du nombre de cellules fusionnées.
+
+Sur la dernière ligne, les cellules \falseverb{a3}, \falseverb{b3} et \falseverb{c3} sont fusionnées, et si la cellule \falseverb{a3 }contient une formule, les cellules \falseverb{b3} et \falseverb{c3} \emph{n'existent pas} pour \ST : on ne peut nulle part faire référence à ces cellules.
+
+Voici un exemple où chaque nombre de la ligne du haut est le produit des 2 nombres se trouvant au dessous de lui :\par\nobreak
+\begin{lstlisting}
+\newcolumntype{K}[1]{@{}>{\centering\arraybackslash}p{#1cm}@{}}
+\begin{spreadtab}{{tabular}{*6{K{0.5}}}}
+\cline{2-5}
+&\multicolumn{2}{|K{1}|}{:={a2*c2}} & \multicolumn{2}{K{1}|}{:={c2*e2}} &\\\hline
+\multicolumn{2}{|K{1}}{:=8}&\multicolumn{2}{|K{1}}{:=7}&\multicolumn{2}{|K{1}|}{:=6}\\\hline
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\newcolumntype{K}[1]{@{}>{\centering\arraybackslash}p{#1cm}@{}}
+\begin{spreadtab}{{tabular}{*6{K{0.5}}}}
+\cline{2-5}
+&\multicolumn{2}{|K{1}|}{:={a2*c2}} & \multicolumn{2}{K{1}|}{:={c2*e2}} &\\\hline
+\multicolumn{2}{|K{1}}{:=8}&\multicolumn{2}{|K{1}}{:=7}&\multicolumn{2}{|K{1}|}{:=6}\\\hline
+\end{spreadtab}
+\end{center}
+On remarque que le marqueur de champ numérique \og\falseverb{:=}\fg{} est nécessaire dans chaque cellule où se trouve la commande \verbinline-\multicolumn-. En effet, si ce marquer n'existait pas la totalite de la cellule, c'est-à-dire \verb-\multicolumn{2}{|c|}{<formule>}- serait considérée comme étant une formule.
+
+\subsection{Le package \ttfamily fp}
+Comme cela a été précisé, tous les calculs sont faits par le package \href{http://www.ctan.org/tex-archive/macros/latex/contrib/fp/}{\texttt{\textbf{fp}}} et sa macro \falseverb{\FPeval}\footnote{À ce propos, les notations infixe ou postfixe sont acceptées par {\ttfamily\string\FPeval} ce qui signifie que les formules dans \ST peuvent être indifféremment sous forme infixe ou postfixe. Par exemple, la formule infixe \og\falseverb{a1+b1}\fg{} est équivalente aux formules postfixes \og\falseverb{a1 b1 add}\fg{} ou \og\falseverb{a1 b1 +}\fg.}. Ce package fournit d'extraordinaires possibilités de calcul pour \TeX{} et dispose de toutes les fonctions arithmétiques, scientifiques et trigonométriques usuelles. Les calculs sont faits avec une précision de $10^{-18}$, et les 18 décimales sont affichées lorsqu'un calcul ne tombe pas juste ! Sans prendre des précautions, on peut se retrouver avec beaucoup de chiffres dans les parties décimales de certains résultats.
+
+Pour se prémunir de ce problème, plusieurs solutions existent :\parindent2em\smallskip
+\begin{itemize}
+ \item on peut utiliser le package \href{http://www.ctan.org/tex-archive/macros/latex/contrib/numprint/}{\texttt{\textbf{numprint}}} qui est ce qui se fait de mieux dans l'affichage des nombres;
+ \item on peut demander à \verb=fp= d'arrondir un résultat avec sa fonction \verb-round(nombre,entier)- qui arrondit \verb=nombre= avec \verb=entier= chiffres après la virgule;
+ \item on peut également demander à \ST d'arrondir \emph{tous} les nombres placés dans le tableau à une certaine précision avec la macro \verbinline-\STautoround- dont l'argument est le nombre de chiffres demandés après la virgule. Si l'argument est vide, aucun arrondi n'est fait.
+\end{itemize}\parindent0pt\medskip
+Voici un exemple simple des nombres de 1 à 7 et leurs inverses, arrondis à $10^{-6}$ :\par\nobreak
+\begin{lstlisting}
+\STautoround{6}
+\begin{spreadtab}{{tabular}{|l|*7{>{\centering\arraybackslash}m{1.35cm}|}}}
+\hline
+@$x$ & 1 & 2 & 3 & 4 & 5 & 6 & 7 \\\hline
+@$x^{-1}$& 1/b1 & 1/c1 & 1/d1 & 1/e1 & 1/f1 & 1/g1 & 1/h1\\\hline
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\STautoround{6}
+\begin{spreadtab}{{tabular}{|l|*7{>{\centering\arraybackslash}m{1.35cm}|}}}
+\hline
+@$x$ & 1 & 2 & 3 & 4 & 5 & 6 & 7 \\\hline
+@$x^{-1}$& 1/b1 & 1/c1 & 1/d1 & 1/e1 & 1/f1 & 1/g1 & 1/h1\\\hline
+\end{spreadtab}
+\end{center}
+
+\section{Macro-fonctions}
+L'extension \falseverb{fp} fournit un nombre conséquent d'opérations et de fonctions. Malgré tout, dans le cadre d'un package comme \ST, celles-ci peuvent être insuffisantes et il est possible au programmeur averti d'écrire des macro-fonctions supplémentaires en utilisant celles fournies par \falseverb{fp}. Cette section présente les macro-fonctions pour l'instant disponibles\footnote{Bien d'autres restent à écrire ! Elles seront disponibles dans des versions futures de \ST.}. Il y aura plus de précisions sur la méthode pour programmer des macro-fonctions dans la prochaine version de ce manuel.
+
+\subsection{Macro-fonctions mathématiques}
+\subsubsection{Sommer des cellules}
+La fonction \og\verbinline=sum=\fg permet de faire la somme d'une ou plusieurs plages de cellules.
+
+Elle s'utilise ainsi : \verbinline=sum(<plage 1>;<plage 2>;...;<plage n>)=, où une plage de cellules est :\parindent2em\smallskip
+\begin{itemize}
+ \item soit une cellule isolée comme \og\falseverb{a1}\fg{} ou \og\falseverb{[2,1]}\fg{};
+ \item soit une zone rectangulaire délimitée par la cellule supérieure gauche et inférieure droite de cette façon : \og\verb=<cellule 1>:<cellule 2>=\fg, à condition que \og\verb=<cellule 1>=\fg se trouve \emph{avant} \og\verb=<cellule 2>=\fg{} lorsqu'on parcourt le tableau de haut en bas, de gauche à droite.\par
+ Voici des exemple de plages de cellules : \og\falseverb{a2:d5}\fg{}, \og\falseverb{[-1,-1]:[2,3]}\fg{}, \og\falseverb{b4:[5,1]}\fg{}.
+\end{itemize}\parindent0pt\medskip
+Dans les plages de cellules, les cellules vides ou ne contenant que du texte sont considérées comme contenant le nombre 0. Il en est de même pour les cellules masquée car fusionnées par \verbinline-\multicolumn-.
+
+Les références relatives et absolues peuvent être utilisées conjointement, comme bon semble à l'utilisateur. Voici un exemple où l'on fait la somme des coefficients du triangle de Pascal :\par\nobreak
+\begin{minipage}{0.75\linewidth}
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{*5c}}
+\multicolumn{5}{c}{somme=:={sum(a2:e6)}}\\
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1] \\
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1] & \\
+[0,1] & [-1,1]+[0,1] & [-1,1] & & \\
+[0,1] & [-1,1] & & & \\
+1 & & & &
+\end{spreadtab}
+\end{lstlisting}
+\end{minipage}%
+\begin{minipage}{0.25\linewidth}
+\centering
+\begin{spreadtab}{{tabular}{*5c}}
+\multicolumn{5}{c}{somme=:={sum(a2:e6)}}\\
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1] \\
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1] & \\
+[0,1] & [-1,1]+[0,1] & [-1,1] & & \\
+[0,1] & [-1,1] & & & \\
+1 & & & &
+\end{spreadtab}
+\end{minipage}%
+
+\subsubsection{La factorielle}
+La macro-fonction \verbinline=fact(<nombre>)= permet de calculer la factorielle de son argument, sous réserve que celui-ci soit un entier compris entre 0 et 18 inclus pour éviter des débordements\footnote{En effet, pour \falseverb{fp} le plus grand entier est $10^{18}-1$. La factorielle de 19 dépasse ce nombre.}. Le \falseverb{<nombre>} peut aussi être une référence vers une cellule contenant un nombre entier.
+
+Voici les factorielles de 0 à 8 :\par\nobreak
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{*9c}}
+ 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 &8\\\hline
+fact(a1)&fact(b1)&fact(c1)&fact(d1)&fact(e1)&fact(f1)&fact(g1)&fact(h1)&fact(i1)
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{*9c}}
+ 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 &8\\\hline
+fact(a1)&fact(b1)&fact(c1)&fact(d1)&fact(e1)&fact(f1)&fact(g1)&fact(h1)&fact(i1)
+\end{spreadtab}
+\end{center}
+
+\subsubsection{La macro-fonction \ttfamily sumprod}
+La fonction \verbinline=sumprod= permet de multiplier les éléments correspondants de 2 plages ou plus et ensuite, additionner ces produits.
+
+Cette fonction s'utilise ainsi : \verbinline{sumprod(<plage 1>;<plage 2>;...;<plage n>)}. Toutes les plages rectangulaires doivent avoir les mêmes dimensions.
+
+Voici un exemple simple où l'on calcule l'âge moyen d'un groupe d'enfants âgés de 10 à 15 ans :\par\nobreak
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{r*6c}}
+@\^Ages & 10 & 11 & 12 & 13 & 14 & 15\\
+@Nombre & 5 & 8 & 20 & 55 & 9 & 3\\\hline
+@Moyenne&\multicolumn{6}{l}{:={sumprod(b1:g1;b2:g2)/sum(b2:g2)}}
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{r*6c}}
+@\^Ages & 10 & 11 & 12 & 13 & 14 & 15\\
+@Nombre & 5 & 8 & 20 & 55 & 9 & 3\\\hline
+@Moyenne&\multicolumn{6}{l}{:={sumprod(b1:g1;b2:g2)/sum(b2:g2)}}
+\end{spreadtab}
+\end{center}
+De la même façon que pour la macro-fonction \verbinline-sum-, les cellules de texte, vides ou fusionnées par un \verbinline-\multicolumn- sont considérées comme contenant le nombre 0.
+
+\subsubsection{Nombres aléatoires}
+Les macro-fonctions \verbinline-randint- et \verbinline-rand- renvoient un nombre aléatoire.
+
+À noter : la \og graine\fg{} qui initialise la suite aléatoire dépend de la date ainsi que de la la minute à laquelle est faite la compilation. Les séries aléatoires données par cette fonction changeront entre deux compilations faite à des heures dont les minutes diffèrent. Si l'on veut vraiment avoir des nombres aléatoires indépendant du moment de compilation et donc reproductibles, il faut neutraliser la macro interne \verb-\ST@seed- et définir une graine pour \verb-fp- :\par\nobreak
+\begin{lstlisting}[backgroundcolor=\color{ST@codebckgcolor}]
+\makeatletter
+\renewcommand\ST@seed{}% redefinit la macro interne
+\makeatletter
+\FPseed=27% donne une graine (n'importe quel entier) a fp
+\end{lstlisting}
+La macro fonction \verbinline-randint- renvoie une nombre \emph{entier} qui dépend des paramètres. La syntaxe est la suivante : \verbinline=randint([<nombre1>,]<nombre2>)=, où \verb=<nombre1>= est un entier optionnel qui vaut 0 par défaut. L'entier aléatoire renvoyé est compris dans l'intervalle \verb=[<nombre1>;<nombre2>]=.
+
+La macro fonction \verbinline-rand()- renvoie un nombre aléatoire décimal compris entre 0 et 1 :\par\nobreak
+\begin{lstlisting}
+\STautoround{6}
+\begin{spreadtab}{{tabular}{|l|cccc|}}\hline
+@nombres dans [0;1] &rand() &rand() &rand() &rand() \\
+@nombres dans [-5;5] &randint(-5,5) &randint(-5,5) &randint(-5,5) &randint(-5,5)\\
+@nombres dans [0;20] &randint(20) &randint(20) &randint(20) &randint(20) \\
+\hline
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\STautoround{6}
+\begin{spreadtab}{{tabular}{|l|cccc|}}\hline
+@nombres dans [0;1] &rand() &rand() &rand() &rand() \\
+@nombres dans [-5;5] &randint(-5,5) &randint(-5,5) &randint(-5,5) &randint(-5,5)\\
+@nombres dans [0;20] &randint(20) &randint(20) &randint(20) &randint(20) \\
+\hline
+\end{spreadtab}
+\end{center}
+
+\subsection{Les macro-fonctions de test}
+Elles sont au nombre de 3 et ont la syntaxe suivante :\par\nobreak
+\begin{center}
+\verbinline=ifeq(nombre1,nombre2,nombre3,nombre4>)=\par
+\verbinline=ifgt(nombre1,nombre2,nombre3,nombre4=\par
+\verbinline=iflt(nombre1,nombre2,nombre3,nombre4)=
+\end{center}
+La comparaison se fait entre \falseverb{nombre1} et \falseverb{nombre2} :\parindent2em\smallskip
+\begin{itemize}
+ \item test d'égalité pour \verbinline-ifeq- : \falseverb{nombre1} = \falseverb{nombre2} ?
+ \item test de supériorité stricte pour \verbinline-ifgt- : \falseverb{nombre1} > \falseverb{nombre2} ?
+ \item test d'infériorité stricte pour \verbinline-iflt- : \falseverb{nombre1} < \falseverb{nombre2} ?
+\end{itemize}\parindent0pt\medskip
+Si le test est vrai, \falseverb{nombre3} est retourné, sinon c'est \falseverb{nombre4}.
+
+À titre d'exemple, voici quelques valeurs de la fonction
+$f(x)=\begin{cases}
+10 &\text{si }x<1\\
+0 &\text{si }x=1\\
+-10 &\text{si }x>1
+\end{cases}
+$
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{|*2c|}}\hline
+@$x$ & @$f(x)$ \\\hline
+-0.5 & iflt([-1,0],1,10,ifeq([-1,0],1,0,-10))\\
+[0,-1]+0.5 & iflt([-1,0],1,10,ifeq([-1,0],1,0,-10))\\
+[0,-1]+0.5 & iflt([-1,0],1,10,ifeq([-1,0],1,0,-10))\\
+[0,-1]+0.5 & iflt([-1,0],1,10,ifeq([-1,0],1,0,-10))\\
+[0,-1]+0.5 & iflt([-1,0],1,10,ifeq([-1,0],1,0,-10))\\
+[0,-1]+0.5 & iflt([-1,0],1,10,ifeq([-1,0],1,0,-10))\\
+[0,-1]+0.5 & iflt([-1,0],1,10,ifeq([-1,0],1,0,-10))\\\hline
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{|*2c|}}\hline
+@$x$ & @$f(x)$ \\\hline
+-0.5 & iflt([-1,0],1,10,ifeq([-1,0],1,0,-10))\\
+[0,-1]+0.5 & iflt([-1,0],1,10,ifeq([-1,0],1,0,-10))\\
+[0,-1]+0.5 & iflt([-1,0],1,10,ifeq([-1,0],1,0,-10))\\
+[0,-1]+0.5 & iflt([-1,0],1,10,ifeq([-1,0],1,0,-10))\\
+[0,-1]+0.5 & iflt([-1,0],1,10,ifeq([-1,0],1,0,-10))\\
+[0,-1]+0.5 & iflt([-1,0],1,10,ifeq([-1,0],1,0,-10))\\
+[0,-1]+0.5 & iflt([-1,0],1,10,ifeq([-1,0],1,0,-10))\\\hline
+\end{spreadtab}
+\end{center}
+
+\subsection{Les macro-fonctions de date}
+\subsubsection{Convertir une date en nombre avec \ttfamily frshortdatetonum}\label{datetonum}
+La macro \verbinline-frshortdatetonum- permet de convertir une date de la forme 14/7/1789 en un nombre qui est en fait le nombre de jours écoulés depuis le 1\ier{} mars de l'an 0\footnote{Cet \og an 0\fg{} n'existe d'ailleurs pas, mais cela ne devrait pas être gênant pour les dates contemporaines}. Il est important de noter que cette macro-fonction requiert un argument \emph{textuel} et non pas un nombre ou le résultat d'un calcul mathématique. Par conséquent, si l'argument de cette macro-fonction fait référence à une cellule, cette cellule \emph{doit} être une cellule textuelle, c'est à dire contenant \og\verb-@-\fg{} ou \og\verb-:={}-\fg{}
+
+Dans l'exemple ci-dessous, les deux premières lignes montrent que la cellule de gauche contient une date, et la cellule de droite fait référence à cette date pour calculer le nombre correspondant. La troisième ligne montre dans la cellule de gauche la date 0, mais surtout calcule dans la cellule de droite le nombre correspondant à la date \emph{d'aujourd'hui}, en transformant en nombre les compteurs de \TeX{} \verbinline-\day-, \verbinline-\month- et \verbinline-\year- qui contiennent les numéros des jours, mois et année courants.\par\nobreak
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{cc}}
+@14/7/1789 & frshortdatetonum(a1)\\
+1/1/2001 :={} & frshortdatetonum(a2)\\\hline
+frshortdatetonum(1/3/0) & frshortdatetonum(\number\day/\number\month/\number\year)
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{cc}}
+@14/7/1789 & frshortdatetonum(a1)\\
+1/1/2001 :={} & frshortdatetonum(a2)\\\hline
+frshortdatetonum(1/3/0) & frshortdatetonum(\number\day/\number\month/\number\year)
+\end{spreadtab}
+\end{center}
+Une autre macro-fonction existe, elle transforme une date longue du type \og 25 décembre 1789\fg{} en un nombre. L'argument peut aussi être la séquence de contrôle \verbinline-\today- si l'on a pris le soin de charger l'extension \verb-babel- avec l'option \verb-frenchb-.\par\nobreak
+\begin{lstlisting}[escapechar=Z]
+\begin{spreadtab}{{tabular}{cc}}
+frlongdatetonum(\today) & frlongdatetonum(25 dZéZcembre 2009)\\
+@1 juillet 1970 & frlongdatetonum(a2)
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{cc}}
+frlongdatetonum(\today) & frlongdatetonum(25 décembre 2009)\\
+@1 juillet 1970 & frlongdatetonum(a2)
+\end{spreadtab}
+\end{center}
+
+\subsubsection{Passer d'un nombre à une date}
+Plusieurs macro-fonctions permettent de traduire un nombre en une donnée de date. Toutes ces macro-fonctions ont en commun que leur résultat est du \emph{texte}. Par conséquent, \emph{la cellule les contenant deviendra une cellule textuelle} dont le texte sera le résultat de cette fonction : si un texte cohabitait avec la formule dans cette cellule, il sera écrasé par le résultat. Il en résulte que la cellule ne peut plus faire l'objet d'aucun traitement mathématique ensuite.
+
+Voici ces fonctions :\parindent2em\smallskip
+\begin{itemize}
+ \item \verbinline-numtofrshortdate- transforme un nombre en une date courte du type 14/7/1789;
+ \item \verbinline-numtofrlongdate- transforme un nombre en une date longue du type \og 14 juillet 1789\fg;
+ \item \verbinline-numtofrmonth- extrait d'un nombre représentant une date le nom du mois correspondant;
+ \item \verbinline-numtofrday- extrait d'un nombre représentant une date le nom du jour correspondant.
+\end{itemize}\parindent0pt\medskip
+Voici un exemple où l'on se place 1000 jours avant puis 1000 jours après le 1/6/2009. Pour chacune de ces 2 dates, on calcule la date courte, la date longue, le mois et le jour de la semaine.\par\nobreak
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{cc}} \hline
+\multicolumn{2}{|c|}{@1/6/2009} \\\hline\hline
+1000 & numtofrshortdate(frshortdatetonum(a1)+[-1,0])\\
+1000 & numtofrlongdate(frshortdatetonum(a1)+[-1,0]) \\
+1000 & numtofrmonth(frshortdatetonum(a1)+[-1,0]) \\
+1000 & numtofrday(frshortdatetonum(a1)+[-1,0]) \\\hline
+-1000 & numtofrshortdate(frshortdatetonum(a1)+[-1,0])\\
+-1000 & numtofrlongdate(frshortdatetonum(a1)+[-1,0]) \\
+-1000 & numtofrmonth(frshortdatetonum(a1)+[-1,0]) \\
+-1000 & numtofrday(frshortdatetonum(a1)+[-1,0])
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{cc}} \hline
+\multicolumn{2}{|c|}{@1/6/2009} \\\hline\hline
+1000 & numtofrshortdate(frshortdatetonum(a1)+[-1,0])\\
+1000 & numtofrlongdate(frshortdatetonum(a1)+[-1,0]) \\
+1000 & numtofrmonth(frshortdatetonum(a1)+[-1,0]) \\
+1000 & numtofrday(frshortdatetonum(a1)+[-1,0]) \\\hline
+-1000 & numtofrshortdate(frshortdatetonum(a1)+[-1,0])\\
+-1000 & numtofrlongdate(frshortdatetonum(a1)+[-1,0]) \\
+-1000 & numtofrmonth(frshortdatetonum(a1)+[-1,0]) \\
+-1000 & numtofrday(frshortdatetonum(a1)+[-1,0])
+\end{spreadtab}
+\end{center}
+
+\section{Précautions particulières}
+\subsection{Redéfinition des commandes de filets horizontaux}
+On peut être tenté de définir une commande pour produire ---~par exemple~--- une double ligne horizontale :\par\nobreak
+\begin{center}
+\verbinline-\newcommand\dline{\hline\hline}-
+\end{center}
+puis essayer de l'utiliser dans un tableau pour produire ce simple exemple qui calcule à la seconde ligne les termes de la suite de Fibonnacci :\par\nobreak
+\begin{center}
+\newcommand\dline{\hline\hline}
+\begin{spreadtab}{{tabular}{*7c}}
+0 & 1 & 2 & 3 & 4 & 5 & 6 \\\dline
+:={1} & 1 & a2+b2 & b2+c2 & c2+d2 & d2+e2 & e2+f2
+\end{spreadtab}
+\end{center}
+Mais en écrivant ce code, il y a un problème :\par\nobreak
+\begin{lstlisting}
+\newcommand\dline{\hline\hline}
+\begin{spreadtab}{{tabular}{*7c}}
+0 & 1 & 2 & 3 & 4 & 5 & 6 \\\dline
+1 & 1 & a2+b2 & b2+c2 & c2+d2 & d2+e2 & e2+f2
+\end{spreadtab}
+\end{lstlisting}
+En effet la compilation échoue et dans le log, on peut lire que \verb-\FPeval- se plaint :\par
+\hfill\falseverb{! Improper alphabetic constant.}\hfill\null
+
+La raison est simple, c'est que le \verb-\dline- de la ligne 4, n'est \emph{pas} reconnu par \ST comme un filet horizontal et \emph{il se retrouve donc dans la cellule de la ligne suivante}. Pour \ST, cette cellule \falseverb{b1} contient :\par
+\hfill\falseverb{\dline 1}\hfill\null
+
+Comme il n'y a pas de \verb-@- ni de délimiteur de formule \verb-:={...}-, \verb-\FPeval- essaie vaillamment de calculer ce contenu et échoue évidemment !
+
+Pour pouvoir compiler ce code sans erreur, la cellule \falseverb{a2} \emph{doir} contenir un marqueur de champ numérique :\par\nobreak
+\begin{lstlisting}
+\newcommand\dline{\hline\hline}
+\begin{spreadtab}{{tabular}{*7c}}
+0 & 1 & 2 & 3 & 4 & 5 & 6 \\\dline
+:={1} & 1 & a2+b2 & b2+c2 & c2+d2 & d2+e2 & e2+f2
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\newcommand\dline{\hline\hline}
+\begin{spreadtab}{{tabular}{*7c}}
+0 & 1 & 2 & 3 & 4 & 5 & 6 \\\dline
+:={1} & 1 & a2+b2 & b2+c2 & c2+d2 & d2+e2 & e2+f2
+\end{spreadtab}
+\end{center}
+
+\subsection{Cohabitation de {\ttfamily\textbackslash multicolumn} et \ttfamily\textbackslash SThidecol}
+Tout d'abord, dans une utilisation normale, l'utilisation conjointe de \verbinline|\multicolumn| et \verbinline-\SThiderow- ne doit pas arriver, et la plupart des utilisateurs ne devrait pas rencontrer cette situation ni lire ce chapitre.
+
+Pour les courageux venons-en au c\oe ur du problème : tout d'abord, une colonne masquée ne doit \emph{jamais} contenir une cellule où se trouve la commande \verbinline-\multicolumn- ! Mais que se passe t-il si une colonne masquée cache des cellules fusionnées par \verbinline-\multicolumn-?
+
+Déjà, en général, il n'y a pas d'erreur de compilation ni message d'erreur, mais il y a quelques subtilités quant aux références qui sont un peu chamboulées dans la ligne concernée après le \verbinline-\multicolumn-\ldots
+
+Prenons un exemple, et mettons que dans le tableau suivant, on fusionne les cellules \falseverb{b2} à \falseverb{h2} et que l'on souhaite cacher les colonnes \falseverb{c}, \falseverb{d} et \falseverb{f}, ici en gris :\par\nobreak
+\begin{center}
+\ttfamily
+\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|}
+\hline
+ a1 & b1 & \cellcolor[gray]{0.6}c1 & \cellcolor[gray]{0.6}d1 & e1 & \cellcolor[gray]{0.6}f1 & g1 & h1 & i1 & j1\\\hline
+ a2 & \multicolumn1c{b2} & \multicolumn1{>{\cellcolor[gray]{0.6}}c}{} & \multicolumn1{>{\cellcolor[gray]{0.6}}c}{} & \multicolumn1c{} & \multicolumn1{>{\cellcolor[gray]{0.6}}c}{} & \multicolumn1{c}{} & \multicolumn1{c|}{} & i2 & j2\\\hline
+\end{tabular}
+\end{center}
+Il y a 4 cellules \emph{visibles} fusionnées, on écrira donc \verbinline-\multicolumn{4}- car on ne tient \emph{jamais} compte des colonnes masquées dans le décompte du nombre de cellules à fusionner.
+
+Maintenant, on compte 4 lettres à partir de la lettre \falseverb{b} en l'incluant dans le décompte. On arrive à la lettre \falseverb{e} : cela détermine un intervalle de colonnes \og\falseverb{b-e}\fg. Dans cet intervalle, 2 colonnes masquées sont incluses (\falseverb c et \falseverb d) et 1 colonne masquée n'est pas comprise (\falseverb f). Ces 2 nombres sont importants pour comprendre la suite, aussi, notons-les $a$ et $b$ dans le cas général.
+
+La règle est la suivante :\parindent2em\smallskip
+\begin{itemize}
+ \item il faut rajouter $b$ signes \og\verb-&-\fg{} après le \verbinline-\multicolumn- (pour l'exemple, il en faudrait 1).
+ \item les références des colonnes des cellules qui suivent le \verbinline-\multicolumn- seront décalées de $a$ lettres vers le début de l'alphabet. Pour l'exemple donnée, si on veut faire référence à la cellule marquée \og \falseverb{i2}\fg{}, il faudra écrire \falseverb{g2} (au lieu de \falseverb{i2}).
+\end{itemize}\parindent0pt\medskip
+Voici un vrai exemple dont la structure est similaire au précédent : $a=2$ et $b=1$. Dans le code, remarquer le \og\textcolor{red}{\texttt{\&}}\fg{} qui a été ajouté puisque $b=1$. Par ailleurs, on reste simple avec les formules, on ajoute 1 au nombre du dessus :\par\nobreak
+\begin{lstlisting}[escapechar=Z]
+\begin{spreadtab}{{tabular}{|*{7}{c|}}}
+\hline
+1 & 2 & \SThidecol3 & \SThidecol4 & 5& \SThidecol6 & 7& 8& 9 & 10 \\\hline
+a1+1& \multicolumn4{l|}{:={b1+1}}Z\ttfamily\color{red}\rlap\&Z & i1+1 & j1+1\\\hline
+a2+1& b2+1 & & & & & & & g2+1 & h2+1\\\hline
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{|*{7}{c|}}}
+\hline
+1 & 2 & \SThidecol3 & \SThidecol4 & 5& \SThidecol6 & 7& 8& 9 & 10 \\\hline
+a1+1& \multicolumn4{l|}{:={b1+1}}& & i1+1 & j1+1\\\hline
+a2+1& b2+1 & & & & & & & g2+1 & h2+1\\\hline
+\end{spreadtab}
+\end{center}
+Voici encore un exemple similaire où une seule colonne est masquée (la colonne \falseverb d), et où $a=1$ et $b=0$ :\par\nobreak
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{|*{9}{c|}}}
+\hline
+1 & 2 & 3 & \SThidecol4 & 5 & 6 & 7 & 8 & 9 & 10 \\\hline
+a1+1& \multicolumn6{l|}{:={b1+1}} & i1+1 & j1+1\\\hline
+a2+1& b2+1 & & & & & & & h2+1 & i2+1\\\hline
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{|*{9}{c|}}}
+\hline
+1 & 2 & 3 & \SThidecol4 & 5 & 6 & 7 & 8 & 9 & 10 \\\hline
+a1+1& \multicolumn6{l|}{:={b1+1}} & i1+1 & j1+1\\\hline
+a2+1& b2+1 & & & & & & & h2+1 & i2+1\\\hline
+\end{spreadtab}
+\end{center}
+
+\subsection{Messages émis par \ST}
+Le package émet des messages d'erreur et arrête la compilation dans ces cas :\parindent2em\smallskip
+\begin{itemize}
+ \item Pour calculer une cellule, on calcule de proche en proche des cellules qui par le jeu des références, reviennent sur la cellule d'origine (références circulaires). Dans ce cas, l'arbre des dépendances est affiché dans le message d'erreur;
+ \item une formule nécessitant un nombre fait référence à une cellule vide ou ne contenant que du texte;
+ \item une cellule fait référence à une cellule non définie (hors limite du tableau);
+ \item une cellule fait référence à une cellule fusionnée par un \verbinline-\multicolumn-;
+ \item une référence relative entre crochets ne respecte pas la syntaxe.
+\end{itemize}\parindent0pt\medskip
+
+Le package peut émettre des messages d'information (dans le fichier de log), ce qu'il fait par défaut. La commande \verbinline-\STmessage- permet ou pas l'émission de messages d'information. Pour chacune des ces altenatives, la syntaxe est la suivante : \verbinline-\STmessage{true}- ou \verbinline-\STmessage{false}-.
+
+Pour comprendre la signification des messages, prenons un tableau simple :\par\nobreak
+\begin{minipage}{0.65\linewidth}
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{|cccc|c|}}\hline
+b1+1 & c1+1 & d1+1 & 10 & a1+b1+c1+d1\\\hline
+\end{spreadtab}
+\end{lstlisting}
+\end{minipage}%
+\begin{minipage}{0.35\linewidth}
+\centering
+\begin{spreadtab}{{tabular}{|cccc|c|}}\hline
+b1+1 & c1+1 & d1+1 & 10 & a1+b1+c1+d1\\\hline
+\end{spreadtab}
+\end{minipage}
+
+Le fonctionnement du tableau est ici très simple à comprendre. Voici les informations délivrées par \ST :\par\nobreak
+\begin{lstlisting}
+[spreadtab] New spreadtab {tabular}{|cccc|c|}
+* reading tab: ok
+* computing formulas:
+ cell A1-B1-C1
+ cell B1
+ cell C1
+ cell D1
+ cell E1
+* building tab: ok
+[spreadtab] End of spreadtab
+\end{lstlisting}
+L'environnement spécifié par l'utilisateur est repris entre parenthèses (ici \verbinline-{tabular}{|cccc|c|}-). Précédées d'une étoile, on retrouve les 3 étapes nécessaires à \ST pour mener à bien sa mission : lecture du tableau, calcul des formules et construction du tableau final.
+
+Pour la seconde étape, les cellules sont évaluées de haut en bas, de gauche à droite : \ST indique qu'il commence par essayer de calculer la première cellule \falseverb{A1}. Pour cela, il indique qu'il doit d'abord évaluer \falseverb{B1} et avant cela encore, évaluer \falseverb{C1}. Comme il n'y a plus de cellule après \falseverb{C1}, c'est qu'elle peut être évaluée; en effet, elle ne dépend que de \falseverb{D1} qui est un nombre égal à 10.
+
+Pour chaque ligne suivante, il n'y a qu'une seule cellule ce qui signifie que lorsque \ST essaie de les évaluer, elles l'ont déjà été et sont des nombres ou alors, elles ne font références qu'à des cellules déjà calculées.
+
+\section{Des exemples}
+Voici quelques tableaux pour finir !
+
+Afin que l'on sache quels nombres sont calculés, seuls les nombres non calculés sont en \textcolor{red}{rouge}. Dans ces tableaux, beaucoup d'artifices (des struts, des multicolumn) et des packages (notamment numprint et ses colonnes \og N\fg{} qui alignent les séparateurs décimaux) ont été utilisés pour obtenir un résultat satisfaisant. Le code est parfois lourd et peu lisible, mais il ne s'agit pas ici d'exemples basiques mais de tableaux peaufinés !
+
+\subsection{Encore un triangle de Pascal}
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{*7r}}
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]\\
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1] & \\
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1] & & \\
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1] & & & \\
+[0,1] & [-1,1]+[0,1] & [-1,1] & & & & \\
+[0,1] & [-1,1] & & & & & \\
+\color{red}:={1}& & & & & &
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{*7r}}
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]\\
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1] & \\
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1] & & \\
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1] & & & \\
+[0,1] & [-1,1]+[0,1] & [-1,1] & & & & \\
+[0,1] & [-1,1] & & & & & \\
+\color{red}:={1}& & & & & &
+\end{spreadtab}
+\end{center}
+
+\subsection{La convergence d'une série}
+Pour les matheux, il s'agit du développement limité de la fonction exponentielle en \numprint{0.5}. En effet,
+\[\forall x\in \mathbf{R}\qquad e^x=\sum_{k=0}^\infty\frac{x^k}{k!}\]
+et le tableau illustre la rapidité de la convergence au fur et à mesure de l'ordre du développement limité.\par\nobreak
+\begin{lstlisting}
+\STautoround{15}
+\begin{spreadtab}[\STsavecell\xvalue{a1}]{{tabular}{cN{2}{15}}}
+\multicolumn{2}{c}{Convergence en $x=\color{red}{\numprint{:={0.5}}}$}\\[1.5ex]
+@$n$ & e^a1\SThidecol & \hfill{@ $\displaystyle e^{\numprint\xvalue}-\sum_{k=0}^n\frac{\numprint\xvalue^k}{k!}$}\hfill\\[3ex]\hline
+\color{red}:={0}& a1^[-1,0]/fact([-1,0]) & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\\hline
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\STautoround{15}
+\begin{spreadtab}[\STsavecell\xvalue{a1}]{{tabular}{cN{2}{15}}}
+\multicolumn{2}{c}{Convergence en $x=\color{red}{\numprint{:={0.5}}}$}\\[1.5ex]
+@$n$ & e^a1\SThidecol & \hfill{@ $\displaystyle e^{\numprint\xvalue}-\sum_{k=0}^n\frac{\numprint\xvalue^k}{k!}$}\hfill\\[3ex]\hline
+\color{red}:={0}& a1^[-1,0]/fact([-1,0]) & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\\hline
+\end{spreadtab}
+\end{center}
+
+\subsection{Convergence vers le nombre d'or}
+Voici la définition des nombres de Fibonacci : $F_0=1\qquad F_1=1\qquad F_{n+2}=F_{n+1}+F_n$
+
+On va mettre ici en évidence que le quotient de 2 nombres de Fibonacci consécutifs $F_n$ et $F_{n-1}$ tend vers le nombre d'or $\varphi=\frac{1+\sqrt{5}}{2}$ de telle sorte que la suite $u_n=\varphi-\frac{F_n}{F_{n-1}}$ soit alternativement positive et négative.\par\nobreak
+\begin{lstlisting}
+\STautoround{9}
+$
+\begin{spreadtab}{{matrix}{}}
+@n & @F_n & @\dfrac{F_n}{F_{n-1}} & @\varphi-\dfrac{F_n}{F_{n-1}}\\[2ex]\hline
+\color{red}:=1 & \color{red}:=1 & & \\
+[0,-1]+1 & \color{red}:=1 & [-1,0]/[-1,-1] & (1+5^0.5)/2-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\\hline
+\end{spreadtab}
+$
+\end{lstlisting}
+\begin{center}
+\STautoround{9}
+$
+\begin{spreadtab}{{matrix}{}}
+@n & @F_n & @\dfrac{F_n}{F_{n-1}} & @\varphi-\dfrac{F_n}{F_{n-1}}\\[2ex]\hline
+\color{red}:=1 & \color{red}:=1 & & \\
+[0,-1]+1 & \color{red}:=1 & [-1,0]/[-1,-1] & (1+5^0.5)/2-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\\hline
+\end{spreadtab}
+$
+\end{center}
+
+\subsection{Un tableau de facturation}
+Voici un tableau de facturation, où les séparateurs décimaux sont alignés dans les colonnes grâce au spécificateur de colonne \og N\fg{} du package \falseverb{numprint}.
+
+Ce tableau est généré par l'environnement \verb=tabularx= de façon à occuper 80\% de la largeur de la ligne. La commande \verbinline=\multicolumn= a été largement utilisée pour la mise en forme :\par\nobreak
+\begin{lstlisting}
+\nprounddigits2
+\let\PC\%
+\begin{spreadtab}{{tabularx}{0.8\linewidth}{|>{\rule[-1.2ex]{0pt}{4ex}}X>{{\color{red}}}N42>{\color{red}}cN42>{\color{red}}cN42|}}
+\hline
+@D\'esignation &@\multicolumn{1}{c}{Prix U}& @\multicolumn{1}{c}{Qt\'e} & @\multicolumn{1}{c}{Prix} & @\multicolumn{1}{c}{R\'eduction} & @\textbf{\`A payer}\\\hline
+@Item 1 & 5.99 & 20 & [-2,0]*[-1,0] & $-:={20}\PC$ & [-2,0]*(1-[-1,0]/100)\\
+@Item 2 & 12 & 7 & [-2,0]*[-1,0] & $-:={10}\PC$ & [-2,0]*(1-[-1,0]/100)\\
+@Item 3 & 4.50 & 40 & [-2,0]*[-1,0] & $-:={35}\PC$ & [-2,0]*(1-[-1,0]/100)\\
+@Item 4 & 650 & 2 & [-2,0]*[-1,0] & $-:={15}\PC$ & [-2,0]*(1-[-1,0]/100)\\\hline
+@\multicolumn{6}{c}{\vspace{-1.5ex}}\\\cline{4-6}% ligne vide et on remonte un peu !
+@\multicolumn{1}{c}{\rule[-1.2ex]{0pt}{4ex}}&@\multicolumn{2}{r|}{\textbf{Total}}& sum(d2:[0,-2]) & \multicolumn{1}{c}{$:={round(([1,0]/[-1,0]-1)*100,0)}\PC$} & {\fontseries{b}\selectfont}:={sum(f2:[0,-2])}\\
+\cline{4-6}
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\nprounddigits2
+\let\PC\%
+\begin{spreadtab}{{tabularx}{0.8\linewidth}{|>{\rule[-1.2ex]{0pt}{4ex}}X>{{\color{red}}}N42>{\color{red}}cN42>{\color{red}}cN42|}}
+\hline
+@D\'esignation &@\multicolumn{1}{c}{Prix U}& @\multicolumn{1}{c}{Qt\'e} & @\multicolumn{1}{c}{Prix} & @\multicolumn{1}{c}{R\'eduction} & @\textbf{\`A payer}\\\hline
+@Item 1 & 5.99 & 20 & [-2,0]*[-1,0] & $-:={20}\PC$ & [-2,0]*(1-[-1,0]/100)\\
+@Item 2 & 12 & 7 & [-2,0]*[-1,0] & $-:={10}\PC$ & [-2,0]*(1-[-1,0]/100)\\
+@Item 3 & 4.50 & 40 & [-2,0]*[-1,0] & $-:={35}\PC$ & [-2,0]*(1-[-1,0]/100)\\
+@Item 4 & 650 & 2 & [-2,0]*[-1,0] & $-:={15}\PC$ & [-2,0]*(1-[-1,0]/100)\\\hline
+@\multicolumn{6}{c}{\vspace{-1.5ex}}\\\cline{4-6}% ligne vide et on remonte un peu !
+@\multicolumn{1}{c}{\rule[-1.2ex]{0pt}{4ex}}&@\multicolumn{2}{r|}{\textbf{Total}}& sum(d2:[0,-2]) & \multicolumn{1}{c}{$:={round(([1,0]/[-1,0]-1)*100,0)}\PC$} & {\fontseries{b}\selectfont}:={sum(f2:[0,-2])}\\
+\cline{4-6}
+\end{spreadtab}
+\end{center}
+
+\subsection{Un carré magique}
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{|*3{>{\hfill\rule[-0.4cm]{0pt}{1cm}$}m{0.7cm}<{$\hfill\null}|}}}
+\hline
+\color{red}:=2 & 5*b2-4*a1 & 3*a1-2*b2 \\\hline
+2*a1-b2 & \color{red}:={-1} & 3*b2-2*a1 \\\hline
+4*b2-3*a1 & 4*a1-3*b2 & 2*b2-a1 \\\hline
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{|*3{>{\hfill\rule[-0.4cm]{0pt}{1cm}$}m{0.7cm}<{$\hfill\null}|}}}
+\hline
+\color{red}:=2 & 5*b2-4*a1 & 3*a1-2*b2 \\\hline
+2*a1-b2 & \color{red}:={-1} & 3*b2-2*a1 \\\hline
+4*b2-3*a1 & 4*a1-3*b2 & 2*b2-a1 \\\hline
+\end{spreadtab}
+\end{center}
+
+\subsection{Une pyramide additive}
+Chaque nombre est la somme des deux nombres se trouvant au dessous de lui.\par\nobreak
+\begin{lstlisting}
+\newlength\cellsize
+\setlength\cellsize{1.5cm}
+\newcolumntype{K}{@{}>{\rule{0pt}{2.5ex}\centering\arraybackslash$}p{\cellsize}<$@{}}
+\begin{spreadtab}{{tabular}{*{8}{@{}p{.5\cellsize}@{}}}}
+\cline{4-5}
+&&&\multicolumn{2}{|K|}{:={[-1,1]+[1,1]}}&&&\\\cline{3-6}
+&&\multicolumn{2}{|K}{:={[-1,1]+[1,1]}}&\multicolumn{2}{|K|}{:={[-1,1]+[1,1]}}&&\\\cline{2-7}
+&\multicolumn{2}{|K}{:={[-1,1]+[1,1]}}&\multicolumn{2}{|K}{:={[-1,1]+[1,1]}}&\multicolumn{2}{|K|}{:={[-1,1]+[1,1]}}&\\\hline
+\multicolumn{2}{|K}{\color{red}:={-5}}&\multicolumn{2}{|K}{\color{red}:={3}}&\multicolumn{2}{|K}{\color{red}:={-2}}&\multicolumn{2}{|K|}{\color{red}:={-3}}\\\hline
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\newlength\cellsize
+\setlength\cellsize{1.5cm}
+\newcolumntype{K}{@{}>{\rule{0pt}{2.5ex}\centering\arraybackslash$}p{\cellsize}<$@{}}
+\begin{spreadtab}{{tabular}{*{8}{@{}p{.5\cellsize}@{}}}}
+\cline{4-5}
+&&&\multicolumn{2}{|K|}{:={[-1,1]+[1,1]}}&&&\\\cline{3-6}
+&&\multicolumn{2}{|K}{:={[-1,1]+[1,1]}}&\multicolumn{2}{|K|}{:={[-1,1]+[1,1]}}&&\\\cline{2-7}
+&\multicolumn{2}{|K}{:={[-1,1]+[1,1]}}&\multicolumn{2}{|K}{:={[-1,1]+[1,1]}}&\multicolumn{2}{|K|}{:={[-1,1]+[1,1]}}&\\\hline
+\multicolumn{2}{|K}{\color{red}:={-5}}&\multicolumn{2}{|K}{\color{red}:={3}}&\multicolumn{2}{|K}{\color{red}:={-2}}&\multicolumn{2}{|K|}{\color{red}:={-3}}\\\hline
+\end{spreadtab}
+\end{center}\medskip
+\parskip0pt
+\begin{center}
+$\star$\par
+$\star\quad\star$
+\end{center}
+C'est tout, j'espère que cette extension vous sera utile !\par\nobreak\medskip
+Compte tenu de la jeunesse de ce package, soyez indulgent quant aux dysfonctionnements rencontrés : avec les remarques des utilisateurs, des versions plus abouties verront le jour. En effet, cette version n'est qu'un début et l'ensemble, quoique plutôt stable, reste encore imparfait. Il reste notamment beaucoup de macro-fonctions à écrire.\par\nobreak\medskip
+Je vous remercie donc d'avance de me signaler par \href{mailto:unbonpetit@gmail.com}{\texttt{\textbf{email}}} tout bug, toute macro-fonction à implémenter que vous pensez utile ou toute proposition d'amélioration \emph{réaliste} : il ne faut pas oublier que cette extension doit rester modeste, que \ST n'est pas excel ou calc et qu'il est impossible d'implémenter toutes les fonctionnalités avancées de ces tableurs.\par\nobreak\bigskip
+Christian \textsc{Tellechea}
+\end{document} \ No newline at end of file
diff --git a/Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_vn.pdf b/Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_vn.pdf
new file mode 100644
index 00000000000..5d686f8d740
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_vn.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_vn.tex b/Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_vn.tex
new file mode 100644
index 00000000000..f2a3f89cfc3
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_vn.tex
@@ -0,0 +1,1013 @@
+% ____________________________________________________________________________
+% | |
+% | |
+% | spreadtab v0.1 |
+% | |
+% | November 3 2009 |
+% | |
+% |___________________________________________________________________________|
+%
+% This is spreadtab_doc_vn.tex, the source code of the vietnamese manual
+% of the spreadtab package.
+%
+% Copyright Christian Tellechea 2009
+% Email: unbonpetit@gmail.com
+%
+% Dịch bởi: Lê Hữu Điền Khuê
+% Email: huudienkhue.le@gmail.com
+% -------------------------------------------------------------------
+% 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.
+% -------------------------------------------------------------------
+\documentclass[a4paper,10pt]{article}
+\usepackage[utf8]{inputenc}
+\usepackage{vntex}
+\usepackage{lmodern}
+\usepackage[a4paper,margin=2.5cm]{geometry}
+\usepackage{amsmath,amssymb}
+\usepackage{array}
+\usepackage{colortbl}
+\usepackage{tabularx}
+\usepackage{xcolor}
+\usepackage{listings}
+\usepackage{numprint}
+\usepackage{xspace}
+\usepackage[bottom]{footmisc}
+\usepackage{spreadtab}
+\usepackage{fancyhdr}
+ \fancyhead[L]{}
+ \fancyhead[C]{\small\bfseries\ST}
+ \fancyhead[R]{\scriptsize\slshape \leftmark}
+ \fancyfoot[l]{\tiny Biên dịch bởi Christian \textsc{Tellechea} \today.}
+ \fancyfoot[c]{}
+ \fancyfoot[r]{\thepage}
+
+\definecolor{ST@bckgcolor}{rgb}{0.87,0.9,1}
+\definecolor{ST@codebckgcolor}{rgb}{0.9,0.9,0.9}
+\definecolor{ST@keywordstc}{rgb}{0.7,0,0}
+\definecolor{ST@keywordslatex}{rgb}{0,0,1}
+\definecolor{ST@arguments}{rgb}{0,0,0}
+\definecolor{ST@comments}{rgb}{0.5,0.5,0.5}
+\lstset{%
+ language=[AlLaTeX]TeX,float=hbp,basicstyle=\footnotesize\ttfamily,identifierstyle=\color{ST@arguments},%
+ keywordstyle=\color{ST@keywordslatex},commentstyle=\itshape\color{ST@comments},%
+ columns=fixed,tabsize=4,frame=single,extendedchars=false,%
+ showspaces=false,showstringspaces=false,numbers=left,numberstyle=\tiny\ttfamily,%
+ breaklines=true,breakindent=3em,backgroundcolor=\color{ST@bckgcolor},breakautoindent=true,%
+ captionpos=t,xleftmargin=1em,xrightmargin=1em,lineskip=0pt,%
+ numbersep=1em,classoffset=1,%
+ morekeywords={% les macros et commandes de spreadtab
+ spreadtab,SThiderow,SThidecol,STsavecell,STautoround,STmessage,%
+ STnumericfieldmarker,STtextcell,fact,ifeq,ifgt,iflt,numtofrshortdate,%
+ numtoengshortdate,numtofrlongdate,numtoenglongdate,numtofrmonth,%
+ numtoengmonth,numtofrday,numtoengday,sum,rand,randint,sumprod,%
+ frshortdatetonum,engshortdatetonum,englongdatetonum,frlongdatetonum},%
+ keywordstyle=\color{ST@keywordstc},classoffset=0}
+\makeatother
+
+\newcommand\verbinline{\lstinline[breaklines=false,basicstyle=\normalsize\ttfamily]}
+\newcommand\ST{\textsf{spreadtab}\xspace}
+\newcommand\falseverb[1]{\texttt{\detokenize{#1}}}
+
+\usepackage[a4paper,bookmarks=true,bookmarksopen=true,colorlinks=true,hyperfootnotes=false,filecolor=black,linkcolor=blue,urlcolor=magenta,pdfauthor={Christian TELLECHEA},pdftitle={spreadtab},pdfsubject={Spreadtab cho phép sử dụng các chức năng của một bảng tính trong bảng LaTeX},pdfkeywords={spreadtab},pdfcreator={LaTeX},unicode]{hyperref}
+
+\begin{document}
+\parindent0pt\pagestyle{fancy}
+\begin{titlepage}
+ \null\par\vfill
+ \begin{center}
+ \begin{minipage}{0.75\linewidth}
+ \begin{center}
+ \Huge\bfseries\ST\par\vspace{5pt}
+ \small v\csname ST@ver\endcsname\par\vspace{35pt}
+ \normalsize Hướng dẫn sử dụng
+ \end{center}
+ \end{minipage}
+ \end{center}
+ \vspace{1cm}
+ \begin{center}
+ Christian {\sc Tellechea}\par\small
+ \href{mailto:unbonpetit@gmail.com}{\texttt{\textbf{unbonpetit@gmail.com}}}\par\vspace{5pt}
+ Dịch bởi Lê Hữu Điền Khuê\par
+ \href{mailto:huudienkhue.le@gmail.com}{\texttt{\textbf{huudienkhue.le@gmail.com}}}\par\vspace{5pt}
+ Ngày 3 tháng 11 năm 2009
+ \end{center}
+ \vfill
+ \begin{center}
+ \begin{minipage}{0.8\linewidth}
+ \noindent\hrulefill\par
+ \hfill\textbf{\textit{Tóm tắt}}\hfill{}\medskip\par\footnotesize
+ Gói này cho phép thực hiện những chức năng của một bảng tính trong mọi môi trường bảng của \LaTeX{}.\par\smallskip
+ Chức năng chính của nó là "công thức hóa" một ô trong bảng bằng cách tham chiếu đến các ô khác, tính giá trị của các ô chứa công thức và hiển thị kết quả của chúng.\par
+ \hrulefill
+ \end{minipage}
+ \end{center}
+ \vfill{}
+\end{titlepage}
+
+\tableofcontents\newpage
+\parskip\medskipamount
+\section{Mở đầu}
+\subsection{Giới thiệu}
+Mục đích của \ST là cho phép viết các công thức toán học vào một hay nhiều ô của một bảng mà trong các công thức này có chứa giá trị của những ô khác, hoàn toàn giống như khi tiến hành trên một bảng tính. Gói này sẽ tính các công thức theo một thứ tự thích hợp và hiển thị bảng chứa các giá trị được tính.
+
+Gói này cần đến $\varepsilon$-\TeX, \LaTeXe{} cũng như gói \href{http://www.ctan.org/tex-archive/macros/latex/contrib/fp/}{\texttt{\textbf{fp}}} để thực hiện việc tính toán. Gói \href{http://www.ctan.org/tex-archive/macros/latex/contrib/xstring/}{\texttt{\textbf{xstring}}} cũng được đòi hỏi (bản \falseverb{v1.5c [2009/06/05]} hoặc mới hơn).
+
+Ngay từ đầu tác giả đã mong muốn rằng \ST sẽ tương thích \emph{với mọi} môi trường bảng mà ở đó các cột được phân chia bởi \verb=&= và việc bắt đầu một hàng mới được thực hiện nhờ \verb=\\=. Điều này bắt buộc tác giả phải lập trình \ST hoàn toàn độc lập với môi trường bảng. Do vậy, \ST sẽ thực hiện việc "đọc" bảng và tính các công thức \emph{trước khi} môi trường bảng làm nhiệm vụ của nó.
+
+Như vậy, \ST sẽ thực hiện ba bước:\parindent2em\smallskip
+\begin{itemize}
+ \item đầu tiên, \ST đọc nội dung của bảng và chia nó thành hàng rồi thành ô (\ST sẽ tự nhận thấy các ô có công thức);
+ \item tiếp theo nó sẽ thực hiện việc tính các công thức của các ô (các ô dùng để tính một ô nào khác sẽ được tính trước). Thứ tự của các ô được tính sẽ do \ST xác định. Các phép tính sẽ được thực hiện bởi gói \href{http://www.ctan.org/tex-archive/macros/latex/contrib/fp/}{\texttt{\textbf{fp}}};
+ \item cuối cùng, nó sẽ xây dựng lại bảng bằng cách thay các công thức bằng giá trị đã tính của chúng và sau đó nhường việc hiển thị bảng cho môi trường bảng (tùy chọn bởi người sử dụng).
+\end{itemize}\parindent0pt\medskip
+
+Cú pháp:
+\begin{lstlisting}[backgroundcolor=\color{ST@codebckgcolor},escapechar=!]
+\begin{spreadtab}{{<!Tên của môi trường bảng!>}<!tham số của môi trường!>}
+! bảng chứa công thức và số!
+\end{spreadtab}
+\end{lstlisting}
+và sau khi \ST thực hiện công việc của mình, bảng sẽ được hiển thị giống như khi ta thực hiện cú pháp:
+\begin{lstlisting}[backgroundcolor=\color{ST@codebckgcolor},escapechar=!]
+\begin{<!Tên của môi trường bảng!>}<!tham số của môi trường!>
+ !bảng chứa số!
+\end{<!Tên của môi trường bảng!>}
+\end{lstlisting}
+Việc thực hiện ba bước trên sẽ mất thời gian, hơn nữa \falseverb{fp} chậm trong việc tính toán, do đó việc biên dịch bảng với \ST sẽ \emph{chậm hơn rất nhiều} so với việc biên dịch một bảng bình thường.
+
+Cần lưu ý rằng \ST \emph{không thể thay thế một bảng tính}. Một điều hơi khó chịu đó là nó không trực quan, nhất là khi làm việc với những bảng lớn và phức tạp, và cú pháp không mấy đơn giản của \ST cũng sẽ là một trở ngại nữa. Ưu điểm của \ST là có thể thực hiện việc tính toán \emph{ngay trong mã nguồn} nhận được khi chuyển đổi sang mã \LaTeX{} một bảng của một chương trình bảng tính\footnote{Có hai chương trình chính cho phép thực hiện điều này : \href{http://calc2latex.sourceforge.net/}{\texttt{\textbf{cacl2latex}}} đối với calc của Open Office, và \href{http://www.ctan.org/tex-archive/support/excel2latex/}{\texttt{\textbf{excel2latex}}} đối với excel của Microsoft Office.}. Chúng ta cũng nên tránh các khuyết điểm của các chương trình chuyển đổi nói trên như: việc định dạng bảng cần phải chỉnh sửa lại nếu muốn nhận được bảng hoàn toàn giống như trong chương trình bảng tính, không tương thích với mọi môi trường bảng, chỉ nhận được các giá trị hay kết quả (các công thức đều bị mất) sau khi chuyển đổi, cần phải tiến hành chuyển đổi lại nếu thay đổi một giá trị hay một công thức trong bảng.
+
+\subsection{Động lực chính}
+Một vài tháng trước khi viết \ST, Derek \textsc{O'Connor} đã nhận xét với tác giả rằng vào thời điểm đó không có một gói nào của \LaTeX{} cho phép tính toán các công thức trong các bảng, tương tự như một bảng tính. Nhận thấy rằng đây là một thách thức thú vị, tác giả bắt tay vào viết \ST, cũng chỉ như làm một bài tập lập trình vậy.
+
+Thuật toán chính trong \ST xác định thứ tự mà các ô được tính, nó không phải là "chuyên môn" của lập trình \LaTeX. Những thuật toán khác mang hơi hưởng của \LaTeX{} nhiều hơn như phân tích các ô và các công thức để tìm ra những tham chiếu đến những ô khác. Đây đúng là một bài tập thú vị, bởi vì trên phương diện lập trình, \TeX{} không hề cung cấp cho chúng ta một thứ gì đó tương tự như con trỏ để xây dựng các danh sách liên kết của các ô cần tính.
+
+Con đường để đi đến phiên bản đầu tiên này của \ST đúng là dài. Tác giả xin cảm ơn Christophe \textsc{Casseau} đã quan tâm ngay từ đầu và cho nhiều góp ý bổ ích, cũng như gần đây là Derek \textsc{O'Connor} đã giúp đỡ và trao đổi với tác giả. Đồng thời cũng xin cảm ơn Lê Hữu Điền Khuê đã dịch tài liệu này sang tiếng Việt.
+
+\section{Các chức năng thông thường}
+
+\subsection{Vị trí tuyệt đối}
+Trong một bảng, các ô được định vị bởi vị trí tuyệt đối của chúng như sau:\parindent2em\smallskip
+\begin{itemize}
+ \item mỗi cột là một chữ cái từ \falseverb a đến \falseverb z, \falseverb a là cột đầu tiên bên trái: như vậy số cột tối đa là 26 (đối với hầu hết các trường hợp thì như thế là quá đủ); \ST sẽ không phân biệt các chữ cái hoa và chữ cái thường;
+ \item tiếp ngay sau chữ cái, một số nguyên dương sẽ biểu diễn số thứ tự của hàng, hàng số 1 là hàng đầu tiên trên cùng.
+\end{itemize}\parindent0pt\medskip
+Một số ví dụ về cách viết vị trí tuyệt đối: "\falseverb{b4}", "\falseverb{C1}" hay "\falseverb{d13}"\footnote{Cách đánh số này tương tự như trong các bảng tính : chữ cái là thứ tự của cột và số là thứ tự của hàng.}.
+
+Trong ví dụ sau, ta sẽ tính tổng của mỗi hàng và của mỗi cột và sau đó là tổng của tất cả các ô:
+
+\begin{minipage}{0.75\linewidth}
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{rr|r}}
+22 & 54 & a1+b1 \\
+43 & 65 & a2+b2 \\
+49 & 37 & a3+b3 \\
+\hline
+a1+a2+a3 & b1+b2+b3 & a4+b4
+\end{spreadtab}
+\end{lstlisting}
+\end{minipage}%
+\begin{minipage}{0.25\linewidth}
+\centering
+\begin{spreadtab}{{tabular}{rr|r}}
+22 & 54 & a1+b1 \\
+43 & 65 & a2+b2 \\
+49 & 37 & a3+b3 \\
+\hline
+a1+a2+a3 & b1+b2+b3 & a4+b4
+\end{spreadtab}
+\end{minipage}%
+
+Còn ví dụ sau sẽ tính một số hàng của tam giác Pascal:
+
+\begin{minipage}{0.75\linewidth}
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{ccccc}}
+1 & & & & \\
+a1 & a1 & & & \\
+a2 & a2+b2 & b2 & & \\
+a3 & a3+b3 & b3+c3 & c3 & \\
+a2 & a4+b4 & b4+c4 & c4+d4 & d4
+\end{spreadtab}
+\end{lstlisting}
+\end{minipage}%
+\begin{minipage}{0.25\linewidth}
+\centering
+\begin{spreadtab}{{tabular}{ccccc}}
+1 & & & & \\
+a1 & a1 & & & \\
+a2 & a2+b2 & b2 & & \\
+a3 & a3+b3 & b3+c3 & c3 & \\
+a2 & a4+b4 & b4+c4 & c4+d4 & d4
+\end{spreadtab}
+\end{minipage}%
+
+\subsection{Vị trí tương đối}
+Để tham chiếu đến một ô, sẽ rất thuận tiện nếu ta xác định vị trí của nó so với ô chứa công thức. "Vị trí tương đối" sẽ giúp ta làm điều này. Vị trí tương đối được cho bởi cú pháp \falseverb{[x,y]}, nó sẽ tham chiếu đến ô thứ \falseverb x theo chiều ngang và thứ \falseverb y theo chiều dọc đối với ô chứa vị trí tương đối, tức chứa công thức (tạm gọi là ô hiện tại). Chẳng hạn \falseverb{[-2,3]} sẽ tham chiếu đến ô ở vị trí thứ 2 về \emph{phía trái} và vị trí thứ 3 \emph{phía dưới} của ô hiện tại (nghĩa là nếu xuất phát từ ô hiện tại, để đi đến được ô \falseverb{[-2,3]}, ta phải di chuyển sang trái 2 ô, sau đó di chuyển xuống phía dưới 3 ô).
+
+Ví dụ dưới đây xây dựng một bảng giống như ví dụ trước nhưng sử dụng vị trí tương đối và môi trường "\verbinline-matrix-" của gói \href{http://www.ctan.org/tex-archive/macros/latex/required/amslatex/math/}{\texttt{\textbf{amsmath}}}:
+
+\begin{minipage}{0.82\linewidth}
+\begin{lstlisting}
+$
+\begin{spreadtab}{{matrix}{}}
+1\\
+[0,-1] & [-1,-1]\\
+[0,-1] & [-1,-1]+[0,-1] & [-1,-1]\\
+[0,-1] & [-1,-1]+[0,-1] & [-1,-1]+[0,-1] & [-1,-1]\\
+[0,-1] & [-1,-1]+[0,-1] & [-1,-1]+[0,-1] & [-1,-1]+[0,-1] & [-1,-1]\\
+\end{spreadtab}
+$
+\end{lstlisting}
+\end{minipage}\hfill
+\begin{minipage}{0.15\linewidth}
+\centering
+$
+\begin{spreadtab}{{matrix}{}}
+1\\
+[0,-1] & [-1,-1]\\
+[0,-1] & [-1,-1]+[0,-1] & [-1,-1]\\
+[0,-1] & [-1,-1]+[0,-1] & [-1,-1]+[0,-1] & [-1,-1]\\
+[0,-1] & [-1,-1]+[0,-1] & [-1,-1]+[0,-1] & [-1,-1]+[0,-1] & [-1,-1]\\
+\end{spreadtab}
+$
+\end{minipage}%
+
+Chúng ta thấy rằng đối với việc xây dựng bảng này, việc sử dụng vị trí tương đối là thích hợp hơn bởi vì chúng ta chỉ sử dụng đúng hai vị trí tương đối: \falseverb{[0,-1]} tham chiếu đến ô ngay phía trên và \falseverb{[-1,-1]} tham chiếu đến ô gần nhất ở phía trái-trên (hay phía Tây-Bắc trong ngôn ngữ bản đồ) so với ô chứa công thức.
+
+Chúng ta cũng có thể sử dụng cả vị trí tuyệt đối lẫn tương đối trong cùng một công thức.
+
+\subsection{Các ô chứa văn bản}
+Nếu muốn chèn văn bản vào một ô, chúng ta cần phải cho \ST biết rằng ô này sẽ không được tính. Chỉ cần thêm vào kí tự "\falseverb @" ở một ví trí nào đó trong nội dung của ô, ô này sẽ được \ST bỏ qua và sẽ trở thành một ô "trơ": nó sẽ không thể được tham chiếu đến từ bất kì ô nào trong bảng.
+
+Sau đây là một ví dụ:
+\begin{lstlisting}[escapechar=!]
+\begin{spreadtab}{{tabular}{|r|ccc|}}
+\hline
+@ !giá trị của! $x$ & -5 & -1 & 4 \\
+@ $f(x)=2x$ & 2*[0,-1] & 2*[0,-1] & 2*[0,-1] \\\hline
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{|r|ccc|}}
+\hline
+@ giá trị của $x$ & -5 & -1 & 4 \\
+@ $f(x)=2x$ & 2*[0,-1] & 2*[0,-1] & 2*[0,-1] \\\hline
+\end{spreadtab}
+\end{center}
+Ta có thể thay "\falseverb @" bằng một kí tự (hoặc một chuỗi các kí tự) khác, chỉ cần định nghĩa lại lệnh \verbinline=\STtextcell= theo cú pháp
+\begin{center}
+\verbinline-\renewcommand\STtextcell-\verb-{kí tự hoặc chuỗi kí tự}-
+\end{center}
+Chẳng hạn nếu ta định nghĩa \verbinline-\renewcommand\STtextcell{toto}- thì khi đó, mọi ô chứa "\falseverb{toto}" đều được xem như những ô chứa văn bản.
+
+Ngoài ra, ô trống cũng được \ST xem như là ô chứa văn bản.
+
+\subsection{Các ô hỗn hợp}
+Trên thực tế, mỗi ô được tạo nên bởi \emph{hai} vùng : \emph{vùng số} chứa công thức và \emph{vùng chữ} chứa văn bản (vùng này sẽ được \falseverb{fp} bỏ qua khi tính toán):\parindent2em\smallskip
+\begin{itemize}
+ \item trong một ô, nếu không có gì đặc biệt, toàn bộ ô sẽ được xem giống như một vùng số, và vùng chữ là rỗng (xem ví dụ về tam giác Pascal ở phần trên của tài liệu);
+ \item nếu ô có chứa "\falseverb{@}" thì toàn bộ ô sẽ được xem như một vùng chữ, vùng số là rỗng;
+ \item nếu ô có chứa "\verb-:=-" thì đối số nằm giữa hai giấu ngoặc nhọn theo sau là vùng số, và những thứ còn lại là vùng chữ. Ô này sẽ có cấu trúc như sau:\par\smallskip
+ \hfil\verb-<vùng chữ>:={vùng số}<tiếp theo của vùng chữ>-\hfil\null\par\smallskip
+
+ Chúng ta có thể thay "\verb-:=-" bởi một hay một chuỗi các kí tự khác, chẳng hạn "\verb-toto-", bằng cách định nghĩa lại macro \verbinline-\STnumericfieldmarker- như sau:\par\smallskip{\centering
+ \verbinline-\renewcommand\STnumericfieldmarker{toto}-\par\smallskip}
+
+\end{itemize}\parindent0pt\bigskip
+Một khi vùng số đã được tính, nó sẽ được thay thế bởi giá trị của nó trong bảng.
+
+Cần lưu ý rằng "\verb-:={vùng số}-" có thể nằm giữa hai dấu ngoặc nhọn. Ví dụ, trong một ô ta có thể viết \verb-\textbf{:={a1+1}}-. Nếu vùng số của ô \falseverb{a1} là 5 thì ô chứa công thức cuối cùng sẽ chứa giá trị là \verb-\textbf{6}-.
+
+Ví dụ đơn giản sau đây sẽ giúp các bạn hiểu rõ hơn:
+
+\begin{lstlisting}[escapechar=!]
+\begin{spreadtab}{{tabular}{|c|c||c|}}\hline
+!giá trị 1! : :={50} & !giá trị 2! : :={29} & !trung bình! : \textbf{:={(a1+b1)/2}}\\\hline
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{|c|c||c|}}\hline
+giá trị 1 : :={50} & giá trị 2 : :={29} & trung bình : \textbf{:={(a1+b1)/2}}\\\hline
+\end{spreadtab}
+\end{center}
+Cũng cần lưu ý rằng "\verb-:={}-" định nghĩa một công thức rỗng, nó tương đương với "\verb-@-" trong một ô (ô này là ô chứa văn bản).
+
+\section{Định dạng bảng}
+\subsection{Trở lại với hàng và đường kẻ ngang}
+Để xác định điểm kết thúc của một hàng, \ST bắt buộc phải nhận ra sự xuống hàng và các đường kẻ ngang. Gói này cho phép sử dụng thêm một tham số của \verb-\\- như sau: \verb-\\[<dimension>]-.
+
+Chúng ta có thể sử dụng một số tùy ý các đường kẻ ngang sau:\parindent2em\smallskip
+\begin{itemize}
+ \item \verb-\hline-;
+ \item \verb=\cline{x-y}= trong đó \falseverb x và \falseverb y là số thứ tự của cột xuất phát và cột đến của đường kẻ;
+ \item \verb=\hhline{<type>}= trong đó \verb=<type>= là kiểu đường kẻ tùy chọn (xem tài liệu của gói \href{http://www.ctan.org/tex-archive/macros/latex/required/tools/}{\texttt{\textbf{hhline}}}).
+\end{itemize}\parindent0pt\medskip
+
+Dưới đây là một ví dụ về tam giác Pascal "ngược":
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{*5c}}
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]\\[1em]
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1] & \\
+[0,1] & [-1,1]+[0,1] & [-1,1] & & \\ \hline\hline
+[0,1] & [-1,1] & & & \\ \cline{2-4}
+1 & & & & \\ \hline
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{*5c}}
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]\\[1em]
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1] & \\
+[0,1] & [-1,1]+[0,1] & [-1,1] & & \\ \hline\hline
+[0,1] & [-1,1] & & & \\ \cline{2-4}
+1 & & & & \\ \hline
+\end{spreadtab}
+\end{center}
+
+\subsection{Ẩn một hàng hay một cột}
+Thỉnh thoảng, nguyên một hàng hay một cột được sử dụng để chứa các phép tính trung gian mà ta muốn chúng không được hiển thị trong bảng. \ST sẽ giúp ta thực hiện điều này nhờ các lệnh \verbinline=\SThiderow= (ẩn hàng) và \verbinline=\SThidecol= (ẩn cột). Nếu chúng được đặt trong một ô nào đó, thì hàng hay cột chứa ô đó sẽ được ẩn đi.
+
+Sau đây là một ví dụ:
+\begin{lstlisting}[escapechar=!]
+\begin{spreadtab}{{tabular}{|r|ccc|}}
+\hline
+@!Giá trị của! $x$ & -1 & 0\SThidecol & 2 & 3 \\\hline
+@$f(x)=2x-1$ & 2*[0,-1]-1 & 2*[0,-1]-1 & 2*[0,-1]-1 & 2*[0,-1]-1 \\
+@$g(x)=x-10$\SThiderow & [0,-2]-10 & [0,-2]-10 & [0,-2]-10 & [0,-2]-10 \\
+@$h(x)=1-x$ & 1-[0,-3] & 1-[0,-3] & 1-[0,-3] & 1-[0,-3] \\\hline
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{|r|ccc|}}
+\hline
+@ Giá trị của $x$ & -1 & 0\SThidecol & 2 & 3 \\\hline
+@$f(x)=2x-1$ & 2*[0,-1]-1 & 2*[0,-1]-1 & 2*[0,-1]-1 & 2*[0,-1]-1 \\
+@$g(x)=x-10$\SThiderow & [0,-2]-10 & [0,-2]-10 & [0,-2]-10 & [0,-2]-10 \\
+@$h(x)=1-x$ & 1-[0,-3] & 1-[0,-3] & 1-[0,-3] & 1-[0,-3] \\\hline
+\end{spreadtab}
+\end{center}
+Chúng ta đã ẩn đi hàng chứa $g(x)$ và cột chứa giá trị 0 (cột thứ ba).
+
+Cần nhớ rằng môi trường bảng (trong ví dụ trên là \verb-tabular-) sẽ không đọc được các hàng và các cột ẩn, điều đó giải thích tại sao trong phần định nghĩa môi trường bảng, chúng ta chỉ có 4 cột (\falseverb{|r|ccc|}), trong khi đó \ST lại làm việc với 5 cột.
+
+Để thấy sự khác biệt, chúng ta sẽ lấy lại ví dụ trên nhưng không ẩn một hàng hay cột nào:
+
+\begin{center}
+\begin{spreadtab}{{tabular}{|r|cccc|}}
+\hline
+@ Giá trị của $x$ & -1 & 0 & 2 & 3 \\\hline
+@$f(x)=2x-1$ & 2*[0,-1]-1 & 2*[0,-1]-1 & 2*[0,-1]-1 & 2*[0,-1]-1 \\
+@$g(x)=x-10$ & [0,-2]-10 & [0,-2]-10 & [0,-2]-10 & [0,-2]-10 \\
+@$h(x)=1-x$ & 1-[0,-3] & 1-[0,-3] & 1-[0,-3] & 1-[0,-3] \\\hline
+\end{spreadtab}
+\end{center}
+
+\subsection{Lưu giá trị của một ô}
+Nhiều lúc chúng ta cần giá trị của một ô để sử dụng bên ngoài một công thức hay thậm chí là bên ngoài của bảng. Ta sử dụng cú pháp sau:
+\begin{center}
+\verbinline-\STsavecell-\verb-{<lệnh>}{<vị trí tuyệt đối>}-
+\end{center}
+Cú pháp này cho phép lưu giá trị của ô có \verb-<vị trí tuyệt đối>- trong \verb-<lệnh>-. \emph{Chú ý}: \ST sẽ không kiểm tra là \verb-<lệnh>- đã được định nghĩa trước đó hay chưa.
+
+Chúng ta chỉ có thể sử dụng vị trí \emph{tuyệt đối} bởi vì cú pháp trên được đặt trong phần tùy chọn của môi trường \verbinline-spreadtab-.
+
+Ta có thể lưu cùng một lúc nhiều ô, chỉ cần đặt trong phần tùy chọn một số tương ứng lệnh \verbinline-\STsavecell-.
+
+\begin{lstlisting}[escapechar=!]
+\begin{spreadtab}[\STsavecell\hhh{b3}\STsavecell\mmm{c3}\STsavecell\sss{d3}]{{tabular}{|rc|}}\hline
+@ !Vận tốc! (km/h) &\SThidecol&\SThidecol&\SThidecol& 35 \\
+@ !Khoảng cách! (km) & & & & 180\\\hline
+@ !Thời gian! (h min s) & trunc(e2/e1,0) & trunc(60*(e2/e1-b3),0) & trunc(3600*(e2/e1-b3)-60*c3,1) &@\hhh\ h \mmm\ min \sss\ s\\\hline
+\end{spreadtab}\par\medskip
+!Phải mất ít nhất! \hhh\ !giờ!
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}[\STsavecell\hhh{b3}\STsavecell\mmm{c3}\STsavecell\sss{d3}]{{tabular}{|rc|}}\hline
+@Vận tốc (km/h) &\SThidecol&\SThidecol&\SThidecol& 35 \\
+@Khoảng cách (km) & & & & 180\\\hline
+@Thời gian (h min s) & trunc(e2/e1,0) & trunc(60*(e2/e1-b3),0) & trunc(3600*(e2/e1-b3)-60*c3,1) &@\hhh\ h \mmm\ min \sss\ s\\\hline
+\end{spreadtab}\par\medskip
+Phải mất ít nhất \hhh\ giờ
+\end{center}
+
+\subsection{Sử dụng \ttfamily\textbackslash multicolumn}
+Gói \ST tương thích với cú pháp
+\begin{center}
+\verbinline=\multicolumn{<n>}=\verb={<kiểu>}{<nội dung>}=
+\end{center}
+Cú pháp này cho phép hợp nhất \falseverb{<n>} ô thành một ô có kiểu và nội dung được xác định trong phần tùy chọn.
+
+Bảng dưới đây chứa một số ô đã được hợp nhất với nhau, các ô của nó sẽ có vị trí như sau đối với \ST:
+\begin{center}
+\ttfamily
+\begin{tabular}{|*7{c|}}\hline
+a1&b1&c1&d1&e1&f1&g1\\\hline
+a2&\multicolumn{2}{l|}{b2}&d2&e2&f2&g2\\\hline
+\multicolumn{3}{|l|}{a3}&d3&\multicolumn{2}{l|}{e3}&g3\\\hline
+\end{tabular}
+\end{center}
+Như vậy, ô ở ngay sau ô hợp nhất sẽ có số thứ tự phụ thuộc vào số ô đã được hợp nhất.
+
+Ở hàng cuối cùng, các ô \falseverb{a3}, \falseverb{b3} và \falseverb{c3} được hợp nhất với nhau, và nếu ô \falseverb{a3} chứa công thức thì các ô \falseverb{b3} và \falseverb{c3} sẽ \emph{không tồn tại} đối với \ST: chúng ta không thể tham chiếu đến chúng từ một ô nào khác.
+
+Trong ví dụ sau đây, mỗi số ở hàng trên sẽ bằng tích của hai số ngay phía dưới của nó:
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{*6c}}
+\cline{2-5}
+ & \multicolumn{2}{|c|}{:={a2*c2}} & \multicolumn{2}{c|}{:={c2*e2}} & \\
+\hline
+\multicolumn{2}{|c}{:=8} & \multicolumn{2}{|c}{:=7} & \multicolumn{2}{|c|}{:=6}\\
+\hline
+&&&&&
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{*6c}}
+\cline{2-5}
+ & \multicolumn{2}{|c|}{:={a2*c2}} & \multicolumn{2}{c|}{:={c2*e2}} & \\
+\hline
+\multicolumn{2}{|c}{:=8} & \multicolumn{2}{|c}{:=7} & \multicolumn{2}{|c|}{:=6}\\
+\hline
+&&&&&
+\end{spreadtab}
+\end{center}
+
+\subsection{Gói \ttfamily fp}
+Như đã nói ở trên, tất cả các phép tính đều được thực hiện bởi gói \href{http://www.ctan.org/tex-archive/macros/latex/contrib/fp/}{\texttt{\textbf{fp}}} và macro \falseverb{\FPeval}\footnote{Cả hai khái niệm "trung tố" (infix) và "hậu tố" (postfix) đều được chấp nhận bởi {\ttfamily\string\FPeval}, do đó các công thức trong \ST có thể được viết dưới cả hai dạng trên.} của nó. Gói này cung cấp một khả năng tính toán rất mạnh cho \TeX{} và còn được trang bị tất cả các hàm số thông dụng. Các phép tính được tính với độ chính xác đến $10^{-18}$, do đó kết quả sẽ được hiển thị đến 18 chữ số thập phân nếu nó không tròn ! Tất nhiên trong hầu hết các trường hợp, 18 chữ số là quá nhiều và ta muốn giảm bớt.
+
+Có nhiều cách để giải quyết vấn đề này:\parindent2em\smallskip
+\begin{itemize}
+ \item có thể dùng gói \href{http://www.ctan.org/tex-archive/macros/latex/contrib/numprint/}{\texttt{\textbf{numprint}}} để quản lí việc hiển thị kết quả;
+ \item sử dụng hàm \verb-round(kết quả,n)- để làm tròn \verb=kết quả= đến \verb=n= chữ số thập phân;
+ \item ta cũng có thể sử dụng macro \verbinline-\STautoround- của \ST, tham số của nó là số chữ số thập phân cần hiển thị. Nếu không có tham số (mặc định), nó sẽ không làm tròn kết quả.
+\end{itemize}\parindent0pt\medskip
+
+Ví dụ sau là bảng chứa các số nguyên từ 1 đến 7 và các nghịch đảo của chúng, được làm tròn đến $10^{-6}$:
+\begin{lstlisting}
+\STautoround{6}
+\begin{spreadtab}{{tabular}{|l|*7{>{\centering\arraybackslash}m{1.35cm}|}}}
+\hline
+@$x$ & 1 & 2 & 3 & 4 & 5 & 6 & 7 \\\hline
+@$x^{-1}$& 1/b1 & 1/c1 & 1/d1 & 1/e1 & 1/f1 & 1/g1 & 1/h1\\\hline
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\STautoround{6}
+\begin{spreadtab}{{tabular}{|l|*7{>{\centering\arraybackslash}m{1.35cm}|}}}
+\hline
+@$x$ & 1 & 2 & 3 & 4 & 5 & 6 & 7 \\\hline
+@$x^{-1}$& 1/b1 & 1/c1 & 1/d1 & 1/e1 & 1/f1 & 1/g1 & 1/h1\\\hline
+\end{spreadtab}
+\end{center}
+
+\section{Macro hàm}
+Bởi vì tất cả các phép tính đều được thực hiện bởi gói \href{http://www.ctan.org/tex-archive/macros/latex/contrib/fp/}{\texttt{\textbf{fp}}} nên các hàm số trong các công thức phải được "hiểu" bởi \falseverb{fp}. Tuy số lượng các hàm số cung cấp bởi \falseverb{fp} là rất lớn, nó vẫn không đủ để thực hiện các phép tính trong bảng. Đó là lí do tại sao cần phải xây dựng các macro hàm. Các macro này được tạo ra nhờ vào các hàm sẵn có của \falseverb{fp}.
+
+Nhận xét quan trọng: có thể lấy hàm hợp lẫn nhau của các macro hàm, và các tham số của chúng có thể chứa các phép toán cũng như hàm số của \falseverb{fp}.
+
+\subsection{Macro hàm toán học}
+\subsubsection{Hàm tổng}
+Hàm "\verbinline=sum=" cho phép lấy tổng của một hay nhiều mảng ô và có cú pháp:
+\begin{center}
+\verbinline=sum=\verb=(<mảng 1>;<mảng 2>;...;<mảng 3 n>)=
+\end{center}
+trong đó một mảng :\parindent2em\smallskip
+\begin{itemize}
+ \item hoặc là một ô riêng biệt, chẳng hạn "\falseverb{a1}" hay "\falseverb{[2,1]}";
+ \item hoặc là một miền chữ nhật giới hạn bởi một ô phía trên bên trái và một ô phía dưới bên phải, nó được nhập vào như sau: "\verb=<ô 1>:<ô 2>=", với điều kiện là "\verb=<ô 1>=" phải ở \emph{trước} "\verb=<ô 2>=" khi chúng ta đi từ trên xuống dưới và từ trái sang phải.
+
+ Ví dụ về mảng ô: "\falseverb{a2:d5}", "\falseverb{[-1,-1]:[2,3]}", "\falseverb{b4:[5,1]}".
+\end{itemize}\parindent0pt\medskip
+
+Trong các mảng, những ô trống hoặc chỉ chứa văn bản được xem như chứa giá trị 0. Các ô bị nhập vào bởi \verbinline-\multicolumn- cũng vậy.
+
+Vị trí tương đối và tuyệt đối có thể được sử dụng cùng nhau. Ví dụ sau đây tính tổng các hệ số của tam giác Pascal:
+
+\begin{minipage}{0.75\linewidth}
+\begin{lstlisting}[escapechar=!]
+\begin{spreadtab}{{tabular}{*5c}}
+\multicolumn{5}{c}{!Tổng! = :={sum(a2:e6)}}\\
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1] \\
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1] & \\
+[0,1] & [-1,1]+[0,1] & [-1,1] & & \\
+[0,1] & [-1,1] & & & \\
+1 & & & &
+\end{spreadtab}
+\end{lstlisting}
+\end{minipage}%
+\begin{minipage}{0.25\linewidth}
+\centering
+\begin{spreadtab}{{tabular}{*5c}}
+\multicolumn{5}{c}{Tổng=:={sum(a2:e6)}}\\
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1] \\
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1] & \\
+[0,1] & [-1,1]+[0,1] & [-1,1] & & \\
+[0,1] & [-1,1] & & & \\
+1 & & & &
+\end{spreadtab}
+\end{minipage}%
+
+\subsubsection{Hàm giai thừa}
+Macro hàm \verbinline=fact(<n>)= cho phép tính giai thừa của tham số \verb=n=, trong đó \verb=n= là một số nguyên trong khoảng từ 0 đến 18\footnote{Đối với \falseverb{fp}, số lớn nhất là $10^{18}-1$. Giai thừa của 19 vượt quá số này.}. \verb=n= có thể là một tham chiếu đến một ô chứa một số nguyên.
+
+Bảng sau chứa giai thừa của các số từ 0 đến 8:
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{*9c}}
+ 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 &8\\\hline
+fact(a1)&fact(b1)&fact(c1)&fact(d1)&fact(e1)&fact(f1)&fact(g1)&fact(h1)&fact(i1)
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{*9c}}
+ 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 &8\\\hline
+fact(a1)&fact(b1)&fact(c1)&fact(d1)&fact(e1)&fact(f1)&fact(g1)&fact(h1)&fact(i1)
+\end{spreadtab}
+\end{center}
+
+\subsubsection{Macro hàm \ttfamily sumprod}
+Hàm \verbinline=sumprod= cho phép lấy tích của các phần tử tương ứng của hai hay nhiều mảng, sau đó tính tổng của các tích này. Cú pháp:
+\begin{center}
+\verbinline{sumprod}\verb=(<mảng 1>;<mảng 2>;...;<mảng n>)=
+\end{center}
+Tất cả các mảng của hàm phải có cùng kích thước.
+
+Ví dụ đơn giản sau đây tính tuổi trung bình của một nhóm trẻ em từ 10 đến 15 tuổi:
+\begin{lstlisting}[escapechar=!]
+\begin{spreadtab}{{tabular}{r*6c}}
+@!Tuổi! & 10 & 11 & 12 & 13 & 14 & 15\\
+@!Số lượng! & 5 & 8 & 20 & 55 & 9 & 3\\\hline
+@!Trung bình!&\multicolumn{6}{l}{:={sumprod(b1:g1;b2:g2)/sum(b2:g2)}}
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{r*6c}}
+@Tuổi & 10 & 11 & 12 & 13 & 14 & 15\\
+@Số lượng & 5 & 8 & 20 & 55 & 9 & 3\\\hline
+@Trung bình&\multicolumn{6}{l}{:={sumprod(b1:g1;b2:g2)/sum(b2:g2)}}
+\end{spreadtab}
+\end{center}
+Cũng giống như macro hàm \verbinline-sum-, các ô chứa văn bản hoặc được nhập bởi \verbinline-\multicolumn- được xem như có giá trị 0.
+
+\subsubsection{Số ngẫu nhiên}
+Macro hàm \verbinline-randint- và \verbinline-rand- trả về một số ngẫu nhiên.
+
+Chú ý: giá trị ngẫu nhiên này phụ thuộc vào thời điểm biên dịch của tài liệu. Nếu chúng ta muốn nhận được những giá trị không phụ thuộc vào thời điểm biên dịch, cần định nghĩa lại macro \verb-\ST@seed- và gán cho \verb-\FPseed- một giá trị nguyên:
+
+\begin{lstlisting}[backgroundcolor=\color{ST@codebckgcolor},escapechar=!]
+\makeatletter
+\renewcommand\ST@seed{}
+\makeatletter
+\FPseed=27% !chẳng hạn, hoặc một số nguyên bất kì nào khác!
+\end{lstlisting}
+Macro hàm \verbinline-randint- trả về một \emph{số nguyên} phụ thuộc vào tham số. Cú pháp như sau:
+\begin{center}
+\verbinline=randint=\verb=([<số 1>,]<số 2>)=
+\end{center}
+trong đó \verb=<số 1>= là một tham số nguyên (mặc định bằng 0). Số nguyên ngẫu nhiên được trả về sẽ nằm trong đoạn \verb=[<số 1>;<số 2>]=.
+
+Macro hàm \verbinline-rand()- trả về một số thập phân ngẫu nhiên giữa 0 và 1:
+\begin{lstlisting}[escapechar=!]
+\STautoround{6}
+\begin{spreadtab}{{tabular}{|l|cccc|}}\hline
+@!Số thuộc đoạn! [0;1] &rand() &rand() &rand() &rand() \\
+@!Số thuộc đoạn! [-5;5] &randint(-5,5) &randint(-5,5) &randint(-5,5) &randint(-5,5)\\
+@!Số thuộc đoạn! [0;20] &randint(20) &randint(20) &randint(20) &randint(20) \\
+\hline
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\STautoround{6}
+\begin{spreadtab}{{tabular}{|l|cccc|}}\hline
+@Số thuộc đoạn [0;1] &rand() &rand() &rand() &rand() \\
+@Số thuộc đoạn [-5;5] &randint(-5,5) &randint(-5,5) &randint(-5,5) &randint(-5,5)\\
+@Số thuộc đoạn [0;20] &randint(20) &randint(20) &randint(20) &randint(20) \\
+\hline
+\end{spreadtab}
+\end{center}
+
+\subsection{Các macro hàm kiểm tra}
+Có ba macro hàm kiểm tra, chúng có cú pháp như sau:
+\begin{center}
+\verbinline=ifeq=\verb=(<số 1>,<số 2>,<số 3>,<số 4>)=\par
+\verbinline=ifgt=\verb=(<số 1>,<số 2>,<số 3>,<số 4>)=\par
+\verbinline=iflt=\verb=(<số 1>,<số 2>,<số 3>,<số 4>)=
+\end{center}
+Phép so sánh được thực hiện giữa \verb-<số 1>- và \verb-<số 2>-:\parindent2em\smallskip
+\begin{itemize}
+ \item kiểm tra đẳng thức với \verbinline-ifeq-: \verb-<số 1>- = \verb-<số 2>- ?
+ \item kiểm tra tính lớn hơn nghiêm ngặt với \verbinline-ifgt- : \verb-<số 1>- > \verb-<số 2>- ?
+ \item kiểm tra tính nhỏ hơn nghiêm ngặt với \verbinline-iflt- : \verb-<số 1>- < \verb-<số 2>- ?
+\end{itemize}\parindent0pt\medskip
+
+Nếu phép kiểm tra là đúng thì \verb-<số 3>- được trả về, nếu không thì \verb-<số 4>- được trả về.
+
+Ví dụ sau đây xác định một vài giá trị của hàm số
+$f(x)=\begin{cases}
+10 &\text{nếu }x<1\\
+0 &\text{nếu }x=1\\
+-10 &\text{nếu }x>1
+\end{cases}
+$
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{|*2c|}}\hline
+@$x$ & @$f(x)$ \\\hline
+-0.5 & iflt([-1,0],1,10,ifeq([-1,0],1,0,-10))\\
+[0,-1]+0.5 & iflt([-1,0],1,10,ifeq([-1,0],1,0,-10))\\
+[0,-1]+0.5 & iflt([-1,0],1,10,ifeq([-1,0],1,0,-10))\\
+[0,-1]+0.5 & iflt([-1,0],1,10,ifeq([-1,0],1,0,-10))\\
+[0,-1]+0.5 & iflt([-1,0],1,10,ifeq([-1,0],1,0,-10))\\
+[0,-1]+0.5 & iflt([-1,0],1,10,ifeq([-1,0],1,0,-10))\\
+[0,-1]+0.5 & iflt([-1,0],1,10,ifeq([-1,0],1,0,-10))\\\hline
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{|*2c|}}\hline
+@$x$ & @$f(x)$ \\\hline
+-0.5 & iflt([-1,0],1,10,ifeq([-1,0],1,0,-10))\\
+[0,-1]+0.5 & iflt([-1,0],1,10,ifeq([-1,0],1,0,-10))\\
+[0,-1]+0.5 & iflt([-1,0],1,10,ifeq([-1,0],1,0,-10))\\
+[0,-1]+0.5 & iflt([-1,0],1,10,ifeq([-1,0],1,0,-10))\\
+[0,-1]+0.5 & iflt([-1,0],1,10,ifeq([-1,0],1,0,-10))\\
+[0,-1]+0.5 & iflt([-1,0],1,10,ifeq([-1,0],1,0,-10))\\
+[0,-1]+0.5 & iflt([-1,0],1,10,ifeq([-1,0],1,0,-10))\\\hline
+\end{spreadtab}
+\end{center}
+
+
+\section{Một số lưu ý đặc biệt}
+\subsection{Định nghĩa lại lệnh vẽ đường kẻ ngang}
+Chúng ta có thể thử định nghĩa một lệnh để vẽ một đường kẻ ngang kép chẳng hạn:
+\begin{center}
+\verbinline-\newcommand\dline{\hline\hline}-
+\end{center}
+rồi sau đó sử dụng nó trong một bảng tính số hạng của dãy Fibonacci:
+\begin{center}
+\newcommand\dline{\hline\hline}
+\begin{spreadtab}{{tabular}{*7c}}
+0 & 1 & 2 & 3 & 4 & 5 & 6 \\\dline
+:={1} & 1 & a2+b2 & b2+c2 & c2+d2 & d2+e2 & e2+f2
+\end{spreadtab}
+\end{center}
+Nhưng khi nhập vào đoạn mã sau
+\begin{lstlisting}
+\newcommand\dline{\hline\hline}
+\spreadtab{\begin{tabular}{*7c}}
+{
+0 & 1 & 2 & 3 & 4 & 5 & 6 \\\dline
+1 & 1 & a2+b2 & b2+c2 & c2+d2 & d2+e2 & e2+f2
+}
+\end{lstlisting}
+và biên dịch thì hệ thống báo lỗi:\par
+\hfill\falseverb{! Improper alphabetic constant.}\hfill\null
+
+Lí do rất đơn giản, đó là \ST \emph{không hiểu} được lệnh \verb-\dline- và do đó không xem nó như một đường kẻ ngang, như vậy nó được xem như thuộc \emph{ô đầu tiên của hàng tiếp theo}. Với \ST, ô \falseverb{b1} chứa:\par
+\hfill\falseverb{\dline 1}\hfill\null
+
+Do không có \verb-@- hay \verb-:={...}-, \verb-\FPeval- cố gắng tính giá trị của ô, và tất nhiên là thất bại !
+
+Để có thể biên dịch mà không bị lỗi, cần phải có một công thức trong ô \falseverb{b1}:
+\begin{lstlisting}
+\newcommand\dline{\hline\hline}
+\begin{spreadtab}{{tabular}{*7c}}
+0 & 1 & 2 & 3 & 4 & 5 & 6 \\\dline
+:={1} & 1 & a2+b2 & b2+c2 & c2+d2 & d2+e2 & e2+f2
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\newcommand\dline{\hline\hline}
+\begin{spreadtab}{{tabular}{*7c}}
+0 & 1 & 2 & 3 & 4 & 5 & 6 \\\dline
+:={1} & 1 & a2+b2 & b2+c2 & c2+d2 & d2+e2 & e2+f2
+\end{spreadtab}
+\end{center}
+
+\subsection{Sử dụng cùng lúc {\ttfamily\textbackslash multicolumn} và \ttfamily\textbackslash SThidecol}
+Trước hết, thông thường việc sử dụng cùng lúc \verbinline|\multicolumn| và \verbinline-\SThiderow- là không thể, và đa số người sử dụng sẽ không rơi vào hoàn cảnh này, và do đó, không cần đọc mục này.
+
+Nhưng nếu bạn đọc nào muốn hiểu rõ vấn đề, chúng ta hãy cùng xem. Một cột được ẩn đi không được chứa một ô có lệnh \verbinline-\multicolumn-, nhưng chuyện gì sẽ xảy ra nếu ta rơi vào trường hợp này ?
+
+Nói chung, hệ thống sẽ không báo lỗi, nhưng các vị trí và tham chiếu sẽ bị xáo trộn ở hàng chứa \verbinline-\multicolumn-\ldots.
+
+Hãy lấy một ví dụ, trong bảng sau, ta sẽ hợp nhất các ô từ \falseverb{b2} đến \falseverb{h2} và ta muốn ẩn đi các cột \falseverb{c}, \falseverb{d} và \falseverb{f} (màu xám):
+\begin{center}
+\ttfamily
+\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|}
+\hline
+ a1 & b1 & \cellcolor[gray]{0.6}c1 & \cellcolor[gray]{0.6}d1 & e1 & \cellcolor[gray]{0.6}f1 & g1 & h1 & i1 & j1\\\hline
+ a2 & \multicolumn1c{b2} & \multicolumn1{>{\cellcolor[gray]{0.6}}c}{} & \multicolumn1{>{\cellcolor[gray]{0.6}}c}{} & \multicolumn1c{} & \multicolumn1{>{\cellcolor[gray]{0.6}}c}{} & \multicolumn1{c}{} & \multicolumn1{c|}{} & i2 & j2\\\hline
+\end{tabular}
+\end{center}
+Có 4 ô \emph{ẩn} được hợp nhất, do đó ta sẽ nhập vào \verbinline-\multicolumn{4}-, bởi vì khi đếm số ô để hợp nhất, ta sẽ trừ ra các ô đã được ẩn.
+
+Bây giờ, nếu đếm 4 chữ cái kể từ chữ cái \falseverb{b} ta sẽ đi đến chữ cái \falseverb{e}: ta được "đoạn cột \falseverb{b-e}". Đoạn này chứa $\underline{\color{red}{2}}$ cột ẩn (\falseverb c và \falseverb d) và không chứa $\underline{\color{blue}{1}}$ cột ẩn khác (\falseverb f). Hai giá trị này là rất quan trọng để hiểu được phần tiếp theo, trong trường hợp tổng quát ta hãy kí hiệu chúng là $\underline{\color{red}{a}}$ và $\underline{\color{blue}{b}}$.
+
+Cần tuân thủ các quy tắc sau :\parindent2em\smallskip
+\begin{itemize}
+ \item phải thêm vào $b$ kí tự "\verb-&-" sau \verbinline-\multicolumn- (con số này là 1 với ví dụ trên);
+ \item dịch chữ cái thứ tự cột của các ô sau \verbinline-\multicolumn- $a$ chữ cái về phía đầu của bảng chữ cái. Đối với ví dụ trên, nếu ta muốn tham chiếu đến ô "\falseverb{i2}", cần phải nhập vào \falseverb{g2}.
+\end{itemize}\parindent0pt\medskip
+
+Trong ví dụ sau, mỗi số ở hàng dưới sẽ bằng tổng của số ở hàng trên và 1. Bảng này có cấu trúc tương tự như ví dụ trước: $a=2$ và $b=1$. Chú ý rằng ta sẽ thêm vào một kí tự "\textcolor{red}{\texttt{\&}}" bởi vì $b=1$.
+\begin{lstlisting}[escapechar=Z]
+\begin{spreadtab}{{tabular}{|*{7}{c|}}}
+\hline
+1 & 2 & \SThidecol3 & \SThidecol4 & 5& \SThidecol6 & 7& 8& 9 & 10 \\\hline
+a1+1& \multicolumn4{l|}{:={b1+1}}Z\ttfamily\color{red}\rlap\&Z & i1+1 & j1+1\\\hline
+a2+1& b2+1 & & & & & & & g2+1 & h2+1\\\hline
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{|*{7}{c|}}}
+\hline
+1 & 2 & \SThidecol3 & \SThidecol4 & 5& \SThidecol6 & 7& 8& 9 & 10 \\\hline
+a1+1& \multicolumn4{l|}{:={b1+1}}& & i1+1 & j1+1\\\hline
+a2+1& b2+1 & & & & & & & g2+1 & h2+1\\\hline
+\end{spreadtab}
+\end{center}
+Sau đây là một ví dụ khác tương tự, ta sẽ ẩn một cột (cột \falseverb d): $a=1$ và $b=0$.
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{|*{9}{c|}}}
+\hline
+1 & 2 & 3 & \SThidecol4 & 5 & 6 & 7 & 8 & 9 & 10 \\\hline
+a1+1& \multicolumn6{l|}{:={b1+1}} & i1+1 & j1+1\\\hline
+a2+1& b2+1 & & & & & & & h2+1 & i2+1\\\hline
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{|*{9}{c|}}}
+\hline
+1 & 2 & 3 & \SThidecol4 & 5 & 6 & 7 & 8 & 9 & 10 \\\hline
+a1+1& \multicolumn6{l|}{:={b1+1}} & i1+1 & j1+1\\\hline
+a2+1& b2+1 & & & & & & & h2+1 & i2+1\\\hline
+\end{spreadtab}
+\end{center}
+
+\subsection{Các thông báo lỗi}
+\ST sẽ dừng biên dịch và thông báo lỗi trong các trường hợp sau:\parindent2em\smallskip
+\begin{itemize}
+ \item để tính giá trị của một ô, chúng ta tính các ô mà nó tham chiếu đến; với các ô này chúng ta lại làm tương tự, và nếu có một ô nào đó tham chiếu đến ô ban đầu (tham chiếu vòng), hệ thống sẽ báo lỗi và hiển thị trong tin nhắn báo lỗi vòng tham chiếu này;
+ \item một công thức chứa một tham chiếu đến một ô rỗng hoặc chỉ chứa văn bản;
+ \item một ô tham chiếu đến một ô không xác định (bên ngoài giới hạn của bảng);
+ \item một ô tham chiếu đến một ô bị hợp nhất bởi \verbinline-\multicolumn-;
+ \item một ví trí tương đối không đúng cú pháp.
+\end{itemize}\parindent0pt\medskip
+
+\ST có thể thông báo lỗi trong tập tin \verb-log-. Lệnh \verbinline-\STmessage- với tham số \verb-true- hoặc \verb-false- cho phép thực hiện hay không việc báo lỗi này (\verb-true- theo mặc định).
+
+Chúng ta hãy lấy một ví dụ đơn giản:
+
+\begin{minipage}{0.65\linewidth}
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{|cccc|c|}}\hline
+b1+1 & c1+1 & d1+1 & 10 & a1+b1+c1+d1\\\hline
+\end{spreadtab}
+\end{lstlisting}
+\end{minipage}%
+\begin{minipage}{0.35\linewidth}
+\centering
+\begin{spreadtab}{{tabular}{|cccc|c|}}\hline
+b1+1 & c1+1 & d1+1 & 10 & a1+b1+c1+d1\\\hline
+\end{spreadtab}
+\end{minipage}
+
+Việc tiến hành xây dựng bảng ở đây rất đơn giản. Sau đây là một số thông tin cho bởi \ST:
+\begin{lstlisting}
+[spreadtab] New spreadtab ({tabular}{|cccc|c|})
+* reading tab: ok
+* computing formulas:
+ cell A1-B1-C1
+ cell B1
+ cell C1
+ cell D1
+ cell E1
+* building tab: ok
+[spreadtab] End of spreadtab
+\end{lstlisting}
+Môi trường bảng cho bởi người sử dụng được đặt trong các dấu ngoặc (trong trường hợp này là \verbinline-{tabular}{|cccc|c|}-). Chúng ta thấy rõ 3 bước cần thiết của \ST (bắt đầu bởi các dấu sao) để thực hiện nhiệm vụ của nó: đọc bảng, tính các công thức rồi sau đó xây dựng lại và hiển thị bảng.
+
+Ở bước thứ hai, các ô được đánh giá từ trên xuống dưới, từ trái sang phải: ta thấy rằng \ST bắt đầu tính ô \falseverb{A1}. Để làm điều đó, nó phải tính \falseverb{B1} trước, và trước đó nữa là \falseverb{C1}. Vì \falseverb{C1} chỉ phụ thuộc vào \falseverb{D1} (có giá trị bằng 10) nên nó có thể được tính.
+
+Các hàng tiếp theo chỉ có một ô, nghĩa là \ST tính các ô này trong khi chúng đã có sẵn giá trị hoặc tham chiếu đến những ô đã được tính.
+
+\section{Một số ví dụ}
+Chúng ta hãy kết thúc bằng một vài ví dụ thú vị !
+
+Để biết được kết quả nào đã được tính, chỉ những số không được tính (cho bởi người dùng) sẽ được in đỏ. Trong các ví dụ này, rất nhiều kĩ năng và gói (chủ yếu là \verb-numprint- và các cột "N" của nó để canh thẳng hàng các dấu phẩy thập phân) đã được sử dụng để nhận được những kết quả, nhiều hay ít, thỏa mãn mỹ quan của chúng ta. Mã nhập vào đôi khi khá nặng nề, nhưng đây không phải là những ví dụ cơ bản, mà là những bảng được "trang điểm" tỉ mỉ !
+
+\subsection{Lại là tam giác Pascal}
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{*7r}}
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]\\
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1] & \\
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1] & & \\
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1] & & & \\
+[0,1] & [-1,1]+[0,1] & [-1,1] & & & & \\
+[0,1] & [-1,1] & & & & & \\
+\color{red}:={1}& & & & & &
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{*7r}}
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]\\
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1] & \\
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1] & & \\
+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1] & & & \\
+[0,1] & [-1,1]+[0,1] & [-1,1] & & & & \\
+[0,1] & [-1,1] & & & & & \\
+\color{red}:={1}& & & & & &
+\end{spreadtab}
+\end{center}
+
+\subsection{Chuỗi hội tụ}
+Chuỗi mà chúng ta sẽ xét đến là khai triển giới hạn của hàm số mũ:
+\[
+\forall x\in \mathbf{R}\qquad e^x=\sum_{k=0}^\infty\frac{x^k}{k!}
+\]
+Bảng sau minh họa "tốc độ" hội tụ ngày càng tăng theo bậc khai triển giới hạn tại \numprint{0.5}.
+\begin{lstlisting}[escapechar=M]
+\STautoround{15}
+\begin{spreadtab}[\STsavecell\xvalue{a1}]{{tabular}{cN{2}{15}}}
+\multicolumn{2}{c}{MHội tụ tạiM $x=\color{red}{\numprint{:={0.5}}}$}\\[1.5ex]
+@$n$ & e^a1\SThidecol & \hfill{@ $\displaystyle e^{\numprint\xvalue}-\sum_{k=0}^n\frac{\numprint\xvalue^k}{k!}$}\hfill\\[3ex]\hline
+\color{red}:={0}& a1^[-1,0]/fact([-1,0]) & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\\hline
+\end{spreadtab}
+\end{lstlisting}
+
+\begin{center}
+\STautoround{15}
+\begin{spreadtab}[\STsavecell\xvalue{a1}]{{tabular}{cN{2}{15}}}
+\multicolumn{2}{c}{Hội tụ tại $x=\color{red}{\numprint{:={0.5}}}$}\\[1.5ex]
+@$n$ & e^a1\SThidecol & \hfill{@ $\displaystyle e^{\numprint\xvalue}-\sum_{k=0}^n\frac{\numprint\xvalue^k}{k!}$}\hfill\\[3ex]\hline
+\color{red}:={0}& a1^[-1,0]/fact([-1,0]) & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\
+ [0,-1]+1 & a1^[-1,0]/fact([-1,0])+[0,-1] & b2-[-1,0] \\\hline
+\end{spreadtab}
+\end{center}
+
+\subsection{Hội tụ đến tỉ số vàng}
+Sau đây là định nghĩa của dãy số Fibonacci: $F_0=1\qquad F_1=1\qquad F_{n+2}=F_{n+1}+F_n$
+
+Chúng ta biết rằng thương của hai số hạng liên tiếp $F_{n}$ và $F_{n-1}$ của dãy tiến đến tỉ số vàng $\varphi=\frac{1+\sqrt{5}}{2}$ và dãy $u_n=\varphi-\frac{F_n}{F_{n-1}}$ là một dãy đan dấu và hội tụ về 0.
+\begin{lstlisting}
+\STautoround{9}
+$
+\begin{spreadtab}{{matrix}{}}
+@n & @F_n & @\dfrac{F_n}{F_{n-1}} & @\varphi-\dfrac{F_n}{F_{n-1}}\\[2ex]\hline
+\color{red}:=1 & \color{red}:=1 & & \\
+[0,-1]+1 & \color{red}:=1 & [-1,0]/[-1,-1] & (1+5^0.5)/2-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\\hline
+\end{spreadtab}
+$
+\end{lstlisting}
+\begin{center}
+\STautoround{9}
+$
+\begin{spreadtab}{{matrix}{}}
+@n & @F_n & @\dfrac{F_n}{F_{n-1}} & @\varphi-\dfrac{F_n}{F_{n-1}}\\[2ex]\hline
+\color{red}:=1 & \color{red}:=1 & & \\
+[0,-1]+1 & \color{red}:=1 & [-1,0]/[-1,-1] & (1+5^0.5)/2-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\
+[0,-1]+1 & [0,-1]+[0,-2] & [-1,0]/[-1,-1] & d3+1-[-1,0] \\\hline
+\end{spreadtab}
+$
+\end{center}
+
+\subsection{Bảng hóa đơn}
+Trong bảng hóa đơn sau, các dấu chấm thập phân được canh thẳng hàng trong các cột nhờ kiểu hàng "N" của gói \falseverb{numprint}.
+
+Bảng này sử dụng môi trường \verb=tabularx= sao cho chiều rộng của nó chiếm 80\% độ rộng văn bản (của tài liệu này). Lệnh \verbinline=\multicolumn= được sử dụng nhiều lần để định dạng bảng:
+\begin{lstlisting}[escapechar=!]
+\nprounddigits2
+\let\PC\%
+\begin{spreadtab}{{tabularx}{0.8\linewidth}{|>{\rule[-1.2ex]{0pt}{4ex}}X>{{\color{red}}}N42>{\color{red}}cN42>{\color{red}}cN42|}}
+\hline
+@!Mục!&@\multicolumn{1}{c}{!Giá đơn vị!} & @\multicolumn{1}{c}{!Số lượng!} & @\multicolumn{1}{c}{!Giá!} &@\multicolumn{1}{c}{!Giảm giá!} &@\textbf{!Còn lại!}\\\hline
+@Item 1& 5.99 & 20 & [-2,0]*[-1,0] & $-:={20}\PC$ & [-2,0]*(1-[-1,0]/100)\\
+@Item 2& 12 & 7 & [-2,0]*[-1,0] & $-:={10}\PC$ & [-2,0]*(1-[-1,0]/100)\\
+@Item 3& 4.50 & 40 & [-2,0]*[-1,0] & $-:={35}\PC$ & [-2,0]*(1-[-1,0]/100)\\
+@Item 4& 650 & 2 & [-2,0]*[-1,0] & $-:={15}\PC$ & [-2,0]*(1-[-1,0]/100)\\\hline
+@\multicolumn{6}{c}{\vspace{-1.5ex}}\\\cline{4-6}
+@\multicolumn{1}{c}{\rule[-1.2ex]{0pt}{4ex}}&@\multicolumn{2}{r|}{!\textbf{Tổng cộng}!}& sum(d2:[0,-2]) &\multicolumn{1}{c}{$:={round(([1,0]/[-1,0]-1)*100,0)}\PC$} &{\fontseries{b}\selectfont}:={sum(f2:[0,-2])}\\
+\cline{4-6}
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\nprounddigits2
+\let\PC\%
+\begin{spreadtab}{{tabularx}{0.8\linewidth}{|>{\rule[-1.2ex]{0pt}{4ex}}X>{{\color{red}}}N42>{\color{red}}cN42>{\color{red}}cN42|}}
+\hline
+@Mục &@\multicolumn{1}{c}{Giá đơn vị}& @\multicolumn{1}{c}{Số lượng} & @\multicolumn{1}{c}{Giá} & @\multicolumn{1}{c}{Giảm giá} & @\textbf{Còn lại}\\\hline
+@Item 1 & 5.99 & 20 & [-2,0]*[-1,0] & $-:={20}\PC$ & [-2,0]*(1-[-1,0]/100)\\
+@Item 2 & 12 & 7 & [-2,0]*[-1,0] & $-:={10}\PC$ & [-2,0]*(1-[-1,0]/100)\\
+@Item 3 & 4.50 & 40 & [-2,0]*[-1,0] & $-:={35}\PC$ & [-2,0]*(1-[-1,0]/100)\\
+@Item 4 & 650 & 2 & [-2,0]*[-1,0] & $-:={15}\PC$ & [-2,0]*(1-[-1,0]/100)\\\hline
+@\multicolumn{6}{c}{\vspace{-1.5ex}}\\\cline{4-6}% ligne vide et on remonte un peu !
+@\multicolumn{1}{c}{\rule[-1.2ex]{0pt}{4ex}}&@\multicolumn{2}{r|}{\textbf{Tổng cộng}}& sum(d2:[0,-2]) & \multicolumn{1}{c}{$:={round(([1,0]/[-1,0]-1)*100,0)}\PC$} & {\fontseries{b}\selectfont}:={sum(f2:[0,-2])}\\
+\cline{4-6}
+\end{spreadtab}
+\end{center}
+
+\subsection{Ô vuông ma thuật}
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{|*3{>{\hfill\rule[-0.4cm]{0pt}{1cm}$}m{0.7cm}<{$\hfill\null}|}}}
+\hline
+\color{red}:=2 & 5*b2-4*a1 & 3*a1-2*b2 \\\hline
+2*a1-b2 & \color{red}:={-1} & 3*b2-2*a1 \\\hline
+4*b2-3*a1 & 4*a1-3*b2 & 2*b2-a1 \\\hline
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{|*3{>{\hfill\rule[-0.4cm]{0pt}{1cm}$}m{0.7cm}<{$\hfill\null}|}}}
+\hline
+\color{red}:=2 & 5*b2-4*a1 & 3*a1-2*b2 \\\hline
+2*a1-b2 & \color{red}:={-1} & 3*b2-2*a1 \\\hline
+4*b2-3*a1 & 4*a1-3*b2 & 2*b2-a1 \\\hline
+\end{spreadtab}
+\end{center}
+
+\subsection{Kim tự tháp tổng}
+Mỗi số hạng là tổng của hai số ngay dưới nó.
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{*{8}{m{2ex}}}}
+\cline{4-5}
+:={}\rule{0pt}{2.7ex}&&&\multicolumn{2}{|c|}{$:={[-1,1]+[1,1]}$}&&&\\\cline{3-6}
+:={}\rule{0pt}{2.7ex}&&\multicolumn{2}{|c}{$:={[-1,1]+[1,1]}$}&\multicolumn{2}{|c|}{$:={[-1,1]+[1,1]}$}&&\\\cline{2-7}
+:={}\rule{0pt}{2.7ex}&\multicolumn{2}{|c}{$:={[-1,1]+[1,1]}$}&\multicolumn{2}{|c}{$:={[-1,1]+[1,1]}$}&\multicolumn{2}{|c|}{$:={[-1,1]+[1,1]}$}&\\\hline
+\multicolumn{2}{|c}{\rule{0pt}{2.7ex}\color{red}$:={-5}$}&\multicolumn{2}{|c}{\color{red}$:={3}$}&\multicolumn{2}{|c}{\color{red}$:={-2}$}&\multicolumn{2}{|c|}{\color{red}$:={-3}$}\\\hline
+&&&&&&&
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{*{8}{m{2ex}}}}
+\cline{4-5}
+:={}\rule{0pt}{2.7ex}&&&\multicolumn{2}{|c|}{$:={[-1,1]+[1,1]}$}&&&\\\cline{3-6}
+:={}\rule{0pt}{2.7ex}&&\multicolumn{2}{|c}{$:={[-1,1]+[1,1]}$}&\multicolumn{2}{|c|}{$:={[-1,1]+[1,1]}$}&&\\\cline{2-7}
+:={}\rule{0pt}{2.7ex}&\multicolumn{2}{|c}{$:={[-1,1]+[1,1]}$}&\multicolumn{2}{|c}{$:={[-1,1]+[1,1]}$}&\multicolumn{2}{|c|}{$:={[-1,1]+[1,1]}$}&\\\hline
+\multicolumn{2}{|c}{\rule{0pt}{2.7ex}\color{red}$:={-5}$}&\multicolumn{2}{|c}{\color{red}$:={3}$}&\multicolumn{2}{|c}{\color{red}$:={-2}$}&\multicolumn{2}{|c|}{\color{red}$:={-3}$}\\\hline
+&&&&&&&
+\end{spreadtab}
+\end{center}
+\parskip0pt
+\begin{center}
+$\star$\par
+$\star$\quad$\star$
+\end{center}
+
+Đó là tất cả, hi vọng rằng gói này sẽ giúp ích cho các bạn !\par\medskip\nobreak
+
+Vì mới ra đời nên \ST không thể không có những sai sót. Xin vui lòng báo cho tác giả qua \href{mailto:unbonpetit@gmail.com}{\texttt{\textbf{email}}} các lỗi mà các bạn gặp phải, các macro hàm cần bổ sung và tất cả các ý kiến đóng góp \emph{mang tính thực tế}: \ST cần giữ được nét đơn giản của nó, nó không phải là \verb-excel- hay \verb-calc- và không thể bổ sung tất cả các chức năng nâng cao của các bảng tính này.\par\nobreak\bigskip
+Christian \textsc{Tellechea}\par\nobreak\bigskip
+
+Nd: Xin vui lòng góp ý cho bản dịch qua \href{mailto:huudienkhue.le@gmail.com}{\texttt{\textbf{email}}}. Người dịch xin cảm ơn anh \textsc{Huỳnh Kỳ Anh} đã giúp đỡ trong việc hoàn thành tài liệu này !
+\end{document} \ No newline at end of file
diff --git a/Master/texmf-dist/tex/latex/spreadtab/spreadtab.sty b/Master/texmf-dist/tex/latex/spreadtab/spreadtab.sty
new file mode 100644
index 00000000000..c4d2f63e7f3
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/spreadtab/spreadtab.sty
@@ -0,0 +1,1360 @@
+% ____________________________________________________________________________
+% | |
+% | |
+% | spreadtab v0.1 |
+% | |
+% | November 3 2009 |
+% | |
+% |___________________________________________________________________________|
+%
+% This is spreadtab.sty, the code of the spreadtab package.
+%
+% Copyright Christian Tellechea 2009
+% email : unbonpetit@gmail.com
+%
+% The "spreadtab" package consists of the 8 following files:
+% spreadtab.sty (this file)
+% README
+% spreadtab_doc_fr.tex, spreadtab_doc_fr.pdf (manual in french)
+% spreadtab_doc_en.tex, spreadtab_doc_en.pdf (manual in english)
+% spreadtab_doc_vn.tex, spreadtab_doc_vn.tex (manual in vietnamese)
+%
+% -------------------------------------------------------------------
+% 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 Christian Tellechea
+% -------------------------------------------------------------------
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%% Définitions préalables %%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\newcommand\ST@ver {0.1}
+\newcommand\ST@date {2009/11/02}
+\newcommand\ST@fr@date {3 novembre 2009}
+\newcommand\ST@eng@date{November $3^\text{rd}$ 2009}
+
+\ProvidesPackage{spreadtab}[\ST@date\space v\ST@ver\space Spreadsheet features for table environments]
+\NeedsTeXFormat{LaTeX2e}
+\RequirePackage{fp}% pour les calculs scientifiques
+\RequirePackage{xstring}[2009/06/04]% version nécessaire
+
+\newcount\ST@count
+\newcount\ST@colcount
+\newcount\ST@colcount@i
+\newcount\ST@rowcount
+\newcount\ST@rowcount@i
+\newif\ifST@hiddencol
+
+% Définit le marqueur qui signale le commencement du champ numérique
+\newcommand\STnumericfieldmarker{:=}
+
+% définit le marqueur qui signale une cellule de texte
+\makeatother\newcommand\STtextcell{@}\makeatletter
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Messages d'erreur %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\newif\ifST@message
+
+\newcommand\ST@errname{[spreadtab] }
+
+\newcommand\STmessage[1]{% #1 = true ou false pour autoriser ou pas les messages
+ \csname ST@message#1\endcsname
+}
+
+\newcommand\ST@emit@message[1]{\ifST@message\message{#1}\fi}
+
+\newcommand\ST@seedoc@i{Please, read the manual.}
+
+\newcommand\ST@circular@reference{%
+ \ST@coord@toref\ST@coord
+ \let\ST@deptree\@empty
+ \ST@show@dependance@tree
+ \@latex@error{\ST@errname circular reference found in cell \ST@coord!^^J
+ Here is its dependant cells: \ST@deptree}\ST@seedoc@i\stop
+}
+
+\newcommand\ST@undefined@cell{%
+ \ST@coord@toref\ST@temp@callcell
+ \ST@coord@toref\ST@coord
+ \@latex@error{\ST@errname Undefined reference!^^J
+ Cell \ST@temp@callcell\space contains a reference to an undefined cell: \ST@coord}\ST@seedoc@i\stop
+}
+
+\newcommand\ST@zerocodecell@cell{%
+ \ST@coord@toref\ST@temp@callcell
+ \ST@coord@toref\ST@coord
+ \@latex@error{\ST@errname A reference to a non-numeric or empty cell is not allowed!^^J
+ Cell \ST@temp@callcell\space contains a reference to an empty or text cell: \ST@coord}\ST@seedoc@i\stop
+}
+
+\newcommand\ST@multicol@cell{%
+ \ST@coord@toref\ST@temp@callcell
+ \ST@coord@toref\ST@coord
+ \@latex@error{\ST@errname Cell \ST@temp@callcell\space contains a reference to a merged \string\multicolumn\space cell: \ST@coord}\ST@seedoc@i\stop
+}
+
+\newcommand\ST@illegal@relativeref{%
+ \edef\ST@temp@callcell{\ST@current@colnumber,\ST@current@rownumber}%
+ \ST@coord@toref\ST@temp@callcell
+ \@latex@error{\ST@errname Illegal relative reference found in cell \ST@temp@callcell!}\ST@seedoc@i
+}
+
+\newcommand\ST@illegal@ref{%
+ \@latex@error{\ST@errname Illegal reference in \string\STsavecell!}\ST@seedoc@i
+}
+
+\newcommand\ST@unmatch@matrixdim{%
+ \edef\ST@temp@callcell{\ST@current@colnumber,\ST@current@rownumber}%
+ \ST@coord@toref\ST@temp@callcell
+ \@latex@error{\ST@errname Somprod dimension of matrix do not match in cell \ST@temp@callcell!}\ST@seedoc@i
+}
+
+\newcommand\ST@fact@outofrange{%
+ \@latex@error{\ST@errname Argument of fact is not integer or is out of range!}\ST@seedoc@i
+}
+
+\newcommand\ST@invalid@date{%
+ \edef\ST@temp@callcell{\ST@current@colnumber,\ST@current@rownumber}%
+ \ST@coord@toref\ST@temp@callcell
+ \@latex@error{\ST@errname Invalid date in cell \ST@temp@callcell.}\ST@seedoc@i
+}
+
+\newcommand\ST@invalid@range{%
+ \edef\ST@temp@callcell{\ST@current@colnumber,\ST@current@rownumber}%
+ \ST@coord@toref\ST@temp@callcell
+ \@latex@error{\ST@errname Invalid range in cell \ST@temp@callcell.}\ST@seedoc@i\stop
+}
+
+% transforme la chaine de cellules "(1,3)(4,5)(3,2)(1,3)" rencontré en référence circulaire en "A3-D5-C2-A3"
+\newcommand\ST@show@dependance@tree{%
+ \ST@between\ST@dependance@tree()\ST@currentref
+ \ST@right\ST@dependance@tree)\ST@dependance@tree
+ \ST@coord@toref\ST@currentref
+ \ST@expadd@tomacro\ST@deptree\ST@currentref
+ \unless\ifx\@empty\ST@dependance@tree
+ \ST@add@tomacro\ST@deptree-%
+ \expandafter\ST@show@dependance@tree
+ \fi
+}
+
+% transforme la séquence de contrôle #1 qui contient par exemple «4,5» en «D5»
+\newcommand\ST@coord@toref[1]{%
+ \ST@split#1,\ST@temp@a#1%
+ \edef#1{\ifcase\ST@temp@a\or A\or B\or C\or D\or E\or F\or G\or H\or I\or J\or K\or L\or M\or
+ N\or O\or P\or Q\or R\or S\or T\or U\or V\or W\or X\or Y\or Z\fi#1}%
+}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%% Macros d'affectation et d'expansion %%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\newcommand\ST@letname[1]{\expandafter\let\csname#1\endcsname}
+
+\newcommand\ST@exp@two@args[3]{%
+ \expandafter\def\expandafter\ST@tmpstr\expandafter{\expandafter#1\expandafter{#2}}%
+ \expandafter\ST@tmpstr\expandafter{#3}%
+}
+
+\newcommand\ST@add@tomacro[2]{\expandafter\def\expandafter#1\expandafter{#1#2}}
+
+\newcommand\ST@expadd@tomacro[2]{\expandafter\ST@add@tomacro\expandafter#1\expandafter{#2}}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%% Macros de manipulation de chaines %%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\def\ST@gobble@remain#1\relax{}
+
+% enlève tous les espaces de la sc #1 et assigne le résultat à #1
+\newcommand\ST@remove@first@spaces[1]{%
+ \IfBeginWith#1\space
+ {\StrGobbleLeft#11[#1]\def\ST@nextspace{\ST@remove@first@spaces{#1}}}%
+ {\let\ST@nextspace\relax}%
+ \ST@nextspace
+}
+
+\newcommand\ST@keep@firstcar[1]{% on ne garde dans la sc #1 que le 1er caractère de la sc #1 ou on enlève les accolades
+ \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter#1\expandafter\expandafter\expandafter{\expandafter\@car#1\@nil}%
+}
+
+\newcommand\ST@firstarg@after[3]{% assigne à la sc #3 l'argument qui suit #2 dans le développement de la sc #1
+ \def\ST@firstarg@after@i##1#2##2##3\@nil{\def#3{##2}}%
+ \expandafter\ST@firstarg@after@i#1\@nil
+}
+
+\newcommand\ST@thirdarg@after[3]{% assigne à la sc #3 le 3è argument qui suit #2 dans le développement de la sc #1
+ \def\ST@thirdarg@after@i##1#2##2##3##4##5\@nil{\def#3{##4}}%
+ \expandafter\ST@thirdarg@after@i#1\@nil
+}
+
+% est ce que la sc #1 contient la sc #2 ?
+\newcommand\ST@Ifinstr[2]{\ST@exp@two@args\ST@Ifinstr@i{#1}{#2}}
+\newcommand\ST@Ifinstr@i[2]{%
+ \def\ST@Ifinstr@ii##1#2##2\@nil{%
+ \csname @\ifx\@empty##2\@empty second\else first\fi oftwo\endcsname
+ }%
+ \ST@Ifinstr@ii#1\@@nil#2\@nil
+}
+
+% Est ce que la sc #1 commence par les caractères #2 ?
+\newcommand\ST@Iffirstis[2]{%
+ \expandafter\ST@Ifinstr@i\expandafter{#1}{#2}%
+ {\def\ST@Iffirstis@i##1#2##2\@nil{%
+ \csname @\ifx\@empty##1\@empty first\else second\fi oftwo\endcsname
+ }%
+ }%
+ {\def\ST@Iffirstis@i##1\@nil{\@secondoftwo}}%
+ \expandafter\ST@Iffirstis@i#1\@@nil#2\@nil
+}
+
+% Coupe la sc #1 au caractère #2
+% ce qui est avant est assigné à #3 et ce qui est après à #4
+\newcommand\ST@split[4]{%
+ \def\ST@split@i##1#2##2\@nil{\def#3{##1}\def#4{##2}}%
+ \expandafter\ST@split@i#1\@nil
+}
+
+% Dans la sc #1, assigne ce qui est avant la sc #2 à la sc #3
+\newcommand\ST@left[3]{\ST@exp@two@args\ST@left@i{#1}{#2}#3}
+\newcommand\ST@left@i[3]{%
+ \def\ST@left@ii##1#2##2\@nil{\def#3{##1}}%
+ \ST@left@ii#1\@nil
+}
+
+% Dans la sc #1, assigne ce qui est après la sc #2 à la sc #3
+\newcommand\ST@right[3]{\ST@exp@two@args\ST@right@i{#1}{#2}#3}
+\newcommand\ST@right@i[3]{%
+ \def\ST@right@ii##1#2##2\@nil{\def#3{##2}}%
+ \ST@right@ii#1\@nil
+}
+
+% Dans la sc #1, assigne à la sc #4 ce qui est entre les caractères #2 et #3
+\newcommand\ST@between[4]{%
+ \def\ST@between@i##1#2##2#3##3\@nil{\def#4{##2}}%
+ \expandafter\ST@between@i#1\@nil
+}
+
+% Dans la sc #1, substitue le pattern #2 par le pattern #3
+\newcommand\ST@subst[3]{%
+ \def\ST@subst@i##1#2##2\@nnil{%
+ \ifx\@empty##2\@empty
+ \def#1{##1}\expandafter\remove@to@nnil
+ \else
+ \expandafter\ST@subst@i
+ \fi
+ ##1#3##2\@nnil
+ }%
+ \expandafter\ST@subst@i#1#2\@nnil
+}
+
+\newcommand\ST@expsubst[3]{%
+ \expandafter\expandafter\expandafter
+ \ST@subst\expandafter\expandafter\expandafter
+ #1\expandafter\expandafter\expandafter
+ {\expandafter#2\expandafter}\expandafter{#3}%
+}
+
+\newcommand\ST@removespaces[1]{\ST@subst#1{ }{}}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Lecture du tableau %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% lit le tableau : considère que \\ sépare les lignes
+% Si le tableau se termine par \\, la dernière ligne peut-être incomplète (\hline, par exemple)
+\newcommand\ST@read@tab{%
+ \def\ST@total@colnumber{0}%
+ \ST@rowcount\z@
+ \ST@search@hline\ST@tab% on met de côté la (ou les) ligne supérieure du tableau
+ \ST@read@tab@i
+}
+
+\newcommand\ST@read@tab@i{%
+ \advance\ST@rowcount\@ne
+ \ST@Ifinstr\ST@tab{\@empty\\}% si contient \\, il reste encore des lignes
+ {\ST@split\ST@tab\\\ST@current@row\ST@tab
+ \@namedef{endrow@\number\ST@rowcount}{\\}% est la fin de cette ligne, pour l'instant
+ \ST@Iffirstis\ST@tab[% on prend en compte l'éventuel argument optionnel de \\
+ {\ST@between\ST@tab[]\ST@temp@a% prend ce qui est entre crochet
+ \ST@Ifinstr\ST@temp@a,% si c'est une référence (on teste juste la présence de la virgule, ça devrait suffire)
+ \relax% on ne fait rien
+ {\ST@split\ST@tab]\ST@temp@a\ST@tab% sinon, coupe au crocher fermant
+ \expandafter\ST@expadd@tomacro\csname endrow@\number\ST@rowcount\endcsname{\ST@temp@a]}}% ajoute l'argument optionnel à la fin de ligne
+ }%
+ \relax
+ \ST@search@hline\ST@tab% on va purger les hlines et les mettre dans la fin de ligne
+ \ifx\ST@tab\@empty\let\ST@next@readrows\relax\edef\ST@total@rownumber{\number\ST@rowcount}\else\let\ST@next@readrows\ST@read@tab@i\fi}%
+ {\let\ST@current@row\ST@tab% plus de ligne ? on prend le tout c-à-d la ligne incomplète qui finit le tableau
+ \let\ST@next@readrows\relax
+ \edef\ST@total@rownumber{\number\ST@rowcount}}%
+ \ST@Ifinstr\ST@current@row{\@empty\SThiderow}% il est demandé de masquer la colonne ?
+ {\edef\ST@row@skiplist{\number\ST@rowcount,\ST@row@skiplist}% on ajoute le numéro de ligne à masquer à la skiplist
+ \StrDel\ST@current@row{\@empty\SThiderow}[\ST@current@row]%
+ }%
+ \relax
+ \ST@colcount\z@
+ \let\ST@multicol@number\@empty
+ \let\ST@nextcell\@empty
+ \ST@read@cells% lit les cellules de la ligne courante \ST@current@row
+ \ST@next@readrows
+}
+
+\newcommand\ST@read@cells{% divise la ligne contenue dans \ST@current@row en cellules
+ \advance\ST@colcount\@ne
+ \ST@Ifinstr\ST@current@row&%
+ {\ST@split\ST@current@row&\ST@current@cell\ST@current@row
+ \let\ST@next@readcells\ST@read@cells}%
+ {\let\ST@current@cell\ST@current@row
+ \let\ST@next@readcells\relax
+ \ifnum\ST@colcount>\ST@total@colnumber\edef\ST@total@colnumber{\number\ST@colcount}\fi}%
+ \ST@Ifinstr\ST@current@cell{\@empty\SThidecol}% on doit masquer cette colonnes ?
+ {\ST@Ifinstr{\ST@col@skiplist,}{\number\ST@colcount,}% ça a déjà été demandé ?
+ \relax% on fait rien
+ {\edef\ST@col@skiplist{\number\ST@colcount,\ST@col@skiplist}% sinon -> ajout à la skiplist
+ \ifnum\ST@colcount>\ST@last@skipcol\edef\ST@last@skipcol{\number\ST@colcount}\fi
+ }%
+ \StrDel\ST@current@cell{\@empty\SThidecol}[\ST@current@cell]%
+ }%
+ \relax
+ \exploregroups
+ \ST@Ifinstr\ST@current@cell{\@empty\multicolumn}% tester la présence d'un \multicol
+ {\ST@firstarg@after\ST@current@cell\multicolumn\ST@multicol@number}%
+ {\let\ST@multicol@number\@empty}%
+ \IfSubStr\ST@current@cell\STnumericfieldmarker% il y a un champ numérique ?
+ {\StrBehind\ST@current@cell\STnumericfieldmarker[\ST@current@formula]%
+ \noexploregroups
+ \StrChar\ST@current@formula1[\ST@temp@a]% \ST@temp@a contient {<formule}
+ \exploregroups
+ \let\ST@temp@b\STnumericfieldmarker
+ \ST@expadd@tomacro\ST@temp@b\ST@temp@a
+ \StrSubstitute[1]\ST@current@cell\ST@temp@b\STnumericfieldmarker[\ST@current@cell]% on remplace \={<formule>} par \=
+ \noexploregroups
+ \ST@keep@firstcar\ST@temp@a% dans la formule, on enlève les accolades
+ \ST@removespaces\ST@temp@a% et tous les espaces
+ \ifx\ST@temp@a\@empty% \ST@temp@a contient la formule : si la formule est vide
+ \@namedef{code@\number\ST@colcount @\number\ST@rowcount}{0}% on mettra le code à 0
+ \StrDel[1]\ST@current@cell\STnumericfieldmarker[\ST@current@cell]% on supprime aussi \=
+ \else% la formule n'est pas vide :
+ \ST@letname{formula@\number\ST@colcount @\number\ST@rowcount}\ST@temp@a% et on assigne à la formule
+ \@namedef{code@\number\ST@colcount @\number\ST@rowcount}{1}% code 1 à priori
+ \fi
+ }%
+ {\IfSubStr\ST@current@cell\STtextcell% si c'est une cellule de texte
+ {\StrDel\ST@current@cell\STtextcell[\ST@current@cell]% on le(s) supprime les flags
+ \@namedef{code@\number\ST@colcount @\number\ST@rowcount}{0}% met le code à 0
+ }% pas de \= ni de @
+ {\StrDel\ST@current@cell\space[\ST@temp@a]%
+ \ifx\@empty\ST@temp@a% il n'y a que des espaces ?
+ \@namedef{code@\number\ST@colcount @\number\ST@rowcount}{0}% met le code à 0
+ \else
+ \@namedef{code@\number\ST@colcount @\number\ST@rowcount}{1}% toute la cellule est considérée comme champ numérique
+ \ST@remove@first@spaces\ST@current@cell
+ \ST@letname{formula@\number\ST@colcount @\number\ST@rowcount}\ST@current@cell% et on assigne toute la cellule
+ \let\ST@current@cell\STnumericfieldmarker% et on met le flag pour la formule
+ \fi
+ }%
+ }%
+ \noexploregroups
+ \unless\ifnum\csname code@\number\ST@colcount @\number\ST@rowcount\endcsname=\z@% si le code est <> 0
+ \ST@try@calc@cell(\number\ST@colcount,\number\ST@rowcount)% on essaie de calculer la cellule en cours
+ \fi
+ \ST@letname{cell@\number\ST@colcount @\number\ST@rowcount}\ST@current@cell
+ \unless\ifx\@empty\ST@multicol@number% si c'est une cellule qui contient \multicolumn
+ \loop% on met tous les codes des cellules fusionées qui suivent la cellule en cours à -1
+ \ifnum\ST@multicol@number>\@ne
+ \edef\ST@multicol@number{\number\numexpr\ST@multicol@number-1}%
+ \advance\ST@colcount1
+ \@namedef{code@\number\ST@colcount @\number\ST@rowcount}{-1}% -1 = cellule multicol
+ \repeat
+ \fi
+ \ST@next@readcells
+}
+
+% On va essayer de purger dans #1 toutes les \hline, \clines, \hhline etc, et ajouter tout ce beau monde
+% et leur evéntuels arguments dans des sc spéciales (par ex \endrow@3 pour la fin de la 3e ligne.)
+\newcommand\ST@search@hline[1]{%
+ \unless\ifcsname endrow@\number\ST@rowcount\endcsname\ST@letname{endrow@\number\ST@rowcount}\@empty\fi
+ \ST@remove@first@spaces#1% on enlève les espaces au début
+ \StrChar#11[\ST@temp@a]% \ST@temp@a est le 1er car
+ \let\next\ST@search@hline
+ \IfStrEqCase\ST@temp@a{% on envisage tous les cas de tracé de ligne horizontale
+ {\@empty\hline}{\StrGobbleLeft#11[#1]\expandafter\ST@add@tomacro\csname endrow@\number\ST@rowcount\endcsname\hline}%
+ {\@empty\cline}{\StrSplit#12\ST@temp@a#1\expandafter\ST@expadd@tomacro\csname endrow@\number\ST@rowcount\endcsname\ST@temp@a}%
+ {\@empty\hhline}{\StrSplit#12\ST@temp@a#1\expandafter\ST@expadd@tomacro\csname endrow@\number\ST@rowcount\endcsname\ST@temp@a}%
+ }[\let\next\@gobble]%
+ \next#1%
+}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%% Recherche d'une référence %%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% teste si le token #1 est une lettre (majuscule ou minuscule)
+\newcommand\ST@ifcar@isletter[1]{%
+ \csname @%
+ \ifcat\relax\noexpand#1second% faux si c'est une sc
+ \else
+ \ifnum`#1<\ifnum`#1<`a`A\else`a\fi second%
+ \else
+ \ifnum`#1>\ifnum`#1<`a`Z\else`z\fi second%
+ \else first%
+ \fi
+ \fi
+ \fi
+ oftwo\endcsname
+}
+
+% cherche une référence du type lettre+nombre dans la sc #1
+% si on trouve, renvoie les coordonnées dans #2 sous la forme x@y
+% si on ne trouve pas, #2 est vide.
+\newcommand\ST@findref@informula[2]{%
+ \let\ST@temp@formula#1
+ \ST@findref@informula@i
+ \let#2\ST@temp@formula
+}
+
+\newcommand\ST@splitatfirstcar[3]{%
+ \def\ST@splitatfirstcar@i##1##2\@nil{\def#2{##1}\def#3{##2}}%
+ \expandafter\ST@splitatfirstcar@i#1\@nil
+}
+
+\newcommand\ST@findref@informula@i{%
+ \let\ST@next@search\ST@findref@informula@i
+ \ifx\@empty\ST@temp@formula
+ \let\ST@next@search\relax
+ \else
+ \StrSplit\ST@temp@formula1\ST@firstcar\ST@temp@formula% prend le 1er car de ce qui reste
+ \expandafter\ST@ifcar@isletter\expandafter{\ST@firstcar}% est-ce que le 1er car est une lettre ?
+ {\IfInteger\ST@temp@formula\relax\relax% on prend le nombre qui suit
+ \ifnum\integerpart>\z@% si ce nombre est plus grand que 0 -> référence valide
+ \edef\ST@ref@found{\ST@firstcar\number\integerpart}%
+ \edef\ST@distant@rownumber{\number\integerpart}% on chope ce nombre pour le numéro de colonne
+ \edef\ST@distant@colnumber{\expandafter\number\expandafter\numexpr\expandafter`\ST@firstcar-`a+1}% traduction lettre->chiffre
+ \ifnum\ST@distant@colnumber<\z@\edef\ST@distant@colnumber{\number\numexpr\ST@distant@colnumber+32}\fi% met les majuscules en minuscules
+ \edef\ST@temp@formula{\ST@distant@colnumber @\ST@distant@rownumber}% les coordonnées de la référence
+ \let\ST@next@search\relax
+ \fi
+ }%
+ {\if[\expandafter\noexpand\ST@firstcar% si le 1er car est [
+ \ST@left\ST@temp@formula]\ST@temp@formula% on prend ce qui est entre crochet
+ \expandafter\def\expandafter\ST@ref@found\expandafter{\expandafter[\ST@temp@formula]}%
+ \ST@left\ST@temp@formula,\ST@rel@num
+ \IfInteger\ST@rel@num
+ {\edef\ST@distant@colnumber{\number\numexpr\ST@current@colnumber+\ST@rel@num}%
+ \ST@right\ST@temp@formula,\ST@rel@num
+ \IfInteger\ST@rel@num
+ {\edef\ST@distant@rownumber{\number\numexpr\ST@current@rownumber+\ST@rel@num}%
+ \edef\ST@temp@formula{\ST@distant@colnumber @\ST@distant@rownumber}% les coordonnées de la référence
+ \let\ST@next@search\relax
+ }%
+ \ST@illegal@relativeref
+ }%
+ \ST@illegal@relativeref
+ \fi
+ }%
+ \fi
+ \ST@next@search
+}
+
+% cette commande teste si la sc #1 est syntaxiquement une référence
+\newcommand\ST@ifref[1]{%
+ \let\ST@temp@formula#1%
+ \let\ST@ref@found\@empty
+ \ST@findref@informula@i
+ \csname @%
+ \ifx\@empty\ST@ref@found
+ second%
+ \else
+ \ifx#1\ST@ref@found first\else second\fi
+ \fi
+ oftwo\endcsname
+}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%% Le noyau : évaluation de toutes les cellules %%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Essaie de calculer la cellule (#1,#2)
+\def\ST@try@calc@cell(#1,#2)%
+{%
+ \ifcsname formula@#1@#2\endcsname% on vérifie que la formule existe
+ \expandafter\ifx\csname formula@#1@#2\endcsname\@empty% et qu'elle est non vide
+ \@namedef{code@#1@#2}{0}% si vide, code à 0
+ \else
+ \def\ST@current@colnumber{#1}\def\ST@current@rownumber{#2}%
+ \expandafter\ST@find@first@func\csname formula@#1@#2\endcsname% cherche une fonction dans la formule
+ \ifx\@empty\ST@function@namefound% s'il n'y a pas de fonction
+ \expandafter\ST@findref@informula\csname formula@#1@#2\endcsname\ST@coord
+ \ifx\@empty\ST@coord% ni de référence
+ \ST@calc@cell(#1,#2)% on va la calculer la cellule
+ \fi
+ \fi
+ \fi
+ \fi
+}
+
+\def\ST@calc@cell(#1,#2)%
+{% calcule la formule numérique de la cellule (#1,#2)
+ \unless\ifnum\csname code@#1@#2\endcsname<\@ne% si le code est >= 1
+ \expandafter\let\expandafter\ST@temp@a\csname formula@#1@#2\endcsname% \ST@temp@a est le contenu de la formule
+ \ST@Iffirstis\ST@temp@a-{\expandafter\def\expandafter\ST@temp@a\expandafter{\expandafter0\ST@temp@a}}\relax
+ \FPeval\ST@temp@a\ST@temp@a% on calcule cette formule
+ \unless\ifx\ST@autouround\@empty\FPround\ST@temp@a\ST@temp@a\ST@autouround\fi% on arrondi s'il faut
+ \FPclip\ST@temp@a\ST@temp@a% puis on supprime les 0 inutiles
+ \ST@letname{formula@#1@#2}\ST@temp@a% assigne le résultat à la formule
+ \@namedef{code@#1@#2}{2}%% et met le code à 2 (cellule calculée)
+ \fi
+}
+
+% Calcule toutes les formules du tableau
+\newcommand\ST@eval@tab{%
+ \ST@rowcount\@ne\ST@colcount\@ne
+ \ST@eval@tab@i
+}
+
+\newcommand\ST@eval@tab@i{%
+ \ifnum\ST@rowcount>\ST@total@rownumber
+ \let\ST@nextcell\relax
+ \else
+ \ifcsname formula@\number\ST@colcount @\number\ST@rowcount\endcsname% si la formule existe
+ \edef\ST@temp@a{\noexpand\ST@eval@cell(\number\ST@colcount,\number\ST@rowcount)}% on la calcule
+ \ST@temp@a
+ \fi
+ \advance\ST@colcount\@ne
+ \let\ST@nextcell\ST@eval@tab@i
+ \ifnum\ST@colcount>\ST@total@colnumber
+ \ST@colcount\@ne
+ \advance\ST@rowcount\@ne
+ \fi
+ \fi
+ \ST@nextcell
+}
+
+% la sc #1 est le nom d'une fonction.
+% La macro renvoie dans la sc #2 : 1, 2 ou 2 selon que #1 est le nom d'une macro à argument numérique, à argument plage ou à argument texte.
+% #2 est vaut 0 si #1 n'est pas le nom d'une fonction
+\newcommand\ST@determine@function@code[2]{%
+ \ST@Ifinstr{\ST@functions@with@num@arg,}{#1,}%
+ {\def#2{1}}%
+ {\ST@Ifinstr{\ST@functions@with@range@arg,}{#1,}%
+ {\def#2{2}}%
+ {\ST@Ifinstr{\ST@functions@with@text@arg,}{#1,}%
+ {\def#2{3}}%
+ {\def#2{0}}%
+ }%
+ }%
+}
+
+% Évalue la cellule (#1#2) par ses coordonnées numériques (col,row)
+\def\ST@eval@cell(#1,#2)%
+{%
+ \def\ST@dependance@tree{(#1,#2)}%
+ \let\ST@stackcall\@empty
+ \let\ST@function@namesaved\@empty
+ \ST@eval@cell@i(#1,#2)% on appelle la macro récursive
+ \ifST@message
+ \let\ST@deptree\@empty
+ \ST@show@dependance@tree
+ \ST@dependance@tree
+ \message{\space\space\space\space\space cell \ST@deptree^^J}%
+ \fi
+}
+
+% Ceci est la macro principale : elle évalue la cellule (#1,#2)
+\def\ST@eval@cell@i(#1,#2)% #1 = no colonne #2 = no ligne
+{%
+ \ifnum\csname code@#1@#2\endcsname=\@ne% on ne fait quelque chose que si le code est 1 : cellule non calculée
+ \def\ST@current@colnumber{#1}\def\ST@current@rownumber{#2}%
+ \let\ST@nexteval\ST@next@onstack% à priori, on regarde à la fin s'il reste quelque chose sur la pile d'appels
+ \expandafter\ST@find@first@func\csname formula@#1@#2\endcsname% cherche une fonction dans la formule
+ \ifx\@empty\ST@function@namefound% il n'y a pas de fonction
+ \IfSubStr[2]\ST@dependance@tree{(#1,#2)}%
+ {\edef\ST@coord{#1,#2}\ST@circular@reference}% message et on s'arrête si référence circulaire
+ \relax
+ \expandafter\ST@findref@informula\csname formula@#1@#2\endcsname\ST@coord% y a t-il une référence dans l'argument ?
+ \ifx\ST@coord\@empty% pas de référence dans l'argument
+ \ifx\ST@function@namesaved\@empty% si aucune fonction n'a été décelée
+ \ST@calc@cell(#1,#2)% on calcule la cellule en cours
+ \else
+ \ST@Ifinstr{\ST@functions@with@textresult,}{\ST@function@namesaved,}% si la dernière fonction rend du texte
+ {\@namedef{code@#1@#2}{0}% on met le code à 0, la cellule devient textuelle
+ \expandafter\let\csname cell@#1@#2\expandafter\endcsname\csname formula@#1@#2\endcsname% copie de la formule vers la zone texte (avec écrasement de ce qui s'y trouvait)
+ \ST@letname{formula@#1@#2}\@empty% et plus rien dansla formule
+ }%
+ {\ST@calc@cell(#1,#2)}% c'est une fonction qui donne un arg numérique : on calcule la cellule en cours
+ \fi
+ \else
+ \ifcsname code@\ST@coord\endcsname% le code distant exite ?
+ \ifcase\csname code@\ST@coord\endcsname% code distant = 0 ==> cellule vide ou textuelle, pas bon du tout !
+ \edef\ST@temp@callcell{#1,#2}% coordonnées de la cellule appelante
+ \edef\ST@coord{\ST@distant@colnumber,\ST@distant@rownumber}% coordonnées appelées
+ \ST@zerocodecell@cell% erreur : référence à une cellule de code 0
+ \or% code distant = 1
+ \edef\ST@dependance@tree{\ST@dependance@tree(\ST@distant@colnumber,\ST@distant@rownumber)}% on l'ajoute à l'arbre des dépendances
+ % on doit évaluer cette formule distante et ensuite, on doit encore recommence avec la formule en cours : on les ajoute sur la pile lifo
+ \edef\ST@stackcall{(\ST@distant@colnumber,\ST@distant@rownumber)(#1,#2)\ST@stackcall}%
+ \or% code distant = 2, la cellule distante est calculée, on créé un alias pour le contenu de la formule distante
+ \expandafter\let\expandafter\ST@distant@formula\csname formula@\ST@coord\endcsname
+ % si la valeur distante est <0, on la met entre parenthèses
+ \ST@Iffirstis\ST@distant@formula-%
+ {\expandafter\def\expandafter\ST@distant@formula\expandafter{\expandafter(\ST@distant@formula)}}%
+ \relax
+ % on remplace toutes les références par la valeur distante
+ \expandafter\ST@expsubst\csname formula@#1@#2\endcsname\ST@ref@found\ST@distant@formula
+ \def\ST@nexteval{\ST@eval@cell@i(#1,#2)}% puis, on évalue à nouveau cette cellule
+ \else% code distant n'est pas {0,1,2} donc est -1, pas bon du tout !
+ \edef\ST@temp@callcell{#1,#2}% coordonnées de la cellule appelante
+ \ST@subst\ST@coord @,% coordonnées appelées
+ \ST@multicol@cell
+ \fi
+ \else% le code distant n'est pas défini
+ \edef\ST@temp@callcell{#1,#2}% coordonnées de la cellule appelante
+ \ST@subst\ST@coord @,% coordonnées appelées
+ \ST@undefined@cell% code distant inexistant -> cellule hors limite du tableau
+ \fi
+ \fi
+ \else% il y a une fonction dans la formule
+ \let\ST@function@namesaved\ST@function@namefound
+ \ST@determine@function@code\ST@function@namefound\ST@codefunc% détermine le code de la fonction
+ \ifcase\ST@codefunc
+ \@latex@error{\ST@errname This error should not occur! Please email the author. Thanks.}{}%
+ \or% le code vaut 1, c'est une fonction à argument numérique
+ \ST@findref@informula\ST@function@argfound\ST@temp@formula% y a t-il une référence dans l'argument de la formule ?
+ \ifx\ST@temp@formula\@empty% pas de référence dans l'argument de la fonction
+ \expandafter\let\expandafter\ST@current@formula\csname formula@#1@#2\endcsname% alias pour la formule
+ \let\ST@tobereplaced\ST@function@namefound
+ \ST@expadd@tomacro\ST@tobereplaced{\expandafter(\ST@function@argfound)}% ce qui va être replacé : fonction(argument)
+ \ST@Ifinstr{\ST@functions@no@calc@arg,}{\ST@function@namefound,}% doit-on calculer l'argument de cette fonction ?
+ \relax
+ {\FPeval\ST@function@argfound\ST@function@argfound\FPclip\ST@function@argfound\ST@function@argfound}%
+ \csname ST@func@\ST@function@namefound\endcsname\ST@function@argfound\ST@result@func% puis on évalue la fonction
+ \ST@Iffirstis\ST@result@func-{\expandafter\def\expandafter\ST@result@func\expandafter{\expandafter(\ST@result@func)}}\relax
+ \ST@expsubst\ST@current@formula\ST@tobereplaced\ST@result@func% on replace dans l'alias
+ \ST@letname{formula@#1@#2}\ST@current@formula% on l'assigne dans la formule
+ \def\ST@nexteval{\ST@eval@cell@i(#1,#2)}% puis, on évalue à nouveau cette cellule
+ \else
+ \ifnum\csname code@\ST@temp@formula\endcsname=\tw@% si la référence est calculée, on la replace par sa valeur
+ \expandafter\let\expandafter\ST@current@formula\csname formula@\ST@temp@formula\endcsname% alias pour la formule distante
+ \ST@Iffirstis\ST@current@formula-%
+ {\expandafter\def\expandafter\ST@current@formula\expandafter{\expandafter(\ST@current@formula)}}%
+ \relax
+ \let\ST@tobereplaced\ST@function@namefound\ST@expadd@tomacro\ST@tobereplaced{\expandafter(\ST@function@argfound)}%
+ \let\ST@replaced\ST@tobereplaced
+ \ST@expsubst\ST@replaced\ST@ref@found\ST@current@formula
+ \expandafter\ST@expsubst\csname formula@#1@#2\endcsname\ST@tobereplaced\ST@replaced
+ \def\ST@nexteval{\ST@eval@cell@i(#1,#2)}% puis, on évalue à nouveau cette cellule
+ \else% la référence n'est pas calculée, donc d'abord il faut
+ \edef\ST@stackcall{(\ST@distant@colnumber,\ST@distant@rownumber)(#1,#2)\ST@stackcall}% l'évaluer, et ensuite ré-evaluer la cellule courante
+ \edef\ST@dependance@tree{\ST@dependance@tree(\ST@distant@colnumber,\ST@distant@rownumber)}% mise à jour de l'arbre des dépendances
+ \fi
+ \fi
+ \or% le code vaut 2, c'est une fonction à argument «plage de cellules»
+ \expandafter\let\expandafter\ST@current@formula\csname formula@#1@#2\endcsname% alias pour la formule
+ \let\ST@tobereplaced\ST@function@namefound\ST@expadd@tomacro\ST@tobereplaced{\expandafter(\ST@function@argfound)}%
+ \csname ST@func@\ST@function@namefound\endcsname\ST@function@argfound\ST@result@func% puis on essaie d'évaluer la fonction
+ \unless\ifx\ST@result@func\@empty% si le calcul a abouti
+ \ST@Iffirstis\ST@result@func-{\expandafter\def\expandafter\ST@result@func\expandafter{\expandafter(\ST@result@func)}}\relax
+ \ST@expsubst\ST@current@formula\ST@tobereplaced\ST@result@func% on replace dans l'alias
+ \ST@letname{formula@#1@#2}\ST@current@formula% on l'assigne dans la formule
+ \def\ST@nexteval{\ST@eval@cell@i(#1,#2)}% puis, on évalue à nouveau cette cellule
+ \fi
+ \or% le code vaut 3, c'est un fonction dont l'argument est textuel
+ \let\ST@function@argfound@edefed\ST@function@argfound
+ \ST@findref@informula\ST@function@argfound\ST@temp@formula% y a t-il une référence dans l'argument de la fonction ?
+ \ifx\ST@temp@formula\@empty% pas de référence dans l'argument de la fonction
+ \expandafter\let\expandafter\ST@current@formula\csname formula@#1@#2\endcsname% alias pour la formule
+ \let\ST@tobereplaced\ST@function@namefound
+ \ST@expadd@tomacro\ST@tobereplaced{\expandafter(\ST@function@argfound)}% ce qui va être remplacé : fonction(argument)
+ \csname ST@func@\ST@function@namefound\endcsname\ST@function@argfound@edefed\ST@result@func% puis on évalue la fonction
+ \ST@expsubst\ST@current@formula\ST@tobereplaced\ST@result@func% on replace dans l'alias
+ \ST@letname{formula@#1@#2}\ST@current@formula% on l'assigne dans la formule
+ \def\ST@nexteval{\ST@eval@cell@i(#1,#2)}% puis, on évalue à nouveau cette cellule
+ \else% il y a une référence dans l'argument de la fontion
+ \ifnum\csname code@\ST@temp@formula\endcsname=\z@% si la référence est une cellule texte
+ \expandafter\let\expandafter\ST@current@formula\csname cell@\ST@temp@formula\endcsname% alias pour la zone texte distante
+ % on ne prend que le texte s'il y a un \multicolumn qui traine
+ \ST@Ifinstr\ST@current@formula{\@empty\multicolumn}%
+ {\ST@thirdarg@after\ST@current@formula\multicolumn\ST@current@formula}\relax
+ \let\ST@tobereplaced\ST@function@namefound\ST@expadd@tomacro\ST@tobereplaced{\expandafter(\ST@function@argfound)}%
+ \csname ST@func@\ST@function@namefound\endcsname\ST@current@formula\ST@result@func% puis on évalue la fonction
+ \expandafter\ST@expsubst\csname formula@#1@#2\endcsname\ST@tobereplaced\ST@result@func
+ \def\ST@nexteval{\ST@eval@cell@i(#1,#2)}% puis, on évalue à nouveau cette cellule
+ \else
+ \@latex@error{\ST@errname Macro function \ST@function@namefound\space requires a reference to a text cell!}\ST@seedoc@i
+ \fi
+ \fi
+ \fi
+ \fi
+ \expandafter\ST@nexteval
+ \fi
+}
+
+% On regarde s'il y a des appels de calcul de cellules en attente
+% Si oui, on enlève le 1er appel de la pile lifo et on l'exécute
+\newcommand\ST@next@onstack{%
+ \unless\ifx\ST@stackcall\@empty
+ \ST@split\ST@stackcall)\ST@temp@a\ST@stackcall\ST@add@tomacro\ST@temp@a)%
+ \expandafter\expandafter\expandafter\ST@eval@cell@i\expandafter\ST@temp@a
+ \fi
+}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Macro-fonctions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\newcommand\ST@for[2]{% \ST@for{#1}{code} -> exécute le code pour toutes les cellules des plages passées en argument #1
+ \def\ST@forcode{#2}%
+ \expandafter\def\expandafter\ST@for@rangelist\expandafter{#1;}%
+ \ST@for@i
+}
+
+\newcommand\ST@for@loopcode{% #2 est le code à exécuter dans la boucle for
+ \ST@forcode% on exécute le code
+ \let\ST@nextfor\ST@for@loopcode
+ \advance\ST@colcount@i\@ne
+ \ifnum\ST@colcount@i>\ST@for@col@end
+ \ST@colcount@i\ST@for@col@start
+ \advance\ST@rowcount@i\@ne
+ \ifnum\ST@rowcount@i>\ST@for@row@end
+ \ST@right\ST@for@rangelist;\ST@for@rangelist
+ \expandafter\let\expandafter\ST@nextfor\ifx\ST@for@rangelist\@empty\relax\else\ST@for@i\fi
+ \fi
+ \fi
+ \ST@nextfor
+}
+
+\newcommand\ST@for@i{%
+ \ST@left\ST@for@rangelist;\ST@for@currentrange
+ \ST@left{\ST@for@currentrange:}{\@empty:}\ST@temp@a
+ \ST@ifref\ST@temp@a\relax\ST@invalid@range
+ \let\ST@for@col@start\ST@distant@colnumber
+ \let\ST@for@row@start\ST@distant@rownumber
+ \ST@colcount@i\ST@distant@colnumber
+ \ST@rowcount@i\ST@distant@rownumber
+ \ST@Ifinstr\ST@for@currentrange{\@empty:}%
+ {\ST@right\ST@for@currentrange{\@empty:}\ST@temp@a
+ \ST@ifref\ST@temp@a\relax\ST@invalid@range
+ \let\ST@for@col@end\ST@distant@colnumber
+ \let\ST@for@row@end\ST@distant@rownumber
+ \let\ST@nextfor\ST@for@loopcode
+ \ifnum\ST@for@col@start>\ST@for@col@end\let\ST@nextfor\relax\fi
+ \ifnum\ST@for@row@start>\ST@for@row@end\let\ST@nextfor\relax\fi
+ }%
+ {\ST@forcode
+ \ST@right\ST@for@rangelist;\ST@for@rangelist
+ \expandafter\let\expandafter\ST@nextfor\ifx\ST@for@rangelist\@empty\relax\else\ST@for@i\fi
+ }%
+ \ST@nextfor
+}
+
+% liste des fonctions dont l'argument est numérique
+\newcommand\ST@functions@with@num@arg{%
+ fact,ifeq,ifgt,iflt,numtofrshortdate,numtoengshortdate,numtofrlongdate,%
+ numtoenglongdate,numtofrmonth,numtoengmonth,numtofrday,numtoengday}
+
+% liste des fonctions dont l'argument est une plage
+\newcommand\ST@functions@with@range@arg{sum,rand,randint,sumprod}
+
+% liste des fonctions dont l'argument ne doit pas être calculé
+\newcommand\ST@functions@no@calc@arg{ifeq,ifgt,iflt}
+
+% liste des fonctions dont l'argument est un texte
+\newcommand\ST@functions@with@text@arg{frshortdatetonum,engshortdatetonum,englongdatetonum,frlongdatetonum}
+
+% liste des fonctions dont le résultat est un texte
+\newcommand\ST@functions@with@textresult{numtofrshortdate,numtoengshortdate,numtofrlongdate,numtoenglongdate,numtofrmonth,numtoengmonth,numtofrday,numtoengday}
+
+% liste totale des fonctions
+\edef\ST@functions@list{\ST@functions@with@num@arg,\ST@functions@with@range@arg,\ST@functions@with@text@arg}
+
+% Cette macro cherche dans la sc #1 la première fonction qu'elle trouve ne contenant pas d'autre fonction dans son argument
+% En sortie, \ST@function@namefound contient le nom de la fonction trouvée et \ST@function@argfound son argument.
+% Si aucune fonction mot-clé n'est trouvé, ces 2 dernières séquences de contrôles sont vides.
+\newcommand\ST@find@first@func[1]{%
+ \let\ST@function@namefound\@empty\let\ST@function@argfound\@empty
+ \let\ST@function@namefound@\@empty\let\ST@function@argfound@\@empty
+ \let\ST@tempfunc#1%
+ \ST@find@first@func@i
+}
+
+\newcommand\ST@find@first@func@i{%
+ \edef\ST@tempfunctions@list{\ST@functions@list,}% réinitialise la liste
+ \let\ST@tempfunc@\ST@tempfunc% sauveagrde pour restauration ultérieure
+ \let\ST@function@namefound\@empty% initialise avant appel à la macro
+ \ST@Ifinstr\ST@tempfunc(% s'il y a une parenthèse
+ {\ST@find@first@func@ii% cherche la 1ere fonction dans l'argument
+ \ifx\ST@function@namefound\@empty% elle n'existe pas ?
+ \let\ST@function@namefound\ST@function@namefound@\let\ST@function@argfound\ST@function@argfound@% on restaure les valeurs précédentes
+ \else% si il y a une fonction dans l'argument
+ \ST@right\ST@tempfunc@\ST@function@namefound\ST@tempfunc% prend ce qui est après le nom de la fonction
+ \ST@seekfunc@arg\ST@tempfunc\ST@function@argfound% isole l'argument entre parenthèses
+ \let\ST@function@namefound@\ST@function@namefound\let\ST@function@argfound@\ST@function@argfound% met à jour les valeurs précédentes
+ \let\ST@tempfunc\ST@function@argfound% recommence avec l'argument
+ \expandafter\ST@find@first@func@i
+ \fi}%
+ {\let\ST@function@namefound\ST@function@namefound@\let\ST@function@argfound\ST@function@argfound@}%
+}
+
+\newcommand\ST@find@first@func@ii{%
+ \unless\ifx\ST@tempfunc\@empty% tant que le contenu n'est pas vide
+ \unless\ifx\ST@tempfunctions@list\@empty% et tant que tous les noms de fonctions n'ont pas été explorés
+ \ST@split\ST@tempfunctions@list,\ST@current@funcname\ST@tempfunctions@list
+ \ST@Ifinstr\ST@tempfunc{\ST@current@funcname(}% si l'argument contient le nom de fonction courant
+ {\let\ST@function@namefound\ST@current@funcname
+ \ST@left\ST@tempfunc{\ST@current@funcname(}\ST@tempfunc% on réduit l'argument à ce qui est avant ce nom
+ }%
+ \relax
+ \expandafter\expandafter\expandafter\ST@find@first@func@ii
+ \fi
+ \fi
+}
+
+% la sc #1 commence normalement (sinon, ça va gueuler) par une parenthèse
+% La macro trouve l'argument se trouvant entre les parenthèses les plus extérieures
+% et l'assigne à la sc #2
+\newcommand\ST@seekfunc@arg[2]{%
+ \edef\ST@openbrace@catcode{\number\catcode`\(}\edef\ST@closebrace@catcode{\number\catcode`\)}%
+ \catcode`\(1 \catcode`\)2
+ \everyeof{\relax}\endlinechar\m@ne
+ \afterassignment\ST@gobble@remain
+ \expandafter\def\expandafter#2\scantokens\expandafter{#1}%
+ \catcode`\(\ST@openbrace@catcode\catcode`\)\ST@closebrace@catcode
+ \def\ST@assignarg##1\relax{\def#2{##1}}%
+ \expandafter\ST@assignarg\scantokens\expandafter{#2}%
+}
+
+\newcommand\ST@func@sum[2]{% #1 est la sc contenant la plage de valeurs, #2 est la sc recevant le résultat
+ \def#2{0}% résultat nul pour l'instant
+ \let\ST@temp@stack\@empty% pile d'appel temporaire vide aussi au début
+ \ST@for{#1}% on parcourt la <plage de cellules>
+ {\ifcase\csname code@\number\ST@colcount@i @\number\ST@rowcount@i\endcsname% on ne prend en compte que les code 1 et 2
+ \or% code=1
+ \edef\ST@temp@stack{(\number\ST@colcount@i,\number\ST@rowcount@i)\ST@temp@stack}%
+ \edef\ST@dependance@tree{\ST@dependance@tree(\number\ST@colcount@i,\number\ST@rowcount@i)}% mise à jour de l'arbre des dépendances
+ \or% code=2
+ \ifx\ST@temp@stack\@empty% on ne prend la peine d'additionner que si toutes les cellules sont calculées
+ \expandafter\FPadd\expandafter#2\expandafter#2\csname formula@\number\ST@colcount@i @\number\ST@rowcount@i\endcsname
+ \fi
+ \fi
+ }%
+ \ifx\ST@temp@stack\@empty% toutes les cellules dans la plage étaient calculées ?
+ \FPclip#2#2% on ôte les 0 inutiles si le calcul a été mené au bout
+ \else
+ \let#2\@empty
+ \edef\ST@stackcall{\ST@temp@stack(\ST@current@colnumber,\ST@current@rownumber)\ST@stackcall}% on met à jour la pile d'appel
+ \fi
+}
+
+\newcommand\ST@func@sumprod[2]{% #1 est la sc contenant la plage de valeurs, #2 est la sc recevant le résultat
+ \ST@left{#1;};\ST@firstmat
+ \ST@right#1;\ST@othermat
+ \ST@left\ST@firstmat{\@empty:}\ST@temp@a
+ \ST@ifref\ST@temp@a\relax\ST@invalid@range
+ \let\ST@mat@firstcol\ST@distant@colnumber
+ \let\ST@mat@firstrow\ST@distant@rownumber
+ \StrBehind\ST@firstmat{\@empty:}[\ST@temp@a]%
+ \ST@ifref\ST@temp@a\relax\ST@invalid@range
+ \edef\ST@matcol{\number\numexpr\ST@distant@colnumber-\ST@mat@firstcol}%
+ \edef\ST@matrow{\number\numexpr\ST@distant@rownumber-\ST@mat@firstrow}%
+ \ST@count\@ne
+ \loop% regarde si toutes les matrices ont la même dimension que la 1ere et pour chacune, calcule les vecteurs de décalage par rapport à la première
+ \unless\ifx\ST@othermat\@empty
+ \ST@left{\ST@othermat;};\ST@currentmat
+ \ST@right{\ST@othermat;};\ST@othermat
+ \ST@left{\ST@currentmat:}{\@empty:}\ST@temp@a
+ \ST@ifref\ST@temp@a\relax\ST@invalid@range
+ \let\ST@currentmatcol\ST@distant@colnumber
+ \let\ST@currentmatrow\ST@distant@rownumber
+ \expandafter\edef\csname ST@vectorcol@\romannumeral\ST@count\endcsname{\number\numexpr\ST@distant@colnumber-\ST@mat@firstcol}%
+ \expandafter\edef\csname ST@vectorrow@\romannumeral\ST@count\endcsname{\number\numexpr\ST@distant@rownumber-\ST@mat@firstrow}%
+ \ST@right\ST@currentmat{\@empty:}\ST@temp@a
+ \ST@ifref\ST@temp@a\relax\ST@invalid@range
+ \edef\ST@currentmatcol{\number\numexpr\ST@distant@colnumber-\ST@currentmatcol}%
+ \edef\ST@currentmatrow{\number\numexpr\ST@distant@rownumber-\ST@currentmatrow}%
+ \unless\ifnum\ST@matcol=\ST@currentmatcol\ST@unmatch@matrixdim\fi% la dimension horizontale ne correspond pas
+ \unless\ifnum\ST@matrow=\ST@currentmatrow\ST@unmatch@matrixdim\fi% la dimension verticale ne correspond pas
+ \advance\ST@count\@ne
+ \repeat
+ \let\ST@temp@stack\@empty% pile d'appel temporaire vide au début
+ \edef\ST@numbermat{\number\ST@count}% c'est le nombre de matrices à multiplier
+ \def#2{0}% résultat nul pour l'instant
+ \ST@for{\ST@firstmat}% pour chaque cellule de la 1ere matrice
+ {\def\ST@inter@result{0}% résultat partiel nul pour l'instant
+ \ifcase\csname code@\number\ST@colcount@i @\number\ST@rowcount@i\endcsname
+ \or% code =1
+ \edef\ST@temp@stack{(\number\ST@colcount@i,\number\ST@rowcount@i)\ST@temp@stack}%
+ \edef\ST@dependance@tree{\ST@dependance@tree(\number\ST@colcount@i,\number\ST@rowcount@i)}% mise à jour de l'arbre des dépendances
+ \or% code=2
+ \expandafter\let\expandafter\ST@inter@result\csname formula@\number\ST@colcount@i @\number\ST@rowcount@i\endcsname
+ \fi
+ \ST@count\@ne
+ \loop% on multiplie tous les nombres qui se correspondent dans les matrices
+ \edef\ST@tempcoord{\number\numexpr\ST@colcount@i+\csname ST@vectorcol@\romannumeral\ST@count\endcsname @\number\numexpr\ST@rowcount@i+\csname ST@vectorrow@\romannumeral\ST@count\endcsname}%
+ \ifcase\csname code@\ST@tempcoord\endcsname
+ \def\ST@inter@result{0}% code =0 -> on met le résultat partiel à 0
+ \or% code =1
+ \ST@subst\ST@tempcoord @,%
+ \edef\ST@temp@stack{(\ST@tempcoord)\ST@temp@stack}%
+ \edef\ST@dependance@tree{\ST@dependance@tree(\ST@tempcoord)}% mise à jour de l'arbre des dépendances
+ \or% code=2
+ \expandafter\FPmul\expandafter\ST@inter@result\expandafter\ST@inter@result\csname formula@\ST@tempcoord\endcsname
+ \else
+ \def\ST@inter@result{0}% code = autre -> on met le résultat partiel à 0
+ \fi
+ \advance\ST@count\@ne
+ \ifnum\ST@count<\ST@numbermat
+ \repeat
+ \FPadd#2#2\ST@inter@result
+ }%
+ \ifx\ST@temp@stack\@empty% toutes les cellules dans la plage étaient calculées ?
+ \FPclip#2#2% on ôte les 0 inutiles si le calcul a été mené au bout
+ \else
+ \let#2\@empty
+ \edef\ST@stackcall{\ST@temp@stack(\ST@current@colnumber,\ST@current@rownumber)\ST@stackcall}% on met à jour la pile d'appel
+ \fi
+}
+
+% Calcule la factorielle du nombre #1 et met le résultat dans la sc #2
+\newcommand\ST@func@fact[2]{%
+ \FPifint{#1}%
+ \FPifgt{#1}{18}%
+ \ST@fact@outofrange
+ \else
+ \FPifpos{#1}%
+ \edef#2{%
+ \ifcase#1 1\or1\or2\or6\or24\or120\or720\or5040\or40320\or362880\or3628800\or39916800\or479001600\or
+ 6227020800\or87178291200\or1307674368000\or20922789888000\or355687428096000\or6402373705728000\fi}%
+ \else
+ \ST@fact@outofrange
+ \fi
+ \fi
+ \else
+ \ST@fact@outofrange
+ \fi
+}
+
+% détermine la graine pour fp en fonction de la date et de l'heure
+\newcommand\ST@seed{\FPseed\number\time\number\day\number\month}
+
+% la fonction randint
+\newcommand\ST@func@randint[2]{% #1=sc contenant l'argument #2: sc recevant le résultat
+ \ST@Ifinstr#1,% s'il y a 2 nombres -> intervalle [nb1;nb2]
+ {\ST@split#1,\ST@limita\ST@limitb
+ \FPifeq\ST@limita\ST@limitb\@latex@error{\ST@errname Macro function randint require two different numbers}\ST@seedoc@i\fi
+ \FPifgt\ST@limita\ST@limitb
+ \let\ST@temp@a\ST@limitb\let\ST@limitb\ST@limita\let\ST@limita\ST@temp@a
+ \fi
+ \FPifint\ST@limita\else\@latex@error{\ST@errname Macro function randint require integer argument}\ST@seedoc@i\fi
+ \FPifint\ST@limitb\else\@latex@error{\ST@errname Macro function randint require integer argument}\ST@seedoc@i\fi
+ \FPrandom#2%
+ \FPeval#2{trunc(trunc(#2*(\ST@limitb-\ST@limita+1),0)+\ST@limita,0)}%
+ }%
+ {\FPifint#1\else\@latex@error{\ST@errname Macro function randint require integer argument}\ST@seedoc@i\fi
+ \FPrandom#2% s'il n'y a qu'un nombre -> intervalle [0;nb2]
+ \FPeval#2{trunc(#2*(#1+1),0)}%
+ }%
+}
+
+\newcommand\ST@func@rand[2]{% #1=sc contenant l'argument (ignoré) #2: sc recevant le résultat
+ \FPrandom#2%
+}
+
+% les fonctions de test
+\def\ST@list@offour#1,#2,#3,#4\@nil{%
+ \def\ST@argA{#1}\def\ST@argB{#2}\def\ST@argC{#3}\def\ST@argD{#4}%
+}
+
+\newcommand\ST@def@funcif[3]{%
+ \expandafter\ST@list@offour#1\@nil
+ \FPeval\ST@argA\ST@argA\FPeval\ST@argB\ST@argB
+ \csname FPif#3\endcsname\ST@argA\ST@argB
+ \FPset#2\ST@argC
+ \else
+ \FPset#2\ST@argD
+ \fi
+}
+
+\newcommand\ST@func@ifeq[2]{\ST@def@funcif#1#2{eq}}
+\newcommand\ST@func@ifgt[2]{\ST@def@funcif#1#2{gt}}
+\newcommand\ST@func@iflt[2]{\ST@def@funcif#1#2{lt}}
+
+% Transforme une date en nombre
+\newcommand\ST@datetonum[4]{% #1=sc recevant le résultat #2=jj #3=mm #4=aa
+ \FPeval#1{#3+9-12*trunc((#3+9)/12,0)}%
+ \FPeval\ST@@@year{#4-trunc(#1/10,0)}%
+ \FPeval#1{365*\ST@@@year+trunc(\ST@@@year/4,0)-trunc(\ST@@@year/100,0)+trunc(\ST@@@year/400,0)+trunc((#1*306+5)/10,0)+#2-1}%
+ \FPclip#1#1%
+}
+
+% Transforme un nombre en une date
+\newcommand\ST@numtodate[4]{% #1=nombre représentant la date #2=jour #3=mois #4=année
+ \FPeval#4{trunc((10000*#1+14780)/3652425,0)}%
+ \FPeval#2{#1-(365*#4+trunc(#4/4,0)-trunc(#4/100,0)+trunc(#4/400,0))}%
+ \FPifneg#2%
+ \FPadd#4#4{-1}%
+ \FPeval#2{#1-(365*#4+trunc(#4/4,0)-trunc(#4/100,0)+trunc(#4/400,0))}%
+ \fi
+ \FPeval#3{trunc((100*#2+52)/3060,0)}%
+ \FPeval#4{#4+trunc((#3+2)/12,0)}\FPclip#4#4%
+ \FPeval#2{#2-trunc((#3*306+5)/10,0)+1}\FPclip#2#2%
+ \FPeval#3{#3+2-12*trunc((#3+2)/12,0)+1}\FPclip#3#3%
+}
+
+\def\ST@parse@datefr#1/#2/#3\@nil{%
+ \def\ST@@@day{#1}\def\ST@@@month{#2}\def\ST@@@year{#3}%
+}
+
+\def\ST@parse@dateeng#1/#2/#3\@nil{%
+ \def\ST@@@day{#3}\def\ST@@@month{#2}\def\ST@@@year{#1}%
+}
+
+% transforme une date française courte du type jj/mm/aaaa en nombre
+\newcommand\ST@func@frshortdatetonum[2]{% #1=sc étant l'argument jj/mm/aaaa #2=sc recevant le résultat
+ \expandafter\ST@parse@datefr#1\@nil
+ \ST@datetonum#2\ST@@@day\ST@@@month\ST@@@year
+}
+
+% Transforme un nombre en une date française de type jj/mm/aaaa
+\newcommand\ST@func@numtofrshortdate[2]{% % #1=nombre représentant la date #2=sc recevant le résultat
+ \ST@numtodate#1\ST@@@day\ST@@@month\ST@@@year
+ \edef#2{\ST@@@day/\ST@@@month/\ST@@@year}%
+}
+
+% Transforme un nombre en une date longue française du type «14 juillet 1789»
+\newcommand\ST@func@numtofrlongdate[2]{% % #1=nombre représentant la date #2=sc recevant le résultat
+ \ST@numtodate#1\ST@@@day\ST@@@month\ST@@@year
+ \edef#2{\ST@@@day\space\ifcase\ST@@@month\or janvier\or f\'evrier\or mars\or avril\or mai\or
+ juin\or juillet\or ao\^ut\or septembre\or octobre \or novembre\or d\'ecembre\fi\space\ST@@@year}%
+}
+
+% Extrait d'un nombre représentant une date le mois en toutes lettres en français
+\newcommand\ST@func@numtofrmonth[2]{% % #1=nombre représentant la date #2=sc recevant le résultat
+ \ST@numtodate#1\ST@@@day\ST@@@month\ST@@@year
+ \edef#2{\ifcase\ST@@@month\or janvier\or f\'evrier\or mars\or avril\or mai\or
+ juin\or juillet\or ao\^ut\or septembre\or octobre \or novembre\or d\'ecembre\fi}%
+}
+
+% Extrait d'un nombre repésentant une date le nom du jour en français
+\newcommand\ST@func@numtofrday[2]{% % #1=nombre représentant la date #2=sc recevant le résultat
+ \FPeval\ST@@@day{#1-7*trunc(#1/7,0)}\FPclip\ST@@@day\ST@@@day
+ \edef#2{\ifcase\ST@@@day mercredi\or jeudi\or vendredi\or samedi\or dimanche\or lundi\or mardi\fi}
+}
+
+% transforme une date anglaise courte du type aaaa/mm/jj en nombre
+\newcommand\ST@func@engshortdatetonum[2]{% #1=sc étant l'argument aaaa/mm/jj #2=sc recevant le résultat
+ \expandafter\ST@parse@dateeng#1\@nil
+ \ST@datetonum#2\ST@@@day\ST@@@month\ST@@@year
+}
+
+% Transforme un nombre en une date anglaise de type aaaa/mm/jj
+\newcommand\ST@func@numtoengshortdate[2]{% % #1=nombre représentant la date #2=sc recevant le résultat
+ \ST@numtodate#1\ST@@@day\ST@@@month\ST@@@year
+ \edef#2{\ST@@@year/\ST@@@month/\ST@@@day}
+}
+
+% Transforme un nombre en une date longue anglaise du type «July 14, 1789»
+\newcommand\ST@func@numtoenglongdate[2]{% % #1=nombre représentant la date #2=sc recevant le résultat
+ \ST@numtodate#1\ST@@@day\ST@@@month\ST@@@year
+ \edef#2{\ifcase\ST@@@month\or January\or February\or March\or April\or May\or
+ June\or July\or August\or September\or October\or November\or December\fi\space\ST@@@day,\space\ST@@@year}%
+}
+
+% Extrait d'un nombre représentant une date le mois en toutes lettres en anglais
+\newcommand\ST@func@numtoengmonth[2]{% % #1=nombre représentant la date #2=sc recevant le résultat
+ \ST@numtodate#1\ST@@@day\ST@@@month\ST@@@year
+ \edef#2{\ifcase\ST@@@month\or January\or February\or March\or April\or May\or
+ June\or July\or August\or September\or October\or November\or December\fi}%
+}
+
+% Extrait d'un nombre repésentant une date le nom du jour en anglais
+\newcommand\ST@func@numtoengday[2]{% % #1=nombre représentant la date #2=sc recevant le résultat
+ \FPeval\ST@@@day{#1-7*trunc(#1/7,0)}\FPclip\ST@@@day\ST@@@day
+ \edef#2{\ifcase\ST@@@day wednesday\or thursday\or friday\or saturday\or sunday\or monday\or tuesday\fi}
+}
+
+% Teste si la date contenue dans les 3 sc #1 (jour) #2(mois) #3(année) est valide. Sinon, envoie un message d'erreur
+\newcommand\ST@test@date@validity[3]{%
+ \IfInteger#1\relax\ST@invalid@date
+ \IfInteger#2\relax\ST@invalid@date
+ \IfInteger#3\relax\ST@invalid@date
+ \ifnum#2<\@ne\ST@invalid@date\fi
+ \ifnum#2>12 \ST@invalid@date\fi
+ \ifnum#1<\@ne\ST@invalid@date\fi
+ \ifnum#1>\ifcase#2\or31\or29\or31\or30\or31\or30\or31\or31\or30\or31\or30\or31\fi\ST@invalid@date\fi
+ \ifnum#3<\@ne\ST@invalid@date\fi% on va s'arrêter à JC quand même :-)
+}
+
+% Transforme une date anglaise longue du type «July 14, 1789» en un nombre
+\newcommand\ST@func@englongdatetonum[2]{% #1=sc contenant la date longue #2=sc recevant le résultat
+ \ST@analyse@text@engdate#1\ST@@@day\ST@@@month\ST@@@year
+ \ST@datetonum#2\ST@@@day\ST@@@month\ST@@@year
+}
+
+\newcommand\ST@analyse@text@engdate[4]{% #1=texte représentant la date #2=jour #3=n° mois #4=année
+ \if\noexpand\today\expandafter\noexpand#1%
+ \edef#2{\number\day}\edef#3{\number\month}\edef#4{\number\year}%
+ \else
+ \ST@left#1\space#3%
+ \ST@removespaces#3%
+ \expandafter\lowercase\expandafter{\expandafter\def\expandafter#3\expandafter{#3}}%
+ \IfStrEqCase#3{%
+ {january}{\def#3{1}}{february}{\def#3{2}}{march}{\def#3{3}}%
+ {april}{\def#3{4}}{may}{\def#3{5}}{june}{\def#3{6}}%
+ {july}{\def#3{7}}{august}{\def#3{8}}{september}{\def#3{9}}%
+ {october}{\def#3{10}}{november}{\def#3{11}}{december}{\def#3{12}}%
+ }[\def#3{-1}]%
+ \ST@right#1\space#2%
+ \ST@Ifinstr#2,{\ST@split#2,#2#4}{\ST@split#2{ }#2#4}%
+ \IfInteger#2\relax{\edef#2{\number\integerpart}}%
+ \ST@removespaces#4%
+ \ST@test@date@validity#2#3#4%
+ \fi
+}
+
+% Transforme une date anglaise longue du type «14 juillet 1789» en un nombre
+\newcommand\ST@func@frlongdatetonum[2]{% #1=sc contenant la date longue #2=sc recevant le résultat
+ \ST@analyse@text@frdate#1\ST@@@day\ST@@@month\ST@@@year
+ \ST@datetonum#2\ST@@@day\ST@@@month\ST@@@year
+}
+
+\def\ST@utfencoding{utf8}
+
+\newcommand\ST@analyse@text@frdate[4]{% #1=texte représentant la date #2=jour #3=n° mois #4=année
+ \if\noexpand\today\expandafter\noexpand#1%
+ \edef#2{\number\day}\edef#3{\number\month}\edef#4{\number\year}%
+ \else
+ \ST@split#1{ }#2#3%
+ \IfInteger#2\relax{\edef#2{\number\integerpart}}%
+ \ST@split#3{ }#3#4%
+ \ST@removespaces#3%
+ \def\ST@e{^^e9}\def\ST@u{^^fb}% é et û en latin1
+ \ifdefined\inputencodingname\ifx\ST@utfencoding\inputencodingname
+ \def\ST@e{^^c3^^a9}\def\ST@u{^^c3^^bb}% é et û en utf8
+ \fi\fi
+ \expandafter\ST@subst\expandafter#3\expandafter{\ST@e}e\ST@subst#3\'{}%
+ \expandafter\ST@subst\expandafter#3\expandafter{\ST@u}u\ST@subst#3\^{}%
+ \expandafter\lowercase\expandafter{\expandafter\def\expandafter\ST@temp@a\expandafter{#3}}%
+ \IfStrEqCase#3{%
+ {janvier}{\def#3{1}}{fevrier}{\def#3{2}}{mars}{\def#3{3}}%
+ {avril}{\def#3{4}}{mai}{\def#3{5}}{juin}{\def#3{6}}%
+ {juillet}{\def#3{7}}{aout}{\def#3{8}}{septembre}{\def#3{9}}%
+ {octobre}{\def#3{10}}{novembre}{\def#3{11}}{decembre}{\def#3{12}}%
+ }[\def#3{-1}]%
+ \ST@test@date@validity#2#3#4%
+ \fi
+}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%% Construction du tableau à afficher %%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\newcommand\ST@search@lastshowcol{% cherche le numéro de la dernière colonne non masquée
+ \ST@colcount\ST@total@colnumber% on commence par la fin
+ \ST@search@lastshowcol@i
+}
+
+\newcommand\ST@search@lastshowcol@i{%
+ \ST@Ifinstr{\ST@col@skiplist,}{\number\ST@colcount,}%
+ {\advance\ST@colcount\m@ne\ST@search@lastshowcol@i}%
+ {\edef\ST@lastshowcol{\number\ST@colcount}}%
+}
+
+\newcommand\ST@build@tab{%
+ \ST@rowcount\@ne\ST@colcount\@ne
+ \expandafter\ST@expadd@tomacro\expandafter\ST@tab\csname endrow@0\endcsname% la (ou les) éventuelle ligne supérieure du tableau
+ \ST@build@tab@i
+}
+
+\newcommand\ST@build@tab@i{% reconstitue le tableau à partir des valeurs calculées et des cellules
+ \ifnum\ST@rowcount>\ST@total@rownumber
+ \let\ST@nextcell\relax
+ \else
+ \let\ST@nextcell\ST@build@tab@i
+ \ST@Ifinstr\ST@row@skiplist{\number\ST@rowcount,}% la ligne fait partie de la skiplist ?
+ {\advance\ST@rowcount\@ne}% on passe à la ligne suivante
+ {%
+ \ifcsname code@\number\ST@colcount @\number\ST@rowcount\endcsname% le code existe ? (tenir compte d'une ligne complètement vide du genre ////)
+ \ST@Ifinstr\ST@col@skiplist{\number\ST@colcount,}% la colonne fait partie de la skiplist ?
+ \ST@hiddencoltrue
+ {%
+ \ST@hiddencolfalse
+ \ifcsname cell@\number\ST@colcount @\number\ST@rowcount\endcsname% si la cellule existe
+ \expandafter\let\expandafter\ST@temp@a\csname formula@\number\ST@colcount @\number\ST@rowcount\endcsname% la valeur
+ \expandafter\let\expandafter\ST@temp@b\csname cell@\number\ST@colcount @\number\ST@rowcount\endcsname% on créé un alias
+ \exploregroups
+ \StrSubstitute[1]\ST@temp@b\STnumericfieldmarker\ST@temp@a[\ST@temp@a]% on remplace le flag de formule par la valeur calculée
+ \noexploregroups
+ \ST@expadd@tomacro\ST@tab\ST@temp@a% on ajoute la cellule au tableau
+ \fi
+ }%
+ \advance\ST@colcount\@ne% on passe à la colonne suivante !
+ \ifcsname code@\number\ST@colcount @\number\ST@rowcount\endcsname% y a t-il encore un code défini ensuite ?
+ \ifnum\csname code@\number\ST@colcount @\number\ST@rowcount\endcsname<\z@% on est dans une cellule contenant \multicol ?
+ \expandafter\ST@firstarg@after\csname cell@\number\numexpr\ST@colcount-1@\number\ST@rowcount\endcsname\multicolumn\ST@multicol@number% combien de cellules ?
+ \advance\ST@colcount\ST@multicol@number% on va voir après le multicol en sautant toutes les valeurs des colonnes intermédiaires
+ \advance\ST@colcount\m@ne
+ \ifcsname code@\number\ST@colcount @\number\ST@rowcount\endcsname% y a t-il un code défini après le multicol ?
+ \ST@add@tomacro\ST@tab&% on ajoute la tabulation
+ \fi
+ \else% pas de \multicolumn
+ \unless\ifST@hiddencol% si la cellule n'est pas masquée
+ \unless\ifnum\ST@colcount>\ST@lastshowcol% si ce n'est pas la dernière cellule affichée
+ \ST@add@tomacro\ST@tab&%on ajoute la tabulation
+ \fi
+ \fi
+ \fi
+ \else% il n'y a plus de code ensuite donc c'était la dernière colonne
+ \ifcsname endrow@\number\ST@rowcount\endcsname
+ \expandafter\ST@expadd@tomacro\expandafter\ST@tab\csname endrow@\number\ST@rowcount\endcsname% ajoute la fin de la ligne
+ \fi
+ \ST@colcount\@ne% on remet la colonne à 1
+ \advance\ST@rowcount\@ne% on passe à la ligne suivante
+ \fi
+ \else
+ \ifcsname endrow@\number\ST@rowcount\endcsname
+ \expandafter\ST@expadd@tomacro\expandafter\ST@tab\csname endrow@\number\ST@rowcount\endcsname% ajoute la fin de la ligne
+ \fi
+ \ST@colcount\@ne% on remet la colonne à 1
+ \advance\ST@rowcount\@ne% on passe à la ligne suivante
+ \fi
+ }%
+ \fi
+ \ST@nextcell
+}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%% Environnement spreadtab et macros publiques %%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\STmessage{true}% affiche les messages par défaut
+
+\newcommand\STautoround[1]{\def\ST@autouround{#1}}
+\STautoround{}% pas d'arrondi par défaut
+
+\newcommand\STsavecell[2]{% met dans la sc #1 la valeur du champ numérique de la cellule spécifiée par sa référence ABSOLUE
+ \def\ST@temp@ref{#2}%
+ \ST@ifref\ST@temp@ref\relax\ST@illegal@ref
+ \ST@Ifinstr\ST@temp@ref[\ST@illegal@ref\relax
+ \expandafter\global\expandafter\let\expandafter#1\csname formula@\ST@temp@formula\endcsname
+}
+
+\long\def\ST@get@body#1\end{%
+ \expandafter\def\expandafter\ST@tab\expandafter{\ST@tab#1}\ST@find@end
+}
+
+\newcommand\ST@find@end[1]{%
+ \def\@tempa{#1}%
+ \ifx\@tempa\ST@name@env
+ \def\@tempa{\end{#1}}%
+ \expandafter\@tempa
+ \else
+ \@addtomacro\ST@tab{\end{#1}}%
+ \expandafter\ST@get@body
+ \fi
+}
+
+\newenvironment{spreadtab}[2][]{%
+ \ifST@message\FPmessagesfalse\fi% pas de message de calcul de FP
+ \expandarg% 1-développement des arguments (réglages de xstring)
+ \noexploregroups% pas d'exploration des groupes (réglages de xstring)
+ \@makeother\:\@makeother\;\@makeother\,% changer les catcodes pour éviter les incompatibilités avec frenchb
+ \edef\ST@name@env{\@currenvir}%
+ \def\ST@tab@preamble{#2}%% préambule du tableau
+ \StrChar{\@empty#2}1[\ST@tab@name]%
+ \def\ST@optcode{#1}%
+ \let\ST@row@skiplist\@empty\let\ST@col@skiplist\@empty\def\ST@last@skipcol{0}%
+ \edef\ST@previous@seed{\number\FPseed}% sauvegarde de la graine
+ \ST@seed% graine variable
+ \ST@emit@message{\ST@errname New spreadtab {\detokenize{#2}}^^J* reading tab:}%
+ \let\ST@tab\@empty
+ \ST@get@body% met le corps de l'environnement dans \ST@tab
+ }%
+ {%
+ \ST@read@tab% analyse le tableau contenu dans \ST@tab
+ \ST@emit@message{ok^^J}%
+ \ST@search@lastshowcol% cherche la dernière colonne affichée
+ \ST@emit@message{* computing formulas:^^J}%
+ \ST@eval@tab
+ \ST@optcode% exécute l'argument optionnel
+ \expandafter\def\expandafter\ST@tab\expandafter{\expandafter\begin\ST@tab@preamble}%
+ \ST@emit@message{* building tab:}%
+ \ST@build@tab
+ \ST@emit@message{ok^^J}%
+ \ST@expadd@tomacro\ST@tab{\expandafter\end\ST@tab@name}
+ \ST@tab% affiche le tableau
+ \ST@emit@message{\ST@errname End of spreadtab^^J^^J}%
+ \global\FPseed\ST@previous@seed% restauration de la graine
+}
+
+\endinput
+
+###############################################################################
+# Historique #
+###############################################################################
+v0.1alpha avril 2009
+-------------------------------------------------------------------------------
+v0.1beta1 2009/06/06
+-------------------------------------------------------------------------------
+v0.1beta2 2009/06/07
+ 1 Une valeur négative dans une cellule provoque un bug.
+ Les valeurs négatives sont désormais mises entre parenthèses
+ 2 Espaces supprimés en début de formules.
+-------------------------------------------------------------------------------
+v0.1beta3 2009/06/12
+ 1 Espaces laissés dans les formules pour pouvoir utiliser la notation
+ postfixée de fp.
+ 2 Les références ne sont plus «@(B4)» mais indifféremment «b4» ou «B4».
+ 3 Références relatives possibles par [x,y] ou x et y sont les décalages
+ de la colonne et de la ligne par rapport à la cellule où est
+ la formule.
+ 4 Bugs corrigés pour rendre le package compatible avec tabularx ou
+ tabulary (entre autres).
+-------------------------------------------------------------------------------
+v0.1beta4 2009/06/21
+ 1 Les espaces sont supprimés au début de chaque cellule, cela créait un
+ bug lorsque la cellule commençait par un nombre négatif.
+ 2 Mise en place de la compatibilité avec la commande
+ \multicolumn{nbre}{type}{contenu} du package éponyme
+ 3 Possibilité de masquer des lignes ou des colonnes entières avec les
+ commandes \SThiderow et \SThidecol
+ Seule condition : aucune colonne masquée ne doit se trouver dans les
+ colonnes impliquées dans un \multicolum à moins de prendre de grandes
+ précautions et savoir les conséquences que cela occasionne.
+-------------------------------------------------------------------------------
+v0.1beta5 2009/06/29
+ 1 Amélioration des messages d'erreur et d'information
+ 2 Suppression de tests superflus
+ 3 Redéfinition de \STtextcell en «@» qui est plus simple
+ 4 Implémentation de \STsavecell
+ 5 Écriture de la documentation provisoire en français
+-------------------------------------------------------------------------------
+v0.1beta6 2009/08/23
+ 1 Correction d'un bug : dans une cellule, on ne pouvait pas écrire
+ plusieurs fois la même référence.
+ 2 Correction d'un bug avec \multicolumn : cette commande était mal gérée
+ lorsqu'employée avec une cellule de texte.
+ 3 Implémentation de macro-fonctions avec différenciation selon le type
+ d'argument et le type de donnée renvoyée.
+ 4 Possibilité d'imbrication des macro-fonctions.
+ 5 Mise en place d'un environnement « spreadtab »
+ 6 Nombreuses optimisations pour une meilleure vitesse d'exécution
+-------------------------------------------------------------------------------
+v0.1pre 2009/09/02
+ 1 Mise au point des messages d'erreurs et des arrêts de compilation selon
+ les erreurs rencontrées.
+ 2 Correction d'un bug dans \ST@coord@toref
+ 3 Les cellules vides, textuelles ou jointes par un \multicolumn sont
+ ignorées dans les plages de cellules concernées par les fonctions sum
+ et sumprod
+ 4 Les noms de mois accentués et \today sont désormais permis en argument
+ de la fonction frlongdatetonum
+ 5 somprod corrigé en sumprod, plus anglais !
+ 6 La macro fonction rnd, trop complexe est supprimée au profit de rand et
+ randint
+ 7 Améliorations et optimisations
+-------------------------------------------------------------------------------
+v0.1 2009/11/03 Première version publique sur le CTAN
+------------------------------------------------------------------------------- \ No newline at end of file
diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check
index 615cadf69fd..50a9112c9e7 100755
--- a/Master/tlpkg/bin/tlpkg-ctan-check
+++ b/Master/tlpkg/bin/tlpkg-ctan-check
@@ -232,7 +232,7 @@ my @WorkingTLP = qw(
skak skaknew slantsc slideshow smalltableof smartref
snapshot songbook sort-by-letters soul
spanish spanish-mx sparklines spie
- splines splitbib splitindex spotcolor sprite spverbatim
+ splines splitbib splitindex spotcolor spreadtab sprite spverbatim
srcltx sseq
ssqquote stack stage statex2 staves stdclsdv stdpage steinmetz
stellenbosch stex stringstrings struktex
diff --git a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
index fe99957dee1..f34c6d86375 100644
--- a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
+++ b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc
@@ -506,6 +506,7 @@ depend smartref
depend snapshot
depend soul
depend sparklines
+depend spreadtab
depend spverbatim
depend splitindex
depend spotcolor
diff --git a/Master/tlpkg/tlpsrc/spreadtab.tlpsrc b/Master/tlpkg/tlpsrc/spreadtab.tlpsrc
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/Master/tlpkg/tlpsrc/spreadtab.tlpsrc