Strange bug with reversed itemize
Hi, For some reason, the numbering in itemize is affected by the value of userpage! \setupuserpagenumber[start=12] \starttext \startitemize[n,reverse] \item One \item Two \stopitemize \stoptext With ConTeXt 2012.09.11 20:36 I get 13. One 12. Two Any ideas? Aditya
What your got is already reversed, isn't it?
On Thu, Sep 13, 2012 at 8:34 AM, Aditya Mahajan
Hi,
For some reason, the numbering in itemize is affected by the value of userpage!
\setupuserpagenumber[start=12] \starttext \startitemize[n,reverse] \item One \item Two \stopitemize \stoptext
With ConTeXt 2012.09.11 20:36 I get
13. One 12. Two
Any ideas?
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 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/http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ______________________________**______________________________** _______________________
On Thu, Sep 13, 2012 at 8:34 AM, Aditya Mahajan
wrote: Hi,
For some reason, the numbering in itemize is affected by the value of userpage!
\setupuserpagenumber[start=12] \starttext \startitemize[n,reverse] \item One \item Two \stopitemize \stoptext
With ConTeXt 2012.09.11 20:36 I get
13. One 12. Two
Any ideas?
What your got is already reversed, isn't it?
Yes, but setting the page number to 12 should not start the item numbers from 12! Aditya
Hi Aditya,
Yes it is a strange behaviour and it appears only when using mkiv and reversed itemize, even with
\setuppagenumber[start=12]
instead of
\setupuserpagenumber[start=12]
Also the pagenumber remains unchanged with either of these commands, which means that it's a bug.
I tested your example with Context version 2011.11.29, mkiv and there everything is correct.
Best regards: OK
On 13 sept. 2012, at 02:34, Aditya Mahajan
Hi,
For some reason, the numbering in itemize is affected by the value of userpage!
\setupuserpagenumber[start=12] \starttext \startitemize[n,reverse] \item One \item Two \stopitemize \stoptext
With ConTeXt 2012.09.11 20:36 I get
13. One 12. Two
Any ideas?
Aditya
On Thu, 13 Sep 2012, Otared Kavian wrote:
On 13 sept. 2012, at 02:34, Aditya Mahajan
wrote: For some reason, the numbering in itemize is affected by the value of userpage!
\setupuserpagenumber[start=12] \starttext \startitemize[n,reverse] \item One \item Two \stopitemize \stoptext
With ConTeXt 2012.09.11 20:36 I get
13. One 12. Two
Any ideas?
Yes it is a strange behaviour and it appears only when using mkiv and reversed itemize, even with \setuppagenumber[start=12] instead of \setupuserpagenumber[start=12] Also the pagenumber remains unchanged with either of these commands, which means that it's a bug.
I tested your example with Context version 2011.11.29, mkiv and there everything is correct.
Thanks for testing. I also tested with 2012.07. \setupserpagenumber does not change the page number (but \setcounter[userpage][start=12] does!) The item numbers come out correctly. So, the bug with wrong item numbers was introduced recently; the bug with \setupuserpagenumber not working came sometime earlier. Aditya
On Thu, 13 Sep 2012, Aditya Mahajan wrote:
On Thu, 13 Sep 2012, Otared Kavian wrote:
On 13 sept. 2012, at 02:34, Aditya Mahajan
wrote: For some reason, the numbering in itemize is affected by the value of userpage!
\setupuserpagenumber[start=12] \starttext \startitemize[n,reverse] \item One \item Two \stopitemize \stoptext
With ConTeXt 2012.09.11 20:36 I get
13. One 12. Two
Any ideas?
Yes it is a strange behaviour and it appears only when using mkiv and reversed itemize, even with \setuppagenumber[start=12] instead of \setupuserpagenumber[start=12] Also the pagenumber remains unchanged with either of these commands, which means that it's a bug.
I tested your example with Context version 2011.11.29, mkiv and there everything is correct.
Thanks for testing. I also tested with 2012.07.
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/6f124794f7dc253f8b83f2517c26ce17e50... 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/6f124794f7dc253f8b83f2517c26ce17e... then the numbering is correct. However, I cannot figure out what is causing the bug in that change. Aditya
On Thu, 13 Sep 2012, Aditya Mahajan wrote:
On Thu, 13 Sep 2012, Aditya Mahajan wrote:
On Thu, 13 Sep 2012, Otared Kavian wrote:
On 13 sept. 2012, at 02:34, Aditya Mahajan
wrote: For some reason, the numbering in itemize is affected by the value of userpage!
\setupuserpagenumber[start=12] \starttext \startitemize[n,reverse] \item One \item Two \stopitemize \stoptext
With ConTeXt 2012.09.11 20:36 I get
13. One 12. Two
Any ideas?
Yes it is a strange behaviour and it appears only when using mkiv and reversed itemize, even with \setuppagenumber[start=12] instead of \setupuserpagenumber[start=12] Also the pagenumber remains unchanged with either of these commands, which means that it's a bug.
I tested your example with Context version 2011.11.29, mkiv and there everything is correct.
Thanks for testing. I also tested with 2012.07.
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/6f124794f7dc253f8b83f2517c26ce17e50...
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/6f124794f7dc253f8b83f2517c26ce17e...
then the numbering is correct.
However, I cannot figure out what is causing the bug in that change.
The bug disappears if I add \setupstructurecounting[start=0] or \setupstructurecounting[start=\zerocount] in the test file! Aditya
Am 14.09.2012 um 00:36 schrieb Aditya Mahajan
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/6f124794f7dc253f8b83f2517c26ce17e50...
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/6f124794f7dc253f8b83f2517c26ce17e...
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. Wolfgang
On Fri, 14 Sep 2012, Wolfgang Schuster wrote:
Am 14.09.2012 um 00:36 schrieb Aditya Mahajan
: 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/6f124794f7dc253f8b83f2517c26ce17e50...
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/6f124794f7dc253f8b83f2517c26ce17e...
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
Am 15.09.2012 um 00:06 schrieb Aditya Mahajan
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).
I would do the expansion here but with \normalexpanded. \def\strc_counter_setup_using_parameter#1#2% name \someparameter {\edef\p_start{#2\c!start}% %\setupcounter \normalexpanded{\setupcounter [#1] [ \c!start=\ifx\p_start\empty0\else\number\p_start\fi, \c!state=#2\c!state, % beware, "" == start \c!way=#2\c!way, % \c!prefix=#2\c!prefix, \c!prefixseparatorset=#2\c!prefixseparatorset, \c!prefixconversion=#2\c!prefixconversion, \c!prefixconversionset=#2\c!prefixconversionset, \c!prefixstarter=#2\c!prefixstarter, \c!prefixstopper=#2\c!prefixstopper, \c!prefixset=#2\c!prefixset, \c!prefixsegments=#2\c!prefixsegments, \c!prefixset=#2\c!prefixset, \c!prefixconnector=#2\c!prefixconnector, % \c!numberseparatorset=#2\c!numberseparatorset, \c!numberconversion=#2\c!numberconversion, \c!numberconversionset=#2\c!numberconversionset, \c!numberstarter=#2\c!numberstarter, \c!numberstopper=#2\c!numberstopper, % \c!numbersegments=#2\c!numbersegments]} \c!numbersegments=#2\c!numbersegments]}} Wolfgang
On Sat, 15 Sep 2012, Wolfgang Schuster wrote:
Am 15.09.2012 um 00:06 schrieb Aditya Mahajan
: 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).
I would do the expansion here but with \normalexpanded.
\def\strc_counter_setup_using_parameter#1#2% name \someparameter {\edef\p_start{#2\c!start}% %\setupcounter \normalexpanded{\setupcounter [#1] [ \c!start=\ifx\p_start\empty0\else\number\p_start\fi, \c!state=#2\c!state, % beware, "" == start \c!way=#2\c!way, % \c!prefix=#2\c!prefix, \c!prefixseparatorset=#2\c!prefixseparatorset, \c!prefixconversion=#2\c!prefixconversion, \c!prefixconversionset=#2\c!prefixconversionset, \c!prefixstarter=#2\c!prefixstarter, \c!prefixstopper=#2\c!prefixstopper, \c!prefixset=#2\c!prefixset, \c!prefixsegments=#2\c!prefixsegments, \c!prefixset=#2\c!prefixset, \c!prefixconnector=#2\c!prefixconnector, % \c!numberseparatorset=#2\c!numberseparatorset, \c!numberconversion=#2\c!numberconversion, \c!numberconversionset=#2\c!numberconversionset, \c!numberstarter=#2\c!numberstarter, \c!numberstopper=#2\c!numberstopper, % \c!numbersegments=#2\c!numbersegments]} \c!numbersegments=#2\c!numbersegments]}}
Thanks. Hans, can you add this to strc-num.mkiv? Aditya
On 15-9-2012 20:06, Aditya Mahajan wrote:
On Sat, 15 Sep 2012, Wolfgang Schuster wrote:
Am 15.09.2012 um 00:06 schrieb Aditya Mahajan
: 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).
I would do the expansion here but with \normalexpanded.
\def\strc_counter_setup_using_parameter#1#2% name \someparameter {\edef\p_start{#2\c!start}% %\setupcounter \normalexpanded{\setupcounter [#1] [ \c!start=\ifx\p_start\empty0\else\number\p_start\fi, \c!state=#2\c!state, % beware, "" == start \c!way=#2\c!way, % \c!prefix=#2\c!prefix, \c!prefixseparatorset=#2\c!prefixseparatorset, \c!prefixconversion=#2\c!prefixconversion, \c!prefixconversionset=#2\c!prefixconversionset, \c!prefixstarter=#2\c!prefixstarter, \c!prefixstopper=#2\c!prefixstopper, \c!prefixset=#2\c!prefixset, \c!prefixsegments=#2\c!prefixsegments, \c!prefixset=#2\c!prefixset, \c!prefixconnector=#2\c!prefixconnector, % \c!numberseparatorset=#2\c!numberseparatorset, \c!numberconversion=#2\c!numberconversion, \c!numberconversionset=#2\c!numberconversionset, \c!numberstarter=#2\c!numberstarter, \c!numberstopper=#2\c!numberstopper, % \c!numbersegments=#2\c!numbersegments]} \c!numbersegments=#2\c!numbersegments]}}
Thanks.
Hans, can you add this to strc-num.mkiv?
Sure, as I assume that Wolfgang investigated possible side effects. Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
participants (5)
-
Aditya Mahajan
-
burwoad
-
Hans Hagen
-
Otared Kavian
-
Wolfgang Schuster