How to use Math Variables amidst text in Writer?

Hi everyone,

I have been struggling to find a way of inserting small math objects (Inset>Object>Formula) in the middle of the text. I can do it, but a large space appears after and before the math object that ruins the document.

For example, when I present a new equation I have to explain in the text what the variables, and I want them to be the exact same format as they appear in the Equation box above. The problem is that they have a massive gap before and after the math object. How do I remove this gap?

Many thanks,
Zeca

I answer only now because the question crept to the top active questions due to an update.

Don’t know if you are still interested in a simple solution, but I had exactly the same concern and this is how I solved it (without dmath extension). Remember that an equation is just an object like any others.

  1. Insert your variable (or any equation) as a formula.
  2. Once you return to your main stream (in Writer after leaving Math), right-click the variable (or equation) and select Object... from the pop-up menu.
  3. Click on the Wrap tab. You can now set the spacing around the object. Since the variable is considered a character in the paragrah, you can adjust only the left and right spacings. Set them to 0 to get the effect of a “standard” glyph so that appended punctuations will have the traditional appearance.
  4. Click OK.

You are done.

If you find this answer useful, please tick its check mark at left and, why not, upvote it.

EDIT: Answer to @Zeca 's question in the comment below

Yes, this spacing can be made default. Formulas live in a frame with a style of their own: Formula. You can access this frame style in the FormatStyles and Formatting panel (or F11). Click on the middle (third) icon in the toolbar (frame styles). One of the styles is Formula. Right-click on it and select Modify....

If you need several different “styles” for your formulas (spacing, background colour, borders, …), create them with a right-click and New.... To style the formula, select it and double click on the required frame style name.

Doing so (multiple formula styles), you can take advantage of the “hierarchical styles” feature: modification of a property in the “master” style automatically propagates down in the hierarchy if it is not overridden in a lower style.

Thank you so much! It works like a charm. Is there a way of setting this Wrap settings to all Math objects subsequently created?

Once again, thanks for your edit. This solves the problem for inline equations.

Maybe a good feature request would be to set the Formula wrap spacing to zero by default? This would make the life of most users much easier

There are two things you need to change in order to reduce or even eliminate the space before and after a Math object.

  • Inside a Math object, go to Format → Spacing and select Border from the drop down menu Category. Now reduce the Left and Right values → press the Default button so any new Math object will use these values as default. NOTE: old objects will not be affected!
  • Open the Style and formatting editor and select Frame styles → right click on Formula → Modify → Wrap tab → reduce the Left and Right values. Now save that document as your default template.

Done.

1 Like

Attach an example demonstrating the issue, please. ( I will see for sufficient “karma”.)

If you want “to explain in the text … and I want them to be the exact same format as they appear in the Equation box” this will not work, I am afraid. The formula editor is using its chosen fonts, sizes, character styles … and will not communicate with the surrounding text about appearance.

Thanks,

Over time I found out that the only way to do it so far (version 5.2) is to install the dmath extension, then type the equation you want then select it and choose InsertFormula. After this process, you will be able to remove the extra space before and after the inline equation.

I did not actually expect to be able to help. Just wanted to make sure understanding you correctly. I do not know remedy in your case. I simply do not find the gaps huge and ugly in the same way as you obviously do. My own discontent with ‘Math’ under one major aspect you find described under this topic…No progress to date. Math seems orphaned.

My first perception of your question was you wanted to get the identical look when using a variable (e.g.) as part of the explaining text. This was what I called “impossible” first. (It may not be in a copmpletely strict sense).

‘’ I simply do not find the gaps huge and ugly in the same way as you obviously do. ‘’ Really? What about the gap between the t=9 and the fullstop? Is this acceptable in any book/article publication? This is s an issue that clearly needs sorting out!
Also I have seen your issue about the scalable brackets and I must agree with you, they don’t look good. t’s a shame that math does not see any measurable improvements over the years. When money is donated to the Document Foundation, the doners

should be able to choose which Libreoffice package they want to improve!

I did not feel obliged to excuse the bad spacing. It will not be acceptable under “high quality layout” standards. My use of ‘Math’ was mainly in teaching context. Requirements with this respect not extremely high.
Your dedicated donations will not work, I am afraid. My offer was not even commented by anybody.

‘‘Your dedicated donations will not work, I am afraid. My offer was not even commented by anybody.’’
Which offer have you made?

@Zeca : I thought you had visited this topic. My “answer” there is containing the offer.

Sorry I cannot find it

My answer is at the bottom of the mentioned topic presently. The announcement I am talking of starts with “Since I am still interested in promoting free software, …” (seventh line, third paragraph of the post).

Hey Lupp,

check out dmath addon for LO: Dmaths abholen

It was suggested by petermau (Any plans to fully integrate TexMaths/dmath with LibreOffice?)

This adds a lot of functionality to ‘Math’ and also seems to solve the problem with the inline equations we have discussed here

@Zeca: Thanks! I also found a hint concerning Dmaths somewhere else. Since I am retired though still interested, I have no longer truely urgent need concerning Math formulae. Now and then I work a bit on an old document. The rest is forum related.
One question: Will ‘Writer’ documents created using ‘Dmaths’ and opened by someone not having the extension installed show any formulae / drawings? Can a formula be edited (insufficiently) then?

I will check that later and let you know

Hi, I have checked and it seems to show formulae and drawings in a LO without dmaths installed. The inline equations also work in a LO without dmaths installed! So, yes you don’t need to have Dmaths installed to see the equations/drawings created using dmaths in another LO.