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

What is the cleanest way to redefine math-mode font commands such as \mathrm and \mathit?

I would like everything else to be unaffected; for example, perhaps I enjoy working with mathptmx and I want to keep its \mathnormal, but I want to change \mathrm and mathit to use a different font.



Some text.

Some formula: \(abc = de/f \quad[\mathrm{var}, \mathit{val}]\)

\(\mathnormal{abc = de/f}\)

var, \textit{val}

\(\mathrm{var}, \mathit{val}\)

% Bitstream Charter
{\fontfamily{bch}\fontseries{m}\fontshape{n}\selectfont  var,
 \fontfamily{bch}\fontseries{m}\fontshape{it}\selectfont val}

% Linux Biolinum
{\fontfamily{LinuxBiolinumT-OsF}\fontseries{m}\fontshape{n}\selectfont  var,
 \fontfamily{LinuxBiolinumT-OsF}\fontseries{m}\fontshape{it}\selectfont val}

% Linux Libertine
{\fontfamily{LinuxLibertineT-OsF}\fontseries{m}\fontshape{n}\selectfont  var,
 \fontfamily{LinuxLibertineT-OsF}\fontseries{m}\fontshape{it}\selectfont val}

share|improve this question
Using Charter for \mathrm when the main font is Times is a typographic nonsense. – egreg Dec 14 '13 at 15:39
@egreg I'm not sure I feel that strongly about it :-) but sometimes a bit of variety serves illustrative purposes, to give examples for the question. – Lover of Structure Dec 14 '13 at 15:50
@egreg (bch is way better than some of the other choices that'd look outrageous in math mode.) – Lover of Structure Dec 14 '13 at 15:58
up vote 4 down vote accepted

Just redefine the macros \mathrm and \mathit to use a different font: the interface is


You can also supplement the font for a different math version: say also


for defining the font to be used in a \boldmath (or \mathversion{bold}) context.

An example follows. But beware that using Charter for \mathrm and \mathit is a typographical nonsense. Here's the visual proof of my claim.



Some text.

Some formula: \(abc = de/f \quad[\mathrm{var}, \mathit{val}]\)

Some formula: \(\mathit{abc}=\mathit{de}/\mathit{f}\)


enter image description here

Instead of \DeclareMathAlphabet one can define a substitute that won't eat up math families:


and use it as


or even

share|improve this answer
What function does the OT1 serve? (I know it's about the "encoding", but practically what does that mean here? Somewhere in the preamble I have the line \usepackage[T3,T1]{fontenc}, with T3 included for tipa. Are there alternatives to OT1?) – Lover of Structure Dec 14 '13 at 15:47
@LoverofStructure Not really; with \mathrm you should only use ASCII characters. – egreg Dec 14 '13 at 15:51
@LoverofStructure No, OT1 is predefined. – egreg Dec 14 '13 at 15:58
@LoverofStructure Using \fontfamily doesn't work in math mode. – egreg Dec 14 '13 at 16:59
@LoverofStructure The math families are allocated only when expressly requested in a math formula for the first time. – egreg Dec 23 '13 at 17:59

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.