When I define a variable:


And use it:

The company \company is...

I usually have the trailing space eaten by the command resulting in The company ACMEIs

So I do the following:

The company \company~is...

Is there a better option?

  • 1
    Use \company{} instead of \company. It will put spaces where there is no punctuation.
    – Zxcvasdf
    Mar 3, 2023 at 8:02
  • use ~ if you want a no-break space, {} or \ otherwise. Mar 3, 2023 at 8:50

1 Answer 1


As @Zxcvasdf already explained, you can use \company{} instead of \company. If you don't want to type {} all the time (maybe because they are hard to type with your keyboard layout or you need \company very often) you can also use the xspace package. It provides the command \xspace which produces a space whenever it is needed.

    The company \company is great! % <- space is inserted 
    I like the company \company.   % <- no space is inserted


Let me briefly comment on why you should not use ~ here for inserting a space: ~ produces a non-breaking space, i.e. there cannot be a line break between these two words. Sometimes this is good style, e.g. in See Figure~\ref{fig} because you do not want to have Figure and the referenced number in different lines, but here there is no reason why you should not allow a line break.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .