ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Problem with margin figures and whitespace in text
@ 2015-04-26  1:32 Rik Kabel
  2015-04-26 18:01 ` Hans Hagen
  0 siblings, 1 reply; 3+ messages in thread
From: Rik Kabel @ 2015-04-26  1:32 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1: Type: text/plain, Size: 3677 bytes --]

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.

The following should demonstrate the problem. Turning on grid setting 
makes it worse. I get the same result with current betas and older versions.

    \useMPlibrary   [dum]
    %\showgrid
    \setuplayout    [%grid=yes,
                      backspace=151pt,leftmargin=117pt]
    \setupwhitespace[big]
    \define\Paragraph{\startparagraph\input khatt-en\stopparagraph}
    \starttext
    {
       \subject{Start/stop paragraphs and figures}
       \subsubject{Group, extra whitespace}
       \Paragraph
       \Paragraph
       \begingroup
         \startplacefigure[location={leftmargin,none}]
           \externalfigure[A]
         \stopplacefigure
       \endgroup
       \Paragraph
       \Paragraph
       \subsubject{No group, no whitespace}
       \Paragraph
       \Paragraph
       \startplacefigure[location={leftmargin,none}]
         \externalfigure[A]
       \stopplacefigure
       \Paragraph
       \Paragraph
       \Paragraph
    }
       \page
    {
       \subject{Start/stop paragraphs, traditional figures}
       \subsubject{Group, extra whitespace}
       \Paragraph
       \Paragraph
       {\placefigure[leftmargin,none]{}{\externalfigure[A]}}
       \Paragraph
       \Paragraph
       \subsubject{No group, no whitespace}
       \Paragraph
       \Paragraph
       \placefigure[leftmargin,none]{}{\externalfigure[A]}
       \Paragraph
       \Paragraph
       \Paragraph
    }
       \page
    {
       \subject{Traditional paragraphs, start/stop figures}
       \subsubject{Group, extra whitespace}
       \input khatt-en\par
       \input khatt-en\par
       \begingroup% or \bgroup or {
         \startplacefigure[location={leftmargin,none}]
           \externalfigure[A]
         \stopplacefigure
       \endgroup% or \egroup or }
       \input khatt-en\par
       \input khatt-en\par
       \subsubject{Okay}
       \input khatt-en\par
       \input khatt-en\par
       \startplacefigure[location={leftmargin,none}]
         \externalfigure[A]
       \stopplacefigure
       \input khatt-en\par
       \input khatt-en\par
       \input khatt-en\par
    }
       \page
    {
       \subject{Traditional paragraphs, traditional figures}
       \subsubject{Group, extra whitespace}
       \input khatt-en\par
       \input khatt-en\par
       {\placefigure[leftmargin,none]{}{\externalfigure[A]}}
       \input khatt-en\par
       \input khatt-en\par
       \subsubject{Okay}
       \input khatt-en\par
       \input khatt-en\par
       \placefigure[leftmargin,none]{}{\externalfigure[A]}
       \input khatt-en\par
       \input khatt-en\par
       \input khatt-en\par
    }
    \stoptext

-- 
Rik

[-- Attachment #1.2: Type: text/html, Size: 5504 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

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

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

* Re: Problem with margin figures and whitespace in text
  2015-04-26  1:32 Problem with margin figures and whitespace in text Rik Kabel
@ 2015-04-26 18:01 ` Hans Hagen
  2015-04-26 19:49   ` Rik Kabel
  0 siblings, 1 reply; 3+ messages in thread
From: Hans Hagen @ 2015-04-26 18:01 UTC (permalink / raw)
  To: ntg-context

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


> The following should demonstrate the problem. Turning on grid setting
> makes it worse. I get the same result with current betas and older versions.
>
>     \useMPlibrary   [dum]
>     %\showgrid
>     \setuplayout    [%grid=yes,
>                       backspace=151pt,leftmargin=117pt]
>     \setupwhitespace[big]
>     \define\Paragraph{\startparagraph\input khatt-en\stopparagraph}
>     \starttext
>     {
>        \subject{Start/stop paragraphs and figures}
>        \subsubject{Group, extra whitespace}
>        \Paragraph
>        \Paragraph
>        \begingroup
>          \startplacefigure[location={leftmargin,none}]
>            \externalfigure[A]
>          \stopplacefigure
>        \endgroup
>        \Paragraph
>        \Paragraph
>        \subsubject{No group, no whitespace}
>        \Paragraph
>        \Paragraph
>        \startplacefigure[location={leftmargin,none}]
>          \externalfigure[A]
>        \stopplacefigure
>        \Paragraph
>        \Paragraph
>        \Paragraph
>     }
>        \page
>     {
>        \subject{Start/stop paragraphs, traditional figures}
>        \subsubject{Group, extra whitespace}
>        \Paragraph
>        \Paragraph
>        {\placefigure[leftmargin,none]{}{\externalfigure[A]}}
>        \Paragraph
>        \Paragraph
>        \subsubject{No group, no whitespace}
>        \Paragraph
>        \Paragraph
>        \placefigure[leftmargin,none]{}{\externalfigure[A]}
>        \Paragraph
>        \Paragraph
>        \Paragraph
>     }
>        \page
>     {
>        \subject{Traditional paragraphs, start/stop figures}
>        \subsubject{Group, extra whitespace}
>        \input khatt-en\par
>        \input khatt-en\par
>        \begingroup% or \bgroup or {
>          \startplacefigure[location={leftmargin,none}]
>            \externalfigure[A]
>          \stopplacefigure
>        \endgroup% or \egroup or }
>        \input khatt-en\par
>        \input khatt-en\par
>        \subsubject{Okay}
>        \input khatt-en\par
>        \input khatt-en\par
>        \startplacefigure[location={leftmargin,none}]
>          \externalfigure[A]
>        \stopplacefigure
>        \input khatt-en\par
>        \input khatt-en\par
>        \input khatt-en\par
>     }
>        \page
>     {
>        \subject{Traditional paragraphs, traditional figures}
>        \subsubject{Group, extra whitespace}
>        \input khatt-en\par
>        \input khatt-en\par
>        {\placefigure[leftmargin,none]{}{\externalfigure[A]}}
>        \input khatt-en\par
>        \input khatt-en\par
>        \subsubject{Okay}
>        \input khatt-en\par
>        \input khatt-en\par
>        \placefigure[leftmargin,none]{}{\externalfigure[A]}
>        \input khatt-en\par
>        \input khatt-en\par
>        \input khatt-en\par
>     }
>     \stoptext
>
> --
> Rik
>
>
> ___________________________________________________________________________________
> 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  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________
>


-- 

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 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  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Problem with margin figures and whitespace in text
  2015-04-26 18:01 ` Hans Hagen
@ 2015-04-26 19:49   ` Rik Kabel
  0 siblings, 0 replies; 3+ messages in thread
From: Rik Kabel @ 2015-04-26 19:49 UTC (permalink / raw)
  To: ntg-context

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

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

end of thread, other threads:[~2015-04-26 19:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-26  1:32 Problem with margin figures and whitespace in text Rik Kabel
2015-04-26 18:01 ` Hans Hagen
2015-04-26 19:49   ` Rik Kabel

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