The end-of-line character is not available to be used in the main input stream, under the standard setting which is
(see The ^^ notation in various engines for information about the
When TeX sees a character with category code 5, it immediately converts it either to a space or to a
\par token if another follows (possibly after the “skipping blanks” phase). When it sees the (operating system defined) end-of-record, it throws it away together with anything that can be on the line past it, removes all trailing blank spaces and inserts the
\endlinechar has category code 5, but this is not mandatory and different effects can be obtained by changing the category code. For instance,
\^^M into an active character and assign it the same meaning as
For your application you can look at section 11.9.4 of TeX by Topic; basically you do
Changing the category code of
^^M must be done in a group or otherwise you end up painting yourself into a corner.
However, I can't recommend doing this: editors might have different ideas about you with respect to when lines should end and hitting a key by mistake can spoil your work. Moreover, using
\mymacro inside an argument to another macro will definitely not work.
The end-of-line character mentioned above is not the system dependent record terminator. When TeX (any engine implementing it) reads a line, is informed by the operating system what the record terminator is; upon finding it, it throws it away together with everything after it on the same line; then it removes trailing blank spaces (character code 32) and tabs (character code 9); finally it inserts the character having the code equal to the current value of
So it's immaterial whether the record terminator is CR (ASCII 13), LF (ASCII 10) or CR+LF, or nothing at all (like for legacy IBM mainframes).
The TeX Live implementation allows any of the combinations above (CR, LF or CR+LF): it examines the first lines of the file and decides upon the line terminator to inform TeX of.