-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
关于ulem包与xeCJKfntef包连用hyperref包进行超链接下划线的疑惑 #327
Comments
更新:刚刚 hyperref 来了消息,说是由于xelatex导致的问题,可以换用lualatex看看,目前发现lualatex配合hyperhref可以临时解决我的问题,不过我还是想暂时让issue开着,因为自己也确实好奇其他的问题是否有解决方案…… |
首先,建议总是具体描述问题(下划线高度不对、表现为横穿文字),不要只定性评价(这里的「过于拉垮」)。 试了试,这更像是 FandolSong 字体的问题。Fandol 系列的其他字体和 macOS 内置的 STSong 都没这个问题。@clerkma % !TeX program = xelatex
\documentclass{article}
\usepackage{fontspec}
\usepackage[urlbordercolor={0 0 0},pdfborderstyle={/S/U/W 1}]{hyperref}
\NewDocumentCommand{\test}{ m }{%
{\fontspec{#1}%
\noindent Font: #1\par
正常文字\href{https://github.com/latex3/hyperref}{测试测试测试}正常文字\par}}
\begin{document}
\noindent Font: Latin Modern Roman\par
Normal Text \href{https://github.com/latex3/hyperref}{test test test} normal text\par
\test{FandolSong}
\test{FandolFang}
\test{FandolHei}
\test{FandolKai}
\end{document} |
似乎确实如此。补充:梦源宋体系列也有此问题,不过表现的不如FandolSong明显,只是下划线距离文字的宽度不均一。 另:今天发现了昨天解决方案的另一个大毛病,在全局设置hyperref宏包后,目录和脚注、表注都有一道下划线,找了一堆doc看也没能找到解决方案,似乎还是得继续加个package用…… % !TeX encoding = UTF-8
% !TEX TS-program = xelatex
\documentclass[a4paper,oneside,onecolumn,12pt,fontset=none]{ctexrep}
\usepackage[colorlinks=false,allbordercolors={0 0 0},pdfborderstyle={/S/U/W 1}]{hyperref}
\setmainfont[BoldFont=Source Han Serif SC]{Source Han Serif SC}
\setCJKmainfont{Source Han Serif SC}[BoldFont=Source Han Serif SC]
\setCJKsansfont[BoldFont=Source Han Serif SC]{Source Han Serif SC}
\begin{document}
This is a line to test footnote\footnotemark and \hyperref[aaa]{ref}.
\footnotetext{这是脚注。}
\bigbreak
{
\label{aaa}
这是引用的内容。
}
\end{document} |
不像选项 <TYPE> ::= "cite" | "file" | "link" | "menu" | "run" | "url" 选项 LaTeX3 团队开发中的 % !TeX program = xelatex
\DocumentMetadata{}
\documentclass{article}
\usepackage{fontspec}
\usepackage{hyperref}
\NewDocumentCommand{\test}{ m }{%
{\fontspec{#1}%
\noindent Font: #1\par
正常文字\href{https://github.com/latex3/hyperref}{测试测试测试}正常文字\par}}
\AddToHook{pdfannot/link/URI/before}{\hypersetup{urlbordercolor=,pdfborderstyle={/S/U/W 1}}}
\begin{document}
\tableofcontents
\section{title}
Text\footnote{text}
\noindent Font: Latin Modern Roman\par
Normal Text \href{https://github.com/latex3/hyperref}{test test test} normal text\par
\test{FandolSong}
\test{FandolFang}
\test{FandolHei}
\test{FandolKai}
\end{document} 注意, |
非常感谢您的耐心解答!因为我还是一个latex新手,并未开始涉猎关于hook与latex编译具体实现的部分,看到您的回答以后才刚开始看 lthooks 的相关文档,部分hook的内容没法彻底理解,所以暂时就直接简单改下照搬了 再次感谢! |
还是不能关issue啊 🤣 今天研究了半天,发现您发的办法2,采用hook时不可取的,因为 所以说最后还是得回到自定义命令上去……(但是自己自定义命令以后又得考虑特殊符号的处理,真的是重复造轮子了……),所以最后我给它又开了个issue latex3/hyperref#350 |
你的真实需求,是「给 |
啊,抱歉,这个地方没说明白。 一开始确实是只是想给 目前的需求是希望仅使用hyperref一个package实现 结果发现似乎有些天方夜谭了 (눈▂눈) |
果然还是回到自定义命令上来吧……相对简便易行一些 此法最大的好处就是无须担忧相同类型链接的自动生成导致的格式问题,例如前面提到的hook,正文没问题了但是自动生成的目录又出了下划线……这样只有在手动调用时才会生成下划线,平时啥也没有就好了 代码见下方链接: |
好吧,上面的实现方式还是有一点小问题,在底部脚注中使用 还是换回了老传统的ulem…… \newcommand{\uhref}[2]{%
\uline{\href{#1}{#2}}%
}
\newcommand{\uref}[1]{%
\uline{\ref{#1}}%
} |
检查清单
操作系统
Linux(ubuntu 22.04.4 LTS)
TeX 发行版
Tex Live 2024
描述问题
hyperref
包的超链接命令\href{url}{text}
增加下划线ulem
包的\uline{}
命令,但发现其不能自动换行xeCJKfntef
的推荐\CJKunderline{}
替换\uline{}
,但意外地发现竟然连英文也无法自动换行了hyperref
包本身自带有下划线命令,但是对CJK支持过于拉胯……请问:
hyperref
包的输出?(优先精简依赖)\uline{}
命令实现CJK的自动换行下划线?\CJKunderline{}
正确运行?附:
最小工作示例(MWE)
其他日志见附件
链接
其他信息
No response
附件
uline_error.log
xecjk_uline_error.log
The text was updated successfully, but these errors were encountered: