TransWikia.com

Write to log without wrapping

TeX - LaTeX Asked by Matthew Leingang on December 18, 2020

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 immediatewrite17. 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 iffalsefi, 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.

newwritelogfilenowrap
immediateopenoutlogfilenowrap=jobname.log

Then immediatewritelogfilenowrap{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.

3 Answers

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

newwritemylog
immediateopenoutmylog=jobname.mylog

Correct answer by Harald Hanche-Olsen on December 18, 2020

Output file line wrapping is controlled by the max_print_line setting in texmf.cnf (for TeX Live, miktex may have another system that I do not know).

The default setting is:

max_print_line = 79

Answered by Taco Hoekwater on December 18, 2020

For the case of pdflatex provided by MiKTeX, you can set max_print_line directly to some larger number - 191 here:

[IO.File]::WriteAllLines("$Env:AppDataMiKTeXmiktexconfigpdftex.ini", "max_print_line=191")

which creates pdftex.ini with a file encoding that allows it to be read by MiKTeX's pdflatex, ie UTF-8 with no BOM.

Answered by joharr on December 18, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP