# How to put A under B with syntactic sugar?

Say I would love to have a command that would put text A under text B. Yet I do not want to write my command arguments in \commandname{A,B} fashion. Instead I would love to write something like to write code like this: \put A \under B Are such constructs possible with TeX commands and how to create them?

-
The stackengine package has a command \stackunder{A}{B} which will stack a B under the A. Likewise, \stackon{A}{B} will stack B atop A. The vertical spacing and horizontal alignments are settable. –  Steven B. Segletes Dec 24 '13 at 1:17
There is B \atop A, but it is for math mode. –  morbusg Dec 24 '13 at 12:40

Yes, you can, but you shouldn't:

\def\put#1\under#2{...something with #1 and #2...}


You can call it like

\put A\under B


or

\put A\under {BC}


There's no way to avoid braces if the second argument consists of more than one token.

Then you'll soon regret doing this, because you'll find out that \put is already a LaTeX command and that you are redefining it. If you're talking about Plain TeX, then there's no problem.

Notice that if you call

\put A \under B


then #1 will be A with a trailing space, that might be significant or not, depending on various factors.

You can read about delimited macro arguments in TeX by Topic (texdoc texbytopic on your system or this link) or in the TeXbook.

-
Hm... Why it worked for me \def\put #1 \under #2{\underset{#1}{#2}} using $\put d \under =$ - there are spaces? –  Kabumbus Dec 24 '13 at 0:21
@Kabumbus You have a space after #1; try \put A\under B and you'll get into trouble. –  egreg Dec 24 '13 at 0:22