require amsmath for some under/over arrows

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9438 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2005-01-05 17:34:12 +00:00
parent bb8fcec6c9
commit b1ab49f40d
3 changed files with 27 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2005-01-03 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* math_decorationinset.C (ams, validate): new methods. Require
amsmath when using AMS-LaTeX over and under arrows.
2005-01-04 Jürgen Spitzmüller <j.spitzmueller@gmx.de>
* math_nestinset.C: reintroduce LFUN_{SUB|SUPER}SCRIPT.

View File

@ -11,6 +11,7 @@
#include <config.h>
#include "LaTeXFeatures.h"
#include "math_decorationinset.h"
#include "math_data.h"
#include "math_support.h"
@ -90,6 +91,16 @@ bool MathDecorationInset::wide() const
}
bool MathDecorationInset::ams() const
{
return
key_->name == "overleftrightarrow" ||
key_->name == "underleftarrow" ||
key_->name == "underrightarrow" ||
key_->name == "underleftrightarrow";
}
void MathDecorationInset::metrics(MetricsInfo & mi, Dimension & dim) const
{
cell(0).metrics(mi, dim);
@ -122,6 +133,13 @@ void MathDecorationInset::draw(PainterInfo & pi, int x, int y) const
}
void MathDecorationInset::validate(LaTeXFeatures & features) const
{
if (ams())
features.require("amsmath");
}
void MathDecorationInset::write(WriteStream & os) const
{
if (os.fragile() && protect())

View File

@ -30,6 +30,8 @@ public:
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void validate(LaTeXFeatures & features) const;
///
void normalize(NormalStream & os) const;
///
void infoize(std::ostream & os) const;
@ -44,6 +46,8 @@ private:
bool protect() const;
/// is it a wide decoration?
bool wide() const;
/// does this need the amsmath package?
bool ams() const;
///
latexkeys const * key_;