I have a file and I'd like to print it in the log file. The problem is that if I add a new line with ^^J, often two newlines are added when the size of the line to print is exactly the maximum width of the line in the console (which occurs… always since I print the log of a latex file 90% of the times).
MWE:
demo.txt
(/nix/store/6z1x24dwqp88qh769isg4y769w47d1x2-texlive-combined-2022/share/texmf/
tex/latex/epstopdf-pkg/epstopdf-base.sty
(/nix/store/6z1x24dwqp88qh769isg4y769w47d1x2-texlive-combined-2022/share/texmf/
tex/latex/latexconfig/epstopdf-sys.cfg))
! Package tikz Error: Giving up on this path. Did you forget a semicolon?.
See the tikz package documentation for explanation.
foo.tex:
\documentclass{article}
\begin{document}
Look at the log.
\ExplSyntaxOn
\ior_new:N \g__my_read_ior
\cs_new:Nn \robExt_write_file_in_log:n {
\ior_open:Nn \g__my_read_ior {#1}%
\ior_str_map_inline:Nn \g__my_read_ior {%
\message{\tl_to_str:n{##1}^^J}%
}%
}
\message{--------------}
\robExt_write_file_in_log:n {demo.txt}
\message{--------------}
\ExplSyntaxOff
\end{document}
\tl_to_str:nis useless here. ■ tl;dr I don't think it's possible. That having said why don't you use\immediate\write18/\typeout? – user202729 Dec 22 '23 at 07:48\typeout, and to be honest the differences with message are still a bit unclear to me ^^ It deals differently with newlines mostly? Another related stuff: https://tex.stackexchange.com/questions/705502/message-add-symbol-in-front-of-new-lines-even-if-there-is-a-line-break/705523#705523 – tobiasBora Dec 22 '23 at 10:39