The scenario is as follows. I am working on a paper using the IEEEtran latex class. I am generating some figures using the Matplotlib plotting library in Python. Matplotlib lets the user adjust the font and compile figures with the help of tex so that you can get nice looking fonts in your figure labels which match the font used in the document the figures are going into. What I would like to know though, is what font is the IEEEtran class actually using so that I can configure Matplotlib to use the same font?

I guess this problem generalizes beyond IEEEtran which I happen to be using. Short of eyeballing a font, is there a reliable way to determine which font is being used at a given point in a document? I'm guessing the font can be overridden in any one of a million possible places, so I'm really interested in knowing whether there is a generalized solution that isn't "read through the manual of whatever class files/other files you're using until you figure it out". Is there a command I can put inline in the middle of a paragraph or something that will tell me the font details in the current context?

  • 1
    Export your data to pgfplots and you don't need to tweak anything at all. – percusse Apr 20 '13 at 6:45
  • 1
    @percusse I have complex plots generated in matplotlib - I'd rather not learn yet another plotting library just for the sake of figure insertion. – Bryce Thomas Apr 20 '13 at 8:34
  • 1
    We'll talk again when IEEE sends back the article for the final proof :) – percusse Apr 20 '13 at 8:38

To show the font at the current point you can use


TeX will stop as if for an error message (just hit return and it will carry on) the message will look something like

> \OT1/cmr/m/n/10 .
<recently read> \font 

which means classic (OT1) font encoded computer modern roman (cmr) medium weight (m) normal shape (n) 10pt (10) font.

Alternatively (or as well) you can use


In which case you get (in this document)

> \OT1/cmr/m/n/10=select font cmr10.
<inserted text> \OT1/cmr/m/n/10 

which tells you that the actual font metric file is cmr10.tfm That possibly more closely corresponds to the font name to use in other applications.

  • is there a source to decipher other strings? e.g., I get ptm instead of cmr, where do I translate this to a font? – Federico Mar 7 '17 at 16:04
  • 1
    @Federico ptm is times roman see the document texdoc fontname – David Carlisle Mar 7 '17 at 16:14
  • 2
    I'm using overleaf, and unfortunately this doesn't seem work at all. I just put \showthe\font at a point in the middle of the document but overleaf seems to compile as if it weren't there. Am I doing something wrong? – aquirdturtle Oct 11 '18 at 0:07
  • overleaf is most likely running in nonstopmode so tex won't stop but the value will be in the log file, which you must be able to see somehow in the interface @aquirdturtle, or use \the instead of \showthe then it will typeset the result in the document rather than the log – David Carlisle Oct 11 '18 at 0:10
  • 1
    Hmm, neither \expandafter\show\the\font or \the\font would make it render in the pdf, but I did eventually find it in the log files after I figured out that I needed to open the "raw logs". Thanks. – aquirdturtle Oct 11 '18 at 0:27

To answer your first question, IEEEtran class uses times.sty, i.e.

  • Times for \textrm
  • Helvetica for \textsf
  • Courier for \texttt

you should create a MWE with the IEEE class. The resulted pdf can be analyzed with pdffonts (on Linux). In a MWE, not so much fonts should be included. Not the smartest way, but hopefully a step to solve the issue.

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