4

I have problem with the following math text: enter image description here

As you can see, the tilde over S is not actually wide, but it's squared nicely. On the other hand, the overline over the X is okay, but the deuce is placed ugly.

Im using Stix 2.0. I'd like to have tilde as wide as overline over the X and the square of X be positioned properly.

How to achieve it without changing math font?

I use XeLaTex. Stix2 is loaded as in MWE:

MWE:

\documentclass[11pt]{article}
\usepackage{fontspec}
\usepackage{xunicode}
\usepackage{unicode-math}
\setmathfont{STIX2Math.otf}[StylisticSet=02]
\begin{document}
$$\widetilde{S}^2 = \int x^2 dF_n - \left(\int x dF_n\right)^2 
     = \frac{1}{n}\sum X_i^2 - \overline{X}^2$$
\end{document}
9
  • 1
    Welcome to TeX.SE! Please show the compilable code resulting in your shown screenshot.
    – Mensch
    Mar 15, 2019 at 17:21
  • Please tell us whether you use XeLaTeX or LuaLaTeX and how exactly you load the Stix Two Math font.
    – Mico
    Mar 15, 2019 at 19:02
  • @Mico, i've edited the question
    – Ilya68
    Mar 15, 2019 at 19:11
  • Welcome to TeX.SX. When you post a question, please provide a "Minimal Working Example" (MWE) that starts with \documentclass, includes all relevant \usepackage commands, ends with \end{document} and compiles without errors, even if it does not produce your desired output.
    – Sandy G
    Mar 15, 2019 at 20:22
  • @SandyG, thx, I've edited the answer again!
    – Ilya68
    Mar 15, 2019 at 20:51

1 Answer 1

4

You can use \wideoverbar instead of \overline.

For the tilde, you can substitute it with the one from TeX Gyre Termes, but some low level tricks are necessary.

\documentclass[11pt]{article}

\usepackage{amsmath}
\usepackage{fontspec}
\usepackage{unicode-math}

\setmainfont{TeX Gyre Termes}
\setmathfont{STIX2Math.otf}[StylisticSet=02]

\newfontface{\termesmath}{texgyretermes-math.otf}[NFSSFamily=termesmath]
\DeclareSymbolFont{termesmath}{TU}{termesmath}{m}{n}

\AtBeginDocument{%
  \protected\def\widetilde{\Umathaccent 7 \symtermesmath "00303\relax}%
}

\begin{document}

\[
\widetilde{S}^2
= \int x^2 \,dF_n - \left(\,\int x \,dF_n\right)^{\!2}
= \frac{1}{n}\sum X_i^2 - \wideoverbar{X}^2
\]

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .