[texhax] Alignment in a \newwrite file?
Robin Fairbairns
Robin.Fairbairns at cl.cam.ac.uk
Sat Aug 21 20:54:32 CEST 2004
> Oleg Katsitadze wrote:
>
> >If I got you right, the following does the job:
> >etc...
>
> Rodolfo Meidina replies:
>
> The first solution you suggested,
> the one I prefer because it only uses plain TeX commands,
> seems to work fine.
>
> But I actually need bluefile.tex to be input *before* the \putstuffoverthere
> occurrencies.
> I tried with:
>
> %%%%%%%%%%%%%%%%%%%%%%%%begin of
> myfile.tex%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> \newwrite\blue
>
> \outer\def\putstuffoverthere#1#2{\immediate\write\blue{#1,& #2!\cr}}
>
> {\catcode`@=11
> \halign{#&#\cr \input bluefile }%
> }
>
> \immediate\openout\blue=bluefile
>
> \putstuffoverthere{Hallo}{folks}
> \putstuffoverthere{Goodbye}{folks}
> \putstuffoverthere{Goodbye}{folks}
>
> \immediate\closeout\blue
>
> \bye
> %%%%%%%%%%%%%%%%%%%%%%end of myfile.tex%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
> , but it doesn't work: I get a message of `Missing \cr inserted'.
> Possible to work this problem out?
you've got an empty bluefile
in any case, i would write:
%%%%%%%%%%%%
\newread \testin
...
\openin \testin bluefile
\ifeof\testin
\closein \testin % file didn't exist
\else
\read\testin to \temp
\ifeof\testin
\closein \testin % file empty
\else
\closein \testin
{\catcode`@=11
\halign{#&#\cr \input bluefile }%
}
\fi
\fi
%%%%%%%%%%%%%%
More information about the texhax
mailing list