ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* syntax for numbercommand and \gobbleoneargument
@ 2006-04-20 19:09 Sanjoy Mahajan
  2006-04-20 19:53 ` Peter Münster
  2006-04-20 20:55 ` Hans Hagen
  0 siblings, 2 replies; 4+ messages in thread
From: Sanjoy Mahajan @ 2006-04-20 19:09 UTC (permalink / raw)


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}

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: syntax for numbercommand and \gobbleoneargument
  2006-04-20 19:09 syntax for numbercommand and \gobbleoneargument Sanjoy Mahajan
@ 2006-04-20 19:53 ` Peter Münster
  2006-04-20 20:42   ` Sanjoy Mahajan
  2006-04-20 20:55 ` Hans Hagen
  1 sibling, 1 reply; 4+ messages in thread
From: Peter Münster @ 2006-04-20 19:53 UTC (permalink / raw)


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/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: syntax for numbercommand and \gobbleoneargument
  2006-04-20 19:53 ` Peter Münster
@ 2006-04-20 20:42   ` Sanjoy Mahajan
  0 siblings, 0 replies; 4+ messages in thread
From: Sanjoy Mahajan @ 2006-04-20 20:42 UTC (permalink / raw)


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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: syntax for numbercommand and \gobbleoneargument
  2006-04-20 19:09 syntax for numbercommand and \gobbleoneargument Sanjoy Mahajan
  2006-04-20 19:53 ` Peter Münster
@ 2006-04-20 20:55 ` Hans Hagen
  1 sibling, 0 replies; 4+ messages in thread
From: Hans Hagen @ 2006-04-20 20:55 UTC (permalink / raw)


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
-----------------------------------------------------------------

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-04-20 20:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-20 19:09 syntax for numbercommand and \gobbleoneargument Sanjoy Mahajan
2006-04-20 19:53 ` Peter Münster
2006-04-20 20:42   ` Sanjoy Mahajan
2006-04-20 20:55 ` Hans Hagen

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).