home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast2.iso / sprint / texmac.zip / TEX.SPM < prev   
Text File  |  1991-11-22  |  11KB  |  334 lines

  1. ; NOTES: 
  2.  
  3. ;Find TeX errors macros
  4. ;   written by Hal Varian on CServe Borapp forum, modified by RDT 3/21/91
  5. ;   start in TeX file, hit ^B to start.  Macro prompts you for log file
  6. ;   name and sets up screen.  Then hit ^G to go to each error in turn
  7. ;  wanna add loose and tight lines over and underfull boxes
  8.  
  9. BeginLog : 
  10. ;   4 set Q0 flist "*.log"  ;present menu of log files
  11. ;     set Q0 fchange "%.LOG" cdstrip fname
  12.      set Q0 flist "%.LOG"
  13.      if length Q0   ; if it exists
  14.        (2->windows              ;create 2 windows
  15.         r winswitch             ;switch to top window
  16.         if !(buffind Q0)        ;if already open, get reread by BigDos
  17.           open Q0               ;open the chosen log file
  18.         r toend                 ;go to start of log file
  19.         f winswitch             ;go back to TeX file
  20.         r toend)                ;go to start of TeX file
  21.  
  22. ; ought also to write macro to find underfull and overful hboxes
  23. ; for loose and tight lines. Or change these to do both errors and ...
  24. FindError : 
  25.    (2 search "l.[0-9]+"                 ;search for line of error 
  26.     dline scroll                        ;scroll this line to top of screen
  27.     f c c                               ;move forward two characters
  28.     copy (past (2 match "[0-9]+")) Q1   ;read line number into Q1
  29.     draw)                                ;redraw the screen
  30. ;    tosol 1->select toeol draw 0->select     ; humm
  31.  
  32. GoToError :  atoi Q1 -> line       ;convert Q1 to number and go to that line
  33.  
  34. HiliteLine :  
  35.    (toeol set themark    ;go to end of line and set the mark
  36.    1->select             ;turn on reverse video 
  37.    tosol draw            ;go to start of line and redraw the screen 
  38.    0->select             ;turn reverse video off 
  39.    0 wait draw)          ;wait for keystroke and redraw the screen
  40.  
  41. GetError : 
  42.    (r winswitch          ;switch to the log file
  43.    FindError             ;find the error 
  44.    f winswitch           ;switch back to the TeX file
  45.    GoToError             ;go to the error line 
  46.    HiliteLine)           ;hilite the line containing error
  47. ; be nice to add under/overfull hbox search
  48.  
  49. ; 3/21/91, Macros by RDT to assist invoking Tex programs from Sprint menus
  50.  
  51. ; how bout a flag 1/0 for TEX status ?
  52.  
  53. SetCompose :     ; stuff TEx compose line into QI slot
  54.     set QD ""
  55.      6 GetQIStr message "\nCompose: " set QD 6 SetQIStr
  56.  
  57. SetDVI :     ; stuff DVI print input into QI slot
  58.      7 GetQIStr message "\nDVI Print: " set QD 7 SetQIStr
  59.  
  60. SetPreview :     ; stuff preview input into QI slot
  61.      8 GetQIStr message "\nPreview: " set QD 8 SetQIStr
  62.  
  63. GetPreview :     ; stuff preview input into QI slot
  64.      8 GetQIStr         ;message "\nPreview: " set QD 8 SetQIStr
  65.  
  66. Compose :     ; Format a DVI file
  67.      if record KeyRecordEnd    ; allow graceful keyrecord endings if 16 used for call
  68.      SetCurrentDir  ; go to directory of current file, uses QD
  69.           ; This keeps .log file in job file's dir.
  70. ;     SetCompose         ; returns tex command line in QD
  71.      if NeedSave FileSave
  72.      set Q0 fname   ; cdstrip fname
  73.      0 QSlash  ; which presents file name in Tex legal format
  74. ; 0 QStripExt       ; remove extension
  75.      SetOvlModf     ; save the damn variables
  76. ;     1+8+ BigDos call QD " " Q0   ; QD is either Tex or Latex, run restart after
  77.      1+8+ BigDos call "tex " Q0
  78. ;    gotta go back to previous dir from Restart macro
  79.  
  80. Dvi2Print : ; output DVI file to printer
  81.      if record KeyRecordEnd    ; allow graceful keyrecord endings if 16 used for call
  82.      SetCurrentDir  ; go to directory of current file, uses QD, this keeps .err files with job
  83.      set q0 fchange "%.DVI" fname
  84.      0 QLow    ; lowercases for peculiarity of dvi2tty, at least in 4dos
  85.      1 GetQINum -> PrintDest
  86.     if PrintDest = 3 (4 GetQIStr $ call "capture nb nt " QD)    ; queue redirected output
  87.      SetDVI  ; puts dvi output command in QD and saves it
  88.      SetOvlModf         ; save the damn variables
  89.      1+8+ BigDos call QD " " Q0  ; runs Restart with 8 to get current dir reset
  90.  
  91. TTY : ; preview DVI file to DVI2TTY to home pview.tty file
  92.      set q0 fchange "%.DVI" cdstrip fname
  93.      0 QLow    ; lowercases for peculiarity of dvi2tty, at least in 4dos
  94.      4 QTMP    ; create temp file in home dir in Q4
  95.      GetPreview  ; puts TTY command in QD and saves it
  96.      1 call QD " -o" Q4 Q0
  97.      open "" read Q4
  98.      r toend
  99.  
  100. DVideo : ; preview DVI file with DVideo
  101.      set q0 fchange "%.DVI" cdstrip fname
  102.      SetOvlModf         ; save the damn variables
  103.     8+BigDos call "dvideo -x.5in -y.5in " Q0
  104.  
  105.  
  106. ; overlaid on top of my base sprint macros
  107.  
  108.  
  109. TexDVIMenu :      ; 1->InTex here? for restart or pbreak use?
  110.      menu "TeX Output Menu" {
  111.       "Compose"              Compose,
  112.       "Print"               Dvi2Print,
  113.       "DVideo View"           Dvideo,
  114.       "Quick View"            SetPreview TTY,
  115.       "_",
  116.       "Start Error Search"         BeginLog GetError,
  117.       "Next Error"                 GetError
  118.       }
  119.  
  120. ;============================================================
  121. ; This is a menu system for inserting common LaTex composition commands
  122. ; and for running LaTex, the previewer, and the printer from within
  123. ; SPRINT
  124. ; modified from HCH contribution to Borapp forum by RDT, 3/23/91
  125.  
  126. ;Put region into a \begin{Q0} ... \end{Q0} pair
  127. EnvEntry :
  128.     if select
  129.     markregion{
  130.         insert "^J\\begin{" insert Q0 insert "}^J"
  131.         swapmark
  132.         insert "^J\\end{" insert Q0 insert "}^J^J"
  133.         unselect
  134.     }        
  135.     else {
  136.         tosol
  137.         insert "^J\\begin{" insert Q0 insert "}^J^J"
  138.         insert "\\end{" insert Q0 insert "}^J^J"
  139.         3 up
  140.         }
  141.  
  142. ;takes Q0, forms \Q0{region}
  143. ComEntry :       ; Q0 has the command  
  144.     if (!select)(setmark)
  145.     markregion{
  146.         insert"\\"
  147.         insert Q0
  148.         '{' insert
  149.         swapmark
  150.         '}' insert
  151.         swapmark
  152.         }
  153.     if select Unselect
  154.     else (r c )
  155.  
  156. ;takes Q0, forms {\Q0 region}
  157. ScopeEntry :            ; Q0 has the command  
  158.     if (! select)(setmark) 
  159.     markregion{
  160.         insert"{"
  161.         insert Q0
  162.         swapmark
  163.           insert QD
  164.         swapmark
  165.         }
  166.     if select Unselect
  167.     else (r length QD repeat (r c) ) ; get back past length of QD
  168.  
  169. ListsMenu :
  170.     menu "List Environments" {
  171.     "Centering"     insert "\\centering\n",
  172.     "N-Center"      set Q0 "center" EnvEntry,
  173.     "Description"   set Q0 "description" EnvEntry,
  174.     "Enumerate"     set Q0 "enumerate" EnvEntry,
  175.     "Itemize"    set Q0 "itemize" EnvEntry,
  176.      "X-item"        insert "\n\\item ",
  177.      "Letter"           set Q0 "letter}{ " EnvEntry,
  178.     "Figure"        set Q0 "figure" EnvEntry,
  179.     "Table"        set Q0 "table" EnvEntry,
  180.         "_",
  181.         "Other"message "\nOther Env: " set Q0 EnvEntry
  182.     }
  183.  
  184. FontSizeMenu :
  185.      set QD "}"
  186.     menu "Font Size" {
  187.     "1--Scriptsize" set Q0 "\\scriptsize " ScopeEntry,
  188.     "2--Footnotesize" set Q0 "\\footnotesize " ScopeEntry,
  189.     "3--Small" set Q0 "\\small " ScopeEntry,
  190.     "4--Normalsize" set Q0 "\\normalsize " ScopeEntry,
  191.     "5--large" set Q0 "\\large " ScopeEntry,
  192.     "6--Large" set Q0 "\\Large " ScopeEntry,
  193.     "7--LARGE" set Q0 "\\LARGE " ScopeEntry,
  194.     "8--huge"  set Q0 "\\huge "  ScopeEntry
  195.     }
  196.  
  197. FontMenu :
  198.      set QD "}"
  199.     menu "Font Commands" {
  200.     "BoldFace"      set Q0 "\\bf " ScopeEntry,
  201.     "Caps"          set Q0 "\\sc " ScopeEntry,
  202.     "Emphasized"    set Q0 "\\em "  set QD "\\/}" ScopeEntry,
  203.     "Italics"       set Q0 "\\it "  set QD "\\/}" ScopeEntry,
  204.     "San Serif"     set Q0 "\\sf " ScopeEntry,
  205.     "Typewriter"    set Q0 "\\tt " ScopeEntry,
  206.     "_",
  207.     "Magnitude"   fontsizemenu
  208.     }
  209.  
  210. BreaksMenu :
  211.     menu "Break Commands" {
  212.     "Linebreak"    insert "\\\\[]^J" ,
  213.     "Pagebreak"    insert  "\\newpage^J",
  214.     "Hspace"       insert  "\\hspace{}" r c,
  215.     "Spring"       insert  "\\hfill ",
  216.     "Verticalspace" insert "\\vspace{}" r c
  217.     }
  218.  
  219. TexUtilitiesmenu :
  220.     menu "Utility Commands" {
  221.     "Array"         set Q0 "array"        EnvEntry,
  222.     "Curlybraces"   set Q0 "" set QD "}"    ScopeEntry,
  223.     "Equation"      set Q0 "equation"    EnvEntry,
  224.     "Displaymath"   set Q0 "displaymath"    EnvEntry,
  225.     "_",
  226.     "Newblock"      insert "\\newblock ",
  227.     "O nocite"      set Q0 "nocite"         ComEntry,
  228.     "I cite"        set Q0 "cite"           ComEntry,
  229.     "T Bibitem"     set Q0 "bibitem"        ComEntry
  230.     }
  231.  
  232. Articlesetup :
  233.       insert "\\documentstyle[12pt]{article}\n"
  234.       insert "\\setcounter{secnumdepth}{0}\n"   
  235.       insert "\\begin{document}\n"
  236.       insert "\\end{document}"
  237.  
  238. Lettersetup :
  239.             insert "\\documentstyle[12pt]{letter}\n"
  240.             insert "\\begin{document}\n"
  241.             insert "\\end{document}"
  242.  
  243. Overallmenu :
  244.     menu "Global Forms" {
  245.         "Article"  Articlesetup,
  246.         "Letter"   Lettersetup
  247. ; ,        "Memo"     memosetup,
  248. ;        "Officeletter"  officelettersetup,
  249. ;        "Homeletter"  homelettersetup
  250.         }
  251.  
  252. Sectionsmenu :
  253.         menu "Sectioning Commands"{
  254.         "Section" set Q0 "section" ComEntry,
  255.         "Usubsection" set Q0 "subsection" ComEntry,
  256.         "Bsubsubsection" set Q0 "subsubsection" ComEntry,
  257.         "Paragraph" set Q0 "paragraph" ComEntry,
  258.         "_",
  259.         "Other" message "\nOther: " set Q0 ComEntry
  260.     }
  261.  
  262. TexFormatMenu :
  263.     menu "TeX Format Menu"{
  264.     "Lists"    listsmenu,
  265.     "Font"    fontmenu,
  266.     "Overall" overallmenu,
  267.     "Utilities" texutilitiesmenu,
  268.     "Sections" Sectionsmenu,
  269.     "Gaps" breaksmenu
  270.      }
  271.  
  272. articleentry:
  273. collectionentry:
  274. misComEntry:
  275. bookentry:
  276.  
  277. Bibliographymenu :
  278.     menu "Bibliography Entry Types"{
  279.     "Article"        articleentry,
  280.     "Book"        bookentry,
  281.     "Incollection"    collectionentry,
  282.     "Misc"        misComEntry
  283.     }
  284.  
  285. bookentry :
  286.      mark{
  287.     insert "@Book{,^J"
  288.     insert "  author =  { },^J"
  289.     insert "  editor =  { },^J"
  290.     insert "  title =   { },^J"
  291.     insert "  publisher =  { },^J"
  292.     insert "  year = { },^J"
  293.     insert "  address = { },^J"
  294.     insert "  edition = { }^J"
  295.     insert "}^J^J"
  296.      }
  297.     10 up toeol r c
  298.  
  299. articleentry :
  300.     insert "@article{,^J"
  301.     insert "  author =  { },^J"
  302.     insert "  title =   { },^J"
  303.     insert "  journal =  { },^J"
  304.     insert "  year = { },^J"
  305.     insert "  volume = { },^J"
  306.     insert "  number = { },^J"
  307.     insert "  pages = { }^J"
  308.     insert "}^J^J"
  309.      10 up toeol r c
  310.  
  311. collectionentry :
  312.     insert "@incollection{,^J"
  313.     insert "  author =  { },^J"
  314.     insert "  title =   { },^J"
  315.     insert "  booktitle =   { },^J"
  316.     insert "  publisher =  { },^J"
  317.     insert "  editor =  { },^J"
  318.     insert "  chapter =  { },^J"
  319.     insert "  pages =  { },^J"
  320.     insert "  year = { },^J"
  321.     insert "  address = { },^J"
  322.     insert "  edition = { }^J"
  323.     insert "}^J^J"
  324.      13 up toeol r c
  325.  
  326. misComEntry :
  327.     insert "@misc{ ,^J"
  328.     insert "  author =  { },^J"
  329.     insert "  title =   { },^J"
  330.     insert "  howpublished =  { },^J"
  331.     insert "  year = { }^J"
  332.     insert "}^J^J"
  333.  
  334.