sphinx-doc/sphinx

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

Open

#5,254 opened on Aug 1, 2018

View on GitHub
 (4 comments) (0 reactions) (0 assignees)Python (5,625 stars) (1,985 forks)batch import
builder:latexhelp wanted

Description

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

Contributor guide