ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Weird frame with framedtext
@ 2003-01-07 11:45 varheit
  2003-01-12 20:11 ` Hans Hagen
  0 siblings, 1 reply; 2+ messages in thread
From: varheit @ 2003-01-07 11:45 UTC (permalink / raw)


Dear ConTeXt users,

I have some trouble with the document below. It uses framing for some
text blocks to make them stand out. In some cases (as with this document)
a float preceding the framed text will be framed too.
I am using the stable version (2002/12/02), the current beta does not
process
the document at all (seems to be some problem with \startfiguretext, I think
this was discussed earlier).

Does anybody know how to fix this strange behaviour?
Thanks

---------- cut here ----------
\setupcolors[state=start]
\defineframedtext[info]
  [frame=on,
   background=screen,
   width=\textwidth,
   framecolor=green]
 
\starttext

\title{Text}

\dorecurse{20}{A paragraph\par}

\startinfo
  \startfiguretext[left]{none}{\framed[width=0.8cm,height=0.8cm]{i}}
  Something important
  \stopfiguretext
\stopinfo


\reservefigure[width=\textwidth,height=\textwidth,frame=on][here]{Caption}

\startinfo
  \startfiguretext[left]{none}{\framed[width=0.8cm,height=0.8cm]{i}}
  This text should be framed
  \stopfiguretext
\stopinfo

\stoptext
---------- cut here ----------

-- 
+++ GMX - Mail, Messaging & more  http://www.gmx.net +++
NEU: Mit GMX ins Internet. Rund um die Uhr für 1 ct/ Min. surfen!

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

* Re: Weird frame with framedtext
  2003-01-07 11:45 Weird frame with framedtext varheit
@ 2003-01-12 20:11 ` Hans Hagen
  0 siblings, 0 replies; 2+ messages in thread
From: Hans Hagen @ 2003-01-12 20:11 UTC (permalink / raw)


At 12:45 PM 1/7/2003 +0100, you wrote:
>Dear ConTeXt users,
>
>I have some trouble with the document below. It uses framing for some
>text blocks to make them stand out. In some cases (as with this document)
>a float preceding the framed text will be framed too.
>I am using the stable version (2002/12/02), the current beta does not
>process
>the document at all (seems to be some problem with \startfiguretext, I think
>this was discussed earlier).

btw, i uploaded a new beta a few days ago

>Does anybody know how to fix this strange behaviour?

You use two quit ecomplicated mechanisms: framed texts and floats. A framed 
text tries to handle spacing as best as possible even in tricky 
ircumstances. Such a framed text is something whole, unbreakable (for 
breakable framing and backgrounds, use \definetextbackground which is 
something new, experimental, but powerful).

A float can migrate to a next page, and in the case of for instance side 
floats (which you use here) flush preceding floats in order to preserve 
order. So, what you do is flushing a float inside a box. You're using a 
main text flow mechanism mixe with a local boxed one, which is asking for 
problems.

>---------- cut here ----------
>\setupcolors[state=start]
>\defineframedtext[info]
>   [frame=on,
>    background=screen,
>    width=\textwidth,
>    framecolor=green]

This is ok.

>\starttext
>
>\title{Text}
>
>\dorecurse{20}{A paragraph\par}
>
>\startinfo
>   \startfiguretext[left]{none}{\framed[width=0.8cm,height=0.8cm]{i}}
>   Something important
>   \stopfiguretext
>\stopinfo

float inside box, but because it's small ... you're lucky

>\reservefigure[width=\textwidth,height=\textwidth,frame=on][here]{Caption}

the big pne

>\startinfo
>   \startfiguretext[left]{none}{\framed[width=0.8cm,height=0.8cm]{i}}
>   This text should be framed
>   \stopfiguretext
>\stopinfo

here the big one gets flushed inside the box

>\stoptext

So, you need to use another mechanism. I played a bit with tabulate, but 
this is sub optimal. You could use the sidebyside mechanism, but this is 
not that flexible. So, back to tabulate.

Some tracing:

\showframe \showstruts

A new macro:

\def\toplinebox
   {\dowithnextbox
      {\ifdim\dp\nextbox>\strutdepth
         \scratchdimen\dp\nextbox
         \advance\scratchdimen-\strutdepth
         \getnoflines\scratchdimen
         \struttedbox{\box\nextbox}%
         \dorecurse\noflines{\vbox{\hsize\zeropoint\strut}}%
       \else
         \box\nextbox
       \fi}%
    \tbox}

The graphic:

\startbuffer
   \toplinebox{\framed[width=0.8cm,height=0.8cm]{i}}
\stopbuffer

Your challenge:

\startinfo \starttabulate[|p|p|]
   \NC \getbuffer \NC This text should be framed \NC \NR
\stoptabulate \stopinfo

\startinfo \starttabulate[|p(1cm)|p|]
   \NC \getbuffer \NC This text should be framed \NC \NR
   \NC \getbuffer \NC This text should be framed \NC \NR
\stoptabulate \stopinfo

This works ok for your case, but when the tabulate is not boxed, and when 
some big graphic is used, one gets funny breaks. So, i patched tabulate to 
handle:

p(fit)

as well as something that prevents the funny breaks. Some day this will 
show up in a beta.

Hans

-------------------------------------------------------------------------
                                   Hans Hagen | PRAGMA ADE | pragma@wxs.nl
                       Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
                        information: http://www.pragma-ade.com/roadmap.pdf
                     documentation: http://www.pragma-ade.com/showcase.pdf
-------------------------------------------------------------------------

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

end of thread, other threads:[~2003-01-12 20:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-07 11:45 Weird frame with framedtext varheit
2003-01-12 20:11 ` Hans Hagen

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