| 1 |
%% file: TXSenvmt.doc - Environments - TeXsis version 2.18 |
| 2 |
%% @(#) $Id: TXSenvmt.doc,v 18.2 2000/05/17 00:19:46 myers Exp $ |
| 3 |
%======================================================================* |
| 4 |
% (C) copyright 1988, 1991, 1994 by Eric Myers and Frank E. Paige. |
| 5 |
% This file is a part of TeXsis. Distribution and/or modifications |
| 6 |
% are allowed under the terms of the LaTeX Project Public License (LPPL). |
| 7 |
% See the file COPYING or ftp://ftp.texsis.org/texsis/LPPL |
| 8 |
%======================================================================* |
| 9 |
\ifx\undefined\bs \texsis\input TXSdocM.doc\draft\input Manual.aux\fi |
| 10 |
|
| 11 |
|
| 12 |
\section{Environments \label{sect.envmt}} |
| 13 |
|
| 14 |
\TeX\ ordinarily provides a layout appropriate for straight text |
| 15 |
and equations. The \TeXsis\ macros described below create environments |
| 16 |
which bypass the normal layout to format text in special ways, to create |
| 17 |
different types of lists, to display theorems and proofs, to display |
| 18 |
computer code, and even to print \TeX\ examples. With the exception of |
| 19 |
some of the specialized \TeX\ example macros, the syntax for all of |
| 20 |
these is generally of the form ``|\thing|...'' to begin the environment |
| 21 |
and ``|\endthing|'' to end it. |
| 22 |
|
| 23 |
%==================================================* |
| 24 |
\subsection{Flush or Centered Text} |
| 25 |
|
| 26 |
There are three environments in \TeXsis\ which center lines, set |
| 27 |
them flush left, or set them flush right, respectively: |
| 28 |
\description{~endflushright~\qquad}\clump |
| 29 |
|
| 30 |
\itm{\CS{center}} |
| 31 |
Centers all lines which follow, up to |\endcenter|. |
| 32 |
|
| 33 |
\itm{\CS{flushleft}} |
| 34 |
The lines which follow, up to |\endflushleft|, |
| 35 |
are made to line up flush to the left margin. |
| 36 |
|
| 37 |
\itm{\CS{flushright}} |
| 38 |
The lines which follow, up to |\endflushright|, |
| 39 |
are made to line up flush to the right margin. |
| 40 |
\enddescription |
| 41 |
In all of these environments line endings |
| 42 |
in the input file {\sl are} obeyed, as with \cs{obeylines}. |
| 43 |
\index{lines!centering}\index{lines!flush left}\index{lines!flush right}% |
| 44 |
For example, |
| 45 |
\TeXexample |
| 46 |
\center |
| 47 |
A Centered Line |
| 48 |
and Another |
| 49 |
\endcenter |
| 50 |
|endTeXexample |
| 51 |
produces |
| 52 |
|
| 53 |
\center\singlespaced\parskip=0pt |
| 54 |
A Centered Line |
| 55 |
and Another |
| 56 |
\endcenter |
| 57 |
\noindent |
| 58 |
There is also a \CS{raggedcenter} environment which does not respect line |
| 59 |
breaks but instead produces centered lines each of which is made as long |
| 60 |
as possible: |
| 61 |
\description{~raggedcenter~\qquad}\clump |
| 62 |
\itm{\CS{raggedcenter}} |
| 63 |
Center lines without respecting line endings. |
| 64 |
Terminate with |\endraggedcenter|. |
| 65 |
\enddescription |
| 66 |
\goodbreak\noindent |
| 67 |
For example |
| 68 |
\def\|{\ifmmode\Vert\else \char`\|\fi} |
| 69 |
\TeXexample |
| 70 |
\raggedcenter |
| 71 |
In the ragged centering environment each line |
| 72 |
is made as long as possible, and |
| 73 |
the successive lines are centered. |
| 74 |
\endraggedcenter |
| 75 |
|endTeXexample |
| 76 |
produces |
| 77 |
\raggedcenter\baselineskip=\normalbaselineskip |
| 78 |
In the ragged centering environment each line |
| 79 |
is made as long as possible, and |
| 80 |
the successive lines are centered. |
| 81 |
\endraggedcenter |
| 82 |
\noindent |
| 83 |
Note that \cs{raggedcenter} does not hyphenate words. |
| 84 |
|
| 85 |
|
| 86 |
%==================================================* |
| 87 |
\subsection{Simple Examples and Quoted Text} |
| 88 |
|
| 89 |
The \CS{example} environment can be used to display an example of |
| 90 |
something in a way that sets it off from the main text. The indentation |
| 91 |
of an example is the same as in the list environments (see |
| 92 |
\Sect{env-indent}). The text in an example will be single |
| 93 |
spaced, even if the rest of the document is double spaced. End this |
| 94 |
environment with \cs{endexample}. An example of the use of \CS{example} |
| 95 |
is |
| 96 |
\TeXexample |
| 97 |
|tentt\example |
| 98 |
Physics is not a finished logical system. Rather, at any |
| 99 |
moment it spans a great confusion of ideas, some that |
| 100 |
survive like folk epics from the heroic periods of the past, |
| 101 |
and other that arise like utopian novels from our dim |
| 102 |
premonitions of a future grand synthesis. |
| 103 |
\endexample |
| 104 |
|endTeXexample |
| 105 |
which produces\reference{Weinberg, 1972} |
| 106 |
S.~Weinberg, |
| 107 |
\booktitle{Gravitation and Cosmology: Principles and Applications of the |
| 108 |
General Theory of Relativity} |
| 109 |
(Wiley, New York, 1972) pg.~3 |
| 110 |
\endreference\relax\index{Weinberg, Steven} |
| 111 |
\begingroup\tenpoint |
| 112 |
\EnvRightskip=\parindent % need this to show off defaults! |
| 113 |
\blockquote |
| 114 |
Physics is not a finished logical system. Rather, at any |
| 115 |
moment it spans a great confusion of ideas, some that |
| 116 |
survive like folk epics from the heroic periods of the past, |
| 117 |
and other that arise like utopian novels from our dim |
| 118 |
premonitions of a future grand synthesis. |
| 119 |
\endexample |
| 120 |
\endgroup |
| 121 |
Another example of \CS{example} is given in the next subsection as an |
| 122 |
example of the |\theorem| environment. |
| 123 |
|
| 124 |
Since one of the uses of \CS{example} is to display block quotes, as |
| 125 |
we've just done above, a synonym for \CS{example} is \CS{blockquote}, |
| 126 |
which should be ended with \CS{endblockquote}. |
| 127 |
|
| 128 |
|
| 129 |
%==================================================* |
| 130 |
\subsection{Theorems and Proofs} |
| 131 |
|
| 132 |
Theorems,\index{theorems} \idx{lemmas}, and \idx{corollaries} are |
| 133 |
typeset in a quasi-SIAM format, with the number in boldface and the text |
| 134 |
in slanted type. |
| 135 |
They are automatically numbered, including the chapter and |
| 136 |
section numbers if \cs{showchaptIDtrue} and \cs{showsectIDtrue} are |
| 137 |
being used. The syntax for a theorem is |
| 138 |
\example |
| 139 |
\CS{theorem}\arg{label} \n |
| 140 |
\meta{text} \n |
| 141 |
\cs{endtheorem} \n |
| 142 |
\CS{proof} \n |
| 143 |
\meta{text} \n |
| 144 |
\cs{endproof} |
| 145 |
\endexample |
| 146 |
\noindent |
| 147 |
and similarly for \CS{lemma}, \CS{corollary} and \CS{definition}. |
| 148 |
Definitions are printed in Roman type, not slanted. The |
| 149 |
\cs{endproof} macro inserts a black box to mark the end of the |
| 150 |
proof. Subsequent references to theorems, lemmas, corollaries |
| 151 |
and definitions can be made in the text automatically using |
| 152 |
\CS{Theorem}\arg{label}, \CS{Lemma}\arg{label}, |
| 153 |
\CS{Corollary}\arg{label}, and \CS{Definition}\arg{label}, |
| 154 |
which give the appropriate name and number. An example of a |
| 155 |
Theorem is: |
| 156 |
\TeXexample |
| 157 |
|tentt\example |
| 158 |
\theorem{Cauchy} |
| 159 |
If $f(z)$ is a function of $z$ which is analytic on and inside of |
| 160 |
a contour $C$, then |
| 161 |
$$ |
| 162 |
\int_C f(z)\,dz = 0 |
| 163 |
$$ |
| 164 |
\endtheorem |
| 165 |
\proof |
| 166 |
Left as an exercise to the reader. |
| 167 |
\endproof |
| 168 |
\endexample |
| 169 |
|endTeXexample |
| 170 |
which produces |
| 171 |
\begingroup |
| 172 |
\EnvRightskip=\parindent % need this to show off defaults! |
| 173 |
\tenpoint |
| 174 |
\example |
| 175 |
\theorem{Cauchy} |
| 176 |
If $f(z)$ is a function of $z$ which is analytic on and inside of |
| 177 |
a contour $C$, then |
| 178 |
$$ |
| 179 |
\int_C f(z)\,dz = 0 |
| 180 |
$$ |
| 181 |
\endtheorem |
| 182 |
\proof |
| 183 |
Left as an exercise to the reader. |
| 184 |
\endproof |
| 185 |
\endexample |
| 186 |
\endgroup |
| 187 |
\noindent |
| 188 |
Note the use of \cs{example} to indent the theorem and proof and print |
| 189 |
them single spaced. Had the \cs{example} been omitted the theorem and |
| 190 |
proof would have had the same margins and spacing as the rest of the text. |
| 191 |
This theorem would be referred to in the text with |\Theorem{Cauchy}|, |
| 192 |
which gives ``\Theorem{Cauchy}.'' This should be sufficient in most |
| 193 |
cases, but if necessary one can refer to theorem or lemma numbers with |
| 194 |
the primitive \cs{use}|{|\meta{type}.\meta{label}|}|, where \meta{type} is |
| 195 |
either |Thm|, |Lem|, respectively. See Section~\use{sect.labels} for |
| 196 |
more on the use of \cs{use}. |
| 197 |
|
| 198 |
|
| 199 |
%==================================================* |
| 200 |
\subsection{Listing Computer Code} |
| 201 |
|
| 202 |
The \CS{Listing} environment can be used to display computer code |
| 203 |
or fragments of computer code. \index{listing computer code}% |
| 204 |
The text is printed in |\tt| type with line endings respected and every |
| 205 |
space counted. You can still use \TeX\ control sequences in this |
| 206 |
environment, but many of the special characters like |%|, |&|, and |#| |
| 207 |
are simply printable characters, since they are used in languages like |
| 208 |
C. (|$|, |_| and |^| also lose any special meaning in this |
| 209 |
environment.) Since the curly brackets used by \TeX\ are also used in C |
| 210 |
(and other languages) they are also simply characters in the |\Listing| |
| 211 |
environment. To perform grouping you should use \cs{bgroup} and |
| 212 |
\cs{egroup}. The backslash is also used in C as an escape character, so |
| 213 |
there has to be some way to print it --- you simply use |\\|; thus \cs{n} |
| 214 |
should be typed as |\\n|. You end the listing environment with |
| 215 |
\cs{endListing}. As an example here is a very famous little |
| 216 |
program,\reference{K&R} |
| 217 |
Brian W.~Kernighan and Dennis M.~Ritchie, |
| 218 |
\booktitle{The C Programming Language}, |
| 219 |
(Prentice Hall, Englewood Clifs, NJ, 1978) |
| 220 |
\endreference |
| 221 |
\index{hello@``hello, world''}% |
| 222 |
% |
| 223 |
\Listing |
| 224 |
#include <stdio.h> |
| 225 |
main() |
| 226 |
{ |
| 227 |
printf("hello, world\\n"); |
| 228 |
} |
| 229 |
\endListing |
| 230 |
\noindent |
| 231 |
which was created by simply typing, |
| 232 |
\TeXexample |
| 233 |
|tentt\Listing |
| 234 |
#include <stdio.h> |
| 235 |
main() |
| 236 |
{ |
| 237 |
printf("hello, world\\n"); |
| 238 |
} |
| 239 |
\endListing |
| 240 |
|endTeXexample |
| 241 |
|
| 242 |
|
| 243 |
The indentation and spacing of the of the \CS{Listing} environment are |
| 244 |
controlled by the same parameters that control the indentation of the |
| 245 |
list environments, as described in Sect.~\use{sect.env-indent}. In |
| 246 |
addition, at the begining of the \CS{Listing} environment the macro |
| 247 |
\CS{everyListing} is executed, if it exists. You can define |
| 248 |
\CS{everyListing} to change the typestyle, type size, or spacing in the |
| 249 |
\CS{Listing} environment. |
| 250 |
|
| 251 |
An alternative way to list computer code is |
| 252 |
\CS{ListCodeFile}\arg{filename}, which will list the contents of a |
| 253 |
source code file exactly as it appears in the file (with no need to make |
| 254 |
|\n| into |\\n| and such). The call to this macro should {\sl not\/} be |
| 255 |
enclosed in a |\Listing| environment. If the example program above were |
| 256 |
contained in the source file |hello.c| it could be listed simply by |
| 257 |
typing |
| 258 |
\TeXexample |
| 259 |
\ListCodeFile{hello.c} |
| 260 |
|endTeXexample |
| 261 |
\noindent |
| 262 |
Long lines can bump up against the right margin. |
| 263 |
Some extra glue has been added to help allow for this, but another way |
| 264 |
to make such lines fit is to make the type size smaller before you |
| 265 |
invoke |
| 266 |
\CS{ListCodeFile} (you can do this using \CS{everyListing}). |
| 267 |
% MAYBE THE FOLLOWING GOES AWAY SOMEDAY SOON: |
| 268 |
Note also that tab characters in the code file may not be treated |
| 269 |
exactly correctly. In the present implementation of \TeXsis\ they will |
| 270 |
simply be replaced with eight spaces. We hope to be able to improve how |
| 271 |
this macro deals with tabs in in a future release of \TeXsis, but it is |
| 272 |
difficult to do it exactly right in all cases, so for now it may be best |
| 273 |
to change tabs to spaces in the source file if proper tab stops are |
| 274 |
needed. Most good editors (like emacs) already do this for you, so this |
| 275 |
should not pose much of a problem. |
| 276 |
|
| 277 |
|
| 278 |
%==================================================* |
| 279 |
\subsection{List Environments} |
| 280 |
|
| 281 |
When you want to make a list of things there are several ways |
| 282 |
to do it. The items in the list can be marked by a simple marker |
| 283 |
(like a bullet: $\bullet$), by a number or numbers and letters (as in |
| 284 |
an outline), or by some sort of descriptive text in the margin. |
| 285 |
In Plain \TeX\ you |
| 286 |
would make all of these kinds of lists using the |\item| macro. The |
| 287 |
``list environments'' described below are generalizations of |\item| for |
| 288 |
making these various kinds of lists:\index{lists!different kinds} |
| 289 |
\description{~description~\qquad}\clump |
| 290 |
\itm{\CS{itemize}} |
| 291 |
List of paragraphs marked by a bullet ($\bullet$) or other symbol. |
| 292 |
\index{lists!itemized}% |
| 293 |
|
| 294 |
\itm{\CS{enumerate}} |
| 295 |
List of paragraphs labeled by numbers or by combinations of |
| 296 |
numbers and letters, as for an outline. |
| 297 |
\index{lists!enumerated}% |
| 298 |
|
| 299 |
\itm{\CS{description}} |
| 300 |
List of items and paragraphs describing them.\index{lists!text labels} |
| 301 |
\enddescription |
| 302 |
In each list environment \cs{itm} is used to introduce each individual |
| 303 |
item. The environments are terminated with \cs{enditemize}, |
| 304 |
\cs{endenumerate} and \cs{enddescription}, respectively. The three |
| 305 |
different kinds of environments can be nested to produce a list with |
| 306 |
several levels. The indentation of and spacing above and below the list |
| 307 |
environments can be easily controlled. This is described in |
| 308 |
Section~\use{sect.env-indent}. |
| 309 |
|
| 310 |
|
| 311 |
% ---------- |
| 312 |
\subsubsection{Itemized lists}\relax |
| 313 |
\CS{itemize} produces paragraphs marked by \idx{bullets}~($\bullet$) |
| 314 |
or some other appropriate symbol; {} % a little extra space in this line |
| 315 |
this is usually used for a short list with only a single level of |
| 316 |
nesting where the order \hbox{either} does not matter or is already |
| 317 |
contained in the items of the list. |
| 318 |
\index{lists!itemized}\index{itemizing}% |
| 319 |
%% WE NEED A BETTER SHORT EXAMPLE THAN THIS -- SOMETHING SIMPLER? |
| 320 |
For example, |\itemize| was used to produce the list of |
| 321 |
sections of this manual which begins |
| 322 |
on \linkto{page.itemize}{page~\use{page.itemize}}. The first few items in |
| 323 |
this list were produced by saying: |
| 324 |
\TeXexample |
| 325 |
|tentt\itemize |
| 326 |
\itm Sect.~\use{sect.intro}: |
| 327 |
An introduction to \TeXsis\ and the philosophy behind the macros, and |
| 328 |
instructions on how to begin using \TeXsis. |
| 329 |
\itm Sect.~\use{sect.fonts}: |
| 330 |
Selecting sizes and fonts of type, choosing single, |
| 331 |
double, or triple spacing, and automatically handling |
| 332 |
quotation marks. |
| 333 |
\itm Sect.~\use{sect.eqns}: |
| 334 |
Automatic numbering of equations, automatic sizing of |
| 335 |
parentheses and brackets, and special symbols for |
| 336 |
physics equations.... |
| 337 |
|endTeXexample |
| 338 |
\goodbreak\noindent |
| 339 |
A paragraph begun by |\itm| is not indented beyond the new left margin, |
| 340 |
but paragraphs that follow {\sl are} indented unless |\noindent| is |
| 341 |
specified (or if they also begin with |\itm|). |
| 342 |
|
| 343 |
You can change the symbol used to mark each item in the list to be |
| 344 |
anything you want by creating your own definition of \CS{itemmark}. |
| 345 |
For example, if you want the symbol to be a \cs{square} you |
| 346 |
would define \CS{itemmark} to be |
| 347 |
\TeXexample |
| 348 |
\def\itemmark{$\square$} |
| 349 |
|endTeXexample |
| 350 |
\noindent |
| 351 |
before invoking \CS{itemize}, or at least before the first |\itm|. |
| 352 |
An example is the following important checklist:\reference{Banzai, 1984} |
| 353 |
\booktitle{The Adventures of Buckaroo Banzai across the Eighth |
| 354 |
Dimension}, (Twentieth Century Fox, 1984) |
| 355 |
\endreference |
| 356 |
\itemize |
| 357 |
\def\itemmark{$\square$} |
| 358 |
\itm Event timer started (display: SINED) |
| 359 |
\itm Antenna Aligned (display: SEELED) |
| 360 |
\itm Oscillation overthruster armed (display: DELIVERED) |
| 361 |
\enditemize |
| 362 |
This was produced by saying: |
| 363 |
\TeXexample |
| 364 |
\itemize |
| 365 |
\def\itemmark{$\square$} |
| 366 |
\itm Event timer started (display: SINED) |
| 367 |
\itm Antenna Aligned (display: SEELED) |
| 368 |
\itm Oscillation overthruster armed (display: DELIVERED) |
| 369 |
\enditemize |
| 370 |
|endTeXexample |
| 371 |
\noindent |
| 372 |
\CS{itemize} starts a new group, which is ended by the \cs{enditemize}, |
| 373 |
so in this example \CS{itemmark} reverts back to its |
| 374 |
previous definition when the list is finished. |
| 375 |
You can get a ``check-mark'' symbol instead of a square by |
| 376 |
replacing \cs{square} with \cs{surd}, or you can use any other symbol |
| 377 |
that suits you. Note though that in this example |
| 378 |
the \cs{square} is enclosed in math |
| 379 |
quotes --- you will have to remember this for any symbol which is defined |
| 380 |
in math mode. |
| 381 |
|
| 382 |
% ---------- |
| 383 |
\subsubsection{Enumerated lists} |
| 384 |
|
| 385 |
\cs{enumerate} produces numbered paragraphs, either with a single level |
| 386 |
or nested several levels deep, like so: |
| 387 |
\index{lists!enumerated}% |
| 388 |
\TeXexample |
| 389 |
|tentt\tenpoint\parskip=0pt % this just makes our examples smaller |
| 390 |
\enumerate |
| 391 |
\itm Paragraph 1. |
| 392 |
\enumerate |
| 393 |
\itm sub-paragraph 1a. |
| 394 |
\enumerate |
| 395 |
\itm sub-sub-paragraph 1a(i). |
| 396 |
\itm sub-sub-paragraph 1a(ii). |
| 397 |
\endenumerate |
| 398 |
\itm sub-paragraph 1b. |
| 399 |
\itm and so on... |
| 400 |
\endenumerate |
| 401 |
\itm Paragraph 2. |
| 402 |
\itm and so on... |
| 403 |
\endenumerate |
| 404 |
|endTeXexample |
| 405 |
\noindent |
| 406 |
This produces the enumerated list: |
| 407 |
\def\ListExample{% Define once, use several times... |
| 408 |
\tenpoint\parskip=0pt\medskip |
| 409 |
\itm Paragraph 1. |
| 410 |
\enumerate |
| 411 |
\itm sub-paragraph 1a. |
| 412 |
\enumerate |
| 413 |
\itm sub-sub-paragraph 1a(i). |
| 414 |
\itm sub-sub-paragraph 1a(ii). |
| 415 |
\endenumerate |
| 416 |
\itm sub-paragraph 1b. |
| 417 |
\itm and so on... |
| 418 |
\endenumerate |
| 419 |
\itm Paragraph 2. |
| 420 |
\itm and so on...} |
| 421 |
\enumerate |
| 422 |
\ListExample |
| 423 |
\endenumerate |
| 424 |
The default form for the paragraph numbering is called \CS{enumPoints}, |
| 425 |
which produces numbers of the form $ii.jj.kk$. You can also have the |
| 426 |
list printed in a standard outline format with a mixture of Roman |
| 427 |
numerals, letters, and Arabic numerals by saying \CS{enumOutline}. |
| 428 |
\index{lists!enumerated!styles}% |
| 429 |
Doing so to the example above produces: |
| 430 |
\enumOutline\enumerate |
| 431 |
\ListExample |
| 432 |
\endenumerate |
| 433 |
Unless enclosed within a group, |
| 434 |
the \CS{enumPoints} or \CS{enumOutline} style selected remains in effect |
| 435 |
until it is changed. The punctuation following the item number is |
| 436 |
\CS{enummark}, which by default is a period (\hbox{.}) but which can be |
| 437 |
redefined by the user [for example, you can change it to |\rparen| to |
| 438 |
obtain numbering of the form ``\hbox{2\rparen}'']. \CS{enummark} can |
| 439 |
also be used to change the spacing between the numbers and the text that |
| 440 |
follows. |
| 441 |
|
| 442 |
A third enumeration style, called \CS{enumNumOutline}, is also available. |
| 443 |
Top level items are labeled by arabic numbers, the level below by |
| 444 |
lower case roman letters, and the level below that by lower case |
| 445 |
roman numerals. With \CS{enumNumOutline} the example above becomes: |
| 446 |
\enumNumOutline\enumerate |
| 447 |
\ListExample |
| 448 |
\endenumerate |
| 449 |
|
| 450 |
If you prefer a different style of enumeration you can create your |
| 451 |
own |\enumWhatever| to use in place of \CS{enumPoint} or |
| 452 |
\CS{enumNumOutline}. To do so, copy the definition of \CS{enumPoints} or |
| 453 |
one of its brothers, along with the comments that go with them, from the |
| 454 |
file |TXSenvmt.tex| into a file called |TXSmods.tex| (see |
| 455 |
Appendix~\use{install}) and then make the appropriate changes as |
| 456 |
described in those comments. |
| 457 |
\index{lists!enumerated!styles}% |
| 458 |
|
| 459 |
% ---------- |
| 460 |
\subsubsection{Lists Labeled by Text}\relax |
| 461 |
\CS{description} is used to create a list of words or other |
| 462 |
items labeled by some text. |
| 463 |
The syntax is\index{lists!text labels} |
| 464 |
\example\tenrm |
| 465 |
\CS{description}\arg{sample text} \n |
| 466 |
\cs{itm}\arg{label 1} |Paragraph 1...| \n |
| 467 |
\cs{itm}\arg{label 2} |Paragraph 2...| \n |
| 468 |
\cs{itm}|{...}| \n |
| 469 |
|\enddescription| |
| 470 |
\endexample |
| 471 |
The argument \meta{sample text} is not printed, but its length is used |
| 472 |
to determine the indentation for the labels on the items, so it |
| 473 |
should be the longest item, followed by some extra space. For example, the |
| 474 |
descriptions of the flush and centered environments at the beginning of |
| 475 |
this section of the manual were typeset with |
| 476 |
\TeXexample |
| 477 |
|tentt\description{~flushright~\qquad} |
| 478 |
\itm{\CS{center}} |
| 479 |
Center each line. |
| 480 |
\itm{\CS{flushleft}} |
| 481 |
Set each line flush left. |
| 482 |
\itm{\CS{flushright}} |
| 483 |
Set each line flush right. |
| 484 |
\enddescription |
| 485 |
|endTeXexample |
| 486 |
since |\flushright| is the longest of the three items. (|\CS| is a |
| 487 |
special macro defined for this manual for printing control sequence |
| 488 |
names.) Each item in the list is separated by a \cs{parskip}, |
| 489 |
just as in itemized or enumerated lists. |
| 490 |
|
| 491 |
If the label text for an item comes out wider than the space |
| 492 |
allowed, the text will usually be broken into several lines |
| 493 |
so that it will fit in the indented margin (if this is possible!). |
| 494 |
Saying \CS{singlelinetrue} will instead put the label text on a |
| 495 |
line by itself, above the item. \CS{singlelinefalse} is the default, |
| 496 |
but this manual has been printed with \CS{singlelinetrue}. |
| 497 |
|
| 498 |
|
| 499 |
%==================================================* |
| 500 |
\subsubsection{Spacing of List Environments \label{sect.env-indent}} |
| 501 |
|
| 502 |
Each of the list environments described above is surrounded by the |
| 503 |
following skips: |
| 504 |
\index{lists!indentation}% |
| 505 |
\TeXexample |
| 506 |
\EnvTopskip = \medskipamount % space above the list |
| 507 |
\EnvBottomskip = \medskipamount % space below the list |
| 508 |
\EnvLeftskip = 2\parindent % left indent for the list |
| 509 |
\EnvRightskip = \parindent % right margin moves in too |
| 510 |
|endTeXexample |
| 511 |
\noindent |
| 512 |
You can change these as you please to any legal \TeX\ dimension. The |
| 513 |
space between |
| 514 |
items which are begun by \cs{itm} is taken from the \cs{parskip}. Since the |
| 515 |
list environment begins a group you can change the |\parskip| inside |
| 516 |
this group to control the spacing between |\itm|'s. For example, if you |
| 517 |
wanted no extra space between the items in the list you could say |
| 518 |
set the |\parskip| to zero, as in, |
| 519 |
\TeXexample |
| 520 |
\itemize |
| 521 |
\parskip=0pt \def\itemmark{$\triangleright$} |
| 522 |
\itm Event timer started (display: SINED) |
| 523 |
\itm Antenna Aligned (display: SEELED) |
| 524 |
\itm Oscillation overthruster armed (display: DELIVERED) |
| 525 |
\enditemize |
| 526 |
|endTeXexample |
| 527 |
\noindent |
| 528 |
which would produce: |
| 529 |
|
| 530 |
\itemize |
| 531 |
\parskip=0pt \def\itemmark{$\triangleright$} |
| 532 |
\itm Event timer started (display: SINED) |
| 533 |
\itm Antenna Aligned (display: SEELED) |
| 534 |
\itm Oscillation overthruster armed (display: DELIVERED) |
| 535 |
\enditemize |
| 536 |
|
| 537 |
|
| 538 |
%==================================================* |
| 539 |
\subsection{\TeX\ example macros} |
| 540 |
|
| 541 |
Typing \TeX\ examples can't be done in either the \cs{example} |
| 542 |
environment nor the |\Listing| environment, because the backslash must |
| 543 |
be turned into a simple printing character. There are several ways \TeXsis\ |
| 544 |
allows you to show examples of \TeX\ code. First, to display \TeX\ |
| 545 |
instructions separately, use |
| 546 |
\index{TeX@\TeX, typing examples}% |
| 547 |
\description{~TeXexample~\qquad}\clump |
| 548 |
% |
| 549 |
\itm{\CS{TeXexample}} |
| 550 |
Prints like an \cs{example}, but verbatim in \cs{tt} type, with |
| 551 |
``{\offtt |}'' made the escape character. Note that you must therefore |
| 552 |
say {\offtt |endTeXexample} to end the example, since "{\tt\bs}" is no |
| 553 |
longer the escape character! |
| 554 |
\enddescription |
| 555 |
To display \TeX\ instructions in running text use |
| 556 |
\description{~TeXexample~\qquad}\clump |
| 557 |
% |
| 558 |
\itm{\CS{TeXquoteon}} |
| 559 |
Make ``{\offtt |}'' a "\TeX\ quote" so that everything between |
| 560 |
{\offtt |}'s is printed verbatim in |\tt| type. |
| 561 |
% |
| 562 |
\itm{\CS{TeXquoteoff}} |
| 563 |
Turns off "\TeX\ quotes." |
| 564 |
% |
| 565 |
\enddescription |
| 566 |
|
| 567 |
All of the displayed examples in this document have been typed using |
| 568 |
\CS{TeXexample}, and many of the inline examples have been typed by |
| 569 |
putting \CS{TeXquoteon} at the beginning of the document and then typing |
| 570 |
{\offtt |\bs whatever\ttdots|}. For both \CS{TeXexample} and |
| 571 |
\CS{TeXquoteon} the only special character is the escape character |
| 572 |
``{\offtt |}''. In particular one must type |
| 573 |
\example\obeylines\tt |
| 574 |
\bs TeXexample |
| 575 |
\meta{TeX stuff} |
| 576 |
\char124endTeXexample |
| 577 |
\endexample |
| 578 |
with {\offtt |endTeXexample} instead of |\endTeXexample|. All other |
| 579 |
characters are set in |\tt| type without any interpretation. The input |
| 580 |
line breaks and spacing are respected, including any leading spaces on |
| 581 |
the lines. \TeX\ commands can be used within a |\TeXexample| environment |
| 582 |
by typing {\offtt |macro} in place of |\macro|, {\offtt |bgroup} and |
| 583 |
{\offtt |egroup} in place of |{| and |}|, etc. In particular, a {\offtt |
| 584 |
|} can be obtained by typing {\offtt |char124}. If you want to display |
| 585 |
the results of a complicated macro inside the |\TeXexample| environment |
| 586 |
you should probably define a different macro to display these results |
| 587 |
and then invoke that macro inside the environment. For example, in this |
| 588 |
manual we have sometimes inserted ``meta'' constructions showing where |
| 589 |
to insert a particular piece of text by using a |\meta| macro which |
| 590 |
encloses its argument in angle brackets (see the example immediately |
| 591 |
above). But in a |\TeXexample| you cannot say ``{\tt \VT meta\lb TeX |
| 592 |
stuff\rb},'' because the ``|{|'' and ``|}|'' are no longer grouping |
| 593 |
characters. Instead you could define the temporary macro |\tmp| as |
| 594 |
\TeXexample |
| 595 |
\def\tmp{\meta{TeX stuff}} |
| 596 |
|endTeXexample |
| 597 |
\noindent |
| 598 |
and then inside the |\TeXexample| environment simply type {\tt \VT tmp} |
| 599 |
to insert the phrase ``\meta{TeX stuff}''. |
| 600 |
|
| 601 |
The indentation and |
| 602 |
spacing of the |\TeXexample| environment are controlled by the same |
| 603 |
parameters that control the indentation of the list environments, as |
| 604 |
described in Sect.~\use{sect.env-indent}. |
| 605 |
The general method used by all of these macros to turn off \TeX's usual |
| 606 |
mechanism for interpreting special characters is discussed in \TeXbook, |
| 607 |
p.~421ff. The \cs{begintt} and \cs{beginlines} macros described there are |
| 608 |
included in \TeXsis\ for completeness. |
| 609 |
|
| 610 |
%>>> EOF TXSenvmt.doc <<< |