0

I typically create new commands for every capital letter in \mathsf, \mathbb, and \mathcal.

# Sans-serif capital letters
\newcommand{\Asf}{\mathsf{A}}
\newcommand{\Bsf}{\mathsf{B}}
.
.
.
\newcommand}{\Zsf}{\mathsf{Z}}

# Bold math capital letters
\newcommand{\Abb}{\mathbb{A}}
\newcommand{\Bbb}{\mathbb{B}}
.
.
.
\newcommand{\Zbb}{\mathbb{Z}}

Is it possible to do this automatically in a for loop?

10
  • yes you could but is \Abb really easier than \mathbb A or (even) \bb A which just needs \let\bb\mathbb Sep 20, 2023 at 15:54
  • 1
    Maybe you need an editor with better autocomplete …
    – cabohah
    Sep 20, 2023 at 15:56
  • 1
    don't you get an error for \newcommand{\Bbb}{\mathbb{B}} ? Sep 20, 2023 at 16:41
  • 1
    only if you ignore big red circles with an error count. @Werner Sep 20, 2023 at 16:46
  • 1
    never ignore errors, after any error if you scroll past it, any generated pdf is at best a debugging aid, not usable. \Bbb is an old command to access blackboard bold, kept for compatibility, if you redefine it you break any code (perhaps in a package) that is using it, so it is up to you to check, I can't tell you if it breaks anything in your document @Physics_Student Sep 20, 2023 at 23:08

1 Answer 1

2

I wouldn't do this but

enter image description here

\documentclass{article}
\usepackage{amsfonts}
\let\Bbb\relax% sigh
\ExplSyntaxOn
\clist_map_inline:nn
{sf,bb,cal}
{\int_step_inline:nnn {`A} {`Z} 
{
\cs_new:cpn{
  \char_generate:nn{##1}{12}#1}{\cs:w math#1\cs_end
                                              {\char_generate:nn{##1}{12}}}}
}

\ExplSyntaxOff
\begin{document}

$ \Qbb + \Zsf $

\end{document}

Not the answer you're looking for? Browse other questions tagged .