TeX - LaTeX Asked by bnd3090 on May 9, 2021

I’m using uarial as text font and want to use newtxsf as a nearly matching math font. I scaled uarial to match the height of latin modern as described in this post: https://tex.stackexchange.com/a/206677.

Still I’m encountering two problems:

- I don’t know how to scale newtxsf correctly, since theht0 stays the same when I change the scaled option. If there is no way to display the height directly I would try some values and choose the one that fits the most.
- in math mode, "sin", "cos", … are not set in uarial but in latin modern. Is there a way to tell newtxsf to use sffamily instead of rmfamily? I tried to solve this using the newtxsf documentation but failed. Or is there another package that matched uarial?

My Code so far

```
documentclass[fontsize=12pt, paper=a4, parskip=half]{scrreprt}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage{lmodern}
usepackage[scale=0.93]{tgheros}
usepackage[scaled=1]{newtxsf}
renewcommand*{familydefault}{sfdefault}
begin{document}
textbf{Displaying height of fonts}par
sbox0{sffamily A}heros: theht0
sbox0{rmfamily A}latin modern: theht0
sbox0{ttfamily A}newtxsf: theht0par
textbf{Math mode} $ Q = Ptan(varphi)$
end{document}
```

My suggestion is to try with no scaling; in this case we get the height of a sans serif A is 8.87999pt and the height of a math A is 8.148pt.

Therefore the scaling factor is 8.148/8.87999=0.91757 (rounded to the fifth decimal digit). Now with

```
documentclass[fontsize=12pt, paper=a4]{scrreprt}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage{amsmath}
usepackage[scale=.91757]{tgheros}
usepackage[scaled=1]{newtxsf}
renewcommand*{familydefault}{sfdefault}
renewcommand*{rmdefault}{sfdefault}
% this to get the operators in the sans serif font
DeclareSymbolFont{operators}{encodingdefault}{sfdefault}{m}{n}
begin{document}
textbf{Displaying height of fonts}
sbox0{sffamily A}heros: theht0
sbox0{$A$}newtxsf: theht0
textbf{Math mode} $ Q = Ptan(varphi)$
end{document}
```

Correct answer by egreg on May 9, 2021

Note that, in `unicode-math`

, the solution is `Scale=MatchLowercase`

, or sometimes, `Scale=MatchUppercase`

. You can even set it as `defaultfontfeatures`

.

It also sets the main font as both the operator font and the `mathrm`

font, but you can override this, with `setoperatorfont`

, `setmathrm`

, etc.

Answered by Davislor on May 9, 2021

Get help from others!

Recent Answers

- Peter Machado on Why fry rice before boiling?
- Lex on Does Google Analytics track 404 page responses as valid page views?
- Joshua Engel on Why fry rice before boiling?
- haakon.io on Why fry rice before boiling?
- Jon Church on Why fry rice before boiling?

Recent Questions

- How can I transform graph image into a tikzpicture LaTeX code?
- How Do I Get The Ifruit App Off Of Gta 5 / Grand Theft Auto 5
- Iv’e designed a space elevator using a series of lasers. do you know anybody i could submit the designs too that could manufacture the concept and put it to use
- Need help finding a book. Female OP protagonist, magic
- Why is the WWF pending games (“Your turn”) area replaced w/ a column of “Bonus & Reward”gift boxes?

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP