Here’s a list of some fonts:

- second
\mathcal
requires eucal
package
\mathbb
requires amsfonts
package
\mathscr
requires mathrsfs
package
- not all of them support lowercase and/or greek letters
\mathtt
is misisng in the image
But I strongly recommend not to use them directly but instead define a new markup macro like
\newcommand*{\StateSpace}[1]{\mathcal{#1}}
and then use it like
$\StateSpace{X}$
(shorter names are certainly possible, like \stsp{X}
)
Doing this would be in the sense of TeX’s separation of content/structure and design/layout, i.e. logical markup instead of fixed formatting. Furthermore in this case it is easy to change the appearance later constant win the whole document, for example if your editor/publisher wants another style.
Can I use \mathsf{A}
in bold??
If you got only latin letters (or a text font supporting greek) you could use the text font for this and define
\newcommand*{\myvar}[1]{%
\mathord{\mbox{%
\sffamily\bfseries\itshape
#1%
}}%
}
(I added also \itshape
because usually variable are set in italics.)
Another way is to define a new math alphabet: Bold , italic (and sans-serif) math symbols
How can I also incorporate a subscript in the \newcommand
that you defined?
First, a note: It should be $\myvar{X}_{test}$
(the subscript outside of the variable argument). Furthermore If the subscript is a text like “max”, “eff.”, “min” etc. you should use \text
from amsmath
package! Only if the subscript is a variable itself (n, i, …) or a number you should write it like x_i
.
If the subscript is always the same (text) you could just add it to the above definition:
\usepackage{amsmath}
\newcommand*{\myvar}[1]{%
\mathord{\mbox{%
\sffamily\bfseries\itshape
#1%
}}%
_{\mkern2mu\text{text}}%
}
(The \mkern2mu
part insert a little space to shift the subscript a little to the right, which looks better.)
If you always have a subscript but a different one each time you can add a second mandatory argument:
\usepackage{amsmath}
\newcommand*{\myvar}[2]{%
\mathord{\mbox{%
\sffamily\bfseries\itshape
#1%
}}%
_{\mkern2mu\text{#2}}%
}
and use it like $\myvar{X}{test}$
.
If the subscript is optional you could use an optional argument which could be defined with \newcommand
too but the test for an empty argument is easier with \NewDocumentCommand
form the xparse
package:
\usepackage{amsmath,xparse}
\NewDocumentCommand{\myvar}{ o m }{
\mathord{\mbox{%
\sffamily\bfseries\itshape
#2%
}}%
\IfValueT{#1}{_{\mkern2mu\text{#1}}}%
}
and use it like $\myvar{X}$
or $\myvar[test]{X}$
. It is also possible to change the order of the arguments by replacing o m
with m o
, #1
with #2
and vice versa. Then the second argument would be optional but it could be problematic if the major without optional argument should be followed by a bracket.
s
, no less), and it's practically unreadable. You can else use arrow, bars, dots, whatever above and below instead (easier to read aloud, too). Just my opinion, obviously.`
, they'll be marked as code, as can be seen in my edit. You can also highlight the code and click the "code" button (with "{}" on it).