[NTG-context] How can I remove a blank leading line from a buffer

Rik Kabel context at rik.users.panix.com
Mon Aug 13 18:15:55 CEST 2018


On 8/13/2018 10:28, Rik Kabel wrote:
> On 8/13/2018 03:01, Hans Hagen wrote:
>> On 8/13/2018 5:18 AM, Rik Kabel wrote:
>>
>>   \startparagraph
>>
>> %     \dontleavehmode\llap{\Mark}\inlinebuffer[TestBuffer]
>> %     \ (first: \First, arg: \Arg)
>>
>>     \margintext{\Mark}
>>
>>     \setupparagraphintro[first][(first: \First, arg: \Arg)]
>>    %\setupparagraphintro[next][(first: \First, arg: \Arg)]
>>
>>     \getbuffer[TestBuffer]
>>
>>   \stopparagraph 
>
> Hans,
>
> That works for the over-simplified case here, but fails in practice. 
> For a \startnarrower[left] paragraph, the mark is still in the main 
> margin, not the 'margin' of the narrowed paragraph. Also, the 
> placement of the text in the margin is wrong and not easily controlled 
> as with \llap and \rlap. The code started out more like:
>
>     \define\Mark{\color[middlegray]{\hskip.6cm\itb¿\ }}
>     \setwidthof{\Mark}\to\MarkWidth
>     ...
>     \starttexdefinition stopBufTest
>       \startluacode
>     buffers.prepend("TestBuffer","\\dontleavehmode\\llap{\\Mark}")
>       \stopluacode
>       \setupnarrower[left=\MarkWidth]
>       \startnarrower[left,right]
>       \startparagraph
>         \inlinebuffer[TestBuffer]
>       \stopparagraph
>       \stopnarrower
>       \egroup
>     \stoptexdefinition
>
>
> So I am still looking for a way to do this. Meanwhile I am trying to 
> understand Aditya's examples.

Turns out another answer was hidden in Hans's reply. The following seems 
to meet my needs, but it may complicate other use of 
\setupparagraphintro (which I don't recall seeing before), so it may not 
be a generic solution.

An empty string works fine instead of the llaped marking shown here.

This is a less dangerous hack than redefining \par, but still may fail 
in more complex documents when \setupparagraphintro is used elsewhere.

    \starttexdefinition stopBufTest
       \startnarrower[left,right]
       \startparagraph
         \setupparagraphintro[first][\llap{\Mark}]
         \inlinebuffer[TestBuffer] \ (first: \First, arg: \Arg)
       \stopparagraph
       \stopnarrower
       \egroup
    \stoptexdefinition


Thank you, Hans.

(For a non-hack generic solution that does not interfere with other use 
of \setupparagraphintro, surely there must be an easy way to apply 
string.strip to the buffer.)

-- 
Rik

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20180813/6593bae3/attachment.html>


More information about the ntg-context mailing list