ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* margin displacement when using backgrounds?
@ 2005-11-29 15:28 Taco Hoekwater
  2005-11-29 16:10 ` Hans Hagen
  0 siblings, 1 reply; 5+ messages in thread
From: Taco Hoekwater @ 2005-11-29 15:28 UTC (permalink / raw)


Hi again,

It seems there is a bit of margin displacement when using
backgrounds.

I assume there is a \setupbackground parameter I can use to
fix this displacement, but I don't know which one ?

TIA for any help, Taco

   % minimal file:
    \starttext
    A\inleft{test} b
    \startbackground
    A\inleft{test} b
    \stopbackground
    \stoptext

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

* Re: margin displacement when using backgrounds?
  2005-11-29 15:28 margin displacement when using backgrounds? Taco Hoekwater
@ 2005-11-29 16:10 ` Hans Hagen
  2005-11-29 16:33   ` Taco Hoekwater
  0 siblings, 1 reply; 5+ messages in thread
From: Hans Hagen @ 2005-11-29 16:10 UTC (permalink / raw)


Taco Hoekwater wrote:

> Hi again,
>
> It seems there is a bit of margin displacement when using
> backgrounds.
>
> I assume there is a \setupbackground parameter I can use to
> fix this displacement, but I don't know which one ?
>
> TIA for any help, Taco
>
>   % minimal file:
>    \starttext
>    A\inleft{test} b
>    \startbackground
>    A\inleft{test} b
>    \stopbackground
>    \stoptext

probably some interaction, best use

\definetextbackground[taco][location=paragraph,frame=off]

A\inleft{test1} b

\starttextbackground[taco]
A\inleft{test2} b
\stoptextbackground

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

* Re: margin displacement when using backgrounds?
  2005-11-29 16:10 ` Hans Hagen
@ 2005-11-29 16:33   ` Taco Hoekwater
  2005-11-29 16:59     ` Hans Hagen
  0 siblings, 1 reply; 5+ messages in thread
From: Taco Hoekwater @ 2005-11-29 16:33 UTC (permalink / raw)




Hans Hagen wrote:
> probably some interaction, best use
> 
> \definetextbackground[taco][location=paragraph,frame=off]
> 
> A\inleft{test1} b
> 
> \starttextbackground[taco]
> A\inleft{test2} b
> \stoptextbackground

No problem since \startbackground has a number of other problems
as well (esp. regarding float placements) that I'd be happy to get
away from, but (never having used textbackgrounds seriously before)
is there a simple way to get the equivalent of

   \setupbackground[frame=off,leftframe=on]

using textbackgrounds?

My previous set of definitions was:

%D how examples look

\defineenumeration
	[Example]
	[style={\switchtobodyfont[9pt]},
          headstyle={\ss\bf},
          before=,
	 after=,
          inbetween=\noindent,
          text=Voorbeeld,
          indentnext=no,
          indenting=yes,
          chapternumber=yes]

\def\startexample%
   {\blank
    \start
    \setupbackground
       [frame=off,
        leftframe=on,
        offset=0pt,
        width=broad,
        background=,
        rulethickness=2pt,
        framecolor=examplecolor]
    \startbackground
    \startnarrower[left]
    \startExample  }

\def\stopexample%
   {\stopExample
    \stopnarrower
    \stopbackground
    \stop
    \blank }

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

* Re: margin displacement when using backgrounds?
  2005-11-29 16:33   ` Taco Hoekwater
@ 2005-11-29 16:59     ` Hans Hagen
  2005-11-29 17:57       ` Taco Hoekwater
  0 siblings, 1 reply; 5+ messages in thread
From: Hans Hagen @ 2005-11-29 16:59 UTC (permalink / raw)


Taco Hoekwater wrote:

>
>
> Hans Hagen wrote:
>
>> probably some interaction, best use
>>
>> \definetextbackground[taco][location=paragraph,frame=off]
>>
>> A\inleft{test1} b
>>
>> \starttextbackground[taco]
>> A\inleft{test2} b
>> \stoptextbackground
>
>
> No problem since \startbackground has a number of other problems
> as well (esp. regarding float placements) that I'd be happy to get
> away from, but (never having used textbackgrounds seriously before)
> is there a simple way to get the equivalent of
>
>   \setupbackground[frame=off,leftframe=on]
>
> using textbackgrounds?


btw, your problem can be solved with:

\defineinmargin [taco] [inner] [normal] 
[distance=\dimexpr\leftmargindistance+.5em\relax]

\setupbackground[leftoffset=.5em,rightoffset=.5em]

the problem is that llap is not working well inside a vbox (i changed 
the hsize adaption to left/rightskip but it's still not going well)

>
> My previous set of definitions was:
>
> %D how examples look
>
> \defineenumeration
>     [Example]
>     [style={\switchtobodyfont[9pt]},
>          headstyle={\ss\bf},
>          before=,
>      after=,
>          inbetween=\noindent,
>          text=Voorbeeld,
>          indentnext=no,
>          indenting=yes,
>          chapternumber=yes]
>
> \def\startexample%
>   {\blank
>    \start
>    \setupbackground
>       [frame=off,
>        leftframe=on,
>        offset=0pt,
>        width=broad,
>        background=,
>        rulethickness=2pt,
>        framecolor=examplecolor]
>    \startbackground
>    \startnarrower[left]
>    \startExample  }
>
> \def\stopexample%
>   {\stopExample
>    \stopnarrower
>    \stopbackground
>    \stop
>    \blank }


hey, some features thatyou don't know about ... here we go:

\setupcolors
  [state=start]

\defineenumeration
  [Example]
  [style={\switchtobodyfont[9pt]},
   headstyle={\ss\bf},
   before=,
   after=,
   inbetween=\noindent,
   text=Voorbeeld,
   indentnext=no,
   indenting=yes,
   chapternumber=yes]

\definetextbackground
  [example]
  [location=paragraph,
   rulethickness=2pt,
   framecolor=red,
   before=\blank,
   after=\blank]

\startuseMPgraphic{mpos:par:columnset}
  for i=1 upto nofmultipars :
%     draw leftboundary multipars[i]
%         shifted (-.25EmWidth,0)
%         withpen pencircle scaled 2pt
%         withcolor red ;
    draw leftboundary multipars[i]
        shifted (-.5EmWidth,0)
        withpen pencircle scaled \MPvar{linewidth}
        withcolor \MPvar{linecolor} ;
  endfor ;
\stopuseMPgraphic

\def\startexample
  {\startnarrower[left]
   \starttextbackground[example]
   \startExample}

\def\stopexample
  {\stopExample
   \stoptextbackground
   \stopnarrower}

\starttext

\input tufte

\startexample
\input tufte
\stopexample

\input tufte

\stoptext

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

* Re: margin displacement when using backgrounds?
  2005-11-29 16:59     ` Hans Hagen
@ 2005-11-29 17:57       ` Taco Hoekwater
  0 siblings, 0 replies; 5+ messages in thread
From: Taco Hoekwater @ 2005-11-29 17:57 UTC (permalink / raw)


Hans Hagen wrote:
> 
> the problem is that llap is not working well inside a vbox (i changed 
> the hsize adaption to left/rightskip but it's still not going well)

The worst problem I have had with the old backgrounds is that they
(seem to) take the size of 'currently floating' floats into account
when deciding whether or not to go to the next page. This quite often
resulted in half-empty pages; naturally followed by an overful float
page two pages in-the-future.

And there were the typical problems from \vsplit where too
much or not enough gets cut off, of course.

The textbackgrounds do not have these problems, so I am very
happy with the example code you gave me (if the science is too
hard, i happily settle for the magic :-)).

Thanks,
Taco

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

end of thread, other threads:[~2005-11-29 17:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-29 15:28 margin displacement when using backgrounds? Taco Hoekwater
2005-11-29 16:10 ` Hans Hagen
2005-11-29 16:33   ` Taco Hoekwater
2005-11-29 16:59     ` Hans Hagen
2005-11-29 17:57       ` Taco Hoekwater

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