From: Hans Hagen <pragma@wxs.nl>
Subject: Re: cropping text
Date: Wed, 07 Sep 2005 15:38:32 +0200 [thread overview]
Message-ID: <431EED58.8080809@wxs.nl> (raw)
In-Reply-To: <431ED16F.90609@gmx.net>
Peter Rolf wrote:
>Hi all,
>
>I've used \doboundtext so far, to crop my text exactly as I want it. But
>now I've problems with text, that contains a \underbar token. It seems,
>that \handletokens can't handle \underbar.
>
>The other cropping alternative, \limitatetext, perfectly works with
>\underbar, but it's useless for me, as it cropps off only at word
>boundaries. mhh..
>
>Is there an (more or less) easy way to solve my problem?
>I don't need a full solution; any hints are welcome.
>
>
here is a full solution; it's up to you to add documentation to the wiki
(the macro will be in the next release)
\def\limitatefirstline#1#2#3%
{\hbox\bgroup\strut
\setbox\scratchbox\hbox{#1}%
\ifdim\wd\scratchbox>#2\relax
\setbox\scratchbox\hbox{#3}%
\hsize#2\relax
\advance\hsize-\wd\scratchbox
\setbox\scratchbox\vbox{\forgetall#1}%
\setbox\scratchbox\vsplit\scratchbox to \lineheight
\vbox{\unvbox\scratchbox}%
#3%
\else
#1%
\fi
\egroup}
\starttext
\limitatefirstline{\input tufte\relax}{10cm}{\unknown}
\stoptext
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------
next prev parent reply other threads:[~2005-09-07 13:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-07 11:39 Peter Rolf
2005-09-07 13:38 ` Hans Hagen [this message]
2005-09-07 13:51 ` cropping text [final] Peter Rolf
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=431EED58.8080809@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).