<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">\documentclass[a4paper]{article}
\usepackage[a4paper]{geometry}
\usepackage{miscdoc}
\usepackage[scaled=0.85]{luximono}
\begin{document}
\title{The \Package{truncate} package}
\author{Donald Arseneau\thanks{Documentation file assembled by Robin
    Fairbairns}}
\date{August 2001, version 3.6}
\maketitle

\section*{Truncating text to a given width}

The package defines a command
\cmdinvoke{truncate}[\meta{marker}]{\meta{width}}{\meta{text}}

If the text is too wide to fit in the specified width, then it is
truncated, and a continuation marker is shown at the end.  The default
marker, used when the optional \texttt{[marker]} parameter is omitted,
is \cs{,}\cs{dots}.   You can change this default by redefining
\cs{TruncateMarker}
(\cmdinvoke{renewcommand}{\cs{TruncateMarker}}{\dots}).

Normally, the text (whether truncated or not) is printed flush-left
in a box with exactly the width specified.  The package option
\option[fit] causes the output text to have its natural width, up to a
maximum of the specified width.

The text will not normally be truncated in the middle of a word,
nor at a space specified by the tie (\verb|~|).  For example:
\begin{quote}
  \cmdinvoke{truncate}{122pt}{This text has been\string~truncated}
\end{quote}
gives
\begin{quote}
  ``This text has\dots~~~~~~''
\end{quote}

You can give one of the package options \option[hyphenate],
\option[breakwords], or \option[breakall] to allow breaking in the
middle of words.  The first two only truncate at hyphenation points;
with the difference being that \option[breakwords] suppresses the
hyphen character.  On the other hand, \option{breakall} allows
truncation at any character.  For example:
\begin{quote}
  \cmdinvoke{truncate}{122pt}{This text has been\string~truncated}
\end{quote}
gives
\begin{quote}
  \begin{tabular}{l@{\quad}l}
    ``This text has been trun-...''  &amp; (option hyphenate) \\
    ``This text has been trun...~''  &amp; (option breakwords) \\
    ``This text has been trunc...''  &amp; (option breakall)
  \end{tabular}
\end{quote}
(All of these options work through \TeX{}'s hyphenation mechanism.)
\end{document}
</pre></body></html>