summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/tabto/tabto-doc.tex
blob: 8d2aef54c1091f6c8d195971a3686280de5c13ea (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
\documentclass[11pt,a4paper]{article}
\usepackage[a4paper,margin=3cm]{geometry}
\setlength{\parskip}{2pt}
\makeatletter

\newcommand\cs[1]{\texttt{\char`\\#1}}
\renewcommand\arg[1]{\nolinebreak[2]\mbox{\texttt{\string{#1\string}}}}
\newcommand\oarg[1]{\nolinebreak[2]\mbox{\texttt{[#1]}}}
\newcommand\sarg{\texttt{*}}

\newcommand\meta[1]{\mbox{\ensuremath{\langle}\textit{#1}\ensuremath{\rangle}}}
\newcommand\prototype[1]{\par\pagebreak[1]\bigskip\begingroup
   \noindent\samepage #1\par \nopagebreak \smallskip \endgroup \@afterheading}

% meaningful names, as in faq.sty
\let\environment\texttt
\let\Package\textsf
\makeatother

\begin{document}
\title{The \Package{tabto} package}
\author{Donald Arseneau\thanks{Thanks to Robin
    Fairbairns for making typeset documentation.}}
\date{Dec 2018, version 1.4}
\maketitle

\section*{Tabbing to fixed positions in a paragraph}

Two new text positioning commands are defined: \cs{tabto} and \cs{tab}.

\prototype{\cs{tabto}\arg{\meta{length}}}

Tab to a position relative to the left margin in a paragraph
(any indentation due to a list is part of the `margin' in this
context).  If the text on the line already goes past the desired
position, the tab starts a new line and moves to the requested
horizontal position.


\prototype{\cs{tabto}\sarg\arg{\meta{length}}}

Similar to \cs{tabto}, except it will perform backspacing, and 
over-print previous text on the line whenever that text is already
longer than the specified length (i.e., no linebreak is produced).
Line-breaks are suppressed immediately after \cs{tabto} or \cs{tabto*}.

The length register \cs{CurrentLineWidth} will report the width
of the existing text on the line, and it may be used in the
\meta{length} argument (using calc.sty, for example). Also, there
is \cs{TabPrevPos} which stores the \cs{CurrentLineWidth} from the
previous tab command (the position where the tab command occurred,
not where it went to), and can be used to return to that position
if no line breaks have occurred in between, or directly below it,
if there were line breaks.

\prototype{\cs{tab}}

Tab to the next tab-stop chosen from a list of tab positions, in
the traditional style of typewriters.  A \cs{tab} will always move
to the next tab stop (or the next line), even if it is already
exactly at a tab stop. Thus, ``\cs{tab}\cs{tab}'' skips a position.  A
linebreak is permitted immediately following a \cs{tab}, in case the
ensuing text does not fit well in the remaining space.

The tab-stop positions are declared using either \cs{TabPositions}
or \cs{NumTabs}:

\prototype{\cs{TabPositions}\arg{\meta{length}, \meta{length},
             \textrm{\dots}\meta{length}}}

Declares the tab stops as a comma-separated list of positions 
relative to the left margin. A tab-stop at \texttt{0pt} is implicit, and 
need not be listed.

\prototype{\cs{NumTabs}\arg{\meta{number}}}

Declares a list of \meta{number} equally-spaced tabs, starting at the
left margin and spanning \cs{linewidth}.  For example
\cs{NumTabs}\arg{2} declares tab-stops at \texttt{0pt} and
\texttt{0.5}\cs{linewidth}, the same as
\cs{TabPositions}\arg{0pt, 0.5\cs{linewidth}}
or \cs{TabPositions}\arg{0.5\cs{linewidth}}.


\end{document}