I want to define a macro \foo that behaves similarly to \over and \atop, such that the code
#1 \foo #2
outputs
foo #1 #2
I want to define a macro \foo that behaves similarly to \over and \atop, such that the code
#1 \foo #2
outputs
foo #1 #2
\over-like notation in a command? The commands\overand\atop, which are TeX primitives, are actually quite problematic from a design-theoretical perspective. There is a very good reason for why LaTeX provides\fracand discourages the use of\over. See also @Aditya's and @barbarabeeton's follow-up comments on this answer to the query What is the difference between \over and \frac? – Mico Dec 31 '20 at 09:04\over,\atop,\above, etc. – Mico Dec 31 '20 at 09:20\over,\atop,\above, etc are implemented as TeX primitives, not as macros. As such, it's going to be rather tough to come up with new commands that adopt infix notation. Are you open to using a LuaLaTeX-based solution that acts like a preprocessor? – Mico Dec 31 '20 at 09:39\tointo a command that generates axymatrixand takes the word before\toas the domain of a function and the word after it as the codomain. Right now I have something like this.\renewcommand{\to}[3][]{\xymatrix@1{#2 \ar@{->}[r]^{#1} & #3}}. – FR09 Dec 31 '20 at 10:03\over(possibly the worst aspect of the tex design), is not implementable using TeX macros. If you have any prefix you could have some syntax such as\zzz ... \to ...where\zzzgrabs the expression and splits on\to, but you can not "go back". – David Carlisle Dec 31 '20 at 10:20\xymatrixand its syntax. Would you mind editing the body of your posting to spell out exactly how you expect the input to be formatted? Thanks. – Mico Dec 31 '20 at 11:19$a+ { b + xyz \over 2}$the numerator isb+xyzbut your request for your\toto take "the previous word" would suggest that in$a+ { b + xyz \to 2}$you want#1to bexyzorznotb+xyz. without Lua none of these is implementable but which do you have in mind? – David Carlisle Dec 31 '20 at 14:37