summaryrefslogtreecommitdiff
path: root/support/brief-t/latexmat.cb
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /support/brief-t/latexmat.cb
Initial commit
Diffstat (limited to 'support/brief-t/latexmat.cb')
-rw-r--r--support/brief-t/latexmat.cb517
1 files changed, 517 insertions, 0 deletions
diff --git a/support/brief-t/latexmat.cb b/support/brief-t/latexmat.cb
new file mode 100644
index 0000000000..44f6ccbe8f
--- /dev/null
+++ b/support/brief-t/latexmat.cb
@@ -0,0 +1,517 @@
+/* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;*/
+/* */
+/* 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 ("<Ctrl-End>", "subscript");
+ assign_to_key ("<Ctrl-Home>", "superscript");
+ assign_to_key ("<Ctrl-Right>", "geq");
+ assign_to_key ("<Ctrl-Left>", "leq");
+ assign_to_key ("<Ctrl-PgDn>", "neq");
+ assign_to_key ("<Ctrl-PgUp>", "simeq");
+ assign_to_key ("<Ctrl-->", "equiv");
+ assign_to_key ("<Ctrl-b><a>", "begin_array");
+ assign_to_key ("<Ctrl-b><d>", "begin_displaymath");
+ assign_to_key ("<Ctrl-b><e>", "begin_equation");
+ assign_to_key ("<Ctrl-b><m>", "begin_math");
+ assign_to_key ("<Ctrl-b><y>", "begin_eqnarray");
+ assign_to_key ("<Ctrl-a>", "arrow");
+ assign_to_key ("<Ctrl-c>", "approx");
+ assign_to_key ("<Ctrl-d>", "deriv");
+ assign_to_key ("<Ctrl-e><a>", "end_array");
+ assign_to_key ("<Ctrl-e><d>", "end_displaymath");
+ assign_to_key ("<Ctrl-e><e>", "end_equation");
+ assign_to_key ("<Ctrl-e><y>", "end_eqnarray");
+ assign_to_key ("<Ctrl-e><m>", "end_math");
+ assign_to_key ("<Ctrl-f>", "frac");
+
+ assign_to_key ("<Ctrl-g><a>", "tex_alpha");
+ assign_to_key ("<Ctrl-g><b>", "tex_beta");
+ assign_to_key ("<Ctrl-g><c>", "tex_psi");
+ assign_to_key ("<Ctrl-g><C>", "tex_Psi");
+ assign_to_key ("<Ctrl-g><d>", "tex_delta");
+ assign_to_key ("<Ctrl-g><D>", "tex_Delta");
+ assign_to_key ("<Ctrl-g><e>", "tex_epsilon");
+ assign_to_key ("<Ctrl-g><E>", "tex_eta");
+ assign_to_key ("<Ctrl-g><v><e>", "tex_varepsilon");
+ assign_to_key ("<Ctrl-g><f>", "tex_phi");
+ assign_to_key ("<Ctrl-g><F>", "tex_Phi");
+ assign_to_key ("<Ctrl-g><v><f>", "tex_varphi");
+ assign_to_key ("<Ctrl-g><g>", "tex_gamma");
+ assign_to_key ("<Ctrl-g><G>", "tex_Gamma");
+ assign_to_key ("<Ctrl-g><t><e>", "tex_theta");
+ assign_to_key ("<Ctrl-g><v><t>", "tex_vartheta");
+ assign_to_key ("<Ctrl-g><i>", "tex_iota");
+ assign_to_key ("<Ctrl-g><k>", "tex_kappa");
+ assign_to_key ("<Ctrl-g><l>", "tex_lambda");
+ assign_to_key ("<Ctrl-g><L>", "tex_Lambda");
+ assign_to_key ("<Ctrl-g><m>", "tex_mu");
+ assign_to_key ("<Ctrl-g><n>", "tex_nu");
+ assign_to_key ("<Ctrl-g><o>", "tex_o");
+ assign_to_key ("<Ctrl-g><p>", "tex_pi");
+ assign_to_key ("<Ctrl-g><v><p>", "tex_varpi");
+ assign_to_key ("<Ctrl-g><P>", "tex_Pi");
+ assign_to_key ("<Ctrl-g><r>", "tex_rho");
+ assign_to_key ("<Ctrl-g><v><r>", "tex_varrho");
+ assign_to_key ("<Ctrl-g><s>", "tex_sigma");
+ assign_to_key ("<Ctrl-g><S>", "tex_Sigma");
+ assign_to_key ("<Ctrl-g><v><s>", "tex_varsigma");
+ assign_to_key ("<Ctrl-g><t>", "tex_tau");
+ assign_to_key ("<Ctrl-g><T>", "tex_Theta");
+ assign_to_key ("<Ctrl-g><x>", "tex_xi");
+ assign_to_key ("<Ctrl-g><X>", "tex_Xi");
+ assign_to_key ("<Ctrl-g><y>", "tex_upsilon");
+ assign_to_key ("<Ctrl-g><Y>", "tex_Upsilon");
+ assign_to_key ("<Ctrl-g><z>", "tex_zeta");
+ assign_to_key ("<Ctrl-g><w>", "tex_omega");
+ assign_to_key ("<Ctrl-g><W>", "tex_Omega");
+
+ assign_to_key ("<Ctrl-i>", "infty");
+ assign_to_key ("<Ctrl-j>", "integral");
+ assign_to_key ("<Ctrl-k>", "dot");
+
+ assign_to_key ("<Ctrl-l><c>", "cos");
+ assign_to_key ("<Ctrl-l><e>", "exp");
+ assign_to_key ("<Ctrl-l><l>", "lim");
+ assign_to_key ("<Ctrl-l><s>", "sin");
+ assign_to_key ("<Ctrl-l><t>", "tan");
+
+ assign_to_key ("<Ctrl-n>", "nabla");
+ assign_to_key ("<Ctrl-o>", "overbrace");
+ assign_to_key ("<Ctrl-p>", "partial");
+ assign_to_key ("<Ctrl-r>", "prod");
+ assign_to_key ("<Ctrl-q>", "sqrt");
+ assign_to_key ("<Ctrl-s>", "sum");
+ assign_to_key ("<Ctrl-t>", "times");
+ assign_to_key ("<Ctrl-u><b>", "bold");
+ assign_to_key ("<Ctrl-u><c>", "caps");
+ assign_to_key ("<Ctrl-u><e>", "emphasize");
+ assign_to_key ("<Ctrl-u><i>", "italic");
+ assign_to_key ("<Ctrl-u><o>", "overline");
+ assign_to_key ("<Ctrl-u><r>", "roman");
+ assign_to_key ("<Ctrl-u><s>", "sansserif");
+ assign_to_key ("<Ctrl-u><t>", "typewriter");
+ assign_to_key ("<Ctrl-u><u>", "underline");
+ assign_to_key ("<Ctrl-v>", "angle");
+ assign_to_key ("<Ctrl-w>", "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 ("<alt>-d") */
+/* error ("dumtext = %s ", dumtext);*/
+ switch (dumtext)
+ {
+ case "<Up>":
+ {
+ upper (substr (text, 1, 1));
+ insert ("\\" + ("up" + (text + " ")));
+ }
+ case "<Down>":
+ {
+ upper (substr (text, 1, 1));
+ insert ("\\" + ("down" + (text + " ")));
+ }
+ case "<Left>":
+ {
+ upper (substr (text, 1, 1));
+ insert ("\\" + ("left" + (text + " ")));
+ }
+ case "<Right>":
+ {
+ upper (substr (text, 1, 1));
+ insert ("\\" + ("right" + (text + " ")));
+ }
+ case "<Shift-Up>":
+ {
+ upper (substr (text, 1, 1));
+ insert ("\\" + ("Up" + (text + " ")));
+ }
+ case "<Shift-Down>":
+ {
+ upper (substr (text, 1, 1));
+ insert ("\\" + ("Down" + (text + " ")));
+ }
+ case "<Shift-Left>":
+ {
+ upper (substr (text, 1, 1));
+ insert ("\\" + ("Left" + (text + " ")));
+ }
+ case "<Shift-Right>":
+ {
+ upper (substr (text, 1, 1));
+ insert ("\\" + ("Right" + (text + " ")));
+ }
+ case "<End>":
+ {
+ upper (substr (text, 1, 1));
+ insert ("\\" + ("sw" + (text + " ")));
+ }
+ case "<Home>":
+ {
+ upper (substr (text, 1, 1));
+ insert ("\\" + ("nw" + (text + " ")));
+ }
+ case "<PgUp>":
+ {
+ upper (substr (text, 1, 1));
+ insert ("\\" + ("ne" + (text + " ")));
+ }
+ case "<PgDn>":
+ {
+ upper (substr (text, 1, 1));
+ insert ("\\" + ("se" + (text + " ")));
+ }
+ case "<Keypad-5>":
+ {
+ 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>", "tab_and");
+ assign_to_key ("<Ctrl-Enter>", "end_enter");
+
+}
+/* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */
+end_array (...)
+{
+ int line1, col1, ntab, length;
+ string text, mess;
+
+ end_command ("array");
+ assign_to_key ("<Tab>", "tab");
+ assign_to_key ("<Ctrl-Enter>", "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>", "tab_and");
+ assign_to_key ("<Ctrl-Enter>", "end_enter");
+/* assign_to_key ("<Ctrl-n>", "nonumber");*/
+
+}
+
+/* ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; */
+
+end_eqnarray (...)
+{
+ end_command ("eqnarray");
+ assign_to_key ("<Tab>", "tab");
+ assign_to_key ("<Ctrl-Enter>", "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");
+}