New Underbrace code breaks my macro

12 views
Skip to first unread message

Andrew Murdza

unread,
Aug 22, 2025, 6:39:17 PMAug 22
to MathJax Users
I have this code
'\\let\\oldUnderbrace\\underbrace\\renewcommand{\\underbrace}[2][\\arg{}]{\\rowUnderbraceParts#1\\arg_\\parts#2\\endparts#2}\n' +
'\\def\\rowUnderbraceParts#1\\arg#2#3\\parts#4&#5\\endparts{\\rlap{\\oldUnderbrace{\\phantom{#4#5}}#2{#1}}} \\newcommand{\\underbraceNormalUnderText}{\\underbrace[\\raise{-0.8em}{\\begin{array}{c}\\textstyle #2\\end{array}}]{#1}}'
\underbrace works fine. But \underbraceNormalUnderText{1}{x&=1}
Gives the error "Runaway Argument for \rowUnderBraceParts?" My code is a little different than the one you sent because I wanted to replace the old \underbrace rather than make a new one. Strangely, even \\newcommand{\\underbraceNormalUnderText}{\\underbrace[#2]{#1}}' gave that error.

This is my old command that worked for the old underbrace:
underbraceNormalUnderText: ['\\underbrace{#1}_{\\raise{-0.8em}{\\begin{array}{c}\\textstyle #2\\end{array}}}', 2]

Could you please fix the issue with the new \\underbrace and \\underbraceNormalUnderText? The goal was to make it so that the text under the underbrace is normal size instead of smaller and is further down below the underbrace.

Andrew Murdza

unread,
Aug 22, 2025, 6:40:01 PMAug 22
to MathJax Users
I forgot to mention that I made a new chat because it wasn't letting me reply on the old chat.

Davide Cervone

unread,
Aug 22, 2025, 7:56:31 PMAug 22
to mathja...@googlegroups.com
Your definition for \underbraceNormalUnderText needs a [2] to tell MathJax that it takes two arguments.  Without that, you are passing the literal "#1" as the row for the underbrace, and that doesn't contain a &, which is why you are getting a message about a runaway argument (MathJax can't find the "&" that it is looking for).

Also, I think you either have the #1 and #2 reversed in your definition, or you have passed the arguments in the wrong order when you do \underbraceNormalUnderText{1}{x&=1}, as your definition uses the SECOND argument in the array under the brace, and the FIRST as the row, but that's not how you appear to have used the \underbraceNormalUnderText macro.

Davide


--
You received this message because you are subscribed to the Google Groups "MathJax Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mathjax-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/mathjax-users/3ac96f51-fcbb-4c04-a605-cf197663ed25n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages