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
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 -----------------------------------------------------------------
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
participants (2)
-
Hans Hagen
-
Peter Rolf