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

Use xeCJK for fontenc as default with XeLaTex and Chinese docs #6239

Closed
zhsj opened this issue Mar 31, 2019 · 4 comments
Closed

Use xeCJK for fontenc as default with XeLaTex and Chinese docs #6239

zhsj opened this issue Mar 31, 2019 · 4 comments
Labels
builder:latex type:enhancement enhance or introduce a new feature
Milestone

Comments

@zhsj
Copy link
Contributor

zhsj commented Mar 31, 2019

When building Chinese translation of CPython docs. The only valid option I tried out is using xeCJK as the fontenc and using xelatex.

A simple project created by sphinx-quickstart, with some Chinese words(like 测试) in source/index.rst, will fail the make latexpdf command.

Howerver the following command works,

make latexpdf SPHINXOPTS='-D latex_engine=xelatex -D latex_elements.fontenc=\\usepackage{xeCJK} -D latex_elements.inputenc='

Although I still get warning like no Babel option known for language 'zh-cn', but the PDF looks good.

Could you set these as default for Chinese documents?

xeCJK will use Fandol font as default, both are Tex packages

https://ctan.org/pkg/xecjk
https://ctan.org/pkg/fandol

@zhsj zhsj added the type:enhancement enhance or introduce a new feature label Mar 31, 2019
@zhsj
Copy link
Contributor Author

zhsj commented Mar 31, 2019

Peviously the CPython docs are built with -D latex_engine=xelatex -D latex_elements.fontenc= -D latex_elements.inputenc=, the command will succeed, but the PDF doesn't contain any Chinese characters. I don't know much about latex, but I recall that I have used xeCJK before...

@tk0miya tk0miya added this to the 2.1.0 milestone Apr 4, 2019
@tk0miya
Copy link
Member

tk0miya commented May 25, 2019

Thank you for the pointer. Okay, let's follow the python-doc's setting.

refs: #1119

tk0miya added a commit to tk0miya/sphinx that referenced this issue May 25, 2019
@tk0miya
Copy link
Member

tk0miya commented May 25, 2019

Note: Sphinx expects the joint character of language is _ (underscore). So zh_CN is better for this case. But it does not resolve the warning.

tk0miya added a commit to tk0miya/sphinx that referenced this issue May 28, 2019
tk0miya added a commit that referenced this issue May 29, 2019
Close #6239: latex: Support to build Chinese documents
@tk0miya
Copy link
Member

tk0miya commented May 29, 2019

Fixed by #6398.
Thank you for reporting!

@tk0miya tk0miya closed this as completed May 29, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
builder:latex type:enhancement enhance or introduce a new feature
Projects
None yet
Development

No branches or pull requests

2 participants