# Array and macro resetting

I would like to make an array with some automatic calculations. I use the package ftlpoint.

I made a test, but it does not work:

\newcommand{\line}[2]{%
\fpMul{\produit}{#1}{#2}% Calculation
\produit&%print result
\produit&print result in another cell
}


On the first cell, no problem, but in the second cell, LaTeX says the command \produit doesn't exist (undefined control sequence).

How can do this?

Ps. Of course, my example is very simplified. I would like to make other calculations as well.

-
You example is to simplified ;-) Please add a minimal working example. –  Marco Daniel Sep 7 '11 at 15:15
You should use \MyLine instead of \line as I believe that is already defined elsewhere. –  Peter Grill Sep 7 '11 at 15:26
Yes, in fact, i work in french, so I use \ligne and not \line –  Maïeul Sep 8 '11 at 15:58

I think you need to make the definition of \produit global. Otherwise it goes out of existence when you move into another table cell.

\documentclass{article}
\usepackage{fltpoint}
\newcommand{\tline}[2]{%
\fpMul{\temp}{#1}{#2}\global\edef\produit{\temp}% Calcul
\produit&%seeing result
\produit%seeing result on a other cell
}
\begin{document}
\begin{tabular}{c|c}
\tline{2}{3}
\end{tabular}
\end{document}

-
Instead of \global\edef you could simply use \xdef. –  mhp Sep 7 '11 at 15:37
the problem is that I have one value of produit by line. So I can't have an unique value –  Maïeul Sep 8 '11 at 9:16
@Maieul --- That doesn't matter. \edef (or \xdef as @mhp suggests) will overwrite any old value that exists. –  Ian Thompson Sep 8 '11 at 11:00
@lan Thompson : thank ! I did'nt know the \edef command :) –  Maïeul Sep 8 '11 at 15:57
@Maieul: if this answers your question, you can select it. –  ℝaphink Sep 10 '11 at 6:54