ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Peter Rolf <indiego@gmx.net>
Subject: Re: cropping text [final]
Date: Wed, 07 Sep 2005 15:51:19 +0200	[thread overview]
Message-ID: <431EF057.1080606@gmx.net> (raw)
In-Reply-To: <431EED58.8080809@wxs.nl>

Hans Hagen wrote:
> 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

Many thanks! I'll add the text cropping stuff to the wiki as soon as
possible.

Greetings,

Peter

> (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
> -----------------------------------------------------------------
> 
> _______________________________________________
> ntg-context mailing list
> ntg-context@ntg.nl
> http://www.ntg.nl/mailman/listinfo/ntg-context
> 
> 

      reply	other threads:[~2005-09-07 13:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-07 11:39 cropping text Peter Rolf
2005-09-07 13:38 ` Hans Hagen
2005-09-07 13:51   ` Peter Rolf [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=431EF057.1080606@gmx.net \
    --to=indiego@gmx.net \
    --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).