[comp.text] Need troff macro for figures.

pete@esosun.UUCP (02/27/87)

Requirements for a troff MS macro to simplify insertion of figures 
in text.

Definition of Problem:

    All of our reports make extensive use of figures and charts.  Often
these are drawn with IDE PICture on the sun, and printed on the
LaserWriter, but there is no convenient way to combine the image with a
caption, and merge both of them in the text.  It is reasonable to
accept the constraint that all included pictures be allotted a full
page but if this constraint could be relaxed, it would be nice.  It is
also reasonable to accept that the figure captions always are placed
below the figure.

ms Macros for Keeps

    At first sight it would seem that the KS/KE (floating Keep Start,
Keep End) pair is suitable for the purpose.  KS/KE are used to delimit
a block of text.  If the block fits on the current page, it prints it
there, otherwise the block is saved in a diversion, and printed at the
top of the next page.  The following troff fragment shows how KS/KE can
be used for small Figures.

.KS
.sp 4.5i
.IP "Figure 2.3.5" 15
This is an example of a Figure caption that accompanies a small
figure.  It is not necessary that the caption fall EXACTLY at the
bottom of the page.
.KE

The action of these lines is to bind together 4.5 inches of white
space, and as much space as is needed, (in the current point size and
vertical spacing) for the caption.  If the  bound object fits on the
current page, it is printed, otherwise it appears at the top of the
next page.  (We ignore the minor annoyance that troff may not give the
4.5 inches at the top of a page unless a non-printing character, blank
or tab, is used to force the it. This is the broken .rs/.ns problem.)

Suppose, however, that the picture is to take up exactly one page.
This is impossible to do by the KS/KE method, except by trial and
error, because of the fact that captions are of variable length.  One
can use the .sp command, either spacing by lines or inches, but it is
impossible to do it right, even after several tries, and any changes to
the layout (double spacing, point size, etc) brakes it.


Desired macro PS (Picture Start), and PE (Picture End):
    
    PS/PE would function almost exactly like KS/KE, except
that it would be page oriented.  The PS macro will have one optional
argument, P.  If P is 1 (or absent) all delimited text is positioned at
the bottom of the next page (and of course the page numbering is
incremented, and normal headers and footers are printed).  If P is less
than one (eg .5), then a block .5 pages long is needed, with the text
placed at the bottom, leaving an indeterminate amount of white space
above. If the .5 page block fits on the current page, put it there,
otherwise float it to the top of the next page.

	Thanks in advance,
-- 

{seismo,sdcsvax}!esosun!pete	(Pete Ware) (619) 458-2520
-- 

{seismo,sdcsvax}!esosun!pete	(Pete Ware) (619) 458-2520

langdon@lll-lcc.UUCP (02/28/87)

In article <29@esosun.UUCP>, pete@esosun.UUCP (Pete Ware) writes:
> Requirements for a troff MS macro to simplify insertion of figures 
> in text.
> 
>     All of our reports make extensive use of figures and charts...
> .. but there is no convenient way to combine the image with a
> caption, and merge both of them in the text.

See summary. There have been postings here of TeX macros to facilitate
same.
----------------------------------------------------------------------
	Bruce Langdon  L-472                langdon@lll-lcc.ARPA
	Physics Department                  "langdon#bruce%d@lll-mfe.ARPA"
	Lawrence Livermore National Laboratory       
	Livermore, CA 94550                 (415) 422-5444
UUCP: ..{ihnp4,qantel,ucdavis,pyramid,styx,topaz}!lll-lcc!langdon
                  ..{gymble,ll-xn,seismo}!lll-crg!lll-lcc!langdon