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

中文斜体失效 #45

Open
xuantengh opened this issue Mar 26, 2022 · 6 comments
Open

中文斜体失效 #45

xuantengh opened this issue Mar 26, 2022 · 6 comments

Comments

@xuantengh
Copy link
Member

xuantengh commented Mar 26, 2022

中文斜体 \textit{斜体} 输出仍为宋体,应为楷体。

一种 quick fix 是使用 \kaishu{斜体} 进行斜体的输出。

@Lovely-XPP
Copy link
Contributor

要不用个\renewcommand进行替换

\renewcommand{\textit}[1]{\kaishu{#1}}

@xuantengh
Copy link
Member Author

要不用个\renewcommand进行替换

是否会对英文斜体输出造成影响?

@Lovely-XPP
Copy link
Contributor

会的,我看看有没有其他解决办法

@Lovely-XPP
Copy link
Contributor

Lovely-XPP commented Jan 18, 2023

有一个解决办法,但是不知道为啥会出现超内存的情况:

\renewcommand*{\textit}[1]{{\kaishu \textit{#1}}}

报错

TeX capacity exceeded, sorry [save size=80000].

如果要统一中英文的斜体的话,只能暂时新建一个命令

\newcommand*{\textitt}[1]{{\kaishu \textit{#1}}}

@Lovely-XPP
Copy link
Contributor

Lovely-XPP commented Jan 18, 2023

另外,从底层来看,我发现xelatex并没有正确调用斜体对应的字体,这是fandol字体集的设定:

\setCJKmainfont { FandolSong-Regular.otf }
          [
            cmap       = UniGB-UTF16-H,
            BoldFont   = FandolSong-Bold.otf,
            ItalicFont = FandolKai-Regular.otf
          ]

而我们调用\textit{xxx}的警告却是

Font shape `TU/FandolSong-Regular(1)/m/it' undefined
(Font)	using `TU/FandolSong-Regular(1)/m/n' instead.

说明没有正确调用ItalicFont = FandolKai-Regular.otf

除此之外,我阅读ctex和xeCJK的宏包说明,发现没有办法直接更改斜体字体,最主要的难点在于不能获取当前CJK字体族对应的字体名称,所以从底层更改字体来解决问题比较困难。

@ddddavid-he
Copy link
Contributor

#61 后的更新中用自定义字体文件可以解决这个问题

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

No branches or pull requests

4 participants