home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / pmcstex.zip / install / e-ex.CS / CSTeX.e next >
Text File  |  2000-04-16  |  66KB  |  1,593 lines

  1. /**************************************************************************
  2.   This is pmCSTeX for EPM, version 16. 4. 2000
  3.  
  4.   This macro file pmCSTeX.e (together with pm4epm.e) implements
  5.   the CSTeX menu for various (La)TeX related commands.
  6.  
  7.   This package was intended to be the (final?) replacement for the packages
  8.   CSTeX for DOS, EPMTeX, TeXshell and pmgraf (and emacs perhaps?) under OS/2.
  9.   *Must have* for {em}(La)TeXing under OS/2 :-)
  10.  
  11.   This file belongs to the "pmCSTeX for EPM" package, see 
  12.      http://www.sci.muni.cz/~mikulik/os2/pmCSTeX.html
  13.   or pmcstex.zip on hobbes, leo and CTAN archives.
  14.  
  15.   Copyright  1996  Petr Mikulik
  16.   -----------------------------
  17.   License: free-latex     distributed under the same terms as LaTeX
  18.   This program can be redistributed and/or modified under the terms
  19.   of the LaTeX Project Public License Distributed from CTAN
  20.   archives in directory macros/latex/base/lppl.txt; either
  21.   version 1 of the License, or any later version.
  22.  
  23.   License meaning in short: use and distribution permitted, like any 
  24.   freeware. Package must be distributed together with the source code. 
  25.   Reuse of the source code or any part of it is allowed. Any changes or
  26.   enhancement to this package must involve a change of name unless these
  27.   changes are accepted by the author. You are welcome to submit your 
  28.   bugfixes, updates or new features.
  29.     Because the program is licensed free of charge, there is no warranty 
  30.   for any of its component. You are responsible for any software, hardware, 
  31.   human or nature disaster resulting from installing and using of this 
  32.   package.
  33.  
  34.  
  35.   Author's address:
  36.   -----------------
  37.   Petr Mikulík
  38.   Department of Solid State Physics 
  39.     and Laboratory of Thin Films and Nanostructures
  40.   Faculty of Science
  41.   Kotlarska 2 (Kotl\'a\v rsk\'a 2)
  42.   Masaryk University
  43.   Brno
  44.   Czech Republic
  45.  
  46.   mikulik@physics.muni.cz
  47.   http://www.sci.muni.cz/~mikulik/
  48.  
  49.  
  50.   Installation:
  51.   -------------
  52.  0. *** Please read manual pmCSTeX.INF, and ignore the following: ***
  53.  1. Copy this file and pm4epm.e to any directory on your EPMPATH
  54.     (create directory E:\APPS\EPM\CSTeX, copy all files into it, modify
  55.      EPMPATH=...;E:\APPS\EPM\CSTeX;... in your CONFIG.SYS)
  56.  2. Write these lines into your Profile.erx:
  57.     'link pm4epm'
  58.     'link pmcstex'
  59.     'link czech'  -- this is for Czech users: Czech keyboard implementation by Z. Wagner     
  60.     'link sampactn' -- there is syntax highlighting there
  61.     'link MyCNF'  -- there are your actions there 
  62.  3. Add these two lines into  actions.lst  file:
  63.     CSTeX
  64.     pm4epm
  65.  4. Maybe something more, thus:
  66.  5. *** Please do the installation according to the pmCSTeX.INF ***
  67.  
  68.  Compilation (of *.e to *.ex files):
  69.  -----------------------------------
  70.  You must have received file  stdconst.e  from EPMMAC.ZIP  (it can be found
  71.  on hobbes.nmsu.edu:os2/editors, on leo, on IBM EWS...). Then type
  72.     etpm pm4epm
  73.     etpm cstex
  74.  
  75.   If you find bugs, or you find something missing, or you want to send
  76.   me your improvements or new features to put it in, then you are welcome.
  77.  
  78. ***************************************************************************/
  79.  
  80. /*
  81. My comments on the history (the details for the ordinary users are written in the
  82. enclosed .INF documentation):
  83.  
  84. o 16.4.2000
  85.     vlnka2.exe removed, replaced by vlna.exe; changes in menu
  86. o 6.3.1999
  87.     enhancement for hotkeys Ctrl/3,4 for the inclusion of (AMS-)LaTeX environments:
  88.       if a line-marked block (Alt-L) exists, then the choosen environment surrounds it; 
  89.       otherwise environment inserted at the cursor position (as before)
  90. o 14.12.1998
  91.     improvement: skipping text between "Overfull/Underfull" and "[]" (sometimes produced 
  92.       a warning about wrong number of corrupted .log file because of parenthesis)
  93.     improvement: skipping text from "LaTeX Warning:" until blank line
  94. o 18.1.1998
  95.     bugfix: the greek keyboard was switching off the Spell checking. 
  96.     next_error: enhanced for "Show me this Warning from this .log file"
  97. o 5.1.1998
  98.     paragraph TeXing enhanced for line blocks
  99. o 29.12.1997
  100.     new action and menu item: TeX->PS
  101. o 26.11.1997
  102.     view documentation enhanced to browse pmCSTeX and LaTeX2e .INFs
  103. o 11.11.1997
  104.     TeXing a paragraph: now going via $cstex$.cmd script in order to avoid the 
  105.       the EPM string length limitation
  106.     'View documentation' menu item added.
  107.     already_in_ring replaced by its explicit expansion.
  108. o 24.9.1997
  109.     TeXing a paragraph on another partition: (cd %d) changed to (%h&cd %d)
  110. o 16.7.1997
  111.     Include command (Alt-1) now accepts absolute pathnames, even in unix format
  112. o 13.4.1997
  113.     Spain dictionary added
  114.     warning if the selected dictionary does not exist
  115.     ksi->xi fixed. psview.cmd. makeindex options
  116. o 5.2.1997
  117.     bugfix for a typo in the previously updated version of the protection against
  118.       damaged .log files
  119. o 3.2.1997
  120.     collisions with hotkeys taken away
  121. o 30.1.1997+1.2.1997
  122.     playing with circleit
  123. o 23.1.1997
  124.     *.bak cleaned too + highlit_all is now OK
  125. o 4.1.1997
  126.     update for master file to be firstly searched in the directory of the working file,
  127.       and some other things
  128. o 30.11.1996
  129.     dvi-out2, vlnka2
  130. o 28.10.1996
  131.     dictionaries FR.dic, UK.dic, US.dic, etc. are taken from the
  132.       directory written in the EPM_DICTIONARIES environmental variable. If this
  133.       variable is not set, then from \APPS\EPM
  134. o 22.10.1996
  135.     for the CS version: separate BibTeX, MakeIndex and csBibTeX, csMakeIndex
  136. o 9.10.1996
  137.     in DEFC cstex_highlight_all added nextfile after the loop
  138. o 22.7.1996
  139.     typo smalle->small corrected; Ctrl/1, Ctrl/6, Ctrl/7 added¬
  140. o 11.6.1996
  141.     added dictionary (language) menu. The corresponding compile option is PM_DICTIONARIES
  142. o 8.6.1996
  143.     the first international release of pmCSTeX for EPM: 
  144. o since January 1996
  145.     creation and the early releases
  146. */
  147.  
  148. include 'stdconst.e'    -- from EPMMAC.ZIP
  149. -- include 'pm4epm.e'  -- Routines are used, but include not needed
  150.  
  151.  
  152. /*** define CSTeX hotkeys ***/
  153. def C_F11 = 'cstex_texit_and_dvips S'
  154. def S_F11 = 'cstex_texit_background S'
  155. def S_F12 = 'cstex_next_error S'
  156.  
  157. DEFINIT
  158.   universal    pm4epm_MasterNotFound,
  159.         cstex_error_array_id, cstex_error_index, cstex_errorarray_name,
  160.         cstex_no_more_errors,
  161.         cstex_true_tex_background, cstex_background_beep,
  162.         cstex_prev_keyset
  163. cstex_error_index=-1
  164. cstex_no_more_errors=0
  165. cstex_true_tex_background=1  -- background compilation is: 0=window 1=icon
  166. cstex_background_beep=0      -- 0/1 nobeep/beep after background the texing
  167. 'PostMe BuildCSTeXMenu'
  168.  
  169.  
  170. /*
  171. DEFLOAD 
  172.   -- 'a_togl_hilit S'
  173.   -- 'toggle_parse 1 epmkwds.tex'
  174. Syntax highlighting is now discussed in the manual pmCSTeX.INF. 
  175. Toggling the syntax on has been moved to your local config file, i.e. MyCNF.e
  176. */
  177.  
  178.  
  179. const
  180. CSTEX_CSTEX = 1 -- allow Czech (CSTeX distribution) related features
  181. -- CSTEX_CSTEX = 0 -- disable Czech (CSTeX distribution) related features
  182.   -- enables/disables CSTOCS, CSTeX spell checker, dvi-out etc. 
  183.  
  184.   CSTEX_CS2CS = 1 -- use cs2cs program for Czech to Czech conversion
  185.   -- CSTEX_CS2CS = 0 -- use old DOS program
  186.  
  187.   PM_DICTIONARIES = 1 -- menu item to change the dictionary file (11.6.1996)
  188.   -- PM_DICTIONARIES = 0 -- do not have that item in the CSTeX menu
  189.  
  190.   CSTEX_USEMASTERDIR = 1
  191.     -- master file is firstly searched in the directory of the working file
  192.   --  CSTEX_USEMASTERDIR = 0
  193.     -- master file is searched in the current directory (the directory
  194.     -- from which the EPM was started from)
  195.     -- Obsolete because of unpredictable results, DON'T USE THE CHOICE 0
  196.  
  197. const
  198.   cstex_texit_inf = 'Compile document by (La)TeX  (pm_command_cmd %format.cmd %N)'
  199.   cstex_preview_inf = 'Preview document by dvipm (using dvipm.cnf)'
  200.   cstex_paragraph_inf = 'Run LaTeX over current paragraph or line block'
  201.   cstex_texit_and_dvips_inf = 'TeX->PS: compile the document and run dvips afterwards'
  202.   cstex_dvips_inf = 'Run dvi-out and dvips'
  203.   cstex_master_inf = 'Load Master file'
  204.   cstex_include_inf = 'Load the file under the cursor'
  205.   cstex_refresh_inf = 'Refresh current file (reload from disk)'
  206.   cstex_save_all_inf = 'Save all files in the ring'
  207.   cstex_highlight_all_inf = 'Toggle syntax highlighting for the whole ring'
  208.   cstex_texit_background_inf = '(La)TeX the document on background'
  209.   cstex_next_error_inf = 'Locate next error in .log file (and open .log if necessary)'
  210.   cstex_gvpm_inf = 'run dvips and then preview by ghostview'
  211.  
  212. DEFC cstex_actionlist
  213. universal ActionsList_FileID
  214.  
  215.  insertline 'cstex_texit'cstex_texit_inf'CSTeX',ActionsList_FileID.last+1,ActionsList_FileID
  216.  insertline 'cstex_preview'cstex_preview_inf'CSTeX',ActionsList_FileID.last+1,ActionsList_FileID
  217.  insertline 'cstex_paragraph'cstex_paragraph_inf'CSTeX',ActionsList_FileID.last+1,ActionsList_FileID
  218.  insertline 'cstex_texit_and_dvips'cstex_texit_and_dvips_inf'CSTeX',ActionsList_FileID.last+1,ActionsList_FileID
  219.  insertline 'cstex_dvips'cstex_dvips_inf'CSTeX',ActionsList_FileID.last+1,ActionsList_FileID
  220.  insertline 'cstex_master'cstex_master_inf'CSTeX',ActionsList_FileID.last+1,ActionsList_FileID
  221.  insertline 'cstex_include'cstex_include_inf'CSTeX',ActionsList_FileID.last+1,ActionsList_FileID
  222.  insertline 'cstex_refresh'cstex_refresh_inf'CSTeX',ActionsList_FileID.last+1,ActionsList_FileID
  223.  insertline 'cstex_save_all'cstex_save_all_inf'CSTeX',ActionsList_FileID.last+1,ActionsList_FileID
  224.  insertline 'cstex_texit_background'cstex_texit_background_inf'CSTeX',ActionsList_FileID.last+1,ActionsList_FileID
  225.  insertline 'cstex_next_error'cstex_next_error_inf'CSTeX',ActionsList_FileID.last+1,ActionsList_FileID
  226.  insertline 'cstex_highlight_all'cstex_highlight_all_inf'CSTeX',ActionsList_FileID.last+1,ActionsList_FileID
  227.  insertline 'cstex_gvpm'cstex_gvpm_inf'CSTeX',ActionsList_FileID.last+1,ActionsList_FileID
  228.  
  229. const
  230.   worldindex='makeindx'
  231.   worldbibtex='BibTeX'
  232. COMPILE IF CSTEX_CSTEX=1
  233.   csindex='csIndex'
  234.   csbibtex='csBibTeX'
  235. COMPILE ELSE
  236.   csindex='makeindx'
  237.   csbibtex='BibTeX'
  238. COMPILE ENDIF
  239.  
  240. --------------------- KEYS DEFINITION ---------------------------------
  241.  
  242. -- CTRL/1 Titles, contributed by M.H., 22.7.96/15.6.96
  243. def C_1 =
  244. s=',subparagraph,paragraph,subsubsection,subsection,section,chapter,mychapter,foilhead'
  245. s=listbox('sectioning commands',s,,20,22,8,25)  -- pos1,pos2,height,width
  246. if s='' then return; endif
  247. getline x; replaceline( insertstr('\'s'{}',x,.col-1) )
  248. .col=.col+1+length(s)+1
  249.  
  250.  
  251. -- CTRL/3 \begin{} \end{} LaTeX environment
  252. def C_3 =
  253. --x=winmessagebox('Choose environment','i=itemize' ,65535)
  254.   /* -- This comes from my Turbo Vision pmgraf program
  255.   s=',flush~left,~center,flush~right,eqnarray,~equation,array,~tabular,tabular*,table,tabbing,'
  256.   s=s'e~numerate,~itemize,~description,displaymath,~picture,~figure,~verbatim,verbatim*,document'
  257.   */
  258. s=',array,center,description,displaymath,document,enumerate,eqnarray,equation,figure,flushleft,flushright,itemize,picture,tabbing,table,tabular,verbatim'
  259. s=listbox('environment',s,,20,22,17,25)  -- pos1,pos2,height,width
  260. -- s=entry_box('environment',s,'equation',30,30)
  261. if s='' then return; endif 
  262. s=word(s,1)
  263. if marktype()='LINE' then -- 6.3.1999: surround line-marked text by the choosen environment
  264.   getmark lfrom,lto
  265.   insertline '\begin{'s'}',lfrom
  266.   insertline '\end{'s'}',lto+2
  267.   return
  268.   endif
  269. -- insert the environment and a blank line in between
  270. if .col>1 then .line=.line+1; endif
  271. insertline '\begin{'s'}'
  272. insertline ''
  273. insertline '\end{'s'}'
  274. .line=.line-2
  275. .col=1
  276.  
  277.  
  278. -- CTRL/4 AMSLaTeX environments
  279. def C_4 =
  280. s=',align,align*,aligned,alignat,alignat*,bmatrix,cases,flalign,flalign*,gather,gather*,gathered,matrix,multline,multline*,pmatrix,smallmatrix,split,subarray,subequations,Sb,Sp,vmatrix,Vmatrix,xalignat,xlignat*,xxalignat,xxlignat*'
  281. s=listbox('AMSLaTeX env.',s,,26,22,23,25)  -- pos1,pos2,height,width
  282. -- s=entry_box('environment',s,'equation',30,30)
  283. if s='' then return; endif 
  284. s=word(s,1)
  285. if marktype()='LINE' then -- 6.3.1999: surround line-marked text by the choosen environment
  286.   getmark lfrom,lto
  287.   insertline '\begin{'s'}',lfrom
  288.   insertline '\end{'s'}',lto+2
  289.   return
  290.   endif
  291. -- insert the environment and a blank line in between
  292. if .col>1 then .line=.line+1; endif
  293. insertline '\begin{'s'}'
  294. insertline ''
  295. insertline '\end{'s'}'
  296. .line=.line-2
  297. .col=1
  298.  
  299.  
  300. -- CTRL/5 LATeX font sizes
  301. def C_5 =
  302. s=',tiny,scriptsize,footnotesize,small,normalsize,large,Large,LARGE,huge,Huge'
  303. s=s',mathbf,mathcal,mathnormal,mathrm,mathsf,mathit,mathtt,mathfrak,boldsymbol,pmb,mathbb,mathrsfs'
  304. --s=listbox('font size',s,,20,22,10,25)  -- pos1,pos2,height,width
  305. s=listbox('font size',s,,20,24,20,25)  -- pos1,pos2,height,width
  306. if s='' then return; endif
  307. getline x; replaceline( insertstr('\'s,x,.col-1) )
  308. .col=.col+1+length(s)
  309.  
  310.  
  311. -- CTRL/6 text fonts
  312. def C_6 =
  313. s=',textrm,textsf,texttt,textmd,textbf,textup,textit,textsl,textsc,emph,textnormal'
  314. s=listbox('text font',s,,20,22,11,25)  -- pos1,pos2,height,width
  315. if s='' then return; endif
  316. getline x; replaceline( insertstr('\'s'{}',x,.col-1) )
  317. .col=.col+1+length(s)+1
  318.  
  319. -- CTRL/7 text fonts
  320. def C_7 =
  321. s=',rmfamily,sffamily,ttfamily,mdseries,bfseries,upshape,itshape,slshape,scshape,em,normalfont'
  322. s=listbox('text font',s,,20,22,11,25)  -- pos1,pos2,height,width
  323. if s='' then return; endif
  324. getline x; replaceline( insertstr('{\'s' }',x,.col-1) )
  325. .col=.col+1+length(s)+1
  326.  
  327.  
  328.  
  329.  
  330. -- Alt-G defines Greek keyboard. Keyboard layout according to Chi-writer
  331. def A_G =
  332.   universal cstex_prev_keyset,czech_is
  333. -- sayerror 'current keyset='.keyset'   czech_is='czech_is
  334. cstex_prev_keyset=.keyset
  335. keys pm_GreekKeys
  336.  
  337. -- DEFKEYS pm_OrigKeys overlay
  338.  
  339. DEFKEYS pm_GreekKeys overlay
  340. def 'a'-'z','G','D','S','L','X','P','Y','F','O','Q','J' = pm_TypeGreek()
  341.  
  342. DEFPROC pm_TypeGreek()
  343.   universal czech_is, cstex_prev_keyset, cstex_prev_keyset
  344. a=lastkey(0)
  345. GreekAlphabet='\alpha\beta\chi\delta\epsilon\phi\gamma\eta\iota\psi\kappa\lambda\mu\nu\omega\pi\theta\rho\sigma\tau\varepsilon\varphi\vartheta\xi\upsilon\zeta\'
  346. a=asc(a);
  347. if a>90 then i=a-96; else i=a-64; endif
  348. p=1; j=2
  349. while j<=i do p=pos('\',GreekAlphabet,p+1); j=j+1; endwhile
  350. i=pos('\',GreekAlphabet,p+1); 
  351. if a>90 
  352.   then s=substr(GreekAlphabet,p,i-p)
  353.   else s=upcase(substr(GreekAlphabet,p+1,1)); s='\'s''substr(GreekAlphabet,p+2,i-p-2)
  354.   endif
  355. getline x; replaceline( insertstr(s,x,.col-1) )
  356. .col=.col+length(s)
  357. -- load the keyset as before. If Czech.E is used, then czech_is holds the state
  358. -- New keys switching implemented on 18.1.1998 (Greek switched off spell checking):
  359. -- Unfortunately, neither or these 2 work:   keys 'edit_keys'    .keyset=cstex_prev_keyset
  360. -- and thus doing it explicitly:
  361. -- InfoBox('cstex_prev_keyset',cstex_prev_keyset)
  362. -- sayerror 'cstex_prev_keyset='cstex_prev_keyset
  363. -- if cstex_prev_keyset='EDIT_KEYS' then keys edit_keys
  364. if cstex_prev_keyset='EDIT_KEYS' then 
  365.     if     czech_is=1 then keys czech_keys
  366.     elseif    czech_is=2 then keys czech_switch
  367.     else keys edit_keys
  368.     endif
  369. elseif cstex_prev_keyset='SPELL_KEYS' then keys spell_keys
  370. elseif cstex_prev_keyset='CZECH_KEYS' then keys czech_keys
  371. elseif cstex_prev_keyset='CZECH_SWITCH' then keys czech_switch
  372. elseif cstex_prev_keyset='PM_GREEKKEYS' then keys edit_keys -- this should not happen!
  373. else ErrorBox('Sorry, the previous keyset is uknown','Please, modify the end of the routine pm_TypeGreek() in CSTeX.e (part ... elseif cstex_prev_keyset= ...) for the keyset 'cstex_prev_keyset)
  374. endif
  375. -- This was the old (until 18.1.1998) keys switching:
  376. /*
  377. if     czech_is=1 then keys czech_keys
  378. elseif    czech_is=2 then keys czech_switch
  379. else     keys pm_OrigKeys
  380. endif
  381. */
  382.  
  383.  
  384.  
  385. ------------------------ PROCEDURES -----------------------------
  386.  
  387.  
  388.  
  389. /*
  390. Wait a little bit. I don't know how to put a DOS prog into window
  391. without STARTing it.
  392. Note: this routine is no more use; it was in use when calling some DOS
  393. programs in the Czech version.
  394. */
  395. COMPILE IF CSTEX_CSTEX=1
  396. DEFPROC PleaseRelax ()
  397. InfoBox('Please relax...','Wait till the program finishes. I do not know how to run DOS windowed program and wait till it finishes. Please send me the solution if you know it.')
  398. return
  399. COMPILE ENDIF
  400.  
  401.  
  402. DEFC cstex_texit
  403.   universal pm4epm_MasterNotFound, cstex_reLaTeXed
  404. parse arg action x
  405. if action='S' then 
  406.   i=length(.filename)
  407.   if (i>4) and (upcase(substr(.filename,i-3,4))='.LOG')  -- update 28.5.1996
  408.     then    e='% MASTER: 'substr(.filename,1,i-4)'.tex'
  409.         insertline e,1
  410.          N=pm_expansion('%format.cmd %N') -- you edit .log file, thus name only
  411.      else    N=pm_expansion('%format.cmd %.N') -- full name
  412.     endif
  413.   if pm4epm_MasterNotFound=1 then return ''; endif
  414.   save_the_ring()
  415.   e=get_env('EMTEXOPT');    -- now cool tricks to set up EMTEXOPT environmental variable
  416.   if (words(e)>0) then e=e' ' endif
  417.   e=e''pm_expansion('%optsemtex')
  418.   if (words(e)=0) then e=N; else e='(set EMTEXOPT='e') & 'N; endif
  419.   COMPILE IF CSTEX_USEMASTERDIR=1
  420.   e=pm_expansion('%h & (cd %d) &')''e  -- 4.1.1997
  421.   COMPILE ENDIF
  422.   'start /c /win /f cmd.exe /c "'e'"'
  423.   cstex_reLaTeXed=1  -- information for cstex_next_error
  424. elseif action='I' then sayerror cstex_texit_inf
  425. endif
  426.  
  427.  
  428. DEFC cstex_texit_background
  429.   universal pm4epm_MasterNotFound, cstex_reLaTeXed,cstex_true_tex_background, cstex_background_beep
  430. parse arg action param
  431. if action='S' then 
  432.   /* before 28.5.1996:
  433.   i=lastpos('.',.filename)
  434.   if (i>0) and (upcase(substr(.filename,i,length(.filename)-i))='LOG') 
  435.     then    N=pm_expansion('%format.cmd %.N') -- full name
  436.         if pm4epm_MasterNotFound=1 then return ''; endif
  437.     else    N=pm_expansion('%format.cmd %N') -- you edit .log file, thus name only
  438.     endif
  439.   */
  440.   i=length(.filename)
  441.   if (i>4) and (upcase(substr(.filename,i-3,4))='.LOG')  -- update 28.5.1996
  442.     then    e='% MASTER: 'substr(.filename,1,i-4)'.tex'
  443.         insertline e,1
  444.          N=pm_expansion('%format.cmd %N') -- you edit .log file, thus name only
  445.      else    N=pm_expansion('%format.cmd %.N') -- full name
  446.     endif
  447.   if pm4epm_MasterNotFound=1 then return ''; endif
  448.   save_the_ring()
  449.   e=get_env('EMTEXOPT')        -- again cool tricks to set up EMTEXOPT environment variable
  450.   if (words(e)>0) then e=e' ' endif
  451.   e=e''pm_expansion('%optsemtex')
  452.   if (words(e)=0) then e='/b'; else e=e' /b'; endif   -- "je to spicovy", it works!
  453.   c='start /c /win /b '
  454.   if (cstex_true_tex_background<>0) then c=c'/min '; endif
  455.   COMPILE IF CSTEX_USEMASTERDIR
  456.   if (param<>'') then N=N' &'param endif -- parameter of dvips after texing: 29.12.1997
  457.   N=pm_expansion('%h&(cd %d)&')''N  -- 4.1.1997
  458.   -- InfoBox('texit: N=',N)
  459.   COMPILE ENDIF
  460.   c=c'cmd.exe /c "(set EMTEXOPT='e')&'N
  461.   -- why that below does not work?
  462.   -- if (cstex_background_beep<>0 || param<>'') then c=c'&echo '; endif
  463.   if (cstex_background_beep<>0 || length(param)<>0) then c=c'&echo '; endif
  464.   -- InfoBox('texit: c=',c) -- for debugging
  465.   c'"' -- add the ending quote and run the command
  466.   -- previously: 'start /c /win /b cmd.exe /c 'N
  467.   cstex_reLaTeXed=1 -- information for cstex_next_error
  468. elseif action='I' then sayerror cstex_texit_background_inf
  469. endif
  470.  
  471.  
  472. DEFC cstex_preview
  473.   universal pm4epm_MasterNotFound
  474. parse arg action
  475. if action='S' then 
  476.   COMPILE IF CSTEX_USEMASTERDIR=1  -- 4.1.1997
  477.   M=pm_expansion('%M')
  478.   COMPILE ELSE
  479.   M=pm_expansion('%m')
  480.   -- it was: '%M'  and pointed out by Kroni: TeX always outputs in the current directory
  481.   -- 4.1.1997: this is now overcome by CSTEX_USEMASTERDIR
  482.   COMPILE ENDIF
  483.   -- if pm4epm_MasterNotFound=1 then return ''; endif -- you can have only .dvi file
  484.   if EXIST(M'.dvi')=0 then ErrorBox('Error','.dvi file not found. Please run (La)TeX first.'); return; endif
  485.   COMPILE IF CSTEX_USEMASTERDIR=1  -- 4.1.1997
  486.   'cmd.exe /c "'pm_expansion('%h & (cd %d)')' & start dvipm.exe @dvipm.cnf 'M'"'
  487.   COMPILE ELSE
  488.   'start dvipm.exe @dvipm.cnf ' M
  489.   COMPILE ENDIF
  490. elseif action='I' then sayerror cstex_preview_inf
  491. endif
  492.  
  493.  
  494. /*
  495. -- This version is now OBSOLETE. See the remark in the routine below.
  496. DEFPROC cstex_dvips (opts)
  497.   universal pm4epm_MasterNotFound
  498. Master=pm_expansion('%m')  -- changed from '%M'
  499. dvipsopts=pm_expansion('%optsdvips')
  500. -- if pm4epm_MasterNotFound=1 then return ''; endif
  501. if EXIST(Master'.dvi')=0 then ErrorBox('Error','.dvi file not found. Please run (La)TeX first.'); return; endif
  502. COMPILE IF CSTEX_CSTEX=1
  503. 'start /win /c /dos dvi-out -m 'Master
  504. PleaseRelax()
  505. COMPILE ENDIF
  506. -- 'cmd /c dvips 'opts' 'Master
  507. x='dvips 'dvipsopts' 'opts' 'Master
  508. sayerror x
  509. 'cmd /c 'x
  510. return Master
  511. */
  512.  
  513.  
  514. -- This version is NOW used since the program dvi-out has been compiled for OS/2
  515. DEFPROC cstex_dvips (opts,pause)
  516.   universal pm4epm_MasterNotFound
  517. Master=pm_expansion('%M')
  518. dvipsopts=pm_expansion('%optsdvips')
  519. -- if pm4epm_MasterNotFound=1 then return ''; endif
  520. if EXIST(Master'.dvi')=0 then ErrorBox('Error','.dvi file not found. Please run (La)TeX first.'); return; endif
  521. COMPILE IF CSTEX_CSTEX=1
  522.   -- 8.1.1998: Master is passed first to csdvips, and order reversed in it
  523.   WhichDvips='csdvips 'Master'.dvi 'dvipsopts' 'opts
  524. COMPILE ELSE
  525.   WhichDvips='dvips 'dvipsopts' 'opts' 'Master
  526. COMPILE ENDIF
  527. COMPILE IF CSTEX_USEMASTERDIR=1  -- 4.1.1997
  528.   if (pause=0) then -- 13.4.1997
  529. --  'cmd /c "'pm_expansion('%h & (cd %d)')' & 'WhichDvips' 'dvipsopts' 'opts' 'Master'"'
  530.   'cmd /c "'pm_expansion('%h & (cd %d)')' & 'WhichDvips'"'
  531.   else
  532. --  'start /C /WIN cmd /c "'pm_expansion('%h & (cd %d)')' & ('WhichDvips' 'dvipsopts' 'opts' 'Master') & pause"'
  533.   'start /C /WIN cmd /c "'pm_expansion('%h & (cd %d)')' & ('WhichDvips') & pause"'
  534.   endif
  535. COMPILE ELSE
  536. --  'cmd /c 'WhichDvips' 'dvipsopts' 'opts' 'Master
  537.   'cmd /c 'WhichDvips
  538. COMPILE ENDIF
  539. return Master
  540.  
  541.  
  542. DEFC cstex_texit_and_dvips
  543. parse arg action opts
  544. if action='S' then 
  545. COMPILE IF CSTEX_CSTEX=1
  546.   WhichDvips='csdvips 'pm_expansion('%m.dvi %optsdvips')
  547. COMPILE ELSE
  548.   WhichDvips='dvips 'pm_expansion('%optsdvips %m')
  549. COMPILE ENDIF
  550. 'cstex_texit_background S 'WhichDvips
  551. elseif action='I' then
  552.     sayerror cstex_texit_and_dvips_inf
  553. endif
  554.  
  555.  
  556. DEFC cstex_dvips
  557. parse arg action opts
  558. if action='S' then call cstex_dvips(opts,0); beep(440,1)
  559. elseif action='I' then sayerror cstex_dvips_inf
  560. endif
  561.  
  562.  
  563. DEFC cstex_dvips_pause
  564. parse arg action opts
  565. if action='S' then call cstex_dvips(opts,1); -- beep(440,1)
  566. elseif action='I' then sayerror cstex_dvips_inf
  567. endif
  568.  
  569.  
  570. DEFC cstex_gvpm
  571. parse arg action x
  572. if action='S' then 
  573.    Master=cstex_dvips('',0)
  574.    if Master<>'' then 'start gvpm 'Master'.ps' endif
  575. endif
  576.  
  577.  
  578. DEFC cstex_psview
  579. parse arg action x
  580. if action='S' then Master=cstex_dvips('',0); 
  581.    if Master<>'' then 'pm_command_cmd S psview.cmd %M.ps' endif
  582.    endif
  583.  
  584.  
  585. DEFC cstex_about
  586. InfoBox('This is pmCSTeX for EPM','Version 16. 4. 2000'\13\13'Developed by Petr Mikulík'\13\13'  Dept. of Solid State Physics, and'\13'  Lab. Thin Films & Nanostructures'\13'  Masaryk University'\13'  Brno, Czech Republic'\13\13'pmCSTeX for EPM resides at http://www.sci.muni.cz/~mikulik/os2/')
  587.  
  588.  
  589. DEFC cstex_view_pmCSTeXINF
  590. -- Note: this routine works if the EPM has been compiled with WANT_SEARCH_PATH
  591. s=search_path(get_env('EPMPATH'),'pmCSTeX.INF')
  592. 'start view 's'pmCSTeX.INF'
  593.  
  594.  
  595. DEFC cstex_viewINF
  596. -- if "view LaTeX2e.INF" works from the command line, then this one works too:
  597. parse arg action x
  598. if action='S' then 'start view 'x
  599. endif
  600.  
  601.  
  602. DEFC cstex_bugs
  603. WinMessageBox('This is pmCSTeX for EPM','Please address your bug reports, suggestions, comments, congratulations, improvements and solutions by e-mail to the author: mikulik@physics.muni.cz',MB_OK + MB_MOVEABLE +MB_ERROR)
  604.  
  605.  
  606. DEFC cstex_next_error
  607.   universal cstex_error_array_id, cstex_error_index, cstex_errorarray_name,
  608.         cstex_last_error_pos, cstex_no_more_errors, cstex_reLaTeXed
  609. parse arg action x
  610. if action='S' then
  611. -- 17.1.1998: enhanced for this Warning search
  612. if cstex_on_log_warning() then return; endif
  613. getfileid W
  614. COMPILE IF CSTEX_USEMASTERDIR=1  -- 4.1.1997
  615. LogName=pm_expansion('%M.log')
  616. COMPILE ELSE
  617. LogName=pm_expansion('%m.log')
  618. COMPILE ENDIF
  619. getfileid Lid, LogName
  620. if ((cstex_reLaTeXed<>0) or (cstex_no_more_errors=1)) and (Lid<>'') then 
  621. i='Y'; /* 15.5.1996: taking this annoying question away
  622.     if (cstex_reLaTeXed<>0)
  623.     then line='I think your document has been reLaTeXed. Reload .log from disk?'
  624.     else line='There are no more errors in the current .log file. Refresh it from disk?'
  625.     endif
  626.     i=AskYesNo(line);
  627. */
  628.     if i='Y' then 
  629.     activatefile Lid; .modify=0; 'xcom quit'; Lid=''; endif
  630.     endif
  631. cstex_reLaTeXed = 0
  632. if Lid='' -- .log is not in ring
  633.   then if EXIST(LogName)=0 then ErrorBox('Error',LogName' does not exist'); return; endif
  634.     'xcom edit 'LogName; top
  635.     -- delete error list if it exists
  636.     if cstex_error_index>0 
  637.       then while (cstex_error_index>1) do
  638.           do_array 4, cstex_error_array_id, cstex_error_index
  639.           cstex_error_index=cstex_error_index-1
  640.           endwhile
  641.       else if cstex_error_index<0 then -- create error list
  642.           do_array 1, cstex_error_array_id, cstex_errorarray_name
  643.           cstex_error_index=0
  644.           endif
  645.       endif
  646.   else    activatefile Lid 
  647.     if (cstex_last_error_pos<>'') then 
  648.       prestore_pos(cstex_last_error_pos)
  649.       line='x'
  650.       -- debugbox('start line='line' lasterrorpos='cstex_last_error_pos)
  651.       while (.line<.last) and (words(line)>0) do
  652.         .line=.line+1
  653.         getline line
  654.         endwhile
  655.       endif
  656.  
  657.     -- .line=.line+1
  658.   /* --This code would look whether the .log file has changed:
  659.       --  but it would require disk access... choose as you want
  660.     psave_pos(p); bot; getline lastline; top; getline firstline
  661.     .modify=0; quitfile(); activatefile W
  662.     'xcom edit 'LogName
  663.     top; getline line;    -- look at first and last line whether the file hasn't been changed
  664.     if line=firstline then
  665.       bot; getline line; top
  666.       if line=lastline then prestore_pos(p); endif  -- restore position of the last error
  667.       endif
  668.   */
  669.   endif
  670.  
  671. linenumber=.line
  672. while (linenumber<.last) do
  673.    getline line,linenumber
  674.    -- skip "Underfull " and "Overfull " lines until "[]"  (14.12.1998)
  675.    if leftstr(line,10)='Underfull ' or leftstr(line,9)='Overfull ' then
  676.     do forever
  677.       -- InfoBox('ignoring line',line)
  678.       if rightstr(line,2)='[]' then -- ending string [] found
  679.         linenumber=linenumber+1
  680.         leave; endif
  681.       linenumber=linenumber+1; getline line,linenumber
  682.       if linenumber>=.last-1 then
  683.         .line=.last
  684.         ErrorBox('Error','Very bad things detected in .log file... missing ending []')
  685.         return; endif
  686.     enddo
  687.     iterate
  688.     endif
  689.    -- skip block beginning "LaTeX Warning:" until a blank line  (14.12.1998)
  690.    if leftstr(line,14)='LaTeX Warning:' then
  691.     do forever
  692.       linenumber=linenumber+1; getline line,linenumber
  693.       if words(line)=0 then leave; endif
  694.     enddo
  695.     iterate
  696.     endif
  697.    -- line starting with '!' means brief description of the error
  698.    if leftstr(line,1)='!' then
  699.      cstex_no_more_errors=0
  700.      parse value line with '!' error
  701.      do forever 
  702.        -- begin of new after ?
  703.        linenumber=linenumber+1; getline line,linenumber
  704.        if leftstr(line,2)='l.' then leave; endif
  705.        if linenumber>=.last-1 then
  706.      .line=.last
  707.      ErrorBox('Error','Very bad things detected in .log file... (do {} match in your .tex?)')
  708.      return
  709.      endif
  710.        -- end of new after ?
  711.        /*
  712.        -- begin of the first year version
  713.        linenumber=linenumber+1; getline line,linenumber;
  714.        if leftstr(line,2)='l.' then leave; endif
  715.        -- end of the first year version
  716.        */
  717.      enddo
  718.      .line=linenumber
  719.      parse value line with 'l.'wrongline what
  720.      if words(what)>0 then what=': 'what; endif
  721.      if cstex_error_index<1 then ErrorBox('Fatal error',LogName' seems to be corrupted [or my algorithm is wrong]: () do not match'); return; endif
  722.      psave_pos(cstex_last_error_pos)
  723.      -- debugbox('SAVE lasterrorpos='cstex_last_error_pos)
  724.      do_array 3, cstex_error_array_id, cstex_error_index, line
  725.      line=translate(line,'\','/') -- convert from unix format
  726.      if pos('\',line)=0 then 
  727.     /* The line below up to 11.11.1997:
  728.     if already_in_ring(line,n) then -- Kroni: EPM always finds files which are already loaded
  729.     Now writing that explicitly; users recompiling whole EPM without E3EMUL support
  730.     switched on had problems.
  731.     */
  732.     getfileid n, line
  733.     if n<>'' then
  734.       line=n.filename
  735.     else  -- EPM requires full spec.
  736.       COMPILE IF CSTEX_USEMASTERDIR=1  -- 4.1.1997
  737.       line=pm_expansion('%d\'line)
  738.       COMPILE ELSE
  739.       line=directory()'\'line
  740.       COMPILE ENDIF
  741.       endif
  742.     endif
  743.      getfileid Wid,line
  744.      -- DebugBox('File with errors seems to be *'line'* with Wid='Wid' on wrongline='wrongline) 
  745.      if Wid='' 
  746.     then 'xcom edit 'line; getfileid Wid --; refresh; activatefile Wid; InfoBox('wait','not edited yet!') 
  747.     else activatefile Wid
  748.     endif
  749.      top
  750.      activatefile Wid
  751.      sayerror 'TeX error: 'error
  752.      if wrongline>.last 
  753.     then ErrorBox('Fatal error','Log file out of date: cannot find file 'line' or a specified line searched in it.')
  754.     else
  755.     .line=wrongline; .col=1 -- place cursor on the error
  756.     i=words(what)
  757.     if i>0 then
  758.       /* before 28.5.1996
  759.         i=wordindex(what,i); j=length(what)
  760.         .col=j
  761.         circleit 2,wrongline,i,length(what),1
  762.       */
  763.     what=substr(what,3,length(what)-2) -- delete ': '
  764.     if (substr(what,1,3)='...') 
  765.       then    what=substr(what,4,length(what)-3))
  766.         getline line
  767.         i=pos(what,line); j=i+length(what)
  768.       else    i=1; j=length(what)
  769.       endif
  770.     .col=i
  771.     circleit 4,wrongline,i,j,13,13  -- 30.1.1997+1.2.1997
  772.     -- circleit 2,wrongline,i,j,1
  773.       -- the same problem as in EPMTEX: ovals are not resistant for the first time
  774.      -- WHY DOES IT SOMETIMES GO BACK TO .LOG FILE INSTEAD OF STAYING HERE ????!!!!
  775.      -- 'xcom edit '.filename
  776.      -- debugbox('I AM HERE'.filename)
  777.      -- activatefile Wid
  778.     return
  779.     endif
  780.      return
  781.      endif -- line with !
  782.    -- count parentheses and change the list accordingly
  783.    lz=pos('(',line); pz=pos(')',line); l=length(line)
  784.    while (lz<>0) or (pz<>0) do
  785.      if (lz=0) or ((pz<lz) and (pz>0))
  786.       then -- remove the last word from the list
  787.     if cstex_error_index<1 then ErrorBox('Fatal error','Log file corrupted: () do not match, index='cstex_error_index); return; endif
  788.     do_array 3, cstex_error_array_id, cstex_error_index, x
  789.     do_array 4, cstex_error_array_id, cstex_error_index
  790.     cstex_error_index=cstex_error_index-1
  791.     pz=pos(')',line,pz+1)
  792.       else
  793.     i=verify(line,' )'\9'','M',lz+1)
  794.     if (i=pz) and (i>0)
  795.       then lz=pos('(',line,pz+1); pz=pos(')',line,pz+1)
  796.       else
  797.         nextlz=pos('(',line,lz+1)
  798.         if ((pz<nextlz) and (pz>0)) or ((pz>0) and (nextlz=0)) then pz=pos(')',line,pz+1); lz=nextlz  --(
  799.         else
  800.         if i=0 then i=l; else i=i-1; endif -- last position
  801.         cstex_error_index=cstex_error_index+1 -- add this word to the list
  802.         theword=substr(line,lz+1,i-lz)
  803.         do_array 2, cstex_error_array_id, cstex_error_index, theword
  804.         lz=nextlz
  805.         endif
  806.       endif
  807.       endif
  808.    endwhile
  809.    linenumber=linenumber+1
  810.    endwhile
  811. -- calculate Warning:
  812. .line=1; i=0;
  813. while .line<.last do
  814.   getline line; if pos('Warning:',line)>0 then i=i+1; endif; .line=.line+1; endwhile
  815. -- get last line
  816. getline line;
  817. if i>0 then line='Warnings: 'i\13\13''line; endif
  818. activatefile W
  819. sayerror ' ' -- sometimes it gives `invalid fileid', strange
  820. InfoBox('Congratulation!','No (more) errors.'\13''line) -- \13'Refresh from disk?'
  821. cstex_no_more_errors=1
  822. elseif action='I' then sayerror cstex_next_error_inf
  823. endif
  824. return
  825.  
  826.  
  827. -- written 17. 1. 1998
  828. defproc cstex_on_log_warning
  829. if (not wordpos(filetype(), 'LOG') ) then
  830.     return false  -- leave without the result
  831.     endif
  832. getline line,.line
  833. -- to parse:
  834. --     % Overfull \hbox (19.0473pt too wide) detected at line 5
  835. --    Underfull \hbox (badness 10000) in paragraph at lines 356--373
  836. --    LaTeX ...whatever.... line 138.
  837. if pos('Overfull \hbox',line)<>1 and pos('Underfull \hbox',line)<>1 and
  838.     word(line,1)<>'LaTeX' then
  839.     return false -- leave without the result
  840.     endif
  841. -- what cannot be parsed:
  842. --   XXXXfull \vbox ...
  843. if word(line,2)='\vbox' then
  844.     InfoBox('Sorry','\vbox-es cannot be localized (no line number info)')
  845.     return true
  846.     endif
  847. k=1 -- warning can be split into several lines
  848. if word(line,1)='LaTeX' 
  849.   then -- LaTeX warning is ended by '.'
  850.     line2=line
  851.     while substr(line2,length(line2),1)<>'.' do
  852.       getline line2,.line+k
  853.       line=line''line2; k=k+1
  854.     endwhile
  855.   else -- other warnings are ended by an empty line
  856.     loop 
  857.       getline line2,.line+k
  858.       if words(line2)=0 then leave; endif
  859.       line=line''line2; k=k+1
  860.     endloop
  861.   endif
  862. sayerror line
  863. -- get line numbers as the last word of the current line
  864. line=word(line,words(line))
  865. parse value line with atline1 '--' atline2    -- line number is  5  or  356--373
  866. if substr(atline1,length(atline1))='.' then    -- line number is  138.
  867.     atline1=substr(atline1,1,length(atline1)-1) endif
  868. if not isnum(atline1) or atline1<=0 then -- cannot get the line number
  869.     ErrorBox('Sorry','I cannot get the line numbers. Either wrong .log file or unknown line structure.')
  870.     return true
  871.     endif
  872. if not isnum(atline2) or atline2<atline1
  873.   then atline2=atline1; endif
  874. -- InfoBox("lines to be circled",'line1='atline1'   line2='atline2)
  875. getline errorline,.line -- remember the warning text
  876. -- Now search the file where that warning occured. It's there as  (work.tex 
  877. -- Thus find the first unbalanced (
  878. nlz=1 -- counter of left parenthneses (. We found the file when this is zero
  879. linenumber=.line-1
  880. while (linenumber>0) do
  881.   getline line,linenumber
  882.   lz=lastpos('(',line); pz=lastpos(')',line)
  883.   while (lz>0) or (pz>0) do
  884.     -- iterate over all parenthesis ( and ) on the given line---from right-hand side
  885.     if (pz>lz) then l=pz-1; nlz=nlz+1 -- found )
  886.     else    nlz=nlz-1
  887.         if nlz=0 then leave endif -- found it => leave this loop now!
  888.         l=lz-1
  889.     endif
  890.     if l<=0 then leave endif
  891.     -- search continues
  892.     lz=lastpos('(',line,l); pz=lastpos(')',line,l)
  893.     endwhile -- iteration over ()
  894.   if nlz=0 then leave endif -- found it => leave this loop now!
  895.   linenumber=linenumber-1
  896.   endwhile -- iteration over the upper lines of the log file
  897. if nlz<>0 then -- sth. wrong happened, top file reached, no result
  898.     sayerror('Mistake location was not found, sorry')
  899.     return true
  900.     endif
  901. sayerror errorline -- display the text of the problem
  902. line=word(substr(line,lz+1),1) -- that's the file with full path
  903. line=translate(line,'\','/') -- convert from unix format
  904. -- InfoBox('Result---file to be opened:',line) -- write the result
  905. getfileid Wid,line
  906. if Wid='' 
  907.   then 'xcom edit 'line; getfileid Wid,line
  908.   endif
  909. activatefile Wid
  910. Wid.line=atline1
  911. getline line,atline1
  912. -- we circle only the upper line even though we have remember the lower one too
  913. circleit 4,atline1,1,length(line),13,13
  914. return true
  915.  
  916.  
  917.  
  918.  
  919. DEFC cstex_paragraph
  920.   universal pm4epm_MasterNotFound
  921. /* Algorithn: Open master file. Copy everything till \begin{document}. Close it.
  922. Localize the paragraph in the current file. Copy it. Append \end{document}.
  923. Run LaTeX over this temporary file. Copy its .dvi to master.dvi. Copy its .log to
  924. master.log */
  925. parse arg action x
  926. if action='S' then 
  927. -- are we Master or Working file?
  928. s=pm_expansion('%.M')
  929. if pm4epm_MasterNotFound=1 then return; endif
  930. if translate(s)=translate(.filename) then WeAreMaster=1; else WeAreMaster=0; endif
  931. localdir=pm_expansion('%d')
  932. psave_pos(Wpos)
  933. getfileid W
  934. CloseMaster=0
  935. l4=.line -- line with cursor, it determines the paragraph
  936. if WeAreMaster=0
  937.   then
  938.      getfileid Mid, s
  939.      if Mid='' then CloseMaster=1; 'edit 's; getfileid Mid
  940.     else activatefile Mid; endif
  941.   else Mid=W
  942.   endif
  943. top; 'xcom L \begin{document}' -- search string
  944. -- people without \begin{document} will have troubles. Their problem, sorry
  945. l2=.line -- line with \begin{document}
  946. -- now get the first (l3) and the last (l4) line of the paragraph
  947. if marktype()='LINE' -- get the 'paragraph' from the line mark
  948. then getmark l3,l4
  949.     if WeAreMaster<>0 then
  950.       if (l2>=l3) then l3=l2+1; endif
  951.       if (l2>=l4) then l4=l2+1; endif
  952.       endif
  953. else -- get the paragraph as the 'true paragraph' separated by blank lines
  954. if WeAreMaster=1 -- first line of the current paragraph
  955.    then if (l4<=l2) then l4=l2+1 endif; stopit=l2+1;
  956.    else stopit=1;
  957.    endif
  958. l3=l4
  959. getline s, l4, W
  960. while (l3>stopit) and (words(s)>0) do l3=l3-1; getline s,l3,W; endwhile
  961. getline s,W.line,W -- last line of the current paragraph
  962. while (l4<W.last) and (words(s)>0) do l4=l4+1; getline s,l4,W; endwhile
  963. endif -- of getting the paragraph
  964. 'EDIT 'localdir'\$$cstex$.tex' -- avoid existence of $cstex$.tex file
  965. 'NAME 'localdir'\$cstex$.tex'  -- rename it. Note: we process it in the Master's directory
  966. getfileid P
  967. for i=1 to l2
  968.   getline s,i,Mid
  969.   insertline s,.last
  970.   endfor
  971. if CloseMaster=1 then activatefile Mid; quitfile(); activatefile P; endif
  972. for i=l3 to l4
  973.   getline s,i,W
  974.   insertline s,.last
  975.   endfor
  976. insertline '\end{document}',.last
  977. 'FILE'  -- save and quit
  978. sayerror 'TeXing paragraph...'
  979. activatefile W
  980. prestore_pos(Wpos)
  981. e=get_env('EMTEXOPT')
  982. if (words(e)>0) then e=e' ' endif -- cool tricks, hot stuff, 17.5.1996
  983. e=e''pm_expansion('%optsemtex')
  984. if (words(e)<>0) then e=e' /b'; else e='/b'; endif -- /batchmode
  985. /* Up to 11.11.1997: single very long command. This was causing EPM crashes when
  986.   invoked from very deep directory (EPM string length limitation).
  987. e='(set EMTEXOPT='e') & '
  988. 'pm_command_pm S /c/b/min cmd.exe /c "'e'(%h&cd %d)&(%format.cmd $cstex$.tex)&(if exist %m.dvi del %m.dvi)&(ren $cstex$.dvi %m.dvi)&(if exist %m.log del %m.log)&(ren $cstex$.log %m.log)&(del $cstex$.*>nul)"'
  989. */
  990. -- New version: making $cstex$.cmd in the Master's directory. Thus cmd.exe is invoked only once.
  991. theh=pm_expansion('%h')
  992. them=pm_expansion('%m'); thed=pm_expansion('%d')
  993. thef=pm_expansion('%format')
  994. 'EDIT 'localdir'\$$cstex$.cmd' -- avoid existence of $cstex$.cmd file
  995. 'NAME 'localdir'\$cstex$.cmd'  -- rename it
  996. insertline '@echo off'
  997. insertline 'rem Produced by pmCSTeX for EPM. Allows (La)TeXing a paragraph.'
  998. insertline 'set EMTEXOPT='e
  999. insertline theh
  1000. insertline 'cd 'thed
  1001. insertline 'call 'thef'.cmd $cstex$.tex'
  1002. insertline 'if exist 'them'.dvi del 'them'.dvi'
  1003. insertline 'ren $cstex$.dvi 'them'.dvi'
  1004. insertline 'if exist 'them'.log del 'them'.log'
  1005. insertline 'ren $cstex$.log 'them'.log'
  1006. insertline 'del $cstex$.*>nul'
  1007. sayerror 0
  1008. 'FILE'  -- save and quit
  1009. sayerror 'TeXing paragraph...'
  1010. activatefile W
  1011. prestore_pos(Wpos)
  1012. 'start /c/b/min cmd.exe /c 'localdir'\$cstex$.cmd'
  1013. sayerror 0
  1014. return
  1015. elseif action='I' then sayerror cstex_paragraph_inf
  1016. endif
  1017.  
  1018.  
  1019. DEFC cstex_master
  1020.   universal pm4epm_MasterNotFound
  1021. parse arg action
  1022. if action='S' then
  1023. Master=pm_expansion('%.M')
  1024. if pm4epm_MasterNotFound=1 then return; endif
  1025. 'xcom edit ' Master
  1026. sayerror 'This is master'
  1027. elseif action='I' then sayerror cstex_master_inf
  1028. endif
  1029.  
  1030.  
  1031.  
  1032. DEFPROC cstex_WhereExists ( Name )
  1033. s=pm_expansion('%d\'Name); -- look at Master's directory
  1034. if EXIST(s)<>0 then return s; endif
  1035. if EXIST(Name)<>0 then return Name; endif  -- look at current directory
  1036. updir=pm_expansion('%d'); -- look at Master's directory
  1037. i=lastpos('\',updir); updir=substr(updir,1,i-1);
  1038. s=updir'\units\'Name  -- there could be my .h files
  1039. if EXIST(s)<>0 then return s; endif
  1040. updir=directory(); /* current directory */ i=lastpos('\',updir); updir=substr(updir,1,i-1); 
  1041. s=updir'\units\'Name  -- there could be my .h files
  1042. if EXIST(s)<>0 then return s; endif
  1043. s='\emtex\texinput\'Name  -- there could be my .tex or .sty files
  1044. if EXIST(s)<>0 then return s; endif
  1045. s='\emx\include\'Name  -- look for GNU C/C++ files
  1046. if EXIST(s)<>0 then return s; endif
  1047. s='\emx\include\cpp\'Name  -- look for GNU C/C++ files
  1048. if EXIST(s)<>0 then return s; endif
  1049. s='\emx\include\sys\'Name  -- look for GNU C/C++ files
  1050. if EXIST(s)<>0 then return s; endif
  1051. s='\emx\include\cpp\gen\'Name  -- look for GNU C/C++ files
  1052. if EXIST(s)<>0 then return s; endif
  1053. return '' -- not found
  1054.  
  1055.  
  1056. -- the following routine withdraws the file name under cursor and (re)loads it
  1057. DEFC cstex_include
  1058. parse arg action line
  1059. if action='S' then
  1060. getline line
  1061. k=words(line)
  1062. if (k=0) or (.col>wordindex(line,k)+length(word(line,k))-1) then Beep(440,222); return; endif
  1063. i=2 -- find the word the char is in
  1064. while (i<=k) and (.col>=wordindex(line,i)) do i=i+1; endwhile --first word above cursor
  1065. i=i-1; if (i<k) and (.col>wordindex(line,i)+length(word(line,i))-1) then Beep(440,222); return; endif
  1066. --i=i-1; if i>k then i=k; elseif i<1 then i=1; endif
  1067. c=.col-wordindex(line,i)+1; line=word(line,i)
  1068. l=length(line);
  1069. -- chars that can appear in file name (English)
  1070. -- CharsInName='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@._$-\\:/'
  1071. -- chars that can appear in file name (codepage 852):
  1072. CharsInName='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@._$-╪τƒ²º∞áíéúà╖µ¼ⁿªφ╡╓ÉΘ▐\\:/'
  1073. Name=''
  1074. if c>1 then -- from cursor-1 to left
  1075.     Name=reverse(substr(line,1,c-1))
  1076.     k=verify(Name,CharsInName)
  1077.     if k=0 then Name=substr(line,1,c-1)
  1078.         else Name=substr(line,c-k+1,k-1)
  1079.         endif
  1080.   endif
  1081. k=verify(line,CharsInName,'N',c)  -- from cursor to right
  1082. if k=0 then Name=Name''substr(line,c,l-c+1)
  1083.   else Name=Name''substr(line,c,k-c)
  1084.   endif
  1085. -- the following routine tries to load Name to editor
  1086. Name=translate(Name,'\','/') -- convert from unix format
  1087. if words(Name)=0 then Beep(440,220); return; endif
  1088. getfileid Lid, Name -- is that file in ring?
  1089. if Lid<>'' then activatefile(Lid); return; endif
  1090. if EXIST(Name)<>0 then 'edit 'Name; return; endif
  1091. -- so look at some directories. List your favourite ones here:
  1092. if substr(Name,1,1)='\\' then Name=substr(Name,2,length(Name)-1); endif
  1093. s=pm_expansion('%d\'Name);
  1094. --TODO!        InfoBox('Helo s=','**'s'**') --PM1906
  1095. s=directory()'\'Name; 
  1096. --TODO!        InfoBox('Helo name=','**'Name'**') --PM1906
  1097. s=cstex_WhereExists(Name)
  1098. if s='' then s=cstex_WhereExists(Name'.h') 
  1099.   if s='' then s=cstex_WhereExists(Name'.cpp') 
  1100.   if s='' then s=cstex_WhereExists(Name'.cxx') 
  1101.   if s='' then s=cstex_WhereExists(Name'.sty') 
  1102.   if s='' then s=cstex_WhereExists(Name'.tex') 
  1103.   if s='' then s=cstex_WhereExists(Name'.dtx') 
  1104.   if s='' then s=cstex_WhereExists(Name'.pas') 
  1105.   if s='' then s=cstex_WhereExists(Name'.txt') 
  1106.   if s='' then s=cstex_WhereExists(Name'.doc') 
  1107. endif endif endif endif endif endif endif endif endif
  1108. /*  -- this is old, explicit version
  1109. if EXIST(s)=0 then s=pm_expansion('%d\'Name); -- look at Master's directory
  1110. if EXIST(s)=0 then
  1111. updir=directory(); i=lastpos('\',updir); updir=substr(updir,1,i-1);
  1112. s=updir'\units\'Name  -- there could be my .h files
  1113. if EXIST(s)=0 then s='\emtex\texinput\'Name  -- there could be my .tex or .sty files
  1114. if EXIST(s)=0 then s='\emx\include\'Name  -- look for GNU C/C++ files
  1115. if EXIST(s)=0 then s='\emx\include\cpp\'Name  -- look for GNU C/C++ files
  1116. if EXIST(s)=0 then s='\emx\include\sys\'Name  -- look for GNU C/C++ files
  1117. if EXIST(s)=0 then s='\emx\include\cpp\gen\'Name  -- look for GNU C/C++ files
  1118. endif endif endif endif endif endif endif
  1119. */
  1120. -- now open it if exists
  1121. getfileid Lid, s -- is that file in ring?
  1122. if Lid<>'' then activatefile(Lid); return; endif
  1123. if EXIST(s)<>0
  1124.   then 'edit 's; 
  1125.   else ErrorBox('Sorry','File 'Name' not found.'\13\13'You can try to edit CSTeX.e, routines cstex_WhereExists and cstex_include, to supply your favourite paths and extensions.')
  1126.   endif
  1127. elseif action='I' then sayerror cstex_include_inf
  1128. endif
  1129.  
  1130.  
  1131. /* Cykl is obsolete now
  1132. DEFC cstex_cykl
  1133.   universal pm4epm_MasterNotFound
  1134. parse arg action
  1135. if action='S' then
  1136. -- 'pm_command_cmd S cykl! %.W call %format.cmd %.N'
  1137. x=pm_expansion('%.W call %format.cmd %.N')
  1138. if pm4epm_MasterNotFound=1 then return; endif
  1139. 'pm_command_cmd S cykl! 'x
  1140. endif
  1141. */
  1142.  
  1143.  
  1144. DEFPROC RefreshCurrentFile ()
  1145. --ct = windowmessage(1,  getpminfo(EPMINFO_EDITFRAME),
  1146. --     5505,        -- EPM_EDIT_KW_QUERYPARSE
  1147. --     0,0)  -- returns 0 / 1 if syntax highl. off/on
  1148. -- InfoBox('myinfo','Keyword parsing is' ct)
  1149. psave_pos(x); .modify=0
  1150. 'xcom edit /d '.filename
  1151. getfileid fid
  1152. prevfile; 'xcom quit'
  1153. activatefile fid; prestore_pos(x)
  1154. return
  1155.  
  1156.  
  1157. DEFC cstex_refresh
  1158. parse arg action
  1159. if action='S' then
  1160. x=AskYesNo( 'Refresh current file' .filename' ?')
  1161. if x<>'Y' then return; endif
  1162. RefreshCurrentFile()
  1163. elseif action='I' then sayerror cstex_refresh_inf
  1164. endif
  1165.  
  1166.  
  1167. DEFC cstex_highlight_all
  1168. parse arg action
  1169. if action='S' then
  1170. n=filesinring()
  1171. for i=1 to n
  1172.   nextfile        -- 23.1.1997: nextfile + toggle is works, otherwise badly.
  1173.   'a_togl_hilit S'  -- It seems that 'a_togl_hilit S' is multi-threaded, so up
  1174.   endfor        -- to now the last nextfile was not executed.
  1175. sayerror ' '
  1176. elseif action='I' then sayerror cstex_highlight_all_inf
  1177. endif
  1178.  
  1179.  
  1180. DEFC cstex_save_all
  1181. parse arg action x
  1182. if action = 'S' then
  1183.   sayerror ''
  1184.   call save_the_ring()
  1185. elseif action='I' then sayerror cstex_save_all_inf
  1186. endif
  1187.  
  1188.  
  1189. COMPILE IF CSTEX_CSTEX=1
  1190.  
  1191. COMPILE IF CSTEX_CS2CS=1
  1192. DEFC CStoCS
  1193. -- CS2CS using OS/2 program
  1194. w=.filename -- pm_expansion('%.W') -- 4.1.1997
  1195. 'save 'w  -- save
  1196. CP='*CP852        (PC Latin II - CP 852)*KEYBCS2     (podle Kamenickych)*CP850        (PC Latin I - CP 850)*IBM852      (Latin II - IBM 852)*ISO-8859-1  (ISO-8859-1 Latin 1)*ISO-8859-2  (ISO-8859-2 Latin 2)*TEX1         (TeX, \v{C})*TEX2         (TeX, \v C)*CORKY        (podle Corky)*CP1250       (MS-Windows - CP 1250)*KOI8-CS      (KOI8-CS)*MAC          (Macintosh)*'
  1197. iCP='*autodetect'CP
  1198. iCP=listbox('Input encoding',iCP,,20,22,13,45)  -- pos1,pos2,height,width
  1199. if iCP='' then return; endif
  1200. iCP=word(iCP,1)
  1201. CP=CP'ASCII        (bez diakritiky)'
  1202. CP=listbox('Output encoding',CP,,20,22,13,45)  -- pos1,pos2,height,width
  1203. if CP='' then return; endif
  1204. CP=word(CP,1)
  1205. if (iCP='autodetect') 
  1206.   then 'cs2cs -s 'w' -o'CP' -w';
  1207.   else 'cs2cs -s 'w' -i'iCP' -o'CP' -w'; endif
  1208. RefreshCurrentFile()
  1209. return
  1210.  
  1211. COMPILE ELSE
  1212.  
  1213. DEFPROC CS1toCS2 ( From, ToTo )
  1214. -- CStoCS using DOS program
  1215. w=.filename -- pm_expansion('%.W') -- 4.1.1997
  1216. 'save 'w  -- save
  1217. -- 'start /win /c /dos cstocs -'From' 'w' -'ToTo' 'w
  1218. -- or: 'pm_command_dos S cstocs -'From' 'w' -'ToTo' 'w
  1219. getfileid fid
  1220. 'edit $.Untitled$'
  1221. .filename='$cstex$.bat'
  1222. s=get_env('EMTEXDIR')'\cstocs.exe'
  1223. if EXIST(s) <> 0
  1224.   then insertline s' -'From' 'w' -'ToTo' 'w
  1225.   else insertline 'cstocs -'From' 'w' -'ToTo' 'w
  1226.   endif
  1227. insertline 'pause'
  1228. 'FILE'
  1229. sayerror ''
  1230. 'start /c /win /dos /f $cstex$.bat'
  1231. activatefile fid
  1232. PleaseRelax()
  1233. 'start /c /b cmd /c del $cstex$.bat'
  1234. RefreshCurrentFile()
  1235. return
  1236. DEFC CStoCS
  1237. parse arg action From ToTo
  1238. if action='S' then
  1239.   CS1toCS2(From,ToTo)
  1240.   endif
  1241.  
  1242. COMPILE ENDIF
  1243.  
  1244.  
  1245. /* obsolete: using the DOS version vlnka.exe:
  1246. DEFC Vlnkax
  1247. parse arg action
  1248. if action='S' then
  1249. w=.filename -- pm_expansion('%.W') -- 4.1.1997
  1250. 'save 'w
  1251. s=get_env('EMTEXDIR')'\vlnka.exe'
  1252. if EXIST(s) <> 0
  1253.   then 'start /win /c /dos 's' 'w' KkOoUuVvSsZzAI'
  1254.   else 'start /win /c /dos vlnka 'w' KkOoUuVvSsZzAI'
  1255.   endif
  1256. -- or: 'pm_command_dos S vlnka 'w' KkOoUuVvSsZzAI'
  1257. --'os2 (cmd /c vlnka 'w' KkOoUuVvSsZzAI) & exit'
  1258. PleaseRelax()
  1259. RefreshCurrentFile()
  1260. endif
  1261. */
  1262.  
  1263.  
  1264. /*
  1265. -- Obsolete: now using the OS/2 version vlnka2.exe:
  1266. DEFC Vlnkax
  1267. parse arg action
  1268. if action='S' then
  1269. w=.filename -- pm_expansion('%.W') -- 4.1.1997
  1270. 'save 'w
  1271. s=get_env('EMTEXDIR')'\vlnka2.exe'
  1272. if EXIST(s) <> 0
  1273.   then s' 'w' KkOoUuVvSsZzAI'
  1274.   else 'vlnka2 'w' KkOoUuVvSsZzAI'
  1275.   endif
  1276. RefreshCurrentFile()
  1277. endif
  1278. */
  1279.  
  1280.  
  1281. -- now using the OS/2 version of vlna.exe (2. 4. 2000):
  1282. DEFC Vlnkax
  1283. parse arg action
  1284. if action='S' then
  1285. w=.filename -- pm_expansion('%.W') -- 4.1.1997
  1286. 'save 'w
  1287. s=get_env('EMTEXDIR')'\vlna.exe'
  1288. if EXIST(s) <> 0
  1289.   then s' -l 'w
  1290.   else 'vlna -l 'w
  1291.   endif
  1292. RefreshCurrentFile()
  1293. endif
  1294.  
  1295.  
  1296. DEFC csTeXspell
  1297. parse arg action dict
  1298. if action='S' then
  1299. w=.filename -- pm_expansion('%.W') -- 4.1.1997
  1300. 'save 'w
  1301. s=get_env('EMTEXDIR')'\cstug\texspell.exe'
  1302. if EXIST(s) = 0 then ErrorBox('Error','Program 's' not found.'); return; endif
  1303. 'start /win /c /dos 's' 'w' @L ='dict
  1304. PleaseRelax()
  1305. RefreshCurrentFile()
  1306. endif
  1307. COMPILE ENDIF
  1308.  
  1309.  
  1310. DEFC cstex_dviout2
  1311. parse arg action param
  1312. if action='S' then
  1313. if (param<>'') then param=param' ' endif
  1314. 'pm_command_os2 S cmd /c "%h & (cd %d) & (dvi-out2 'param'%M.dvi) & pause"'
  1315. endif
  1316.  
  1317.  
  1318. DEFC worldBibTeXx
  1319. parse arg action
  1320. if action='S' then
  1321. 'pm_command_os2 S cmd /c "%h & (cd %d) & 'worldbibtex' %M & pause"'
  1322. endif
  1323.  
  1324.  
  1325. DEFC csBibTeXx
  1326. parse arg action
  1327. if action='S' then
  1328. --'pm_command_os2 S 'csbibtex' /p /and %M'
  1329. --'pm_command_os2fs S cmd /c "'csbibtex' /p /and %M & pause"'
  1330. --'pm_command_os2 S 'csbibtex' /f=$(EMTEXDIR)\data\csbibtex\pclatin2.alp /and %M'
  1331. COMPILE IF CSTEX_USEMASTERDIR=1  -- 4.1.1997
  1332. 'pm_command_os2 S cmd /c "%h & (cd %d) & 'csbibtex' /p /and %M & pause"'
  1333. COMPILE ELSE
  1334. 'pm_command_os2 S cmd /c "'csbibtex' /p /and %M & pause"'
  1335. COMPILE ENDIF
  1336. endif
  1337.  
  1338.  
  1339. DEFC DoMakeindex
  1340. parse arg action
  1341. if action='S' then
  1342. 'pm_command_cmd S "%h & (cd %d) & 'worldindex' %optsmakeindex %M & pause"'
  1343. endif
  1344.  
  1345. DEFC DoCsMakeindex
  1346. parse arg action
  1347. if action='S' then
  1348. -- Sorry, but DOS does not support:
  1349. -- 'pm_command_dos S "%h & (cd %d) & 'csindex' -z latin2 %optsmakeindex %M & pause"'
  1350. 'pm_command_dos S 'csindex' -z latin2 %optsmakeindex %M'
  1351. endif
  1352.  
  1353.  
  1354. DEFC cstex_texclean
  1355. COMPILE IF CSTEX_USEMASTERDIR -- 4.1.1997
  1356. 'start /c /win cmd /c "'pm_expansion('%h & (cd %d)')' & for %i in (*.aux *.log *.dlg *.dvi *.toc *.lot *.lof *.blg *.idx *.ind *.glo *.gls *.hp *.mfj *.pri *.bak *~ *.lj *.dj *.fx *.ljh *.djh) do del %i >nul 2>nul"'
  1357. COMPILE ELSE
  1358. 'start /c /win cmd /c "for %i in (*.aux *.log *.dlg *.dvi *.toc *.lot *.lof *.blg *.idx *.ind *.glo *.gls *.hp *.mfj *.pri *.bak *~ *.lj *.dj *.fx *.ljh *.djh) do del %i >nul 2>nul"'
  1359. COMPILE ENDIF
  1360.  
  1361.  
  1362. DEFC cstex_printmy
  1363. parse arg action myprt outfile
  1364. COMPILE IF CSTEX_USEMASTERDIR -- 4.1.1997
  1365. if action='S' then 'pm_command_cmd S "%h & (cd %d) & 'myprt' // %viewopts %M 'outfile'"'
  1366. COMPILE ELSE
  1367. if action='S' then 'pm_command_cmd S 'myprt' // %viewopts %M 'outfile
  1368. COMPILE ENDIF
  1369. endif
  1370.  
  1371.  
  1372. DEFC cstex_printpm
  1373. parse arg action cnf
  1374. COMPILE IF CSTEX_USEMASTERDIR -- 4.1.1997
  1375. if action='S' then 'pm_command_cmd S "%h & (cd %d) & dvipm.exe @'cnf'.cnf // %viewopts %M"'
  1376. COMPILE ELSE
  1377. if action='S' then 'pm_command_pm S dvipm.exe @'cnf'.cnf // %viewopts %M'
  1378. COMPILE ENDIF
  1379. endif
  1380.  
  1381.  
  1382. DEFC cstex_printfs
  1383. parse arg action cnf
  1384. COMPILE IF CSTEX_USEMASTERDIR -- 4.1.1997
  1385. if action='S' then 'pm_command_os2fs S "cmd /c ""%h & (cd %d) & dviscr7.exe @'cnf'.cnf // %viewopts %M"""'
  1386. COMPILE ELSE
  1387. if action='S' then 'pm_command_os2fs S dviscr7.exe @'cnf'.cnf // %viewopts %M'
  1388. COMPILE ENDIF
  1389. endif
  1390.  
  1391.  
  1392. DEFPROC cstex_print ( hpljcnf, outfile )
  1393. COMPILE IF CSTEX_USEMASTERDIR -- 4.1.1997
  1394. 'pm_command_cmd S "%h & (cd %d) & dvi'hpljcnf'.cnf // %viewopts %M 'outfile'"'
  1395. COMPILE ELSE
  1396. 'pm_command_os2 S dvi'hpljcnf'.cnf // %viewopts %M 'outfile
  1397. COMPILE ENDIF
  1398. DEFC cstex_print
  1399. parse arg action args
  1400. if action='S' then cstex_print(args,'prn')
  1401. endif
  1402. DEFC cstex_printfile
  1403. parse arg action args
  1404. if action='S' then cstex_print(args,'%M.pri')
  1405. endif
  1406.  
  1407.  
  1408. COMPILE IF PM_DICTIONARIES=1
  1409.  
  1410. DEFC pm_change_dictionary
  1411.    universal  ADDENDA_FILENAME
  1412.    universal  DICTIONARY_FILENAME
  1413. parse arg action which
  1414. if action='S' then
  1415. e=get_env('EPM_DICTIONARIES')
  1416. if (e='') then e='\apps\epm\';
  1417.      else if (substr(e,length(e),1)<>'\') then e=e'\' endif
  1418.      endif
  1419. dic=e''which'.dic'
  1420. if not(EXIST(dic)) then 
  1421.   ErrorBox('Sorry---Error','Cannot find file 'dic'. Please copy the dictionary 'which'.dic into the directory specified by EPM_DICTIONARIES.'); return; endif
  1422. DICTIONARY_FILENAME=dic
  1423. dic=e''which'.adl'
  1424. if not(EXIST(dic)) then 
  1425.   InfoBox('Warning','Cannot find file 'dic'. This is your personal dictionary, thus maybe this does not exist yet ('which'.adl should be in the directory specified by EPM_DICTIONARIES).'); endif
  1426. ADDENDA_FILENAME=dic
  1427. endif
  1428. COMPILE ENDIF
  1429.  
  1430.  
  1431. /*************************** BUILD CSTEX MENU *********************/
  1432.  
  1433. DEFC BuildCSTeXMenu
  1434.    universal  defaultmenu,
  1435.           app_hini
  1436.         ,DICTIONARY_FILENAME
  1437.  
  1438. defaultmenu = 'default'
  1439.  
  1440. -- Note for accelkeys: 'cstex_texit'1\'Preview Document'\9'Sh+F11'
  1441.  
  1442.  
  1443. idcount = 6940 -- start value of counter of ids
  1444. cstexid = 1969 -- registration id of the CSTeX menu
  1445.  
  1446. /*
  1447. Cykl is obsolete now
  1448. cstex_cykl_inf = '(La)TeX forever on the master file when working file changed'
  1449. */
  1450.  
  1451. id=idcount  --    Note: center hotkeys right: 'Texujx'\9'Sh+F12'
  1452. buildsubmenu defaultmenu, cstexid, 'CS~TeX', \1'Menu for (La)TeXing', 0,0
  1453. id=id+1; buildmenuitem defaultmenu, cstexid, id, '(La)TeX document', 'cstex_texit S'\1''cstex_texit_inf, 0,0
  1454. id=id+1; buildmenuitem defaultmenu, cstexid, id, '(La)TeX paragraph',  'cstex_paragraph S'\1''cstex_paragraph_inf, 0,0
  1455. id=id+1; buildmenuitem defaultmenu, cstexid, id, '(La)TeX + dvips'\9'Ctrl+F11', 'cstex_texit_and_dvips S'\1''cstex_texit_and_dvips_inf, 0,0
  1456. /* Cykl is obsolete now
  1457. id=id+1; buildmenuitem defaultmenu, cstexid, id, 'Cykl! (La)TeX document', 'cstex_cykl S'\1''cstex_cykl_inf, 0,0
  1458. */
  1459. id=id+1; buildmenuitem defaultmenu, cstexid, id, \0, '', 4, 0 -- hline
  1460. id=id+1; buildmenuitem defaultmenu, cstexid, id, '(La)TeX document /b'\9'Shift+F11', 'cstex_texit_background S'\1''cstex_texit_background_inf, 0,0
  1461. id=id+1; buildmenuitem defaultmenu, cstexid, id, 'Locate ~Next Error'\9'Shift+F12', 'cstex_next_error S'\1''cstex_next_error_inf, 0,0
  1462. -- id=id+1; buildmenuitem defaultmenu, cstexid, id, 'Reload .~log file',  'pm_expand S edit /d %M.log'\1'pm_expand S edit /d %M.log', 0,0
  1463. id=id+1; buildmenuitem defaultmenu, cstexid, id, \0, '', 4, 0 -- hline
  1464. id=id+1; buildmenuitem defaultmenu, cstexid, id, '~View document', 'cstex_preview S'\1''cstex_preview_inf, 0,0  
  1465. id=id+1; buildmenuitem defaultmenu, cstexid, id, 'Post~Script',  ' '\1'PostScript actions', 64+17,0
  1466.   id=id+1; buildmenuitem defaultmenu, cstexid, id, '~dvips-it',  'cstex_dvips S'\1'Run dvips', 0,0
  1467.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'dvips + GhostV~iew',  'cstex_gvpm S'\1'Run dvips and then gvpm (GhostView for OS/2 PM)', 0,0
  1468.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'dvips + psview',  'cstex_psview S'\1'Run dvips and then psview.cmd (ANSI "GhostView" for OS/2)', 0,0
  1469.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'print from dvips',  'cstex_dvips S -o prn'\1'Run dvips, output to prn', 0,0
  1470.   id=id+1; buildmenuitem defaultmenu, cstexid, id, \0, '', 4, 0 -- hline
  1471.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'dvips-it + pause',  'cstex_dvips_pause S'\1'Run dvips', 32768+1,0
  1472. id=id+1; buildmenuitem defaultmenu, cstexid, id, \0, '', 4, 0 -- hline
  1473. id=id+1; buildmenuitem defaultmenu, cstexid, id, 'PM Preview before print', ' '\1'Preview document by dvipm with @_theprinter_.cnf and VIEWOPTS:',17+64,0
  1474.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'HP LJ 300 dpi', 'cstex_printpm S lj'\1'using @lj.cnf', 0,0
  1475.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'HP LJ 600 dpi', 'cstex_printpm S ljh'\1'using @ljh.cnf', 0,0
  1476.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'HP DeskJet 300 dpi', 'cstex_printpm S dj'\1'using @dj.cnf', 0,0
  1477.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'HP DeskJet 600 dpi', 'cstex_printpm S djh'\1'using @djh.cnf', 0,0
  1478. --  id=id+1; buildmenuitem defaultmenu, cstexid, id, 'Stylus', 'cstex_printpm S sty'\1'using @sty.cnf', 0,0
  1479.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'Epson FX1050', 'cstex_printpm S fx1050'\1'using @fx1050.cnf', 0,0
  1480.   id=id+1; buildmenuitem defaultmenu, cstexid, id, \0, '', 4, 0 -- hline
  1481.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'myprt1', 'cstex_printpm S myprt1'\1"using user's @myprt1.cnf", 0,0
  1482.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'myprt2', 'cstex_printpm S myprt2'\1"using user's @myprt2.cnf", 32768+1,0
  1483. id=id+1; buildmenuitem defaultmenu, cstexid, id, 'FS Preview before print', ' '\1'Preview document by dviscr with @_theprinter_.cnf and VIEWOPTS:',17+64,0
  1484.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'HP LJ 300 dpi', 'cstex_printfs S lj'\1'using @lj.cnf', 0,0
  1485.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'HP LJ 600 dpi', 'cstex_printfs S ljh'\1'using @ljh.cnf', 0,0
  1486.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'HP DeskJet 300 dpi', 'cstex_printfs S dj'\1'using @dj.cnf', 0,0
  1487.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'HP DeskJet 600 dpi', 'cstex_printfs S djh'\1'using @djh.cnf', 0,0
  1488. --  id=id+1; buildmenuitem defaultmenu, cstexid, id, 'Stylus', 'cstex_printfs S sty'\1'using @sty.cnf', 0,0
  1489.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'Epson FX1050', 'cstex_printfs S dot7 fx1050'\1'using fx1050.cnf @fx1050.cnf', 0,0
  1490.   id=id+1; buildmenuitem defaultmenu, cstexid, id, \0, '', 4, 0 -- hline
  1491.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'myprt1', 'cstex_printfs S myprt1'\1"using user's @myprt1.cnf", 0,0
  1492.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'myprt2', 'cstex_printfs S myprt2'\1"using user's @myprt2.cnf", 32768+1,0
  1493. id=id+1; buildmenuitem defaultmenu, cstexid, id, '~Print document', ' '\1'Print the document',17+64,0
  1494.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'HP LJ 300 dpi', 'cstex_print S hplj @lj'\1'dvihplj @lj.cnf', 0,0
  1495.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'HP LJ 600 dpi', 'cstex_print S hplj @ljh'\1'dvihplj @ljh.cnf', 0,0
  1496.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'HP DeskJet 300 dpi', 'cstex_print S hplj @dj'\1'dvihplj @dj.cnf', 0,0
  1497.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'HP DeskJet 600 dpi', 'cstex_print S hplj @dj'\1'dvihplj @djh.cnf', 0,0
  1498. --  id=id+1; buildmenuitem defaultmenu, cstexid, id, 'Stylus', 'cstex_print S dot sty.dot @sty'\1'dvidot sty.dot @sty.cnf', 0,0
  1499.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'Epson FX1050', 'cstex_print S dot7 fx1050.dot @fx100'\1'dvidot7 fx1050.dot @fx1050.cnf', 0,0
  1500.   id=id+1; buildmenuitem defaultmenu, cstexid, id, \0, '', 4, 0 -- hline
  1501.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'myprt1', 'cstex_printmy S myprt1'\1"using user's myprt1.cmd", 0,0
  1502.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'myprt2', 'cstex_printmy S myprt2'\1"using user's myprt2.cmd", 32768+1,0
  1503. id=id+1; buildmenuitem defaultmenu, cstexid, id, 'Print to ~file', ' '\1'Print document to file _Master_.pri',17+64,0
  1504.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'HP LJ 300 dpi', 'cstex_printfile S hplj @lj'\1'dvihplj @lj.cnf', 0,0
  1505.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'HP LJ 600 dpi', 'cstex_printfile S hplj @ljh'\1'dvihplj @ljh.cnf', 0,0
  1506.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'HP DeskJet 300 dpi', 'cstex_printfile S hplj @dj'\1'dvihplj @dj.cnf', 0,0
  1507.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'HP DeskJet 600 dpi', 'cstex_printfile S hplj @djh'\1'dvihplj @djh.cnf', 0,0
  1508. --  id=id+1; buildmenuitem defaultmenu, cstexid, id, 'Stylus', 'cstex_printfile S dot sty.dot @sty'\1'dvidot sty.dot @sty.cnf', 0,0
  1509.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'Epson FX1050', 'cstex_printfile S dot7 fx1050.dot @fx100'\1'dvidot7 fx1050.dot @fx1050.cnf', 0,0
  1510.   id=id+1; buildmenuitem defaultmenu, cstexid, id, \0, '', 4, 0 -- hline
  1511.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'myprt1', 'cstex_printmy S myprt1 %M.pri'\1"using user's myprt1.cmd", 0,0
  1512.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'myprt2', 'cstex_printmy S myprt2 %M.pri'\1"using user's myprt2.cmd", 32768+1,0
  1513. id=id+1; buildmenuitem defaultmenu, cstexid, id, \0, '', 4, 0 -- hline
  1514. COMPILE IF CSTEX_CSTEX=1
  1515. id=id+1; buildmenuitem defaultmenu, cstexid, id, 'Tie (vlnka)',  'Vlnkax S'\1'P²idání vlnek za p²edloºky', 0,0
  1516. COMPILE IF CSTEX_CS2CS=1
  1517. id=id+1; buildmenuitem defaultmenu, cstexid, id, 'CStoCS',  'CStoCS S'\1'Czech encodings conversion using program cs2cs.exe', 0, 0
  1518. COMPILE ELSE
  1519. id=id+1; buildmenuitem defaultmenu, cstexid, id, 'CStoCS',  ' '\1'Czech encodings conversion using program cstocs.exe', 17+64, 0
  1520.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'Kameniƒtí to PC-Latin 2', 'CStoCS S i1 o2', 0,0
  1521.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'PC-Latin2 to Kameniƒtí', 'CStoCS S i2 o1', 0,0
  1522.   id=id+1; buildmenuitem defaultmenu, cstexid, id, \0, '', 4, 0 -- hline
  1523.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'ISO8859-Latin 2 to PC-Latin2', 'CStoCS S i3 o2', 0,0
  1524.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'PC-Latin2 to ISO8859-Latin 2', 'CStoCS S i2 o3', 0,0
  1525.   id=id+1; buildmenuitem defaultmenu, cstexid, id, \0, '', 4, 0 -- hline
  1526.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'PC-Latin2 to TeX sequencies', 'CStoCS S i2 o0', 0,0
  1527.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'TeX sequencies to PC-Latin2', 'CStoCS S i0 o2', 0,0
  1528.   id=id+1; buildmenuitem defaultmenu, cstexid, id, \0, '', 4, 0 -- hline
  1529.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'Strip accents from PC-Latin2', 'CStoCS S i2 a', 32768+1,0
  1530. COMPILE ENDIF
  1531. id=id+1; buildmenuitem defaultmenu, cstexid, id, 'Spell (CSTUG)', ' '\1'DOS spell-checker, only for registered CSTUG members', 17+64, 0
  1532.   id=id+1; buildmenuitem defaultmenu, cstexid, id, '~Czech', 'csTeXspell S C', 0,0
  1533.   id=id+1; buildmenuitem defaultmenu, cstexid, id, '~Slovak', 'csTeXspell S S', 0,0
  1534.   id=id+1; buildmenuitem defaultmenu, cstexid, id, '~English', 'csTeXspell S A', 32768+1,0
  1535. id=id+1; buildmenuitem defaultmenu, cstexid, id, \0, '', 4, 0 -- hline  
  1536. COMPILE ENDIF
  1537. id=id+1; buildmenuitem defaultmenu, cstexid, id, '~Other TeX programs', ' '\1'Some additional programs', 17+64, 0
  1538.   id=id+1; buildmenuitem defaultmenu, cstexid, id, '~BibTeX', 'worldBibTeXx S'\1''worldBibTeX' program', 0,0 
  1539. --  id=id+1; buildmenuitem defaultmenu, cstexid, id, 'Make~Index', 'pm_command_os2 S 'worldindex'  %M'\1''worldindex' program (make index of course)', 0,0 
  1540.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'Make~Index', 'DoMakeindex S'\1''worldindex' program (make index of course)', 0,0 
  1541.   id=id+1; buildmenuitem defaultmenu, cstexid, id, '~TeXCAD', 'start /c /fs /dos command.com /c texcad'\1'TeXCAD drawing program', 0,0 
  1542. COMPILE IF CSTEX_CSTEX
  1543.   id=id+1; buildmenuitem defaultmenu, cstexid, id, '~Qfig','start /c /fs /dos command.com /c qfig'\1'Qfig drawing program',0,0
  1544.   id=id+1; buildmenuitem defaultmenu, cstexid, id, \0, '', 4, 0 -- hline  
  1545.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'csBibTeX', 'csBibTeXx S'\1''csBibTeX' program', 0,0 
  1546. --  id=id+1; buildmenuitem defaultmenu, cstexid, id, 'csMakeIndex', 'pm_command_dos S 'csindex' -z latin2 %M'\1''csIndex' program (index, rejst²íky)', 0,0 
  1547.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'csMakeIndex', 'DoCsMakeindex S'\1''csIndex' program (index, rejst²íky)', 0,0 
  1548. --  id=id+1; buildmenuitem defaultmenu, cstexid, id, 'DVI-Out cs->cm', 'pm_command_dos S dvi-out %M'\1'Convert 8bit cs-fonts to 7bit cm-fonts', 0,0
  1549. --  id=id+1; buildmenuitem defaultmenu, cstexid, id, 'DVI-Out cm->cs', 'pm_command_dos S dvi-out -m %M'\1'Convert 7bit cm-fonts to 8bit cs-fonts', 32768+1,0
  1550.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'DVI-Out cs->cm', 'cstex_dviout2 S'\1'Convert 8bit cs-fonts to 7bit cm-fonts', 0,0
  1551.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'DVI-Out cm->cs', 'cstex_dviout2 S -m'\1'Convert 7bit cm-fonts to 8bit cs-fonts', 32768+1,0
  1552. COMPILE ELSE
  1553.   id=id+1; buildmenuitem defaultmenu, cstexid, id, '~Qfig','start /c /fs /dos command.com /c qfig'\1'Qfig drawing program', 32768+1,0
  1554. COMPILE ENDIF
  1555.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'Te~Xclean', 'cstex_texclean S'\1'Clean all garbage files', 0,0 
  1556. id=id+1; buildmenuitem defaultmenu, cstexid, id, '~Editor', ' '\1'EPM related commands', 17+64, 0 
  1557.   id=id+1; buildmenuitem defaultmenu, cstexid, id, '~Master', 'cstex_master S'\1''cstex_master_inf, 0,0 
  1558.   id=id+1; buildmenuitem defaultmenu, cstexid, id, '~Include', 'cstex_include S'\1''cstex_include_inf, 0,0 
  1559.   id=id+1; buildmenuitem defaultmenu, cstexid, id, '~Refresh', 'cstex_refresh S'\1''cstex_refresh_inf, 0,0 
  1560.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'Save ~all', 'cstex_save_all S'\1''cstex_save_all_inf, 0,0 
  1561. id=id+1; buildmenuitem defaultmenu, cstexid, id, '~Syntax highlighting', '', 32768 +17+64, 0
  1562.   id=id+1; buildmenuitem defaultmenu, cstexid, id, '~Auto current file', 'a_togl_hilit S', 0,0 
  1563.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'Auto a~ll files', 'cstex_highlight_all S'\1''cstex_highlight_all_inf, 0,0 
  1564.   id=id+1; buildmenuitem defaultmenu, cstexid, id, '~C/C++ current file', 'toggle_parse 1 epmkwds.c', 0,0 
  1565.   id=id+1; buildmenuitem defaultmenu, cstexid, id, '~TeX current file', 'toggle_parse 1 epmkwds.tex', 32768+1,0 
  1566. COMPILE IF PM_DICTIONARIES=1
  1567. id=id+1; buildmenuitem defaultmenu, cstexid, id, 'Spell~-checker', ' '\1'Change EPM spell-checker dictionary 'DICTIONARY_FILENAME, 17+64, 0 
  1568.   id=id+1; buildmenuitem defaultmenu, cstexid, id, '~francais', 'pm_change_dictionary S FR'\1'', 0,0 
  1569.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'U~K English', 'pm_change_dictionary S UK'\1'', 0,0 
  1570.   id=id+1; buildmenuitem defaultmenu, cstexid, id, '~deutsch', 'pm_change_dictionary S GR'\1'', 0,0 
  1571.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'U~S English', 'pm_change_dictionary S US'\1'', 0,0 
  1572. --  id=id+1; buildmenuitem defaultmenu, cstexid, id, '~Italiano', 'pm_change_dictionary S IT'\1'', 32768+1,0 
  1573.   id=id+1; buildmenuitem defaultmenu, cstexid, id, '~Espagnol', 'pm_change_dictionary S SP'\1'', 32768+1,0 
  1574. COMPILE ENDIF
  1575. id=id+1; buildmenuitem defaultmenu, cstexid, id, \0, '', 4, 0 -- hline 
  1576. id=id+1; buildmenuitem defaultmenu, cstexid, id, '~About pmCSTeX for EPM', 'cstex_about'\1'Info about the current version of pmCSTeX', 0,0
  1577. -- id=id+1; buildmenuitem defaultmenu, cstexid, id, 'View documentation', 'cstex_viewINF'\1'View the pmCSTeX.INF hypertext documentation', 0,0
  1578. id=id+1; buildmenuitem defaultmenu, cstexid, id, 'View documentation', ' '\1'Browse the pmCSTeX.INF or LaTeX2e.INF hypertext documentation', 17+64, 0 
  1579.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'for pmCSTeX', 'cstex_view_pmCSTeXINF'\1'View pmCSTeX.INF', 0,0
  1580.   id=id+1; buildmenuitem defaultmenu, cstexid, id, \0, '', 4, 0 -- hline  
  1581. COMPILE IF CSTEX_CSTEX
  1582.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'for EPMpopisJK', 'cstex_viewINF S EPMpopisJK.INF'\1'View CzEpmCs.INF', 0,0
  1583.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'for CzEpmCs', 'cstex_viewINF S CzEpmCs.INF'\1'View CzEpmCs.INF', 0,0
  1584.   id=id+1; buildmenuitem defaultmenu, cstexid, id, \0, '', 4, 0 -- hline  
  1585. COMPILE ENDIF
  1586.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'for LaTeX2e', 'cstex_viewINF S LaTeX2e.INF'\1'View LaTeX2e.INF (reminder: Ctrl/H hotkey)', 0,0
  1587.   id=id+1; buildmenuitem defaultmenu, cstexid, id, 'for TeX-math', 'cstex_viewINF S TeX-Math.INF'\1'View TeX-Math.INF', 32768+1,0
  1588. id=id+1; buildmenuitem defaultmenu, cstexid, id, '~Bug reports', 'cstex_bugs'\1'Where to send you suggestions and bug reports', 0,0
  1589. showmenu 'default' 
  1590. return
  1591.  
  1592. /* end of CSTeX.e */
  1593.