In order to separate the content structure from the style, I decided to implement commands for denoting random variables:
\newcommand{\myrv}[1]{\mathbf{#1}}
\newcommand{\rvA}{\myrv{A}}
\newcommand{\rvB}{\myrv{B}}
\newcommand{\rvC}{\myrv{C}}
...
This way, if I ever decide to change the style of random variables from \mathbf
to say \mathbb
,
all I need to do is to change the definition of \myrv
.
Is a way to generate the commands \rvA
, \rvB
, \rvC
, …
automatically?
Best Answer
There are other similar questions, but none that treats explicitly this problem, as far as I can see.
The
\show
command are just to see that it worked. The terminal output isAn extended version using
expl3
:The syntax of
\generate
is a bit different: the first argument is the starting point, the second argument is the end point; the third argument is the format for the name and the fourth argument is the format for the required definition, where#1
stands for the current letter in the cycle.The examples should make their meanings clear.
Here's the output on the terminal, just for checking.