Can one create a two-part spacing command?

I would like to create a two-part spacing command. Specifically, I'd like two commands: \mySpaceOne and \mySpaceTwo. If \mySpaceOne is followed by a \mySpaceTwo, then it generates a certain amount of space; otherwise, it does nothing and does not consume the next token.

Is this possible? How would one begin to create such a command?

-
Welcome to TeX.SE. It is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. This will also serve as a test case and ensure that the solution actually works for you. –  Peter Grill Mar 13 '12 at 14:46
This is doable, but depends on what you mean by "followed by", and what is meant by not "followed by". So, the test case should cover these cases. –  Peter Grill Mar 13 '12 at 14:48
Understood; thanks for the heads up. My lack of an MWE reflected my uncertainty as to exactly what it was I wanted here. Not knowing TeX as well as I would like, I didn't want to limit my possibilities by requesting something too specific. :) –  Zach Mar 14 '12 at 14:55

\makeatletter
\newcommand\mySpaceOne{\@ifnextchar\mySpaceTwo{\hspace{1em}}{}}
\makeatother


This will consume all space tokens, however.

-
I think you might consider adding \let\mySpaceTwo\relax to enable \mySpaceTwo to be standalone command doing nothing. –  tohecz Mar 13 '12 at 17:29
Excellent; thank you! –  Zach Mar 14 '12 at 16:17
With the \expandafter it works and it obviously can't work with the first definition: TeX sees \hello, which is not \mySpaceTwo. You're probably not using the right approach, but it's difficult to say more without knowing what you're trying to do. –  egreg Mar 14 '12 at 16:44

Similar answer to egreg but using the TeX primitive \futurelet

\documentclass{article}
\begin{document}
\def\myspacetwo{}
\def\myspaceone{%
\futurelet\ifoptions
\choosemacro
}

\def\choiceone{\rule{20pt}{20pt}}
\def\choicetwo{}
\def\choosemacro{%
\ifx\ifoptions\myspacetwo%
\let\choice = \choiceone
\else
\let\choice = \choicetwo
\fi
\choice
}
\myspaceone\myspacetwo
\myspaceone
\end{document}


A \futurelet takes normally three tokens:

     \futurelet\tokena\tokenb\tokenc


TeX executes a let\tokena=\tokenc generating a copy of \tokenc stored under the name of \tokena.

It then removes \tokena from the main token list. Following TeX expands \tokenb.

This token is for all practical purposes a macro with the following properties:

1. The macro will use \tokena, which is a copy of \tokenc, to find out what \tokenc is, in other words what token is to be expected later.
2. It then causes another macro to be expanded which will ultimately absorb \tokenc.
-