ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Malicious little bugger
@ 2006-07-02  4:36 David Arnold
  2006-07-02 11:23 ` Hans Hagen
  0 siblings, 1 reply; 12+ messages in thread
From: David Arnold @ 2006-07-02  4:36 UTC (permalink / raw)


All,

Came across this again.

\placeformula[-]
\startformula
[9,\infty)=\{x:\,x\ge 9\}
\stopformula

Got it to compile with:

\placeformula[-]
\startformula\relax
[9,\infty)=\{x:\,x\ge 9\}
\stopformula

Yuk!

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

* Re: Malicious little bugger
  2006-07-02  4:36 Malicious little bugger David Arnold
@ 2006-07-02 11:23 ` Hans Hagen
  2006-07-02 18:15   ` Peter Münster
  0 siblings, 1 reply; 12+ messages in thread
From: Hans Hagen @ 2006-07-02 11:23 UTC (permalink / raw)


David Arnold wrote:
> All,
>
> Came across this again.
>
> \placeformula[-]
> \startformula
> [9,\infty)=\{x:\,x\ge 9\}
> \stopformula
>
> Got it to compile with:
>
> \placeformula[-]
> \startformula\relax
> [9,\infty)=\{x:\,x\ge 9\}
> \stopformula
>
>   
indeed, that's the price to pay for optional arguments

Hans 


-----------------------------------------------------------------
                                          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] 12+ messages in thread

* Re: Malicious little bugger
  2006-07-02 11:23 ` Hans Hagen
@ 2006-07-02 18:15   ` Peter Münster
  2006-07-02 19:01     ` Taco Hoekwater
  2006-07-02 19:53     ` Hans Hagen
  0 siblings, 2 replies; 12+ messages in thread
From: Peter Münster @ 2006-07-02 18:15 UTC (permalink / raw)


On Sun, 2 Jul 2006, Hans Hagen wrote:

> David Arnold wrote:
> >
> > \startformula\relax
> > [9,\infty)=\{x:\,x\ge 9\}
> > \stopformula
> >
> indeed, that's the price to pay for optional arguments

Really? Isn't it rather the price for optional space before the "["?
Cheers, Peter

-- 
http://pmrb.free.fr/contact/

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

* Re: Malicious little bugger
  2006-07-02 18:15   ` Peter Münster
@ 2006-07-02 19:01     ` Taco Hoekwater
  2006-07-02 19:53     ` Hans Hagen
  1 sibling, 0 replies; 12+ messages in thread
From: Taco Hoekwater @ 2006-07-02 19:01 UTC (permalink / raw)


Peter Münster wrote:
> On Sun, 2 Jul 2006, Hans Hagen wrote:
> 
> 
>>David Arnold wrote:
>>
>>>\startformula\relax
>>>[9,\infty)=\{x:\,x\ge 9\}
>>>\stopformula
>>>
>>
>>indeed, that's the price to pay for optional arguments
> 
> Really? Isn't it rather the price for optional space before the "["?

Same thing, because there is no way to turn that optional space off.

Taco

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

* Re: Malicious little bugger
  2006-07-02 18:15   ` Peter Münster
  2006-07-02 19:01     ` Taco Hoekwater
@ 2006-07-02 19:53     ` Hans Hagen
  2006-07-02 20:25       ` Peter Münster
  2006-07-02 23:35       ` David Arnold
  1 sibling, 2 replies; 12+ messages in thread
From: Hans Hagen @ 2006-07-02 19:53 UTC (permalink / raw)


� wrote:
> On Sun, 2 Jul 2006, Hans Hagen wrote:
>
>   
>> David Arnold wrote:
>>     
>>> \startformula\relax
>>> [9,\infty)=\{x:\,x\ge 9\}
>>> \stopformula
>>>
>>>       
>> indeed, that's the price to pay for optional arguments
>>     
>
> Really? Isn't it rather the price for optional space before the "["?
>   
for tex: 

  \bla[

and 
 
  \bla [ 

are the same, i.e. the \cs ends at a non-letter and the space is gobbled 

Hans 

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

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

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

* Re: Malicious little bugger
  2006-07-02 19:53     ` Hans Hagen
@ 2006-07-02 20:25       ` Peter Münster
  2006-07-02 23:35       ` David Arnold
  1 sibling, 0 replies; 12+ messages in thread
From: Peter Münster @ 2006-07-02 20:25 UTC (permalink / raw)


On Sun, 2 Jul 2006, Hans Hagen wrote:

> for tex: 
> 
>   \bla[
> 
> and 
>  
>   \bla [ 
> 
> are the same, i.e. the \cs ends at a non-letter and the space is gobbled 

Ah, I see...
Then, the #1 in
         \def\MyZigzag#1[#2]{% 
             % the #1 makes sure we allow a space before the bracket
on page http://wiki.contextgarden.net/Commands_with_KeyVal_arguments seems
to be not really necessary.

Thanks, Peter

-- 
http://pmrb.free.fr/contact/

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

* Re: Malicious little bugger
  2006-07-02 19:53     ` Hans Hagen
  2006-07-02 20:25       ` Peter Münster
@ 2006-07-02 23:35       ` David Arnold
  2006-07-03  2:29         ` Sanjoy Mahajan
  1 sibling, 1 reply; 12+ messages in thread
From: David Arnold @ 2006-07-02 23:35 UTC (permalink / raw)


Can someone give me an example where this happens in either latex or  
tex?


On Jul 2, 2006, at 12:53 PM, Hans Hagen wrote:

> � wrote:
>> On Sun, 2 Jul 2006, Hans Hagen wrote:
>>
>>
>>> David Arnold wrote:
>>>
>>>> \startformula\relax
>>>> [9,\infty)=\{x:\,x\ge 9\}
>>>> \stopformula
>>>>
>>>>
>>> indeed, that's the price to pay for optional arguments
>>>
>>
>> Really? Isn't it rather the price for optional space before the "["?
>>
> for tex:
>
>   \bla[
>
> and
>
>   \bla [
>
> are the same, i.e. the \cs ends at a non-letter and the space is  
> gobbled
>
> Hans
>
> -----------------------------------------------------------------
>                                           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
> -----------------------------------------------------------------
>
> _______________________________________________
> ntg-context mailing list
> ntg-context@ntg.nl
> http://www.ntg.nl/mailman/listinfo/ntg-context

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

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

* Re: Malicious little bugger
  2006-07-02 23:35       ` David Arnold
@ 2006-07-03  2:29         ` Sanjoy Mahajan
  2006-07-03  2:32           ` David Arnold
  0 siblings, 1 reply; 12+ messages in thread
From: Sanjoy Mahajan @ 2006-07-03  2:29 UTC (permalink / raw)


>> are the same, i.e. the \cs ends at a non-letter and the space is  
>> gobbled

> Can someone give me an example where this happens in either latex or  
> tex?

Not sure if this example is what you're looking for, but a typical
case in TeX or LaTeX is:

  \TeX has a programming language that only a mother could love.

which should be written as

  \TeX{} has a programming language that only a mother could love.

or as 

  \TeX\ has a ...

-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] 12+ messages in thread

* Re: Malicious little bugger
  2006-07-03  2:29         ` Sanjoy Mahajan
@ 2006-07-03  2:32           ` David Arnold
  2006-07-03  5:17             ` Aditya Mahajan
  2006-07-03  6:26             ` Taco Hoekwater
  0 siblings, 2 replies; 12+ messages in thread
From: David Arnold @ 2006-07-03  2:32 UTC (permalink / raw)


Sanjoy,

Of course. Thanks.

But how about an example in latex or tex where a function eats a  
brace and crashes, as what happens with this context code:

  \placeformula[-]
  \startformula
  [9,\infty)=\{x:\,x\ge 9\}
  \stopformula

I know I've seen this in Latex before, but I can't remember where.

On Jul 2, 2006, at 7:29 PM, Sanjoy Mahajan wrote:

>>> are the same, i.e. the \cs ends at a non-letter and the space is
>>> gobbled
>
>> Can someone give me an example where this happens in either latex or
>> tex?
>
> Not sure if this example is what you're looking for, but a typical
> case in TeX or LaTeX is:
>
>   \TeX has a programming language that only a mother could love.
>
> which should be written as
>
>   \TeX{} has a programming language that only a mother could love.
>
> or as
>
>   \TeX\ has a ...
>
> -Sanjoy
>
> `Never underestimate the evil of which men of power are capable.'
>          --Bertrand Russell, _War Crimes in Vietnam_, chapter 1.
> _______________________________________________
> ntg-context mailing list
> ntg-context@ntg.nl
> http://www.ntg.nl/mailman/listinfo/ntg-context

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

* Re: Malicious little bugger
  2006-07-03  2:32           ` David Arnold
@ 2006-07-03  5:17             ` Aditya Mahajan
  2006-07-03  8:43               ` Hans Hagen
  2006-07-03  6:26             ` Taco Hoekwater
  1 sibling, 1 reply; 12+ messages in thread
From: Aditya Mahajan @ 2006-07-03  5:17 UTC (permalink / raw)


On Sun, 2 Jul 2006, David Arnold wrote:

> Sanjoy,
>
> Of course. Thanks.
>
> But how about an example in latex or tex where a function eats a
> brace and crashes, as what happens with this context code:
>
>  \placeformula[-]
>  \startformula
>  [9,\infty)=\{x:\,x\ge 9\}
>  \stopformula
>
> I know I've seen this in Latex before, but I can't remember where.

\begin{equation}
  \begin{aligned}
    [g,\infty)=\{...\}
  \end{aligned}
\end{equation}

The package mathtools enforces that the optional arguments of aligned 
et al. should come in the same line, that is

\begin{aligned}[t] takes "t" as an optional arguments which

\begin{aligned}
[t]

does not.

I do not think that this can be ever enforced in Context, because a 
lot of Context code is written like

\definesomething
   [somename]
   [some options]

\dosingleempty et al, could be changed to stop scanning on a newline, 
but I am certain it will break some of the internals.

Aditya

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

* Re: Malicious little bugger
  2006-07-03  2:32           ` David Arnold
  2006-07-03  5:17             ` Aditya Mahajan
@ 2006-07-03  6:26             ` Taco Hoekwater
  1 sibling, 0 replies; 12+ messages in thread
From: Taco Hoekwater @ 2006-07-03  6:26 UTC (permalink / raw)


David Arnold wrote:
> Sanjoy,
> 
> Of course. Thanks.
> 
> But how about an example in latex or tex where a function eats a  
> brace and crashes, as what happens with this context code:
> 
>   \placeformula[-]
>   \startformula
>   [9,\infty)=\{x:\,x\ge 9\}
>   \stopformula
> 
> I know I've seen this in Latex before, but I can't remember where.

LaTeX's newline -- \\ -- command is infamous for this, esp. because
non-expert users tend to forget it even has an optional argument.

Greetings, Taco

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

* Re: Malicious little bugger
  2006-07-03  5:17             ` Aditya Mahajan
@ 2006-07-03  8:43               ` Hans Hagen
  0 siblings, 0 replies; 12+ messages in thread
From: Hans Hagen @ 2006-07-03  8:43 UTC (permalink / raw)


Aditya Mahajan wrote:
> On Sun, 2 Jul 2006, David Arnold wrote:
>
>   
>> Sanjoy,
>>
>> Of course. Thanks.
>>
>> But how about an example in latex or tex where a function eats a
>> brace and crashes, as what happens with this context code:
>>
>>  \placeformula[-]
>>  \startformula
>>  [9,\infty)=\{x:\,x\ge 9\}
>>  \stopformula
>>
>> I know I've seen this in Latex before, but I can't remember where.
>>     
>
> \begin{equation}
>   \begin{aligned}
>     [g,\infty)=\{...\}
>   \end{aligned}
> \end{equation}
>
> The package mathtools enforces that the optional arguments of aligned 
> et al. should come in the same line, that is
>
> \begin{aligned}[t] takes "t" as an optional arguments which
>
> \begin{aligned}
> [t]
>   
that only can work if one gives the end of line characters a different 
catcode; a side effect is that the lookahead may fail when the formula 
is passed in a macro so it will never be robust
> does not.
>
> I do not think that this can be ever enforced in Context, because a 
> lot of Context code is written like
>
> \definesomething
>    [somename]
>    [some options]
>
> \dosingleempty et al, could be changed to stop scanning on a newline, 
> but I am certain it will break some of the internals.
>   
indeed,

for tex (unless one messes around with the endline char)

\define[]
\define []
\define      []
\define
  []

is the same, and in order to be consistent, context even does some 
explicit testing so that intermediate newlines and spaces are gobbles 
(when non standard), think of:

\define[][]
\define[] []
\define []
  []

why should we treat spaces between \define [] and [] [] differently?

anyhow, it dates back a long time, is rather optimized, and will not change

Hans

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

end of thread, other threads:[~2006-07-03  8:43 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-02  4:36 Malicious little bugger David Arnold
2006-07-02 11:23 ` Hans Hagen
2006-07-02 18:15   ` Peter Münster
2006-07-02 19:01     ` Taco Hoekwater
2006-07-02 19:53     ` Hans Hagen
2006-07-02 20:25       ` Peter Münster
2006-07-02 23:35       ` David Arnold
2006-07-03  2:29         ` Sanjoy Mahajan
2006-07-03  2:32           ` David Arnold
2006-07-03  5:17             ` Aditya Mahajan
2006-07-03  8:43               ` Hans Hagen
2006-07-03  6:26             ` Taco Hoekwater

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