问题
我在一个文件上运行
tinytex::latexmk()
,其中包含 (a) UTF-8 编码、(b) T1 字体编码、(c) 包含重音字符的满水平框。这会创建一个采用 latin1 (ISO-8859-1) 编码的日志文件,导致来自 tinytex
的警告。
可重现的示例
tinytex::latexmk("tiny.tex")
## [1] "tiny.pdf"
## Warning messages:
## 1: In xfun::read_utf8(log) :
## The file tiny.log is not encoded in UTF-8. These lines contain invalid UTF-8 characters: 51
## 2: In grep("^(LaTeX|Package [[:alnum:]]+) Warning:", x) :
## unable to translate 'r/bx/n/10 vari-able di-cot<f3>mica\T1/cmr/m/n/10 . ' to a wide string
## 3: In grep("^(LaTeX|Package [[:alnum:]]+) Warning:", x) :
## input string 51 is invalid
其中
tiny.tex
包含
\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
\begin{document}
\begin{itemize}
\item In this line we get an overfull hbox because the word \textbf{variable dicotómica}.
\end{itemize}
\end{document}
系统信息
R 4.3.1 在 Debian/GNU Linux(测试)系统上使用
tinytex
0.46 和 xfun
0.40 以及 TeXLive 2023.20230613-3,运行 en_US.UTF-8 语言环境。 TinyTeX 发行版未安装,即 R 包tinytex
调用系统 TeXLive。不过,我们在 Windows 系统上也看到了同样的问题。
解决方法
我可以通过不使用 T1 字体编码来避免这个问题,即通过省略或注释
tiny.tex
中的第二行。然后使用 OT1 字体编码,关于溢出 hbox 的日志消息采用 ASCII 格式。
问题
我可以做些什么来获取 UTF-8 格式的日志消息吗?或者
tinytex
必须处理它(例如,通过读取字节然后使用 iconv()
)?