1

I am using \allowbreak to wrap long expressions over multiple lines. For some reason, successive lines of maths broken in this way always appear without any line spacing. I haven't found any \setstretch,\linespread etc. that will increasing the spacing. Any suggestions?

Edit: example added below. This produces text paragraphs with a lot of spacing, yet the two lines of the maths expression are glued together. I guess this is consistent, in the sense that the distance between two base lines of the maths expression is at least the distance between two base lines of text.

So a better way to ask my question: in the example below, how do I ensure that the maths lines do not stick together, but have a bit of vertical space between them, without changing the line spacing of the text lines?

\documentclass{article}
\usepackage{lipsum}
\everymath{\displaystyle\allowbreak}
\linespread{2.0}

\begin{document}

\lipsum[1]
$\frac{1}{c_s^{2}} \partial_{t}{\psi_{1}}
\partial_{t}{\rho_{0}}+\frac{1}{c_s^{2}} \partial_{t}{\rho_{0}}
\partial_{i}{\psi_{1}} v^{(0)}_{i}+\frac{1}{c_s^{2}}
\partial_{t}{\partial_{t}{\psi_{1}}} \rho_{0}+\frac{1}{c_s^{2}}
\partial_{t}{v^{(0)}_{i}} \partial_{i}{\psi_{1}}
\rho_{0}+\frac{1}{c_s^{2}} \partial_{t}{\partial_{i}{\psi_{1}}}
\rho_{0} v^{(0)}_{i}+\frac{1}{c_s^{2}} \partial_{t}{\psi_{1}}
\partial_{i}{\rho_{0}} v^{(0)}_{i}+\frac{1}{c_s^{2}}
\partial_{i}{\partial_{t}{\psi_{1}}} \rho_{0}
v^{(0)}_{i}$
\lipsum[1]
\end{document}
  • where is \allowbreaks defined? it is not a command I know. Inline math will always break it doesn't need a declaration, display math will never break automatically in any of the standard packages. – David Carlisle Jan 22 '17 at 11:52
  • Sorry, I meant \allowbreak, without the 's'. It is inline maths. – Kasper Peeters Jan 22 '17 at 12:00
  • 1
    OK but the question is still completely unclear, inline math is just part of the paragraph so the line spacing is that of the paragraph so \baselineskip normally or \lineskip if the math does not fit in baseline space, there can not be any special spacing for just the math bits. It is always best to include a small complete example document in the question. – David Carlisle Jan 22 '17 at 12:08
  • I have added clarification and a minimal example. – Kasper Peeters Jan 22 '17 at 14:13
  • the example shown does fit in the enlarged linespacing (teh \allowbreak is totally unwanted at the position you add it though at the start of the math. it just adds a break point there, before the expression. the point of text style is to look better inline, but you have forced display style so it does look a bit over-sized, so it would be better to simply remove your \everymath setting – David Carlisle Jan 22 '17 at 14:52
1

TeX will ensure that baselines are equally spaced, unless the distance between the deepest object in a line and the highest object in the next one is less than \lineskiplimit (default value 0pt). Well this is not the complete truth, but it's sufficient for this case.

In your document the distance between baselines is set to 24pt, due to \linespread{2}.

The deepest object is \frac{1}{c_s^2}, which is also the highest object. Its depth is 9.33168pt, while its height is 13.20952pt.

Summing up these we get 22.54120pt, which is less than the usual distance between baselines, so no additional space will be added and the baselines will have 24pt distance between them.

Just to make experiments, try doing \linespread{1.8}\lineskip=30pt and you'll see

enter image description here

I added \noindent in front of the formula so as to avoid an overfull box that's irrelevant for the problem at hand.

Now the sum of depth and height is larger than the baseline skip, so \lineskip glue is inserted to distance them (default value 1pt).

Differently from other software, TeX does not implement line spacing by inserting a fixed amount of glue between lines: this would lead to differently spaced lines, according to the presence of ascenders or descenders. Rather, it works on a constant distance between baselines, until possible.

What you could do is to increase the values of \lineskiplimit \lineskip: with

\lineskip=6pt
\lineskiplimit=18pt

you get

enter image description here

which is as wrong as it could be. But the document is yours; adjust the values to suit. If you want also the distance between “rutrum” and the formula to be larger, give an even larger value to \lineskiplimit.

The problem is in the declaration

\everymath{\displaystyle}

(note that \allowbreak does nothing at all, because it just inserts a zero penalty at the start of each math formula, which is useless or even bad). Such a declaration is one of the best ways to spoil the appearance of a document.

Just for comparison, here is the output without the dreaded declaration, and it looks quite good (considering the bad situation you're in with double spacing).

enter image description here

  • Ok, thanks a lot for pointing me in the right direction, the thing I was looking for was the lineskip/lineskiplimit combo. My example was of course a silly one; in the real problem, the output comes out of a computer algebra system and I definitely want display style. I am using inline math line breaking because the alternative for display style (breqn) has a bug which makes it choke on some of my expressions. – Kasper Peeters Jan 22 '17 at 20:57

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.