# Line height with \sqrt and TeX Gyre Pagella Math

Using TeX Gyre Pagella Math as a math font with unicode-math, I've noticed that inserting an inline square root such as $\sqrt{S}$ in a paragraph results in a line that is too high, creating a very ugly skip between lines (see image below):

\documentclass[a4paper, 12pt]{scrartcl}

\usepackage{unicode-math}
\setmainfont{TeX Gyre Pagella}
\setmathfont{TeX Gyre Pagella Math}
\usepackage{lipsum}

\begin{document}
\lipsum*[1]
$\sqrt{S}$
\lipsum*[1]
$\smash{\sqrt{S}}$
\lipsum*[1]

\end{document}


I assume this is due to the metrics of the Pagella Math font, because this does not seem to occur (or at least not as noticeably) with Computer Modern. As seen above, a workaround is wrapping the square root in a \smash.

Is there a better way around this? I'm not sure I'm happy with how the \smash workaround looks. Also, with this I have to remember to wrap every potentially problematic \sqrt in \smash.

• If you're not sure about the look of "the \smash workaround", what are you expecting it to look like? – Werner Sep 16 '15 at 13:34
• the interline spacing looks a bit tight in the example. perhaps it's just the design, but i'd also check to see how the baseline distance is set. if it's less than 2pt more than the nominal size of the font being used, it's really too tight to consider using with math; maybe it should be increased for math use anyway. another possibility, but not an attractive one, is to ask that the math dimensions in the font with the radical be adjusted so that the clearance between the radical rule and the top of its contents be decreased. – barbara beeton Sep 16 '15 at 13:51
• @Werner Well, the upper line of the square root sign does get a little close to the line of text above it. I suppose changing the line spacing would work – I'm just wondering why the default is so ugly. – Socob Sep 17 '15 at 15:38
• @barbarabeeton I'm just using defaults here (as seen in the example above); since I'm not an expert, I'm not sure I want to be messing around with line spacing and such (is the "baseline distance" just \baselineskip?). – Socob Sep 17 '15 at 15:41
• @Socob -- unfortunately, we don't have the pagella fonts installed, so i can't check what dimensions are in effect. maybe someone else can do that. – barbara beeton Sep 17 '15 at 16:06

The effect is also visible with standard LaTeX and mathpazo.

You can “fix” this by enlarging the leading, which is something I learn always to do when the text font is Palatino.

\documentclass[a4paper, 12pt]{scrartcl}

\usepackage{unicode-math}
\setmainfont{TeX Gyre Pagella}
\setmathfont{TeX Gyre Pagella Math}
\setmathfont[range=\sqrt]{Asana Math} % better than the Pagella symbol

\usepackage{lipsum}

\begin{document}

\lipsum*[2]
$\sqrt{S}$
\lipsum*[2]
\smash{$\sqrt{S}$}
\lipsum[2]
\end{document}


If I use the standard square root sign from Pagella, the line would again turn out to be too high.

• Is it OK to only adjust \linespread like that? From reading around, I've gotten nervous about changing stuff like this since most of the time, people are told to use something like the setspace package instead (although I wouldn't know how to accomplish the same thing using setspace). – Socob Sep 17 '15 at 17:14
• @Socob There are big differences between \linespread{1.1} or \linespread{1.5}. The main one being that the former is acceptable, whereas the latter isn't (but sometimes one has to swallow and obey orders). Typography is not an exact science: if you need several of those square roots, then make room for them. Just a couple of cases can be treated “manually” should the case arise. – egreg Sep 17 '15 at 17:20
• the unfortunate thing about making this adjustment is that it's often no longer possible to meet the nominal spec for the height of the text body for most publications (which in the u.s. is usually measured as an integer number of picas, or maybe half-picas) with an integer number of lines. of course, any display math will make hash of a grid, but it's nice if a page of straight text can do that in the absence of stretch or shrink with no complaints about overfull or underfull vboxes. – barbara beeton Sep 18 '15 at 20:08
• @barbarabeeton For a single serial publication, where the font doesn't change, where's the problem? Publishers will have their in house fonts and tailor their publications accordingly. – egreg Sep 18 '15 at 20:22
• @egreg -- true enough, but the discontinuity crops up in a similar way with the ams document classes when someone specifies the [12pt] option, and it really confuses authors. (and the in-house production editors are also confused with book series for which different text font sizes are permitted. they are quite insistent that the 50.5pc nominal text height be matched exactly. not possible for pages of solid text.) – barbara beeton Sep 18 '15 at 20:59