\documentclass[a4paper,oneside]{book}
%\documentclass{book}

%\usepackage{fontspec}
%\setmainfont{DejaVu Sans}
%\setmonofont{DejaVu Sans Mono}

\usepackage{polyglossia}

\ifdefined\ENGLISH
\setmainfont[Ligatures=TeX]{CMU Serif}
%\setmainfont[Ligatures=TeX]{DejaVu Serif}

\newcommand{\MonoFontMain}{CMU Typewriter Text}
\newcommand{\MonoFontForBoxChars}{DejaVu Sans Mono}
\setmonofont{\MonoFontMain}

\setmainlanguage{english}
%\setotherlanguage{russian}
\fi

\ifdefined\RUSSIAN
\setmainfont[Ligatures=TeX]{CMU Serif}
\newfontfamily{\cyrillicfonttt}{CMU Typewriter Text}

\setmainlanguage{russian}
\setotherlanguage{english}
%\newfontfamily{\cyrillicfonttt}{DejaVu Sans Mono}
\fi

\usepackage{cmap}
%\usepackage[russian,english]{babel}
%\usepackage[T2A]{fontenc}
%\usepackage[default]{sourcesanspro}

\usepackage{amsmath, amssymb, graphics, setspace}
\usepackage[table]{xcolor}% http://ctan.org/pkg/xcolor

\usepackage{listings}
\usepackage{longtable}
\usepackage{pmboxdraw}
\usepackage{url}
\usepackage[cm]{fullpage}
\usepackage{graphicx}
\usepackage{framed}
\usepackage{color}
\usepackage{float}
\usepackage{tikz}
\usepackage{shorttoc}
\usepackage[footnote,printonlyused,withpage]{acronym}
\usetikzlibrary{arrows,shapes,positioning}
\usepackage[nottoc]{tocbibind}
%\usepackage{esint}
%\usepackage{charter}
%\usepackage[charter]{mathdesign}
\usepackage[]{hyperref} % should be last
\usepackage{epigraph}
\usepackage{subcaption}
\usepackage{fancyhdr}
\usepackage{pdfpages}
\usepackage{svg}

% fancyhdr =============================================================================================================================
\pagestyle{fancy}
\setlength{\headheight}{13pt}
% https://tex.stackexchange.com/questions/10043/page-number-position
\fancyhf{}
\fancyhead[R]{\thepage} % suppress chapter name, add page number (upper right corner)

%\ifdefined\ENGLISH
%\cfoot{\small Please take a short survey: \url{https://smt.st/survey.html}. This will help me! TIA! \normalsize}
%\cfoot{\small BTW, I'm teaching: \url{https://yurichev.com/news/20210109_teaching/}. \normalsize}
%\cfoot{\small Please become my patron, so I can spend more time writing this: \href{http://link.yurichev.com/17401?\today p.\thepage}{patreon.com}. Thanks!\normalsize}
%\cfoot{\small Please become my patron, so I can spend more time writing this: \href{http://link.yurichev.com/17401}{patreon.com}. Thanks!\normalsize}
%\cfoot{\small If you noticed a typo, error or have any suggestions, do not hesitate to drop me a note: dennis(a)yurichev.com.
%Thanks!\normalsize}
%\cfoot{\small If you noticed a typo, error or have any suggestions, do not hesitate to drop me a note: \href{https://yurichev.com/contact.html}{my emails}. Thanks!\normalsize}
% https://tex.stackexchange.com/questions/13406/how-to-add-a-horizontal-line-above-the-footer-with-fancyhdr
\renewcommand{\footrulewidth}{0.4pt}
%\fi

% ======================================================================================================================================

\definecolor{lstbgcolor}{rgb}{0.94,0.94,0.94}
\definecolor{light-gray}{gray}{0.87}

\newcommand{\TT}[1]{\texttt{#1}}
%\newcommand*{\TT}[1]{\colorbox{light-gray}{\texttt{#1}}}

\EN{\newcommand{\TITLE}{SAT/SMT by Example}}
\RU{\newcommand{\TITLE}{SAT/SMT в примерах}}
\EN{\newcommand{\AUTHOR}{Dennis Yurichev}}
\RU{\newcommand{\AUTHOR}{Денис Юричев}}

\definecolor{linkcolor}{RGB}{10,0,190}

\hypersetup{
    pdftex,
    colorlinks=true,
    allcolors=linkcolor,
    %allcolors=darkblue,
    pdfauthor={\AUTHOR},
    pdftitle={\TITLE},
    pdfpagemode=None
}

\lstset{
    %backgroundcolor=\color{lstbgcolor},
    %backgroundcolor=\color{light-gray},
    %basicstyle=\ttfamily\small, 
    basicstyle=\ttfamily\normalsize, % and this is OK, don't change. see PDF in 100% in Okular
    %basicstyle=\ttfamily\large,
    %basicstyle=\ttfamily\footnotesize, 
    literate={~} {$\sim$}{1},
    breaklines=true,
    frame=single,
    %columns=fullflexible,keepspaces,
    columns=keepspaces,
    escapeinside=§§,
    inputencoding=utf8
}

\definecolor{digits}{RGB}{0,0,0}
\definecolor{colkw}{RGB}{0,0,0}

%\definecolor{colstr}{RGB}{80,80,80}
%\definecolor{colid}{RGB}{80,80,80}

\definecolor{colstr}{RGB}{0,0,0}
\definecolor{colid}{RGB}{0,0,0}

\definecolor{colcomment}{RGB}{130,130,130}
%\definecolor{colcomment}{RGB}{170,170,170}

\definecolor{colbg}{RGB}{255,255,255}

\lstdefinestyle{custompy}{
  language=Python,
  showstringspaces=false,
  backgroundcolor=\color{colbg},
  keywordstyle=\color{colkw},
  commentstyle=\color{colcomment},
  identifierstyle=\color{colid},
  stringstyle=\color{colstr}
}

\lstdefinestyle{customc}{
  language=C,
  showstringspaces=false,
  backgroundcolor=\color{colbg},
  keywordstyle=\color{colkw},
  commentstyle=\color{colcomment},
  identifierstyle=\color{colid},
  stringstyle=\color{colstr}
}

\lstdefinestyle{customsmt}{
  morecomment=[l]{;},
  showstringspaces=false,
  backgroundcolor=\color{colbg},
  keywordstyle=\color{colkw},
  commentstyle=\color{colcomment},
  identifierstyle=\color{colid},
  stringstyle=\color{colstr}
}

\lstdefinestyle{customsat}{
  morecomment=[l]{c\ },
  showstringspaces=false,
  backgroundcolor=\color{colbg},
  keywordstyle=\color{colkw},
  commentstyle=\color{colcomment},
  identifierstyle=\color{colid},
  stringstyle=\color{colstr}
}

% с fullflexible в русской версии "+-----+" выглядит длиннее! ХЗ, почему

\newcommand{\myhrule}{\begin{center}\rule{0.5\textwidth}{.4pt}\end{center}}

% http://tex.stackexchange.com/questions/32160/new-line-after-paragraph
\newcommand{\myparagraph}[1]{\paragraph{#1}\mbox{}\\}
\newcommand{\mysubparagraph}[1]{\subparagraph{#1}\mbox{}\\}

\input{myheadings}

\author{\AUTHOR}
\title{\TITLE}

\newcommand{\RepoURL}{https://smt.st/current_tree}
\newcommand{\MKURL}{https://smt.st/MK85}

\newcommand{\KRBook}{Brian W. Kernighan, Dennis M. Ritchie, \emph{The C Programming Language}, 2ed, (1988)}

\begin{document}

%\input{1st_page}

\begin{titlepage}
\input{cover}
\end{titlepage}

\maketitle

\shorttoc{Abridged contents}{0}

\tableofcontents

\newcommand{\MathForProg}{Untitled collection of math notes\footnote{\url{https://xn--mxacd.xn--qxam/math-notes.pdf}}}

\newcommand{\CURPATH}{NOTHING}

% chapters:
\input{parts}
\input{acronyms}

\end{document}

