The color inset might produce latex errors, because it exports the gui name to 
LaTeX instead the latex name, and the GUI name string gets translated.

The attached patch fixes it. I'll apply if I get no objections.

BTW the colorinset ui sucks. Is it possible to not display cell(0) with the 
color name (which is displayed in the status bar anyway)?

Regards,
Jürgen
Index: math_colorinset.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_colorinset.C,v
retrieving revision 1.12
diff -u -r1.12 math_colorinset.C
--- math_colorinset.C	9 Apr 2005 11:13:21 -0000	1.12
+++ math_colorinset.C	12 Jun 2005 15:19:02 -0000
@@ -18,6 +18,8 @@
 #include "LaTeXFeatures.h"
 #include "LColor.h"
 
+#include "gettext.h"
+
 #include "support/std_ostream.h"
 
 using std::auto_ptr;
@@ -28,7 +30,7 @@
 // color "none" (reset to default) needs special treatment
 bool normalcolor(MathArray const & ar)
 {
-	return (asString(ar) == "none");
+	return (asString(ar) == _("none"));
 }
 
 } // namespace anon
@@ -95,12 +97,14 @@
 
 void MathColorInset::write(WriteStream & os) const
 {
+	std::string const color = 
+		lcolor.getLaTeXName(lcolor.getFromGUIName(asString(cell(0))));
 	if (normalcolor(cell(0)))
 		os << "{\\normalcolor " << cell(1) << '}';
 	else if (oldstyle_)
-		os << "{\\color" << '{' << cell(0) << '}' << cell(1) << '}';
+		os << "{\\color" << '{' << color.c_str() << '}' << cell(1) << '}';
 	else
-		os << "\\textcolor" << '{' << cell(0) << "}{" << cell(1) << '}';
+		os << "\\textcolor" << '{' << color.c_str() << "}{" << cell(1) << '}';
 }
 
 
@@ -112,5 +116,5 @@
 
 void MathColorInset::infoize(std::ostream & os) const
 {
-	os << "Color: " << cell(0);
+	os << _("Color") << ": " << asString(cell(0)).c_str();
 }

Reply via email to