summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/spreadtab
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-01-27 01:41:58 +0000
committerKarl Berry <karl@freefriends.org>2010-01-27 01:41:58 +0000
commit6558da0729e1c500bec9acbfaa748066b84b02f4 (patch)
treeda92a0250d1bb4f55c86c44e0bb9c00a35825cc8 /Master/texmf-dist/doc/latex/spreadtab
parent369434476fa43e7b8819204ac80d6e6275b8a78b (diff)
spreadtab 0.2 (25jan10)
git-svn-id: svn://tug.org/texlive/trunk@16829 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/spreadtab')
-rw-r--r--Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_en.pdfbin670143 -> 749468 bytes
-rw-r--r--Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_en.tex326
-rw-r--r--Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_fr.pdfbin700145 -> 782814 bytes
-rw-r--r--Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_fr.tex370
-rw-r--r--Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_vn.pdfbin711085 -> 0 bytes
-rw-r--r--Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_vn.tex1013
6 files changed, 630 insertions, 1079 deletions
diff --git a/Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_en.pdf b/Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_en.pdf
index 089f6ab0fe3..68e6187241c 100644
--- a/Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_en.pdf
+++ 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
index 1419c90311d..b8b47f59285 100644
--- a/Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_en.tex
+++ b/Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_en.tex
@@ -1,9 +1,9 @@
-% ____________________________________________________________________________
+ % ____________________________________________________________________________
% | |
% | |
-% | spreadtab v0.1 |
+% | spreadtab v0.2 |
% | |
-% | November 3 2009 |
+% | January 24, 2010 |
% | |
% |___________________________________________________________________________|
%
@@ -30,8 +30,10 @@
\usepackage{lmodern}
\usepackage[a4paper,margin=2.5cm]{geometry}
\usepackage{amsmath,amssymb}
+\usepackage{textcomp}
\usepackage{array}
-\usepackage{colortbl}
+\usepackage[table]{xcolor}
+\usepackage{arydshln}
\usepackage{tabularx}
\usepackage{xcolor}
\usepackage{listings}
@@ -39,15 +41,18 @@
\usepackage{xspace}
\usepackage[bottom]{footmisc}
\usepackage{spreadtab}
+\usepackage[protrusion=true,final,verbose=true,babel=true]{microtype}
\usepackage{fancyhdr}
\fancyhead[L]{}
\fancyhead[C]{\small\bfseries\ST}
- \fancyhead[R]{\scriptsize\slshape\leftmark}
- \fancyfoot[l]{\tiny\LaTeX'd by Christian \textsc{Tellechea}, \today.}
+ \fancyhead[R]{\scriptsize\slshape \leftmark}
+ \fancyfoot[l]{\tiny \LaTeX ed by Christian \textsc{Tellechea}, le \today.}
\fancyfoot[c]{}
\fancyfoot[r]{\thepage}
-\usepackage[english]{babel}
+\usepackage[frenchb]{babel}
+\frenchbsetup{StandardLists=true}
+\usepackage{enumitem}
\makeatletter
\definecolor{ST@bckgcolor}{rgb}{0.87,0.9,1}
\definecolor{ST@codebckgcolor}{rgb}{0.9,0.9,0.9}
@@ -64,19 +69,67 @@
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,%
+ spreadtab,SThiderow,SThidecol,STsavecell,STautoround,STmessage,STsetdecimalsep,STtransposecar,STdebug,STdisplaytab,%
+ STnumericfieldmarker,STtextcell,STcopy,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}
+
+
+%%%%%%%%%%% environnement OOcalc
+\newcount\cntlin
+\newcount\cntcol
+
+\newtoks\t@b
+\long\def\ifremain@lines#1\\#2\@nil{%
+ \csname @\ifx\@empty#2\@empty second\else first\fi oftwo\endcsname}
+\long\def\subst@eol#1\\#2\@nil{\addtot@b{#1\\\cline{1-1}\hdashline}%
+ \ifremain@lines#2\\\@nil{\addtot@b&\subst@eol#2\@nil}{\addtot@b{#2\end{tabular}}}}
+\long\def\collect@body#1\end{\subst@eol#1\@nil\end}
+
+\newcommand\addtot@b[1]{\t@b\expandafter{\the\t@b#1}}
+\newcommand\edftot@b[1]{\edef\temp@{#1}\expandafter\addtot@b\expandafter{\temp@}}
+
+\newenvironment{OOocalc}[2][1.5cm]{% #1=largeur colonnes #2 = nombre de colonnes
+ \newcolumntype w{>{\centering\arraybackslash}m{#1}}%
+ \arrayrulewidth0.4pt\dashlinedash0.4pt\relax\dashlinegap3pt
+ \global\cntlin\m@ne\global\cntcol\z@
+ \tabfont
+ \tabcolsep0pt
+ \t@b{\begin{tabular}{%
+ |>{\cellcolor{tabheadcolor}%
+ \global\cntcol\z@\global\advance\cntlin\@ne
+ \centering\arraybackslash
+ \ifnum\cntlin>\z@\tableheadformat\number\cntlin\fi}
+ m{2em}|*{#2}{w:}}%
+ \hline
+ \rowcolor{tabheadcolor}}%
+ \loop
+ \ifnum\cntcol<#2
+ \advance\cntcol\@ne
+ \addtot@b{&\multicolumn{1}{>\centering m{#1}|}}%
+ \edftot@b{{\noexpand\tableheadformat\@Alph\cntcol}}%
+ \repeat
+ \addtot@b{\\\hline&}%
+ \collect@body}{\the\t@b}
\makeatother
-\newcommand\verbinline{\lstinline[breaklines=false,basicstyle=\normalsize\ttfamily]}
+% commandes de personnalisation de OOcalc
+\newcommand*\tabfont{\fontfamily{phv}\selectfont\footnotesize}% police du tableau (helvetica ici)
+\newcommand*\tableheadformat{\bfseries}% police des en-têtes du tableau (en gras)
+\colorlet{tabheadcolor}{gray!40}% couleur de font des en-têtes du tableau
+\colorlet{palepink}{pink!80}
+\colorlet{lightpink}{pink!30}
+\colorlet{palegreen}{green!60}
+\colorlet{lightgreen}{green!30}
+\newcommand\CC[1]{\cellcolor{#1}}
+
+\newcommand\verbinline[1][]{\lstinline[breaklines=false,basicstyle=\normalsize\ttfamily,#1]}
\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}
+\usepackage[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}
@@ -111,7 +164,7 @@
\end{titlepage}
\tableofcontents\newpage
-\parskip\medskipamount
+\parskip\medskipamount This manual is a translation of the french manual. I apologize for my poor english but I did my best\footnote{Any help to improve this translation is welcome!}, and I hope that the following is comprehensible!
\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.
@@ -140,14 +193,12 @@ after the work of \ST, we get a display as if we had written:
\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.
+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 two main 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.
+The road was long before reaching this 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.
@@ -158,8 +209,12 @@ A table cell is identified by the pair \falseverb{<colref><rowref>}\footnote{No
\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}.
-
+Here are examples of absolutes references: \falseverb{b4} or \falseverb{C1} or \falseverb{d13}. Locations of cells appear clearly in the spreadsheet-like table below:
+\begin{center}
+\begin{OOocalc}[6em]{5}
+&&&&\\&&&&\\&&&&\\&&&&\\&&&&\\
+\end{OOocalc}
+\end{center}
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}
@@ -288,17 +343,128 @@ value 1 : :={50} & value 2 : :={29} & average : \textbf{:={(a1+b1)/2}}\\\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{@}`.
+If '\verb-:=-` is written in a cell with an empty argument like this '\verb-:={}-`, then the cell is understood as a text cell. In fact, '\verb-:={}-` behaves like '\verb-@-', but they are \emph{not} equivalent: '\verb-:={}-` allows the cell to receive a formula from an other with \verbinline-\STcopy- (see next chapter) while it is impossible with '\verb-@-'.
+
+\subsection{Copy a formula}
+To avoid having to copy formulas into adjacent cells, the \ST package provides the \verbinline-\STcopy- command.
+
+This command must be written in a cell with this syntax:
+\begin{center}
+\verbinline-\STcopy{>-$x$\verbinline-,v-$y$\verbinline-}{formula}-
+\end{center}
+where $x$ and $y$ are positive numbers that represent horizontal and vertical offsets relative to the cell where the command is. With the cell containing the command (the source cell), these offsets define a range of cells which will receive the \verb-<formule> -\footnote{The copy can not be done to cells located on the right and below the cell is located in the macro.}. The command \verbinline-\STcopy- must \emph{not} be in a cell where there is a numeric field marker "\verb-:=-".
+
+Here is how the copy is made: it starts from the cell where the command \verbinline-\STcopy- is. For the other cells, all the coordinates in the formula are modified taking into account the offsets from the source cell. For example, if the source cell contains the formula \verb-a1+b2+c3-, and the taget cell is located 2 columns rightwards and 5 rows below then, this formula becomes: \verb-c6+d7+e8-. The formula can also contain relative references but, since they are relative, they are not modified.
+
+Preceded by "\verb-!-", a coordinate in a formula is not modified when the formula is copied. For example, if the source cell contains \verb-a!1+!b2+!c!3- and the target cell is located 2 columns rightwards and 5 rows below then, this formula becomes: \verb-c1+b7+c3-. The feature is compatible with relative coordinates. Let's suppose a cell contains this formula: \verb|[-1,!-1]+[!-1,1]+[!1,!2]|. As usualy, let's say that this formula is copied to the cell located 2 columns rightwards and 5 rows below: this formula becomes: \verb|[-1,-6]+[-3,1]+[-1,-3]|.
+
+The "\verb-!-" char is the expansion of the control sequence \verbinline-\STtransposecar-. It may be changed to any other with \verbinline-\renewcommand\STtransposecar-\verb-{<char>}-. The "\verb-!-" char, used by default, keeps its 13 catcode and remains active if the \verb-babel- package is loaded with the \verb-frenchb- option.
+
+In "\verbinline-\STcopy{>-$x$\verbinline-,v-$y$\verbinline-}{formula}-", if $x$ is omitted, the copie is made to the cells rightwards, up to the right edge of the table. With $y$, it is the same: if this number is omitted, the copy is done to the cells below until the bottom of the table is reached. If $x$ or $y$ are equal to 0, the copy is limited to the column or row of the source cell. Instead of writing \verb-v0- ou \verb->0-, it is possible to write \verb-v- ou \verb->-.
+
+Here are some examples:
+\begin{tabular}{cl}\hline
+\verb-{>3,v1}- & copy to 3 columns rightwards and 1 row below\\
+\verb-{>3}- & copy to 3 cells on the right\\
+\verb-{v1}- & copy to the cell below\\
+\verb-{>}- & copy rightwards up to the right edge\\
+\verb-{v}- & copy below\\
+\verb-{v,>}- & copy to the right and below until the end of the table\\\hline
+\end{tabular}
+
+It is easy to generate the multiplication table from 1 to 10:
+
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{|c|*{10}{c}|}}
+\hline
+@$\times$ & 1 & \STcopy{>}{b1+1} & & & & & & & & \\\hline
+1 & \STcopy{>,v}{!a2*b!1} & & & & & & & & & \\
+\STcopy{v}{a2+1} & & & & & & & & & & \\
+ & & & & & & & & & & \\
+ & & & & & & & & & & \\
+ & & & & & & & & & & \\
+ & & & & & & & & & & \\
+ & & & & & & & & & & \\
+ & & & & & & & & & & \\
+ & & & & & & & & & & \\
+ & & & & & & & & & & \\\hline
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{|c|*{10}{c}|}}
+\hline
+@$\times$ & 1 & \STcopy{>}{b1+1} & & & & & & & & \\\hline
+1 & \STcopy{>,v}{!a2*b!1} & & & & & & & & & \\
+\STcopy{v}{a2+1} & & & & & & & & & & \\
+ & & & & & & & & & & \\
+ & & & & & & & & & & \\
+ & & & & & & & & & & \\
+ & & & & & & & & & & \\
+ & & & & & & & & & & \\
+ & & & & & & & & & & \\
+ & & & & & & & & & & \\
+ & & & & & & & & & & \\\hline
+\end{spreadtab}
+\end{center}
+
+If the numeric field of a target cell is not empty, it is not replaced and the copy is not done for this cell.
+
+If 2 or more \verbinline-\STcopy- command in several source cells have the same taget cell, then, the formula this latter receive is the one contained in the last \verbinline-\STcopy- command when the table is read from top left to botton right. In the spreadsheet-like example below, the \verbinline-\STcopy- in the pink cell \falseverb{B1} has its target range partially covered by the one of the green cell \falseverb{C3}.
+\begin{center}
+\begin{OOocalc}[2.3cm]{6}
+1 &\CC{palepink}\ttfamily\textbackslash STcopy \{v,>\}\{!a1+1\} &\CC{lightpink} &\CC{lightpink} &\CC{lightpink} &\CC{lightpink} \\
+2 &\CC{lightpink} &\CC{lightpink} &\CC{lightpink} &\CC{lightpink} &\CC{lightpink} ~\par~ \\
+3 &\CC{lightpink} &\CC{palegreen}\ttfamily\textbackslash STcopy \{>2,v1\}\{!a3*10\}&\CC{lightgreen} &\CC{lightgreen} &\CC{lightpink} \\
+4 &\CC{lightpink} &\CC{lightgreen} &\CC{lightgreen} &\CC{lightgreen} &\CC{lightpink}~\par~ \\
+5 &\CC{lightpink} &\CC{lightpink} &\CC{lightpink} &\CC{lightpink} &\CC{lightpink}~\par~ \\
+\end{OOocalc}
+\end{center}
+Here is this example, treated by \ST below. In this table, the cell \verb-b5- (numeric field alone) and the cell \verb-c5- (text field + numeric field) stay un changed since their numeric field are not empty:
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{|*6{c|}}}\hline
+1 &\STcopy{v,>}{!a1+1} & & & & \\\hline
+2 & & & & & \\\hline
+3 & & \STcopy{>2,v1}{!a3*10} & & & \\\hline
+4 & & & & & \\\hline
+5 & -1 & a:={0}b & & & \\\hline
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{|*6{c|}}}\hline
+1 &\STcopy{v,>}{!a1+1} & & & & \\\hline
+2 & & & & & \\\hline
+3 & & \STcopy{>2,v1}{!a3*10} & & & \\\hline
+4 & & & & & \\\hline
+5 & -1 & a:={0}b & & & \\\hline
+\end{spreadtab}
+\end{center}
+As mentioned in the last chapter, you can also copy a formula in a text cell containing an empty numeric field (that is to say a cell containing ``\verb-:={}-''). In this case, the formula is copied inside the brackets. On the other side, a cell containing text ``\verb-@-'' can not receive a formula when copying is not done and the cell remains purely textual.
+
+Example :
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{|*6{c|}}}\hline
+1 & 2 & 3 & 4 & 5 & 6 \\\hline
+X\STcopy{>}{a1+1}Y & @XY & X:={}Y & \textbf{:={}} & & \\\hline
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{|*6{c|}}}\hline
+1 & 2 & 3 & 4 & 5 & 6 \\\hline
+X\STcopy{>}{a1+1}Y & @XY & X:={}Y & \textbf{:={}} & & \\\hline
+\end{spreadtab}
+\end{center}
\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>]-.
+\ST recognizes the usual line breaks and horizontal rules \verb|\\| and \verb|\hline|. It is also possible to specify 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).
+ \item any command of the \href{http://www.ctan.org/tex-archive/macros/latex/contrib/booktabs/}{\texttt{\textbf{booktabs}}} package: \verb-\toprule-, \verb-\midrule-, \verb-\bottomrule-, \verb-\cmidrule-, \verb-\addlinespace-, \verb-\morecmidrule- and \verb-\specialrule-. All the arguments of these macros, optional or mandatory are taken into account;
+ \item \verbinline-\noalign- and its mandatory argument can be written after \verb-\\-.
\end{itemize}
Example:
\begin{lstlisting}
@@ -465,6 +631,66 @@ In this example, floating point numbers are rounded to 6 digits:\par\nobreak
\end{spreadtab}
\end{center}
+\subsection{Decimal seprarator}
+The \verb-fp- return its results with the decimal point separator. After the job of \verb-fp-, \ST can change this decimal separator: everything happens as if the results returned by \verb-fp- were taking this into account. The command \verbinline-\STsetdecimalsep- take a mandatory argument which is the char used as decimal separator:
+\begin{center}
+\verbinline-\STsetdecimalsep-\verb-{<char}-
+\end{center}
+For exemple, french users should write this in the preamble of the document:
+\begin{center}
+\verbinline-\STsetdecimalsep{,}-
+\end{center}
+For numeric field located in math mode, the comma is considered as a math punctuation, which explains why it is followed by a space. To pevent this behaviour, it can be written inside brackets:
+
+\begin{minipage}{0.65\linewidth}
+\begin{lstlisting}[backgroundcolor=\color{ST@codebckgcolor}]
+3,14 is not displayed like $3,14$.\par
+3,14 is displayed like $3{,}14$
+\end{lstlisting}
+\end{minipage}\hfill
+\begin{minipage}{0.35\linewidth}
+3,14 is not displayed like $3,14$.\par
+3,14 is displayed like $3{,}14$
+\end{minipage}%
+
+When cells are in math mode, you can\footnote{It is preferable to use the \texttt{numprint} package to format the results. You can also change the math code of the comma: \texttt{\textbackslash mathcode`,="013B\textbackslash relax}. This trick puts the comma in the class 0 of the ordinary signs while its naturally class is 6 (punctuation signs).} use this feature and ask \ST to replace the decimal point by a comma inside braces with the command \verbinline-\STsetdecimalsep{{,}}-. In these tables where each cell is in math mode, the space after the commas are neutralized in the second table:
+
+\begin{minipage}{0.65\linewidth}
+\begin{lstlisting}
+\STsetdecimalsep{,}
+\begin{spreadtab}{{tabular}{|*3{>{$}r<{$}}|}}\hline
+@x & @y & @\text{Average}\\\hline
+5 & -4 & (a2+b2)/2\\
+-6.1 & -8 & (a3+b3)/2\\
+9.85 & 3.7 & (a4+b4)/2\\\hline
+\end{spreadtab}\par\smallskip
+\STsetdecimalsep{{,}}
+\begin{spreadtab}{{tabular}{|*3{>{$}r<{$}}|}}\hline
+@x & @y & @\text{Average}\\\hline
+5 & -4 & (a2+b2)/2\\
+-6.1 & -8 & (a3+b3)/2\\
+9.85 & 3.7 & (a4+b4)/2\\\hline
+\end{spreadtab}
+\end{lstlisting}
+\end{minipage}%
+\begin{minipage}{0.35\linewidth}
+\centering
+\STsetdecimalsep{,}
+\begin{spreadtab}{{tabular}{|*3{>{$}r<{$}}|}}\hline
+@x & @y & @\text{Average}\\\hline
+5 & -4 & (a2+b2)/2\\
+-6.1 & -8 & (a3+b3)/2\\
+9.85 & 3.7 & (a4+b4)/2\\\hline
+\end{spreadtab}\par\smallskip
+\STsetdecimalsep{{,}}
+\begin{spreadtab}{{tabular}{|*3{>{$}r<{$}}|}}\hline
+@x & @y & @\text{Average}\\\hline
+5 & -4 & (a2+b2)/2\\
+-6.1 & -8 & (a3+b3)/2\\
+9.85 & 3.7 & (a4+b4)/2\\\hline
+\end{spreadtab}
+\end{minipage}
+
\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.
@@ -846,10 +1072,65 @@ For the second step, cells are evaluated from top to bottom, left to right: at l
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.
+\subsection{Debug mode}
+To ease the use of \ST, a debug mode is available. It is activated when the command \verbinline-\STdebug- is written in the optional argument of the \verbinline-spreadtab- environment. This command changes the behavior of \ST which, instead of displaying the final table, displays one (or more) table(s) containing debugging informations. This display is done just after \ST has read all the cells, and no calculating formula has yet taken place. There are as many tables as commands \verbinline-\STdebug-, provided that their argument is different. Only 3 arguments are possible:
+\begin{itemize}
+ \item \verbinline-\STdebug{formula}-: displays all the numeric fields and the ends of lines;
+ \item \verbinline-\STdebug{text}-: displays all the textual fields;
+ \item \verbinline-\STdebug{code}-: displays the internal code of the cells. Indeed, \ST assigns a code to every cell when it reads the table. Here are the possible values of this code:
+ \begin{enumerate}[label=\small\textbullet]
+ \item $-1$ if the cell is merged with \verbinline-\multicolumn-;
+ \item 0 if the cell is a text cell or is empty;
+ \item 1 if the numeric field of the cell contains a formula which will be computed later;
+ \item 2 if the numeric field of the cell contains a number.
+ \end{enumerate}
+\end{itemize}
+
+When the ``debug mode'' is activated, the final table is not displayed.
+
+Here is a table which will be used for the next example:
+
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{|r|r|r|}}\hline
+@$x$ &@$y$ & @$x+y$\\\hline\hline
+22 & 54 & \STcopy{v3}{a2+b2} \\
+43 & 65 & \\
+49 & 37 & \\\hline
+$Sx=:={a2+a3+a4}$ & $Sy=:={b2+b3+b4}$ & $Sx+Sy=:={}$\\\hline
+\multicolumn2{|r|}{$Sy-Sx=:={b5-a5}$} & @\multicolumn1c{}\\\cline{1-2}
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{|r|r|r|}}\hline
+@$x$ &@$y$ & @$x+y$\\\hline\hline
+22 & 54 & \STcopy{v3}{a2+b2} \\
+43 & 65 & \\
+49 & 37 & \\\hline
+$Sx=:={a2+a3+a4}$ & $Sy=:={b2+b3+b4}$ & $Sx+Sy=:={}$\\\hline
+\multicolumn2{|r|}{$Sy-Sx=:={b5-a5}$} & @\multicolumn1c{}\\\cline{1-2}
+\end{spreadtab}
+\end{center}
+Let's ask \ST to shows the 3 possible debugging tables for table above. To do this, just change the line 1 in the code above to:
+
+\hfill\verbinline[basicstyle=\ttfamily\small]-\begin{spreadtab}[\STdebug{text}\STdebug{formula}\STdebug{code}]{{tabular}{|rr|r|}}\hline-\hfill\kern0pt
+\begin{center}
+\begin{spreadtab}[\STdebug{text}\STdebug{formula}\STdebug{code}]{{tabular}{|rr|r|}}\hline
+@$x$ &@$y$ & @$x+y$\\\hline\hline
+22 & 54 & \STcopy{v3}{a2+b2} \\
+43 & 65 & \\
+49 & 37 & \\\hline
+$Sx=:={a2+a3+a4}$ & $Sy=:={b2+b3+b4}$ & $Sx+Sy=:={}$\\\hline
+\multicolumn2{|r|}{$Sy-Sx=:={b5-a5}$} & @\multicolumn1c{}\\\cline{1-2}
+\end{spreadtab}
+\end{center}
+These 3 debugging tables may help to better understand what happens behind the scene when \ST works. We can observe that all cells with a numeric field (see table 2) have an internal code of 1 or 2 (see table 3) and an associated numeric field marker ``\verb-:=-'' in table 1. This marker represents the location where will be inserted (by substitution) the result of the numeric field. So from the contents of text fields in table 1 and once calculated the numeric fields, by a simple substitution, the cells are reconstituted to give those of the final table.
+
+In the debugging tables, cells containing the coordinates are grayed if the package \href{http://www.ctan.org/tex-archive/macros/latex/contrib/colortbl/}{\texttt{\textbf{colortbl}}} has been loaded, they are left white otherwise.
+
\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!
+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! For readability, the command \verbinline-\STcopy- is not used.
\subsection{The Pascal's triangle again!}
\begin{lstlisting}
@@ -1047,7 +1328,8 @@ Each number is the sum of two numbers located below it.
&\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
+\end{center}
+\medskip
\parskip0pt
\begin{center}
$\star$\par
diff --git a/Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_fr.pdf b/Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_fr.pdf
index 33fc2891570..1336e2fc699 100644
--- a/Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_fr.pdf
+++ 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
index 1067308e3f1..0ca5f170afc 100644
--- a/Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_fr.tex
+++ b/Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_fr.tex
@@ -1,16 +1,16 @@
-% ____________________________________________________________________________
+% ____________________________________________________________________________
% | |
% | |
-% | spreadtab v0.1 |
+% | spreadtab v0.2 |
% | |
-% | November 3 2009 |
+% | 24 janvier 2010 |
% | |
% |___________________________________________________________________________|
%
% Ce fichier est spreadtab_doc_fr.tex, le code source de la documentation en
% français du package spreadtab.
%
-% Copyright Christian Tellechea 2009
+% Copyright Christian Tellechea 2009-2010
% email : unbonpetit@gmail.com
%
% -------------------------------------------------------------------
@@ -30,8 +30,10 @@
\usepackage{lmodern}
\usepackage[a4paper,margin=2.5cm]{geometry}
\usepackage{amsmath,amssymb}
+\usepackage{textcomp}
\usepackage{array}
-\usepackage{colortbl}
+\usepackage[table]{xcolor}
+\usepackage{arydshln}
\usepackage{tabularx}
\usepackage{xcolor}
\usepackage{listings}
@@ -39,6 +41,7 @@
\usepackage{xspace}
\usepackage[bottom]{footmisc}
\usepackage{spreadtab}
+\usepackage[protrusion=true,final,verbose=true,babel=true]{microtype}
\usepackage{fancyhdr}
\fancyhead[L]{}
\fancyhead[C]{\small\bfseries\ST}
@@ -47,7 +50,9 @@
\fancyfoot[c]{}
\fancyfoot[r]{\thepage}
\usepackage[frenchb]{babel}
+\frenchbsetup{StandardLists=true}
+\usepackage{enumitem}
\makeatletter
\definecolor{ST@bckgcolor}{rgb}{0.87,0.9,1}
\definecolor{ST@codebckgcolor}{rgb}{0.9,0.9,0.9}
@@ -64,22 +69,70 @@
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,%
+ spreadtab,SThiderow,SThidecol,STsavecell,STautoround,STmessage,STsetdecimalsep,STtransposecar,STdebug,STdisplaytab,%
+ STnumericfieldmarker,STtextcell,STcopy,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}
+
+
+%%%%%%%%%%% environnement OOcalc
+\newcount\cntlin
+\newcount\cntcol
+
+\newtoks\t@b
+\long\def\ifremain@lines#1\\#2\@nil{%
+ \csname @\ifx\@empty#2\@empty second\else first\fi oftwo\endcsname}
+\long\def\subst@eol#1\\#2\@nil{\addtot@b{#1\\\cline{1-1}\hdashline}%
+ \ifremain@lines#2\\\@nil{\addtot@b&\subst@eol#2\@nil}{\addtot@b{#2\end{tabular}}}}
+\long\def\collect@body#1\end{\subst@eol#1\@nil\end}
+
+\newcommand\addtot@b[1]{\t@b\expandafter{\the\t@b#1}}
+\newcommand\edftot@b[1]{\edef\temp@{#1}\expandafter\addtot@b\expandafter{\temp@}}
+
+\newenvironment{OOocalc}[2][1.5cm]{% #1=largeur colonnes #2 = nombre de colonnes
+ \newcolumntype w{>{\centering\arraybackslash}m{#1}}%
+ \arrayrulewidth0.4pt\dashlinedash0.4pt\relax\dashlinegap3pt
+ \global\cntlin\m@ne\global\cntcol\z@
+ \tabfont
+ \tabcolsep0pt
+ \t@b{\begin{tabular}{%
+ |>{\cellcolor{tabheadcolor}%
+ \global\cntcol\z@\global\advance\cntlin\@ne
+ \centering\arraybackslash
+ \ifnum\cntlin>\z@\tableheadformat\number\cntlin\fi}
+ m{2em}|*{#2}{w:}}%
+ \hline
+ \rowcolor{tabheadcolor}}%
+ \loop
+ \ifnum\cntcol<#2
+ \advance\cntcol\@ne
+ \addtot@b{&\multicolumn{1}{>\centering m{#1}|}}%
+ \edftot@b{{\noexpand\tableheadformat\@Alph\cntcol}}%
+ \repeat
+ \addtot@b{\\\hline&}%
+ \collect@body}{\the\t@b}
\makeatother
-\newcommand\verbinline{\lstinline[breaklines=false,basicstyle=\normalsize\ttfamily]}
+% commandes de personnalisation de OOcalc
+\newcommand*\tabfont{\fontfamily{phv}\selectfont\footnotesize}% police du tableau (helvetica ici)
+\newcommand*\tableheadformat{\bfseries}% police des en-têtes du tableau (en gras)
+\colorlet{tabheadcolor}{gray!40}% couleur de font des en-têtes du tableau
+\colorlet{palepink}{pink!80}
+\colorlet{lightpink}{pink!30}
+\colorlet{palegreen}{green!60}
+\colorlet{lightgreen}{green!30}
+\newcommand\CC[1]{\cellcolor{#1}}
+
+\newcommand\verbinline[1][]{\lstinline[breaklines=false,basicstyle=\normalsize\ttfamily,#1]}
\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}
+\usepackage[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}
+\parindent0pt\pagestyle{fancy}\setitemize{leftmargin=3em,topsep=0pt,parsep=0pt,itemsep=0pt,label=--}\STsetdecimalsep{,}
\begin{titlepage}
\null\par\vfill
\begin{center}
@@ -116,16 +169,16 @@
\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]}.
+Ce package nécessite le moteur $\varepsilon$-\TeX, le format \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 version \verb-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
+Par conséquent, \ST procède en 3 étapes :
\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
+\end{itemize}
La syntaxe est la suivante :\par\nobreak
\begin{lstlisting}[backgroundcolor=\color{ST@codebckgcolor}]
\begin{spreadtab}{{<nom de l'environnement>}<parametres de l'environnement>}
@@ -145,21 +198,23 @@ Il faut ajouter que \ST \emph{ne peut remplacer un tableur}. En effet, ses possi
\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.
+La route a été longue avant d'arriver à cette 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
+Dans le tableau, les cellules sont repérées par leur références absolues de cette façon :
\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.}.
-
+\end{itemize}
+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.}. Visuellement, on peut illustrer ce fonctionnement par ce genre de tableau ressemblant à un tableur, ici volontairement limité à 5 lignes et 5 colonnes :
+\begin{center}
+\begin{OOocalc}[6em]{5}
+&&&&\\&&&&\\&&&&\\&&&&\\&&&&\\
+\end{OOocalc}
+\end{center}
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}
@@ -241,7 +296,7 @@ On remarque que les références relatives sont plus adaptées ici puisque seule
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.
+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 \protect\pageref{datetonum}.} de faire référence nulle part ailleurs dans le tableau.
Voici un exemple :\par\nobreak
\begin{lstlisting}
@@ -263,7 +318,7 @@ Le caractère \og\falseverb @\fg{} est le développement de la séquence de cont
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
+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 :
\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.
@@ -272,7 +327,7 @@ En réalité, chaque cellule est composée de \emph{deux} champs. D'un côté le
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
+\end{itemize}
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}-.
@@ -288,18 +343,129 @@ valeur 1 : :={50} & valeur 2 : :={29} & moyenne : \textbf{:={(a1+b1)/2}}\\\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.
+À noter également que \og\verb-:={}-\fg{}, qui définit formule vide, a le même effet que \og\verb-@-\fg dans une cellule : celle-ci est comprise comme cellule de texte. Cependant, \og\verb-@-\fg et \og\verb-:={}-\fg{} \emph{ne sont pas équivalents} car une cellule textuelle contenant ce dernier peut recevoir une formule par copie (voir section suivante), ce qui est impossible avec \og\verb-@-\fg.
+
+\subsection{Copier des formules}
+Pour éviter d'avoir à recopier des formules identiques dans des cellules voisines, \ST fournit l'instruction \verbinline-\STcopy-.
+
+Cette commande se place dans une cellule selon cette syntaxe :
+\begin{center}
+\verbinline-\STcopy{>-$x$\verbinline-,v-$y$\verbinline-}{formule}-
+\end{center}
+où $x$ et $y$ sont des nombres positifs qui représentent des décalages horizontaux et verticaux par rapport à la cellule où se trouve l'instruction. La cellule qui contient la commande et la cellule obtenue par ces décalages définissent une plage rectangulaire de cellules qui recevront la \verb-<formule>-\footnote{La copie ne peut donc se faire que vers des cellules se trouvant à droite et plus bas que la cellule dans laquelle se trouve la commande.}. La commande \verbinline-\STcopy -\emph{ne doit pas} se trouver dans une cellule où un marqueur de champ numérique \og\verb-:=-\fg{} est présent.
+
+Voici comment se déroule la copie : elle se fait en partant de la cellule où se trouve l'instruction, la cellule source. Pour chaque cellule cible, toutes les références dans la formule sont incrémentées pour tenir compte du décalage entre la cellule cible et la cellule source. Ainsi par exemple, mettons que la cellule source contienne la formule \verb-a1+b2+c3-. Lorsque cette formule est copiée dans une cellule cible se trouvant 2 colonnes à droite et 5 lignes en dessous, cette formule deviendra : \verb-c6+d7+e8-. La formule peut également contenir des références relatives qui, puisqu'elle sont relatives, ne seront pas modifiées.
+
+En faisant précéder d'un \og\verb-!-\fg une coordonnée d'une référence, cette coordonnée reste inchangée lors de la copie. Reprenons l'exemple précédent avec la formule \verb-a!1+!b2+!c!3-. Si cette formule est copiée dans la cellule se trouvant 2 colonnes à droite et 5 lignes en dessous, alors, elle deviendra : \verb-c1+b7+c3-. Cette fonctionnalité est compatible avec des références relatives : mettons qu'une cellule contienne la formule \verb|[-1,!-1]+[!-1,1]+[!1,!2]| et que cette formule soit copiée vers la cellule se trouvant 2 colonnes à droite et 5 lignes en dessous. Alors, elle deviendra : \verb|[-1,-6]+[-3,1]+[-1,-3]|.
+
+Le caractère \og\verb-!-\fg est le développement de la séquence de contrôle \verbinline-\STtransposecar-. On peut donc modifier ce caractère en tout autre avec \verbinline-\renewcommand\STtransposecar-\verb-{<caractère>}-. Le point d'exclamation, utilisé par défaut, garde son code de catégorie actif qui lui a été attribué par le package \verb-babel- chargé avec l'option \verb-frenchb-.
+
+Dans la syntaxe \verbinline-\STcopy{>-$x$\verbinline-,v-$y$\verbinline-}{formule}-, si le nombre $x$ est absent, la copie dans le sens horizontal se fait vers la droite jusqu'au bord droit du tableau. Si $y$ est absent, la copie dans le sens vertical se fait jusqu'en bas du tableau.
+
+Voici quelques exemples :
+\begin{tabular}{cl}\hline
+\verb-{>3,v1}- & copie vers les 3 colonnes à droite et 1 ligne en dessous\\
+\verb-{>3}- & copie vers les 3 cellules de droite\\
+\verb-{v1}- & copie vers la cellule de dessous\\
+\verb-{>}- & copie vers toutes les cellules situées à droite\\
+\verb-{v}- & copie vers toutes les cellules situées en dessous\\
+\verb-{v,>}- & copie vers le bas et vers la droite à partir de la cellule courante\\\hline
+\end{tabular}
+
+On peut facilement générer la table de multiplication de 1 à 10 :
+
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{|c|*{10}{c}|}}
+\hline
+@$\times$ & 1 & \STcopy{>}{b1+1} & & & & & & & & \\\hline
+1 & \STcopy{>,v}{!a2*b!1} & & & & & & & & & \\
+\STcopy{v}{a2+1} & & & & & & & & & & \\
+ & & & & & & & & & & \\
+ & & & & & & & & & & \\
+ & & & & & & & & & & \\
+ & & & & & & & & & & \\
+ & & & & & & & & & & \\
+ & & & & & & & & & & \\
+ & & & & & & & & & & \\
+ & & & & & & & & & & \\\hline
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{|c|*{10}{c}|}}
+\hline
+@$\times$ & 1 & \STcopy{>}{b1+1} & & & & & & & & \\\hline
+1 & \STcopy{>,v}{!a2*b!1} & & & & & & & & & \\
+\STcopy{v}{a2+1} & & & & & & & & & & \\
+ & & & & & & & & & & \\
+ & & & & & & & & & & \\
+ & & & & & & & & & & \\
+ & & & & & & & & & & \\
+ & & & & & & & & & & \\
+ & & & & & & & & & & \\
+ & & & & & & & & & & \\
+ & & & & & & & & & & \\\hline
+\end{spreadtab}
+\end{center}
+
+Lors d'une copie de formule, si la cellule cible contient déjà un champ numérique non vide, celui-ci n'est pas écrasé et la copie ne se fait pas.
+
+Si des commandes \verbinline-\STcopy- se trouvant danns des plusieurs cellules départ ont une même cellule cible, la formule que cette dernière reçoit est celle correspondant à la dernière commande \verbinline-\STcopy- rencontrée lorsque le tableau est lu de haut en bas et de droite à gauche. Dans l'exemple visuel ci-dessous, le \verbinline-\STcopy- se trouvant dans la cellule rose \falseverb{B1} a son champ cible partiellement recouvert par celui du \verbinline-\STcopy- se trouvant dans la cellule verte \falseverb{C3}. En effet, cette dernière est rencontrée plus tard lors de la lecture du tableau :
+\begin{center}
+\begin{OOocalc}[2.3cm]{6}
+1 &\CC{palepink}\ttfamily\textbackslash STcopy \{v,>\}\{!a1+1\} &\CC{lightpink} &\CC{lightpink} &\CC{lightpink} &\CC{lightpink} \\
+2 &\CC{lightpink} &\CC{lightpink} &\CC{lightpink} &\CC{lightpink} &\CC{lightpink} ~\par~ \\
+3 &\CC{lightpink} &\CC{palegreen}\ttfamily\textbackslash STcopy \{>2,v1\}\{!a3*10\}&\CC{lightgreen} &\CC{lightgreen} &\CC{lightpink} \\
+4 &\CC{lightpink} &\CC{lightgreen} &\CC{lightgreen} &\CC{lightgreen} &\CC{lightpink}~\par~ \\
+5 &\CC{lightpink} &\CC{lightpink} &\CC{lightpink} &\CC{lightpink} &\CC{lightpink}~\par~ \\
+\end{OOocalc}
+\end{center}
+Voici cet exemple repris ci-dessous pour mettre en évidence ces comportements. Dans cet exemple, la celule \verb-b5- qui est composée d'un champ numérique et la cellule \verb-c5- qui est mixte, leur champ numérique n'étant pas vide, il est conservé.
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{|*6{c|}}}\hline
+1 &\STcopy{v,>}{!a1+1} & & & & \\\hline
+2 & & & & & \\\hline
+3 & & \STcopy{>2,v1}{!a3*10} & & & \\\hline
+4 & & & & & \\\hline
+5 & -1 & a:={0}b & & & \\\hline
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{|*6{c|}}}\hline
+1 &\STcopy{v,>}{!a1+1} & & & & \\\hline
+2 & & & & & \\\hline
+3 & & \STcopy{>2,v1}{!a3*10} & & & \\\hline
+4 & & & & & \\\hline
+5 & -1 & a:={0}b & & & \\\hline
+\end{spreadtab}
+\end{center}
+Comme on l'a dit à la fin du chpitre précédent, on peut également copier une formule dans une cellule de texte contenant un champ numérique vide (c'est-à-dire une cellule contenant \og\verb-:={}-\fg). Dans ce cas, la formule est copiée à l'endroit où se trouve \og\verb-:={}-\fg. Par contre, dans une cellule de texte contenant \og\verb-@-\fg, la copie ne se fait pas et la cellule reste purement textuelle.
+
+Exemple :
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{|*6{c|}}}\hline
+1 & 2 & 3 & 4 & 5 & 6 \\\hline
+X\STcopy{>}{a1+1}Y & @XY & X:={}Y & \textbf{:={}} & & \\\hline
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{|*6{c|}}}\hline
+1 & 2 & 3 & 4 & 5 & 6 \\\hline
+X\STcopy{>}{a1+1}Y & @XY & X:={}Y & \textbf{:={}} & & \\\hline
+\end{spreadtab}
+\end{center}
\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
+Pour les filets horizontaux, on peut utiliser autant de fois que l'on veut:
\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
+ \item n'importe quelle commande du package \href{http://www.ctan.org/tex-archive/macros/latex/contrib/booktabs/}{\texttt{\textbf{booktabs}}} : \verb-\toprule-, \verb-\midrule-, \verb-\bottomrule-, \verb-\cmidrule-, \verb-\addlinespace-, \verb-\morecmidrule- et \verb-\specialrule-. Tous les arguments de ces macros, optionnels ou pas sont gérés;
+ \item \verbinline-\noalign- et son argument peuvent être placés après \verb-\\- et pris en compte.
+\end{itemize}
Voici le triangle de Pascal inversé, et massacré pour l'exemple :\par\nobreak
\begin{lstlisting}
\begin{spreadtab}{{tabular}{*5c}}
@@ -441,12 +607,12 @@ On remarque que le marqueur de champ numérique \og\falseverb{:=}\fg{} est néce
\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
+Pour se prémunir de ce problème, plusieurs solutions existent :
\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
+\end{itemize}
Voici un exemple simple des nombres de 1 à 7 et leurs inverses, arrondis à $10^{-6}$ :\par\nobreak
\begin{lstlisting}
\STautoround{6}
@@ -465,6 +631,66 @@ Voici un exemple simple des nombres de 1 à 7 et leurs inverses, arrondis à $10
\end{spreadtab}
\end{center}
+\subsection{Séparateur décimal}
+Le package \verb-fp- renvoie ses résultats décimaux avec le point comme séparateur décimal. Il est possible de changer ce séparateur décimal de telle sorte que tout se passe comme si les résultats retournés par \verb-fp- en tenaient compte. L'instruction \verbinline-\STsetdecimalsep- permet de changer le séparateur décimal en n'importe quel caractère en utilisant la syntaxe :
+\begin{center}
+\verbinline-\STsetdecimalsep-\verb-{<caractère>}-
+\end{center}
+Pour une utilisation en langue française, il faut donc inclure dans le préambule cette ligne :
+\begin{center}
+\verbinline-\STsetdecimalsep{,}-
+\end{center}
+Pour les champs numériques se trouvant en mode math, il faut noter que la virgule n'est pas neutre dans ce mode. En effet, elle est considérée comme une ponctuation ce qui explique qu'elle est suivie d'un espace. Pour neutraliser cet espace, on peut mettre cette virgule entre accolades comme on le voit dans ce code :
+
+\begin{minipage}{0.65\linewidth}
+\begin{lstlisting}[escapechar=Z,backgroundcolor=\color{ST@codebckgcolor}]
+3,14 n'est pas affichZéZ comme $3,14$.\par
+3,14 est affichZéZ comme $3{,}14$
+\end{lstlisting}
+\end{minipage}\hfill
+\begin{minipage}{0.35\linewidth}
+3,14 n'est pas affiché comme $3,14$.\par
+3,14 est affiché comme $3{,}14$
+\end{minipage}%
+
+Lorsque des cellules sont en mode math, on peut\footnote{Il est cependant préférable d'utiliser le package \texttt{numprint} pour formatter les résultats. On peut aussi modifier le code mathématique de la virgule : \texttt{\textbackslash mathcode`,="013B\textbackslash relax}. Cette modification, réservée aux utilisateurs avertis, fait entrer la virgule dans la classe 0 des signes ordinaires alors qu'elle est naturellement dans la classe 6 des signes de ponctuation.} s'inspirer de cette propriété et demander à \ST de remplacer le point décimal par une virgule entre accolades avec la commande \verbinline-\STsetdecimalsep{{,}}-. Dans ces deux tableaux où chaque cellule est en mode math, on constate que l'espacement après la virgule est neutralisé pour le second :
+
+\begin{minipage}{0.65\linewidth}
+\begin{lstlisting}
+\STsetdecimalsep{,}
+\begin{spreadtab}{{tabular}{|*3{>{$}r<{$}}|}}\hline
+@x & @y & @\text{Moyenne}\\\hline
+5 & -4 & (a2+b2)/2\\
+-6.1 & -8 & (a3+b3)/2\\
+9.85 & 3.7 & (a4+b4)/2\\\hline
+\end{spreadtab}\par\smallskip
+\STsetdecimalsep{{,}}
+\begin{spreadtab}{{tabular}{|*3{>{$}r<{$}}|}}\hline
+@x & @y & @\text{Moyenne}\\\hline
+5 & -4 & (a2+b2)/2\\
+-6.1 & -8 & (a3+b3)/2\\
+9.85 & 3.7 & (a4+b4)/2\\\hline
+\end{spreadtab}
+\end{lstlisting}
+\end{minipage}%
+\begin{minipage}{0.35\linewidth}
+\centering
+\STsetdecimalsep{,}
+\begin{spreadtab}{{tabular}{|*3{>$r<$}|}}\hline
+@x & @y & @\text{Moyenne}\\\hline
+5 & -4 & (a2+b2)/2\\
+-6.1 & -8 & (a3+b3)/2\\
+9.85 & 3.7 & (a4+b4)/2\\\hline
+\end{spreadtab}\par\smallskip
+\STsetdecimalsep{{,}}
+\begin{spreadtab}{{tabular}{|*3{>$r<$}|}}\hline
+@x & @y & @\text{Moyenne}\\\hline
+5 & -4 & (a2+b2)/2\\
+-6.1 & -8 & (a3+b3)/2\\
+9.85 & 3.7 & (a4+b4)/2\\\hline
+\end{spreadtab}
+\end{minipage}
+
\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.
@@ -472,12 +698,12 @@ L'extension \falseverb{fp} fournit un nombre conséquent d'opérations et de fon
\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
+Elle s'utilise ainsi : \verbinline=sum(<plage 1>;<plage 2>;...;<plage n>)=, où une plage de cellules est :
\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
+\end{itemize}
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
@@ -579,16 +805,16 @@ La macro fonction \verbinline-rand()- renvoie un nombre aléatoire décimal comp
\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=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
+La comparaison se fait entre \falseverb{nombre1} et \falseverb{nombre2} :
\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
+\end{itemize}
Si le test est vrai, \falseverb{nombre3} est retourné, sinon c'est \falseverb{nombre4}.
À titre d'exemple, voici quelques valeurs de la fonction
@@ -659,13 +885,13 @@ frlongdatetonum(\today) & frlongdatetonum(25 décembre 2009)\\
\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
+Voici ces fonctions :
\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
+\end{itemize}
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
@@ -724,7 +950,7 @@ La raison est simple, c'est que le \verb-\dline- de la ligne 4, n'est \emph{pas}
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
+Pour pouvoir compiler ce code sans erreur, la cellule \falseverb{a2} \emph{doit} contenir un marqueur de champ numérique :\par\nobreak
\begin{lstlisting}
\newcommand\dline{\hline\hline}
\begin{spreadtab}{{tabular}{*7c}}
@@ -760,11 +986,11 @@ Il y a 4 cellules \emph{visibles} fusionnées, on écrira donc \verbinline-\mult
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
+La règle est la suivante :
\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
+\end{itemize}
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|}}}
@@ -801,14 +1027,14 @@ a2+1& b2+1 & & & & & & & h2+1 & i2+1\\\hline
\end{center}
\subsection{Messages émis par \ST}
-Le package émet des messages d'erreur et arrête la compilation dans ces cas :\parindent2em\smallskip
+Le package émet des messages d'erreur et arrête la compilation dans ces cas :
\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
+\end{itemize}
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}-.
@@ -846,10 +1072,65 @@ Pour la seconde étape, les cellules sont évaluées de haut en bas, de gauche
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.
+\subsection{Débogage}
+Pour faciliter l'utilisation de \ST, un mode de débogage est disponible. Il est activé lorsque la commande \verbinline-\STdebug- est présente dans l'argument optionnel de l'environnement \verb-spreadtab-. Cette commande change le comportement de \ST qui, au lieu d'afficher le tableau final, affiche un (ou plusieurs) tableau de débogage. Cet affichage se fait juste après que \ST ait lu l'ensemble de toutes les cellules ; aucun calcul de formule n'a encore eu lieu. Il y a autant de tableaux affichés que de commande \verbinline-\STdebug- présentes, sous réserve que leur argument soit différent. Seuls 3 arguments sont possibles, et voici ce qu'il permettent :
+\begin{itemize}
+ \item \verbinline-\STdebug{formula}- : affichage des champs numériques de toutes les cellules et les fins de ligne;
+ \item \verbinline-\STdebug{text}- : affichage des champs textuels de toutes les cellules;
+ \item \verbinline-\STdebug{code}- : affichage du code interne que \ST affecte à chaque cellule. Ce code interne est assigné à chaque cellule lors de la lecture du tableau. Il vaut :
+ \begin{enumerate}[label=\small\textbullet]
+ \item $-1$ s'il s'agit d'une cellule fusionnée par une commande \verbinline-\multicolumn-;
+ \item 0 si la cellule est vide ou purement textuelle;
+ \item 1 si le champ numérique de la cellule contient une formule qui sera à évaluer plus tard;
+ \item 2 si la champ numérique de la cellule contient un nombre.
+ \end{enumerate}
+\end{itemize}
+
+Lorsque le mode débogage est activé, le tableau final \emph{n'est pas affiché}. Il est cependant possible de forcer cet affichage en mettant la commande \verbinline-\STdisplaytab- dans l'argument optionnel.
+
+Voici un tableau sur lequel s'appuiera l'exemple suivant :
+
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{|r|r|r|}}\hline
+@$x$ &@$y$ & @$x+y$\\\hline\hline
+22 & 54 & \STcopy{v3}{a2+b2} \\
+43 & 65 & \\
+49 & 37 & \\\hline
+$Sx=:={a2+a3+a4}$ & $Sy=:={b2+b3+b4}$ & $Sx+Sy=:={}$\\\hline
+\multicolumn2{|r|}{$Sy-Sx=:={b5-a5}$} & @\multicolumn1c{}\\\cline{1-2}
+\end{spreadtab}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{|r|r|r|}}\hline
+@$x$ &@$y$ & @$x+y$\\\hline\hline
+22 & 54 & \STcopy{v3}{a2+b2} \\
+43 & 65 & \\
+49 & 37 & \\\hline
+$Sx=:={a2+a3+a4}$ & $Sy=:={b2+b3+b4}$ & $Sx+Sy=:={}$\\\hline
+\multicolumn2{|r|}{$Sy-Sx=:={b5-a5}$} & @\multicolumn1c{}\\\cline{1-2}
+\end{spreadtab}
+\end{center}
+On va demander à ce que \ST affiche les 3 tableaux de débogage possibles concernant le tableau ci-dessus. Pour cela, il suffit de modifier la ligne 1 du code ci-dessus comme ceci :
+
+\hfill\verbinline[basicstyle=\ttfamily\small]-\begin{spreadtab}[\STdebug{text}\STdebug{formula}\STdebug{code}]{{tabular}{|rr|r|}}\hline-\hfill\kern0pt
+\begin{center}
+\begin{spreadtab}[\STdebug{text}\STdebug{formula}\STdebug{code}]{{tabular}{|rr|r|}}\hline
+@$x$ &@$y$ & @$x+y$\\\hline\hline
+22 & 54 & \STcopy{v3}{a2+b2} \\
+43 & 65 & \\
+49 & 37 & \\\hline
+$Sx=:={a2+a3+a4}$ & $Sy=:={b2+b3+b4}$ & $Sx+Sy=:={}$\\\hline
+\multicolumn2{|r|}{$Sy-Sx=:={b5-a5}$} & @\multicolumn1c{}\\\cline{1-2}
+\end{spreadtab}
+\end{center}
+Ces 3 tableaux de débogage peuvent aider à comprendre un peu mieux le fonctionnement interne de \ST. On peut observer dans le tableau 2 que toutes les cellules ayant un champ numérique ont un code interne de 1 ou 2 (voir tableau 3) et ont un marqueur de champ numérique "\verb-:=-" qui leur est associé (voir tableau 1). Ce marqueur représente l'endroit où sera inséré ---~par substitution~--- le résultat du calcul du champ numérique. C'est donc à partir des contenus des champs textuels du tableau 1 et par simple substitution, qu'une fois les champs numériques calculés, les cellules sont reconstituées pour donner celles du tableau final.
+
+Dans les tableaux ci-dessus, les cellules contenant les coordonnées ne sont grisées que si le package \href{http://www.ctan.org/tex-archive/macros/latex/contrib/colortbl/}{\texttt{\textbf{colortbl}}} a été chargé.
+
\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 !
+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 ! Par souci de lisibilité, la commande \verbinline-\STcopy- n'a pas été utilisée.
\subsection{Encore un triangle de Pascal}
\begin{lstlisting}
@@ -983,7 +1264,7 @@ Ce tableau est généré par l'environnement \verb=tabularx= de façon à occupe
@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{6}{c}{}\\[-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}
@@ -998,7 +1279,7 @@ Ce tableau est généré par l'environnement \verb=tabularx= de façon à occupe
@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{6}{c}{}\\[-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}
@@ -1047,7 +1328,8 @@ Chaque nombre est la somme des deux nombres se trouvant au dessous de lui.\par\n
&\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
+\end{center}
+\medskip
\parskip0pt
\begin{center}
$\star$\par
diff --git a/Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_vn.pdf b/Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_vn.pdf
deleted file mode 100644
index 5d686f8d740..00000000000
--- a/Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_vn.pdf
+++ /dev/null
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
deleted file mode 100644
index f2a3f89cfc3..00000000000
--- a/Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_vn.tex
+++ /dev/null
@@ -1,1013 +0,0 @@
-% ____________________________________________________________________________
-% | |
-% | |
-% | 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