This question kind of already exists here: How to write infix macro/newcommand?
But I'm not looking for a way to divide using an infix command, which I know there already exists a command for. I'm looking for a way to define a new binary infix command for any purpose. Something like
\infixnewcommand{\T}{{bunchofstuff} {#1} {bunchofstuff} {#2} {bunchofstuff}}
Then later on in the code, {2 z \T 3 y}
would get replaced with {{bunchofstuff} {2 z} {bunchofstuff} {3 y} {bunchofstuff}}
.
Also, the wobsite wouldn't let me comment on the other question, saying I didn't have the rep, so I was kind of forced to start a new question, at least until I have enough rep to comment. Sorry about that :D
The particular example I'm faced with is defining tfrac, but as infix, so I guess it would be tover. But just to be clear, I'm not interested in a "solution" involving a pre-existing package where tover is defined. tover is just the current example at hand. I'm interested in knowing how I could define such a command in my own code, since I can easily see my future self requiring this capability.
\over
and\choose
.\infixnotation{<stuff> \T <more stuff>}
, then yes...\over
doesn't work like a macro; actually, when TeX sees\over
it stores the math list it was forming, starts a new one and finally builds the fraction. The already stored math list is not reprocessed in any way, apart from fixing a style for each of its atoms.\over
that do work this way are strongly deprecated in LaTeX and defined to give a warning if you use the standardamsmath
package.