Internet Draft                                                  T. Hain
Document: draft-hain-msword-template-00.txt                   Microsoft
Category: Informational                                   February 1999


        Using Microsoft Word to create Internet Drafts and RFC's


Status of this Memo

   This document is an Internet-Draft and is in full conformance with
   all provisions of Section 10 of RFC2026 [1].

   Internet-Drafts are working documents of the Internet Engineering
   Task Force (IETF), its areas, and its working groups. Note that
   other groups may also distribute working documents as Internet-
   Drafts. Internet-Drafts are draft documents valid for a maximum of
   six months and may be updated, replaced, or obsoleted by other
   documents at any time. It is inappropriate to use Internet- Drafts
   as reference material or to cite them other than as "work in
   progress."
   The list of current Internet-Drafts can be accessed at
   http://www.ietf.org/ietf/1id-abstracts.txt
   The list of Internet-Draft Shadow Directories can be accessed at
   http://www.ietf.org/shadow.html.



Abstract

   This document will describe the steps to configure the Microsoft
   Word application to produce documents in Internet Draft and RFC
   format.


Conventions used in this document

   In this document the steps for walking a pull-down tree are indented
   on subsequent lines. This allows abbreviation rather than a barrage
   of 'then click' or 'select' strings in a paragraph form. Example:

   Help
      About Microsoft Word


   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
   "SHOULD", "SHOULD NOT", "RECOMMENDED",  "MAY", and "OPTIONAL" in
   this document are to be interpreted as described in RFC-2119 [2].
Using Microsoft Word to create Internet Drafts and RFC's February 1999

Overview

   This is a Microsoft Word 97 template to assist those producing
   Internet drafts. It allows for simple WYSIWYG editing of drafts and
   RFCs while producing output that is in accordance with IETF draft
   and RFC submission regulations. (72 Characters per line, 58 lines
   per page, each line terminated by a CRLF, and each page followed by
   a LF, etc.) Using Word's text justification capabilities may
   facilitate creating ASCII stick drawings.

   This document is not a product of Microsoft and is unsupported.  It
   may be freely modified and distributed.

   Included is a detailed description of how the RFC Text and RFC
   Heading styles are defined. This should prove useful to those
   wishing to do further customization work or create a similar
   template for other versions of Microsoft Word.

   It also includes a description and the source of the CRLF.EXE
   program that is needed to create the final text file output. A copy
   of the CRLF source, and makefile for the CRLF.EXE program, can also
   be found at http://www.ietf.org/apps


Instructions for producing Internet drafts and RFCs

   1) The "auto-formatting" Microsoft Word does can result in some
   problems when creating the standardized format. E.g. It will insert
   special characters for quotation marks, add special formatting when
   creating lists, etc.  To avoid this, turn off "auto formatting"
   Tools
      Autocorrect
   On the property pages 'AutoFormat' and 'AutoFormat As You Type',
   turn off all of the auto formatting options.

   2) Two special styles need to be defined: RFC Heading and RFC Text.
   If you choose automatic reference numbering (defined below), the
   style for Endnote Reference and Endnote Text need to be modified.
   The entire draft must be written using these styles for the spacing
   to come out correctly.  Do not use bold, underlining, italics, etc.,
   or you will loose the WYSIWYG editing feature since these settings
   affect the number of characters that can occur on a line. (Plus
   Internet drafts are supposed to be in plain text.)

   4) Print the document to the Generic Text Printer, and save the
   output to file.  If you do not have the Generic Text Printer driver
   installed, install it from the Control Panel. (Printers, Add
   Printer, local/my computer, any LPT port (you will be printing to a
   file), select Generic, Generic/Text Only from the combo box). When
   you print to a file a pop-up will ask for the file name.

   5) Run the CRLF program to automatically add carriage returns.
             Usage is CRLF <source> <destination>
Using Microsoft Word to create Internet Drafts and RFC's February 1999
   Where <source> is the name of the file produced by printing to the
   generic text printer, and <destination> is the name of the text
   draft you are producing. Example: crlf draft-00.prn draft-00.txt


Defining Microsoft Word Page Layout and Styles

   These are settings used to define the RFC Text and RFC Heading
   styles. Note: the menu options to set these are enclosed in
   parenthesis and are listed for Microsoft Word 97.  They will differ
   slightly for other versions of Microsoft Word.

   1) Set measurement units to points.
   Tools
      Options
         General
            Measurement units = points

   2) Set margins as follows: (File, Page Setup, Margins)
   Top:         24 pts
   Bottom:      0 pts
   Left:        0 pts
   Right:       93.6 pts
   Gutter:      0 pts
   Header:      0 pts
   Footer:      0 pts

   The right margin is what determines 72 characters per line. Using 12
   pt font, 10 chars/inch, 72 chars = 7.2".  Using paper that is 8.5"
   wide. 8.5" - 7.2" = 1.3" = 93.6 pts   If you get "one or more
   margins are outside the printable area" message, select Ignore.
   This seems to depend on the printer you currently have selected.

   3) Set paper size as follows:
   File
      Page Setup
         Paper Size
                Width:  612 pt (8.5")
                Height: 696 pt (12pt * 58 lines per page)

   The height of the paper is what determines 58 lines per page.

   4) Set headers/footers to be different for the first page.
   File
      Page Setup
         Layout

   5) Define a RFC Heading Style.
   Format
      Style
         New
   RFC Heading: Normal+Font:  Courier New, 12pt, Line Spacing Exactly
   12pt.
Using Microsoft Word to create Internet Drafts and RFC's February 1999
   NOTE: Line Spacing Exactly 12pt is very important. Set this through
   Format: Paragraph

   6) Define a RFC Text Style.
   Format
      Style
         New
   RFC Text: Normal+Font: Courier New, 12pt, Indent: Left 21.6pt, Line
   Spacing Exactly 12 pt.

   Line Spacing and indent are set through Format, Paragraph.  This
   leaves a 3 character left indent for the RFC text

   7) Fix the Header Style.
   Format
      Style
         Header
   Header:  Normal+Font: Courier New, 12pt, Line Spacing Exactly 12 pt,
   Clear the tabs previously defined, and clear the tabs previously
   defined and add Tabs 252 pt Centered, 504 pt Right Flush

   8) Fix the Footer Style.
   Format
      Style
         Footer
   Footer:  Normal+Font: Courier New, 12pt, Line Spacing Exactly 12 pt,
   Tabs 252 pt Centered, 504 pt Right Flush

   9) Define your headers and footers for the first page.
   View
      Headers
         (on first page)
   Header: No Header
   Footer:  Carriage Return
   AuthorName <tab> <tab> <page number field>

   10) Define subsequent headers and footers.
   View
      Headers
         (on second page)
   Header: <tab> Title <tab> Month, Year
   Footer:  Carriage Return
   AuthorName <tab> Category & Expiration <tab> <page number field>


Positioning the document identifiers on the first page

   The 'Table' tool can be used to assist with justification of the
   document identifiers on the first page. Each cell in the table
   maintains its own justification characteristics, so getting left and
   right justification on the same line is simplified. On the Toolbar
   select the icon that looks like a grid with a dark bar across the
   top. This will pop-up a table array. Drag the mouse across to select
   the number of rows and columns (for the opening header 4 rows x 2
Using Microsoft Word to create Internet Drafts and RFC's February 1999
   columns, unless there are several authors). Select the table that
   was just inserted and clear the boarders.
   Format
      Borders and Shading
         None

   Select the cells on the right (position the cursor just above the
   top cell, when the cursor becomes an arrow pointing down, click) and
   set justification right. (The default is to take justification from
   the line it is being positioned on, so the left column shouldn't
   need changing.)
   Format
      Paragraph
         Right

   Move the center divider to the right if necessary for the document
   title. Select the left column of cells, then position the cursor
   over the dividing line. When it changes to parallel bars with
   right/left arrows, click-and-hold, then drag the line as necessary.


Automatic reference numbering

   To support automatic updates of reference numbers, make the
   following changes. (Requires the document to be a single section
   prior to the Reference heading.)

   1) Insert a section break on the line after Reference heading.
   Insert
      Break
        Section Break
           Continuous

   2) Format the style of the Endnote References and Text.
   Format
      Style
         Endnote reference
         Modify
            Based on 'underlying paragraph'
            Format Font
                 clear the check box for 'superscript'
         Endnote text
         Modify
            Based on 'RFC text'
            Format Paragraph
               Indentation
                  Left    .3
               Special
                  Hanging .3

   3) Set up the location of the references, and number style.
   Insert
      Footnote
        Endnote
        Autonumber
Using Microsoft Word to create Internet Drafts and RFC's February 1999
        Options
           Place at 'End of section'
           Numeric style '1,2,3'

   4) Select the location for the first reference. Between the user
   typed [ ] characters insert an endnote.
   Insert
      Footnote (endnote will already be selected, as will auto 1,2,3)
         OK
   When the endnote is inserted the lower pane will appear. Type in the
   text for the reference. The first time a reference is inserted the
   Endnote Separator should be cleared (the continuation separator may
   need it as well). Find the pull down just above the reference text,
   and change it to each of the options to make sure all but the 'All
   Endnotes' are cleared.
   Endnote Separator
      Select and delete any text

   The reference number in the text and the endnote table will
   automatically track as changes are made. If the endnote window is
   closed and changes need to be made, select
   View
      Footnotes


Final fixup: the CRLF program

   Each line to be terminated by a CRLF, but when printing your
   document to the Generic Text Printer driver, some blank lines will
   be terminated only with a line feed. Consider a traditional text
   line printer, printing a line of text, followed by 3 blank lines.
   The output would look as follows:

   Line of Text<CR><LF><LF><LF>.

   This is because there is no need to move the print carriage head for
   the blank lines, only line feeds are necessary.

   CRLF.EXE is a Win16/32 program to fix up the output from the Generic
   Text Printer driver so that each line is terminated by a CRLF.  An
   extra line that makes the first page be 59 lines, instead of the
   required 58 is also removed.

   Following is the source of the CRLF program.
Using Microsoft Word to create Internet Drafts and RFC's February 1999
   /***************************************************************
   * CRLF.C - Sample source code to format documents produced by
   * the MS Word IETF template so that they comply to IETF draft
   * and rfc guidelines
   ****************************************************************/

   #include <stdio.h>
   #include <io.h>
   #include <fcntl.h>
   #include <sys/types.h>
   #include <sys/stat.h>
   #include <memory.h>

   #define CR 13
   #define LF 10
   #define FF 12
   #define TRUE 1
   #define FALSE 0

   typedef int BOOL;

   int main(int argc, char *argv[])
   {
        int fSrc, fDest;
        int iNumBytesRead;
        char cr = CR;
        char lf = LF;
        unsigned char buff[3];
        BOOL bPreceedingCR = FALSE;

        if(argc != 3)
        {
                printf("Usage:\n\n");
                printf("    crlf <srcfile> <dstfile>\n\n");
                return 0;
        }

        fSrc = _open(argv[1], _O_RDONLY | _O_BINARY);
        fDest = _open(argv[2], _O_CREAT | _O_RDWR | _O_BINARY |
          _O_TRUNC, _S_IREAD | _S_IWRITE);

        if(fSrc == -1)
        {
                printf("Could not open file (%s) for reading.\n",
                argv[1]);
                return 0;
        }

        if(fDest == -1)
        {
                printf("Count not open file (%s) for writing.\n",
                   argv[2]);
                return 0;
        }
Using Microsoft Word to create Internet Drafts and RFC's February 1999
        // Using the MS Word IETF template, an extra CR LF
        // starts the file.  Skip over these first 2 bytes,
        // otherwise the first page will have 59 lines instead of 58
        iNumBytesRead = _read(fSrc, buff, 2);

        // Prepare to parse through the file
        iNumBytesRead = _read(fSrc, buff, 1);

        while(iNumBytesRead > 0)
        {
                // Found a LF without a preceding CR
                // Inject a CR to preceed the LF
                if (buff[0] == LF && bPreceedingCR == FALSE)
                {
                _    write(fDest, &cr, 1);
                    _write(fDest, &(buff[0]), 1);
                }
                else
                {
                        // Using the MS Word IETF template, FF are
                        // preceeded only by a CR.  Inject a LF to
                        // follow the CR.
                        if (buff[0] == FF)
                        {
                                _write(fDest, &lf, 1);
                                _write(fDest, &(buff[0]), 1);
                        }
                        else
                        {
                                // Write byte out
                                _write(fDest, &(buff[0]), 1);

                                // Track whether we will have a
                                // preceeding CR for the next byte we
                                // read
                                if (buff[0] == CR)
                                        bPreceedingCR = TRUE;
                                else
                                        bPreceedingCR = FALSE;
                        }
                }

                // Read next byte
                iNumBytesRead = _read(fSrc, &buff[0], 1);

        }
        _close(fSrc);
        _close(fDest);

        return 0;
   }
Using Microsoft Word to create Internet Drafts and RFC's February 1999
Known problems

   Printing

   If you try to print the draft you are working on from within
   Microsoft Word to an actual printer (not to a file using the Generic
   Text printer driver), you will receive an error message indicating
   the margins are outside of the printable area of the printer.  If
   you continue printing, the first 2 characters of each heading will
   be truncated.  It is recommended you produce a printed copy of the
   draft you are working on by using the CRLF program to produce a text
   file, and then redirect it to a printer (so that you do not need to
   deal with other programs like NOTEPAD, etc. adding their own
   margins.) Example:

   - Print to a file using the generic text printer
   - CRLF draft.prn draft.txt
   - NET USE lpt1 <\\printername\sharename>
   - TYPE draft.txt > LPT1

   As an alternative, if the final draft.txt file is opened with Word,
   setting all 4 margins to .65" will position it on the page.
   File
      Page Setup
         Top    .65
         Bottom .65
         Left   .65
         Right  .65


   The Underscore character

   If you use the underscore character "_" within the RFC Text and RFC
   Heading style, it will not be displayed on most screens.  (It
   appears as a blank space.)  It will print correctly and will appear
   as an underscore character in the final draft output.


Formal Syntax

   The formal definition of RFC format is defined in RFC-2223 [3] and
   Internet Draft instructions are available at [4].


Security Considerations

   Caution is advised when opening any document that may contain a
   macro virus. The template files originally provided to the Internet-
   drafts & RFC editors did not contain any macros, and unless tampered
   with should not now. If there are concerns about using the template
   doc file, the instructions provided here will allow creation of one
   from scratch. Further details about Microsoft Word macro virus
   concerns are available at:
   http://www.microsoft.com/magazine/apr1998/vfree/vfree.htm
Using Microsoft Word to create Internet Drafts and RFC's February 1999

References

   1  Bradner, S., "The Internet Standards Process -- Revision 3", BCP
      9, RFC 2026, October 1996.

   2  Bradner, S., "Key words for use in RFCs to Indicate Requirement
      Levels", BCP 14, RFC 2119, March 1997

   3  J. Postel, J. Reynolds, " Instructions to RFC Authors", RFC 2223,
      October 1997

   4  http://www.ietf.org/ietf/1id-guidelines.txt





Author's Addresses

   Mike Gahrns
   Microsoft
   One Microsoft Way            Phone:  1-425-936-9833
   Redmond, Wa. USA             Email:  mikega@microsoft.com

   Tony Hain
   Microsoft
   One Microsoft Way            Phone:  1-425-703-6619
   Redmond, Wa. USA             Email:  tonyhain@microsoft.com


Copyright Notice

   "Copyright (C) The Internet Society 1999. All Rights Reserved.

   This document and translations of it may be copied and furnished to
   others, and derivative works that comment on or otherwise explain it
   or assist in its implmentation may be prepared, copied, published
   and distributed, in whole or in part, without restriction of any
   kind, provided that the above copyright notice and this paragraph
   are included on all such copies and derivative works. However, this
   document itself may not be modified in any way, such as by removing
   the copyright notice or references to the Internet Society or other
   Internet organizations, except as needed for the purpose of
   developing Internet standards in which case the procedures for
   copyrights defined in the Internet Standards process must be
   followed, or as required to translate it into