Skip to content

Instantly share code, notes, and snippets.

@mattecapu
Last active November 28, 2022 18:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattecapu/6dd75f1de1cb1ab71cb80617ab76ca21 to your computer and use it in GitHub Desktop.
Save mattecapu/6dd75f1de1cb1ab71cb80617ab76ca21 to your computer and use it in GitHub Desktop.
%
% MAMA package (MAth MAcros)
% a semantic package for mathematical symbols and fast latexing
%
% by Matteo Capucci <matteo.capucci@gmail.com>
%
% comment on an equation
\newcommand{\comment}[1]{\qquad\text{#1}}
% overset without decreasing font size
\newcommand{\Overset}[2]{%
\mathop{#2}\limits^{\vbox to -.1ex{%
\kern -1.8ex\hbox{$#1$}\vss}}%
}
% underset without decreasing font size
\newcommand{\Underset}[2]{%
\mathop{#2}\limits_{\vbox to .1ex{%
\kern -.6ex\hbox{$#1$}\vss}}%
}
% hyphen for math mode
\mathchardef\dash="2D
% defined term
\newcommand{\defining}[1]{\textbf{#1}}
% subject of a thesis
\renewcommand{\th}[1]{\overset{th}{#1}}
% e costant
\newcommand{\e}{\mathrm{e}}
% exp
\renewcommand{\exp}{\operatorname{exp}}
% cotangent
\newcommand{\cotan}{\operatorname{cotan}}
% argmin
\newcommand{\argmin}{\operatorname{argmin}}
% 'does not imply' symbol
\newcommand{\nimplies}{\centernot\implies}
% implications in the opposite direction
\newcommand{\implied}{\Longleftarrow}
\newcommand{\nimplied}{\centernot\implied}
% logical implication
\newcommand{\limp}{\rightarrow}
\newcommand{\liff}{\leftrightarrow}
% inhabitation for types
\newcommand{\tin}{\!:\!}
% inverses of \to
\newcommand{\ot}{\leftarrow}
\newcommand{\from}{\ot}
% long version of \to
\newcommand{\longto}{\longrightarrow}
% inverse of \mapsto
% \newcommand{\mapsfrom}{\mathrel{\reflectbox{\ensuremath{\mapsto}}}}
% \newcommand{\longmapsfrom}{\mathrel{\reflectbox{\ensuremath{\longmapsto}}}}
% inclusion
\newcommand{\into}{\hookrightarrow}
\newcommand{\inot}{\hookleftarrow}
\newcommand{\mono}{\rightarrowtail}
% surjection
\newcommand{\onto}{\twoheadrightarrow}
\newcommand{\epi}{\twoheadrightarrow}
% iso arrows
\newcommand{\isoto}{\overset{\sim}\to}
\newcommand{\isolongto}{\overset{\sim}\longto}
% 2-morphisms
\newcommand{\twoto}{\Rightarrow}
\newcommand{\isotwoto}{\overset{\sim}\twoto}
\newcommand{\longtwoto}{\Longrightarrow}
\newcommand{\isolongtwoto}{\overset{\sim}\longtwoto}
% 3-morphisms
\newcommand{\threeto}{\Rrightarrow}
\newcommand{\narrow}[2]{\overset{#1}{#2}}
\newcommand{\nto}[1]{\narrow{#1}{\to}}
\newcommand{\nfrom}[1]{\narrow{#1}{\from}}
\newcommand{\nlongto}[1]{\xrightarrow{#1}}
\newcommand{\ninto}[1]{\narrow{#1}{\into}}
\newcommand{\nisoto}[1]{\narrow{#1}{\isolongto}}
\newcommand{\nepi}[1]{\narrow{#1}{\epi}}
\newcommand{\nmono}[1]{\narrow{#1}{\mono}}
% 'a | b'
\newcommand{\divides}{\,|\,}
% constant function
\newcommand{\cost}{\text{cost.}}
\newcommand{\const}{\mathsf{const}}
% locutions
\newcommand{\word}[1]{\quad\text{\underline{#1}}\quad}
\@ifpackagewith{babel}{italian}{%
\newcommand{\almosteverywhereon}[2][\mu]{{\text{${#1}$-q.o. su ${#2}$}}}
\renewcommand{\ae}{\ \text{q.o.}}
\newcommand{\sse}{\word{sse}}
\newcommand{\means}{\word{significa}}
\newcommand{\impl}{\word{implica}}
\newcommand{\fa}{\ \text{p.o.}\;}
}{%
\newcommand{\almosteverywhereon}[2][\mu]{{\text{${#1}$-a.e. on ${#2}$}}}
\renewcommand{\ae}{\ \text{a.e.}}
\newcommand{\sse}{\word{iff}}
\newcommand{\means}{\word{means}}
\newcommand{\impl}{\word{implies}}
\newcommand{\fa}{\ \text{f.a.}\;}
}
% such that
\newcommand{\suchthat}{\mid}
% numerical sets
\newcommand{\N}{\mathbb{N}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\R}{\mathbb{R}}
%\newcommand{\C}{\mathbb{C}}
% set-theoretic stuff
\newcommand{\card}[1]{\left|{#1}\right|}
\newcommand{\parts}[1]{\mathcal{P}\left({#1}\right)}
\newcommand{\continuum}{\mathfrak{c}}
% diameter of a set
\newcommand{\diam}{\operatorname{diam}}
% vectors
\newcommand{\vers}[1]{\hat{\vv{#1}}}
\newcommand{\ii}{\vers{i}}
\newcommand{\jj}{\vers{j}}
\newcommand{\kk}{\vers{k}}
\newcommand{\xx}{\vv{x}}
\newcommand{\yy}{\vv{y}}
\newcommand{\zz}{\vv{z}}
% big kernel, cokernel & image
\newcommand{\Ker}{\operatorname{Ker}}
\newcommand{\coker}{\operatorname{coker}}
\newcommand{\Imm}{\operatorname{Im}}
\newcommand{\im}{\operatorname{im}}
% action of a group
\newcommand{\acts}{\curvearrowright}
% weak action groupoid
\newcommand{\wag}{\mathbin{/\mkern-6mu/}}
% direct sum
\newcommand{\dir}{\oplus}
\newcommand{\bigdir}{\bigoplus}
% operations in an Heyting algebra
\newcommand{\hey}{\Rightarrow}
\newcommand{\bigsup}{\bigvee}
\newcommand{\biginf}{\bigwedge}
% differential
\newcommand{\diff}[1]{\operatorname{d}{#1}}
% jacobian
\newcommand{\jac}{\operatorname{\vv{J}}}
% derivatives
\newcommand{\de}{\mathrm{d}}
\newcommand{\dx}{\de x}
\newcommand{\dt}{\de t}
\newcommand{\ds}{\de s}
\newcommand{\der}[2]{\frac{\de{#1}}{\de{#2}}}
\newcommand{\pder}[2]{\frac{\partial {#1}}{\partial {#2}}}
% second derivatives
\newcommand{\sder}[2]{\frac{\de^2{#1}}{\de{#2}^2}}
\newcommand{\spder}[3]{\frac{\partial^2{#1}}{\partial{#2} \partial{#3}}}
% second derivative on the same coordinate
\newcommand{\sdpder}[2]{\frac{\partial^2{#1}}{\partial{#2}^2}}
% big derivatives
\newcommand{\bigder}[2]{\dfrac{\strut \de{#1}}{\de{#2}}}
\newcommand{\bigpder}[2]{\dfrac{\strut \partial {#1}}{\partial {#2}}}
% big second derivatives
\newcommand{\bigsder}[2]{\dfrac{\strut \de^2 {#1}}{\de{#2}^2}}
\newcommand{\bigspder}[3]{\dfrac{\strut \partial^2 {#1}}{\partial {#2} \partial {#3}}}
% big second derivative on the same coordinate
\newcommand{\bigsdpder}[2]{\dfrac{\strut \partial^2 {#1}}{\partial {#2}^2}}
% left/right applied partial derivatives
\newcommand{\lpartial}{\overset{\leftarrow}\partial}
\newcommand{\rpartial}{\overset{\rightarrow}\partial}
% complex stuff
\newcommand{\conj}[1]{\overline{#1}}
\newcommand{\Arg}{\operatorname{Arg}}
\newcommand{\Res}{\operatorname{Res}}
% real and imaginary parts
\renewcommand{\Re}[1]{\mathfrak{Re}\left(#1\right)}
\renewcommand{\Im}[1]{\mathfrak{Im}\left(#1\right)}
% sign function
\newcommand{\sign}{\operatorname{}{sgn}}
% convergence
\newcommand{\conv}[1][]{\underset{{#1}}{\longrightarrow}}
% regularity classes
\newcommand{\Cn}{\mathcal{C}}
\newcommand{\Czero}{\Cn^0}
\newcommand{\Cone}{\Cn^1}
\newcommand{\Ctwo}{\Cn^2}
\newcommand{\Cinfty}{\Cn^\infty}
% Lipschitz
\newcommand{\Lip}{\mathrm{Lip}}
% indicator function
\newcommand{\ind}{\vv{1}}
% lenses
\newcommand{\lens}[2]{{#1 \choose #2}}
\renewcommand{\S}{\mathcal S}
\newcommand{\A}{\mathcal A}
\newcommand{\G}{\mathcal G}
\newcommand{\cat}[1]{\mathbf{#1}}
\newcommand{\dblcat}[1]{\cat{\mathbb #1}}
\newcommand{\trplcat}[1]{\cat{\mathfrak #1}}
\newcommand{\dblSet}{\dblcat{Set}}
\newcommand{\dblCat}{\dblcat{Cat}}
\newcommand{\Span}{\dblcat{Span}}
\newcommand{\DblCat}{\dblcat{DblCat}}
\newcommand{\DblIx}{\dblcat{Dbl}\dblcat{Ix}}
\newcommand{\MonDblIx}{\dblcat{Mon}\dblcat{Dbl}\dblcat{Ix}}
\newcommand{\Processes}{\dblcat{P}}
\newcommand{\CyberProcesses}{\trplcat{P}}
\newcommand{\Sys}{\cat{Sys}}
\newcommand{\Cyb}{\cat{Cyb}}
\newcommand{\CybSys}{\cat{CybSys}}
\newcommand{\Cont}{\cat{Cont}}
\newcommand{\doctrine}{\mathfrak{D}}
\newcommand{\theory}{\mathbb{T}}
\newcommand{\Theories}{\dblcat{Theories}}
\newcommand{\Behaviour}{\dblcat{Behav}}
\newcommand{\Obs}{\cat{Obs}}
\newcommand{\Org}{\dblcat{Org}}
\newcommand{\Poly}{\cat{Poly}}
\newcommand{\Moore}{\cat{Moore}}
\newcommand{\Games}{\cat{Games}}
\newcommand{\Players}{\cat{Plrs}}
\newcommand{\unilaxto}{\nlongto{\text{unitary lax}}}
\newcommand{\sys}[1]{\mathsf{#1}}
\newcommand{\dist}{\Delta}
\newcommand{\pow}{\mathcal{P}}
\newcommand{\cod}{\mathrm{cod}}
\newcommand{\dom}{\mathrm{dom}}
\newcommand{\st}{\mathrm{st}}
\newcommand{\nash}{\mathbf{n}}
\newcommand{\Sub}{\mathrm{Sub}}
\renewcommand{\H}{\mathcal H}
\newcommand{\K}{\mathcal K}
\newcommand{\U}{\mathcal U}
\renewcommand{\L}{\mathcal L}
\newcommand{\loss}{\ell}%{\mathsf{loss}}
\newcommand{\GD}{\mathsf{GD}}
\newcommand{\GF}{\mathsf{GF}}
\newcommand{\Comega}{{\mathchoice
{\rotatebox[origin=c]{180}{$\displaystyle \Omega$}}% \displaystyle
{\rotatebox[origin=c]{180}{$\textstyle \Omega$}}% \textstyle
{\rotatebox[origin=c]{180}{$\scriptstyle \Omega$}}% \scriptstyle
{\rotatebox[origin=c]{180}{$\scriptscriptstyle \Omega$}}% \scriptscriptstyle
}}
\DeclareMathOperator*{\Boxtimes}{\text{\raisebox{-0.25ex}{\scalebox{1.25}{$\boxtimes$}}}}
\newcommand{\Arenas}{\cat{Arenas}}
\newcommand{\Matrix}{\cat{Matrix}}
\newcommand{\fix}{\mathsf{fix}}
\renewcommand{\clock}{\text{\showclock{10}{10}}}
\newcommand{\Nature}{\mathcal N}
\newcommand{\eval}{\mathrm{eval}}
\newcommand{\curr}{\mathrm{curr}}
\newcommand{\true}{\mathsf{true}}
\newcommand{\view}{\mathsf{view}}
\newcommand{\play}{\mathsf{play}}
\newcommand{\coplay}{\mathsf{coplay}}
\newcommand{\expose}{\mathsf{expose}}
\newcommand{\update}{\mathsf{update}}
\renewcommand{\output}{\mathsf{output}}
\newcommand{\observe}{\mathsf{observe}}
\newcommand{\name}[1]{\lceil #1 \rceil}
\DeclareMathOperator{\argmax}{\mathrm{argmax}}
% identity
\newcommand{\identity}{\mathrm{id}}
\newcommand{\id}{\mathrm{id}}
% categories
\newcommand{\Ob}{\operatorname{Ob}}
\newcommand{\Hom}{\operatorname{Hom}}
\newcommand{\End}{\operatorname{End}}
\newcommand{\Aut}{\operatorname{Aut}}
\newcommand{\Nat}{\operatorname{Nat}}
% Kan extensions
\newcommand{\Lan}{\operatorname{Lan}}
\newcommand{\Ran}{\operatorname{Ran}}
% profunctor arrow
\newcommand{\profto}{\stackMath\mathrel{\stackinset{c}{-0.25ex}{c}{0.25ex}{\shortmid}{\to}}}
\newcommand{\longprofto}{\stackMath\mathrel{\stackinset{c}{-0.25ex}{c}{0.25ex}{\shortmid}{\longrightarrow}}}
\newcommand{\nprofto}[1]{\narrow{#1}{\profto}}
\newcommand{\horto}{\to}
\newcommand{\verto}{\stackMath\mathrel{\stackinset{c}{-0.25ex}{c}{0.25ex}{\bullet}{\to}}}
\newcommand{\longverto}{\stackMath\mathrel{\stackinset{c}{-0.25ex}{c}{0.25ex}{\bullet}{\longrightarrow}}}
\newcommand{\nhorto}[1]{\narrow{#1}{\horto}}
\newcommand{\nverto}[1]{\narrow{#1}{\verto}}
% big categories
\newcommand{\Cat}{\cat{Cat}}
\newcommand{\Prof}{\cat{Prof}}
\newcommand{\Set}{\cat{Set}}
\newcommand{\FinSet}{\cat{FinSet}}
\newcommand{\Mon}{\cat{Mon}}
\newcommand{\Grp}{\cat{Grp}}
\newcommand{\Mod}{\cat{Mod}}
\newcommand{\Ab}{\cat{Ab}}
\renewcommand{\Vec}{\cat{Vec}}
\newcommand{\Met}{\cat{Met}}
\newcommand{\Meas}{\cat{Meas}}
\newcommand{\Msbl}{\cat{Msbl}}
\newcommand{\Prob}{\cat{Prob}}
\newcommand{\Euc}{\cat{Euc}}
\newcommand{\Smooth}{\cat{Smooth}}
% opposite category
\newcommand{\op}{\mathsf{op}}
\newcommand{\co}{\mathsf{co}}
\newcommand{\coop}{\mathsf{coop}}
% isomorphism and equivalence symbols
\newcommand{\iso}[1][]{\overset{#1}{\cong}}
\newcommand{\equi}{\simeq}
% F left adjoint to G symbol
\newcommand{\adj}{\dashv}
\newcommand{\Para}{\cat{Para}}
\newcommand{\dblPara}{\dblcat{Para}}
\newcommand{\Proxy}{\cat{Proxy}}
\newcommand{\Copara}{\cat{Copara}}
\newcommand{\Optic}{\cat{Optic}}
\newcommand{\Lens}{\cat{Lens}}
\newcommand{\dblLens}{\dblcat{Lens}}
\newcommand{\DLens}{\cat{DLens}}
\newcommand{\DChart}{\cat{DChart}}
\newcommand{\Bun}{\mathrm{Bun}}
% monoidal products
\DeclareMathOperator{\extch}{\&}
\newcommand{\tensor}[1][\cat M]{\otimes_{#1}}
\newcommand{\mtimes}{\otimes}
\newcommand{\ntimes}{\oslash}
\newcommand{\ctimes}{\boxtimes}
\newcommand{\dtimes}{\boxdot}
\newcommand{\cplus}{\boxplus}
\newcommand{\copow}{\otimes}
% actions
\newcommand{\ostar}{\circledast}
\newcommand{\laction}{\smallblackdiamond}
\newcommand{\raction}{\diamond}
\newcommand{\waff}{\circledcirc}
\newcommand{\bothaction}{{\upperhalfcirc}}
\newcommand{\prodaction}{\bothaction^\times}
\newcommand{\coprodaction}{\bothaction^+}
\newcommand{\extchaction}{\bothaction^{\extch}}
% scaled & centered figures
\newcommand{\sctikzfig}[2][.8]{\begin{center}\scalebox{#1}{\tikzfig{#2}}\end{center}}
% fat semicolon
\newcommand{\comp}{\fatsemi}
% optic
\newcommand{\opticto}{\leftrightarrows}
\newcommand{\chartto}{\rightrightarrows}
\newcommand{\PsdMon}{\cat{PsdMon}}
\newcommand{\MonCat}{\twocat{M}\cat{onCat}}
\newcommand{\SymMonCat}{\twocat{S}\cat{ymMonCat}}
\newcommand{\BrMonCat}{\twocat{B}\cat{rMonCat}}
\newcommand{\Fib}{\twocat{F}\cat{ib}}
\newcommand{\OpFib}{\twocat{O}\cat{pFib}}
\newcommand{\deloop}{\twocat{B}}
\newcommand{\Kl}{\cat{Kl}}
\newcommand{\biKl}{\cat{biKl}}
\newcommand{\Alg}[1]{{#1}\dash\twocat{A}\cat{lg}}
\newcommand{\Bialg}[2]{({#1},{#2})\dash\twocat{B}\cat{iAlg}}
\newcommand{\lax}{\mathrm{lx}}
\newcommand{\oplax}{\mathrm{ox}}
\newcommand{\pseudo}{\mathrm{ps}}
\newcommand{\strict}{\mathrm{s}}
\newcommand{\braided}{\mathrm{br}}
\newcommand{\cart}{\mathrm{cart}}
\newcommand{\VCat}[1]{{#1}\dash\Cat}
\newcommand{\Actt}{\twocat{A}\cat{ct}}
\newcommand{\Act}[1]{{#1}\dash\Actt}
\newcommand{\Biactt}{\twocat{B}\cat{iact}}
\newcommand{\Biact}[2][\cat M]{{#1}\dash\Actt\dash{#2}}
\newcommand{\rev}{\mathrm{rev}}
\newcommand{\swap}{\mathrm{swap}}
\newcommand{\Bal}{\mathrm{Bal}}
\newcommand{\equalto}{=\mathrel{\mkern-3mu}=}
\newcommand{\Rho}{P}
\newcommand{\Alpha}{A}
\newcommand{\Day}{\mathrm{Day}}
\newcommand{\drinfeld}{\mathcal Z}
\newcommand{\Waff}{\cat W}
\makeatletter
\newcommand{\superimpose}[2]{%
{\ooalign{$#1\@firstoftwo#2$\cr\hfil$#1\@secondoftwo#2$\hfil\cr}}}
\makeatother
\newcommand{\revrel}[1]{\mathrel{\overset{\rev}{#1}}}
\newcommand{\colim}{\operatorname{colim}}
\newcommand{\rdev}{T^*}
\newcommand{\nopticto}[2]{\overset{#1}{\underset{#2}\opticto}}
\newcommand{\nchartto}[2]{\overset{#1}{\underset{#2}\chartto}}
\newcommand{\fflat}{{\flat\kern-1.4pt\flat}}
\newcommand{\hop}{\mathrm{hop}}
\newcommand{\vop}{\mathrm{vop}}
\newcommand{\trop}{\mathrm{top}}
\newcommand{\undertext}[2]{\underbrace{#1}_{\text{#2}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment