ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* cropping text
@ 2005-09-07 11:39 Peter Rolf
  2005-09-07 13:38 ` Hans Hagen
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Rolf @ 2005-09-07 11:39 UTC (permalink / raw)


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.

Thanks in advice,

Peter

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

* Re: cropping text
  2005-09-07 11:39 cropping text Peter Rolf
@ 2005-09-07 13:38 ` Hans Hagen
  2005-09-07 13:51   ` cropping text [final] Peter Rolf
  0 siblings, 1 reply; 3+ messages in thread
From: Hans Hagen @ 2005-09-07 13:38 UTC (permalink / raw)


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
-----------------------------------------------------------------

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

* Re: cropping text [final]
  2005-09-07 13:38 ` Hans Hagen
@ 2005-09-07 13:51   ` Peter Rolf
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Rolf @ 2005-09-07 13:51 UTC (permalink / raw)


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
> 
> 

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

end of thread, other threads:[~2005-09-07 13:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-07 11:39 cropping text Peter Rolf
2005-09-07 13:38 ` Hans Hagen
2005-09-07 13:51   ` cropping text [final] Peter Rolf

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).