\documentclass[oneside,final,14pt]{extreport}
\usepackage[utf8]{inputenc}
\usepackage[T2A,T1]{fontenc}
\usepackage[russian]{babel}
\usepackage{threeparttable}
\usepackage[labelsep=endash,tableposition=top,labelfont=md,textfont=md]{caption}
\usepackage{indentfirst}
\usepackage{rotating}
\usepackage{setspace}
\usepackage{array}
\usepackage{graphicx}
\usepackage[compact]{titlesec}
\usepackage{titletoc}
\usepackage{xinttools}
\usepackage{ragged2e}
\usepackage{listingsutf8}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{color}
\usepackage{xstring}
\usepackage{tabularx}
\usepackage{enumitem}
\usepackage[abspath]{currfile}
\usepackage[hidelinks,linktoc=all]{hyperref}

% ОТЛАДОЧНЫЕ ФУНКЦИИ --------------------
% \usepackage{showframe}

% ПОЛЯ ----------------------------------
\usepackage{geometry}
\geometry{
   a4paper,
   % total={170mm,257mm},
   left=30mm,
   top=15mm,
   right=15mm,
   bottom=20mm
}

% ОФОРМЛЕНИЕ СОДЕРЖАНИЯ -----------------
\addto\captionsrussian{
   \renewcommand{\contentsname}%
   {\normalsize \MakeUppercase{Содержание}}%
}
\dottedcontents{chapter}[0cm]{}{1em}{2mm}
\titlecontents{chapter}
[0em]
{}
{\thecontentslabel. }
{}
{\titlerule*[2mm]{.}\contentspage}

\titlecontents{section}
[1.5em] % 1.5em (chapter) + 2.3em
{}
{\thecontentslabel. }
{\hspace*{-2.3em}}
{\titlerule*[2mm]{.}\contentspage}


% ОФОРМЛЕНИЕ ЗАГОЛОВКОВ -----------------
% В т.ч. и содержания
\titleformat{\paragraph}[runin]
{\normalfont\normalsize\bfseries}{\theparagraph}{1em}{}
\titlespacing*{\paragraph} {\parindent}{3.25ex plus 1ex minus .2ex}{1em}
\titleformat{\chapter}[display]{\normalfont\large\bfseries}{}{0cm}{\large\centering}
\titleformat{\section}
{\normalfont\large\bfseries}{\thesection}{5mm}{}
\makeatletter
% NormalTeXSyntaxON
\def\@makechapterhead#1{%
   \vspace*{0\p@}%
   {\parindent \z@ \raggedright \normalfont \setstretch{1.2}
      \interlinepenalty\@M
      \large \bfseries \space \thechapter. #1\par\nobreak
   }}
% NormalTeXSyntaxOFF
\titlespacing{\chapter}{0pt}{-5mm}{0cm}

% ОФОРМЛЕНИЕ СПИСКОВ --------------------
\setlist{noitemsep,align=left,left=\parindent,topsep=0pt}

% ОФОРМЛЕНИЕ ЛИСТИНГОВ КОДА -----------------
\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{mauve}{rgb}{0.58,0,0.82}
\lstset{
   frame=tb,
   language=C++,
   aboveskip=3mm,
   belowskip=3mm,
   showstringspaces=false,
   columns=flexible,
   basicstyle={\small\ttfamily},
   numbers=none,
   numberstyle=\tiny\color{gray},
   keywordstyle=\color{blue},
   commentstyle=\color{dkgreen},
   stringstyle=\color{mauve},
   breaklines=true,
   breakatwhitespace=true,
   tabsize=3,
   escapechar={|},
   emptylines=0,
}
\newcommand\inputcode[3][]{
   {\bfseries #1\filename{#2}}:
   \lstinputlisting[%
      #3,
   ]{#2}%
}

% ОФОРМЛЕНИЕ НУМЕРАЦИИ СПИСКОВ ----------------------------------
% Команды ниже переназначают алфавит используемый при нумерации с английского на русский 
\makeatletter
\renewcommand*{\@alph}[1]{%
   \ifcase#1\or а\or б\or в\or г\or
      д\or е\or ё\or ж\or з\or и\or й\or
      к\or л\or м\or н\or о\or п\or р\or с\or т\or
      у\or ф\or х\or ц\or ч\or
      ш\or щ\or ы\or э\or у \or я
   \else\@ctrerr\fi
}
\renewcommand*{\@Alph}[1]{%
   \ifcase#1\or А\or Б\or В\or Г\or
      Д\or Е\or Ё\or Ж\or З\or И\or Й\or
      К\or Л\or М\or Н\or О\or П\or Р\or С\or Т\or
      У\or Ф\or Х\or Ц\or Ч\or
      Ш\or Щ\or Ы\or Э\or У\or Я
   \else\@ctrerr\fi
}
\makeatother
\makeatletter
\renewcommand\@biblabel[1]{#1.}
\makeatother


% file path
\newcommand{\runtimeFsep}{/}
\newcommand{\updateRuntimeFsep}{\IfSubStr{\currfileabsdir}{/}{}{\renewcommand{\runtimeFsep}{\backslash}}}
\updateRuntimeFsep

\makeatletter
\DeclareRobustCommand{\filename}[2][]{%
   \begingroup
   % \lstname seems to change hyphens into \textendash
   \def\textendash{-}%
   \filename@parse{#2}%
   \IfSubStr{\filename@base}{\runtimeFsep}{\filename@parse{\filename@base}}{}%
   \edef\filename@base{\detokenize\expandafter{\filename@base}}%
   #1{\filename@base.\filename@ext}%
   \endgroup
}
\makeatother

% \section*{#1}%
% \addcontentsline{toc}{chapter}{#1}
\newcommand\tcchapter[1]{%
   \chapter{#1}%
}
\newcommand\tcsection[1]{%
   \section{#1}%
}
\onehalfspacing

% \contentsmargin{2.55em}

\addto\captionsrussian{\renewcommand{\figurename}{Рисунок }}

% URL ---------------
\urlstyle{same}

% ОФОРМЛЕНИЕ ТЕКСТА
\renewcommand{\baselinestretch}{1.5} 
