\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{import}
\usepackage{listings}
\usepackage{xcolor}
\usepackage{bookmark}
\usepackage{multicol,multirow,colortbl}
\usepackage{longtable}
\usepackage{setspace}
\usepackage{titlesec}
\usepackage{indentfirst}
\usepackage{amsmath,amsfonts,amssymb,amsthm,mathtools}
\usepackage{icomma}
\usepackage{layout}
\usepackage{lscape}
\usepackage{hyperref}
\usepackage{graphicx}
\usepackage{geometry}
\usepackage[russian]{babel}
\usepackage{wrapfig}
\usepackage{fancyhdr}
\usepackage{tabularx,adjustbox}
\usepackage{anyfontsize,tabto}
\usepackage{float,makecell}
\usepackage{nomencl}
\usepackage{makeidx}
\usepackage{tocloft}
\usepackage{scrextend}
\usepackage{enumitem}
\usepackage{caption,subcaption}
\usepackage{afterpage}

\newgeometry{ % отступы по ГОСТ Р 7.0.97-2016
  left=2cm,
  right=1cm,
  top=2cm,
  bottom=2cm
}

\makeindex
\makenomenclature
\babelfont{rm}{Times New Roman}
\babelfont{sf}{Liberation Serif}
\babelfont{tt}{Courier New}

\onehalfspacing

\pgfplotsset{compat=1.16}
\pgfplotsset{model/.style = {blue, samples = 100}}
\usetikzlibrary{calc,intersections,backgrounds}

\graphicspath{ {./pics/} }

\definecolor{codekeywords}{rgb}{0.1,0.4,0.4}
\definecolor{codecomments}{rgb}{0,0.6,0}
\definecolor{codenumbers}{rgb}{0.4,0.4,0.4}
\definecolor{codestring}{rgb}{0.85,0.2,0.1}
\definecolor{backcolour}{rgb}{0.95,0.95,0.92}
\definecolor{codefine}{rgb}{0.7,0.5,0.3}
\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{mauve}{rgb}{0.58,0,0.82}

\lstdefinestyle{JCodeStyle}{
  frame=single,
  language=Java,
  aboveskip=3mm,
  belowskip=3mm,
  showstringspaces=false,
  columns=flexible,
  basicstyle=\footnotesize\ttfamily,
  numbers=left,
  numberstyle=\tiny\color{gray},
  keywordstyle=\color{blue},
  commentstyle=\color{dkgreen},
  stringstyle=\color{mauve},
  breaklines=true,
  breakatwhitespace=true,
  tabsize=4,
  escapeinside={<@}{@>}
}

\lstdefinestyle{PyCodeStyle}{
    frame=single,
    commentstyle=\color{codecomments},
    numberstyle=\tiny\color{codenumbers},
    stringstyle=\color{codestring},
    basicstyle=\ttfamily\footnotesize,
    keywordstyle=\color{codekeywords},
    breakatwhitespace=false,
    breaklines=true,
    captionpos=b,
    keepspaces=true,
    numbers=left,
    numbersep=5pt,
    showspaces=false,
    showstringspaces=false,
    showtabs=false,
    tabsize=4,
    escapeinside={<@}{@>}
}

\lstdefinestyle{CCodeStyle}{
    frame=single,
    commentstyle=\color{codecomments},
    morecomment=[l][\color{codefine}]{\#},
    numberstyle=\tiny\color{codenumbers},
    stringstyle=\color{codestring},
    basicstyle=\ttfamily\footnotesize,
    keywordstyle=\color{codekeywords},
    emph={int,char,double,float,unsigned,void,bool},
    emphstyle={\color{blue}},
    breakatwhitespace=false,
    breaklines=true,
    captionpos=b,
    keepspaces=true,
    numbers=left,
    numbersep=5pt,
    showspaces=false,
    showstringspaces=false,
    showtabs=false,
    tabsize=4,
    escapeinside={<@}{@>}
}

\lstdefinestyle{ASMStyle}{
    frame=single,
    numberstyle=\tiny\color{codenumbers},
    commentstyle=\color{codecomments},
    keywordstyle=\color{codekeywords},
    morecomment=[l]{//}, % l is for line comment
    morecomment=[s]{/*}{*/}, % s is for start and end delimiter
    basicstyle={\ttfamily\footnotesize},
    morekeywords={
      add,addi,and,andi,
      bge,beq,bne,br,
      cmpeqi,cmpgei,cmplti,cmpnei,
      ldhu,ldw,ldwio,
      mov,movi,movhi,muli,
      nop,nor,
      ret,
      slli,srai,srli,stw,stwio},
    breakatwhitespace=false,
    breaklines=true,
    captionpos=b,
    keepspaces=true,
    numbers=left,
    numbersep=5pt,
    showspaces=false,
    showtabs=false,
    tabsize=4,
    escapeinside={<@}{@>}
}

\lstset{escapeinside={<@}{@>}}

\hypersetup{
  colorlinks=false,
  linktoc=all
}

\fancypagestyle{titlepage}{
   \fancyhf{}
   \cfoot{\small{\textbf{Москва, 2021 г.}}}
}

\fancyhf{}
\renewcommand{\headrulewidth}{0pt}

\newcommand{\numerationTop}{
\fancyhead[C]{\thepage}
}
\newcommand{\numerationBottom}{
\fancyfoot[C]{\thepage}
}
\newcommand{\code}[1]{\texttt{#1}}
% \newcommand{\sectionbreak}{\clearpage}

\renewcommand{\nomname}{ }
\newcommand*{\nom}[2]{#1\nomenclature{#1}{#2}}

\newcommand\blankpage{%
    \null
    \thispagestyle{empty}%
    \addtocounter{page}{-1}%
    \newpage
}
  
\newcommand{\makeBMSTUHeader}{
    \noindent\begin{minipage}{0.05\textwidth}
        \includegraphics[scale=0.2]{../logo_bmstu.png}
    \end{minipage}
    \hfill
    \begin{minipage}{0.85\textwidth}\raggedleft
        \begin{center}
            \fontsize{13pt}{0.3\baselineskip}\selectfont 
            \textbf{Министерство науки и высшего образования 
                Российской Федерации \\ 
                Федеральное государственное бюджетное образовательное \\
                учреждение высшего образования \\ 
                «Московский государственный технический университет \\ 
                имени Н. Э. Баумана \\ 
                (национальный исследовательский университет)» \\ 
                (МГТУ им. Н. Э. Баумана)
            }
        \end{center}
    \end{minipage}
    \begin{center}
        \fontsize{12pt}{0.1\baselineskip}\selectfont
        \noindent\makebox[\linewidth]{\rule{\textwidth}{2pt}} 
        \makebox[\linewidth]{\rule{\textwidth}{1pt}}
    \end{center}
    \begin{flushleft}
        \fontsize{12pt}{14pt}\selectfont
        \textbf{ФАКУЛЬТЕТ \tabto{3cm} «Информатика и системы управления» (ИУ)\\
                КАФЕДРА \tabto{3cm} «Информационные системы и телекоммуникации» (ИУ3)
        }
    \end{flushleft}
}

\newcommand{\makeReportTitle}[5]{
\vspace*{3em}
\thispagestyle{titlepage}
\begin{center}
\Large{\textbf{Отчет \\
    по лабораторной работе № #1\\
    «#2»\\
    по курсу\\
    «#3»
}}
\end{center}
\vspace*{4em}
\begin{flushright}
 Выполнил:\\
 Студент группы ИУ3-11М \\
 Овчинников И.И. \\
\vspace*{0.5em}
 Проверил#4:\\
 #5
\end{flushright}
}

\newcommand{\frm}[1]{\newline%
\newline%
\indent\fbox{%
    \parbox{0.9\textwidth}{%
        #1}%
}%
\newline%
\newline%
}%

\makeatletter
\newcommand{\setword}[2]{%
  \phantomsection
  #1\def\@currentlabel{\unexpanded{#1}}\label{#2}%
}
\makeatother

\newcommand{\approval}[2]{
  \begin{tabular}{c}
    УТВЕРЖДАЮ \\
    #1\\
    \underline{\hspace{2.7cm}}#2\\
    «\underline{\hspace{0.6cm}}»\underline{\hspace{2.1cm}}2021 г.
  \end{tabular}
}

\newcommand\lh[2]{\texttt{\textcolor{#1}{#2}}}
\newcommand\hrf[1]{\hyperref[#1]{\ref{#1}}}
\newcommand*\circled[1]{\tikz[baseline=(char.base)]{\node[shape=circle,draw,inner sep=2pt] (char) {#1};}}

\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}}
\renewcommand\labelitemi{\textemdash}
\renewcommand\thesubfigure{\asbuk{subfigure}}