[comp.text.tex] [OzTeX] ^^M^^M not the same as \par.

john@basho.uucp (John Lacey) (03/28/91)

I have a problem with OzTeX 1.3.  If I say `\def\foo#1\par{...}',
and then say `\foo text\par', I get #1 as four tokens, `t', 
`e', `x', and `t'.

BUT, if instead I say `\foo text^^M^^M' (either just like that 
or by actually pressing two returns), I get five tokens---the 
obvious four and a trailing blank space.

What's the matter?
-- 
John Lacey         614 436 3773         73730,2250
john@basho.uucp  or  basho!john@cis.ohio-state.edu

raymond@math.berkeley.edu (Raymond Chen) (03/30/91)

In article <1991Mar28.071310.26773@basho.uucp>, john@basho (John Lacey) writes:
>If I say `\def\foo#1\par{...}' ... [and] `\foo text^^M^^M'...
>I get five tokens---the  obvious four and a trailing blank space.

Read the TeXbook, page 46f very carefully.  Especially the double-dangerous
bend on page 47 that begins `If TeX sees an end-of-line character'.

The first ^^M TeX sees is in state M, so it gets converted to a space.
It is the second one that TeX sees in state N and which is converted
into a \par.

eijkhout@s41.csrd.uiuc.edu (Victor Eijkhout) (03/30/91)

john@basho.uucp (John Lacey) writes:

>I have a problem with OzTeX 1.3.  If I say `\def\foo#1\par{...}',
>and then say `\foo text\par', I get #1 as four tokens, `t', 
>`e', `x', and `t'.

How would you want it otherwise? There are two kinds of
tokens: character tokens and control sequence tokens
(oh well. parameter tokens is the third kind),
and you didn't say \foo\text\par, so you get four
character tokens.

>BUT, if instead I say `\foo text^^M^^M' (either just like that 
>or by actually pressing two returns), I get five tokens---the 
>obvious four and a trailing blank space.

Now I think you're holding something back here.
If you write 
\foo text^^M^^M
\nextmacros....
\againsomehting
\par
you will get 
#1 <- text \nextmacros\againsomething
so I suspect that you left an empty line after the
^^M^^M call.

Explanation: the first ^^M is the end of the line so the
second one is never seen.

Contrary to popular misconceptions, a \par is not the
result of two ^^M's in a row, it is the effect of
an ^^M while TeX is still in state N, that is,
if there were at most space characters on the line
so far.

Exercise for the reader: do you get a \par in the following
cases:
---
\space
---

---
\expandafter\relax
\space
---

---
\catcode`Q=10
Q
---

???

Victor.