/* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;*/ /* */ /* P†l Hedne 1990 */ /* */ /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;*/ /* #include "gresk.cb"*/ extern begin_command, end_command, put_commands; extern embrace; extern tab_and, tab, open_line, end_enter; extern ToggleMath, MathModus; extern check_tab; /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ _init (...) { int math_key; global math_key; math_key=0; } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ defmathkeys (...) { keyboard_push (); assign_to_key ("", "subscript"); assign_to_key ("", "superscript"); assign_to_key ("", "geq"); assign_to_key ("", "leq"); assign_to_key ("", "neq"); assign_to_key ("", "simeq"); assign_to_key ("", "equiv"); assign_to_key ("", "begin_array"); assign_to_key ("", "begin_displaymath"); assign_to_key ("", "begin_equation"); assign_to_key ("", "begin_math"); assign_to_key ("", "begin_eqnarray"); assign_to_key ("", "arrow"); assign_to_key ("", "approx"); assign_to_key ("", "deriv"); assign_to_key ("", "end_array"); assign_to_key ("", "end_displaymath"); assign_to_key ("", "end_equation"); assign_to_key ("", "end_eqnarray"); assign_to_key ("", "end_math"); assign_to_key ("", "frac"); assign_to_key ("", "tex_alpha"); assign_to_key ("", "tex_beta"); assign_to_key ("", "tex_psi"); assign_to_key ("", "tex_Psi"); assign_to_key ("", "tex_delta"); assign_to_key ("", "tex_Delta"); assign_to_key ("", "tex_epsilon"); assign_to_key ("", "tex_eta"); assign_to_key ("", "tex_varepsilon"); assign_to_key ("", "tex_phi"); assign_to_key ("", "tex_Phi"); assign_to_key ("", "tex_varphi"); assign_to_key ("", "tex_gamma"); assign_to_key ("", "tex_Gamma"); assign_to_key ("", "tex_theta"); assign_to_key ("", "tex_vartheta"); assign_to_key ("", "tex_iota"); assign_to_key ("", "tex_kappa"); assign_to_key ("", "tex_lambda"); assign_to_key ("", "tex_Lambda"); assign_to_key ("", "tex_mu"); assign_to_key ("", "tex_nu"); assign_to_key ("", "tex_o"); assign_to_key ("

", "tex_pi"); assign_to_key ("

", "tex_varpi"); assign_to_key ("

", "tex_Pi"); assign_to_key ("", "tex_rho"); assign_to_key ("", "tex_varrho"); assign_to_key ("", "tex_sigma"); assign_to_key ("", "tex_Sigma"); assign_to_key ("", "tex_varsigma"); assign_to_key ("", "tex_tau"); assign_to_key ("", "tex_Theta"); assign_to_key ("", "tex_xi"); assign_to_key ("", "tex_Xi"); assign_to_key ("", "tex_upsilon"); assign_to_key ("", "tex_Upsilon"); assign_to_key ("", "tex_zeta"); assign_to_key ("", "tex_omega"); assign_to_key ("", "tex_Omega"); assign_to_key ("", "infty"); assign_to_key ("", "integral"); assign_to_key ("", "dot"); assign_to_key ("", "cos"); assign_to_key ("", "exp"); assign_to_key ("", "lim"); assign_to_key ("", "sin"); assign_to_key ("", "tan"); assign_to_key ("", "nabla"); assign_to_key ("", "overbrace"); assign_to_key ("", "partial"); assign_to_key ("", "prod"); assign_to_key ("", "sqrt"); assign_to_key ("", "sum"); assign_to_key ("", "times"); assign_to_key ("", "bold"); assign_to_key ("", "caps"); assign_to_key ("", "emphasize"); assign_to_key ("", "italic"); assign_to_key ("", "overline"); assign_to_key ("", "roman"); assign_to_key ("", "sansserif"); assign_to_key ("", "typewriter"); assign_to_key ("", "underline"); assign_to_key ("", "angle"); assign_to_key ("", "underbrace"); math_key = inq_keyboard (); keyboard_pop (1); } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ MathKeys (...) { if (math_key == 0) defmathkeys (); use_local_keyboard (math_key); } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ NonMathKeys (...) { use_local_keyboard (0); } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ partial (...) { insert ("\\,\\partial "); } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ deriv (...) { insert ("\\,{\\rm d}\\,"); move_rel(0,-2); } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ leq (...) { insert ("\\leq "); } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ geq (...) { insert ("\\geq "); } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ simeq (...) { insert ("\\simeq "); } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ neq (...) { insert ("\\neq "); } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ equiv (...) { insert ("\\equiv "); } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ approx (...) { insert ("\\approx "); } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ times (...) { insert ("\\times "); } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ nabla (...) { insert ("\\nabla "); } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ angle (...) { insert ("\\angle "); } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ infty (...) { insert ("\\infty "); } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ sum (...) { insert ("\\sum"); } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ integral (...) { insert ("\\int"); } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ cos (...) { insert ("\\cos\\!\\,"); move_rel (0, -2); } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ exp (...) { insert ("\\exp\\!\\,"); move_rel (0, -2); } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ lim (...) { insert ("\\lim\\!\\,"); move_rel (0, -2); } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ sin (...) { insert ("\\sin\\!\\,"); move_rel (0, -2); } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ tan (...) { insert ("\\tan\\!\\,"); move_rel (0, -2); } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ prod (...) { insert ("\\prod "); } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ arrow (...) { sel_arrow ("arrow"); } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ sel_arrow (...) { int ins, ichar; string text, dumtext; if (get_parm (0, text)) { ins = insert_mode (1); while ((ichar = read_char ()) < 0); dumtext = int_to_key (ichar); /* .. to mnemonic code ("-d") */ /* error ("dumtext = %s ", dumtext);*/ switch (dumtext) { case "": { upper (substr (text, 1, 1)); insert ("\\" + ("up" + (text + " "))); } case "": { upper (substr (text, 1, 1)); insert ("\\" + ("down" + (text + " "))); } case "": { upper (substr (text, 1, 1)); insert ("\\" + ("left" + (text + " "))); } case "": { upper (substr (text, 1, 1)); insert ("\\" + ("right" + (text + " "))); } case "": { upper (substr (text, 1, 1)); insert ("\\" + ("Up" + (text + " "))); } case "": { upper (substr (text, 1, 1)); insert ("\\" + ("Down" + (text + " "))); } case "": { upper (substr (text, 1, 1)); insert ("\\" + ("Left" + (text + " "))); } case "": { upper (substr (text, 1, 1)); insert ("\\" + ("Right" + (text + " "))); } case "": { upper (substr (text, 1, 1)); insert ("\\" + ("sw" + (text + " "))); } case "": { upper (substr (text, 1, 1)); insert ("\\" + ("nw" + (text + " "))); } case "": { upper (substr (text, 1, 1)); insert ("\\" + ("ne" + (text + " "))); } case "": { upper (substr (text, 1, 1)); insert ("\\" + ("se" + (text + " "))); } case "": { upper (substr (text, 1, 1)); insert ("\\" + ("Leftright" + (text + " "))); } /* default */ default: push_back (ichar); } } } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ dot (...) { embrace ("dot",0); } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ sqrt (...) { embrace ("sqrt",0); } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ frac (...) { embrace ("frac",0); move_rel (0, 1); insert ("{}"); move_rel (0, -3); } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ underbrace (...) { embrace ("underbrace",0); } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ overbrace (...) { embrace ("overbrace",0); } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ subscript (...) { embrace ("_", 1); } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ superscript (...) { embrace ("^", 1); } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ /* ; */ /* array ; */ /* ; */ /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ begin_array (...) { int ikey; begin_command ("array"); ToggleMath (1); assign_to_key ("", "tab_and"); assign_to_key ("", "end_enter"); } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ end_array (...) { int line1, col1, ntab, length; string text, mess; end_command ("array"); assign_to_key ("", "tab"); assign_to_key ("", "open_line"); ToggleMath (0); check_tab("array"); } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ array (...) { put_commands ("array"); } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ /* ; */ /* EQUATION ; */ /* ; */ /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ equation (...) { put_commands ("equation"); } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ begin_equation (...) { begin_command ("equation"); ToggleMath (1); } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ end_equation (...) { end_command ("equation"); ToggleMath (0); } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ /* ; */ /* EQNARRAY ; */ /* ; */ /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ eqnarray (...) { put_commands ("eqnarray"); } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ begin_eqnarray (...) { begin_command ("eqnarray"); ToggleMath (1); assign_to_key ("", "tab_and"); assign_to_key ("", "end_enter"); /* assign_to_key ("", "nonumber");*/ } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ end_eqnarray (...) { end_command ("eqnarray"); assign_to_key ("", "tab"); assign_to_key ("", "open_line"); ToggleMath (0); } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ /* ; */ /* displaymath ; */ /* ; */ /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ displaymath (...) { put_commands ("displaymath"); } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ begin_displaymath (...) { begin_command ("displaymath"); ToggleMath (1); } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ end_displaymath (...) { end_command ("displaymath"); ToggleMath (0); } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ /* ; */ /* math ; */ /* ; */ /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ math (...) { put_commands ("math"); } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ begin_math (...) { begin_command ("math"); ToggleMath (1); } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ end_math (...) { end_command ("math"); ToggleMath (0); } /* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */ nonumber (...) { insert ("\nonumber"); }