soul 与中文配合不太好, 见截图.
也有绕过困难的方法。简单地说,用\mbox 把要高亮的一小段含中文的内容包裹起来就
可以顺利使用soul.
测试环境: ctex v2.9.2.164, texlive 2022
下面这段中文代码编译不过去
\documentclass[UTF8]{ctexart}
\usepackage{xcolor,soul}
\begin{document}
\hl{分久必合}
\end{document}
偶然发现中文之间加入空格可以编译通过.
\documentclass[UTF8]{ctexart}
\usepackage{xcolor,soul}
\begin{document}
\hl{分 久 必 合}
\end{document}
这表明 soul不是不能高亮中文.
为了去掉以上编译结果中的空格, 可以用\mbox把每个汉字包起来,
\documentclass[UTF8]{ctexart}
\usepackage{xcolor,soul}
\begin{document}
\hl{\mbox{分}\mbox{久}\mbox{必}\mbox{合}}
\end{document}
也可以简单地把要高亮的一小段汉字包裹起来:
\documentclass[UTF8]{ctexart}
\usepackage{xcolor,soul}
\begin{document}
\hl{\mbox{分久必合}}
\end{document}
以上两种方法都可以顺利编译通过。
类似的方法见:
https://www.mysmth.net/nForum/#!article/TeX/304723
\hl{this is test \mbox{\cite{foo}}.}
--
FROM 112.50.40.*
