TeX - LaTeX Asked on December 20, 2020
I noticed the space between frac{}{}
changes depending on where it shows up in the expression.
And also depending on font used. Why does this happen? It does not look very good.
Here is an example, using default font
The first case, the space is the same between the numerator and the dash, and the numerator and the dash. In the second case, the space is not the same. It is the same expression in both cases.
The code for the above is
documentclass[11pt, notitlepage]{article}
usepackage{amsmath}
usepackage[mathit=sym,bold-style=ISO]{unicode-math}
begin{document}
[
y left(x right) = -left(int frac{sin left(x right) g left(x right)}{x^{frac{3}{2}}}d x right) cos left(x right)
]
[
y left(x right) = frac{-left(int frac{sin left(x right) g left(x right)}{x^{frac{3}{2}}}d x right) cos left(x right)}{sqrt{x}}
]
end{document}
Things get a little worst, when I use the following font. Now there is too much wasted space between the numerator and the dash. The space is not the same between the dash.
The code for the above is
documentclass[11pt, notitlepage]{article}
usepackage{amsmath}
usepackage[mathit=sym,bold-style=ISO]{unicode-math}
setmathfont{Asana Math}[Scale=MatchLowercase]
usepackage{Baskervaldx} %changed to thisbelow
setmainfont{Baskervaldx}[
UprightFont=*-Reg,
ItalicFont=*-Ita,
BoldFont=*-Bol,
BoldItalicFont=*-BolIta,
]
begin{document}
[
y left(x right) = -left(int frac{sin left(x right) g left(x right)}{x^{frac{3}{2}}}d x right) cos left(x right)
]
[
y left(x right) = frac{-left(int frac{sin left(x right) g left(x right)}{x^{frac{3}{2}}}d x right) cos left(x right)}{sqrt{x}}
]
end{document}
In both cases, the exponent font size could be made little smaller actually. It seems to be be the same size as the letter itself it is being raised to this exponent.
Is there a font that does this right? Keeping the same space all the time?
TL 2020
(posting this answer so that the posting may be considered as having an "official answer")
Some preliminary comments and observations:
In a displayed equation, the default math style is displaystyle
.
When TeX is in display-style math mode, int
generates the "large" size of the integral symbol, and frac
employs textstyle
for the contents of the numerator and denominator. Letters and other symbols have the same size in display and text style; the main difference between the two styles lies in the size of "variable-size symbols" such as sum
, prod
, and int
.
When TeX is in text-style math mode, int
generates the "regular" size of the integral symbol, and frac
employs scriptstyle
for the contents of the numerator and denominator. In scriptstyle
, letters and symbols are 30% smaller than in textstyle
.
Armed with these pieces of knowledge, we can explain the output of your sample code.
In the first case (also shown in the first line below), displaystyle
is in effect; hence, a "large" integral symbols is generated, and the numerator and denominator terms are typeset in text style.
In the second case (also shown in the second line below), the code of the first example occurs in the numerator of a frac
expression; hence, text style is in effect. Therefore, the "regular" size of the integral symbol will be produced, and the numerator and denominator of the "inner" frac
term will be typeset in scriptstyle
.
To force the contents of the numerator of the "outer" frac
term to be typeset in displaystyle
rather than in textstyle
, it suffices to insert the directive displaystyle
at the start of the numerator term; see the third row below.
Aside: In the following code, I've replaced x^{frac{3}{2}}
with x^{3/2}
in order not to make the denominator term needlessly (and distractingly) large.
documentclass[11pt]{article}
usepackage{amsmath} % for 'align*' environment
usepackage[mathit=sym,bold-style=ISO]{unicode-math}
setmainfont{Baskervaldx}[
UprightFont = *-Reg,
ItalicFont = *-Ita,
BoldFont = *-Bol,
BoldItalicFont= *-BolIta]
setmathfont{Asana Math}[Scale=MatchLowercase]
newcommandblurb{-left( int frac{sin(x),g(x)}{x^{3/2}},dx right) cos x}
begin{document}
begin{align*}
y (x) &= blurb [1.5ex]
z (x) &= frac{blurb}{sqrt{x}}
&= frac{displaystyleblurb}{sqrt{x}}
end{align*}
end{document}
Correct answer by Mico on December 20, 2020
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP