[comp.text] Thesis Macros, Troff

leff@smu (05/17/88)

Does anybody have a set of macros to be used for the generation
of theses.   I. E. a set of macros that automatically generates
the table of figures, table of tables, table of contents in the
appropriate format.

We already have written such a set, integrated with the MS package.

For example, one simply writes 


.NH 1 "INTRODUCTION" 


.NH n "section heading"


.NH Z "APPENDIX I"
.NH Z "REFERENCES"

one of these and the appropriate entry is made in the table of contents
as well as the proper numbered entry is made then and there as in
the conventional ms macros.

For figures we do the following 

.fZ bc

This will put in the internal troff string, bc, the next sequential
number of the form n-m where n is the chapter number and m is the 
figure number within that chapter.  

When you print out the figure, include the line

.fG bc "caption"

bc is the same two character sequence as for the corresponding .fZ macro.
In the quotes, put whatever caption you want.

Again, a record of this information will be kept for the purposes
of generating the LIST OF FIGURES with a record of the page number.

There is one more gee-whiz feature here.  Since the .fZ macro
puts the figure number in a register, you can include that number
in your text.  That way you don't have to modify the text should
the figure numbering change.

You simply include in the text, the five characters \*(bc where bc
is the two character name from the .fZ macro.  That will expand to
the appropriate figure number.  The .fZ macro to generate the
figure number is called before the \*(bc stuff.

If you have a one page figure that needs to be pasted on a page,
use .fZ in the identical way to reserve a figure number.
Then put

.Df  bc "caption"

where bc is the two character identifier used in the .fZ macro
and caption is the appropriate header.  Your text will continue
and on the next page, will appear the appropriate page number with the
caption ready for you to paste your figure onto.

However, unfortunately there are some problems, particularly bad
interactions between my macros and the ms macros.  Here are some examples:

You may find that some figures may have a page number that does not
correspond to the place where the figure is.  Generally, the page number
on the list of figures will be one less than it should be.

For each such figure, put a ".bp" before the figure starts.

What is happening is as follows,
  When the ms macros see something in .DS .DE or .PS  .PE, it
  puts the item in a diversion to see if it can print it on this page.
  If it can, it will print it on that page and the page number will
  be correct in the list of figures.

  When it cannot, it will print it on the next page.  However, the page
  number will be that when the diversion was made, not where the
  picture was paged.


The ultimate solution to this is to write an integrated set of macros
that does thesis plus the stuff now done by MS that will solve
these problems.  We have reached the end of the line with what can
be done with this solution.

You do not need a .bp if the figure is already on the same page as
when invoked (i. e. MS is not skipping a page to make room).
You also do not need one for Df type figures as those are handled
a different way and will have the right page number.

Note that there is a template at the end of the file which calls
the appropriate macros (generated by Df, fG, NH, etc.) where
needed to put the table of contents, table of figures, etc.

DOES ANYONE HAVE ANYTHING BETTER?  We are going to write a set of
integrated macros where we write all  the macros and everything works
together.

fmr@mcvax.UUCP (05/20/88)

> Nf-ID: #N:smu:250100002:000:3623
> Nf-From: smu!leff    May 16 21:30:00 1988
> Does anybody have a set of macros to be used for the generation
> of theses.   I. E. a set of macros that automatically generates
> the table of figures, table of tables, table of contents in the
> appropriate format.
> DOES ANYONE HAVE ANYTHING BETTER?  We are going to write a set of
> integrated macros where we write all  the macros and everything works
> together.
I don't know if this helps, but it does adress
your problem. In 'Software Praxis and Experience'(a monthly
magazine) Vol.18(1), January 1988 authors Alfred V. Aho and Ravi Sethi
describe a suite of shell scripts which they call
a reference assembler.It works with
any formatter. You should really loke into it.
By the way the mag is published by J.Wiley & Sons.
Hope this helps.
fmr@cwi.nl
-- 
It is better never to have been born. But who among us has such luck?
--------------------------------------------------------------------------
These opinions are solely mine and in no way reflect those of my employer.  

ring@cg-atla.UUCP (Steve Ring) (05/23/88)

I have a comprehensive set of -ms macros that do automatic TOC generation. We
have been using here at CG for over 3 years in our internal specification
documents and other Engineering documentation. Is comp.text the right place
to submit these [nt]roff command set. Here is my man page


       CGWRITER(7)                     PUBLIC                     CGWRITER(7)

                          Last Changed: December 14, 1987                   1
       CG Writer Release 2.0                                     Compugraphic
       ______________________________________________________________________


       NAME
            CG Writers ToolKit - text formatting utilities & [nt]roff command
            macros


       DESCRIPTION
            The "Cg Writers ToolKit:" is an integrated set  of  Bourne  shell
            utilities combined with [nt]roff -ms enhancements and extensions,
            all designed to assist and simplify  the  preparation  of  Compu-
            graphic  Engineering  documents,  memos, and employee performance
            reviews, meeting notices, and any other type of typeset  documen-
            tation.  This ToolKit cannot do your writing, of course, but with
            the tools and services provided you will be able to minimize time
            and  effort  in  text command programming so concentration can be
            placed on composing the document text.


       SETUP

          1)   Place the path /part3/epsfs/bin   into  your  .profile/.login,
               usually right after your own $HOME/bin path

          2)   Establish a directory called /_Tmp  in  your  home  directory.
               Various temporary files created during document processing are
               stored there. You will need to remove these files  at  various
               times (usually from a .logout file for whenever you log off).

          3)   Set the environmental variable EDITOR in your  .profile/.login
               to  either tve, vi, emacs to cause one of them to be automati-
               cally invoked as your editor of  choice.  The  default  is  to
               invoke vi.

          4)   Optionally, you can set the  environmental  variable  VIEW  to
               less  if  that is the previewer of your choice. The default is
               more.

          5)   To make viewing of nroffed documents  more  readable  on  your
               terminal  screen,  I  recommend that you set the environmental
               variable MORE in your .cshrc_or_.login  to  the  options  -cs.
               Then whenever you use more, or less, your document will scroll
               from the top of the screen down  -  squeezing  multiple  blank
               lines into one as it scrolls.

          6)   Include one of  the  .so/part3/epsfs/lib/INIT*  lines  at  the
               front of your text file. Several INIT* files exist - each spe-
               cially designed for different CG documents


                         File                   Document Type
                    ____________________________________________________
                    INIT              Report Style Documents
                    INIT.memo         Memos
                    INIT.man          Manual Pages
                    INIT.vugraph      VuGraphs
                    INIT.meet         Meeting Notices
                    INIT.perf_hour    Hourly Employee Performance Review
                    INIT.perf_sal     Salary Employee Performance Review
                    INIT.self_asses   Employee Self Assessment


       FILES
            /part3/epsfs/lib/INIT*


       SEE_ALSO
            eqn(1), tbl(1), troff(1), pic(1), epx(1)


       AUTHOR
            Steve Ring


       NOTE:
            The following pages can be xeroxed 2-sided  and  used  as  refer-
            ences.



       TOOLKIT_UTILITIES

       memo [file]              dww  [file]              pww [file]
       ______________________________________________________________________

       nrf  [*Pntr*] [*Host*] [-man|-me|-mm] [-noinit] [-col] [-nodate]
               [-noquote] [-notoc] file[.n|.nrf|.nro|.txt]
       where:

       usage: nrf [*Pntr*] [*Host*] [-man|-me|-mm] [-noinit] [-col] [-nodate]
                        [-noquote] [-notoc] [-sc]    file[.n|.nrf|.nro|.txt]
       or:    nrf [-Q]        = Nroff queues on Vaxes
       or:    nrf [-k]        = Kill Nroff job on Vaxes
       or:    nrf [-BB]       = Bulletin Board Info, Last Update `mm/dd/yy'
        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
       *Prntr*: =   -[a|b|z|c|cz|CZ|ep1|Ep1|ep2|Ep2|5|5x|7|7x|p|pr|P|d|dp|D|q ]
       *Host*:  =   -[stymie|garth|oracle|moon|surf|opus|liberty]

       -man/-me/-mm = use if UR using "man/me/mm" macros
       -sc     = enable short screen format (.SC)
       -noinit = use if U don't want "../lib/INIT" provided for U
       -nodate = don't insert current date/time stamp
       -nopath = don't insert file path name
       -noquote= just print warning message for lines beginning with '
       -notoc  = don't print the Table of Contents
       -col:   = pipe output thru 'col' for .B1/.x1 usages (i.e. 'nroff|col')

       Note: -Q gives the Vax Nroff job queue, -k kills Vax nroff jobs
       ______________________________________________________________________

       trf  [*Pntr*] [*Host*] [-man|-me|-mm] [-noinit] [-nodate] [-nopath]
               [-noquote] [-notoc]  file[.n|.nrf|.nro|.txt]
       where:

       usage: trf [*Pntr*] [*Host*] [-man|-me|-mm] [-noinit] [-nodate] [-nopath]
                     [-noquote] [-notoc] file[.n|.nrf|.nro|.txt]
       or:    trf [-BB]  = Read Bulletin Board, Last Update `mm/dd/yy'
       - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
       *Prntr*: = [-im]
       *Host*:  = [-ep1|-ep2|
                   -stymie|-garth|-oracle|-moon|-surf|-opus|-liberty]

       -man/-me/-mm = use if UR using "man/me/mm" macros
       -noinit  = use if U don't want "../lib/INIT" provided for U
       -nodate  = disable inserting current date/time stamp
       -nopath  = disable inserting file path name
       -noquote = only print warning message for lines beginning with '
       -notoc   = disable printing of a Document's Table of Contents "

       ______________________________________________________________________




       INSERTED_DATA

        .so _Date      \" Insert Current Date/Time stamp
        .so _FileDate  \" Insert File Date/Time Stamp
        .so _Path      \" Insert full file path name



       CUSTOMIZED_DEFAULT_STRING_VALUES


       Note: !A, !C only apply to Report type documents. They  do  not  exist
       for other type documents (memos, etc.). On the other hand, !P, !N, !E,
       !H, !F are common string variables defined for all types of documents.
        -----------------------
        .\"    REPORT DOCUMENTS
        .ds !A new-page-ah1-on
        .ds !C toc-on
        .\"    COMMON VARIABLES
        .ds !P new-page-nh1-on
        .ds !N para-indent-on
        .ds !E even-odd-page-off
        .ds !H hanging-indent-on
        .ds !F dashed
        -----------------------

        -----------------------
        .\"    MEMOS
        .\"
        .\"    COMMON VARIABLES
        .ds !P new-page-nh1-OFF
        .ds !N para-indent-on
        .ds !E even-odd-page-off
        .ds !H hanging-indent-on
        .ds !F number
        -----------------------

        -----------------------
        .\"    REVIEWS
        .\"
        .\"    COMMON VARIABLES
        .ds !P new-page-nh1-OFF
        .ds !N para-indent-on
        .ds !E even-odd-page-off
        .ds !H hanging-indent-OFF
        .ds !F number
        -----------------------

        -----------------------
        .\"    VUGRAPHS
        .\"
        .\"    COMMON VARIABLES
        .ds !P new-page-nh1-OFF
        .ds !N para-indent-on
        .ds !E even-odd-page-off
        .ds !H hanging-indent-OFF
        .ds !F number
        -----------------------

        -----------------------
        .\"    MEETING NOTICES
        .\"
        .\"    COMMON VARIABLES
        .ds !P new-page-nh1-OFF
        .ds !N para-indent-on
        .ds !E even-odd-page-off
        .ds !H hanging-indent-on
        .ds !F number
        -----------------------



       TOOLKIT_COMMAND_LIBRARY

                          Table 1. ToolKit Command Library

            Name               Options                   Explanations

      .B>                     -                Indented paragraph: =>
      .BA/ba word          indent              Indented paragraph: Word
      .BH/bh                  -                Indented Paragraph: -
      .BI/bi word          indent              Indented paragraph: Word
      .BK                     -                Indented Paragraph:
      .BN/bn               style num format    Indented paragraph: #'s
      .BS/bs                  -                Indented Paragraph: *
      .BU/bu                  -                Indented Paragraph: o+
      .CI                     -                Indented Paragraph: O
      .DS                  [I|B|L|C] title     Start no-fill display keep
      .Fo                  Pts Vert            Local Font Changes
      .Fz Pts                 -                Global Font Change
      .G9                  [I|B|L|C] title     Start 9 pt no-fill display keep
      .GE                     -                End no-fill display keep
      .GS                  [I|B|L|C] title     Start no-fill display keep
      .IB word                -                Italics Bold Word
      .LG                  [I|B] word          Large word
      .Qb word             punct               "Word"
      .Qe                     -                End special paragraphing
      .Qi word             punct               "Word"
      .Qo word             punct               "Word"
      .Qp                  [I|B]               Offset Paragraphing
      .Rv                     -                Revision History
      .SM                  [I|B]  word         Smaller word
      .SC                  width               Short screen presentation format
      .TE                     -                End Tables
      .TS                  [-9]  [H|H9]
                           [NK|NK9] [title]    Start Tables
      .UC                  [-l|word]           Translate lower <=> uppercase
      .Wi                  width               Set page line width
      .Wz                  width               Set default page line width
      .ah 0|level title       -                Appendices
      .ej                  level
                           EJECT|NOEJECT       page eject
      .ep                  [0|word]            Skip to next even page
      .fg                  title               Figure captions
      .hl                  char                Draw horizontal line
      .i                      -                Convenience: .IP
      .ip                     -                Indented Paragraph, no space
      .ke                     -                End no-fill keep
      .kl                     -                Start wide no-fill keep,
      .kp                     -                Start floating no-fill keep
      .ks                     -                Start no-fill keep
      .l                      -                Convenience: .LP
      .nh level title         -                Numbered (sub)Sections
      .op                  [0|word]            Skip to next odd page
      .p                      -                Convenience: .PP
      .sb title               -                o+ title, .PP
      .sc title               -                title, Underline .IP
      .sg title               -                title, .PP
      .sh title               -                title, .LP
      .si title               -                title, .IP
      .sk                  [0|word]            Skip blank page
      .sq title               -                Left to User, .IP, No Space
      .su title               -                title, .IP
      .sv title               -                title, .IP, No Space
      .tb title               -                Captioned Tables
      .uc title               -                Continuous Underline
      .un                  number              Undent margin
      .us title               -                Underline title
      .x1                  C  [-9|-10]         Start no-fill Boxed keep (.)
      .x2                     -                End no-fill Boxed keep
      .y1                  C  [-9|-10]         Start no-fill Boxed keep (.)
      .y2                     -                End no-fill Boxed keep
      .z1                     -                Start Block text region
      .z2                     -                End Block text region



       STRING/NUMBER_REFERENCES_&_VARIABLES


                            Table 2. Number References{|-}



                      Reference           Description
                         B#        most recent Table number
                         B+        next Table number
                         F#        most recent Figure number
                         F+        next Figure number
                         D#        most recent Display number
                         D+        next Figure Display number
                         yr        Current year
                         dy        Current day date

     {|-} Note: Number references preceded by \n(


                            Table 3. String References{|=}



              Reference                    Description
                 Bb        'Table xx' portion of the next Table
                 Bh        title portion of the Table heading
                 Bt        'Table xx' portion of the Table heading
                 Ff        'Figure xx' portion of the next Figure
                 Fh        title portion of the Figure heading
                 Ft        'Figure xx' portion of the Figure heading
                 Df        'Display xx' portion of the next Display
                 Dh        title portion of the Display heading
                 Dt        'Display xx' portion of the Display heading
                 Cf        Center text, first bottom line
                 DY        Current Date
                 LF        Eng. Number(or left bottom text)
                 LH        Document Title
                 MO        current month
                 DW        current day
                 Rf        first bottom line, right corner text
                 RF        Author's Organization (right bottom text)
                 SN        current section number
                 Sh        current Top level section number
                 st        current section title
                 PN        current page number

     {|=} Note: String references preceded by \*(


                          Table 4. Common String Variables



          String         Value                     Description
            !P     new-page-nh1-on      Do Page break @ .nh1
                   (anything else)      Don't page break @ .nh1
            !N     para-indent-on       Do Indent (.PP) after .nh/ah
                   (anything else)      Don't indent (.LP) after .nh/ah
            !F     dashed               Set captions as "Figure S-n Text"
                   number               Set captions as "Figure n. Text"
                   no-number            Set captions as "Text"
            !E     even-odd-page-off    page title lines same on all pages
                   (anything else)      Even/odd page Title lines
            !H     hanging-indent-on    Hanging symbol -  indent (1.0i)
                   (anything else)      Hanging symbol - indent (0.5i)


                     Table 5. Document Specific String Variables


             String        Value                  Description

               !A     new-page-ah1-on    Do Page break @ .ah A,B..
                      (anything else)    Don't page break @ .ah A/B..
               !C     toc-on             Print Table of Contents
                      (anything else)    Don't print Table of Contents




-- 
...!{decvax,ima,ism780c,ulowell,laidbak,cgeuro,cg-f}!cg-atla!ring
Steve Ring 
CompuGraphic Corp. 
Wilmington, Mass., 01887, (617) 658-5600, x5092