Maintaing line height in Writer constant regardless of formulas.

Whenever I insert a formula inside a paragrapho it messes the uniformity of line width. How can i tweak it so that it stays constant?

EDIT: i add a picture where the second paragraph seems to have extra neight between the 3 and 4th lines.
EDIT: true… height i meant… sorry about that.

(Title edited by ajlittoz)

Edit your question to describe the “technical” characteristics of the insertion. Don’t use an answer which is reserved for solutions.

A Math formula is an object which must be anchored somewhere in the text. If you use Insert>Object>Formula, it is generally inserted As Character. This can be checked with a right-click on the formula and Anchor. In this anchoring mode, it is considered a single wide character and participate in text lay out. This does not change line paragraph line area.

If you can’t sort out the problem, edit your question to attach a sample file to it (cannot be done to a comment) and explain clearly in this file what you want to achieve.

This is not width but height or spacing!

Formulas are inserted as “characters”. This strange character is enclosed in a box called a frame. A frame generally has padding space around it so that it is positioned clear of the surrounding text.

In the case of inline formulas, this is not desirable, otherwise line spacing increases.

There are two ways to fix it:

  • with frame styles (will apply to all formulas)

    Formulas are enclosed in frames controlled by frame style Formula.

    Open the side style pane with F11 if not already visible.

    Click on the third icon from left in the toolbar.

    Right-click on Formula and Modify.

  • with manual editing on each formula

    Right-click on the formula and Properties.

The rest of the procedure is common to both methods.
Go to the Wrap tab and change the Spacing distances. What you want is probably to set Top and Bottom to 0. But experiment to obtain the best looking result.

To show the community your question has been answered, click the ✓ next to the correct answer, and “upvote” by clicking on the ^ arrow of any helpful answers. These are the mechanisms for communicating the quality of the Q&A on this site. Thanks!

In case you need clarification, edit your question (not an answer) or comment the relevant answer.

1 Like

Many thanx, i already had those values at 0. With fixed line space seems to look better now.

Then maybe you composed your formula in size 12 pt while your text is 10 pt. Or also the font face in the formula has not the same base metrics as the text font, e.g.larger x-height or global line spacing. It is very difficult to mix different font families in the same line. Sometimes, even the italic variant of the font causes line spacing irregularities.

Gonna look into that, as a matter of fact that was another question I had (how to change the math font), but on that one i did find help online.

Airsalva,

Choose menu Format - Paragraph - Indents & Spacing tab. Below Line spacing select Fixed “of” and enter the value to use for the line spacing.

LibreOffice Help on Indents and Spacing is loosing some text, but con help.

@LeroyG: I would not recommend this method because you act upon the paragraph while the culprit is the formula. Forcing the line spacing may be forgotten later. Imagine you remove the formula and change the font face and font size. Your line spacing remains the same and you’ll wonder quite a long time to understand what’s happening.

Seems to work. Aji: noted the point (and sorry for confusing width with heght)

@ajlittoz if your formula is nroot{5}{2^3} it will take more vertical space than a normal line space for almost any font and font size you choose. A fixed line spacing is the only way to “solve” this problem (page register may give you even worst results, with text jumping a whole line), but you need to be careful your formula does not “collide” with the previous or following line(s). Most fonts use a default line spacing in the order of a 120% of the point size, but if you want to use lots of inline objects, you’ll need to pick a bigger line spacing… which it’s also a bit awkward. I prefer a variable line spacing :wink:

@RGB-es: Inserting inline math formulas leads to the kind of problems you mention. The example you give is typical. Formulas can’t be guaranteed to stay within the surrounding line spacing. This is why I prefer to leave the line spacing self-adapting yo prevent collision. The alternate solution, if there are not too many formulas (otherwise the document also looks awkward) it to lay out the formula in its own paragraph. This is easy: just change the anchor to To Paragraph and position it, e.g. horizontally centrered, vertically below the announcing paragraph, tuning wrap so that nothing is flown next to it.

Anyway math text is always breaking nice formatting.

So it seems both solutions, by ajlittoz and by RGB-es don’t really work. The issue described in the original message bothers me as well. I don’t use formulas, but I use inline code a lot, and it have the same line spacing problem. If you have 10-pt Liberation Mono word in 12-pt Liberation Serif paragraph, line spacing unwantedly increases. Actually, the problem is that both Writer and Word treat fixed line spacing in a conceptually wrong way: fixed line spacing should not “trim” characters that are too large for it (nor images or formulas inserted as characters!); this is how InDesign works, if you want to see this in action.

Write do not do that, although that is what is shown in the edit window and in the preview window; at least for me (LO 7.1.7.2).

Please note, we talk about fixed line spacing. With using Writer 7.1.5.2 on Windows, I have the following:

image

And this is the same how it worked for me for ages in both text processors, while in InDesign the word “large” will overlap lines above and below itself instead.

Yours is a screenshot from the edit window of Writer?

fixed line spacing

…on Windows 10.0 (x64).

EDIT: The next image is from the edit window.
fixed line spacing edit

1 Like

Yes, I use LibreOffice Writer, not Microsoft Word. Very strange. Maybe it was an improvement in the latest version (yours is 7.1.7.2, while mine is 7.1.5.2), but I don’t know for sure.

Edit: I missed that you talked about PDF. So yes, everything works the same for you and me. I don’t normally export documents to PDF.

Edit 2: With fixed line spacing, the upper horizonal line in nroot{5}{2^3} is still trimmed even in PDF.