[texhax] Writing explicit newline to external file

Toby Cubitt tsc25 at cantab.net
Mon Jun 11 18:52:08 CEST 2007

```Oleg Katsitadze wrote:
> On Fri, Jun 08, 2007 at 11:57:15AM +0100, Toby Cubitt wrote:
>> Is there some way to write an explicit newline character to an external
>> file in (La)TeX?
>
> Does the following do what you want:
>
> \newlinechar=`^^J
> \write\@stream{blah blah^^Jfoo bar}

That does the trick! Thanks very much!

In fact, it even seems to work without the first line. I guess I was
close with my attempt using ^^M, but picked the wrong control character.
It works under both Windows and Unix, but I wonder if using linefeed
instead of carriage return will cause problems in other ways? Is that
the reason for first setting \newlinechar?

Toby
```