CTeX-org / ctex-kit

Macro Packages and Scripts for Chinese TeX users
972 stars 124 forks source link

中英文混排时,等宽英文前后空格宽度不一致 #570

Closed Evian-Zhang closed 3 years ago

Evian-Zhang commented 3 years ago
\documentclass{ctexart}
\begin{document}
你\texttt{abc}好。
\end{document}

生成的结果中,“你”之后“a“之前的空格为等宽字体的空格,宽度为1em;“c”之后“好”之前的空格为正常字体的空格,宽度为0.5em。

编译器:XeLaTeX 平台:macOS CTeX版本:2021/03/14 v2.5.6 详细信息:

xelatex --version
XeTeX 3.14159265-2.6-0.999992 (TeX Live 2020)
kpathsea version 6.3.2
Copyright 2020 SIL International, Jonathan Kew and Khaled Hosny.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the XeTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the XeTeX source.
Primary author of XeTeX: Jonathan Kew.
Compiled with ICU version 65.1; using 65.1
Compiled with zlib version 1.2.11; using 1.2.11
Compiled with FreeType2 version 2.10.1; using 2.10.1
Compiled with Graphite2 version 1.3.13; using 1.3.13
Compiled with HarfBuzz version 2.6.4; using 2.6.4
Compiled with libpng version 1.6.37; using 1.6.37
Compiled with poppler version 0.68.0
Using Mac OS X Core Text and Cocoa frameworks
sikouhjw commented 3 years ago

https://github.com/CTeX-org/forum/issues/165

muzimuzhi commented 3 years ago

生成的结果中,“你”之后“a“之前的空格为等宽字体的空格,宽度为1em;“c”之后“好”之前的空格为正常字体的空格,宽度为0.5em。

宽度描述那里,不大对。

本地测试的结果,单位均为 pt

\documentclass{ctexart}
\showboxbreadth=1000
\showboxdepth=100

\begin{document}
\setbox0=\hbox{你\texttt{abc\quad abc}好}
\showbox0
\usebox0
\end{document}

log 里得到

> \box0=
\hbox(8.06262+1.82329)x73.8599
.\TU/SongtiSCLight(0)/m/n/10.53937 你
.\kern 0.0
.\glue 5.53317
.\TU/lmtt/m/n/10.53937 abc
.\kern -0.0002
.\kern 0.0002
.\glue 10.53937
.\TU/lmtt/m/n/10.53937 abc
.\kern 0.0
.\glue 3.50961 plus 1.7548 minus 1.16986
.\TU/SongtiSCLight(0)/m/n/10.53937 好
.\kern -0.00017
.\kern 0.00017

! OK.
l.8 \showbox0
stone-zeng commented 3 years ago

See #252.