\newcommand{\rowClass}[2]{\rowClassParts{#1}#2\endparts}\def\rowClassParts#1#2\endparts{\class{#1}{#2}&{}\class{#1}{#3}}
\begin{aligned}\rowClass{myClass}{a&=b+c} \\&=c+d\\\end{aligned}
On Aug 19, 2025, at 4:47 PM, Andrew Murdza <andrew...@gmail.com> wrote:
This is similar to my question about underbrace: how I can use & in a \class macro that is itself in an aligned environment?
--
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/7aba2e4f-7125-4cd6-8194-7787ccfff5f0n%40googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/mathjax-users/57b4a45c-ca9f-4fa4-be60-9041f83d50d5n%40googlegroups.com.
\let\oldclass=\class\renewcommand{\class}[2]{\rowClassParts{#1}#2&&\endparts}\def\rowClassParts#1#2\endparts{\oldclass{#1}{#2}\checkEmpty#4\notEmpty\skipEmpty\endCheck{&{}\oldclass{#1}{#3}}}\def\checkEmpty#1#2#3\endCheck{#2}\def\skipEmpty#1{}\def\notEmpty#1{#1}
To view this discussion visit https://groups.google.com/d/msgid/mathjax-users/0097d2c6-c60e-4700-bf3d-d9a81f978ea3n%40googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/mathjax-users/129871aa-accd-4f26-b412-f153f2825df5n%40googlegroups.com.
Will this code also work for Mathtip since it also has two arguments like \class?
Also is it possible to make one for \bbox?
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">
<title>\bbox test</title><script>window.MathJax ={loader: {load: ['[tex]/bbox']},tex: {packages: {'[+]': ['bbox']},
},startup: {ready: () => {MathJax.startup.defaultReady();
MathJax.tex2mml(String.raw`\let\oldbbox=\bbox\renewcommand{\bbox}[2][]{\bboxParts{#1}#2&&\endParts}\def\bboxParts#1#2\endParts{\checkEmpty#4{\rlap{\kernedBBox#1|.267em|\endBBox{\phantom{#2#3}}}#2}{\kernedBBox#1|0px|\endBBox{#2}}\endCheck}\def\checkEmpty#1#2#3\endCheck{#2}\def\kernedBBox#1|#2|#3\endBBox{\kern-#2\oldbbox[#1]}`);},}};</script><script src="https://cdn.jsdelivr.net/npm/mathjax@4/tex-chtml.js"></script></head><body>\begin{align}\bbox[5px, border: 2px solid blue|7px]{a&=b}\\a &= b\end{align}\[\bbox[5px, border: 2px solid blue]{a=b}\]</body></html>
Also in my previous message I asked if the same thing can be done for \underbrace{1&=1}_{1} and \underbrace{1=1}_{1}.
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">
<title>\underbrace test</title><script>window.MathJax ={tex: {packages: {'[-]': ['textmacros']}},
startup: {ready: () => {MathJax.startup.defaultReady();
MathJax.tex2mml(String.raw`\let\oldunderbrace=\underbrace\renewcommand{\underbrace}[1]{\underbraceParts#1&&\endParts}\def\underbraceParts#1\endParts{\checkEmpty#3{\underbraceBox{#1}{#2}}{\oldunderbrace{#1}}\endCheck}\def\checkEmpty#1#2#3\endCheck{#2}\def\checkLength#1#2#3\multChars\multChars#4#5\endcheck{#4}\def\checkUnderscore#1_#2#3\endcheck{#2}\def\doUnderscore#1{\makeUnderbrace{_{\hskip-5em#1\hskip-5em}}}\def\underbraceBox#1#2#3{\def\makeUnderbrace##1{\rlap{\underbrace{\phantom{#1#2}}##1}#1}\def\multChars{\makeUnderbrace{}{#3}}\checkLength#3\multChars\multChars\multChars{\checkUnderscore#3\doUnderscore_{\makeUnderbrace{}#3}\endcheck}\multChars\multChars{\makeUnderbrace{}{}}\endcheck}`);},}};</script>
<script src="https://cdn.jsdelivr.net/npm/mathjax@4/tex-chtml.js"></script></head><body>\begin{align}
\underbrace{a&=b+c+d}\\\underbrace{a&=b+c+d}_{xyz}\\\underbrace{a&=b}_{xyz\,xyx\,xyz\,xyz}\\
a &= b\end{align}
\[\underbrace{a=b+c+d}\]\[\underbrace{a=b+c+d}_{xyz}\]</body></html>