Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

7
  • 1
    Trailing spaces (ASCII 32, regardless of catcode) are trimmed in web2c TeX implementations. You can try that by setting the space to a show-stopping catcode, like 2: a line with a will be valid Commented Jan 26, 2021 at 16:34
  • @PhelypeOleinik The spaces are actually stripped off before looking at category codes and, as far as I know, this is in all TeX implementations. Commented Jan 26, 2021 at 16:37
  • @egreg Yeah, that's right (with "regardless of catcode" I should have said "before TeX assigns any catcode to them"). I don't know if this is in all implementations, though: this code is in some web2c C routines, so if some implementation doesn't use that, spaces may be preserved. This code is not part of TeX itself Commented Jan 26, 2021 at 16:40
  • 1
    @PhelypeOleinik it is documented in the texbook (and web2c recently changed to only strip space and not strip tab to match the texbook more exactly) Commented Jan 26, 2021 at 16:49
  • @PhelypeOleinik As David says: third double dangerous bend on page 46 of the TeXbook: “TeX deletes any ⟨space⟩ characters (number 32) that occur at the right end of an input line.” Commented Jan 26, 2021 at 17:13