Next: , Previous: quote, Up: Environments


8.21 tabbing

Synopsis:

     \begin{tabbing}
     row1col1 \= row1col2 \= row1col3 \= row1col4 \\
     row2col1 \>                \> row2col3 \\
     ...
     \end{tabbing}

The tabbing environment provides a way to align text in columns. It works by setting tab stops and tabbing to them much as was done on an ordinary typewriter. It is best suited for cases where the width of each column is constant and known in advance.

This environment can be broken across pages, unlike the tabular environment.

The following commands can be used inside a tabbing enviroment:

\\ tabbing
End a line.
\= (tabbing)
Sets a tab stop at the current position.
\> (tabbing)
Advances to the next tab stop.
\<
Put following text to the left of the local margin (without changing the margin). Can only be used at the start of the line.
\+
Moves the left margin of the next and all the following commands one tab stop to the right, beginning tabbed line if necessary.
\-
Moves the left margin of the next and all the following commands one tab stop to the left, beginning tabbed line if necessary.
\' (tabbing)
Moves everything that you have typed so far in the current column, i.e. everything from the most recent \>, \<, \', \\, or \kill command, to the right of the previous column, flush against the current column's tab stop.
\` (tabbing)
Allows you to put text flush right against any tab stop, including tab stop 0. However, it can't move text to the right of the last column because there's no tab stop there. The \` command moves all the text that follows it, up to the \\ or \end{tabbing} command that ends the line, to the right margin of the tabbing environment. There must be no \> or \' command between the \` and the command that ends the line.
\a (tabbing)
In a tabbing environment, the commands \=, \' and \` do not produce accents as usual (see Accents). Instead, the commands \a=, \a' and \a` are used.
\kill
Sets tab stops without producing text. Works just like \\ except that it throws away the current line instead of producing output for it. The effect of any \=, \+ or \- commands in that line remain in effect.
\poptabs
Restores the tab stop positions saved by the last \pushtabs.
\pushtabs
Saves all current tab stop positions. Useful for temporarily changing tab stop positions in the middle of a tabbing environment.
\tabbingsep
Distance to left of tab stop moved by \'.

This example typesets a Pascal function in a traditional format:

     \begin{tabbing}
     function \= fact(n : integer) : integer;\\
              \> begin \= \+ \\
                    \> if \= n $>$ 1 then \+ \\
                             fact := n * fact(n-1) \- \\
                       else \+ \\
                             fact := 1; \-\- \\
                 end;\\
     \end{tabbing}