0

I defined a macro but I found the word spacing is gone. Am I missing something?

\documentclass[11pt, oneside]{article}

\newcommand{\abc}{$abc$}
\newcommand{\abcSpace}{$abc$ }

\begin{document}

Word spacing here $abc$ is correct.

Word spacing here \abc is incorrect.

Why do I need to define macro like this \abcSpace in order to have a space?

But within brackets, this space again is not what I want: (\abcSpace).


\end{document}  
Daniel
  • 1,816
  • 3
    This is perfectly normal and documented behavior. Use \abc\ is when you want a space. – egreg Jun 06 '13 at 17:11
  • Why tex is designed in this way, I thought macro is just replacement. Sadly, it is not. – Daniel Jun 06 '13 at 17:12
  • I'd be sad if this weren't documented. It is; spaces after control sequences consisting of letters (like your \abc) are ignored. That's the way it is. – egreg Jun 06 '13 at 17:14
  • Consider using xspace which adds space automatically whenever necessary. – Hasan Zakeri Jun 06 '13 at 17:21
  • 3
    Why downvote? Even if a duplicate question, it is a common one, and there is a minimal example. (If only all people included them in their questions!) Is the downvote meant to imply 'look harder before asking'? – jon Jun 06 '13 at 17:26
  • Thanks for your understanding @jon! And sometime, it is just difficult to choose keywords to search. – Daniel Jun 06 '13 at 17:36

1 Answers1

0

Use macro with {} solves the problem.

\documentclass[11pt, oneside]{article}

\newcommand{\abc}{$abc$}

\begin{document}

Word spacing \abc{} is correct now.

Within brackets: (\abc{}).

\end{document}  
Daniel
  • 1,816