[NTG-context] Problem with margin figures and whitespace in text

Rik Kabel context at rik.users.panix.com
Sun Apr 26 21:49:00 CEST 2015


On 2015-04-26 14:01, Hans Hagen wrote:
> On 4/26/2015 3:32 AM, Rik Kabel wrote:
>> I have two problems with figures placed into the left or right margin.
>> When the figure is in a group, extra whitespace is inserted between the
>> paragraphs that precede and follow the placefigure command. This happens
>> for figures placed by startplacefigure/stopplacefigure and tradiitonal
>> placefigure commands, and paragraphs placed by
>> startparagraph/stopparagraph or marked by par or newlines.
>>
>> When the figure is not in a group, whitespace called for by
>> \setupwhitespace is lost, except when the paragraphs are marked by
>> traditional means. That is, whitespace is lost when
>> startparagraph/stopparagraph is used.
>>
>> Interestingly, when that is changed to bpar/epar, the problem for
>> ungrouped figures disappears, but as I understand it, bpar/epar is not a
>> real substitute for startparagraph/stopparagraph.
>>
>> There is probably a simple explanation, but it eludes me. I prefer to be
>> able to use startparagraph/stopparagraph, and it is sometimes desirable
>> to place a figure into a group in order to prevent unique settings from
>> leaking out.
>
> you can test with this in cont-new.mkiv
>
> \unprotect
>
> \def\page_sides_inject_dummy_lines
>   {\begingroup
>    \scratchcounter\pageshrink
>    \divide\scratchcounter \baselineskip
>    \advance\scratchcounter \plusone
>    \parskip\zeropoint
>    \dorecurse\scratchcounter{\hbox to \hsize{}}%
>    \kern-\scratchcounter\baselineskip
>    \penalty\zerocount
>    \endgroup}
>
> \def\page_sides_prepare_space
>   {\par
>   %\whitespace
>    \begingroup
>    \forgetall
>    \reseteverypar
>    \verticalstrut
>    \vskip-\struttotal
>    \endgroup}
>
> \protect
>
Thank you, Hans. That works well, both on the example and on a more 
complex real document.

-- 
Rik


More information about the ntg-context mailing list