I know there is probably several answers about this in tex.stackexchange.com, but they tend to be very technical and difficult to understand or they have really long codes of more than 5 lines, so is there a simple way to change fonts, including math fonts inline in Latex, that is in PDFLatex (NOT LuaTex or XeLatex) ?

right now I'am trying to use the $\varepsilonup$ of the txfonts package instead of the usual $\varepsilon$ of the standard Computer Modern that I don't like because it is made with lines that are too thin and doesn't match the rest of the font, but I don't want to change all of my text to the txfonts package since I am making a beamer presentation and I would like to keep the global font as being \documentclass[serif]{beamer}.

But this is a recurring thing with me because I like to write my texts in a highly stylised way, and in other ocasions I always hit this wall when it comes to using other fonts in only some sections of the text or of using other specific glyphs of other fonts, be them mathematical or not, and since I am asking this, I would also like to ask how to input in a Latex document a specific "user made" font or glyph, I know this can be done because afriend of mine used a pdf file of a stylised 'r' glyph that David Griffiths uses in his book on eletrodynamics and that he disponibilizes this glyph in his site for download, so there is some way to make this pdf file of a glyph into a font element instead of a simple image to be put in the Latex. I am asking this because although I am somewhat satisfied with the epsilon from txfonts it is still not exactly what I have in mind as the ideal epsilon and I am somewhat close to finishing a epsilon glyph in metapost, that is, it will generate a pdf or svg file from code and I still dont know how to use this file as a font glyph in Latex. I also would like to re-make that classical mathematical font that was used in mathematics texts and text-books in the end of the 19th century and beguining of the 20th century, that all familiar font that was used in texts such as G.H. Hardy "A course of pure mathematics", his orientator book in mechanics E. T. Whittaker's "A treatise on classical dynamics", Courant's books in Differential and Integral Calculus, perhaps Fermi's book of Thermodynamics, etc. I once asked about this in a fonts reddit and first someone said that it was Computer Modern which is obviously false, latter he said that Computer Modern was made to immitate that font and latter he said it is a font, or type of font or family of fonts, apparently called Scotch Roman, but I can't seem to find a decent one to use in my texts, so I will try to make one myself as a hobby in the future.


If you’re using OpenType math fonts with unicode-math, there’s a standard command for this. For example,

\setmathfont{Latin Modern Math}
\setmathfont{TeX Gyre Termes Math}[range=\mitvarepsilon]

In unicode-math, mathematical italic letters begin with \mit, mathematical upright letters with \mup, bold upright letters with \mbfup, etc. See the symbol list for a complete listing.

My advice is to use unicode-math for your Beamer presentations, unless there is some specific reason that won’t work for a particular document. You aren’t submitting your Beamer source to one of the journals that still hasn’t upgraded from 8-bit fonts in 2021.

In legacy LaTeX, you want to open up the .sty file, find the lines of code that define the symbol you want to use and the symbol font that contains it, and copy those. Typically, this will be a \DeclareSymbolFont command followed by \DeclareMathSymbol, but newtxmath is one of the packages that makes it more complicated. The commands are split between newtxmath.sty and untxmia.fd, and need some modification to work in a stand-alone document. Unfortunately, the code will be different for every package.

\usepackage{amsmath, amssymb}

\DeclareFontFamily{U}{ntxmia}{\skewchar \font =127}
  <-> ntxmia}{}    
  <-> ntxbmia}{}

\DeclareFontShape{U}{ntxmia}{m}{sl}{<->ssub * ntxmia/m/it}{}
\DeclareFontShape{U}{ntxmia}{bx}{it}{<->ssub * ntxmia/b/it}{}
\DeclareFontShape{U}{ntxmia}{b}{sl}{<->ssub * ntxmia/b/it}{}
\DeclareFontShape{U}{ntxmia}{bx}{sl}{<->ssub * ntxmia/b/sl}{}


Computer Modern \(\epsilon\), newtx \(\varepsilon\).

{\bfseries\boldmath Computer Modern  \(\epsilon\), newtx \(\varepsilon\).}

Also be aware that legacy TeX limits you to sixteen 8-bit math alphabets, and this will use up one of them. You can work around this by declaring a symbol to switch to text mode.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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