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

貢獻者指南