On page 10 of the book The TeXbook, it says that \show\cs, where \cs is any control sequence, can output its meaning. For example, \show\thinspace outputs

> \thinspace=macro:
->\kern .16667em .

Why does \show\ output:

> \^^M=macro:
->\ .

Why is there ^^M here? I knew the ^^M refers to the enter key in keyboard, but may you tell me the reason?

  • I am comfused why the titile was needed to be changed to \show\" instead of "\show\ " and why the why was changed to where.
    – Y. zeng
    Oct 27, 2023 at 11:47
  • I changed it because you are showing the end-of-line command
    – Joseph Wright
    Oct 27, 2023 at 11:49
  • @JosephWright But "\show\" wouldn't output "^^M"
    – Y. zeng
    Oct 27, 2023 at 11:50
  • @JosephWright But why 'where'? The original made sense. I don't understand the 'where'?
    – cfr
    Oct 27, 2023 at 11:51
  • 2
    @Y.zeng OK, I've reverted as this is clearly part of what is confusing you
    – Joseph Wright
    Oct 27, 2023 at 12:08

1 Answer 1


the behaviour of non printable characters in tex output is customisable by the tcx options on the commandline but by default a newline is shown as ^^M (character 13) and \ at the end of a line is \<newline> that is \^^M as the space character is stripped by TeXs file reading routines before the input is tokenised. If you end the line with \ % then you will get a \ shown as the control sequence will have name space not name newline.

  • 1
    @Y.zeng if you subtract 32 (0x40) to M you have the ASCII code of the carriage return. See upload.wikimedia.org/wikipedia/commons/1/1b/…. This is why the character with code zero can be written ^^@, etc...
    – Rmano
    Oct 27, 2023 at 11:59
  • 1
    It is the TeX syntax for ctrl-M which is carriage return, \r just as ^^J is ctrl-J which is newline \n . This is not tex specific (apart from the ^^ syntax), ctrl-m has end of line behaviour in general. Oct 27, 2023 at 12:03
  • 2
    @Y.zeng the offset for ctrl is 64 not 32 Oct 27, 2023 at 12:05
  • 1
    @UlrichDiez well since tex normalizes 10, 13, and 10-13 pairs on input (to \endlinechar=13) the names are a bit arbitrary to be honest. Oct 27, 2023 at 13:31
  • 2
    @UlrichDiez tex just assumes that the input consists of "lines" it does not have to be a stream with separator characters could be a record based system, or punched card per line or whatever, so yes this is web2c but explicitly authorised system-specific part of tex.web Oct 27, 2023 at 13:57

You must log in to answer this question.

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