mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-03 00:20:43 +00:00
Merge InsetMathBoldSymbol and InsetMathBM by providing \boldsymbol
through the bm package. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23684 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
bde87d4ce7
commit
ba496b94ac
@ -453,7 +453,6 @@ src_mathed_header_files = Split('''
|
||||
InsetMathAMSArray.h
|
||||
InsetMathArray.h
|
||||
InsetMathBig.h
|
||||
InsetMathBM.h
|
||||
InsetMathBoldSymbol.h
|
||||
InsetMathBox.h
|
||||
InsetMathBrace.h
|
||||
@ -522,7 +521,6 @@ src_mathed_files = Split('''
|
||||
InsetMathAMSArray.cpp
|
||||
InsetMathArray.cpp
|
||||
InsetMathBig.cpp
|
||||
InsetMathBM.cpp
|
||||
InsetMathBoldSymbol.cpp
|
||||
InsetMathBox.cpp
|
||||
InsetMathBrace.cpp
|
||||
|
@ -55,6 +55,7 @@
|
||||
\bind "C-Prior" "buffer-previous"
|
||||
\bind "C-S-Tab" "buffer-previous"
|
||||
|
||||
\bind "C-M-b" "math-insert \mathbf"
|
||||
\bind "C-b" "font-bold"
|
||||
\bind "C-e" "font-emph"
|
||||
# used below for line-delete-forward
|
||||
|
@ -42,6 +42,7 @@
|
||||
\bind "M-Tab" "buffer-next"
|
||||
\bind "M-S-BackTab" "buffer-previous"
|
||||
|
||||
\bind "C-M-b" "math-insert \mathbf"
|
||||
\bind "C-b" "font-bold"
|
||||
\bind "C-e" "font-emph"
|
||||
\bind "C-k" "font-noun" # 'k' for capitals
|
||||
|
@ -136,10 +136,6 @@ static string const floatingfootnote_def =
|
||||
" \\expandafter\\noexpand\\csname SF@gobble@opt \\endcsname}\n"
|
||||
"\\def\\SF@gobble@twobracket[#1]#2{}\n";
|
||||
|
||||
static string const boldsymbol_def =
|
||||
"%% Bold symbol macro for standard LaTeX users\n"
|
||||
"\\providecommand{\\boldsymbol}[1]{\\mbox{\\boldmath $#1$}}\n";
|
||||
|
||||
static string const binom_def =
|
||||
"%% Binom macro for standard LaTeX users\n"
|
||||
"\\newcommand{\\binom}[2]{{#1 \\choose #2}}\n";
|
||||
@ -664,8 +660,6 @@ string const LaTeXFeatures::getMacros() const
|
||||
macros << guillemotright_def << '\n';
|
||||
|
||||
// Math mode
|
||||
if (mustProvide("boldsymbol") && !isRequired("amsmath"))
|
||||
macros << boldsymbol_def << '\n';
|
||||
if (mustProvide("binom") && !isRequired("amsmath"))
|
||||
macros << binom_def << '\n';
|
||||
if (mustProvide("mathcircumflex"))
|
||||
|
@ -329,7 +329,6 @@ SOURCEFILESMATHED = \
|
||||
mathed/InsetMathAMSArray.cpp \
|
||||
mathed/InsetMathArray.cpp \
|
||||
mathed/InsetMathBig.cpp \
|
||||
mathed/InsetMathBM.cpp \
|
||||
mathed/InsetMathBoldSymbol.cpp \
|
||||
mathed/InsetMathBox.cpp \
|
||||
mathed/InsetMathBrace.cpp \
|
||||
@ -395,7 +394,6 @@ HEADERFILESMATHED = \
|
||||
mathed/InsetMathAMSArray.h \
|
||||
mathed/InsetMathArray.h \
|
||||
mathed/InsetMathBig.h \
|
||||
mathed/InsetMathBM.h \
|
||||
mathed/InsetMathBoldSymbol.h \
|
||||
mathed/InsetMathBox.h \
|
||||
mathed/InsetMathBrace.h \
|
||||
|
@ -1,86 +0,0 @@
|
||||
/**
|
||||
* \file InsetMathBM.cpp
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Bernhard Roider
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "InsetMathBM.h"
|
||||
|
||||
#include "MathStream.h"
|
||||
#include "MathData.h"
|
||||
#include "LaTeXFeatures.h"
|
||||
|
||||
#include <ostream>
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
InsetMathBM::InsetMathBM()
|
||||
: InsetMathNest(1)
|
||||
{}
|
||||
|
||||
|
||||
Inset * InsetMathBM::clone() const
|
||||
{
|
||||
return new InsetMathBM(*this);
|
||||
}
|
||||
|
||||
|
||||
void InsetMathBM::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
{
|
||||
//FontSetChanger dummy(mi.base, "mathbf");
|
||||
cell(0).metrics(mi, dim);
|
||||
metricsMarkers(dim);
|
||||
++dim.wid; // for 'double stroke'
|
||||
}
|
||||
|
||||
|
||||
void InsetMathBM::draw(PainterInfo & pi, int x, int y) const
|
||||
{
|
||||
//FontSetChanger dummy(pi.base, "mathbf");
|
||||
cell(0).draw(pi, x + 1, y);
|
||||
cell(0).draw(pi, x + 2, y);
|
||||
drawMarkers(pi, x, y);
|
||||
}
|
||||
|
||||
|
||||
void InsetMathBM::metricsT(TextMetricsInfo const & mi, Dimension & /*dim*/) const
|
||||
{
|
||||
// FIXME: BROKEN!
|
||||
Dimension dim;
|
||||
cell(0).metricsT(mi, dim);
|
||||
}
|
||||
|
||||
|
||||
void InsetMathBM::drawT(TextPainter & pain, int x, int y) const
|
||||
{
|
||||
cell(0).drawT(pain, x, y);
|
||||
}
|
||||
|
||||
|
||||
void InsetMathBM::validate(LaTeXFeatures & features) const
|
||||
{
|
||||
InsetMathNest::validate(features);
|
||||
features.require("bm");
|
||||
}
|
||||
|
||||
|
||||
void InsetMathBM::write(WriteStream & os) const
|
||||
{
|
||||
os << "\\bm{" << cell(0) << "}";
|
||||
}
|
||||
|
||||
|
||||
void InsetMathBM::infoize(odocstream & os) const
|
||||
{
|
||||
os << "bm ";
|
||||
}
|
||||
|
||||
|
||||
} // namespace lyx
|
@ -1,47 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file InsetMathBM.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Bernhard Roider
|
||||
*
|
||||
* Full author contact details are available in file CREDITS.
|
||||
*/
|
||||
|
||||
#ifndef MATH_BMINSET_H
|
||||
#define MATH_BMINSET_H
|
||||
|
||||
#include "InsetMathNest.h"
|
||||
|
||||
|
||||
namespace lyx {
|
||||
|
||||
|
||||
/// Inset for \bm
|
||||
class InsetMathBM : public InsetMathNest {
|
||||
public:
|
||||
///
|
||||
InsetMathBM();
|
||||
///
|
||||
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||
///
|
||||
void draw(PainterInfo & pi, int x, int y) const;
|
||||
///
|
||||
void metricsT(TextMetricsInfo const & mi, Dimension & dim) const;
|
||||
///
|
||||
void drawT(TextPainter & pi, int x, int y) const;
|
||||
///
|
||||
void validate(LaTeXFeatures & features) const;
|
||||
///
|
||||
void write(WriteStream & os) const;
|
||||
///
|
||||
void infoize(odocstream & os) const;
|
||||
private:
|
||||
virtual Inset * clone() const;
|
||||
};
|
||||
|
||||
|
||||
} // namespace lyx
|
||||
|
||||
#endif
|
@ -21,8 +21,8 @@
|
||||
|
||||
namespace lyx {
|
||||
|
||||
InsetMathBoldSymbol::InsetMathBoldSymbol()
|
||||
: InsetMathNest(1)
|
||||
InsetMathBoldSymbol::InsetMathBoldSymbol(Kind kind)
|
||||
: InsetMathNest(1), kind_(kind)
|
||||
{}
|
||||
|
||||
|
||||
@ -67,19 +67,33 @@ void InsetMathBoldSymbol::drawT(TextPainter & pain, int x, int y) const
|
||||
void InsetMathBoldSymbol::validate(LaTeXFeatures & features) const
|
||||
{
|
||||
InsetMathNest::validate(features);
|
||||
features.require("amssymb");
|
||||
features.require("bm");
|
||||
}
|
||||
|
||||
|
||||
void InsetMathBoldSymbol::write(WriteStream & os) const
|
||||
{
|
||||
switch (kind_) {
|
||||
case BOLD:
|
||||
os << "\\boldsymbol{" << cell(0) << "}";
|
||||
break;
|
||||
case HEAVY:
|
||||
os << "\\heavysymbol{" << cell(0) << "}";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void InsetMathBoldSymbol::infoize(odocstream & os) const
|
||||
{
|
||||
switch (kind_) {
|
||||
case BOLD:
|
||||
os << "Boldsymbol ";
|
||||
break;
|
||||
case HEAVY:
|
||||
os << "Heavysymbol ";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -21,8 +21,12 @@ namespace lyx {
|
||||
/// Inset for AMSTeX's \boldsymbol
|
||||
class InsetMathBoldSymbol : public InsetMathNest {
|
||||
public:
|
||||
enum Kind {
|
||||
BOLD,
|
||||
HEAVY
|
||||
};
|
||||
///
|
||||
InsetMathBoldSymbol();
|
||||
InsetMathBoldSymbol(Kind kind = BOLD);
|
||||
///
|
||||
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||
///
|
||||
@ -37,6 +41,8 @@ public:
|
||||
void write(WriteStream & os) const;
|
||||
///
|
||||
void infoize(odocstream & os) const;
|
||||
///
|
||||
Kind kind_;
|
||||
private:
|
||||
virtual Inset * clone() const;
|
||||
};
|
||||
|
@ -570,7 +570,6 @@ void InsetMathHull::validate(LaTeXFeatures & features) const
|
||||
//if (features.amsstyle)
|
||||
// return;
|
||||
|
||||
features.require("boldsymbol");
|
||||
//features.binom = true;
|
||||
|
||||
InsetMathGrid::validate(features);
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
#include "InsetMathAMSArray.h"
|
||||
#include "InsetMathArray.h"
|
||||
#include "InsetMathBM.h"
|
||||
#include "InsetMathBoldSymbol.h"
|
||||
#include "InsetMathBox.h"
|
||||
#include "InsetMathCases.h"
|
||||
@ -376,10 +375,10 @@ MathAtom createInsetMath(docstring const & s)
|
||||
return MathAtom(new InsetMathFrac(InsetMathFrac::ATOP));
|
||||
if (s == "lefteqn")
|
||||
return MathAtom(new InsetMathLefteqn);
|
||||
if (s == "boldsymbol")
|
||||
return MathAtom(new InsetMathBoldSymbol);
|
||||
if (s == "bm")
|
||||
return MathAtom(new InsetMathBM);
|
||||
if (s == "boldsymbol" || s == "bm")
|
||||
return MathAtom(new InsetMathBoldSymbol(InsetMathBoldSymbol::BOLD));
|
||||
if (s == "heavysymbol" || s == "hm")
|
||||
return MathAtom(new InsetMathBoldSymbol(InsetMathBoldSymbol::HEAVY));
|
||||
if (s == "color" || s == "normalcolor")
|
||||
return MathAtom(new InsetMathColor(true));
|
||||
if (s == "textcolor")
|
||||
|
Loading…
Reference in New Issue
Block a user