* beginner question re: counters
@ 2003-09-17 17:16 Matthew Huggett
2003-09-17 17:41 ` Pawel Jackowski na Onet
0 siblings, 1 reply; 9+ messages in thread
From: Matthew Huggett @ 2003-09-17 17:16 UTC (permalink / raw)
Hi:
I apologize for asking such a basic question. What is the correct way
to increment a counter such that each time a macro is used, the counter
is augmented by 1. So far, I have \newcount\MyCounter and have tried
\advance\MyCounter by1 and a few other things I found online, but
whenever I try to increase its value by 1, all references to it's value
return 1. Not a particularly useful counter ;-) .
Thanks,
Matt
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: beginner question re: counters
2003-09-17 17:16 beginner question re: counters Matthew Huggett
@ 2003-09-17 17:41 ` Pawel Jackowski na Onet
2003-09-17 21:10 ` sorry (off topic) Pawel Jackowski na Onet
2003-09-21 13:51 ` beginner question re: counters Patrick Gundlach
0 siblings, 2 replies; 9+ messages in thread
From: Pawel Jackowski na Onet @ 2003-09-17 17:41 UTC (permalink / raw)
> I apologize for asking such a basic question. What is the correct way
> to increment a counter such that each time a macro is used, the counter
> is augmented by 1. So far, I have \newcount\MyCounter and have tried
> \advance\MyCounter by1 and a few other things I found online, but
> whenever I try to increase its value by 1, all references to it's value
> return 1. Not a particularly useful counter ;-) .
Hmmm... It can happens for many reasons.
Try for instance
\global\advance\MyCounter by 1\relax
\the\MyCounter
% \relax is not always obligatory but treat it as a goode habit
^ permalink raw reply [flat|nested] 9+ messages in thread
* sorry (off topic)
2003-09-17 17:41 ` Pawel Jackowski na Onet
@ 2003-09-17 21:10 ` Pawel Jackowski na Onet
2003-09-17 22:32 ` Tobias Burnus
2003-09-21 13:51 ` beginner question re: counters Patrick Gundlach
1 sibling, 1 reply; 9+ messages in thread
From: Pawel Jackowski na Onet @ 2003-09-17 21:10 UTC (permalink / raw)
Hi
> % \relax is not always obligatory but treat it as a goode habit
^^^^^
What I wanted to say by 'goode'? Sorry for that... I sent it too fast.
Sorry for any other mistakes in my messages. Belive me, it's not my
negligence.
I work hard on it...
Pawe/l
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: sorry (off topic)
2003-09-17 21:10 ` sorry (off topic) Pawel Jackowski na Onet
@ 2003-09-17 22:32 ` Tobias Burnus
2003-09-19 19:00 ` Henning Hraban Ramm
0 siblings, 1 reply; 9+ messages in thread
From: Tobias Burnus @ 2003-09-17 22:32 UTC (permalink / raw)
Hello,
On Wed, Sep 17, 2003 at 11:10:37PM +0200, Pawel Jackowski na Onet wrote:
> > % \relax is not always obligatory but treat it as a goode habit
> What I wanted to say by 'goode'?
While it is not an English word (says the Oxford English Dictionary)
there is
Goode, Richard (Stephen)
(b NY, 1943). Amer. pianist. Début NY 1962 (NY Young Concert Artists).
Eur. début Spoleto Fest. 1964. Member of Boston Symphony Chamber Players
1967-9 and of Chamber Mus. Soc. of Lincoln Center, NY, 1969-79 and 1983-9.
Won 1st prize Clara Haskil comp. 1973. Wide repertory and has recorded
complete cycle of Beethoven sonatas.
(The Concise Oxford Dictionary of Music.)
Doesn't sound too bad ;)
Tobias
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: sorry (off topic)
2003-09-17 22:32 ` Tobias Burnus
@ 2003-09-19 19:00 ` Henning Hraban Ramm
0 siblings, 0 replies; 9+ messages in thread
From: Henning Hraban Ramm @ 2003-09-19 19:00 UTC (permalink / raw)
>>> % \relax is not always obligatory but treat it as a goode habit
>> What I wanted to say by 'goode'?
> While it is not an English word (says the Oxford English Dictionary)
> there is
> Goode, Richard (Stephen)
And it is a olde(!) english form of "good" as well, medieval I think.
Grüßlis vom Hraban!
--
http://www.fiee.net/texnique/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: beginner question re: counters
2003-09-17 17:41 ` Pawel Jackowski na Onet
2003-09-17 21:10 ` sorry (off topic) Pawel Jackowski na Onet
@ 2003-09-21 13:51 ` Patrick Gundlach
2003-09-21 15:04 ` Matthew Huggett
2003-09-21 15:59 ` Pawel Jackowski na Onet
1 sibling, 2 replies; 9+ messages in thread
From: Patrick Gundlach @ 2003-09-21 13:51 UTC (permalink / raw)
Hi,
Matthew Huggett <mhuggett@zam.att.ne.jp> writes:
>> I apologize for asking such a basic question. What is the correct way
>> to increment a counter such that each time a macro is used, the counter
>> is augmented by 1.
"Pawel Jackowski na Onet" <jackos1@poczta.onet.pl> writes:
> Hmmm... It can happens for many reasons.
> Try for instance
> ...
General remark (not really concerning this thread):
It would be nice if the original posters would comment answers like
this one if this works fine or not. Since these mails are archived,
other people might come across this post and wonder if this is a good
solution or not.
Just my $50^{-1}$ Euro
Patrick
--
Silent is the goldfish in its bowl
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Re: beginner question re: counters
2003-09-21 13:51 ` beginner question re: counters Patrick Gundlach
@ 2003-09-21 15:04 ` Matthew Huggett
2003-09-22 7:28 ` Hans Hagen
2003-09-21 15:59 ` Pawel Jackowski na Onet
1 sibling, 1 reply; 9+ messages in thread
From: Matthew Huggett @ 2003-09-21 15:04 UTC (permalink / raw)
Patrick Gundlach wrote:
>Hi,
>
>Matthew Huggett <mhuggett@zam.att.ne.jp> writes:
>
>
>
>>>I apologize for asking such a basic question. What is the correct way
>>>to increment a counter such that each time a macro is used, the counter
>>>is augmented by 1.
>>>
>>>
>
>
>"Pawel Jackowski na Onet" <jackos1@poczta.onet.pl> writes:
>
>
>
>
>>Hmmm... It can happens for many reasons.
>>Try for instance
>>...
>>
>>
>
>General remark (not really concerning this thread):
>
>It would be nice if the original posters would comment answers like
>this one if this works fine or not. Since these mails are archived,
>other people might come across this post and wonder if this is a good
>solution or not.
>
>
>Just my $50^{-1}$ Euro
>
>Patrick
>
>
>
Yeah, the solution worked. Just to recap:
What I wanted was a macro and counter such that each time the macro gets
used the counter gets augmented + 1.
The solution was:
\newcount\MyCounter
\define[1]\MyMacro{
\global\advance\MyCounter by 1 \relax
\number\MyCounter #1}
\starttext
\MyMacro{Hello}
\MyMacro{Goodbye}
\MyMacro{Hello again}
\stoptext
--> 1Hello 2Goodbye 3Hello again
Matt
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Re: beginner question re: counters
2003-09-21 13:51 ` beginner question re: counters Patrick Gundlach
2003-09-21 15:04 ` Matthew Huggett
@ 2003-09-21 15:59 ` Pawel Jackowski na Onet
1 sibling, 0 replies; 9+ messages in thread
From: Pawel Jackowski na Onet @ 2003-09-21 15:59 UTC (permalink / raw)
"Patrick Gundlach" <pg@levana.de> writes:
> [...]
> It would be nice if the original posters would comment answers like
> this one if this works fine or not. Since these mails are archived,
> other people might come across this post and wonder if this is a good
> solution or not.
>
>
> Just my $50^{-1}$ Euro
Ok, I will do my best to comment messages in more readable way.
Pawe/l
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Re: beginner question re: counters
2003-09-21 15:04 ` Matthew Huggett
@ 2003-09-22 7:28 ` Hans Hagen
0 siblings, 0 replies; 9+ messages in thread
From: Hans Hagen @ 2003-09-22 7:28 UTC (permalink / raw)
At 00:04 22/09/2003 +0900, you wrote:
>\newcount\MyCounter
>\define[1]\MyMacro{
> \global\advance\MyCounter by 1 \relax
> \number\MyCounter #1}
>
>\starttext
>\MyMacro{Hello}
>\MyMacro{Goodbye}
>\MyMacro{Hello again}
>\stoptext
>--> 1Hello 2Goodbye 3Hello again
or, using pseudo counters:
\define[1]\MyMacro
{\doglobal\increment\MyCounter
\MyCounter#1}
or even
\define\MyCounter{\doglobal\increment\MyCounter\MyCounter}
Hans
-------------------------------------------------------------------------
Hans Hagen | PRAGMA ADE | pragma@wxs.nl
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
information: http://www.pragma-ade.com/roadmap.pdf
documentation: http://www.pragma-ade.com/showcase.pdf
-------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2003-09-22 7:28 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-17 17:16 beginner question re: counters Matthew Huggett
2003-09-17 17:41 ` Pawel Jackowski na Onet
2003-09-17 21:10 ` sorry (off topic) Pawel Jackowski na Onet
2003-09-17 22:32 ` Tobias Burnus
2003-09-19 19:00 ` Henning Hraban Ramm
2003-09-21 13:51 ` beginner question re: counters Patrick Gundlach
2003-09-21 15:04 ` Matthew Huggett
2003-09-22 7:28 ` Hans Hagen
2003-09-21 15:59 ` Pawel Jackowski na Onet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).