I would like to use newpxtext and newpxmath as primary font and combine this with a sans-serif font, like cmbright, for secondary text, such as headings, figure captions and labels within pgfplots.
Based on this post, I tried the following code:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{newpxtext}
\usepackage{newpxmath}
\renewcommand{\sfdefault}{cmbr}
\DeclareMathVersion{sans}
\SetSymbolFont{operators}{sans}{OT1}{cmbr}{m}{n}
\SetSymbolFont{letters}{sans}{OML}{cmbrm}{m}{it}
\SetSymbolFont{symbols}{sans}{OMS}{cmbrs}{m}{n}
\SetMathAlphabet{\mathit}{sans}{OT1}{cmbr}{m}{sl}
\SetMathAlphabet{\mathbf}{sans}{OT1}{cmbr}{bx}{n}
\SetMathAlphabet{\mathtt}{sans}{OT1}{cmtl}{m}{n}
\SetSymbolFont{largesymbols}{sans}{OMX}{iwona}{m}{n}
\DeclareMathVersion{boldsans}
\SetSymbolFont{operators}{boldsans}{OT1}{cmbr}{b}{n}
\SetSymbolFont{letters}{boldsans}{OML}{cmbrm}{b}{it}
\SetSymbolFont{symbols}{boldsans}{OMS}{cmbrs}{b}{n}
\SetMathAlphabet{\mathit}{boldsans}{OT1}{cmbr}{b}{sl}
\SetMathAlphabet{\mathbf}{boldsans}{OT1}{cmbr}{bx}{n}
\SetMathAlphabet{\mathtt}{boldsans}{OT1}{cmtl}{b}{n}
\SetSymbolFont{largesymbols}{boldsans}{OMX}{iwona}{bx}{n}
\newif\IfInSansMode
\let\oldsf\sffamily
\renewcommand*{\sffamily}{\oldsf\mathversion{sans}\InSansModetrue}
\let\oldmd\mdseries
\renewcommand*{\mdseries}{\oldmd\IfInSansMode\mathversion{sans}\fi\relax}
\let\oldbf\bfseries
\renewcommand*{\bfseries}{\oldbf\IfInSansMode\mathversion{boldsans}\else\mathversion{bold}\fi\relax}
\let\oldnorm\normalfont
\renewcommand*{\normalfont}{\oldnorm\InSansModefalse\mathversion{normal}}
\let\oldrm\rmfamily
\renewcommand*{\rmfamily}{\oldrm\InSansModefalse\mathversion{normal}}
\usepackage{titlesec}
\titleformat*{\section}{\Large\bfseries\sffamily}
\newcommand{\samplemath}{
123$123Ax\alpha+\chi\cdot f(x) b$
\begin{equation}
Ax\alpha+\chi\cdot f(x) * b \quad \sum_{i=0}^{\infty} \int_{a}^{b} f_i(x) dx
\end{equation}
}
\begin{document}
\section{Section heading with math $\alpha(\pi)$}
Normal:\samplemath
\sffamily Sans:\samplemath
\bfseries Bold-sans:\samplemath
\normalfont Back to Normal:\samplemath
\end{document}
Which gives me the following outcome:

As you can see, the brackets "(" and ")" as well as the integral and summation symbols are missing. Otherwise it would be perfect.
If I remove \usepackage{newpxmath} from the preamble, the math font changes to the default and all symbols show correctly.
If I remove \SetSymbolFont{symbols}{sans}{OMS}{cmbrs}{m}{n} and \SetSymbolFont{largesymbols}{sans}{OMX}{iwona}{m}{n} the missing symbols appear, but in the newpxmath serif font.
Is there a way to use newpxmath and have secondary text with sans-serif math?
I found this post. If I add
\DeclareMathDelimiter{(}{\mathopen} {operators}{"28}{largesymbols}{"00}
\DeclareMathDelimiter{)}{\mathclose}{operators}{"29}{largesymbols}{"01}
to the preamble, I do get the "(" and ")". Is there a better way than doing this for every math symbol that I need?