On page 46 of The TeXbook, there is

TEX deletes any space characters (number 32) that occur at the right end of an input line. Then it inserts a return character (number 13) at the right end of the line, except that it places nothing additional at the end of a line that you inserted with ‘I’ during error recovery. Note that return is considered to be an actual character that is part of the line; you can obtain special effects by changing its catcode.

For check whether TeX inserts a carriage return at the right end of lines, I code


but it produces

! Undefined control sequence. 
l.3 \bye

What should I do to see it?

  • It's the same reason as when you tried |string/ with \catcode`\\=11 a few days ago.
    – egreg
    Commented Nov 28, 2023 at 7:51
  • @egreg Yes. As \ becomes a letter.
    – Y. zeng
    Commented Nov 28, 2023 at 8:01

2 Answers 2


Do a little change in your code:


Then there is no error and you see "hellofl" in the dvi output. Because fl is ligature inserted at the slot 13 in the cmr10 current font and the "return" character has code 13.

Your example (with catcode 11) sets the "return" character as letter, so the token \bye^^M is created (the string of this control sequence consists from b, y, e, return). Such a control sequence is undefined.


Petr (wipet) has already explained why. But, assuming you want to reproduce the input, you may do as follows. With \obeylines the character ^^M is made active and defined as \par. I add \P and \strut` in order to respect also initial spaces.

\parindent=0pt \tt
hello  world
  some line

after a  blank line 

\input knuth%


enter image description here

  • 1
    the op may ask for the black magic behind \input knuth%
    – jarnosz
    Commented Nov 28, 2023 at 10:54
  • @jarnosz It's a file in the ConTeXt distribution.
    – egreg
    Commented Nov 28, 2023 at 11:30
  • Good to know, but I meant to say "why the percent sign before the end of line"...
    – jarnosz
    Commented Nov 28, 2023 at 22:29
  • 1
    @jarnosz Well, that's an exercise for the reader!
    – egreg
    Commented Nov 28, 2023 at 22:50
  • 1
    @Y.zeng TeX always appends ^^M (actually the \endlinechar); but the % causes it to be ignored.
    – egreg
    Commented Nov 29, 2023 at 13:36

You must log in to answer this question.

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