ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Filling framed boxes up to the max
@ 2005-12-05 18:58 Alexander Klink
  2005-12-06  9:26 ` Hans Hagen
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Klink @ 2005-12-05 18:58 UTC (permalink / raw)


Hi,

I would like to do the timetable of the Chaos Communication
Congress in ConTeXt again. Last year, I used a perl script
to convert the iCal file to ConTeXt code. This year, I'd like
to do it a bit better. One of the problems I have there is that
I would like to fill a framed box with text up to the max. If it
is full before everything is typeset, the text should end with
»...«. The manual solution (cf. http://www.alech.de/tmp/day1.pdf)
involved counting the numbers of letters and perl and estimating
a cut-off value. But I guess there is a better method in ConTeXt
itself.
Maybe someone here has an idea.

TIA,
Greetings,
	    Alex

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

* Re: Filling framed boxes up to the max
  2005-12-05 18:58 Filling framed boxes up to the max Alexander Klink
@ 2005-12-06  9:26 ` Hans Hagen
  0 siblings, 0 replies; 2+ messages in thread
From: Hans Hagen @ 2005-12-06  9:26 UTC (permalink / raw)


Alexander Klink wrote:

>Hi,
>
>I would like to do the timetable of the Chaos Communication
>Congress in ConTeXt again. Last year, I used a perl script
>to convert the iCal file to ConTeXt code. This year, I'd like
>to do it a bit better. One of the problems I have there is that
>I would like to fill a framed box with text up to the max. If it
>is full before everything is typeset, the text should end with
>�...�. The manual solution (cf. http://www.alech.de/tmp/day1.pdf)
>involved counting the numbers of letters and perl and estimating
>a cut-off value. But I guess there is a better method in ConTeXt
>itself.
>Maybe someone here has an idea.
>  
>
if live was always so easy ...

when confronted with problems like this, it's often that one first 
thinks of the tools one knows (perl, ruby, xslt) even when the problem 
is more related to typesetting which means that tex may well be able to 
deal with the problem directly ...

\starttext

\def\StartCutOff
  {\setbox\scratchbox = \vbox \bgroup
   \setstrut \begstrut}

\def\StopCutOff
  {\endstrut
   \egroup
   \ifdim\ht\scratchbox>\vsize
     \setbox\scratchbox=\vsplit\scratchbox to 
\dimexpr\vsize-\lineheight\relax
     \unvbox\scratchbox
     \vfill
     \hfill \strut ?...?
   \else
     \unvbox\scratchbox
   \fi}

\framed
  [width=4cm,height=5cm,align=right,strut=no]
  {\StartCutOff \input tufte \StopCutOff}

\framed
  [width=4cm,height=5cm,align=right,strut=no]
  {\StartCutOff \input zapf \StopCutOff}

\stoptext

it's up to you to wikify it (maybe i should collect those things for a 
magazine issue)

Hans

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

end of thread, other threads:[~2005-12-06  9:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-05 18:58 Filling framed boxes up to the max Alexander Klink
2005-12-06  9:26 ` 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).