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.
\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
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
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.
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
I think that was the case :)
Thanks a lot.