[Tex/LaTex] Write to log without wrapping

loggingtex-core

I'd like to to generate some metadata in the log file that I can copy to another application. But the log file is wrapped to 80 columns and I end up with newlines embedded in what I'm putting there. Is there a way around this?

The two ways I know to write to the log file are \message and \immediate\write17. But both of these have the same effect. Is \write17 a special filehandle that only writes wrapped text?

My workaround so far is to write to the auxiliary file between \iffalse\fi, but I know that's not what the aux file is for. I don't feel like writing this metadata to another file. Yes, I'm being stubborn, but TeX means you can usually get anything you want if you work hard enough. Can I do this?

Edit: Here's something else that doesn't work. Open another filehandle with the same filename.

\newwrite\logfilenowrap
\immediate\openout\logfilenowrap=\jobname.log

Then \immediate\write\logfilenowrap{long text} will not wrap lines. But it lops off everything that was in the logfile before this point (of course it does. Opening a file handle usually puts the pointer at the front).

Edit 2: Thanks for all the replies. Consensus is that this is "probably" not possible. I'll go the route of writing metadata to a separate text file.

Best Answer

I am pretty sure the wrapping behaviour is hardwired in TeX itself. Why can't you simply write to a separate file instead?

\newwrite\mylog
\immediate\openout\mylog=\jobname.mylog
Related Question