3

While refining my thesis, I noticed that the spacing between lines differs sometimes, when there are inline formulae in the text. I guess this happens to provide enough space between the formulae and the surrounding lines. Unfortunately, this can look extremely ugly, when the spacings are differing every two lines.

The inline formula are typically some simple specifiers like

… coefficient $T_j^{(1)}$ is …

This means, it doesn't make sense to move it in an equation/align environment.

At the moment, I'm circumventing the additional spacing by adding an empirically determined stretch to the lines (e.g., \setstretch{1.1} from the setspace package yields equally spaced lines), but I can't be sure that this will fit all occurrences of oversized inline formulae. But I want to avoid more "extreme" settings like \onehalfspacing, since (IMHO) this looks ugly, too.

So my questions are:

  1. Is there a way to force the regular spacing of one \baselineskip? (Please ignore the fact that this will probably look ugly as hell.)
  2. Is there a prettier automatic solution, which is better than manually stretching the whole document?
  3. Or is it even possible to reduce the size of this formula? I'm thinking of the difference between \textstyle and \displaystyle for fractions and operators.

For testing purposes, I created a MWE (to be compiled with lualatex), where the baselines of the first 5 lines are marked with a green line. In the standard configuration, the third, fourth and fifth line are much lower:

example spacing

\documentclass[a5paper,DIV=9]{scrartcl}
\usepackage{amsmath}
\usepackage{fontspec}
\setmainfont{Latin Modern Roman}
\usepackage{unicode-math}
\setmathfont{Latin Modern Math}

\usepackage{setspace}
%\setstretch{1.05}

% geometry with DIV9 options
\usepackage[
  showframe,
  marginratio={1:1,1:2},
  scale=0.66666
  ]{geometry}

\usepackage{xcolor,picture,eso-pic}
\def\bl{-66.39178pt} % upper border of textarea, taken from output of geometry package

\begin{document}
\AddToShipoutPicture*{%
  \AtPageUpperLeft{%
    \color{red}%
    \put(0,\bl){\line(1,0){\paperwidth}}%
    \color{green}
    \put(0,\bl-1em){\line(1,0){\paperwidth}}%
    \put(0,\bl-1em-\baselineskip){\line(1,0){\paperwidth}}%
    \put(0,\bl-1em-2\baselineskip){\line(1,0){\paperwidth}}%
    \put(0,\bl-1em-3\baselineskip){\line(1,0){\paperwidth}}%
    \put(0,\bl-1em-4\baselineskip){\line(1,0){\paperwidth}}%
  }%
}

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut,
placerat ac, adipiscing vitae, felis. Curabitur dictum  $T_j^{(1)}$ gravida mauris. Nam arcu libero,
nonummy eget, consectetuer id, vulputate a, magna. Donec vehicula augue eu neque.
\end{document}
  • 2
    You might \smash the offending formula, but really the best way to cope with the problem, when you have several of those very high objects, is to enlarge the leading; \linespread{1.1} is a good remedy for this case (no need of setspace). – egreg Jul 5 '16 at 12:36
  • the same thing happens with plain tex, and it's by design, so tall objects in a following line don't bash into low objects in the preceding line. it's possible to override it, by (at least usually) by setting \normallineskip=0pt, but it's not recommended. even if you do that, a display-style fraction in a text line will force lines apart. – barbara beeton Jul 5 '16 at 12:55
  • @egreg Thanks! Do you have an idea, how to detect offending formulae? – Stefan Jul 6 '16 at 7:49
  • @barbarabeeton This didn't change anything. However, setting \lineskiplimit to a large negative value did the trick. – Stefan Jul 6 '16 at 7:50
  • 1
    @Stefan Set \lineskip to a large value: they'll show up very clearly. – egreg Jul 6 '16 at 8:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.