列印日誌中的文件

列印日誌中的文件

我有一個文件,我想將其列印在日誌文件中。問題是,如果我新增一個新行^^J,當要列印的行的大小恰好是控制台中行的最大寬度時,通常會添加兩個換行符(這種情況總是在我列印乳膠檔案的日誌時發生) 90% 的時間)。

微量元素: 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}

相關內容