This is kind of a follow up question of Make mathfont respect the surrounding family.
For my main text (\rmfamily) I want to use Palatino and for \sffamily Arev. The math fonts should also respect this. And it nearly works, but the following example code has two issues:
- Uppercase greek letters don’t work in sans. How can I fix that?
- How can I select the other
vfrom Araev, ssince the one selected is nearly indistinguishable from\nu. When I try\DeclareMathSymbol{v}{\mathalpha}{extraitalic}{71}it affects all math fonts and also has no bold version.
Code
\documentclass{book}
\usepackage[scaled=1.15]{newpxtext}
\usepackage[varg,scaled=1.15,cmintegrals]{newpxmath}
\usepackage{letltxmacro}
\renewcommand{\sfdefault}{fav}
\DeclareMathVersion{arev}
\SetSymbolFont {operators} {arev} {OT1} {zavm} {m} {n}
\SetSymbolFont {letters} {arev} {OML} {zavm} {m} {it}
\SetSymbolFont {lettersA} {arev} {OT1} {zavm} {m} {n} % <-- breaks some symbols
\SetSymbolFont {symbols} {arev} {OMS} {zavm} {m} {n}
\SetSymbolFont {largesymbols} {arev} {OMX} {mdbch} {m} {n}
\SetMathAlphabet {\mathrm} {arev} {OT1} {zavm} {m} {n}
\SetMathAlphabet {\mathit} {arev} {OT1} {zavm} {m} {it}
\SetMathAlphabet {\mathbf} {arev} {OT1} {zavm} {b} {n}
\SetMathAlphabet {\mathtt} {arev} {T1} {fvm} {m} {n}
% ander Form für v
\DeclareSymbolFont{extraitalic}{U}{zavm}{m}{it}
%\DeclareMathSymbol{v}{\mathalpha}{extraitalic}{71}% affects \rmfamily too, and doesnt have bold version
\DeclareMathVersion{arevbold}
\SetSymbolFont {operators} {arevbold} {OT1} {zavm} {b} {n}
\SetSymbolFont {letters} {arevbold} {OML} {zavm} {b} {it}
\SetSymbolFont {lettersA} {arevbold} {OT1} {zavm} {b} {n} % <-- breaks some symbols
\SetSymbolFont {symbols} {arevbold} {OMS} {zavm} {m} {n}
\SetSymbolFont {largesymbols} {arevbold} {OMX} {mdbch} {b} {n}
\SetMathAlphabet {\mathrm} {arevbold} {OT1} {zavm} {b} {n}
\SetMathAlphabet {\mathit} {arevbold} {OT1} {zavm} {b} {it}
\SetMathAlphabet {\mathbf} {arevbold} {OT1} {zavm} {b} {n}
\SetMathAlphabet {\mathtt} {arevbold} {T1} {fvm} {b} {n}
\newif\IfInSansMode
\LetLtxMacro\oldsf\sffamily
\renewcommand*{\sffamily}{\oldsf\mathversion{arev}\InSansModetrue}
\LetLtxMacro\oldbf\bfseries
\renewcommand*{\bfseries}{\oldbf\IfInSansMode\mathversion{arevbold}\else\mathversion{bold}\fi\relax}
\LetLtxMacro\oldnorm\normalfont
\renewcommand*{\normalfont}{\oldnorm\InSansModefalse\mathversion{normal}}
\LetLtxMacro\oldrm\rmfamily
\renewcommand*{\rmfamily}{\oldrm\InSansModefalse\mathversion{normal}}
\newcommand{\TestText}{%
$v \nu$
$abcdefghijklmnopqrstuvwxyz$
$ABCDEFGHIJKLMNOPQRSTUVWXYZ$
$\alpha\beta\gamma\delta\epsilon\varepsilon\zeta\eta\theta\vartheta\iota\kappa\lambda\mu\nu\xi\pi\varpi\rho\varrho\sigma\varsigma\tau\omega\psi\chi\varphi\phi\upsilon$
$\Gamma\Delta\Theta\Lambda\Xi\Pi\Sigma\Upsilon\Phi\Psi\Omega$
$\int(1-2\cdot 10^{-5}) = \sum_i^\infty\sin x_i + a$
}
\begin{document}
\TestText
\bigskip
\bfseries
\TestText
\bigskip
\sffamily\mdseries
\TestText
\bigskip
\bfseries
\TestText
\end{document}
PS: I have to use pdflatex …


vshape in sans only)? – Tobi Aug 06 '16 at 07:55vin a way that onlyarevaffect it but thenpalatinouses the sam slot in which it has aGinstead of avdue to the different encodings … – Tobi Aug 08 '16 at 17:36\Delta(and the alternativev). As far as I can tell at the moment no other uppercase greek letters are in use. – Tobi Aug 08 '16 at 17:42XeLaTeX? – MadyYuvi Jul 03 '23 at 06:57arabicandalphanumerals from thesansfont and the Greek can come from any of the standard fonts, i.e., like\mathversion{sans}, sorry for my poorEnglish– MadyYuvi Jul 03 '23 at 09:12