Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
    
\newcommand*{\foo}{bar} plus \foo's results in bar's for me. –  lockstep Oct 7 '11 at 22:30
1  
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
2  
@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

1 Answer 1

up vote 4 down vote accepted

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.

share|improve this answer
    
Yes! Thanks a lot. –  xando Oct 7 '11 at 23:13
5  
@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
1  
@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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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