Changes

Jump to navigation Jump to search
1,728 bytes added ,  17:58, 7 September 2005
no edit summary
== Cropping text ==
There are some rare cases in which it is useful to crop a given
text line and loose part of its information.

Sometimes there is not enough room to show the complete
(line of) text. In such a situation we can strip of some
'''characters''' by using

<texcode>
\doboundtext {text} {width} {sentinel}
</texcode>

When the <tt>text</tt> is wider than the given <tt>width</tt>, it's split and the third
argument (<tt>sentinel</tt>) is appended. As much text as possible is printed.

An example:

<texcode>
\framed{\doboundtext{My entire inheritance goes to my cat Pussy!}{62mm}{...}}
</texcode>

<context>
\framed{\doboundtext{My entire inheritance goes to my cat Pussy!}{62mm}{...}}
</context>


A bit more beautiful alternative for the previous command is <tt>\limitatetext</tt>.
This command takes care of '''word''' boundaries, so that only complete words will
appear in the final (cropped) text.

<texcode>
\limitatetext {text} {width} {sentinel}
\limitatetext {text} {-width} {prelude}
</texcode>

When no <tt>width</tt> is given, the whole <tt>text</tt> becomes available.
A negative value crops the beginning and the text starts with
the <tt>prelude</tt>. Sentinel and prelude are optional.

Example:

<texcode>
\framed{\limitatetext {Pussy is the name of the cat!}{50mm}{...}}
\framed{\limitatetext {Pussy is the name of the cat!}{-50mm}{...}}
</texcode>

<context>
\framed{\limitatetext {Pussy is the name of the cat!}{50mm}{...}}
\framed{\limitatetext {Pussy is the name of the cat!}{-50mm}{...}}
</context>


Both commands have their range of application.
<tt>\limitatetext</tt> is more robust, <tt>\doboundtext</tt> works
better on text that cannot be hyphenated.

TODO: <tt>\limitatefirstline</tt>
37

edits

Navigation menu