]> git.cameronkatri.com Git - mandoc.git/commitdiff
Fix operator precedence according to Brian W. Kernighan and Lorinda
authorIngo Schwarze <schwarze@openbsd.org>
Thu, 6 Jul 2017 00:19:54 +0000 (00:19 +0000)
committerIngo Schwarze <schwarze@openbsd.org>
Thu, 6 Jul 2017 00:19:54 +0000 (00:19 +0000)
L. Cherry, "Typesetting Mathematics - User's Guide (Second Edition)",
August 15, 1978, paragraph 23; swarm of bugs pointed out by bentley@.

22 files changed:
eqn.c
eqn_term.c
regress/eqn/fromto/Makefile
regress/eqn/fromto/precedence.in [new file with mode: 0644]
regress/eqn/fromto/precedence.out_ascii [new file with mode: 0644]
regress/eqn/fromto/precedence.out_html [new file with mode: 0644]
regress/eqn/over/precedence.in
regress/eqn/over/precedence.out_ascii
regress/eqn/over/precedence.out_html
regress/eqn/subsup/Makefile
regress/eqn/subsup/precedence.in [new file with mode: 0644]
regress/eqn/subsup/precedence.out_ascii [new file with mode: 0644]
regress/eqn/subsup/precedence.out_html [new file with mode: 0644]
regress/eqn/unary/bold.in
regress/eqn/unary/bold.out_ascii
regress/eqn/unary/bold.out_html
regress/eqn/unary/diacrit.in
regress/eqn/unary/diacrit.out_ascii
regress/eqn/unary/diacrit.out_html
regress/eqn/unary/sqrt.in
regress/eqn/unary/sqrt.out_ascii
regress/eqn/unary/sqrt.out_html

diff --git a/eqn.c b/eqn.c
index 4806b933155fe136bd0d13d625cbb96e9565e43a..6711d4f6d20be08276bf04e3d70415f7d616a1bd 100644 (file)
--- a/eqn.c
+++ b/eqn.c
@@ -1,4 +1,4 @@
-/*     $Id: eqn.c,v 1.73 2017/07/05 15:03:27 schwarze Exp $ */
+/*     $Id: eqn.c,v 1.74 2017/07/06 00:19:54 schwarze Exp $ */
 /*
  * Copyright (c) 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv>
  * Copyright (c) 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -819,6 +819,8 @@ next_tok:
                        ep->gsize = size;
                        break;
                }
+               while (parent->args == parent->expectargs)
+                       parent = parent->parent;
                parent = eqn_box_alloc(ep, parent);
                parent->type = EQN_LIST;
                parent->expectargs = 1;
@@ -840,13 +842,25 @@ next_tok:
                        cur->type = EQN_TEXT;
                        cur->text = mandoc_strdup("");
                }
-               /* Handle the "subsup" and "fromto" positions. */
-               if (EQN_TOK_SUP == tok && parent->pos == EQNPOS_SUB) {
+               while (parent->expectargs == 1 && parent->args == 1)
+                       parent = parent->parent;
+               if (tok == EQN_TOK_FROM || tok == EQN_TOK_TO)  {
+                       for (cur = parent; cur != NULL; cur = cur->parent)
+                               if (cur->pos == EQNPOS_SUB ||
+                                   cur->pos == EQNPOS_SUP ||
+                                   cur->pos == EQNPOS_SUBSUP ||
+                                   cur->pos == EQNPOS_SQRT ||
+                                   cur->pos == EQNPOS_OVER)
+                                       break;
+                       if (cur != NULL)
+                               parent = cur->parent;
+               }
+               if (tok == EQN_TOK_SUP && parent->pos == EQNPOS_SUB) {
                        parent->expectargs = 3;
                        parent->pos = EQNPOS_SUBSUP;
                        break;
                }
-               if (EQN_TOK_TO == tok && parent->pos == EQNPOS_FROM) {
+               if (tok == EQN_TOK_TO && parent->pos == EQNPOS_FROM) {
                        parent->expectargs = 3;
                        parent->pos = EQNPOS_FROMTO;
                        break;
@@ -895,6 +909,8 @@ next_tok:
                        cur->type = EQN_TEXT;
                        cur->text = mandoc_strdup("");
                }
+               while (parent->args == parent->expectargs)
+                       parent = parent->parent;
                while (EQN_SUBEXPR == parent->type)
                        parent = parent->parent;
                parent = eqn_box_makebinary(ep, EQNPOS_OVER, parent);
@@ -1099,13 +1115,6 @@ next_tok:
                                parent = split->parent;
                        break;
                }
-               /*
-                * Post-process list status.
-                */
-               while (parent->type == EQN_LIST &&
-                   parent->expectargs == 1 &&
-                   parent->args == 1)
-                       parent = parent->parent;
                break;
        default:
                abort();
index 33edf415a1b9a75253889bc58aa66d9e10af5dab..e11b0485a18ad25991a4ab93a4ecc6e062c46575 100644 (file)
@@ -1,4 +1,4 @@
-/*     $Id: eqn_term.c,v 1.10 2017/07/05 15:03:27 schwarze Exp $ */
+/*     $Id: eqn_term.c,v 1.11 2017/07/06 00:19:54 schwarze Exp $ */
 /*
  * Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
  * Copyright (c) 2014, 2015, 2017 Ingo Schwarze <schwarze@openbsd.org>
@@ -113,15 +113,6 @@ eqn_box(struct termp *p, const struct eqn_box *bp)
 
        if (bp->font != EQNFONT_NONE)
                term_fontpop(p);
-       if ((bp->type == EQN_LIST && bp->expectargs > 1) ||
-           (bp->type == EQN_PILE && (bp->prev || bp->next)) ||
-           (bp->parent != NULL && bp->parent->pos == EQNPOS_SQRT)) {
-               p->flags |= TERMP_NOSPACE;
-               term_word(p, bp->right != NULL ? bp->right : ")");
-               if (bp->parent->type == EQN_SUBEXPR && bp->next != NULL)
-                       p->flags |= TERMP_NOSPACE;
-       }
-
        if (bp->top != NULL) {
                p->flags |= TERMP_NOSPACE;
                term_word(p, bp->top);
@@ -130,4 +121,12 @@ eqn_box(struct termp *p, const struct eqn_box *bp)
                p->flags |= TERMP_NOSPACE;
                term_word(p, "_");
        }
+       if ((bp->type == EQN_LIST && bp->expectargs > 1) ||
+           (bp->type == EQN_PILE && (bp->prev || bp->next)) ||
+           (bp->parent != NULL && bp->parent->pos == EQNPOS_SQRT)) {
+               p->flags |= TERMP_NOSPACE;
+               term_word(p, bp->right != NULL ? bp->right : ")");
+               if (bp->parent->type == EQN_SUBEXPR && bp->next != NULL)
+                       p->flags |= TERMP_NOSPACE;
+       }
 }
index a2012e8f9321df2e669006ab7e5114d1b7ef8c3e..1384c543153378b9486c2dae0469c35feb364679 100644 (file)
@@ -1,6 +1,6 @@
-# $OpenBSD: Makefile,v 1.2 2015/01/01 15:34:43 schwarze Exp $
+# $OpenBSD: Makefile,v 1.3 2017/07/06 00:08:52 schwarze Exp $
 
-REGRESS_TARGETS         = basic noarg
-HTML_TARGETS    = basic noarg
+REGRESS_TARGETS  = basic noarg precedence
+HTML_TARGETS    = basic noarg precedence
 
 .include <bsd.regress.mk>
diff --git a/regress/eqn/fromto/precedence.in b/regress/eqn/fromto/precedence.in
new file mode 100644 (file)
index 0000000..939ab51
--- /dev/null
@@ -0,0 +1,15 @@
+.\" $OpenBSD: precedence.in,v 1.1 2017/07/06 00:08:52 schwarze Exp $
+.Dd $Mdocdate: July 6 2017 $
+.Dt SUBSUP-PRECEDENCE 1
+.Os
+.Sh NAME
+.Nm subsup-precedence
+.Nd precedence of subscripts and superscripts
+.Sh DESCRIPTION
+.ps 36
+initial text
+.EQ
+X from a under to c hat ; roman X from bold a to italic c ;
+X sub 1 sup 2 from a sub c sup e to o sub r sup s
+.EN
+final text
diff --git a/regress/eqn/fromto/precedence.out_ascii b/regress/eqn/fromto/precedence.out_ascii
new file mode 100644 (file)
index 0000000..1eba1be
--- /dev/null
@@ -0,0 +1,9 @@
+SUBSUP-PRECEDENCE(1)        General Commands Manual       SUBSUP-PRECEDENCE(1)
+
+N\bNA\bAM\bME\bE
+     s\bsu\bub\bbs\bsu\bup\bp-\b-p\bpr\bre\bec\bce\bed\bde\ben\bnc\bce\be - precedence of subscripts and superscripts
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+     initial text _\bX__\ba_^_\bc^ ; X_a\ba^_\bc ; _\bX_1^2__\ba__\bc^_\be^_\bo__\br^_\bs final text
+
+OpenBSD                          July 6, 2017                          OpenBSD
diff --git a/regress/eqn/fromto/precedence.out_html b/regress/eqn/fromto/precedence.out_html
new file mode 100644 (file)
index 0000000..bb9074e
--- /dev/null
@@ -0,0 +1 @@
+<mrow><munderover><mi>X</mi><munder><mi>a</mi><mo>_</mo></munder><mover><mi>c</mi><mo>^</mo></mover></munderover><mo>;</mo><munderover><mrow><mi fontstyle="normal">X</mi></mrow><mrow><mi fontweight="bold">a</mi></mrow><mrow><mi>c</mi></mrow></munderover><mo>;</mo><munderover><msubsup><mi>X</mi><mn>1</mn><mn>2</mn></msubsup><msubsup><mi>a</mi><mi>c</mi><mi>e</mi></msubsup><msubsup><mi>o</mi><mi>r</mi><mi>s</mi></msubsup></munderover></mrow>
index 3bc0e7fc86a0484d2c6327e8eae4b80d5e023695..12b28cef4eaa2745303930c202455be01f0ed7bc 100644 (file)
@@ -1,5 +1,5 @@
-.\" $OpenBSD: precedence.in,v 1.2 2017/07/04 14:53:23 schwarze Exp $
-.Dd $Mdocdate: July 4 2017 $
+.\" $OpenBSD: precedence.in,v 1.3 2017/07/06 00:08:52 schwarze Exp $
+.Dd $Mdocdate: July 6 2017 $
 .Dt OVER-PRECEDENCE 1
 .Os
 .Sh NAME
@@ -8,6 +8,7 @@
 .Sh DESCRIPTION
 initial text
 .EQ
-1 + x + x sup 2 over 2 + x sup 3 over { 2 * 3 }
+1 + x + x sup 2 over 2 + x sup 3 over { 2 * 3 } ;
+a hat over c tilde ; bold a over bold c ; sqrt a over sqrt c
 .EN
 final text
index 92529bb43403cf50d879b78560b27b2bb1a96654..a77aa47fb60ffa4f30a9bea342afd305ccb186f6 100644 (file)
@@ -4,6 +4,7 @@ N\bNA\bAM\bME\bE
      o\bov\bve\ber\br-\b-p\bpr\bre\bec\bce\bed\bde\ben\bnc\bce\be - precedence of the fraction operator
 
 D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
-     initial text 1 + _\bx + _\bx^2/2 + _\bx^3/(2 * 3) final text
+     initial text 1 + _\bx + _\bx^2/2 + _\bx^3/(2 * 3) ; _\ba^/_\bc~ ; a\ba/c\bc ; sqrt(_\ba)/sqrt(_\bc)
+     final text
 
-OpenBSD                          July 4, 2017                          OpenBSD
+OpenBSD                          July 6, 2017                          OpenBSD
index b7c4f36d526e5da6680294608562bcff2b557e66..52e45eb557f3dff10c9b1f170b3111757497f5cd 100644 (file)
@@ -1 +1 @@
-<mrow><mn>1</mn><mo>+</mo><mi>x</mi><mo>+</mo><mfrac><msup><mi>x</mi><mn>2</mn></msup><mn>2</mn></mfrac><mo>+</mo><mfrac><msup><mi>x</mi><mn>3</mn></msup><mrow><mn>2</mn><mo>*</mo><mn>3</mn></mrow></mfrac></mrow>
+<mrow><mn>1</mn><mo>+</mo><mi>x</mi><mo>+</mo><mfrac><msup><mi>x</mi><mn>2</mn></msup><mn>2</mn></mfrac><mo>+</mo><mfrac><msup><mi>x</mi><mn>3</mn></msup><mrow><mn>2</mn><mo>*</mo><mn>3</mn></mrow></mfrac><mo>;</mo><mfrac><mover><mi>a</mi><mo>^</mo></mover><mover><mi>c</mi><mo>~</mo></mover></mfrac><mo>;</mo><mfrac><mrow><mi fontweight="bold">a</mi></mrow><mrow><mi fontweight="bold">c</mi></mrow></mfrac><mo>;</mo><mfrac><msqrt><mi>a</mi></msqrt><msqrt><mi>c</mi></msqrt></mfrac></mrow>
index 4e11b33d5c5b92a8eae562abe5479b07c80d80a3..a780104630e51fdb18b6cfab5a0962ea433e4dab 100644 (file)
@@ -1,6 +1,6 @@
-# $OpenBSD: Makefile,v 1.2 2015/01/01 15:34:43 schwarze Exp $
+# $OpenBSD: Makefile,v 1.3 2017/07/06 00:08:52 schwarze Exp $
 
-REGRESS_TARGETS         = combine noarg sub_group
-HTML_TARGETS    = combine noarg sub_group
+REGRESS_TARGETS  = combine noarg precedence sub_group
+HTML_TARGETS    = combine noarg precedence sub_group
 
 .include <bsd.regress.mk>
diff --git a/regress/eqn/subsup/precedence.in b/regress/eqn/subsup/precedence.in
new file mode 100644 (file)
index 0000000..d184fc0
--- /dev/null
@@ -0,0 +1,14 @@
+.\" $OpenBSD: precedence.in,v 1.1 2017/07/06 00:08:52 schwarze Exp $
+.Dd $Mdocdate: July 6 2017 $
+.Dt SUBSUP-PRECEDENCE 1
+.Os
+.Sh NAME
+.Nm subsup-precedence
+.Nd precedence of subscripts and superscripts
+.Sh DESCRIPTION
+initial text
+.EQ
+x hat sub 1 under sup 2 bar + e tilde sup x hat sub s dyad ;
+roman I sub bold I sup italic I + roman I sup bold I sub italic I
+.EN
+final text
diff --git a/regress/eqn/subsup/precedence.out_ascii b/regress/eqn/subsup/precedence.out_ascii
new file mode 100644 (file)
index 0000000..60619b5
--- /dev/null
@@ -0,0 +1,9 @@
+SUBSUP-PRECEDENCE(1)        General Commands Manual       SUBSUP-PRECEDENCE(1)
+
+N\bNA\bAM\bME\bE
+     s\bsu\bub\bbs\bsu\bup\bp-\b-p\bpr\bre\bec\bce\bed\bde\ben\bnc\bce\be - precedence of subscripts and superscripts
+
+D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
+     initial text _\bx^_1_^2 + _\be~^_\bx^__\bs<-> ; I_I\bI^_\bI + I^I\bI__\bI final text
+
+OpenBSD                          July 6, 2017                          OpenBSD
diff --git a/regress/eqn/subsup/precedence.out_html b/regress/eqn/subsup/precedence.out_html
new file mode 100644 (file)
index 0000000..1cad9ce
--- /dev/null
@@ -0,0 +1 @@
+<mrow><msubsup><mover><mi>x</mi><mo>^</mo></mover><munder><mn>1</mn><mo>_</mo></munder><mover><mn>2</mn><mo></mo></mover></msubsup><mo>+</mo><msup><mover><mi>e</mi><mo>~</mo></mover><msub><mover><mi>x</mi><mo>^</mo></mover><mover><mi>s</mi><mo>&#8596;</mo></mover></msub></msup><mo>;</mo><msubsup><mrow><mi fontstyle="normal">I</mi></mrow><mrow><mi fontweight="bold">I</mi></mrow><mrow><mi>I</mi></mrow></msubsup><mo>+</mo><msup><mrow><mi fontstyle="normal">I</mi></mrow><msub><mrow><mi fontweight="bold">I</mi></mrow><mrow><mi>I</mi></mrow></msub></msup></mrow>
index ad098a830656c62123999548f581ddb4112f4e11..e77398f46e95ac82494a304c2c631ff2c67d6a9b 100644 (file)
@@ -1,5 +1,5 @@
-.\" $OpenBSD: bold.in,v 1.2 2017/07/04 14:53:23 schwarze Exp $
-.Dd $Mdocdate: July 4 2017 $
+.\" $OpenBSD: bold.in,v 1.3 2017/07/06 00:08:52 schwarze Exp $
+.Dd $Mdocdate: July 6 2017 $
 .Dt UNARY-BOLD 1
 .Os
 .Sh NAME
@@ -8,6 +8,6 @@
 .Sh DESCRIPTION
 initial text
 .EQ
-bold { sin "sin" }
+bold { sin "sin" } "text" bold x hat
 .EN
 final text
index c20dc638a6ba434fb90a4915587867290897e559..7356ede0a565f70d66aee8ad9344d673e1c5c25d 100644 (file)
@@ -4,6 +4,6 @@ N\bNA\bAM\bME\bE
      u\bun\bna\bar\bry\by-\b-b\bbo\bol\bld\bd - font handling in bold boxes
 
 D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
-     initial text (\b(sin s\bsi\bin\bn)\b) final text
+     initial text (\b(sin s\bsi\bin\bn)\b_\bt_\be_\bx_\bt x\bx^\bfinal text
 
-OpenBSD                          July 4, 2017                          OpenBSD
+OpenBSD                          July 6, 2017                          OpenBSD
index 56d6762f913c6328026ef2fe2d24b469cac12e5e..e1263a4fd30531b1a880deff35138dc9d9519617 100644 (file)
@@ -1 +1 @@
-<mrow><mrow><mrow><mi>sin</mi><mi fontweight="bold">sin</mi></mrow></mrow></mrow>
+<mrow><mrow><mrow><mi>sin</mi><mi fontweight="bold">sin</mi></mrow></mrow><mi fontstyle="italic">text</mi><mrow><mover><mi fontweight="bold">x</mi><mo>^</mo></mover></mrow></mrow>
index 6e91f847e1fb25b08ed6495f3edd74c56009240c..ab83dbb1b8b8ff170ab4c702e0701c88b69d2dbd 100644 (file)
@@ -1,5 +1,5 @@
-.\" $OpenBSD: diacrit.in,v 1.2 2017/07/04 14:53:23 schwarze Exp $
-.Dd $Mdocdate: July 4 2017 $
+.\" $OpenBSD: diacrit.in,v 1.3 2017/07/06 00:08:52 schwarze Exp $
+.Dd $Mdocdate: July 6 2017 $
 .Dt UNARY-DIACRIT 1
 .Os
 .Sh NAME
@@ -10,5 +10,6 @@ initial text
 .EQ
 x dot x dotdot x hat x tilde x vec x dyad
 { x + y } bar { x + y } under
+x tilde hat
 .EN
 final text
index f2c5b0bbf8d20a53ccfdbfc52fdab97be1eca280..62ac035f14067d2ab85f17d2abcbdf76b18b63db 100644 (file)
@@ -4,6 +4,6 @@ N\bNA\bAM\bME\bE
      u\bun\bna\bar\bry\by-\b-d\bdi\bia\bac\bcr\bri\bit\bt - diacritical marks in equations
 
 D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
-     initial text _\bx. _\bx" _\bx^ _\bx~ _\bx-> _\bx<-> (_\bx + _\by) (_\bx + _\by)_ final text
+     initial text _\bx. _\bx" _\bx^ _\bx~ _\bx-> _\bx<-> (_\bx + _\by) (_\bx + _\by)_ _\bx~^ final text
 
-OpenBSD                          July 4, 2017                          OpenBSD
+OpenBSD                          July 6, 2017                          OpenBSD
index 02dcc2f4911170a2eb718ca7d49b74618e94f5a4..d3d4d3613af54d1f1bb99359d17455fdd4c9d57f 100644 (file)
@@ -1 +1 @@
-<mrow><mover><mi>x</mi><mo>&#729;</mo></mover><mover><mi>x</mi><mo>&#168;</mo></mover><mover><mi>x</mi><mo>^</mo></mover><mover><mi>x</mi><mo>~</mo></mover><mover><mi>x</mi><mo>&#8594;</mo></mover><mover><mi>x</mi><mo>&#8596;</mo></mover><mover><mrow><mi>x</mi><mo>+</mo><mi>y</mi></mrow><mo></mo></mover><munder><mrow><mi>x</mi><mo>+</mo><mi>y</mi></mrow><mo>_</mo></munder></mrow>
+<mrow><mover><mi>x</mi><mo>&#729;</mo></mover><mover><mi>x</mi><mo>&#168;</mo></mover><mover><mi>x</mi><mo>^</mo></mover><mover><mi>x</mi><mo>~</mo></mover><mover><mi>x</mi><mo>&#8594;</mo></mover><mover><mi>x</mi><mo>&#8596;</mo></mover><mover><mrow><mi>x</mi><mo>+</mo><mi>y</mi></mrow><mo></mo></mover><munder><mrow><mi>x</mi><mo>+</mo><mi>y</mi></mrow><mo>_</mo></munder><mover><mover><mi>x</mi><mo>~</mo></mover><mo>^</mo></mover></mrow>
index a70596242579e7396a2b407e3d04ff92546a6db9..e007ff0173982974519d6e6871d92cc13c9979a6 100644 (file)
@@ -1,5 +1,5 @@
-.\" $OpenBSD: sqrt.in,v 1.4 2017/07/04 14:53:23 schwarze Exp $
-.Dd $Mdocdate: July 4 2017 $
+.\" $OpenBSD: sqrt.in,v 1.5 2017/07/06 00:08:52 schwarze Exp $
+.Dd $Mdocdate: July 6 2017 $
 .Dt UNARY-SQRT 1
 .Os
 .Sh NAME
@@ -8,6 +8,6 @@
 .Sh DESCRIPTION
 initial text
 .EQ
-r = sqrt { x sup 2 + y sup 2 } + sqrt a+b + sqrt { } + sqrt
+r = sqrt { x sup 2 + y sup 2 } + sqrt a+b + sqrt x hat + sqrt { } + sqrt
 .EN
 final text
index 607a6013aa3667037ce66b763352fd21d67b3a32..72b7047debcd8a2cb1e5bf5e6ad44ccbb798288d 100644 (file)
@@ -4,6 +4,7 @@ N\bNA\bAM\bME\bE
      u\bun\bna\bar\bry\by-\b-s\bsq\bqr\brt\bt - square root
 
 D\bDE\bES\bSC\bCR\bRI\bIP\bPT\bTI\bIO\bON\bN
-     initial text _\br = sqrt(_\bx^2 + _\by^2) + sqrt(_\ba + _\bb) + sqrt() + sqrt final text
+     initial text _\br = sqrt(_\bx^2 + _\by^2) + sqrt(_\ba + _\bb) + sqrt(_\bx^) + sqrt() + sqrt
+     final text
 
-OpenBSD                          July 4, 2017                          OpenBSD
+OpenBSD                          July 6, 2017                          OpenBSD
index ca2de199e98beaa84ce621826a9f1ccc00f3d531..0b5fe37e1d54bbcd87184ef9da4cd90ead839c41 100644 (file)
@@ -1 +1 @@
-<mrow><mi>r</mi><mo>=</mo><msqrt><mrow><msup><mi>x</mi><mn>2</mn></msup><mo>+</mo><msup><mi>y</mi><mn>2</mn></msup></mrow></msqrt><mo>+</mo><msqrt><mrow><mi>a</mi><mo>+</mo><mi>b</mi></mrow></msqrt><mo>+</mo><msqrt><mrow></mrow></msqrt><mo>+</mo><msqrt></msqrt></mrow>
+<mrow><mi>r</mi><mo>=</mo><msqrt><mrow><msup><mi>x</mi><mn>2</mn></msup><mo>+</mo><msup><mi>y</mi><mn>2</mn></msup></mrow></msqrt><mo>+</mo><msqrt><mrow><mi>a</mi><mo>+</mo><mi>b</mi></mrow></msqrt><mo>+</mo><msqrt><mover><mi>x</mi><mo>^</mo></mover></msqrt><mo>+</mo><msqrt><mrow></mrow></msqrt><mo>+</mo><msqrt></msqrt></mrow>