Skip to content
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

ctex: 修改 numberformat 时前后间距异常 #476

Open
stone-zeng opened this issue Jan 7, 2020 · 2 comments
Open

ctex: 修改 numberformat 时前后间距异常 #476

stone-zeng opened this issue Jan 7, 2020 · 2 comments
Labels

Comments

@stone-zeng
Copy link
Member

stone-zeng commented Jan 7, 2020

使用 XeLaTeX 编译:

\documentclass[fontset=fandol]{ctexbook}
\ctexset{
  chapter = {
    break      = {},
    beforeskip = 10pt,
    afterskip  = 10pt,
  }
}

\begin{document}

\chapter{}

\begingroup
\ctexset{chapter/numberformat = \zihao{0}}
\chapter{}
\endgroup

\begingroup
\ctexset{chapter/numberformat = \zihao{7}}
\chapter{}
\endgroup

\ctexset{chapter/number = \arabic{chapter}}
\chapter{}

\begingroup
\ctexset{chapter/numberformat = \zihao{0}}
\chapter{}
\endgroup

\begingroup
\ctexset{chapter/numberformat = \zihao{7}}
\chapter{}
\endgroup

\end{document}

Screen Shot 2020-01-07 at 12 28 55

看问题应该还是来自 xeCJK 对空格的处理:

\huge\bfseries\centering
\begin{tabular}{ll}
  第\textit{\zihao{0}5}章   & 第\textit{\zihao{7}6}章   \\
  第\textit{\zihao{0}5} 章  & 第\textit{\zihao{7}6} 章  \\
  第 \textit{\zihao{0}5}章  & 第 \textit{\zihao{7}6}章  \\
  第 \textit{\zihao{0}5} 章 & 第 \textit{\zihao{7}6} 章 \\
\end{tabular}

Screen Shot 2020-01-07 at 12 31 12

LuaLaTeX 编译没有问题:

Screen Shot 2020-01-07 at 12 32 15

PS:这个其实是文档里面的例子(不带颜色),所以最好还是要处理一下。

@muzimuzhi
Copy link
Contributor

muzimuzhi commented Jan 7, 2020

  • 5 之前的间距,是文字 5 的字号下一个空格的宽度
  • 5 之后的间距,是文字 的字号下一个空格的宽度

5 的字号差异较大时,就能看到前后间距异常的问题。

xecjk 目前的实现,\CJKecglue 总是采用下一个(非空格)字符的字号。不了解 luatex-ja 的实现方式。

\documentclass{article}
\usepackage{xeCJK}

\def\test#1{
  \def\zihao##1{\fontsize{#1}{#1}\selectfont}
  \texttt{#1pt}: 
  \begin{tabular}{*{4}{p{4em}}}
    第\textit{\zihao{0}5}章   & 
    第\textit{\zihao{0}5} 章  & 
    第 \textit{\zihao{0}5}章  & 
    第 \textit{\zihao{0}5} 章 \\
  \end{tabular}\par
}

\begin{document}
\huge\bfseries
\test{10}
\test{15}
\test{20}
\test{40}
\end{document}

image

@stone-zeng stone-zeng mentioned this issue Jan 10, 2020
25 tasks
@RuixiZhang42
Copy link
Member

这个好像很早就发现了:CTeX-org/forum#31 (comment)

切换字体时,中转西的「空格」使用组内西文字体指定的大小,西转中的「空格」使用组外当前中文字体指定的大小。总之就是 xeCJK 自动补回去的空格不能一致。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants