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

Please provide the Traditional Chinese version of the CTEX 宏集手册 #668

Open
amalgame21 opened this issue Jul 24, 2023 · 4 comments
Open

Comments

@amalgame21
Copy link

I found the manual in ctex/ctex.dtx but I failed to build it myself.
I can only compile the first 27 pages and hit an error with xelatex ctex.dtx command.
Also, the formatting of the compiled pdf are way off.

Also, after I translated it with opencc, some of the character are missing because the predefined font does not support Traditional Chinese.

It would be great if the Traditional Chinese version of the manual is provided, or just translate it with opencc or other tools.

@SwitWu
Copy link

SwitWu commented Jul 24, 2023

To avoid the compiling error, change the 2727 line:

% \section{\LuaLaTeX{} 下的中文支持方式}

into

% \section{\protect\LuaLaTeX{} 下的中文支持方式}

muzimuzhi added a commit to muzimuzhi/ctex-kit that referenced this issue Jul 24, 2023
muzimuzhi added a commit to muzimuzhi/ctex-kit that referenced this issue Jul 24, 2023
@muzimuzhi
Copy link
Contributor

I found the manual in ctex/ctex.dtx but I failed to build it myself.
I can only compile the first 27 pages and hit an error with xelatex ctex.dtx command.

See PR #670.

@amalgame21
Copy link
Author

Thank you very much!
After manually modified in /usr/share/texmf-dist/tex/latex/ctex/ctxdoc.cls, it can now be complied successfully!

However some of the font cannot be displayed properly after converting to Traditional Chinese.
This is the output of page 2:
ctex cht

So many broken character displayed as an F within a box.
Do you know how to change to some Traditional Chinese compatible font, say, Noto Sans CJK TC?
I have looked into the source code, seems line 10579-11073 are font-related, but I cannot locate which line is the one to modify.

By the way, at least it is readable to me now, thank you very much for your help!

@muzimuzhi
Copy link
Contributor

muzimuzhi commented Jul 29, 2023

I have looked into the source code, seems line 10579-11073 are font-related, but I cannot locate which line is the one to modify.

First, different (default) font configs are chosen per OS

ctex-kit/ctex/ctex.dtx

Lines 10280 to 10294 in 3dbff76

% \begin{macro}[int]{\ctex_detect_platform:}
% 根据操作系统判断默认字体配置。
% \begin{macrocode}
\cs_new_protected:Npn \ctex_detect_platform:
{
\sys_if_platform_windows:TF
{ \tl_gset:Nn \g_@@_fontset_tl { windows } }
{
\ctex_if_platform_macos:TF
{ \tl_gset:Nn \g_@@_fontset_tl { mac } }
{ \tl_gset:Nn \g_@@_fontset_tl { fandol } }
}
}
% \end{macrocode}
% \end{macro}

In each ctex-fontset-<name>.def, the configs used under xelatex is the forth argument of \ctex_fontset_case:nnnn.

For example for recent macOS (no older than 10.11), the related configs in ctex-fontset-macold.def for xelatex is

ctex-kit/ctex/ctex.dtx

Lines 10901 to 10917 in 3dbff76

%<*macnew>
\setCJKmainfont { Songti~SC~Light }
[
BoldFont = Songti~SC~Bold,
ItalicFont = Kaiti~SC,
BoldItalicFont = Kaiti~SC~Bold
]
\setCJKsansfont { PingFang~SC }
\setCJKmonofont { STFangsong }
\setCJKfamilyfont { zhsong } { Songti~SC~Light } [ BoldFont = Songti~SC~Bold ]
\setCJKfamilyfont { zhhei } { Heiti~SC~Light } [ BoldFont = Heiti~SC~Medium ]
\setCJKfamilyfont { zhpf } { PingFang~SC }
\setCJKfamilyfont { zhfs } { STFangsong }
\setCJKfamilyfont { zhkai } { Kaiti~SC } [ BoldFont = Kaiti~SC~Bold ]
\setCJKfamilyfont { zhli } { Baoli~SC }
\setCJKfamilyfont { zhyou } { Yuanti~SC~Light } [ BoldFont = Yuanti~SC~Regular ]
%</macnew>

For a doc in traditional Chinese, you may also need to adapt ctex settings, such as

ctex-kit/ctex/ctex.dtx

Lines 9782 to 9799 in 3dbff76

\keys_set_known:nn { ctex }
{
contentsname = 目录 ,
listfigurename = 插图 ,
listtablename = 表格 ,
figurename = 图 ,
tablename = 表 ,
abstractname = 摘要 ,
indexname = 索引 ,
bibname = 参考文献 ,
appendixname = 附录 ,
proofname = 证明 ,
algorithmname = 算法 ,
refname = 参考文献 ,
continuation = (续) ,
part / name = { 第 , 部分 } ,
chapter / name = { 第 , 章 }
}

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

No branches or pull requests

3 participants