13

Many resources on LaTeX teach that "é" and "ä" are typeset with (respectively) \'{e} and \"{a}; and it is similar for other accent symbols. Are the braces really needed? Aren't \'e and \"a shorter but identical in functionality?

2 Answers2

13

The manuals usually insist teaching a uniform syntax: all arguments will be braced. However, as far as TeX is concerned, a one letter (one token, to be precise) argument can in most cases be left without braces:

\"{a} \"a

will give exactly the same result. Not that I recommend it, but also

\begin{tabular}c

will result in a one column tabular, just like \begin{tabular}{c}. The braces for accented letters are really handy for \c or \v: writing

gar\c con

is clumsy and gar\c{c}on is better. However, accents are more easily input using inputenc facility. It's way easier to encode our documents with UTF-8, declaring

\usepackage[utf8]{inputenc}

and then writing

garçon élève flügel čaj

The precise rule is:

when TeX is looking for an argument to a macro defined with \newcommand, if it finds a left brace {, then the argument will be whatever is between this brace and the corresponding } (at the same level); otherwise the first token (character or control sequence) will be the argument.

This explains why one can omit the first pair of braces in

\newcommand\foo{something}

which is perfectly equivalent to

\newcommand{\foo}{something}

Of course this is not valid for optional arguments, which always need to be enclosed in brackets [...].

Note: for BibTeX the situation is different (as nicely explained by Mico).

egreg
  • 1,121,712
12

For bibliographies at least -- more specifically, for files that will be processed by BibTeX at some point -- it's very important to write the accented characters as {\'e} and {\"a} rather than as \'{e} and \"{a} (or, for that matter, as \'e and \"a).

For other examples of how to render accented characters in a manner that's robust to BibTeX's requirements see, e.g., this answer (shameless self-citation alert!).

Mico
  • 506,678
  • 2
    Unfortunately, kerning is inhibited with {\"a} and friends unless you are using LuaTeX. – mhp Jul 14 '12 at 21:03
  • @mhp: I guess one's facing a choice between two negatives (when using BibTeX): either forego accented characters, or put up with some instances of less-than-optimal kerning of character pairs. Confronted with this choice, I suppose most users will put up with the latter, right? – Mico Jul 14 '12 at 21:47
  • Yes, undoubtedly. – mhp Jul 15 '12 at 06:58
  • You can type e.g. {T^y} which I think should maintain kerning. But this is problematic if T would affect the sort order. EDIT: That is, you can put the whole word in curly brackets (T^y) rather than just the accented character (^y). – cfr Jan 03 '14 at 01:05