| 1 |
\documentclass[11pt,a4paper]{article} |
| 2 |
\usepackage[a4paper,margin=3cm]{geometry} |
| 3 |
\setlength{\parskip}{2pt} |
| 4 |
\makeatletter |
| 5 |
|
| 6 |
\newcommand\cs[1]{\texttt{\char`\\#1}} |
| 7 |
\renewcommand\arg[1]{\nolinebreak[2]\mbox{\texttt{\string{#1\string}}}} |
| 8 |
\newcommand\oarg[1]{\nolinebreak[2]\mbox{\texttt{[#1]}}} |
| 9 |
\newcommand\sarg{\texttt{*}} |
| 10 |
|
| 11 |
\newcommand\meta[1]{\mbox{\ensuremath{\langle}\textit{#1}\ensuremath{\rangle}}} |
| 12 |
\newcommand\prototype[1]{\par\pagebreak[1]\bigskip\begingroup |
| 13 |
\noindent\samepage #1\par \nopagebreak \smallskip \endgroup \@afterheading} |
| 14 |
|
| 15 |
% meaningful names, as in faq.sty |
| 16 |
\let\environment\texttt |
| 17 |
\let\Package\textsf |
| 18 |
\makeatother |
| 19 |
|
| 20 |
\begin{document} |
| 21 |
\title{The \Package{tabto} package} |
| 22 |
\author{Donald Arseneau\thanks{Thanks to Robin |
| 23 |
Fairbairns for making typeset documentation.}} |
| 24 |
\date{Dec 2018, version 1.4} |
| 25 |
\maketitle |
| 26 |
|
| 27 |
\section*{Tabbing to fixed positions in a paragraph} |
| 28 |
|
| 29 |
Two new text positioning commands are defined: \cs{tabto} and \cs{tab}. |
| 30 |
|
| 31 |
\prototype{\cs{tabto}\arg{\meta{length}}} |
| 32 |
|
| 33 |
Tab to a position relative to the left margin in a paragraph |
| 34 |
(any indentation due to a list is part of the `margin' in this |
| 35 |
context). If the text on the line already goes past the desired |
| 36 |
position, the tab starts a new line and moves to the requested |
| 37 |
horizontal position. |
| 38 |
|
| 39 |
|
| 40 |
\prototype{\cs{tabto}\sarg\arg{\meta{length}}} |
| 41 |
|
| 42 |
Similar to \cs{tabto}, except it will perform backspacing, and |
| 43 |
over-print previous text on the line whenever that text is already |
| 44 |
longer than the specified length (i.e., no linebreak is produced). |
| 45 |
Line-breaks are suppressed immediately after \cs{tabto} or \cs{tabto*}. |
| 46 |
|
| 47 |
The length register \cs{CurrentLineWidth} will report the width |
| 48 |
of the existing text on the line, and it may be used in the |
| 49 |
\meta{length} argument (using calc.sty, for example). Also, there |
| 50 |
is \cs{TabPrevPos} which stores the \cs{CurrentLineWidth} from the |
| 51 |
previous tab command (the position where the tab command occurred, |
| 52 |
not where it went to), and can be used to return to that position |
| 53 |
if no line breaks have occurred in between, or directly below it, |
| 54 |
if there were line breaks. |
| 55 |
|
| 56 |
\prototype{\cs{tab}} |
| 57 |
|
| 58 |
Tab to the next tab-stop chosen from a list of tab positions, in |
| 59 |
the traditional style of typewriters. A \cs{tab} will always move |
| 60 |
to the next tab stop (or the next line), even if it is already |
| 61 |
exactly at a tab stop. Thus, ``\cs{tab}\cs{tab}'' skips a position. A |
| 62 |
linebreak is permitted immediately following a \cs{tab}, in case the |
| 63 |
ensuing text does not fit well in the remaining space. |
| 64 |
|
| 65 |
The tab-stop positions are declared using either \cs{TabPositions} |
| 66 |
or \cs{NumTabs}: |
| 67 |
|
| 68 |
\prototype{\cs{TabPositions}\arg{\meta{length}, \meta{length}, |
| 69 |
\textrm{\dots}\meta{length}}} |
| 70 |
|
| 71 |
Declares the tab stops as a comma-separated list of positions |
| 72 |
relative to the left margin. A tab-stop at \texttt{0pt} is implicit, and |
| 73 |
need not be listed. |
| 74 |
|
| 75 |
\prototype{\cs{NumTabs}\arg{\meta{number}}} |
| 76 |
|
| 77 |
Declares a list of \meta{number} equally-spaced tabs, starting at the |
| 78 |
left margin and spanning \cs{linewidth}. For example |
| 79 |
\cs{NumTabs}\arg{2} declares tab-stops at \texttt{0pt} and |
| 80 |
\texttt{0.5}\cs{linewidth}, the same as |
| 81 |
\cs{TabPositions}\arg{0pt, 0.5\cs{linewidth}} |
| 82 |
or \cs{TabPositions}\arg{0.5\cs{linewidth}}. |
| 83 |
|
| 84 |
|
| 85 |
\end{document} |