22

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

  • 4
    Use $\smash{<formula>}$. – egreg May 28 '13 at 8:58
  • Works perfectly, thansk ^^ – Aurélien Lambert May 28 '13 at 9:20
18

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.

  • 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)}. – blazs 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
4

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}
  • 2
    \usepackage[nopar]{lipsum} avoids the need to redefine \lips@par. Or you can use \lipsum*[1]. – egreg May 28 '13 at 9:16
  • \lineskiplimit has really bad side-effects od \begin{equation}\end {equation} ... \smash seems to work right. Thanks ! – Aurélien Lambert May 28 '13 at 9:22
  • @egreg thanks. I should probably have a look at the lipsum documentation ... – StrongBad May 28 '13 at 9:28

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.