I know how to define a macro that will take the rest of the paragraph as parameter.
But, how do I write a macro whose argument will extend to the end of the line?
This answer builds upon Martin Scharrer's updated solution (which was based on mine, based on his... ;-p).
In order to grab the end of the line, we use a delimited argument, but for this, we need to have an active end-of-line character. Two possibilities:
Finally, the construction
The end-of-line character in TeX is the ASCII 13 Carriage Return character which can be represented by
However you cannot simply write
This worked in my tests, but might be flawed somehow and there might be better/more efficient ways to do it.
Please note that the end-of-line can be commented out using
Here a variation of the solution of Bruno Le Floch (which is based on my solution above) where
Please also note that there is a
Here is a crude solution that relies on changing catcodes: