29

I have trouble in writing my latex document : I have a lot of inline short math formulas in my text, and latex keep growing line spacing because of it. I'd like to force latex to keep a normal line spacing, even if it means writing the formulas over the text (in this case I would deal with it case by case).

I've tried quite every command for fixing line spacing, but latex does not care.

Here is a small picture of what I'd like to avoid (in particular, there is still much free space between lines I could reduce):

enter image description here

lockstep
  • 250,273

2 Answers2

21

If you insert a formula as

$\smash{<formula>}$

its vertical size will not be considered during typesetting. However, spaces inside the formula won't stretch or shrink together with the other spaces in the line, which could change the typesetting. So, in the case of a formula with an equality you should type

$x=\smash{<big subformula>}$

I'd not do in this way, though: the enlarged line spacing is the only clue you have for manually fixing the output. So I'd leave the typesetting as is, and only then apply cautiously adjustments. In the showcase example, you could use

$\smash[b]{\binom{\xi}{\xi}}$

(requires amsmath) to remove the bottom vertical space.

egreg
  • 1,121,712
  • 1
    Any idea what could I try if \smash{expression} causes the symbol to overlap with a symbol from the line on top and \smasm[b]{expression} doesn't improve the vertical spacing? The symbol I'm typesetting inline is \partial_p^{(K, L)}. – user12344567 Mar 21 '16 at 16:33
  • I've found that \smash is rather universal, it also prevents line spacing adjustments because of text mode elements, like superscripts. – lblb May 25 '17 at 15:36
5

It might be overkill, but I think if you really want to force the spacing between lines/height of each line to be the same you want to set \lineskiplimit. I think \lineskiplimit basically tells LaTeX when lines are too close together. By making \lineskiplimit very negative, the lines are never too close together and therefore LaTeX never adds extra space.

\documentclass{article}
\usepackage[nopar]{lipsum}

\lineskiplimit=-\maxdimen\relax

\begin{document}
\lipsum[1]
\(\frac{\frac{A}{B}}{\frac{C}{D}}\)
\lipsum[2]
\(\frac{\frac{A}{B}}{\frac{C}{D}}\)
\lipsum[3]
\end{document}
StrongBad
  • 20,495