\documentclass[10pt,openany]{book}                                          %%
\usepackage{indentfirst}%%                                          %%
\usepackage{demopack}                                               %%
%\usepackage{a4wide} % analog of fullpage.sty                       %%
%\usepackage{a4}     % standard page margins                         %%
\usepackage{threeparttable}                                         %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{fancyheadings}                                          %%
%запоминает название главы:                                         %%
\renewcommand{\chaptermark}[1]{\markboth{\thechapter.\:#1}{}}       %%
%запоминает номер раздела и его название:                           %%
\renewcommand{\sectionmark}[1]{\markright{\thesection.\:#1}}        %%
\lhead[\fancyplain{}{\bfseries\leftmark}]%продолжение команды       %%
      {\fancyplain{}{}}                                             %%
\rhead[\fancyplain{}{}]%продолжение команды                         %%
      {\fancyplain{}{\bfseries\rightmark}}                          %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\lfoot[\fancyplain{}{\bfseries\thepage}]%продолжение команды        %%
%      {\fancyplain{}{}}                                             %%
%\rfoot[\fancyplain{}{}]%продолжение команды                         %%
%      {\fancyplain{}{\bfseries\thepage}}                            %%
%\cfoot{}                                                            %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{makeidx}     % allows index generation                  %%
\usepackage{graphicx}    % standard LaTeX graphics tool             %%
\usepackage{multicol}    % used for the two-column index            %%
\usepackage{epsfig}                                                 %%
\usepackage{amssymb}                                                %%
\usepackage{amsmath}                                                %%
\usepackage{mathrsfs}                                               %%
\usepackage{texdraw}                                                %%
\usepackage[figuresright]{rotating}   
\usepackage{xcolor}
%%
\usepackage{amsfonts}                                               %%
\usepackage{epstopdf}
\usepackage{moreverb}
\usepackage[T2A]{fontenc}                             %%
\usepackage[utf8x]{inputenc}                         %%
\usepackage[russian]{babel}                           %%
%для того чтобы можно было искать по тексту в pdf
\usepackage{cmap}
\usepackage[a4paper, total={210mm, 297mm}, hmargin=25mm, bmargin=60mm, tmargin=0mm, footskip=8mm, headheight=0mm]{geometry}
\topmargin=0mm
\headsep=0mm
\voffset=0mm

\makeindex             % used for the subject index
                       % please use the style svind.ist with
                       % your makeindex program

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%begin=added by semoushin                                          ДОБАВИЛ СЕМУШИН %
\newcommand{\indexentry}[2]{\item #1 #2}%для генерации предметного указателя книги  %
%переопределили команду, чтобы писалось не Литература, а Список литературы          %
%как хочет сделать автор (Семушин И.В.)                                             %
\renewcommand{\bibname}{Список литературы}                                          %
%                                                                                   %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%Ввели счетчик ЛИСТИНГОВ, чтобы ставился номер ЛИСТИНГА:         %%%%%
\newcounter{lis}[chapter]                                          %%%%%
\renewcommand{\thelis}{\thechapter.\arabic{lis}}                   %%%%%
\newcommand{\li}{\par\refstepcounter{lis}%                         %%%%%
{\vspace{0.3cm}\noindent\textbf{Листинг}\, %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{\bf\arabic{chapter}.\arabic{lis}.\quad}}}%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%	Добавил Филиппов А.А.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[bookmarks=true]{hyperref}
\usepackage{array}
\usepackage{caption}
\usepackage{titlesec}
\usepackage{enumitem}
\usepackage{textcase}
\usepackage{listings}
\usepackage{placeins} % \FloatBarrier
\usepackage{etoolbox}
\usepackage{longtable}
\usepackage{multirow}
\usepackage{tabu}
\usepackage{booktabs}
\usepackage{mathabx} % $\Rsh$ $\Lsh$ $\drsh$ $\dlsh$
\usepackage{setspace}
\usepackage{DejaVuSerifCondensed}
\usepackage{DejaVuSansMono}

% каталог с изображениями
\graphicspath{{images/}}

% коэффициент масштабирования рисунков для всего документа
\usepackage{xfp}
\newcommand{\scalefactor}{0.45}
\newcommand{\scalefactorx}[1]{\fpeval{\scalefactor+#1}}

% уменьшение отступов перед и после table
\BeforeBeginEnvironment{table}{\vskip-0.3ex}
\AfterEndEnvironment{table}{\vskip-0.3ex}

% кастомизация размера шрифта для longtabu
\let\oldlongtabu\longtabu
\renewcommand{\longtabu}{\normalsize\oldlongtabu}

% настройка listing
\lstset{
	literate=
		{а}{{\selectfont\char224}}1
		{б}{{\selectfont\char225}}1
		{в}{{\selectfont\char226}}1
		{г}{{\selectfont\char227}}1
		{д}{{\selectfont\char228}}1
		{е}{{\selectfont\char229}}1
		{ё}{{\"e}}1
		{ж}{{\selectfont\char230}}1
		{з}{{\selectfont\char231}}1
		{и}{{\selectfont\char232}}1
		{й}{{\selectfont\char233}}1
		{к}{{\selectfont\char234}}1
		{л}{{\selectfont\char235}}1
		{м}{{\selectfont\char236}}1
		{н}{{\selectfont\char237}}1
		{о}{{\selectfont\char238}}1
		{п}{{\selectfont\char239}}1
		{р}{{\selectfont\char240}}1
		{с}{{\selectfont\char241}}1
		{т}{{\selectfont\char242}}1
		{у}{{\selectfont\char243}}1
		{ф}{{\selectfont\char244}}1
		{х}{{\selectfont\char245}}1
		{ц}{{\selectfont\char246}}1
		{ч}{{\selectfont\char247}}1
		{ш}{{\selectfont\char248}}1
		{щ}{{\selectfont\char249}}1
		{ъ}{{\selectfont\char250}}1
		{ы}{{\selectfont\char251}}1
		{ь}{{\selectfont\char252}}1
		{э}{{\selectfont\char253}}1
		{ю}{{\selectfont\char254}}1
		{я}{{\selectfont\char255}}1
		{А}{{\selectfont\char192}}1
		{Б}{{\selectfont\char193}}1
		{В}{{\selectfont\char194}}1
		{Г}{{\selectfont\char195}}1
		{Д}{{\selectfont\char196}}1
		{Е}{{\selectfont\char197}}1
		{Ё}{{\"E}}1
		{Ж}{{\selectfont\char198}}1
		{З}{{\selectfont\char199}}1
		{И}{{\selectfont\char200}}1
		{Й}{{\selectfont\char201}}1
		{К}{{\selectfont\char202}}1
		{Л}{{\selectfont\char203}}1
		{М}{{\selectfont\char204}}1
		{Н}{{\selectfont\char205}}1
		{О}{{\selectfont\char206}}1
		{П}{{\selectfont\char207}}1
		{Р}{{\selectfont\char208}}1
		{С}{{\selectfont\char209}}1
		{Т}{{\selectfont\char210}}1
		{У}{{\selectfont\char211}}1
		{Ф}{{\selectfont\char212}}1
		{Х}{{\selectfont\char213}}1
		{Ц}{{\selectfont\char214}}1
		{Ч}{{\selectfont\char215}}1
		{Ш}{{\selectfont\char216}}1
		{Щ}{{\selectfont\char217}}1
		{Ъ}{{\selectfont\char218}}1
		{Ы}{{\selectfont\char219}}1
		{Ь}{{\selectfont\char220}}1
		{Э}{{\selectfont\char221}}1
		{Ю}{{\selectfont\char222}}1
		{Я}{{\selectfont\char223}}1,
	extendedchars=\true,
	tabsize=4,
	gobble=4,
	keepspaces=true,
	basicstyle=\normalsize\ttfamily,
	breaklines=true,
	columns=fullflexible,
}
\lstdefinestyle{Inline} % \- символ переноса в lstlinline
{
	literate={\\-}{}{0\discretionary{-}{}{}} % discretionary{-}{}{} для печати дефиса
}
\newcommand{\code}{\lstinline[style=Inline, breakatwhitespace=true]}

% отключение интервала между элементами списков
\setlist{noitemsep, topsep=0pt, leftmargin=\parindent}
% отключение интервала между элементами списков \itemize
%\setlist[itemize]{noitemsep, topsep=0pt}
% отключение интервала между элементами списков \enumerate
%\setlist[enumerate]{noitemsep, topsep=0pt}

% отключение интервала между элементами списка библиографии
\let\oldthebibliography\thebibliography 
\renewcommand\thebibliography[1]{
	\oldthebibliography{#1}
	\setlength{\parskip}{0pt}
	\setlength{\itemsep}{0pt}
}

% подписи к рисункам и таблицам в русской типографской традиции
\DeclareCaptionFormat{GOSTtable}{#2#1\\#3}
\DeclareCaptionLabelSeparator{fill}{\hfill}
\DeclareCaptionLabelFormat{fullparents}{\bothIfFirst{#1}{~}#2}
\captionsetup[table]{
	format=GOSTtable,
	labelformat=fullparents,
	labelsep=fill,
	textfont=bf,
	justification=centering,
	singlelinecheck=false
}
\captionsetup[figure]{
	labelsep=period,
	justification=centering,
	singlelinecheck=false
}

% кастомизация заголовков
\titleformat{\chapter}
	{\filcenter\bfseries\MakeTextUppercase}
	{\thechapter}
	{8pt}
	{}
\titleformat{\section}
	{\bfseries}
	{\thesection}
	{1em}{}
\titleformat{\subsection}
	{\bfseries\itshape}
	{\thesubsection}
	{1em}{} 
\titleformat{\subsubsection}
	{\itshape}
	{\thesubsubsection}
	{1em}{} 	

% настройка вертикальных и горизонтальных отступов заголовков
\titlespacing*{\chapter}{0pt}{-30pt}{8pt}
\titlespacing*{\section}{\parindent}{24pt}{*1}
\titlespacing*{\subsection}{\parindent}{12pt}{*1}
\titlespacing*{\subsubsection}{\parindent}{12pt}{*1}

% запрет висячих строк
\clubpenalty=10000
\widowpenalty=10000
\hyphenpenalty=500
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}
\large
\renewcommand{\bibname}{Библиографический список}                   %%

\frontmatter%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%если вставите сюда \include{titlepage} и др., то здесь будет идти
%отдельная нумерация страниц римскими цифрами

\mainmatter%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pagestyle{plain}
%\pagestyle{empty}
\include{titlepage}%это команда вставить титульный лист (имя его файла titlepage.tex)
\include{secondpage}%это команда вставить лист выходных сведений (имя его файла secondpage.tex)
\tableofcontents%это команда вставить листы оглавления (его файл вам создавать не нужно)
\include{introduction}%это команда вставить листы введения (имя его файла introduction.tex)
%\pagestyle{fancyplain}
\include{chapter1}
\include{chapter2}
\include{chapter3}
\include{chapter4}
%\pagestyle{empty}
%\appendix%это команда о том, что дальше пойдет приложение к книге
%\include{appendix}%это команда вставить приложение к книге (имя его файла appendix.tex)
\include{conclusion}%это команда вставить листы заключения (имя его файла conclusion.tex)
\backmatter%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\include{references}%это команда вставить список литературы к книге (имя его файла references.tex)
%\printindex%это команда вставить предметный указатель к книге
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\begin{theindex} %% Эти три команды добавил Семушин, чтобы печатался предметный указатель
%\input{book-index.tex} %% Эти три команды сейчас (временно) закрыты для исполнения
%\end{theindex}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\include{lastpage}%это команда вставить выходные данные книги (имя его файла lastpage.tex)
\end{document} 
