sphinx-doc/sphinx

[RFC] LaTeX: for Russian and XeLaTeX/LuaLaTeX should polyglossia be replaced by babel?

Open

#5,254 创建于 2018年8月1日

在 GitHub 查看
 (4 评论) (0 反应) (0 负责人)Python (1,985 fork)batch import
builder:latexhelp wanted

仓库指标

Star
 (5,625 star)
PR 合并指标
 (平均合并 10天 11小时) (30 天内合并 11 个 PR)

描述

I have realized that polyglossia + russian creates very slow PDF builds. However I have not tested it on pure Russian project, hence I am asking for advice.

Here is my testing:

  • git clone https://github.com/sphinx-doc/sphinx.git
  • create a python virtualenv, activate it, mv to sphinx repertory and do pip install -e .
  • cd to sphinx/doc

Now we are going to build Sphinx's own English documentation in PDF pretending the document is in Russian and forcing usage of xelatex (this will use polyglossia):

time make clean latexpdf O="-D latex_engine=xelatex -D latex_elements.fontpkg=\\\\setmainfont{CMU\ Serif}\\\\setsansfont{CMU\ Sans\ Serif}\\\\setmonofont{CMU\ Typewriter\ Text} -D latex_elements.preamble= -D language=ru "

Then repeat but forcing usage of babel in place of polyglossia:

time make clean latexpdf O="-D latex_engine=xelatex -D latex_elements.fontpkg=\\\\setmainfont{CMU\ Serif}\\\\setsansfont{CMU\ Sans\ Serif}\\\\setmonofont{CMU\ Typewriter\ Text} -D latex_elements.preamble= -D language=ru -D latex_elements.babel=\\\\usepackage{babel}"

The former gives me a whopping

polyglossia

real	4m32.324s
user	3m47.644s
sys	0m49.290s

and the latter a more reasonable

babel

real	0m42.242s
user	0m43.583s
sys	0m1.525s

I have done the first try also with lualatex with same result. So something in polyglossia + russian slows down considerably PDF build. But this might be caused by the text being in English.

Any advice welcome: we can make (like for French, for other reasons) babel the default for Russian in replacement of polyglossia + russian.

  • Sphinx version: 1.8+
  • TeXLive 2018

贡献者指南