[Tex/LaTex] How to determine the font being used by a latex document


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?

Best Answer

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.

Related Question