176 lines
5.2 KiB
TeX
176 lines
5.2 KiB
TeX
\usepackage{amsfonts, amsmath, amssymb, amsthm}
|
|
\usepackage{bigfoot}
|
|
\usepackage{comment}
|
|
\usepackage[shortlabels]{enumitem}
|
|
\usepackage{etoolbox}
|
|
\usepackage{environ}
|
|
\usepackage{fancybox}
|
|
\usepackage{fontawesome5}
|
|
\usepackage{mathabx, mathrsfs}
|
|
\usepackage{soul}
|
|
\usepackage{stmaryrd}
|
|
% Must load `xcolor` before `tikz`.
|
|
\usepackage[dvipsnames]{xcolor}
|
|
\usepackage{tikz}
|
|
% `hyperref` comes after `xr-hyper`.
|
|
\usepackage{xr-hyper}
|
|
\usepackage{hyperref}
|
|
|
|
% Open "private" namespace.
|
|
\makeatletter
|
|
|
|
% ========================================
|
|
% General
|
|
% ========================================
|
|
|
|
\newcommand{\header}[2]{\title{#1}\author{#2}\date{}\maketitle}
|
|
|
|
% ========================================
|
|
% Dividers
|
|
% ========================================
|
|
|
|
\newcommand\@linespace{\vspace{10pt}}
|
|
\newcommand\linedivider{\@linespace\hrule\@linespace}
|
|
\WithSuffix\newcommand\linedivider*{\@linespace\hrule}
|
|
\newcommand\suitdivider{$$\spadesuit\;\spadesuit\;\spadesuit$$}
|
|
|
|
% ========================================
|
|
% Linking
|
|
% ========================================
|
|
|
|
\hypersetup{colorlinks=true, linkcolor=blue, urlcolor=blue}
|
|
\newcommand{\textref}[1]{\text{\nameref{#1}}}
|
|
\newcommand{\hyperlabel}[1]{%
|
|
\label{#1}%
|
|
\hypertarget{#1}{}}
|
|
|
|
% Denote if working with a predefined statement/theorem or a custom one.
|
|
\newcommand\@leanlink[4]{%
|
|
\textcolor{BlueViolet}{\raisebox{-4.5pt}{%
|
|
\tikz{\draw (0, 0) node[yscale=-1,xscale=1] {\faFont};}}{-\;}}%
|
|
\href{#1/#2.html\##3}{\color{BlueViolet}{#4}}}
|
|
\newcommand\@codelink[4]{%
|
|
\textcolor{MidnightBlue}{\raisebox{-4.5pt}{%
|
|
\tikz{\draw (0, 0) node[xshift=8pt] {\faCodeBranch};}}{-\;}}%
|
|
\href{#1/#2.html\##3}{\color{MidnightBlue}{#4}}}
|
|
|
|
% Reference to an anchor of generated Lean documentation.
|
|
\newcommand\leanref[3]{%
|
|
\@leanlink{#1}{#2}{#3}{#3}}
|
|
\newcommand\coderef[3]{%
|
|
\@codelink{#1}{#2}{#3}{#3}}
|
|
\newcommand\leanpref[4]{%
|
|
\@leanlink{#1}{#2}{#3}{#4}}
|
|
\newcommand\codepref[4]{%
|
|
\@codelink{#1}{#2}{#3}{#4}}
|
|
|
|
% Macro to build all Lean related commands relative to a specified directory.
|
|
\newcommand\makeleancommands[1]{%
|
|
\newcommand\lean[2]{%
|
|
\noindent\leanref{#1}{##1}{##2}}
|
|
\WithSuffix\newcommand\lean*[2]{%
|
|
\vspace{6pt}\noindent\leanref{#1}{##1}{##2}}
|
|
|
|
\newcommand\code[2]{%
|
|
\noindent\coderef{#1}{##1}{##2}}
|
|
\WithSuffix\newcommand\code*[2]{%
|
|
\vspace{6pt}\noindent\coderef{#1}{##1}{##2}}
|
|
|
|
\newcommand\leanp[3]{%
|
|
\noindent\leanpref{#1}{##1}{##2}{##3}}
|
|
\WithSuffix\newcommand\leanp*[3]{%
|
|
\vspace{6pt}\noindent\leanpref{#1}{##1}{##2}{##3}}
|
|
|
|
\newcommand\codep[3]{%
|
|
\noindent\codepref{#1}{##1}{##2}{##3}}
|
|
\WithSuffix\newcommand\codep*[3]{%
|
|
\vspace{6pt}\noindent\codepref{#1}{##1}{##2}{##3}}
|
|
}
|
|
|
|
% ========================================
|
|
% Admonitions
|
|
% ========================================
|
|
|
|
\newcommand{\@admonition}[2]{%
|
|
\begin{center}
|
|
\doublebox{
|
|
\begin{minipage}{0.95\textwidth}
|
|
\vspace{2pt}
|
|
\hl{#1} #2
|
|
\vspace{2pt}
|
|
\end{minipage}}
|
|
\end{center}}
|
|
|
|
\NewEnviron{note}{\@admonition{NOTE:}{\BODY}}
|
|
\NewEnviron{todo}{\@admonition{TODO:}{\BODY}}
|
|
|
|
% ========================================
|
|
% Statements
|
|
% ========================================
|
|
|
|
\newcommand\@statement[1]{%
|
|
\linedivider*\paragraph{\normalfont\normalsize\textit{#1.}}}
|
|
\newenvironment{answer}{\@statement{Answer}}{\hfill$\square$}
|
|
\renewenvironment{proof}{\@statement{Proof}}{\hfill$\square$}
|
|
|
|
\newtheorem{corollaryinner}{Corollary}
|
|
\newenvironment{corollary}[1][]{%
|
|
\ifstrempty{#1}
|
|
{\corollaryinner}
|
|
{\renewcommand\thecorollaryinner{#1}\corollaryinner}
|
|
}{\endcorollaryinner}
|
|
|
|
\newtheorem{lemmainner}{Lemma}
|
|
\newenvironment{lemma}[1][]{%
|
|
\ifstrempty{#1}
|
|
{\lemmainner}
|
|
{\renewcommand\thelemmainner{#1}\lemmainner}
|
|
}{\endlemmainner}
|
|
|
|
\newtheorem{theoreminner}{Theorem}
|
|
\newenvironment{theorem}[1][]{%
|
|
\ifstrempty{#1}
|
|
{\theoreminner}
|
|
{\renewcommand\thetheoreminner{#1}\theoreminner}
|
|
}{\endtheoreminner}
|
|
|
|
% ========================================
|
|
% Status
|
|
% ========================================
|
|
|
|
\DeclareRobustCommand{\defined}[1]{%
|
|
\texorpdfstring{\color{darkgray}\faParagraph\ #1}{#1}}
|
|
\DeclareRobustCommand{\verified}[1]{%
|
|
\texorpdfstring{\color{teal}\faCheckCircle\ #1}{#1}}
|
|
\DeclareRobustCommand{\unverified}[1]{%
|
|
\texorpdfstring{\color{olive}\faCheckCircle[regular]\ #1}{#1}}
|
|
\DeclareRobustCommand{\pending}[1]{%
|
|
\texorpdfstring{\color{Fuchsia}\faPencil*\ #1}{#1}}
|
|
\DeclareRobustCommand{\sorry}[1]{%
|
|
\texorpdfstring{\color{Maroon}\faExclamationCircle\ #1}{#1}}
|
|
|
|
% ========================================
|
|
% Math
|
|
% ========================================
|
|
|
|
\newcommand{\abs}[1]{\left|#1\right|}
|
|
\newcommand{\ceil}[1]{\left\lceil#1\right\rceil}
|
|
\newcommand{\dom}[1]{\textop{dom}{#1}}
|
|
\newcommand{\fld}[1]{\textop{fld}{#1}}
|
|
\newcommand{\floor}[1]{\left\lfloor#1\right\rfloor}
|
|
\newcommand{\icc}[2]{\left[#1, #2\right]}
|
|
\newcommand{\ico}[2]{\left[#1, #2\right)}
|
|
\newcommand{\img}[2]{#1\!\left\llbracket#2\right\rrbracket}
|
|
\newcommand{\ioc}[2]{\left(#1, #2\right]}
|
|
\newcommand{\ioo}[2]{\left(#1, #2\right)}
|
|
\newcommand{\powerset}[1]{\mathscr{P}#1}
|
|
\newcommand{\ran}[1]{\textop{ran}{#1}}
|
|
\newcommand{\textop}[1]{\mathop{\text{#1}}}
|
|
\newcommand{\ubar}[1]{\text{\b{$#1$}}}
|
|
|
|
\let\oldemptyset\emptyset
|
|
\let\emptyset\varnothing
|
|
|
|
% Close off "private" namespace.
|
|
\makeatother
|