如下所示的代码:
\documentclass[b5paper,twoside,openany,UTF8,no-math]{ctexbook}
\usepackage{xeCJK,xeCJKfntef}
%xeCJKfntef是xeCJK的子宏包,支持断行换页的中文下划线
\usepackage{color,xcolor} %颜色支持
\definecolor{lightblue}{rgb}{.8,.8,1} %lightblue的RGB颜色设定
%定制下划线(指令\CJKunderline*{<文字>})样式,实现文字高亮排版
\xeCJKsetup{underline={%
format = \color{lightblue}, %下划线颜色
thickness = 1.25\ccwd, %下划线厚度
depth = -1.0\ccwd, %下划线到文字基线的距离
}
}
\begin{document}
这是一段测试文字,\CJKunderline*{其中这些文字用xeCJKfntef宏包高亮,但是这些文字的注释\footnote{显示异常的注释。}显示异常。}
\end{document}
提示:
这个问题其实是因为\CJKunderline
实际上模仿的是ulem
的方法,因此该问题实际上可以进一步简化为ulem
与footnote
的冲突。
下面是一个不优雅的workaround:
\documentclass[b5paper,twoside,openany,UTF8,no-math]{ctexbook}
\usepackage{color}
\usepackage{xeCJKfntef}
\xeCJKsetup{underline={%
format = \color{yellow},
thickness = 1.25\ccwd,
depth = -1.0\ccwd,
}
}
\usepackage{soul}
\usepackage{ulem}
\begin{document}
这是一段测试文字,\CJKunderline*{其中这些文字用xeCJKfntef宏包高亮,但是这些文字\mbox{\footnotemark} 的注释显示异常。}\footnotetext{显示异常的注释。}
I can eat the glass and it doesn't hurt me.I can \uline{eat the glass and it doesn't hurt\mbox{\footnotemark} me}.I can eat the glass and it doesn't hurt me.\footnotetext{note with ulem}
I can eat the glass and it doesn't hurt me.I can \hl{eat the glass and it doesn't hurt\footnote{the footnote in hl} me}.I can eat the glass and it doesn't hurt me.
I can eat the glass and it doesn't hurt me.I can \ul{eat the glass and it doesn't hurt\footnote{the footnote in hl} me}.I can eat the glass and it doesn't hurt me.
\end{document}
同时还发现基于soul
宏包实现的高亮不会影响footnote
.
这样,能接受吗?
\documentclass[b5paper,twoside,openany,UTF8,no-math]{ctexbook}
\usepackage{xeCJK,xeCJKfntef}
%xeCJKfntef是xeCJK的子宏包,支持断行换页的中文下划线
\usepackage{color,xcolor} %颜色支持
\definecolor{lightblue}{rgb}{.8,.8,1} %lightblue的RGB颜色设定
%定制下划线(指令\CJKunderline*{<文字>})样式,实现文字高亮排版
\xeCJKsetup{underline={%
format = \color{lightblue}, %下划线颜色
thickness = 1.25\ccwd, %下划线厚度
depth = -1.0\ccwd, %下划线到文字基线的距离
}
}
\begin{document}
这是一段测试文字,\CJKunderline*{其中这些文字用xeCJKfntef宏包高亮,但是这些文字的注释}\footnote{显示异常的注释。}\CJKunderline*{显示异常。}
\end{document}
\ul{eat the glass and it doesn't hurt\footnote{the footnote in hl} me}
输入中文报错是的,因为
soul
宏包不支持中文,这也是为什么xeCJKfntef
为什么存在的原因。ref1: https://tex.stackexchange.com/questions/186176/underlining-with-ulem-package-breaks-footnotes
ref2: https://tex.stackexchange.com/questions/702598/how-can-i-print-a-footnote-in-an-sout-from-ulem