CTeX-org / ctex-kit

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

xeCJK设置特殊字符问题 #645

Closed libinxu01 closed 1 year ago

libinxu01 commented 1 year ago

使用环境:xelatex(Tex Live 2022) 最新版本的xeCJK设置标点、箭头、数学操作符等字体:


\xeCJKDeclareSubCJKBlock{CircledNumbers}{`① -> `⑳, `㉑ -> `㉟, `㊱ -> `㊿} % "2460 -> "2473
\xeCJKDeclareSubCJKBlock{GeneralPunctuation}{
    "2000 ->"2013,
    "2015 -> "2017,
    "201A -> "201B,
    "201E -> "2031,
    "2034 -> "206F}
\xeCJKDeclareSubCJKBlock{Arrows}{"2190 -> "21FF}
\xeCJKDeclareSubCJKBlock{MathematicalOperators}{
    "2200 -> "223C,
    "223E -> "224D,
    "224E -> "22FF
}
\xeCJKDeclareSubCJKBlock{SimLikeMathematicalOperators}{
    "223D -> "223D,     %∽相似符号
    "224C -> "224C,     %≌全等符号
    "2263 -> "2263,     %≣化学三键
    "22E6 -> "22E6      %⋦实体R
}

\xeCJKDeclareSubCJKBlock{BoxDrawing}{
    "2500 -> "257F,
    "31C0 -> "31E3 % 笔画
}
\xeCJKDeclareSubCJKBlock{GeometricShapes}{"25A0 -> "25FF}
\xeCJKDeclareSubCJKBlock{Symbols}{%
    "2100 -> "214F,   % Letterlike Symbols
    "2600 -> "26FF,   % Miscellaneous Symbols
    "2980 -> "29FF    % Miscellaneous Mathematical Symbols-B
}

\setCJKmainfont[AutoFakeBold,
                               AutoFakeSlant,
                               BoldFont=Source~Han~Serif~CN~Bold,
                               ItalicFont=Source-Sa3mSerifCN-Regular,
                               GeneralPunctuation=BabelStone~Han,
                               Arrows=XITS,
                               MathematicalOperators=XITS,
                               SimLikeMathematicalOperators=Tutor~Pub~Custom,
                               BoxDrawing=BabelStone~Han,
                               GeometricShapes=XITS,
                               Symbols=Symbola]{Source~Han~Serif~CN}
\setmainfont[ItalicFont=TimesNewRomanPS-ItalicMT]{TeXGyreTermes-Regular}
\setCJKsansfont{NotoSansCJKsc-Regular}
\setCJKmonofont{STYuanti-SC-Regular}

% use the new font family as: \CJKfamily+{NotoLight}
\setCJKfamilyfont{NotoDemiLight}{NotoSansCJKsc-DemiLight}
\newCJKfontfamily[NotoSansCJKsc-Thin]\sfThin{NotoSansCJKsc-Thin}

\setCJKfamilyfont{songtiBlack}[BoldFont=STSongti-SC-Black,
                               AutoFakeBold=false]{STSongti-SC-Black}
\setCJKfamilyfont{songtiBold}[BoldFont=STSongti-SC-Bold,
                              AutoFakeBold=false]{STSongti-SC-Bold}

提示:

Font "Source Han Serif CN" does not contain(fontspec) requested Script "CJK".
Font "Times New Roman" does not contain requested(fontspec) Script "Math".
OpenType feature 'Style=MathScript' (ssty) not(fontspec) available for font 'Times New Roman' with script(fontspec) 'CustomDefault' and language 'Default'.
OpenType feature 'Style=MathScriptScript' (ssty) not(fontspec) available for font 'Times New Roman' with script(fontspec) 'CustomDefault' and language 'Default'.
Font "BabelStone Han" does not contain requested(fontspec) Script "CJK".
Font "XITS" does not contain requested Script "CJK".
Font "Tutor Pub Custom" does not contain requested(fontspec) Script "CJK".
Font "Symbola" does not contain requested Script(fontspec) "CJK".

请问是什么原因呢?

AlphaZTX commented 1 year ago

请修改你的提问直至你的提问变得规范。

尤其需要注意 Markdown 抄录代码的语法。

muzimuzhi commented 1 year ago
libinxu01 commented 1 year ago
  • 警告 Font "Symbola" does not contain requested Script(fontspec) "CJK". 可以不用管,见 消除经典不包含Script "CJK"警告 #593
  • 例子不完整,ArrowsMathematicalOperatorsSimLikeMathematicalOperators 等像是通过 \xeCJKDeclareSubCJKBlock 自行定义的 block
muzimuzhi commented 1 year ago
  • 感谢,我试试看,消除下warning

Warning 不必全部消除,忍一忍就好。

  • 是通过\xeCJKDeclareSubCJKBlock自定义的,已补充
\xeCJKDeclareSubCJKBlock{SimLikeMathematicalOperators}{
    "223D -> "223D,     %∽相似符号
    "224C -> "224C,     %≌全等符号
    "2263 -> "2263,     %≣化学三键
    "22E6 -> "22E6      %⋦实体R
}

不是非得写成 range (xxx -> xxx) 的形式,写成

\xeCJKDeclareSubCJKBlock{SimLikeMathematicalOperators}{"223D, "224C, "2263, "22E6}

就行。参见 \xeCJKDeclareSubCJKBlock 的文档,

其中⟨block range⟩ 是逗号列表, 可以是CJK 字符的Unicode 范围, 也可以是单个字符的Unicode

muzimuzhi commented 1 year ago

Duplicate of #593