10 在使用xeCJKfntef包排版高亮文字时,footnote无法正常显示,如何解决?

发布于 2025-03-04 17:57:20

如下所示的代码:

\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}

提示:
微信截图_20250304175523.jpg

查看更多

关注者
0
被浏览
158
2 个回答
Sagittarius Rover
我要成为Typst糕手/(ㄒoㄒ)/~~

这个问题其实是因为\CJKunderline实际上模仿的是ulem的方法,因此该问题实际上可以进一步简化为ulemfootnote的冲突。

下面是一个不优雅的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.

image.png

远方不远
远方不远 2天前
这家伙很懒,什么也没写!

这样,能接受吗?
image.png
image.png

\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}

撰写答案

请登录后再发布答案,点击登录

发布
问题

分享
好友

手机
浏览

扫码手机浏览