"TeX capacity exceeded" error when converting markdown to PDF using XeLaTeX with russian language
The problem seems to reduce to this minimal example:
\documentclass{book}
\usepackage{fontspec}
\usepackage{polyglossia}
\defaultfontfeatures{Scale=MatchLowercase}
\setmainfont{Linux Libertine O}
\setmainlanguage{russian}
\begin{document}
x
\end{document}
which aborts with
! TeX capacity exceeded, sorry [input stack size=5000].
<to be read again>
{
If the Scale=MatchLowercase
option is removed, the document compiles. If I save the LaTeX file from your test with
pandoc --latex-engine=xelatex --toc --chapters -V mainfont="Linux Libertine O" -V lang="russian" -f markdown -w latex -s test.md > test.tex
and then remove the option, running XeLaTeX on test.tex
is successful.
This is quite probably a bug in the Russian module for Polyglossia.