[texhax] Detection of start of source line

David Carlisle d.p.carlisle at gmail.com
Thu Oct 6 00:08:02 CEST 2016


I think once you change the catcode you need to do the \par for a
blank line by hand, also if the character after the newline is not a *
then you want to use the original chanracter not \char`\*


\catcode `\^^M = \active%
\def \treatasteriskspecially{%
\ifx *\nexttoken \expandafter\item\else%
\ifx^^M\nexttoken\par\fi\fi}%
\def\item*{\par[item]}%
\def ^^M{%
\futurelet \nexttoken \treatasteriskspecially}%
%
a b c
* x y * z

s s
* qq

\bye





On 5 October 2016 at 18:13, Philip Taylor <P.Taylor at rhul.ac.uk> wrote:
> Further correction :
>
> This may help -- at least it generates no run-time errors :
>
>
> \def \treatasteriskspecially
>
>      { % space needed here
>
>          \ifx *\nexttoken
>
>              \let \nexttoken = \item
>
>          \else
>
>              \def \nexttoken {\char `\*}^ but not here
>
>          \fi
>
>          \nexttoken
>
>      }
>
> \catcode `\^^M = \active \def ^^M{\futurelet \nexttoken
> \treatasteriskspecially}
>
> abcd * efgh
>
> * ihjk * lmno
>
> \end
>
>
>
> _______________________________________________
> TeX FAQ: http://www.tex.ac.uk/faq
> Mailing list archives: http://tug.org/pipermail/texhax/
> More links: http://tug.org/begin.html
>
> Automated subscription management: http://tug.org/mailman/listinfo/texhax
> Human mailing list managers: postmaster at tug.org


More information about the texhax mailing list