I'm used to insert a space after a command by using the {}, e.g. \mycommand{} some other text, in order to circumvent the space-gobbling of commands.

I'm wondering if it's best or what are the specific drawbacks or differences between the following:

\mycommand{} some text

\mycommand\ some text

\mycommand\space some text

is it a matter of habit or do the spaces and mechanics differ?



I prefer the \myCommand{} appraoch since there is no risk that I create a false command by accident as with \myCommand\ (e. g. when I forget the space after \ and LaTeX complains that the "command" is unknown). I have never used \space before.

There is also a package called xspace. One of the authors is the Stackexchange high reputation user David Carlisle.

The xspace package provides a command called \xspace which will decide if a space is necessary or not. Here's an example taken from the manual:

Command Definition

\newcommand{\gb}{Great Britain\xspace}

Use of Command

\gb is a very nice place to live.\\
\gb, a small island off the coast of France.\\
\gb\footnote{The small island off the coast of France.}
is a very nice place to live.


enter image description here

So the benefit is, that you don't need to worry about your question when you define your own commands.

Related Questions

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