5

If used in the denominator, the \prime symbols are lower than in the numerator. This becomes even more pronounced (and annoying) if Libertine/Libertinus Math is used.

Why is that? Can this somehow be corrected?

Example:

\documentclass{article}
\usepackage{amsmath}
\usepackage{libertine}
\usepackage{libertinust1math}

\begin{document}

  \begin{equation}
    \frac{h^{\prime\prime}-h^{\prime}}{h^{\prime\prime}-h^{\prime}}
  \end{equation}

\end{document}

Default CM:

enter image description here

libertinust1math:

enter image description here

AlexG
  • 54,894
  • 2
    For a one-shot-only solution you can just add \textstyle in the denominator. Or do you want to avoid cramped styles altogether? That's tough, cramped styles are hard coded in TeX... – campa Aug 28 '17 at 12:57
  • Could you give an example? I wonder why this isn't handled correctly in a math-centred typesetting software like TeX. – AlexG Aug 28 '17 at 13:02
  • 1
    Well, it is handled correctly from TeX's point of view. See this questions and its answers. (This might actually be a dupe.) – campa Aug 28 '17 at 13:05
  • I would expect whatever styles TeX provides, the same ones to be used in the numerator as in the denominator. Could you please briefly summarize what the reason is behind this weirdness? (I have no The TeX Book.) – AlexG Aug 28 '17 at 13:18
  • Sorry, beats me. All I can say is "that's how Knuth wrote TeX". Hopefully someone with more information will step in. – campa Aug 28 '17 at 13:50
  • So let me thank you for the link to the other question you gave in your 2nd comment. – AlexG Aug 28 '17 at 13:53
  • I will add \let\fracorig\frac\renewcommand\frac[2]{\fracorig{\displaystyle #1}{\displaystyle #2}} to the current and to all my future documents. Let's see which side-effects it may have. – AlexG Aug 28 '17 at 13:56
  • 1
    That will have very bad side effects. All fractions in text mode will be broken, as well as fractions in numerators/denominators of other fractions. – campa Aug 28 '17 at 14:00
  • Yes, you are right, not such a good idea in the case of nested fractions. – AlexG Aug 28 '17 at 14:04
  • why are you using h^{\prime} rather than h' (it makes no difference really but you almost never need to use \prime) – David Carlisle Aug 28 '17 at 16:46

2 Answers2

3

The amount superscripts are raised is determined by the fontdimen parameters of the font specified for fam2. In the case of the denominator it's mostly fontdimen15.

Here I set 13,14,and 15 to a rather large value and you see the numerator and denominator then match

enter image description here

\documentclass{article}
\usepackage{amsmath}
\usepackage{libertine}
\usepackage{libertinust1math}

\begin{document}
$a$
\fontdimen13 \textfont2 =7pt
\fontdimen14 \textfont2 =7pt
\fontdimen15 \textfont2 =7pt
  \begin{equation}
    \frac{h^{\prime\prime}-h^{\prime}}{h^{\prime\prime}-h^{\prime}}
  \end{equation}

\end{document}
David Carlisle
  • 757,742
2

You seem to not want the cramped style in the denominator:

\documentclass{article}
\usepackage{amsmath}
\usepackage{libertine}
\usepackage{libertinust1math}

\newcommand{\ncfrac}[2]{\frac{#1}{\mathpalette\notcramped{#2}}}
\newcommand{\notcramped}[2]{#1#2}

\begin{document}

\begin{equation}
\ncfrac{h''-h'}{h''-h'}
\end{equation}
\begin{equation}
\frac{h''-h'}{h''-h'}
\end{equation}

\end{document}

enter image description here

egreg
  • 1,121,712
  • I don't seem to understand your code. Where, in the first \newcommand, is the second argument to be passed to \notcramped? – AlexG Aug 28 '17 at 19:46
  • @AlexG \mathpallete executes the command four times supplying the "missing" argument in each case as #1 (\displaystyle, then \textstyle, then scriptstyle and \scriptscriptstyle) – David Carlisle Aug 28 '17 at 20:05