ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Aditya Mahajan <adityam@umich.edu>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Strange bug with reversed itemize
Date: Fri, 14 Sep 2012 18:06:22 -0400 (EDT)	[thread overview]
Message-ID: <alpine.LNX.2.02.1209141804080.4289@qrpragenyvmrq> (raw)
In-Reply-To: <123393FA-6BA3-473D-BD6A-55DEE1BC4466@gmail.com>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 2575 bytes --]

On Fri, 14 Sep 2012, Wolfgang Schuster wrote:

>
> Am 14.09.2012 um 00:36 schrieb Aditya Mahajan <adityam@umich.edu>:
>
>> I have been able to isolate the bug to the update on 2012.07.09; specifically to this commit.
>>
>> http://repo.or.cz/w/context.git/blobdiff/6f124794f7dc253f8b83f2517c26ce17e50d66ff..refs/heads/origin:/tex/context/base/strc-num.mkiv
>>
>> If I replace the current version of strc-num.mkiv with the version from 2012.07.09:
>> http://repo.or.cz/w/context.git/blob_plain/6f124794f7dc253f8b83f2517c26ce17e50d66ff:/tex/context/base/strc-num.mkiv
>>
>> then the numbering is correct.
>>
>> However, I cannot figure out what is causing the bug in that change.
>
> Part of the problem is this code block:
>
> \def\strc_counters_check_setup#1% does it have to happen here?
>  {% this can be done at the lua end / a bit messy here ... todo ...
>   \ifcsname\??counter#1\c!number\endcsname
>        \doifelsevalue   {\??counter#1\c!number}{#1} {\letbeundefined{\??counter#1\c!number}}%
>       {\doifvaluenothing{\??counter#1\c!number}     {\letbeundefined{\??counter#1\c!number}}}%
>   \fi
>   \ifcsname\??counter#1\c!number\endcsname
>     % it's a clone
>   \else
>     \edef\currentcounterlevel{\thenamedcounterlevel{#1}}%
>     \edef\p_start{\counterparameter{#1}\c!start}%
>     \ctxcommand{checkcountersetup("#1",\currentcounterlevel,\ifx\p_start\empty0\else\number\p_start\fi,"\counterparameter{#1}\c!state")}%
>   \fi}
>
> ConTeXt uses \p_start to store the current value of the start parameter.
> When you set now a value for start in \setuppagenumber the value is kept
> in \p_start (because there are no groups). When you start now the itemize
> environment the same code is loaded and the start parameter (which hasn’t
> been set yet) expands to a very stupid default value which is by another
> helper function.
>
> \def\strc_counter_setup_using_parameter#1#2% name \someparameter
>  {\edef\p_start{#2\c!start}%
>   \setupcounter
>     [#1]
>     [              \c!start=\ifx\p_start\empty0\else\number\p_start\fi,
>                           ...
>           \c!numbersegments=#2\c!numbersegments]}
>
>
> As you can see here the start parameter expands to \p_start when it isn’t empty
> what is the case here and because of this you get a wrong value for the item numbers.

Thanks for the diagnosis. What will be a good way to fix this? I think 
that

\expanded{\setupcounter[#1][\c!start=\ifx\p_start\empty0\else\number\p_start\fi.,...]}

should work (but I haven't tested it yet).

Aditya

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2012-09-14 22:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-13  0:34 Aditya Mahajan
2012-09-13  3:30 ` burwoad
2012-09-13  3:36   ` Aditya Mahajan
2012-09-13  7:59 ` Otared Kavian
2012-09-13 16:18   ` Aditya Mahajan
2012-09-13 22:36     ` Aditya Mahajan
2012-09-13 22:49       ` Aditya Mahajan
2012-09-13 23:11       ` Wolfgang Schuster
2012-09-14 22:06         ` Aditya Mahajan [this message]
2012-09-15  8:03           ` Wolfgang Schuster
2012-09-15 18:06             ` Aditya Mahajan
2012-09-16 10:52               ` Hans Hagen

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=alpine.LNX.2.02.1209141804080.4289@qrpragenyvmrq \
    --to=adityam@umich.edu \
    --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).