How can I define a macro, say \address, so that I can use it like this:

27/7 Montague Street

and it would put the lines following it into another macro, say \addrinfo ? What I'm ultimately trying to do, is modify Knuth's letter macros so that I can specify the address once in the letter, and then produce an address in a different font. Currently I've got

  \hsize=\longindentation \everypar{\hangindent1cm}

but this means the address label is set in the same font.

  • 1
    Is there a reason you want to use plain tex instead of, say, koma-script’s nice letter (scrlttr2) class? – Caramdir Oct 6 '10 at 22:31
  • 1
    Personal preference for plain TeX, born from a frustration with LaTeX not giving me enough freedom. I'm also aware that my understanding of plain TeX is less that I want it to be. – Harry Newton Oct 10 '10 at 11:02

What you can do is to put each line into a separate definition as part of the definition of \address. In Knuth's letter format, he puts the first line of the address in the definition of \addressee.

The idea is to do this for the whole address. Then you'll have the definitions of \ToName, \ToStreet etc to use afterwards in any way you like.

A minimal example to illustrate the idea is as follows:


% Populates the \To* definitions.

Some Name
27/7 Montague Street


And now you can use the different fields as you wish. For example:


This letter is addressed to {\bf \ToName}.


You can also have a \FromAddress macro similar to \address, but whose ending markup is \address instead of \beginletter. So you'd start your letter like:

My Name
My Street
My City

To Name
To Street
To City



In effect, your \address macro is not undelimited: Somehow, the \endmode macro has to get called afterwards. In Knuth's letter macros, this job is done by the \body macro. So, what you can do is delimit the \address macro like this:


Then the macro \theaddress will contain the unformatted address. Hope you can work out the missing details.

  • Thanks. My original version put the desired text in a box which was specified as \vtop\bgroup. The desired text was delimited by a \egroup which got called with one of several macros e.g. \date or \body or \yourref - the definitions of which included a \egroup. Am I right in saying it isn't possible to do a similar trick with macro definitions ? e.g \def\addr{\bgroup} and \def\date{\egroup <rest of \date definition> } ? – Harry Newton Oct 10 '10 at 11:13
  • @Harry Newton: Unfortunately, you can't use \bgroup and \egroup in this way. As you can read in the TeXbook in the bottom of page 275, \def needs explicit left and right braces. – Hendrik Vogt Oct 16 '10 at 12:38

Your Answer

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