TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
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
up vote 16 down vote accepted

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


\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.

share|improve this answer
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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.