I've installed pandoc
and texlive-full
packages on recent Ubuntu 14.04 LTS 64bit to convert markdown files with russian language to PDF.
Everything works fine when I run the following command:
pandoc --latex-engine=xelatex --toc --chapters -V mainfont="Ubuntu" -f markdown -o test.pdf test.md
But in order to have russian language also in table of contents, in pictures' descriptions and etc I specify lang
variable like this:
pandoc --latex-engine=xelatex --toc --chapters -V mainfont="Ubuntu" -V lang="russian" -f markdown -o test.pdf test.md
and execution ends with the following message:
pandoc: Error producing PDF from TeX source.
! TeX capacity exceeded, sorry [input stack size=5000].
<inserted text>
-1
l.61 \tableofcontents
Everything works again if I specify another language, e.g. french
or dutch
:
pandoc --latex-engine=xelatex --toc --chapters -V mainfont="Ubuntu" -V lang="french" -f markdown -o test.pdf test.md
It doesn't matter what contents of test.md
are. They could be a simple text file:
# Первая глава
Текст первой главы.
# Вторая глава
Текст второй главы.
# Третья глава
Текст третьей главы.
I use default latex template:
pandoc -D latex > mytemplate.tex
and guess that something goes wrong when main language is set:
\ifxetex
\usepackage{polyglossia}
\setmainlanguage{$mainlang$}
\else
\usepackage[$lang$]{babel}
\fi
Am I doing something wrong or is it a bug? Unfortunately, I was unable to find workaround to fix the problem. As I can see there is a lot of issues that may cause this error. I'm absolute beginner in pandoc, TeX and all related things so any help will be appreciated!
UPDATE
Tried on Windows 7 Professional 32bit using MiKTeX as recommended by pandoc documentation specifying -V mainfont="Times New Roman"
for font and got exactly the same error...
Scale=MatchLowercase
in the template.