ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* bizarre bug in xml
@ 2020-11-20 21:44 Thomas A. Schmitz
  2020-11-20 21:52 ` Wolfgang Schuster
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas A. Schmitz @ 2020-11-20 21:44 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Hi all,

this is the most bizarre bug I've ever seen in context. I would be 
grateful if others could try to replicate it. Test file:

\startbuffer[test]
<document>
     <hskip width="1em"/>Materiam vati da Venus alma tuo.
</document>
\stopbuffer

\startxmlsetups xml:testsetups
         \xmlsetsetup{#1}{*}{-}
	\xmlsetsetup{#1}{document|
			hskip}{xml:*}
\stopxmlsetups

\xmlregistersetup{xml:testsetups}

\startxmlsetups xml:document
    \xmlflush{#1}
\stopxmlsetups

\startxmlsetups xml:hskip
	\hskip\xmlatt{#1}{width}
\stopxmlsetups

\starttext
	\xmlprocessbuffer{main}{test}{}
\stoptext

This gives an error with the latest lmtx (2020.11.19 11:28, linux 64 bit):

tex error       > tex error on line 10 in file ./xmltest.tex: Valid 
keyword expected, likely 'minus'


<lua output> Ma
     teriam vati da Venus alma tuo.
<macro> \22>:xml:document #1->\xmlflush {#1}

<lua output> }


<macro> \22>:xml:process #1->\xmlregistereddocumentsetups 
{#1}{#1}\xmlmain {#1}


<macro> \lxml_process ...ocument {#3}#2{#3}{#4}\setcatcodetable 
\notcatcodes \doifelsenothing {#5}{\xmlsetup 
{#3}{xml:process}}{\xmlsetup {#3}{#5}}
     \endgroup

<line 4.24>     \xmlprocessbuffer{main}{test}{}

The file compiles cleanly if I give the --luatex switch.

Now for the bizarre part: if you delete the capital M of "Materiam" or 
replace it by any other capital letter, the file compiles. What's going 
on here?

Thanks, and all best

Thomas
___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: bizarre bug in xml
  2020-11-20 21:44 bizarre bug in xml Thomas A. Schmitz
@ 2020-11-20 21:52 ` Wolfgang Schuster
  2020-11-21  1:09   ` Pablo Rodriguez
       [not found]   ` <b5a7ee4f-2f0e-c60b-ea39-0de4c0bfef79@uni-bonn.de>
  0 siblings, 2 replies; 6+ messages in thread
From: Wolfgang Schuster @ 2020-11-20 21:52 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Thomas A. Schmitz

Thomas A. Schmitz schrieb am 20.11.2020 um 22:44:
> 
> Hi all,
> 
> this is the most bizarre bug I've ever seen in context. I would be 
> grateful if others could try to replicate it. Test file:
> 
> \startbuffer[test]
> <document>
>      <hskip width="1em"/>Materiam vati da Venus alma tuo.
> </document>
> \stopbuffer
> 
> \startxmlsetups xml:testsetups
>          \xmlsetsetup{#1}{*}{-}
>      \xmlsetsetup{#1}{document|
>              hskip}{xml:*}
> \stopxmlsetups
> 
> \xmlregistersetup{xml:testsetups}
> 
> \startxmlsetups xml:document
>     \xmlflush{#1}
> \stopxmlsetups
> 
> \startxmlsetups xml:hskip
>      \hskip\xmlatt{#1}{width}

     \hskip\xmlatt{#1}{width}\relax

> The file compiles cleanly if I give the --luatex switch.
> 
> Now for the bizarre part: if you delete the capital M of "Materiam" or 
> replace it by any other capital letter, the file compiles. What's going 
> on here?

Optional arguments (e.g. plus/minus values for \hskip) for commands are 
handled different in LMTX but it was always recommended to add \relax 
after the last value.

Wolfgang
___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: bizarre bug in xml
  2020-11-20 21:52 ` Wolfgang Schuster
@ 2020-11-21  1:09   ` Pablo Rodriguez
  2020-11-21  9:35     ` Hans Hagen
       [not found]   ` <b5a7ee4f-2f0e-c60b-ea39-0de4c0bfef79@uni-bonn.de>
  1 sibling, 1 reply; 6+ messages in thread
From: Pablo Rodriguez @ 2020-11-21  1:09 UTC (permalink / raw)
  To: ntg-context

On 11/20/20 10:52 PM, Wolfgang Schuster wrote:
> [...]
> Optional arguments (e.g. plus/minus values for \hskip) for commands are
> handled different in LMTX but it was always recommended to add \relax
> after the last value.

Hi Wolfgang,

the same would apply to \vskip, wouldn’t it?

Many thanks for your help,

Pablo
--
http://www.ousia.tk
___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: bizarre bug in xml
  2020-11-21  1:09   ` Pablo Rodriguez
@ 2020-11-21  9:35     ` Hans Hagen
  0 siblings, 0 replies; 6+ messages in thread
From: Hans Hagen @ 2020-11-21  9:35 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Pablo Rodriguez

On 11/21/2020 2:09 AM, Pablo Rodriguez wrote:
> On 11/20/20 10:52 PM, Wolfgang Schuster wrote:
>> [...]
>> Optional arguments (e.g. plus/minus values for \hskip) for commands are
>> handled different in LMTX but it was always recommended to add \relax
>> after the last value.
> 
> Hi Wolfgang,
> 
> the same would apply to \vskip, wouldn’t it?
also for \hrule and \vrule (and in pdftex/luatex some backend related 
primitives); primitives like \hbox have their keyword scan terminated by 
a leftbrace token

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: bizarre bug in xml
       [not found]   ` <b5a7ee4f-2f0e-c60b-ea39-0de4c0bfef79@uni-bonn.de>
@ 2020-11-21 10:04     ` Wolfgang Schuster
  2020-11-21 10:13       ` Thomas A. Schmitz
  0 siblings, 1 reply; 6+ messages in thread
From: Wolfgang Schuster @ 2020-11-21 10:04 UTC (permalink / raw)
  To: Thomas A. Schmitz; +Cc: NTG-Context ConTeXt users

Thomas A. Schmitz schrieb am 20.11.2020 um 22:57:
>
> On 11/20/20 10:52 PM, Wolfgang Schuster wrote:
>> Optional arguments (e.g. plus/minus values for \hskip) for commands 
>> are handled different in LMTX but it was always recommended to add 
>> \relax after the last value.
>
> Thank you Wolfgang, that makes the file indeed compile again! Any 
> explanation for the strange behavior of the error?

In LMTX the order of the plus and minus values of \hskip can be written 
in any order and it's even possible to set them multiple times (try the 
example below with LuaTeX and LMTX).

To check whether a stretch or shrink value is set LMTX takes a look at 
the next character (p, P, m or M) before it makes a decision, when you 
have now a word after \hskip which start with one of these characters 
(e.g. Materiam) you trigger the scanner which fails because it didn't 
find a keyword. To avoid such problems always add \relax after the last 
value of \hskip, this is even explained in one of the exercises in the 
TeXbook.

\starttext

a\hskip 1cm plus 5mm minus 5mm b

a\hskip 1cm minus 5mm plus 5mm b

a\hskip 1cm pLuS 5mm MiNuS 5mm b

a\hskip 1cm plus 5mm minus 5mm plus 1cm b

\stoptext

Wolfgang

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: bizarre bug in xml
  2020-11-21 10:04     ` Wolfgang Schuster
@ 2020-11-21 10:13       ` Thomas A. Schmitz
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas A. Schmitz @ 2020-11-21 10:13 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Wolfgang Schuster

On 11/21/20 11:04 AM, Wolfgang Schuster wrote:
> To check whether a stretch or shrink value is set LMTX takes a look at 
> the next character (p, P, m or M) before it makes a decision, when you 
> have now a word after \hskip which start with one of these characters 
> (e.g. Materiam) you trigger the scanner which fails because it didn't 
> find a keyword. To avoid such problems always add \relax after the last 
> value of \hskip, this is even explained in one of the exercises in the 
> TeXbook.

Thank you Wolfgang, now it all makes sense. I will relax more and dust 
off my copy of the TeXbook. I used to read small chapters in the tramway 
on my way to the university, but with the lockdown, I didn't have this 
opportunity. Nah, just kidding, I haven't looked at it in a long time.

Thomas
___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

end of thread, other threads:[~2020-11-21 10:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-20 21:44 bizarre bug in xml Thomas A. Schmitz
2020-11-20 21:52 ` Wolfgang Schuster
2020-11-21  1:09   ` Pablo Rodriguez
2020-11-21  9:35     ` Hans Hagen
     [not found]   ` <b5a7ee4f-2f0e-c60b-ea39-0de4c0bfef79@uni-bonn.de>
2020-11-21 10:04     ` Wolfgang Schuster
2020-11-21 10:13       ` Thomas A. Schmitz

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