\usepackage{amsthm}
\usepackage{thmtools,thm-restate}
\usepackage{subcaption}
\usepackage{subfiles}
\usepackage{mkolar_definitions}
\usepackage{nameref}
\usepackage{cleveref}
\usepackage{commath}
\usepackage{enumitem}
\usepackage{url}
\usepackage{booktabs}
\usepackage{amsfonts}
\usepackage{nicefrac}
\usepackage{microtype}
\usepackage{xcolor}
\usepackage{calc}
\usepackage{titletoc}
\usepackage{tcolorbox}

\usepackage{bibunits}
\defaultbibliography{ref}
\defaultbibliographystyle{abbrvnat}

\usepackage[vlined,ruled,linesnumbered,noend]{algorithm2e}
\usepackage{setspace}
\usepackage{mathtools}

% ------------------------------------------

\usepackage{apptools}
\AtAppendix{\counterwithin{theorem}{section}}
\AtAppendix{\counterwithin{remark}{section}}
\AtAppendix{\counterwithin{figure}{section}}
\AtAppendix{\counterwithin{definition}{section}}
\AtAppendix{\counterwithin{lemma}{section}}
\AtAppendix{\counterwithin{proposition}{section}}
\AtAppendix{\counterwithin{definition}{section}}
\AtAppendix{\counterwithin{corollary}{section}}
\AtAppendix{\counterwithin{example}{section}}
\AtAppendix{\counterwithin{claim}{section}}
\AtAppendix{\counterwithin{fact}{section}}

\usepackage{tikz}

\DeclareMathOperator{\rank}{rank}
\DeclareMathOperator{\linearspan}{span}
\DeclareMathOperator{\err}{err}
\DeclareMathOperator{\vectorize}{vec}
\DeclareMathOperator{\ols}{LS}

\newcommand*{\vertbar}{\rule[-1ex]{0.5pt}{2.5ex}}

\providecommand{\phantop}{{\vphantom{\top}}}
\providecommand{\Sym}{\ensuremath{\mathrm{Sym}}}
\providecommand{\Qpd}{\ensuremath{\mathcal{Q}_{\mathrm{p.d.}}}}
\providecommand{\bvert}{\ensuremath{\big|}}
\providecommand{\dmv}{\ensuremath{d_M \big|_V}}
\providecommand{\rhomv}{\ensuremath{\rho_M \big|_V}}
\providecommand{\Qhat}{\ensuremath{\widehat{Q}}}

\usepackage{xcolor}
\definecolor{color1}{HTML}{105e8a}
\definecolor{color2}{HTML}{e99926}
\definecolor{color3}{HTML}{b82a0c}
\definecolor{color4}{HTML}{3e8a10}
\definecolor{color5}{HTML}{80037e}
\definecolor{oceanboatblue}{rgb}{0.0, 0.47, 0.75}

\usepackage{mathrsfs}

\newcommand\mycommfont[1]{\textcolor{color1}{#1}}
\SetCommentSty{mycommfont}

\makeatletter
\DeclareFontFamily{OMX}{MnSymbolE}{}
\DeclareSymbolFont{MnLargeSymbols}{OMX}{MnSymbolE}{m}{n}
\SetSymbolFont{MnLargeSymbols}{bold}{OMX}{MnSymbolE}{b}{n}
\DeclareFontShape{OMX}{MnSymbolE}{m}{n}{
    <-6>  MnSymbolE5
   <6-7>  MnSymbolE6
   <7-8>  MnSymbolE7
   <8-9>  MnSymbolE8
   <9-10> MnSymbolE9
  <10-12> MnSymbolE10
  <12->   MnSymbolE12
}{}
\DeclareFontShape{OMX}{MnSymbolE}{b}{n}{
    <-6>  MnSymbolE-Bold5
   <6-7>  MnSymbolE-Bold6
   <7-8>  MnSymbolE-Bold7
   <8-9>  MnSymbolE-Bold8
   <9-10> MnSymbolE-Bold9
  <10-12> MnSymbolE-Bold10
  <12->   MnSymbolE-Bold12
}{}

\let\llangle\@undefined
\let\rrangle\@undefined
\DeclareMathDelimiter{\llangle}{\mathopen}%
                     {MnLargeSymbols}{'164}{MnLargeSymbols}{'164}
\DeclareMathDelimiter{\rrangle}{\mathclose}%
                     {MnLargeSymbols}{'171}{MnLargeSymbols}{'171}
\makeatother

\makeatletter
\renewenvironment{algomathdisplay}
{\[}
{\@endalgocfline\]}
\makeatother

\usepackage{float}

% -------------------------------------
\usepackage[titletoc]{appendix}
% \usepackage[font=small]{caption}

\hypersetup{
    hypertexnames=false,
    breaklinks=true,
    pdfborder={0 0 0},
    hidelinks,
    colorlinks,
    linkcolor=color1,
    citecolor=color1,
    urlcolor=color1
}