[texhax] plain TeX: separate itmes by comme in \write environment

Philip Taylor P.Taylor at Rhul.Ac.Uk
Wed Apr 25 23:30:36 CEST 2018


Still at the hotel, but found some time to investigate.  It would seem 
that \toks 0 was the culprit.

\input eplain

\newwrite \standout
\openout \standout = temp.txt

\newtoks \temptoks

\def \write #1#2%
     {%
         \if \relax \the \temptoks  \relax
             \temptoks  = {#2}%
         \else
             \temptoks  = \expandafter {\the \temptoks , #2}%
         \fi
     }

\def \donewriting #1{\primitive \write #1 {\the \temptoks}\closeout #1}

\write \standout {Now}
\write \standout {is}
\write \standout {the}
\write \standout {time}
\write \standout {for}
\write \standout {all}
\write \standout {good}
\write \standout {men}
\write \standout {etc.}

\donewriting \standout
\leavevmode \vfill \eject
\input temp.txt

\end


More information about the texhax mailing list