Is there a latex command to print the name of the font used for text and for math?

My answer can be improved for math, but it has up to 16 groups, you can check what \makeatletter\meaning\mv@normal\makeatother produces to get an idea of what is involved.

\documentclass[12pt]{article}
\usepackage{amsmath}

\usepackage[T1]{fontenc}
\usepackage{fourier}
\usepackage{baskervald}

\begin{document}

%\footnote{This document was compiled using text font \textFontName 
%and math font \mathFontName} 

This is some math $\sin(x)$.

\makeatletter
\edef\textFontName{\fontname\csname
  \f@encoding/\f@family/\f@series/\f@shape/\f@size\endcsname}
\edef\mathFontName{\fontname\textfont0}
\edef\mathLetterFontName{\fontname\textfont1}
\makeatother

See\footnote{Text Font: \textFontName

Math Operator Font: \mathFontName

Math Letter Font: \mathLetterFontName\par
}
\end{document}

enter image description here


With xetex:

\documentclass[12pt]{article}
\usepackage{amsmath}

\usepackage{fontspec}

\begin{document}

%\footnote{This document was compiled using text font \textFontName 
%and math font \mathFontName} 

This is some math $\sin(x)$.

\makeatletter
\edef\textFontName{\fontname\csname
  \f@encoding/\f@family/\f@series/\f@shape/\f@size\endcsname}
\edef\mathFontName{\fontname\textfont0}
\edef\mathLetterFontName{\fontname\textfont1}
\makeatother

See\footnote{Text Font: \texttt{\textFontName}

Math Operator Font: \texttt{\mathFontName}

Math Letter Font: \texttt{\mathLetterFontName}\par
}
\end{document}

enter image description here

Tags:

Fonts