
% Required to support mathematical unicode
\usepackage[warnunknown, fasterrors, mathletters]{ucs}
\usepackage[utf8x]{inputenc}

% Always typeset math in display style
\everymath{\displaystyle}

% Use a larger font size
\usepackage[fontsize=14pt]{scrextend}

% Standard mathematical typesetting packages
\usepackage{amsfonts, amsthm, amsmath, amssymb}
\usepackage{mathtools}  % Extension to amsmath

% Symbol and utility packages
\usepackage{cancel, textcomp}
\usepackage[mathscr]{euscript}
\usepackage[nointegrals]{wasysym}

% Extras
\usepackage{physics}  % Lots of useful shortcuts and macros
\usepackage{tikz-cd}  % For drawing commutative diagrams easily
\usepackage{color}  % Add some colour to life
\usepackage{microtype}  % Minature font tweaks

% Common shortcuts
\def\mbb#1{\mathbb{#1}}
\def\mfk#1{\mathfrak{#1}}

\def\bN{\mbb{N}}
\def\bC{\mbb{C}}
\def\bR{\mbb{R}}
\def\bQ{\mbb{Q}}
\def\bZ{\mbb{Z}}

% Sometimes helpful macros
\newcommand{\func}[3]{#1\colon#2\to#3}
\newcommand{\vfunc}[5]{\func{#1}{#2}{#3},\quad#4\longmapsto#5}
\newcommand{\floor}[1]{\left\lfloor#1\right\rfloor}
\newcommand{\ceil}[1]{\left\lceil#1\right\rceil}

% Some standard theorem definitions
\newtheorem{Theorem}{Theorem}
\newtheorem{Proposition}{Theorem}
\newtheorem{Lemma}[Theorem]{Lemma}
\newtheorem{Corollary}[Theorem]{Corollary}

\theoremstyle{definition}
\newtheorem{Definition}[Theorem]{Definition}

\usepackage[erewhon,vvarbb,bigdelims]{newtxmath}
\usetikzlibrary{automata, positioning, arrows}
\usepackage{calligra}

\DeclareMathAlphabet{\mathcalligra}{T1}{calligra}{m}{n}
\DeclareFontShape{T1}{calligra}{m}{n}{<->s*[2.2]callig15}{}
\newcommand{\scriptr}{\mathcalligra{r}}
\newcommand{\boldscriptr}{\pmb{\mathcalligra{r}}}
\usepackage{environ}
\usepackage{xcolor}
\definecolor{Background}{HTML}{1d2021}
\definecolor{Foreground}{HTML}{D4BE98}



%%% Background Setting
\usepackage{varwidth}
\let\olddoc=\document
\let\oldenddoc=\enddocument
\let\document=\relax
\let\enddocument=\relax
\NewEnviron{document}{%
  \global\let\document\olddoc%
  \global\let\enddocument\oldenddoc%
  \colorlet{defaultcolor}{.}%
  \begin{document}%
    \colorbox{Background}{%
      \begin{varwidth}{\textwidth}\color{Foreground}\BODY\end{varwidth}%
    }%
  \end{document}%
}
\pagecolor{Background}
