I have a latex document that I want to use to write text to a plain text file. I want macros to be expanded, so I can't use \filecontents
(which just saves input verbatim to a file)
So far I have
\newwrite\metadatafile
\immediate\openout\metadatafile=\jobname-meta.txt
\immediate\write\metadatafile{Title: \jobname\string
Tags: \coursecode.\secnum.\termcode, \coursecode.\termcode, ...
Description:
...}
\immediate\closeout\metadatafile
What comes out in the text file inserts \par
tokens instead of my double-newlines, and doesn't have any newlines in it at all. How can I get newlines and have a regular plain text file?