]> git.lyx.org Git - features.git/commitdiff
get recently broken \mathcircumflex working again (hackish, proper fix in 1.3)
authorAndré Pönitz <poenitz@gmx.net>
Wed, 3 Apr 2002 10:45:32 +0000 (10:45 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Wed, 3 Apr 2002 10:45:32 +0000 (10:45 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3889 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/math_hash.C
src/mathed/math_macro.C
src/mathed/math_macro.h
src/mathed/math_macrotable.C
src/mathed/math_macrotable.h
src/mathed/math_parser.C
src/mathed/math_support.C

index dcc7643a130755148559b5ec585fee340afeadd8..c02b4156f8097bf3f1527b24c8f9e5ec982b88a0 100644 (file)
@@ -103,6 +103,7 @@ key_type wordlist_array[] =
        {"mathfrak",  LM_TK_FONT, LM_TC_EUFRAK},
        {"mathit",  LM_TK_FONT, LM_TC_IT},
        {"mathnormal",  LM_TK_FONT, LM_TC_VAR},
+       //{"mathring",  LM_TK_DECORATION, 0},
        {"mathrm",  LM_TK_FONT, LM_TC_RM},
        {"mathsf",  LM_TK_FONT, LM_TC_SF},
        {"mathtt",  LM_TK_FONT, LM_TC_TT},
index 3cf76db27b4908c164e563e8cd0d792c05b77fd0..ef3bf5da1bc26561d174f0cdb8062d196b894adc 100644 (file)
@@ -24,6 +24,7 @@
 #include "math_macrotable.h"
 #include "math_macrotemplate.h"
 #include "math_mathmlstream.h"
+#include "math_streamstr.h"
 #include "support/lstrings.h"
 #include "support/LAssert.h"
 #include "debug.h"
@@ -53,9 +54,9 @@ MathInset * MathMacro::clone() const
 }
 
 
-const char * MathMacro::name() const
+string const & MathMacro::name() const
 {
-       return tmplate_->asMacroTemplate()->name().c_str();
+       return tmplate_->asMacroTemplate()->name();
 }
 
 
@@ -190,8 +191,8 @@ bool MathMacro::idxRight(idx_type &, pos_type &) const
 
 void MathMacro::validate(LaTeXFeatures & features) const
 {
-       if (name() == "binom")
-               features.require("binom");
+       if (name() == "binom" || name() == "mathcircumflex")
+               features.require(name());
        //MathInset::validate(features);
 }
 
index ee8059c03dc7d6409ec93883d656b4de651e309c..1de5a90cafbf59d00bc68c652d39168716a085c8 100644 (file)
@@ -79,7 +79,7 @@ private:
        ///
        void operator=(MathMacro const &);
        ///
-       char const * name() const;
+       string const & name() const;
        ///
        bool defining() const;
        ///
index d2cd7d6f67e54040da80a0b5dc32bf0818b9a219..7df45d81637bb27c1182c02490c83fa4f6e3821f 100644 (file)
@@ -63,10 +63,10 @@ void MathMacroTable::create
 }
 
 
-void MathMacroTable::define(string const & def)
+void MathMacroTable::define(string const & display)
 {
        string name;
-       mathed_parse_macro(name, def);
+       mathed_parse_macro(name, display);
 }
 
 
@@ -151,6 +151,9 @@ void MathMacroTable::builtinMacros()
                define("\\def\\Join{\\ltimes\\kern-12mu\\rtimes}");
        }
 
+       //
+       define("\\def\\mathcircumflex{\\mbox{\\^{}}}\n"   "{\\hat{}}");
+
        //define("\def\lint",       4, "\\int_#1^#2#3 d#4}");
        //define("\\def\\silentmult{\\cdot}");
        //define("\def\binom",        2, "\\left(\\frac#1#2\\right)}");
index 91765b9f135aa5a2da2ef1c80ec51ba8fb303591..ab377190581e041ca6d1fa1f099721c6a36340d0 100644 (file)
@@ -29,7 +29,7 @@ public:
        static void dump();
 private:
        /// create internal macros (like \longrightarrow...)
-       static void define(string const & definition);
+       static void define(string const & display);
 
        ///
        typedef std::map<string, MathAtom> table_type;
index 64cb40acdc5ef168ba09e5e0e0ffea0ae8ac4d9f..961bcac731aaa6ba0cd11d459b199bb22bd5a660 100644 (file)
@@ -802,6 +802,7 @@ bool Parser::parse_macro(string & name)
                return false;
        }
 
+       // is a version for display attached?
        MathArray ar2;
        parse_into(ar2, FLAG_ITEM);
 
index b13212770e765075b9c231e0e6ebb5e5f4068bd3..d32a2c52528dca596ddd268e9d1a7b18cfbc2840 100644 (file)
@@ -436,6 +436,13 @@ double const  Vert[] = {
 };
 
 
+double const ring[] = {
+       2, 5,
+       0.5, 0.8,  0.8, 0.5,  0.5, 0.2,  0.2, 0.5,  0.5, 0.8,
+       0
+};
+
+
 double const tilde[] = {
        2, 4,
        0.05, 0.8,  0.25, 0.2,  0.75, 0.8,  0.95, 0.2,
@@ -510,6 +517,7 @@ named_deco_struct deco_table[] = {
        {"breve",          parenth,    1 },
        {"vec",            arrow,      3 },
        {"not",            slash,      0 },
+       {"mathring",       ring,       0 },
 
        // Dots
        {"ldots",          hline3,     0 },