Skip to content

Instantly share code, notes, and snippets.

@nidrissi
Last active Apr 19, 2022
Embed
What would you like to do?
%%% Dark magic
\makeatletter
\def\font@loop#1{% define a loop
\ifx\relax#1% if we get to \relax, do nothing
\else% otherwise...
% define \cA=\mathcal{A}, etc
\expandafter\def\csname c#1\endcsname{\mathcal{#1}}
% define \sA=\mathsf{A}, etc
\expandafter\def\csname s#1\endcsname{\mathsf{#1}}
% define \bA=\mathbf{A}, etc
\expandafter\def\csname b#1\endcsname{\mathbf{#1}}
% define \fA=\mathfrak{A}, etc
\expandafter\def\csname f#1\endcsname{\mathfrak{#1}}
% define \AA=\mathbb{A}, etc
% warning: \AA and \SS are predefined LaTeX commands!
\expandafter\def\csname #1#1\endcsname{\mathbb{#1}}
\expandafter\font@loop%
\fi}
% call the loop
\font@loop ABCDEFGHIJKLMNOPQRSTUVWXYZ\relax
\makeatother
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment