Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Plain format basic text macro definitions (obeylines)

19 views
Skip to first unread message

peter_pa

unread,
Nov 22, 2009, 7:53:16 PM11/22/09
to
I'm trying to fully understand plain.tex format file (fmtversion =
3.141592653). I got stuck with the line after definition of
\obeylines:

Line 523: \global\let^^M\par} % this is in case ^^M appears in a
\write

For me that line is totally useless. I don't understand its purpose, i
don't even understand the comment.
When ^^M appears in a \write the let assignment to \par won't help,
^^M won't be expanded.

Please help, I think I have a mistake somewhere in my reasoning.

Enrico Gregorio

unread,
Nov 22, 2009, 8:16:56 PM11/22/09
to
peter_pa <peter....@gmail.com> wrote:

\obeylines
\write16{xy
ab}

The ^^M that ends the line is gone in the token list for the \write
operation: it is a character with category code 13. This token list
will be looked at when TeX is shipping out a page, when it must have
a valid definition for the active ^^M and \obeylines might not be in
force any more.

During the \write, expandable tokens are expanded, unexpandable tokens
are written as themselves, but undefined tokens will raise an error.

Ciao
Enrico

Donald Arseneau

unread,
Nov 23, 2009, 4:39:16 AM11/23/09
to
On Nov 22, 4:53 pm, peter_pa <peter.azma...@gmail.com> wrote:
> I'm trying to fully understand plain.tex format file (fmtversion =
> 3.141592653).

Are you doing this by going through the TeXbook? If not, then
you will have terrible trouble.

> I got stuck with the line after definition of
> \obeylines:
>
> Line 523:
>   \global\let^^M\par} % this is in case ^^M appears in a \write
>
> For me that line is totally useless. I don't understand its purpose, i
> don't even understand the comment.

First, the purpose:

\obeylines makes the end-of-line character, control-M, an alias for
\par, so turning every line of text input into a separate paragraph.

Next the comment: A global default definition of the active ^^M
character is provided in case such a character is read-in under
the influence of \obeylines but used elsewhere. One way this can
happen is with the delayed expension step used by \write (in order
to get page numbers correct) but there are other possibilities.

Remember that the \catcode setting is local to a group, but the
catcode
of the character token does not change when the group ends.

Donald Arseneau

peter_pa

unread,
Nov 23, 2009, 9:38:26 AM11/23/09
to
On Nov 23, 5:16 am, Enrico Gregorio <grego...@math.unipd.it> wrote:
>
> \obeylines
> \write16{xy
> ab}
>
> The ^^M that ends the line is gone in the token list for the \write
> operation: it is a character with category code 13. This token list
> will be looked at when TeX is shipping out a page, when it must have
> a valid definition for the active ^^M and \obeylines might not be in
> force any more.
>
> During the \write, expandable tokens are expanded, unexpandable tokens
> are written as themselves, but undefined tokens will raise an error.

Thanks for quick response.
As I understand the purpose of that definition is the same as the
purpose of this line:

{\obeyspaces\global\let =\space}

The comment for the active-^^M assignment embarrasses me. I can make
^^M active and after that each line ending will cause error.

peter_pa

unread,
Nov 23, 2009, 9:51:37 AM11/23/09
to
On Nov 23, 12:39 pm, Donald Arseneau <a...@triumf.ca> wrote:
> First, the purpose:
>
> \obeylines makes the end-of-line character, control-M, an alias for
> \par, so turning every line of text input into a separate paragraph.
>
> Next the comment: A global default definition of the active ^^M
> character is provided in case such a character is read-in under
> the influence of \obeylines but used elsewhere.  One way this can
> happen is with the delayed expension step used by \write (in order
> to get page numbers correct) but there are other possibilities.
>
> Remember that the \catcode setting is local to a group, but the
> catcode
> of the character token does not change when the group ends.

Thanks for detailed reply. The purpose is now clear, but that comment
still embarrasses me. You mentioned that \write isn't the only case
though commentary says that assignment is for the \write case or it's
just an example?

Donald Arseneau

unread,
Nov 23, 2009, 12:38:54 PM11/23/09
to
On Nov 23, 6:51 am, peter_pa <peter.azma...@gmail.com> wrote:
> Thanks for detailed reply. The purpose is now clear, but that comment
> still embarrasses me. You mentioned that \write isn't the only case
> though commentary says that assignment is for the \write case or it's
> just an example?

Why would it embarrass you?

I can't say what DEK thought. I could guess that he inserted the
definition because the \write problem bit him, but the definition also
applies to other cases, such as

\obeylines
\gdef\something{Hello
World}


Donald Arseneau

peter_pa

unread,
Nov 23, 2009, 12:58:39 PM11/23/09
to
On Nov 23, 8:38 pm, Donald Arseneau <a...@triumf.ca> wrote:
> I can't say what DEK thought.  I could guess that he inserted the
> definition because the \write problem bit him

I think that was the case :)
Thanks a lot.

0 new messages