我有一个文件,我想将其打印在日志文件中。问题是,如果我使用 添加新行^^J
,通常会添加两个换行符,而要打印的行的大小恰好是控制台中行的最大宽度(这种情况总是发生,因为我 90% 的时间都在打印 latex 文件的日志)。
梅威瑟:
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}