Your latest edit added a few more requirements, such as an italic font. So, here you go. First, a version for modern toolchains. Since you said you have a preference for newtx
, I changed the main text font to TeX Gyre Termes X, the variant based on newtx
. Any Unicode text and math font will have much better coverage than any combination of legacy NFSS packages.
For a sans serif font, I went with Universalis ADF Std., which is free and on CTAN. You might also try the Condensed variant. The relative x-height is right, and the slant of the italics and the weight are both about right.
\documentclass[varwidth, preview]{standalone}
\usepackage{unicode-math}
\setmainfont{TeX Gyre Termes X}[Ligatures={Common, TeX}]
\defaultfontfeatures{Scale=MatchLowercase}
\setsansfont{Universalis ADF Std}
\setmathfont{TeX Gyre Termes Math}
\setmathfont[range=sfup]{Universalis ADF Std}
\setmathfont[range=sfit]{Universalis ADF Std Italic}
\setmathfont[range=bfsfup]{Universalis ADF Std Bold}
\setmathfont[range=bfsfit]{Universalis ADF Std Bold Italic}
\begin{document}
\textrm{M}\textsf{M}\textrm{x}\textsf{x}
\textit{\textrm{M}\textsf{M}\textrm{x}\textsf{x}}
\( \mathrm{M}\mathsf{M}\mathrm{x}\mathsf{x}
\mathit{M}\mathsfit{M}\mathit{x}\mathsfit{x} \)
\end{document}

You indicated in your revised question that you needed \mathsf
, so I set the sfup
, sfit
, bfsfup
and bfsfit
alphabets to the corresponding sans-serif text fonts. You can remove the four \setmathfont[range=
lines if you either don’t need to define them all or prefer the defaults.
You might replace the \mathrm
, \mathit
, \mathsf
and \mathsfit
commands with \symup
, \symit
, \symsfup
and \symsfit
to get slightly better spacing for one-letter variables at the cost of backward-compatibility. It’s also possible to use a different font for \symup
, \symit
, \symsfup
and so on than for the default (or math Roman) and sans fonts. Here is an example of why you might want to.
For Backward Compatibility
The PDFTeX-compatible legacy solution can’t quite do everything the other one could, but here you go:
\documentclass[varwidth, preview]{standalone}
\usepackage{newtxtext}
\usepackage[sfdefault, type1]{universalis}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[slantedGreek]{newtxmath}
\RequirePackage{textcomp}
\begin{document}
\textrm{M}\textsf{M}\textrm{x}\textsf{x}
\textit{\textrm{M}\textsf{M}\textrm{x}\textsf{x}}
\( \mathrm{M}\mathsf{M}\mathrm{x}\mathsf{x} \)
\end{document}

You might need to load a number of other packages to get some of the features that work with unicode-math
out of the box. For example, you’d need to load isomath
to get the \mathsfit
alphabet, but it will not load boldface sans-serif should you want to use that. For instance:
\usepackage[rmdefault=newtxi,
sfdefault=iwona,
OMLmathrm,
OMLmathsf,
OMLmathsfit]{isomath}
This breaks the upright sans-serif math alphabet slightly, but allows the following to work:
\( \mathrm{\alpha} \beta \mathsf{\gamma} \mathsfit{\delta} \)
If you want other math alphabets, you would need to load them from different packages. For example, mathalfa
can load calligraphic, script, Fraktur and blackboard bold alphabets.
Update
You clarified that you need to use Times in your publication. In that case, I would suggest you use unicode-math
and \setmathfont{TeX Gyre Termes Math}[Scale=MatchLowercase]
if your publisher supports it. With \setsansfont[Scale=MatchLowercase]
, only the relative x-height needs to be the same as Times, not all the font metrics, and you don’t have to guess a scaling factor. Here’s a more serious example:
\documentclass[varwidth, preview]{standalone}
\usepackage{unicode-math}
\setmainfont{TeX Gyre Termes}[Ligatures={Common, TeX}]
\defaultfontfeatures{Scale=MatchLowercase}
\setsansfont{Comfortaa}
\setmathfont{TeX Gyre Termes Math}
\begin{document}
\textrm{M}\textsf{M}\textrm{m}\textsf{m}\textrm{x}\textsf{x}
\end{document}

If not, you can try \usepackage[no-math]{fontspec}
followed by \usepackage{newtxmath}
, although it seems unlikely that a publisher would support fontspec
but not unicode-math
.
Failing that, here is a list of all packages on CTAN tagged as sans-serif fonts. (Whereas fontspec
can load any TTF or OTF font.) You would need to check the options of each and determine a scale factor by trial and error, such as:
\documentclass[varwidth, preview]{standalone}
\usepackage[T1]{fontenc} % best for Western European languages
\usepackage[utf8]{inputenc} % The default as of June 2018
\usepackage{amsthm}% cannot be loaded after newtxmath
\usepackage{newtxtext}
\usepackage[defaultsans, scale=0.85]{comfortaa}
\usepackage{newtxmath}
\RequirePackage{textcomp} % Probably loaded already, but make sure.
\useosf % for osf in normal text
\begin{document}
\textrm{M}\textsf{M}\textrm{m}\textsf{m}\textrm{x}\textsf{x}
\end{document}

This PDFTeX-compatible template does not set up all the math alphabets unicode-math
does. If you need any additional math alphabets, load them with a package such as mathalfa
or isomath
.
Previous
Although the newtxtext
font does not come with a matching sans serif, the newtxmath
font supports the libertine
option, which makes the fonts compatible with Libertine. This does have a matching sans-serif font, Biolinum. Therefore, modifying one of the examples in the newtx
documentation slightly, we can write:
\documentclass[varwidth, preview]{standalone}
\usepackage[lining,proportional,semibold]{libertine}
\usepackage[T1]{fontenc} % best for Western European languages
\usepackage{textcomp} % required to get special symbols
\usepackage[utf8]{inputenc} % The default as of June 2018
\usepackage{amsthm}% must be loaded before newtxmath
\usepackage[libertine,vvarbb]{newtxmath}
\useosf % for osf in normal text
\begin{document}
\textrm{M}\textsf{M}\textrm{m}\textsf{m}\textrm{x}\textsf{x}
\end{document}

This also works, even more simply, with the Libertinus OpenType font family:
\usepackage{unicode-math}
\setmainfont{Libertinus Serif}
\setsansfont{Libertinus Sans}
\setmonofont{Libertineus Mono}
\setmathfont{Libertinus Math}
If you want to use Times, specifically, your best bet might be to load TeX Gyre Termes Math
as your math font, and load your sans-serif font with Scale=MatchUppercase
. Then, only the ratio of the height of uppercase and lowercase letters needs to match Times. Here is an example with one of the few common sans-serif fonts that does:
\documentclass[varwidth, preview]{standalone}
\usepackage{fontspec}
\setmainfont{TeX Gyre Termes}
\setsansfont[Scale=MatchUppercase]{Comic Sans MS}
\begin{document}
\textrm{M}\textsf{M}\textrm{m}\textsf{m}\textrm{x}\textsf{x}
\end{document}
