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

David Carlisle d.p.carlisle at gmail.com
Wed Apr 25 17:21:12 CEST 2018

your question isn't very clear, I assume \write\zzzz{a,b,c} isn't the answer?
If the point is that you make multiple writes but do not know which is
the last then you can do

\def\mysep{}% at the start of the document

then on each write do

\write\zzzz{\mysep a}\gdef\mysep{,}
\write\zzzz{\mysep b}\gdef\mysep{,}
\write\zzzz{\mysep c}\gdef\mysep{,}

then you will get

a
,b
,c

which if input ignoring line ends will give you a,b,c

On 25 April 2018 at 16:11, Rodolfo Medina <rodolfo.medina at gmail.com> wrote:
> Hi all (La)TeX users.
>
> In (e)plain TeX: in a document of mine I'm using the \write command so to write
> a list of items in an external file and then input it in the document.  I wish
> that items were separated by a comma, apart from the last one of course.  How
> can I do that?
>
> Thanks for any help,
>
> Rodolfo
>
> _______________________________________________
> TeX FAQ: http://www.tex.ac.uk/faq
> Mailing list archives: http://tug.org/pipermail/texhax/