1

If I execute the code \tt\catcode` =12\relax test I get:

enter image description here

I also can emulate the same effect using \char32 in place of <space>. Is it possible to change the character code of <space>, so that when I type \tt\catcode`\ =12\relax test there is another character displayed there? For example, whenever I type <space> it displays !, which is \char33?

3

2 Answers 2

1

Plain TeX offers \obeyspaces that simply declares the space character to be active.

\obeyspaces\def {!}%

\tt test

\tt^^@test test

\bye

enter image description here

1
  • Thou shalt obey thy spaces!
    – Gaussler
    Commented Jun 29, 2022 at 14:18
0

Inspired by user202729's comment, I have done the following:

\begingroup\lccode`~=` \lowercase{\endgroup\obeyspaces\let~=!\relax}
\tt test
\bye

Note the \lowercase trick to trick TeX into using an active space in the definition \let~=!.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .