From c7c443e5e2bbf0967e3fa24bf536460b6cd35d9c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Fri, 18 Jan 2002 14:27:54 +0000 Subject: [PATCH] Martin's validate() patch (\pm\varepsilon\smile) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3417 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/math_charinset.C | 8 ++++++++ src/mathed/math_charinset.h | 2 ++ src/mathed/math_stringinset.C | 12 +++++++----- src/mathed/math_symbolinset.C | 11 ++++++----- 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/src/mathed/math_charinset.C b/src/mathed/math_charinset.C index 329b68caa0..94207622c7 100644 --- a/src/mathed/math_charinset.C +++ b/src/mathed/math_charinset.C @@ -14,6 +14,7 @@ #include "math_parser.h" #include "debug.h" #include "math_mathmlstream.h" +#include "LaTeXFeatures.h" MathCharInset::MathCharInset(char c) @@ -121,6 +122,13 @@ void MathCharInset::handleFont(MathTextCodes t) code_ = (code_ == t) ? LM_TC_VAR : t; } +void MathCharInset::validate(LaTeXFeatures & features) const +{ + // Make sure amssymb is put in preamble if Blackboard Bold or + // Fraktur used: + if ( (code_ == LM_TC_BB) || (code_ == LM_TC_EUFRAK) ) + features.require("amssymb"); +} bool MathCharInset::match(MathInset * p) const { diff --git a/src/mathed/math_charinset.h b/src/mathed/math_charinset.h index 20d5e472f1..e20ac397e8 100644 --- a/src/mathed/math_charinset.h +++ b/src/mathed/math_charinset.h @@ -51,6 +51,8 @@ public: /// bool isRelOp() const; /// + void validate(LaTeXFeatures & features) const; + /// void handleFont(MathTextCodes t); /// bool match(MathInset *) const; diff --git a/src/mathed/math_stringinset.C b/src/mathed/math_stringinset.C index a7a7ade2bc..b1efdb6f81 100644 --- a/src/mathed/math_stringinset.C +++ b/src/mathed/math_stringinset.C @@ -11,6 +11,7 @@ #include "Painter.h" #include "math_support.h" #include "math_parser.h" +#include "LaTeXFeatures.h" #include "debug.h" #include @@ -48,6 +49,12 @@ int MathStringInset::width() const return mathed_string_width(code_, mi_, str_); } +void MathStringInset::validate(LaTeXFeatures & features) const +{ + //lyxerr << "stringinset amssymb" << endl; + if (code_ == LM_TC_MSA || code_ == LM_TC_MSB) + features.require("amssymb"); +} void MathStringInset::metrics(MathMetricsInfo const & mi) const { @@ -118,8 +125,3 @@ void MathStringInset::write(WriteStream & os) const } -void MathStringInset::validate(LaTeXFeatures & features) const -{ - // if (...) - // features.require("amssymb"); -} diff --git a/src/mathed/math_symbolinset.C b/src/mathed/math_symbolinset.C index f2f0f5c6a2..121a1814cd 100644 --- a/src/mathed/math_symbolinset.C +++ b/src/mathed/math_symbolinset.C @@ -5,6 +5,7 @@ #include "math_streamstr.h" #include "math_support.h" #include "math_parser.h" +#include "LaTeXFeatures.h" #include "debug.h" @@ -119,6 +120,11 @@ bool MathSymbolInset::takesLimits() const return sym_->token == LM_TK_CMEX; } +void MathSymbolInset::validate(LaTeXFeatures & features) const +{ + if (sym_->token == LM_TK_MSA || sym_->token == LM_TK_MSB) + features.require("amssymb"); +} void MathSymbolInset::normalize(NormalStream & os) const { @@ -183,8 +189,3 @@ void MathSymbolInset::infoize(std::ostream & os) const } -void MathSymbolInset::validate(LaTeXFeatures & features) const -{ - // if (...) - // features.require("amssymb"); -} -- 2.39.2