Text Formattingonehalfspacing and math

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
det
Posts: 5
Joined: Sun Feb 06, 2011 11:38 am

onehalfspacing and math

Post by det »

If there's e.g. a matrix inlined somewhere, the \onehalfspacing from the setspace package doesn't work correctly, means: the space between the top of the matrix and the line preceding it is less than 1.5 lines high.

what's the easiest way to get this straight?

thanks!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

onehalfspacing and math

Post by frabjous »

It seems to me that it works perfectly. But if you don't like it behaving that way, how do you want it to behave? Should the top row of the matrix be aligned with the surrounding text, even if this means that its bottom drops below and thus is closer to the next line? Or should the line spacing change so much that there is still a half line between its top and the line above as well as a half line between its bottom and the line below, no matter how inconsistent this makes the spacing between the lines (which I think would be incredibly ugly by comparison)?

But I'd also suggest avoiding having matrices inline that so large that they make a significant change to line spacing.
det
Posts: 5
Joined: Sun Feb 06, 2011 11:38 am

Re: onehalfspacing and math

Post by det »

I should clarify and say that it's not a lot of normal text but rather a lot of inline math and some text that make up flashcards. Yet I stumbled upon this spacing issue before.
What I mean is: there's something big (like a matrix) in line #2, which itself is anyhow (much) higher then 1.5 of a line. Now the closest vertical distance from any point on line #1 (which should be a line containing just text for now) to any point on line #2 is much less then the 1.5 line heights (that i meant to set). Expressed differently: the tip of a matrix-bracket is quite close to the line above. So this isn't affected by \onehalfspacing and since text-baseline to text-baseline is anyhow much higher then 1.5 to me it would be more evenly (and more nicely distributed) if the topmost point of any object from one line were what would set the spacing to the line above.

I hope it's understandable what I mean and if you can tell me how to achieve this (micro?)-layouting.
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Re: onehalfspacing and math

Post by frabjous »

I still fail to understand. You cannot literally mean that you thought that \onehalfspacing put one and a half blank lines between the top point in one line and the bottom point of another. That would be a huge amount of whitespace, and \onehalfspacing is certainly not meant to do that!

What \onehalfspacing does is modify the \baselinestretch value, which is the distance between the baseline of one line of text and the baseline of the next, so that it is normally 1.5 times what it would ordinarily be. It doesn't indicate the distance between the top of one and the bottom of the other, but the distance between their baselines (the bottoms of letters without descenders) in typical cases. Of course it remains flexible, so that extra space will be added if it needs to to squeeze something in.

The space between one line of text and another is pretty much never determined by the distance between the top of one and the bottom of the other, or you'd have inconsistent spacing when, e.g., a line only contained lowercase letters, or no descenders. That would be very ugly typographically.

So I'm still confused about what you were expecting, and what you wanted. I can't believe that you actually wanted 1.5 lines of whitespace between the top of one line and the bottom of another; that would be at least 2.5 spacing and possibly more. Do you want to ensure at least one half-line of padding between the top of one line and the bottom of another? I think that's going to be very ugly too, but the only way I think of doing it would be to place fake vertical padding on any large elements. I could try to figure out how to do that for a matrix if it were really important, but my recommendation would be to leave things as they are, unless you have a publisher demanding something different.
det
Posts: 5
Joined: Sun Feb 06, 2011 11:38 am

onehalfspacing and math

Post by det »

Thanks for your kind reply!
How I read, I'd assume, you've understood what I mean.
For now I'll take your recommendation and accept certain parameters as they are since there's other things of higher priority. Nevertheless, I'm getting quite interested in gaining more control since I always care about aesthetic details.

In order to communicate how I'd prefer the line spacing, it's the bottom one in the attachment.


Edit by localghost: Preferably no external links (see Board Rules). Attachments go onto the forum server where possible.
Attachments
LineSpacingDemo.png
LineSpacingDemo.png (58.33 KiB) Viewed 4203 times
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Re: onehalfspacing and math

Post by frabjous »

It's a bit hard to give concrete advice without seeing the code. If line breaks are created with \\, just put a space after it, e.g., \\[24pt] or \\[2\baselineskip] or whatever so it'll skip more or less space between lines.
Post Reply