4

Newtx fonts are great. Still, when your main font is roman, and when you occasionally use the sans serif font supplied with newtx, you get slightly too small capital sans serif letters and slightly too large small sans serif letters. I think the documentation of newtx speaks about 90% default scaling.

The result of

\documentclass{article}
\usepackage{newtxtext}
\usepackage[slantedGreek]{newtxmath}
\begin{document}
M\textsf{M}x\textsf{x}\emph{M\textsf{M}x\textsf{x}}\(M\mathsf{M}x\mathsf{x}\)
\end{document}

is output of pdflatex

I'm wondering whether one could make the heights of the serif "M" and the sans "M" exactly equal, and simultaneously the heights of serif "x" and sans "x" exactly equal (both in upright and italics settings). Of course, this should happen by default: I don't want to typeset each letter as a scaled tikz picture separately, for example ;-).

Is there a sans-serif helvetica-like package which supplies a font whose ratio (height of capital letters)/(height of small letters) is exactly the same as that of newtx? Another Times clone would do as well, but, in fact, I do have a very strong preference for newtx (it is well-tested, contains many useful glyphs, and jives with a publisher's class).

  • @Davislor That happens. Comments are ephemeral. When we don't tidy them up ourselves, they disappear. (Mods sometimes. Maybe the system sometimes does it. Not sure.) – cfr Jun 8 '18 at 0:36
  • @cfr I wish they’d left the replies to me up long enough for me to read them. – Davislor Jun 8 '18 at 1:01
  • @Davislor They should/usually do. Unless something is abusive or whatever. (Or unless you take months or years to check for replies, of course.) You could ask in chat what happened. – cfr Jun 9 '18 at 3:00
5

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}

TeX Gyre Termes X/Universalis ADF Std

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}

Newtx/Universalis

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}

MMmmxx

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}

MMmmxx

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}

MMmmxx

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}

MMmmxx

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy