How to use Alegreya Sans for math mode on pdfLaTeX
You can use newtxsf
for the Greek letters and mathastext
:
\documentclass{scrartcl}
\usepackage{newtxsf}
\usepackage[sfdefault]{AlegreyaSans}
\usepackage[italic]{mathastext}
\begin{document}
This is in Alegreya Sans, with math
$E=mc^2$ and $\sin(\alpha+\beta)=\pi$
\[
\int_{-\infty}^{\infty}e^{-x^2}\,dx=\sqrt{\pi}
\]
\boldmath Also bold math
$E=mc^2$ and $\sin(\alpha+\beta)=\pi$
\[
\int_{-\infty}^{\infty}e^{-x^2}\,dx=\sqrt{\pi}
\]
\end{document}
For serif text and sans serif math (but why?), you can use a trick suggested in the manual of mathastext
:
\documentclass{scrartcl}
\usepackage{newtxsf}
\usepackage{Alegreya,AlegreyaSans}
\renewcommand\familydefault\sfdefault
\usepackage[italic]{mathastext}
\renewcommand\familydefault\rmdefault
\begin{document}
This is in Alegreya Sans, with math
$E=mc^2$ and $\sin(\alpha+\beta)=\pi$
\[
\int_{-\infty}^{\infty}e^{-x^2}\,dx=\sqrt{\pi}
\]
\boldmath Also bold math
$E=mc^2$ and $\sin(\alpha+\beta)=\pi$
\[
\int_{-\infty}^{\infty}e^{-x^2}\,dx=\sqrt{\pi}
\]
\end{document}
\documentclass{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{Alegreya,AlegreyaSans}
\DeclareMathAlphabet{\mathrm} {T1}{AlegreyaSans-LF}{m}{n}
\SetMathAlphabet{\mathrm}{bold}{T1}{AlegreyaSans-LF}{b}{n}
\DeclareMathAlphabet{\mathit} {T1}{AlegreyaSans-LF}{m}{it}
\SetMathAlphabet{\mathit}{bold}{T1}{AlegreyaSans-LF}{b}{it}
\DeclareMathAlphabet{\mathbf} {T1}{AlegreyaSans-Bold-lf-t1}{b}{n}
\SetMathAlphabet{\mathbf}{bold}{T1}{AlegreyaSans-Bold-lf-t1}{b}{n}
\DeclareSymbolFont{operators} {T1}{AlegreyaSans-LF}{m}{n}
\SetSymbolFont{operators}{bold}{T1}{AlegreyaSans-LF}{b}{n}
\DeclareSymbolFont{letters} {T1}{AlegreyaSans-LF}{m}{it}
\DeclareSymbolFont{lettersA} {OML}{zplm}{m}{it}% for greek letters
\SetSymbolFont{letters}{normal}{T1}{AlegreyaSans-LF}{m}{it}
\SetSymbolFont{letters}{bold} {T1}{AlegreyaSans-LF}{b}{it}
\DeclareMathSymbol{\alpha}{\mathalpha}{lettersA}{"0B}
\DeclareMathSymbol{\beta}{\mathalpha}{lettersA}{"0C}
\DeclareMathSymbol{\gamma}{\mathalpha}{lettersA}{"0D}
\DeclareMathSymbol{\delta}{\mathalpha}{lettersA}{"0E}
\DeclareMathSymbol{\epsilon}{\mathalpha}{lettersA}{"0F}
\DeclareMathSymbol{\zeta}{\mathalpha}{lettersA}{"10}
\DeclareMathSymbol{\eta}{\mathalpha}{lettersA}{"11}
\DeclareMathSymbol{\theta}{\mathalpha}{lettersA}{"12}
\DeclareMathSymbol{\iota}{\mathalpha}{lettersA}{"13}
\DeclareMathSymbol{\kappa}{\mathalpha}{lettersA}{"14}
\DeclareMathSymbol{\lambda}{\mathalpha}{lettersA}{"15}
\DeclareMathSymbol{\mu}{\mathalpha}{lettersA}{"16}
\DeclareMathSymbol{\nu}{\mathalpha}{lettersA}{"17}
\DeclareMathSymbol{\xi}{\mathalpha}{lettersA}{"18}
\DeclareMathSymbol{\pi}{\mathalpha}{lettersA}{"19}
\DeclareMathSymbol{\rho}{\mathalpha}{lettersA}{"1A}
\DeclareMathSymbol{\sigma}{\mathalpha}{lettersA}{"1B}
\DeclareMathSymbol{\tau}{\mathalpha}{lettersA}{"1C}
\DeclareMathSymbol{\upsilon}{\mathalpha}{lettersA}{"1D}
\DeclareMathSymbol{\phi}{\mathalpha}{lettersA}{"1E}
\DeclareMathSymbol{\chi}{\mathalpha}{lettersA}{"1F}
\DeclareMathSymbol{\psi}{\mathalpha}{lettersA}{"20}
\DeclareMathSymbol{\omega}{\mathalpha}{lettersA}{"21}
\DeclareMathSymbol{\varepsilon}{\mathalpha}{lettersA}{"22}
\DeclareMathSymbol{\vartheta}{\mathalpha}{lettersA}{"23}
\DeclareMathSymbol{\varpi}{\mathalpha}{lettersA}{"24}
\DeclareMathSymbol{\varrho}{\mathalpha}{lettersA}{"25}
\DeclareMathSymbol{\varsigma}{\mathalpha}{lettersA}{"26}
\DeclareMathSymbol{\varphi}{\mathalpha}{lettersA}{"27}
\DeclareMathSymbol{\ldotp}{\mathpunct}{lettersA}{"3A}
\begin{document}\sffamily
sin(x) $E=mc^2$ $\mathit{E=mc^2}$ \itshape E=mc$^2 \sin(x) \alpha\beta$
\upshape\boldmath
sin(x) $E=mc^2$ $\mathit{E=mc^2}$ \itshape\bfseries E=mc$^2 \sin(x) \alpha \beta$
\end{document}