ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
Subject: Re: Filling framed boxes up to the max
Date: Tue, 06 Dec 2005 10:26:54 +0100	[thread overview]
Message-ID: <4395595E.1020004@wxs.nl> (raw)
In-Reply-To: <20051205185856.GA9175@dach-wg.de>

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

      reply	other threads:[~2005-12-06  9:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-05 18:58 Alexander Klink
2005-12-06  9:26 ` Hans Hagen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4395595E.1020004@wxs.nl \
    --to=pragma@wxs.nl \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).