[texhax] Problems with \halign within a \write environment

Rodolfo Medina rodolfo.medina at gmail.com
Fri Sep 14 20:27:13 CEST 2007

If I process test.tex:


\newread \testin
\openin \testin myfile
  \closein \testin % file didn't exist
  \read\testin to \temp
    \closein \testin % file empty
    \closein \testin
    {\catcode`@=11 \input myfile }%


\immediate\write\myfile{\halign{#&#\cr a&b\cr}}



, I get the following error:

$ tex test
This is TeX, Version 3.14159 (Web2C 7.4.5)
(./test.tex (./myfile.tex
! Only one # is allowed per tab.
l.1 \halign {##
               &##\cr a&b\cr }
? h
There should be exactly one # between &'s, when an
\halign or \valign is being set up. In this case you had
more than one, so I'm ignoring all but the first.


And in fact, in myfile.tex there are two `##' instead of one.
Can anybody suggest a possible solution to avoid that?


More information about the texhax mailing list