Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!maverick.ksu.ksu.edu!ux1.cso.uiuc.edu!csrd.uiuc.edu!s41.csrd.uiuc.edu!eijkhout From: eijkhout@s41.csrd.uiuc.edu (Victor Eijkhout) Newsgroups: comp.text.tex Subject: Re: How to include unbalanced brackets `}' in macro substitution? Message-ID: <1991Feb5.174501.10666@csrd.uiuc.edu> Date: 5 Feb 91 17:45:01 GMT References: <1991Feb5.023920.20619@cs.ucla.edu> Sender: news@csrd.uiuc.edu (news) Organization: UIUC Center for Supercomputing Research and Development Lines: 28 kirkaas@oahu.cs.ucla.edu (paul kirkaas) writes: >I want to define macros that end a group, doing a few cleanup chores in >the process --- for example, a \beginvcenter \endvcenter pair to center >text vertically in a page. >I would like to find a way to either: >1) Include a closing brace `}' as part of the macro substitution > or >2) Figure out how to properly use \begingroup & \endgroup to achieve the >same end. Boxes can be opened/closed by braces or by `implicit braces': tokens that are \let to a brace. Because of the definitions \let\bgroup{ \let\egroup} (l)plain.tex, you can write \hbox\bgroup ... \egroup, and you can do that with macros: \def\beginbox{\hbox\bgroup} \def\endbox{\egroup} The \begingroup/\endgroup commands cannot be interchanged with {} or \bgroup/\egroup. But they do define a group in which changes are local. You can use them therefore as some sort of runtime error checking: they will not be matched accidentally with braces or \bgroup/\egroup tokens appearing. Victor.