summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/truncate/truncate.tex
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/truncate/truncate.tex')
-rw-r--r--macros/latex/contrib/truncate/truncate.tex57
1 files changed, 57 insertions, 0 deletions
diff --git a/macros/latex/contrib/truncate/truncate.tex b/macros/latex/contrib/truncate/truncate.tex
new file mode 100644
index 0000000000..412d183553
--- /dev/null
+++ b/macros/latex/contrib/truncate/truncate.tex
@@ -0,0 +1,57 @@
+\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-...'' & (option hyphenate) \\
+ ``This text has been trun...~'' & (option breakwords) \\
+ ``This text has been trunc...'' & (option breakall)
+ \end{tabular}
+\end{quote}
+(All of these options work through \TeX{}'s hyphenation mechanism.)
+\end{document}