ログ内のファイルを印刷

ログ内のファイルを印刷

ファイルがあり、それをログ ファイルに印刷したいと考えています。問題は、 を使用して新しい行を追加すると^^J、印刷する行のサイズがコンソールの行の最大幅とまったく同じ場合に、2 つの改行が追加されることが多いことです (これは、LaTeX ファイルのログを 90% の確率で印刷するため、常に発生します)。

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}

関連情報