We've covered the question "When can one use implicit braces instead of explicit braces?"; this leads immediately in my mind to the question "Why would one want to?"

(Remember, implicit braces are e.g. \bgroup and \egroup as defined by the code \let\bgroup={ \let\egroup=} in plain TeX.)

I suppose this is basically the same as the question "When must one use implicit braces instead of explicit braces?"


There's a nice example in Appendix E of the TeXbook, where a letter format is described. A few lines of a possible letter:

Prof.~Brian~K. Reid
Department of Electrical Engineering
Stanford University
Stanford, CA 94305


Here, \address and \body are defined as follows:

{\obeylines\gdef\getaddress #1
    \hsize=\longindentation \everypar{\hangindent2em}#2
    \def\endmode{\egroup\endgroup \copy\theaddress \bigskip}}}

Please pay attention mainly to the \vbox\bgroup in \getaddress and to the \egroup in \endmode that gets called by \beginparmode via \body. What happens is that \address starts a \vbox, which is then ended by the occurence of \body (or anything else calling \endmode). The box thus constructed can then be used "both in the letter and in the label on the envelope", as Knuth explains.

  • So it breaks if you try to put the body before the address, or if you try to put something before the body but after the address? Seems like a potential cause of future confusion..
    – naught101
    Jul 24 '12 at 6:32

For example, you can do this:


not bold \blah bold\bloh not bold

Doing this:


would have completely different result.

  • 2
    I'd call this an example of structure-defining macros. The question is, why not define \def\blahbloh#1{{\bf #1}}? It's an example of the mechanical difference, but not an example of why they are useful. Jan 28 '11 at 9:09
  • 3
    @Charles: As DEK points out on p. 205 in the TeXbook, this can be useful if you don't want to fill TeX's memory with a long argument. He even gives an example with \beginbold and \endbold, but I think nowadays this would only be useful if you have lots of pages in bold. Jan 28 '11 at 20:21
  • On the other hand, one could just use \begingroup/\endgroup for this and avoid having to do so much thinking, right?
    – SamB
    Jan 28 '11 at 22:27
  • Oh, and this doesn't leave a space between "bold" and "not"...
    – SamB
    Jan 28 '11 at 22:28
  • 1
    @SamB: just leave a space before \bloh. --- Note that replacing \bgroup by \iftrue{\else}\fi, and \egroup by \iffalse{\else}\fi will also work :). Feb 15 '11 at 20:03

Among a gazillion other uses, it provides a handy way for storing paragraphs in a box for later processing.


Ordinary paragraph.
This paragraph will be saved in \string\box\string\savedparbox.
If you wish, you can unpack the box and do all kinds of processing on it.
In this demo, I won't do any processing.
Look in the log file to examine the box contents.


Another ordinary paragraph.

When testing for the presence of a brace using a \futurelet construction.

\def\isbraced@{\ifx\next\bgroup Braced\else Unbraced\fi}

Inside macros, \bgroup sometimes helps readability:

      \bf #1\par 
  \endgroup }

(I tend to get confused when there are too many braces)

  • 2
    If you use \begingroup instead of \bgroup, you get a compile-time check as well. Jan 28 '11 at 9:02
  • edited (but I usually use \bgroup because I am too lazy to type any more) Jan 28 '11 at 9:04
  • Hmm, I guess I should have restricted my question to cases not already covered by \begingroup/\endgroup ;-)
    – SamB
    Jan 28 '11 at 22:24


in this case it maybe better to use \begingroup ...\endgroup instead

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.