# [texhax] read argument until EOL

Philip Taylor (Webmaster, Ret'd) P.Taylor at Rhul.Ac.Uk
Thu Jan 6 12:24:22 CET 2011


Arno Trautmann wrote:
> Hi all,
>
> a question I posted on the LaTeX3-list and Uwe Lueck asked me to re-post
> here:
>
> How to code a macro that reads an argument until the end of the line?
> e.g. to get rid of braces in \section:
>
>    \eolsection My Title
>    normal text.
>
> Here, "My Title" should be accesible in the \eolsection as #1.
> For my case, the solution does not have to be robust or cover any
> strange case with catcodes, verbatim or anything else, just plain text
> will appear.

I am going to take my life in my hands and type in an extempore
solution without testing : /caveat emptor/ !

\def \eolsection
{
\begingroup
\catcode \^^M = \active
\uccode \~ = \^^M
\uppercase {\def \innereolsection ##1~}{\endgroup \message {##1}}\relax
\innereolsection
}

Where I have "\message {##1}", you should insert whatever
you want to do with My Title and analogous parameters.

THIS CODE IS UNTESTED : USE IS ENTIRELY AT YOUR OWN RISK.

Philip Taylor
`