Possible Duplicate:
Horizontal Spacing: double \hspace removal?
I'm trying to keep my document as abstract as possible since I'm likely to change representation of the terms I'm using on a regular basis. For this reason, I have created a number of commands similar to the following:
\newcommand{\gtDepth}{\texttt{depth}}
\newcommand{\gnInt}{\textit{int}}
\newcommand{\gtSemi}{\texttt{;}}
I can then use these commands to describe a simple grammar rule:
\gtDepth \gnInt \gtSemi
The problem is, of course, that there is no spacing between these terms. I would like to write something like the following:
\newcommand{\gspc}{\minspace{3mm}}
\newcommand{\gtDepth}{\gspc\texttt{depth}\gspc}
\newcommand{\gnInt}{\gspc\textit{int}\gspc}
\newcommand{\gtSemi}{\gspc\texttt{;}\gspc}
Specifically, I want this "minspace" construct to create space only if it is not already adjacent to that much space. For instance, I would like
a\minspace{3mm}b
to be equivalent to
a\minspace{3mm}\minspace{2mm}b
because the 3mm space is larger. It seems that \mathop provides this behavior in a very crude sort of way: things in \mathop are padded on the left and the right, but two \mathops adjacent to each other don't create twice as much space.
Any thoughts?
Thanks!
\xspacedoesn't work there. – egreg Mar 12 '12 at 17:16mathmode;-) – Marco Daniel Mar 12 '12 at 17:20