[Tex/LaTex] Using ‘xfrac’ with ‘mathrsfs’

fontsfontsizewarningsxfrac

I'm attempting to move from the nicefrac package to xfrac. The following source compiles, but with a warning:

\RequirePackage{fix-cm}
\documentclass{article}
\usepackage{xfrac}
\usepackage{mathrsfs}
\begin{document}
  $\sfrac{1}{2}$
\end{document}

LaTeX Font Warning: Font shape 'U/rsfs/m/n' in size <3.49998> not available

It appears as though xfrac attempts to load all current math alphabets in its typeset size, even if they are not used in the fraction. Is there a variant of rsfs that supports fractional sizes? Or a way to prevent xfrac from loading it unless it is needed?

Basically, I'd like to suppress this warning unless LaTeX is actually typesetting a glyph from rsfs at a fractional size. Is this possible?

Best Answer

Fixed font sizes of rsfs font in NFSS scheme is declared in ursfs.fd. It contains

\ProvidesFile{ursfs.fd}[1998/03/24 rsfs font definition file (jk)]
\DeclareFontFamily{U}{rsfs}{\skewchar\font127 }
\DeclareFontShape{U}{rsfs}{m}{n}{%
   <5> <6> rsfs5
   <7> rsfs7
   <8> <9> <10> <10.95> <12> <14.4> <17.28> <20.74> <24.88> rsfs10
}{}

Now you can modify it for continuous font sizes. You can just put the code in preamble:

\RequirePackage{fix-cm}
\documentclass{article}
\usepackage{xfrac}
\usepackage{mathrsfs}
\DeclareFontFamily{U}{rsfs}{\skewchar\font127 }
\DeclareFontShape{U}{rsfs}{m}{n}{%
   <-6> rsfs5
   <6-8> rsfs7
   <8-> rsfs10
}{}
\begin{document}
  $\sfrac{1}{2}$
\end{document}
Related Question