>>>>> "Jean-Marc" == Jean-Marc Lasgouttes <[EMAIL PROTECTED]> writes:

I applied all the bits except for this latest patch. I attach the
remaining bits.

Jean-Marc> OK, this new patch fixes this problem too. There are two
Jean-Marc> parts:

Jean-Marc> - easy one: export x^2, but {xy}^2 and {x^{2}}^2 (this last
Jean-Marc> one has only one element in the nucleus, but we want braces
Jean-Marc> nevertheless.

Jean-Marc> - more tricky part: when a ^ or _ is encountered, it the
Jean-Marc> previous inset is a MathBraceInset (which encloses in {}),
Jean-Marc> use only the inside of the inset as nucleus. This is done
Jean-Marc> twice, in the parser (for when reading files or doing undo,
Jean-Marc> cutnpaste) and in mathinset (for interactive entry).

Jean-Marc> I think it works well, and now at least it is possible to
Jean-Marc> enter things like {x'}^2 (although not as easily as one
Jean-Marc> could have hoped).

JMarc

Index: src/mathed/math_scriptinset.C
===================================================================
--- src/mathed/math_scriptinset.C	(revision 14795)
+++ src/mathed/math_scriptinset.C	(working copy)
@@ -418,7 +418,11 @@ bool MathScriptInset::idxUpDown(LCursor 
 void MathScriptInset::write(WriteStream & os) const
 {
 	if (nuc().size()) {
-		os << nuc();
+		if (nuc().size() == 1 
+		    && ! nuc().begin()->nucleus()->asScriptInset())
+			os << nuc();
+		else
+			os << '{' << nuc() << '}';
 		//if (nuc().back()->takesLimits()) {
 			if (limits_ == -1)
 				os << "\\nolimits ";
Index: src/mathed/math_parser.C
===================================================================
--- src/mathed/math_parser.C	(revision 14789)
+++ src/mathed/math_parser.C	(working copy)
@@ -810,10 +810,9 @@ void Parser::parse1(MathGridInset & grid
 			MathScriptInset * p = cell->back().nucleus()->asScriptInset();
 			// special handling of {}-bases
 			// is this always correct?
-			// It appears that this is wrong (Dekel)
-			//if (p->nuc().size() == 1 && p->nuc().back()->asNestInset() &&
-			//    p->nuc().back()->extraBraces())
-			//	p->nuc() = p->nuc().back()->asNestInset()->cell(0);
+			if (p->nuc().size() == 1 
+			    && p->nuc().back()->asBraceInset())
+				p->nuc() = p->nuc().back()->asNestInset()->cell(0);
 			parse(p->cell(p->idxOfScript(up)), FLAG_ITEM, mode);
 			if (limits) {
 				p->limits(limits);
Index: src/mathed/math_nestinset.C
===================================================================
--- src/mathed/math_nestinset.C	(revision 14795)
+++ src/mathed/math_nestinset.C	(working copy)
@@ -1272,6 +1272,12 @@ bool MathNestInset::script(LCursor & cur
 		}
 		--cur.pos();
 		MathScriptInset * inset = cur.nextAtom().nucleus()->asScriptInset();
+		// special handling of {}-bases
+		// is this always correct?
+		if (inset->nuc().size() == 1 
+		    && inset->nuc().back()->asBraceInset())
+			inset->nuc() = inset->nuc().back()->asNestInset()->cell(0);
+		
 		cur.push(*inset);
 		cur.idx() = 1;
 		cur.pos() = 0;

Reply via email to