math_bigopinset.h \
math_binominset.C \
math_binominset.h \
- math_cheatinset.C \
- math_cheatinset.h \
math_charinset.C \
math_charinset.h \
math_cursor.C \
math_hash.C \
math_inset.C \
math_inset.h \
+ math_kerninset.C \
+ math_kerninset.h \
math_macro.C \
math_macro.h \
math_macroarg.C \
+++ /dev/null
-#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 &, int, int) 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_;
-}
+++ /dev/null
-// -*- 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
#include "math_funcinset.h"
#include "math_funcliminset.h"
#include "math_fracinset.h"
+#include "math_kerninset.h"
#include "math_macro.h"
#include "math_macrotable.h"
#include "math_noglyphinset.h"
return new MathSymbolInset(l);
case LM_TK_STACK:
return new MathStackrelInset;
+ case LM_TK_KERN:
+ return new MathKernInset;
case LM_TK_BINOM:
case LM_TK_CHOOSE:
return new MathBinomInset;
int MathGridInset::RowInfo::skipPixels() const
{
#ifdef WITH_WARNINGS
-#warning fix this once the interface to LyXLength has oimproved
+#warning fix this once the interface to LyXLength has improved
#endif
return int(skip_.value());
}
{"jmath", LM_TK_NOGLYPH, 0, LMB_NONE},
{"kappa", LM_TK_SYM, LM_kappa, LMB_NONE},
{"ker", LM_TK_FUNC, 0, LMB_NONE},
+ {"kern", LM_TK_KERN, 0, LMB_NONE},
{"label", LM_TK_LABEL, 0, LMB_NONE},
{"lambda", LM_TK_SYM, LM_lambda, LMB_NONE},
{"langle", LM_TK_SYM, LM_langle, LMB_NONE},
--- /dev/null
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include "math_kerninset.h"
+#include "support.h"
+#include "support/LOstream.h"
+
+
+MathKernInset::MathKernInset()
+{}
+
+
+MathKernInset::MathKernInset(LyXLength const & w)
+ : wid_(w)
+{}
+
+
+MathKernInset::MathKernInset(string const & s)
+ : wid_(s)
+{}
+
+
+MathInset * MathKernInset::clone() const
+{
+ return new MathKernInset(*this);
+}
+
+
+void MathKernInset::draw(Painter &, int, int) const
+{}
+
+
+void MathKernInset::write(std::ostream & os, bool) const
+{
+ os << "\\kern" << wid_.asLatexString() << " ";
+}
+
+
+void MathKernInset::writeNormal(std::ostream & os) const
+{
+ os << "[kern " << wid_.asLatexString() << "]";
+}
+
+
+void MathKernInset::metrics(MathStyles) const
+{
+ ascent_ = 0;
+ descent_ = 0;
+#ifdef WITH_WARNINGS
+#warning fix this once the interface to LyXLength has improved
+#endif
+ width_ = static_cast<int>(wid_.value());
+}
--- /dev/null
+// -*- C++ -*-
+#ifndef MATH_CHEATINSET_H
+#define MATH_CHEATINSET_H
+
+#include "math_diminset.h"
+#include "vspace.h"
+#include "LString.h"
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+/// The \kern primitive
+
+class MathKernInset : public MathDimInset {
+public:
+ ///
+ MathKernInset();
+ ///
+ explicit MathKernInset(LyXLength const & wid);
+ ///
+ explicit MathKernInset(string const & 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
+ LyXLength wid_;
+};
+#endif
#include "math_macro.h"
#include "math_macrotemplate.h"
#include "math_parser.h"
-#include "math_fracinset.h"
-#include "math_cheatinset.h"
-#include "math_charinset.h"
#include "debug.h"
createTemplate("perp", 0, "\\bot");
createTemplate("owns", 0, "\\ni");
createTemplate("to", 0, "\\rightarrow");
+#ifdef WITH_WARNINGS
+#warning 9em looks like too much but it is somehow working on screen..
+#endif WITH_WARNINGS
+ createTemplate("ll", 0, "<\\kern-9em<");
+ createTemplate("gg", 0, ">\\kern-9em>");
//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);
}
#include "math_deliminset.h"
#include "math_factory.h"
#include "math_funcinset.h"
+#include "math_kerninset.h"
#include "math_macro.h"
#include "math_macrotable.h"
#include "math_macrotemplate.h"
lyxerr[Debug::MATHED] << "unknow math inset begin '" << name << "'\n";
}
+ else if (t.cs() == "kern") {
+#ifdef WITH_WARNINGS
+#warning A hack...
+#endif
+ string s;
+ while (1) {
+ Token const & t = getToken();
+ if (!good()) {
+ putback();
+ break;
+ }
+ s += t.character();
+ if (isValidLength(s))
+ break;
+ }
+ array.push_back(new MathKernInset(s));
+ }
+
else if (t.cs() == "label") {
//MathArray ar;
//parse_into(ar, FLAG_ITEM);
///
LM_TK_NOT,
///
+ LM_TK_KERN,
+ ///
LM_TK_STACK
};