I'm quite lost. I can't figure out what I'm doing wrong below.
\documentclass{article}
\usepackage{amsmath,amssymb}
\makeatletter
\newcommand\aermb[1]{\def\ae@i@r{#1}\ae@rmb}
\def\ae@rmb{%%
\typeout{=======> \space\space ae@rmb}%%
\@ifnextchar[%]
{\@ae@rmb}{\@ae@rmb[\height]}}
\def\@ae@rmb[#1]{%%
\typeout{=======> \space @ae@rmb}%%
\def\ae@i@ht{#1}%%
\@@ae@rmb}
\def\@@ae@rmb{%%
\typeout{=======> @@ae@rmb}%%
\@ifnextchar[%]
{\typeout{\space\space\space optional arg}\@@@ae@rmb}
{\typeout{no optional arg}\@@@ae@rmb[\depth]}}
\def\@@@ae@rmb[#1]#2{$#2$}%%
%% \def\@@@ae@rmb[#1]#2{%%
%% \typeout{-->\detokenize\x{\ae@i@r}}%%
%% \typeout{-->\detokenize\x{\ae@i@ht}}%%
%% \typeout{==>\detokenize{#1}}}%%
%% \raisebox{\ae@i@r}[\ae@i@ht][#1]{\mbox{$#2$}}}
\makeatother
\begin{document}
\aermb{\frac{1}{2}}
\end{document}
I get the following error with the above code:
=======> ae@rmb
=======> @ae@rmb
=======> @@ae@rmb
no optional arg
Runaway argument?
! Paragraph ended before \@@@ae@rmb was complete.
<to be read again>
\par
l.30
?

\parin the argument of a non\longmacro. – egreg Oct 24 '14 at 20:21\parcoming from? – A.Ellett Oct 24 '14 at 20:22\longbefore\def\@@@ae@rmb....I get a new error about missing$even though the macro is supposed to insert them. Why is that? – A.Ellett Oct 24 '14 at 20:24{\frac{1}{2}}– egreg Oct 24 '14 at 20:24xthere and you'll see it isxthat gets set in math mode not your fraction so it's trying to set\par– David Carlisle Oct 24 '14 at 20:30\aermbwhen I wrote\@@@ae@rmb. – A.Ellett Oct 24 '14 at 20:32xparseimplementation of your multipronged macro: just a tad easier.;-)– egreg Oct 24 '14 at 20:47