[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:

----------------------------->%--------------------------------
\newwrite\myfile

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

\immediate\openout\myfile=myfile

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

\immediate\closeout\myfile

\end
-----------------------------%<--------------------------------

, 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?

Thanks,
Rodolfo



More information about the texhax mailing list