Skip to content

Instantly share code, notes, and snippets.

@nidrissi
Last active April 19, 2022 16:21
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 nidrissi/6d648cc108a2afad246abc197bdc1157 to your computer and use it in GitHub Desktop.
Save nidrissi/6d648cc108a2afad246abc197bdc1157 to your computer and use it in GitHub Desktop.
%%% 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