Skip to content

Instantly share code, notes, and snippets.

@lambdabetaeta
Last active March 20, 2024 19:04
Show Gist options
  • Save lambdabetaeta/0beb1e1a26146603092de62d6589b898 to your computer and use it in GitHub Desktop.
Save lambdabetaeta/0beb1e1a26146603092de62d6589b898 to your computer and use it in GitHub Desktop.
Macros for category theory
\RequirePackage{xparse}
\RequirePackage{jmsdelim}
\RequirePackage{graphicx}
%% CATEGORICAL CONSTANTS
\NewDocumentCommand{\SET}{}{\mathbf{Set}}
\NewDocumentCommand{\CAT}{}{\mathbf{Cat}}
\NewDocumentCommand{\COCONT}{}{\textbf{Cocont}}
\NewDocumentCommand{\TT}{}{\mathbb{T}}
\NewDocumentCommand{\BB}{}{\mathcal{B}}
\NewDocumentCommand{\CC}{}{\mathcal{C}}
\NewDocumentCommand{\DD}{}{\mathcal{D}}
\NewDocumentCommand{\EE}{}{\mathcal{E}}
\NewDocumentCommand{\FF}{}{\mathcal{F}}
\RenewDocumentCommand{\SS}{}{\mathcal{S}}
\NewDocumentCommand{\VV}{}{\mathcal{V}}
\NewDocumentCommand{\NN}{}{\mathcal{N}}
\NewDocumentCommand{\II}{}{\mathcal{I}}
\NewDocumentCommand{\initial}{}{\mathbf{0}}
\NewDocumentCommand{\terminal}{}{\mathbf{1}}
\NewDocumentCommand{\ARROW}{}{\mathbf{2}}
%% ARROWS AND OTHER RELATIONS
\NewDocumentCommand{\fto}{}{\longrightarrow}
\NewDocumentCommand{\id}{}{\textsf{id}}
\NewDocumentCommand{\Id}{}{\textsf{Id}}
\NewDocumentCommand{\To}{}{\Rightarrow}
\NewDocumentCommand{\Equiv}{}{\simeq}
\NewDocumentCommand{\Adjoint}{}{\dashv}
\NewDocumentCommand{\AdjointLUp}{}{\rotatebox[origin=c]{-90}{$\Adjoint$}}
\NewDocumentCommand{\AdjointLDown}{}{\rotatebox[origin=c]{90}{$\Adjoint$}}
%% BASIC GADGETS: OBJECTS, MORPHISMS, ...
\NewDocumentCommand{\IdArr}{g}{\id_{#1}}
\NewDocumentCommand{\semi}{}{\mathbin{;}} % diagrammatic order
\NewDocumentCommand{\Hom}{O{} m m}{\mathrm{Hom}_{#1}\DelimPrn{#2, #3}}
\NewDocumentCommand{\Op}{sm}{
\IfBooleanTF{#1}{\DelimPrn{#2}^\mathsf{op}}{#2^\mathsf{op}}
}
\NewDocumentCommand{\Ob}{m}{\DelimMin{2} \mathop{\textrm{ob}} #1}
% \NewDocumentCommand{\Mor}{m}{\DelimMin{2} \mathop{\textrm{mor}} #1}
\NewDocumentCommand{\Dom}{}{\mathop{\textrm{dom}}}
\NewDocumentCommand{\Cod}{}{\mathop{\textrm{cod}}}
\NewDocumentCommand{\PreM}{m}{- \circ #1}
\NewDocumentCommand{\PostM}{m}{#1 \circ -}
%% LIMITS
\NewDocumentCommand{\Colim}{o}{\DelimMin{2}{\varinjlim}_{#1}\,}
\NewDocumentCommand{\Lim}{}{\mathop{\text{Lim}}}
%% basic categories and constructions of categories
\NewDocumentCommand{\PSH}{m}{\DelimMin{2} \textbf{Psh}\DelimPrn{#1}}
\NewDocumentCommand{\FUNC}{mmO{}}{\DelimBrk{#1, #2}_{#3}}
\NewDocumentCommand{\SLICE}{mm}{#1 \mathbin{/} #2}
%% Kan and Nerves and Reindexing and Grothendieck
\NewDocumentCommand{\LKan}{smm}{\DelimMin{2}#2_{{!}}\IfBooleanTF{#1}{\DelimPrn{#3}}{#3}}
\NewDocumentCommand{\RKan}{smm}{\DelimMin{2}#2_{{*}}\IfBooleanTF{#1}{\DelimPrn{#3}}{#3}}
\NewDocumentCommand{\NerveS}{smm}{\DelimMin{2}{#2}^{{\star}}\IfBooleanTF{#1}{\DelimPrn{#3}}{#3}}
\NewDocumentCommand{\Geom}{m}{\DelimSurround{\vert}{\vert}{#1}}
\NewDocumentCommand{\Nerve}{m}{\mathcal{N}\DelimPrn{#1}}
\NewDocumentCommand{\Pre}{smm}{#2^*\IfBooleanTF{#1}{\DelimPrn{#3}}{#3}}
\NewDocumentCommand{\ReIdx}{smm}{\IfBooleanTF{#1}{\DelimPrn{#2}}{#2}^{-1}\DelimPrn{#3}}
\NewDocumentCommand{\Groth}{O{\CC}m}{\esh_{#1} #2}
\NewDocumentCommand{\PSHEL}{sm}{\mathop{\textsf{el}}\IfBooleanTF{#1}{\DelimPrn{#2}}{#2}}
\NewDocumentCommand{\PElem}{mmm}{\DelimPrn{#3 \in #1(#2)}}
% fibration macros
\NewDocumentCommand{\fib}{mmm}{\begin{tikzcd} #2 \arrow[d, "{#1}"] \\ #3 \end{tikzcd}}
\NewDocumentCommand{\lift}{mo}{\check{#1}\IfNoValueTF{#2}{}{\DelimPrn{#2}}}
%% TRANSPOSE
\NewDocumentCommand{\Transp}{m}{\DelimMin{2} \widebar{#1}}
%% YONEDA STUFF
\NewDocumentCommand{\Yo}{g}{\mathbf{y}\IfValueT{#1}{\DelimPrn{#1}}}
\NewDocumentCommand{\YoCov}{g}{\mathbf{h}\IfValueT{#1}{\DelimPrn{#1}}}
\NewDocumentCommand\YoEm{G{-}}{
\mathchoice{%
\mleft\lfloor\mkern-2mu{#1}\mkern-2mu\mright\rfloor
}{%
\mleft\lfloor\mkern-2mu{#1}\mkern-2mu\mright\rfloor
}{%
\lfloor #1 \rfloor%
}{%
\lfloor #1 \rfloor%
}%
}
% presheaf-specific macros
\NewDocumentCommand{\Open}{m}{\mathcal{O}(#1)}
\NewDocumentCommand{\Fam}{m m}{\DelimPrn{#1}_{#2}}
\NewDocumentCommand{\esh}{}{\textstyle\int}
\NewDocumentCommand{\DFIB}{}{\mathbf{DFib}}
\NewDocumentCommand{\lowerset}{}{\mathop{\downarrow}}
\NewDocumentCommand{\quiver}{}{\mathfrak{Q}}
\NewDocumentCommand{\Act}{mm}{#1 \mathbin{\cdot} #2}
%% PROFUNCTORIAL MACROS
\NewDocumentCommand{\PROF}{oo}{\textbf{Prof}\IfValueTF{#1}{\DelimPrn{#1, #2}}}
\NewDocumentCommand{\EPROF}{oo}{\textbf{EProf}\IfValueTF{#1}{\DelimPrn{#1, #2}}}
\NewDocumentCommand{\DIST}{oo}{\textbf{Dist}\IfValueTF{#1}{\DelimPrn{#1, #2}}}
\NewDocumentCommand{\pfto}{}{\relbar\joinrel\mapstochar\joinrel\rightarrow}
\NewDocumentCommand{\OpProf}{sm}{%
\IfBooleanTF{#1}{\DelimMin{1} \DelimPrn{#2}^\dagger}{#2^\dagger}
}
\NewDocumentCommand{\ActForward}{smm}{%
#2 \mathbin{\rhd} \IfBooleanTF{#1}{\DelimMin{2} \DelimPrn{#3}}{#3}
}
\NewDocumentCommand{\ActBackward}{smm}{%
\IfBooleanTF{#1}{\DelimMin{2} \DelimPrn{#2}}{#2} \mathbin{\lhd} #3
}
\NewDocumentCommand{\ReprProf}{omO{-}O{-}}{\Hom[#1]{#3}{#2 #4}}
%% COMPLETIONS
\NewDocumentCommand{\IND}{m}{\DelimMin{2} \textsf{Ind}\DelimPrn{#1}}
\NewDocumentCommand{\SIND}{m}{\DelimMin{2} \textsf{Sind}\DelimPrn{#1}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment