From f7d86b5eb60376920570e7e83b2de729b2565a02 Mon Sep 17 00:00:00 2001 From: Interitio Date: Fri, 29 Aug 2025 23:28:51 +1000 Subject: [PATCH 1/3] Add sty files locally. --- fancycom.sty | 306 +++++++++++++++++++++++++++++++++++++++++ fancymath.sty | 371 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 677 insertions(+) create mode 100644 fancycom.sty create mode 100644 fancymath.sty diff --git a/fancycom.sty b/fancycom.sty new file mode 100644 index 0000000..cc6c92c --- /dev/null +++ b/fancycom.sty @@ -0,0 +1,306 @@ +%LaTeX package providing some shorthands and quick commands, tailored to certain unspecified fields of maths. +%Not checked for conflicts with other packages. +%Mostly for personal use. +%Will not always be backwards compatible, although every effort will be made so that this is so. +%Written by Adam Walsh +%Version 1.0 (will not upgrade version numbers for minor command editions) + +\ProvidesPackage{fancycom}[2018/02/03 v1.0 Fancy maths common commands package] + +\RequirePackage{amsfonts} +\RequirePackage{amsthm} +\RequirePackage{amsmath} +\RequirePackage{amssymb} + +\RequirePackage{mathtools} + +\RequirePackage{calc} +\RequirePackage{textcomp} +\RequirePackage[nointegrals]{wasysym} +\RequirePackage{xparse} + +%\RequirePackage{mathrsfs} +\RequirePackage[mathscr]{euscript} + +\RequirePackage{tikz-cd} + +%Textual shortcuts/aids + \newcommand{\mbb}[1]{\mathbb{#1}} %Emblacken your symbols! + \newcommand{\mbf}[1]{\mathbf{#1}} %Embolden your symbols! + \newcommand{\mfk}[1]{\mathfrak{#1}} %Enfraken your symbols! + \newcommand{\bsl}{\backslash} %Backslash + \newcommand{\cndall}{\,\,\,\forall} %forall given as condition + \newcommand{\st}{\,\mid\,} %Such that symbol. : is also used. + \newcommand{\what}[1]{& \qquad &\begin{sloppy}\textit{\small\mbox{#1}\small}\end{sloppy}} %Little comment for an align block. Memento of 2007. + +%Basic symbol extensions + \def\bA{\mathbb{A}} + \def\bF{\mathbb{F}} + \def\bN{\mathbb{N}} + \def\bR{\mathbb{R}} + \def\bZ{\mathbb{Z}} + \def\bQ{\mathbb{Q}} + \def\bC{\mathbb{C}} + \def\bO{\mathbb{O}} + \def\bP{\mathbb{P}} + \def\bS{\mathbb{S}} + \def\fR{\mathfrak{R}} + \def\fZ{\mathfrak{Z}} + \def\fQ{\mathfrak{Q}} + \def\fC{\mathfrak{C}} + \def\fO{\mathfrak{O}} + \def\sC{\mathscr{C}} + \def\sD{\mathscr{D}} + \def\sP{\mathscr{P}} + \def\sF{\mathscr{F}} + \def\sH{\mathscr{H}} + \def\sM{\mathscr{M}} + \def\sT{\mathscr{T}} + \def\cA{\mathcal{A}} + \def\cB{\mathcal{B}} + \def\cO{\mathcal{O}} + \def\cF{\mathcal{F}} + \def\cG{\mathcal{G}} + \def\cC{\mathcal{C}} + \def\cD{\mathcal{D}} + \def\cT{\mathcal{T}} + \def\cP{\mathcal{P}} + \def\cS{\mathcal{S}} + + \def\bfz{\mathbf{0}} + + \def\fkp{\mathfrak{p}} + \def\fkq{\mathfrak{q}} + \def\fkm{\mathfrak{m}} + + +%Symbol abbreviations + \def\lm{\lambda} + \def\eps{\epsilon} + \def\veps{\varepsilon} + \def\vphi{\varphi} + + \def\ot{\otimes} + \def\ptl{\partial} + \def\bdry{\partial} + + \def\nin{\not\in} + + \newcommand{\isom}{\cong} %Isomorphism + \newcommand{\ceq}{\coloneqq} %Defined to be equal to + \newcommand{\eqc}{\eqqcolon} %Equal to be defined to + \newcommand{\ra}{\rangle} %Right angle bracket + \newcommand{\la}{\langle} %Left angle bracket + \newcommand{\wto}{\rightharpoonup} %Weak convergence, or just an arrow with the bottom half missing + \renewcommand{\to}{\longrightarrow} %A long right arrow, for functions and such + \newcommand{\lmto}{\longmapsto} %A right arrow with a vertical tail, for mapping definitions + \newcommand{\llim}{\lim\limits} %limit set up so that it always writes the limits underneath + +%Function constructors + \newcommand{\func}[3]{#1\colon#2\to #3} %Generic function definition without mapping + \newcommand{\mfunc}[3]{#1\colon#2\mapsto #3} %Generic function definition with only mapping + \newcommand{\afunc}[3]{#1\colon#2&\to #3} %Generic function with alignment on arrow + \newcommand{\vfunc}[5]{\func{#1}{#2}{#3},\quad#4\longmapsto #5} %Generic function definition with mapping + \newcommand{\vafunc}[5]{\afunc{#1}{#2}{#3}\\#4&\longmapsto #5} %Generic function over two lines aligned on arrow + + +%More complex operator constructors + \DeclareDocumentCommand\amod{ m g g } + {% + \IfNoValueTF{#2} + {% + \pmod{#1} + }{% + \IfNoValueTF{#3} + {% + {#1}\pmod{#2} + }{% + {#1} \,\equiv\, #2\pmod{#3} + } + } + } + + \DeclareDocumentCommand\ppp{ m g } + {% + \IfNoValueTF{#2} + {% + \frac{\partial}{\partial #1} + }{% + \frac{\partial #1}{\partial #2} + } + } + + \newcommand{\pp}[1]{\frac{\partial}{\partial #1}} + + +%For theorems and proofs + + \newtheorem{Theorem}{Theorem} + \newtheorem{Proposition}{Proposition} + \newtheorem{Conjecture}[Theorem]{Conjecture} + \newtheorem{Lemma}[Theorem]{Lemma} + \newtheorem{Corollary}[Theorem]{Corollary} + +\theoremstyle{remark} + \newtheorem{Example}{Example} + \newtheorem{Note}{Note} + \newtheorem{Question}{Question} + \newtheorem{Remark}{Remark} + +\theoremstyle{definition} + \newtheorem{Result}[Theorem]{Result} + \newtheorem{Definition}[Theorem]{Definition} + %Shorthands + \DeclareDocumentCommand\sdef{m}{\begin{Definition}#1\end{Definition}} + \DeclareDocumentCommand\sex{m}{\begin{Example}#1\end{Example}} + \DeclareDocumentCommand\snote{m}{\begin{Note}#1\end{Note}} + \DeclareDocumentCommand\slem{m}{\begin{Lemma}#1\end{Lemma}} + \DeclareDocumentCommand\sresult{m}{\begin{Result}#1\end{Result}} + \DeclareDocumentCommand\sres{m}{\begin{Result}#1\end{Result}} + \DeclareDocumentCommand\sques{m}{\begin{Question}#1\end{Question}} + \DeclareDocumentCommand\srem{m}{\begin{Remark}#1\end{Remark}} + + + +%Mathematical Operators + \DeclareMathOperator{\Ell}{Ell} %Elliptic genera + \DeclareMathOperator{\id}{id} + \DeclareMathOperator{\Id}{id} + \DeclareMathOperator{\Set}{\mathscr{S}et} + \DeclareMathOperator{\Hom}{\mathscr{H}om} + \DeclareMathOperator{\Top}{\mathscr{T}op} + \DeclareMathOperator{\Mod}{\mathbf{Mod}} + \DeclareMathOperator{\Comm}{\mathbf{Comm}} + \DeclareMathOperator{\Grp}{\mathbf{Grp}} + \DeclareMathOperator{\GL}{GL} + \DeclareMathOperator{\Obj}{Obj} + \DeclareMathOperator{\Spec}{Spec} + \DeclareMathOperator{\Specm}{Specm} + \DeclareMathOperator{\Min}{min} + \DeclareMathOperator{\Ker}{Ker} + \DeclareMathOperator{\im}{Im} + \DeclareMathOperator{\CoIm}{CoIm} + \DeclareMathOperator{\CoKer}{CoKer} + \DeclareMathOperator{\Der}{Der} + \DeclareMathOperator{\End}{End} + + +% Brackets and braces + \DeclareDocumentCommand\braces{}{{\ifnum\z@=`}\fi\@braces} + \DeclareDocumentCommand\@braces{ s t\big t\Big t\bigg t\Bigg m m m } + { % General braces with automatic and manual sizing + \IfBooleanTF{#1} + {\left#6\smash{#8}\right#7\vphantom{#8}} + { + \IfBooleanTF{#2}{\bigl#6{#8}\bigr#7}{ + \IfBooleanTF{#3}{\Bigl#6{#8}\Bigr#7}{ + \IfBooleanTF{#4}{\biggl#6{#8}\biggr#7}{ + \IfBooleanTF{#5}{\Biggl#6{#8}\Biggr#7}{\left#6{#8}\right#7} + } + } + } + } + \ifnum\z@=`{\fi} + } + + + \DeclareDocumentCommand\quantity{}{{\ifnum\z@=`}\fi\@quantity} + \DeclareDocumentCommand\@quantity{ t\big t\Big t\bigg t\Bigg g o d() d|| } + { % Flexible automatic bracketing of an expression in () or [] or {} or || + % Handles manual override of sizing + \IfBooleanTF{#1}{\let\ltag\bigl \let\rtag\bigr}{ + \IfBooleanTF{#2}{\let\ltag\Bigl \let\rtag\Bigr}{ + \IfBooleanTF{#3}{\let\ltag\biggl \let\rtag\biggr}{ + \IfBooleanTF{#4} + {\let\ltag\Biggl \let\rtag\Biggr} + {\let\ltag\left \let\rtag\right} + } + } + } + % Handles actual bracketing + \IfNoValueTF{#5}{ + \IfNoValueTF{#6}{ + \IfNoValueTF{#7}{ + \IfNoValueTF{#8} + {()} + {\ltag\lvert{#8}\rtag\rvert} + } + {\ltag(#7\rtag) \IfNoValueTF{#8}{}{|#8|}} + } + {\ltag[#6\rtag] \IfNoValueTF{#7}{}{(#7)} \IfNoValueTF{#8}{}{|#8|}} + } + {\ltag\lbrace#5\rtag\rbrace \IfNoValueTF{#6}{}{[#6]} \IfNoValueTF{#7}{}{(#7)} \IfNoValueTF{#8}{}{|#8|}} + \ifnum\z@=`{\fi} + } + \DeclareDocumentCommand\qty{}{\quantity} % Shorthand for \quantity + \DeclareDocumentCommand\pqty{ l m }{\braces#1{\lparen}{\rparen}{#2}} + \DeclareDocumentCommand\bqty{ l m }{\braces#1{\lbrack}{\rbrack}{#2}} + \DeclareDocumentCommand\Bqty{ l m }{\braces#1{\lbrace}{\rbrace}{#2}} + \DeclareDocumentCommand\vqty{ l m }{\braces#1{\lvert}{\rvert}{#2}} + +%Matrix constructors +\DeclareDocumentCommand\pmqty{m}{\begin{pmatrix}#1\end{pmatrix}} +\DeclareDocumentCommand\Pmqty{m}{\left\lgroup\begin{matrix}#1\end{matrix}\right\rgroup} +\DeclareDocumentCommand\bmqty{m}{\begin{bmatrix}#1\end{bmatrix}} +\DeclareDocumentCommand\Bmqty{m}{\begin{Bmatrix}#1\end{Bmatrix}} +\DeclareDocumentCommand\sbmqty{m}{\left[\begin{smallmatrix}#1\end{smallmatrix}\right]} +\DeclareDocumentCommand\vmqty{m}{\begin{vmatrix}#1\end{vmatrix}} +\DeclareDocumentCommand\matrixquantity{}{{\ifnum\z@=`}\fi\@matrixquantity} +\DeclareDocumentCommand\@matrixquantity{ s g o d() d|| } +{ + \mathord{ + \IfNoValueTF{#2} + { + \IfNoValueTF{#3} + { + \IfNoValueTF{#4} + { + \IfNoValueTF{#5} + {()} + {\vmqty{#5}} + } + { + \IfBooleanTF{#1} + {\Pmqty{#4}} + {\pmqty{#4}} + \IfNoValueTF{#5}{}{|#5|} + } + } + {\bmqty{#3} \IfNoValueTF{#4}{}{(#4)} \IfNoValueTF{#5}{}{|#5|}} + } + {\begin{matrix}#2\end{matrix} \IfNoValueTF{#3}{}{[#3]} \IfNoValueTF{#4}{}{(#4)} \IfNoValueTF{#5}{}{|#5|}} + } + \ifnum\z@=`{\fi} +} +\DeclareDocumentCommand\mqty{}{\matrixquantity} % Shorthand for \matrixquantity +\DeclareDocumentCommand\matrixdeterminant{m}{\vmqty{#1}} % Matrix determinant +\DeclareDocumentCommand\mdet{}{\matrixdeterminant} % Shorthand for matrix determinant + + +% Quick quad text (math-mode text with \quad spacing) + \DeclareDocumentCommand\qqtext{ s m }{\IfBooleanTF{#1}{}{\quad}\text{#2}\quad} + \DeclareDocumentCommand\qq{}{\qqtext} + + \DeclareDocumentCommand\qcomma{}{,\quad} + \DeclareDocumentCommand\qc{}{\qcomma} + + \DeclareDocumentCommand\qif{s}{\IfBooleanTF{#1}{}{\quad}\text{if}\quad} + \DeclareDocumentCommand\qthen{s}{\IfBooleanTF{#1}{}{\quad}\text{then}\quad} + \DeclareDocumentCommand\qelse{s}{\IfBooleanTF{#1}{}{\quad}\text{else}\quad} + \DeclareDocumentCommand\qotherwise{s}{\IfBooleanTF{#1}{}{\quad}\text{otherwise}\quad} + \DeclareDocumentCommand\qunless{s}{\IfBooleanTF{#1}{}{\quad}\text{unless}\quad} + \DeclareDocumentCommand\qgiven{s}{\IfBooleanTF{#1}{}{\quad}\text{given}\quad} + \DeclareDocumentCommand\qusing{s}{\IfBooleanTF{#1}{}{\quad}\text{using}\quad} + \DeclareDocumentCommand\qassume{s}{\IfBooleanTF{#1}{}{\quad}\text{assume}\quad} + \DeclareDocumentCommand\qsince{s}{\IfBooleanTF{#1}{}{\quad}\text{since}\quad} + \DeclareDocumentCommand\qlet{s}{\IfBooleanTF{#1}{}{\quad}\text{let}\quad} + \DeclareDocumentCommand\qfor{s}{\IfBooleanTF{#1}{}{\quad}\text{for}\quad} + \DeclareDocumentCommand\qall{s}{\IfBooleanTF{#1}{}{\quad}\text{all}\quad} + \DeclareDocumentCommand\qeven{s}{\IfBooleanTF{#1}{}{\quad}\text{even}\quad} + \DeclareDocumentCommand\qodd{s}{\IfBooleanTF{#1}{}{\quad}\text{odd}\quad} + \DeclareDocumentCommand\qinteger{s}{\IfBooleanTF{#1}{}{\quad}\text{integer}\quad} + \DeclareDocumentCommand\qand{s}{\IfBooleanTF{#1}{}{\quad}\text{and}\quad} + \DeclareDocumentCommand\qor{s}{\IfBooleanTF{#1}{}{\quad}\text{or}\quad} + \DeclareDocumentCommand\qas{s}{\IfBooleanTF{#1}{}{\quad}\text{as}\quad} + \DeclareDocumentCommand\qin{s}{\IfBooleanTF{#1}{}{\quad}\text{in}\quad} + \DeclareDocumentCommand\qcc{s}{\IfBooleanTF{#1}{}{\quad}\text{c.c.}\quad} diff --git a/fancymath.sty b/fancymath.sty new file mode 100644 index 0000000..4892d1e --- /dev/null +++ b/fancymath.sty @@ -0,0 +1,371 @@ +%LaTeX package for writing fancy mathematics fast, specifically tailored to writing assignments and course notes. +%Requires and integrates with the fancycom package, which defines many mathematical command shortcuts. +%Not carefully checked for integration with other packages. +%Written by Adam Walsh +%Version 1.0 + +%----------Identification------------ +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{fancymath}[2016/06/17 v1.0 Fancy Maths Package] + +%----------Initial code-------------- + +\RequirePackage{ifthen} + +%Layout colour +%% 0=Full (default) +%% 1=Black (no colour) +%% 2=Grey (Greyscale colours) +\newcounter{colour} +\newboolean{fullcolour} +\setboolean{fullcolour}{true} +\newcommand{\colour}{} + +%Default Layouts +%% 0=plain (default) +%% 1=Assignment +%% 2=General Submission +%% 3=Course Notes +%% 4= +\newcounter{layout} + + +%Separate questions on different pages (for question and answer environment) +%%0= multiple questions per page (default) +%%1= One question and answer per page +\newboolean{sepquest} + +\newboolean{qthm} + +%----------Option Declaration------------ + +%Colour selection +\DeclareOption{grey}{% + \setcounter{colour}{2}% + \setboolean{fullcolour}{false}% + \renewcommand{\colour}{\color{Gray}}} + +\DeclareOption{black}{% + \setcounter{colour}{1}% + \setboolean{fullcolour}{false}% + \renewcommand{\colour}{\color{Black}}} + +%Default Layout selection +\DeclareOption{ass}{\setcounter{layout}{1}} +\DeclareOption{general}{\setcounter{layout}{2}} +\DeclareOption{notes}{\setcounter{layout}{3}} + +%Seperate questions option +\DeclareOption{qsep}{\setboolean{sepquest}{true}} + +\DeclareOption{qthm}{\setboolean{qthm}{true}} + +%---------Process Options---------------- +\ProcessOptions + +%------------Package Loading--------------- + +\RequirePackage[table,dvipsnames]{xcolor} %To use coloured layout +\RequirePackage{fancyhdr} %To make the headers and footers fancy +\RequirePackage{geometry} %To manipulate the geometry of the pages + +\RequirePackage{calc} %For manipulating values + + +%------------Main Code--------------- + + +%Some formatting lengths not usually useful in mathematical submissions. +\setlength{\parindent}{0mm} +\setlength{\parskip}{0mm} + + + +%General values used in titles and styling +\newcommand{\authorname}{} +\newcommand{\authornumber}{} +\newcommand{\coursename}{} +\newcommand{\coursenumber}{} +\newcommand{\submissiontitle}{} +\newcommand{\assignmentnumber}{} +\newcommand{\thetitle}{\submissiontitle} +\newcommand{\theauthor}{\authorname} +\newcommand{\therightfoot}{} +\newcommand{\theleftfoot}{} +\newcommand{\thelefthead}{} +\newcommand{\therighthead}{} + + + +%Control sequences for basic style values +\newcommand{\aname}[1]{% + \renewcommand{\authorname}{#1}} +\newcommand{\anum}[1]{% + \renewcommand{\authornumber}{#1}} +\newcommand{\cname}[1]{% + \renewcommand{\coursename}{#1}} +\newcommand{\cnum}[1]{% + \renewcommand{\coursenumber}{#1}} +\newcommand{\stitle}[1]{% + \renewcommand{\submissiontitle}{#1}} +\newcommand{\assnum}[1]{% + \renewcommand{\assignmentnumber}{#1}} + +%Advanced control sequences for controlling styling +\newcommand{\rawtitle}[1]{% + \renewcommand{\thetitle}{#1}} +\newcommand{\rawauthor}[1]{% + \renewcommand{\theauthor}{#1}} +\newcommand{\rawrfoot}[1]{% + \renewcommand{\therightfoot}{#1}} +\newcommand{\rawlfoot}[1]{% + \renewcommand{\theleftfoot}{#1}} +\newcommand{\rawlhead}[1]{% + \renewcommand{\thelefthead}{#1}} +\newcommand{\rawrhead}[1]{% + \renewcommand{\therighthead}{#1}} + + +%Styling common to all layouts, including plain + +%The page geometry +\geometry{% + a4paper,% + left=20mm,% + right=20mm,% + top=20mm,% + bottom=20mm,% + heightrounded} + + + +%Styling common to general non-plain layouts +\ifthenelse{\not \value{layout}=0}{% + %Base colours, determined from colour option + \newcommand{\titlecolour}{% + \ifthenelse{\boolean{fullcolour}}{\color{Brown}}{\colour}} + \newcommand{\headcolour}{% + \ifthenelse{\boolean{fullcolour}}{\color{Blue}}{\colour}} + \newcommand{\headrulecolour}{% + \ifthenelse{\boolean{fullcolour}}{\color{Brown}}{\colour}} + \newcommand{\enumcolour}{% + \ifthenelse{\boolean{fullcolour}}{\color{Brown}}{\colour}} + + %Some default values for the footers + \rawlfoot{\authorname} + \rawrfoot{\today} + \rawlhead{\submissiontitle} + \rawrhead{\thepage} + + %Page style + \pagestyle{fancy} + + %Set the headers and footers + \fancyhead{} + \fancyfoot{} + \fancyfoot[L]{\headcolour\theleftfoot} + \fancyfoot[C]{\headcolour\thepage} + \fancyfoot[R]{\headcolour{}\therightfoot} + \fancyhead[L]{\headcolour\thelefthead} + \fancyhead[R]{\headcolour\therighthead} + + %Make the headrule + \renewcommand{\headrule}{\headrulecolour\vbox to 0pt{\hbox to\headwidth{\hrulefill}\vss}} + \headheight=21pt + + %Slightly modify line spacing + \renewcommand{\baselinestretch}{1.1} + + %Set the style and colour of the enumerate labels + \renewcommand{\theenumi}{\alph{enumi}} + \renewcommand{\theenumii}{\roman{enumii}} + \renewcommand{\theenumiii}{\alph{enumiii}} + \renewcommand{\labelenumi}{\enumcolour(\theenumi)} + \renewcommand{\labelenumii}{\enumcolour(\theenumii)} + \renewcommand{\labelenumiii}{\enumcolour(\theenumiii)} + + %Make title info for maketitle + \author{\titlecolour\theauthor} + \title{\titlecolour\thetitle} + \date{\titlecolour\today} + +}{} + +%---Notes specific layout and styling--- +\ifthenelse{\value{layout}=3}{% + %Set the Notes specific headers and footers + \rawlfoot{\authorname, \today} + \rawrfoot{Notes} + \rawlhead{\coursenumber -- \coursename} + + %Assignment specific title and Author + \rawauthor{\authorname} + \rawtitle{\coursename -- Notes} +}{} + +%---Assignment specific layout and styling--- +\ifthenelse{\value{layout}=1}{% + %Set the Assignment specific headers and footers + \rawlfoot{\authorname} + \rawrfoot{\today} + \rawrhead{Assignment \assignmentnumber} + \rawlhead{\coursenumber -- \coursename} + + %Assignment specific title and Author + \rawauthor{\authorname, Student \authornumber} + \rawtitle{\coursenumber -- Assignment \assignmentnumber} +}{} + + +%Defining the Question-and-Answer environment for use in assignments. +%%Formats Questions and Answers with incrementing counters +%Base lengths +%%Amount questions and answers are indented +\newlength{\qmargin} +\setlength{\qmargin}{5mm} + +%%Amount of vertical space between question/answer title and question/answer. +\newlength{\qgap} +\setlength{\qgap}{5mm} + +%%Amount of vertical space between end of question and answer. +\newlength{\qagap} +\setlength{\qagap}{0.5em} + + +%Base colours, determined from colour option +%%Default colour is gray anyway +\newcommand{\qcolour}{% + \ifthenelse{\boolean{fullcolour}}{\color{Gray}}{\colour}} + + +\ifthenelse{\boolean{qthm}}{ + %Values + \newcounter{question} + \newcounter{nextanswer} + + \newboolean{firstquest} + \newboolean{questopen} + \newboolean{answeropen} + + \RequirePackage{amsthm} + \theoremstyle{plain} + \newtheorem{Question}[question]{Question} + + + \makeatletter + + \newcommand{\theanswer}{Answer \arabic{nextanswer}} + + \newcommand{\qnum}[1]{% + \setcounter{question}{#1}% + \addtocounter{question}{-1}% + \setcounter{nextanswer}{#1}% + } + + \newcommand{\startqanda}{% + \setcounter{question}{0}% + \setcounter{nextanswer}{0}% + \setboolean{firstquest}{true}% + \setboolean{questopen}{false}% + \setboolean{answeropen}{false}% + } + + \newcommand{\closeqanda}{% + \ifthenelse{\boolean{questopen}}{\closequestion}{}% + \ifthenelse{\boolean{answeropen}}{\closeanswer}{}% + } + + \newcommand{\question}[1][0]{% + \closeqanda% + \ifthenelse{\boolean{sepquest} \and \not \boolean{firstquest} }{\newpage}{}% + \setboolean{firstquest}{false}% + \ifthenelse{#1=0}{}{\qnum{#1}}% + \begin{Question} + \@minipagetrue% + \setboolean{questopen}{true}% + \setcounter{nextanswer}{\value{question}}% + } + \newcommand{\closequestion}{% + \end{Question}% + \setboolean{questopen}{false}% + } + + \newcommand{\answer}[1][0]{% + \closeqanda% + \ifthenelse{#1=0}{}{\qnum{#1}\stepcounter{question}\stepcounter{question}}% + \begin{proof}[\theanswer] + \@minipagetrue% + \setboolean{answeropen}{true}% + \setcounter{question}{\value{nextanswer}}% + \stepcounter{nextanswer}% + \phantom{}% + } + \newcommand{\closeanswer}{% + \ifvmode\vspace*{-\baselineskip}\fi% + %\unskip% + \end{proof}% + \setboolean{answeropen}{false}% + } + + \newenvironment{qanda}{% + \startqanda% + }{% + \closeqanda% + } + \makeatother +}{ + + %Values + \newcounter{question} + \newcounter{lastquestion} + \newboolean{firstquest} + + + %Control Sequences + \newcommand{\qnum}[1]{% + \setcounter{question}{#1}% + \addtocounter{question}{-1}% + \setcounter{lastquestion}{\value{question}}} + + %The environment + \newenvironment{qanda}{% + \setcounter{question}{0}% + \setcounter{lastquestion}{0}% + \setboolean{firstquest}{true}% + \begin{list}{}{% + \renewcommand{\makelabel}[1]{\qcolour\textbf{##1}\\}% + \setlength{\leftmargin}{\qmargin}% + }% + }{% + \end{list}% + } + + %The question and answer commands + \makeatletter + \newcommand{\question}[1][0]{% + \ifthenelse{\boolean{sepquest} \and \not \boolean{firstquest} }{\newpage}{}% + \setboolean{firstquest}{false}% + \ifthenelse{#1=0}{% + \stepcounter{question}% + \setcounter{lastquestion}{\value{question}}% + \item[Question \arabic{question}]% + }{% + \setcounter{lastquestion}{#1}% + \item[Question #1]% + }% + \hfill\break\@minipagetrue% + } + + \newcommand{\answer}[1][0]{% + \vspace{\the\qagap}% + \ifthenelse{#1=0}{% + \item[Answer \arabic{lastquestion}]% + }{% + \item[Answer #1]% + }% + \hfill\break% + \@minipagetrue% + } + \makeatother +} From 62ec5dafe46ac2cf25556f8b901ad7c27bdf2ef7 Mon Sep 17 00:00:00 2001 From: Interitio Date: Fri, 29 Aug 2025 23:29:14 +1000 Subject: [PATCH 2/3] Add macros. --- main.tex | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.tex b/main.tex index 686c125..8d394f5 100644 --- a/main.tex +++ b/main.tex @@ -14,6 +14,9 @@ \DeclareMathOperator{\cTop}{\mathcal{T}op} \def\Sets{\Set} \DeclareMathOperator{\cHom}{\mathcal{H}om} +\def\ul{\underline} +\def\constset#1{\underline{\{#1\}}} + %\rawtitle{ } %\rawauthor{ } From dcd73a79c1ae8c4d78bc8c895bcdb625ae423414 Mon Sep 17 00:00:00 2001 From: Interitio Date: Fri, 29 Aug 2025 23:30:00 +1000 Subject: [PATCH 3/3] Up to Ex 2.3.D. --- chapter2.tex | 234 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 224 insertions(+), 10 deletions(-) diff --git a/chapter2.tex b/chapter2.tex index 760a014..85ade83 100644 --- a/chapter2.tex +++ b/chapter2.tex @@ -55,28 +55,31 @@ and let $\eta \colon A \implies B$ be a natural transformation between them. Then $\eta$ induces a map on the colimits, if they exist. \[ - \colim_{i \in I} B(i) \longrightarrow \colim_{i \in I} A(i) + \colim_{i \in I} A(i) \longrightarrow \colim_{i \in I} B(i) \] \end{Lemma} \begin{proof} Let $Z$ be any co-cone over the diagram $B$, - written as a natural transformation as in the previous lemma. + written as a natural transformation $\varepsilon$ as in the previous lemma. \[ \begin{tikzcd}[row sep=large] & * \ar[rd, "Z"] \\ I \ar[ru] - \ar[rr, bend left, "A"{anchor=center, fill=white, name=A}] - \ar[rr, bend right, "B"'{name=B}] - \ar[from=B.north-|A, shorten=4pt, to=A, Rightarrow, "\eta"] - \ar[from=A, ur, Rightarrow, shorten=2pt, "\varepsilon"] + \ar[rr, bend left, "B"{anchor=center, fill=white, name=B}] + \ar[rr, bend right, "A"'{name=A}] + \ar[from=A.north-|B, shorten=4pt, to=B, Rightarrow, "\eta"] + \ar[from=B, ur, Rightarrow, shorten=2pt, "\varepsilon"] & & C\\ \end{tikzcd} \] The composition $\varepsilon \circ \eta$ then describes $Z$ - as a co-cone over the diagram $B$. - If we choose $Z$ to be the colimit over $A$, - and assume the colimit of $B$ also exists, - then we get the map desired by the lemma. + as a co-cone over the diagram $A$ as well. + + If the diagram $A$ has a colimit, then it must admit a map to + this cocone $Z$ by universal property. + Thus, if $Z$ is assumed to be the colimit of $B$, + we have induced a map from the colimit of $A$ to the colimit of $B$ + as desired. \end{proof} \begin{qanda} @@ -647,7 +650,218 @@ Thus, $\cHom(\cF, \cG)$ is a presheaf satisfying both identity and gluing, and is thus a sheaf, as desired. + % Exercise 2.3.D + \question + \begin{enumerate} + \item Let $\cF$ be a sheaf of sets on $X$. + Show that $\cHom(\underline{\{p\}}, \cF) \isom \cF$, + where $\underline{\{p\}}$ is the constant sheaf with values in $\{p\}$. + \item Let $\cF$ be a sheaf of abelian groups on $X$. + Show that $\cHom_{Ab_X}(\underline{\bZ}, \cF) \isom \cF$ + in the category of sheaves of abelian groups. + \item Let $\cF$ be an $\cO_X$-module. + Show that $\cHom_{Mod_{\cO_X}}(\cO_X, \cF) \isom \cF$ + in the category of $\cO_X$-modules. + \end{enumerate} + \answer + \begin{enumerate} + \item We first consider the sheaf $\constset{p}$. + Take any $U$ open in $X$, then the sections $\constset{p}(U)$ + are the functions $f\colon U \to \{p\}$ such that $f^{-1}(p)$ is open. + That is, $\constset{p}(U)$ is the single-element set $*$. + The restrictions are then the trivial map $* \to *$. + Now, consider $\cHom(\constset{p}, \cF)$. + The sections of this sheaf hom over $U$ are the natural transformations + $\constset{p}|_U \to \cF|_U$. + However, such a natural transformation is precisely the choice of + an element of $\cF(U)$. + Note that although the natural transformation + describes a map $* \to \cF(V)$ for every open set $V \subseteq U$, + the natural transformation diagram ensures that + the chosen section over $V$ is the restriction of the + section over $U$, so the image of the $U$ component + does fully determine the transformation. + \[ + \begin{tikzcd} + * \ar[r] \ar[d] & \cF(U) \ar[d] \\ + * \ar[r] & \cF(V) + \end{tikzcd} + \] + This then defines a natural transformation $\cHom(\constset{p}, \cF) \Rightarrow \cF$, + which is isomorphic on components and is thus a natural isomorphism + as desired. + \item + Next we consider $\ul{\bZ}$, the constant sheaf on $\bZ$. + For $U$ open in $X$, the sections over $U$ are functions + $\func{f}{U}{\bZ}$ such that $f^{-1}(n)$ is open in $U$ for each $n \in \bZ$. + The group structure on $\ul{\bZ}(U)$ is given by pointwise addition, + that is, $(f+g)(x) = f(x) + g(x) \in \bZ$. + This is well-defined since for any $n \in \bZ$, + \[ + (f+g)^{-1}(n) = \bigcup_{a+b = n} f^{-1}(a) \cap g^{-1}(b). + \] + Unlike in the previous part, $\ul{\bZ}(U)$ now has more than a single element. + However, we shall show that each $\eta \in \Hom(\ul{\bZ}|_U, \cF|_U)$ + is still fully determined by where a single function in $\ul{\bZ}(U)$ is sent. + For $n \in \bZ$, let $\ul{n}^V\colon V \to \bZ$ denote the function in $\ul{\bZ}(V)$ + sending every point to $n$. Let $\sigma = \eta_U(\ul{1}^U)$. + + Now, take any $f \in \ul{\bZ}(U)$. + Then for each $n$, by definition, $U_n \ceq f^{-1}(n)$ is open in $U$. + Restricting, we have the following two diagrams. + \[ + \begin{tikzcd} + f \ar[r, mapsto] \ar[d, mapsto] & \eta_U(f) \ar[d, mapsto] \\ + \ul{n}^{U_n} \ar[r, mapsto] & \eta_U(f)|_{U_n} + \end{tikzcd} + \qquad + \begin{tikzcd} + \ul{1}^U \ar[r, mapsto] \ar[d, mapsto] & \sigma \ar[d, mapsto] \\ + \ul{1}^{U_n} \ar[r, mapsto] & \sigma|_{U_n} + \end{tikzcd} + \] + Since $\eta_{U_n}$ is a group homomorphism, we have + \[ + \eta_U(f)|_{U_n} = \eta_{U_n}(\ul{n}^{U_n}) = n \cdot \eta_{U_n}(\ul{1}^{U_n}) + = n \cdot \sigma|_{U_n} + \] + Thus the restrictions of $\eta_U(f)$ to the cover $U_n$ of $U$ + are fully determined by the values of $\sigma|_{U_n}$. + Since $\cF$ is a sheaf, we then have that $\eta_U(f)$ itself is fully determined by + $\sigma$, and thus we have a correspondence between $\cHom(\ul{\bZ}|_U, \cF|_U)$ + and $\cF(U)$ as desired. + \end{enumerate} + + % Question 2.3.E + \question + If $\phi\colon \cF \to \cG$ is a morphism of presheaves, + the presheaf kernel $\ker_{pre}(\phi)$ is defined by + $(\ker_{pre}\phi)(U) \ceq \ker \phi(U)$ + + Show that the presheaf kernel defined in this way is a presheaf. + + % Question 2.3.F + \question + Show that the presheaf cokernel satisfies the universal property of cokernel. + + % Question 2.3.G + \question + Show that $\cF \mapsto \cF(U)$ + is an exact functor $Ab^{pre}_X \to Ab$. + + % Question 2.3.H + \question + Show that a sequence of presheaves + \[ + 0 \to \cF_1 \to \cF_2 \to \dots \cdot \cF_n \to 0. + \] + is exact if and only if + \[ + 0 \to \cF_1(U) \to \cF_2(U) \to \dots \to \cF_n(U) \to 0. + \] + is exact for all $U$. + + % Question 2.3.I + \question + Assume $\phi\colon \cF \to \cG$ is a morphism of sheaves. + Show $\ker_{pre}\phi$ is a sheaf, + and satisfies the universal property of kernels in the category of sheaves. + + % Question 2.3.J + \question + Take $X$ to be $\cC$ with the standard topology, + and let $\cO_X$ be the sheaf of holomorphic functions. + Let $\cF$ be the presheaf of functions on $X$ admitting a holomorphic logarithm. + Show that the follow sequence of preshaves is exact + \[ + 0 \to \ul{\bZ} \to \cO_X \to \cF \to 0. + \] + Here $\ul{\bZ} \to \cO_X$ is the natural inclusion, and $\cO_X \to \cF$ + is given by $f \mapsto \exp(2\pi i f)$. + + Show that even though $\cF$ is a presheaf cokernel of a morphism of sheaves, + $\cF$ is not a sheaf itself. + + % Question 2.4.A + \question + Prove that a section of a sheaf of sets is determined by its germs, i.e., + the natural map + \[ + \cF(U) \to \prod_{p\in U} \cF_p + \] + is injective. + + % Question 2.4.B + \question + Call a family of germs over an open set $U$ \emph{compatible} + if they are locally the germs of some cover of $U$. + + Formally, say that $(s_p)_{p \in U}$ is a compatible family of germs + if for each $p \in U$, + there is some neighbourhood $U_p \ni p$ + where for some section $t \in \cF(U_p)$ over that neighbourhood, + $t_q = s_q$ for all $q \in U_p$. + + % Question 2.4.C + \question + If $\phi_1$ and $\phi_2$ are morphisms from a presheaf of sets $\cF$ + to a sheaf of sets $\cG$ that induce the same maps on each stalk, + show that $\phi_1 = \phi_2$. + + % Question 2.4.D + \question + Show that a morphism of sheaves of sets is an isomorphism + if and only if it induces an isomorphism of all stalks. + + % Question 2.4.E + \question + \begin{enumerate} + \item Show that $\cF(U) \to \prod_{p \in U} \cF_p$ + need not be injective if $\cF$ is not a sheaf. + \item Show that morphisms are not determined by stalks + for general presheaves. + \item Show that isomorphisms are not determined by stalks + for general presheaves. + \end{enumerate} + + % Question 2.4.F + \question + Show that sheafification is unique up to unique isomorphism, + assuming it exists. Show that $\cF$ is a sheaf, + then the sheafification is $id\colon \cF \to \cF$. + + % Question 2.4.G + \question + Show that sheafification is a functor from presheaves on $X$ to sheaves on $X$. + + % Question 2.4.H + \question + Show that $\cF^{sh}$ forms a sheaf. + + % Question 2.4.I + \question + Describe a natural map of presheaves $sh\colon \cF \to \cF^{sh}$ + + % Question 2.4.K + \question + Show that the sheafification functor is left-adjoint + to the forgetful functor from sheaves on $X$ to presheaves on $X$. + + % Question 2.4.L + \question + Show $\cF \to \cF^{sh}$ induces an isomorphism of stalks. + + % Question 2.4.M + \question + Suppose $\phi \colon \cF \to \cG$ is a morphism of sheaves of sets on $X$. + Show that the following are equivalent. + \begin{enumerate} + \item $\phi$ is a monomorphism in the category of sheaves. + \item $\phi$ is injective on the level of stalks, i.e. + $\phi_p\colon \cF_p \to \cG_p$ injective + \item $\phi$ is injective on the level open sets. + \end{enumerate} \end{qanda}