# Check if mathversion (font) is defined

One can define a new mathversion using \DeclareMathVersion{sans}.

I wonder if I can test the existence of such a font definition, for example with

\IfMathVersionDefined{sansmath}
{math font is defined}
{math font is not defined}

-

Are you just looking for this?

\makeatletter
\newcommand{\IfMathVersionDefined}[3]{%
\expandafter\@ifundefined\csname mv@#1\endcsname{#3}{#2}%
}
\makeatother


The above is motivated by the fact that \DeclareMathVersion{#1} defines \mv@#1.

-
Exactly. I failed to find the code where this is defined. – Matthias Pospiech Jan 12 '12 at 20:39
\documentclass{article}

\DeclareMathVersion{blub}

\begin{document}
\ifcsname mv@blub\endcsname
math version blub exist
\else
math version blub  doesnt exist
\fi

\ifcsname mv@bla\endcsname
math version bla exist
\else
math version bla doesnt exist
\fi

\end{document}

-