# Adding Cyrillic in LaTeX templates [closed]

I am trying to configure Cyrillic (namely, the Russian language) in my LaTeX template. I successfully downloaded the template like this: LaTeX book template dependent files

The only change that I made to the template was in the main.tex file, which I'm showing the snippet of code below:

%----------------------------------------------------------------------------------------
%   PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
%----------------------------------------------------------------------------------------

\documentclass[11pt,fleqn]{book} % Default font size and left-justified equations

\usepackage{fontspec} % loaded by polyglossia, but included here for transparency
\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage{russian}

%\newfontfamily\russianfont[Script=Cyrillic]{Linux Libertine}

\usepackage{xcolor} % Required for specifying colors by name
\definecolor{ocre}{RGB}{52,177,201} % Define the orange color used for highlighting throughout the book

% Font Settings
\usepackage{avant} % Use the Avantgarde font for headings
%\usepackage{times} % Use the Times font for headings
\usepackage{mathptmx} % Use the Adobe Times Roman as the default text font together with math symbols from the SymÂ­bol, Chancery and ComÂ­puter Modern fonts

\usepackage{microtype} % Slightly tweak font spacing for aesthetics
\usepackage[utf8]{inputenc} % Required for including letters with accents
\usepackage[T1]{fontenc} % Use 8-bit encoding that has 256 glyphs

% Bibliography
\usepackage[style=alphabetic,sorting=nyt,sortcites=true,autopunct=true,babel=hyphen,hyperref=true,abbreviate=false,backref=true,backend=biber]{biblatex}

\input{structure} % Insert the commands.tex file which contains the majority of the structure behind the template

\begin{document}

%----------------------------------------------------------------------------------------
%   TITLE PAGE
%----------------------------------------------------------------------------------------

\begingroup
\thispagestyle{empty}
\centering
\vspace*{5cm}
\par\normalfont\fontsize{35}{35}\sffamily\selectfont

\textbf{Привет}\\

{\LARGE Data Mining and Machine Learning in Astronomy}\par % Book title
\vspace*{1cm}
{\Huge Andrea Hidalgo}\par % Author name
\endgroup


As you can see, I've added one Russian word at the bottom of the file and attempted setting up Russian at the top of the file. I have tried these options so far: How to include russian in LaTeX (LEd)? and Cyrillic in (La)TeX. I have tried a few different options from these two existing questions.

I seem to be running into an issue with babel, something along these lines: babel with russian and english language. Specifically, the compiler doesn't like this specific line in my structure.tex file: \usepackage[english]{babel} % English language/hyphenation. I have tried specifying russian inside its scope, but that doesn't solve my issue.

Can anyone please help me configure Russian for my template? I don't understand why none of those options have worked for me (yet).

EDIT

Another MWE using suggestions provided from here: https://www.sharelatex.com/learn/Russian

%----------------------------------------------------------------------------------------
%   PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
%----------------------------------------------------------------------------------------

\documentclass[11pt,fleqn]{book} % Default font size and left-justified equations

\usepackage{xcolor} % Required for specifying colors by name
\definecolor{ocre}{RGB}{52,177,201} % Define the orange color used for highlighting throughout the book

% Font Settings
\usepackage{avant} % Use the Avantgarde font for headings
%\usepackage{times} % Use the Times font for headings
\usepackage{mathptmx} % Use the Adobe Times Roman as the default text font together with math symbols from the SymÂ­bol, Chancery and ComÂ­puter Modern fonts

\usepackage{microtype} % Slightly tweak font spacing for aesthetics
\usepackage[utf8]{inputenc} % Required for including letters with accents
\usepackage[T2A]{fontenc} % Use 8-bit encoding that has 256 glyphs

\usepackage[russian]{babel}

% Bibliography
\usepackage[style=alphabetic,sorting=nyt,sortcites=true,autopunct=true,babel=hyphen,hyperref=true,abbreviate=false,backref=true,backend=biber]{biblatex}

• You are extending a template meant for pdflatex with commands and packages meant for xelatex. This won't work. Instead of trying to adapt a large template you should better start with small examples and learn the differences between the engines. – Ulrike Fischer Aug 17 '15 at 8:21