On Wed, Sep 04, 2002 at 07:44:15PM +0300, Dekel Tsur wrote: > On Tue, Sep 03, 2002 at 10:32:00PM +1000, John Sheahan wrote: > > Hi > > > > In my lyx doc I'd like to be able to add up a couple of > > numbers, perhaps in a table, maybe in a paragraph, get a total > > > > and then be able to copy the result (sort of like a label) > > somewhere else in the document, as a summary. > > > > Is this possible somehow? > > It is possible using latex code: > \newcounter{tmp} > \setcounter{tmp}{0} > \addtocounter{tmp}{10} > \addtocounter{tmp}{5} > \arabic{tmp} > > To save typing, you can use > \newcommand{\add}[1]{\addtocounter{tmp}{#1}} > and then you can write \add{10} instead of \addtocounter{tmp}{10}
Thanks Derek, Andre I discovered also I could use an external escape to the shell with something like echo $[ 1 + 2 ] arter tweaking external_templates. (lets not consider security here for a few minutes) or I could include tex from gnumeric with additional processing. while I do not understand the math_extern at all - and could really use a pointer/example code here, these solutions appear to suffer from 2 disadvantages firstly, I'd quite like to be able to read the half dozen numbers I am adding from the lyx window. If I really want to include a big spreadsheet somehow I can do that, but it seems overkill for addimg a couple of numbers that maybe are in a table, maybe in the text but are described with text. And its nice to see the sum at write time also secondly, I want to gather a few numbers from random sections together in the summary chapter. And to be really difficult my summary is at the start of the document. \arabic{blah} appears to work as long as the summary is after the sum. Given the number of documents I've read where there are obselete sections after a couple of changes, many word processors must have this problem. regards, John