# True macros' in (La)TeX [duplicate]


Obviously, the functionality I'm trying to implement is a C-preprocessor-type macro. An automatic search-and-replace. In the example, if I were to instead just type $d(x, y)$ instead of d\p{x, y}. I've been searching for a good resource on how LaTeX macros actually work (the TeXbook comes to mind, but I've yet to come across it in my reading), but the box thing makes programmatic sense if the meaning of a macro were truly based upon its use.

How would somebody implement a C-preprocessor-like macro using only (La)TeX, as opposed to \newcommand's smarty-pants-ness? The dumber, the better.

• I should note that the nath package might solve the core problem, but I'm not certain. The question stands. – Sean Allred Feb 10 '13 at 22:17
• Your problem doesn't seem to be the macro but the \left and \right. I couldn't reproduce your problem unless I used exactly your example which I thought was just sloppy code. – Christian Feb 10 '13 at 22:37
• I'm sure you will observe the same thing if you insert \left(<stuff>\right) directly instead of \p{<stuff>}. There are a number of questions on this site about the spacing with \left \right delimiters instead of the direct ones, e.g. Spacing around \left and \right. – cgnieder Feb 10 '13 at 22:38
• I would suggest asking a new question without the \left\right` stuff. As it currently stands, the question is really confusing. – mafp Feb 11 '13 at 10:51