# “backspace” a character

It's not really "backspace" a character: I define a command, for example \foo representing bar, actually a macro for replacement. I need to produce the string bars with \foo. It's impossible to just use \foos, so there must be whitespace between \foo and s. That's why I wish to backspace the whitespace. What's the solution?

-
\newcommand*{\foo}{bar} plus \foo's results in bar's for me. –  lockstep Oct 7 '11 at 22:30
Why should it be impossible to use \foo's? The control sequence name is stopped by the nonletter '. On the other hand, \foo 's would work the same and not produce white space. –  egreg Oct 7 '11 at 22:31
Yes, you are right---my mistake. I want \foo\foo\foo. –  xando Oct 7 '11 at 22:36
\foo\foo\foo produces barbarbar. –  Jukka Suomela Oct 7 '11 at 22:43
@Kejia柯嘉: Even for that the same holds. The space after \foo is gobbled as a macro termination, leaving no space between bar and s. –  Werner Oct 7 '11 at 23:18
show 1 more comment

Not sure I fully understand, so are you just looking for a simple replacement such as this:

\documentclass{article}
\usepackage{amsmath}
\newcommand{\foo}{bar}%

\begin{document}
\foo's
\end{document}


With the above using \foo's produces bar's for me.

If you have issues with terminating a macro the way to do that is \foo{}'s, but in this case it does not seem necessary. Where it would be necessary is if you wanted to produce bars, then you would use \foo{}s.

-
Yes! Thanks a lot. –  xando Oct 7 '11 at 23:13
@Peter: even in \foo{}s, braces are unnecessary: \foo s works well: the space after \foo is simply ignored by TeX. Then choosing between \foo{}s and \foo s is a matter of taste. –  Bruno Le Floch Oct 7 '11 at 23:34
@BrunoLeFloch: Good point. I have gotten into the habit of using \foo{}s style, so \foo s did not even come to mind. Good to know there are options. –  Peter Grill Oct 7 '11 at 23:43