Newsgroups: comp.text.tex
From: oberd...@ruf.uni-freiburg.de (Heiko Oberdiek)
Date: 1998/04/08
Subject: Re: Adding a \ref to a counter?
Jon Haugsand <haugs...@regulus.nr.no> wrote: In a thread in de.comp.text.tex I have written commands to convert >In a humble attempt to simulate a spreadsheet in LaTeX, I tried to add >a \ref to a counter like this: >\newcounter{bbb}\setcounter{bbb}{50}\addtocounter{bbb}{\ref{AAA}} >This did not work out as \ref{AAA} is not a number. Is it possible to \ref into a number. Here the next version as a package file: --- snip --- 'refcount.sty' --- snip --- begin --- \newcommand{\@FirstParam}{} \newcommand{\@useref}[3]{% } \newcommand{\setcounterwithref}[2]{% \@useref\setcounter{#1}{#2}% } \newcommand{\addtocounterwithref}[2]{% \@useref\addtocounter{#1}{#2}% } \endinput --- snip --- 'refcount.sty' --- snip --- end --- Your example looks now: --- snip --- 'test.tex' --- snip --- end --- \newcounter{aaa} \begin{document} \setcounter{aaa}{-100}\refstepcounter{aaa}\label{AAA} \end{document} Yours sincerely You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||