%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                                                    |  \               %
%   ______  __     __  ______  _______      _______ _| ▓▓_   __    __   %
%  /      \|  \   /  \|      \|       \    /       \   ▓▓ \ |  \  |  \  %
% |  ▓▓▓▓▓▓\\▓▓\ /  ▓▓ \▓▓▓▓▓▓\ ▓▓▓▓▓▓▓\  |  ▓▓▓▓▓▓▓\▓▓▓▓▓▓ | ▓▓  | ▓▓  %
% | ▓▓    ▓▓ \▓▓\  ▓▓ /      ▓▓ ▓▓  | ▓▓   \▓▓    \  | ▓▓ __| ▓▓  | ▓▓  %
% | ▓▓▓▓▓▓▓▓  \▓▓ ▓▓ |  ▓▓▓▓▓▓▓ ▓▓  | ▓▓__ _\▓▓▓▓▓▓\ | ▓▓|  \ ▓▓__/ ▓▓  %
%  \▓▓     \   \▓▓▓   \▓▓    ▓▓ ▓▓  | ▓▓  \       ▓▓  \▓▓  ▓▓\▓▓    ▓▓  %
%   \▓▓▓▓▓▓▓    \▓     \▓▓▓▓▓▓▓\▓▓   \▓▓\▓▓\▓▓▓▓▓▓▓    \▓▓▓▓ _\▓▓▓▓▓▓▓  %
%                                                           |  \__| ▓▓  %
%                                                            \▓▓    ▓▓  %
%                                                             \▓▓▓▓▓▓   %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Original file:
% https://github.com/vEnhance/dotfiles/blob/main/texmf/tex/latex/evan/evan.sty

% TL;DR of the Boost license conditions are as follows:
%
% 1. Any SOURCE VERSIONS must cite evan.sty and the Boost license below.
% 2. For COMPILED PDF OUTPUT, attribution of evan.sty is OPTIONAL (but nice).
% 3. NO OTHER REQUIREMENTS; you may modify, redistribute, sell freely.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% BOOST SOFTWARE LICENSE - VERSION 1.0 - 17 AUGUST 2003
%
% Copyright (c) 2022 Evan Chen [evan at evanchen.cc]
% https://web.evanchen.cc/ || github.com/vEnhance
%
% Available for download at:
% https://github.com/vEnhance/dotfiles/blob/main/texmf/tex/latex/evan/evan.sty
%
% Permission is hereby granted, free of charge, to any person or organization
% obtaining a copy of the software and accompanying documentation covered by
% this license (the "Software") to use, reproduce, display, distribute,
% execute, and transmit the Software, and to prepare derivative works of the
% Software, and to permit third-parties to whom the Software is furnished to
% do so, all subject to the following:
%
% The copyright notices in the Software and this entire statement, including
% the above license grant, this restriction and the following disclaimer,
% must be included in all copies of the Software, in whole or in part, and
% all derivative works of the Software, unless such copies or derivative
% works are solely in the form of machine-executable object code generated by
% a source language processor.
%
% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
% FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
% SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
% FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
% ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
% DEALINGS IN THE SOFTWARE.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\ProvidesPackage{evan}

\ProcessOptions\relax

\usepackage{amsmath,amssymb}
\usepackage{iftex}
\usepackage[minimal]{yhmath}

\setlength\parindent{0pt}

% Personal commands
\newcommand{\card}[1]{\left|#1\right|}
\newcommand{\nsqrt}[2]{\!\sqrt[#1]{#2}\,}
\newcommand{\zeroset}{\{0\}}
\newcommand{\setminuszero}{\setminus \{0\}}

\newcommand{\corref}[1]{\textit{Corollario \ref{#1}}}
\newcommand{\exref}[1]{\textit{Esercizio \ref{#1}}}
\newcommand{\exmplref}[1]{\textit{Esempio \ref{#1}}}
\newcommand{\propref}[1]{\textit{Proposizione \ref{#1}}}
\newcommand{\lemref}[1]{\textit{Lemma \ref{#1}}}
\newcommand{\thref}[1]{\textit{Teorema \ref{#1}}}

\newcommand{\BB}{\mathcal{B}}
\newcommand{\HH}{\mathbb{H}}
\newcommand{\KK}{\mathbb{K}}
\newcommand{\ZZp}{\mathbb{Z}_p}

\newcommand{\CCx}{\mathbb{C}[x]}
\newcommand{\FFpp}{\mathbb{F}_p}
\newcommand{\FFpd}{\mathbb{F}_{p^d}}
\newcommand{\FFpm}{\mathbb{F}_{p^m}}
\newcommand{\FFpn}{\mathbb{F}_{p^n}}
\newcommand{\FFp}[1]{\mathbb{F}_{p^{#1}}}
\newcommand{\KKx}{\mathbb{K}[x]}
\newcommand{\QQx}{\mathbb{Q}[x]}
\newcommand{\RRx}{\mathbb{R}[x]}
\newcommand{\ZZi}{\mathbb{Z}[i]}
\newcommand{\ZZom}{\mathbb{Z}[\omega]}
\newcommand{\ZZpx}{\mathbb{Z}_p[x]}
\newcommand{\ZZsqrt}[1]{\mathbb{Z}[\sqrt{#1}]}
\newcommand{\ZZx}{\mathbb{Z}[x]}

\newcommand{\ii}{\mathbf{i}}
\newcommand{\jj}{\mathbf{j}}
\newcommand{\kk}{\mathbf{k}}

\newcommand{\valalpha}{\varphi_\alpha}
\newcommand{\Frob}{\mathcal{F}}
\newcommand{\Frobexp}{\mathcal{F}{\mkern 1.5mu}}

\newcommand{\dual}[1]{#1^{*}}
\newcommand{\LL}[2]{\mathcal{L} \left(#1, \, #2\right)}
\newcommand{\M}[1]{\mathcal{M}_{#1}\left(\KK\right)}
\newcommand{\nsg}{\mathrel{\unlhd}}
\renewcommand{\vec}[1]{\underline{#1}}

\newcommand{\hatpi}{\hat{\pi}}
\newcommand{\hatpip}{\hat{\pi}_p}

% evan.sty original commands
\newcommand{\cbrt}[1]{\sqrt[3]{#1}}
\newcommand{\floor}[1]{\left\lfloor #1 \right\rfloor}
\newcommand{\ceiling}[1]{\left\lceil #1 \right\rceil}
\newcommand{\mailto}[1]{\href{mailto:#1}{\texttt{#1}}}
\newcommand{\eps}{\varepsilon}
\newcommand{\vocab}[1]{\textbf{\color{blue}\sffamily #1}}
\providecommand{\alert}{\vocab}
\newcommand{\catname}{\mathsf}
\providecommand{\arc}[1]{\wideparen{#1}}

% From H113 "Introduction to Abstract Algebra" at UC Berkeley
\newcommand{\CC}{\mathbb C}
\newcommand{\FF}{\mathbb F}
\newcommand{\NN}{\mathbb N}
\newcommand{\QQ}{\mathbb Q}
\newcommand{\RR}{\mathbb R}
\newcommand{\ZZ}{\mathbb Z}
\DeclareMathOperator{\Aut}{Aut}
\DeclareMathOperator{\Inn}{Inn}
\DeclareMathOperator{\Syl}{Syl}
\DeclareMathOperator{\Gal}{Gal}
\DeclareMathOperator{\GL}{GL}
\DeclareMathOperator{\SL}{SL}

%From Kiran Kedlaya's "Geometry Unbound"
\newcommand{\abs}[1]{\left\lvert #1 \right\rvert}
\newcommand{\norm}[1]{\left\lVert #1 \right\rVert}
\newcommand{\dang}{\measuredangle} %% Directed angle
\newcommand{\ray}[1]{\overrightarrow{#1}}
\newcommand{\seg}[1]{\overline{#1}}

% From M275 "Topology" at SJSU
\newcommand{\id}{\mathrm{id}}
\newcommand{\taking}[1]{\xrightarrow{#1}}
\newcommand{\inv}{^{-1}}

\DeclareMathOperator{\ord}{ord}
\newcommand{\defeq}{\overset{\mathrm{def}}{=}}
\newcommand{\defiff}{\overset{\mathrm{def}}{\iff}}

% From the USAMO .tex files
\newcommand{\dg}{^\circ}

\newcommand{\liff}{\leftrightarrow}
\newcommand{\lthen}{\rightarrow}
\newcommand{\opname}{\operatorname}
\newcommand{\surjto}{\twoheadrightarrow}
\newcommand{\injto}{\hookrightarrow}
\DeclareMathOperator{\Char}{char}
\DeclareMathOperator{\Dom}{Dom}
\DeclareMathOperator{\Fix}{\textit{Fix}\,}
\DeclareMathOperator{\End}{End}
\DeclareMathOperator{\existsone}{\exists !}
\DeclareMathOperator{\Hom}{Hom}
\DeclareMathOperator{\Imm}{Imm}
\DeclareMathOperator{\Ker}{Ker}
\DeclareMathOperator{\rank}{rank}
\DeclareMathOperator{\MCD}{MCD}
\DeclareMathOperator{\Mor}{Mor}
\DeclareMathOperator{\mcm}{mcm}
\DeclareMathOperator{\tr}{tr}

\let\oldemptyset\emptyset
\let\emptyset\varnothing

\let\oldcirc\circ
\let\circ\undefined
\DeclareMathOperator{\circ}{\oldcirc}

\let\oldexists\exists
\let\exists\undefined
\DeclareMathOperator{\exists}{\oldexists}

\let\oldforall\forall
\let\forall\undefined
\DeclareMathOperator{\forall}{\oldforall}

\let\oldnexists\nexists
\let\nexists\undefined
\DeclareMathOperator{\nexists}{\oldnexists}

\let\oldland\land
\let\land\undefined
\DeclareMathOperator{\land}{\oldland}

\let\oldlnot\lnot
\let\lnot\undefined
\DeclareMathOperator{\lnot}{\oldlnot}

\let\oldlor\lor
\let\lor\undefined
\DeclareMathOperator{\lor}{\oldlor}

\title{}
\author{Gabriel Antonio Videtta}
\date{\today}

\PassOptionsToPackage{usenames,svgnames,dvipsnames,table}{xcolor}
\usepackage{xcolor}
\usepackage[colorlinks=true]{hyperref}
\hypersetup{urlcolor=RubineRed,linkcolor=RoyalBlue,citecolor=ForestGreen}
\usepackage[nameinlink]{cleveref}

\usepackage{amsthm}
\usepackage{thmtools}
\usepackage[framemethod=TikZ]{mdframed}

\mdfdefinestyle{mdbluebox}{%
  roundcorner=10pt,
  linewidth=1pt,
  skipabove=12pt,
  innerbottommargin=9pt,
  skipbelow=2pt,
  linecolor=blue,
  nobreak=true,
  backgroundcolor=TealBlue!5,
}
\declaretheoremstyle[
  headfont=\sffamily\bfseries\color{MidnightBlue},
  mdframed={style=mdbluebox},
  headpunct={\\[3pt]},
  postheadspace={0pt}
]{thmbluebox}

\mdfdefinestyle{mdbluebox2}{%
  roundcorner=10pt,
  linewidth=1pt,
  skipabove=12pt,
  innerbottommargin=9pt,
  skipbelow=2pt,
  linecolor=blue,
  nobreak=true,
  backgroundcolor=BlueViolet!9,
}
\declaretheoremstyle[
  headfont=\sffamily\bfseries\color{RoyalPurple},
  mdframed={style=mdbluebox2},
  headpunct={\\[3pt]},
  postheadspace={0pt}
]{thmbluebox2}

\mdfdefinestyle{mdredbox}{%
  linewidth=0.5pt,
  skipabove=12pt,
  frametitleaboveskip=5pt,
  frametitlebelowskip=0pt,
  skipbelow=2pt,
  frametitlefont=\bfseries,
  innertopmargin=4pt,
  innerbottommargin=8pt,
  nobreak=true,
  backgroundcolor=Salmon!5,
  linecolor=RawSienna,
}
\declaretheoremstyle[
  headfont=\bfseries\color{RawSienna},
  mdframed={style=mdredbox},
  headpunct={\\[3pt]},
  postheadspace={0pt},
]{thmredbox}

\mdfdefinestyle{mdredbox2}{%
  roundcorner=10pt,
  linewidth=1pt,
  skipabove=12pt,
  innerbottommargin=9pt,
  skipbelow=2pt,
  linecolor=red,
  nobreak=true,
  backgroundcolor=WildStrawberry!5,
}
\declaretheoremstyle[
  headfont=\sffamily\bfseries\color{Maroon},
  mdframed={style=mdredbox2},
  headpunct={\\[3pt]},
  postheadspace={0pt}
]{thmredbox2}

\mdfdefinestyle{mdgreenbox}{%
  skipabove=8pt,
  linewidth=2pt,
  rightline=false,
  leftline=true,
  topline=false,
  bottomline=false,
  linecolor=ForestGreen,
  backgroundcolor=ForestGreen!5,
}
\declaretheoremstyle[
  headfont=\bfseries\sffamily\color{ForestGreen!70!black},
  bodyfont=\normalfont,
  spaceabove=2pt,
  spacebelow=1pt,
  mdframed={style=mdgreenbox},
  headpunct={ --- },
]{thmgreenbox}

\mdfdefinestyle{mdgreenbox2}{%
  roundcorner=10pt,
  linewidth=1pt,
  skipabove=12pt,
  innerbottommargin=9pt,
  skipbelow=2pt,
  linecolor=ForestGreen,
  nobreak=true,
  backgroundcolor=ForestGreen!5,
}
\declaretheoremstyle[
  headfont=\sffamily\bfseries\color{ForestGreen!70!black},
  mdframed={style=mdgreenbox2},
  headpunct={\\[3pt]},
  postheadspace={0pt}
]{thmgreenbox2}

\mdfdefinestyle{mdblackbox}{%
  skipabove=8pt,
  linewidth=3pt,
  rightline=false,
  leftline=true,
  topline=false,
  bottomline=false,
  linecolor=black,
  backgroundcolor=RedViolet!5!gray!10,
}
\declaretheoremstyle[
  headfont=\bfseries,
  bodyfont=\normalfont\small,
  spaceabove=0pt,
  spacebelow=0pt,
  mdframed={style=mdblackbox}
]{thmblackbox}

\mdfdefinestyle{mdblackbox2}{%
  skipabove=8pt,
  linewidth=3pt,
  rightline=false,
  leftline=true,
  topline=false,
  bottomline=false,
  linecolor=gray,
  backgroundcolor=RedViolet!5!gray!10,
}
\declaretheoremstyle[
  headfont=\bfseries,
  bodyfont=\normalfont\small,
  spaceabove=0pt,
  spacebelow=0pt,
  mdframed={style=mdblackbox2}
]{thmblackbox2}

\newcommand{\listhack}{$\empty$\vspace{-2em}}

\declaretheorem[%
  style=thmbluebox,name=Teorema,numberwithin=section]{theorem}

\declaretheorem[style=thmgreenbox2,name=Lemma,sibling=theorem]{lemma}
\declaretheorem[style=thmredbox2,name=Proposizione,sibling=theorem]{proposition}
\declaretheorem[style=thmbluebox2,name=Corollario,sibling=theorem]{corollary}
\declaretheorem[style=thmbluebox,name=Teorema,numbered=no]{theorem*}
\declaretheorem[style=thmgreenbox2,name=Lemma,numbered=no]{lemma*}
\declaretheorem[style=thmredbox2,name=Proposizione,numbered=no]{proposition*}
\declaretheorem[style=thmbluebox2,name=Corollario,numbered=no]{corollary*}
\declaretheorem[style=thmgreenbox,name=Claim,sibling=theorem]{claim}
\declaretheorem[style=thmgreenbox,name=Claim,numbered=no]{claim*}
\declaretheorem[style=thmredbox,name=Esempio,sibling=theorem]{example}
\declaretheorem[style=thmredbox,name=Esempio,numbered=no]{example*}
\declaretheorem[style=thmblackbox, name=Definizione,sibling=theorem]{definition}
\declaretheorem[style=thmblackbox, name=Definizione,numbered=no]{definition*}
\declaretheorem[style=thmblackbox2,name=Osservazione,sibling=theorem]{remark}
\declaretheorem[style=thmblackbox2,name=Osservazione,numbered=no]{remark*}
\declaretheorem[name=Congettura,sibling=theorem]{conjecture}
\declaretheorem[name=Congettura,numbered=no]{conjecture*}
\declaretheorem[name=Esercizio,sibling=theorem]{exercise}
\declaretheorem[name=Esercizio,numbered=no]{exercise*}
\declaretheorem[name=Asserzione,sibling=theorem]{fact}
\declaretheorem[name=Asserzione,numbered=no]{fact*}
\declaretheorem[name=Problema,sibling=theorem]{problem}
\declaretheorem[name=Problema,numbered=no]{problem*}
\declaretheorem[name=Domanda,sibling=theorem]{ques}
\declaretheorem[name=Domanda,numbered=no]{ques*}

\Crefname{claim}{Claim}{Claim}
\Crefname{conjecture}{Congettura}{Congetture}
\Crefname{exercise}{Esercizio}{Esercizi}
\Crefname{fact}{Asserzione}{Asserzioni}
\Crefname{problem}{Problema}{Problemi}
\Crefname{ques}{Domanda}{Domande}

\addtokomafont{partprefix}{\rmfamily}
\renewcommand*{\partformat}{\color{purple}
  \scalebox{2.5}{\thepart}\enlargethispage{2em}}

\renewcommand*{\sectionformat}%
{\color{purple}\S\thesection\enskip}
\renewcommand*{\subsectionformat}%
{\color{purple}\S\thesubsection\enskip}
\renewcommand*{\subsubsectionformat}%
{\color{purple}\S\thesubsubsection\enskip}
\KOMAoptions{numbers=noenddot}

\usepackage{listings}
\usepackage{mathrsfs}
\usepackage{textcomp}
\lstset{basicstyle=\ttfamily\scriptsize,
  backgroundcolor=\color{green!2!white},
  breakatwhitespace=true,
  breaklines=true,
  commentstyle=\color{green!70!black},
  frame=shadowbox,
  frame=single,
  identifierstyle=\color{green!20!black},
  keywordstyle=\bfseries,
  keywordstyle=\bfseries\color{blue},
  numbers=left,
  numbersep=5pt,
  numberstyle=\tiny\sffamily\itshape\color{black!60},
  rulecolor=\color{blue!70!black},
  rulesepcolor=\color{blue!30!black},
  showstringspaces=false,
  stringstyle=\color{orange},
  tabsize=4,
}

\usepackage[shortlabels]{enumitem}
\usepackage[obeyFinal,textsize=scriptsize,shadow]{todonotes}
\usepackage{textcomp}
\usepackage{multirow}
\usepackage{ellipsis}
\usepackage{mathtools}
\usepackage{microtype}
\usepackage{xstring}
\usepackage{wrapfig}

\addtokomafont{subtitle}{\Large}
\setkomafont{author}{\Large\scshape}
\setkomafont{date}{\Large\normalsize}

\providecommand{\thetitle}{\@title}
\providecommand{\theauthor}{\@author}
\providecommand{\thedate}{\@date}

\usepackage[headsepline]{scrlayer-scrpage}
\renewcommand{\headfont}{}
\addtolength{\textheight}{3.14cm}
\setlength{\footskip}{0.5in}
\setlength{\headsep}{10pt}

\ihead{\footnotesize\textbf{\rightmark}}
\ohead{\footnotesize\textit{\thetitle}}

\automark{section}
\chead{}
\cfoot{\pagemark}

\hfuzz=\maxdimen
\tolerance=10000
\hbadness=10000
