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.

I am using several special character commands, such as those described at Which symbols need to be escaped in ConTeXt?. I noticed that some, such as \textdollar will not work if they are immediately followed by some other word, e.g.:

\textbraceleftThis is some text.\textbraceright

To fix this, I have added some spaces after the command:

\textbraceleft This is some text.\textbraceright
  • Is it correct to always place spaces after these commands? Are there any cases where this will create problems, such as a line break when the two items should be placed together?
  • Are the \# and \& treated differently?
share|improve this question
    
Related: tex.stackexchange.com/questions/37955/… –  lockstep Apr 1 '12 at 0:03

1 Answer 1

up vote 11 down vote accepted

This has nothing to do with the meaning of \textbraceleft, in the sense that this is a rule valid for all macros (or more generally, control sequences).

TeX scanning of a control word ends with the first nonletter. The first example you give is the control word \textbraceleftThis which is probably undefined.

On the other hand, \# is not a control word, because the backslash is followed by a nonletter. By rule it is a control symbol and the scanning ends there: only one nonletter can be part of the command's name. Therefore

\#text

will give

#test

while

\# text

will give

# test

with a space.

A space after a control word is ignored. Not after a control symbol. This is one of the first rules one learns with TeX.

Weren't for this rule, one couldn't have macros

\a \ab \abc \abcd \abcde

which are instead possible and all with unrelated meanings.

share|improve this answer

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.