| 1 |
%% file: TXSfigs.doc - Figures and Tables - TeXsis version 2.18 |
| 2 |
%% @(#) $Id: TXSfigs.doc,v 18.2 2000/05/17 00:19:46 myers Exp $ |
| 3 |
%======================================================================* |
| 4 |
% (C) Copyright 1989, 1992,1993,1994, 1997 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\meta \texsis\input TXSdocM.doc\input Manual.aux\draft\fi |
| 10 |
|
| 11 |
% Select the Penguin shown at the end of the section |
| 12 |
% (the one in the middle is always the Feynman diagram). |
| 13 |
|
| 14 |
%\def\penguin{penguin2} % to use Larry Ewing's Linux Penguin |
| 15 |
\def\penguin{penguin} % to use the Feynman diagram. |
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
\section{Figures and Tables \label{sect.figures}} |
| 20 |
|
| 21 |
Technical papers often include tables and/or figures. Regardless of how |
| 22 |
the contents of the figures or tables are created, these have a lot in |
| 23 |
common in the way they are generally treated. \TeXsis\ makes use of |
| 24 |
\TeX's \idx{floating insertion} capabilities (see Chapter~15 of |
| 25 |
\TeXbook) to insert figures and tables on the current page or on a |
| 26 |
following page. It is also possible to have figures or tables saved and |
| 27 |
printed at the end of the document. Captions are easily added either |
| 28 |
above or below the figure or table. Both kinds of objects are |
| 29 |
automatically assigned numbers, which are associated with internal |
| 30 |
labels so that they may be referred to in the text without having to |
| 31 |
know their order. It is possible to create a list of the figures and |
| 32 |
tables which appear in a document, much like creating a table of |
| 33 |
contents. Figures themselves |
| 34 |
are generally created outside of \TeX, either by hand |
| 35 |
or by computer graphics programs, while tables can be created using |
| 36 |
\TeX\ commands. The most complicated tables have vertical and |
| 37 |
horizontal lines (called ``rules'') to guide the reader's eye and to |
| 38 |
make the table more readable. \TeXsis\ has some very easy to use |
| 39 |
commands for making ruled tables. |
| 40 |
|
| 41 |
Before discussing \TeXsis's figure and table making macros in detail we |
| 42 |
should mention that \TeXsis\ also adds a new insertion class to those of |
| 43 |
Plain \TeX. In Plain \TeX\ saying \cs{topinsert}, \cs{midinsert} or |
| 44 |
\cs{pageinsert} begins a \idx{floating insertion} (ended by |
| 45 |
\cs{endinsert}) which will appear somewhere on the current page or a |
| 46 |
following page. Material entered with a \cs{topinsert} appears at the |
| 47 |
top of the current page, if there is room for it, or at the top of the |
| 48 |
next page where there is room. A \cs{midinsert} attempts to insert the |
| 49 |
text into the current page right where it is invoked, but if the |
| 50 |
insertion won't fit it becomes a \cs{topinsert}. Saying \cs{pageinsert} |
| 51 |
creates an insertion which takes up a whole page by itself. |
| 52 |
% |
| 53 |
In \TeXsis\ you can also say \cs{bottominsert} to make a \idx{floating |
| 54 |
insertion} that will appear at the bottom of the current page, if it |
| 55 |
will fit, or at the bottom of the next page where it will fit. |
| 56 |
There is also \cs{heavyinsert}, which like \cs{midinsert} tries first to |
| 57 |
insert the material into the current page right where it is called, but |
| 58 |
in this case becomes a \cs{bottominsert} if the material wont' fit. |
| 59 |
|
| 60 |
|
| 61 |
%==================================================* |
| 62 |
\subsection{Figures \label{sect.figs}} |
| 63 |
|
| 64 |
\TeX\ is designed for technical typesetting, but does not include a |
| 65 |
graphics standard, so to include a figure or drawing in a document |
| 66 |
it is necessary to |
| 67 |
leave blank space and to either glue the drawing in later or to arrange |
| 68 |
for the figure material to be inserted by some mechanism outside of |
| 69 |
\TeX\ when the page is actually printed (e.g., using the \cs{special} |
| 70 |
command or the \cs{epsfbox} command described later). |
| 71 |
|
| 72 |
Imagine that you wish to insert into the text a drawing of a |
| 73 |
``\idx{penguin} diagram,'' which is about 6~cm tall. You could create |
| 74 |
the space for this figure at the top of a page, along with a caption, |
| 75 |
with the following commands:\index{figures}% |
| 76 |
\TeXexample |
| 77 |
|smalltt\figure{Penguin} |
| 78 |
\hrule |
| 79 |
\vskip 2cm |
| 80 |
\line{\hss (glue your penguin here) \hfil} |
| 81 |
\vskip 2cm |
| 82 |
\hrule |
| 83 |
\Caption |
| 84 |
Sample figure showing how easy it is to insert |
| 85 |
numbered figures with captions in \TeXsis. |
| 86 |
\endCaption |
| 87 |
\endfigure |
| 88 |
|endTeXexample |
| 89 |
\noindent |
| 90 |
This produces \Fig{Penguin} (we put the \cs{hrule}'s in just to show |
| 91 |
off the empty space). ``Penguin'' is the |
| 92 |
label for the figure, so to refer to the figure in the text we typed |
| 93 |
\CS{Fig}|{Penguin}|, which produced ``\Fig{Penguin}.'' The caption can be |
| 94 |
placed either before or after the figure: if it is to be at the top then |
| 95 |
\CS{Caption} must be the first token after |\figure|. As shown, the |
| 96 |
caption text must be terminated with \CS{endCaption}. When the caption is |
| 97 |
printed it will automatically start with the figure number in bold type, |
| 98 |
followed by the caption text. The caption is indented on both sides if |
| 99 |
it is more than one line long and centered otherwise. |
| 100 |
|
| 101 |
\CS{caption}\arg{text} is equivalent to \CS{Caption}\meta{text} |
| 102 |
\CS{endCaption} and may be more convenient for short captions. |
| 103 |
It should be avoided for very long captions to keep from overflowing \TeX's |
| 104 |
internal memory. |
| 105 |
|
| 106 |
\figure{Penguin} |
| 107 |
\hrule |
| 108 |
\vskip 2cm |
| 109 |
\line{\hss (glue your \idx{penguin} here) \hfil} |
| 110 |
\vskip 2cm |
| 111 |
\hrule |
| 112 |
\Caption |
| 113 |
Sample figure showing how easy it is to insert |
| 114 |
numbered figures with captions in \TeXsis. |
| 115 |
\endCaption |
| 116 |
\infiglist{Sample figure showing how easy it is |
| 117 |
to insert numbered figures with captions in \TeXsis.} |
| 118 |
\endfigure |
| 119 |
|
| 120 |
There are commands to create figures for each of the \idx{insertion |
| 121 |
classes} of Plain \TeX (that is, \cs{midinsert}, \cs{topinsert} and |
| 122 |
\cs{pageinsert}) along with the new insertion class |
| 123 |
added by \TeXsis\ (\cs{bottominsert}) . |
| 124 |
In addition, there are special commands for creating wide or full page |
| 125 |
figures while in double column mode (which is described later in |
| 126 |
Section~\use{sect.dcol}): |
| 127 |
\index{figures!placement}% |
| 128 |
\singlelinetrue |
| 129 |
\description{XfullFigureXXXXXX}\clump |
| 130 |
% |
| 131 |
\itm{\CS{figure}\arg{label\/}} |
| 132 |
Inserts a figure at the top of the current page, if there is enough room for |
| 133 |
it, or at the top of the next available page. |
| 134 |
% |
| 135 |
\itm{\CS{midfigure}\arg{label\/}} |
| 136 |
Inserts a figure at the current position, if there is enough room for it, or at |
| 137 |
the top of the next page if there is not. |
| 138 |
% |
| 139 |
\itm{\CS{fullfigure}\arg{label\/}} |
| 140 |
Inserts a figure on a separate page. The body of the figure should |
| 141 |
normally contain a \cs{vfill} to allow the figure to stretch to fill the |
| 142 |
whole page. |
| 143 |
% |
| 144 |
\itm{\CS{bottomfigure}\arg{label\/}} |
| 145 |
Inserts the figure at the bottom of the current page, if there is room |
| 146 |
for it, or on the bottom of the next page where there is room. |
| 147 |
% |
| 148 |
\itm{\CS{heavyfigure}\arg{label\/}} |
| 149 |
Inserts a figure at the current position, if there is room for it on the |
| 150 |
page, or at the bottom of the page following if there is not. This is |
| 151 |
therefore like \CS{midfigure}, except that if the figure can't be fit on |
| 152 |
the page it ends up on the bottom of a following page, not the top. |
| 153 |
% |
| 154 |
\itm{\cs{widetopfigure}\arg{label\/}} |
| 155 |
Inserts a figure at the top of a page across both columns in |
| 156 |
double column format. Equivalent to \CS{figure} in single column |
| 157 |
format. \cs{widefigure} is a synonym. |
| 158 |
% |
| 159 |
\itm{\cs{widefullfigure}\arg{label\/}} |
| 160 |
Inserts a full page figure across both columns in double column |
| 161 |
format. Equivalent to \CS{fullfigure} in single column format. |
| 162 |
% |
| 163 |
\itm{\CS{endfigure}} |
| 164 |
Ends any of the figure insertions described above. |
| 165 |
% |
| 166 |
\enddescription |
| 167 |
\noindent |
| 168 |
In all cases \meta{label\/} is an internal label which is assigned to |
| 169 |
the figure number. The figure number will include the chapter and |
| 170 |
section numbers in the format ``$cc.ss.nn$'' if \cs{showchaptIDtrue} and |
| 171 |
\cs{showsectIDtrue} have been selected. |
| 172 |
\index{figures!placement}% |
| 173 |
|
| 174 |
The body of the figure can include any vertical mode |
| 175 |
commands, as in the example above. When you are simply leaving |
| 176 |
space for a figure to be glued in later a convenient way to specify the |
| 177 |
amount of space to leave is to \cs{vskip} by some amount proportional to |
| 178 |
the width of the current column or page. The dimension \cs{colwidth} is |
| 179 |
the width of the page (the \cs{hsize}) in single column mode and the width |
| 180 |
of the current column in double column mode. So for example, if you |
| 181 |
have a figure which was half again as tall as it is wide you could say |
| 182 |
\index{figures!size}% |
| 183 |
\example |
| 184 |
\cs{vskip} |1.5|\cs{colwidth} |
| 185 |
\endexample |
| 186 |
Another way to standardize the space reserved for figures is to define |
| 187 |
your own dimension, such as |\myfigsize|, to use in the \cs{vskip} |
| 188 |
above. For example, |
| 189 |
\TeXexample |
| 190 |
\newdim\myfigsize |
| 191 |
\myfigsize= 1.5\colwidth |
| 192 |
|endTeXexample |
| 193 |
\noindent |
| 194 |
and then |\vskip\myfigsize|. This has the same effect as the previous |
| 195 |
example, but |\myfigsize| can be changed to any valid dimension. |
| 196 |
\index{figures!size}% |
| 197 |
|
| 198 |
|
| 199 |
%==================================================* |
| 200 |
\subsection{Encapsulated PostScript Graphics} |
| 201 |
|
| 202 |
Instead of simply gluing figures into a paper by hand it is possible to |
| 203 |
have computer generated graphs and drawings automatically inserted into |
| 204 |
a document. Unfortunately, the method can vary from |
| 205 |
computer to computer and printer to printer. Recall that \TeX\ |
| 206 |
produces as output a \idx{DVI file}, which contains device independent |
| 207 |
instructions for typesetting the document. To actually print the |
| 208 |
document the \idx{DVI file} must be translated into instructions for |
| 209 |
the specific printer being used by a suitable device driver. It is at |
| 210 |
this stage, when the device driver is converting the \idx{DVI file} to |
| 211 |
printer instructions, that graphs and drawings may be inserted. |
| 212 |
However, since different printers may require different kinds of |
| 213 |
instructions, there are many different device drivers, each having its |
| 214 |
own way of including drawings in the document. |
| 215 |
|
| 216 |
In recent years some standardization has become possible, because many |
| 217 |
printer manufacturers have chosen \idx{PostScript} as the ``language'' |
| 218 |
for giving instructions to their printers. PostScript contains |
| 219 |
commands both for drawing and for typesetting text. Still, there are |
| 220 |
some problems, because there are many different device drivers for |
| 221 |
converting \idx{DVI file}s to \idx{PostScript}, and they all treat the |
| 222 |
inclusion of figures slightly differently. Also, while all of these filters |
| 223 |
require that the drawings to be included are themselves already in |
| 224 |
PostScript, there are several variations of \idx{PostScript}, leading to |
| 225 |
further problems of incompatibility. |
| 226 |
|
| 227 |
Until there is some standardization for inserting drawings into \TeX\ |
| 228 |
documents (and perhaps to encourage it) we recommend using the scheme |
| 229 |
which (a) seems to be the easiest to use and the most well thought |
| 230 |
out, and (b) is potentially available to the widest group of users. |
| 231 |
Our choice is, first, to use a specific variation of PostScript known |
| 232 |
as ``Encapsulated'' \idx{PostScript} (EPS). |
| 233 |
\index{Encapsulated PostScript|see{PostScript}} Most newer computer |
| 234 |
programs which produce graphics output, including Mathematica, |xfig|, |
| 235 |
and |paw|, can produce EPS output files. To include these in the text |
| 236 |
we have chosen to rely on the program |dvips| \index{dvips} by Tomas |
| 237 |
Rokicki,\reference{Rokicki} Tomas Rokicki, \booktitle{{\tt dvips} |
| 238 |
User's Manual}. |
| 239 |
The source code for {\tt dvips} is available from CTAN |
| 240 |
in the directory {\tt dviware/dvips} |
| 241 |
\endreference |
| 242 |
\index{Rokicki, Tomas} along with his \TeX\ macros for including EPS |
| 243 |
graphics, called |epsf.tex|. Be warned that there are other programs |
| 244 |
called ``dvips,'' but as far as we know only Rokicki's version will |
| 245 |
work with |epsf.tex|. We expect that when including drawings in \TeX\ |
| 246 |
is standardized, it will be based on Rokicki's scheme or something |
| 247 |
close to it. |
| 248 |
|
| 249 |
\bigskip |
| 250 |
|
| 251 |
To include EPS graphics in a document using the |epsf.tex| macros you |
| 252 |
must first input the macros. Somewhere early in your manuscript file you |
| 253 |
should put: |
| 254 |
\TeXexample |
| 255 |
\input epsf.tex |
| 256 |
|endTeXexample |
| 257 |
You can have the macros report the size of a figure when it is |
| 258 |
included by saying: |
| 259 |
\TeXexample |
| 260 |
\epsfverbosetrue |
| 261 |
|endTeXexample |
| 262 |
At the point where you want a graph or drawing included |
| 263 |
you simply say: |
| 264 |
\example |
| 265 |
\CS{epsfbox}|{foo.ps}| |
| 266 |
\endexample |
| 267 |
This will include the drawing from the file called `|foo.ps|,' which must |
| 268 |
already exist in the current directory. \TeX\ will leave enough room |
| 269 |
for the figure (by creating a box of the correct size) and will use a |
| 270 |
\cs{special} command to insert instructions into the DVI file telling |
| 271 |
the DVI to PS translator to read in the \idx{EPS file} |foo.ps|. |
| 272 |
|
| 273 |
Once the document has been processed by \TeXsis\ and the DVI file has |
| 274 |
been produced you will convert it to a PS file with the ``\idx{dvips}'' |
| 275 |
program. If your DVI file is called |myfile.dvi| then the command is |
| 276 |
simply: |
| 277 |
\TeXexample |
| 278 |
dvips myfile |
| 279 |
|endTeXexample |
| 280 |
This will convert |myfile.dvi| to PostScript, |
| 281 |
and depending on how dvips is set up at your installation it will either |
| 282 |
put the output in the file |myfile.ps| or it will send it directly to |
| 283 |
the default printer (see the man pages for dvips on how to change this |
| 284 |
behavior, or try a short example to see how it is set up on your computer). |
| 285 |
Note that the EPS files to be included must be in the same directory as |
| 286 |
|myfile.dvi| when you run dvips, so that they can be merged into the final |
| 287 |
output file (or you can specify the full path filename in the |
| 288 |
\CS{epsfbox} command). |
| 289 |
|
| 290 |
On Unix systems you may not be able to use the |lpr -d| |
| 291 |
command if you have included EPS files in the document. This command |
| 292 |
runs the DVI file through dvips (or some other DVI to PS filter) in a |
| 293 |
different directory, and the EPS files will therefore not be included |
| 294 |
unless you have used a full path name for the file. |
| 295 |
|
| 296 |
|
| 297 |
If you use the latest version of |
| 298 |
the |xdvi| program to preview DVI files on your workstation |
| 299 |
you will find that it automatically includes EPS graphics in the |
| 300 |
display, but some other previewing programs (such as |texsun|, or older |
| 301 |
versions of |xdvi|) will not. Even if the previewer does not know how |
| 302 |
to deal with the \cs{special} commands in the DVI file, you will |
| 303 |
see that \TeX\ has left room for the figure. Once you have converted |
| 304 |
your DVI and \idx{EPS file}s into a PS file you can preview that file |
| 305 |
if you have a PostScript previewer, such as GhostScript. Then your |
| 306 |
graphs and drawings will appear just as they would if you had printed |
| 307 |
the PS file. |
| 308 |
|
| 309 |
\bigskip |
| 310 |
|
| 311 |
Sometimes you will find that more room has been left for the figure than |
| 312 |
is really needed. The way \CS{epsfbox} decides how much room to leave is |
| 313 |
by reading the first part of the \idx{EPS file} to find a line |
| 314 |
which looks like: |
| 315 |
\TeXexample |
| 316 |
%%BoundingBox: 67 176 544 616 |
| 317 |
|endTeXexample |
| 318 |
\noindent |
| 319 |
The two pairs of numbers are the coordinates of the lower left and upper |
| 320 |
right corners of the figure, respectively. They are measured in |
| 321 |
printer's points (1/72${}{\hbox{nd}}$ of an inch). If you don't like |
| 322 |
the positioning of the figure given by the original bounding box in the |
| 323 |
PostScript file you can override it by specifying a new bounding box |
| 324 |
like so: |
| 325 |
\TeXexample |
| 326 |
\epsfbox[0 180 540 700]{file.ps} |
| 327 |
|endTeXexample |
| 328 |
\noindent |
| 329 |
You may have to experiment with positioning the BoundingBox for the best |
| 330 |
effect, and it may help to look at the \idx{PostScript} file to see what the |
| 331 |
default BoundingBox is and adjust things using that coordinate system. |
| 332 |
|
| 333 |
\bigskip |
| 334 |
|
| 335 |
You can also control the size of the included graphic using |
| 336 |
\CS{epsfxsize} or \CS{epsfysize} before you call \CS{epsfbox}. The |
| 337 |
figure will be enlarged or reduced to fit the dimension you specify. |
| 338 |
Saying |
| 339 |
\example |
| 340 |
\CS{epsfxsize}|=|\meta{dimen} \CS{epsfbox}|{figure.ps}| |
| 341 |
\endexample |
| 342 |
will scale the drawing in the file |figure.ps| so that its {\sl width\/} |
| 343 |
is \meta{dimen}, with the height scaled accordingly, while saying |
| 344 |
\example |
| 345 |
\CS{epsfysize}|=|\meta{dimen} \CS{epsfbox}|{graph.ps}| |
| 346 |
\endexample |
| 347 |
will scale the drawing in the file |graph.ps| so that its {\sl height\/} is |
| 348 |
\meta{dimen}, with the width scaled accordingly. You can only specify |
| 349 |
the width or height, but not both at the same time. Whatever change of |
| 350 |
size you specify will only be applied to the \CS{epsfbox} command which |
| 351 |
immediately follows. After that, subsequent included graphics will |
| 352 |
revert to their natural sizes unless you also specify a particular size |
| 353 |
for them. |
| 354 |
|
| 355 |
The \CS{epsfbox} command creates a box of the proper size, into which |
| 356 |
the figure is later drawn. |
| 357 |
That is all. |
| 358 |
If you want the figure to be centered across the page then you will |
| 359 |
have to do so yourself, using \cs{centerline} or something similar. |
| 360 |
The advantage of this is that since figures are simply treated as |
| 361 |
boxes, you can stack them or arrange them in a row, or do whatever |
| 362 |
else you would with boxes. |
| 363 |
This gives you much more flexibility to construct complicated figures |
| 364 |
from several EPS files. |
| 365 |
|
| 366 |
\figure{Penguin2} |
| 367 |
\centerline{\epsfysize=4cm\epsfbox{penguin.eps}} |
| 368 |
\Caption |
| 369 |
Example of including EPS graphics in a figure. |
| 370 |
\endCaption |
| 371 |
\endfigure |
| 372 |
|
| 373 |
So now consider the earlier example of including a 4~cm tall |
| 374 |
\idx{penguin} diagram in a figure, but now assuming that the drawing |
| 375 |
exists as an EPS graphic in the file |penguin.eps|. |
| 376 |
Assume also that we need to override the default bounding box in that |
| 377 |
file. |
| 378 |
The commands to do this are: |
| 379 |
\TeXexample |
| 380 |
\figure{Penguin2} |
| 381 |
\centerline{\epsfysize=4cm \epsfbox{penguin.eps}} |
| 382 |
\Caption |
| 383 |
Example of including EPS graphics in a figure. |
| 384 |
\endCaption |
| 385 |
\endfigure |
| 386 |
|endTeXexample |
| 387 |
\relax |
| 388 |
The results are shown in \Fig{Penguin2}. |
| 389 |
The drawing was created with Bill Dimm's {\sl FeynDiagram} |
| 390 |
package,\reference{FeynDiagram} |
| 391 |
Dimm, Bill, |
| 392 |
\booktitle{FeynDiagram Tutorial}, |
| 393 |
available at \URL{ftp://ftp.hepth.cornell.edu} |
| 394 |
\endreference |
| 395 |
which is a set of C++ objects which make it fairly easy to create EPS |
| 396 |
\idx{Feynman Diagrams} by writing short C++ programs. It was converted |
| 397 |
from a |.ps| to a |.eps| file using |ps2epsi|. |
| 398 |
|
| 399 |
%==================================================* |
| 400 |
\subsection{Simple Tables \label{sect.tbls}} |
| 401 |
|
| 402 |
Simple tables\index{tables!simple} (without ruled lines) are constructed |
| 403 |
in \TeX\ with \idx{alignment tabs} or with \cs{halign}. The reader who |
| 404 |
is not familiar with these should look at Chapter~22 in \TeXbook. In |
| 405 |
\TeXsis\ simple tables with table numbers and captions are |
| 406 |
treated much the same as figures. For example, saying |
| 407 |
\TeXexample |
| 408 |
|smalltt\midtable{table example} |
| 409 |
\caption{Charged leptons.} |
| 410 |
\centerline{\vbox{\halign{#\ \hfil & #\ \hfil & #\hfil \cr |
| 411 |
Name & Mass & Lifetime \cr |
| 412 |
$e^-$ & .511 MeV & $>2 \times 10^{22}$ yr. \cr |
| 413 |
$\mu^-$ & 105 MeV & $2.197 \times 10^{-6}$ sec. \cr |
| 414 |
$\tau^-$ & 1784 MeV & $3.3 \times 10^{-13}$ sec. \cr}}} |
| 415 |
\endtable |
| 416 |
|endTeXexample |
| 417 |
\noindent |
| 418 |
produces the following table, in the middle of the page: |
| 419 |
\vskip 0pt |
| 420 |
\midtable{table example} |
| 421 |
\caption{Charged leptons.} |
| 422 |
\centerline{\vbox{\halign{#\ \hfil & #\ \hfil & #\hfil \cr |
| 423 |
Name & Mass & Lifetime \cr |
| 424 |
$e^-$ & .511 MeV & $>2 \times 10^{22}$ yr. \cr |
| 425 |
$\mu^-$ & 105 MeV & $2.197 \times 10^{-6}$ sec. \cr |
| 426 |
$\tau^-$ & 1784 MeV & $3.3 \times 10^{-13}$ sec. \cr}}} |
| 427 |
\intablelist{Charged leptons.} |
| 428 |
\endtable |
| 429 |
\noindent |
| 430 |
Note the use of \cs{centerline} and a \cs{vbox} to center the table. The |
| 431 |
reference to this table in the text was produced by typing ``|\Tbl{table |
| 432 |
example}|.'' Note also that we used \cs{caption} followed by the text in |
| 433 |
brackets as an alternative method of defining the caption; |
| 434 |
However \cs{caption} |
| 435 |
should only be used when the caption is short. Table captions are |
| 436 |
traditionally placed above the table, so \cs{Caption} or \cs{caption} should |
| 437 |
be the first token after \CS{table}\arg{label\/} and its siblings. |
| 438 |
|
| 439 |
There are a number of different kinds of table insertions, and they |
| 440 |
match closely the different kinds of insertions used for figures: |
| 441 |
\description{xwidefullTablexx\qquad}\clump |
| 442 |
% |
| 443 |
\itm{\CS{table}\arg{label\/}} |
| 444 |
Inserts a table at the top of next available page. |
| 445 |
% |
| 446 |
\itm{\CS{midtable}\arg{label\/}} |
| 447 |
Inserts a table at the current position if there is room or at |
| 448 |
the top of a page if necessary. |
| 449 |
% |
| 450 |
\itm{\CS{fulltable}\arg{label\/}} |
| 451 |
Inserts a table on a separate page. The body of the table |
| 452 |
should normally contain a \cs{vfill}. |
| 453 |
% |
| 454 |
\itm{\CS{bottomtable}\arg{label\/}} |
| 455 |
Inserts the table at the bottom of the current page, if there is room |
| 456 |
for it, or on the bottom of the next page where there is room. |
| 457 |
% |
| 458 |
\itm{\CS{heavytable}\arg{label\/}} |
| 459 |
Inserts a table at the current position, if there is room for it on the |
| 460 |
page, or at the bottom of the page following if there is not. This is |
| 461 |
therefore like \CS{midtable}, except that if the table can't be fit on |
| 462 |
the page it ends up on the bottom of a following page, not the top. |
| 463 |
% |
| 464 |
\itm{\cs{widetoptable}\arg{label\/}} |
| 465 |
Inserts a table at the top of a page across both columns in |
| 466 |
double column format. Equivalent to \CS{table} in single column |
| 467 |
format. |
| 468 |
% |
| 469 |
\itm{\cs{widefulltable}\arg{label\/}} |
| 470 |
Inserts a full page table in double column format. Equivalent to |
| 471 |
\CS{fulltable} in single column format. |
| 472 |
% |
| 473 |
\itm{\CS{endtable}} |
| 474 |
Ends any of the tables above. |
| 475 |
% |
| 476 |
\enddescription |
| 477 |
Again, in these macros \meta{label\/} is an internal label which is assigned to |
| 478 |
the table number. The table number will include the chapter and section |
| 479 |
numbers in the format ``$cc.ss.nn$'' if |\showchaptIDtrue| and |
| 480 |
|\showsectIDtrue| have been selected. The table can then be referred to |
| 481 |
in the text by saying \cs{Tbl}\arg{label\/}. |
| 482 |
|
| 483 |
%==================================================* |
| 484 |
% RULED TABLES: |
| 485 |
|
| 486 |
\subsection{Ruled Tables \label{sect.ruled}} |
| 487 |
\input TXSruled.doc |
| 488 |
|
| 489 |
%==================================================* |
| 490 |
\subsection{Lists of Figures and Tables} |
| 491 |
|
| 492 |
In large technical documents it is often desirable to have a list of the |
| 493 |
figures and/or tables which appear in the document, along with a brief |
| 494 |
caption and the number of the page on which the figure or table appears. |
| 495 |
This is similar to |
| 496 |
a table of contents, but is separate from it. In \TeXsis\ you can add a |
| 497 |
figure or table to a list of figures or tables by using \CS{infiglist} |
| 498 |
after \cs{figure} or \CS{intablelist} after \cs{table}, similar to the |
| 499 |
way you would use \cs{caption}. The syntax is \CS{infiglist}\arg{text}. |
| 500 |
The text is the text of the (possibly abbreviated) caption which is to |
| 501 |
appear in the list of figures. Remember though, if a table has a |
| 502 |
caption it should |
| 503 |
appear above the table body, so the \cs{caption} must still be the first |
| 504 |
thing after \cs{table}; the \CS{infiglist} can come later. |
| 505 |
\index{lists!of figures}\index{lists!of tables}% |
| 506 |
|
| 507 |
As an example, consider the ``penguin diagram'' already discussed. |
| 508 |
To add an entry for this figure in the list of figures it |
| 509 |
would be entered as follows: |
| 510 |
\TeXexample |
| 511 |
\figure{Penguin} |
| 512 |
\centerline{\epsfbox{/home/fermi/qcd/penguin.eps}} |
| 513 |
\caption{Example of including EPS graphics in a figure.} |
| 514 |
\infiglist{Example of including a figure in the list of figures.} |
| 515 |
\endfigure |
| 516 |
|endTeXexample |
| 517 |
\relax |
| 518 |
The \cs{caption} text is what is put under the figure in the body of the |
| 519 |
paper, while the \CS{infiglist} text is what shows up in the list of |
| 520 |
figures, and these do not have to be the same. |
| 521 |
|
| 522 |
To produce the list of figures at the end of the document you say |
| 523 |
\CS{ListFigures}, and similarly to produce the list of tables say |
| 524 |
\CS{ListTables}. Even if the list is to appear at the front of the |
| 525 |
document, along with the table of contents, you should print it at the |
| 526 |
end and move the list to the front afterwards. This is because until |
| 527 |
the document is actually processed \TeX\ does not know on which page the |
| 528 |
figure or table appears. |
| 529 |
|
| 530 |
One word of caution: figures and tables are produced by putting them |
| 531 |
in ``floating inserts'', which \TeX\ saves up and prints when there is |
| 532 |
room. The entry into the list of figures or tables is not made until |
| 533 |
the item actually makes its way into the output DVI file. If you ask |
| 534 |
for the list of figures or tables before one of these items is output it |
| 535 |
will not be in the list, and in fact that entry for the figure or table |
| 536 |
list will later end up spewing out on your terminal. To be sure that |
| 537 |
all floating insertions have been output you should say \cs{supereject} |
| 538 |
before you print the list of figures or tables. |
| 539 |
|
| 540 |
%==================================================* |
| 541 |
\subsection{Listing Figure and Table Captions} |
| 542 |
|
| 543 |
When a manuscript is submitted to some journals, like the Physical |
| 544 |
Review, one is supposed to include a separate list of the captions of all |
| 545 |
figures and tables. This is similar to the lists created by |
| 546 |
\CS{ListFigures} and \CS{ListTables}, but the page numbers are not |
| 547 |
supposed to be included. It is very easy to use the caption information |
| 548 |
stored by \CS{infiglist} and \CS{intablelist} to make just a list of |
| 549 |
captions, without including the page numbers. The command to make a |
| 550 |
list of all the figure captions is \CS{ListFigureCaptions}, and |
| 551 |
similarly all the table captions can be listed with |
| 552 |
\CS{ListTableCaptions}. Just as with \CS{ListFigures} and |
| 553 |
\CS{ListTables} these should appear at the end of the job, so that all |
| 554 |
of the caption information will have already been stored. |
| 555 |
|
| 556 |
It should be said that this method of making a list of captions assumes |
| 557 |
that you have put the same captions under the figures, with \cs{Caption} |
| 558 |
or \cs{caption}, as the caption in the list of figures entered with |
| 559 |
\CS{infiglist}. |
| 560 |
|
| 561 |
It may help to know a little bit more about how the macros |
| 562 |
\CS{ListFigures} and \CS{ListFigureCaptions} work. The \CS{infiglist} |
| 563 |
command writes the figure caption information you provide to a file |
| 564 |
which has the same name as your manuscript file but with the extension |
| 565 |
|.fgl|, meaning ``figure list'' (for tables the file name extension is |
| 566 |
|.tbl|). The page number on which the figure appears is also recorded |
| 567 |
in this file. When the whole document has been processed all of the |
| 568 |
figure captions will have been saved in this file, and \CS{ListFigures} |
| 569 |
and \CS{ListFigureCaptions} simply read this file back in. One of them |
| 570 |
uses the page numbers to construct a table of contents for the figures, |
| 571 |
while the other just prints out the figure captions by themselves. In |
| 572 |
either case, it is important that all the caption information be in the |
| 573 |
file when the list is to be made, which is why a \cs{supereject} may be |
| 574 |
necessary to flush all floating insertions to the output. |
| 575 |
|
| 576 |
%==================================================* |
| 577 |
\subsection{Printing Figures and Tables at the End of a Document} |
| 578 |
|
| 579 |
When working on a paper to be sent for publication it is sometimes |
| 580 |
necessary to print all of the figures at the end of the document. To cause |
| 581 |
this to be done you simply have to say |
| 582 |
\example |
| 583 |
\cs{FiguresLast} |
| 584 |
\endexample |
| 585 |
at some point before you call \cs{figure} and its relatives, and then put |
| 586 |
\example |
| 587 |
\cs{PrintFigures} |
| 588 |
\endexample |
| 589 |
\index{figures!at end of document}% |
| 590 |
\index{tables!at end of document}% |
| 591 |
\noindent |
| 592 |
at the end of the document. \cs{FiguresLast} causes \cs{figure} to save the |
| 593 |
definition of your figure in an auxiliary file instead of immediately |
| 594 |
creating the figure, and \cs{PrintFigures} reads the material back in from |
| 595 |
that file. If you say \cs{PrintFigures} without first saying |
| 596 |
\cs{FiguresLast} nothing will happen. You can return to having the |
| 597 |
figures printed where they are defined by saying \cs{FiguresNow}. |
| 598 |
In that case \cs{PrintFigures} does nothing; you have to have said |
| 599 |
\cs{FiguresLast} for \cs{PrintFigures} to read any stored figures back in. |
| 600 |
|
| 601 |
Tables can also be saved until the end of the document by saying |
| 602 |
\cs{TablesLast} and then \cs{PrintTables}. \cs{TablesNow} is the |
| 603 |
opposite of \cs{TablesLast}. |
| 604 |
|
| 605 |
\pagecheck{4cm} |
| 606 |
|
| 607 |
One important note: Since the figure or table material is copied to the |
| 608 |
file in which it is held one line at a time it is important to use |
| 609 |
\cs{Caption} and \CS{endCaption} for long captions instead of \cs{caption}. |
| 610 |
If you use \cs{caption} \TeX\ will try to read the whole caption at once, |
| 611 |
which may result in the error message |
| 612 |
``{\tt TeX capacity exceeded, sorry.}''\index{TeX capacity |
| 613 |
exceeded@{\tt TeX capacity exceeded, sorry}} |
| 614 |
|
| 615 |
|
| 616 |
%==================================================* |
| 617 |
\subsection{Nonstandard Figure and Table Placement} |
| 618 |
|
| 619 |
On rare occasions you may need to have a figure or table from one |
| 620 |
section of your document appear in another section of the document. For |
| 621 |
example, if the introductory section is very short but has a figure, |
| 622 |
that figure might end up at the top of the first page when you really |
| 623 |
want it to appear at the top of the second page. You can cause the |
| 624 |
figure to come out later by moving it farther back in the manuscript |
| 625 |
file, but if it is moved into the next section it will then have the |
| 626 |
wrong figure number. |
| 627 |
\index{figures!nonstandard placement}% |
| 628 |
\index{tables!nonstandard placement}% |
| 629 |
|
| 630 |
The solution to this problem is to have a way to override or modify the |
| 631 |
way figure and table numbers are assigned. Since the first part of the |
| 632 |
figure or table number is the chapter or section number you need to change |
| 633 |
this by saying |
| 634 |
\example |
| 635 |
\cs{setSectionID}\arg{something-else} |
| 636 |
\endexample |
| 637 |
This changes the section number part of the figure and table numbers to |
| 638 |
whatever you put as \meta{something-else}. It will also effect equation |
| 639 |
numbers, so it is best to have this inside of a group, so that the |
| 640 |
change goes away at the end of the group. Next you have to change the |
| 641 |
figure or table number. \TeXsis\ keeps count of tables and figures in |
| 642 |
global variables, and increments these counters globally when a new |
| 643 |
figure or table is created. Thus just changing the counter inside a |
| 644 |
group won't work, because the counter outside of the group would still |
| 645 |
be modified. To temporarily change the value of such a counter you use |
| 646 |
\example |
| 647 |
\cs{setcnt}\arg{counter}\arg{value} |
| 648 |
\endexample |
| 649 |
where \meta{value} is the temporary value to assign to the counter |
| 650 |
\meta{counter}. This should be done inside of a group, and when the |
| 651 |
group ends the counter will go back to its previous global value. You |
| 652 |
should only use \cs{setcnt} once within a given group! |
| 653 |
|
| 654 |
An example will make this procedure clear. |
| 655 |
Suppose that Figure~\use{Fg.intro.17} is a part of |
| 656 |
Section~\use{sect.intro}, but we wanted to show it much later in this |
| 657 |
Manual (such as right about now). |
| 658 |
It can be created in this section by saying: |
| 659 |
\TeXexample |
| 660 |
\begingroup % changes are temporary |
| 661 |
\setSectionID{1} % changes the section ID |
| 662 |
\setcnt\fignum{16}% figure counter is 1 less than we want |
| 663 |
\midfigure{intro.17} |
| 664 |
\centerline{\epsfysize=4cm\epsfbox{|penguin.eps}} |
| 665 |
\caption{A bizarrely placed figure for Section~\use{sect.intro}} |
| 666 |
\infiglist{A bizarrely placed figure for Section~\use{sect.intro}} |
| 667 |
\endfigure |
| 668 |
\endgroup % everything goes back the way it was |
| 669 |
|endTeXexample |
| 670 |
|
| 671 |
\begingroup % changes are temporary |
| 672 |
\setSectionID{1} % changes the section ID |
| 673 |
\setcnt\fignum{16} % figure number is 1 less than we want |
| 674 |
\midfigure{intro.17} |
| 675 |
\centerline{\epsfysize=4cm\epsfbox{\penguin.eps}} |
| 676 |
\caption{A bizarrely placed figure for Section~\use{sect.intro}} |
| 677 |
\infiglist{A bizarrely placed figure for Section~\use{sect.intro}} |
| 678 |
\endfigure |
| 679 |
\endgroup % everything goes back the way it was |
| 680 |
|
| 681 |
In this case the figure number in the counter \cs{fignum} is set to one |
| 682 |
less than the value we want, so that it comes out correctly when |
| 683 |
\cs{bottomfigure} increments the count. You can use \cs{setcnt} to |
| 684 |
modify any of \TeXsis's global counters. The complete list is given in |
| 685 |
Section~\use{sect.labels} (where the use of \cs{use} is also described). |
| 686 |
|
| 687 |
% If we are using Larry Ewing's penguin2.eps then we need to |
| 688 |
% acknowlege it: |
| 689 |
|
| 690 |
\def\tmp{penguin2} |
| 691 |
\ifx\penguin\tmp |
| 692 |
The drawing in \Fig{intro.17}, which is the official \idx{Linux} |
| 693 |
Penguin, was created by \idx{Larry Ewing} of Texas A\&M University |
| 694 |
and turned into a scalable vector based postcript file by \idx{Neal |
| 695 |
Tucker}. |
| 696 |
\fi |
| 697 |
|
| 698 |
|
| 699 |
By the way, you should never move a figure out of a {\sl Chapter}, |
| 700 |
unless you move it to the end of the document, and the appropriate way |
| 701 |
to do that is with \cs{FiguresLast}. |
| 702 |
|
| 703 |
%>>> EOF TXSfigs.doc <<< |