Possible Duplicate:
\newcommand and spacing

In my latex document I have defined a new command to force a consistency in naming of a product I talk in my document:


However I experience a problem that:

\fancyName is a wonderfull and fancy product.

is compiled to:

ABCis a wonderfull and fancy product.

without a space after \fancyName in the compiled text.

Does anybody know how to define a new command and avoid this issue?

marked as duplicate by Gonzalo Medina, Martin Scharrer May 10 '11 at 13:06

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • guess it is a dublicate – Martin H May 10 '11 at 12:53
  • (La)TeX ignores all spaces after any macro, user defined or not. This is because the space might just be a separator to indicate the end of the macro name. As already states in the answer here and in the duplicate question: Either use {} after the macro, insert an explicit space using \ , ~ (unbreakable), or \space or add \xspace at the very end. It will add a space if the macro isn't used before a punctuation mark. – Martin Scharrer May 10 '11 at 13:11

This is a well known "problem". You can either write \macro{} or maybe you consider using


xspace should create a space if the macro is used in text but no space if it is at the end of a sentence and followed by a full stop.

  • 7
    Another option is to add {} after the macro call, like \fancyName{}. – ℝaphink May 10 '11 at 12:55

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