summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/truncate/truncate.tex
blob: 412d183553c07a9f3c8e583abd45312f10b3b705 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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}