summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/spreadtab/README4
-rw-r--r--Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_en.pdfbin856956 -> 856371 bytes
-rw-r--r--Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_en.tex310
-rw-r--r--Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_fr.pdfbin882719 -> 891558 bytes
-rw-r--r--Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_fr.tex140
-rw-r--r--Master/texmf-dist/tex/latex/spreadtab/spreadtab.sty1104
6 files changed, 967 insertions, 591 deletions
diff --git a/Master/texmf-dist/doc/latex/spreadtab/README b/Master/texmf-dist/doc/latex/spreadtab/README
index d41f670317f..a225c9ff8e2 100644
--- a/Master/texmf-dist/doc/latex/spreadtab/README
+++ b/Master/texmf-dist/doc/latex/spreadtab/README
@@ -1,8 +1,8 @@
_____________________
spreadtab package
- v0.3c
- 2011/04/08
+ v0.4
+ 2011/07/04
_____________________
This package provides spreadsheet features for LaTeX table environments.
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 6d33d05d57b..68e1e310474 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 54317c5ba9e..3d991ddc203 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.3c |
+% | spreadtab v0.4 |
% | |
-% | April 8, 2011 |
+% | 4 July 2011 |
% | |
% |___________________________________________________________________________|
%
@@ -70,14 +70,13 @@
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,STsetdecimalsep,STtransposecar,STdebug,STdisplaytab,STsetdisplaymarks,%
- STnumericfieldmarker,STprintnum,STtextcell,STcopy,fact,id,ifeq,ifgt,iflt,numtofrshortdate,%
+ spreadtab,endspreadtab,SThiderow,SThidecol,STsavecell,STautoround,STmessage,STsetdecimalsep,STtransposecar,STdebug,STdisplaytab,STsetdisplaymarks,%
+ STnumericfieldmarker,STprintnum,STtextcell,STcopy,STtag,STmakegtag,STeol,fact,id,ifeq,ifgt,iflt,numtofrshortdate,%
numtoengshortdate,numtofrlongdate,numtoenglongdate,numtofrmonth,%
numtoengmonth,numtofrday,numtoengday,sum,rand,randint,sumprod,%
- frshortdatetonum,engshortdatetonum,englongdatetonum,frlongdatetonum,gcd,lcm},%
+ frshortdatetonum,engshortdatetonum,englongdatetonum,frlongdatetonum,gcd,lcm,tag,cell,row,col},%
keywordstyle=\color{ST@keywordstc},classoffset=0}
-
%%%%%%%%%%% environnement OOcalc
\newcount\cntlin
\newcount\cntcol
@@ -148,7 +147,7 @@
\vspace{1cm}
\begin{center}
Christian {\sc Tellechea}\par\small
- \href{mailto:unbonpetit@gmail.com}{\texttt{\textbf{unbonpetit@gmail.com}}}\par\vspace{5pt}
+ \href{mailto:unbonpetit@gmail.com}{\texttt{\textbf{unbonpetit@gmail.com}}}\par\vspace{5pt}
\csname ST@eng@date\endcsname
\end{center}
\vfill
@@ -165,14 +164,23 @@
\end{titlepage}
\tableofcontents\newpage
-\parskip\medskipamount {\bfseries\color{red}This manual is a translation of the french manual. I apologize for my poor english but I did my best and I hope that the following is comprehensible! Any help improve this translation will be greatly appreciated.}
+\parskip\medskipamount
\section{Introduction}
+\subsection{new in version \csname ST@ver\endcsname}
+Here is what is new in the new version:
+\begin{itemize}
+ \item before moving into the environment requested by the user, \ST does not work inside a group so that the calculations no longer cause a `save-stack' error in large tables with many calculations;
+ \item \verbinline-\spreadtab- and \verbinline-\endspreadtab- can delimit tables;
+ \item new macro functions: `\verbinline-tag-', `\verbinline-cell-', `\verbinline-row-', `\verbinline-col-' and the command \verbinline-\STtag- (see page~\pageref{tag});
+ \item \verbinline-\STeol{<macro>}- enables the user to choose what marker \ST expects at the ends of lines when it reads the table (see page~\pageref{STeol}).
+\end{itemize}
+
\subsection{Presentation}
This package allows us to construct tables in a manner similar to a spreadsheet. The cells of a table have row and column indices and these can be used in formulas to generate values in other cells.
The package requires $\varepsilon$-\TeX, \LaTeXe{} and the \href{http://www.ctan.org/tex-archive/macros/latex/contrib/fp/}{\texttt{\textbf{fp}}} package, which performs arithmetic on cell values. Also, the \href{http://www.ctan.org/tex-archive/macros/latex/contrib/xstring/}{\texttt{\textbf{xstring}}} package is needed in its \falseverb{v1.5d [2010/03/28]} version or later.\medskip
-The package is compatible with \emph{all} tabular environments, and assumes that `\verb=&=' is used to delimit columns and `\verb-\\-' to end the lines. This compatibility requirement led me to program \ST so that it works independently of the table environment. Thus, reading the table, processing and calculating the formulas is done \emph{before} the environment table `sees' the body of the table.\medskip
+The package is compatible with \emph{all} tabular environments, and assumes that `\verb=&=' is used to delimit columns and `\verb-\\-' to end lines (but see page~\pageref{STeol}). This compatibility requirement led me to program \ST so that it works independently of the table environment. Thus, reading the table, processing and calculating the formulas is done \emph{before} the environment table `sees' the body of the table.\medskip
Consequently, \ST proceeds in 3 main stages before \verbinline=\begin{<table environment>}= sees the table:
\begin{itemize}
@@ -180,29 +188,42 @@ Consequently, \ST proceeds in 3 main stages before \verbinline=\begin{<table env
\item then, it computes the formulas in the cells, taking care for each to previously calculate all the dependent cells. The calculations are done by the \href{http://www.ctan.org/tex-archive/macros/latex/contrib/fp/}{\texttt{\textbf{fp}}} package;
\item finally, it is necessary to rebuild the table, replacing each formula by its numerical calculated value and handing over to the environment name specified by the user.
\end{itemize}
-Here is the syntax:\par\nobreak
+The syntax in both the following is allowed (and equivalent), where \verb-<name>- is the name of any table environment available with \LaTeX{} or with a package:\par\nobreak
+\begin{minipage}{0.48\linewidth}
\begin{lstlisting}[backgroundcolor=\color{ST@codebckgcolor}]
-\begin{spreadtab}{{<name of table environment>}<parameters of environment>}
+\begin{spreadtab}{{<name>}{<parameters>}}
table with formulas and numbers
\end{spreadtab}
\end{lstlisting}
-after the work of \ST, we get a display as if we had written:
+\end{minipage}\hfill or\hfill
+\begin{minipage}{0.48\linewidth}
\begin{lstlisting}[backgroundcolor=\color{ST@codebckgcolor}]
-\begin{<name of table environment>}<parameters of environment>
+\spreadtab{{<name>}{<parameters>}}
+ table with formulas and numbers
+\endspreadtab
+\end{lstlisting}
+\end{minipage}
+
+After the work of \ST, we get a display as if we had written:
+\begin{lstlisting}[backgroundcolor=\color{ST@codebckgcolor}]
+\begin{<name>}{<parameters>}
table with numbers
-\end{<name of table environment>}
+\end{<name>}
\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 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.
+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 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. However, the advantage of this package is that it makes it possible to write \emph{in the \LaTeX{} code} tables involving 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 formula 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.
+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 this package as a good programming exercise.
-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.
+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 Andrew \textsc{Parsloe} for proofreading the english 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.
+A table is a rectangular array of cells which may be viewed as a set of cells arranged in horizontal rows or vertical columns.
+
+\label{STeol}By default, \ST expects a `\verb-\\-' at the end of lines, which is usual in tables. This end of line marker can be changed via the \verbinline-\STeol{<macro>}- command. We can write for example \verbinline-\STeol{\tabularnewline}-. It is important to remember that the ends of lines to be inserted in the final table will always be `\verb-\\-' even if the end of line marker that \ST sees when it \emph{reads} the table is different.
\subsection{Absolute references}
A table cell is identified by the pair \falseverb{<colref><rowref>}\footnote{Note: this is the opposite to the standard matrix convention}, where:
@@ -216,7 +237,7 @@ Here are examples of absolutes references: \falseverb{b4} or \falseverb{C1} or \
&&&&\\&&&&\\&&&&\\&&&&\\&&&&\\
\end{OOocalc}
\end{center}
-This example calculates the sum each row and each column and then calculates the grand total:\par\nobreak
+This example calculates the sum of each row and each column and then calculates the grand total:\par\nobreak
\begin{minipage}{0.75\linewidth}
\begin{lstlisting}
\begin{spreadtab}{{tabular}{rr|r}}
@@ -263,9 +284,9 @@ a2 & a4+b4 & b4+c4 & c4+d4 & d4
\end{minipage}%
\subsection{Relative references}
-To refer to a cell, it may be convenient to specify its position relatively to where the formula is written. Thus, the relative coordinates of a cell are 2 relative numbers written using this syntax: \falseverb{[x,y]} where \falseverb x is the horizontal offset from the cell containing the formula and \falseverb y is the vertical offset. For example, \falseverb{[-2,3]} refers to the cell located 2 columns before (on the left) and 3 rows after (below) the cell where the formula is located.
+To refer to a cell, it may be convenient to specify its position relative to where the formula is written. Thus, the relative coordinates of a cell are 2 relative numbers written using this syntax: \falseverb{[x,y]} where \falseverb x is the horizontal offset from the cell containing the formula and \falseverb y is the vertical offset. For example, \falseverb{[-2,3]} refers to the cell located 2 columns before (on the left) and 3 rows after (below) the cell where the formula is located.
-Here is the same table as above but the references are relatives and the \verbinline-matrix- environment of the \href{http://www.ctan.org/tex-archive/macros/latex/required/amslatex/math/}{\texttt{\textbf{amsmath}}} is used:\par\nobreak
+Here is the same table as above but the references are relatives and the \verbinline-matrix- environment of the \href{http://www.ctan.org/tex-archive/macros/latex/required/amslatex/math/}{\texttt{\textbf{amsmath}}} package is used:\par\nobreak
\begin{minipage}{0.82\linewidth}
\begin{lstlisting}
$
@@ -292,18 +313,18 @@ $
$
\end{minipage}%
-We note that relative references are more appropriate here, since only 2 different references are used: \falseverb{[0,1]} which refers to the cell below and \falseverb{[-1,1]} which refers to the cell located at the SW of the current cell.\medskip
+We note that relative references are more appropriate here, since only 2 different references are used: \falseverb{[0,-1]} which refers to the cell above and \falseverb{[-1,-1]} which refers to the cell located to the NW of the current cell.\medskip
Absolute and relative references can be mixed in a formula.
\subsection{Text cells}
-If you want to put only text in a cell, you must tell \ST that the cell should not be calculated. Simply place somewhere in the cell character `\falseverb @' with its usual catcode 12. The cell will be ignored by \ST which will consider it as an inert cell impossible to refer\footnote{There is an exception, see page \pageref{datetonum}.} elsewhere in the table.
+If you want to put only text in a cell, you must tell \ST that the cell should not be calculated. Simply place somewhere in the cell the character `\falseverb @' with its usual catcode 12. The cell will be ignored by \ST which will consider it as an inert cell impossible to reference\footnote{There is an exception, see page \pageref{datetonum}.} elsewhere in the table.
Example:\par\nobreak
\begin{lstlisting}
\begin{spreadtab}{{tabular}{|r|ccc|}}
\hline
-@ values of de $x$ & -5 & -1 & 4 \\
+@ values of $x$ & -5 & -1 & 4 \\
@ $f(x)=2x$ & 2*[0,-1] & 2*[0,-1] & 2*[0,-1] \\\hline
\end{spreadtab}
\end{lstlisting}
@@ -314,7 +335,7 @@ Example:\par\nobreak
@ $f(x)=2x$ & 2*[0,-1] & 2*[0,-1] & 2*[0,-1] \\\hline
\end{spreadtab}
\end{center}
-The control sequence \verbinline=\STtextcell= expands to the character `\falseverb @'. It is possible to redefine it, for example, after \verbinline-\renewcommand\STtextcell{\celltext}-, a cell containing \verb=\celltext= will be understood as a text cell.
+The control sequence \verbinline=\STtextcell= expands to the character `\falseverb @'. It is possible to redefine it; for example, after \verbinline-\renewcommand\STtextcell{`}-, a cell containing the char \verb=`= will be understood as a text cell.
Moreover, if a cell is empty or filled with spaces, \ST will consider it as a text cell.
@@ -327,11 +348,11 @@ In reality, each cell is composed of two fields. The first is a \emph{numeric fi
\hfil\verb-<text field>:={numeric field}<end of text field>-\hfil\null\par
The marker `\verb-:=-' is the expansion of the control sequence \verbinline-\STnumericfieldmarker-. It is possible to redefine it, for example:\par\smallskip
{\centering\verbinline-\renewcommand\STnumericfieldmarker{\=}-\par\smallskip}
- In this case, the expansion of the marker `\verb-\=-' would have no importance and would not be invloved in the process. For \ST, it is only a token showing where the formula begins. This token is sought and recognized but is never expanded.
+ In this case, the expansion of the marker `\verb-\=-' would have no importance and would not be involved in the process. For \ST, it is only a token showing where the formula begins. This token is sought and recognized but is never expanded.
\end{itemize}
Once the \falseverb{numeric field} is computed, `\falseverb{:={numeric field}}' is replaced by the numeric value.
-Note that '\verb-:={numeric field}-` may be inside brackets, whatever be the level of nesting. For example, if a cell contains \verb-\textbf{:={a1+1}}- and if the numeric value of the cell \falseverb{a1} is 5, then finally, the cell will contain \verb-\textbf{6}-\medskip
+Note that `\verb-:={numeric field}-' may be inside brackets, whatever be the level of nesting. For example, if a cell contains \verb-\textbf{:={a1+1}}- and if the numeric value of the cell \falseverb{a1} is 5, then finally, the cell will contain \verb-\textbf{6}-\medskip
Here is a simple example:\par\nobreak
\begin{lstlisting}
@@ -344,7 +365,7 @@ 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-:=-` 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-@-'.
+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 another with \verbinline-\STcopy- (see next section) 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.
@@ -353,15 +374,15 @@ 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-:=-".
+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-<formula>-\footnote{The copy can only be done to cells located on the right and below the cell containing 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.
+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 target 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]|.
+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 usual, 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.
+The `\verb-!-' character is the expansion of the control sequence \verbinline-\STtransposecar-. It may be changed to any other with \verbinline-\renewcommand\STtransposecar-\verb-{<char>}-. The `\verb-!-' character, 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->-.
+In `\verbinline-\STcopy{>-$x$\verbinline-,v-$y$\verbinline-}{formula}-', if $x$ is omitted, the copy 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$ is equal to 0, the copy is limited to the column or row of the source cell. Instead of writing \verb-v0- or \verb->0-, it is possible to write \verb-v- or \verb->-.
Here are some examples:
\begin{tabular}{cl}\hline
@@ -410,7 +431,7 @@ It is easy to generate the multiplication table from 1 to 10:
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}.
+If 2 or more \verbinline-\STcopy- commands in several source cells have the same target cell, then, the formula this latter receives is the one contained in the last \verbinline-\STcopy- command when the table is read from top left to bottom 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} \\
@@ -420,7 +441,7 @@ If 2 or more \verbinline-\STcopy- command in several source cells have the same
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:
+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 unchanged since their numeric fields are not empty:
\begin{lstlisting}
\begin{spreadtab}{{tabular}{|*6{c|}}}\hline
1 &\STcopy{v,>}{!a1+1} & & & & \\\hline
@@ -439,7 +460,7 @@ Here is this example, treated by \ST below. In this table, the cell \verb-b5- (n
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.
+As mentioned in the last chapter, you can also copy a formula to 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 hand, a cell containing text `\verb-@-' cannot receive a formula when copying and the cell remains purely textual.
Example :
\begin{lstlisting}
@@ -457,15 +478,15 @@ X\STcopy{>}{a1+1}Y & @XY & X:={}Y & \textbf{:={}} & & \\\hline
\section{Features for formatting the table}
\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:
+The \verb-fp- package returns 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- takes a mandatory argument which is the character used as decimal separator:
\begin{center}
-\verbinline-\STsetdecimalsep-\verb-{<char}-
+\verbinline-\STsetdecimalsep-\verb-{<char>}-
\end{center}
-For exemple, french users should write this in the preamble of the document:
+For example, 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:
+For numeric fields 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}]
@@ -478,7 +499,7 @@ For numeric field located in math mode, the comma is considered as a math punctu
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:
+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 natural 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}
@@ -517,13 +538,13 @@ When cells are in math mode, you can\footnote{It is preferable to use the \textt
\end{minipage}
\subsection{Number formatting and the {\ttfamily fp} package}
-All calculations are made by the \verb-\FPeval- macro\footnote{This macro accepts infix or postfix notation. Consequently, both can be used to write formulas in a cell. For example the infix formula '\falseverb{a1+b1}' is equivalent to the postfix ones '\falseverb{a1 b1 add}' or '\falseverb{a1 b1 +}'.} of the \href{http://www.ctan.org/tex-archive/macros/latex/contrib/fp/}{\texttt{\textbf{fp}}} package. This package provides all necessary along with various scientific and trigonometric functions. Calculations are made with 18 decimal digits of precision, and \falseverb{fp} displays \emph{all} the decimals!
+All calculations are made by the \verb-\FPeval- macro\footnote{This macro accepts infix or postfix notation. Consequently, both can be used to write formulas in a cell. For example the infix formula `\falseverb{a1+b1}' is equivalent to the postfix ones `\falseverb{a1 b1 add}' or `\falseverb{a1 b1 +}'.} of the \href{http://www.ctan.org/tex-archive/macros/latex/contrib/fp/}{\texttt{\textbf{fp}}} package. This package provides all necessary arithmetical functions along with various scientific and trigonometric functions. Calculations are made with 18 decimal digits of precision, and \falseverb{fp} displays \emph{all} the decimals!
The number of digits displayed can be controlled in various ways:
\begin{itemize}
\item the \href{http://www.ctan.org/tex-archive/macros/latex/contrib/numprint/}{\texttt{\textbf{numprint}}} package can be used in order to properly display numbers;
- \item \verb=fp= can round or truc numbers with \verb-round(number,integer)- or \verb-trunc(number,integer)- but the syntax makes this tedious to write if this is needed for many cells;
- \item \ST can round \emph{all} the numbers in the table with the macro \verbinline-\STautoround- whose argument is number of digits in the decimal part. If the argument is empty, no rounding is done. If the starred macro \verbinline-\STautoround*- is used, the decimal part is filled with 0 if necessary.
+ \item \verb=fp= can round or truncate numbers with \verb-round(number,integer)- or \verb-trunc(number,integer)- but the syntax makes this tedious to write if this is needed for many cells;
+ \item \ST can round \emph{all} the numbers in the table with the macro \verbinline-\STautoround- whose argument is number of digits in the decimal part. If the argument is empty, no rounding is done. If the starred macro \verbinline-\STautoround*- is used, the decimal part is filled with 0 as necessary.
\end{itemize}
In this example, floating point numbers are rounded to 6 digits:\par\nobreak
\begin{lstlisting}
@@ -561,7 +582,7 @@ All the numbers contained in the final table, either typed as is or coming from
\begin{center}
\verbinline-\newcommand\STprintnum[1]{#1}-
\end{center}
-It is possible to round all the numbers via the \verbinline-\numprint- command from the \verb-numprint- package. To achive this, the \verbinline-\STprintnum- command must be redefined:\par\nobreak
+It is possible to round all the numbers via the \verbinline-\numprint- command from the \verb-numprint- package. To achieve this, the \verbinline-\STprintnum- command must be redefined:\par\nobreak
\begin{lstlisting}
\renewcommand\STprintnum[1]{\numprint{#1}}
\nprounddigits{6}
@@ -579,7 +600,7 @@ It is possible to round all the numbers via the \verbinline-\numprint- command f
\end{spreadtab}
\end{center}
-Here is another similar example where we test if the number to display is negative with the command \verbinline-\FPifneg- from the \verb-fp- package. If this happens, the number is displayed in red. The command \verbinline-\STautoround- was preferred to \verbinline-\nprounddigits- from the \verb-numprint- package because the latter it adds unnecessary 0's.
+Here is another similar example where we test if the number to display is negative with the command \verbinline-\FPifneg- from the \verb-fp- package. If this happens, the number is displayed in red. The command \verbinline-\STautoround- was preferred to \verbinline-\nprounddigits- from the \verb-numprint- package because the latter adds unnecessary 0's.
\begin{lstlisting}
\STsetdecimalsep{.}
\renewcommand\STprintnum[1]{\FPifneg{#1}\color{red}\fi\numprint{#1}}
@@ -602,7 +623,7 @@ Here is another similar example where we test if the number to display is negati
\subsection{End of lines and horizontal rules}
\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
+For horizontal rules, 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;
@@ -654,7 +675,7 @@ An example:\par\nobreak
\end{center}
The row containing $g(x)$ and column corresponding to the value 0 are hidden.
-You must be remember that the hidden rows and columns are \emph{invisible} to the tabular environment chosen by the user. Thus, only 4 columns have been defined (\falseverb{|r|ccc|}) and not 5 as seen by \ST.
+Remember that the hidden rows and columns are \emph{invisible} to the tabular environment chosen by the user. Thus, only 4 columns have been defined (\falseverb{|r|ccc|}) and not 5 as seen by \ST.
Just to see the difference, here is the table obtained when setting 5 columns in the preamble and not hiding any row or column:\par\nobreak
\begin{center}
@@ -668,7 +689,7 @@ Just to see the difference, here is the table obtained when setting 5 columns in
\end{center}
\subsection{Save the result of a cell}
-It may be necessary to save the numerical value of a cell to display it outside of a formula or even outside of the table. Here is how to do it:
+It may be necessary to save the numerical value of a cell to display it outside a formula or even outside the table. Here is how to do it:
\begin{center}
\verbinline-\STsavecell{<control sequence>}{<absolute reference>}-
\end{center}
@@ -714,9 +735,9 @@ It lasts more than \hhh\ hours.
\end{center}
\subsection{Display the value of a cell}
-In order to display the numeric field of a cell in a textual field, we have seen that we could save this value in a control sequence and use this control sequence anywhere in the table. The process is somewhat tedious\ldots{} Indeed, the \verbinline-\STsavecell- is not intented to be used in such a way. Its aim is to save the value of a numeric field for a further use \emph{outside} the table.
+In order to display the numeric field of a cell in a textual field, we have seen that we could save this value in a control sequence and use this control sequence anywhere in the table. The process is somewhat tedious\ldots{} Indeed, \verbinline-\STsavecell- is not intended to be used in such a way. Its aim is to save the value of a numeric field for further use \emph{outside} the table.
-There is a simpler way to display the numeric field of a cell in a textual field using the syntax \verb-<<reference>>- which is replaced by the numeric field of the cell \verb-reference-, where the \verb-reference- can be absolute or relative. If the text between \verb-<<- and \verb->>- is not a reference, then \verb-<<text>>- is left as is. The \verb-reference- must not contain any space, and for exampple, if you write \verb-<< a1>>-, \ST does not uderstand it as a reference because of the space before "\verb-a1-".
+There is a simpler way to display the numeric field of a cell in a textual field using the syntax \verb-<<reference>>- which is replaced by the numeric field of the cell \verb-reference-, where the \verb-reference- can be absolute or relative. If the text between \verb-<<- and \verb->>- is not a reference, then \verb-<<text>>- is left as is. The \verb-reference- must not contain any space; for example, if you write \verb-<< a1>>-, \ST does not uderstand it as a reference because of the space before `\verb-a1-'.
Example in a textual cell \verb-a3-:
\begin{lstlisting}
@@ -744,7 +765,7 @@ Example in the mixed cell \verb-c1-:
23 & 32 & Average $= \frac{<<a1>>+<<b1>>}{2}= :={(a1+b1)/2}$\\\hline
\end{spreadtab}
\end{center}
-The chars used to delimit the reference are set to "\verb-<<-" and "\verb->>-" by default. They can be modified with the \verbinline-\STsetdisplaymarks- command whose arguments contain the left and right delimiters. For example, if you write \verbinline-\STsetdisplaymarks{|}{|}-, you will write \verb-|reference|- in order to display the content of the numeric field of the cell \verb-reference-.
+The characters used to delimit the reference are set to `\verb-<<-' and `\verb->>-' by default. They can be modified with the \verbinline-\STsetdisplaymarks- command whose arguments contain the left and right delimiters. For example, if you write \verbinline-\STsetdisplaymarks{|}{|}-, you will write \verb-|reference|- in order to display the content of the numeric field of the cell \verb-reference-.
\subsection{The use of \ttfamily\textbackslash multicolumn}
\ST is compatible with the syntax \verbinline=\multicolumn{<n>}{<type>}{<content>}= which merges \falseverb{<n>} cells in a unique cell whose type and content are specified in the arguments.
@@ -758,7 +779,7 @@ a2&\multicolumn{2}{l|}{b2}&d2&e2&f2&g2\\\hline
\multicolumn{3}{|l|}{a3}&d3&\multicolumn{2}{l|}{e3}&g3\\\hline
\end{tabular}
\end{center}
-Thus, whatever be the number of merged cells, the next cell has a column number that take into account the number of merged cells.\medskip
+Thus, whatever the number of merged cells, the next cell has a column number that takes into account the number of merged cells.\medskip
In the last line, cells \falseverb{a3}, \falseverb{b3} and \falseverb{c3} are merged and consequently, the cells \falseverb{b3} and \falseverb{c3} \emph{do not exist} for \ST: it is not possible to refer to \falseverb{b3} or \falseverb{c3} anywhere in the table.\medskip
@@ -791,12 +812,12 @@ The macro-function \verbinline=sum= sums one or several ranges of cells.
It should be used like this: \verbinline=sum(<range 1>;<range 2>;...;<range n>)=, where a range of cells is:
\begin{itemize}
\item either a single cell like \falseverb{a1} or \falseverb{[2,1]};
- \item either a rectangular area bounded by the upper-left cell and lower-right with this syntax:\par{\centering\verb=<cell 1>:<cell 2>=\par}
+ \item or a rectangular area bounded by the upper-left cell and lower-right with this syntax:\par{\centering\verb=<cell 1>:<cell 2>=\par}
Here are some examples of such areas: \falseverb{a2:d5}, \falseverb{[-1,-1]:[2,3]}, \falseverb{b4:[5,1]}.
\end{itemize}
-In the ranges of cell, if a cell does have a numeric field (empty cell or text cell or merged cell with \verbinline-\mutlicolumn-), it is seen as 0 by \verbinline-sum-.
+In cell ranges, if a cell does not have a numeric field (empty cell or text cell or merged cell with \verbinline-\mutlicolumn-), it is seen as 0 by \verbinline-sum-.
-In the following table, the sum of the binomial coefficients of the Pascal's triangle is calculated:\par\nobreak
+In the following table, the sum of the binomial coefficients of Pascal's triangle is calculated:\par\nobreak
\begin{minipage}{0.75\linewidth}
\begin{lstlisting}
\begin{spreadtab}{{tabular}{*5c}}
@@ -822,9 +843,9 @@ In the following table, the sum of the binomial coefficients of the Pascal's tri
\end{minipage}%
\subsubsection{The \texttt{fact} macro}
-The macro-function \verbinline=fact(<number>)= computes the factorial of its argument, assumed it is an \emph{integer} between 0 and 18 to avoid overflows\footnote{Indeed, for \falseverb{fp} the greatest integer is $10^{18}-1$. The factorial of 19 is greater than it.}. The \falseverb{<number>} can also be a reference to a cell whose numeric field contains an integer.\medskip
+The macro-function \verbinline=fact(<number>)= computes the factorial of its argument, assuming it is an \emph{integer} between 0 and 18 to avoid overflows\footnote{Indeed, for \falseverb{fp} the greatest integer is $10^{18}-1$. The factorial of 19 is greater than this.}. The \falseverb{<number>} can also be a reference to a cell whose numeric field contains an integer.\medskip
-Here are the factorial from 0 to 8:\par\nobreak
+Here are the factorials from 0 to 8:\par\nobreak
\begin{lstlisting}
\begin{spreadtab}{{tabular}{*9c}}
0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 &8\\\hline
@@ -858,19 +879,19 @@ In this simple example, the average age of a group of children aged from 10 to 1
@Average&\multicolumn{6}{l}{:={sumprod(b1:g1;b2:g2)/sum(b2:g2)}}
\end{spreadtab}
\end{center}
-If any cell in the rages is empty, pure text or merged with \verbinline-\multicolumn-, its numeric field is replaced by 0.
+If any cell in the ranges is empty, pure text or merged with \verbinline-\multicolumn-, its numeric field is replaced by 0.
\subsubsection{Random numbers}
-The macro-functions \verbinline-randint- and \verbinline-rand- return a random number depending of its argument.
+The macro-functions \verbinline-randint- and \verbinline-rand- each returns a random number depending on its argument.
-It should be noted that the seed initializing the random sequence depends on the date and the minute at which the compilation is done. Thus, the random sequence of numbers given by this function will change between two compilations made at times which minutes differ. If randoms numbers need to be repeatable, the private macro \verb-\ST@seed- must be cancelled and a seed should be chosen for \falseverb{fp}. Here is the code to do this:\par\nobreak
+It should be noted that the seed initializing the random sequence depends on the date and the minute at which the compilation is done. Thus, the random sequence of numbers given by this function will change between two compilations made at different times. If random numbers need to be repeatable, the private macro \verb-\ST@seed- must be cancelled and a seed should be chosen for \falseverb{fp}. Here is the code to do this:\par\nobreak
\begin{lstlisting}[backgroundcolor=\color{ST@codebckgcolor}]
\makeatletter
\renewcommand\ST@seed{}% redefines the private macro
-\makeatletter
+\makeatother
\FPseed=27% gives a seed (any integer) to fp.
\end{lstlisting}
-The macro-function \verbinline-randint- returns a random \emph{integer} depending on its argument. Here is the syntax: \verbinline=randint([<number1>,]<number2>)=, where \verb=<number1>= is an optional integer which default value is 0. The random integer returned is in the interval \verb=[<number1>;<number2>]=.
+The macro-function \verbinline-randint- returns a random \emph{integer} depending on its argument. Here is the syntax: \verbinline=randint([<number1>,]<number2>)=, where \verb=<number1>= is an optional integer with default value 0. The random integer returned is in the interval \verb=[<number1>;<number2>]=.
The macro-function \verbinline-rand()- returns a random number between 0 and 1.\par\nobreak
\begin{lstlisting}
@@ -893,12 +914,12 @@ The macro-function \verbinline-rand()- returns a random number between 0 and 1.\
\end{center}
\subsubsection{GCD and LCM}
-The macro functions "gcd" and "lcm" compute the Greatest Common Divisor and the Least Common Multiple of list of numbers in their argument:
+The macro functions `gcd' and `lcm' compute the Greatest Common Divisor and the Least Common Multiple of the list of numbers in their argument:
\begin{center}
\verbinline-gcd(number1,number2,...,numberN)-\par
\verbinline-lcm(number1,number2,...,numberN)-
\end{center}
-Exemple :
+Example :
\begin{lstlisting}
\begin{spreadtab}{{tabular}{|r|r|r||c|c|}}\hline
\multicolumn3{|c||}{@Numbers}& @GCD & @LCM \\\hline
@@ -919,12 +940,12 @@ Exemple :
\end{center}
\subsubsection{Scientific notation}
-The macro function "scitodec" enables to convert a number written in scientific notation into a decimal number, understandable by \ST to achieve its calculations. The syntax is \verbinline-scitodec(<text>)-, where \verb-<text>- is:
+The macro function `scitodec' converts a number written in scientific notation into a decimal number, understandable by \ST to achieve its calculations. The syntax is \verbinline-scitodec(<text>)-, where \verb-<text>- is:
\begin{itemize}
- \item a sequence of characters with the syntax \verb-<mantissa>EE<exponent>- where \verb-<mantissa>- is a decimal number and the \verb-<exponent>- is an integer. The "E" may be written uppercase or lowercase.
+ \item a sequence of characters with the syntax \verb-<mantissa>EE<exponent>- where \verb-<mantissa>- is a decimal number and the \verb-<exponent>- is an integer. The `EE' may be written uppercase or lowercase.
\verb-<mantissa>EE<exponent>- means the number $\text{\ttfamily <mantissa>}\times10^{\text{\ttfamily <exponent>}}$
- \item a reference to the \emph{textual} field of a cell which containing \verb-<mantissa>EE<exponent>-
+ \item a reference to the \emph{textual} field of a cell containing \verb-<mantissa>EE<exponent>-
\end{itemize}
Example :
\begin{lstlisting}
@@ -951,9 +972,9 @@ Example :
\end{center}
\subsubsection{Identity}
-The simplest macro functions is "\verbinline=id(<number>)=". It returns the number in its argument. Mathematically, it is not very usefull, but with \ST, it makes possible to write mathematical expressions in arguments of macro function where they are not allowed. In the argument of \verbinline=sum= for example.
+The simplest macro function is `\verbinline=id(<number>)='. It returns the number in its argument. Mathematically, it is not very useful, but with \ST, it makes possible the writing of mathematical expressions in arguments of macro functions where they are not otherwise allowed -- in the argument of \verbinline=sum= for example.
-In the code below, the \verbinline-id- macro function is used to compute the range of cell to add with \verbinline-sum-. In this example, the numeric field of the cell "a2" contains 8. Therefore, "\verbinline=sum([0,-1]:[id(a2-1),-1])/a2=" is equivalent to \verbinline=sum([0,-1]:[7,-1])/8=:
+In the code below, the \verbinline-id- macro function is used to compute the range of cells to add with \verbinline-sum-. In this example, the numeric field of the cell `a2' contains 8. Therefore, `\verbinline=sum([0,-1]:[id(a2-1),-1])/a2=' is equivalent to \verbinline=sum([0,-1]:[7,-1])/8=:
\begin{lstlisting}
\begin{spreadtab}{{tabular}{r*{10}c}}
@@ -989,7 +1010,8 @@ $f(x)=\begin{cases}
0 &\text{if }x=1\\
-10 &\text{if }x>1
\end{cases}
-$
+$\smallskip
+
\begin{lstlisting}
\begin{spreadtab}{{tabular}{|*2c|}}\hline
@$x$ & @$f(x)$ \\\hline
@@ -1017,7 +1039,7 @@ $
\subsection{Macro-functions manipulating dates}
\subsubsection{Date to number with \ttfamily engshortdatetonum}\label{datetonum}
-The macro \verbinline-engshortdatetonum- converts a short date like 1789/7/14 to an integer which is the number of days passed since the 1st march of the year 0\footnote{This year 0 does not exists but this should not be a problem with recent dates.}. It is important to note that this macro-function requires a \emph{textual} argument and not a number or the result of a mathematical calculation. Therefore, if the argument of this macro-function refers to a cell, that cell \emph{must} be a text cell, i.e. a cell containing '\verb-@-` or '\verb-:={}-`.
+The macro \verbinline-engshortdatetonum- converts a short date like 1789/7/14 to an integer which is the number of days passed since the 1st March of the year 0\footnote{This year 0 does not exist but this should not be a problem with recent dates.}. It is important to note that this macro-function requires a \emph{textual} argument and not a number or the result of a mathematical calculation. Therefore, if the argument of this macro-function refers to a cell, that cell \emph{must} be a text cell, i.e. a cell containing `\verb-@-' or `\verb-:={}-'.
In the example below, the first two lines show how to refer to a text cell. The third line displays the date 0 on the left, and more interesting on the right, it shows how to calculate the number corresponding to the current date with the use of the \TeX{} counters \verbinline-\year-, \verbinline-\month- and \verbinline-\day- which contain the numbers of the current year, month and day.\par\nobreak
\begin{lstlisting}
@@ -1034,7 +1056,7 @@ engshortdatetonum(0/3/1) & engshortdatetonum(\number\year/\number\month/\number\
engshortdatetonum(0/3/1) & engshortdatetonum(\number\year/\number\month/\number\day)
\end{spreadtab}
\end{center}
-Another macro-function provides the same feature but with a long date like 'December 25, 1789` or the string contained in \verbinline-\today-:\par\nobreak
+Another macro-function provides the same feature but with a long date like `December 25, 1789' or the string contained in \verbinline-\today-:\par\nobreak
\begin{lstlisting}
\begin{spreadtab}{{tabular}{cc}}
englongdatetonum(February 13, 2005) & englongdatetonum(\today)\\
@@ -1049,12 +1071,12 @@ englongdatetonum(February 13, 2005) & englongdatetonum(\today)\\
\end{center}
\subsubsection{From a number to a date}
-Several macro-functions enable to translate a number into a date. All these macro-functions have in common that their result is \emph{text}. Therefore, the cells containing such results \emph{become cells containing text}: the numeric field becomes empty and the text field becomes this result.
+Several macro-functions translate a number into a date. All these macro-functions have in common that their result is \emph{text}. Therefore, the cells containing such results \emph{become cells containing text} and if the cell is composed of two fields, the numeric field becomes empty and `\verb-:={<formula>}-' is replaced by its result in the text field.
-This macro-functions are:
+These macro-functions are:
\begin{itemize}
- \item \verbinline-numtoengshortdate- translate a number into a short date like '1789/7/14`;
- \item \verbinline-numtoenglongdate- translate a number into a long date like 'July 14, 1789`;
+ \item \verbinline-numtoengshortdate- translate a number into a short date like `1789/7/14';
+ \item \verbinline-numtoenglongdate- translate a number into a long date like `July 14, 1789';
\item \verbinline-numtoengmonth- given a number representing a date, it finds the name of the month;
\item \verbinline-numtoengday- same as above but it finds the name of the day.
\end{itemize}
@@ -1086,13 +1108,91 @@ Here is an example in which we consider 1000 days before and 1000 days after 200
\end{spreadtab}
\end{center}
+\subsection{Coordinate macro functions}\label{tag}
+Rather than referring to a cell by its coordinates which are difficult to remember and change if you insert a row or column, it is sometimes more convenient to give a name to a cell and refer to it later by name.
+
+The macro function `\verbinline-tag(<name>)-' gives a name to the cell in which it is located. This is not really a macro function like the others, since it returns nothing when put in a formula and disappears without causing any effect on the mathematical result. We can write `\verbinline-tag(<nom>)-' \emph{anywhere} in the numeric field of a cell. The \verb-<name>- can be any string of alphanumeric characters, but it is not advisable to put a letter and a number that could be understood as a reference to a cell, and would therefore be modified at a copy operation with \verbinline-\STcopy-. This macro function has an additional action, it saves via a \verbinline-\def- the numeric value of the cell in which it is located in order to be able to use later \emph{outside} the table via the purely expandable command \verbinline-\STtag{<name>}-.
+
+Later in the table, instead of writing the coordinates of the cell, we can write `\verbinline-cell(<name>)-', which is a macro function that returns the coordinates of the cell named \verb-<name>-. For example, if `\verbinline-tag(<name>)-' is written in the cell `\verb-B3-' and in a further cell, we write `\verbinline-cell(<name>)-', this macro function returns \verb-B3-.
+
+Here is an example where we add cells and the name `\verb-foo-' is given to the first number and the name `\verb-bar-' to the last. One can see that \verbinline-tag(foo)- is between `1' and `9' but at the end, since this macro function diappears, the numeric field of the cell will be `19':
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{r@{}r}}
+ & 15tag(foo) \\
+@+ & 37 \\
+@+ & 13 \\
+@+ & 48 \\
+@+ & 1tag(bar)9 \\\cline{2-2}
+ & sum(cell(foo):cell(bar))tag(baz)
+\end{spreadtab}
+
+foo=\STtag{foo}, bar=\STtag{bar}, baz=\STtag{baz}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{r@{}r}}
+ & 15tag(foo) \\
+@+ & 37 \\
+@+ & 13 \\
+@+ & 48 \\
+@+ & 1tag(bar)9 \\\cline{2-2}
+ & sum(cell(foo):cell(bar))tag(baz)
+\end{spreadtab}
+
+foo=\STtag{foo}, bar=\STtag{bar}, baz=\STtag{baz}
+\end{center}
+When the environment \ST is nested in another environment, the assignments made by the macro funtion \verbinline-tag- are \emph{local} in this environment and could not be accessed outside of this environment via \verbinline-\STtag-. In the example below, the table made with \ST is in a \verbinline-center- environment and we must use \verbinline-\STmakegtag{<name>}- to make global the previous saving of the numerical value contained in the cell marked by `tag(<name>)':
+
+\begin{minipage}{.6\linewidth}
+\begin{lstlisting}
+\begin{center}
+ \begin{spreadtab}{{tabular}{cccc}}\hline
+ 6&9&17&21\\\hline
+ \multicolumn{4}{c}{average = :={sum(a1:d1)/4tag(avg)}}
+ \end{spreadtab}
+ \STmakegtag{avg}
+\end{center}
+The average is \STtag{avg}.
+\end{lstlisting}
+\end{minipage}\kern6pt
+\begin{minipage}{.3\linewidth}
+\begin{center}
+ \begin{spreadtab}{{tabular}{cccc}}\hline
+ 6&9&17&21\\\hline
+ \multicolumn{4}{c}{average = :={sum(a1:d1)/4tag(avg)}}
+ \end{spreadtab}
+ \STmakegtag{avg}
+\end{center}
+The average is \STtag{avg}.
+\end{minipage}
+
+The argument of \verbinline-\STmakegtag- can be made of several names, separated with commas.
+
+Although at first sight less useful, \ST also provides the macro functions `\verbinline-row(<name>)-' and `\verbinline-col(<name>)-' that return the number of the row or column of the cell \verbinline-tag(<name>)-. Here is an example of how to calculate the average of a number of values; the first and last values are tagged `first' and `last' and therefore, the number of values is row(last)-row(first)+1:
+
+\begin{minipage}{0.6\linewidth}
+\begin{lstlisting}
+average = \begin{spreadtab}{{tabular}[b]{r}}
+7tag(first)\\9\\15\\6\\20\\13\\11\\55tag(last)\\
+\hline
+sum(cell(first):cell(last))/(row(last)-row(first)+1)
+\end{spreadtab}
+\end{lstlisting}
+\end{minipage}\hfill
+\begin{minipage}{0.35\linewidth}
+average = \begin{spreadtab}{{tabular}[b]{r}}
+7tag(first)\\9\\15\\6\\20\\13\\11\\55tag(last)\\
+\hline
+sum(cell(first):cell(last))/(row(last)-row(first)+1)
+\end{spreadtab}
+\end{minipage}
+
\section{Particular care}
\subsection{Defining new commands with \ttfamily\textbackslash hline}
It may be useful to define a new command to produce, for example, a double horizontal line:\par\nobreak
\begin{center}
\verbinline-\newcommand\dline{\hline\hline}-
\end{center}
-and then try to use it in a table as in this simple example that computes Fibonnacci sequence in the second line:
+and then try to use it in a table as in this simple example that computes the Fibonnacci sequence in the second line:
\begin{center}
\newcommand\dline{\hline\hline}
\begin{spreadtab}{{tabular}{*7c}}
@@ -1111,12 +1211,12 @@ But, if you write the following code, there is a problem when compiling:\par\nob
In the log file, you can read that \verb-\FPeval- fails and complains:\par
\hfill\falseverb{! Improper alphabetic constant.}\hfill\null
-The reason is simple, \verb-\dline- in line 4 is not recognized by \ST as an horizontal rule and therefore, \emph{it is placed in the cell next line}. For \ST, the cell \falseverb{b1} contains:\par
+The reason is simple, \verb-\dline- in line 4 is not recognized by \ST as a horizontal rule and therefore, \emph{it is placed in the cell in the next line}. For \ST, the cell \falseverb{b1} contains:\par
\hfill\falseverb{\dline 1}\hfill\null
Since there is no \verb-@- or \verb-:={<formula>}-, \ST considers that the whole cell is a numeric field and \verb-\FPeval- tries valiantly to calculate this content and obviously fails.
-To compile without error, the cell \falseverb{a2} \emph{must} contains a numeric field marker:\par\nobreak
+To compile without error, the cell \falseverb{a2} \emph{must} contain a numeric field marker:\par\nobreak
\begin{lstlisting}
\newcommand\dline{\hline\hline}
\begin{spreadtab}{{tabular}{*7c}}
@@ -1150,14 +1250,14 @@ Let's take an example, and let's say that, in the following table, we want to me
\end{center}
There are 4 visible merged cells, so we write \verbinline-\multicolumn{4}- because hidden columns are never taken into account when counting the number of \verbinline-\multicolumn-.
-Then we count 4 letters from \falseverb{b} (this letter included): we obtain the letter \falseverb{e}. In the range \falseverb{b-e}, let's count: 2 gray hidden columns are included (\falseverb c and \falseverb d) and 1 hidden column is not included (\falseverb f). These numbers are important to understand the following, also let's call them $a$ and $b$ in the general case.
+Then we count 4 letters from \falseverb{b} (this letter included): we obtain the letter \falseverb{e}. In the range \falseverb{b-e}, let's count: 2 gray hidden columns are included (\falseverb c and \falseverb d) and 1 hidden column is not included (\falseverb f). These numbers are important to understand the following, also let's call them $x$ and $y$ in the general case.
The rule is:
\begin{itemize}
- \item it is necessary to add $b$ signs \verb-&- after \verbinline-\multicolumn- (in the example above, it would be 1);
- \item references to columns of cells after the \verbinline-\multicolumn- will be shifted $a$ to the beginning of the alphabet. For the example given, if we want to refer to the cell \falseverb{i2}, we should write \falseverb{g2} instead of \falseverb{i2}.
+ \item it is necessary to add $y$ signs \verb-&- after \verbinline-\multicolumn- (in the example above, it would be 1);
+ \item references to columns of cells after the \verbinline-\multicolumn- will be shifted $x$ to the beginning of the alphabet. For the example given, if we want to refer to the cell \falseverb{i2}, we should write \falseverb{g2} instead of \falseverb{i2}.
\end{itemize}
-Here is an example with a similar structure than the previous ($a=2$ and $b=1$) with simple formulas: add 1 to the number above.\par\nobreak
+Here is an example with a similar structure to the previous ($x=2$ and $y=1$) with simple formulas: add 1 to the number above.\par\nobreak
\begin{lstlisting}
\begin{spreadtab}{{tabular}{|*{7}{c|}}}
\hline
@@ -1174,7 +1274,7 @@ a1+1& \multicolumn4{l|}{:={b1+1}} & & i1+1 & j1+1\\\hl
a2+1& b2+1 & & & & & & & g2+1 & h2+1\\\hline
\end{spreadtab}
\end{center}
-And another example with $a=1$ and $b=0$ where a single column is hidden \falseverb d:\par\nobreak
+And another example with $x=1$ and $y=0$ where a single column is hidden \falseverb d:\par\nobreak
\begin{lstlisting}
\begin{spreadtab}{{tabular}{|*{9}{c|}}}
\hline
@@ -1193,15 +1293,15 @@ a2+1& b2+1 & & & & & & & h2+1 & i2+1\\\hline
\end{center}
\subsection{Messages delivered by \ST}
-The package delivers error messages and abort compilation in these cases:
+The package delivers error messages and aborts compilation in these cases:
\begin{itemize}
- \item a circular reference is found in a cell. In this case, the dependant cells are displayed;
- \item a cell refers to an empty cell or a text cell when a non empty numeric field is expected;
+ \item a circular reference is found in a cell. In this case, the dependent cells are displayed;
+ \item a cell refers to an empty cell or a text cell when a non-empty numeric field is expected;
\item a cell refers to an undefined cell (outside the table);
- \item a cell refers to a merged cell by a \verbinline-\multicolumn- command;
- \item a relative reference has a bad syntax.
+ \item a cell refers to a cell merged by a \verbinline-\multicolumn- command;
+ \item a relative reference has bad syntax.
\end{itemize}
-The package can deliver information messages (in the log file), which it does by default. If the user wants or not the delivery of information messages, the syntax is \verbinline-\STmessage{true}- or \verbinline-\STmessage{false}-.
+The package can deliver informative messages (in the log file), which it does by default. If the user wants or not the delivery of informative messages, the syntax is \verbinline-\STmessage{true}- or \verbinline-\STmessage{false}-.
To understand the meaning of these messages, let's take a simple table:\par\nobreak
\begin{minipage}{0.65\linewidth}
@@ -1232,14 +1332,14 @@ Here are the messages deliverd by \ST:\par\nobreak
* building tab: ok
[spreadtab] End of spreadtab
\end{lstlisting}\medskip
-Preceded by a star, we recognize the 3 steps necessary to \ST to complete its task: reading the table, calculation of the formulas and building the final table.
+Preceded by a star, we recognize the 3 steps necessary for \ST to complete its task: reading the table, calculation of the formulas and building the final table.
For the second step, cells are evaluated from top to bottom, left to right: at line 4 in the code above, \ST says that it begins by trying to calculate the first cell \falseverb{A1}. After a dash, we see that for this, it must first compute the cell \falseverb{B1}, which itself requires that the cell \falseverb{C1} is calculated: the latter can be calculated since it depends only on \falseverb{D1} which is a cell containing the number 10.
-In the following (lines 5 to 8), there is only one cell per line which means that when \ST tries to evaluate the cell, either it contains a number or dependant cells are already calculated.
+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 dependent 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:
+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 information. This display is done just after \ST has read all the cells, and no calculating of formulas 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;
@@ -1252,7 +1352,7 @@ To ease the use of \ST, a debug mode is available. It is activated when the comm
\end{enumerate}
\end{itemize}
-When the ``debug mode'' is activated, the final table is not displayed.
+When the `debug mode' is activated, the final table is not displayed.
Here is a table which will be used for the next example:
@@ -1276,7 +1376,7 @@ $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:
+Let's ask \ST to show the 3 possible debugging tables for the table above. To do this, just change 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}
@@ -1289,16 +1389,16 @@ $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.
+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 (by substitution) the result of the numeric field will be inserted. 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.
+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!
-\subsection{The Pascal's triangle again!}
+\subsection{Pascal's triangle again!}
\begin{lstlisting}
\begin{spreadtab}{{tabular}{*7r}}
[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]+[0,1] & [-1,1]\\
@@ -1363,10 +1463,10 @@ and this table shows the speed of convergence for $x=0.5$
\end{spreadtab}
\end{center}
-\subsection{Convergence on the golden ration}
+\subsection{Convergence to the golden ratio}
In mathematical terms, the sequence $F_n$ of Fibonacci numbers is defined by the recurrence relation:\[F_0=1\qquad F_1=1\qquad F_{n+2}=F_{n+1}+F_n\]
-The golden ratio is the limit of the ratios of successive terms of the Fibonacci sequence. We show here that the quotients $F_{n+1}/F_n$ approximate the golden ration $\varphi=\frac{1+\sqrt{5}}{2}$ alternately lower and higher than $\varphi$.\par\nobreak
+The golden ratio is the limit of the ratios of successive terms of the Fibonacci sequence. We show here that the quotients $F_{n+1}/F_n$ approximate the golden ratio $\varphi=\frac{1+\sqrt{5}}{2}$ alternately lower and higher than $\varphi$.\par\nobreak
\begin{lstlisting}
\STautoround{9}
$\begin{spreadtab}{{array}{ccN39N{3}{9}}}
@@ -1415,7 +1515,7 @@ $\begin{spreadtab}{{array}{ccN39N{3}{9}}}
\end{center}
\subsection{A billing table}
-Here is a billing table where the decimal points are aligned in columns with the column specifier 'N` of the package \falseverb{numprint}.
+Here is a billing table where the decimal points are aligned in columns with the column specifier `N' of the package \falseverb{numprint}.
This table is generated by the environment \verb=tabularx= stretched to fit 80\% of the width of the line. The command \verbinline=\multicolumn= has been widely used for formatting:\par\nobreak
\begin{lstlisting}
@@ -1503,8 +1603,8 @@ Each number is the sum of two numbers located below it.
$\star$\par
$\star\quad\star$
\end{center}\bigskip
-That's all, I hope we will find this package useful!\par\nobreak\medskip
+That's all. I hope you will find this package useful!\par\nobreak\medskip
Given the youth of this package, please, be tolerant if you find bugs: with comments from users, better versions should be available soon. Indeed, this version is just beginning and, though rather stable, many things are still imperfect.\par\nobreak\medskip
-I thank you in advance for sending by \href{mailto:unbonpetit@gmail.com}{\texttt{\textbf{email}}} any bug you find, any macro-function or improvment you would like to be implemented, assumed that it must be \emph{realistic}. This package has to be modest and \ST is not excel or calc: it is impossible to implement some advanced features of these spreadsheets.\ldots\par\nobreak\bigskip
+I thank you in advance for sending by \href{mailto:unbonpetit@gmail.com}{\texttt{\textbf{email}}} any bug you find, any macro-function or improvment you would like to be implemented, assuming that it must be \emph{realistic}. This package has to be modest and \ST is not excel or calc: it is impossible to implement some advanced features of these spreadsheets.\ldots\par\nobreak\bigskip
Christian \textsc{Tellechea}
\end{document} \ No newline at end of file
diff --git a/Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_fr.pdf b/Master/texmf-dist/doc/latex/spreadtab/spreadtab_doc_fr.pdf
index 66f4838f5d5..a6dae84e6f6 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 7436cc0a385..efd1f6dcc20 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.3c |
+% | spreadtab v0.4 |
% | |
-% | 8 avril 2011 |
+% | 4 juillet 2011 |
% | |
% |___________________________________________________________________________|
%
% Ce fichier est spreadtab_doc_fr.tex, le code source de la documentation en
% français du package spreadtab.
%
-% Copyright Christian Tellechea 2009-2010
+% Copyright Christian Tellechea 2009-2011
% email : unbonpetit@gmail.com
%
% -------------------------------------------------------------------
@@ -53,7 +53,6 @@
\fancyfoot[r]{\thepage}
\usepackage[frenchb]{babel}
\frenchbsetup{StandardLists=true}
-
\usepackage{enumitem}
\makeatletter
\definecolor{ST@bckgcolor}{rgb}{0.87,0.9,1}
@@ -71,11 +70,11 @@
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,STsetdecimalsep,STtransposecar,STdebug,STdisplaytab,STsetdisplaymarks,%
- STnumericfieldmarker,STprintnum,STtextcell,STcopy,fact,id,ifeq,ifgt,iflt,numtofrshortdate,%
+ spreadtab,endspreadtab,SThiderow,SThidecol,STsavecell,STautoround,STmessage,STsetdecimalsep,STtransposecar,STdebug,STdisplaytab,STsetdisplaymarks,%
+ STnumericfieldmarker,STprintnum,STtextcell,STcopy,STtag,STmakegtag,STeol,fact,id,ifeq,ifgt,iflt,numtofrshortdate,%
numtoengshortdate,numtofrlongdate,numtoenglongdate,numtofrmonth,%
numtoengmonth,numtofrday,numtoengday,sum,rand,randint,sumprod,%
- frshortdatetonum,engshortdatetonum,englongdatetonum,frlongdatetonum,gcd,lcm},%
+ frshortdatetonum,engshortdatetonum,englongdatetonum,frlongdatetonum,gcd,lcm,tag,cell,row,col},%
keywordstyle=\color{ST@keywordstc},classoffset=0}
%%%%%%%%%%% environnement OOcalc
@@ -167,6 +166,15 @@
\tableofcontents\newpage
\parskip\medskipamount
\section{Introduction}
+\subsection{Nouveau dans la version \csname ST@ver\endcsname}
+Voici les nouveautés de cette version :
+\begin{itemize}
+ \item avant de passer la main à l'environnement demandé par l'utilisateur, \ST ne travaille pas à l'intérieur d'un groupe de telle sorte que les calculs ne provoquent plus de ``save-stack error'' dans les tableaux de grande taille avec de nombreux calculs;
+ \item les commandes \verbinline-\spreadtab- et \verbinline-\endspreadtab- peuvent délimiter un tableau;
+ \item implémentation des macros fonctions ``\verbinline-tag-'', ``\verbinline-cell-'', ``\verbinline-row-'', ``\verbinline-col-'' et de la commande \verbinline-\STtag- (voir page~\pageref{tag});
+ \item la commande \verbinline-\STeol{<macro>}- permet de choisir quelle séquence de contrôle marquera les fins de lignes dans les tableaux de \ST (voir page~\pageref{STeol}).
+\end{itemize}
+
\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.
@@ -180,18 +188,29 @@ Par conséquent, \ST procède en 3 étapes :
\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}
-La syntaxe est la suivante :\par\nobreak
+Les deux syntaxes possibles (et équivalentes) sont les suivantes, où \verb-<nom>- représente le nom de n'importe quel environnement de type tableau disponible avec \LaTeX{} ou avec une extension :\par\nobreak
+\begin{minipage}{0.48\linewidth}
\begin{lstlisting}[backgroundcolor=\color{ST@codebckgcolor}]
-\begin{spreadtab}{{<nom de l'environnement>}<parametres de l'environnement>}
+\begin{spreadtab}{{<nom>}{<parametres>}}
tableau avec formules et nombres
\end{spreadtab}
\end{lstlisting}
+\end{minipage}\hfill ou\hfill
+\begin{minipage}{0.48\linewidth}
+\begin{lstlisting}[backgroundcolor=\color{ST@codebckgcolor}]
+\spreadtab{{<nom>}{<parametres>}}
+ tableau avec formules et nombres
+\endspreadtab
+\end{lstlisting}
+\end{minipage}
+
et après le travail de \ST, on obtient un affichage comme si l'on avait écrit :\par\nobreak
\begin{lstlisting}[backgroundcolor=\color{ST@codebckgcolor}]
-\begin{<nom de l'environnement>}<parametres de l'environnement>
+\begin{<nom>}{<parametres>}
tableau avec nombres
-\end{<nom de l'environnement>}
+\end{<nom>}
\end{lstlisting}
+
Même si disposer de fonctionnalités ressemblant à celles d'un tableur avec \LaTeX{} est appréciable, il ne faut pas perdre de vue que les 3 étapes décrites ci-dessus prennent du temps et surtout que \falseverb{fp} est lent dans ses calculs. L'ensemble conduit donc à des temps de compilation \emph{beaucoup plus importants} qu'avec un tableau classique.
Il faut ajouter que \ST \emph{ne peut remplacer un tableur}. En effet, ses possibilités sont très limitées. De plus, surtout pour des tableaux complexes ou de grande taille, le manque d'aide visuelle devient gênant\footnote{Ceci dit, je certifie qu'avec l'habitude, cette gêne tend à s'estomper (si l'on s'en tient à des tableaux raisonnables, bien sûr).}, et la syntaxe de \ST constitue aussi un obstacle supplémentaire. L'avantage de cette extension est de pouvoir écrire \emph{dans le code \LaTeX} des tableaux comportant des calculs, alors que ces tableaux sont généralement exportés\footnote{On peut signaler les 2 principaux programmes d'exportation : \href{http://calc2latex.sourceforge.net/}{\texttt{\textbf{cacl2latex}}} pour \og calc\fg{} de Open Office, et \href{http://www.ctan.org/tex-archive/support/excel2latex/}{\texttt{\textbf{excel2latex}}} pour \og excel\fg{} de Microsoft Office.} d'une feuille de calcul d'un tableur vers le code \LaTeX. On évite ainsi les désagréments des programmes d'exportation : mise en forme souvent à retoucher pour obtenir exactement ce que l'on veut, non compatibilité avec tous les environnements de tableaux, obtention de tableaux ne contenant que les valeurs (les formules sont perdues à l'exportation), exportation à recommencer si l'on modifie un seul nombre ou formule dans le tableau.
@@ -199,11 +218,13 @@ 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.
-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.
+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 à Andrew \textsc{Parsloe} pour la relecture et les corrections apportées à la traduction de ce manuel en anglais.
\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.
+\label{STeol}Par défaut, \ST considère qu'une ligne se termine avec ``\verb-\\-'' qui est habituel dans les tableaux. Ce marqueur de fin de ligne peut être modifié via la commande \verbinline-\STeol{<macro>}-. On peut par exemple écrire \verbinline-\STeol{\tabularnewline}-. Il faut bien comprendre que les fins de lignes qui seront insérées dans le tableau final seront toujours ``\verb-\\-'', même si le marqueur de fin de ligne lorsque \ST \emph{lit} le tableau a été modifié.
+
\subsection{Références absolues}
Dans le tableau, les cellules sont repérées par leur références absolues de cette façon :
\begin{itemize}
@@ -314,7 +335,7 @@ Voici un exemple :\par\nobreak
@ $f(x)=2x$ & 2*[0,-1] & 2*[0,-1] & 2*[0,-1] \\\hline
\end{spreadtab}
\end{center}
-Le caractère \og\falseverb @\fg{} est le développement de la séquence de contrôle \verbinline=\STtextcell=. On peut donc redéfinir cette séquence de contrôle en ce que l'on veut et par exemple, \verbinline-\renewcommand\STtextcell{\celltext}- fera qu'une cellule contenant \verb=\celltext= sera comprise comme étant une cellule de texte.
+Le caractère \og\falseverb @\fg{} est le développement de la séquence de contrôle \verbinline=\STtextcell=. On peut donc redéfinir cette séquence de contrôle en ce que l'on veut et par exemple, \verbinline-\renewcommand\STtextcell{`}- fera qu'une cellule contenant le caractère ``\verb=`='' sera comprise comme étant une cellule de texte.
De plus, si une cellule est vide ou entièrement constituée d'espaces, alors \ST la considérera comme une cellule de texte.
@@ -867,7 +888,7 @@ Les macro-fonctions \verbinline-randint- et \verbinline-rand- renvoient un nombr
\begin{lstlisting}[backgroundcolor=\color{ST@codebckgcolor}]
\makeatletter
\renewcommand\ST@seed{}% redefinit la macro interne
-\makeatletter
+\makeatother
\FPseed=27% donne une graine (n'importe quel entier) a fp
\end{lstlisting}
La macro fonction \verbinline-randint- renvoie une nombre \emph{entier} qui dépend des paramètres. La syntaxe est la suivante : \verbinline=randint([<nombre1>,]<nombre2>)=, où \verb=<nombre1>= est un entier optionnel qui vaut 0 par défaut. L'entier aléatoire renvoyé est compris dans l'intervalle \verb=[<nombre1>;<nombre2>]=.
@@ -1050,7 +1071,7 @@ frlongdatetonum(\today) & frlongdatetonum(25 décembre 2009)\\
\end{center}
\subsubsection{Passer d'un nombre à une date}
-Plusieurs macro-fonctions permettent de traduire un nombre en une donnée de date. Toutes ces macro-fonctions ont en commun que leur résultat est du \emph{texte}. Par conséquent, \emph{la cellule les contenant deviendra une cellule textuelle} dont le texte sera le résultat de cette fonction : si un texte cohabitait avec la formule dans cette cellule, il sera écrasé par le résultat. Il en résulte que la cellule ne peut plus faire l'objet d'aucun traitement mathématique ensuite.
+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, le résultat de la formule sera inséré à la place de \verb-:={<formule>}-. Il en résulte que la cellule ne peut plus faire l'objet d'aucun traitement mathématique ensuite.
Voici ces fonctions :
\begin{itemize}
@@ -1087,6 +1108,84 @@ Voici un exemple où l'on se place 1000 jours avant puis 1000 jours après le 1
\end{spreadtab}
\end{center}
+\subsection{Macro fonctions de coordonnées}\label{tag}
+Plutôt que de faire référence à une cellule par ses coordonnées qui sont difficiles à mémoriser et qui changent si on insère une ligne ou une colonne, il est parfois bien plus pratique de donner un nom à une cellule et d'y faire référence plus loin par ce nom.
+
+La macro fonction ``\verbinline-tag(<nom>)-'' a pour effet de nommer la cellule dans laquelle elle se trouve. Il ne s'agit pas vraiment d'une macro fonction comme les autres puisque ce qu'elle retourne rien lorsqu'elle est mise dans une formule : elle disparait sans provoquer aucun effet sur le résultat mathématique. On peut donc écrire ``\verbinline-tag(<nom>)-'' \emph{n'importe où} dans le champ numérique d'une cellule. Le \verb-<nom>- peut être n'importe quelle suite de caractères alphanumériques, mais il est déconseillé de mettre une lettre et un nombre, qui pourraient être compris comme une référence à une cellule, et serait donc modifié lors d'une opération de copie avec \verbinline-\STcopy-. Cette macro fonction a une action supplémentaire, elle sauvegarde via un \verbinline-\def- la valeur numérique de la cellule dans laquelle elle se trouve de façon à pouvoir y faire appel plus tard \emph{en dehors du tableau} via la commande purement développable \verbinline-\STtag{<nom>}-.
+
+Par la suite dans le tableau, au lieu de mettre les coordonnées de la cellule \verb-<nom>-, on peut écrire ``\verbinline-cell(<nom>)-'' qui est une macro fonction qui renvoit les coordonnées de la cellule précédemment nommée. Par exemple si ``\verbinline-tag(<nom>)-'' a été écrit dans la cellule ``\verb-B3-'' si on a écrit plus loin ``cell(<nom>)'', cette macro fonction renvoit \verb-B3-.
+
+Voici un exemple où l'on fait la somme de cellules et l'on donne le nom ``\verb-foo-'' au premier nombre et le nom ``\verb-bar-'' au dernier. On peut observer que \verbinline-tag(foo)- se trouve entre ``1'' et ``9'' et qu'au final, puisque cette macro fonction disparait, le champ numérique de la cellule contiendra ``19'' :
+\begin{lstlisting}
+\begin{spreadtab}{{tabular}{r@{}r}}
+ & 15tag(foo) \\
+@+ & 37 \\
+@+ & 13 \\
+@+ & 48 \\
+@+ & 1tag(bar)9 \\\cline{2-2}
+ & sum(cell(foo):cell(bar))tag(baz)
+\end{spreadtab}
+
+foo=\STtag{foo}, bar=\STtag{bar}, baz=\STtag{baz}
+\end{lstlisting}
+\begin{center}
+\begin{spreadtab}{{tabular}{r@{}r}}
+ & 15tag(foo) \\
+@+ & 37 \\
+@+ & 13 \\
+@+ & 48 \\
+@+ & 1tag(bar)9 \\\cline{2-2}
+ & sum(cell(foo):cell(bar))tag(baz)
+\end{spreadtab}
+
+foo=\STtag{foo}, bar=\STtag{bar}, baz=\STtag{baz}
+\end{center}
+Lorsque l'environnement \ST se trouve inclus dans un autre environnement, les affectations faites par la macro fonction \verb-tag- restent \emph{locales} à cet environnement et ne pourraient pas être accessibles en dehors de cet environnement via \verbinline-\STtag-. Dans l'exemple ci-dessous, le tableau fait par \ST est dans un environnement \verb-center- et l'on doit donc utiliser \verbinline-\STmakegtag{<nom>}- pour rendre global la sauvegarde de la valeur numérique contenus dans la cellule marquée par ``tag{<nom>}'' :
+
+\begin{minipage}{.6\linewidth}
+\begin{lstlisting}
+\begin{center}
+ \begin{spreadtab}{{tabular}{cccc}}\hline
+ 6&9&17&21\\\hline
+ \multicolumn{4}{c}{moyenne = :={sum(a1:d1)/4tag(moy)}}
+ \end{spreadtab}
+ \STmakegtag{moy}
+\end{center}
+La moyenne est de \STtag{moy}.
+\end{lstlisting}
+\end{minipage}\kern6pt
+\begin{minipage}{.3\linewidth}
+\begin{center}
+ \begin{spreadtab}{{tabular}{cccc}}\hline
+ 6&9&17&21\\\hline
+ \multicolumn{4}{c}{moyenne = :={sum(a1:d1)/4tag(moy)}}
+ \end{spreadtab}
+ \STmakegtag{moy}
+\end{center}
+La moyenne est de \STtag{moy}.
+\end{minipage}
+
+L'argument de \verbinline-\STmakegtag- peut êre constitué de plusieurs noms séparés par des virgules.
+
+Bien qu'elles soient à première vue moins utiles, \ST fournit également les macros fonctions ``\verbinline-row(<nom>)-'' et ``\verbinline-col(<nom>)-'' qui renvoient le numéro de la ligne ou de la colonne où se trouvait \verbinline-tag(<nom>)-. Voici par exemple une façon de dénombrer des valeurs pour en calculer la moyenne : on nomme ``un'' la première valeur et ``der'' la dernière, et le nombre de valeurs est donc row(der)-row(un)+1 :
+
+\begin{minipage}{0.6\linewidth}
+\begin{lstlisting}
+moyenne = \begin{spreadtab}{{tabular}[b]{r}}
+7tag(un)\\9\\15\\6\\20\\13\\11\\55tag(der)\\
+\hline
+sum(cell(un):cell(der))/(row(der)-row(un)+1)
+\end{spreadtab}
+\end{lstlisting}
+\end{minipage}\hfill
+\begin{minipage}{0.35\linewidth}
+moyenne = \begin{spreadtab}{{tabular}[b]{r}}
+7tag(un)\\9\\15\\6\\20\\13\\11\\55tag(der)\\
+\hline
+sum(cell(un):cell(der))/(row(der)-row(un)+1)
+\end{spreadtab}
+\end{minipage}
+
\section{Précautions particulières}
\subsection{Redéfinition des commandes de filets horizontaux}
On peut être tenté de définir une commande pour produire ---~par exemple~--- une double ligne horizontale :\par\nobreak
@@ -1151,14 +1250,14 @@ Prenons un exemple, et mettons que dans le tableau suivant, on fusionne les cell
\end{center}
Il y a 4 cellules \emph{visibles} fusionnées, on écrira donc \verbinline-\multicolumn{4}- car on ne tient \emph{jamais} compte des colonnes masquées dans le décompte du nombre de cellules à fusionner.
-Maintenant, on compte 4 lettres à partir de la lettre \falseverb{b} en l'incluant dans le décompte. On arrive à la lettre \falseverb{e} : cela détermine un intervalle de colonnes \og\falseverb{b-e}\fg. Dans cet intervalle, 2 colonnes masquées sont incluses (\falseverb c et \falseverb d) et 1 colonne masquée n'est pas comprise (\falseverb f). Ces 2 nombres sont importants pour comprendre la suite, aussi, notons-les $a$ et $b$ dans le cas général.
+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 $x$ et $y$ dans le cas général.
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}).
+ \item il faut rajouter $y$ 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 $x$ 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}
-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
+Voici un vrai exemple dont la structure est similaire au précédent : $x=2$ et $y=1$. Dans le code, remarquer le \og\textcolor{red}{\texttt{\&}}\fg{} qui a été ajouté puisque $y=1$. Par ailleurs, on reste simple avec les formules, on ajoute 1 au nombre du dessus :\par\nobreak
\begin{lstlisting}[escapechar=Z]
\begin{spreadtab}{{tabular}{|*{7}{c|}}}
\hline
@@ -1175,7 +1274,7 @@ a1+1& \multicolumn4{l|}{:={b1+1}}& & i1+1 & j1+1\\\hl
a2+1& b2+1 & & & & & & & g2+1 & h2+1\\\hline
\end{spreadtab}
\end{center}
-Voici encore un exemple similaire où une seule colonne est masquée (la colonne \falseverb d), et où $a=1$ et $b=0$ :\par\nobreak
+Voici encore un exemple similaire où une seule colonne est masquée (la colonne \falseverb d), et où $x=1$ et $y=0$ :\par\nobreak
\begin{lstlisting}
\begin{spreadtab}{{tabular}{|*{9}{c|}}}
\hline
@@ -1453,7 +1552,6 @@ Ce tableau est généré par l'environnement \verb=tabularx= de façon à occupe
\cline{4-6}
\end{spreadtab}
\end{center}
-\bigskip
\subsection{Carré magique}
\begin{lstlisting}
diff --git a/Master/texmf-dist/tex/latex/spreadtab/spreadtab.sty b/Master/texmf-dist/tex/latex/spreadtab/spreadtab.sty
index 39cd205b573..b7bfbfba56a 100644
--- a/Master/texmf-dist/tex/latex/spreadtab/spreadtab.sty
+++ b/Master/texmf-dist/tex/latex/spreadtab/spreadtab.sty
@@ -1,9 +1,9 @@
% ____________________________________________________________________________
% | |
% | |
-% | spreadtab v0.3c |
+% | spreadtab v0.4 |
% | |
-% | April 8, 2011 |
+% | 4 July 2011 |
% | |
% |___________________________________________________________________________|
%
@@ -19,15 +19,15 @@
% spreadtab_doc_en.tex, spreadtab_doc_en.pdf (manual in english)
%
% -------------------------------------------------------------------
-% 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.
+% 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.
+% and version 1.3 or later is part of all distributions of LaTeX version
+% 2005/12/01 or later.
% -------------------------------------------------------------------
% This work has the LPPL maintenance status `maintained'.
%
@@ -35,17 +35,17 @@
% -------------------------------------------------------------------
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%% D\'efinitions pr\'ealables %%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%% D\'efinitions pr\'ealables %%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\newcommand\ST@ver {0.3c}
-\newcommand\ST@date {2011/04/08}
-\newcommand\ST@fr@date {8 avril 2011}
-\newcommand\ST@eng@date{April $8^\text{th}$ 2011}
+\newcommand\ST@ver {0.4}
+\newcommand\ST@date {2011/07/04}
+\newcommand\ST@fr@date {4 juillet 2011}
+\newcommand\ST@eng@date{4 July 2011}
\ProvidesPackage{spreadtab}[\ST@date\space v\ST@ver\space Spreadsheet features for table environments]
\NeedsTeXFormat{LaTeX2e}
\RequirePackage{fp}% pour les calculs scientifiques
-\RequirePackage{xstring}[2010/0/28]% version n\'ecessaire
+\RequirePackage{xstring}[2010/03/28]% version n\'ecessaire
\newcount\ST@count
\newcount\ST@colcount
@@ -60,107 +60,113 @@
\AtBeginDocument{\@ifpackageloaded{colortbl}\ST@colortblloadedtrue\ST@colortblloadedfalse}
% D\'efinit le marqueur qui signale le commencement du champ num\'erique
-\newcommand\STnumericfieldmarker{:=}
+\newcommand*\STnumericfieldmarker{:=}
% D\'efinit la macro qui va afficher les valeurs num\'eriques dans le tableau
\newcommand\STprintnum[1]{#1}
% D\'efinit les caract\`eres entre lesquels doivent entre envelopp\'ees les r\'ef\'erences des cellules
% que l'on veut afficher dans les champs textuels
-\newcommand\STsetdisplaymarks[2]{%
+\newcommand*\STsetdisplaymarks[2]{%
\def\ST@startdisplay{#1}\def\ST@enddisplay{#2}%
}
\STsetdisplaymarks{<<}{>>}% d\'elimiteurs par d\'efaut
% d\'efinit le marqueur qui signale une cellule de texte
-\makeatother\newcommand\STtextcell{@}\makeatletter
+\makeatother\newcommand*\STtextcell{@}\makeatletter
% Commande qui permet \'a l'utilisateur de d\'efinir le caract\`ere qui conserve une r\'ef\'erence lors de la copie d'une formule
-\AtBeginDocument{\newcommand\STtransposecar{!}}
+\AtBeginDocument{\newcommand*\STtransposecar{!}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Messages d'erreur %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newif\ifST@message
-\newcommand\ST@errname{[spreadtab] }
+\def\ST@package@name{spreadtab}
-\newcommand\STmessage[1]{% #1 = true ou false pour autoriser ou pas les messages
+\newcommand*\STmessage[1]{% #1 = true ou false pour autoriser ou pas les messages
\csname ST@message#1\endcsname
}
-\newcommand\ST@emit@message[1]{\ifST@message\message{#1}\fi}
+\newcommand*\ST@emit@message[1]{\ifST@message\message{#1}\fi}
-\newcommand\ST@seedoc@i{Please, read the manual.}
+\newcommand*\ST@seedoc@i{Please, read the manual.}
-\newcommand\ST@circular@reference{%
+\newcommand*\ST@circular@reference{%
\ST@coord@toref\ST@coord
\let\ST@deptree\@empty
\ST@show@dependance@tree
- \@latex@error{\ST@errname circular reference found in cell \ST@coord!^^J
+ \PackageError\ST@package@name{circular reference found in cell \ST@coord!^^J
Here is its dependant cells: \ST@deptree}\ST@seedoc@i\stop
}
-\newcommand\ST@undefined@cell{%
+\newcommand*\ST@undefined@cell{%
\ST@coord@toref\ST@temp@callcell
\ST@coord@toref\ST@coord
- \@latex@error{\ST@errname Undefined reference!^^J
+ \PackageError\ST@package@name{Undefined reference!^^J
Cell \ST@temp@callcell\space contains a reference to an undefined cell: \ST@coord}\ST@seedoc@i\stop
}
-\newcommand\ST@zerocodecell@cell{%
+\newcommand*\ST@zerocodecell@cell{%
\ST@coord@toref\ST@temp@callcell
\ST@coord@toref\ST@coord
- \@latex@error{\ST@errname A reference to a non-numeric or empty cell is not allowed!^^J
+ \PackageError\ST@package@name{A reference to a non-numeric or empty cell is not allowed!^^J
Cell \ST@temp@callcell\space contains a reference to an empty or text cell: \ST@coord}\ST@seedoc@i\stop
}
-\newcommand\ST@multicol@cell{%
+\newcommand*\ST@multicol@cell{%
\ST@coord@toref\ST@temp@callcell
\ST@coord@toref\ST@coord
- \@latex@error{\ST@errname Cell \ST@temp@callcell\space contains a reference to a merged \string\multicolumn\space cell: \ST@coord}\ST@seedoc@i\stop
+ \PackageError\ST@package@name{Cell \ST@temp@callcell\space contains a reference to a merged \string\multicolumn\space cell: \ST@coord}\ST@seedoc@i
}
-\newcommand\ST@illegal@relativeref{%
+\newcommand*\ST@illegal@relativeref{%
\edef\ST@temp@callcell{\ST@current@colnumber,\ST@current@rownumber}%
\ST@coord@toref\ST@temp@callcell
- \@latex@error{\ST@errname Illegal relative reference found in cell \ST@temp@callcell!}\ST@seedoc@i
+ \PackageError\ST@package@name{Illegal relative reference found in cell \ST@temp@callcell!}\ST@seedoc@i\stop
}
-\newcommand\ST@illegal@ref{%
- \@latex@error{\ST@errname Illegal reference in \string\STsavecell!}\ST@seedoc@i
+\newcommand*\ST@illegal@ref{%
+ \PackageError\ST@package@name{Illegal reference in \string\STsavecell!}\ST@seedoc@i
}
-\newcommand\ST@unmatch@matrixdim{%
+\newcommand*\ST@unmatch@matrixdim{%
\edef\ST@temp@callcell{\ST@current@colnumber,\ST@current@rownumber}%
\ST@coord@toref\ST@temp@callcell
- \@latex@error{\ST@errname Somprod dimension of matrix do not match in cell \ST@temp@callcell!}\ST@seedoc@i
+ \PackageError\ST@package@name{Somprod dimension of matrix do not match in cell \ST@temp@callcell!}\ST@seedoc@i
}
-\newcommand\ST@fact@outofrange{%
- \@latex@error{\ST@errname Argument of fact is not integer or is out of range!}\ST@seedoc@i
+\newcommand*\ST@fact@outofrange{%
+ \PackageError\ST@package@name{Argument of fact is not integer or is out of range!}\ST@seedoc@i
}
\newcommand\ST@invalid@date{%
\edef\ST@temp@callcell{\ST@current@colnumber,\ST@current@rownumber}%
\ST@coord@toref\ST@temp@callcell
- \@latex@error{\ST@errname Invalid date in cell \ST@temp@callcell.}\ST@seedoc@i
+ \PackageError\ST@package@name{Invalid date in cell \ST@temp@callcell.}\ST@seedoc@i
}
-\newcommand\ST@invalid@range{%
+\newcommand*\ST@invalid@range{%
\edef\ST@temp@callcell{\ST@current@colnumber,\ST@current@rownumber}%
\ST@coord@toref\ST@temp@callcell
- \@latex@error{\ST@errname Invalid range in cell \ST@temp@callcell.}\ST@seedoc@i\stop
+ \PackageError\ST@package@name{Invalid range in cell \ST@temp@callcell.}\ST@seedoc@i\stop
}
-\newcommand\ST@invalidSTcopy{%
+\newcommand*\ST@invalidSTcopy{%
\edef\ST@temp@callcell{\ST@current@colnumber,\ST@current@rownumber}%
\ST@coord@toref\ST@temp@callcell
- \@latex@error{\ST@errname Numeric field marker found, \string\STcopy\space forbidden in cell \ST@temp@callcell.}\ST@seedoc@i\stop
+ \PackageError\ST@package@name{Numeric field marker found, \string\STcopy\space forbidden in cell \ST@temp@callcell.}\ST@seedoc@i\stop
+}
+
+\newcommand*\ST@unknown@tag{%
+ \edef\ST@temp@callcell{\ST@current@colnumber,\ST@current@rownumber}%
+ \ST@coord@toref\ST@temp@callcell
+ \PackageError\ST@package@name{Undefined tag in cell \ST@temp@callcell.}\ST@seedoc@i
}
% transforme la chaine de cellules "(1,3)(4,5)(3,2)(1,3)" rencontr\'e en r\'ef\'erence circulaire en "A3-D5-C2-A3"
-\newcommand\ST@show@dependance@tree{%
+\newcommand*\ST@show@dependance@tree{%
\ST@between\ST@dependance@tree()\ST@currentref
\ST@right\ST@dependance@tree)\ST@dependance@tree
\ST@coord@toref\ST@currentref
@@ -172,30 +178,26 @@
}
% transforme la s\'equence de contrôle #1 qui contient par exemple «4,5» en «D5»
-\newcommand\ST@coord@toref[1]{%
+\newcommand*\ST@coord@toref[1]{%
\ST@split#1,\ST@temp@a#1%
\edef#1{\ifcase\ST@temp@a\or A\or B\or C\or D\or E\or F\or G\or H\or I\or J\or K\or L\or M\or
N\or O\or P\or Q\or R\or S\or T\or U\or V\or W\or X\or Y\or Z\fi#1}%
}
-\newcommand\ST@illegal@copy{%
- \@latex@error{\ST@errname Illegal reference in copied formula!}\ST@seedoc@i
+\newcommand*\ST@illegal@copy{%
+ \PackageError\ST@package@name{Illegal reference in copied formula!}\ST@seedoc@i
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%% Macros d'affectation et d'expansion %%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\newcommand\ST@letname[1]{\expandafter\let\csname#1\endcsname}
+\newcommand*\ST@letname[1]{\expandafter\let\csname#1\endcsname}
\newcommand\ST@exp@two@args[3]{%
- \begingroup
- \def\ST@tmpstr{#1}%
- \ST@expadd@tomacro\ST@tmpstr{\expandafter{#2}}%
- \ST@expadd@tomacro\ST@tmpstr{\expandafter{#3}}%
- \expandafter\endgroup
- \ST@tmpstr
-% \expandafter\def\expandafter\ST@tmpstr\expandafter{\expandafter#1\expandafter{#2}}%
-% \expandafter\ST@tmpstr\expandafter{#3}%
+ \def\ST@tmp@{#1}%
+ \ST@expadd@tomacro\ST@tmp@{\expandafter{#2}}%
+ \ST@expadd@tomacro\ST@tmp@{\expandafter{#3}}%
+ \ST@tmp@
}
\newcommand\ST@add@tomacro[2]{\expandafter\def\expandafter#1\expandafter{#1#2}}
@@ -203,8 +205,7 @@
\newcommand\ST@expadd@tomacro[2]{\expandafter\ST@add@tomacro\expandafter#1\expandafter{#2}}
\newcommand\ST@edefadd@tomacro[2]{%
- \begingroup\edef\ST@tmpstr{#2}\expandafter\endgroup
- \expandafter\ST@add@tomacro\expandafter#1\expandafter{\ST@tmpstr}%
+ \edef#1{\unexpanded\expandafter{#1}#2}%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -216,7 +217,7 @@
}
\def\ST@gobble@remain@i{%
- \unless\ifx\ST@toks\relax\expandafter\ST@gobble@remain\fi
+ \unless\ifx\ST@toks\ST@nil\expandafter\ST@gobble@remain\fi
}
\newcommand\ST@splitatfirstcar[3]{%
@@ -323,6 +324,18 @@
\newcommand\ST@removespaces[1]{\ST@subst#1{ }{}}
+\newcommand\ST@ifvalid@csname[1]{%
+ \ifcsname#1\endcsname
+ \expandafter\ifx\csname#1\endcsname\ST@undef@content
+ \expandafter\expandafter\expandafter\@secondoftwo
+ \else
+ \expandafter\expandafter\expandafter\@firstoftwo
+ \fi
+ \else
+ \expandafter\@secondoftwo
+ \fi
+}
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Lecture du tableau %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -330,31 +343,32 @@
\newcommand\ST@read@tab{%
\def\ST@total@colnumber{0}%
\ST@rowcount\z@
- \ST@search@hline\ST@tab% on met de côt\'e la (ou les) ligne sup\'erieure du tableau
+ \ST@search@hline% on met de côt\'e la (ou les) ligne sup\'erieure du tableau
\ST@read@tab@i
}
\newcommand\ST@read@tab@i{%
\advance\ST@rowcount\@ne
- \ST@Ifinstr\ST@tab{\@empty\\}% si contient \\, il reste encore des lignes
- {\ST@split\ST@tab\\\ST@current@row\ST@tab
- \@namedef{endrow@\number\ST@rowcount}{\\}% est la fin de cette ligne, pour l'instant
- \ST@Iffirstis\ST@tab[% on prend en compte l'\'eventuel argument optionnel de \\
+ \ST@Ifinstr\ST@tab{\ST@eol}% si contient \\, il reste encore des lignes
+ {\expandafter\ST@split\expandafter\ST@tab\expandafter{\ST@eol}\ST@current@row\ST@tab
+ \@namedef{endrow@\number\ST@rowcount\expandafter}\expandafter{\ST@eol}% est la fin de cette ligne, pour l'instant
+ \ST@Iffirstis\ST@tab[% on prend en compte l'\'eventuel argument optionnel de \\
{\ST@between\ST@tab[]\ST@temp@a% prend ce qui est entre crochet
- \ST@Ifinstr\ST@temp@a,% si c'est une r\'ef\'erence (on teste juste la pr\'esence de la virgule, ça devrait suffire)
- \relax% on ne fait rien
- {\ST@split\ST@tab]\ST@temp@a\ST@tab% sinon, coupe au crocher fermant
- \expandafter\ST@expadd@tomacro\csname endrow@\number\ST@rowcount\endcsname{\ST@temp@a]}}% ajoute l'argument optionnel \'a la fin de ligne
- }%
- \relax
- \ST@search@hline\ST@tab% on va purger les hlines et les mettre dans la fin de ligne
- \ifx\ST@tab\@empty\let\ST@next@readrows\relax\edef\ST@total@rownumber{\number\ST@rowcount}\else\let\ST@next@readrows\ST@read@tab@i\fi}%
+ \ST@Ifinstr\ST@temp@a,% si c'est une r\'ef\'erence (on teste juste la pr\'esence de la virgule, ça devrait suffire)
+ \relax% on ne fait rien
+ {\ST@split\ST@tab]\ST@temp@a\ST@tab% sinon, coupe au crocher fermant
+ \expandafter\ST@expadd@tomacro\csname endrow@\number\ST@rowcount\endcsname{\ST@temp@a]}}% ajoute l'argument optionnel \'a la fin de ligne
+ }%
+ \relax
+ \ST@search@hline% on va purger les hlines et les mettre dans la fin de ligne
+ \ifx\ST@tab\@empty\let\ST@next@readrows\relax\edef\ST@total@rownumber{\number\ST@rowcount}\else\let\ST@next@readrows\ST@read@tab@i\fi
+ }%
{\let\ST@current@row\ST@tab% plus de ligne ? on prend le tout c-\'a-d la ligne incompl\`ete qui finit le tableau
- \let\ST@next@readrows\relax
- \edef\ST@total@rownumber{\number\ST@rowcount}}%
+ \let\ST@next@readrows\relax
+ \edef\ST@total@rownumber{\number\ST@rowcount}}%
\ST@Ifinstr\ST@current@row{\@empty\SThiderow}% il est demand\'e de masquer la colonne ?
{\edef\ST@row@skiplist{(\number\ST@rowcount)\ST@row@skiplist}% on ajoute le num\'ero de ligne \'a masquer \'a la skiplist
- \StrDel\ST@current@row{\@empty\SThiderow}[\ST@current@row]%
+ \StrDel\ST@current@row{\@empty\SThiderow}[\ST@current@row]%
}%
\relax
\ST@colcount\z@
@@ -368,17 +382,17 @@
\advance\ST@colcount\@ne
\ST@Ifinstr\ST@current@row&%
{\ST@split\ST@current@row&\ST@current@cell\ST@current@row
- \let\ST@next@readcells\ST@read@cells}%
+ \let\ST@next@readcells\ST@read@cells}%
{\let\ST@current@cell\ST@current@row
- \let\ST@next@readcells\relax
- \ifnum\ST@colcount>\ST@total@colnumber\edef\ST@total@colnumber{\number\ST@colcount}\fi}%
+ \let\ST@next@readcells\relax
+ \ifnum\ST@colcount>\ST@total@colnumber\edef\ST@total@colnumber{\number\ST@colcount}\fi}%
\ST@Ifinstr\ST@current@cell{\@empty\SThidecol}% on doit masquer cette colonnes ?
{\ST@Ifinstr\ST@col@skiplist{\expandafter(\number\ST@colcount)}% ça a d\'ej\'a \'et\'e demand\'e ?
\relax% on fait rien
{\edef\ST@col@skiplist{(\number\ST@colcount)\ST@col@skiplist}% sinon -> ajout \'a la skiplist
- \ifnum\ST@colcount>\ST@last@skipcol\edef\ST@last@skipcol{\number\ST@colcount}\fi
+ \ifnum\ST@colcount>\ST@last@skipcol\edef\ST@last@skipcol{\number\ST@colcount}\fi
}%
- \StrDel\ST@current@cell{\@empty\SThidecol}[\ST@current@cell]%
+ \StrDel\ST@current@cell{\@empty\SThidecol}[\ST@current@cell]%
}%
\relax
\exploregroups
@@ -387,82 +401,83 @@
{\let\ST@multicol@number\@empty}%
\IfSubStr\ST@current@cell\STnumericfieldmarker% il y a un marqueur de champ num\'erique ?
{\IfSubStr\ST@current@cell{\@empty\STcopy}\ST@invalidSTcopy\relax% s'il y a un \STcopy, erreur (pas de champ num\'erique et de \STcopy dans une m\^eme cellule)
- \StrBehind\ST@current@cell\STnumericfieldmarker[\ST@current@formula]%
- \noexploregroups
- \StrChar\ST@current@formula1[\ST@temp@a]% \ST@temp@a contient {<formule}
- \exploregroups
- \let\ST@temp@b\STnumericfieldmarker
- \ST@expadd@tomacro\ST@temp@b\ST@temp@a
- \StrSubstitute[1]\ST@current@cell\ST@temp@b\STnumericfieldmarker[\ST@current@cell]% on remplace \={<formule>} par ":="
- \noexploregroups
- \ST@keep@firstcar\ST@temp@a% dans la formule, on enl\`eve les accolades
- \ST@removespaces\ST@temp@a% et tous les espaces
- \ifx\ST@temp@a\@empty% \ST@temp@a contient la formule : si la formule est vide
- \ifx\ST@copylist\@empty% pas de copylist ?
- \@namedef{code@\number\ST@colcount @\number\ST@rowcount}{0}% met le code \'a 0
- \else% si la copylist existe
- \ST@lookincopylist{\number\ST@colcount}{\number\ST@rowcount}\ST@celltocopy% on cherche si la cellule en cours est dans une plage de copie
- \ifx\ST@celltocopy\@empty
- \@namedef{code@\number\ST@colcount @\number\ST@rowcount}{0}% si c'est non, met le code \'a 0
- \StrDel[1]\ST@current@cell\STnumericfieldmarker[\ST@current@cell]% on supprime aussi ":="
- \else
- \ST@letname{formula@\number\ST@colcount @\number\ST@rowcount}\ST@celltocopy% il y a une cellule \'a copier : on l'assigne au champ num\'erique
- \@namedef{code@\number\ST@colcount @\number\ST@rowcount}{1}% et on met le code \'a 1
- \fi
- \fi
- \else% la formule n'est pas vide
- \ST@letname{formula@\number\ST@colcount @\number\ST@rowcount}\ST@temp@a% et on assigne \'a la formule
- \@namedef{code@\number\ST@colcount @\number\ST@rowcount}{1}% code 1 \'a priori
- \fi
+ \StrBehind\ST@current@cell\STnumericfieldmarker[\ST@current@formula]%
+ \noexploregroups
+ \StrChar\ST@current@formula1[\ST@temp@a]% \ST@temp@a contient {<formule}
+ \exploregroups
+ \let\ST@temp@b\STnumericfieldmarker
+ \ST@expadd@tomacro\ST@temp@b\ST@temp@a
+ \StrSubstitute[1]\ST@current@cell\ST@temp@b\STnumericfieldmarker[\ST@current@cell]% on remplace :={<formule>} par ":="
+ \noexploregroups
+ \ST@keep@firstcar\ST@temp@a% dans la formule, on enl\`eve les accolades
+ \ST@removespaces\ST@temp@a% et tous les espaces
+ \ifx\ST@temp@a\@empty% \ST@temp@a contient la formule : si la formule est vide
+ \ifx\ST@copylist\@empty% pas de copylist ?
+ \@namedef{code@\number\ST@colcount @\number\ST@rowcount}{0}% met le code \'a 0
+ \else% si la copylist existe
+ \ST@lookincopylist{\number\ST@colcount}{\number\ST@rowcount}\ST@celltocopy% on cherche si la cellule en cours est dans une plage de copie
+ \ifx\ST@celltocopy\@empty
+ \@namedef{code@\number\ST@colcount @\number\ST@rowcount}{0}% si c'est non, met le code \'a 0
+ \StrDel[1]\ST@current@cell\STnumericfieldmarker[\ST@current@cell]% on supprime aussi ":="
+ \else
+ \ST@letname{formula@\number\ST@colcount @\number\ST@rowcount}\ST@celltocopy% il y a une cellule \'a copier : on l'assigne au champ num\'erique
+ \@namedef{code@\number\ST@colcount @\number\ST@rowcount}{1}% et on met le code \'a 1
+ \fi
+ \fi
+ \else% la formule n'est pas vide
+ \ST@letname{formula@\number\ST@colcount @\number\ST@rowcount}\ST@temp@a% et on assigne \'a la formule
+ \@namedef{code@\number\ST@colcount @\number\ST@rowcount}{1}% code 1 \'a priori
+ \fi
}% ci dessous, il n'y a pas de marqueur de champ num\'erique
{\IfSubStr\ST@current@cell\STtextcell% si c'est une cellule de texte
{\StrDel\ST@current@cell\STtextcell[\ST@current@cell]% on le(s) supprime les flags
- \@namedef{code@\number\ST@colcount @\number\ST@rowcount}{0}% met le code \'a 0
+ \@namedef{code@\number\ST@colcount @\number\ST@rowcount}{0}% met le code \'a 0
}% ci dessous, ce n'est pas une cellule texte, c'est donc une cellule purement champ num\'erique sans marqueur
{\StrDel\ST@current@cell\space[\ST@temp@a]%
- \ifx\@empty\ST@temp@a% il n'y a que des espaces, c'est donc une cellule vide
+ \ifx\@empty\ST@temp@a% il n'y a que des espaces, c'est donc une cellule vide
\ifx\ST@copylist\@empty% pas de copylist ?
\@namedef{code@\number\ST@colcount @\number\ST@rowcount}{0}% met le code \'a 0
\else% si la copylist existe
- \ST@lookincopylist{\number\ST@colcount}{\number\ST@rowcount}\ST@celltocopy% on cherche si la cellule en cours est dans un oplage de copie
- \ifx\ST@celltocopy\@empty
- \@namedef{code@\number\ST@colcount @\number\ST@rowcount}{0}% si c'est non, met le code \'a 0
- \else
- \let\ST@current@cell\STnumericfieldmarker% il y a une cellule \'a copier ici
- \ST@letname{formula@\number\ST@colcount @\number\ST@rowcount}\ST@celltocopy% on l'assigne au champ num\'erique
- \@namedef{code@\number\ST@colcount @\number\ST@rowcount}{1}% et on met le code \'a 1
- \fi
- \fi
- \else% ici, la cellule est compos\'ee d'une champ num\'erique sans marqueur
- \@namedef{code@\number\ST@colcount @\number\ST@rowcount}{1}% toute la cellule est consid\'er\'ee comme champ num\'erique
- \ST@remove@first@spaces\ST@current@cell
- \ST@Ifinstr\ST@current@cell{\@empty\STcopy}%
- {\ST@findcopyargs\ST@current@cell\ST@copyrange\ST@copyformula% on chope les arguments de \STcopy
- \ST@seekcopyoffset\ST@copyrange% cherche les d\'ecalages
- \edef\ST@copyrange{\ST@hoffest,\ST@voffest}% et affecte sous forme a,b o\`u a et b sont des nombres ou sont vides
- \expandafter\def\expandafter\ST@newtocopylist\expandafter{\expandafter|\ST@copyformula|}% \ST@newtocopylist est le nouvel \'el\'ement \'a ajouter \'a la copylist
- \ST@edefadd@tomacro\ST@newtocopylist{[\number\ST@colcount,\number\ST@rowcount]}%
- \ST@expadd@tomacro\ST@newtocopylist{\expandafter(\ST@copyrange)}%
- \ST@expadd@tomacro\ST@newtocopylist\ST@copylist% ajoute la copylist \'a la fin
- \let\ST@copylist\ST@newtocopylist% et l'assigne \'a copylist
- \ST@transposeformula00\ST@copyformula\ST@copyformula% on transpose \'eventuellement pour g\'erer les "!"
- \ST@letname{formula@\number\ST@colcount @\number\ST@rowcount}\ST@copyformula% affecte la formule inchang\'ee au champ num\'erique courant
- }%
- {\ST@letname{formula@\number\ST@colcount @\number\ST@rowcount}\ST@current@cell% et on assigne toute la cellule
- \let\ST@current@cell\STnumericfieldmarker}%% et on met le flag pour la formule
- \fi
+ \ST@lookincopylist{\number\ST@colcount}{\number\ST@rowcount}\ST@celltocopy% on cherche si la cellule en cours est dans un oplage de copie
+ \ifx\ST@celltocopy\@empty
+ \@namedef{code@\number\ST@colcount @\number\ST@rowcount}{0}% si c'est non, met le code \'a 0
+ \else
+ \let\ST@current@cell\STnumericfieldmarker% il y a une cellule \'a copier ici
+ \ST@letname{formula@\number\ST@colcount @\number\ST@rowcount}\ST@celltocopy% on l'assigne au champ num\'erique
+ \@namedef{code@\number\ST@colcount @\number\ST@rowcount}{1}% et on met le code \'a 1
+ \fi
+ \fi
+ \else% ici, la cellule est compos\'ee d'une champ num\'erique sans marqueur
+ \@namedef{code@\number\ST@colcount @\number\ST@rowcount}{1}% toute la cellule est consid\'er\'ee comme champ num\'erique
+ \ST@remove@first@spaces\ST@current@cell
+ \ST@Ifinstr\ST@current@cell{\@empty\STcopy}%
+ {\ST@findcopyargs\ST@current@cell\ST@copyrange\ST@copyformula% on chope les arguments de \STcopy
+ \ST@seekcopyoffset\ST@copyrange% cherche les d\'ecalages
+ \edef\ST@copyrange{\ST@hoffest,\ST@voffest}% et affecte sous forme a,b o\`u a et b sont des nombres ou sont vides
+ \expandafter\def\expandafter\ST@newtocopylist\expandafter{\expandafter|\ST@copyformula|}% \ST@newtocopylist est le nouvel \'el\'ement \'a ajouter \'a la copylist
+ \ST@edefadd@tomacro\ST@newtocopylist{[\number\ST@colcount,\number\ST@rowcount]}%
+ \ST@expadd@tomacro\ST@newtocopylist{\expandafter(\ST@copyrange)}%
+ \ST@expadd@tomacro\ST@newtocopylist\ST@copylist% ajoute la copylist \'a la fin
+ \let\ST@copylist\ST@newtocopylist% et l'assigne \'a copylist
+ \ST@transposeformula00\ST@copyformula\ST@copyformula% on transpose \'eventuellement pour g\'erer les "!"
+ \ST@letname{formula@\number\ST@colcount @\number\ST@rowcount}\ST@copyformula% affecte la formule inchang\'ee au champ num\'erique courant
+ }%
+ {\ST@letname{formula@\number\ST@colcount @\number\ST@rowcount}\ST@current@cell% et on assigne toute la cellule
+ \let\ST@current@cell\STnumericfieldmarker% et on met le flag pour la formule
+ }%
+ \fi
}%
}%
\noexploregroups
- \unless\ifnum\csname code@\number\ST@colcount @\number\ST@rowcount\endcsname=\z@% si le code est <> 0
- \ST@try@calc@cell(\number\ST@colcount,\number\ST@rowcount)% on essaie de calculer la cellule
+ \ifnum\csname code@\number\ST@colcount @\number\ST@rowcount\endcsname>\z@% si le code est > 0
+ \ST@try@calc@cell(\number\ST@colcount,\number\ST@rowcount)% on essaie de calculer la cellule
\fi
\ST@letname{text@\number\ST@colcount @\number\ST@rowcount}\ST@current@cell
\unless\ifx\@empty\ST@multicol@number% si c'est une cellule qui contient \multicolumn
\loop% on met tous les codes des cellules fusion\'ees qui suivent la cellule en cours \'a -1
\ifnum\ST@multicol@number>\@ne
\edef\ST@multicol@number{\number\numexpr\ST@multicol@number-1}%
- \advance\ST@colcount1
+ \advance\ST@colcount\@ne
\@namedef{code@\number\ST@colcount @\number\ST@rowcount}{-1}% -1 = cellule multicol
\repeat
\fi
@@ -471,48 +486,54 @@
% On va essayer de purger dans #1 toutes les \hline, \clines, \hhline etc, et ajouter tout ce beau monde
% et leur ev\'entuels arguments dans des sc sp\'eciales (par ex \endrow@3 pour la fin de la 3e ligne.)
-\newcommand\ST@search@hline[1]{%
- \unless\ifcsname endrow@\number\ST@rowcount\endcsname\ST@letname{endrow@\number\ST@rowcount}\@empty\fi
- \ST@remove@first@spaces#1% on enl\`eve les espaces au d\'ebut
- \StrChar#11[\ST@temp@a]% \ST@temp@a est le 1er car
- \let\next\ST@search@hline
+\newcommand\ST@search@hline{%
+ \ST@ifvalid@csname{endrow@\number\ST@rowcount}%
+ \relax
+ {\ST@letname{endrow@\number\ST@rowcount}\@empty}%
+ \ST@search@hline@i
+}
+
+\newcommand\ST@search@hline@i{%
+ \ST@remove@first@spaces\ST@tab% on enl\`eve les espaces au d\'ebut
+ \StrChar\ST@tab1[\ST@temp@a]% \ST@temp@a est le 1er car
+ \let\ST@temp@b\ST@search@hline@i
\IfStrEqCase\ST@temp@a{% on envisage tous les cas de trac\'e de ligne horizontale
- {\@empty\hline}{\StrGobbleLeft#11[#1]\expandafter\ST@add@tomacro\csname endrow@\number\ST@rowcount\endcsname\hline}%
- {\@empty\cline}{\StrSplit#12\ST@temp@a#1\expandafter\ST@expadd@tomacro\csname endrow@\number\ST@rowcount\endcsname\ST@temp@a}%
- {\@empty\hhline}{\StrSplit#12\ST@temp@a#1\expandafter\ST@expadd@tomacro\csname endrow@\number\ST@rowcount\endcsname\ST@temp@a}%
- {\@empty\noalign}{\StrSplit#12\ST@temp@a#1\expandafter\ST@expadd@tomacro\csname endrow@\number\ST@rowcount\endcsname\ST@temp@a}%
+ {\@empty\hline}{\StrGobbleLeft\ST@tab1[\ST@tab]\expandafter\ST@add@tomacro\csname endrow@\number\ST@rowcount\endcsname\hline}%
+ {\@empty\cline}{\StrSplit\ST@tab2\ST@temp@a\ST@tab\expandafter\ST@expadd@tomacro\csname endrow@\number\ST@rowcount\endcsname\ST@temp@a}%
+ {\@empty\hhline}{\StrSplit\ST@tab2\ST@temp@a\ST@tab\expandafter\ST@expadd@tomacro\csname endrow@\number\ST@rowcount\endcsname\ST@temp@a}%
+ {\@empty\noalign}{\StrSplit\ST@tab2\ST@temp@a\ST@tab\expandafter\ST@expadd@tomacro\csname endrow@\number\ST@rowcount\endcsname\ST@temp@a}%
{\@empty\toprule}{% les commandes de booktabs
- \StrSplit#11\ST@temp@a#1% chope le 1er lex\`eme : la commande \toprule
- \IfBeginWith#1[{\StrBefore#1][\ST@temp@b]\ST@expadd@tomacro\ST@temp@a{\ST@temp@b]}\StrBehind#1][#1]}\relax
+ \StrSplit\ST@tab1\ST@temp@a\ST@tab% chope le 1er lex\`eme : la commande \toprule
+ \IfBeginWith\ST@tab[{\StrBefore\ST@tab][\ST@temp@b]\ST@expadd@tomacro\ST@temp@a{\ST@temp@b]}\StrBehind\ST@tab][\ST@tab]}\relax
\expandafter\ST@expadd@tomacro\csname endrow@\number\ST@rowcount\endcsname\ST@temp@a
}%
{\@empty\midrule}{%
- \StrSplit#11\ST@temp@a#1% chope le 1er lex\`eme : la commande \midrule
- \IfBeginWith#1[{\StrBefore#1][\ST@temp@b]\ST@expadd@tomacro\ST@temp@a{\ST@temp@b]}\StrBehind#1][#1]}\relax
+ \StrSplit\ST@tab1\ST@temp@a\ST@tab% chope le 1er lex\`eme : la commande \midrule
+ \IfBeginWith\ST@tab[{\StrBefore\ST@tab][\ST@temp@b]\ST@expadd@tomacro\ST@temp@a{\ST@temp@b]}\StrBehind\ST@tab][\ST@tab]}\relax
\expandafter\ST@expadd@tomacro\csname endrow@\number\ST@rowcount\endcsname\ST@temp@a
}%
{\@empty\bottomrule}{%
- \StrSplit#11\ST@temp@a#1% chope le 1er lex\`eme : la commande \bottomrule
- \IfBeginWith#1[{\StrBefore#1][\ST@temp@b]\ST@expadd@tomacro\ST@temp@a{\ST@temp@b]}\StrBehind#1][#1]}\relax
+ \StrSplit\ST@tab1\ST@temp@a\ST@tab% chope le 1er lex\`eme : la commande \bottomrule
+ \IfBeginWith\ST@tab[{\StrBefore\ST@tab][\ST@temp@b]\ST@expadd@tomacro\ST@temp@a{\ST@temp@b]}\StrBehind\ST@tab][\ST@tab]}\relax
\expandafter\ST@expadd@tomacro\csname endrow@\number\ST@rowcount\endcsname\ST@temp@a
}%
{\@empty\cmidrule}{%
- \StrSplit#11\ST@temp@a#1% chope le 1er lex\`eme : la commande \cmidrule
- \IfBeginWith#1[{\StrBefore#1][\ST@temp@b]\ST@expadd@tomacro\ST@temp@a{\ST@temp@b]}\StrBehind#1][#1]}\relax
- \IfBeginWith#1({\StrBefore#1)[\ST@temp@b]\ST@expadd@tomacro\ST@temp@a{\ST@temp@b)}\StrBehind#1)[#1]}\relax
- \StrSplit#11\ST@temp@b#1% chope l'argument obligatoire : {a-b}
+ \StrSplit\ST@tab1\ST@temp@a\ST@tab% chope le 1er lex\`eme : la commande \cmidrule
+ \IfBeginWith\ST@tab[{\StrBefore\ST@tab][\ST@temp@b]\ST@expadd@tomacro\ST@temp@a{\ST@temp@b]}\StrBehind\ST@tab][\ST@tab]}\relax
+ \IfBeginWith\ST@tab({\StrBefore\ST@tab)[\ST@temp@b]\ST@expadd@tomacro\ST@temp@a{\ST@temp@b)}\StrBehind\ST@tab)[\ST@tab]}\relax
+ \StrSplit\ST@tab1\ST@temp@b\ST@tab% chope l'argument obligatoire : {a-b}
\ST@expadd@tomacro\ST@temp@a\ST@temp@b% l'ajoute \'a \ST@temp@b
\expandafter\ST@expadd@tomacro\csname endrow@\number\ST@rowcount\endcsname\ST@temp@a% et on ajoute le tout \'a endrow
}%
{\@empty\addlinespace}{%
- \StrSplit#11\ST@temp@a#1% chope le 1er lex\`eme : la commande \addlinespace
- \IfBeginWith#1[{\StrBefore#1][\ST@temp@b]\ST@expadd@tomacro\ST@temp@a{\ST@temp@b]}\StrBehind#1][#1]}\relax
+ \StrSplit\ST@tab1\ST@temp@a\ST@tab% chope le 1er lex\`eme : la commande \addlinespace
+ \IfBeginWith\ST@tab[{\StrBefore\ST@tab][\ST@temp@b]\ST@expadd@tomacro\ST@temp@a{\ST@temp@b]}\StrBehind\ST@tab][\ST@tab]}\relax
\expandafter\ST@expadd@tomacro\csname endrow@\number\ST@rowcount\endcsname\ST@temp@a
}%
- {\@empty\morecmidrules}{\StrGobbleLeft#11[#1]\expandafter\ST@add@tomacro\csname endrow@\number\ST@rowcount\endcsname\morecmidrules}%
- {\@empty\specialrule}{\StrSplit#14\ST@temp@a#1\expandafter\ST@expadd@tomacro\csname endrow@\number\ST@rowcount\endcsname\ST@temp@a}%
- }[\let\next\@gobble]%
- \next#1%
+ {\@empty\morecmidrules}{\StrGobbleLeft\ST@tab1[\ST@tab]\expandafter\ST@add@tomacro\csname endrow@\number\ST@rowcount\endcsname\morecmidrules}%
+ {\@empty\specialrule}{\StrSplit\ST@tab4\ST@temp@a\ST@tab\expandafter\ST@expadd@tomacro\csname endrow@\number\ST@rowcount\endcsname\ST@temp@a}%
+ }[\let\ST@temp@b\relax]%
+ \ST@temp@b
}
% Cette macro transpose toutes les r\'ef\'erences (absolues et relatives) de la sc #3.
@@ -536,13 +557,13 @@
\fi
\expandafter\ST@ifcar@isletter\expandafter{\ST@firstcar}% est-ce que le 1er car est une lettre ?
{\if\expandafter\noexpand\STtransposecar\expandafter\expandafter\expandafter\noexpand\expandafter\@car\ST@temp@formula\@nil% le caract\`ere suivant est un "!" ?
- \let\ST@addrow@\z@% pas de tranposition sur la ligne
- \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter\ST@temp@formula\expandafter\expandafter\expandafter{\expandafter\@cdr\ST@temp@formula\@nil}% on prend ce qui est apr\`es le !
- \else
- \let\ST@addrow@\ST@addrow% sinon, on copie le vecteur
- \fi
- \IfInteger\ST@temp@formula\relax\relax% on prend le nombre qui suit
- \ifnum\integerpart>\z@% si ce nombre est plus grand que 0 -> r\'ef\'erence valide
+ \let\ST@addrow@\z@% pas de tranposition sur la ligne
+ \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter\ST@temp@formula\expandafter\expandafter\expandafter{\expandafter\@cdr\ST@temp@formula\@nil}% on prend ce qui est apr\`es le !
+ \else
+ \let\ST@addrow@\ST@addrow% sinon, on copie le vecteur
+ \fi
+ \IfInteger\ST@temp@formula\relax\relax% on prend le nombre qui suit
+ \ifnum\integerpart>\z@% si ce nombre est plus grand que 0 -> r\'ef\'erence valide
\let\ST@temp@formula\@xs@afterinteger% on prend ce qui est apr\`es le nombre
\expandafter\lowercase\expandafter{\expandafter\def\expandafter\ST@firstcar\expandafter{\ST@firstcar}}% met en minuscules
\edef\ST@firstcar{\number\numexpr\expandafter`\ST@firstcar-`a+1+\ST@addcol@}% est le num\'ero de la colonne
@@ -552,36 +573,36 @@
n\or o\or p\or q\or r\or s\or t\or u\or v\or w\or x\or y\or z\fi
\number\numexpr\integerpart+\ST@addrow@}%
\ifnum\numexpr\integerpart+\ST@addrow@<\@ne\ST@illegal@copy\fi% erreur de copie ?
- \else
- \let\ST@temp@formula\@xs@afterinteger
- \ST@expadd@tomacro\ST@transposed@formula\ST@firstcar
- \fi
+ \else
+ \let\ST@temp@formula\@xs@afterinteger
+ \ST@expadd@tomacro\ST@transposed@formula\ST@firstcar
+ \fi
}%
{\if[\expandafter\noexpand\ST@firstcar% si le 1er car est [
- \ST@left\ST@temp@formula]\ST@temp@ref% on prend ce qui est entre crochet
- \ST@right\ST@temp@formula]\ST@temp@formula% pour la suite, on prend ce qui apr\`es le crochet
- \ST@left\ST@temp@ref,\ST@rel@num% ce qui est avant la virgule
- \if\expandafter\noexpand\STtransposecar\expandafter\expandafter\expandafter\noexpand\expandafter\@car\ST@rel@num\@nil% commence par un "!" ?
- \let\ST@addcol@\ST@addcol% compensation pour conserver la cellule initiale
- \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter\ST@rel@num\expandafter\expandafter\expandafter{\expandafter\@cdr\ST@rel@num\@nil}% on prend ce qui est apr\`es le !
- \else
- \let\ST@addcol@\z@% sinon, on n'ajoute rien
- \fi
- \IfInteger\ST@rel@num
- {\edef\ST@addcol@{\number\numexpr\ST@rel@num-\ST@addcol@}%
- \ST@right\ST@temp@ref,\ST@rel@num% ce qui est apr\`es la virgule
- \if\expandafter\noexpand\STtransposecar\expandafter\expandafter\expandafter\noexpand\expandafter\@car\ST@rel@num\@nil% commence par un "!"?
- \let\ST@addrow@\ST@addrow% on compense pour conserver la cellule initiale
- \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter\ST@rel@num\expandafter\expandafter\expandafter{\expandafter\@cdr\ST@rel@num\@nil}% on prend ce qui est apr\`es le !
- \else
- \let\ST@addrow@\z@% sinon, on n'ajoute rien
- \fi
- \IfInteger\ST@rel@num
- {\ST@edefadd@tomacro\ST@transposed@formula{[\ST@addcol@,\number\numexpr\ST@rel@num-\ST@addrow@]}%
- }%
- \ST@illegal@relativeref
- }%
- \ST@illegal@relativeref
+ \ST@left\ST@temp@formula]\ST@temp@ref% on prend ce qui est entre crochet
+ \ST@right\ST@temp@formula]\ST@temp@formula% pour la suite, on prend ce qui apr\`es le crochet
+ \ST@left\ST@temp@ref,\ST@rel@num% ce qui est avant la virgule
+ \if\expandafter\noexpand\STtransposecar\expandafter\expandafter\expandafter\noexpand\expandafter\@car\ST@rel@num\@nil% commence par un "!" ?
+ \let\ST@addcol@\ST@addcol% compensation pour conserver la cellule initiale
+ \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter\ST@rel@num\expandafter\expandafter\expandafter{\expandafter\@cdr\ST@rel@num\@nil}% on prend ce qui est apr\`es le !
+ \else
+ \let\ST@addcol@\z@% sinon, on n'ajoute rien
+ \fi
+ \IfInteger\ST@rel@num
+ {\edef\ST@addcol@{\number\numexpr\ST@rel@num-\ST@addcol@}%
+ \ST@right\ST@temp@ref,\ST@rel@num% ce qui est apr\`es la virgule
+ \if\expandafter\noexpand\STtransposecar\expandafter\expandafter\expandafter\noexpand\expandafter\@car\ST@rel@num\@nil% commence par un "!"?
+ \let\ST@addrow@\ST@addrow% on compense pour conserver la cellule initiale
+ \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter\ST@rel@num\expandafter\expandafter\expandafter{\expandafter\@cdr\ST@rel@num\@nil}% on prend ce qui est apr\`es le !
+ \else
+ \let\ST@addrow@\z@% sinon, on n'ajoute rien
+ \fi
+ \IfInteger\ST@rel@num
+ {\ST@edefadd@tomacro\ST@transposed@formula{[\ST@addcol@,\number\numexpr\ST@rel@num-\ST@addrow@]}%
+ }%
+ \ST@illegal@relativeref
+ }%
+ \ST@illegal@relativeref
\else
\ST@expadd@tomacro\ST@transposed@formula\ST@firstcar
\fi
@@ -671,13 +692,13 @@
\def\ST@alias@copylist{#6}% on enl\`eve le premier \'el\'ement de la copylist
\ST@Ifin\ST@copycol\ST@copyrow[#2,#3](#4,#5)% si ça correspond
{\def\ST@returnedformula{#1}%
- \ST@transposeformula{\numexpr\ST@copycol-#2}{\numexpr\ST@copyrow-#3}\ST@returnedformula\ST@returnedformula
+ \ST@transposeformula{\numexpr\ST@copycol-#2}{\numexpr\ST@copyrow-#3}\ST@returnedformula\ST@returnedformula
}%
{\ifx\@empty#5\@empty\else
- \ifnum\ST@copyrow>\numexpr#3+#5\relax
- \ST@subst\ST@copylist{|#1|[#2,#3](#4,#5)}{}% si on a d\'epass\'e la ligne, on retire ce premier \'el\'ement de la copylist
- \fi
- \fi
+ \ifnum\ST@copyrow>\numexpr#3+#5\relax
+ \ST@subst\ST@copylist{|#1|[#2,#3](#4,#5)}{}% si on a d\'epass\'e la ligne, on retire ce premier \'el\'ement de la copylist
+ \fi
+ \fi
}%
}
@@ -744,7 +765,7 @@
\StrSplit\ST@temp@formula1\ST@firstcar\ST@temp@formula% prend le 1er car de ce qui reste
\expandafter\ST@ifcar@isletter\expandafter{\ST@firstcar}% est-ce que le 1er car est une lettre ?
{\IfInteger\ST@temp@formula\relax\relax% on prend le nombre qui suit
- \ifnum\integerpart>\z@% si ce nombre est plus grand que 0 -> r\'ef\'erence valide
+ \ifnum\integerpart>\z@% si ce nombre est plus grand que 0 -> r\'ef\'erence valide
\let\ST@after@ref@found\@xs@afterinteger
\edef\ST@ref@found{\ST@firstcar\number\integerpart}% est la r\'ef\'erence trouv\'ee
\edef\ST@distant@rownumber{\number\integerpart}% on chope ce nombre pour le num\'ero de colonne
@@ -752,7 +773,7 @@
\ifnum\ST@distant@colnumber<\z@\edef\ST@distant@colnumber{\number\numexpr\ST@distant@colnumber+32}\fi% met les majuscules en minuscules
\edef\ST@temp@formula{\ST@distant@colnumber @\ST@distant@rownumber}% les coordonn\'ees de la r\'ef\'erence
\let\ST@next@search\relax
- \fi
+ \fi
}%
{\if[\expandafter\noexpand\ST@firstcar% si le 1er car est [
\ST@right\ST@temp@formula]\ST@after@ref@found
@@ -761,16 +782,16 @@
\ST@left\ST@temp@formula,\ST@rel@num
\IfInteger\ST@rel@num
{\edef\ST@distant@colnumber{\number\numexpr\ST@current@colnumber+\ST@rel@num}%
- \ST@right\ST@temp@formula,\ST@rel@num
- \IfInteger\ST@rel@num
- {\edef\ST@distant@rownumber{\number\numexpr\ST@current@rownumber+\ST@rel@num}%
- \edef\ST@temp@formula{\ST@distant@colnumber @\ST@distant@rownumber}% les coordonn\'ees de la r\'ef\'erence
- \let\ST@next@search\relax
- }%
- \ST@illegal@relativeref
+ \ST@right\ST@temp@formula,\ST@rel@num
+ \IfInteger\ST@rel@num
+ {\edef\ST@distant@rownumber{\number\numexpr\ST@current@rownumber+\ST@rel@num}%
+ \edef\ST@temp@formula{\ST@distant@colnumber @\ST@distant@rownumber}% les coordonn\'ees de la r\'ef\'erence
+ \let\ST@next@search\relax
+ }%
+ \ST@illegal@relativeref
}%
\ST@illegal@relativeref
- \fi
+ \fi
}%
\fi
\ST@next@search
@@ -799,10 +820,10 @@
% Essaie de calculer la cellule (#1,#2)
\def\ST@try@calc@cell(#1,#2)%
{%
- \ifcsname formula@#1@#2\endcsname% on v\'erifie que la formule existe
- \expandafter\ifx\csname formula@#1@#2\endcsname\@empty% et qu'elle est non vide
+ \ST@ifvalid@csname{formula@#1@#2}% on v\'erifie que la formule existe
+ {\expandafter\ifx\csname formula@#1@#2\endcsname\@empty
\@namedef{code@#1@#2}{0}% si vide, code \'a 0
- \else
+ \else% et qu'elle est non vide
\def\ST@current@colnumber{#1}\def\ST@current@rownumber{#2}%
\expandafter\ST@find@first@func\csname formula@#1@#2\endcsname% cherche une fonction dans la formule
\ifx\@empty\ST@function@namefound% s'il n'y a pas de fonction
@@ -811,8 +832,7 @@
\ST@calc@cell(#1,#2)% on va la calculer la cellule
\fi
\fi
- \fi
- \fi
+ \fi}\relax
}
\def\ST@calc@cell(#1,#2)%
@@ -831,7 +851,7 @@
\fi
\ST@letname{formula@#1@#2}\ST@temp@a% assigne le r\'esultat \'a la formule
\@namedef{code@#1@#2}{2}% et met le code \'a 2 (cellule calcul\'ee)
- \fi
+ \fi
}
% Calcule toutes les formules du tableau
@@ -844,10 +864,9 @@
\ifnum\ST@rowcount>\ST@total@rownumber
\let\ST@nextcell\relax
\else
- \ifcsname formula@\number\ST@colcount @\number\ST@rowcount\endcsname% si la formule existe
- \edef\ST@temp@a{\noexpand\ST@eval@cell(\number\ST@colcount,\number\ST@rowcount)}% on la calcule
- \ST@temp@a
- \fi
+ \ST@ifvalid@csname{formula@\number\ST@colcount @\number\ST@rowcount}% si la formule existe
+ {\ST@eval@cell(\number\ST@colcount,\number\ST@rowcount)}% on la calcule
+ \relax
\advance\ST@colcount\@ne
\let\ST@nextcell\ST@eval@tab@i
\ifnum\ST@colcount>\ST@total@colnumber
@@ -873,7 +892,7 @@
}%
}
-% Évalue la cellule (#1#2) par ses coordonn\'ees num\'eriques (col,row)
+% \'Evalue la cellule (#1#2) par ses coordonn\'ees num\'eriques (col,row)
\def\ST@eval@cell(#1,#2)%
{%
\def\ST@dependance@tree{(#1,#2)}%
@@ -905,18 +924,20 @@
\else
\ST@Ifinstr{\ST@functions@with@textresult,}{\ST@function@namesaved,}% si la derni\`ere fonction rend du texte
{\ifx\ST@stackcall\@empty% et si on est dans la cellule source
- \@namedef{code@#1@#2}{0}% on met le code \'a 0, la cellule devient textuelle
- \expandafter\let\csname text@#1@#2\expandafter\endcsname\csname formula@#1@#2\endcsname% copie de la formule vers la zone texte (avec \'ecrasement de ce qui s'y trouvait)
- \ST@letname{formula@#1@#2}\@empty% et plus rien dansla formule
- \else
- \ST@calc@cell(#1,#2)% sinon, on se trouve dans une cellule appel\'ee par une macrofonction et donc, on la calcule
- \fi
+ \@namedef{code@#1@#2}{0}% on met le code \'a 0, la cellule devient textuelle
+ \exploregroups
+ \expandafter\StrSubstitute\expandafter[\expandafter\@ne\expandafter]\csname text@#1@#2\expandafter\endcsname\expandafter\STnumericfieldmarker\csname formula@#1@#2\expandafter\endcsname\expandafter[\csname text@#1@#2\endcsname]% copie de la formule vers la zone texte
+ \noexploregroups
+ \ST@letname{formula@#1@#2}\@empty% et plus rien dans la formule
+ \else
+ \ST@calc@cell(#1,#2)% sinon, on se trouve dans une cellule appel\'ee par une macrofonction et donc, on la calcule
+ \fi
}%
{\ST@calc@cell(#1,#2)}% c'est une fonction qui donne un arg num\'erique : on calcule la cellule en cours
\fi
\else
- \ifcsname code@\ST@coord\endcsname% le code distant exite ?
- \ifcase\csname code@\ST@coord\endcsname% code distant = 0 ==> cellule vide ou textuelle, pas bon du tout !
+ \ST@ifvalid@csname{code@\ST@coord}% le code distant exite ?
+ {\ifcase\csname code@\ST@coord\endcsname% code distant = 0 ==> cellule vide ou textuelle, pas bon du tout !
\edef\ST@temp@callcell{#1,#2}% coordonn\'ees de la cellule appelante
\edef\ST@coord{\ST@distant@colnumber,\ST@distant@rownumber}% coordonn\'ees appel\'ees
\ST@zerocodecell@cell% erreur : r\'ef\'erence \'a une cellule de code 0
@@ -937,18 +958,17 @@
\edef\ST@temp@callcell{#1,#2}% coordonn\'ees de la cellule appelante
\ST@subst\ST@coord @,% coordonn\'ees appel\'ees
\ST@multicol@cell
- \fi
- \else% le code distant n'est pas d\'efini
- \edef\ST@temp@callcell{#1,#2}% coordonn\'ees de la cellule appelante
+ \fi}%
+ {\edef\ST@temp@callcell{#1,#2}% coordonn\'ees de la cellule appelante
\ST@subst\ST@coord @,% coordonn\'ees appel\'ees
\ST@undefined@cell% code distant inexistant -> cellule hors limite du tableau
- \fi
+ }%
\fi
\else% il y a une fonction dans la formule
\let\ST@function@namesaved\ST@function@namefound
\ST@determine@function@code\ST@function@namefound\ST@codefunc% d\'etermine le code de la fonction
- \ifcase\ST@codefunc
- \@latex@error{\ST@errname This error should not occur! Please email the author. Thanks.}{}%
+ \ifcase\ST@codefunc\relax
+ \PackageError\ST@package@name{This error should not occur! Please email the author. Thanks.}{}%
\or% le code vaut 1, c'est une fonction \'a argument num\'erique
\ST@findref@informula\ST@function@argfound\ST@temp@formula% y a t-il une r\'ef\'erence dans l'argument de la formule ?
\ifx\ST@temp@formula\@empty% pas de r\'ef\'erence dans l'argument de la fonction
@@ -962,7 +982,11 @@
\ST@Iffirstis\ST@result@func-{\expandafter\def\expandafter\ST@result@func\expandafter{\expandafter(\ST@result@func)}}\relax
\ST@expsubst\ST@current@formula\ST@tobereplaced\ST@result@func% on replace dans l'alias
\ST@letname{formula@#1@#2}\ST@current@formula% on l'assigne dans la formule
- \edef\ST@stackcall{(#1,#2)\ST@stackcall}% puis, on \'evalue \'a nouveau cette cellule
+ \ifx\@empty\ST@current@formula% pour cause de macro fonction "tag" qui est seule et qui a disparue apr\`es substitution
+ \@namedef{code@#1@#2}{0}%
+ \else
+ \edef\ST@stackcall{(#1,#2)\ST@stackcall}% puis, on \'evalue \'a nouveau cette cellule
+ \fi
\else
\ifnum\csname code@\ST@temp@formula\endcsname=\tw@% si la r\'ef\'erence est calcul\'ee, on la replace par sa valeur
\expandafter\let\expandafter\ST@current@formula\csname formula@\ST@temp@formula\endcsname% alias pour la formule distante
@@ -982,18 +1006,18 @@
\fi
\fi
\or% le code vaut 2, c'est une fonction \'a argument «plage de cellules»
- \expandafter\let\expandafter\ST@current@formula\csname formula@#1@#2\endcsname% alias pour la formule
\let\ST@tobereplaced\ST@function@namefound\ST@expadd@tomacro\ST@tobereplaced{\expandafter(\ST@function@argfound)}%
\csname ST@func@\ST@function@namefound\endcsname\ST@function@argfound\ST@result@func% puis on essaie d'\'evaluer la fonction
\unless\ifx\ST@result@func\@empty% si le calcul a abouti
\ST@Iffirstis\ST@result@func-{\expandafter\def\expandafter\ST@result@func\expandafter{\expandafter(\ST@result@func)}}\relax
- \ST@expsubst\ST@current@formula\ST@tobereplaced\ST@result@func% on replace dans l'alias
- \ST@letname{formula@#1@#2}\ST@current@formula% on l'assigne dans la formule
+ \expandafter\ST@expsubst\csname formula@#1@#2\endcsname\ST@tobereplaced\ST@result@func% on replace dans la formule
\edef\ST@stackcall{(#1,#2)\ST@stackcall}% puis, on \'evalue \'a nouveau cette cellule
\fi
\or% le code vaut 3, c'est un fonction dont l'argument est textuel
\let\ST@function@argfound@edefed\ST@function@argfound
- \ST@findref@informula\ST@function@argfound\ST@temp@formula% y a t-il une r\'ef\'erence dans l'argument de la fonction ?
+ \ST@Ifinstr{\ST@functions@with@assign@argument,}{\ST@function@namefound,}%
+ {\let\ST@temp@formula\@empty}%
+ {\ST@findref@informula\ST@function@argfound\ST@temp@formula}% y a t-il une r\'ef\'erence dans l'argument de la fonction ?
\ifx\ST@temp@formula\@empty% pas de r\'ef\'erence dans l'argument de la fonction
\expandafter\let\expandafter\ST@current@formula\csname formula@#1@#2\endcsname% alias pour la formule
\let\ST@tobereplaced\ST@function@namefound
@@ -1015,7 +1039,7 @@
\expandafter\ST@expsubst\csname formula@#1@#2\endcsname\ST@tobereplaced\ST@result@func
\edef\ST@stackcall{(#1,#2)\ST@stackcall}% puis, on \'evalue \'a nouveau cette cellule
\else
- \@latex@error{\ST@errname Macro function \ST@function@namefound\space requires a reference to a text cell!}\ST@seedoc@i
+ \PackageError\ST@package@name{Macro function \ST@function@namefound\space requires a reference to a text cell!}\ST@seedoc@i
\fi
\fi
\fi
@@ -1031,15 +1055,16 @@
\ST@split\ST@stackcall)\ST@temp@a\ST@stackcall
\ST@add@tomacro\ST@temp@a)%
\ST@sanitize@stack
- \expandafter\expandafter\expandafter\ST@eval@cell@i\expandafter\ST@temp@a
+ \expandafter\def\expandafter\ST@temp@a\expandafter{\expandafter\ST@eval@cell@i\ST@temp@a}%
+ \expandafter\ST@temp@a
\fi
}
\newcommand\ST@sanitize@stack{% enl\`eve de \ST@stackcall toutes les occurrences de \ST@temp@a
\ST@Ifinstr\ST@stackcall\ST@temp@a
{\expandafter\ST@subst\expandafter\ST@stackcall\expandafter{\ST@temp@a}{}%
- \ST@sanitize@stack
- }%
+ \ST@sanitize@stack
+ }%
\relax
}
@@ -1059,7 +1084,10 @@
\newcommand\ST@functions@no@calc@arg{ifeq,ifgt,iflt,gcd,lcm}
% liste des fonctions dont l'argument est un texte
-\newcommand\ST@functions@with@text@arg{frshortdatetonum,engshortdatetonum,englongdatetonum,frlongdatetonum,scitodec}
+\newcommand\ST@functions@with@text@arg{frshortdatetonum,engshortdatetonum,englongdatetonum,frlongdatetonum,scitodec,tag,row,col,cell}
+
+% liste des fonctions dont l'argument est une variable -> il ne faut donc pas aller chercher des r\'ef\'erences dans l'argument
+\newcommand\ST@functions@with@assign@argument{tag,row,col,cell}
% liste des fonctions dont le r\'esultat est un texte
\newcommand\ST@functions@with@textresult{%
@@ -1067,7 +1095,7 @@
numtofrmonth,numtoengmonth,numtofrday,numtoengday}
% liste totale des fonctions
-\edef\ST@functions@list{\ST@functions@with@num@arg,\ST@functions@with@range@arg,\ST@functions@with@text@arg}
+\edef\ST@functions@list{\ST@functions@with@range@arg,\ST@functions@with@num@arg,\ST@functions@with@text@arg}
\newcommand\ST@for[2]{% \ST@for{#1}{code} -> ex\'ecute le code pour toutes les cellules des plages pass\'ees en argument #1
\def\ST@forcode{#2}%
@@ -1084,7 +1112,7 @@
\advance\ST@rowcount@i\@ne
\ifnum\ST@rowcount@i>\ST@for@row@end
\ST@right\ST@for@rangelist;\ST@for@rangelist
- \expandafter\let\expandafter\ST@nextfor\ifx\ST@for@rangelist\@empty\relax\else\ST@for@i\fi
+ \ifx\ST@for@rangelist\@empty\let\ST@nextfor\relax\else\let\ST@nextfor\ST@for@i\fi
\fi
\fi
\ST@nextfor
@@ -1100,16 +1128,20 @@
\ST@rowcount@i\ST@distant@rownumber
\ST@Ifinstr\ST@for@currentrange{\@empty:}%
{\ST@right\ST@for@currentrange{\@empty:}\ST@temp@a
- \ST@ifref\ST@temp@a\relax\ST@invalid@range
- \let\ST@for@col@end\ST@distant@colnumber
- \let\ST@for@row@end\ST@distant@rownumber
- \let\ST@nextfor\ST@for@loopcode
- \ifnum\ST@for@col@start>\ST@for@col@end\let\ST@nextfor\relax\fi
- \ifnum\ST@for@row@start>\ST@for@row@end\let\ST@nextfor\relax\fi
- }%
+ \ST@ifref\ST@temp@a\relax\ST@invalid@range
+ \let\ST@for@col@end\ST@distant@colnumber
+ \let\ST@for@row@end\ST@distant@rownumber
+ \let\ST@nextfor\ST@for@loopcode
+ \ifnum\ST@for@col@start>\ST@for@col@end\let\ST@nextfor\relax\fi
+ \ifnum\ST@for@row@start>\ST@for@row@end\let\ST@nextfor\relax\fi
+ }%
{\ST@forcode
- \ST@right\ST@for@rangelist;\ST@for@rangelist
- \expandafter\let\expandafter\ST@nextfor\ifx\ST@for@rangelist\@empty\relax\else\ST@for@i\fi
+ \ST@right\ST@for@rangelist;\ST@for@rangelist
+ \ifx\ST@for@rangelist\@empty
+ \let\ST@nextfor\relax
+ \else
+ \let\ST@nextfor\ST@for@i
+ \fi
}%
\ST@nextfor
}
@@ -1148,7 +1180,7 @@
\ST@split\ST@tempfunctions@list,\ST@current@funcname\ST@tempfunctions@list
\ST@Ifinstr\ST@tempfunc{\ST@current@funcname(}% si l'argument contient le nom de fonction courant
{\let\ST@function@namefound\ST@current@funcname
- \ST@left\ST@tempfunc{\ST@current@funcname(}\ST@tempfunc% on r\'eduit l'argument \'a ce qui est avant ce nom
+ \ST@left\ST@tempfunc{\ST@current@funcname(}\ST@tempfunc% on r\'eduit l'argument \'a ce qui est avant ce nom
}%
\relax
\expandafter\expandafter\expandafter\ST@find@first@func@ii
@@ -1160,29 +1192,31 @@
% La macro trouve l'argument se trouvant entre les parenth\`eses les plus ext\'erieures
% et l'assigne \'a la sc #2
\newcommand\ST@seekfunc@arg[2]{%
- \edef\ST@openbrace@catcode{\number\catcode`\(}\edef\ST@closebrace@catcode{\number\catcode`\)}%
- \catcode`\(1 \catcode`\)2
- \everyeof{\relax}\endlinechar\m@ne
- \afterassignment\ST@gobble@remain
- \expandafter\def\expandafter#2\scantokens\expandafter{#1}%
- \catcode`\(\ST@openbrace@catcode\catcode`\)\ST@closebrace@catcode
- \def\ST@assignarg##1\relax{\def#2{##1}}%
- \expandafter\ST@assignarg\scantokens\expandafter{#2}%
+ \begingroup
+ \everyeof{\ST@nil}% met un \@nil \`a la fin du fichier virtuel
+ \endlinechar\m@ne
+ \catcode\z@12
+ \catcode`(=1 \catcode`)=2
+ \afterassignment\ST@gobble@remain
+ \expandafter\def\expandafter\ST@temp@a\scantokens\expandafter{#1}%
+ \catcode`(=12 \catcode`)=12
+ \def\ST@assign@result##1\ST@nil{\endgroup\def#2{##1}}%
+ \expandafter\ST@assign@result\scantokens\expandafter{\ST@temp@a}% on fait l'assignation
}
\newcommand\ST@func@sum[2]{% #1 est la sc contenant la plage de valeurs, #2 est la sc recevant le r\'esultat
\def#2{0}% r\'esultat nul pour l'instant
\let\ST@temp@stack\@empty% pile d'appel temporaire vide aussi au d\'ebut
\ST@for{#1}% on parcourt la <plage de cellules>
- {\ifcase\csname code@\number\ST@colcount@i @\number\ST@rowcount@i\endcsname% on ne prend en compte que les code 1 et 2
- \or% code=1
- \edef\ST@temp@stack{\ST@temp@stack(\number\ST@colcount@i,\number\ST@rowcount@i)}%
- \or% code=2
- \ifx\ST@temp@stack\@empty% on ne prend la peine d'additionner que si toutes les cellules sont calcul\'ees
- \expandafter\FPadd\expandafter#2\expandafter#2\csname formula@\number\ST@colcount@i @\number\ST@rowcount@i\endcsname
- \edef\ST@dependance@tree{\ST@dependance@tree(\number\ST@colcount@i,\number\ST@rowcount@i)}% mise \'a jour de l'arbre des d\'ependances
- \fi
- \fi
+ {\ifcase0\csname code@\number\ST@colcount@i @\number\ST@rowcount@i\endcsname\relax% on ne prend en compte que les code 1 et 2
+ \or% code=1
+ \edef\ST@temp@stack{\ST@temp@stack(\number\ST@colcount@i,\number\ST@rowcount@i)}%
+ \or% code=2
+ \ifx\ST@temp@stack\@empty% on ne prend la peine d'additionner que si toutes les cellules sont calcul\'ees
+ \expandafter\FPadd\expandafter#2\expandafter#2\csname formula@\number\ST@colcount@i @\number\ST@rowcount@i\endcsname
+ \edef\ST@dependance@tree{\ST@dependance@tree(\number\ST@colcount@i,\number\ST@rowcount@i)}% mise \'a jour de l'arbre des d\'ependances
+ \fi
+ \fi
}%
\ifx\ST@temp@stack\@empty% toutes les cellules dans la plage \'etaient calcul\'ees ?
\FPclip#2#2% on ôte les 0 inutiles si le calcul a \'et\'e men\'e au bout
@@ -1227,31 +1261,31 @@
\def#2{0}% r\'esultat nul pour l'instant
\ST@for{\ST@firstmat}% pour chaque cellule de la 1ere matrice
{\def\ST@inter@result{0}% r\'esultat partiel nul pour l'instant
- \ifcase\csname code@\number\ST@colcount@i @\number\ST@rowcount@i\endcsname
- \or% code =1
- \edef\ST@temp@stack{\ST@temp@stack(\number\ST@colcount@i,\number\ST@rowcount@i)}%
- \edef\ST@dependance@tree{\ST@dependance@tree(\number\ST@colcount@i,\number\ST@rowcount@i)}% mise \'a jour de l'arbre des d\'ependances
- \or% code=2
- \expandafter\let\expandafter\ST@inter@result\csname formula@\number\ST@colcount@i @\number\ST@rowcount@i\endcsname
- \fi
- \ST@count\@ne
- \loop% on multiplie tous les nombres qui se correspondent dans les matrices
- \edef\ST@tempcoord{\number\numexpr\ST@colcount@i+\csname ST@vectorcol@\romannumeral\ST@count\endcsname @\number\numexpr\ST@rowcount@i+\csname ST@vectorrow@\romannumeral\ST@count\endcsname}%
- \ifcase\csname code@\ST@tempcoord\endcsname
- \def\ST@inter@result{0}% code =0 -> on met le r\'esultat partiel \'a 0
- \or% code =1
- \ST@subst\ST@tempcoord @,%
- \edef\ST@temp@stack{\ST@temp@stack(\ST@tempcoord)}%
- \edef\ST@dependance@tree{\ST@dependance@tree(\ST@tempcoord)}% mise \'a jour de l'arbre des d\'ependances
- \or% code=2
- \expandafter\FPmul\expandafter\ST@inter@result\expandafter\ST@inter@result\csname formula@\ST@tempcoord\endcsname
- \else
- \def\ST@inter@result{0}% code = autre -> on met le r\'esultat partiel \'a 0
- \fi
- \advance\ST@count\@ne
- \ifnum\ST@count<\ST@numbermat
- \repeat
- \FPadd#2#2\ST@inter@result
+ \ifcase\csname code@\number\ST@colcount@i @\number\ST@rowcount@i\endcsname
+ \or% code =1
+ \edef\ST@temp@stack{\ST@temp@stack(\number\ST@colcount@i,\number\ST@rowcount@i)}%
+ \edef\ST@dependance@tree{\ST@dependance@tree(\number\ST@colcount@i,\number\ST@rowcount@i)}% mise \'a jour de l'arbre des d\'ependances
+ \or% code=2
+ \expandafter\let\expandafter\ST@inter@result\csname formula@\number\ST@colcount@i @\number\ST@rowcount@i\endcsname
+ \fi
+ \ST@count\@ne
+ \loop% on multiplie tous les nombres qui se correspondent dans les matrices
+ \edef\ST@tempcoord{\number\numexpr\ST@colcount@i+\csname ST@vectorcol@\romannumeral\ST@count\endcsname @\number\numexpr\ST@rowcount@i+\csname ST@vectorrow@\romannumeral\ST@count\endcsname}%
+ \ifcase\csname code@\ST@tempcoord\endcsname
+ \def\ST@inter@result{0}% code =0 -> on met le r\'esultat partiel \'a 0
+ \or% code =1
+ \ST@subst\ST@tempcoord @,%
+ \edef\ST@temp@stack{\ST@temp@stack(\ST@tempcoord)}%
+ \edef\ST@dependance@tree{\ST@dependance@tree(\ST@tempcoord)}% mise \'a jour de l'arbre des d\'ependances
+ \or% code=2
+ \expandafter\FPmul\expandafter\ST@inter@result\expandafter\ST@inter@result\csname formula@\ST@tempcoord\endcsname
+ \else
+ \def\ST@inter@result{0}% code = autre -> on met le r\'esultat partiel \'a 0
+ \fi
+ \advance\ST@count\@ne
+ \ifnum\ST@count<\ST@numbermat
+ \repeat
+ \FPadd#2#2\ST@inter@result
}%
\ifx\ST@temp@stack\@empty% toutes les cellules dans la plage \'etaient calcul\'ees ?
\FPclip#2#2% on ôte les 0 inutiles si le calcul a \'et\'e men\'e au bout
@@ -1319,18 +1353,18 @@
\newcommand\ST@func@randint[2]{% #1=sc contenant l'argument #2: sc recevant le r\'esultat
\ST@Ifinstr#1,% s'il y a 2 nombres -> intervalle [nb1;nb2]
{\ST@split#1,\ST@limita\ST@limitb
- \FPifeq\ST@limita\ST@limitb\@latex@error{\ST@errname Macro function randint require two different numbers}\ST@seedoc@i\fi
- \FPifgt\ST@limita\ST@limitb
- \let\ST@temp@a\ST@limitb\let\ST@limitb\ST@limita\let\ST@limita\ST@temp@a
- \fi
- \FPifint\ST@limita\else\@latex@error{\ST@errname Macro function randint require integer argument}\ST@seedoc@i\fi
- \FPifint\ST@limitb\else\@latex@error{\ST@errname Macro function randint require integer argument}\ST@seedoc@i\fi
- \FPrandom#2%
- \FPeval#2{trunc(trunc(#2*(\ST@limitb-\ST@limita+1),0)+\ST@limita,0)}%
+ \FPifeq\ST@limita\ST@limitb\PackageError\ST@package@name{Macro function randint require two different numbers}\ST@seedoc@i\fi
+ \FPifgt\ST@limita\ST@limitb
+ \let\ST@temp@a\ST@limitb\let\ST@limitb\ST@limita\let\ST@limita\ST@temp@a
+ \fi
+ \FPifint\ST@limita\else\PackageError\ST@package@name{Macro function randint require integer argument}\ST@seedoc@i\fi
+ \FPifint\ST@limitb\else\PackageError\ST@package@name{Macro function randint require integer argument}\ST@seedoc@i\fi
+ \FPrandom#2%
+ \FPeval#2{trunc(trunc(#2*(\ST@limitb-\ST@limita+1),0)+\ST@limita,0)}%
}%
- {\FPifint#1\else\@latex@error{\ST@errname Macro function randint require integer argument}\ST@seedoc@i\fi
- \FPrandom#2% s'il n'y a qu'un nombre -> intervalle [0;nb2]
- \FPeval#2{trunc(#2*(#1+1),0)}%
+ {\FPifint#1\else\PackageError\ST@package@name{Macro function randint require integer argument}\ST@seedoc@i\fi
+ \FPrandom#2% s'il n'y a qu'un nombre -> intervalle [0;nb2]
+ \FPeval#2{trunc(#2*(#1+1),0)}%
}%
}
@@ -1346,11 +1380,11 @@
\expandafter\lowercase\expandafter{\expandafter\def\expandafter#1\expandafter{#1}}%
\ST@Ifinstr#1{ee}% on regarde s'il y a "ee"
{\ST@split#1{ee}\ST@mantissa\ST@exposant
- \ST@powerten\ST@exposant\ST@tenpow
- \csname FP\ifnum\ST@exposant<\z@ div\else mul\fi\endcsname#2\ST@mantissa\ST@tenpow}%
+ \ST@powerten\ST@exposant\ST@tenpow
+ \csname FP\ifnum\ST@exposant<\z@ div\else mul\fi\endcsname#2\ST@mantissa\ST@tenpow}%
{\IfDecimal#1%
{\let#2#1}%
- {\@latex@error{\ST@errname Illegal number in scitodec argument}\ST@seedoc@i}}%
+ {\PackageError\ST@package@name{Illegal number in scitodec argument}\ST@seedoc@i}}%
}
% les fonctions de test
@@ -1546,6 +1580,57 @@
\fi
}
+\newcommand\ST@func@tag[2]{%
+ \let#2\@empty
+ \ifcsname ST@@\detokenize\expandafter{#1}\endcsname
+ \PackageWarning\ST@package@name{The tag "\detokenize\expandafter{#1}" already exists, previous is lost.}%
+ \fi
+ \expandafter\edef\csname ST@@\detokenize\expandafter{#1}\endcsname{\number\ST@colcount,\number\ST@rowcount}%
+ \ST@expadd@tomacro\ST@tag@list{%
+ \expandafter\let\csname ST@celltag@\detokenize\expandafter{#1}\expandafter\endcsname\csname formula@\number\ST@colcount @\number\ST@rowcount\endcsname}%
+ \expandafter\ST@coord@toref\csname ST@@\detokenize\expandafter{#1}\endcsname
+}
+
+\newcommand\ST@func@cell[2]{%
+ \unless\ifcsname ST@@\detokenize\expandafter{#1}\endcsname\ST@unknown@tag\fi
+ \edef#2{\csname ST@@\detokenize\expandafter{#1}\endcsname}%
+}
+
+\newcommand\ST@func@row[2]{%
+ \unless\ifcsname ST@@\detokenize\expandafter{#1}\endcsname\ST@unknown@tag\fi
+ \edef#2{\expandafter\expandafter\expandafter\@gobble\csname ST@@\detokenize\expandafter{#1}\endcsname}%
+}
+
+\newcommand\ST@func@col[2]{%
+ \unless\ifcsname ST@@\detokenize\expandafter{#1}\endcsname\ST@unknown@tag\fi
+ \edef#2{%
+ \number\numexpr
+ \expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter
+ `\expandafter\expandafter\expandafter\@car\csname ST@@\detokenize\expandafter{#1}\endcsname\@nil-64}%
+}
+
+% \newcommand\ST@func@timetosec[2]{%
+% \ST@left{#1}:\ST@nb@hours
+% \ST@right{#1}:\ST@nb@min
+% \ST@Ifinstr\ST@nb@min:%
+% {\ST@right\ST@nb@min:\ST@nb@sec
+% \ST@left\ST@nb@min:\ST@nb@min
+% }%
+% {\def\ST@nb@sec{0}}%
+% \FPeval#2{\ST@nb@sec+60*\ST@nb@min+3600*\ST@nb@hours}%
+% \FPclip#2#2%
+% }
+%
+% \newcommand\ST@func@sectotime[2]{%
+% \FPeval\ST@nb@hours{trunc(#1/3600,0)}\FPclip\ST@nb@hours\ST@nb@hours
+% \FPeval\ST@nb@min{trunc((#1-\ST@nb@hours*3600)/60,0)}\FPclip\ST@nb@min\ST@nb@min
+% \FPeval\ST@nb@sec{#1-3600*\ST@nb@hours-60*\ST@nb@min}\FPclip\ST@nb@sec\ST@nb@sec
+% \edef#2{%
+% \ST@nb@hours
+% :\ifnum\ST@nb@min<10 0\fi\ST@nb@min
+% \ifnum\ST@nb@sec>\z@:\ifnum\ST@nb@sec<10 0\fi\ST@nb@sec\fi}%
+% }
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%% Construction du tableau \'a afficher %%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -1568,12 +1653,12 @@
\unless\ifx\@empty\ST@dipslaycell% si ce qui a entre les marqueurs n'est pas vide
\ST@ifref\ST@dipslaycell% et si c'est une r\'ef\'erence valide
{\let\ST@next\ST@startdisplay
- \ST@expadd@tomacro\ST@next\ST@dipslaycell
- \ST@expadd@tomacro\ST@next\ST@enddisplay
- \expandafter\let\expandafter\ST@dipslaycell\csname formula@\ST@temp@formula\endcsname% alias pour la formule distante
- \unless\ifx\ST@decsep\ST@decsepfp\ST@substdecsep\ST@dipslaycell\fi% subsitution du s\'eparateur d\'ecimal s'il y a lieu
- \StrSubstitute#1\ST@next\ST@dipslaycell[#1]% on substitue <<ref>> par le champ num\'erique de la formule distante
- \let\ST@next\ST@displaynumfields
+ \ST@expadd@tomacro\ST@next\ST@dipslaycell
+ \ST@expadd@tomacro\ST@next\ST@enddisplay
+ \expandafter\let\expandafter\ST@dipslaycell\csname formula@\ST@temp@formula\endcsname% alias pour la formule distante
+ \unless\ifx\ST@decsep\ST@decsepfp\ST@substdecsep\ST@dipslaycell\fi% subsitution du s\'eparateur d\'ecimal s'il y a lieu
+ \StrSubstitute#1\ST@next\ST@dipslaycell[#1]% on substitue <<ref>> par le champ num\'erique de la formule distante
+ \let\ST@next\ST@displaynumfields
}\relax
\fi
\ST@next#1%
@@ -1597,8 +1682,8 @@
\ST@hiddencoltrue
{%
\ST@hiddencolfalse
- \ifcsname text@\number\ST@colcount @\number\ST@rowcount\endcsname% si la cellule existe
- \expandafter\let\expandafter\ST@temp@b\csname text@\number\ST@colcount @\number\ST@rowcount\endcsname% on cr\'e\'e un alias pour le texte
+ \ST@ifvalid@csname{text@\number\ST@colcount @\number\ST@rowcount}% si la cellule existe
+ {\expandafter\let\expandafter\ST@temp@b\csname text@\number\ST@colcount @\number\ST@rowcount\endcsname% on cr\'e\'e un alias pour le texte
\exploregroups
\ifnum\csname code@\number\ST@colcount @\number\ST@rowcount\endcsname=\tw@% si la cellule contient un champ num\'erique
\expandafter\let\expandafter\ST@temp@a\csname formula@\number\ST@colcount @\number\ST@rowcount\endcsname% alias pour la valeur
@@ -1610,31 +1695,30 @@
\ST@displaynumfields\ST@temp@a% affiche les champs num\'eriques des cellules entre << et >>
\noexploregroups
\ST@expadd@tomacro\ST@tab\ST@temp@a% on ajoute la cellule au tableau
- \fi
+ }\relax
}%
\advance\ST@colcount\@ne% on passe \'a la colonne suivante !
- \ifcsname code@\number\ST@colcount @\number\ST@rowcount\endcsname% y a t-il encore un code d\'efini ensuite ?
- \ifnum\csname code@\number\ST@colcount @\number\ST@rowcount\endcsname<\z@% on est dans une cellule contenant \multicol ?
+ \ST@ifvalid@csname{code@\number\ST@colcount @\number\ST@rowcount}% y a t-il encore un code d\'efini ensuite ?
+ {\ifnum\csname code@\number\ST@colcount @\number\ST@rowcount\endcsname<\z@% on est dans une cellule contenant \multicol ?
\expandafter\ST@firstarg@after\csname text@\number\numexpr\ST@colcount-1@\number\ST@rowcount\endcsname\multicolumn\ST@multicol@number% combien de cellules ?
\advance\ST@colcount\ST@multicol@number% on va voir apr\`es le multicol en sautant toutes les valeurs des colonnes interm\'ediaires
\advance\ST@colcount\m@ne
- \ifcsname code@\number\ST@colcount @\number\ST@rowcount\endcsname% y a t-il un code d\'efini apr\`es le multicol ?
- \ST@add@tomacro\ST@tab&% on ajoute la tabulation
- \fi
+ \ST@ifvalid@csname{code@\number\ST@colcount @\number\ST@rowcount}% y a t-il un code d\'efini apr\`es le multicol ?
+ {\ST@add@tomacro\ST@tab&}% on ajoute la tabulation
+ \relax
\else% pas de \multicolumn
\unless\ifST@hiddencol% si la cellule n'est pas masqu\'ee
\unless\ifnum\ST@colcount>\ST@lastshowcol% si ce n'est pas la derni\`ere cellule affich\'ee
\ST@add@tomacro\ST@tab&%on ajoute la tabulation
\fi
\fi
- \fi
- \else% il n'y a plus de code ensuite donc c'\'etait la derni\`ere colonne
- \ifcsname endrow@\number\ST@rowcount\endcsname
- \expandafter\ST@expadd@tomacro\expandafter\ST@tab\csname endrow@\number\ST@rowcount\endcsname% ajoute la fin de la ligne
- \fi
+ \fi}%
+ {\ST@ifvalid@csname{endrow@\number\ST@rowcount}%
+ {\expandafter\ST@expadd@tomacro\expandafter\ST@tab\csname endrow@\number\ST@rowcount\endcsname}% ajoute la fin de la ligne
+ \relax
\ST@colcount\@ne% on remet la colonne \'a 1
\advance\ST@rowcount\@ne% on passe \'a la ligne suivante
- \fi
+ }%
}%
\fi
\ST@nextcell
@@ -1681,9 +1765,9 @@
&% passe \'a la derni\`ere colonne de la premi\`ere ligne
\noexpand\multicolumn1l{%
\ifx\ST@temp@a\ST@debuginfo
- \ifcsname endrow@\number\ST@rowcount\endcsname
- \detokenize\expandafter\expandafter\expandafter{\csname endrow@0\endcsname}%
- \fi
+ \ST@ifvalid@csname{endrow@\number\ST@rowcount}%
+ {\detokenize\expandafter\expandafter\expandafter{\csname endrow@0\endcsname}}%
+ \relax
\fi}%
\noexpand\\\noexpand\cline{2-\number\numexpr\ST@lastshowcol+1}%
}%
@@ -1712,9 +1796,9 @@
\ST@edefadd@tomacro\ST@debugtab{%
&\noexpand\multicolumn1l{%
\ifx\ST@temp@a\ST@debuginfo
- \ifcsname endrow@\number\ST@rowcount\endcsname
- \detokenize\expandafter\expandafter\expandafter{\csname endrow@\number\ST@rowcount\endcsname}%
- \fi
+ \ST@ifvalid@csname{endrow@\number\ST@rowcount}%
+ {\detokenize\expandafter\expandafter\expandafter{\csname endrow@\number\ST@rowcount\endcsname}}%
+ \relax
\fi}%
\noexpand\\\noexpand\cline{2-\number\numexpr\ST@lastshowcol+1}}%
\ST@colcount\@ne% on remet la colonne \'a 1
@@ -1730,16 +1814,52 @@
%%%%%%%%%%%%%%%%%% Environnement spreadtab et macros publiques %%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% d\'efinit quelle sera le s\'equence de conytr\^ole qui finira les lignes
+% dans les tableaux de spreadtab
+\newcommand*\STeol[1]{\def\ST@eol{#1}}
+\STeol\\
+
+% renvoie la valeur num\'erique de la cellule de tag #1
+\newcommand\STtag[1]{%
+ \ifcsname ST@celltag@\detokenize\expandafter{#1}\endcsname
+ \csname ST@celltag@\detokenize\expandafter{#1}\endcsname
+ \else
+ \PackageError\ST@package@name{Tag "#1" is unknown, have you defined it?}\ST@seedoc@i
+ \fi
+}
+
+\newcommand*\STmakegtag[1]{%
+ \STmakegtag@i#1,\STmakegtag@i,%
+}
+
+\def\STmakegtag@i#1,{%
+ \ifx\STmakegtag@i#1%
+ \else
+ \def\ST@temp@a{#1}%
+ \ifx\@empty\ST@temp@a
+ \PackageWarning\ST@package@name{An empty tag is ignored.}%
+ \else
+ \ifcsname ST@celltag@\detokenize\expandafter{#1}\endcsname
+ \global\expandafter\let\csname ST@celltag@\detokenize\expandafter{#1}\expandafter\endcsname
+ \csname ST@celltag@\detokenize\expandafter{#1}\endcsname
+ \else
+ \PackageError\ST@package@name{Tag "#1" is unknown, have you defined it?}\ST@seedoc@i
+ \fi
+ \fi
+ \expandafter\STmakegtag@i
+ \fi
+}
+
% d\'efinit le s\'eparateur d\'ecimal
-\newcommand\STsetdecimalsep[1]{\def\ST@decsep{#1}}
+\newcommand*\STsetdecimalsep[1]{\def\ST@decsep{#1}}
\def\ST@decsepfp{.}% le s\'eparateur d\'ecimal donn\'e par fp
\STsetdecimalsep.% le point par d\'efaut
\STmessage{true}% affiche les messages par d\'efaut
\newif\ifST@clipround
-\newcommand\STautoround{\@ifstar{\ST@cliproundfalse\ST@autoround}{\ST@cliproundtrue\ST@autoround}}
-\newcommand\ST@autoround[1]{\def\ST@rounddigit{#1}}
+\newcommand*\STautoround{\@ifstar{\ST@cliproundfalse\ST@autoround}{\ST@cliproundtrue\ST@autoround}}
+\newcommand*\ST@autoround[1]{\def\ST@rounddigit{#1}}
\STautoround{}% pas d'arrondi par d\'efaut
\newcommand\STsavecell[2]{% met dans la sc #1 la valeur du champ num\'erique de la cellule sp\'ecifi\'ee par sa r\'ef\'erence ABSOLUE
@@ -1751,38 +1871,53 @@
\global\let#1#1% on rend l'assignation globale
}
-\long\def\ST@get@body#1\end{%
+\long\def\ST@get@body@env#1\end{%
\expandafter\def\expandafter\ST@tab\expandafter{\ST@tab#1}\ST@find@end
}
\newcommand\ST@find@end[1]{%
\def\ST@temp@a{#1}%
- \ifx\ST@temp@a\ST@name@env
- \def\ST@temp@a{\end{#1}}%
- \expandafter\ST@temp@a
+ \ifx\ST@temp@a\ST@package@name
+ \expandafter\spreadtab@i
\else
- \@addtomacro\ST@tab{\end{#1}}%
- \expandafter\ST@get@body
+ \ST@add@tomacro\ST@tab{\end{#1}}%
+ \expandafter\ST@get@body@env
\fi
}
-\newenvironment{spreadtab}[2][]{%
+\long\def\ST@get@body@cs#1\endspreadtab{%
+ \def\ST@tab{#1}\spreadtab@i
+}
+
+\newcommand\spreadtab[2][]{%
+ \ifx\ST@package@name\@currenvir% on vient d'un \begin{spreadtab} ?
+ \endgroup
+ \let\ST@get@body\ST@get@body@env
+ \else
+ \let\ST@get@body\ST@get@body@cs
+ \fi
+ \let\ST@FPmessages\ifFPmessages
\ifST@message\FPmessagesfalse\fi% pas de message de calcul de FP
- \expandarg% 1-d\'eveloppement des arguments (r\'eglages de xstring)
- \noexploregroups% pas d'exploration des groupes (r\'eglages de xstring)
- \@makeother\:\@makeother\;\@makeother\,% changer les catcodes pour \'eviter les incompatibilit\'es avec frenchb
- \edef\ST@name@env{\@currenvir}%
- \def\ST@tab@preamble{#2}%% pr\'eambule du tableau
- \StrChar{\@empty#2}1[\ST@tab@name]%
+ \saveexpandmode\expandarg% 1-d\'eveloppement des arguments (r\'eglages de xstring)
+ \saveexploremode\noexploregroups% pas d'exploration des groupes (r\'eglages de xstring)
+ \edef\ST@catocde@saved{\catcode`:=\the\catcode`:\relax\catcode`;=\the\catcode`;\relax}%
+ \@makeother\:\@makeother\;% changer les catcodes pour \'eviter les incompatibilit\'es avec frenchb
+ \def\ST@tab@preamble{#2}% pr\'eambule du tableau
+ \StrChar{\@empty#2}\@ne[\ST@tab@name]%
\def\ST@optcode{#1}%
- \let\ST@copylist\@empty\let\ST@row@skiplist\@empty\let\ST@col@skiplist\@empty\def\ST@last@skipcol{0}%
+ \let\ST@copylist\@empty
+ \let\ST@row@skiplist\@empty
+ \let\ST@col@skiplist\@empty
+ \def\ST@last@skipcol{0}%
\edef\ST@previous@seed{\number\FPseed}% sauvegarde de la graine
\ST@seed% graine variable
- \ST@emit@message{\ST@errname New spreadtab: \string\begin\detokenize{#2}^^J* reading tab:}%
+ \ST@emit@message{New spreadtab: \string\begin\detokenize{#2}^^J* reading tab:}%
\let\ST@tab\@empty
- \ST@get@body% met le corps de l'environnement dans \ST@tab
- }%
- {%
+ \ST@get@body% met le code du tableau dans \ST@tab
+}
+
+\newcommand\spreadtab@i{%
+ \let\ST@tag@list\@empty
\let\ST@ref@found\@empty
\ST@read@tab% analyse le tableau contenu dans \ST@tab
\ST@emit@message{ok^^J}%
@@ -1808,141 +1943,184 @@
\ST@build@tab
\ST@emit@message{ok^^J}%
\ST@expadd@tomacro\ST@tab{\expandafter\end\ST@tab@name}%
- \ST@tab% affiche le tableau
+ \expandafter\ST@tab% affiche le tableau
+ \fi
+ \ST@emit@message{End of spreadtab: \string\end\detokenize\expandafter{\ST@tab@name}^^J^^J}%
+ \FPseed\ST@previous@seed% restauration de la graine
+ \let\ifFPmessages\ST@FPmessages
+ \restoreexpandmode\restoreexploremode
+ \ST@catocde@saved
+ \ST@tag@list
+ \ST@sanitize@cs
+}
+
+\newcommand\ST@sanitize@cs{%
+ \ST@letname{endrow@0}\ST@undef@content
+ \ST@sanitize@cs@i1}
+
+\newcommand\ST@sanitize@cs@i[1]{%
+ \unless\ifnum#1>\ST@total@rownumber
+ \def\ST@temp@a{#1}%
+ \ST@letname{endrow@#1}\ST@undef@content
+ \ST@sanitize@cs@ii1%
+ \expandafter\ST@sanitize@cs@i\expandafter{\number\numexpr#1+1\expandafter}%
\fi
- \ST@emit@message{\ST@errname End of spreadtab: \string\end\detokenize\expandafter{\ST@tab@name}^^J^^J}%
- \global\FPseed\ST@previous@seed% restauration de la graine
}
+\newcommand\ST@sanitize@cs@ii[1]{%
+ \unless\ifnum#1>\ST@total@colnumber
+ \ST@letname{formula@#1@\ST@temp@a}\ST@undef@content
+ \ST@letname{code@#1@\ST@temp@a}\ST@undef@content
+ \ST@letname{text@#1@\ST@temp@a}\ST@undef@content
+ \expandafter\ST@sanitize@cs@ii\expandafter{\number\numexpr#1+1\expandafter}%
+ \fi
+}
+
+\def\ST@undef@content{\ST@undef@content}
+
\endinput
-###############################################################################
-# Historique #
-###############################################################################
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Historique %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
v0.1alpha avril 2009
-------------------------------------------------------------------------------
v0.1beta1 2009/06/06
-------------------------------------------------------------------------------
v0.1beta2 2009/06/07
- 1 Une valeur n\'egative dans une cellule provoque un bug.
- Les valeurs n\'egatives sont d\'esormais mises entre parenth\`eses
- 2 Espaces supprim\'es en d\'ebut de formules.
+ 1 Une valeur n\'egative dans une cellule provoque un bug.
+ Les valeurs n\'egatives sont d\'esormais mises entre parenth\`eses
+ 2 Espaces supprim\'es en d\'ebut de formules.
-------------------------------------------------------------------------------
v0.1beta3 2009/06/12
- 1 Espaces laiss\'es dans les formules pour pouvoir utiliser la notation
- postfix\'ee de fp.
- 2 Les r\'ef\'erences ne sont plus «@(B4)» mais indiff\'eremment «b4» ou «B4».
- 3 R\'ef\'erences relatives possibles par [x,y] ou x et y sont les d\'ecalages
- de la colonne et de la ligne par rapport \'a la cellule o\`u est
- la formule.
- 4 Bugs corrig\'es pour rendre le package compatible avec tabularx ou
- tabulary (entre autres).
+ 1 Espaces laiss\'es dans les formules pour pouvoir utiliser la notation
+ postfix\'ee de fp.
+ 2 Les r\'ef\'erences ne sont plus «@(B4)» mais indiff\'eremment «b4» ou
+ «B4».
+ 3 R\'ef\'erences relatives possibles par [x,y] ou x et y sont les
+ d\'ecalages de la colonne et de la ligne par rapport \'a la cellule
+ o\`u est la formule.
+ 4 Bugs corrig\'es pour rendre le package compatible avec tabularx ou
+ tabulary (entre autres).
-------------------------------------------------------------------------------
v0.1beta4 2009/06/21
- 1 Les espaces sont supprim\'es au d\'ebut de chaque cellule, cela cr\'eait un
- bug lorsque la cellule commençait par un nombre n\'egatif.
- 2 Mise en place de la compatibilit\'e avec la commande
- \multicolumn{nbre}{type}{contenu} du package \'eponyme
- 3 Possibilit\'e de masquer des lignes ou des colonnes enti\`eres avec les
- commandes \SThiderow et \SThidecol
- Seule condition : aucune colonne masqu\'ee ne doit se trouver dans les
- colonnes impliqu\'ees dans un \multicolum \'a moins de prendre de grandes
- pr\'ecautions et savoir les cons\'equences que cela occasionne.
+ 1 Les espaces sont supprim\'es au d\'ebut de chaque cellule, cela
+ cr\'eait un bug lorsque la cellule commençait par un nombre n\'egatif.
+ 2 Mise en place de la compatibilit\'e avec la commande
+ \multicolumn{nbre}{type}{contenu} du package \'eponyme
+ 3 Possibilit\'e de masquer des lignes ou des colonnes enti\`eres avec les
+ commandes \SThiderow et \SThidecol
+ Seule condition : aucune colonne masqu\'ee ne doit se trouver dans les
+ colonnes impliqu\'ees dans un \multicolum \'a moins de prendre de
+ grandes pr\'ecautions et savoir les cons\'equences que cela occasionne.
-------------------------------------------------------------------------------
v0.1beta5 2009/06/29
- 1 Am\'elioration des messages d'erreur et d'information
- 2 Suppression de tests superflus
- 3 Red\'efinition de \STtextcell en «@» qui est plus simple
- 4 Impl\'ementation de \STsavecell
- 5 Écriture de la documentation provisoire en français
+ 1 Am\'elioration des messages d'erreur et d'information
+ 2 Suppression de tests superflus
+ 3 Red\'efinition de \STtextcell en «@» qui est plus simple
+ 4 Impl\'ementation de \STsavecell
+ 5 \'Ecriture de la documentation provisoire en français
-------------------------------------------------------------------------------
v0.1beta6 2009/08/23
- 1 Correction d'un bug : dans une cellule, on ne pouvait pas \'ecrire
- plusieurs fois la m\^eme r\'ef\'erence.
- 2 Correction d'un bug avec \multicolumn : cette commande \'etait mal g\'er\'ee
- lorsqu'employ\'ee avec une cellule de texte.
- 3 Impl\'ementation de macro-fonctions avec diff\'erenciation selon le type
- d'argument et le type de donn\'ee renvoy\'ee.
- 4 Possibilit\'e d'imbrication des macro-fonctions.
- 5 Mise en place d'un environnement « spreadtab »
- 6 Nombreuses optimisations pour une meilleure vitesse d'ex\'ecution
+ 1 Correction d'un bug : dans une cellule, on ne pouvait pas \'ecrire
+ plusieurs fois la m\^eme r\'ef\'erence.
+ 2 Correction d'un bug avec \multicolumn : cette commande \'etait mal
+ g\'er\'ee lorsqu'employ\'ee avec une cellule de texte.
+ 3 Impl\'ementation de macro-fonctions avec diff\'erenciation selon le
+ type d'argument et le type de donn\'ee renvoy\'ee.
+ 4 Possibilit\'e d'imbrication des macro-fonctions.
+ 5 Mise en place d'un environnement « spreadtab »
+ 6 Nombreuses optimisations pour une meilleure vitesse d'ex\'ecution
-------------------------------------------------------------------------------
v0.1pre 2009/09/02
- 1 Mise au point des messages d'erreurs et des arr\^ets de compilation selon
- les erreurs rencontr\'ees.
- 2 Correction d'un bug dans \ST@coord@toref
- 3 Les cellules vides, textuelles ou jointes par un \multicolumn sont
- ignor\'ees dans les plages de cellules concern\'ees par les fonctions sum
- et sumprod
- 4 Les noms de mois accentu\'es et \today sont d\'esormais permis en argument
- de la fonction frlongdatetonum
- 5 somprod corrig\'e en sumprod, plus anglais !
- 6 La macro fonction rnd, trop complexe est supprim\'ee au profit de rand et
- randint
- 7 Am\'eliorations et optimisations
+ 1 Mise au point des messages d'erreurs et des arr\^ets de compilation
+ selon les erreurs rencontr\'ees.
+ 2 Correction d'un bug dans \ST@coord@toref
+ 3 Les cellules vides, textuelles ou jointes par un \multicolumn sont
+ ignor\'ees dans les plages de cellules concern\'ees par les fonctions
+ sum et sumprod
+ 4 Les noms de mois accentu\'es et \today sont d\'esormais permis en
+ argument de la fonction frlongdatetonum
+ 5 somprod corrig\'e en sumprod, plus anglais !
+ 6 La macro fonction rnd, trop complexe est supprim\'ee au profit de rand
+ et randint
+ 7 Am\'eliorations et optimisations
-------------------------------------------------------------------------------
v0.1 2009/11/03 Premi\`ere version publique sur le CTAN
-------------------------------------------------------------------------------
v0.2 2010/01/24
- 1 On peut d\'efinir le s\'eparateur d\'ecimal par la macro
- \STsetdecimalsep{<caract\`ere>}
- 2 Il est possible de copier une formule dans le tableau \'a l'aide de
- \STcopy{>a,vb}{formule} o\`u a et b sont les nombres de cellules
- horizontaux et verticaux vers lesquels la formule sera copi\'ee.
- 3 D\'esormais, spreadtab est enti\`erement compatible avec toutes les
+ 1 On peut d\'efinir le s\'eparateur d\'ecimal par la macro
+ \STsetdecimalsep{<caract\`ere>}
+ 2 Il est possible de copier une formule dans le tableau \'a l'aide de
+ \STcopy{>a,vb}{formule} o\`u a et b sont les nombres de cellules
+ horizontaux et verticaux vers lesquels la formule sera copi\'ee.
+ 3 D\'esormais, spreadtab est enti\`erement compatible avec toutes les
commandes du package booktabs
- 4 La commande \noalign et son argument est prise en compte lorsqu'elle se
- trouve apr\`es un \\
- 5 Suppression d'espaces ind\'esirables
- 6 Mise en place d'un mode d\'ebogage o\`u l'on peut visualiser les champs
- num\'eriques, les champs textuels ou les codes des cellules du tableau
+ 4 La commande \noalign et son argument est prise en compte lorsqu'elle se
+ trouve apr\`es un \\
+ 5 Suppression d'espaces ind\'esirables
+ 6 Mise en place d'un mode d\'ebogage o\`u l'on peut visualiser les champs
+ num\'eriques, les champs textuels ou les codes des cellules du tableau
-------------------------------------------------------------------------------
v0.2a 2010/02/02
- 1 Ajout de la traduction en vietnamien et correction d'erreurs dans la
- documentation française.
- 2 Implementation beta et donc non visible des macros fonctions gcd, lcm
- Ces macro-fonctions ne sont pas encore document\'ees.
+ 1 Ajout de la traduction en vietnamien et correction d'erreurs dans la
+ documentation française.
+ 2 Implementation beta et donc non visible des macros fonctions gcd, lcm
+ Ces macro-fonctions ne sont pas encore document\'ees.
-------------------------------------------------------------------------------
v0.3 2010/03/28
- 1 La macro \STautoround{x} admet une version \'etoil\'ee pour laquelle les
- nombres sont arrondis et format\'es pour avoir x chiffres apr\`es la
- virgules en rajoutant des 0 inutiles si besoin
- 2 La valeur sauvegard\'ee par \STsavecell tient d\'esormais compte du
+ 1 La macro \STautoround{x} admet une version \'etoil\'ee pour laquelle
+ les nombres sont arrondis et format\'es pour avoir x chiffres apr\`es
+ la virgule en rajoutant des 0 inutiles si besoin
+ 2 La valeur sauvegard\'ee par \STsavecell tient d\'esormais compte du
s\'eparateur d\'ecimal
- 3 Macro fonctions "gcd" (PGCD), "lcm" (PPCM) et "scitodec" pour convertir
- une \'ecriture scientifique en une \'ecriture d\'ecimale
- 4 Dans le champ textuel d'une cellule, on peut d\'esormais afficher le
- champ num\'erique d'une cellule avec <<ref>>
- 5 Am\'elioration de l'algorithme pour \STcopy : enleve une formule de
- \ST@copylist lorsqu'on a d\'epass\'e la derni\`ere ligne de la plage o\`u elle
- doit \^etre copi\'ee
- 6 Correction d'un bug lorsque la macro-fonction admettant un argument
- textuel a un argument faisant r\'ef\'erence \'a une autre cellule : enlever
- ":=" si besoin
- 7 Correction d'un bug dans xstring qui changeait les catcodes des tokens
- de \@xs@afterinteger lorsqu'on appelle \IfInteger
- 8 Correction d'un bug dans \ST@build@tab@i pour prendre en compte les
- cellules de code 0 dans lesquelles ":=" doit \^etre supprim\'e
+ 3 Macro fonctions "gcd" (PGCD), "lcm" (PPCM) et "scitodec" pour convertir
+ une \'ecriture scientifique en une \'ecriture d\'ecimale
+ 4 Dans le champ textuel d'une cellule, on peut d\'esormais afficher le
+ champ num\'erique d'une cellule avec <<ref>>
+ 5 Am\'elioration de l'algorithme pour \STcopy : enleve une formule de
+ \ST@copylist lorsqu'on a d\'epass\'e la derni\`ere ligne de la plage
+ o\`u elle doit \^etre copi\'ee
+ 6 Correction d'un bug lorsque la macro-fonction admettant un argument
+ textuel a un argument faisant r\'ef\'erence \'a une autre cellule :
+ enlever ":=" si besoin
+ 7 Correction d'un bug dans xstring qui changeait les catcodes des tokens
+ de \@xs@afterinteger lorsqu'on appelle \IfInteger
+ 8 Correction d'un bug dans \ST@build@tab@i pour prendre en compte les
+ cellules de code 0 dans lesquelles ":=" doit \^etre supprim\'e
-------------------------------------------------------------------------------
v0.3a 2010/05/15
- 1 Correction d'un bug dans \ST@gobble@remain : ce qui reste \'a manger peut
- contenir des tokens de catcode 1 ou 2 ce qui fait que l'utilisation
- d'arguments d\'elimit\'es ne fonctionnerait pas dans ces cas.
+ 1 Correction d'un bug dans \ST@gobble@remain : ce qui reste \'a manger
+ peut contenir des tokens de catcode 1 ou 2 ce qui fait que
+ l'utilisation d'arguments d\'elimit\'es ne fonctionnerait pas dans ces
+ cas.
-------------------------------------------------------------------------------
v0.3b 2010/06/06
- 1 Correction d'un bug concernant les macro-fonctions renvoyant un texte.
- Lorsque leur argument contenait une r\'ef\'erence, celle-ci devenait une
- cellule texte.
- 2 Correction d'un bug sur la macro \ST@stackcall : il faut y enlever
+ 1 Correction d'un bug concernant les macro-fonctions renvoyant un texte.
+ Lorsque leur argument contenait une r\'ef\'erence, celle-ci devenait
+ une cellule texte.
+ 2 Correction d'un bug sur la macro \ST@stackcall : il faut y enlever
toutes les occurrences de la cellule en train d'\^etre calcul\'ee
- 3 Modification de l'ordre de calcul des cellules concern\'ees par les macro
- fonctions sum et somprod
- 4 Correction d'un bug dans la façon dont sont produites les skiplist
+ 3 Modification de l'ordre de calcul des cellules concern\'ees par les
+ macro fonctions sum et somprod
+ 4 Correction d'un bug dans la façon dont sont produites les skiplist
\ST@row@skiplist et \STcol@skiplist
- 5 Impl\'ementation de la macro fonction "id"
+ 5 Impl\'ementation de la macro fonction "id"
-------------------------------------------------------------------------------
v0.3c 2011/04/08
- 1 Correction d'un gros bug lors de la substitution d'une r\'ef\'erence de type
- <lettre><nbre> lorsque nbre>10 : a10 \'etait vu comme "a1" suivi de 0, et
- m\^eme pour tousles nbre>10 !
- 2 Macro \STprintnum \ No newline at end of file
+ 1 Correction d'un gros bug lors de la substitution d'une r\'ef\'erence de
+ type <lettre><nbre> lorsque nbre>10 : a10 \'etait vu comme "a1" suivi
+ de 0, et m\^eme pour tous les nbre>10 !
+ 2 Macro \STprintnum
+-------------------------------------------------------------------------------
+v0.4 2011/07/04
+ 1 Les calculs se font en dehors d'un groupe pour \'eviter l'erreur de
+ save-satck
+ 2 Possibilit\'e d'\'ecrire aussi \spreadtab<code tableau>\endspreadtab
+ 3 Macros fonctions tag, cell, row, col et la macro \STtag qui permet de
+ faire appel \`a la valeur de la cellule marqu\'ee par la macro fonction
+ tag. \STmakegtag rend les sauvegardes globales.
+ 4 La commande \STeol permet de choisir quel est le marqueur de
+ fin de ligne dans les tableau de spreadtab
+ 5 dans une cellule mixte, les macro fonctions renvoyant du texte ont leur
+ r\'esultat qui prend la place de :={<formule>} \ No newline at end of file