-
Notifications
You must be signed in to change notification settings - Fork 15
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
\pdfmarkupcomment 不支持中文 #14
Comments
你说的我都懂,然而这和 ctex kit 项目有什么关系?
Liam Huang
From my iPhone
… 在 2019年3月12日,16:33,taroxd ***@***.***> 写道:
一个例子:
% !TeX program = LuaLaTeX
% !TeX encoding = UTF-8
\documentclass{article}
\pagestyle{empty}
\usepackage{luatexja-fontspec}
\usepackage{luatexja-ruby}
\usepackage[rgb]{xcolor}
\usepackage[author={taroxd}]{pdfcomment}
\begin{document}
\section{标题}
\pdfmarkupcomment[markup=Squiggly,color=red]{中文}{中文}
\end{document}
使用 lualatex 编译,会得到如下错误。
Package soul Error: Reconstruction failed. [...t[markup=Squiggly,color=red]{中文}{中文}]
类似的,用 xelatex 也是得到同样的错误。这段代码将“中文”两次改为英文不会有问题。
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
因为有人跟我说中文的问题最好在这儿问 _(:з)∠)_ |
Issue reopened after transfering. |
这个应该不意外, |
一个比较手动的 workaround \documentclass{article}
\usepackage{ctex}
\usepackage[author={taroxd}]{pdfcomment}
\usepackage[rgb]{xcolor}
\usepackage{xpatch}
\makeatletter
\AtBeginDocument{
\patchcmd{\SOUL@doword}{\SOUL@tt}{}{}{\ddt}
\patchcmd{\SOUL@dosyllable}{\SOUL@tt}{}{}{\ddt}
}
\makeatother
\newfontfamily\cnFont{SourceHanSerif-Regular}
\newcommand{\pdfmarkupcommentX}[3][]{%
\xeCJKsetup{xeCJKactive=false}%
\cnFont
\pdfmarkupcomment[#1]{#2}{#3}%
\xeCJKsetup{xeCJKactive=true}
}
\begin{document}
\pdfmarkupcommentX[markup=Squiggly,color=red]{中文测试}{中文测试}
\end{document}
以下是尝试的过程,过程并不具有严谨的科学性,只是「凑巧」可用。
\documentclass{article}
\usepackage{ctex}
\usepackage{soul}
\begin{document}
\ul{中文}
\end{document} 对应的错误是
\font\cnFont="[SourceHanSerif.ttc]"
\xeCJKsetup{xeCJKactive=false}\cnFont
this works: \ul{中文x}, \\
this does not work: \ul{中文}
|
以下是一个让
\documentclass{article}
\usepackage{ctex}
\usepackage[rgb]{xcolor}
\usepackage{pdfcomment}
\usepackage{xpatch}
\makeatletter
% change the dimension that stores the width of annotation
\xpatchcmd\pc@soul@markup{\ulwidth}{\pc@box@width}{}{\ddt}
% change entrance to \@new@soul, and substitute each of 2 occurrences
\xpatchcmd\pdfmarkupcomment{\SOUL@}{\@new@soul}{}{\ddt}
\xpatchcmd\pdfmarkupcomment{\SOUL@}{\@new@soul}{}{\ddt}
\def\@new@soul#1{%
% \pc@box@width is provided by "pdfcomment.sty"
\settowidth{\pc@box@width}{#1}%
\pc@soul@markup
#1%
}
\makeatother
\begin{document}
text
\pdfmarkupcomment[markup=Squiggly,color=red]{text}{something}
\pdfmarkupcomment[markup=Squiggly,color=red]{中文text中文:aha}{something}
\end{document} 目前知道的信息 % in pdfcomment.sty
\pdfmarkupcomment, def of
- handle math mode, and "pdfcomment" options like "final" and "disable"
- change internal entrance of \SOUL@
% \def\ulp@draw{\pc@soul@markup}
- use soul to calculate the dimensions of annotated text
% \SOUL@{#2}
\pc@soul@markup, def of
- save start positions of annotation in \pc@Sposx and \pc@Sposy
- set ending x-postiion, where \ulwidth is the width of annotated text
% \addtolength{\pc@Eposx}{\ulwidth}
- set ending y-position to the same as start y-position
- execute \pc@annot@complete to draw the annotation |
一个例子:
使用 lualatex 编译,会得到如下错误。
类似的,用 xelatex 也是得到同样的错误。这段代码将“中文”两次改为英文不会有问题。
The text was updated successfully, but these errors were encountered: