TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

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:


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:


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


to be equivalent to


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?


share|improve this question

marked as duplicate by Marco Daniel, egreg, lockstep, Andrey Vihrov, Stefan Kottwitz Mar 12 '12 at 17:34

This question was marked as an exact duplicate of an existing question.

Do you need the objects to be equally spaced or the space between some of them should be different? – egreg Mar 12 '12 at 17:14
@MarcoDaniel The question is tagged "mathmode" and \xspace doesn't work there. – egreg Mar 12 '12 at 17:16
@egreg: I didn't see the tag mathmode ;-) – Marco Daniel Mar 12 '12 at 17:20

Just found another stackexchange post that solves the problem. shame! It's over here: Horizontal Spacing: double \hspace removal?

Specifically, I was looking for the following. I modified it from the original post to remove the horizontal mode assertion; this makes it work in math mode for me.

        \hskip \@tempskipb
    \ifdim \lastskip =\z@
    \hskip #1\relax

Sorry about the dupe!

share|improve this answer
There's no need to be sorry, now I know about \lastskip :-) – Andrey Vihrov Mar 12 '12 at 17:18

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