[Solved] Changing default spacing (Borders) around formula
[Solved] Changing default spacing (Borders) around formula
The spacing for a formula consists of spacing around the math object, and spacing (borders) inside the math object. Changing this is documented at
http://wiki.services.openoffice.org/wik ... formula%3F
Now, I want to remove the superfluous spacing from numerous formulae in a writer document. It seems to me that I'll have to adjust the spacing(borders) of all these formulae one by one by hand, but I have the nagging feeling I could be able to set some style parameter somewhere which avoids this chore. Am I overlooking something? But if I have to, is it possible to `paint' these properties to reduce this click-fest?
http://wiki.services.openoffice.org/wik ... formula%3F
Now, I want to remove the superfluous spacing from numerous formulae in a writer document. It seems to me that I'll have to adjust the spacing(borders) of all these formulae one by one by hand, but I have the nagging feeling I could be able to set some style parameter somewhere which avoids this chore. Am I overlooking something? But if I have to, is it possible to `paint' these properties to reduce this click-fest?
Last edited by martenjan on Thu Jan 13, 2011 10:57 am, edited 2 times in total.
OpenOffice 3.2.1 on Windows Vista
OpenOffice 3.2.1 on Ubuntu
OpenOffice 3.2.1 on Ubuntu
Re: Changing default spacing (Borders) around formula
Which superfluous spacing? According to that Wiki, you can reduce the external spacing for all formulas in one fell swoop, but it's very likely that if you want to adjust the internal spacing, you will have to do it for each formula (but when you have set the new spacing settings, maybe you only have to double click each formula for the new settings to take effect).
OpenOffice 4.1.11 on Ubuntu; LibreOffice 6.4 on Linux Mint, LibreOffice 7.6.2.1 on Ubuntu
If your problem has been solved or your question has been answered, please edit the first post in this thread and add [Solved] to the title bar.
Nederlandstalig forum
If your problem has been solved or your question has been answered, please edit the first post in this thread and add [Solved] to the title bar.
Nederlandstalig forum
Re: Changing default spacing (Borders) around formula
Both. I did reduce the external spacing with one fell swoop, and the internal spacing for all new formulae. But I did not know how to apply this automatically for the formulae I already have. By the way, with zero borders, results in a math box that clips part of the f. I worked around this by using . I think it is a bug, but this requires me to check whether the formula is rendered correctly after applying the zero border.
A double click does not apply the new settings, so the documentation is correct in saying that it only applies to new formulae.
Code: Select all
K u = f
Code: Select all
K u = f {}
A double click does not apply the new settings, so the documentation is correct in saying that it only applies to new formulae.
OpenOffice 3.2.1 on Windows Vista
OpenOffice 3.2.1 on Ubuntu
OpenOffice 3.2.1 on Ubuntu
Re: Changing default spacing (Borders) around formula
I suppose that a macro can do it - select each formula, get the formula code from it, delete the formula, insert a new one with the saved formula code. You can ask for help in the Macro and API forum
OpenOffice 4.1.11 on Ubuntu; LibreOffice 6.4 on Linux Mint, LibreOffice 7.6.2.1 on Ubuntu
If your problem has been solved or your question has been answered, please edit the first post in this thread and add [Solved] to the title bar.
Nederlandstalig forum
If your problem has been solved or your question has been answered, please edit the first post in this thread and add [Solved] to the title bar.
Nederlandstalig forum
Re: Changing default spacing (Borders) around formula
I believe someone (Hagar, IIRC) has already posted just such a macro. Try a search.
Hmm... maybe it was a macro to change all the formula font sizes. Sorry, I'm not 100% sure.
Hmm... maybe it was a macro to change all the formula font sizes. Sorry, I'm not 100% sure.
AOO4/LO5 • Linux • Fedora 23
Re: Changing default spacing (Borders) around formula
That wouldn't matter. A macro with a body to traverse through all formulas requiring only editing the action to be taken would be great.acknak wrote:I believe someone (Hagar, IIRC) has already posted just such a macro. Try a search.
Hmm... maybe it was a macro to change all the formula font sizes. Sorry, I'm not 100% sure.
It's my lucky day. Found the macro. This one is it.
Last edited by floris v on Wed Jan 12, 2011 7:05 pm, edited 2 times in total.
OpenOffice 4.1.11 on Ubuntu; LibreOffice 6.4 on Linux Mint, LibreOffice 7.6.2.1 on Ubuntu
If your problem has been solved or your question has been answered, please edit the first post in this thread and add [Solved] to the title bar.
Nederlandstalig forum
If your problem has been solved or your question has been answered, please edit the first post in this thread and add [Solved] to the title bar.
Nederlandstalig forum
- Hagar Delest
- Moderator
- Posts: 32662
- Joined: Sun Oct 07, 2007 9:07 pm
- Location: France
Re: Changing default spacing (Borders) around formula
Yes, someone has made a macro here but for the font.acknak wrote:Hmm... maybe it was a macro to change all the formula font sizes. Sorry, I'm not 100% sure.
LibreOffice 7.6.2.1 on Xubuntu 23.10 and 7.6.4.1 portable on Windows 10
Re: Changing default spacing (Borders) around formula
Instead of the font specs you have to set the LeftMargin, Rightmargin, TopMargin and BottomMargin (Wiki)
Edited after debugging
Code: Select all
Sub mathmargins
dim embeddedObjects, elementNames, i, element
embeddedObjects = ThisComponent.getEmbeddedObjects()
elementNames = embeddedObjects.getElementNames()
for i=0 to UBOUND(elementNames)
element = embeddedObjects.getByName(elementNames(i)).Model
if (element.supportsService("com.sun.star.formula.FormulaProperties")) then
element.TopMargin = 30 : sets to 0.30 mm
element.BottomMargin = 30
element.LeftMargin = 30
element.RightMargin = 30
endif
next i
ThisComponent.reformat()
End Sub
OpenOffice 4.1.11 on Ubuntu; LibreOffice 6.4 on Linux Mint, LibreOffice 7.6.2.1 on Ubuntu
If your problem has been solved or your question has been answered, please edit the first post in this thread and add [Solved] to the title bar.
Nederlandstalig forum
If your problem has been solved or your question has been answered, please edit the first post in this thread and add [Solved] to the title bar.
Nederlandstalig forum
Re: Changing default spacing (Borders) around formula
This looks promising. After insertion of rem to correct the syntax error in the line with TopMargin, the macro runs as intended (although I used zero margins instead of 30). Thanks!
Code: Select all
Sub MathMargin
dim embeddedObjects, elementNames, i, element
embeddedObjects = ThisComponent.getEmbeddedObjects()
elementNames = embeddedObjects.getElementNames()
for i=0 to UBOUND(elementNames)
element = embeddedObjects.getByName(elementNames(i)).Model
if (element.supportsService("com.sun.star.formula.FormulaProperties")) then
element.TopMargin = 30 : rem sets to 0.30 mm
element.BottomMargin = 30
element.LeftMargin = 30
element.RightMargin = 30
endif
next i
ThisComponent.reformat()
End Sub
OpenOffice 3.2.1 on Windows Vista
OpenOffice 3.2.1 on Ubuntu
OpenOffice 3.2.1 on Ubuntu
Re: Changing default spacing (Borders) around formula
To preserve this for the next fellow running into this, I added this to http://wiki.services.openoffice.org/wik ... formula%3F. With that I consider my question solved.
OpenOffice 3.2.1 on Windows Vista
OpenOffice 3.2.1 on Ubuntu
OpenOffice 3.2.1 on Ubuntu