[texhax] How to write a TeX code into file literally

Paul Isambert zappathustra at free.fr
Sun Oct 9 08:59:39 CEST 2011


Le 09/10/2011 08:49, Yue Wu a écrit :
> Then I tried to set #'s catcode to 12(other):
>
> \newwrite\testwrite
> \openout\testwrite=testwrite
> {\catcode`\#=12
> \immediate\write\testwrite{\halign{#&#\cr
> hello&test\cr
> }}
> }
>
> then the file will be empty.

Add \immediate before \openout, otherwise the file isn't opened yet when 
\write is called.

Best,
Paul


More information about the texhax mailing list