1

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[top=3cm,bottom=3cm,left=3.2cm,right=3.2cm,headsep=10pt,letterpaper]{geometry} % Page margins

    \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}
    \addbibresource{bibliography.bib} % BibTeX bibliography file
    \defbibheading{bibempty}{}

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

    \begin{document}

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

    \begingroup
    \thispagestyle{empty}
    \AddToShipoutPicture*{\put(0,0){\includegraphics[scale=1.25]{esahubble}}} % Image background
    \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[top=3cm,bottom=3cm,left=3.2cm,right=3.2cm,headsep=10pt,letterpaper]{geometry} % Page margins

\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}
\addbibresource{bibliography.bib} % BibTeX bibliography file
\defbibheading{bibempty}{}

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

closed as unclear what you're asking by Johannes_B, gernot, Stefan Pinnow, TeXnician, CarLaTeX Apr 2 '17 at 13:16

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • You say you use LaTeX, but since you load the fontspec package I assume you are using XeLaTeX. Correct? – ph0t0nix Aug 17 '15 at 8:03
  • 2
    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
  • @ph0t0nix Yes, in the MWE I'm showing above, I'm using XeLaTeX. However, I also tried some other approaches, as outlined in tex.stackexchange.com/questions/816/cyrillic-in-latex. But, so far, none of these approaches worked for me, which makes me wonder what is fundamentally different between my problem and the others. – warship Aug 17 '15 at 14:04
  • @UlrikeFischer Correct, I am using XeLaTeX for the template above. See my other comment to ph0t0nix. Following your advice, I've tried each small example as per each different approach presented in tex.stackexchange.com/questions/816/cyrillic-in-latex, but nothing worked for me. It seems that I am dealing with a scenario fundamentally different than the ones already asked about on tex.stackexchange. – warship Aug 17 '15 at 14:08
  • @warship: And as I said: It won't work. The template is not for xelatex. You will have to remove inputenc, avant, mathptmx, fontenc and perhaps some more lines and packages in the structure.tex to adapt it to xelatex. Don't use large templates that you don't understand. If you have a problem with a small example then show this example and the error messages you get. – Ulrike Fischer Aug 17 '15 at 14:15

Browse other questions tagged or ask your own question.