Path: utzoo!attcan!uunet!lll-winken!lll-tis!helios.ee.lbl.gov!pasteur!ucbvax!ean.ubc.ca!prindiville%ccrs.CDN
From: prindiville%ccrs.CDN@ean.ubc.ca (John Edgecombe)
Newsgroups: comp.os.vms
Subject: Re: RUNOFF to TeX converter
Message-ID: <23*prindiville@ccrs.cdn>
Date: 11 Jul 88 21:56:00 GMT
Sender: daemon@ucbvax.BERKELEY.EDU
Organization: The Internet
Lines: 1045

Sorry about the previous send, I am still learning this mailer.
I'll try again with a different method.

+-+-+-+ Beginning of part 4 +-+-+-+
X  gotten : boolean;
Xbegin                   
X   if eoln(infile) then 
X   begin
X     readln(infile);
X     totallines := totallines + 1;
X     columncounter := 1
X   end;
X   if putcrlf then 
X     writeln(outfile);
X   while (eoln(infile)) and (not eof(infile)) do
X   begin  
X     readln(infile);
X     writeln(outfile);  
X     columncounter := 1;                            
X     totallines := totallines + 1
X   end;                                      
X   if not eof(infile) then
X   begin 
X     read(infile, currentchar);       
X     totalchars := totalchars + 1;
X     lastinputchar := blank
X   end;                        
X   if ord(currentchar) = tab then
X   begin                                             
X      tabrecord.charcountintab := ncharsintab;
X      tabrecord.tabread := true
X   end
X   else
X   begin
X     tabrecord.charcountintab := 0;
X     tabrecord.tabread := false
X   end;
X   if currentchar < blank then currentchar := blank
Xend;
X
X
X
X
X
X
X[GLOBAL] PROCEDURE changeflagchar( flag : dsrflagclasses; newchar:char);
Xbegin
X   flagtable[flag].representation := newchar;
X   write(log,'[internal flag representation change for ');
X   writeflagname(log, flag);
X   writeln(log,' to "',newchar,'"]')
Xend;
X
X    
X
X[GLOBAL] PROCEDURE turnflagon( flag : dsrflagclasses );
Xbegin
X   flagtable[flag].turnedon := true;
X   write(log,'[internal flag ');
X   writeflagname(log, flag);
X   writeln(log,' enabled]')
Xend;
X                                    
X
X
X[GLOBAL] PROCEDURE turnflagoff( flag : dsrflagclasses );
Xbegin
X  flagtable[flag].turnedon := false;
X  write(log,'[internal flag ');
X  writeflagname(log, flag);
X  writeln(log,' disabled]')
Xend;
X
X
X
X
X[GLOBAL] PROCEDURE texwritearg( var outfile : text; arg : argument );
Xvar
X  s : pckstr;
X  i, l : integer;
Xbegin
X  s := argliteral( arg, false );
X  l := length( s );
X  for i := 1 to l do  texwrite(outfile, s.body[i]);
X  write(outfile, blank)
Xend;
X
X
XEND.                                                                
$ GOSUB UNPACK_FILE
$ FILE_IS = "GETCLI.FOR"
$ CHECKSUM_IS = 53499580
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X`009SUBROUTINE GETCLI (IFILE,OFILE,TEX)
X
X`009IMPLICIT NONE
X`009 
XC 
XC FUNCTIONAL DESCRIPTION:`009
XC 
XC    This routine gets the input and output file names for program
XC    RNOTOTEX.
XC 
XC DUMMY ARGUMENTS:
XC 
XC    none.
XC 
XC IMPLICIT INPUTS:
XC 
XC    none
XC 
XC IMPLICIT OUTPUTS:
XC 
X`009CHARACTER*(*) IFILE
XC`009INPUT FILE NAME
XC
X`009CHARACTER*(*) OFILE
XC`009OUTPUT FILE NAME
XC
X`009INTEGER TEX
XC `009TEX COMMANDS FLAG : 0 FOR NO, NOT 0 FOR YES
XC 
XC SIDE EFFECTS:
XC 
XC    none
XC 
XC 
XC`009LOCALS
XC
X`009INTEGER CLI$GET_VALUE 
X`009EXTERNAL CLI$GET_VALUE 
XC`009system routine to get a value from a command line
XC
X`009INTEGER STATUS
XC`009status of command line extraction
XC`009 
XC`009BEGIN
X
X`009STATUS = CLI$GET_VALUE('RNO_FILE',IFILE,)
X`009STATUS = CLI$GET_VALUE('TEX_FILE',OFILE,)
X
X        TEX = 0
X
X`009RETURN
X`009END
$ GOSUB UNPACK_FILE
$ FILE_IS = "INIOPS.PAS"
$ CHECKSUM_IS = 608058111
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X{   `009INI FILE MODULE FOR RNO TO TEX CONVERSION           }
X{ `009RANDALL VENHOLA JULY 7, 1987                        }
X               
X[INHERIT('UTILITYOPS','BASICFILEOPS','ARGOPS',
X         'TREEANDLISTOPS','SCREENHANDLERS')]
X
XMODULE INIOPS;
X
X
X                           
X[GLOBAL] PROCEDURE readarglistfromini( var ini : text; var index : integer;
X`009                          var list : arglist );
Xconst
X  iniseparator = '$';
Xvar
X  s : pckstr;
X  done : boolean;
X  gotten : boolean;
X  arg : argument;
X  inserted : boolean;
X
X  function endofline : boolean;
X  begin
X    if eof(ini) then
X       endofline := true
X    else
X       begin
X         if eoln(ini) then
X            endofline := true
X         else
X           begin
X             if ini^ = blank then
X                endofline := true
X             else
X                endofline := false
X           end
X       end
X  end;
X                     
X  function atseparator : boolean;
X  begin
X    atseparator := (ini^ = iniseparator)
X  end;
X
X  procedure readpckstr( var s : pckstr; var gotten : boolean );
X  var
X    ch : char; 
X    done : boolean;
X    charindex : integer;
X  begin
X    s.body := blank;
X    done := false;
X    charindex := 0;
X    repeat
X        if endofline then
X            done := true
X        else
X          if atseparator then
X             done := true
X          else
X             if charindex = maxchars then
X             begin
X`009        warningmessage('readini','ini file argument size overflow');
X                done := true                                              
X             end
X`009     else
X             begin
X                read(ini, ch);
X                charindex := charindex + 1;
X                s.body[charindex] := ch
X             end;
X         s.length := charindex
X    until done;
X    gotten := charindex > 0;
X    if atseparator then read(ini, ch)                      
X  end;
X  
X  procedure readindex(var index : integer; var gotten : boolean );
X  const
X    ndigits = 3;
X  var
X    count : integer;
X    ch    : char;
X  begin
X    gotten := true;
X    count := 0;
X    index := 0;
X    repeat
X        if endofline then
X            gotten := false
X        else
X          if count < ndigits then
X          begin
X             read(ini, ch);                   
X             count := count + 1;
X             if ch in ['0'..'9'] then
X                index := index*10 + ord(ch) - ord('0')
X             else
X             begin
X`009        warningmessage('readini','bad index digits in INI');
X`009        gotten := false                                   
X             end
X          end
X     until (not gotten) or (count = ndigits);
X     if (gotten) and (not eof(ini)) then read(ini, ch)
X  end;
X
X  procedure pckstrtoarg( s : pckstr; index : integer; var arg : argument);
X  label
X      routineexit;
X  begin
X     initarg(arg, [dsrverb], s, index, false );        
X     if s = '[N]' then
X     begin
X       reassignargclass(arg, [int,signedint,nulltype]);
X       reassignarggeneralization(arg, true);
X       goto routineexit
X     end;
X     if s = '[Y]' then
X     begin
X       reassignargclass(arg, [stylespecifier]);
X       reassignarggeneralization(arg, true);
X       goto routineexit
X     end;
X     if s = '[T]' then
X     begin            
X       reassignargclass(arg, [textpckstr,character,nulltype]);
X       reassignarggeneralization(arg, true);
X       goto routineexit
X     end;
X     if s = '[C]' then
X     begin
X       reassignargclass(arg, [character,nulltype]);
X       reassignarggeneralization(arg, true);
X       goto routineexit
X     end;                  
X     if s = '[Q]' then
X     begin
X       reassignargclass(arg, [quotedpckstr,nulltype]);
X       reassignarggeneralization(arg, true);
X       goto routineexit
X     end;
X     routineexit : nullstatement
X  end;         
X  
Xbegin {readarglistfromini}
X  list := nulllist;
X  readindex(index, gotten );
X  if gotten then                                              
X  begin         
X    if index < 1 then      
X      warningmessage('readini','bad INI index value');
X    repeat
X       readpckstr(s, gotten );
X       if gotten then        
X       begin
X         pckstrtoarg(s, index, arg );
X         appendargonlist(list, arg);
X       end                                             
X    until not gotten;
X    if arglistlength(list) = 0 then
X       warningmessage('readini','empty argument list in INI file')
X  end  
X  else
X  begin
X    index := indexofunknowntexcommand;
X    warningmessage('readini','could not read index from INI file')
X  end;                        
X  if not eof(ini) then
X    readln(ini)
Xend;  
X         
X
X
X
X
X                   
X[GLOBAL] PROCEDURE setuptree( var ini : text; var tree : argtree );
Xvar 
X   list : arglist;
X   index : integer;
Xbegin  
X    openinifile( ini );
X    tree := nulltree;
X    while not eof(ini) do
X    begin          
X       readarglistfromini( ini, index, list);
X
X       {   ***** ttywritestring(' index read = ');
X                 ttywriteint(index);
X                 ttywriteln;                   *****      }
X
X       insertlistintotree( list, tree )
X    end;
X    closeinifile( ini )
Xend;
X    
X    
X                                      
XEND.                  
$ GOSUB UNPACK_FILE
$ FILE_IS = "LATEXOPS.PAS"
$ CHECKSUM_IS = 964346211
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X[INHERIT('UTILITYOPS','ARGOPS','BASICFILEOPS',
X'TREEANDLISTOPS','FLAGOPS')]
X
XMODULE LATEXOPS;
X
X
XTYPE
X 
X
Xcountparametertype = (numericcounter, lowercasechars, uppercasechars );
X
Xparameterchangestates = (nochange, altered,  assigned);
X
Xpagestyletype  = (empty, plain, headings, myheadings);
X
Xliststatetype = (nostate, itemize, enumerate);
X
X
XVAR
X   
X   LOG               : [EXTERNAL] TEXT;
X   pagestyle        : [EXTERNAL] pagestyletype;
X   datestring       : [EXTERNAL] pckstr;
X   title, subtitle   : [EXTERNAL] argarray;
X   fill`009             : [EXTERNAL] boolean;
X   centering         : [EXTERNAL] boolean;
X   flushright       : [EXTERNAL] boolean;
X   minipageactive  : [EXTERNAL] boolean;
X   inmarginpar      : [EXTERNAL] boolean;        
X   infootnote       : [EXTERNAL] boolean;
X   underlineactive  : [EXTERNAL] enhancmentstates;
X   boldactive       : [EXTERNAL] enhancmentstates;
X   listnestlevel   : [EXTERNAL] integer;
X
VPROCEDURE startlatex( var outfile : text; outputfont : integer ; outputstyle: p
Xckstr );
Xconst
X   minfont = 10;
X   maxfont = 12;
Xvar
X  pt : integer;
Xbegin          
X  pt := outputfont;
X  if (pt < minfont) or (pt > maxfont) then
X    pt := minfont;                                                  
X  writeln(outfile,'%');
X  if pt = 10 then
X     writeln(outfile,'\documentstyle{',outputstyle,'}')
X  else
X     writeln(outfile,'\documentstyle[',pt:2,'pt]{',outputstyle,'}');
X   writeln(outfile,'%');
X   writeln(outfile,'% (put preamble statements here) ');
X   writeln(outfile,'%');
X   writeln(outfile,'\begin{document}');
X   writeln(outfile,'%')
Xend;
X
X
X[GLOBAL] PROCEDURE closeanyopenbrackets( var outfile : text );
Xvar
X  i : integer;
Xbegin
X   if not fill then
X     writeln(outfile,'} % - end of obeylines and obeyspaces group');
X   if centering then
X     writeln(outfile,'\end{centering}');
X   if flushright then
X     writeln(outfile,'\end{flushright}');
X   if minipageactive then
X     writeln(outfile,'\end{minipage}');
X   if inmarginpar then
X     writeln(outfile,'} % - end of margin par ');
X   if infootnote then
X     writeln(outfile,'} % - end of footnote');
X   if inliteral then
X     writeln(outfile,'\end{verbatim}');
X   for i := 1 to listnestlevel do
X      writeln(outfile,'\end{itemize} % - RNOTOTEX forced list close');
X   stopunderline( outfile );
X   stopbold( outfile )
Xend;
X    
X
X
X[GLOBAL] PROCEDURE endlatex( var outfile : text );
Xbegin           
X  closeanyopenbrackets( outfile );
X  writeln(outfile,'%');
X  writeln(outfile,'%  (put postamble statements here) ');
X  writeln(outfile,'%');
X  writeln(outfile,'\end{document}')
Xend;
X
X
X                                     
X[GLOBAL] PROCEDURE adjustpagestyle( var f : text; newstyle : pagestyletype);
Xbegin
X  pagestyle := newstyle;
X  case pagestyle of
X    empty       : writeln(f,'\pagestyle{empty}');
X    plain       : writeln(f,'\pagestyle{plain}');
X    headings    : writeln(f,'\pagestyle{headings}');
X    myheadings  : begin
X                     writeln(f,'\pagestyle{myheadings}');
X`009             write(f,'\markright{');
X                     writeargarray(f, title);
X                     writeargarray(f, subtitle);
X                     write(f, datestring );
X                     writeln(f,'}')
X                  end
X  end;
X  case pagestyle of
X    empty       : writeln(log,'\pagestyle{empty}');
X    plain       : writeln(log,'\pagestyle{plain}');
X    headings    : writeln(log,'\pagestyle{headings}');
X    myheadings  : begin
X                     writeln(log,'\pagestyle{myheadings}');
X`009             write(log,'\markright{');
X                     writeargarray(log, title);
X                     writeargarray(log, subtitle);
X                     write(log, datestring );
X                     writeln(log,'}')
X                  end
X  end
Xend;
X                      
X                      
X
X
X[GLOBAL] PROCEDURE writecharwidth( var f : text; nchars : integer);
Xconst
X  widthofcharincm = 0.254; { 10 chars per inch, 2.54 cm per inch }
X  maxwidth = 20.0;
X  minwidth = -20.0;
Xvar
X  cm  : real;
Xbegin
X  cm := nchars * widthofcharincm;
X  if cm > maxwidth then
X  begin
X    writeln(log,'[too many chars to skip, ',nchars,' = ',cm:10:2,'cm]');
X    cm := 1.0
X  end;             
X  if  cm < minwidth then
X  begin
X    writeln(log,'[too many chars to skip ',nchars,' = ',cm:10:2,'cm]');
X    cm := -1.0
X  end;
X  write(f, cm:6:2, 'cm ');
X  write(log, cm:6:2,'cm ')
Xend;
X
X
X
X[GLOBAL] PROCEDURE writecharheight( var f : text; nlines : integer );
Xconst
X  heightoftextincm = 0.425; { 6 lines per inch, 2.54 cm per inch }
X  maxheight = 25.0;
X  minheight = -25.0;
Xvar
X  cm : real;
Xbegin
X  cm := nlines * heightoftextincm;
X  if cm > maxheight then
X  begin
X    writeln(log,'[too many lines to skip, ',nlines,' = ',cm:10:2,'cm]');
X    cm := 1.0
X  end;             
X  if  cm < minheight then
X  begin
X    writeln(log,'[too many lines to skip ',nlines,' = ',cm:10:2,'cm]');
X    cm := -1.0
X  end;
X  write(f, cm:6:2,'cm ');
X  write(log, cm:6:2,'cm ')
Xend;
X
X
X
X
X
V[GLOBAL] PROCEDURE adjustlength( var outfile : text; modified : parameterchange
Xstates;
Xlengthvalue : integer; adjustmentvalue : integer; charwidth : boolean;
Xlatexname : pckstr );
Xbegin
X   case modified of
X     nochange : nullstatement;
X     altered   : begin
X`009           write(outfile,'\addtolength{',latexname,'}{');
X                   if charwidth then
X                      writecharwidth(outfile, adjustmentvalue)
X                   else
X                      writecharheight(outfile, adjustmentvalue);
X                   writeln(outfile,'}')
X                 end;
X     assigned  : begin
X`009           write(outfile,'\setlength{',latexname,'}{');
X                   if charwidth then
X                      writecharwidth(outfile, lengthvalue)
X`009           else
X`009              writecharheight(outfile, lengthvalue);
X                   writeln(outfile,'}')
X                 end
X  end;              
X   case modified of
X     nochange : noconversion;
X     altered   : begin
X`009           write(log,'\addtolength{',latexname,'}{');
X                   if charwidth then
X                      writecharwidth(log, adjustmentvalue)
X                   else
X                      writecharheight(log, adjustmentvalue);
X                   writeln(log,'}')
X                 end;
X     assigned  : begin
X`009           write(log,'\setlength{',latexname,'}{');
X                   if charwidth then
X                      writecharwidth(log, lengthvalue)
X`009           else
X`009              writecharheight(log, lengthvalue);
X                   writeln(log,'}')
X                 end
X  end              
Xend;                                              
X 
X               
X
V[GLOBAL] PROCEDURE adjustcounter( var outfile : text;  modified : parameterchan
Xgestates;
Xcountervalue : integer; adjustmentvalue : integer; latexname : pckstr );
Xbegin
X   case modified of
X     nochange : nullstatement;
V     altered   : writeln(outfile,'\addtocounter{',latexname,'}{',adjustmentvalu
Xe,'}');
V     assigned  : writeln(outfile,'\setcounter{',latexname,'}{',countervalue,'}'
X)               
X   end;
X   case modified of
X     nochange : noconversion;
V     altered   : writeln(log,'\addtocounter{',latexname,'}{',adjustmentvalue,'}
X');
V     assigned  : writeln(log,'\setcounter{',latexname,'}{',countervalue,'}')   
X            
X   end
Xend;
X
X                                                     
X
X[GLOBAL] PROCEDURE adjuststyle(var outfile : text; s : styletype;
X`009                         latexname : pckstr );
Xbegin                                                         
X   case s of 
X     undetermined : nullstatement;
V     decimal      : writeln(outfile,'\renewcommand{\the',latexname,'}{\arabic{'
X,latexname,'}}');
V     octal        : writeln(outfile,'\renewcommand{\the',latexname,'}{\arabic{'
X,latexname,'}}'); 
V     hexidecimal  : writeln(outfile,'\renewcommand{\the',latexname,'}{\arabic{'
X,latexname,'}}');
V     romanupper  : writeln(outfile,'\renewcommand{\the',latexname,'}{\Roman{',l
Xatexname,'}}');
V     romanlower  : writeln(outfile,'\renewcommand{\the',latexname,'}{\roman{',l
Xatexname,'}}');
V     romanmixed  : writeln(outfile,'\renewcommand{\the',latexname,'}{\roman{',l
Xatexname,'}}');
V     letterupper : writeln(outfile,'\renewcommand{\the',latexname,'}{\Alpha{',l
Xatexname,'}}');
V     letterlower : writeln(outfile,'\renewcommand{\the',latexname,'}{\alpha{',l
Xatexname,'}}');
V     lettermixed : writeln(outfile,'\renewcommand{\the',latexname,'}{\alpha{',l
Xatexname,'}}');
X     nostyle     : nullstatement
X  end;
X   case s of                     
X     undetermined : noconversion;
V     decimal      : writeln(log,'\renewcommand{\the',latexname,'}{\arabic{',lat
Xexname,'}}');
V     octal        : writeln(log,'\renewcommand{\the',latexname,'}{\arabic{',lat
Xexname,'}}'); 
V     hexidecimal  : writeln(log,'\renewcommand{\the',latexname,'}{\arabic{',lat
Xexname,'}}');
V     romanupper  : writeln(log,'\renewcommand{\the',latexname,'}{\Roman{',latex
Xname,'}}');
V     romanlower  : writeln(log,'\renewcommand{\the',latexname,'}{\roman{',latex
Xname,'}}');
V     romanmixed  : writeln(log,'\renewcommand{\the',latexname,'}{\roman{',latex
Xname,'}}');
V     letterupper : writeln(log,'\renewcommand{\the',latexname,'}{\Alpha{',latex
Xname,'}}');
V     letterlower : writeln(log,'\renewcommand{\the',latexname,'}{\alpha{',latex
Xname,'}}');
V     lettermixed : writeln(log,'\renewcommand{\the',latexname,'}{\alpha{',latex
Xname,'}}');
X     nostyle     : noconversion
X  end
Xend;
X
X
XEND.
X                                
$ GOSUB UNPACK_FILE
$ FILE_IS = "LINK_RNOTOTEX.COM"
$ CHECKSUM_IS = 960643418
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X$ IF ("''P1'" .EQS. "") THEN $ PI="NODEBUG"
X$ LINK/'P1'  RNOTOTEX,-
X`009     UTILITYOPS,-
X`009     SCREENHANDLERS,-
X`009     ARGOPS,-
X`009     BASICFILEOPS,-
X`009     FLAGOPS,-
X`009     TREEANDLISTOPS,-
X`009     LATEXOPS,-
X`009     INIOPS,-
X`009     CONVERSION,-
X`009     DSROPS,-
X`009     GETCLI
$ GOSUB UNPACK_FILE
$ FILE_IS = "RNOTOTEX.CLD"
$ CHECKSUM_IS = 958872892
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X!`009
X!`009FILE TO SET UP THE RNOTOTEX COMMAND
XDEFINE VERB RNOTOTEX
X    IMAGE TEX_CONVERTAREA:RNOTOTEX.EXE
X    QUALIFIER TEX
X    PARAMETER P1 LABEL=RNO_FILE,PROMPT="RNO file",VALUE(TYPE=$FILE,REQUIRED)
X    PARAMETER P2 LABEL=TEX_FILE,PROMPT="TeX file",VALUE(TYPE=$FILE,REQUIRED)
$ GOSUB UNPACK_FILE
$ FILE_IS = "RNOTOTEX.PAS"
$ CHECKSUM_IS = 1062041168
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X[INHERIT('BASICFILEOPS','CONVERSION',
X'LATEXOPS','TREEANDLISTOPS','FLAGOPS','DSROPS','INIOPS')]
X
XPROGRAM RNOTOTEX( INPUT, OUTPUT);
X
X{ PROGRAM TO CONVERT A RUNOFF FORMAT FILE TO TEX FORMAT }
X{ DEVELOPED BY RANDALL VENHOLA, SUMMER 1987 ON CCRS SMOKE:: }
X{ USING VAX PASCAL }
X
XLABEL
X
X  ENDOFPROGRAM;
X
XCONST
X   DEFAULTFONT = 10;
X   DEFAULTSTYLE = 'report';
X
XVAR
X 
X  RNO, TEX, INI                 : TEXT;         
X  RUNOFFTREE                   : ARGTREE;
X  CURRENTDATE, CURRENTTIME    : DATETIMETYPE;
X  INPUTFID, OUTPUTFID         : FIDTYPE;                   
X  LASTINPUTCHAR, CURRENTCHAR : [GLOBAL] CHAR;
X  TOTALLINES, TOTALCHARS      : [GLOBAL] INTEGER;
X  TOTALGOODDSRCOMMANDS       : [GLOBAL] INTEGER;
X  TOTALBADDSRCOMMANDS        : [GLOBAL] INTEGER;
X  TABRECORD                    : [GLOBAL] TABRECORDTYPE;
X  LOG`009                        : [GLOBAL] TEXT;
X  COLUMNCOUNTER                : [GLOBAL] INTEGER;
X         
X{emergency exit procedure}
X[GLOBAL] PROCEDURE GOTOENDOFPROGRAM;
XBEGIN
X   GOTO ENDOFPROGRAM
XEND;
X
X
XBEGIN
X
X    OPENLOGFILE;
X    GREETUSER( CURRENTDATE, CURRENTTIME );
X    USERINTERFACE( INPUTFID, OUTPUTFID, RNO, TEX );
X    SETUPTREE( INI, RUNOFFTREE );
X    PUTCOMMENTSTOOUTPUT( TEX, INPUTFID, CURRENTDATE, CURRENTTIME);
X    STARTLATEX( TEX, DEFAULTFONT, DEFAULTSTYLE );
X    INITFLAGTABLE;
X    INITGLOBALVARS;
X    INITCHARREADER( RNO );
X    PARSEFILE(RNO, TEX, RUNOFFTREE );
X    ENDLATEX( TEX );
X
XENDOFPROGRAM:
X
X    WRITELN(LOG,'[TOTAL GOOD DSR COMMANDS = ',TOTALGOODDSRCOMMANDS,']');
X    WRITELN(LOG,'[TOTAL  BAD DSR COMMANDS = ',TOTALBADDSRCOMMANDS,']');
X    CLOSEFILES( RNO, TEX );
X    CLOSELOGFILE          
X
XEND.
X                    
$ GOSUB UNPACK_FILE
$ FILE_IS = "RNOTOTEX.RNH"
$ CHECKSUM_IS = 808919667
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X.AP
X.NOFLAGS ACCEPT
X.NONUMBER
X.LITERAL
X
X1 RNOTOTEX
X
X  $ RNOTOTEX[ /qualifier] RNO-FILE-SPEC TEX-FILE-SPEC
X
X.END LITERAL
X.LM+2
XReads a Digital Standard Runoff format file and creates the LaTeX 
Xequivalent.
X.LM-2
X.LITERAL
X
X2 Parameters
X
X   RNO-FILE-SPEC 
X
X.END LITERAL
X.LM+2
X ... is the name of the input DSR format file. The default type 
Xis .RNO.
X.LITERAL
X
X  TEX-FILE-SPEC
X
X.END LITERAL
X
X ... is the name of the output TEX file spec. The default
Xtype is .TEX.
X.LM-2
X.LITERAL
X
X2 Command-Qualifiers
X
X/TEX
X
X  /TEX 
X
X.END LITERAL
X.LM+2
XPreserve embedded TeX and LaTeX commands in the input DSR file. 
XAny commands found are copied directly to the output .TEX file.  The
Xdefault is /NOTEX.
X
X.LM-2
X.LITERAL
X
X2 Example
X
X.END LITERAL
X.LM+2
XThe following DCL 
Xcommands convert the DSR file FOO.RNO to FOO.TEX and prints the
XLN3 file on the LN03. The log of the conversion is also printed
Xand deleted.
X.LITERAL
X
X  $ RNOTOTEX FOO.RNO FOO.TEX
X  $ LATEX/BATCH FOO.TEX
X  $ DVI2LN3 FOO.DVI
X  $ PRINT/FORM=TEX FOO.LN3
X  $ PRINT/DELETE RNOTOTEX.LOG
X
X.END LITERAL
X
XNote that there isn't a one-to-one mapping of DSR commands to LaTeX 
Xcommands and that more LaTeX text fits on a page than a RUNOFF file.
XThe first output may be messy!  The output .TEX file must be
Xedited after examining the first printing. It may take a few tries to
Xget the output that you want.
X
XThe program was designed for those familiar with both LaTeX and DSR
Xand would like to upgrade older documents to LaTeX format.
$ GOSUB UNPACK_FILE
$ FILE_IS = "RNOTOTEX_GUIDE.TEX"
$ CHECKSUM_IS = 1613414640
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X\documentstyle{report}
X%
X%   DOCUMENTATION FOR PROGRAM RNOTOTEX
X%   WRITTEN IN LATEX USING LSE 
X%   R. VENHOLA, 9-MAR-88
X%
X%   Revised by John Edgecombe,  6-JUL-1988, restricting to RNOTOTEX only
X%
X% put section headings on top of page
X\pagestyle{headings}
X
X% release the LaTeX boundaries for margins
X\setlength{\oddsidemargin}{0.5in}
X\setlength{\evensidemargin}{0.0in}
X\setlength{\topmargin}{0.0in}
X
X% make the page size wider and longer
X\setlength{\textwidth}{6.0in}   % 8.5 by 11 page with 1 inch margins
X\setlength{\textheight}{8.0in}  % on each side
X
X% generate a title page
X\author{R.~Venhola}
X\title{ { \Huge \TeX\ \& \LaTeX\ \\ 
X\vspace*{1.0ex} 
XCONVERSION PROGRAM } \\
XRNOTOTEX
X}
X\maketitle
X
X% An IDX file is to be generated
X\makeindex
X
X% A short form command 
X\newcommand{\lb}{\large\bf}
X
X\begin{document}
X
X\chapter{Quick Reference}
XExecute SETUP.COM ({\tt @SETUP.COM}) to set the DCL command syntax
Xbefore using the RNOTOTEX command.
X
X\section{RNOTOTEX}
XDCL command format is :
X
X\begin{center}
X
X{\large\bf \$ RNOTOTEX[\ /qualifier] RNO-FILE-SPEC  TEX-FILE-SPEC}
X
X\end{center}
X
XReads a {\em Digital Standard Runoff} format file and creates the \LaTeX\ 
Xequivalent.
X
X
X\subsection{Parameters}
X
X\begin{center}
X
X
X {\large\sl RNO--FILE--SPEC }
X
X\end{center}
X
X$\ldots$ is the name of the input DSR format file.  The default type 
Xis~{\tt{.RNO}}.
X\begin{center}
X
X
X {\large\sl TEX--FILE--SPEC }
X
X\end{center}
X$\ldots$ is the name of the output~{\tt{TEX}} file spec.  The default
Xtype is~{\tt{.TEX}}.
X
X\subsection{/TEX}
X
X\begin{center}
X
X{\large\sl /TEX }
X
X\end{center}
X
XPreserve embedded \TeX\ and \LaTeX\ commands in the input DSR file.  
XAny commands found are copied directly to the output~{\tt{.TEX}} file.   The
Xdefault is /NOTEX.
X
X\subsection{Example}
XThe following DCL 
Xcommands convert the DSR file FOO.RNO to FOO.TEX and prints the
XLN3 file on the LN03.  The log of the conversion is also printed
Xand deleted.
X
X\begin{verbatim}
X
X    $ RNOTOTEX FOO.RNO
X    $ LATEX FOO.TEX
X    $ DVI2LN3 FOO.DVI
X    $ PRINT/FORM=TEX FOO.LN3
X    $ PRINT/DELETE RNOTOTEX.LOG
X
X\end{verbatim}
X
XNote that there isn't a one-to-one mapping of DSR commands to \LaTeX\ 
Xcommands and that more \LaTeX\ text fits on a page than a RUNOFF file.
VThe  first output may be messy!   The output~{\tt{.TEX}} file must \index{messy
X RNOTOTEX output}
Xedited after examining the first printing.  It may take a few tries to
Xget the output that you want.
X
XThe program was designed for those familiar with both \LaTeX\ and DSR
Xand would like to upgrade older documents to \LaTeX\ format.
X\vspace{10.0cm}
X\pagebreak
X
X\chapter{Introduction}
X\TeX\ and \LaTeX\ are programs that allow programmers to typeset manuscripts
Vfor high precision output devices, such as the \index{LN03} LN03 linked to the 
XSMOKE
Xsystem at CCRS.  \LaTeX\ can be thought of as a usable extension of
X\TeX\ .  Raw \TeX\ can be difficult to use.
X
XThe input files to the program are created in the same
Xmanner as one would create a RUNOFF source file.  The usual file type 
Xis ````{\tt{.TEX}}''.
XThe files are in simple ASCII format, so that they may be created using an
Xeditor such as EDT, SED or \index{LSE} LSE ({\bf L}anguage 
X{\bf S}ensitive {\bf E}ditor).  As a note, the current version of
XLSE on SMOKE recognizes {\tt{TEX}} files and initializes the programming
Xlanguage to be ````LATEX'', with the appropriate expandable placeholders.
X
XCommands such  as ````\verb+\chapter{Introduction}+'' are 
Xembedded in the~{\tt{.TEX}}
Xfile. The file is run through either the \TeX\ or \LaTeX\ program, 
Vwhich will produces a~{\tt{.DVI}} file (for {\bf D}e{\bf{V}}ice {\bf I}ndepende
Xnt).
XThis {\tt{.DVI}} file must be converted to the local print format, which in our
Xcase is done by the program {\bf DVI2LN3}.  
X
XDocumentation on \TeX\ and \LaTeX\ commands are given in Knuth\cite{tex-manual}
Xand Lamport\cite{latex-manual}\footnote{References are listed in the
XBibliography}.
XThe user requires some familiarity with either \TeX\ or \LaTeX\ 
Xto use the conversion programs described in this document.
X
XProgram {\bf RNOTOTEX} reads a DSR format file 
X(i.e.~FOO.RNO) and writes the equivalent\footnote{Well, not {\em really}
Xequivalent, as you will find out in later} TEX format
Xfile (FOO.TEX).
X
X\chapter{RNOTOTEX}
XProgram {\bf RNOTOTEX} will read a DEC Standard RUNOFF (DSR) format text file,
Xtranslate the RUNOFF commands to \LaTeX\ commands and write the corresponding
XTEX file.  The output file may then be processed by \LaTeX\ and printed
Xon the local high quality printer.  To use {\bf RNOTOTEX} one must have
Xexecuted the DCL command procedure
X````SETUP'' as described
Xin the first chapter.
X
X\section{Execution}
XProgram {\bf RNOTOTEX} requires two files names on the command line : the
Xinput~.RNO file and the output~{\tt{.TEX}} file.  For example~:
X\begin{verbatim}
X
X  $ RNOTOTEX FOO.RNO FOO.TEX
X
X\end{verbatim}
Xtranslates the file FOO.RNO to the file FOO.TEX.   The program does not
Xrequire any user input.
X
X\section{Translation Actions}
XThe program does four tasks.  It will translate RUNOFF sectioning commands
Xto \LaTeX\ sectioning commands, translate RUNOFF flags to \LaTeX\ commands,
Xtranslate RUNOFF page directives to \LaTeX\ page directives and adjust
X\LaTeX\ counters by the same amount as RUNOFF counters are to be adjusted.
X
X\subsection{Conversion of Sectioning Commands}
X{\bf RNOTOTEX} converts RUNOFF sectioning commands to \LaTeX\ sectioning 
Xcommands. 
XThe output \LaTeX\ style is always {\tt report } in 10 point font.
XThe sectioning command are converted in table~\ref{section-commands}.
X\begin{table}
X\begin{tabular}{ll}
X{\lb RUNOFF }`009    & {\LaTeX\ \lb Command Generated} \\
X .HL1 text      & \verb+\chapter{text}+ \\
X .HL2 text      & \verb+\section{text}+ \\
X .HL3 text      & \verb+\subsection{text}+ \\
X .HL4 text      & \verb+\subsubsection{text}+ \\
X .HL5 text      & \verb+\paragraph{text}+ \\
X .HL6 text      & \verb+\subparagraph{text}+ \\
X\end{tabular}
X\caption{Conversion of RUNOFF Sectioning Commands\label{section-commands}}
X\end{table}
X
X\subsection{Conversion of RUNOFF Flags}
XRUNOFF flags are converted to \LaTeX\ commands by {\bf RNOTOTEX}.  
XThis is a direct
Xconversion process, i.e.~a RUNOFF underline command is converted to a
X\LaTeX\ underline command.  This does not always produce the prettiest
Xresults (as one can use {\bf bold} and {\it italic} fonts in \LaTeX\ ),
Xbut it is consistent.  The author regrets that {\bf RNOTOTEX} does not
Vhave the esthetic sense to decide when a font is more appropriate than \index{e
Xsthetic sense}
Xa converted RUNOFF command.  The conversion process for RUNOFF flags
Xis table~\ref{flag-commands}.
X\begin{table}
X\begin{tabular}{lcl}
X{\lb RUNOFF Flag } & {\lb Flag } & {\LaTeX\ \lb Command Generated} \\
X{\lb Name        } & {\lb Char } &`009`009\\
XAccept`009`009`009& \_`009`009   & \verb!\verb+?+! \\
XBold`009`009`009& *`009`009   & \verb+{\bf+$\cdots$\verb+}+ \\
XBreak`009`009`009& \verb+|+`009   & \verb+\\+ \\
XCapitalize`009`009& \verb+<+`009   & (see below) \\
XComment`009`009        &  !`009`009   & \% \\
-+-+-+-+-+ End of part 4 +-+-+-+-+-