ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* xml parsing
@ 2008-11-28  8:43 Thomas A. Schmitz
  2008-11-28  9:22 ` Wolfgang Schuster
  2008-11-28  9:23 ` Hans Hagen
  0 siblings, 2 replies; 6+ messages in thread
From: Thomas A. Schmitz @ 2008-11-28  8:43 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi all, Hans,

this is a terribly inaccurate bug report, and I apologize for its  
form, but it's something you and other people might want to look at.  
Or maybe I should change my files, I don't know. Here comes:

SUMMARY

The new mkiv xml parser sometimes "eats" parts of my xml files when  
they are typeset. It appears to skip parts of text between two tags.

DESCRIPTION

I have no minimal example, just a description: for my lectures, I have  
defined a counter to tell me when I  want to show the next slide:

\definelabel[SlideNumber][headstyle=normal,way=bytext]

\define\sln{\color[red]{ [\nextSlideNumber]}}

For my xml files, I have wrapped this into a xml command:

\startxmlsetups xml:sln
	\sln
\stopxmlsetups

This works wonderfully in most cases. To make my source file more  
readable, I usually code

foo
<sln/>
bar

In this case, the xml parser SOMETIMES (not reproducibly,  
unfortunately) skips the "bar" part up to the next paragraph <p> tag.  
When I take away the line break and write

foo <sln/> bar

the "bar" part appears normally.

ANECDOTE

I write my lectures in xml so I can put them on a website for my  
students, and I deliver them from typeset notes. This happened to me  
last Tuesday. I had typeset and printed my notes, and then while  
lecturing realized that an entire paragraph was missing. I could ad- 
lib it, but this is not something you want to happen at an important  
job-talk...

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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: xml parsing
  2008-11-28  8:43 xml parsing Thomas A. Schmitz
@ 2008-11-28  9:22 ` Wolfgang Schuster
  2008-11-28 10:16   ` Thomas A. Schmitz
  2008-11-28  9:23 ` Hans Hagen
  1 sibling, 1 reply; 6+ messages in thread
From: Wolfgang Schuster @ 2008-11-28  9:22 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi Thomas,

On Fri, Nov 28, 2008 at 9:43 AM, Thomas A. Schmitz
<Thomas.Schmitz@uni-bonn.de> wrote:
> Hi all, Hans,
>
> this is a terribly inaccurate bug report, and I apologize for its
> form, but it's something you and other people might want to look at.
> Or maybe I should change my files, I don't know. Here comes:
>
> SUMMARY
>
> The new mkiv xml parser sometimes "eats" parts of my xml files when
> they are typeset. It appears to skip parts of text between two tags.
>
> DESCRIPTION
>
> I have no minimal example, just a description: for my lectures, I have
> defined a counter to tell me when I  want to show the next slide:
>
> \definelabel[SlideNumber][headstyle=normal,way=bytext]
>
> \define\sln{\color[red]{ [\nextSlideNumber]}}
>
> For my xml files, I have wrapped this into a xml command:
>
> \startxmlsetups xml:sln
>        \sln
> \stopxmlsetups
>
> This works wonderfully in most cases. To make my source file more
> readable, I usually code
>
> foo
> <sln/>
> bar
>
> In this case, the xml parser SOMETIMES (not reproducibly,
> unfortunately) skips the "bar" part up to the next paragraph <p> tag.
> When I take away the line break and write
>
> foo <sln/> bar
>
> the "bar" part appears normally.
>
> ANECDOTE
>
> I write my lectures in xml so I can put them on a website for my
> students, and I deliver them from typeset notes. This happened to me
> last Tuesday. I had typeset and printed my notes, and then while
> lecturing realized that an entire paragraph was missing. I could ad-
> lib it, but this is not something you want to happen at an important
> job-talk...

I don't if this will help you but you can try the following three changes.


1. Change the defintion of \sln

\define\sln{\startcolor[red][\nextSlideNumber]\stopcolor}


2. Put a \relax after the xml setup for \sln

\startxmlsetups xml:sln
       \sln\relax
\stopxmlsetups


3. define \SlideNumber as TeX counter

\newcount\SlideNumber

\def\resetSlideNumber
  {\global\SlideNumber\zerocount\relax}

\def\incrementSlideNumber
  {\global\advance\SlideNumber\plusone\relax}

\def\currentSlideNumber
  {\number\SlideNumber\relax}

\def\nextSlideNumber
  {\incrementSlideNumber
   \currentSlideNumber}


(4. Switch the system or TeX installation, helped on my former
Windows installation with font problems)


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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: xml parsing
  2008-11-28  8:43 xml parsing Thomas A. Schmitz
  2008-11-28  9:22 ` Wolfgang Schuster
@ 2008-11-28  9:23 ` Hans Hagen
  2008-11-28  9:43   ` Thomas A. Schmitz
  1 sibling, 1 reply; 6+ messages in thread
From: Hans Hagen @ 2008-11-28  9:23 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Thomas A. Schmitz wrote:
> Hi all, Hans,
> 
> this is a terribly inaccurate bug report, and I apologize for its  
> form, but it's something you and other people might want to look at.  
> Or maybe I should change my files, I don't know. Here comes:

in such cases you run into lookahead of macros; adding a \relax helps

\startxmlsetups xml:sln
	\sln\relax
\stopxmlsetups

of so; let me know if this solves the problem


-----------------------------------------------------------------
                                           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
-----------------------------------------------------------------
___________________________________________________________________________________
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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: xml parsing
  2008-11-28  9:23 ` Hans Hagen
@ 2008-11-28  9:43   ` Thomas A. Schmitz
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas A. Schmitz @ 2008-11-28  9:43 UTC (permalink / raw)
  To: mailing list for ConTeXt users


On Nov 28, 2008, at 10:23 AM, Hans Hagen wrote:

> in such cases you run into lookahead of macros; adding a \relax helps
>
> \startxmlsetups xml:sln
> 	\sln\relax
> \stopxmlsetups
>
> of so; let me know if this solves the problem

Hi Hans,

thanks for answering this inaccurate report. No, adding \relax to the  
xmlsetup did not solve the problem. Maybe I should try grouping or  
sprinkling around \relax in other places of my definitions?


Just btw: I reported a similar problem this spring: http://archive.contextgarden.net/message/20080324.212853.4a4abc6c.en.html

and realized later that again linebreaks are the culprit. From what I  
have understood, this is basically impossible: mkiv xml parsing uses  
the LPEG mechanism which doesn't see linebreaks as anything special.  
Nevertheless, I have these cases where introducing a linebreak makes  
elements from the xml tree disappear, removing it makes everything  
work. I'll keep an eye on it (and am aware that there may not be an  
immediate solution).

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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: xml parsing
  2008-11-28  9:22 ` Wolfgang Schuster
@ 2008-11-28 10:16   ` Thomas A. Schmitz
  2008-11-28 11:02     ` Wolfgang Schuster
  0 siblings, 1 reply; 6+ messages in thread
From: Thomas A. Schmitz @ 2008-11-28 10:16 UTC (permalink / raw)
  To: mailing list for ConTeXt users


On Nov 28, 2008, at 10:22 AM, Wolfgang Schuster wrote:

> I don't if this will help you but you can try the following three  
> changes.
>
>
> 1. Change the defintion of \sln
>
> \define\sln{\startcolor[red][\nextSlideNumber]\stopcolor}
>
>
> 2. Put a \relax after the xml setup for \sln
>
> \startxmlsetups xml:sln
>       \sln\relax
> \stopxmlsetups
>
>
> 3. define \SlideNumber as TeX counter
>
> \newcount\SlideNumber
>
> \def\resetSlideNumber
>  {\global\SlideNumber\zerocount\relax}
>
> \def\incrementSlideNumber
>  {\global\advance\SlideNumber\plusone\relax}
>
> \def\currentSlideNumber
>  {\number\SlideNumber\relax}
>
> \def\nextSlideNumber
>  {\incrementSlideNumber
>   \currentSlideNumber}
>
>
> (4. Switch the system or TeX installation, helped on my former
> Windows installation with font problems)
>
>
> Wolfgang

Hi Wolfgang,

thanks for your suggestions! I tried solutions 1-3, but I still get  
the same result; the paragraph is skipped (hey, what about #3: are you  
leading me into temptation to use low-level code?!). #4: I have tried  
both the minimals and a fully updated TeXLive on OS X; I will tomorrow  
check if the same thing happens on my linux installation.  
Unfortunately, the file is pretty long and contains some additional  
modules and fonts, or I'd send it to you to see if it compiles OK on  
your installation (though: could I imagine switching to Windows? No, I  
couldn't...)

All best, and thanks a lot

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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: xml parsing
  2008-11-28 10:16   ` Thomas A. Schmitz
@ 2008-11-28 11:02     ` Wolfgang Schuster
  0 siblings, 0 replies; 6+ messages in thread
From: Wolfgang Schuster @ 2008-11-28 11:02 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Fri, Nov 28, 2008 at 11:16 AM, Thomas A. Schmitz
<thomas.schmitz@uni-bonn.de> wrote:
>
> On Nov 28, 2008, at 10:22 AM, Wolfgang Schuster wrote:
>
>> I don't if this will help you but you can try the following three
>> changes.
>>
>>
>> 1. Change the defintion of \sln
>>
>> \define\sln{\startcolor[red][\nextSlideNumber]\stopcolor}
>>
>>
>> 2. Put a \relax after the xml setup for \sln
>>
>> \startxmlsetups xml:sln
>>       \sln\relax
>> \stopxmlsetups

\startxmlsetups xml:sln
      \sln\space\ignorespaces
\stopxmlsetups

>> 3. define \SlideNumber as TeX counter
>>
>> \newcount\SlideNumber
>>
>> \def\resetSlideNumber
>>  {\global\SlideNumber\zerocount\relax}
>>
>> \def\incrementSlideNumber
>>  {\global\advance\SlideNumber\plusone\relax}
>>
>> \def\currentSlideNumber
>>  {\number\SlideNumber\relax}
>>
>> \def\nextSlideNumber
>>  {\incrementSlideNumber
>>   \currentSlideNumber}
>>
>>
>> (4. Switch the system or TeX installation, helped on my former
>> Windows installation with font problems)
>>
>>
>> Wolfgang
>
> Hi Wolfgang,
>
> thanks for your suggestions! I tried solutions 1-3, but I still get
> the same result; the paragraph is skipped (hey, what about #3: are you
> leading me into temptation to use low-level code?!).

There is nothing wrong with low level code if you know what you do
*and* counters are faster (but you won't notice the difference here :)

> #4: I have tried
> both the minimals and a fully updated TeXLive on OS X; I will tomorrow
> check if the same thing happens on my linux installation.
> Unfortunately, the file is pretty long and contains some additional
> modules and fonts, or I'd send it to you to see if it compiles OK on
> your installation (though: could I imagine switching to Windows? No, I
> couldn't...)

You could send me your files. I switched from windows to Mac
and most of my problems disappeared.

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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

end of thread, other threads:[~2008-11-28 11:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-28  8:43 xml parsing Thomas A. Schmitz
2008-11-28  9:22 ` Wolfgang Schuster
2008-11-28 10:16   ` Thomas A. Schmitz
2008-11-28 11:02     ` Wolfgang Schuster
2008-11-28  9:23 ` Hans Hagen
2008-11-28  9:43   ` 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).