3

This question already has an answer here:

I am trying to learn how to define commands (\newcommand) and variables (\def) in LaTeX.

When I try:

\def \new {$new$}

or

\newcommand{\new}{$new$}

and substitute it in the text:

\documentclass{article}

%\def \new {$new$}           
%\newcommand{\new}{$new$}

\begin{document}
lala \new lala
\end{document}

The substituted text sticks to the following text as shown here:

enter image description here

no matter how many spaces I put after the command.

What causes this behavior and how can I change it?

marked as duplicate by jubobs, egreg, Peter Jansson, karlkoeller, lockstep Nov 22 '13 at 15:32

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.

  • 1
    That's the normal behaviour. Any amount of space after a control sequence (such as \new) gets gobbled. To effect a space after \new, you can, for instance, use an empty group {}: try lala \new{} lala. – jubobs Nov 22 '13 at 14:30
  • 1
    Or use xspace package and put \newcommand{\new}{$new$\xspace}. David is here any way to help ;-) – user11232 Nov 22 '13 at 14:52

Browse other questions tagged or ask your own question.