2

According to this answer, TeX's standard end-of-line character is ASCII 13 (Carriage Return) with catcode 5.

How does TeX recognize the end of a line on systems with a different end-of-line character, e.g. on Unix systems, whose end-of-line character is ASCII 10 (Line Feed), which on my Mac has catcode 12 like the letters of the alphabet?


* I'm interested in pdfTeX, LuaTeX and XeTex.

  • 1
    The record terminator is implementation dependent; TeX will remove it together with whatever remains on the line, also removes trailing blank spaces (character code 32) and tabs (character code 9) and puts in the character having the current value of \endlinechar as character code. – egreg Jun 20 '17 at 17:36
  • I added the info to my answer. – egreg Jun 20 '17 at 17:42
  • @egreg: There's a point in your addendum to that answer that baffles me. I wrote a comment explaining my misgivings. – Evan Aad Jun 20 '17 at 19:11
3

As explained in the addendum to my answer, the exact record terminator is completely irrelevant because it is thrown away when the line is read in.

So whether the OS thinks records are terminated with CR, LF or CR+LF is of no importance whatsoever as far as TeX is concerned. The current \endlinechar with its category code can be assumed to terminate a line, from a TeX programmer’s point of view.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.