File indexing completed on 2024-11-24 04:34:44

0001 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
0002 <html>
0003 <!-- This document is an unofficial reference manual for LaTeX, a
0004 document preparation system, version of November 2018.
0005 
0006 This manual was originally translated from LATEX.HLP v1.0a in the
0007 VMS Help Library.  The pre-translation version was written by
0008 George D. Greenwade of Sam Houston State University.  The
0009 LaTeX 2.09 version was written by Stephen Gilmore.  The
0010 LaTeX2e version was adapted from this by Torsten Martinsen.  Karl
0011 Berry made further updates and additions, and gratefully acknowledges
0012 using Hypertext Help with LaTeX, by Sheldon Green, and
0013 LaTeX Command Summary (for LaTeX 2.09) by
0014 L. Botway and C. Biemesderfer (published by the TeX Users
0015 Group as TeXniques number 10), as reference material.  We also
0016 gratefully acknowledge additional material appearing in
0017 latex2e-reference by Martin Herbert Dietze.  (From these references no
0018 text was directly copied.)
0019 
0020 Copyright 2007, 2008, 2009, 2010, 2011, 2012, 2013,
0021 2014, 2015, 2016, 2017, 2018 Karl Berry.
0022 
0023 Copyright 1988, 1994, 2007 Stephen Gilmore.
0024 
0025 Copyright 1994, 1995, 1996 Torsten Martinsen.
0026 
0027 Permission is granted to make and distribute verbatim copies of
0028 this manual provided the copyright notice and this permission notice
0029 are preserved on all copies.
0030 
0031 
0032 Permission is granted to copy and distribute modified versions of this
0033 manual under the conditions for verbatim copying, provided that the entire
0034 resulting derived work is distributed under the terms of a permission
0035 notice identical to this one.
0036 
0037 Permission is granted to copy and distribute translations of this manual
0038 into another language, under the above conditions for modified versions. -->
0039 <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
0040 <head>
0041 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
0042 <title>tabbing (LaTeX2e unofficial reference manual (November 2018))</title>
0043 
0044 <meta name="description" content="tabbing (LaTeX2e unofficial reference manual (November 2018))">
0045 <meta name="keywords" content="tabbing (LaTeX2e unofficial reference manual (November 2018))">
0046 <meta name="resource-type" content="document">
0047 <meta name="distribution" content="global">
0048 <meta name="Generator" content="makeinfo">
0049 <link href="index.html#Top" rel="start" title="Top">
0050 <link href="IndexDocument.html#Index" rel="index" title="Index">
0051 <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
0052 <link href="Environments.html#Environments" rel="up" title="Environments">
0053 <link href="table.html#table" rel="next" title="table">
0054 <link href="quotation-_0026-quote.html#quotation-_0026-quote" rel="prev" title="quotation &amp; quote">
0055 <style type="text/css">
0056 <!--
0057 /* $Id: latex2e.css 690 2018-09-15 15:20:19Z jimhefferon $
0058    Minor css for latexrefman. Public domain.
0059    Originally written by Jim Hefferon and Karl Berry, 2018. */
0060 
0061 /* So you can style for yourself */
0062 @import url("/css/latexreflocal.css");
0063 
0064 
0065 
0066 a.summary-letter {text-decoration: none}
0067 blockquote.indentedblock {margin-right: 0em}
0068 blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
0069 blockquote.smallquotation {font-size: smaller}
0070 div.display {margin-left: 3.2em}
0071 div.example {margin-left: 3.2em}
0072 div.lisp {margin-left: 3.2em}
0073 div.smalldisplay {margin-left: 3.2em}
0074 div.smallexample {margin-left: 3.2em}
0075 div.smalllisp {margin-left: 3.2em}
0076 kbd {font-style: oblique}
0077 pre.display {font-family: inherit}
0078 pre.format {font-family: inherit}
0079 pre.menu-comment {font-family: serif}
0080 pre.menu-preformatted {font-family: serif}
0081 pre.smalldisplay {font-family: inherit; font-size: smaller}
0082 pre.smallexample {font-size: smaller}
0083 pre.smallformat {font-family: inherit; font-size: smaller}
0084 pre.smalllisp {font-size: smaller}
0085 span.nolinebreak {white-space: nowrap}
0086 span.roman {font-family: initial; font-weight: normal}
0087 span.sansserif {font-family: sans-serif; font-weight: normal}
0088 ul.no-bullet {list-style: none}
0089 BODY {
0090   margin-top: 1em;
0091   margin-left: 1em; /* auto results in two-digit <ol> lost off left */
0092   margin-right: 1em;
0093   margin-bottom: 1em;
0094   /* the idea is to use the whole window, unless it is ridiculously
0095      wide, probably with too-small fonts, too.  */
0096   max-width: 64em;
0097 }
0098 
0099 /* Because we want @math{... @code ...} to be upright, not slanted,
0100    and Texinfo won't fix it. */
0101 code {font-style:normal; font-family:monospace; }
0102 
0103 /* We put a link to our own home page at the bottom. */
0104 div.referenceinfo {font-size:small;}
0105 
0106 -->
0107 </style>
0108 
0109 
0110 </head>
0111 
0112 <body lang="en">
0113 <a name="tabbing"></a>
0114 <div class="header">
0115 <p>
0116 Next: <a href="table.html#table" accesskey="n" rel="next">table</a>, Previous: <a href="quotation-_0026-quote.html#quotation-_0026-quote" accesskey="p" rel="prev">quotation &amp; quote</a>, Up: <a href="Environments.html#Environments" accesskey="u" rel="up">Environments</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="IndexDocument.html#Index" title="Index" rel="index">Index</a>]</p>
0117 </div>
0118 <hr>
0119 <a name="tabbing-1"></a>
0120 <h3 class="section">8.21 <code>tabbing</code></h3>
0121 
0122 <a name="index-environment_002c-tabbing"></a>
0123 <a name="index-tabbing-environment"></a>
0124         
0125 <a name="index-tab-stops_002c-using"></a>
0126 <a name="index-lining-text-up-using-tab-stops"></a>
0127 <a name="index-alignment-via-tabbing"></a>
0128 
0129 <p>Synopsis:
0130 </p>
0131 <div class="example">
0132 <pre class="example">\begin{tabbing}
0133 <var>row1col1</var> \= <var>row1col2</var> ...  \\
0134 <var>row2col1</var> \&gt; <var>row2col2</var> ...  \\
0135 ...
0136 \end{tabbing}
0137 </pre></div>
0138 
0139 <p>Align text in columns, by setting tab stops and tabbing to them much as
0140 was done on a typewriter.  This is less often used than the environments
0141 <code>tabular</code> (see <a href="tabular.html#tabular">tabular</a>) or <code>array</code> (see <a href="array.html#array">array</a>) because
0142 in those the width of each column need not be constant and need not be
0143 known in advance.
0144 </p>
0145 <p>This example has a first line where the tab stops are set to explicit
0146 widths, ended by a <code>\kill</code> command (which is described below):
0147 </p>
0148 <div class="example">
0149 <pre class="example">\begin{tabbing}
0150 \hspace{0.75in}     \= \hspace{0.40in}  \= \hspace{0.40in}    \kill
0151 Ship                \&gt; Guns             \&gt; Year    \\ 
0152 \textit{Sophie}     \&gt; 14               \&gt; 1800    \\
0153 \textit{Polychrest} \&gt; 24               \&gt; 1803    \\
0154 \textit{Lively}     \&gt; 38               \&gt; 1804    \\
0155 \textit{Surprise}   \&gt; 28               \&gt; 1805    \\
0156 \end{tabbing}
0157 </pre></div>
0158 
0159 <p>Both the <code>tabbing</code> environment and the more widely-used
0160 <code>tabular</code> environment put text in columns.  The most important
0161 distinction is that in <code>tabular</code> the width of columns is
0162 determined automatically by LaTeX, while in <code>tabbing</code> the user
0163 sets the tab stops.  Another distinction is that <code>tabular</code>
0164 generates a box, but <code>tabbing</code> can be broken across pages.
0165 Finally, while <code>tabular</code> can be used in any mode, <code>tabbing</code>
0166 can be used only in paragraph mode and it starts a new paragraph.
0167 </p>
0168 <p>A <code>tabbing</code> environment always starts a new paragraph, without
0169 indentation. Moreover, as shown in the example above, there is no need
0170 to use the starred form of the <code>\hspace</code> command at the beginning
0171 of a tabbed row.  The right margin of the <code>tabbing</code> environment is
0172 the end of line, so that the width of the environment is
0173 <code>\linewidth</code>.
0174 </p>
0175 <a name="index-row_002c-tabbing"></a>
0176 <p>The <code>tabbing</code> environment contains a sequence of <em>tabbed
0177 rows</em>.  The first tabbed row begins immediately after
0178 <code>\begin{tabbing}</code> and each row ends with <code>\\</code> or
0179 <code>\kill</code>. The last row may omit the <code>\\</code> and end with just
0180 <code>\end{tabbing}</code>.
0181 </p>
0182 <p>At any point the <code>tabbing</code> environment has a current tab stop
0183 pattern, a sequence of <em><var>n</var> &gt; 0</em> tab stops, numbered 0, 1,
0184 etc.  These create <var>n</var> corresponding columns.  Tab stop&nbsp;0 is
0185 always the left margin, defined by the enclosing environment.  Tab
0186 stop number&nbsp;<var>i</var> is set if it is assigned a horizontal
0187 position on the page.  Tab stop number&nbsp;<var>i</var> can only be set if
0188 all the stops 0, &hellip;, <em>i-1</em> have already been set; normally
0189 later stops are to the right of earlier ones.
0190 </p>
0191 <p>By default any text typeset in a <code>tabbing</code> environment is typeset
0192 ragged right and left-aligned on the current tab stop. Typesetting is
0193 done in LR mode (see <a href="Modes.html#Modes">Modes</a>).
0194 </p>
0195 <p>The following commands can be used inside a <code>tabbing</code> environment.
0196 They are all fragile (see <a href="_005cprotect.html#g_t_005cprotect">\protect</a>).
0197 </p>
0198 <dl compact="compact">
0199 <dt><code>\\ <span class="roman">(tabbing)</span></code>
0200 <a name="index-_005c_005c-_0028tabbing_0029"></a>
0201 </dt>
0202 <dd><p>End a tabbed line and typeset it.
0203 </p>
0204 </dd>
0205 <dt><code>\= <span class="roman">(tabbing)</span></code>
0206 <a name="index-_005c_003d-_0028tabbing_0029"></a>
0207 </dt>
0208 <dd><p>Sets a tab stop at the current position.
0209 </p>
0210 </dd>
0211 <dt><code>\&gt; <span class="roman">(tabbing)</span></code>
0212 <a name="index-_005c_003e-_0028tabbing_0029"></a>
0213 </dt>
0214 <dd><a name="index-_005c_003e"></a>
0215 <p>Advances to the next tab stop.
0216 </p>
0217 </dd>
0218 <dt><code>\&lt;</code>
0219 <a name="index-_005c_003c"></a>
0220 </dt>
0221 <dd><p>Put following text to the left of the local margin (without changing
0222 the margin).  Can only be used at the start of the line.
0223 </p>
0224 </dd>
0225 <dt><code>\+</code>
0226 <a name="index-_005c_002b"></a>
0227 </dt>
0228 <dd><p>Moves the left margin of the next and all the
0229 following commands one tab stop to the right, beginning tabbed line if
0230 necessary.
0231 </p>
0232 </dd>
0233 <dt><code>\-</code>
0234 <a name="index-_005c_002d"></a>
0235 </dt>
0236 <dd><p>Moves the left margin of the next and all the
0237 following commands one tab stop to the left, beginning tabbed line if
0238 necessary.
0239 </p>
0240 </dd>
0241 <dt><code>\' <span class="roman">(tabbing)</span></code>
0242 <a name="index-_005c_0027-_0028tabbing_0029"></a>
0243 </dt>
0244 <dd><p>Moves everything that you have typed so far in the current column, i.e.,
0245 everything from the most recent <code>\&gt;</code>, <code>\&lt;</code>, <code>\'</code>,
0246 <code>\\</code>, or <code>\kill</code> command, to the previous column and aligned
0247 to the right, flush against the current column&rsquo;s tab stop.
0248 </p>
0249 </dd>
0250 <dt><code>\` <span class="roman">(tabbing)</span></code>
0251 <a name="index-_005c_0060-_0028tabbing_0029"></a>
0252 </dt>
0253 <dd><p>Allows you to put text flush right against any tab stop, including tab
0254 stop&nbsp;0.  However, it can&rsquo;t move text to the right of the last
0255 column because there&rsquo;s no tab stop there.  The <code>\`</code> command moves
0256 all the text that follows it, up to the <code>\\</code> or
0257 <code>\end{tabbing}</code> command that ends the line, to the right margin
0258 of the <code>tabbing</code> environment.  There must be no <code>\&gt;</code> or
0259 <code>\'</code> command between the <code>\`</code> and the <code>\\</code> or
0260 <code>\end{tabbing}</code> command that ends the line.
0261 </p>
0262 </dd>
0263 <dt><code>\a <span class="roman">(tabbing)</span></code>
0264 <a name="index-_005ca-_0028tabbing_0029"></a>
0265 </dt>
0266 <dd><a name="index-_005ca_0027-_0028acute-accent-in-tabbing_0029"></a>
0267 <a name="index-_005ca_0060-_0028grave-accent-in-tabbing_0029"></a>
0268 <a name="index-_005ca_003d-_0028macron-accent-in-tabbing_0029"></a>
0269 <p>In a <code>tabbing</code> environment, the commands <code>\=</code>, <code>\'</code> and
0270 <code>\`</code> do not produce accents as usual (see <a href="Accents.html#Accents">Accents</a>).  Instead,
0271 use the commands <code>\a=</code>, <code>\a'</code> and <code>\a`</code>.
0272 </p>
0273 </dd>
0274 <dt><code>\kill</code>
0275 <a name="index-_005ckill"></a>
0276 </dt>
0277 <dd><p>Sets tab stops without producing text.  Works just like <code>\\</code> except
0278 that it throws away the current line instead of producing output for it.
0279 Any <code>\=</code>, <code>\+</code> or <code>\-</code> commands in that line remain in
0280 effect.
0281 </p>
0282 </dd>
0283 <dt><code>\poptabs</code>
0284 <a name="index-_005cpoptabs"></a>
0285 </dt>
0286 <dd><a name="index-_005cpoptabs-1"></a>
0287 <p>Restores the tab stop positions saved by the last <code>\pushtabs</code>.
0288 </p>
0289 </dd>
0290 <dt><code>\pushtabs</code>
0291 <a name="index-_005cpushtabs"></a>
0292 </dt>
0293 <dd><p>Saves all current tab stop positions. Useful for temporarily changing
0294 tab stop positions in the middle of a <code>tabbing</code> environment.
0295 </p>
0296 </dd>
0297 <dt><code>\tabbingsep</code>
0298 <a name="index-_005ctabbingsep"></a>
0299 </dt>
0300 <dd><p>Distance of the text moved by <code>\'</code> to left of current tab stop.
0301 </p>
0302 </dd>
0303 </dl>
0304 
0305 <p>This example typesets a Pascal function:
0306 </p>
0307 <div class="example">
0308 <pre class="example">\begin{tabbing}
0309 function \= fact(n : integer) : integer;\\
0310          \&gt; begin \= \+ \\
0311                \&gt; if \= n &gt; 1 then \+ \\
0312                         fact := n * fact(n-1) \- \\
0313                   else \+ \\
0314                         fact := 1; \-\- \\
0315             end;\\
0316 \end{tabbing}
0317 </pre></div>
0318 
0319 <p>The output looks like this.
0320 </p>
0321 <div class="example">
0322 <pre class="example">function fact(n : integer) : integer;
0323          begin
0324                if n &gt; 1 then
0325                   fact := n * fact(n-1);
0326                else
0327                   fact := 1;
0328          end;
0329 </pre></div>
0330 
0331 <a name="index-package_002c-algorithm2e"></a>
0332 <a name="index-algorithm2e-package"></a>
0333 <a name="index-package_002c-listings"></a>
0334 <a name="index-listings-package"></a>
0335 <a name="index-package_002c-minted"></a>
0336 <a name="index-minted-package"></a>
0337 
0338 <a name="index-package_002c-fancyvrb"></a>
0339 <a name="index-fancyvrb-package"></a>
0340 
0341 <p>This example is just for illustration of the environment.  To actually
0342 typeset computer code in typewriter like this, a verbatim environment
0343 (see <a href="verbatim.html#verbatim">verbatim</a>) would normally be best.  For pretty-printed code,
0344 there are quite a few packages, including <code>algorithm2e</code>,
0345 <code>fancyvrb</code>, <code>listings</code>, and <code>minted</code>.
0346 </p>
0347         
0348 
0349 
0350 <hr/><div class='referenceinfo'> <a href='https://latexref.xyz/'> <i>Unofficial LaTeX2e reference manual</i></a></div>
0351 </body>
0352 </html>