>>>>> "Andre" == Andre Poenitz <[EMAIL PROTECTED]> writes:

Andre> On Thu, Nov 25, 2004 at 02:52:58PM +0000, Angus Leeming wrote:
>> Actually, it's something of a conscious decision. Andre didn't want
>> to force the user to use AMSMath. Maybe he uses a package that
>> defines \underrightarrow that we don't know about.

Andre> No, I think I just forgot ams in the inset's validate. But I
Andre> think I fixed this already several times...

So this is the fix, right?

JMarc

Index: src/mathed/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/ChangeLog,v
retrieving revision 1.299.2.13
diff -u -p -r1.299.2.13 ChangeLog
--- src/mathed/ChangeLog	30 Dec 2004 14:54:17 -0000	1.299.2.13
+++ src/mathed/ChangeLog	3 Jan 2005 16:40:42 -0000
@@ -1,3 +1,8 @@
+2005-01-03  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
+
+	* math_decorationinset.C (ams, validate): new methods. Require
+	amsmath when using AMS-LaTeX over and under arrows.
+
 2004-12-22  Georg Baum  <[EMAIL PROTECTED]>
 
 	* math_parser.C (addRow, addCol): new, try to add a row or column to
Index: src/mathed/math_decorationinset.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_decorationinset.C,v
retrieving revision 1.51.2.1
diff -u -p -r1.51.2.1 math_decorationinset.C
--- src/mathed/math_decorationinset.C	7 Dec 2004 10:49:52 -0000	1.51.2.1
+++ src/mathed/math_decorationinset.C	3 Jan 2005 16:40:42 -0000
@@ -1,5 +1,6 @@
 #include <config.h>
 
+#include "LaTeXFeatures.h"
 #include "math_decorationinset.h"
 #include "math_support.h"
 #include "math_parser.h"
@@ -71,6 +72,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(MathMetricsInfo & mi) const
 {
 	cell(0).metrics(mi);
@@ -98,6 +109,13 @@ void MathDecorationInset::draw(MathPaint
 	else
 		mathed_draw_deco(pi, x + 1 + (width() - dw_) / 2, y + dy_, dw_, dh_, key_->name);
 	drawMarkers(pi, x, y);
+}
+
+
+void MathDecorationInset::validate(LaTeXFeatures & features) const
+{
+	if (ams())
+		features.require("amsmath");
 }
 
 
Index: src/mathed/math_decorationinset.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_decorationinset.h,v
retrieving revision 1.29.2.1
diff -u -p -r1.29.2.1 math_decorationinset.h
--- src/mathed/math_decorationinset.h	7 Dec 2004 10:49:52 -0000	1.29.2.1
+++ src/mathed/math_decorationinset.h	3 Jan 2005 16:40:42 -0000
@@ -26,6 +26,8 @@ public:
 	///
 	void metrics(MathMetricsInfo & mi) const;
 	///
+	void validate(LaTeXFeatures & features) const;
+	///
 	void normalize(NormalStream & os) const;
 	///
 	void infoize(std::ostream & os) const;
@@ -39,6 +41,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_;
Index: src/mathed/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/ChangeLog,v
retrieving revision 1.460
diff -u -p -r1.460 ChangeLog
--- src/mathed/ChangeLog	28 Dec 2004 15:43:29 -0000	1.460
+++ src/mathed/ChangeLog	3 Jan 2005 16:42:34 -0000
@@ -1,3 +1,8 @@
+2005-01-03  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
+
+	* math_decorationinset.C (ams, validate): new methods. Require
+	amsmath when using AMS-LaTeX over and under arrows.
+
 2004-12-22  Georg Baum  <[EMAIL PROTECTED]>
 
 	* math_parser.C (addRow, addCol): new, try to add a row or column to
Index: src/mathed/math_decorationinset.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_decorationinset.C,v
retrieving revision 1.68
diff -u -p -r1.68 math_decorationinset.C
--- src/mathed/math_decorationinset.C	23 Nov 2004 23:04:50 -0000	1.68
+++ src/mathed/math_decorationinset.C	3 Jan 2005 16:42:34 -0000
@@ -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);
@@ -119,6 +130,13 @@ void MathDecorationInset::draw(PainterIn
 		mathed_draw_deco(pi, x + 1 + (cell(0).width() - dw_) / 2,
 			y + dy_, dw_, dh_, key_->name);
 	drawMarkers(pi, x, y);
+}
+
+
+void MathDecorationInset::validate(LaTeXFeatures & features) const
+{
+	if (ams())
+		features.require("amsmath");
 }
 
 
Index: src/mathed/math_decorationinset.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_decorationinset.h,v
retrieving revision 1.39
diff -u -p -r1.39 math_decorationinset.h
--- src/mathed/math_decorationinset.h	23 Nov 2004 23:04:50 -0000	1.39
+++ src/mathed/math_decorationinset.h	3 Jan 2005 16:42:34 -0000
@@ -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_;

Reply via email to