syntax for numbercommand and \gobbleoneargument
This minimal file [case 1]: \setuphead[chapter][numbercommand={\gobbleoneargument} ] \starttext \chapter{One} \stoptext fails. Whereas if the first two lines are replaced by [case 2]: \setuphead[chapter][numbercommand={\gobbleoneargument}, ] or [case 3]: \setuphead[chapter][numbercommand={\gobbleoneargument}] then it's fine. Is this a bug or a feature of TeX's tricky spacing rules? And how can I think about ConTeXt's parsing in way that the difference between cases 1 and 2,3 is obvious? The error is (with tex : pdfeTeX, 3.141592-1.21a-2.2 (Web2C 7.5.4), context : ver: 2006.04.17 23:14): ERROR: Argument of \gobbleoneargument has an extra }. --- TeX said --- <inserted text> \par <to be read again> } \@@kochapternumbercommand ->{\gobbleoneargument } <argument> ...{\??ko \v!chapter \c!numbercommand } {\setstrut \begstrut \exec... \@@ko::normal ...numbercontent \setbox 0\hbox {{#1 }\hskip \numberheaddistanc... \doplaceheadnumbertext ...utes \dostopattributes } }\fi \endheadplacement {#1... ... l.4 \chapter{One}
On Thu, 20 Apr 2006, Sanjoy Mahajan wrote:
This minimal file [case 1]:
\setuphead[chapter][numbercommand={\gobbleoneargument} ] \starttext \chapter{One} \stoptext
fails. Whereas if the first two lines are replaced by [case 2]:
\setuphead[chapter][numbercommand={\gobbleoneargument}, ]
or [case 3]:
\setuphead[chapter][numbercommand={\gobbleoneargument}]
then it's fine. Is this a bug or a feature of TeX's tricky spacing rules? And how can I think about ConTeXt's parsing in way that the difference between cases 1 and 2,3 is obvious?
A newline is treated in general as a space, so you have unwanted space in case 1. case 2 shows just a ConTeXt feature: space after a "," in an option list is gobbled. case 3 is the normal way to write \setup-commands If you really want a newline as in case 1, then consider case 4: \setuphead[chapter][numbercommand={\gobbleoneargument}% ] Cheers, Peter -- http://pmrb.free.fr/contact/
Thanks for the useful explanations.
A newline is treated in general as a space, so you have unwanted space in case 1.
Right, but what confused me was that I expected the closing brace in numbercommand={\gobbleoneargument} to bound what numbercommand was set to.
If you really want a newline as in case 1, then consider case 4:
I'm happy to put the ] on the same line. I had ended up with case 1 by mistake after a bunch of experiments with exercise numbering, and then it took me a while to figure out the change that was causing the error. -Sanjoy `Never underestimate the evil of which men of power are capable.' --Bertrand Russell, _War Crimes in Vietnam_, chapter 1.
Sanjoy Mahajan wrote:
This minimal file [case 1]:
\setuphead[chapter][numbercommand={\gobbleoneargument} ] \starttext \chapter{One} \stoptext
fails. Whereas if the first two lines are replaced by [case 2]:
in this case the command is "{\gobbleoneargument} " and {\gobbleoneargument} {some text} will fail because gobble runs into an }
\setuphead[chapter][numbercommand={\gobbleoneargument}, ]
in this case the command is {\gobbleoneargument" and \gobbleoneargument{some text} work sok
or [case 3]:
\setuphead[chapter][numbercommand={\gobbleoneargument}]
then it's fine. Is this a bug or a feature of TeX's tricky spacing rules? And how can I think about ConTeXt's parsing in way that the difference between cases 1 and 2,3 is obvious?
idem it's [key=value] [key=value, nextkey=nextvalue] (spaces are dropped after the comma) so in [key=value ,nextkey=nextvalue] the comma before the , is part of key's value ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
participants (3)
-
Hans Hagen
-
Peter Münster
-
Sanjoy Mahajan