Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

How to define a math command that displays a variable in a specific font? E.g. usage \MyMathCommand{P}.

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

You could use

\newcommand{\MyMathCommand}[1]{\mathbf{#1}}

which would print the variable in boldface (perhaps typical of matrix or vector notation). There is also \mathit (for italic math) and \mathsf (for sans serif fonts). These can be mixed in some fonts. You may be interested also in \mathcal (for calligraphy-style letters, perhaps used in set notation) or something else altogether.

If you wish for this command to work in either text or math mode, you can use:

\newcommand{\MyMathCommand}[1]{\ensuremath{\mathbf{#1}}}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.