# [NTG-context] bug: wrong subject name in headertext

Hans Hagen pragma at wxs.nl
Thu Oct 13 23:13:10 CEST 2011

```On 13-10-2011 22:35, Mojca Miklavec wrote:
> On Thu, Oct 13, 2011 at 22:19, Wolfgang Schuster wrote:
>> Am 13.10.2011 um 22:10 schrieb Mojca Miklavec:
>>
>>> Hello,
>>>
>>> the following example might not be the most minimal possible example,
>>> but I hope that it is short enough. I'm using
>>>         []
>>>         [subject]
>>> to print subject into header, but the headers are screwed up in some
>>> very weird way. My real document behaves differently that this minimal
>>> example, but even here one can notice that headers say:
>>> - This is first heading
>>> - This is fourth heading
>>> - This is second heading
>>> - This is fourth heading
>>
>
> Thank you. Black magic worked.
>
>
> Assuming that one would want to explain that option in reference
> manual - what would be some short and clear explanation? When do I
> need to use expansion?

it is also a side effects of using buffers

say that you do

\startsection[title=\xmlflush{#1}]

in fact what you then get is a reference to an xml node and that one is
quite likely gone when you finish typesetting the buffer (that is, there
is then a reference to a non existing node or maybe another one if you
use the same buffer with some other xml) ; you can peek in the tuc file
to see this in action

expansion will take the content but this also can have a side effect
i.e. there can be nested elements

there are couple of options to deal with this (including piping back
snippets) and to some extend there is tracking of this

(mixing tex and xml in this way will always remain somewhat tricky)

eventually all this will be (and some already is) in the xml mkiv manual
but ... it takes time ...

Hans

-----------------------------------------------------------------