TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
up vote 2 down vote accepted

You could use


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:

share|improve this answer

Your Answer


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.