[Tex/LaTex] siunitx does not detect typeface and size

sharelatexsiunitx

I am using a template from PNAS (http://www.pnas.org/site/authors/LaTex.xhtml) on sharelatex and when I am adding units like:

\SI{15}{\mL}

they are not scaled properly, as seen in the attached image.
Example of siunitx not scaled properly
Moreover, is there a way that I could force siunitx to use the surrounding fonts. I have tried to use in the preamble:

\sisetup{detect-weight=true, detect-family=true}

with no luck.
Any help would be appreciated.

Edit 1: Minimal example added

\documentclass{pnastwo}
\usepackage[dvips]{graphicx}
\usepackage{amssymb,amsfonts,amsmath}
\usepackage{gensymb,fixltx2e}
\usepackage{fontspec}
\usepackage{siunitx}
\sisetup{detect-weight=true, detect-family=true}

\begin{document}
\begin{article}
\begin{materials}
This is a minimal example. The following units \SI{15}{\mL} do not render with the same typeface and size as the surrounding text. 
\end{materials}
\end{article}
\end{document}

Best Answer

The class doesn't use nfss to define fonts and so siunitx has absolutly no chance to detect the font (and as a side-warning: be careful with non-ascii chars. In the combination with xelatex/lualatex they can come out wrong or be missing all together). You can get around the problem by redefining the font commands:

\documentclass{pnastwo}

\usepackage{graphicx}
\usepackage{amssymb,amsfonts,amsmath}
\usepackage{gensymb,fixltx2e}
\usepackage{fontspec}
\renewcommand\materialfont{\sffamily\fontsize{7pt}{\baselineskip}\selectfont}
\usepackage{siunitx}
\sisetup{detect-weight=true, detect-family=true}

\begin{document}
\begin{article}
\begin{materials}
This is a minimal example. The following units \SI{15}{\mL} do not render with the same typeface and size as the surrounding text.
\end{materials}
\end{article}
\end{document}