Let's see: if you try
\tt
{\catcode‘\>=2 >
\bye
you get No pages of output.
On the other hand, with
\tt
{\catcode`\>=2>
\bye
you get output, precisely “>” and
(\end occurred inside a group at level 1)
### simple group (level 1) entered at line 3 ({)
### bottom level
The explanation is easy: in the second case, the character >
is tokenized before the category code assignment is finalized, hence it has category code 12. The use of \tt
is to avoid getting “¿” in output.
Actually \catcode`\<=1
affects nothing and you get the same output (and the same warning) without it.
I'll just use h
and remove \par
that serve no purpose and just complicates tha analysis:
{\catcode`\>=2>h{\catcode`\>=2>h
You have the following token list:
{
1 |catcode|
`
12 |>|
=
12 2
12 >
12 h
11 {
1 |catcode|
`
12 |>|
=
12 2
12 >
2 h
11
Can you see the difference? The first >
has catcode 12 for the reasons explained above, but the second one has category code 2, because the assignment has been performed. So the second assignment is actually performed in a group and has essentially no effect. But you also see that adding \catcode`\<=1
has no role whatsoever.
The output is “>hh” and the warning about the unclosed group is the same, because the initial {
1 isn't balanced, while the second one is, by >
2.
Side note
The codes
\catcode`\>=2
\catcode`>=2
are completely equivalent when >
has its standard category code 12. Escaping the character is a safety measure that's actually only needed when the character has category code 0, 5, 9, 14 or 15. For instance, you cannot assign active category code to ^^@
(byte 0) with
\catcode`^^@=13
because normally ^^@
has category code 9 (ignored). To the contrary
\catcode`\^^@=13
would do. In the \obeylines
macro you'll find
\catcode`\^^M\active
for the same reason.
\catcode
\<=1` you get the same output.{\catcode
\>=2}hello\par` because>
is end group when TeX looks for the matching end group.>
is already end group when that line is read. On the first line,>
still has its original meaning.>
is supposed to produce in TeX.