i edited the patch a bit and made it a bit nicer by taking handle_ert out of the if's

i also attach a second version which is much shorter

both untested

Uwe Stöhr wrote:
The attached patch for trunk fixes
http://bugzilla.lyx.org/show_bug.cgi?id=2504

http://bugzilla.lyx.org/show_bug.cgi?id=2504#c7
describes what the patch is for.

Jürgen, can this also go into branch?

regards Uwe



--
http://leuven.economists.nl
Index: text.cpp
===================================================================
--- text.cpp	(revision 24220)
+++ text.cpp	(working copy)
@@ -2345,6 +2345,43 @@
 
 		else if (t.cs() == "parbox")
 			parse_box(p, os, FLAG_ITEM, outer, context, true);
+
+		//\makebox() is part of the picture environment and different from \makebox{}
+		//\makebox{} will be parsed by parse_box when bug 2956 is fixed
+		else if (t.cs() == "makebox") {
+			string arg = p.get_token().string(); // should be '(' or '['
+			arg += parse_text_snippet(p, FLAG_BRACK_LAST, outer, context) + "]";
+			if (p.next_token().character() == '[') {
+				p.get_token(); // eat '['
+				arg += "[" + parse_text_snippet(p, FLAG_BRACK_LAST,
+					outer, context) + "]";
+			}
+			handle_ert(os, "\\makebox" + arg, context);
+		}
 
 		else if (t.cs() == "smallskip" ||
 			 t.cs() == "medskip" ||
Index: text.cpp
===================================================================
--- text.cpp	(revision 24220)
+++ text.cpp	(working copy)
@@ -2345,6 +2345,43 @@
 
 		else if (t.cs() == "parbox")
 			parse_box(p, os, FLAG_ITEM, outer, context, true);
+		
+		//\makebox() is part of the picture environment and different from \makebox{}
+		//\makebox{} will be parsed by parse_box when bug 2956 is fixed
+		else if (t.cs() == "makebox") {
+			string arg;
+			if (p.next_token().character() == '(') {
+				//the syntax is: \makebox(x,y)[position]{content}
+				//the content can be left as is, the rest is put into an ERT
+				p.get_token(); // eat '('
+				arg = "(" + parse_text_snippet(p, FLAG_BRACK_LAST,
+					outer, context) + "]";
+			} else {
+				//the syntax is: \makebox[width][position]{content}
+				if (p.next_token().character() == '[') {
+					p.get_token(); // eat '['
+					arg = "[" + parse_text_snippet(p, FLAG_BRACK_LAST,
+						outer, context) + "]";
+					if (p.next_token().character() == '[') {
+						p.get_token(); // eat '['
+						arg += "[" + parse_text_snippet(p, FLAG_BRACK_LAST,
+							outer, context) + "]";
+					}
+				}
+			}
+			handle_ert(os, "\\makebox" + arg, context);
+		}
 
 		else if (t.cs() == "smallskip" ||
 			 t.cs() == "medskip" ||

Reply via email to