-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

I'm trying to write a document which includes financial data, towards the end I sum up various costs using a counter (\newcounter and all that) and some simple macros. This works fine and gets me the total costs at the end of the document. But I would like to copy the final figure to the start of the document for a summary, and of course I'd like this automatic (even if that means running the document through LaTeX twice after a change).

The approach I'm taking is to try and save the counter value to the .aux file with this command:

\newcommand{\savemetoaux}[2]{\addtocounter{#1}{-1}\refstepcounter{#1}\label{#2}}

The idea is, if "totalcost" is the counter with the final costs, to write in the document at the end:

\savemetoaux{totalcost}{finalcostsum}

and then retrieve at the head of the document with

\ref{finalcostsum}

Needless to say it does not work! The error message, with teTeX version 2.0 (downloaded late January 2003) and compiled on Linux:

"(./proposal.toc [1]) [2]Segmentation fault (core dumped)"

Any ideas as to what is wrong? or can anyone suggest an alternative strategy to getting the counter value from the tail of the document printed at the head?

Many thanks for any suggestions,

David.

- -- - ---------------------------------------------------------------------
Dr David C Hendry, School of Engineering and Physical Sciences,
University of Aberdeen, Kings College, Aberdeen, Scotland, AB24 3UE.
Tel UK 01224 272790, Fax UK 01224 272497, www.eng.abdn.ac.uk/~eng186
- ---------------------------------------------------------------------


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.1 (GNU/Linux)
Comment: Using GnuPG with Netscape - http://enigmail.mozdev.org

iEYEARECAAYFAj5clhEACgkQyfpMEny1NzsRKQCfchd78YJ5VF6/23svjPUMzwZC
E/UAnidMAdlQJWj7oUjoixHQMqTCtH1m
=Lyyt
-----END PGP SIGNATURE-----

Reply via email to