This finally should lay to rest, in a way that is IMHO good enough for 1.2.0,
the trouble with the circumflex and underscore symbol insertion in math.

-- Martin


2002-01-24      Martin Vermeer <[EMAIL PROTECTED]>

        * LaTeXFeatures.C:
        * lyx_sty.[Ch]:
        * math_macro.C:
        * math_macrotable.C:
        * math.bind: Allow both circumflex and underscore to be inserted in
        math in a sustainable way. Circumflex implements a macro
        \mathcircumflex for this, with validation code.
        Now both characters render correctly both on-screen and in print, 
        and survive the save/load cycle.
        Key bindings added: M-m _ and M-m ^.

-- 
Martin Vermeer  [EMAIL PROTECTED]
Helsinki University of Technology 
Department of Surveying
P.O. Box 1200, FIN-02015 HUT, Finland
:wq
Index: lib/bind/math.bind
===================================================================
RCS file: /cvs/lyx/lyx-devel/lib/bind/math.bind,v
retrieving revision 1.7
diff -u -b -B -p -r1.7 math.bind
--- lib/bind/math.bind  2001/10/15 10:30:32     1.7
+++ lib/bind/math.bind  2002/01/24 05:27:23
@@ -28,8 +28,10 @@
 
 \bind "M-m f"                  "math-insert \frac"
 \bind "M-m s"                  "math-insert \sqrt"
-\bind "M-m e"                  "math-insert ^"
-\bind "M-m x"                  "math-insert _"
+\bind "M-m e"                  "math-insert \mathcircumflex"
+\bind "M-m asciicircum"        "math-insert \mathcircumflex"
+\bind "M-m x"                  "math-insert \_ "
+\bind "M-m ~S-underscore"      "math-insert \_ "
 \bind "M-m u"                  "math-insert \sum"
 \bind "M-m i"                  "math-insert \int"
 \bind "M-m m"                  "math-mode"
Index: src/LaTeXFeatures.C
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/LaTeXFeatures.C,v
retrieving revision 1.53
diff -u -b -B -p -r1.53 LaTeXFeatures.C
--- src/LaTeXFeatures.C 2002/01/10 10:05:43     1.53
+++ src/LaTeXFeatures.C 2002/01/24 05:27:26
@@ -311,6 +311,8 @@ string const LaTeXFeatures::getMacros() 
                macros << boldsymbol_def << '\n';
        if (isRequired("binom") && !isRequired("amsmath"))
                macros << binom_def << '\n';
+       if (isRequired("mathcircumflex"))
+               macros << mathcircumflex_def << '\n';
 
        // other
        if (isRequired("NeedLyXMinipageIndent"))
Index: src/lyx_sty.C
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/lyx_sty.C,v
retrieving revision 1.6
diff -u -b -B -p -r1.6 lyx_sty.C
--- src/lyx_sty.C       2001/05/30 13:53:30     1.6
+++ src/lyx_sty.C       2002/01/24 05:27:26
@@ -122,3 +122,7 @@ string const binom_def = 
        "%% Binom macro for standard LaTeX users\n"
        "\\newcommand{\\binom}[2]{{#1 \\choose #2}}\n";
 
+string const mathcircumflex_def = 
+       "%% For printing a cirumflex inside a formula\n"
+       "\\newcommand{\\mathcircumflex}[0]{\\textrm{\\^{}}}\n";
+
Index: src/lyx_sty.h
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/lyx_sty.h,v
retrieving revision 1.7
diff -u -b -B -p -r1.7 lyx_sty.h
--- src/lyx_sty.h       2001/05/30 13:53:30     1.7
+++ src/lyx_sty.h       2002/01/24 05:27:26
@@ -62,5 +62,7 @@ extern string const minipageindent_def;
 extern string const boldsymbol_def;
 ///
 extern string const binom_def;
+///
+extern string const mathcircumflex_def;
 
 #endif
Index: src/lyxfunc.C
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/lyxfunc.C,v
retrieving revision 1.288
diff -u -b -B -p -r1.288 lyxfunc.C
Index: src/mathed/math_macro.C
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/mathed/math_macro.C,v
retrieving revision 1.94
diff -u -b -B -p -r1.94 math_macro.C
--- src/mathed/math_macro.C     2001/12/12 13:11:28     1.94
+++ src/mathed/math_macro.C     2002/01/24 05:27:38
@@ -190,8 +190,9 @@ bool MathMacro::idxRight(idx_type &, pos
 
 void MathMacro::validate(LaTeXFeatures & features) const
 {
-       if (name() == "binom")
-               features.require("binom");
+       string const & n = name(); 
+       if (n == "mathcircumflex" || n == "binom")
+               features.require(n);
        //MathInset::validate(features);
 }
 
Index: src/mathed/math_macrotable.C
===================================================================
RCS file: /cvs/lyx/lyx-devel/src/mathed/math_macrotable.C,v
retrieving revision 1.52
diff -u -b -B -p -r1.52 math_macrotable.C
--- src/mathed/math_macrotable.C        2001/12/18 15:19:32     1.52
+++ src/mathed/math_macrotable.C        2002/01/24 05:27:38
@@ -145,4 +145,6 @@ void MathMacroTable::builtinMacros()
        //create("lint",       4, "\\int_#1^#2#3 d#4");
        //create("silentmult", 0, "\\cdot");
        //create("binom",        2, "\\left(\\frac#1#2\\right)");
+
+               create("mathcircumflex",        0, "\\^");
 }

Attachment: msg31965/pgp00000.pgp
Description: PGP signature

Reply via email to