home *** CD-ROM | disk | FTP | other *** search
Wrap
compile if not defined(SMALL) -- If SMALL not defined, then being separately compiled define INCLUDING_FILE = 'LATEXMNU.E' const tryinclude 'MYCNF.E' -- the user's configuration customizations. compile if not defined(SITE_CONFIG) const SITE_CONFIG = 'SITECNF.E' compile endif compile if SITE_CONFIG tryinclude SITE_CONFIG compile endif compile endif const compile if not defined(WANT_DYNAMIC_PROMPTS) WANT_DYNAMIC_PROMPTS = 1 compile endif compile if EVERSION < '5.21' TILDE_CHAR = '' compile else TILDE_CHAR = '~' compile endif AF_CHAR = 1 -- key style constants (from STDCONST.E) AF_ALT = 32 ; my_ADDRESS = 'Larry Margolis\\P.O.\ Box 218\\Yorktown Heights, NY 11287' ; my_SIGNATURE = 'Lawrence A.\ Margolis\\EPM Guru' const -- Text defined separately, for easier NLS translation LATEX_BAR__MSG = TILDE_CHAR'LaTeX ' LIST_ITEM_MENU__MSG = '~List item' QUOTE_MENU__MSG = '~Quote' QUOTATION_MENU__MSG = '~Quotation' CENTER_MENU__MSG = '~Center' UNDERLINE_MENU__MSG = 'U~nderline' OLIST_MENU__MSG = '~Enumerated list' ULIST_MENU__MSG = '~Itemized list' DLIST_MENU__MSG = '~Description list' MATH_MENU__MSG = '~Math' DMATH_MENU__MSG = '~Displaymath' EQN_MENU__MSG = '~Equation' FIGURE_MENU__MSG = '~Figure' TABLE_MENU__MSG = '~Table' FOOTNOTE_MENU__MSG = '~Footnote' HEADS_MENU__MSG = '~Sections' HEAD0_MENU__MSG = '~Part' HEAD1_MENU__MSG = '~Chapter' HEAD2_MENU__MSG = '~Section' HEAD3_MENU__MSG = 'S~ubsection' HEAD4_MENU__MSG = 'Su~bsubsection' HEAD5_MENU__MSG = 'P~aragraph' HEAD6_MENU__MSG = 'Subpa~ragraph' EM_MENU__MSG = '~Emphasize phrase' TYPES_MENU__MSG = '~Typestyles' TYPE_BF_MENU__MSG = '~Bold' TYPE_SF_MENU__MSG = '~Sans serif' TYPE_SL_MENU__MSG = 'S~lanted' TYPE_SC_MENU__MSG = 'S~mall caps' TYPE_TT_MENU__MSG = '~Typewriter type' TYPE_RM_MENU__MSG = '~Roman' TYPE_IT_MENU__MSG = '~Italic' DOC_MENU__MSG = 'Docu~ments' SIMPLE_MENU__MSG = '~Simple' LETTER_MENU__MSG = '~Letter' compile if WANT_DYNAMIC_PROMPTS LATEX_BARP__MSG = \1'Insert LaTeX commands' LIST_ITEM_MENUP__MSG = \1'Insert \item tag after current line' QUOTE_MENUP__MSG = \1'Insert quote environment around mark or after current line' QUOTATION_MENUP__MSG = \1'Insert quotation environment after current line' CENTER_MENUP__MSG = \1'Insert center command after current line' UNDERLINE_MENUP__MSG = \1'Insert underline command around block or char. mark, or current word' OLIST_MENUP__MSG = \1'Create an enumerated list' ULIST_MENUP__MSG = \1'Create an itemized (bulleted) list' DLIST_MENUP__MSG = \1'Create a description list' MATH_MENUP__MSG = \1'Create an inline mathematical formula' DMATH_MENUP__MSG = \1'Create a separatly-displayed mathematical formula' EQN_MENUP__MSG = \1'Create a numbered mathematical formula' FIGURE_MENUP__MSG = \1'Create a figure' TABLE_MENUP__MSG = \1'Create a table' FOOTNOTE_MENUP__MSG = \1'Create a footnote' HEADS_MENUP__MSG = \1'Insert sectioning commands' HEADx_MENUP__MSG = \1'Insert the indicated sectioning command' EM_MENUP__MSG = \1'Emphasize a phrase - block or char. mark, or current word' TYPES_MENUP__MSG = \1'Change the typestyle of a phrase - block or char. mark, or current word' TYPE_x_MENUP__MSG = \1'Change block or char. mark, or current word, to indicated typestyle' DOC_MENUP__MSG = \1'Create a document' SIMPLE_MENUP__MSG = \1'Create a simple document' LETTER_MENUP__MSG = \1'Create a Bookmaster User Document' compile else LATEX_BARP__MSG = '' LIST_ITEM_MENUP__MSG = '' QUOTE_MENUP__MSG = '' QUOTATION_MENUP__MSG = '' CENTER_MENUP__MSG = '' UNDERLINE_MENUP__MSG = '' OLIST_MENUP__MSG = '' ULIST_MENUP__MSG = '' DLIST_MENUP__MSG = '' MATH_MENUP__MSG = '' DMATH_MENUP__MSG = '' EQN_MENUP__MSG = '' FIGURE_MENUP__MSG = '' TABLE_MENUP__MSG = '' FOOTNOTE_MENUP__MSG = '' HEADS_MENUP__MSG = '' HEADx_MENUP__MSG = '' EM_MENUP__MSG = '' TYPES_MENUP__MSG = '' TYPE_x_MENUP__MSG = '' DOC_MENUP__MSG = '' SIMPLE_MENUP__MSG = '' LETTER_MENUP__MSG = '' compile endif -- WANT_DYNAMIC_PROMPTS definit universal defaultmenu, activemenu universal activeaccel universal LaTeX_cmds_menu_flag deletemenu defaultmenu, 6, 0, 0 -- delete the existing Help menu (we want it to stay at the right) buildsubmenu defaultmenu, 39, LATEX_BAR__MSG, LATEX_BARP__MSG, 0, 0 buildmenuitem defaultmenu, 39, 3901, LIST_ITEM_MENU__MSG, 'LaTeX_IL 1 \item 'LIST_ITEM_MENUP__MSG, 0, 0 buildmenuitem defaultmenu, 39, 3902, QUOTE_MENU__MSG, 'LaTeX_quote'QUOTE_MENUP__MSG, 0, 0 buildmenuitem defaultmenu, 39, 3903, QUOTATION_MENU__MSG, 'LaTeX_IML /\begin{quotation}/ /\end{quotation}'QUOTATION_MENUP__MSG, 0, 0 buildmenuitem defaultmenu, 39, 3904, CENTER_MENU__MSG, 'LaTeX_IML /\begin{center}/ /\end{center}'CENTER_MENUP__MSG, 0, 0 buildmenuitem defaultmenu, 39, 3905, UNDERLINE_MENU__MSG, 'LaTeX_UL'UNDERLINE_MENUP__MSG, 0, 0 buildmenuitem defaultmenu, 39, 3906, \0, '', 4, 0 buildmenuitem defaultmenu, 39, 3910, OLIST_MENU__MSG, 'LaTeX_IML /\begin{enumerate}/ \item /end{enumerate}'OLIST_MENUP__MSG, 0, 0 buildmenuitem defaultmenu, 39, 3911, ULIST_MENU__MSG, 'LaTeX_IML /\begin{itemize}/ \item /end{itemize}'ULIST_MENUP__MSG, 0, 0 buildmenuitem defaultmenu, 39, 3912, DLIST_MENU__MSG, 'LaTeX_IML /\begin{description}/ \item []/end{description}'DLIST_MENUP__MSG, 0, 0 buildmenuitem defaultmenu, 39, 3913, \0, '', 4, 0 buildmenuitem defaultmenu, 39, 3920, MATH_MENU__MSG, 'LaTeX_IT \begin{math} ~\end{math}'MATH_MENUP__MSG, 0, 0 buildmenuitem defaultmenu, 39, 3921, DMATH_MENU__MSG, 'LaTeX_IML /\begin{displaymath}/ /\end{displaymath}'DMATH_MENUP__MSG, 0, 0 buildmenuitem defaultmenu, 39, 3922, EQN_MENU__MSG, 'LaTeX_IML /\begin{equation}/ /\end{equation}'EQN_MENUP__MSG, 0, 0 buildmenuitem defaultmenu, 39, 3923, FIGURE_MENU__MSG, 'LaTeX_IML /\begin{figure}/ / \caption{}/\end{figure}'FIGURE_MENUP__MSG, 0, 0 buildmenuitem defaultmenu, 39, 3924, TABLE_MENU__MSG, 'LaTeX_IML /\begin{table}/ / \caption{}/\end{table}'TABLE_MENUP__MSG, 0, 0 buildmenuitem defaultmenu, 39, 3925, FOOTNOTE_MENU__MSG, 'LaTeX_IT \footnote{~}'FOOTNOTE_MENUP__MSG, 0, 0 buildmenuitem defaultmenu, 39, 3929, \0, '', 4, 0 buildmenuitem defaultmenu, 39, 3930, HEADS_MENU__MSG, HEADS_MENUP__MSG, 17, 0 buildmenuitem defaultmenu, 39, 3931, HEAD0_MENU__MSG, 'LaTeX_IL 0 \part'HEADx_MENUP__MSG, 0, 0 buildmenuitem defaultmenu, 39, 3932, HEAD1_MENU__MSG, 'LaTeX_IL 0 \chapter'HEADx_MENUP__MSG, 0, 0 buildmenuitem defaultmenu, 39, 3933, HEAD2_MENU__MSG, 'LaTeX_IL 0 \section'HEADx_MENUP__MSG, 0, 0 buildmenuitem defaultmenu, 39, 3934, HEAD3_MENU__MSG, 'LaTeX_IL 0 \subsection'HEADx_MENUP__MSG, 0, 0 buildmenuitem defaultmenu, 39, 3935, HEAD4_MENU__MSG, 'LaTeX_IL 0 \subsubsection'HEADx_MENUP__MSG, 0, 0 buildmenuitem defaultmenu, 39, 3936, HEAD5_MENU__MSG, 'LaTeX_IL 0 \paragraph'HEADx_MENUP__MSG, 0, 0 buildmenuitem defaultmenu, 39, 3937, HEAD6_MENU__MSG, 'LaTeX_IL 0 \subparagraph'HEADx_MENUP__MSG, 32769, 0 buildmenuitem defaultmenu, 39, 3940, EM_MENU__MSG, 'LaTeX_EM em'EM_MENUP__MSG, 0, 0 buildmenuitem defaultmenu, 39, 3941, TYPES_MENU__MSG, TYPES_MENUP__MSG, 17, 0 buildmenuitem defaultmenu, 39, 3942, TYPE_BF_MENU__MSG, 'LaTeX_EM bf'TYPE_x_MENUP__MSG, 0, 0 buildmenuitem defaultmenu, 39, 3943, TYPE_SF_MENU__MSG, 'LaTeX_EM sf'TYPE_x_MENUP__MSG, 0, 0 buildmenuitem defaultmenu, 39, 3944, TYPE_SL_MENU__MSG, 'LaTeX_EM sl'TYPE_x_MENUP__MSG, 0, 0 buildmenuitem defaultmenu, 39, 3945, TYPE_SC_MENU__MSG, 'LaTeX_EM sc'TYPE_x_MENUP__MSG, 0, 0 buildmenuitem defaultmenu, 39, 3946, TYPE_TT_MENU__MSG, 'LaTeX_EM tt'TYPE_x_MENUP__MSG, 0, 0 buildmenuitem defaultmenu, 39, 3947, TYPE_RM_MENU__MSG, 'LaTeX_EM rm'TYPE_x_MENUP__MSG, 0, 0 buildmenuitem defaultmenu, 39, 3948, TYPE_IT_MENU__MSG, 'LaTeX_EM it'TYPE_x_MENUP__MSG, 32769, 0 buildmenuitem defaultmenu, 39, 3960, DOC_MENU__MSG, DOC_MENUP__MSG, 17, 0 buildmenuitem defaultmenu, 39, 3961, SIMPLE_MENU__MSG, 'SIMPLE_DOC'SIMPLE_MENUP__MSG, 0, 0 buildmenuitem defaultmenu, 39, 3962, LETTER_MENU__MSG, 'LETTER_DOC'LETTER_MENUP__MSG, 32769, 0 call readd_help_menu() LaTeX_cmds_menu_flag = 1 buildacceltable activeaccel, 'dokey a+L', AF_CHAR+AF_ALT, 76, 3998 -- a+L buildacceltable activeaccel, 'dokey a+L', AF_CHAR+AF_ALT, 108, 3999 -- a+l activateacceltable activeaccel defc LaTeX_IL = -- InsertLine parse arg indent_flag rest if indent_flag then getline line pref=leftstr(line, max(0, verify(line, ' '\9, 'N')-1)) insertline pref || rest, .line+1 else insertline rest, .line+1 endif '+1' end_line defc LaTeX_IT = -- InsertText i_s = insert_state() if not i_s then insert_toggle; endif newtext = arg(1) c = pos('~', newtext) if c then keyin leftstr(newtext, c-1) cursor_line = .line; cursor_col = .col keyin substr(newtext, c+1) cursor_line; .col = cursor_col call fixup_cursor() else keyin newtext if not insert_state() then insert_toggle; endif -- restore insert status endif defc LaTeX_quote = -- Prefix line with arg mt = marktype() if mt='' then 'LaTeX_IML /\begin{quote}/ /\end{quote}' else getfileid fid getmark firstline,lastline,firstcol,lastcol,fileid if fid<>fileid then sayerror 'Wrong file - check mark' return endif if leftstr(mt,1)='L' then -- Line mark insertline '\end{quote}', lastline+1 insertline '\begin{quote}', firstline else call LaTeX_insert_tags('\begin{quote} ', '\end{quote} ') endif endif defc LaTeX_IML = -- Insert Many Lines getline line pref=leftstr(line, max(0, verify(line, ' '\9, 'N')-1)) parse value strip(arg(1),'L') with delim 2 rest nextline = .line+1 do while rest <> '' parse value rest with line (delim) rest insertline pref || line, nextline nextline = nextline + 1 enddo '+2' end_line r2 = rightstr(textline(.line), 2) if r2='[]' | r2='{}' then left if not insert_state() then insert_toggle; call fixup_cursor(); endif endif defc LaTeX_em call LaTeX_insert_tags('{\'arg(1)' ', '}') defc LaTeX_ul call LaTeX_insert_tags('\underline{', '}') defproc LaTeX_insert_tags(start_tag, end_tag) mt = marktype() if pos(leftstr(mt,1), 'BC') then -- Block or Character mark getfileid fid getmark firstline,lastline,firstcol,lastcol,fileid if fid<>fileid then sayerror 'Wrong file - check mark' return endif else firstline = .line; lastline = .line; call pend_word(); lastcol = .col call pbegin_word(); firstcol = .col endif .col=lastcol+1 lastline i_s = insert_state() if not i_s then insert_toggle; endif keyin end_tag firstline .col=firstcol keyin start_tag if pos(leftstr(mt,1), 'BC') then -- Block or Character mark l = length(start_tag) call pset_mark(firstline, lastline, firstcol+l, lastcol+(l*(lastline=firstline)), mt, fileid) endif if not i_s then insert_toggle; endif defc Simple_DOC start_line = .line "LaTeX_IML /\documentstyle{article}/\title{}/\author{}/\date{}/\begin{document}/\maketitle/\end{document}" start_line+2; end_line; left if not insert_state() then insert_toggle; endif if textline(start_line)='' then deleteline start_line; endif defc LETTER_DOC start_line = .line ; "LaTeX_IML /\documentstyle{letter}/\address{}/\signature{}/\date{}/\begin{letter}{<addressee>}/\opening{Dear sirs:}//\closing{Sincerely,}/% \cc {}/% \encl/% \ps/\end{letter}" insertline '\documentstyle{letter}', .line+1 compile if defined(my_ADDRESS) insertline '\address{'my_ADDRESS'}', .line+2 compile else insertline '\address{}', .line+2 compile endif compile if defined(my_SIGNATURE) insertline '\signature{'my_SIGNATURE'}', .line+3 compile else insertline '\signature{}', .line+3 compile endif start_line+3 "LaTeX_IML /\date{}/\begin{document}/\begin{letter}{<addressee>}/\opening{Dear sirs:}/% Body of letter goes here.//\closing{Sincerely,}/% \cc {}/% \encl/% \ps/\end{letter}/\end{document}" compile if defined(my_ADDRESS) start_line+9; .col = 1 compile else start_line+2; end_line; left if not insert_state() then insert_toggle; endif compile endif if textline(start_line)='' then deleteline start_line; endif