- #1
Eclair_de_XII
- 1,083
- 91
- TL;DR Summary
- I'm trying to learn how to use the \write command in order to tell TeX to write files. I want to start a new line with each message inserted. According to TeX for the Impatient, whenever the program encounters the character whose charcode is given by the numerical \newlinechar parameter, the engine starts a new line. Such is not the case for the code below. Why is this?
Code:
\documentclass{article}
\newlinechar=`\^^J
\def\first{This is the first sentence.^^J}
\def\second{This is the second sentence.^^J}
\def\third{This is the third sentence.^^J}
\def\nth{You get the idea.^^J}
\def\outfile{outfile.txt}
\newwrite\myout
\begin{document}
\immediate\openout\myout=\outfile
\immediate\write\myout{\first}
\immediate\write\myout{\second}
\immediate\write\myout{\third}
\immediate\write\myout{\nth}
\immediate\closeout\myout
\end{document}