bookshelf/preamble.tex

145 lines
4.2 KiB
TeX
Raw Normal View History

2023-05-19 15:25:37 +00:00
\usepackage{amsfonts, amsmath, amssymb, amsthm}
\usepackage{bigfoot}
\usepackage{comment}
\usepackage[shortlabels]{enumitem}
\usepackage{etoolbox}
\usepackage{environ}
\usepackage{fancybox}
\usepackage{fontawesome5}
\usepackage{mathrsfs}
\usepackage{soul}
\usepackage[usenames,dvipsnames]{xcolor}
% `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
% ========================================
2023-05-13 01:31:44 +00:00
\hypersetup{colorlinks=true, linkcolor=blue, urlcolor=blue}
\newcommand{\textref}[1]{\text{\nameref{#1}}}
\newcommand\@leanlink[4]{%
\textcolor{blue}{$\pmb{\exists}\;{-}\;$}\href{#1/#2.html\##3}{#4}}
% Reference to an anchor of Lean documentation.
\newcommand\leanref[3]{%
\@leanlink{#1}{#2}{#3}{#3}\vspace{10pt}}
\WithSuffix\newcommand\leanref*[3]{%
\@leanlink{#1}{#2}{#3}{#3}}
% Variant that allows customizing display text.
\newcommand\leanpref[4]{%
\@leanlink{#1}{#2}{#3}{#4}\vspace{10pt}}
\WithSuffix\newcommand\leanpref*[4]{%
\@leanlink{#1}{#2}{#3}{#4}}
% Macro to build all Lean related commands relative to a specified directory.
\newcommand\makeleancommands[1]{%
\newcommand\lean[2]{%
\leanref{#1}{##1}{##2}}
\WithSuffix\newcommand\lean*[2]{%
\leanref*{#1}{##1}{##2}}
\newcommand\leanp[3]{%
\leanpref{#1}{##1}{##2}{##3}}
\WithSuffix\newcommand\leanp*[3]{%
\leanpref*{#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}}
\newcommand{\note}[1]{\@admonition{Note:}{#1}}
\newcommand{\todo}[1]{\@admonition{TODO:}{#1}}
% ========================================
% Statements
% ========================================
\newcommand\@statement[1]{%
\linedivider*\paragraph{\normalfont\normalsize\textit{#1.}}}
\newcommand{\statementpadding}{\ \vspace{8pt}}
\newenvironment{answer}{\@statement{Answer}}{\hfill$\square$}
\newenvironment{axiom}{\@statement{Axiom}}{\hfill$\square$}
\newenvironment{definition}{\@statement{Definition}}{\hfill$\square$}
\renewenvironment{proof}{\@statement{Proof}}{\hfill$\square$}
2023-05-17 16:32:49 +00:00
\newtheorem{lemmainner}{Lemma}
\newenvironment{lemma}[1][]{%
\ifstrempty{#1}
{\lemmainner}
{\renewcommand\thelemmainner{#1}\lemmainner}
2023-05-17 16:32:49 +00:00
}{\endlemmainner}
2023-05-17 16:32:49 +00:00
\newtheorem{theoreminner}{Theorem}
\newenvironment{theorem}[1][]{%
\ifstrempty{#1}
{\theoreminner}
{\renewcommand\thetheoreminner{#1}\theoreminner}
2023-05-17 16:32:49 +00:00
}{\endtheoreminner}
% ========================================
% Status
% ========================================
\DeclareRobustCommand{\defined}[1]{%
2023-05-13 01:31:44 +00:00
\texorpdfstring{\color{darkgray}\faParagraph\ #1}{#1}}
\DeclareRobustCommand{\verified}[1]{%
2023-05-11 01:09:41 +00:00
\texorpdfstring{\color{teal}\faCheckCircle\ #1}{#1}}
\DeclareRobustCommand{\partial}[1]{%
\texorpdfstring{\color{Fuchsia}\faPencil*\ #1}{#1}}
\DeclareRobustCommand{\unverified}[1]{%
\texorpdfstring{\color{Maroon}\faExclamationCircle\ #1}{#1}}
% ========================================
% Math
% ========================================
\newcommand{\abs}[1]{\left|#1\right|}
2023-05-08 19:18:12 +00:00
\newcommand{\ceil}[1]{\left\lceil#1\right\rceil}
\newcommand{\floor}[1]{\left\lfloor#1\right\rfloor}
\newcommand{\icc}[2]{\left[#1, #2\right]}
\newcommand{\ico}[2]{\left[#1, #2\right)}
\newcommand{\ioc}[2]{\left(#1, #2\right]}
\newcommand{\ioo}[2]{\left(#1, #2\right)}
\newcommand{\powerset}[1]{\mathscr{P}#1}
\newcommand{\textop}[1]{\mathop{\text{#1}}}
\newcommand{\ubar}[1]{\text{\b{$#1$}}}
2023-05-19 15:25:37 +00:00
\let\oldemptyset\emptyset
\let\emptyset\varnothing
% Close off "private" namespace.
\makeatother