GithubHelp home page GithubHelp logo

Comments (4)

leo-liu avatar leo-liu commented on August 25, 2024

Comment #1 originally posted by sobenlee on 2012-04-10T17:55:18.000Z:

r181 中将一些 \CJKecglue 改成 @SPtoken 的用意应该是保留汉字与非汉字直接手动加入的空格,而让 \CJKsetecglue 只影响 xeCJK 自动加入的空格。不过

\def\xeCJK@cclv@i{{
\ifnum\lastkern=@ne
\CJKglue
\else
\ifnum\lastkern=\xeCJK@four
@SPtoken%\CJKecglue
\else
\ifnum\lastnodetype=\xeCJK@ten
\CJKecglue
\fi
\fi
\fi}
\bgroup

\xeCJK@emptyCJKtoks
\xeCJK@setfont
\CJKsymbol}

这里的 @SPtoken 应该还是得改成 \CJKecglue。因为前面 0 到 255 的代码是

\def\xeCJK@@cclv{
\futurelet\xeCJK@nexttoken\xeCJK@zz@cclv}

\def\xeCJK@zz@cclv{
\ifx\xeCJK@nexttoken@sptoken
\else
{\xeCJK@zerokern}
\fi}

这里 \xeCJK@zerokern 是 \edef\xeCJK@zerokern{\kern -4sp\kern 4sp}。说明,当 0 与 255 之间不是空格时,插入 \xeCJK@zerokern 用于判断,这就使得 \xeCJK@cclv@i 中 \ifnum\lastkern=\xeCJK@four 判断正确,从而插入 @SPtoken,但是本来就没有空格,这里应该插入的是 \CJKecglue。

另外,“中\textdollar 国”的状态转移似乎是 1-0-255-1,而“中$国”的状态转移似乎是 1-255-0-255-1。这使得“中$国”在 $ 前多加入了 \xeCJK@cclv@ 中的 @SPtoken

\def\xeCJK@cclv@{
\ifnum\lastkern=@ne
@SPtoken%\CJKecglue
\fi}

我的观察可能不完全,但确实存在这样状态转移的差异,具体原因不清楚。

from ctex-kit.

leo-liu avatar leo-liu commented on August 25, 2024

Comment #2 originally posted by sobenlee on 2012-04-10T22:51:56.000Z:

r302 已修复。将 xeCJK 的 \CJKsetecglue 修改为影响中英文、中文与行内数学公式之间的空白,正文中显式加入的空格也将被 \CJKecglue 替换。

但是这里有一个问题,数学公式后显式加入的 glue,例如 \quad、\hskip 之类也会被 \CJKecglue 替换。例如

\CJKsetecglue{ }
中$x$\quad 国

这里的 \quad 会被 \CJKecglue(这里是空格)替换掉。解决的方法是在 $ 与 \quad 直接加入一个空格,但此时 $x$ 与“国”直接的空白是 \quad + 一个空格的宽度,而非预期的 \quad。

产生问题的原因是在 \xeCJK@cclv@i 中用了 \unskip 来消掉 255 与 1 之间的空格,而用 \CJKecglue 将之替换。

因此,这个修复顾此失彼了。

from ctex-kit.

leo-liu avatar leo-liu commented on August 25, 2024

Comment #3 originally posted by sobenlee on 2012-04-10T23:48:23.000Z:

r303 通过增加对 \lastskip 与空格宽度的比较,减少对显示加入的 glue 的替换。

from ctex-kit.

leo-liu avatar leo-liu commented on August 25, 2024

Comment #4 originally posted by LeoLiu.PKU on 2012-04-11T01:12:38.000Z:

当年 xeCJK 较早的版本,加间距的规则非常复杂,那时候就有 CJKnormalspaces, CJKaddspaces, CJKtextspaces, CJKmathspaces, CJKsetspaces, CJKnospaces 一系列选项,后来又因为 bug 太多全删掉,改成现在比较简单的规则。

你现在改的规则我没有仔细看,我担心又会出现以前类似的问题。

from ctex-kit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.