ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Carsten Fechtmann <fecht@zarm-technik.de>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Bug or feature? Strange counter behaviour in macro
Date: Sun, 13 Jan 2008 00:52:21 +0100	[thread overview]
Message-ID: <B358A15C-A773-4D7C-A60B-17EEBD36419B@zarm-technik.de> (raw)
In-Reply-To: <alpine.DEB.0.9999.0801121726170.21905@nqv-yncgbc>

Hi Aditya,

yes, looking at the .tuo did the trick. :-D

I had tried things with expanded already, but at that time I still had
> {\expanded{\Issue[\IssueCounter]{Issue~\IssueCounter:}{\currentdate}}}
as command. Which does NOT work (due to the tilde ~ resulting in an  
error message then)
The rest was actually fine. Now, without it (i.e. "~") it works!
...
{\expanded{\Issue[\IssueCounter]{Issue: \IssueCounter:}{\currentdate}}}
...

Thanks a lot, that had me seriously baffled ;-)
Carsten

On 12.01.2008 at 23:29 wrote Aditya Mahajan:

> Hi Carsten,
>
> On Sat, 12 Jan 2008, Carsten Fechtmann wrote:
>
>> What this all burns down is, that I /really/ would like to  
>> understand,
>> how I can pass a value from a counter as (constant) argument to a  
>> self-
>> defined function. As that seems to be the core of the matter/problem
>> here.
>
> You need to understand how synonyms work. It writes enteries to the  
> tuo
> file, and then uses that in the second pass to sort things. One way to
> make sure that you have the correct entry in the tuo file is to use
> expanded:
>
> \definesynonyms[Issue][issues][\IssueText][\IssueDate]
> \setupsynonyms[Issue][criterium=all]
>
> \newcounter\IssueCounter
>
> \def\NewIssue{\dosingleargument\doNewIssue}
>
> \def\doNewIssue[#1]%
>   {\increment\IssueCounter
>     %Debug: \IssueCounter / \getnumber[IssueNumber]%
>     \doifelsenothing{#1}
>       {\expanded{\Issue[\IssueCounter]{\IssueCounter}{\currentdate}}}
>       {\expanded{\Issue[\IssueCounter]{\IssueCounter}{#1}}}}
>
> % Compare the tuo file with and without expanded and you will know  
> what is
> % happening.
>
> \starttext
> \NewIssue[January 9, 2008]
> \NewIssue[January 10, 2008]
> \NewIssue                       % January 11, 2008
>
> List of issue \# and dates:
>
> \placelistofissues \blank
>
> \IssueDate{\IssueCounter} % produces correct result in either case
>
> \stoptext
>
> Aditya
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an  
> entry to the Wiki!
>
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive  : https://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


  reply	other threads:[~2008-01-12 23:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-11 18:13 Carsten Fechtmann
2008-01-12 17:44 ` Aditya Mahajan
2008-01-12 19:45   ` Carsten Fechtmann
2008-01-12 22:29     ` Aditya Mahajan
2008-01-12 23:52       ` Carsten Fechtmann [this message]
2008-01-13  2:40         ` Aditya Mahajan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=B358A15C-A773-4D7C-A60B-17EEBD36419B@zarm-technik.de \
    --to=fecht@zarm-technik.de \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).