I know it's not a good habit to write latex this way, But just wonder why \textbf\& is the same as \textbf{\&}, while \textbf\"o is not the same as \textbf{\"o}?


Others have answered most of your question so I will restrict to why you don't get an error with


It's instructive to go


{\tracingmacros2 aaa \textbf\"o bbb}

The first one to make sure the bold fonts are set up before you turn on tracing, and the second one with tracing set, then look in the log file and you will see macros expand:

After checking to see what font setup is going to be used to get the accent (OT1 in the default case) TeX finally gets to:

\OT1\" #1->\@text@composite \OT1\" #1\@empty \@text@composite {\add@accent {127}{#1}}

So the argument to \" is \check@icr which is the token that LaTeX adds to the end of all the \text__ commands to check on the italic slope of the following text to see if it needs italic correction.

So the answer to why this doesn't generate an error is basically just luck (or lack of luck, depending on your point of view) \" doesn't get an error as it has an argument, even if not the one you intended, and \check@icr, because it is designed to look ahead to whatever comes after \textbf is written fairly defensively and generally avoids making errors and if it doesn't find something it just doesn't insert italic correction, so even though it is being expanded in entirely the wrong place, inside the accent command it just decides not to insert an italic correction and things move on....


\& is one token while \"o are two tokens. If you dont use braces to delimit the argument, \textbf will affect only the next token it founds.

  • You wanted to write \"o for the second one I think? – yo' Mar 22 '12 at 12:22
  • It should be said that if a macro reads one argument, it reads one token. If this token is a group, e.g. {\"o}, it assigns to the whole group as a parameter. Without the braces, it takes only \" as an argument. – yo' Mar 22 '12 at 12:24
  • But there is no error for this wrong way, while there is an error if I just write \". why is so strange? – Z.H. Mar 22 '12 at 12:26
  • @Z.H.: \" expects a character after it. – Gonzalo Medina Mar 22 '12 at 12:46
  • @GonzaloMedina: Sorry, I means why LaTeX thinks \textbf\" is right and the result is the same as \textbf{\"{}}? – Z.H. Mar 22 '12 at 12:54

Expanding on Gonzalo's correct answer.

TeX operates on tokens scanning them one by one (in normal operations). In \textbf\"o there are three tokens

\textbf  \"  o

The syntax rules of TeX specify that when a command has an argument (which is the case for \textbf), this argument is determined as follows:

  • if the next token is not an open brace {, that token is the argument
  • if the next token is an open brace { the argument is everything that goes from the { up to the } that balances it.

Therefore with \textbf\& the argument is \&; with \textbf\"o the argument is \". The two calls are equivalent to \textbf{\&} and \textbf{\"}o, respectively.

On the other hand, in \textbf{\"{o}} the argument is \"{o} (because the inner braces balance each other).

Always use braces for commands with arguments (unless you belong to the category of ninja programmers who are supposed to know what they're doing) and you'll be OK.

  • Thanks. But still one thing I don't understand: if \abc and \xyz are two single-argument macros, It seems that latex reads \abc\xyz as \abc{\xyz{}} but not throws an error. Why? – Z.H. Mar 22 '12 at 13:13
  • @Z.H. TeX doesn't interpret tokens when looking for arguments. This is a very useful feature when programming in TeX, but can be confusing for the beginner; that's why the manuals insist in putting arguments in braces. – egreg Mar 22 '12 at 13:20

\& is special purposes within LaTeX. if you use \textbf it will tag 1 character only. so Don't use like this. Use \textbf{text}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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