Skip to content

Support LaTeX macros#152

Merged
ScriptRaccoon merged 27 commits into
mainfrom
latex-macros
May 3, 2026
Merged

Support LaTeX macros#152
ScriptRaccoon merged 27 commits into
mainfrom
latex-macros

Conversation

@ScriptRaccoon
Copy link
Copy Markdown
Owner

@ScriptRaccoon ScriptRaccoon commented May 3, 2026

This PR enables LaTeX macros.

Before

\mathrm{Hom}(\mathbb{N},\mathbb{N}) \cong \mathbb{N}

After

\Hom(\IN,\IN) \cong \IN

Luckily, katex supports macros out of the box. We just need to pass a dictionary with the macros.

Many macros have already been defined. The replacements have been done in hundreds of places.

Macro Expansion Category
\IN \mathbb{N} blackboard bold
\IZ \mathbb{Z} blackboard bold
\IQ \mathbb{Q} blackboard bold
\IR \mathbb{R} blackboard bold
\IC \mathbb{C} blackboard bold
\IF \mathbb{F} blackboard bold
\IB \mathbb{B} blackboard bold
\IA \mathbb{A} blackboard bold
\IP \mathbb{P} blackboard bold
\A \mathcal{A} calligraphic
\B \mathcal{B} calligraphic
\C \mathcal{C} calligraphic
\D \mathcal{D} calligraphic
\E \mathcal{E} calligraphic
\F \mathcal{F} calligraphic
\I \mathcal{I} calligraphic
\J \mathcal{J} calligraphic
\O \mathcal{O} calligraphic
\S \mathcal{S} calligraphic
\op \mathrm{op} abbreviation
\c \mathrm{c} abbreviation
\f \mathrm{f} abbreviation
\fg \mathrm{fg} abbreviation
\fp \mathrm{fp} abbreviation
\ab \mathrm{ab} abbreviation
\reg \mathrm{reg} abbreviation
\Mor \operatorname{Mor} operator
\Hom \operatorname{Hom} operator
\End \operatorname{End} operator
\Ob \operatorname{Ob} operator
\id \operatorname{id} operator
\card \operatorname{card} operator
\colim \operatorname{colim} operator
\im \operatorname{im} operator
\lcm \operatorname{lcm} operator
\Spec \operatorname{Spec} operator
\Sh \operatorname{Sh} operator
\ord \operatorname{ord} operator
\diag \operatorname{diag} operator
\Sub \operatorname{Sub} operator
\Quot \operatorname{Quot} operator
\supp \operatorname{supp} operator
\Coexp \operatorname{Coexp} operator
\Set \mathbf{Set} category
\Rel \mathbf{Rel} category
\Ab \mathbf{Ab} category
\Grp \mathbf{Grp} category
\Vect \mathbf{Vect} category
\Ring \mathbf{Ring} category
\Alg \mathbf{Alg} category
\CRing \mathbf{CRing} category
\CAlg \mathbf{CAlg} category
\Rng \mathbf{Rng} category
\Mon \mathbf{Mon} category
\CMon \mathbf{CMon} category
\Mod \mathbf{Mod} category
\Fld \mathbf{Fld} category
\FinAb \mathbf{FinAb} category
\FinGrp \mathbf{FinGrp} category
\FreeAb \mathbf{FreeAb} category
\TorsFreeAb \mathbf{TorsFreeAb} category
\Cat \mathbf{Cat} category
\Ban \mathbf{Ban} category
\Meas \mathbf{Meas} category
\Met \mathbf{Met} category
\PMet \mathbf{PMet} category
\Top \mathbf{Top} category
\Haus \mathbf{Haus} category
\sSet \mathbf{sSet} category
\Man \mathbf{Man} category
\LRS \mathbf{LRS} category
\Sch \mathbf{Sch} category
\Pos \mathbf{Pos} category
\Prost \mathbf{Prost} category
\FinOrd \mathbf{FinOrd} category
\FinSet \mathbf{FinSet} category
\FI \mathbf{FI} category
\FS \mathbf{FS} category
\Sp \mathbf{Sp} category
\0 \mathbf{0} category
\1 \mathbf{1} category
\2 \mathbf{2} category
\On \mathbf{On} category
\RS \mathbf{RS} category
\CoAlg \mathbf{CoAlg} category
\Cone \mathbf{Cone} category

@ScriptRaccoon ScriptRaccoon merged commit 7e8b777 into main May 3, 2026
1 check passed
@ScriptRaccoon ScriptRaccoon deleted the latex-macros branch May 3, 2026 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant