| 1 |
\documentclass[a4paper]{article} |
| 2 |
\usepackage[a4paper]{geometry} |
| 3 |
\usepackage{miscdoc} |
| 4 |
\usepackage[scaled=0.85]{luximono} |
| 5 |
\begin{document} |
| 6 |
\title{The \Package{truncate} package} |
| 7 |
\author{Donald Arseneau\thanks{Documentation file assembled by Robin |
| 8 |
Fairbairns}} |
| 9 |
\date{August 2001, version 3.6} |
| 10 |
\maketitle |
| 11 |
|
| 12 |
\section*{Truncating text to a given width} |
| 13 |
|
| 14 |
The package defines a command |
| 15 |
\cmdinvoke{truncate}[\meta{marker}]{\meta{width}}{\meta{text}} |
| 16 |
|
| 17 |
If the text is too wide to fit in the specified width, then it is |
| 18 |
truncated, and a continuation marker is shown at the end. The default |
| 19 |
marker, used when the optional \texttt{[marker]} parameter is omitted, |
| 20 |
is \cs{,}\cs{dots}. You can change this default by redefining |
| 21 |
\cs{TruncateMarker} |
| 22 |
(\cmdinvoke{renewcommand}{\cs{TruncateMarker}}{\dots}). |
| 23 |
|
| 24 |
Normally, the text (whether truncated or not) is printed flush-left |
| 25 |
in a box with exactly the width specified. The package option |
| 26 |
\option[fit] causes the output text to have its natural width, up to a |
| 27 |
maximum of the specified width. |
| 28 |
|
| 29 |
The text will not normally be truncated in the middle of a word, |
| 30 |
nor at a space specified by the tie (\verb|~|). For example: |
| 31 |
\begin{quote} |
| 32 |
\cmdinvoke{truncate}{122pt}{This text has been\string~truncated} |
| 33 |
\end{quote} |
| 34 |
gives |
| 35 |
\begin{quote} |
| 36 |
``This text has\dots~~~~~~'' |
| 37 |
\end{quote} |
| 38 |
|
| 39 |
You can give one of the package options \option[hyphenate], |
| 40 |
\option[breakwords], or \option[breakall] to allow breaking in the |
| 41 |
middle of words. The first two only truncate at hyphenation points; |
| 42 |
with the difference being that \option[breakwords] suppresses the |
| 43 |
hyphen character. On the other hand, \option{breakall} allows |
| 44 |
truncation at any character. For example: |
| 45 |
\begin{quote} |
| 46 |
\cmdinvoke{truncate}{122pt}{This text has been\string~truncated} |
| 47 |
\end{quote} |
| 48 |
gives |
| 49 |
\begin{quote} |
| 50 |
\begin{tabular}{l@{\quad}l} |
| 51 |
``This text has been trun-...'' & (option hyphenate) \\ |
| 52 |
``This text has been trun...~'' & (option breakwords) \\ |
| 53 |
``This text has been trunc...'' & (option breakall) |
| 54 |
\end{tabular} |
| 55 |
\end{quote} |
| 56 |
(All of these options work through \TeX{}'s hyphenation mechanism.) |
| 57 |
\end{document} |