some *cough* support for \ll and \gg and potentially more...

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2561 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2001-08-20 16:37:35 +00:00
parent bdd235120b
commit 7e7a107039
5 changed files with 86 additions and 2 deletions

View File

@ -26,6 +26,8 @@ libmathed_la_SOURCES = \
math_bigopinset.h \
math_binominset.C \
math_binominset.h \
math_cheatinset.C \
math_cheatinset.h \
math_charinset.C \
math_charinset.h \
math_cursor.C \

View File

@ -0,0 +1,39 @@
#ifdef __GNUG__
#pragma implementation
#endif
#include "math_cheatinset.h"
#include "support.h"
#include "support/LOstream.h"
MathCheatInset::MathCheatInset(double w)
: wid_(w)
{}
MathInset * MathCheatInset::clone() const
{
return new MathCheatInset(*this);
}
void MathCheatInset::draw(Painter & pain, int x, int y) const
{}
void MathCheatInset::write(std::ostream &, bool) const
{}
void MathCheatInset::writeNormal(std::ostream &) const
{}
void MathCheatInset::metrics(MathStyles st) const
{
// mimic -.1em
mathed_char_dim(LM_TC_CONST, st, 'm', ascent_, descent_, width_);
width_ *= wid_;
}

View File

@ -0,0 +1,31 @@
// -*- C++ -*-
#ifndef MATH_CHEATINSET_H
#define MATH_CHEATINSET_H
#include "math_diminset.h"
#ifdef __GNUG__
#pragma interface
#endif
/// Some cheating for displaying things like \ll etc
class MathCheatInset : public MathDimInset {
public:
///
explicit MathCheatInset(double wid);
///
MathInset * clone() const;
///
void draw(Painter &, int x, int y) const;
///
void write(std::ostream &, bool fragile) const;
///
void writeNormal(std::ostream &) const;
///
void metrics(MathStyles st) const;
private:
/// width in em
double wid_;
};
#endif

View File

@ -137,7 +137,6 @@ latexkeys wordlist[] =
{"gamma", LM_TK_SYM, LM_gamma, LMB_NONE},
{"gcd", LM_TK_FUNCLIM, 0, LMB_NONE},
{"geq", LM_TK_SYM, LM_geq, LMB_RELATION},
{"gg", LM_TK_NOGLYPH, 0, LMB_RELATION},
{"grave", LM_TK_DECORATION, LM_grave, LMB_NONE},
{"hat", LM_TK_DECORATION, LM_hat, LMB_NONE},
{"hbar", LM_TK_NOGLYPH, 0, LMB_NONE},
@ -171,7 +170,6 @@ latexkeys wordlist[] =
{"liminf", LM_TK_FUNCLIM, 0, LMB_NONE},
{"limits", LM_TK_LIMIT, 1 , LMB_NONE},
{"limsup", LM_TK_FUNCLIM, 0, LMB_NONE},
{"ll", LM_TK_NOGLYPH, 0, LMB_RELATION},
{"ln", LM_TK_FUNC, 0, LMB_NONE},
{"log", LM_TK_FUNC, 0, LMB_NONE},
{"longleftarrow", LM_TK_NOGLYPH, 0, LMB_NONE},

View File

@ -11,6 +11,8 @@
#include "math_macrotemplate.h"
#include "math_parser.h"
#include "math_fracinset.h"
#include "math_cheatinset.h"
#include "math_charinset.h"
#include "debug.h"
@ -100,4 +102,16 @@ void MathMacroTable::builtinMacros()
//createTemplate("lint", 4, "\\int_#1^#2#3 d#4");
//createTemplate("silentmult", 0, "\\cdot");
//createTemplate("binom", 2, "\\left(\\frac#1#2\\right)");
MathMacroTemplate ll("ll", 0);
ll.cell(0).push_back(new MathCharInset('<', LM_TC_CONST));
ll.cell(0).push_back(new MathCheatInset(-0.9));
ll.cell(0).push_back(new MathCharInset('<', LM_TC_CONST));
insertTemplate(ll);
MathMacroTemplate gg("gg", 0);
gg.cell(0).push_back(new MathCharInset('>', LM_TC_CONST));
gg.cell(0).push_back(new MathCheatInset(-0.9));
gg.cell(0).push_back(new MathCharInset('>', LM_TC_CONST));
insertTemplate(gg);
}