Filling framed boxes up to the max
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
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
participants (2)
-
Alexander Klink
-
Hans Hagen